From 4d44b1843e25f045f4251e521c23c80ada77bd35 Mon Sep 17 00:00:00 2001 From: Sukchan Lee Date: Wed, 1 Mar 2023 19:56:49 +0900 Subject: [PATCH] [Release-17] Upgrade SBI to v17.x.0 --- lib/sbi/nnrf-build.c | 6 +- lib/sbi/nnrf-handler.c | 2 +- lib/sbi/openapi/meson.build | 740 +++++-- lib/sbi/openapi/model/aanf_info.c | 141 ++ lib/sbi/openapi/model/aanf_info.h | 38 + lib/sbi/openapi/model/abnormal_behaviour.c | 305 +++ lib/sbi/openapi/model/abnormal_behaviour.h | 57 + lib/sbi/openapi/model/acc_net_ch_id.c | 37 +- lib/sbi/openapi/model/acc_net_ch_id.h | 6 +- .../openapi/model/access_and_mobility_data.c | 58 +- .../openapi/model/access_and_mobility_data.h | 6 +- .../access_and_mobility_subscription_data.c | 273 ++- .../access_and_mobility_subscription_data.h | 35 +- .../access_and_mobility_subscription_data_1.c | 273 ++- .../access_and_mobility_subscription_data_1.h | 35 +- .../model/access_net_charging_identifier.c | 37 +- .../model/access_net_charging_identifier.h | 4 + lib/sbi/openapi/model/access_right_status.h | 2 +- lib/sbi/openapi/model/access_tech.h | 2 +- lib/sbi/openapi/model/access_token_req.c | 81 +- lib/sbi/openapi/model/access_token_req.h | 8 +- lib/sbi/openapi/model/access_type.h | 2 +- lib/sbi/openapi/model/access_type_rm.h | 2 +- lib/sbi/openapi/model/accu_usage_report.h | 2 +- lib/sbi/openapi/model/accumulated_usage.h | 2 +- lib/sbi/openapi/model/accuracy.c | 87 + lib/sbi/openapi/model/accuracy.h | 37 + lib/sbi/openapi/model/accuracy_any_of.c | 30 + lib/sbi/openapi/model/accuracy_any_of.h | 31 + lib/sbi/openapi/model/acknowledge_info.c | 73 +- lib/sbi/openapi/model/acknowledge_info.h | 8 +- lib/sbi/openapi/model/acs_info.h | 2 +- lib/sbi/openapi/model/acs_info_1.h | 2 +- lib/sbi/openapi/model/acs_info_rm.h | 2 +- .../openapi/model/additional_access_info.h | 2 +- .../openapi/model/additional_ee_subs_info.c | 209 ++ .../openapi/model/additional_ee_subs_info.h | 45 + .../openapi/model/additional_measurement.c | 345 +++ .../openapi/model/additional_measurement.h | 52 + .../openapi/model/additional_snssai_data.c | 89 +- .../openapi/model/additional_snssai_data.h | 7 +- .../openapi/model/additional_snssai_data_1.c | 194 ++ .../openapi/model/additional_snssai_data_1.h | 45 + lib/sbi/openapi/model/addr_fqdn.c | 141 ++ lib/sbi/openapi/model/addr_fqdn.h | 41 + lib/sbi/openapi/model/address_list.c | 195 ++ lib/sbi/openapi/model/address_list.h | 40 + lib/sbi/openapi/model/aerial_ue_indication.c | 30 + lib/sbi/openapi/model/aerial_ue_indication.h | 31 + .../model/aerial_ue_subscription_info.c | 135 ++ .../model/aerial_ue_subscription_info.h | 41 + .../model/aerial_ue_subscription_info_1.c | 135 ++ .../model/aerial_ue_subscription_info_1.h | 41 + lib/sbi/openapi/model/af_coordination_info.c | 216 ++ lib/sbi/openapi/model/af_coordination_info.h | 45 + lib/sbi/openapi/model/af_event.c | 4 +- lib/sbi/openapi/model/af_event.h | 2 +- lib/sbi/openapi/model/af_event_notification.h | 2 +- lib/sbi/openapi/model/af_event_subscription.h | 2 +- .../openapi/model/af_routing_requirement.c | 152 +- .../openapi/model/af_routing_requirement.h | 23 +- .../openapi/model/af_routing_requirement_rm.c | 152 +- .../openapi/model/af_routing_requirement_rm.h | 23 +- lib/sbi/openapi/model/allowed_nssai.h | 2 +- lib/sbi/openapi/model/allowed_snssai.h | 2 +- .../openapi/model/alternative_qos_profile.h | 2 +- .../alternative_service_requirements_data.c | 182 ++ .../alternative_service_requirements_data.h | 46 + lib/sbi/openapi/model/am_influ_data.c | 633 ++++++ lib/sbi/openapi/model/am_influ_data.h | 75 + lib/sbi/openapi/model/am_influ_event.c | 87 + lib/sbi/openapi/model/am_influ_event.h | 37 + lib/sbi/openapi/model/am_influ_event_any_of.c | 30 + lib/sbi/openapi/model/am_influ_event_any_of.h | 31 + .../openapi/model/am_requested_value_rep.c | 403 ++++ .../openapi/model/am_requested_value_rep.h | 53 + lib/sbi/openapi/model/ambr.h | 2 +- lib/sbi/openapi/model/ambr_1.h | 2 +- lib/sbi/openapi/model/ambr_rm.h | 2 +- .../model/amf3_gpp_access_registration.c | 279 ++- .../model/amf3_gpp_access_registration.h | 39 +- ...mf3_gpp_access_registration_modification.c | 26 +- ...mf3_gpp_access_registration_modification.h | 6 +- lib/sbi/openapi/model/amf_event.c | 319 ++- lib/sbi/openapi/model/amf_event.h | 33 +- lib/sbi/openapi/model/amf_event_area.h | 2 +- lib/sbi/openapi/model/amf_event_mode.c | 71 +- lib/sbi/openapi/model/amf_event_mode.h | 10 +- .../openapi/model/amf_event_subscription.c | 216 ++ .../openapi/model/amf_event_subscription.h | 10 +- .../model/amf_event_subscription_add_info.c | 153 +- .../model/amf_event_subscription_add_info.h | 13 +- lib/sbi/openapi/model/amf_event_trigger.h | 2 +- lib/sbi/openapi/model/amf_event_type.h | 2 +- lib/sbi/openapi/model/amf_event_type_any_of.c | 4 +- lib/sbi/openapi/model/amf_event_type_any_of.h | 2 +- lib/sbi/openapi/model/amf_info.c | 26 +- lib/sbi/openapi/model/amf_info.h | 6 +- .../model/amf_non3_gpp_access_registration.c | 214 +- .../model/amf_non3_gpp_access_registration.h | 28 +- .../model/amf_status_change_notification.h | 2 +- .../amf_status_change_subscription_data.c | 174 -- .../amf_status_change_subscription_data.h | 41 - lib/sbi/openapi/model/amf_status_info.h | 2 +- lib/sbi/openapi/model/amf_subscription_info.c | 35 +- lib/sbi/openapi/model/amf_subscription_info.h | 7 +- lib/sbi/openapi/model/an_gw_address.h | 2 +- lib/sbi/openapi/model/analytics_metadata.c | 87 + lib/sbi/openapi/model/analytics_metadata.h | 37 + .../openapi/model/analytics_metadata_any_of.c | 30 + .../openapi/model/analytics_metadata_any_of.h | 31 + .../model/analytics_metadata_indication.c | 263 +++ .../model/analytics_metadata_indication.h | 47 + .../openapi/model/analytics_metadata_info.c | 262 +++ .../openapi/model/analytics_metadata_info.h | 52 + .../openapi/model/analytics_subscription.c | 197 ++ .../openapi/model/analytics_subscription.h | 43 + lib/sbi/openapi/model/analytics_subset.c | 87 + lib/sbi/openapi/model/analytics_subset.h | 37 + .../openapi/model/analytics_subset_any_of.c | 30 + .../openapi/model/analytics_subset_any_of.h | 31 + lib/sbi/openapi/model/anchor_smf_features.c | 109 + lib/sbi/openapi/model/anchor_smf_features.h | 40 + lib/sbi/openapi/model/apn_rate_status.h | 2 +- lib/sbi/openapi/model/app_descriptor_1.c | 185 ++ lib/sbi/openapi/model/app_descriptor_1.h | 40 + lib/sbi/openapi/model/app_detection_info.h | 2 +- .../openapi/model/app_detection_notif_type.c | 30 + .../openapi/model/app_detection_notif_type.h | 31 + lib/sbi/openapi/model/app_detection_report.c | 139 ++ lib/sbi/openapi/model/app_detection_report.h | 41 + lib/sbi/openapi/model/app_list_for_ue_comm.c | 212 ++ lib/sbi/openapi/model/app_list_for_ue_comm.h | 51 + .../model/app_session_context_req_data.c | 21 + .../model/app_session_context_req_data.h | 3 + .../model/app_session_context_update_data.c | 21 + .../model/app_session_context_update_data.h | 5 +- .../model/application_data_change_notif.c | 35 +- .../model/application_data_change_notif.h | 5 +- lib/sbi/openapi/model/application_data_subs.c | 140 +- lib/sbi/openapi/model/application_data_subs.h | 11 +- lib/sbi/openapi/model/application_volume.c | 134 ++ lib/sbi/openapi/model/application_volume.h | 40 + lib/sbi/openapi/model/area.h | 2 +- lib/sbi/openapi/model/area_1.h | 2 +- .../model/area_of_interest_event_state.c | 166 ++ .../model/area_of_interest_event_state.h | 41 + lib/sbi/openapi/model/area_of_validity.h | 2 +- lib/sbi/openapi/model/area_scope.h | 2 +- lib/sbi/openapi/model/arp.h | 2 +- lib/sbi/openapi/model/arp_1.h | 2 +- .../model/as_time_distribution_param.c | 131 ++ .../model/as_time_distribution_param.h | 44 + lib/sbi/openapi/model/assign_ebi_data.c | 64 +- lib/sbi/openapi/model/assign_ebi_data.h | 7 +- lib/sbi/openapi/model/assign_ebi_error.h | 2 +- lib/sbi/openapi/model/assign_ebi_failed.h | 2 +- lib/sbi/openapi/model/assigned_ebi_data.c | 64 +- lib/sbi/openapi/model/assigned_ebi_data.h | 6 +- lib/sbi/openapi/model/atom.c | 24 +- lib/sbi/openapi/model/atom.h | 7 +- lib/sbi/openapi/model/atsss_capability.h | 2 +- .../openapi/model/atsss_capability_any_of.c | 30 - .../openapi/model/atsss_capability_any_of.h | 31 - lib/sbi/openapi/model/ausf_info.c | 64 +- lib/sbi/openapi/model/ausf_info.h | 5 +- lib/sbi/openapi/model/auth_event.c | 81 +- lib/sbi/openapi/model/auth_event.h | 6 +- lib/sbi/openapi/model/auth_method.c | 4 +- lib/sbi/openapi/model/auth_method.h | 2 +- lib/sbi/openapi/model/auth_result.h | 2 +- lib/sbi/openapi/model/auth_type.c | 4 +- lib/sbi/openapi/model/auth_type.h | 2 +- lib/sbi/openapi/model/authentication_info.c | 70 +- lib/sbi/openapi/model/authentication_info.h | 16 +- .../model/authentication_info_request.c | 48 +- .../model/authentication_info_request.h | 10 +- .../model/authentication_info_result.c | 131 +- .../model/authentication_info_result.h | 15 +- .../model/authentication_subscription.c | 72 +- .../model/authentication_subscription.h | 12 +- lib/sbi/openapi/model/authorization_data.c | 176 +- lib/sbi/openapi/model/authorization_data.h | 15 +- lib/sbi/openapi/model/authorization_info.c | 303 +++ lib/sbi/openapi/model/authorization_info.h | 54 + .../openapi/model/authorized_default_qos.h | 2 +- .../model/authorized_network_slice_info.c | 197 +- .../model/authorized_network_slice_info.h | 11 +- lib/sbi/openapi/model/av5g_aka.h | 2 +- lib/sbi/openapi/model/backup_amf_info.h | 2 +- lib/sbi/openapi/model/battery_indication.h | 2 +- lib/sbi/openapi/model/battery_indication_rm.h | 2 +- lib/sbi/openapi/model/bdt_data.c | 70 +- lib/sbi/openapi/model/bdt_data.h | 10 +- lib/sbi/openapi/model/bdt_policy_data.c | 58 +- lib/sbi/openapi/model/bdt_policy_data.h | 6 +- lib/sbi/openapi/model/bdt_policy_data_patch.h | 2 +- lib/sbi/openapi/model/binding_resp.h | 2 +- .../model/bridge_management_container.h | 2 +- lib/sbi/openapi/model/bsf_event.c | 30 + lib/sbi/openapi/model/bsf_event.h | 31 + .../openapi/model/bsf_event_notification.c | 263 +++ .../openapi/model/bsf_event_notification.h | 48 + lib/sbi/openapi/model/bsf_info.c | 193 +- lib/sbi/openapi/model/bsf_info.h | 14 +- lib/sbi/openapi/model/bsf_notification.c | 245 +++ lib/sbi/openapi/model/bsf_notification.h | 48 + lib/sbi/openapi/model/bsf_subscription.c | 355 +++ lib/sbi/openapi/model/bsf_subscription.h | 54 + lib/sbi/openapi/model/bsf_subscription_resp.c | 486 ++++ lib/sbi/openapi/model/bsf_subscription_resp.h | 66 + lib/sbi/openapi/model/bw_requirement.c | 206 ++ lib/sbi/openapi/model/bw_requirement.h | 46 + lib/sbi/openapi/model/cag_ack_data.h | 2 +- .../openapi/model/candidate_for_replacement.h | 2 +- lib/sbi/openapi/model/cause.c | 4 +- lib/sbi/openapi/model/cause.h | 2 +- lib/sbi/openapi/model/cell_global_id.c | 176 ++ lib/sbi/openapi/model/cell_global_id.h | 43 + lib/sbi/openapi/model/change_item.h | 2 +- lib/sbi/openapi/model/charging_data.h | 2 +- lib/sbi/openapi/model/charging_information.c | 14 +- lib/sbi/openapi/model/charging_information.h | 2 +- .../openapi/model/circumstance_description.c | 185 ++ .../openapi/model/circumstance_description.h | 49 + lib/sbi/openapi/model/civic_address.h | 2 +- lib/sbi/openapi/model/class_criterion.c | 177 ++ lib/sbi/openapi/model/class_criterion.h | 44 + lib/sbi/openapi/model/cm_info.h | 2 +- lib/sbi/openapi/model/cm_state.h | 2 +- lib/sbi/openapi/model/cn_assisted_ran_para.h | 2 +- lib/sbi/openapi/model/cnf.h | 2 +- lib/sbi/openapi/model/cnf_unit.h | 2 +- .../openapi/model/collocated_nf_instance.c | 139 ++ .../openapi/model/collocated_nf_instance.h | 41 + lib/sbi/openapi/model/collocated_nf_type.c | 30 + lib/sbi/openapi/model/collocated_nf_type.h | 31 + .../model/communication_characteristics_af.c | 153 ++ .../model/communication_characteristics_af.h | 48 + lib/sbi/openapi/model/complex_query.h | 2 +- lib/sbi/openapi/model/condition_data.h | 2 +- lib/sbi/openapi/model/configured_snssai.h | 2 +- lib/sbi/openapi/model/confirmation_data.h | 2 +- .../model/confirmation_data_response.c | 64 +- .../model/confirmation_data_response.h | 7 +- lib/sbi/openapi/model/congestion_info.c | 334 +++ lib/sbi/openapi/model/congestion_info.h | 54 + lib/sbi/openapi/model/congestion_type.c | 87 + lib/sbi/openapi/model/congestion_type.h | 37 + .../openapi/model/congestion_type_any_of.c | 30 + .../openapi/model/congestion_type_any_of.h | 31 + .../openapi/model/connection_capabilities.c | 87 + .../openapi/model/connection_capabilities.h | 37 + .../model/connection_capabilities_any_of.c | 30 + .../model/connection_capabilities_any_of.h | 31 + .../openapi/model/consumer_nf_information.c | 193 ++ .../openapi/model/consumer_nf_information.h | 43 + lib/sbi/openapi/model/context_data_set_name.c | 4 +- lib/sbi/openapi/model/context_data_set_name.h | 2 +- lib/sbi/openapi/model/context_data_sets.c | 66 +- lib/sbi/openapi/model/context_data_sets.h | 10 +- lib/sbi/openapi/model/context_info.c | 58 +- lib/sbi/openapi/model/context_info.h | 4 +- .../openapi/model/create_ue_context_request.c | 37 +- .../openapi/model/create_ue_context_request.h | 4 +- lib/sbi/openapi/model/data_change_notify.h | 2 +- lib/sbi/openapi/model/data_filter.c | 86 +- lib/sbi/openapi/model/data_filter.h | 9 +- lib/sbi/openapi/model/data_ind.h | 2 +- lib/sbi/openapi/model/data_ind_any_of.c | 4 +- lib/sbi/openapi/model/data_ind_any_of.h | 2 +- .../model/data_restoration_notification.c | 475 ++++ .../model/data_restoration_notification.h | 58 + lib/sbi/openapi/model/data_set_id.c | 4 +- lib/sbi/openapi/model/data_set_id.h | 2 +- lib/sbi/openapi/model/data_set_name.c | 4 +- lib/sbi/openapi/model/data_set_name.h | 2 +- .../datalink_reporting_configuration_1.c | 247 +++ .../datalink_reporting_configuration_1.h | 47 + .../model/dataset_statistical_property.c | 87 + .../model/dataset_statistical_property.h | 37 + .../dataset_statistical_property_any_of.c | 30 + .../dataset_statistical_property_any_of.h | 31 + lib/sbi/openapi/model/dccf_cond.c | 355 +++ lib/sbi/openapi/model/dccf_cond.h | 54 + lib/sbi/openapi/model/dccf_info.c | 307 +++ lib/sbi/openapi/model/dccf_info.h | 47 + .../openapi/model/ddd_traffic_descriptor.h | 2 +- .../openapi/model/ddd_traffic_descriptor_1.c | 178 ++ .../openapi/model/ddd_traffic_descriptor_1.h | 46 + lib/sbi/openapi/model/ddn_failure_sub_info.h | 2 +- lib/sbi/openapi/model/ddn_failure_subs.h | 2 +- lib/sbi/openapi/model/def_sub_service_info.c | 164 ++ lib/sbi/openapi/model/def_sub_service_info.h | 40 + .../model/default_notification_subscription.c | 123 +- .../model/default_notification_subscription.h | 11 +- .../openapi/model/default_unrelated_class_1.c | 274 --- .../openapi/model/default_unrelated_class_1.h | 50 - lib/sbi/openapi/model/deregistration_info.h | 2 +- lib/sbi/openapi/model/deregistration_reason.c | 4 +- lib/sbi/openapi/model/deregistration_reason.h | 2 +- lib/sbi/openapi/model/dispersion_area.c | 289 +++ lib/sbi/openapi/model/dispersion_area.h | 49 + lib/sbi/openapi/model/dispersion_class.c | 87 + lib/sbi/openapi/model/dispersion_class.h | 37 + .../openapi/model/dispersion_class_one_of.c | 30 + .../openapi/model/dispersion_class_one_of.h | 31 + lib/sbi/openapi/model/dispersion_collection.c | 458 ++++ lib/sbi/openapi/model/dispersion_collection.h | 72 + lib/sbi/openapi/model/dispersion_info.c | 233 ++ lib/sbi/openapi/model/dispersion_info.h | 46 + .../model/dispersion_ordering_criterion.c | 87 + .../model/dispersion_ordering_criterion.h | 37 + .../dispersion_ordering_criterion_any_of.c | 30 + .../dispersion_ordering_criterion_any_of.h | 31 + .../openapi/model/dispersion_requirement.c | 304 +++ .../openapi/model/dispersion_requirement.h | 51 + lib/sbi/openapi/model/dispersion_type.c | 87 + lib/sbi/openapi/model/dispersion_type.h | 37 + .../openapi/model/dispersion_type_one_of.c | 30 + .../openapi/model/dispersion_type_one_of.h | 31 + lib/sbi/openapi/model/dn_perf.c | 269 +++ lib/sbi/openapi/model/dn_perf.h | 53 + lib/sbi/openapi/model/dn_perf_info.c | 250 +++ lib/sbi/openapi/model/dn_perf_info.h | 50 + .../model/dn_perf_ordering_criterion.c | 87 + .../model/dn_perf_ordering_criterion.h | 37 + .../model/dn_perf_ordering_criterion_any_of.c | 30 + .../model/dn_perf_ordering_criterion_any_of.h | 31 + lib/sbi/openapi/model/dn_performance_req.c | 209 ++ lib/sbi/openapi/model/dn_performance_req.h | 45 + lib/sbi/openapi/model/dnai_information.h | 2 +- lib/sbi/openapi/model/dnf.h | 2 +- lib/sbi/openapi/model/dnf_unit.h | 2 +- lib/sbi/openapi/model/dnn_configuration.c | 426 +++- lib/sbi/openapi/model/dnn_configuration.h | 39 +- lib/sbi/openapi/model/dnn_configuration_1.c | 426 +++- lib/sbi/openapi/model/dnn_configuration_1.h | 39 +- lib/sbi/openapi/model/dnn_easdf_info_item.c | 168 ++ lib/sbi/openapi/model/dnn_easdf_info_item.h | 40 + lib/sbi/openapi/model/dnn_info_item.c | 114 + lib/sbi/openapi/model/dnn_info_item.h | 38 + lib/sbi/openapi/model/dnn_mb_smf_info_item.c | 114 + lib/sbi/openapi/model/dnn_mb_smf_info_item.h | 38 + .../model/dnn_route_selection_descriptor.h | 2 +- lib/sbi/openapi/model/dnn_smf_info_item.c | 64 +- lib/sbi/openapi/model/dnn_smf_info_item.h | 5 +- .../model/dnn_smf_info_item_dnai_list_inner.c | 87 + .../model/dnn_smf_info_item_dnai_list_inner.h | 36 + .../openapi/model/dnn_snssai_information.c | 141 ++ .../openapi/model/dnn_snssai_information.h | 41 + lib/sbi/openapi/model/dnn_tsctsf_info_item.c | 114 + lib/sbi/openapi/model/dnn_tsctsf_info_item.h | 38 + lib/sbi/openapi/model/dnn_upf_info_item.c | 120 + lib/sbi/openapi/model/dnn_upf_info_item.h | 5 + .../downlink_data_notification_control_rm.h | 2 +- lib/sbi/openapi/model/dynamic5_qi.h | 2 +- lib/sbi/openapi/model/eap_session.c | 87 +- lib/sbi/openapi/model/eap_session.h | 9 +- .../openapi/model/eas_ip_replacement_info.c | 157 ++ .../openapi/model/eas_ip_replacement_info.h | 41 + lib/sbi/openapi/model/eas_server_address.c | 142 ++ lib/sbi/openapi/model/eas_server_address.h | 41 + lib/sbi/openapi/model/easdf_info.c | 267 +++ lib/sbi/openapi/model/easdf_info.h | 44 + lib/sbi/openapi/model/ebi_arp_mapping.h | 2 +- lib/sbi/openapi/model/ec_restriction_1.c | 217 ++ lib/sbi/openapi/model/ec_restriction_1.h | 45 + .../openapi/model/ec_restriction_data_wb.h | 2 +- lib/sbi/openapi/model/ecgi.h | 2 +- lib/sbi/openapi/model/ecgi_1.h | 2 +- lib/sbi/openapi/model/ecs_addr_config_info.c | 149 ++ lib/sbi/openapi/model/ecs_addr_config_info.h | 42 + .../openapi/model/ecs_addr_config_info_1.c | 149 ++ .../openapi/model/ecs_addr_config_info_1.h | 42 + lib/sbi/openapi/model/ecs_server_addr.c | 278 +++ lib/sbi/openapi/model/ecs_server_addr.h | 45 + lib/sbi/openapi/model/ee_group_profile_data.c | 72 +- lib/sbi/openapi/model/ee_group_profile_data.h | 10 +- lib/sbi/openapi/model/ee_profile_data.c | 72 +- lib/sbi/openapi/model/ee_profile_data.h | 12 +- lib/sbi/openapi/model/ee_subscription.c | 181 +- lib/sbi/openapi/model/ee_subscription.h | 12 +- lib/sbi/openapi/model/ee_subscription_1.c | 567 +++++ lib/sbi/openapi/model/ee_subscription_1.h | 71 + lib/sbi/openapi/model/ee_subscription_ext.c | 689 ++++++ lib/sbi/openapi/model/ee_subscription_ext.h | 80 + lib/sbi/openapi/model/ellipsoid_arc.h | 2 +- lib/sbi/openapi/model/emergency_info.c | 35 +- lib/sbi/openapi/model/emergency_info.h | 5 +- lib/sbi/openapi/model/emergency_info_1.c | 186 -- lib/sbi/openapi/model/emergency_info_1.h | 47 - lib/sbi/openapi/model/eps_bearer_info.h | 2 +- lib/sbi/openapi/model/eps_iwk_pgw.c | 35 +- lib/sbi/openapi/model/eps_iwk_pgw.h | 5 +- lib/sbi/openapi/model/eps_nas_security_mode.h | 2 +- lib/sbi/openapi/model/eps_pdn_cnx_info.h | 2 +- lib/sbi/openapi/model/error_report.c | 69 +- lib/sbi/openapi/model/error_report.h | 7 +- lib/sbi/openapi/model/eth_flow_description.h | 2 +- lib/sbi/openapi/model/eutra_location.h | 2 +- lib/sbi/openapi/model/event.c | 87 + lib/sbi/openapi/model/event.h | 37 + lib/sbi/openapi/model/event_any_of.c | 30 + lib/sbi/openapi/model/event_any_of.h | 31 + lib/sbi/openapi/model/event_id.h | 2 +- lib/sbi/openapi/model/event_id_any_of.c | 4 +- lib/sbi/openapi/model/event_id_any_of.h | 2 +- lib/sbi/openapi/model/event_notification.c | 1146 ++++++++++ lib/sbi/openapi/model/event_notification.h | 100 + .../model/event_reporting_requirement.c | 426 ++++ .../model/event_reporting_requirement.h | 69 + lib/sbi/openapi/model/event_subscription.c | 1955 +++++++++++++++++ lib/sbi/openapi/model/event_subscription.h | 151 ++ lib/sbi/openapi/model/event_type_any_of.c | 4 +- lib/sbi/openapi/model/event_type_any_of.h | 2 +- lib/sbi/openapi/model/events_notification.c | 104 + lib/sbi/openapi/model/events_notification.h | 10 +- lib/sbi/openapi/model/events_subsc_put_data.c | 180 ++ lib/sbi/openapi/model/events_subsc_put_data.h | 16 +- lib/sbi/openapi/model/events_subsc_req_data.c | 80 +- lib/sbi/openapi/model/events_subsc_req_data.h | 8 +- .../openapi/model/events_subsc_req_data_rm.c | 26 +- .../openapi/model/events_subsc_req_data_rm.h | 8 +- lib/sbi/openapi/model/exception.c | 175 ++ lib/sbi/openapi/model/exception.h | 46 + lib/sbi/openapi/model/exception_id.c | 87 + lib/sbi/openapi/model/exception_id.h | 37 + lib/sbi/openapi/model/exception_id_any_of.c | 30 + lib/sbi/openapi/model/exception_id_any_of.h | 31 + lib/sbi/openapi/model/exception_trend.c | 87 + lib/sbi/openapi/model/exception_trend.h | 37 + .../openapi/model/exception_trend_any_of.c | 30 + .../openapi/model/exception_trend_any_of.h | 31 + lib/sbi/openapi/model/exemption_ind.h | 2 +- .../openapi/model/expected_analytics_type.c | 87 + .../openapi/model/expected_analytics_type.h | 37 + .../model/expected_analytics_type_any_of.c | 30 + .../model/expected_analytics_type_any_of.h | 31 + lib/sbi/openapi/model/expected_ue_behavior.h | 2 +- .../model/exposure_data_change_notification.h | 2 +- .../model/exposure_data_subscription.c | 58 +- .../model/exposure_data_subscription.h | 6 +- .../model/ext_amf_event_subscription.c | 369 +++- .../model/ext_amf_event_subscription.h | 21 +- lib/sbi/openapi/model/ext_problem_details.h | 2 +- lib/sbi/openapi/model/ext_snssai.c | 38 +- lib/sbi/openapi/model/ext_snssai.h | 13 +- lib/sbi/openapi/model/extended_sm_subs_data.c | 205 ++ lib/sbi/openapi/model/extended_sm_subs_data.h | 41 + lib/sbi/openapi/model/external_client_type.h | 2 +- lib/sbi/openapi/model/failure_code.c | 4 +- lib/sbi/openapi/model/failure_code.h | 2 +- lib/sbi/openapi/model/failure_event_info.c | 157 ++ lib/sbi/openapi/model/failure_event_info.h | 42 + lib/sbi/openapi/model/flow_direction_rm.c | 87 + lib/sbi/openapi/model/flow_direction_rm.h | 38 + lib/sbi/openapi/model/flow_info.h | 2 +- lib/sbi/openapi/model/flow_information.h | 2 +- lib/sbi/openapi/model/flows.h | 2 +- lib/sbi/openapi/model/fqdn_rm.c | 87 + lib/sbi/openapi/model/fqdn_rm.h | 37 + lib/sbi/openapi/model/gad_shape.h | 2 +- lib/sbi/openapi/model/gba_auth_type.c | 30 + lib/sbi/openapi/model/gba_auth_type.h | 31 + .../model/gba_authentication_info_request.c | 166 ++ .../model/gba_authentication_info_request.h | 44 + .../model/gba_authentication_info_result.c | 141 ++ .../model/gba_authentication_info_result.h | 41 + .../openapi/model/gbr_qos_flow_information.h | 2 +- lib/sbi/openapi/model/geo_service_area.c | 207 ++ lib/sbi/openapi/model/geo_service_area.h | 42 + lib/sbi/openapi/model/geo_service_area_1.c | 207 ++ lib/sbi/openapi/model/geo_service_area_1.h | 42 + lib/sbi/openapi/model/geographic_area.h | 2 +- lib/sbi/openapi/model/geographical_area.c | 149 ++ lib/sbi/openapi/model/geographical_area.h | 42 + .../openapi/model/geographical_coordinates.h | 2 +- lib/sbi/openapi/model/gera_location.c | 371 ++++ lib/sbi/openapi/model/gera_location.h | 64 + ...multiple_pp_data_entries_ue_id_parameter.c | 87 + ...multiple_pp_data_entries_ue_id_parameter.h | 36 + .../model/get_nf_instances_200_response.h | 39 - lib/sbi/openapi/model/global_ran_node_id.h | 2 +- lib/sbi/openapi/model/global_ran_node_id_1.h | 2 +- lib/sbi/openapi/model/gmlc_info.c | 58 +- lib/sbi/openapi/model/gmlc_info.h | 4 +- lib/sbi/openapi/model/gnb_id.h | 2 +- lib/sbi/openapi/model/gpsi_type.c | 30 + lib/sbi/openapi/model/gpsi_type.h | 31 + lib/sbi/openapi/model/guami.h | 2 +- lib/sbi/openapi/model/hfc_node_id.h | 2 +- lib/sbi/openapi/model/hsmf_update_data.c | 217 +- lib/sbi/openapi/model/hsmf_update_data.h | 27 +- lib/sbi/openapi/model/hsmf_update_error.h | 2 +- lib/sbi/openapi/model/hsmf_updated_data.c | 73 +- lib/sbi/openapi/model/hsmf_updated_data.h | 10 +- lib/sbi/openapi/model/hss_info.c | 95 +- lib/sbi/openapi/model/hss_info.h | 7 +- lib/sbi/openapi/model/hss_subscription_info.c | 151 ++ lib/sbi/openapi/model/hss_subscription_info.h | 39 + lib/sbi/openapi/model/hss_subscription_item.c | 172 ++ lib/sbi/openapi/model/hss_subscription_item.h | 43 + lib/sbi/openapi/model/id_translation_result.c | 112 +- lib/sbi/openapi/model/id_translation_result.h | 6 +- lib/sbi/openapi/model/identity_data.c | 125 +- lib/sbi/openapi/model/identity_data.h | 8 +- lib/sbi/openapi/model/identity_range.h | 2 +- lib/sbi/openapi/model/immediate_mdt_conf.h | 2 +- lib/sbi/openapi/model/immediate_report.c | 583 +++++ lib/sbi/openapi/model/immediate_report.h | 86 + lib/sbi/openapi/model/imsi_range.h | 2 +- .../indirect_data_forwarding_tunnel_info.h | 2 +- .../openapi/model/inter_freq_target_info.h | 2 +- .../openapi/model/inter_freq_target_info_1.h | 2 +- .../openapi/model/internal_group_id_range.h | 2 +- lib/sbi/openapi/model/invalid_param.h | 2 +- lib/sbi/openapi/model/invalid_param_1.c | 137 -- lib/sbi/openapi/model/invalid_param_1.h | 40 - lib/sbi/openapi/model/ip_addr.c | 156 ++ lib/sbi/openapi/model/ip_addr.h | 42 + lib/sbi/openapi/model/ip_addr_1.c | 156 ++ lib/sbi/openapi/model/ip_addr_1.h | 42 + lib/sbi/openapi/model/ip_end_point.h | 2 +- .../openapi/model/ip_eth_flow_description.c | 141 ++ .../openapi/model/ip_eth_flow_description.h | 41 + lib/sbi/openapi/model/ip_index.c | 87 + lib/sbi/openapi/model/ip_index.h | 36 + .../openapi/model/ip_multicast_address_info.h | 2 +- lib/sbi/openapi/model/ip_sm_gw_guidance.c | 127 ++ lib/sbi/openapi/model/ip_sm_gw_guidance.h | 40 + lib/sbi/openapi/model/ip_sm_gw_info.c | 149 ++ lib/sbi/openapi/model/ip_sm_gw_info.h | 42 + lib/sbi/openapi/model/ip_sm_gw_registration.c | 172 +- lib/sbi/openapi/model/ip_sm_gw_registration.h | 16 +- lib/sbi/openapi/model/iptv_config_data.c | 82 +- lib/sbi/openapi/model/iptv_config_data.h | 11 +- .../openapi/model/iptv_config_data_patch.h | 2 +- lib/sbi/openapi/model/iwmsc_info.c | 290 +++ lib/sbi/openapi/model/iwmsc_info.h | 47 + lib/sbi/openapi/model/key_amf.h | 2 +- lib/sbi/openapi/model/ladn_info.h | 2 +- .../lcs_broadcast_assistance_types_data.c | 48 +- .../lcs_broadcast_assistance_types_data.h | 4 +- .../lcs_broadcast_assistance_types_data_1.c | 136 -- .../lcs_broadcast_assistance_types_data_1.h | 38 - lib/sbi/openapi/model/lcs_mo_data.c | 35 +- lib/sbi/openapi/model/lcs_mo_data.h | 5 +- lib/sbi/openapi/model/lcs_privacy_data_1.c | 209 -- lib/sbi/openapi/model/lcs_privacy_data_1.h | 45 - .../model/limit_id_to_monitoring_key.h | 2 +- lib/sbi/openapi/model/link.h | 2 +- lib/sbi/openapi/model/links_value_schema.h | 2 +- lib/sbi/openapi/model/lmf_info.c | 184 +- lib/sbi/openapi/model/lmf_info.h | 11 +- .../model/local2d_point_uncertainty_ellipse.c | 247 +++ .../model/local2d_point_uncertainty_ellipse.h | 51 + ...local2d_point_uncertainty_ellipse_all_of.c | 212 ++ ...local2d_point_uncertainty_ellipse_all_of.h | 47 + .../local3d_point_uncertainty_ellipsoid.c | 247 +++ .../local3d_point_uncertainty_ellipsoid.h | 51 + ...cal3d_point_uncertainty_ellipsoid_all_of.c | 212 ++ ...cal3d_point_uncertainty_ellipsoid_all_of.h | 47 + lib/sbi/openapi/model/local_origin.c | 141 ++ lib/sbi/openapi/model/local_origin.h | 41 + .../openapi/model/location_accuracy_any_of.c | 4 +- .../openapi/model/location_accuracy_any_of.h | 2 +- lib/sbi/openapi/model/location_area.c | 45 +- lib/sbi/openapi/model/location_area.h | 9 +- lib/sbi/openapi/model/location_area_1.c | 35 +- lib/sbi/openapi/model/location_area_1.h | 5 +- lib/sbi/openapi/model/location_area_id.c | 149 ++ lib/sbi/openapi/model/location_area_id.h | 41 + lib/sbi/openapi/model/location_filter.h | 2 +- .../openapi/model/location_filter_any_of.c | 4 +- .../openapi/model/location_filter_any_of.h | 2 +- lib/sbi/openapi/model/location_info.c | 172 +- lib/sbi/openapi/model/location_info.h | 22 +- .../location_reporting_configuration_1.c | 191 ++ .../location_reporting_configuration_1.h | 47 + .../openapi/model/loss_connectivity_cfg_1.c | 109 + .../openapi/model/loss_connectivity_cfg_1.h | 40 + lib/sbi/openapi/model/lpi_1.c | 143 -- lib/sbi/openapi/model/lpi_1.h | 42 - lib/sbi/openapi/model/lte_v2x_auth.h | 2 +- lib/sbi/openapi/model/lte_v2x_auth_1.c | 129 -- lib/sbi/openapi/model/lte_v2x_auth_1.h | 41 - lib/sbi/openapi/model/mapping_of_snssai.h | 2 +- lib/sbi/openapi/model/matching_direction.c | 87 + lib/sbi/openapi/model/matching_direction.h | 37 + .../openapi/model/matching_direction_any_of.c | 30 + .../openapi/model/matching_direction_any_of.h | 31 + lib/sbi/openapi/model/mb_smf_info.c | 426 ++++ lib/sbi/openapi/model/mb_smf_info.h | 51 + lib/sbi/openapi/model/mb_upf_info.c | 430 ++++ lib/sbi/openapi/model/mb_upf_info.h | 56 + lib/sbi/openapi/model/mbs_binding_resp.c | 170 ++ lib/sbi/openapi/model/mbs_binding_resp.h | 41 + .../openapi/model/mbs_ext_problem_details.c | 475 ++++ .../openapi/model/mbs_ext_problem_details.h | 68 + lib/sbi/openapi/model/mbs_service_area.c | 207 ++ lib/sbi/openapi/model/mbs_service_area.h | 42 + lib/sbi/openapi/model/mbs_service_area_info.c | 142 ++ lib/sbi/openapi/model/mbs_service_area_info.h | 41 + lib/sbi/openapi/model/mbs_session.c | 195 ++ lib/sbi/openapi/model/mbs_session.h | 42 + lib/sbi/openapi/model/mbs_session_id.c | 172 ++ lib/sbi/openapi/model/mbs_session_id.h | 44 + lib/sbi/openapi/model/mbs_session_id_1.c | 172 ++ lib/sbi/openapi/model/mbs_session_id_1.h | 44 + lib/sbi/openapi/model/mbs_subscription_data.c | 169 ++ lib/sbi/openapi/model/mbs_subscription_data.h | 43 + .../openapi/model/mbs_subscription_data_1.c | 169 ++ .../openapi/model/mbs_subscription_data_1.h | 43 + lib/sbi/openapi/model/mbsfn_area.h | 2 +- lib/sbi/openapi/model/mdt_configuration.h | 2 +- lib/sbi/openapi/model/mdt_configuration_1.h | 2 +- lib/sbi/openapi/model/media_component.c | 86 +- lib/sbi/openapi/model/media_component.h | 9 +- lib/sbi/openapi/model/media_component_rm.c | 86 +- lib/sbi/openapi/model/media_component_rm.h | 11 +- lib/sbi/openapi/model/media_sub_component.h | 2 +- .../openapi/model/media_sub_component_rm.h | 2 +- lib/sbi/openapi/model/message_waiting_data.h | 2 +- lib/sbi/openapi/model/mfaf_info.c | 307 +++ lib/sbi/openapi/model/mfaf_info.h | 47 + lib/sbi/openapi/model/ml_analytics_info.c | 267 +++ lib/sbi/openapi/model/ml_analytics_info.h | 45 + lib/sbi/openapi/model/mm_context.c | 25 +- lib/sbi/openapi/model/mm_context.h | 7 +- lib/sbi/openapi/model/mme_capabilities.c | 26 +- lib/sbi/openapi/model/mme_capabilities.h | 8 +- lib/sbi/openapi/model/mnpf_info.c | 151 ++ lib/sbi/openapi/model/mnpf_info.h | 39 + lib/sbi/openapi/model/mo_exp_data_counter.h | 2 +- lib/sbi/openapi/model/model_3_g_aka_av.c | 222 ++ lib/sbi/openapi/model/model_3_g_aka_av.h | 46 + lib/sbi/openapi/model/model_5_g_ddnmf_info.c | 122 + lib/sbi/openapi/model/model_5_g_ddnmf_info.h | 39 + .../openapi/model/model_5_gvn_group_data.c | 109 +- .../openapi/model/model_5_gvn_group_data.h | 10 +- .../model/model_5_mbs_authorization_info.c | 147 ++ .../model/model_5_mbs_authorization_info.h | 39 + lib/sbi/openapi/model/modify_200_response.c | 133 +- lib/sbi/openapi/model/modify_200_response.h | 15 +- ...scription_data_subscription_200_response.c | 435 ++++ ...scription_data_subscription_200_response.h | 65 + .../openapi/model/monitoring_configuration.c | 111 +- .../openapi/model/monitoring_configuration.h | 14 +- .../model/monitoring_configuration_1.c | 549 +++++ .../model/monitoring_configuration_1.h | 89 + lib/sbi/openapi/model/mps_action.c | 30 + lib/sbi/openapi/model/mps_action.h | 31 + lib/sbi/openapi/model/mtc_provider.h | 2 +- .../openapi/model/multicast_access_control.c | 127 ++ .../openapi/model/multicast_access_control.h | 14 +- .../model/multicast_access_control_any_of.c | 30 - .../model/multicast_access_control_any_of.h | 31 - lib/sbi/openapi/model/n1_message_container.h | 2 +- .../openapi/model/n1_message_notification.h | 2 +- .../model/n1_n2_message_transfer_cause.c | 4 +- .../model/n1_n2_message_transfer_cause.h | 2 +- .../model/n1_n2_message_transfer_error.h | 2 +- .../model/n1_n2_message_transfer_req_data.c | 27 +- .../model/n1_n2_message_transfer_req_data.h | 6 +- .../model/n1_n2_message_transfer_rsp_data.h | 2 +- .../openapi/model/n1_n2_msg_txfr_err_detail.h | 2 +- .../n1_n2_msg_txfr_failure_notification.h | 2 +- lib/sbi/openapi/model/n2_info_container.c | 35 +- lib/sbi/openapi/model/n2_info_container.h | 7 +- lib/sbi/openapi/model/n2_info_content.h | 2 +- .../model/n2_info_notification_rsp_data.c | 73 +- .../model/n2_info_notification_rsp_data.h | 8 +- ...fo_notify_handover_complete_200_response.c | 539 ++++- ...fo_notify_handover_complete_200_response.h | 34 +- .../openapi/model/n2_info_notify_request.c | 184 ++ .../openapi/model/n2_info_notify_request.h | 43 + lib/sbi/openapi/model/n2_information_class.c | 4 +- lib/sbi/openapi/model/n2_information_class.h | 2 +- .../model/n2_information_notification.h | 2 +- .../model/n2_information_transfer_error.h | 2 +- .../model/n2_information_transfer_req_data.h | 2 +- .../model/n2_information_transfer_rsp_data.h | 2 +- lib/sbi/openapi/model/n2_ran_information.h | 2 +- lib/sbi/openapi/model/n2_sm_info_type.c | 4 +- lib/sbi/openapi/model/n2_sm_info_type.h | 2 +- lib/sbi/openapi/model/n2_sm_information.h | 2 +- lib/sbi/openapi/model/n3ga_location.c | 21 + lib/sbi/openapi/model/n3ga_location.h | 5 +- lib/sbi/openapi/model/n4_information.c | 110 +- lib/sbi/openapi/model/n4_information.h | 10 +- .../openapi/model/namf_subscription_data.c | 174 ++ .../openapi/model/namf_subscription_data.h | 41 + lib/sbi/openapi/model/nas_security_mode.h | 2 +- lib/sbi/openapi/model/ncgi.h | 2 +- lib/sbi/openapi/model/ncgi_1.h | 2 +- lib/sbi/openapi/model/ncgi_tai.c | 186 ++ lib/sbi/openapi/model/ncgi_tai.h | 42 + lib/sbi/openapi/model/nef_cond.h | 2 +- lib/sbi/openapi/model/nef_info.c | 260 ++- lib/sbi/openapi/model/nef_info.h | 17 +- lib/sbi/openapi/model/network_area_info.h | 2 +- lib/sbi/openapi/model/network_area_info_1.c | 32 +- lib/sbi/openapi/model/network_area_info_1.h | 8 +- lib/sbi/openapi/model/network_area_info_2.c | 327 +++ lib/sbi/openapi/model/network_area_info_2.h | 48 + lib/sbi/openapi/model/network_perf_info.c | 215 ++ lib/sbi/openapi/model/network_perf_info.h | 54 + .../openapi/model/network_perf_requirement.c | 166 ++ .../openapi/model/network_perf_requirement.h | 47 + lib/sbi/openapi/model/network_perf_type.c | 87 + lib/sbi/openapi/model/network_perf_type.h | 37 + .../openapi/model/network_perf_type_any_of.c | 30 + .../openapi/model/network_perf_type_any_of.h | 31 + lib/sbi/openapi/model/nf_group_cond.c | 4 +- lib/sbi/openapi/model/nf_group_cond.h | 2 +- lib/sbi/openapi/model/nf_group_list_cond.c | 241 ++ lib/sbi/openapi/model/nf_group_list_cond.h | 52 + lib/sbi/openapi/model/nf_identifier.c | 135 ++ lib/sbi/openapi/model/nf_identifier.h | 41 + lib/sbi/openapi/model/nf_instance_info.c | 214 ++ lib/sbi/openapi/model/nf_instance_info.h | 43 + .../openapi/model/nf_load_level_information.c | 370 ++++ .../openapi/model/nf_load_level_information.h | 77 + lib/sbi/openapi/model/nf_profile.c | 975 +++++++- lib/sbi/openapi/model/nf_profile.h | 56 +- lib/sbi/openapi/model/nf_service.c | 35 +- lib/sbi/openapi/model/nf_service.h | 7 +- lib/sbi/openapi/model/nf_service_instance.c | 156 ++ lib/sbi/openapi/model/nf_service_instance.h | 42 + lib/sbi/openapi/model/nf_service_set_cond.c | 27 +- lib/sbi/openapi/model/nf_service_set_cond.h | 4 +- lib/sbi/openapi/model/nf_type.c | 4 +- lib/sbi/openapi/model/nf_type.h | 2 +- lib/sbi/openapi/model/ng_ap_cause.h | 2 +- lib/sbi/openapi/model/ng_ksi.h | 2 +- lib/sbi/openapi/model/ng_ran_target_id.h | 2 +- lib/sbi/openapi/model/ngap_ie_type.c | 4 +- lib/sbi/openapi/model/ngap_ie_type.h | 2 +- .../openapi/model/nidd_authorization_info.c | 151 ++ .../openapi/model/nidd_authorization_info.h | 39 + .../model/nnwdaf_events_subscription.c | 433 ++++ .../model/nnwdaf_events_subscription.h | 60 + lib/sbi/openapi/model/nnwdaf_nf_status.c | 153 ++ lib/sbi/openapi/model/nnwdaf_nf_status.h | 48 + lib/sbi/openapi/model/no_profile_match_info.c | 182 ++ lib/sbi/openapi/model/no_profile_match_info.h | 42 + .../openapi/model/no_profile_match_reason.c | 87 + .../openapi/model/no_profile_match_reason.h | 37 + .../model/no_profile_match_reason_any_of.c | 30 + .../model/no_profile_match_reason_any_of.h | 31 + lib/sbi/openapi/model/non_dynamic5_qi.h | 2 +- .../non_ue_n2_info_subscription_create_data.h | 2 +- ...non_ue_n2_info_subscription_created_data.h | 2 +- lib/sbi/openapi/model/notif_condition.h | 2 +- lib/sbi/openapi/model/notification_data.c | 35 +- lib/sbi/openapi/model/notification_data.h | 5 +- lib/sbi/openapi/model/notification_flag.c | 30 + lib/sbi/openapi/model/notification_flag.h | 31 + lib/sbi/openapi/model/notification_info.c | 163 ++ lib/sbi/openapi/model/notification_info.h | 44 + lib/sbi/openapi/model/notification_item.h | 2 +- lib/sbi/openapi/model/notification_method.c | 87 + lib/sbi/openapi/model/notification_method.h | 37 + lib/sbi/openapi/model/notification_method_1.c | 87 + lib/sbi/openapi/model/notification_method_1.h | 37 + .../model/notification_method_1_any_of.c | 30 + .../model/notification_method_1_any_of.h | 31 + .../model/notification_method_any_of.c | 30 + .../model/notification_method_any_of.h | 31 + lib/sbi/openapi/model/notification_type.c | 4 +- lib/sbi/openapi/model/notification_type.h | 2 +- lib/sbi/openapi/model/notify_item.h | 2 +- lib/sbi/openapi/model/npcf_af_event.c | 4 +- lib/sbi/openapi/model/npcf_af_event.h | 2 +- lib/sbi/openapi/model/npcf_atsss_capability.c | 30 + lib/sbi/openapi/model/npcf_atsss_capability.h | 31 + .../model/npcf_multicast_access_control.c | 30 + .../model/npcf_multicast_access_control.h | 31 + .../openapi/model/npcf_pdu_session_status.c | 30 + .../openapi/model/npcf_pdu_session_status.h | 31 + lib/sbi/openapi/model/nr_location.c | 22 + lib/sbi/openapi/model/nr_location.h | 6 +- lib/sbi/openapi/model/nr_v2x_auth.h | 2 +- lib/sbi/openapi/model/nr_v2x_auth_1.c | 129 -- lib/sbi/openapi/model/nr_v2x_auth_1.h | 41 - lib/sbi/openapi/model/nrf_info.c | 1058 ++++++++- lib/sbi/openapi/model/nrf_info.h | 70 +- ...f_info_served_aanf_info_list_value_value.c | 141 ++ ...f_info_served_aanf_info_list_value_value.h | 39 + .../model/nrf_info_served_amf_info_value.c | 498 +++++ .../model/nrf_info_served_amf_info_value.h | 61 + .../model/nrf_info_served_ausf_info_value.c | 284 +++ .../model/nrf_info_served_ausf_info_value.h | 47 + .../model/nrf_info_served_bsf_info_value.c | 504 +++++ .../model/nrf_info_served_bsf_info_value.h | 59 + .../model/nrf_info_served_chf_info_value.c | 336 +++ .../model/nrf_info_served_chf_info_value.h | 52 + .../model/nrf_info_served_gmlc_info_value.c | 201 ++ .../model/nrf_info_served_gmlc_info_value.h | 42 + ...rf_info_served_hss_info_list_value_value.c | 441 ++++ ...rf_info_served_hss_info_list_value_value.h | 54 + .../model/nrf_info_served_lmf_info_value.c | 488 ++++ .../model/nrf_info_served_lmf_info_value.h | 60 + ...info_served_mb_smf_info_list_value_value.c | 426 ++++ ...info_served_mb_smf_info_list_value_value.h | 52 + .../model/nrf_info_served_nef_info_value.c | 602 +++++ .../model/nrf_info_served_nef_info_value.h | 67 + .../model/nrf_info_served_nwdaf_info_value.c | 540 +++++ .../model/nrf_info_served_nwdaf_info_value.h | 64 + .../model/nrf_info_served_pcf_info_value.c | 436 ++++ .../model/nrf_info_served_pcf_info_value.h | 65 + ..._info_served_pcscf_info_list_value_value.c | 569 +++++ ..._info_served_pcscf_info_list_value_value.h | 60 + .../nrf_info_served_scp_info_list_value.c | 779 +++++++ .../nrf_info_served_scp_info_list_value.h | 70 + .../nrf_info_served_sepp_info_list_value.c | 303 +++ .../nrf_info_served_sepp_info_list_value.h | 47 + .../model/nrf_info_served_smf_info_value.c | 564 +++++ .../model/nrf_info_served_smf_info_value.h | 76 + .../model/nrf_info_served_udm_info_value.c | 464 ++++ .../model/nrf_info_served_udm_info_value.h | 55 + .../model/nrf_info_served_udr_info_value.c | 396 ++++ .../model/nrf_info_served_udr_info_value.h | 53 + .../model/nrf_info_served_udsf_info_value.c | 245 +++ .../model/nrf_info_served_udsf_info_value.h | 45 + .../model/nrf_info_served_upf_info_value.c | 710 ++++++ .../model/nrf_info_served_upf_info_value.h | 92 + lib/sbi/openapi/model/nrppa_information.h | 2 +- lib/sbi/openapi/model/nsacf_capability.c | 131 ++ lib/sbi/openapi/model/nsacf_capability.h | 44 + lib/sbi/openapi/model/nsacf_info.c | 242 ++ lib/sbi/openapi/model/nsacf_info.h | 45 + lib/sbi/openapi/model/nsag_info.c | 335 +++ lib/sbi/openapi/model/nsag_info.h | 47 + lib/sbi/openapi/model/nsi_id_info.c | 176 ++ lib/sbi/openapi/model/nsi_id_info.h | 41 + lib/sbi/openapi/model/nsi_information.c | 77 +- lib/sbi/openapi/model/nsi_information.h | 6 +- lib/sbi/openapi/model/nsi_load_level_info.c | 446 ++++ lib/sbi/openapi/model/nsi_load_level_info.h | 71 + lib/sbi/openapi/model/nssaa_status.h | 2 +- lib/sbi/openapi/model/nssaaf_info.c | 207 ++ lib/sbi/openapi/model/nssaaf_info.h | 42 + lib/sbi/openapi/model/nssai.c | 26 +- lib/sbi/openapi/model/nssai.h | 6 +- lib/sbi/openapi/model/nssai_1.c | 34 +- lib/sbi/openapi/model/nssai_1.h | 8 +- lib/sbi/openapi/model/nssai_ack_data.h | 2 +- lib/sbi/openapi/model/nssai_mapping.h | 2 +- lib/sbi/openapi/model/nudm_amf_info.c | 170 ++ lib/sbi/openapi/model/nudm_amf_info.h | 44 + lib/sbi/openapi/model/null_value.h | 2 +- lib/sbi/openapi/model/number_average.c | 149 ++ lib/sbi/openapi/model/number_average.h | 44 + lib/sbi/openapi/model/nwdaf_capability.c | 131 ++ lib/sbi/openapi/model/nwdaf_capability.h | 44 + lib/sbi/openapi/model/nwdaf_cond.c | 164 +- lib/sbi/openapi/model/nwdaf_cond.h | 12 +- lib/sbi/openapi/model/nwdaf_data.c | 174 ++ lib/sbi/openapi/model/nwdaf_data.h | 41 + lib/sbi/openapi/model/nwdaf_event.h | 2 +- lib/sbi/openapi/model/nwdaf_event_any_of.c | 4 +- lib/sbi/openapi/model/nwdaf_event_any_of.h | 2 +- lib/sbi/openapi/model/nwdaf_failure_code.c | 87 + lib/sbi/openapi/model/nwdaf_failure_code.h | 37 + .../openapi/model/nwdaf_failure_code_any_of.c | 30 + .../openapi/model/nwdaf_failure_code_any_of.h | 31 + lib/sbi/openapi/model/nwdaf_info.c | 217 +- lib/sbi/openapi/model/nwdaf_info.h | 17 +- lib/sbi/openapi/model/nwdaf_registration.c | 332 +++ lib/sbi/openapi/model/nwdaf_registration.h | 52 + .../openapi/model/nwdaf_registration_info.c | 151 ++ .../openapi/model/nwdaf_registration_info.h | 39 + .../model/nwdaf_registration_modification.c | 220 ++ .../model/nwdaf_registration_modification.h | 45 + lib/sbi/openapi/model/nwdaf_subscription.c | 149 ++ lib/sbi/openapi/model/nwdaf_subscription.h | 41 + .../model/observed_redundant_trans_exp.c | 263 +++ .../model/observed_redundant_trans_exp.h | 68 + lib/sbi/openapi/model/odb_data.h | 2 +- .../model/operator_specific_data_container.c | 119 +- .../model/operator_specific_data_container.h | 20 +- .../operator_specific_data_container_value.c | 87 + .../operator_specific_data_container_value.h | 36 + lib/sbi/openapi/model/output_strategy.c | 87 + lib/sbi/openapi/model/output_strategy.h | 37 + .../openapi/model/output_strategy_any_of.c | 30 + .../openapi/model/output_strategy_any_of.h | 31 + lib/sbi/openapi/model/packet_filter_info.h | 2 +- lib/sbi/openapi/model/parameter_combination.h | 2 +- .../openapi/model/partial_success_report.c | 64 +- .../openapi/model/partial_success_report.h | 7 +- lib/sbi/openapi/model/partitioning_criteria.c | 30 + lib/sbi/openapi/model/partitioning_criteria.h | 31 + lib/sbi/openapi/model/patch_item.h | 2 +- lib/sbi/openapi/model/patch_result.h | 2 +- lib/sbi/openapi/model/pc5_flow_bit_rates.h | 2 +- lib/sbi/openapi/model/pc5_qo_s_para.h | 2 +- lib/sbi/openapi/model/pc5_qos_flow_item.h | 2 +- lib/sbi/openapi/model/pcc_rule.c | 70 +- lib/sbi/openapi/model/pcc_rule.h | 16 +- lib/sbi/openapi/model/pcf_addressing_info.c | 193 ++ lib/sbi/openapi/model/pcf_addressing_info.h | 43 + lib/sbi/openapi/model/pcf_binding.h | 2 +- lib/sbi/openapi/model/pcf_binding_patch.h | 2 +- .../openapi/model/pcf_for_pdu_session_info.c | 453 ++++ .../openapi/model/pcf_for_pdu_session_info.h | 61 + lib/sbi/openapi/model/pcf_for_ue_binding.c | 310 +++ lib/sbi/openapi/model/pcf_for_ue_binding.h | 54 + .../openapi/model/pcf_for_ue_binding_patch.c | 193 ++ .../openapi/model/pcf_for_ue_binding_patch.h | 43 + lib/sbi/openapi/model/pcf_for_ue_info.c | 237 ++ lib/sbi/openapi/model/pcf_for_ue_info.h | 48 + lib/sbi/openapi/model/pcf_info.c | 88 +- lib/sbi/openapi/model/pcf_info.h | 12 +- lib/sbi/openapi/model/pcf_mbs_binding.c | 318 +++ lib/sbi/openapi/model/pcf_mbs_binding.h | 55 + lib/sbi/openapi/model/pcf_mbs_binding_patch.c | 193 ++ lib/sbi/openapi/model/pcf_mbs_binding_patch.h | 43 + .../model/pcf_selection_assistance_info.c | 149 ++ .../model/pcf_selection_assistance_info.h | 41 + .../model/pcf_selection_assistance_info_1.c | 149 ++ .../model/pcf_selection_assistance_info_1.h | 41 + lib/sbi/openapi/model/pcf_ue_callback_info.c | 137 ++ lib/sbi/openapi/model/pcf_ue_callback_info.h | 40 + lib/sbi/openapi/model/pcscf_address.c | 218 ++ lib/sbi/openapi/model/pcscf_address.h | 42 + lib/sbi/openapi/model/pcscf_info.c | 131 ++ lib/sbi/openapi/model/pcscf_info.h | 6 + .../model/pcscf_restoration_notification.c | 35 +- .../model/pcscf_restoration_notification.h | 5 +- lib/sbi/openapi/model/pdu_session_1.c | 207 -- lib/sbi/openapi/model/pdu_session_1.h | 46 - lib/sbi/openapi/model/pdu_session_context.c | 326 ++- lib/sbi/openapi/model/pdu_session_context.h | 34 +- .../openapi/model/pdu_session_context_type.c | 30 + .../openapi/model/pdu_session_context_type.h | 31 + .../openapi/model/pdu_session_create_data.c | 273 ++- .../openapi/model/pdu_session_create_data.h | 38 +- .../openapi/model/pdu_session_create_error.h | 2 +- .../openapi/model/pdu_session_created_data.c | 72 +- .../openapi/model/pdu_session_created_data.h | 12 +- .../model/pdu_session_event_notification.c | 343 +++ .../model/pdu_session_event_notification.h | 60 + lib/sbi/openapi/model/pdu_session_info.c | 149 ++ lib/sbi/openapi/model/pdu_session_info.h | 41 + .../model/pdu_session_management_data.c | 88 +- .../model/pdu_session_management_data.h | 10 +- .../openapi/model/pdu_session_notify_item.h | 2 +- lib/sbi/openapi/model/pdu_session_rel_cause.c | 4 +- lib/sbi/openapi/model/pdu_session_rel_cause.h | 2 +- lib/sbi/openapi/model/pdu_session_status.c | 91 +- lib/sbi/openapi/model/pdu_session_status.h | 16 +- .../openapi/model/pdu_session_status_any_of.c | 30 - .../openapi/model/pdu_session_status_any_of.h | 31 - .../openapi/model/pdu_session_status_cfg_1.c | 110 + .../openapi/model/pdu_session_status_cfg_1.h | 38 + .../openapi/model/pdu_session_tsn_bridge.c | 127 +- .../openapi/model/pdu_session_tsn_bridge.h | 15 +- lib/sbi/openapi/model/pdu_session_types.c | 14 +- lib/sbi/openapi/model/pdu_session_types_1.c | 14 +- lib/sbi/openapi/model/perf_data.c | 199 ++ lib/sbi/openapi/model/perf_data.h | 52 + lib/sbi/openapi/model/periodicity.h | 2 +- .../openapi/model/pfd_change_notification.h | 2 +- lib/sbi/openapi/model/pfd_content.h | 2 +- lib/sbi/openapi/model/pfd_data_for_app.c | 201 -- lib/sbi/openapi/model/pfd_data_for_app.h | 43 - lib/sbi/openapi/model/pfd_data_for_app_ext.c | 80 +- lib/sbi/openapi/model/pfd_data_for_app_ext.h | 10 +- .../model/pfd_data_for_app_ext_all_of.c | 110 - .../model/pfd_data_for_app_ext_all_of.h | 38 - lib/sbi/openapi/model/pgw_info.c | 81 +- lib/sbi/openapi/model/pgw_info.h | 9 +- lib/sbi/openapi/model/pgw_info_1.c | 194 -- lib/sbi/openapi/model/pgw_info_1.h | 47 - lib/sbi/openapi/model/plmn_ec_info_1.c | 175 ++ lib/sbi/openapi/model/plmn_ec_info_1.h | 46 + lib/sbi/openapi/model/plmn_id.h | 2 +- lib/sbi/openapi/model/plmn_id_1.h | 2 +- lib/sbi/openapi/model/plmn_id_nid.h | 2 +- lib/sbi/openapi/model/plmn_id_nid_1.h | 2 +- lib/sbi/openapi/model/plmn_oauth2.c | 207 ++ lib/sbi/openapi/model/plmn_oauth2.h | 41 + lib/sbi/openapi/model/plmn_operator_class_1.c | 170 -- lib/sbi/openapi/model/plmn_operator_class_1.h | 41 - lib/sbi/openapi/model/plmn_restriction.c | 362 +++ lib/sbi/openapi/model/plmn_restriction.h | 53 + lib/sbi/openapi/model/plmn_restriction_1.c | 362 +++ lib/sbi/openapi/model/plmn_restriction_1.h | 53 + .../model/plmn_route_selection_descriptor.h | 2 +- lib/sbi/openapi/model/point.h | 2 +- lib/sbi/openapi/model/point_altitude.h | 2 +- .../model/point_altitude_uncertainty.h | 2 +- .../openapi/model/point_uncertainty_circle.h | 2 +- .../openapi/model/point_uncertainty_ellipse.h | 2 +- lib/sbi/openapi/model/policy_association.c | 208 +- lib/sbi/openapi/model/policy_association.h | 20 +- .../model/policy_association_request.c | 180 ++ .../model/policy_association_request.h | 10 +- .../model/policy_association_update_request.c | 184 +- .../model/policy_association_update_request.h | 12 +- .../model/policy_control_request_trigger.c | 4 +- .../model/policy_control_request_trigger.h | 2 +- .../model/policy_data_change_notification.c | 66 +- .../model/policy_data_change_notification.h | 8 +- .../model/policy_data_for_individual_ue.c | 326 +++ .../model/policy_data_for_individual_ue.h | 51 + .../openapi/model/policy_data_subscription.c | 118 +- .../openapi/model/policy_data_subscription.h | 6 +- lib/sbi/openapi/model/policy_data_subset.c | 87 + lib/sbi/openapi/model/policy_data_subset.h | 37 + .../openapi/model/policy_data_subset_any_of.c | 30 + .../openapi/model/policy_data_subset_any_of.h | 31 + .../model/policy_decision_failure_code.c | 4 +- .../model/policy_decision_failure_code.h | 2 +- lib/sbi/openapi/model/policy_req_trigger.c | 4 +- lib/sbi/openapi/model/policy_req_trigger.h | 2 +- lib/sbi/openapi/model/policy_update.c | 208 +- lib/sbi/openapi/model/policy_update.h | 20 +- lib/sbi/openapi/model/polygon.h | 2 +- .../openapi/model/port_management_container.h | 2 +- lib/sbi/openapi/model/pp_data.c | 35 +- lib/sbi/openapi/model/pp_data.h | 5 +- lib/sbi/openapi/model/pp_data_entry.c | 331 +++ lib/sbi/openapi/model/pp_data_entry.h | 57 + lib/sbi/openapi/model/pp_data_entry_list.c | 170 ++ lib/sbi/openapi/model/pp_data_entry_list.h | 41 + .../openapi/model/pp_dl_packet_count_ext.c | 54 + .../openapi/model/pp_dl_packet_count_ext.h | 5 + .../openapi/model/preemption_capability_rm.h | 2 +- .../model/preemption_control_information_rm.h | 2 +- .../model/preemption_vulnerability_rm.h | 2 +- lib/sbi/openapi/model/preferred_search.c | 92 +- lib/sbi/openapi/model/preferred_search.h | 20 +- lib/sbi/openapi/model/presence_info.h | 2 +- lib/sbi/openapi/model/presence_info_rm.h | 2 +- lib/sbi/openapi/model/prev_sub_info.c | 280 +++ lib/sbi/openapi/model/prev_sub_info.h | 48 + lib/sbi/openapi/model/pro_se_allowed_plmn.c | 168 ++ lib/sbi/openapi/model/pro_se_allowed_plmn.h | 42 + lib/sbi/openapi/model/pro_se_auth_data.c | 87 + lib/sbi/openapi/model/pro_se_auth_data.h | 36 + .../openapi/model/pro_se_authentication_ctx.c | 247 +++ .../openapi/model/pro_se_authentication_ctx.h | 47 + .../model/pro_se_authentication_info.c | 203 ++ .../model/pro_se_authentication_info.h | 46 + .../pro_se_authentication_info_request.c | 188 ++ .../pro_se_authentication_info_request.h | 45 + .../model/pro_se_authentication_info_result.c | 189 ++ .../model/pro_se_authentication_info_result.h | 46 + .../model/pro_se_authentication_result.c | 156 ++ .../model/pro_se_authentication_result.h | 42 + .../model/pro_se_authentication_vectors.c | 87 + .../model/pro_se_authentication_vectors.h | 37 + lib/sbi/openapi/model/pro_se_capability.c | 219 ++ lib/sbi/openapi/model/pro_se_capability.h | 60 + lib/sbi/openapi/model/pro_se_eap_session.c | 300 +++ lib/sbi/openapi/model/pro_se_eap_session.h | 52 + lib/sbi/openapi/model/pro_se_information.c | 118 + lib/sbi/openapi/model/pro_se_information.h | 39 + lib/sbi/openapi/model/problem_details.h | 2 +- lib/sbi/openapi/model/problem_details_1.h | 2 +- lib/sbi/openapi/model/problem_details_2.c | 284 --- lib/sbi/openapi/model/problem_details_2.h | 53 - .../openapi/model/problem_details_add_info.h | 2 +- lib/sbi/openapi/model/prose_context.c | 246 +++ lib/sbi/openapi/model/prose_context.h | 52 + lib/sbi/openapi/model/prose_direct_allowed.c | 30 + lib/sbi/openapi/model/prose_direct_allowed.h | 31 + lib/sbi/openapi/model/prose_service_auth.c | 129 ++ lib/sbi/openapi/model/prose_service_auth.h | 41 + .../openapi/model/prose_subscription_data.c | 201 ++ .../openapi/model/prose_subscription_data.h | 44 + lib/sbi/openapi/model/provisioned_data_sets.c | 247 ++- lib/sbi/openapi/model/provisioned_data_sets.h | 28 +- lib/sbi/openapi/model/psa_indication.c | 4 +- lib/sbi/openapi/model/psa_indication.h | 2 +- lib/sbi/openapi/model/psa_information.h | 2 +- lib/sbi/openapi/model/pws_error_data.h | 2 +- lib/sbi/openapi/model/pws_information.c | 27 +- lib/sbi/openapi/model/pws_information.h | 6 +- lib/sbi/openapi/model/pws_response_data.h | 2 +- lib/sbi/openapi/model/qos_characteristics.h | 2 +- lib/sbi/openapi/model/qos_data.h | 2 +- .../model/qos_flow_add_modify_request_item.h | 2 +- lib/sbi/openapi/model/qos_flow_item.c | 35 +- lib/sbi/openapi/model/qos_flow_item.h | 7 +- lib/sbi/openapi/model/qos_flow_notify_item.h | 2 +- lib/sbi/openapi/model/qos_flow_profile.h | 2 +- .../model/qos_flow_release_request_item.h | 2 +- lib/sbi/openapi/model/qos_flow_setup_item.c | 26 +- lib/sbi/openapi/model/qos_flow_setup_item.h | 8 +- lib/sbi/openapi/model/qos_flow_usage_report.h | 2 +- lib/sbi/openapi/model/qos_monitoring_data.c | 26 +- lib/sbi/openapi/model/qos_monitoring_data.h | 8 +- lib/sbi/openapi/model/qos_monitoring_info.h | 2 +- .../model/qos_monitoring_information_rm.h | 2 +- lib/sbi/openapi/model/qos_monitoring_report.h | 2 +- .../model/qos_notification_control_info.h | 2 +- lib/sbi/openapi/model/qos_requirement.c | 221 ++ lib/sbi/openapi/model/qos_requirement.h | 53 + .../openapi/model/qos_sustainability_info.c | 271 +++ .../openapi/model/qos_sustainability_info.h | 55 + .../openapi/model/query_param_combination.c | 151 ++ .../openapi/model/query_param_combination.h | 39 + lib/sbi/openapi/model/query_parameter.c | 141 ++ lib/sbi/openapi/model/query_parameter.h | 40 + lib/sbi/openapi/model/ran_nas_rel_cause.h | 2 +- lib/sbi/openapi/model/ranking_criterion.c | 127 ++ lib/sbi/openapi/model/ranking_criterion.h | 40 + lib/sbi/openapi/model/rat_freq_information.c | 236 ++ lib/sbi/openapi/model/rat_freq_information.h | 57 + lib/sbi/openapi/model/rat_type.c | 4 +- lib/sbi/openapi/model/rat_type.h | 2 +- lib/sbi/openapi/model/reachability_filter.h | 2 +- .../reachability_for_data_configuration.c | 144 ++ .../reachability_for_data_configuration.h | 43 + .../reachability_for_data_configuration_1.c | 144 ++ .../reachability_for_data_configuration_1.h | 43 + .../reachability_for_data_report_config.c | 87 + .../reachability_for_data_report_config.h | 37 + ...achability_for_data_report_config_any_of.c | 30 + ...achability_for_data_report_config_any_of.h | 31 + .../model/red_trans_exp_ordering_criterion.c | 87 + .../model/red_trans_exp_ordering_criterion.h | 37 + .../red_trans_exp_ordering_criterion_any_of.c | 30 + .../red_trans_exp_ordering_criterion_any_of.h | 31 + lib/sbi/openapi/model/redirect_information.h | 2 +- lib/sbi/openapi/model/redirect_response.c | 27 +- lib/sbi/openapi/model/redirect_response.h | 6 +- .../model/redundant_pdu_session_information.c | 26 +- .../model/redundant_pdu_session_information.h | 6 +- .../model/redundant_transmission_exp_info.c | 205 ++ .../model/redundant_transmission_exp_info.h | 44 + .../model/redundant_transmission_exp_per_ts.c | 235 ++ .../model/redundant_transmission_exp_per_ts.h | 55 + .../model/redundant_transmission_exp_req.c | 149 ++ .../model/redundant_transmission_exp_req.h | 42 + lib/sbi/openapi/model/ref_to_binary_data.h | 2 +- .../model/registration_context_container.h | 2 +- .../model/registration_data_set_name.c | 4 +- .../model/registration_data_set_name.h | 2 +- .../openapi/model/registration_data_sets.c | 66 +- .../openapi/model/registration_data_sets.h | 8 +- .../model/registration_location_info.c | 31 + .../model/registration_location_info.h | 3 + .../model/relative_cartesian_location.c | 149 ++ .../model/relative_cartesian_location.h | 44 + lib/sbi/openapi/model/release_cause.c | 30 + lib/sbi/openapi/model/release_cause.h | 31 + lib/sbi/openapi/model/release_data.h | 2 +- lib/sbi/openapi/model/release_session_info.c | 176 ++ lib/sbi/openapi/model/release_session_info.h | 41 + lib/sbi/openapi/model/released_data.h | 2 +- .../model/relocate_ue_context_request.c | 44 +- .../model/relocate_ue_context_request.h | 4 +- lib/sbi/openapi/model/report_item.c | 27 +- lib/sbi/openapi/model/report_item.h | 6 +- lib/sbi/openapi/model/reporting_information.c | 318 +++ lib/sbi/openapi/model/reporting_information.h | 67 + lib/sbi/openapi/model/reporting_options.c | 25 +- lib/sbi/openapi/model/reporting_options.h | 5 +- lib/sbi/openapi/model/reporting_options_1.c | 250 +++ lib/sbi/openapi/model/reporting_options_1.h | 60 + lib/sbi/openapi/model/request_trigger.c | 4 +- lib/sbi/openapi/model/request_trigger.h | 2 +- lib/sbi/openapi/model/requested_qos.h | 2 +- lib/sbi/openapi/model/requested_rule_data.h | 2 +- lib/sbi/openapi/model/requested_usage_data.h | 2 +- lib/sbi/openapi/model/resource_item.h | 2 +- lib/sbi/openapi/model/resource_usage.c | 153 ++ lib/sbi/openapi/model/resource_usage.h | 48 + .../openapi/model/resources_allocation_info.h | 2 +- .../openapi/model/resynchronization_info_1.c | 141 ++ .../openapi/model/resynchronization_info_1.h | 40 + .../openapi/model/retainability_threshold.c | 162 ++ .../openapi/model/retainability_threshold.h | 47 + lib/sbi/openapi/model/retrieve_data.c | 25 +- lib/sbi/openapi/model/retrieve_data.h | 7 +- lib/sbi/openapi/model/retrieved_data.c | 35 +- lib/sbi/openapi/model/retrieved_data.h | 7 +- lib/sbi/openapi/model/rg_auth_ctx.h | 2 +- .../openapi/model/rg_authentication_info.h | 2 +- lib/sbi/openapi/model/rm_info.h | 2 +- lib/sbi/openapi/model/rm_state.h | 2 +- lib/sbi/openapi/model/roaming_info_update.c | 144 ++ lib/sbi/openapi/model/roaming_info_update.h | 43 + lib/sbi/openapi/model/roaming_restrictions.c | 109 + lib/sbi/openapi/model/roaming_restrictions.h | 40 + lib/sbi/openapi/model/route_information.h | 2 +- .../model/route_selection_parameter_set.c | 283 +++ .../model/route_selection_parameter_set.h | 51 + lib/sbi/openapi/model/route_to_location.h | 2 +- lib/sbi/openapi/model/routing_area_id.c | 176 ++ lib/sbi/openapi/model/routing_area_id.h | 43 + .../openapi/model/routing_info_sm_request.c | 132 ++ .../openapi/model/routing_info_sm_request.h | 42 + .../openapi/model/routing_info_sm_response.c | 234 ++ .../openapi/model/routing_info_sm_response.h | 49 + lib/sbi/openapi/model/rsn.c | 4 +- lib/sbi/openapi/model/rsn.h | 2 +- lib/sbi/openapi/model/rule_report.c | 27 +- lib/sbi/openapi/model/rule_report.h | 6 +- .../model/satellite_backhaul_category.c | 30 + .../model/satellite_backhaul_category.h | 31 + .../model/scheduled_communication_time.h | 2 +- .../model/scheduled_communication_time_1.h | 2 +- .../model/scheduled_communication_time_rm.h | 2 +- .../model/scheduled_communication_type_rm.h | 2 +- lib/sbi/openapi/model/scp_capability.c | 30 + lib/sbi/openapi/model/scp_capability.h | 31 + lib/sbi/openapi/model/scp_domain_cond.c | 58 +- lib/sbi/openapi/model/scp_domain_cond.h | 7 +- .../openapi/model/scp_domain_connectivity.c | 145 ++ .../openapi/model/scp_domain_connectivity.h | 38 + .../scp_domain_routing_info_notification.c | 144 ++ .../scp_domain_routing_info_notification.h | 43 + .../scp_domain_routing_info_subscription.c | 182 ++ .../scp_domain_routing_info_subscription.h | 46 + .../model/scp_domain_routing_information.c | 164 ++ .../model/scp_domain_routing_information.h | 39 + lib/sbi/openapi/model/scp_info.c | 116 +- lib/sbi/openapi/model/scp_info.h | 8 +- lib/sbi/openapi/model/sdm_subscription.c | 145 +- lib/sbi/openapi/model/sdm_subscription.h | 21 +- lib/sbi/openapi/model/sdm_subscription_1.c | 145 +- lib/sbi/openapi/model/sdm_subscription_1.h | 21 +- lib/sbi/openapi/model/seaf_data.h | 2 +- lib/sbi/openapi/model/search_result.c | 130 +- lib/sbi/openapi/model/search_result.h | 12 +- .../openapi/model/secondary_rat_usage_info.h | 2 +- .../model/secondary_rat_usage_report.h | 2 +- lib/sbi/openapi/model/security_result.h | 2 +- lib/sbi/openapi/model/send_mo_data_req_data.h | 2 +- lib/sbi/openapi/model/sepp_info.c | 303 +++ lib/sbi/openapi/model/sepp_info.h | 46 + lib/sbi/openapi/model/sequence_number.h | 2 +- lib/sbi/openapi/model/serv_auth_info.c | 4 +- lib/sbi/openapi/model/serv_auth_info.h | 2 +- .../openapi/model/server_addressing_info.c | 249 +++ .../openapi/model/server_addressing_info.h | 42 + .../model/service_area_coverage_info.c | 176 ++ .../model/service_area_coverage_info.h | 41 + lib/sbi/openapi/model/service_area_id.c | 176 ++ lib/sbi/openapi/model/service_area_id.h | 43 + .../openapi/model/service_area_restriction.h | 2 +- .../model/service_area_restriction_1.h | 2 +- .../openapi/model/service_experience_info.c | 580 +++++ .../openapi/model/service_experience_info.h | 82 + .../openapi/model/service_experience_type.c | 87 + .../openapi/model/service_experience_type.h | 37 + .../model/service_experience_type_any_of.c | 30 + .../model/service_experience_type_any_of.h | 31 + .../openapi/model/service_name_list_cond.c | 193 ++ .../openapi/model/service_name_list_cond.h | 45 + .../openapi/model/service_parameter_data.c | 370 +++- .../openapi/model/service_parameter_data.h | 26 +- .../model/service_parameter_data_patch.c | 239 +- .../model/service_parameter_data_patch.h | 20 +- .../service_specific_authorization_info.c | 151 ++ .../service_specific_authorization_info.h | 39 + lib/sbi/openapi/model/service_type.c | 87 + lib/sbi/openapi/model/service_type.h | 37 + lib/sbi/openapi/model/service_type_any_of.c | 30 + lib/sbi/openapi/model/service_type_any_of.h | 31 + .../model/service_type_unrelated_class_1.c | 294 --- .../model/service_type_unrelated_class_1.h | 52 - lib/sbi/openapi/model/serving_nf_identity.c | 35 +- lib/sbi/openapi/model/serving_nf_identity.h | 7 +- .../model/sess_inact_timer_for_ue_comm.c | 127 ++ .../model/sess_inact_timer_for_ue_comm.h | 40 + .../session_management_subscription_data.c | 27 +- .../session_management_subscription_data.h | 4 +- .../session_management_subscription_data_1.c | 27 +- .../session_management_subscription_data_1.h | 4 +- lib/sbi/openapi/model/session_rule.h | 2 +- .../openapi/model/session_rule_failure_code.c | 4 +- .../openapi/model/session_rule_failure_code.h | 2 +- lib/sbi/openapi/model/session_rule_report.h | 2 +- lib/sbi/openapi/model/sgsn_address.c | 133 ++ lib/sbi/openapi/model/sgsn_address.h | 40 + lib/sbi/openapi/model/shared_data.c | 129 +- lib/sbi/openapi/model/shared_data.h | 11 +- lib/sbi/openapi/model/shared_data_id_range.c | 110 + lib/sbi/openapi/model/shared_data_id_range.h | 38 + .../model/shared_data_treatment_instruction.c | 30 + .../model/shared_data_treatment_instruction.h | 31 + lib/sbi/openapi/model/sign.h | 2 +- .../model/slice_info_for_pdu_session.h | 2 +- .../model/slice_info_for_registration.c | 70 +- .../model/slice_info_for_registration.h | 16 +- .../slice_info_for_ue_configuration_update.c | 130 +- .../slice_info_for_ue_configuration_update.h | 18 +- .../model/slice_load_level_information.c | 171 ++ .../model/slice_load_level_information.h | 41 + lib/sbi/openapi/model/slice_mbr.c | 141 ++ lib/sbi/openapi/model/slice_mbr.h | 40 + lib/sbi/openapi/model/slice_mbr_1.c | 141 ++ lib/sbi/openapi/model/slice_mbr_1.h | 40 + lib/sbi/openapi/model/slice_mbr_rm.c | 141 ++ lib/sbi/openapi/model/slice_mbr_rm.h | 42 + lib/sbi/openapi/model/slice_policy_data.c | 256 +++ lib/sbi/openapi/model/slice_policy_data.h | 48 + lib/sbi/openapi/model/sm_context.c | 270 ++- lib/sbi/openapi/model/sm_context.h | 41 +- .../openapi/model/sm_context_create_data.c | 556 ++++- .../openapi/model/sm_context_create_data.h | 65 +- .../openapi/model/sm_context_create_error.h | 2 +- .../openapi/model/sm_context_created_data.c | 27 +- .../openapi/model/sm_context_created_data.h | 6 +- .../openapi/model/sm_context_release_data.h | 2 +- .../openapi/model/sm_context_released_data.h | 2 +- .../openapi/model/sm_context_retrieve_data.h | 2 +- .../openapi/model/sm_context_retrieved_data.c | 35 +- .../openapi/model/sm_context_retrieved_data.h | 7 +- .../model/sm_context_status_notification.c | 104 +- .../model/sm_context_status_notification.h | 13 +- lib/sbi/openapi/model/sm_context_type.c | 4 +- lib/sbi/openapi/model/sm_context_type.h | 2 +- .../openapi/model/sm_context_update_data.c | 229 +- .../openapi/model/sm_context_update_data.h | 29 +- .../openapi/model/sm_context_update_error.h | 2 +- .../openapi/model/sm_context_updated_data.c | 89 +- .../openapi/model/sm_context_updated_data.h | 12 +- .../sm_policy_association_release_cause.c | 4 +- .../sm_policy_association_release_cause.h | 2 +- .../openapi/model/sm_policy_context_data.c | 228 +- .../openapi/model/sm_policy_context_data.h | 26 +- lib/sbi/openapi/model/sm_policy_control.h | 2 +- lib/sbi/openapi/model/sm_policy_data.c | 58 +- lib/sbi/openapi/model/sm_policy_data.h | 4 +- lib/sbi/openapi/model/sm_policy_decision.c | 22 + lib/sbi/openapi/model/sm_policy_decision.h | 6 +- lib/sbi/openapi/model/sm_policy_delete_data.h | 2 +- .../openapi/model/sm_policy_notification.h | 2 +- lib/sbi/openapi/model/sm_policy_snssai_data.c | 35 +- lib/sbi/openapi/model/sm_policy_snssai_data.h | 5 +- .../model/sm_policy_update_context_data.c | 302 ++- .../model/sm_policy_update_context_data.h | 32 +- lib/sbi/openapi/model/sm_subs_data.c | 205 ++ lib/sbi/openapi/model/sm_subs_data.h | 42 + .../openapi/model/small_data_rate_status.h | 2 +- .../model/small_data_rate_status_info.h | 2 +- lib/sbi/openapi/model/smcce_info.c | 176 ++ lib/sbi/openapi/model/smcce_info.h | 44 + lib/sbi/openapi/model/smcce_ue_list.c | 249 +++ lib/sbi/openapi/model/smcce_ue_list.h | 42 + lib/sbi/openapi/model/smf_change_info.h | 2 +- lib/sbi/openapi/model/smf_info.c | 184 +- lib/sbi/openapi/model/smf_info.h | 19 +- lib/sbi/openapi/model/smf_registration.c | 180 +- lib/sbi/openapi/model/smf_registration.h | 17 +- .../model/smf_registration_modification.c | 168 ++ .../model/smf_registration_modification.h | 43 + lib/sbi/openapi/model/smf_selection_data.h | 2 +- .../model/smf_selection_subscription_data.c | 27 +- .../model/smf_selection_subscription_data.h | 4 +- .../model/smf_selection_subscription_data_1.c | 206 -- .../model/smf_selection_subscription_data_1.h | 43 - lib/sbi/openapi/model/smf_selection_type.c | 30 + lib/sbi/openapi/model/smf_selection_type.h | 31 + lib/sbi/openapi/model/smf_subscription_item.c | 35 +- lib/sbi/openapi/model/smf_subscription_item.h | 5 +- lib/sbi/openapi/model/sms_router_info.c | 233 ++ lib/sbi/openapi/model/sms_router_info.h | 49 + lib/sbi/openapi/model/sms_subscription_data.c | 27 +- lib/sbi/openapi/model/sms_subscription_data.h | 4 +- .../openapi/model/sms_subscription_data_1.c | 27 +- .../openapi/model/sms_subscription_data_1.h | 4 +- lib/sbi/openapi/model/smsc_data.h | 2 +- lib/sbi/openapi/model/smsf_info.c | 27 +- lib/sbi/openapi/model/smsf_info.h | 4 +- lib/sbi/openapi/model/smsf_info_1.c | 149 -- lib/sbi/openapi/model/smsf_info_1.h | 41 - lib/sbi/openapi/model/smsf_registration.c | 148 +- lib/sbi/openapi/model/smsf_registration.h | 16 +- lib/sbi/openapi/model/snssai.h | 2 +- lib/sbi/openapi/model/snssai_dnn_pair.c | 149 ++ lib/sbi/openapi/model/snssai_dnn_pair.h | 41 + .../openapi/model/snssai_easdf_info_item.c | 186 ++ .../openapi/model/snssai_easdf_info_item.h | 42 + lib/sbi/openapi/model/snssai_extension.c | 38 +- lib/sbi/openapi/model/snssai_extension.h | 13 +- lib/sbi/openapi/model/snssai_info_item.c | 186 ++ lib/sbi/openapi/model/snssai_info_item.h | 42 + .../openapi/model/snssai_mb_smf_info_item.c | 186 ++ .../openapi/model/snssai_mb_smf_info_item.h | 42 + .../model/snssai_route_selection_descriptor.h | 2 +- lib/sbi/openapi/model/snssai_smf_info_item.c | 12 +- lib/sbi/openapi/model/snssai_smf_info_item.h | 6 +- .../openapi/model/snssai_tsctsf_info_item.c | 186 ++ .../openapi/model/snssai_tsctsf_info_item.h | 42 + lib/sbi/openapi/model/snssai_upf_info_item.c | 12 +- lib/sbi/openapi/model/snssai_upf_info_item.h | 6 +- lib/sbi/openapi/model/sor_data.c | 26 +- lib/sbi/openapi/model/sor_data.h | 8 +- lib/sbi/openapi/model/sor_info.c | 94 +- lib/sbi/openapi/model/sor_info.h | 14 +- lib/sbi/openapi/model/sor_info_1.c | 94 +- lib/sbi/openapi/model/sor_info_1.h | 14 +- lib/sbi/openapi/model/sor_update_info.c | 27 +- lib/sbi/openapi/model/sor_update_info.h | 4 +- lib/sbi/openapi/model/spatial_validity.h | 2 +- lib/sbi/openapi/model/spatial_validity_cond.c | 232 ++ lib/sbi/openapi/model/spatial_validity_cond.h | 44 + .../openapi/model/spatial_validity_cond_1.c | 232 ++ .../openapi/model/spatial_validity_cond_1.h | 44 + lib/sbi/openapi/model/spatial_validity_rm.h | 2 +- .../openapi/model/sponsor_connectivity_data.h | 2 +- lib/sbi/openapi/model/ssm.c | 157 ++ lib/sbi/openapi/model/ssm.h | 41 + lib/sbi/openapi/model/ssm_1.c | 157 ++ lib/sbi/openapi/model/ssm_1.h | 41 + .../openapi/model/stationary_indication_rm.h | 2 +- lib/sbi/openapi/model/status_info.h | 2 +- lib/sbi/openapi/model/status_notification.c | 158 +- lib/sbi/openapi/model/status_notification.h | 18 +- lib/sbi/openapi/model/steer_mode_indicator.c | 30 + lib/sbi/openapi/model/steer_mode_indicator.h | 31 + lib/sbi/openapi/model/steering_info.h | 2 +- lib/sbi/openapi/model/steering_mode.c | 56 +- lib/sbi/openapi/model/steering_mode.h | 10 +- lib/sbi/openapi/model/stored_search_result.h | 2 +- lib/sbi/openapi/model/subscr_cond.c | 665 ++++++ lib/sbi/openapi/model/subscr_cond.h | 70 + .../openapi/model/subscribed_default_qos.h | 2 +- .../openapi/model/subscribed_default_qos_1.h | 2 +- lib/sbi/openapi/model/subscribed_event.h | 2 +- lib/sbi/openapi/model/subscribed_snssai.c | 58 +- lib/sbi/openapi/model/subscribed_snssai.h | 6 +- lib/sbi/openapi/model/subscription_context.c | 145 ++ lib/sbi/openapi/model/subscription_context.h | 41 + lib/sbi/openapi/model/subscription_data.c | 115 +- lib/sbi/openapi/model/subscription_data.h | 22 +- .../openapi/model/subscription_data_sets.c | 154 +- .../openapi/model/subscription_data_sets.h | 17 +- .../openapi/model/subscription_data_sets_1.c | 519 ----- .../openapi/model/subscription_data_sets_1.h | 75 - .../model/subscription_data_subscr_cond.c | 557 ----- .../model/subscription_data_subscr_cond.h | 66 - .../model/subscription_data_subscriptions.c | 57 +- .../model/subscription_data_subscriptions.h | 9 +- lib/sbi/openapi/model/suci_info.c | 201 ++ lib/sbi/openapi/model/suci_info.h | 40 + lib/sbi/openapi/model/supi_info.c | 145 ++ lib/sbi/openapi/model/supi_info.h | 38 + lib/sbi/openapi/model/supi_range.h | 2 +- lib/sbi/openapi/model/supported_gad_shapes.h | 2 +- .../model/supported_gad_shapes_any_of.c | 4 +- .../model/supported_gad_shapes_any_of.h | 2 +- lib/sbi/openapi/model/svc_experience.c | 153 ++ lib/sbi/openapi/model/svc_experience.h | 48 + lib/sbi/openapi/model/tac_info.h | 2 +- lib/sbi/openapi/model/tai.h | 2 +- lib/sbi/openapi/model/tai_1.h | 2 +- lib/sbi/openapi/model/target_area.c | 229 ++ lib/sbi/openapi/model/target_area.h | 46 + lib/sbi/openapi/model/target_dnai_info.c | 135 ++ lib/sbi/openapi/model/target_dnai_info.h | 41 + lib/sbi/openapi/model/target_ue_information.c | 271 +++ lib/sbi/openapi/model/target_ue_information.h | 46 + lib/sbi/openapi/model/temporal_validity.h | 2 +- lib/sbi/openapi/model/termination_cause.c | 4 +- lib/sbi/openapi/model/termination_cause.h | 2 +- lib/sbi/openapi/model/termination_info.h | 2 +- .../openapi/model/termination_notification.h | 2 +- lib/sbi/openapi/model/threshold_level.c | 331 +++ lib/sbi/openapi/model/threshold_level.h | 76 + lib/sbi/openapi/model/threshold_value.c | 131 ++ lib/sbi/openapi/model/threshold_value.h | 44 + lib/sbi/openapi/model/time_unit.c | 87 + lib/sbi/openapi/model/time_unit.h | 37 + lib/sbi/openapi/model/time_unit_any_of.c | 30 + lib/sbi/openapi/model/time_unit_any_of.h | 31 + lib/sbi/openapi/model/time_window.c | 4 +- lib/sbi/openapi/model/time_window.h | 2 +- lib/sbi/openapi/model/tmgi.c | 149 ++ lib/sbi/openapi/model/tmgi.h | 41 + lib/sbi/openapi/model/tmgi_1.c | 149 ++ lib/sbi/openapi/model/tmgi_1.h | 41 + lib/sbi/openapi/model/tmgi_range.c | 199 ++ lib/sbi/openapi/model/tmgi_range.h | 45 + lib/sbi/openapi/model/tnap_id.h | 2 +- lib/sbi/openapi/model/top_application.c | 163 ++ lib/sbi/openapi/model/top_application.h | 45 + lib/sbi/openapi/model/trace_data.h | 2 +- lib/sbi/openapi/model/trace_data_1.h | 2 +- .../openapi/model/traffic_characterization.c | 312 +++ .../openapi/model/traffic_characterization.h | 62 + lib/sbi/openapi/model/traffic_control_data.c | 156 +- lib/sbi/openapi/model/traffic_control_data.h | 23 +- lib/sbi/openapi/model/traffic_descriptor.h | 2 +- .../model/traffic_descriptor_components.c | 442 ++++ .../model/traffic_descriptor_components.h | 51 + lib/sbi/openapi/model/traffic_influ_data.c | 136 +- lib/sbi/openapi/model/traffic_influ_data.h | 24 +- .../openapi/model/traffic_influ_data_notif.h | 2 +- .../openapi/model/traffic_influ_data_patch.c | 182 +- .../openapi/model/traffic_influ_data_patch.h | 31 +- lib/sbi/openapi/model/traffic_influ_sub.c | 58 +- lib/sbi/openapi/model/traffic_influ_sub.h | 6 +- lib/sbi/openapi/model/traffic_information.c | 199 ++ lib/sbi/openapi/model/traffic_information.h | 52 + lib/sbi/openapi/model/traffic_profile_rm.h | 2 +- .../openapi/model/transfer_mo_data_req_data.h | 2 +- .../openapi/model/transfer_mt_data_add_info.h | 2 +- .../openapi/model/transfer_mt_data_error.c | 22 + .../openapi/model/transfer_mt_data_error.h | 6 +- .../openapi/model/transfer_mt_data_req_data.h | 2 +- lib/sbi/openapi/model/transport_protocol_1.c | 30 + lib/sbi/openapi/model/transport_protocol_1.h | 31 + lib/sbi/openapi/model/trigger_request.c | 35 +- lib/sbi/openapi/model/trigger_request.h | 5 +- lib/sbi/openapi/model/trigger_type_any_of.c | 4 +- lib/sbi/openapi/model/trigger_type_any_of.h | 2 +- lib/sbi/openapi/model/trust_af_info.c | 323 +++ lib/sbi/openapi/model/trust_af_info.h | 50 + lib/sbi/openapi/model/tscai_input_container.c | 48 +- lib/sbi/openapi/model/tscai_input_container.h | 10 +- lib/sbi/openapi/model/tsctsf_info.c | 400 ++++ lib/sbi/openapi/model/tsctsf_info.h | 50 + lib/sbi/openapi/model/tsn_bridge_info.h | 2 +- lib/sbi/openapi/model/tunnel_info.h | 2 +- lib/sbi/openapi/model/twap_id.h | 2 +- lib/sbi/openapi/model/uc_purpose.c | 30 + lib/sbi/openapi/model/uc_purpose.h | 31 + lib/sbi/openapi/model/uc_subscription_data.c | 150 ++ lib/sbi/openapi/model/uc_subscription_data.h | 39 + lib/sbi/openapi/model/udm_info.c | 64 +- lib/sbi/openapi/model/udm_info.h | 5 +- lib/sbi/openapi/model/udr_info.c | 64 +- lib/sbi/openapi/model/udr_info.h | 5 +- .../model/ue_analytics_context_descriptor.c | 178 ++ .../model/ue_analytics_context_descriptor.h | 41 + lib/sbi/openapi/model/ue_authentication_ctx.h | 2 +- lib/sbi/openapi/model/ue_camping_rep.c | 25 +- lib/sbi/openapi/model/ue_camping_rep.h | 7 +- lib/sbi/openapi/model/ue_communication.c | 410 ++++ lib/sbi/openapi/model/ue_communication.h | 82 + lib/sbi/openapi/model/ue_context.c | 903 +++++++- lib/sbi/openapi/model/ue_context.h | 76 +- .../model/ue_context_cancel_relocate_data.h | 2 +- .../openapi/model/ue_context_create_data.c | 31 + .../openapi/model/ue_context_create_data.h | 4 +- .../openapi/model/ue_context_create_error.h | 2 +- .../openapi/model/ue_context_created_data.c | 58 +- .../openapi/model/ue_context_created_data.h | 6 +- .../openapi/model/ue_context_in_amf_data.c | 64 +- .../openapi/model/ue_context_in_amf_data.h | 5 +- .../openapi/model/ue_context_in_amf_data_1.c | 118 - .../openapi/model/ue_context_in_amf_data_1.h | 39 - .../openapi/model/ue_context_in_smf_data_1.c | 251 --- .../openapi/model/ue_context_in_smf_data_1.h | 45 - .../model/ue_context_in_smf_data_sub_filter.c | 223 ++ .../model/ue_context_in_smf_data_sub_filter.h | 45 + .../ue_context_in_smf_data_sub_filter_1.c | 223 ++ .../ue_context_in_smf_data_sub_filter_1.h | 45 + .../openapi/model/ue_context_in_smsf_data_1.c | 149 -- .../openapi/model/ue_context_in_smsf_data_1.h | 41 - lib/sbi/openapi/model/ue_context_release.h | 2 +- .../openapi/model/ue_context_relocate_data.h | 2 +- .../openapi/model/ue_context_relocated_data.c | 14 +- .../openapi/model/ue_context_relocated_data.h | 2 +- .../model/ue_context_transfer_200_response.c | 37 +- .../model/ue_context_transfer_200_response.h | 4 +- .../model/ue_context_transfer_req_data.h | 2 +- .../model/ue_context_transfer_rsp_data.c | 31 + .../model/ue_context_transfer_rsp_data.h | 4 +- .../openapi/model/ue_differentiation_info.h | 2 +- lib/sbi/openapi/model/ue_in_area_filter.c | 140 ++ lib/sbi/openapi/model/ue_in_area_filter.h | 43 + .../model/ue_initiated_resource_request.h | 2 +- lib/sbi/openapi/model/ue_mobility.c | 245 +++ lib/sbi/openapi/model/ue_mobility.h | 52 + .../ue_n1_n2_info_subscription_create_data.h | 2 +- .../ue_n1_n2_info_subscription_created_data.h | 2 +- lib/sbi/openapi/model/ue_policy_set.c | 58 +- lib/sbi/openapi/model/ue_policy_set.h | 4 +- lib/sbi/openapi/model/ue_reachability.h | 2 +- lib/sbi/openapi/model/ue_reachable_ind.c | 30 + lib/sbi/openapi/model/ue_reachable_ind.h | 31 + .../model/ue_reg_status_update_req_data.c | 118 +- .../model/ue_reg_status_update_req_data.h | 9 +- .../model/ue_reg_status_update_rsp_data.h | 2 +- lib/sbi/openapi/model/ue_slice_mbr.c | 230 ++ lib/sbi/openapi/model/ue_slice_mbr.h | 44 + lib/sbi/openapi/model/ue_type.c | 87 + lib/sbi/openapi/model/ue_type.h | 37 + lib/sbi/openapi/model/ue_type_any_of.c | 30 + lib/sbi/openapi/model/ue_type_any_of.h | 31 + lib/sbi/openapi/model/ue_update_status.h | 2 +- lib/sbi/openapi/model/ulcl_bp_information.h | 2 +- lib/sbi/openapi/model/umt_time.c | 134 ++ lib/sbi/openapi/model/umt_time.h | 40 + lib/sbi/openapi/model/umt_time_1.c | 134 ++ lib/sbi/openapi/model/umt_time_1.h | 40 + lib/sbi/openapi/model/un_trust_af_info.c | 196 ++ lib/sbi/openapi/model/un_trust_af_info.h | 45 + lib/sbi/openapi/model/uncertainty_ellipse.h | 2 +- lib/sbi/openapi/model/uncertainty_ellipsoid.c | 167 ++ lib/sbi/openapi/model/uncertainty_ellipsoid.h | 44 + lib/sbi/openapi/model/unrelated_class_1.c | 213 -- lib/sbi/openapi/model/unrelated_class_1.h | 45 - lib/sbi/openapi/model/up_interface_type.c | 4 +- lib/sbi/openapi/model/up_interface_type.h | 2 +- lib/sbi/openapi/model/up_path_chg_event.h | 2 +- lib/sbi/openapi/model/up_security.h | 2 +- lib/sbi/openapi/model/up_security_1.h | 2 +- lib/sbi/openapi/model/up_security_info.h | 2 +- .../update_nwdaf_registration_200_response.c | 396 ++++ .../update_nwdaf_registration_200_response.h | 57 + lib/sbi/openapi/model/updated_item.c | 24 +- lib/sbi/openapi/model/updated_item.h | 5 +- .../openapi/model/updp_subscription_data.c | 187 ++ .../openapi/model/updp_subscription_data.h | 44 + lib/sbi/openapi/model/upf_cond.h | 2 +- lib/sbi/openapi/model/upf_info.c | 87 +- lib/sbi/openapi/model/upf_info.h | 7 +- lib/sbi/openapi/model/upf_information.c | 141 ++ lib/sbi/openapi/model/upf_information.h | 41 + lib/sbi/openapi/model/upu_data.h | 2 +- lib/sbi/openapi/model/upu_data_1.h | 2 +- lib/sbi/openapi/model/upu_data_2.h | 2 +- lib/sbi/openapi/model/upu_info.c | 69 +- lib/sbi/openapi/model/upu_info.h | 8 +- lib/sbi/openapi/model/upu_info_1.c | 69 +- lib/sbi/openapi/model/upu_info_1.h | 8 +- ...nf_instances_200_response.c => uri_list.c} | 92 +- lib/sbi/openapi/model/uri_list.h | 43 + lib/sbi/openapi/model/ursp_rule_request.c | 200 ++ lib/sbi/openapi/model/ursp_rule_request.h | 46 + lib/sbi/openapi/model/usage_mon_data.c | 80 +- lib/sbi/openapi/model/usage_mon_data.h | 9 +- lib/sbi/openapi/model/usage_mon_data_limit.c | 24 +- lib/sbi/openapi/model/usage_mon_data_limit.h | 5 +- lib/sbi/openapi/model/usage_mon_data_scope.h | 2 +- lib/sbi/openapi/model/usage_mon_level.h | 2 +- lib/sbi/openapi/model/usage_monitoring_data.h | 2 +- lib/sbi/openapi/model/usage_threshold.h | 2 +- lib/sbi/openapi/model/usage_threshold_rm.h | 2 +- lib/sbi/openapi/model/user_consent.c | 30 + lib/sbi/openapi/model/user_consent.h | 31 + .../openapi/model/user_data_congestion_info.c | 188 ++ .../openapi/model/user_data_congestion_info.h | 45 + lib/sbi/openapi/model/user_identifier.h | 2 +- lib/sbi/openapi/model/user_location.c | 66 +- lib/sbi/openapi/model/user_location.h | 10 +- lib/sbi/openapi/model/utra_location.c | 302 +++ lib/sbi/openapi/model/utra_location.h | 58 + lib/sbi/openapi/model/uuaa_mm_status.c | 30 + lib/sbi/openapi/model/uuaa_mm_status.h | 31 + lib/sbi/openapi/model/v2x_capability.c | 131 ++ lib/sbi/openapi/model/v2x_capability.h | 44 + lib/sbi/openapi/model/v2x_context.c | 4 +- lib/sbi/openapi/model/v2x_context.h | 2 +- lib/sbi/openapi/model/v2x_information.h | 2 +- .../openapi/model/v2x_subscription_data_1.c | 195 -- .../openapi/model/v2x_subscription_data_1.h | 46 - lib/sbi/openapi/model/valid_time_period_1.c | 133 -- lib/sbi/openapi/model/valid_time_period_1.h | 40 - lib/sbi/openapi/model/volume_timed_report.h | 2 +- lib/sbi/openapi/model/vplmn_qos.h | 2 +- lib/sbi/openapi/model/vsmf_update_data.c | 156 +- lib/sbi/openapi/model/vsmf_update_data.h | 21 +- lib/sbi/openapi/model/vsmf_update_error.c | 47 +- lib/sbi/openapi/model/vsmf_update_error.h | 12 +- lib/sbi/openapi/model/vsmf_updated_data.c | 35 +- lib/sbi/openapi/model/vsmf_updated_data.h | 6 +- lib/sbi/openapi/model/wireline_area.h | 2 +- lib/sbi/openapi/model/wireline_area_1.h | 2 +- .../model/wireline_service_area_restriction.h | 2 +- .../wireline_service_area_restriction_1.h | 2 +- .../openapi/model/wlan_ordering_criterion.c | 87 + .../openapi/model/wlan_ordering_criterion.h | 37 + .../model/wlan_ordering_criterion_any_of.c | 30 + .../model/wlan_ordering_criterion_any_of.h | 31 + .../model/wlan_per_ss_id_performance_info.c | 178 ++ .../model/wlan_per_ss_id_performance_info.h | 41 + .../model/wlan_per_ts_performance_info.c | 253 +++ .../model/wlan_per_ts_performance_info.h | 59 + lib/sbi/openapi/model/wlan_performance_info.c | 182 ++ lib/sbi/openapi/model/wlan_performance_info.h | 42 + lib/sbi/openapi/model/wlan_performance_req.c | 257 +++ lib/sbi/openapi/model/wlan_performance_req.h | 46 + src/nrf/nnrf-handler.c | 2 +- 1687 files changed, 121604 insertions(+), 9310 deletions(-) create mode 100644 lib/sbi/openapi/model/aanf_info.c create mode 100644 lib/sbi/openapi/model/aanf_info.h create mode 100644 lib/sbi/openapi/model/abnormal_behaviour.c create mode 100644 lib/sbi/openapi/model/abnormal_behaviour.h create mode 100644 lib/sbi/openapi/model/accuracy.c create mode 100644 lib/sbi/openapi/model/accuracy.h create mode 100644 lib/sbi/openapi/model/accuracy_any_of.c create mode 100644 lib/sbi/openapi/model/accuracy_any_of.h create mode 100644 lib/sbi/openapi/model/additional_ee_subs_info.c create mode 100644 lib/sbi/openapi/model/additional_ee_subs_info.h create mode 100644 lib/sbi/openapi/model/additional_measurement.c create mode 100644 lib/sbi/openapi/model/additional_measurement.h create mode 100644 lib/sbi/openapi/model/additional_snssai_data_1.c create mode 100644 lib/sbi/openapi/model/additional_snssai_data_1.h create mode 100644 lib/sbi/openapi/model/addr_fqdn.c create mode 100644 lib/sbi/openapi/model/addr_fqdn.h create mode 100644 lib/sbi/openapi/model/address_list.c create mode 100644 lib/sbi/openapi/model/address_list.h create mode 100644 lib/sbi/openapi/model/aerial_ue_indication.c create mode 100644 lib/sbi/openapi/model/aerial_ue_indication.h create mode 100644 lib/sbi/openapi/model/aerial_ue_subscription_info.c create mode 100644 lib/sbi/openapi/model/aerial_ue_subscription_info.h create mode 100644 lib/sbi/openapi/model/aerial_ue_subscription_info_1.c create mode 100644 lib/sbi/openapi/model/aerial_ue_subscription_info_1.h create mode 100644 lib/sbi/openapi/model/af_coordination_info.c create mode 100644 lib/sbi/openapi/model/af_coordination_info.h create mode 100644 lib/sbi/openapi/model/alternative_service_requirements_data.c create mode 100644 lib/sbi/openapi/model/alternative_service_requirements_data.h create mode 100644 lib/sbi/openapi/model/am_influ_data.c create mode 100644 lib/sbi/openapi/model/am_influ_data.h create mode 100644 lib/sbi/openapi/model/am_influ_event.c create mode 100644 lib/sbi/openapi/model/am_influ_event.h create mode 100644 lib/sbi/openapi/model/am_influ_event_any_of.c create mode 100644 lib/sbi/openapi/model/am_influ_event_any_of.h create mode 100644 lib/sbi/openapi/model/am_requested_value_rep.c create mode 100644 lib/sbi/openapi/model/am_requested_value_rep.h delete mode 100644 lib/sbi/openapi/model/amf_status_change_subscription_data.c delete mode 100644 lib/sbi/openapi/model/amf_status_change_subscription_data.h create mode 100644 lib/sbi/openapi/model/analytics_metadata.c create mode 100644 lib/sbi/openapi/model/analytics_metadata.h create mode 100644 lib/sbi/openapi/model/analytics_metadata_any_of.c create mode 100644 lib/sbi/openapi/model/analytics_metadata_any_of.h create mode 100644 lib/sbi/openapi/model/analytics_metadata_indication.c create mode 100644 lib/sbi/openapi/model/analytics_metadata_indication.h create mode 100644 lib/sbi/openapi/model/analytics_metadata_info.c create mode 100644 lib/sbi/openapi/model/analytics_metadata_info.h create mode 100644 lib/sbi/openapi/model/analytics_subscription.c create mode 100644 lib/sbi/openapi/model/analytics_subscription.h create mode 100644 lib/sbi/openapi/model/analytics_subset.c create mode 100644 lib/sbi/openapi/model/analytics_subset.h create mode 100644 lib/sbi/openapi/model/analytics_subset_any_of.c create mode 100644 lib/sbi/openapi/model/analytics_subset_any_of.h create mode 100644 lib/sbi/openapi/model/anchor_smf_features.c create mode 100644 lib/sbi/openapi/model/anchor_smf_features.h create mode 100644 lib/sbi/openapi/model/app_descriptor_1.c create mode 100644 lib/sbi/openapi/model/app_descriptor_1.h create mode 100644 lib/sbi/openapi/model/app_detection_notif_type.c create mode 100644 lib/sbi/openapi/model/app_detection_notif_type.h create mode 100644 lib/sbi/openapi/model/app_detection_report.c create mode 100644 lib/sbi/openapi/model/app_detection_report.h create mode 100644 lib/sbi/openapi/model/app_list_for_ue_comm.c create mode 100644 lib/sbi/openapi/model/app_list_for_ue_comm.h create mode 100644 lib/sbi/openapi/model/application_volume.c create mode 100644 lib/sbi/openapi/model/application_volume.h create mode 100644 lib/sbi/openapi/model/area_of_interest_event_state.c create mode 100644 lib/sbi/openapi/model/area_of_interest_event_state.h create mode 100644 lib/sbi/openapi/model/as_time_distribution_param.c create mode 100644 lib/sbi/openapi/model/as_time_distribution_param.h delete mode 100644 lib/sbi/openapi/model/atsss_capability_any_of.c delete mode 100644 lib/sbi/openapi/model/atsss_capability_any_of.h create mode 100644 lib/sbi/openapi/model/authorization_info.c create mode 100644 lib/sbi/openapi/model/authorization_info.h create mode 100644 lib/sbi/openapi/model/bsf_event.c create mode 100644 lib/sbi/openapi/model/bsf_event.h create mode 100644 lib/sbi/openapi/model/bsf_event_notification.c create mode 100644 lib/sbi/openapi/model/bsf_event_notification.h create mode 100644 lib/sbi/openapi/model/bsf_notification.c create mode 100644 lib/sbi/openapi/model/bsf_notification.h create mode 100644 lib/sbi/openapi/model/bsf_subscription.c create mode 100644 lib/sbi/openapi/model/bsf_subscription.h create mode 100644 lib/sbi/openapi/model/bsf_subscription_resp.c create mode 100644 lib/sbi/openapi/model/bsf_subscription_resp.h create mode 100644 lib/sbi/openapi/model/bw_requirement.c create mode 100644 lib/sbi/openapi/model/bw_requirement.h create mode 100644 lib/sbi/openapi/model/cell_global_id.c create mode 100644 lib/sbi/openapi/model/cell_global_id.h create mode 100644 lib/sbi/openapi/model/circumstance_description.c create mode 100644 lib/sbi/openapi/model/circumstance_description.h create mode 100644 lib/sbi/openapi/model/class_criterion.c create mode 100644 lib/sbi/openapi/model/class_criterion.h create mode 100644 lib/sbi/openapi/model/collocated_nf_instance.c create mode 100644 lib/sbi/openapi/model/collocated_nf_instance.h create mode 100644 lib/sbi/openapi/model/collocated_nf_type.c create mode 100644 lib/sbi/openapi/model/collocated_nf_type.h create mode 100644 lib/sbi/openapi/model/communication_characteristics_af.c create mode 100644 lib/sbi/openapi/model/communication_characteristics_af.h create mode 100644 lib/sbi/openapi/model/congestion_info.c create mode 100644 lib/sbi/openapi/model/congestion_info.h create mode 100644 lib/sbi/openapi/model/congestion_type.c create mode 100644 lib/sbi/openapi/model/congestion_type.h create mode 100644 lib/sbi/openapi/model/congestion_type_any_of.c create mode 100644 lib/sbi/openapi/model/congestion_type_any_of.h create mode 100644 lib/sbi/openapi/model/connection_capabilities.c create mode 100644 lib/sbi/openapi/model/connection_capabilities.h create mode 100644 lib/sbi/openapi/model/connection_capabilities_any_of.c create mode 100644 lib/sbi/openapi/model/connection_capabilities_any_of.h create mode 100644 lib/sbi/openapi/model/consumer_nf_information.c create mode 100644 lib/sbi/openapi/model/consumer_nf_information.h create mode 100644 lib/sbi/openapi/model/data_restoration_notification.c create mode 100644 lib/sbi/openapi/model/data_restoration_notification.h create mode 100644 lib/sbi/openapi/model/datalink_reporting_configuration_1.c create mode 100644 lib/sbi/openapi/model/datalink_reporting_configuration_1.h create mode 100644 lib/sbi/openapi/model/dataset_statistical_property.c create mode 100644 lib/sbi/openapi/model/dataset_statistical_property.h create mode 100644 lib/sbi/openapi/model/dataset_statistical_property_any_of.c create mode 100644 lib/sbi/openapi/model/dataset_statistical_property_any_of.h create mode 100644 lib/sbi/openapi/model/dccf_cond.c create mode 100644 lib/sbi/openapi/model/dccf_cond.h create mode 100644 lib/sbi/openapi/model/dccf_info.c create mode 100644 lib/sbi/openapi/model/dccf_info.h create mode 100644 lib/sbi/openapi/model/ddd_traffic_descriptor_1.c create mode 100644 lib/sbi/openapi/model/ddd_traffic_descriptor_1.h create mode 100644 lib/sbi/openapi/model/def_sub_service_info.c create mode 100644 lib/sbi/openapi/model/def_sub_service_info.h delete mode 100644 lib/sbi/openapi/model/default_unrelated_class_1.c delete mode 100644 lib/sbi/openapi/model/default_unrelated_class_1.h create mode 100644 lib/sbi/openapi/model/dispersion_area.c create mode 100644 lib/sbi/openapi/model/dispersion_area.h create mode 100644 lib/sbi/openapi/model/dispersion_class.c create mode 100644 lib/sbi/openapi/model/dispersion_class.h create mode 100644 lib/sbi/openapi/model/dispersion_class_one_of.c create mode 100644 lib/sbi/openapi/model/dispersion_class_one_of.h create mode 100644 lib/sbi/openapi/model/dispersion_collection.c create mode 100644 lib/sbi/openapi/model/dispersion_collection.h create mode 100644 lib/sbi/openapi/model/dispersion_info.c create mode 100644 lib/sbi/openapi/model/dispersion_info.h create mode 100644 lib/sbi/openapi/model/dispersion_ordering_criterion.c create mode 100644 lib/sbi/openapi/model/dispersion_ordering_criterion.h create mode 100644 lib/sbi/openapi/model/dispersion_ordering_criterion_any_of.c create mode 100644 lib/sbi/openapi/model/dispersion_ordering_criterion_any_of.h create mode 100644 lib/sbi/openapi/model/dispersion_requirement.c create mode 100644 lib/sbi/openapi/model/dispersion_requirement.h create mode 100644 lib/sbi/openapi/model/dispersion_type.c create mode 100644 lib/sbi/openapi/model/dispersion_type.h create mode 100644 lib/sbi/openapi/model/dispersion_type_one_of.c create mode 100644 lib/sbi/openapi/model/dispersion_type_one_of.h create mode 100644 lib/sbi/openapi/model/dn_perf.c create mode 100644 lib/sbi/openapi/model/dn_perf.h create mode 100644 lib/sbi/openapi/model/dn_perf_info.c create mode 100644 lib/sbi/openapi/model/dn_perf_info.h create mode 100644 lib/sbi/openapi/model/dn_perf_ordering_criterion.c create mode 100644 lib/sbi/openapi/model/dn_perf_ordering_criterion.h create mode 100644 lib/sbi/openapi/model/dn_perf_ordering_criterion_any_of.c create mode 100644 lib/sbi/openapi/model/dn_perf_ordering_criterion_any_of.h create mode 100644 lib/sbi/openapi/model/dn_performance_req.c create mode 100644 lib/sbi/openapi/model/dn_performance_req.h create mode 100644 lib/sbi/openapi/model/dnn_easdf_info_item.c create mode 100644 lib/sbi/openapi/model/dnn_easdf_info_item.h create mode 100644 lib/sbi/openapi/model/dnn_info_item.c create mode 100644 lib/sbi/openapi/model/dnn_info_item.h create mode 100644 lib/sbi/openapi/model/dnn_mb_smf_info_item.c create mode 100644 lib/sbi/openapi/model/dnn_mb_smf_info_item.h create mode 100644 lib/sbi/openapi/model/dnn_smf_info_item_dnai_list_inner.c create mode 100644 lib/sbi/openapi/model/dnn_smf_info_item_dnai_list_inner.h create mode 100644 lib/sbi/openapi/model/dnn_snssai_information.c create mode 100644 lib/sbi/openapi/model/dnn_snssai_information.h create mode 100644 lib/sbi/openapi/model/dnn_tsctsf_info_item.c create mode 100644 lib/sbi/openapi/model/dnn_tsctsf_info_item.h create mode 100644 lib/sbi/openapi/model/eas_ip_replacement_info.c create mode 100644 lib/sbi/openapi/model/eas_ip_replacement_info.h create mode 100644 lib/sbi/openapi/model/eas_server_address.c create mode 100644 lib/sbi/openapi/model/eas_server_address.h create mode 100644 lib/sbi/openapi/model/easdf_info.c create mode 100644 lib/sbi/openapi/model/easdf_info.h create mode 100644 lib/sbi/openapi/model/ec_restriction_1.c create mode 100644 lib/sbi/openapi/model/ec_restriction_1.h create mode 100644 lib/sbi/openapi/model/ecs_addr_config_info.c create mode 100644 lib/sbi/openapi/model/ecs_addr_config_info.h create mode 100644 lib/sbi/openapi/model/ecs_addr_config_info_1.c create mode 100644 lib/sbi/openapi/model/ecs_addr_config_info_1.h create mode 100644 lib/sbi/openapi/model/ecs_server_addr.c create mode 100644 lib/sbi/openapi/model/ecs_server_addr.h create mode 100644 lib/sbi/openapi/model/ee_subscription_1.c create mode 100644 lib/sbi/openapi/model/ee_subscription_1.h create mode 100644 lib/sbi/openapi/model/ee_subscription_ext.c create mode 100644 lib/sbi/openapi/model/ee_subscription_ext.h delete mode 100644 lib/sbi/openapi/model/emergency_info_1.c delete mode 100644 lib/sbi/openapi/model/emergency_info_1.h create mode 100644 lib/sbi/openapi/model/event.c create mode 100644 lib/sbi/openapi/model/event.h create mode 100644 lib/sbi/openapi/model/event_any_of.c create mode 100644 lib/sbi/openapi/model/event_any_of.h create mode 100644 lib/sbi/openapi/model/event_notification.c create mode 100644 lib/sbi/openapi/model/event_notification.h create mode 100644 lib/sbi/openapi/model/event_reporting_requirement.c create mode 100644 lib/sbi/openapi/model/event_reporting_requirement.h create mode 100644 lib/sbi/openapi/model/event_subscription.c create mode 100644 lib/sbi/openapi/model/event_subscription.h create mode 100644 lib/sbi/openapi/model/exception.c create mode 100644 lib/sbi/openapi/model/exception.h create mode 100644 lib/sbi/openapi/model/exception_id.c create mode 100644 lib/sbi/openapi/model/exception_id.h create mode 100644 lib/sbi/openapi/model/exception_id_any_of.c create mode 100644 lib/sbi/openapi/model/exception_id_any_of.h create mode 100644 lib/sbi/openapi/model/exception_trend.c create mode 100644 lib/sbi/openapi/model/exception_trend.h create mode 100644 lib/sbi/openapi/model/exception_trend_any_of.c create mode 100644 lib/sbi/openapi/model/exception_trend_any_of.h create mode 100644 lib/sbi/openapi/model/expected_analytics_type.c create mode 100644 lib/sbi/openapi/model/expected_analytics_type.h create mode 100644 lib/sbi/openapi/model/expected_analytics_type_any_of.c create mode 100644 lib/sbi/openapi/model/expected_analytics_type_any_of.h create mode 100644 lib/sbi/openapi/model/extended_sm_subs_data.c create mode 100644 lib/sbi/openapi/model/extended_sm_subs_data.h create mode 100644 lib/sbi/openapi/model/failure_event_info.c create mode 100644 lib/sbi/openapi/model/failure_event_info.h create mode 100644 lib/sbi/openapi/model/flow_direction_rm.c create mode 100644 lib/sbi/openapi/model/flow_direction_rm.h create mode 100644 lib/sbi/openapi/model/fqdn_rm.c create mode 100644 lib/sbi/openapi/model/fqdn_rm.h create mode 100644 lib/sbi/openapi/model/gba_auth_type.c create mode 100644 lib/sbi/openapi/model/gba_auth_type.h create mode 100644 lib/sbi/openapi/model/gba_authentication_info_request.c create mode 100644 lib/sbi/openapi/model/gba_authentication_info_request.h create mode 100644 lib/sbi/openapi/model/gba_authentication_info_result.c create mode 100644 lib/sbi/openapi/model/gba_authentication_info_result.h create mode 100644 lib/sbi/openapi/model/geo_service_area.c create mode 100644 lib/sbi/openapi/model/geo_service_area.h create mode 100644 lib/sbi/openapi/model/geo_service_area_1.c create mode 100644 lib/sbi/openapi/model/geo_service_area_1.h create mode 100644 lib/sbi/openapi/model/geographical_area.c create mode 100644 lib/sbi/openapi/model/geographical_area.h create mode 100644 lib/sbi/openapi/model/gera_location.c create mode 100644 lib/sbi/openapi/model/gera_location.h create mode 100644 lib/sbi/openapi/model/get_multiple_pp_data_entries_ue_id_parameter.c create mode 100644 lib/sbi/openapi/model/get_multiple_pp_data_entries_ue_id_parameter.h delete mode 100644 lib/sbi/openapi/model/get_nf_instances_200_response.h create mode 100644 lib/sbi/openapi/model/gpsi_type.c create mode 100644 lib/sbi/openapi/model/gpsi_type.h create mode 100644 lib/sbi/openapi/model/hss_subscription_info.c create mode 100644 lib/sbi/openapi/model/hss_subscription_info.h create mode 100644 lib/sbi/openapi/model/hss_subscription_item.c create mode 100644 lib/sbi/openapi/model/hss_subscription_item.h create mode 100644 lib/sbi/openapi/model/immediate_report.c create mode 100644 lib/sbi/openapi/model/immediate_report.h delete mode 100644 lib/sbi/openapi/model/invalid_param_1.c delete mode 100644 lib/sbi/openapi/model/invalid_param_1.h create mode 100644 lib/sbi/openapi/model/ip_addr.c create mode 100644 lib/sbi/openapi/model/ip_addr.h create mode 100644 lib/sbi/openapi/model/ip_addr_1.c create mode 100644 lib/sbi/openapi/model/ip_addr_1.h create mode 100644 lib/sbi/openapi/model/ip_eth_flow_description.c create mode 100644 lib/sbi/openapi/model/ip_eth_flow_description.h create mode 100644 lib/sbi/openapi/model/ip_index.c create mode 100644 lib/sbi/openapi/model/ip_index.h create mode 100644 lib/sbi/openapi/model/ip_sm_gw_guidance.c create mode 100644 lib/sbi/openapi/model/ip_sm_gw_guidance.h create mode 100644 lib/sbi/openapi/model/ip_sm_gw_info.c create mode 100644 lib/sbi/openapi/model/ip_sm_gw_info.h create mode 100644 lib/sbi/openapi/model/iwmsc_info.c create mode 100644 lib/sbi/openapi/model/iwmsc_info.h delete mode 100644 lib/sbi/openapi/model/lcs_broadcast_assistance_types_data_1.c delete mode 100644 lib/sbi/openapi/model/lcs_broadcast_assistance_types_data_1.h delete mode 100644 lib/sbi/openapi/model/lcs_privacy_data_1.c delete mode 100644 lib/sbi/openapi/model/lcs_privacy_data_1.h create mode 100644 lib/sbi/openapi/model/local2d_point_uncertainty_ellipse.c create mode 100644 lib/sbi/openapi/model/local2d_point_uncertainty_ellipse.h create mode 100644 lib/sbi/openapi/model/local2d_point_uncertainty_ellipse_all_of.c create mode 100644 lib/sbi/openapi/model/local2d_point_uncertainty_ellipse_all_of.h create mode 100644 lib/sbi/openapi/model/local3d_point_uncertainty_ellipsoid.c create mode 100644 lib/sbi/openapi/model/local3d_point_uncertainty_ellipsoid.h create mode 100644 lib/sbi/openapi/model/local3d_point_uncertainty_ellipsoid_all_of.c create mode 100644 lib/sbi/openapi/model/local3d_point_uncertainty_ellipsoid_all_of.h create mode 100644 lib/sbi/openapi/model/local_origin.c create mode 100644 lib/sbi/openapi/model/local_origin.h create mode 100644 lib/sbi/openapi/model/location_area_id.c create mode 100644 lib/sbi/openapi/model/location_area_id.h create mode 100644 lib/sbi/openapi/model/location_reporting_configuration_1.c create mode 100644 lib/sbi/openapi/model/location_reporting_configuration_1.h create mode 100644 lib/sbi/openapi/model/loss_connectivity_cfg_1.c create mode 100644 lib/sbi/openapi/model/loss_connectivity_cfg_1.h delete mode 100644 lib/sbi/openapi/model/lpi_1.c delete mode 100644 lib/sbi/openapi/model/lpi_1.h delete mode 100644 lib/sbi/openapi/model/lte_v2x_auth_1.c delete mode 100644 lib/sbi/openapi/model/lte_v2x_auth_1.h create mode 100644 lib/sbi/openapi/model/matching_direction.c create mode 100644 lib/sbi/openapi/model/matching_direction.h create mode 100644 lib/sbi/openapi/model/matching_direction_any_of.c create mode 100644 lib/sbi/openapi/model/matching_direction_any_of.h create mode 100644 lib/sbi/openapi/model/mb_smf_info.c create mode 100644 lib/sbi/openapi/model/mb_smf_info.h create mode 100644 lib/sbi/openapi/model/mb_upf_info.c create mode 100644 lib/sbi/openapi/model/mb_upf_info.h create mode 100644 lib/sbi/openapi/model/mbs_binding_resp.c create mode 100644 lib/sbi/openapi/model/mbs_binding_resp.h create mode 100644 lib/sbi/openapi/model/mbs_ext_problem_details.c create mode 100644 lib/sbi/openapi/model/mbs_ext_problem_details.h create mode 100644 lib/sbi/openapi/model/mbs_service_area.c create mode 100644 lib/sbi/openapi/model/mbs_service_area.h create mode 100644 lib/sbi/openapi/model/mbs_service_area_info.c create mode 100644 lib/sbi/openapi/model/mbs_service_area_info.h create mode 100644 lib/sbi/openapi/model/mbs_session.c create mode 100644 lib/sbi/openapi/model/mbs_session.h create mode 100644 lib/sbi/openapi/model/mbs_session_id.c create mode 100644 lib/sbi/openapi/model/mbs_session_id.h create mode 100644 lib/sbi/openapi/model/mbs_session_id_1.c create mode 100644 lib/sbi/openapi/model/mbs_session_id_1.h create mode 100644 lib/sbi/openapi/model/mbs_subscription_data.c create mode 100644 lib/sbi/openapi/model/mbs_subscription_data.h create mode 100644 lib/sbi/openapi/model/mbs_subscription_data_1.c create mode 100644 lib/sbi/openapi/model/mbs_subscription_data_1.h create mode 100644 lib/sbi/openapi/model/mfaf_info.c create mode 100644 lib/sbi/openapi/model/mfaf_info.h create mode 100644 lib/sbi/openapi/model/ml_analytics_info.c create mode 100644 lib/sbi/openapi/model/ml_analytics_info.h create mode 100644 lib/sbi/openapi/model/mnpf_info.c create mode 100644 lib/sbi/openapi/model/mnpf_info.h create mode 100644 lib/sbi/openapi/model/model_3_g_aka_av.c create mode 100644 lib/sbi/openapi/model/model_3_g_aka_av.h create mode 100644 lib/sbi/openapi/model/model_5_g_ddnmf_info.c create mode 100644 lib/sbi/openapi/model/model_5_g_ddnmf_info.h create mode 100644 lib/sbi/openapi/model/model_5_mbs_authorization_info.c create mode 100644 lib/sbi/openapi/model/model_5_mbs_authorization_info.h create mode 100644 lib/sbi/openapi/model/modifysubscription_data_subscription_200_response.c create mode 100644 lib/sbi/openapi/model/modifysubscription_data_subscription_200_response.h create mode 100644 lib/sbi/openapi/model/monitoring_configuration_1.c create mode 100644 lib/sbi/openapi/model/monitoring_configuration_1.h create mode 100644 lib/sbi/openapi/model/mps_action.c create mode 100644 lib/sbi/openapi/model/mps_action.h delete mode 100644 lib/sbi/openapi/model/multicast_access_control_any_of.c delete mode 100644 lib/sbi/openapi/model/multicast_access_control_any_of.h create mode 100644 lib/sbi/openapi/model/n2_info_notify_request.c create mode 100644 lib/sbi/openapi/model/n2_info_notify_request.h create mode 100644 lib/sbi/openapi/model/namf_subscription_data.c create mode 100644 lib/sbi/openapi/model/namf_subscription_data.h create mode 100644 lib/sbi/openapi/model/ncgi_tai.c create mode 100644 lib/sbi/openapi/model/ncgi_tai.h create mode 100644 lib/sbi/openapi/model/network_area_info_2.c create mode 100644 lib/sbi/openapi/model/network_area_info_2.h create mode 100644 lib/sbi/openapi/model/network_perf_info.c create mode 100644 lib/sbi/openapi/model/network_perf_info.h create mode 100644 lib/sbi/openapi/model/network_perf_requirement.c create mode 100644 lib/sbi/openapi/model/network_perf_requirement.h create mode 100644 lib/sbi/openapi/model/network_perf_type.c create mode 100644 lib/sbi/openapi/model/network_perf_type.h create mode 100644 lib/sbi/openapi/model/network_perf_type_any_of.c create mode 100644 lib/sbi/openapi/model/network_perf_type_any_of.h create mode 100644 lib/sbi/openapi/model/nf_group_list_cond.c create mode 100644 lib/sbi/openapi/model/nf_group_list_cond.h create mode 100644 lib/sbi/openapi/model/nf_identifier.c create mode 100644 lib/sbi/openapi/model/nf_identifier.h create mode 100644 lib/sbi/openapi/model/nf_instance_info.c create mode 100644 lib/sbi/openapi/model/nf_instance_info.h create mode 100644 lib/sbi/openapi/model/nf_load_level_information.c create mode 100644 lib/sbi/openapi/model/nf_load_level_information.h create mode 100644 lib/sbi/openapi/model/nf_service_instance.c create mode 100644 lib/sbi/openapi/model/nf_service_instance.h create mode 100644 lib/sbi/openapi/model/nidd_authorization_info.c create mode 100644 lib/sbi/openapi/model/nidd_authorization_info.h create mode 100644 lib/sbi/openapi/model/nnwdaf_events_subscription.c create mode 100644 lib/sbi/openapi/model/nnwdaf_events_subscription.h create mode 100644 lib/sbi/openapi/model/nnwdaf_nf_status.c create mode 100644 lib/sbi/openapi/model/nnwdaf_nf_status.h create mode 100644 lib/sbi/openapi/model/no_profile_match_info.c create mode 100644 lib/sbi/openapi/model/no_profile_match_info.h create mode 100644 lib/sbi/openapi/model/no_profile_match_reason.c create mode 100644 lib/sbi/openapi/model/no_profile_match_reason.h create mode 100644 lib/sbi/openapi/model/no_profile_match_reason_any_of.c create mode 100644 lib/sbi/openapi/model/no_profile_match_reason_any_of.h create mode 100644 lib/sbi/openapi/model/notification_flag.c create mode 100644 lib/sbi/openapi/model/notification_flag.h create mode 100644 lib/sbi/openapi/model/notification_info.c create mode 100644 lib/sbi/openapi/model/notification_info.h create mode 100644 lib/sbi/openapi/model/notification_method.c create mode 100644 lib/sbi/openapi/model/notification_method.h create mode 100644 lib/sbi/openapi/model/notification_method_1.c create mode 100644 lib/sbi/openapi/model/notification_method_1.h create mode 100644 lib/sbi/openapi/model/notification_method_1_any_of.c create mode 100644 lib/sbi/openapi/model/notification_method_1_any_of.h create mode 100644 lib/sbi/openapi/model/notification_method_any_of.c create mode 100644 lib/sbi/openapi/model/notification_method_any_of.h create mode 100644 lib/sbi/openapi/model/npcf_atsss_capability.c create mode 100644 lib/sbi/openapi/model/npcf_atsss_capability.h create mode 100644 lib/sbi/openapi/model/npcf_multicast_access_control.c create mode 100644 lib/sbi/openapi/model/npcf_multicast_access_control.h create mode 100644 lib/sbi/openapi/model/npcf_pdu_session_status.c create mode 100644 lib/sbi/openapi/model/npcf_pdu_session_status.h delete mode 100644 lib/sbi/openapi/model/nr_v2x_auth_1.c delete mode 100644 lib/sbi/openapi/model/nr_v2x_auth_1.h create mode 100644 lib/sbi/openapi/model/nrf_info_served_aanf_info_list_value_value.c create mode 100644 lib/sbi/openapi/model/nrf_info_served_aanf_info_list_value_value.h create mode 100644 lib/sbi/openapi/model/nrf_info_served_amf_info_value.c create mode 100644 lib/sbi/openapi/model/nrf_info_served_amf_info_value.h create mode 100644 lib/sbi/openapi/model/nrf_info_served_ausf_info_value.c create mode 100644 lib/sbi/openapi/model/nrf_info_served_ausf_info_value.h create mode 100644 lib/sbi/openapi/model/nrf_info_served_bsf_info_value.c create mode 100644 lib/sbi/openapi/model/nrf_info_served_bsf_info_value.h create mode 100644 lib/sbi/openapi/model/nrf_info_served_chf_info_value.c create mode 100644 lib/sbi/openapi/model/nrf_info_served_chf_info_value.h create mode 100644 lib/sbi/openapi/model/nrf_info_served_gmlc_info_value.c create mode 100644 lib/sbi/openapi/model/nrf_info_served_gmlc_info_value.h create mode 100644 lib/sbi/openapi/model/nrf_info_served_hss_info_list_value_value.c create mode 100644 lib/sbi/openapi/model/nrf_info_served_hss_info_list_value_value.h create mode 100644 lib/sbi/openapi/model/nrf_info_served_lmf_info_value.c create mode 100644 lib/sbi/openapi/model/nrf_info_served_lmf_info_value.h create mode 100644 lib/sbi/openapi/model/nrf_info_served_mb_smf_info_list_value_value.c create mode 100644 lib/sbi/openapi/model/nrf_info_served_mb_smf_info_list_value_value.h create mode 100644 lib/sbi/openapi/model/nrf_info_served_nef_info_value.c create mode 100644 lib/sbi/openapi/model/nrf_info_served_nef_info_value.h create mode 100644 lib/sbi/openapi/model/nrf_info_served_nwdaf_info_value.c create mode 100644 lib/sbi/openapi/model/nrf_info_served_nwdaf_info_value.h create mode 100644 lib/sbi/openapi/model/nrf_info_served_pcf_info_value.c create mode 100644 lib/sbi/openapi/model/nrf_info_served_pcf_info_value.h create mode 100644 lib/sbi/openapi/model/nrf_info_served_pcscf_info_list_value_value.c create mode 100644 lib/sbi/openapi/model/nrf_info_served_pcscf_info_list_value_value.h create mode 100644 lib/sbi/openapi/model/nrf_info_served_scp_info_list_value.c create mode 100644 lib/sbi/openapi/model/nrf_info_served_scp_info_list_value.h create mode 100644 lib/sbi/openapi/model/nrf_info_served_sepp_info_list_value.c create mode 100644 lib/sbi/openapi/model/nrf_info_served_sepp_info_list_value.h create mode 100644 lib/sbi/openapi/model/nrf_info_served_smf_info_value.c create mode 100644 lib/sbi/openapi/model/nrf_info_served_smf_info_value.h create mode 100644 lib/sbi/openapi/model/nrf_info_served_udm_info_value.c create mode 100644 lib/sbi/openapi/model/nrf_info_served_udm_info_value.h create mode 100644 lib/sbi/openapi/model/nrf_info_served_udr_info_value.c create mode 100644 lib/sbi/openapi/model/nrf_info_served_udr_info_value.h create mode 100644 lib/sbi/openapi/model/nrf_info_served_udsf_info_value.c create mode 100644 lib/sbi/openapi/model/nrf_info_served_udsf_info_value.h create mode 100644 lib/sbi/openapi/model/nrf_info_served_upf_info_value.c create mode 100644 lib/sbi/openapi/model/nrf_info_served_upf_info_value.h create mode 100644 lib/sbi/openapi/model/nsacf_capability.c create mode 100644 lib/sbi/openapi/model/nsacf_capability.h create mode 100644 lib/sbi/openapi/model/nsacf_info.c create mode 100644 lib/sbi/openapi/model/nsacf_info.h create mode 100644 lib/sbi/openapi/model/nsag_info.c create mode 100644 lib/sbi/openapi/model/nsag_info.h create mode 100644 lib/sbi/openapi/model/nsi_id_info.c create mode 100644 lib/sbi/openapi/model/nsi_id_info.h create mode 100644 lib/sbi/openapi/model/nsi_load_level_info.c create mode 100644 lib/sbi/openapi/model/nsi_load_level_info.h create mode 100644 lib/sbi/openapi/model/nssaaf_info.c create mode 100644 lib/sbi/openapi/model/nssaaf_info.h create mode 100644 lib/sbi/openapi/model/nudm_amf_info.c create mode 100644 lib/sbi/openapi/model/nudm_amf_info.h create mode 100644 lib/sbi/openapi/model/number_average.c create mode 100644 lib/sbi/openapi/model/number_average.h create mode 100644 lib/sbi/openapi/model/nwdaf_capability.c create mode 100644 lib/sbi/openapi/model/nwdaf_capability.h create mode 100644 lib/sbi/openapi/model/nwdaf_data.c create mode 100644 lib/sbi/openapi/model/nwdaf_data.h create mode 100644 lib/sbi/openapi/model/nwdaf_failure_code.c create mode 100644 lib/sbi/openapi/model/nwdaf_failure_code.h create mode 100644 lib/sbi/openapi/model/nwdaf_failure_code_any_of.c create mode 100644 lib/sbi/openapi/model/nwdaf_failure_code_any_of.h create mode 100644 lib/sbi/openapi/model/nwdaf_registration.c create mode 100644 lib/sbi/openapi/model/nwdaf_registration.h create mode 100644 lib/sbi/openapi/model/nwdaf_registration_info.c create mode 100644 lib/sbi/openapi/model/nwdaf_registration_info.h create mode 100644 lib/sbi/openapi/model/nwdaf_registration_modification.c create mode 100644 lib/sbi/openapi/model/nwdaf_registration_modification.h create mode 100644 lib/sbi/openapi/model/nwdaf_subscription.c create mode 100644 lib/sbi/openapi/model/nwdaf_subscription.h create mode 100644 lib/sbi/openapi/model/observed_redundant_trans_exp.c create mode 100644 lib/sbi/openapi/model/observed_redundant_trans_exp.h create mode 100644 lib/sbi/openapi/model/operator_specific_data_container_value.c create mode 100644 lib/sbi/openapi/model/operator_specific_data_container_value.h create mode 100644 lib/sbi/openapi/model/output_strategy.c create mode 100644 lib/sbi/openapi/model/output_strategy.h create mode 100644 lib/sbi/openapi/model/output_strategy_any_of.c create mode 100644 lib/sbi/openapi/model/output_strategy_any_of.h create mode 100644 lib/sbi/openapi/model/partitioning_criteria.c create mode 100644 lib/sbi/openapi/model/partitioning_criteria.h create mode 100644 lib/sbi/openapi/model/pcf_addressing_info.c create mode 100644 lib/sbi/openapi/model/pcf_addressing_info.h create mode 100644 lib/sbi/openapi/model/pcf_for_pdu_session_info.c create mode 100644 lib/sbi/openapi/model/pcf_for_pdu_session_info.h create mode 100644 lib/sbi/openapi/model/pcf_for_ue_binding.c create mode 100644 lib/sbi/openapi/model/pcf_for_ue_binding.h create mode 100644 lib/sbi/openapi/model/pcf_for_ue_binding_patch.c create mode 100644 lib/sbi/openapi/model/pcf_for_ue_binding_patch.h create mode 100644 lib/sbi/openapi/model/pcf_for_ue_info.c create mode 100644 lib/sbi/openapi/model/pcf_for_ue_info.h create mode 100644 lib/sbi/openapi/model/pcf_mbs_binding.c create mode 100644 lib/sbi/openapi/model/pcf_mbs_binding.h create mode 100644 lib/sbi/openapi/model/pcf_mbs_binding_patch.c create mode 100644 lib/sbi/openapi/model/pcf_mbs_binding_patch.h create mode 100644 lib/sbi/openapi/model/pcf_selection_assistance_info.c create mode 100644 lib/sbi/openapi/model/pcf_selection_assistance_info.h create mode 100644 lib/sbi/openapi/model/pcf_selection_assistance_info_1.c create mode 100644 lib/sbi/openapi/model/pcf_selection_assistance_info_1.h create mode 100644 lib/sbi/openapi/model/pcf_ue_callback_info.c create mode 100644 lib/sbi/openapi/model/pcf_ue_callback_info.h create mode 100644 lib/sbi/openapi/model/pcscf_address.c create mode 100644 lib/sbi/openapi/model/pcscf_address.h delete mode 100644 lib/sbi/openapi/model/pdu_session_1.c delete mode 100644 lib/sbi/openapi/model/pdu_session_1.h create mode 100644 lib/sbi/openapi/model/pdu_session_context_type.c create mode 100644 lib/sbi/openapi/model/pdu_session_context_type.h create mode 100644 lib/sbi/openapi/model/pdu_session_event_notification.c create mode 100644 lib/sbi/openapi/model/pdu_session_event_notification.h create mode 100644 lib/sbi/openapi/model/pdu_session_info.c create mode 100644 lib/sbi/openapi/model/pdu_session_info.h delete mode 100644 lib/sbi/openapi/model/pdu_session_status_any_of.c delete mode 100644 lib/sbi/openapi/model/pdu_session_status_any_of.h create mode 100644 lib/sbi/openapi/model/pdu_session_status_cfg_1.c create mode 100644 lib/sbi/openapi/model/pdu_session_status_cfg_1.h create mode 100644 lib/sbi/openapi/model/perf_data.c create mode 100644 lib/sbi/openapi/model/perf_data.h delete mode 100644 lib/sbi/openapi/model/pfd_data_for_app.c delete mode 100644 lib/sbi/openapi/model/pfd_data_for_app.h delete mode 100644 lib/sbi/openapi/model/pfd_data_for_app_ext_all_of.c delete mode 100644 lib/sbi/openapi/model/pfd_data_for_app_ext_all_of.h delete mode 100644 lib/sbi/openapi/model/pgw_info_1.c delete mode 100644 lib/sbi/openapi/model/pgw_info_1.h create mode 100644 lib/sbi/openapi/model/plmn_ec_info_1.c create mode 100644 lib/sbi/openapi/model/plmn_ec_info_1.h create mode 100644 lib/sbi/openapi/model/plmn_oauth2.c create mode 100644 lib/sbi/openapi/model/plmn_oauth2.h delete mode 100644 lib/sbi/openapi/model/plmn_operator_class_1.c delete mode 100644 lib/sbi/openapi/model/plmn_operator_class_1.h create mode 100644 lib/sbi/openapi/model/plmn_restriction.c create mode 100644 lib/sbi/openapi/model/plmn_restriction.h create mode 100644 lib/sbi/openapi/model/plmn_restriction_1.c create mode 100644 lib/sbi/openapi/model/plmn_restriction_1.h create mode 100644 lib/sbi/openapi/model/policy_data_for_individual_ue.c create mode 100644 lib/sbi/openapi/model/policy_data_for_individual_ue.h create mode 100644 lib/sbi/openapi/model/policy_data_subset.c create mode 100644 lib/sbi/openapi/model/policy_data_subset.h create mode 100644 lib/sbi/openapi/model/policy_data_subset_any_of.c create mode 100644 lib/sbi/openapi/model/policy_data_subset_any_of.h create mode 100644 lib/sbi/openapi/model/pp_data_entry.c create mode 100644 lib/sbi/openapi/model/pp_data_entry.h create mode 100644 lib/sbi/openapi/model/pp_data_entry_list.c create mode 100644 lib/sbi/openapi/model/pp_data_entry_list.h create mode 100644 lib/sbi/openapi/model/prev_sub_info.c create mode 100644 lib/sbi/openapi/model/prev_sub_info.h create mode 100644 lib/sbi/openapi/model/pro_se_allowed_plmn.c create mode 100644 lib/sbi/openapi/model/pro_se_allowed_plmn.h create mode 100644 lib/sbi/openapi/model/pro_se_auth_data.c create mode 100644 lib/sbi/openapi/model/pro_se_auth_data.h create mode 100644 lib/sbi/openapi/model/pro_se_authentication_ctx.c create mode 100644 lib/sbi/openapi/model/pro_se_authentication_ctx.h create mode 100644 lib/sbi/openapi/model/pro_se_authentication_info.c create mode 100644 lib/sbi/openapi/model/pro_se_authentication_info.h create mode 100644 lib/sbi/openapi/model/pro_se_authentication_info_request.c create mode 100644 lib/sbi/openapi/model/pro_se_authentication_info_request.h create mode 100644 lib/sbi/openapi/model/pro_se_authentication_info_result.c create mode 100644 lib/sbi/openapi/model/pro_se_authentication_info_result.h create mode 100644 lib/sbi/openapi/model/pro_se_authentication_result.c create mode 100644 lib/sbi/openapi/model/pro_se_authentication_result.h create mode 100644 lib/sbi/openapi/model/pro_se_authentication_vectors.c create mode 100644 lib/sbi/openapi/model/pro_se_authentication_vectors.h create mode 100644 lib/sbi/openapi/model/pro_se_capability.c create mode 100644 lib/sbi/openapi/model/pro_se_capability.h create mode 100644 lib/sbi/openapi/model/pro_se_eap_session.c create mode 100644 lib/sbi/openapi/model/pro_se_eap_session.h create mode 100644 lib/sbi/openapi/model/pro_se_information.c create mode 100644 lib/sbi/openapi/model/pro_se_information.h delete mode 100644 lib/sbi/openapi/model/problem_details_2.c delete mode 100644 lib/sbi/openapi/model/problem_details_2.h create mode 100644 lib/sbi/openapi/model/prose_context.c create mode 100644 lib/sbi/openapi/model/prose_context.h create mode 100644 lib/sbi/openapi/model/prose_direct_allowed.c create mode 100644 lib/sbi/openapi/model/prose_direct_allowed.h create mode 100644 lib/sbi/openapi/model/prose_service_auth.c create mode 100644 lib/sbi/openapi/model/prose_service_auth.h create mode 100644 lib/sbi/openapi/model/prose_subscription_data.c create mode 100644 lib/sbi/openapi/model/prose_subscription_data.h create mode 100644 lib/sbi/openapi/model/qos_requirement.c create mode 100644 lib/sbi/openapi/model/qos_requirement.h create mode 100644 lib/sbi/openapi/model/qos_sustainability_info.c create mode 100644 lib/sbi/openapi/model/qos_sustainability_info.h create mode 100644 lib/sbi/openapi/model/query_param_combination.c create mode 100644 lib/sbi/openapi/model/query_param_combination.h create mode 100644 lib/sbi/openapi/model/query_parameter.c create mode 100644 lib/sbi/openapi/model/query_parameter.h create mode 100644 lib/sbi/openapi/model/ranking_criterion.c create mode 100644 lib/sbi/openapi/model/ranking_criterion.h create mode 100644 lib/sbi/openapi/model/rat_freq_information.c create mode 100644 lib/sbi/openapi/model/rat_freq_information.h create mode 100644 lib/sbi/openapi/model/reachability_for_data_configuration.c create mode 100644 lib/sbi/openapi/model/reachability_for_data_configuration.h create mode 100644 lib/sbi/openapi/model/reachability_for_data_configuration_1.c create mode 100644 lib/sbi/openapi/model/reachability_for_data_configuration_1.h create mode 100644 lib/sbi/openapi/model/reachability_for_data_report_config.c create mode 100644 lib/sbi/openapi/model/reachability_for_data_report_config.h create mode 100644 lib/sbi/openapi/model/reachability_for_data_report_config_any_of.c create mode 100644 lib/sbi/openapi/model/reachability_for_data_report_config_any_of.h create mode 100644 lib/sbi/openapi/model/red_trans_exp_ordering_criterion.c create mode 100644 lib/sbi/openapi/model/red_trans_exp_ordering_criterion.h create mode 100644 lib/sbi/openapi/model/red_trans_exp_ordering_criterion_any_of.c create mode 100644 lib/sbi/openapi/model/red_trans_exp_ordering_criterion_any_of.h create mode 100644 lib/sbi/openapi/model/redundant_transmission_exp_info.c create mode 100644 lib/sbi/openapi/model/redundant_transmission_exp_info.h create mode 100644 lib/sbi/openapi/model/redundant_transmission_exp_per_ts.c create mode 100644 lib/sbi/openapi/model/redundant_transmission_exp_per_ts.h create mode 100644 lib/sbi/openapi/model/redundant_transmission_exp_req.c create mode 100644 lib/sbi/openapi/model/redundant_transmission_exp_req.h create mode 100644 lib/sbi/openapi/model/relative_cartesian_location.c create mode 100644 lib/sbi/openapi/model/relative_cartesian_location.h create mode 100644 lib/sbi/openapi/model/release_cause.c create mode 100644 lib/sbi/openapi/model/release_cause.h create mode 100644 lib/sbi/openapi/model/release_session_info.c create mode 100644 lib/sbi/openapi/model/release_session_info.h create mode 100644 lib/sbi/openapi/model/reporting_information.c create mode 100644 lib/sbi/openapi/model/reporting_information.h create mode 100644 lib/sbi/openapi/model/reporting_options_1.c create mode 100644 lib/sbi/openapi/model/reporting_options_1.h create mode 100644 lib/sbi/openapi/model/resource_usage.c create mode 100644 lib/sbi/openapi/model/resource_usage.h create mode 100644 lib/sbi/openapi/model/resynchronization_info_1.c create mode 100644 lib/sbi/openapi/model/resynchronization_info_1.h create mode 100644 lib/sbi/openapi/model/retainability_threshold.c create mode 100644 lib/sbi/openapi/model/retainability_threshold.h create mode 100644 lib/sbi/openapi/model/roaming_info_update.c create mode 100644 lib/sbi/openapi/model/roaming_info_update.h create mode 100644 lib/sbi/openapi/model/roaming_restrictions.c create mode 100644 lib/sbi/openapi/model/roaming_restrictions.h create mode 100644 lib/sbi/openapi/model/route_selection_parameter_set.c create mode 100644 lib/sbi/openapi/model/route_selection_parameter_set.h create mode 100644 lib/sbi/openapi/model/routing_area_id.c create mode 100644 lib/sbi/openapi/model/routing_area_id.h create mode 100644 lib/sbi/openapi/model/routing_info_sm_request.c create mode 100644 lib/sbi/openapi/model/routing_info_sm_request.h create mode 100644 lib/sbi/openapi/model/routing_info_sm_response.c create mode 100644 lib/sbi/openapi/model/routing_info_sm_response.h create mode 100644 lib/sbi/openapi/model/satellite_backhaul_category.c create mode 100644 lib/sbi/openapi/model/satellite_backhaul_category.h create mode 100644 lib/sbi/openapi/model/scp_capability.c create mode 100644 lib/sbi/openapi/model/scp_capability.h create mode 100644 lib/sbi/openapi/model/scp_domain_connectivity.c create mode 100644 lib/sbi/openapi/model/scp_domain_connectivity.h create mode 100644 lib/sbi/openapi/model/scp_domain_routing_info_notification.c create mode 100644 lib/sbi/openapi/model/scp_domain_routing_info_notification.h create mode 100644 lib/sbi/openapi/model/scp_domain_routing_info_subscription.c create mode 100644 lib/sbi/openapi/model/scp_domain_routing_info_subscription.h create mode 100644 lib/sbi/openapi/model/scp_domain_routing_information.c create mode 100644 lib/sbi/openapi/model/scp_domain_routing_information.h create mode 100644 lib/sbi/openapi/model/sepp_info.c create mode 100644 lib/sbi/openapi/model/sepp_info.h create mode 100644 lib/sbi/openapi/model/server_addressing_info.c create mode 100644 lib/sbi/openapi/model/server_addressing_info.h create mode 100644 lib/sbi/openapi/model/service_area_coverage_info.c create mode 100644 lib/sbi/openapi/model/service_area_coverage_info.h create mode 100644 lib/sbi/openapi/model/service_area_id.c create mode 100644 lib/sbi/openapi/model/service_area_id.h create mode 100644 lib/sbi/openapi/model/service_experience_info.c create mode 100644 lib/sbi/openapi/model/service_experience_info.h create mode 100644 lib/sbi/openapi/model/service_experience_type.c create mode 100644 lib/sbi/openapi/model/service_experience_type.h create mode 100644 lib/sbi/openapi/model/service_experience_type_any_of.c create mode 100644 lib/sbi/openapi/model/service_experience_type_any_of.h create mode 100644 lib/sbi/openapi/model/service_name_list_cond.c create mode 100644 lib/sbi/openapi/model/service_name_list_cond.h create mode 100644 lib/sbi/openapi/model/service_specific_authorization_info.c create mode 100644 lib/sbi/openapi/model/service_specific_authorization_info.h create mode 100644 lib/sbi/openapi/model/service_type.c create mode 100644 lib/sbi/openapi/model/service_type.h create mode 100644 lib/sbi/openapi/model/service_type_any_of.c create mode 100644 lib/sbi/openapi/model/service_type_any_of.h delete mode 100644 lib/sbi/openapi/model/service_type_unrelated_class_1.c delete mode 100644 lib/sbi/openapi/model/service_type_unrelated_class_1.h create mode 100644 lib/sbi/openapi/model/sess_inact_timer_for_ue_comm.c create mode 100644 lib/sbi/openapi/model/sess_inact_timer_for_ue_comm.h create mode 100644 lib/sbi/openapi/model/sgsn_address.c create mode 100644 lib/sbi/openapi/model/sgsn_address.h create mode 100644 lib/sbi/openapi/model/shared_data_id_range.c create mode 100644 lib/sbi/openapi/model/shared_data_id_range.h create mode 100644 lib/sbi/openapi/model/shared_data_treatment_instruction.c create mode 100644 lib/sbi/openapi/model/shared_data_treatment_instruction.h create mode 100644 lib/sbi/openapi/model/slice_load_level_information.c create mode 100644 lib/sbi/openapi/model/slice_load_level_information.h create mode 100644 lib/sbi/openapi/model/slice_mbr.c create mode 100644 lib/sbi/openapi/model/slice_mbr.h create mode 100644 lib/sbi/openapi/model/slice_mbr_1.c create mode 100644 lib/sbi/openapi/model/slice_mbr_1.h create mode 100644 lib/sbi/openapi/model/slice_mbr_rm.c create mode 100644 lib/sbi/openapi/model/slice_mbr_rm.h create mode 100644 lib/sbi/openapi/model/slice_policy_data.c create mode 100644 lib/sbi/openapi/model/slice_policy_data.h create mode 100644 lib/sbi/openapi/model/sm_subs_data.c create mode 100644 lib/sbi/openapi/model/sm_subs_data.h create mode 100644 lib/sbi/openapi/model/smcce_info.c create mode 100644 lib/sbi/openapi/model/smcce_info.h create mode 100644 lib/sbi/openapi/model/smcce_ue_list.c create mode 100644 lib/sbi/openapi/model/smcce_ue_list.h create mode 100644 lib/sbi/openapi/model/smf_registration_modification.c create mode 100644 lib/sbi/openapi/model/smf_registration_modification.h delete mode 100644 lib/sbi/openapi/model/smf_selection_subscription_data_1.c delete mode 100644 lib/sbi/openapi/model/smf_selection_subscription_data_1.h create mode 100644 lib/sbi/openapi/model/smf_selection_type.c create mode 100644 lib/sbi/openapi/model/smf_selection_type.h create mode 100644 lib/sbi/openapi/model/sms_router_info.c create mode 100644 lib/sbi/openapi/model/sms_router_info.h delete mode 100644 lib/sbi/openapi/model/smsf_info_1.c delete mode 100644 lib/sbi/openapi/model/smsf_info_1.h create mode 100644 lib/sbi/openapi/model/snssai_dnn_pair.c create mode 100644 lib/sbi/openapi/model/snssai_dnn_pair.h create mode 100644 lib/sbi/openapi/model/snssai_easdf_info_item.c create mode 100644 lib/sbi/openapi/model/snssai_easdf_info_item.h create mode 100644 lib/sbi/openapi/model/snssai_info_item.c create mode 100644 lib/sbi/openapi/model/snssai_info_item.h create mode 100644 lib/sbi/openapi/model/snssai_mb_smf_info_item.c create mode 100644 lib/sbi/openapi/model/snssai_mb_smf_info_item.h create mode 100644 lib/sbi/openapi/model/snssai_tsctsf_info_item.c create mode 100644 lib/sbi/openapi/model/snssai_tsctsf_info_item.h create mode 100644 lib/sbi/openapi/model/spatial_validity_cond.c create mode 100644 lib/sbi/openapi/model/spatial_validity_cond.h create mode 100644 lib/sbi/openapi/model/spatial_validity_cond_1.c create mode 100644 lib/sbi/openapi/model/spatial_validity_cond_1.h create mode 100644 lib/sbi/openapi/model/ssm.c create mode 100644 lib/sbi/openapi/model/ssm.h create mode 100644 lib/sbi/openapi/model/ssm_1.c create mode 100644 lib/sbi/openapi/model/ssm_1.h create mode 100644 lib/sbi/openapi/model/steer_mode_indicator.c create mode 100644 lib/sbi/openapi/model/steer_mode_indicator.h create mode 100644 lib/sbi/openapi/model/subscr_cond.c create mode 100644 lib/sbi/openapi/model/subscr_cond.h create mode 100644 lib/sbi/openapi/model/subscription_context.c create mode 100644 lib/sbi/openapi/model/subscription_context.h delete mode 100644 lib/sbi/openapi/model/subscription_data_sets_1.c delete mode 100644 lib/sbi/openapi/model/subscription_data_sets_1.h delete mode 100644 lib/sbi/openapi/model/subscription_data_subscr_cond.c delete mode 100644 lib/sbi/openapi/model/subscription_data_subscr_cond.h create mode 100644 lib/sbi/openapi/model/suci_info.c create mode 100644 lib/sbi/openapi/model/suci_info.h create mode 100644 lib/sbi/openapi/model/supi_info.c create mode 100644 lib/sbi/openapi/model/supi_info.h create mode 100644 lib/sbi/openapi/model/svc_experience.c create mode 100644 lib/sbi/openapi/model/svc_experience.h create mode 100644 lib/sbi/openapi/model/target_area.c create mode 100644 lib/sbi/openapi/model/target_area.h create mode 100644 lib/sbi/openapi/model/target_dnai_info.c create mode 100644 lib/sbi/openapi/model/target_dnai_info.h create mode 100644 lib/sbi/openapi/model/target_ue_information.c create mode 100644 lib/sbi/openapi/model/target_ue_information.h create mode 100644 lib/sbi/openapi/model/threshold_level.c create mode 100644 lib/sbi/openapi/model/threshold_level.h create mode 100644 lib/sbi/openapi/model/threshold_value.c create mode 100644 lib/sbi/openapi/model/threshold_value.h create mode 100644 lib/sbi/openapi/model/time_unit.c create mode 100644 lib/sbi/openapi/model/time_unit.h create mode 100644 lib/sbi/openapi/model/time_unit_any_of.c create mode 100644 lib/sbi/openapi/model/time_unit_any_of.h create mode 100644 lib/sbi/openapi/model/tmgi.c create mode 100644 lib/sbi/openapi/model/tmgi.h create mode 100644 lib/sbi/openapi/model/tmgi_1.c create mode 100644 lib/sbi/openapi/model/tmgi_1.h create mode 100644 lib/sbi/openapi/model/tmgi_range.c create mode 100644 lib/sbi/openapi/model/tmgi_range.h create mode 100644 lib/sbi/openapi/model/top_application.c create mode 100644 lib/sbi/openapi/model/top_application.h create mode 100644 lib/sbi/openapi/model/traffic_characterization.c create mode 100644 lib/sbi/openapi/model/traffic_characterization.h create mode 100644 lib/sbi/openapi/model/traffic_descriptor_components.c create mode 100644 lib/sbi/openapi/model/traffic_descriptor_components.h create mode 100644 lib/sbi/openapi/model/traffic_information.c create mode 100644 lib/sbi/openapi/model/traffic_information.h create mode 100644 lib/sbi/openapi/model/transport_protocol_1.c create mode 100644 lib/sbi/openapi/model/transport_protocol_1.h create mode 100644 lib/sbi/openapi/model/trust_af_info.c create mode 100644 lib/sbi/openapi/model/trust_af_info.h create mode 100644 lib/sbi/openapi/model/tsctsf_info.c create mode 100644 lib/sbi/openapi/model/tsctsf_info.h create mode 100644 lib/sbi/openapi/model/uc_purpose.c create mode 100644 lib/sbi/openapi/model/uc_purpose.h create mode 100644 lib/sbi/openapi/model/uc_subscription_data.c create mode 100644 lib/sbi/openapi/model/uc_subscription_data.h create mode 100644 lib/sbi/openapi/model/ue_analytics_context_descriptor.c create mode 100644 lib/sbi/openapi/model/ue_analytics_context_descriptor.h create mode 100644 lib/sbi/openapi/model/ue_communication.c create mode 100644 lib/sbi/openapi/model/ue_communication.h delete mode 100644 lib/sbi/openapi/model/ue_context_in_amf_data_1.c delete mode 100644 lib/sbi/openapi/model/ue_context_in_amf_data_1.h delete mode 100644 lib/sbi/openapi/model/ue_context_in_smf_data_1.c delete mode 100644 lib/sbi/openapi/model/ue_context_in_smf_data_1.h create mode 100644 lib/sbi/openapi/model/ue_context_in_smf_data_sub_filter.c create mode 100644 lib/sbi/openapi/model/ue_context_in_smf_data_sub_filter.h create mode 100644 lib/sbi/openapi/model/ue_context_in_smf_data_sub_filter_1.c create mode 100644 lib/sbi/openapi/model/ue_context_in_smf_data_sub_filter_1.h delete mode 100644 lib/sbi/openapi/model/ue_context_in_smsf_data_1.c delete mode 100644 lib/sbi/openapi/model/ue_context_in_smsf_data_1.h create mode 100644 lib/sbi/openapi/model/ue_in_area_filter.c create mode 100644 lib/sbi/openapi/model/ue_in_area_filter.h create mode 100644 lib/sbi/openapi/model/ue_mobility.c create mode 100644 lib/sbi/openapi/model/ue_mobility.h create mode 100644 lib/sbi/openapi/model/ue_reachable_ind.c create mode 100644 lib/sbi/openapi/model/ue_reachable_ind.h create mode 100644 lib/sbi/openapi/model/ue_slice_mbr.c create mode 100644 lib/sbi/openapi/model/ue_slice_mbr.h create mode 100644 lib/sbi/openapi/model/ue_type.c create mode 100644 lib/sbi/openapi/model/ue_type.h create mode 100644 lib/sbi/openapi/model/ue_type_any_of.c create mode 100644 lib/sbi/openapi/model/ue_type_any_of.h create mode 100644 lib/sbi/openapi/model/umt_time.c create mode 100644 lib/sbi/openapi/model/umt_time.h create mode 100644 lib/sbi/openapi/model/umt_time_1.c create mode 100644 lib/sbi/openapi/model/umt_time_1.h create mode 100644 lib/sbi/openapi/model/un_trust_af_info.c create mode 100644 lib/sbi/openapi/model/un_trust_af_info.h create mode 100644 lib/sbi/openapi/model/uncertainty_ellipsoid.c create mode 100644 lib/sbi/openapi/model/uncertainty_ellipsoid.h delete mode 100644 lib/sbi/openapi/model/unrelated_class_1.c delete mode 100644 lib/sbi/openapi/model/unrelated_class_1.h create mode 100644 lib/sbi/openapi/model/update_nwdaf_registration_200_response.c create mode 100644 lib/sbi/openapi/model/update_nwdaf_registration_200_response.h create mode 100644 lib/sbi/openapi/model/updp_subscription_data.c create mode 100644 lib/sbi/openapi/model/updp_subscription_data.h create mode 100644 lib/sbi/openapi/model/upf_information.c create mode 100644 lib/sbi/openapi/model/upf_information.h rename lib/sbi/openapi/model/{get_nf_instances_200_response.c => uri_list.c} (52%) create mode 100644 lib/sbi/openapi/model/uri_list.h create mode 100644 lib/sbi/openapi/model/ursp_rule_request.c create mode 100644 lib/sbi/openapi/model/ursp_rule_request.h create mode 100644 lib/sbi/openapi/model/user_consent.c create mode 100644 lib/sbi/openapi/model/user_consent.h create mode 100644 lib/sbi/openapi/model/user_data_congestion_info.c create mode 100644 lib/sbi/openapi/model/user_data_congestion_info.h create mode 100644 lib/sbi/openapi/model/utra_location.c create mode 100644 lib/sbi/openapi/model/utra_location.h create mode 100644 lib/sbi/openapi/model/uuaa_mm_status.c create mode 100644 lib/sbi/openapi/model/uuaa_mm_status.h create mode 100644 lib/sbi/openapi/model/v2x_capability.c create mode 100644 lib/sbi/openapi/model/v2x_capability.h delete mode 100644 lib/sbi/openapi/model/v2x_subscription_data_1.c delete mode 100644 lib/sbi/openapi/model/v2x_subscription_data_1.h delete mode 100644 lib/sbi/openapi/model/valid_time_period_1.c delete mode 100644 lib/sbi/openapi/model/valid_time_period_1.h create mode 100644 lib/sbi/openapi/model/wlan_ordering_criterion.c create mode 100644 lib/sbi/openapi/model/wlan_ordering_criterion.h create mode 100644 lib/sbi/openapi/model/wlan_ordering_criterion_any_of.c create mode 100644 lib/sbi/openapi/model/wlan_ordering_criterion_any_of.h create mode 100644 lib/sbi/openapi/model/wlan_per_ss_id_performance_info.c create mode 100644 lib/sbi/openapi/model/wlan_per_ss_id_performance_info.h create mode 100644 lib/sbi/openapi/model/wlan_per_ts_performance_info.c create mode 100644 lib/sbi/openapi/model/wlan_per_ts_performance_info.h create mode 100644 lib/sbi/openapi/model/wlan_performance_info.c create mode 100644 lib/sbi/openapi/model/wlan_performance_info.h create mode 100644 lib/sbi/openapi/model/wlan_performance_req.c create mode 100644 lib/sbi/openapi/model/wlan_performance_req.h diff --git a/lib/sbi/nnrf-build.c b/lib/sbi/nnrf-build.c index bf09e83b8..6f37b1bba 100644 --- a/lib/sbi/nnrf-build.c +++ b/lib/sbi/nnrf-build.c @@ -653,7 +653,7 @@ static OpenAPI_smf_info_t *build_smf_info(ogs_sbi_nf_info_t *nf_info) OpenAPI_list_t *sNssaiSmfInfoList = NULL; OpenAPI_snssai_smf_info_item_t *sNssaiSmfInfoItem = NULL; - OpenAPI_snssai_t *sNssai = NULL; + OpenAPI_ext_snssai_t *sNssai = NULL; OpenAPI_list_t *DnnSmfInfoList = NULL; OpenAPI_dnn_smf_info_item_t *DnnSmfInfoItem = NULL; @@ -1045,7 +1045,7 @@ static void free_smf_info(OpenAPI_smf_info_t *SmfInfo) { OpenAPI_list_t *sNssaiSmfInfoList = NULL; OpenAPI_snssai_smf_info_item_t *sNssaiSmfInfoItem = NULL; - OpenAPI_snssai_t *sNssai = NULL; + OpenAPI_ext_snssai_t *sNssai = NULL; OpenAPI_list_t *DnnSmfInfoList = NULL; OpenAPI_dnn_smf_info_item_t *DnnSmfInfoItem = NULL; @@ -1309,7 +1309,7 @@ ogs_sbi_request_t *ogs_nnrf_nfm_build_status_subscribe( ogs_sbi_server_t *server = NULL; OpenAPI_subscription_data_t *SubscriptionData = NULL; - OpenAPI_subscription_data_subscr_cond_t SubscrCond; + OpenAPI_subscr_cond_t SubscrCond; ogs_assert(subscription_data); ogs_assert(subscription_data->req_nf_type); diff --git a/lib/sbi/nnrf-handler.c b/lib/sbi/nnrf-handler.c index ac60bf111..e20937e55 100644 --- a/lib/sbi/nnrf-handler.c +++ b/lib/sbi/nnrf-handler.c @@ -332,7 +332,7 @@ static void handle_smf_info( OpenAPI_list_t *sNssaiSmfInfoList = NULL; OpenAPI_snssai_smf_info_item_t *sNssaiSmfInfoItem = NULL; - OpenAPI_snssai_t *sNssai = NULL; + OpenAPI_ext_snssai_t *sNssai = NULL; OpenAPI_list_t *DnnSmfInfoList = NULL; OpenAPI_dnn_smf_info_item_t *DnnSmfInfoItem = NULL; diff --git a/lib/sbi/openapi/meson.build b/lib/sbi/openapi/meson.build index 2610fdeb4..c51b96124 100644 --- a/lib/sbi/openapi/meson.build +++ b/lib/sbi/openapi/meson.build @@ -21,31 +21,44 @@ libsbi_openapi_sources = files(''' src/binary.c external/cJSON.c + model/aanf_info.c + model/abnormal_behaviour.c + model/acc_net_ch_id.c + model/acc_net_charging_address.c model/acceptable_service_info.c model/access_and_mobility_data.c - model/access_and_mobility_subscription_data_1.c model/access_and_mobility_subscription_data.c + model/access_and_mobility_subscription_data_1.c model/access_net_charging_identifier.c model/access_network_id.c - model/access_right_status_any_of.c model/access_right_status.c - model/access_tech_any_of.c + model/access_right_status_any_of.c model/access_tech.c + model/access_tech_any_of.c model/access_token_err.c model/access_token_req.c model/access_type.c model/access_type_rm.c - model/acc_net_charging_address.c - model/acc_net_ch_id.c - model/accumulated_usage.c model/accu_usage_report.c + model/accumulated_usage.c + model/accuracy.c + model/accuracy_any_of.c model/acknowledge_info.c - model/acs_info_1.c model/acs_info.c + model/acs_info_1.c model/acs_info_rm.c model/additional_access_info.c + model/additional_ee_subs_info.c + model/additional_measurement.c model/additional_qos_flow_info.c model/additional_snssai_data.c + model/additional_snssai_data_1.c + model/addr_fqdn.c + model/address_list.c + model/aerial_ue_indication.c + model/aerial_ue_subscription_info.c + model/aerial_ue_subscription_info_1.c + model/af_coordination_info.c model/af_event.c model/af_event_exposure_data.c model/af_event_notification.c @@ -60,75 +73,94 @@ libsbi_openapi_sources = files(''' model/allowed_nssai.c model/allowed_snssai.c model/alternative_qos_profile.c - model/ambr_1.c + model/alternative_service_requirements_data.c + model/am_influ_data.c + model/am_influ_event.c + model/am_influ_event_any_of.c + model/am_policy_data.c + model/am_requested_value_rep.c model/ambr.c + model/ambr_1.c model/ambr_rm.c model/amf3_gpp_access_registration.c model/amf3_gpp_access_registration_modification.c model/amf_cond.c model/amf_dereg_info.c - model/amf_event_area.c model/amf_event.c + model/amf_event_area.c model/amf_event_mode.c - model/amf_event_subscription_add_info.c model/amf_event_subscription.c - model/amf_event_trigger_any_of.c + model/amf_event_subscription_add_info.c model/amf_event_trigger.c - model/amf_event_type_any_of.c + model/amf_event_trigger_any_of.c model/amf_event_type.c + model/amf_event_type_any_of.c model/amf_info.c model/amf_non3_gpp_access_registration.c model/amf_non3_gpp_access_registration_modification.c model/amf_status_change_notification.c - model/amf_status_change_subscription_data.c model/amf_status_info.c model/amf_subscription_info.c - model/am_policy_data.c model/an_gw_address.c model/an_node_type.c + model/analytics_metadata.c + model/analytics_metadata_any_of.c + model/analytics_metadata_indication.c + model/analytics_metadata_info.c + model/analytics_subscription.c + model/analytics_subset.c + model/analytics_subset_any_of.c + model/anchor_smf_features.c model/any_type.c model/apn_rate_status.c model/app_descriptor.c + model/app_descriptor_1.c model/app_detection_info.c - model/application_data_change_notif.c - model/application_data_subs.c + model/app_detection_notif_type.c + model/app_detection_report.c + model/app_list_for_ue_comm.c model/app_port_id.c model/app_session_context.c model/app_session_context_req_data.c model/app_session_context_resp_data.c model/app_session_context_update_data.c model/app_session_context_update_data_patch.c - model/area_1.c + model/application_data_change_notif.c + model/application_data_subs.c + model/application_volume.c model/area.c + model/area_1.c + model/area_of_interest_event_state.c model/area_of_validity.c model/area_scope.c - model/arp_1.c model/arp.c + model/arp_1.c + model/as_time_distribution_param.c model/assign_ebi_data.c model/assign_ebi_error.c model/assign_ebi_failed.c model/assigned_ebi_data.c - model/association_type_any_of.c model/association_type.c + model/association_type_any_of.c model/atom.c - model/atsss_capability_any_of.c model/atsss_capability.c model/ausf_info.c + model/auth_event.c + model/auth_method.c + model/auth_result.c + model/auth_status.c + model/auth_type.c model/authentication_info.c model/authentication_info_request.c model/authentication_info_result.c model/authentication_subscription.c model/authentication_vector.c - model/auth_event.c - model/auth_method.c model/authorization_data.c + model/authorization_info.c model/authorized_default_qos.c model/authorized_network_slice_info.c - model/auth_result.c - model/auth_status.c - model/auth_type.c - model/av5g_aka.c model/av5_ghe_aka.c + model/av5g_aka.c model/av_eap_aka_prime.c model/av_eps_aka.c model/av_ims_gba_eap_aka.c @@ -140,44 +172,62 @@ libsbi_openapi_sources = files(''' model/bdt_data_patch.c model/bdt_policy_data.c model/bdt_policy_data_patch.c - model/bdt_policy_status_any_of.c model/bdt_policy_status.c + model/bdt_policy_status_any_of.c model/binding_level.c model/binding_resp.c model/bridge_management_container.c + model/bsf_event.c + model/bsf_event_notification.c model/bsf_info.c + model/bsf_notification.c + model/bsf_subscription.c + model/bsf_subscription_resp.c + model/bw_requirement.c model/cag_ack_data.c - model/cag_data_1.c model/cag_data.c - model/cag_info_1.c + model/cag_data_1.c model/cag_info.c + model/cag_info_1.c model/cancel_relocate_ue_context_request.c model/candidate_for_replacement.c model/cause.c model/ce_mode_b_ind.c + model/cell_global_id.c model/change_item.c model/change_type.c model/charging_data.c model/charging_information.c model/chf_info.c model/ciphering_algorithm.c + model/circumstance_description.c model/civic_address.c + model/class_criterion.c model/cm_info.c - model/cm_state_any_of.c model/cm_state.c + model/cm_state_any_of.c model/cn_assisted_ran_para.c model/cnf.c model/cnf_unit.c model/code_word_ind.c model/collection_period_rmm_lte_mdt.c model/collection_period_rmm_nr_mdt.c + model/collocated_nf_instance.c + model/collocated_nf_type.c model/communication_characteristics.c + model/communication_characteristics_af.c model/complex_query.c model/condition_data.c model/condition_event_type.c model/configured_snssai.c model/confirmation_data.c model/confirmation_data_response.c + model/congestion_info.c + model/congestion_type.c + model/congestion_type_any_of.c + model/connection_capabilities.c + model/connection_capabilities_any_of.c + model/consumer_nf_information.c model/context_data_set_name.c model/context_data_sets.c model/context_info.c @@ -188,52 +238,88 @@ libsbi_openapi_sources = files(''' model/credit_management_status.c model/data_change_notify.c model/data_filter.c - model/data_ind_any_of.c model/data_ind.c - model/datalink_reporting_configuration.c + model/data_ind_any_of.c + model/data_restoration_notification.c model/data_set_id.c model/data_set_name.c + model/datalink_reporting_configuration.c + model/datalink_reporting_configuration_1.c + model/dataset_statistical_property.c + model/dataset_statistical_property_any_of.c + model/dccf_cond.c + model/dccf_info.c model/ddd_traffic_descriptor.c + model/ddd_traffic_descriptor_1.c model/ddn_failure_sub_info.c model/ddn_failure_subs.c + model/def_sub_service_info.c model/default_notification_subscription.c - model/default_unrelated_class_1.c model/default_unrelated_class.c model/deregistration_data.c model/deregistration_info.c model/deregistration_reason.c + model/dispersion_area.c + model/dispersion_class.c + model/dispersion_class_one_of.c + model/dispersion_collection.c + model/dispersion_info.c + model/dispersion_ordering_criterion.c + model/dispersion_ordering_criterion_any_of.c + model/dispersion_requirement.c + model/dispersion_type.c + model/dispersion_type_one_of.c model/dl_data_delivery_status.c + model/dn_perf.c + model/dn_perf_info.c + model/dn_perf_ordering_criterion.c + model/dn_perf_ordering_criterion_any_of.c + model/dn_performance_req.c model/dnai_change_type.c model/dnai_information.c model/dnf.c model/dnf_unit.c - model/dnn_configuration_1.c model/dnn_configuration.c + model/dnn_configuration_1.c + model/dnn_easdf_info_item.c model/dnn_info.c + model/dnn_info_item.c + model/dnn_mb_smf_info_item.c model/dnn_route_selection_descriptor.c model/dnn_selection_mode.c model/dnn_smf_info_item.c + model/dnn_smf_info_item_dnai_list_inner.c + model/dnn_snssai_information.c + model/dnn_tsctsf_info_item.c model/dnn_upf_info_item.c - model/domain_name_protocol_any_of.c model/domain_name_protocol.c + model/domain_name_protocol_any_of.c model/downlink_data_notification_control.c model/downlink_data_notification_control_rm.c model/dynamic5_qi.c model/eap_auth_method_200_response.c model/eap_session.c + model/eas_ip_replacement_info.c + model/eas_server_address.c + model/easdf_info.c model/ebi_arp_mapping.c - model/ecgi_1.c - model/ecgi.c model/ec_restriction.c + model/ec_restriction_1.c model/ec_restriction_data_wb.c - model/edrx_parameters_1.c + model/ecgi.c + model/ecgi_1.c + model/ecs_addr_config_info.c + model/ecs_addr_config_info_1.c + model/ecs_server_addr.c model/edrx_parameters.c + model/edrx_parameters_1.c model/ee_group_profile_data.c model/ee_profile_data.c model/ee_subscription.c - model/ellipsoid_arc_all_of.c + model/ee_subscription_1.c + model/ee_subscription_ext.c model/ellipsoid_arc.c - model/emergency_info_1.c + model/ellipsoid_arc_all_of.c model/emergency_info.c model/enhanced_coverage_restriction_data.c model/eps_bearer_info.c @@ -247,97 +333,129 @@ libsbi_openapi_sources = files(''' model/error_report.c model/eth_flow_description.c model/eutra_location.c + model/event.c + model/event_any_of.c model/event_for_mdt.c - model/event_id_any_of.c model/event_id.c - model/event_report_mode_any_of.c + model/event_id_any_of.c + model/event_notification.c model/event_report_mode.c + model/event_report_mode_any_of.c + model/event_reporting_requirement.c + model/event_subscription.c + model/event_type.c + model/event_type_any_of.c model/events_notification.c model/events_subsc_put_data.c model/events_subsc_req_data.c model/events_subsc_req_data_rm.c - model/event_type_any_of.c - model/event_type.c + model/exception.c + model/exception_id.c + model/exception_id_any_of.c + model/exception_trend.c + model/exception_trend_any_of.c model/exemption_ind.c + model/expected_analytics_type.c + model/expected_analytics_type_any_of.c model/expected_ue_behavior.c model/expected_ue_behaviour.c - model/expected_ue_behaviour_data_1.c model/expected_ue_behaviour_data.c + model/expected_ue_behaviour_data_1.c model/exposure_data_change_notification.c model/exposure_data_subscription.c model/ext_amf_event_subscription.c - model/extended_problem_details_all_of.c - model/extended_problem_details.c - model/external_client_type_any_of.c - model/external_client_type.c - model/external_unrelated_class.c model/ext_problem_details.c model/ext_snssai.c + model/extended_problem_details.c + model/extended_problem_details_all_of.c + model/extended_sm_subs_data.c + model/external_client_type.c + model/external_client_type_any_of.c + model/external_unrelated_class.c model/failure_cause.c model/failure_code.c - model/final_unit_action_any_of.c + model/failure_event_info.c model/final_unit_action.c + model/final_unit_action_any_of.c model/flow_direction.c + model/flow_direction_rm.c model/flow_info.c model/flow_information.c - model/flows.c model/flow_status.c model/flow_usage.c - model/frame_route_info_1.c + model/flows.c + model/fqdn_rm.c model/frame_route_info.c + model/frame_route_info_1.c model/gad_shape.c + model/gba_auth_type.c + model/gba_authentication_info_request.c + model/gba_authentication_info_result.c model/gbr_qos_flow_information.c - model/geographical_coordinates.c + model/geo_service_area.c + model/geo_service_area_1.c model/geographic_area.c - model/get_nf_instances_200_response.c - model/global_ran_node_id_1.c + model/geographical_area.c + model/geographical_coordinates.c + model/gera_location.c + model/get_multiple_pp_data_entries_ue_id_parameter.c model/global_ran_node_id.c + model/global_ran_node_id_1.c model/gmlc_info.c model/gnb_id.c + model/gpsi_type.c model/group_identifiers.c model/guami.c model/guami_list_cond.c model/hfc_node_id.c model/ho_state.c model/hsmf_update_data.c - model/hsmf_updated_data.c model/hsmf_update_error.c + model/hsmf_updated_data.c + model/hss_auth_type.c + model/hss_auth_type_in_uri.c model/hss_authentication_info_request.c model/hss_authentication_info_result.c model/hss_authentication_vectors.c - model/hss_auth_type.c - model/hss_auth_type_in_uri.c model/hss_av_type.c model/hss_info.c + model/hss_subscription_info.c + model/hss_subscription_item.c + model/id_translation_result.c model/identity_data.c model/identity_range.c - model/id_translation_result.c model/immediate_mdt_conf.c - model/imsi_range.c + model/immediate_report.c model/ims_vo_ps.c + model/imsi_range.c model/indirect_data_forwarding_tunnel_info.c model/integrity_algorithm.c - model/interface_upf_info_item.c - model/inter_freq_target_info_1.c model/inter_freq_target_info.c + model/inter_freq_target_info_1.c + model/interface_upf_info_item.c model/internal_group_id_range.c - model/invalid_param_1.c model/invalid_param.c - model/ip_address_1.c + model/ip_addr.c + model/ip_addr_1.c model/ip_address.c + model/ip_address_1.c model/ip_end_point.c + model/ip_eth_flow_description.c + model/ip_index.c model/ip_multicast_address_info.c model/ip_reachability.c + model/ip_sm_gw_guidance.c + model/ip_sm_gw_info.c model/ip_sm_gw_registration.c model/iptv_config_data.c model/iptv_config_data_patch.c model/ipv4_address_range.c model/ipv6_prefix_range.c + model/iwmsc_info.c model/job_type.c model/key_amf.c model/key_amf_type.c model/ladn_info.c - model/lcs_broadcast_assistance_types_data_1.c model/lcs_broadcast_assistance_types_data.c model/lcs_client_class.c model/lcs_client_external.c @@ -345,39 +463,57 @@ libsbi_openapi_sources = files(''' model/lcs_mo_data.c model/lcs_mo_service_class.c model/lcs_privacy.c - model/lcs_privacy_data_1.c model/lcs_privacy_data.c model/limit_id_to_monitoring_key.c model/line_type.c model/link.c model/links_value_schema.c model/lmf_info.c - model/location_accuracy_any_of.c + model/local2d_point_uncertainty_ellipse.c + model/local2d_point_uncertainty_ellipse_all_of.c + model/local3d_point_uncertainty_ellipsoid.c + model/local3d_point_uncertainty_ellipsoid_all_of.c + model/local_origin.c model/location_accuracy.c - model/location_area_1.c + model/location_accuracy_any_of.c model/location_area.c - model/location_filter_any_of.c + model/location_area_1.c + model/location_area_id.c model/location_filter.c + model/location_filter_any_of.c model/location_info.c model/location_privacy_ind.c model/location_reporting_configuration.c + model/location_reporting_configuration_1.c model/logging_duration_mdt.c model/logging_duration_nr_mdt.c model/logging_interval_mdt.c model/logging_interval_nr_mdt.c model/loss_connectivity_cfg.c - model/lpi_1.c + model/loss_connectivity_cfg_1.c model/lpi.c model/lte_m_ind.c - model/lte_v2x_auth_1.c model/lte_v2x_auth.c model/ma_pdu_indication.c - model/mapping_of_snssai.c model/ma_release_indication.c + model/mapping_of_snssai.c + model/matching_direction.c + model/matching_direction_any_of.c model/max_integrity_protected_data_rate.c + model/mb_smf_info.c + model/mb_upf_info.c + model/mbs_binding_resp.c + model/mbs_ext_problem_details.c + model/mbs_service_area.c + model/mbs_service_area_info.c + model/mbs_session.c + model/mbs_session_id.c + model/mbs_session_id_1.c + model/mbs_subscription_data.c + model/mbs_subscription_data_1.c model/mbsfn_area.c - model/mdt_configuration_1.c model/mdt_configuration.c + model/mdt_configuration_1.c model/mdt_user_consent.c model/measurement_lte_for_mdt.c model/measurement_nr_for_mdt.c @@ -390,16 +526,24 @@ libsbi_openapi_sources = files(''' model/media_type.c model/message_waiting_data.c model/metering_method.c + model/mfaf_info.c + model/ml_analytics_info.c model/mm_context.c model/mme_capabilities.c + model/mnpf_info.c + model/mo_exp_data_counter.c + model/model_3_g_aka_av.c + model/model_5_g_ddnmf_info.c model/model_5_gvn_group_configuration.c model/model_5_gvn_group_data.c + model/model_5_mbs_authorization_info.c model/modification_notification.c model/modify_200_response.c - model/mo_exp_data_counter.c + model/modifysubscription_data_subscription_200_response.c model/monitoring_configuration.c + model/monitoring_configuration_1.c + model/mps_action.c model/mtc_provider.c - model/multicast_access_control_any_of.c model/multicast_access_control.c model/n1_message_class.c model/n1_message_container.c @@ -415,6 +559,7 @@ libsbi_openapi_sources = files(''' model/n2_info_notification_rsp_data.c model/n2_info_notify_handover_complete_200_response.c model/n2_info_notify_reason.c + model/n2_info_notify_request.c model/n2_information_class.c model/n2_information_notification.c model/n2_information_transfer_error.c @@ -423,28 +568,40 @@ libsbi_openapi_sources = files(''' model/n2_information_transfer_rsp_data.c model/n2_interface_amf_info.c model/n2_ran_information.c - model/n2_sm_information.c model/n2_sm_info_type.c + model/n2_sm_information.c model/n3ga_location.c model/n4_information.c model/n4_message_type.c + model/namf_subscription_data.c model/nas_security_mode.c - model/ncgi_1.c model/ncgi.c + model/ncgi_1.c + model/ncgi_tai.c model/nef_cond.c model/nef_info.c model/net_loc_access_support.c - model/network_area_info_1.c model/network_area_info.c - model/network_node_diameter_address_1.c + model/network_area_info_1.c + model/network_area_info_2.c model/network_node_diameter_address.c + model/network_node_diameter_address_1.c + model/network_perf_info.c + model/network_perf_requirement.c + model/network_perf_type.c + model/network_perf_type_any_of.c model/network_slice_cond.c model/nf_group_cond.c + model/nf_group_list_cond.c + model/nf_identifier.c model/nf_info.c model/nf_instance_id_cond.c model/nf_instance_id_list_cond.c + model/nf_instance_info.c + model/nf_load_level_information.c model/nf_profile.c model/nf_service.c + model/nf_service_instance.c model/nf_service_set_cond.c model/nf_service_status.c model/nf_service_version.c @@ -453,11 +610,17 @@ libsbi_openapi_sources = files(''' model/nf_type.c model/nf_type_cond.c model/ng_ap_cause.c - model/ngap_ie_type.c model/ng_ksi.c model/ng_ran_target_id.c - model/nidd_information_1.c + model/ngap_ie_type.c + model/nidd_authorization_info.c model/nidd_information.c + model/nidd_information_1.c + model/nnwdaf_events_subscription.c + model/nnwdaf_nf_status.c + model/no_profile_match_info.c + model/no_profile_match_reason.c + model/no_profile_match_reason_any_of.c model/node_type.c model/non_dynamic5_qi.c model/non_ue_n2_info_notify_request.c @@ -470,118 +633,186 @@ libsbi_openapi_sources = files(''' model/notification_control_indication.c model/notification_data.c model/notification_event_type.c + model/notification_flag.c + model/notification_info.c model/notification_item.c + model/notification_method.c + model/notification_method_1.c + model/notification_method_1_any_of.c + model/notification_method_any_of.c model/notification_type.c model/notify_item.c model/npcf_af_event.c + model/npcf_atsss_capability.c + model/npcf_multicast_access_control.c + model/npcf_pdu_session_status.c model/npn_access_info.c - model/nrf_info.c model/nr_location.c - model/nrppa_information.c - model/nr_v2x_auth_1.c model/nr_v2x_auth.c + model/nrf_info.c + model/nrf_info_served_aanf_info_list_value_value.c + model/nrf_info_served_amf_info_value.c + model/nrf_info_served_ausf_info_value.c + model/nrf_info_served_bsf_info_value.c + model/nrf_info_served_chf_info_value.c + model/nrf_info_served_gmlc_info_value.c + model/nrf_info_served_hss_info_list_value_value.c + model/nrf_info_served_lmf_info_value.c + model/nrf_info_served_mb_smf_info_list_value_value.c + model/nrf_info_served_nef_info_value.c + model/nrf_info_served_nwdaf_info_value.c + model/nrf_info_served_pcf_info_value.c + model/nrf_info_served_pcscf_info_list_value_value.c + model/nrf_info_served_scp_info_list_value.c + model/nrf_info_served_sepp_info_list_value.c + model/nrf_info_served_smf_info_value.c + model/nrf_info_served_udm_info_value.c + model/nrf_info_served_udr_info_value.c + model/nrf_info_served_udsf_info_value.c + model/nrf_info_served_upf_info_value.c + model/nrppa_information.c + model/nsacf_capability.c + model/nsacf_info.c + model/nsag_info.c + model/nsi_id_info.c model/nsi_information.c + model/nsi_load_level_info.c model/nssaa_status.c + model/nssaaf_info.c + model/nssai.c model/nssai_1.c model/nssai_ack_data.c - model/nssai.c model/nssai_mapping.c + model/nudm_amf_info.c model/null_value.c + model/number_average.c + model/nwdaf_capability.c model/nwdaf_cond.c - model/nwdaf_event_any_of.c + model/nwdaf_data.c model/nwdaf_event.c + model/nwdaf_event_any_of.c + model/nwdaf_failure_code.c + model/nwdaf_failure_code_any_of.c model/nwdaf_info.c + model/nwdaf_registration.c + model/nwdaf_registration_info.c + model/nwdaf_registration_modification.c + model/nwdaf_subscription.c model/object.c + model/observed_redundant_trans_exp.c model/odb_data.c model/odb_packet_services.c model/operation_mode.c model/operator_specific_data_container.c + model/operator_specific_data_container_value.c model/options_response.c model/out_of_credit_information.c + model/output_strategy.c + model/output_strategy_any_of.c model/packet_filter_info.c model/parameter_combination.c - model/partial_record_method_any_of.c model/partial_record_method.c + model/partial_record_method_any_of.c model/partial_success_report.c + model/partitioning_criteria.c model/patch_item.c model/patch_operation.c model/patch_result.c model/pc5_flow_bit_rates.c - model/pc5_qos_flow_item.c model/pc5_qo_s_para.c + model/pc5_qos_flow_item.c model/pcc_rule.c + model/pcf_addressing_info.c model/pcf_binding.c model/pcf_binding_patch.c + model/pcf_for_pdu_session_info.c + model/pcf_for_ue_binding.c + model/pcf_for_ue_binding_patch.c + model/pcf_for_ue_info.c model/pcf_info.c + model/pcf_mbs_binding.c + model/pcf_mbs_binding_patch.c + model/pcf_selection_assistance_info.c + model/pcf_selection_assistance_info_1.c + model/pcf_ue_callback_info.c + model/pcscf_address.c model/pcscf_info.c model/pcscf_restoration_notification.c model/pcscf_restoration_request_data.c - model/pdu_session_1.c model/pdu_session.c model/pdu_session_context.c + model/pdu_session_context_type.c model/pdu_session_continuity_ind.c model/pdu_session_create_data.c - model/pdu_session_created_data.c model/pdu_session_create_error.c + model/pdu_session_created_data.c + model/pdu_session_event_notification.c + model/pdu_session_info.c model/pdu_session_management_data.c model/pdu_session_notify_item.c model/pdu_session_rel_cause.c - model/pdu_session_status_any_of.c model/pdu_session_status.c model/pdu_session_status_cfg.c + model/pdu_session_status_cfg_1.c model/pdu_session_tsn_bridge.c model/pdu_session_type.c - model/pdu_session_types_1.c model/pdu_session_types.c + model/pdu_session_types_1.c model/pei_update_info.c + model/perf_data.c model/periodic_communication_indicator.c - model/periodicity_any_of.c model/periodicity.c + model/periodicity_any_of.c model/pfd_change_notification.c model/pfd_content.c model/pfd_data.c - model/pfd_data_for_app.c - model/pfd_data_for_app_ext_all_of.c model/pfd_data_for_app_ext.c - model/pgw_info_1.c model/pgw_info.c model/plmn_ec_info.c - model/plmn_id_1.c + model/plmn_ec_info_1.c model/plmn_id.c - model/plmn_id_nid_1.c + model/plmn_id_1.c model/plmn_id_nid.c - model/plmn_operator_class_1.c + model/plmn_id_nid_1.c + model/plmn_oauth2.c model/plmn_operator_class.c model/plmn_range.c + model/plmn_restriction.c + model/plmn_restriction_1.c model/plmn_route_selection_descriptor.c model/plmn_snssai.c - model/point_all_of.c - model/point_altitude_all_of.c - model/point_altitude.c - model/point_altitude_uncertainty_all_of.c - model/point_altitude_uncertainty.c model/point.c - model/point_uncertainty_circle_all_of.c + model/point_all_of.c + model/point_altitude.c + model/point_altitude_all_of.c + model/point_altitude_uncertainty.c + model/point_altitude_uncertainty_all_of.c model/point_uncertainty_circle.c - model/point_uncertainty_ellipse_all_of.c + model/point_uncertainty_circle_all_of.c model/point_uncertainty_ellipse.c + model/point_uncertainty_ellipse_all_of.c model/policy_association.c model/policy_association_release_cause.c model/policy_association_request.c model/policy_association_update_request.c model/policy_control_request_trigger.c model/policy_data_change_notification.c + model/policy_data_for_individual_ue.c model/policy_data_subscription.c + model/policy_data_subset.c + model/policy_data_subset_any_of.c model/policy_decision_failure_code.c model/policy_req_trigger.c model/policy_update.c - model/polygon_all_of.c model/polygon.c + model/polygon_all_of.c model/port_management_container.c model/positioning_method_mdt.c model/pp5g_vn_group_profile_data.c model/pp_active_time.c model/pp_data.c + model/pp_data_entry.c + model/pp_data_entry_list.c model/pp_dl_packet_count_ext.c model/pp_maximum_latency.c model/pp_maximum_response_time.c @@ -597,18 +828,33 @@ libsbi_openapi_sources = files(''' model/presence_info.c model/presence_info_rm.c model/presence_state.c + model/prev_sub_info.c model/priority_sharing_indicator.c model/privacy_check_related_action.c - model/problem_details_1.c - model/problem_details_2.c - model/problem_details_add_info.c + model/pro_se_allowed_plmn.c + model/pro_se_auth_data.c + model/pro_se_authentication_ctx.c + model/pro_se_authentication_info.c + model/pro_se_authentication_info_request.c + model/pro_se_authentication_info_result.c + model/pro_se_authentication_result.c + model/pro_se_authentication_vectors.c + model/pro_se_capability.c + model/pro_se_eap_session.c + model/pro_se_information.c model/problem_details.c + model/problem_details_1.c + model/problem_details_add_info.c + model/prose_context.c + model/prose_direct_allowed.c + model/prose_service_auth.c + model/prose_subscription_data.c model/protection_result.c model/provisioned_data_sets.c model/psa_indication.c model/psa_information.c - model/ptw_parameters_1.c model/ptw_parameters.c + model/ptw_parameters_1.c model/pws_error_data.c model/pws_information.c model/pws_response_data.c @@ -630,87 +876,122 @@ libsbi_openapi_sources = files(''' model/qos_monitoring_information_rm.c model/qos_monitoring_report.c model/qos_monitoring_req.c - model/qos_notification_control_info.c model/qos_notif_type.c + model/qos_notification_control_info.c + model/qos_requirement.c model/qos_resource_type.c + model/qos_sustainability_info.c + model/query_param_combination.c + model/query_parameter.c model/ran_nas_rel_cause.c + model/ranking_criterion.c + model/rat_freq_information.c model/rat_selector.c model/rat_type.c - model/reachability_filter_any_of.c model/reachability_filter.c - model/reachability_for_sms_configuration_any_of.c + model/reachability_filter_any_of.c + model/reachability_for_data_configuration.c + model/reachability_for_data_configuration_1.c + model/reachability_for_data_report_config.c + model/reachability_for_data_report_config_any_of.c model/reachability_for_sms_configuration.c + model/reachability_for_sms_configuration_any_of.c + model/red_trans_exp_ordering_criterion.c + model/red_trans_exp_ordering_criterion_any_of.c model/redirect_address_type.c model/redirect_information.c model/redirect_response.c model/redundant_pdu_session_information.c - model/reflective_qo_s_attribute.c + model/redundant_transmission_exp_info.c + model/redundant_transmission_exp_per_ts.c + model/redundant_transmission_exp_req.c model/ref_to_binary_data.c + model/reflective_qo_s_attribute.c model/registration_context_container.c model/registration_data_set_name.c model/registration_data_sets.c model/registration_location_info.c model/registration_reason.c + model/relative_cartesian_location.c + model/release_cause.c model/release_data.c - model/released_data.c model/release_pdu_session_200_response.c model/release_pdu_session_request.c + model/release_session_info.c model/release_sm_context_request.c + model/released_data.c model/relocate_ue_context_request.c model/report_amount_mdt.c - model/reporting_frequency.c - model/reporting_level.c - model/reporting_options.c - model/reporting_trigger.c model/report_interval_mdt.c model/report_interval_nr_mdt.c model/report_item.c model/report_type_mdt.c + model/reporting_frequency.c + model/reporting_information.c + model/reporting_level.c + model/reporting_options.c + model/reporting_options_1.c + model/reporting_trigger.c + model/request_indication.c + model/request_trigger.c + model/request_type.c model/requested_qos.c model/requested_qos_monitoring_parameter.c model/requested_rule_data.c model/requested_rule_data_type.c model/requested_usage_data.c - model/request_indication.c - model/request_trigger.c - model/request_type.c model/required_access_info.c model/reserv_priority.c model/resource_item.c - model/resources_allocation_info.c model/resource_status.c + model/resource_usage.c + model/resources_allocation_info.c model/restriction_type.c model/resynchronization_info.c + model/resynchronization_info_1.c + model/retainability_threshold.c model/retrieve_data.c model/retrieved_data.c model/rg_auth_ctx.c model/rg_authentication_info.c model/rm_info.c - model/rm_state_any_of.c model/rm_state.c + model/rm_state_any_of.c model/roaming_charging_profile.c model/roaming_indication.c + model/roaming_info_update.c model/roaming_odb.c + model/roaming_restrictions.c model/route_information.c + model/route_selection_parameter_set.c model/route_to_location.c + model/routing_area_id.c + model/routing_info_sm_request.c + model/routing_info_sm_response.c model/rsn.c model/rule_operation.c model/rule_report.c model/rule_status.c + model/satellite_backhaul_category.c model/sbi_binding_level.c - model/scheduled_communication_time_1.c + model/sc_type.c model/scheduled_communication_time.c + model/scheduled_communication_time_1.c model/scheduled_communication_time_rm.c model/scheduled_communication_type.c model/scheduled_communication_type_rm.c + model/scp_capability.c model/scp_domain_cond.c + model/scp_domain_connectivity.c model/scp_domain_info.c + model/scp_domain_routing_info_notification.c + model/scp_domain_routing_info_subscription.c + model/scp_domain_routing_information.c model/scp_info.c - model/sc_type.c - model/sdm_subscription_1.c - model/sdm_subscription.c - model/sdm_subs_modification.c model/sd_range.c + model/sdm_subs_modification.c + model/sdm_subscription.c + model/sdm_subscription_1.c model/seaf_data.c model/search_result.c model/secondary_rat_usage_info.c @@ -719,34 +1000,51 @@ libsbi_openapi_sources = files(''' model/send_mo_data_req_data.c model/send_mo_data_request.c model/sensor_measurement.c + model/sepp_info.c model/sequence_number.c model/serv_auth_info.c - model/service_area_restriction_1.c + model/server_addressing_info.c + model/service_area_coverage_info.c + model/service_area_id.c model/service_area_restriction.c + model/service_area_restriction_1.c + model/service_experience_info.c + model/service_experience_type.c + model/service_experience_type_any_of.c model/service_info_status.c model/service_name_cond.c + model/service_name_list_cond.c model/service_parameter_data.c model/service_parameter_data_patch.c - model/service_type_unrelated_class_1.c + model/service_specific_authorization_info.c + model/service_type.c + model/service_type_any_of.c model/service_type_unrelated_class.c model/serving_nf_identity.c - model/session_management_subscription_data_1.c + model/sess_inact_timer_for_ue_comm.c model/session_management_subscription_data.c + model/session_management_subscription_data_1.c model/session_rule.c model/session_rule_failure_code.c model/session_rule_report.c + model/sgsn_address.c model/shared_data.c + model/shared_data_id_range.c + model/shared_data_treatment_instruction.c model/sign.c model/sip_forking_indication.c model/slice_info_for_pdu_session.c model/slice_info_for_registration.c model/slice_info_for_ue_configuration_update.c - model/small_data_rate_status.c - model/small_data_rate_status_info.c + model/slice_load_level_information.c + model/slice_mbr.c + model/slice_mbr_1.c + model/slice_mbr_rm.c + model/slice_policy_data.c model/sm_context.c model/sm_context_create_data.c - model/sm_context_created_data.c model/sm_context_create_error.c + model/sm_context_created_data.c model/sm_context_release_data.c model/sm_context_released_data.c model/sm_context_retrieve_data.c @@ -754,18 +1052,8 @@ libsbi_openapi_sources = files(''' model/sm_context_status_notification.c model/sm_context_type.c model/sm_context_update_data.c - model/sm_context_updated_data.c model/sm_context_update_error.c - model/smf_change_indication.c - model/smf_change_info.c - model/smf_info.c - model/smf_registration.c - model/smf_registration_info.c - model/smf_selection_data.c - model/smf_selection_subscription_data_1.c - model/smf_selection_subscription_data.c - model/smf_subscription_info.c - model/smf_subscription_item.c + model/sm_context_updated_data.c model/sm_policy_association_release_cause.c model/sm_policy_context_data.c model/sm_policy_control.c @@ -779,83 +1067,126 @@ libsbi_openapi_sources = files(''' model/sm_policy_snssai_data.c model/sm_policy_snssai_data_patch.c model/sm_policy_update_context_data.c + model/sm_subs_data.c + model/small_data_rate_status.c + model/small_data_rate_status_info.c + model/smcce_info.c + model/smcce_ue_list.c + model/smf_change_indication.c + model/smf_change_info.c + model/smf_info.c + model/smf_registration.c + model/smf_registration_info.c + model/smf_registration_modification.c + model/smf_selection_data.c + model/smf_selection_subscription_data.c + model/smf_selection_type.c + model/smf_subscription_info.c + model/smf_subscription_item.c + model/sms_management_subscription_data.c + model/sms_management_subscription_data_1.c + model/sms_router_info.c + model/sms_subscription_data.c + model/sms_subscription_data_1.c + model/sms_support.c model/smsc_data.c - model/smsf_info_1.c model/smsf_info.c model/smsf_registration.c - model/sms_management_subscription_data_1.c - model/sms_management_subscription_data.c - model/sms_subscription_data_1.c - model/sms_subscription_data.c - model/sms_support.c model/snssai.c + model/snssai_dnn_pair.c + model/snssai_easdf_info_item.c model/snssai_extension.c model/snssai_info.c + model/snssai_info_item.c + model/snssai_mb_smf_info_item.c model/snssai_route_selection_descriptor.c model/snssai_smf_info_item.c + model/snssai_tsctsf_info_item.c model/snssai_upf_info_item.c model/sor_data.c - model/sor_info_1.c model/sor_info.c + model/sor_info_1.c model/sor_update_indicator.c model/sor_update_info.c model/spatial_validity.c + model/spatial_validity_cond.c + model/spatial_validity_cond_1.c model/spatial_validity_rm.c model/sponsor_connectivity_data.c model/sponsoring_status.c model/sqn_scheme.c model/ssc_mode.c - model/ssc_modes_1.c model/ssc_modes.c + model/ssc_modes_1.c + model/ssm.c + model/ssm_1.c model/stationary_indication.c model/stationary_indication_rm.c model/status_change.c model/status_info.c model/status_notification.c + model/steer_mode_indicator.c + model/steer_mode_value.c model/steering_container.c model/steering_functionality.c model/steering_info.c model/steering_mode.c - model/steer_mode_value.c model/stored_search_result.c - model/subscribed_default_qos_1.c + model/subscr_cond.c model/subscribed_default_qos.c - model/subscribed_event_any_of.c + model/subscribed_default_qos_1.c model/subscribed_event.c + model/subscribed_event_any_of.c model/subscribed_snssai.c + model/subscription_context.c model/subscription_data.c - model/subscription_data_sets_1.c model/subscription_data_sets.c - model/subscription_data_subscr_cond.c model/subscription_data_subscriptions.c - model/suggested_packet_num_dl_1.c + model/suci_info.c model/suggested_packet_num_dl.c + model/suggested_packet_num_dl_1.c + model/supi_info.c model/supi_range.c - model/supported_gad_shapes_any_of.c model/supported_gad_shapes.c + model/supported_gad_shapes_any_of.c + model/svc_experience.c model/tac_info.c model/tac_range.c - model/tai_1.c model/tai.c + model/tai_1.c model/tai_range.c + model/target_area.c + model/target_dnai_info.c + model/target_ue_information.c model/temporal_validity.c model/termination_cause.c model/termination_info.c model/termination_notification.c + model/threshold_level.c + model/threshold_value.c model/time_period.c + model/time_unit.c + model/time_unit_any_of.c model/time_window.c + model/tmgi.c + model/tmgi_1.c + model/tmgi_range.c model/tnap_id.c model/tngf_info.c - model/trace_data_1.c + model/top_application.c model/trace_data.c + model/trace_data_1.c model/trace_data_response.c model/trace_depth.c + model/traffic_characterization.c model/traffic_control_data.c model/traffic_descriptor.c + model/traffic_descriptor_components.c model/traffic_influ_data.c model/traffic_influ_data_notif.c model/traffic_influ_data_patch.c model/traffic_influ_sub.c + model/traffic_information.c model/traffic_profile.c model/traffic_profile_rm.c model/transfer_mo_data_req_data.c @@ -867,36 +1198,42 @@ libsbi_openapi_sources = files(''' model/transfer_policy.c model/transfer_reason.c model/transport_protocol.c + model/transport_protocol_1.c model/trigger.c - model/trigger_category_any_of.c model/trigger_category.c + model/trigger_category_any_of.c model/trigger_request.c - model/trigger_type_any_of.c model/trigger_type.c + model/trigger_type_any_of.c + model/trust_af_info.c model/tscai_input_container.c + model/tsctsf_info.c model/tsn_bridge_info.c model/tsn_qos_container.c model/tsn_qos_container_rm.c model/tunnel_info.c model/twap_id.c model/twif_info.c + model/uc_purpose.c + model/uc_subscription_data.c model/udm_info.c model/udr_info.c model/udsf_info.c + model/ue_analytics_context_descriptor.c model/ue_auth.c - model/ue_authentication_ctx_5g_auth_data.c model/ue_authentication_ctx.c + model/ue_authentication_ctx_5g_auth_data.c model/ue_camping_rep.c + model/ue_communication.c model/ue_context.c model/ue_context_cancel_relocate_data.c model/ue_context_create_data.c - model/ue_context_created_data.c model/ue_context_create_error.c - model/ue_context_in_amf_data_1.c + model/ue_context_created_data.c model/ue_context_in_amf_data.c - model/ue_context_in_smf_data_1.c model/ue_context_in_smf_data.c - model/ue_context_in_smsf_data_1.c + model/ue_context_in_smf_data_sub_filter.c + model/ue_context_in_smf_data_sub_filter_1.c model/ue_context_in_smsf_data.c model/ue_context_release.c model/ue_context_relocate_data.c @@ -909,60 +1246,77 @@ libsbi_openapi_sources = files(''' model/ue_differentiation_info.c model/ue_id.c model/ue_identity_info.c + model/ue_in_area_filter.c model/ue_initiated_resource_request.c + model/ue_mobility.c model/ue_n1_n2_info_subscription_create_data.c model/ue_n1_n2_info_subscription_created_data.c model/ue_policy_section.c model/ue_policy_set.c model/ue_policy_set_patch.c - model/ue_reachability_any_of.c model/ue_reachability.c + model/ue_reachability_any_of.c + model/ue_reachable_ind.c model/ue_reg_status_update_req_data.c model/ue_reg_status_update_rsp_data.c + model/ue_slice_mbr.c + model/ue_type.c + model/ue_type_any_of.c model/ue_update_status.c model/ulcl_bp_information.c + model/umt_time.c + model/umt_time_1.c + model/un_trust_af_info.c model/unavailable_access_indication.c model/uncertainty_ellipse.c - model/unrelated_class_1.c + model/uncertainty_ellipsoid.c model/unrelated_class.c model/up_cnx_state.c model/up_confidentiality.c - model/updated_item.c + model/up_integrity.c + model/up_interface_type.c + model/up_path_chg_event.c + model/up_security.c + model/up_security_1.c + model/up_security_info.c + model/update_nwdaf_registration_200_response.c model/update_pdu_session_200_response.c model/update_pdu_session_400_response.c model/update_pdu_session_request.c model/update_sm_context_200_response.c model/update_sm_context_400_response.c model/update_sm_context_request.c + model/updated_item.c + model/updp_subscription_data.c model/upf_cond.c model/upf_info.c - model/up_integrity.c - model/up_interface_type.c - model/up_path_chg_event.c - model/up_security_1.c - model/up_security.c - model/up_security_info.c + model/upf_information.c + model/upu_data.c model/upu_data_1.c model/upu_data_2.c - model/upu_data.c - model/upu_info_1.c model/upu_info.c + model/upu_info_1.c + model/uri_list.c model/uri_scheme.c + model/ursp_rule_request.c model/usage_mon_data.c model/usage_mon_data_limit.c model/usage_mon_data_scope.c - model/usage_monitoring_data.c - model/usage_mon_level_any_of.c model/usage_mon_level.c + model/usage_mon_level_any_of.c + model/usage_monitoring_data.c model/usage_threshold.c model/usage_threshold_rm.c + model/user_consent.c + model/user_data_congestion_info.c model/user_identifier.c model/user_location.c + model/utra_location.c + model/uuaa_mm_status.c + model/v2x_capability.c model/v2x_context.c model/v2x_information.c - model/v2x_subscription_data_1.c model/v2x_subscription_data.c - model/valid_time_period_1.c model/valid_time_period.c model/vendor_specific_feature.c model/vgmlc_address.c @@ -970,13 +1324,19 @@ libsbi_openapi_sources = files(''' model/volume_timed_report.c model/vplmn_qos.c model/vsmf_update_data.c - model/vsmf_updated_data.c model/vsmf_update_error.c + model/vsmf_updated_data.c model/w_agf_info.c - model/wireline_area_1.c model/wireline_area.c - model/wireline_service_area_restriction_1.c + model/wireline_area_1.c model/wireline_service_area_restriction.c + model/wireline_service_area_restriction_1.c + model/wlan_ordering_criterion.c + model/wlan_ordering_criterion_any_of.c + model/wlan_per_ss_id_performance_info.c + model/wlan_per_ts_performance_info.c + model/wlan_performance_info.c + model/wlan_performance_req.c '''.split()) libsbi_openapi_inc = include_directories('.') diff --git a/lib/sbi/openapi/model/aanf_info.c b/lib/sbi/openapi/model/aanf_info.c new file mode 100644 index 000000000..54b1fb57d --- /dev/null +++ b/lib/sbi/openapi/model/aanf_info.c @@ -0,0 +1,141 @@ + +#include +#include +#include +#include "aanf_info.h" + +OpenAPI_aanf_info_t *OpenAPI_aanf_info_create( + OpenAPI_list_t *routing_indicators +) +{ + OpenAPI_aanf_info_t *aanf_info_local_var = ogs_malloc(sizeof(OpenAPI_aanf_info_t)); + ogs_assert(aanf_info_local_var); + + aanf_info_local_var->routing_indicators = routing_indicators; + + return aanf_info_local_var; +} + +void OpenAPI_aanf_info_free(OpenAPI_aanf_info_t *aanf_info) +{ + OpenAPI_lnode_t *node = NULL; + + if (NULL == aanf_info) { + return; + } + if (aanf_info->routing_indicators) { + OpenAPI_list_for_each(aanf_info->routing_indicators, node) { + ogs_free(node->data); + } + OpenAPI_list_free(aanf_info->routing_indicators); + aanf_info->routing_indicators = NULL; + } + ogs_free(aanf_info); +} + +cJSON *OpenAPI_aanf_info_convertToJSON(OpenAPI_aanf_info_t *aanf_info) +{ + cJSON *item = NULL; + OpenAPI_lnode_t *node = NULL; + + if (aanf_info == NULL) { + ogs_error("OpenAPI_aanf_info_convertToJSON() failed [AanfInfo]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (aanf_info->routing_indicators) { + cJSON *routing_indicatorsList = cJSON_AddArrayToObject(item, "routingIndicators"); + if (routing_indicatorsList == NULL) { + ogs_error("OpenAPI_aanf_info_convertToJSON() failed [routing_indicators]"); + goto end; + } + OpenAPI_list_for_each(aanf_info->routing_indicators, node) { + if (cJSON_AddStringToObject(routing_indicatorsList, "", (char*)node->data) == NULL) { + ogs_error("OpenAPI_aanf_info_convertToJSON() failed [routing_indicators]"); + goto end; + } + } + } + +end: + return item; +} + +OpenAPI_aanf_info_t *OpenAPI_aanf_info_parseFromJSON(cJSON *aanf_infoJSON) +{ + OpenAPI_aanf_info_t *aanf_info_local_var = NULL; + OpenAPI_lnode_t *node = NULL; + cJSON *routing_indicators = NULL; + OpenAPI_list_t *routing_indicatorsList = NULL; + routing_indicators = cJSON_GetObjectItemCaseSensitive(aanf_infoJSON, "routingIndicators"); + if (routing_indicators) { + cJSON *routing_indicators_local = NULL; + if (!cJSON_IsArray(routing_indicators)) { + ogs_error("OpenAPI_aanf_info_parseFromJSON() failed [routing_indicators]"); + goto end; + } + + routing_indicatorsList = OpenAPI_list_create(); + + cJSON_ArrayForEach(routing_indicators_local, routing_indicators) { + double *localDouble = NULL; + int *localInt = NULL; + if (!cJSON_IsString(routing_indicators_local)) { + ogs_error("OpenAPI_aanf_info_parseFromJSON() failed [routing_indicators]"); + goto end; + } + OpenAPI_list_add(routing_indicatorsList, ogs_strdup(routing_indicators_local->valuestring)); + } + } + + aanf_info_local_var = OpenAPI_aanf_info_create ( + routing_indicators ? routing_indicatorsList : NULL + ); + + return aanf_info_local_var; +end: + if (routing_indicatorsList) { + OpenAPI_list_for_each(routing_indicatorsList, node) { + ogs_free(node->data); + } + OpenAPI_list_free(routing_indicatorsList); + routing_indicatorsList = NULL; + } + return NULL; +} + +OpenAPI_aanf_info_t *OpenAPI_aanf_info_copy(OpenAPI_aanf_info_t *dst, OpenAPI_aanf_info_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_aanf_info_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_aanf_info_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_aanf_info_free(dst); + dst = OpenAPI_aanf_info_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/aanf_info.h b/lib/sbi/openapi/model/aanf_info.h new file mode 100644 index 000000000..7f74687bd --- /dev/null +++ b/lib/sbi/openapi/model/aanf_info.h @@ -0,0 +1,38 @@ +/* + * aanf_info.h + * + * Represents the information relative to an AAnF NF Instance. + */ + +#ifndef _OpenAPI_aanf_info_H_ +#define _OpenAPI_aanf_info_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_aanf_info_s OpenAPI_aanf_info_t; +typedef struct OpenAPI_aanf_info_s { + OpenAPI_list_t *routing_indicators; +} OpenAPI_aanf_info_t; + +OpenAPI_aanf_info_t *OpenAPI_aanf_info_create( + OpenAPI_list_t *routing_indicators +); +void OpenAPI_aanf_info_free(OpenAPI_aanf_info_t *aanf_info); +OpenAPI_aanf_info_t *OpenAPI_aanf_info_parseFromJSON(cJSON *aanf_infoJSON); +cJSON *OpenAPI_aanf_info_convertToJSON(OpenAPI_aanf_info_t *aanf_info); +OpenAPI_aanf_info_t *OpenAPI_aanf_info_copy(OpenAPI_aanf_info_t *dst, OpenAPI_aanf_info_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_aanf_info_H_ */ + diff --git a/lib/sbi/openapi/model/abnormal_behaviour.c b/lib/sbi/openapi/model/abnormal_behaviour.c new file mode 100644 index 000000000..e42eabc91 --- /dev/null +++ b/lib/sbi/openapi/model/abnormal_behaviour.c @@ -0,0 +1,305 @@ + +#include +#include +#include +#include "abnormal_behaviour.h" + +OpenAPI_abnormal_behaviour_t *OpenAPI_abnormal_behaviour_create( + OpenAPI_list_t *supis, + OpenAPI_exception_t *excep, + char *dnn, + OpenAPI_snssai_t *snssai, + bool is_ratio, + int ratio, + bool is_confidence, + int confidence, + OpenAPI_additional_measurement_t *addt_meas_info +) +{ + OpenAPI_abnormal_behaviour_t *abnormal_behaviour_local_var = ogs_malloc(sizeof(OpenAPI_abnormal_behaviour_t)); + ogs_assert(abnormal_behaviour_local_var); + + abnormal_behaviour_local_var->supis = supis; + abnormal_behaviour_local_var->excep = excep; + abnormal_behaviour_local_var->dnn = dnn; + abnormal_behaviour_local_var->snssai = snssai; + abnormal_behaviour_local_var->is_ratio = is_ratio; + abnormal_behaviour_local_var->ratio = ratio; + abnormal_behaviour_local_var->is_confidence = is_confidence; + abnormal_behaviour_local_var->confidence = confidence; + abnormal_behaviour_local_var->addt_meas_info = addt_meas_info; + + return abnormal_behaviour_local_var; +} + +void OpenAPI_abnormal_behaviour_free(OpenAPI_abnormal_behaviour_t *abnormal_behaviour) +{ + OpenAPI_lnode_t *node = NULL; + + if (NULL == abnormal_behaviour) { + return; + } + if (abnormal_behaviour->supis) { + OpenAPI_list_for_each(abnormal_behaviour->supis, node) { + ogs_free(node->data); + } + OpenAPI_list_free(abnormal_behaviour->supis); + abnormal_behaviour->supis = NULL; + } + if (abnormal_behaviour->excep) { + OpenAPI_exception_free(abnormal_behaviour->excep); + abnormal_behaviour->excep = NULL; + } + if (abnormal_behaviour->dnn) { + ogs_free(abnormal_behaviour->dnn); + abnormal_behaviour->dnn = NULL; + } + if (abnormal_behaviour->snssai) { + OpenAPI_snssai_free(abnormal_behaviour->snssai); + abnormal_behaviour->snssai = NULL; + } + if (abnormal_behaviour->addt_meas_info) { + OpenAPI_additional_measurement_free(abnormal_behaviour->addt_meas_info); + abnormal_behaviour->addt_meas_info = NULL; + } + ogs_free(abnormal_behaviour); +} + +cJSON *OpenAPI_abnormal_behaviour_convertToJSON(OpenAPI_abnormal_behaviour_t *abnormal_behaviour) +{ + cJSON *item = NULL; + OpenAPI_lnode_t *node = NULL; + + if (abnormal_behaviour == NULL) { + ogs_error("OpenAPI_abnormal_behaviour_convertToJSON() failed [AbnormalBehaviour]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (abnormal_behaviour->supis) { + cJSON *supisList = cJSON_AddArrayToObject(item, "supis"); + if (supisList == NULL) { + ogs_error("OpenAPI_abnormal_behaviour_convertToJSON() failed [supis]"); + goto end; + } + OpenAPI_list_for_each(abnormal_behaviour->supis, node) { + if (cJSON_AddStringToObject(supisList, "", (char*)node->data) == NULL) { + ogs_error("OpenAPI_abnormal_behaviour_convertToJSON() failed [supis]"); + goto end; + } + } + } + + if (!abnormal_behaviour->excep) { + ogs_error("OpenAPI_abnormal_behaviour_convertToJSON() failed [excep]"); + return NULL; + } + cJSON *excep_local_JSON = OpenAPI_exception_convertToJSON(abnormal_behaviour->excep); + if (excep_local_JSON == NULL) { + ogs_error("OpenAPI_abnormal_behaviour_convertToJSON() failed [excep]"); + goto end; + } + cJSON_AddItemToObject(item, "excep", excep_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_abnormal_behaviour_convertToJSON() failed [excep]"); + goto end; + } + + if (abnormal_behaviour->dnn) { + if (cJSON_AddStringToObject(item, "dnn", abnormal_behaviour->dnn) == NULL) { + ogs_error("OpenAPI_abnormal_behaviour_convertToJSON() failed [dnn]"); + goto end; + } + } + + if (abnormal_behaviour->snssai) { + cJSON *snssai_local_JSON = OpenAPI_snssai_convertToJSON(abnormal_behaviour->snssai); + if (snssai_local_JSON == NULL) { + ogs_error("OpenAPI_abnormal_behaviour_convertToJSON() failed [snssai]"); + goto end; + } + cJSON_AddItemToObject(item, "snssai", snssai_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_abnormal_behaviour_convertToJSON() failed [snssai]"); + goto end; + } + } + + if (abnormal_behaviour->is_ratio) { + if (cJSON_AddNumberToObject(item, "ratio", abnormal_behaviour->ratio) == NULL) { + ogs_error("OpenAPI_abnormal_behaviour_convertToJSON() failed [ratio]"); + goto end; + } + } + + if (abnormal_behaviour->is_confidence) { + if (cJSON_AddNumberToObject(item, "confidence", abnormal_behaviour->confidence) == NULL) { + ogs_error("OpenAPI_abnormal_behaviour_convertToJSON() failed [confidence]"); + goto end; + } + } + + if (abnormal_behaviour->addt_meas_info) { + cJSON *addt_meas_info_local_JSON = OpenAPI_additional_measurement_convertToJSON(abnormal_behaviour->addt_meas_info); + if (addt_meas_info_local_JSON == NULL) { + ogs_error("OpenAPI_abnormal_behaviour_convertToJSON() failed [addt_meas_info]"); + goto end; + } + cJSON_AddItemToObject(item, "addtMeasInfo", addt_meas_info_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_abnormal_behaviour_convertToJSON() failed [addt_meas_info]"); + goto end; + } + } + +end: + return item; +} + +OpenAPI_abnormal_behaviour_t *OpenAPI_abnormal_behaviour_parseFromJSON(cJSON *abnormal_behaviourJSON) +{ + OpenAPI_abnormal_behaviour_t *abnormal_behaviour_local_var = NULL; + OpenAPI_lnode_t *node = NULL; + cJSON *supis = NULL; + OpenAPI_list_t *supisList = NULL; + cJSON *excep = NULL; + OpenAPI_exception_t *excep_local_nonprim = NULL; + cJSON *dnn = NULL; + cJSON *snssai = NULL; + OpenAPI_snssai_t *snssai_local_nonprim = NULL; + cJSON *ratio = NULL; + cJSON *confidence = NULL; + cJSON *addt_meas_info = NULL; + OpenAPI_additional_measurement_t *addt_meas_info_local_nonprim = NULL; + supis = cJSON_GetObjectItemCaseSensitive(abnormal_behaviourJSON, "supis"); + if (supis) { + cJSON *supis_local = NULL; + if (!cJSON_IsArray(supis)) { + ogs_error("OpenAPI_abnormal_behaviour_parseFromJSON() failed [supis]"); + goto end; + } + + supisList = OpenAPI_list_create(); + + cJSON_ArrayForEach(supis_local, supis) { + double *localDouble = NULL; + int *localInt = NULL; + if (!cJSON_IsString(supis_local)) { + ogs_error("OpenAPI_abnormal_behaviour_parseFromJSON() failed [supis]"); + goto end; + } + OpenAPI_list_add(supisList, ogs_strdup(supis_local->valuestring)); + } + } + + excep = cJSON_GetObjectItemCaseSensitive(abnormal_behaviourJSON, "excep"); + if (!excep) { + ogs_error("OpenAPI_abnormal_behaviour_parseFromJSON() failed [excep]"); + goto end; + } + excep_local_nonprim = OpenAPI_exception_parseFromJSON(excep); + + dnn = cJSON_GetObjectItemCaseSensitive(abnormal_behaviourJSON, "dnn"); + if (dnn) { + if (!cJSON_IsString(dnn) && !cJSON_IsNull(dnn)) { + ogs_error("OpenAPI_abnormal_behaviour_parseFromJSON() failed [dnn]"); + goto end; + } + } + + snssai = cJSON_GetObjectItemCaseSensitive(abnormal_behaviourJSON, "snssai"); + if (snssai) { + snssai_local_nonprim = OpenAPI_snssai_parseFromJSON(snssai); + } + + ratio = cJSON_GetObjectItemCaseSensitive(abnormal_behaviourJSON, "ratio"); + if (ratio) { + if (!cJSON_IsNumber(ratio)) { + ogs_error("OpenAPI_abnormal_behaviour_parseFromJSON() failed [ratio]"); + goto end; + } + } + + confidence = cJSON_GetObjectItemCaseSensitive(abnormal_behaviourJSON, "confidence"); + if (confidence) { + if (!cJSON_IsNumber(confidence)) { + ogs_error("OpenAPI_abnormal_behaviour_parseFromJSON() failed [confidence]"); + goto end; + } + } + + addt_meas_info = cJSON_GetObjectItemCaseSensitive(abnormal_behaviourJSON, "addtMeasInfo"); + if (addt_meas_info) { + addt_meas_info_local_nonprim = OpenAPI_additional_measurement_parseFromJSON(addt_meas_info); + } + + abnormal_behaviour_local_var = OpenAPI_abnormal_behaviour_create ( + supis ? supisList : NULL, + excep_local_nonprim, + dnn && !cJSON_IsNull(dnn) ? ogs_strdup(dnn->valuestring) : NULL, + snssai ? snssai_local_nonprim : NULL, + ratio ? true : false, + ratio ? ratio->valuedouble : 0, + confidence ? true : false, + confidence ? confidence->valuedouble : 0, + addt_meas_info ? addt_meas_info_local_nonprim : NULL + ); + + return abnormal_behaviour_local_var; +end: + if (supisList) { + OpenAPI_list_for_each(supisList, node) { + ogs_free(node->data); + } + OpenAPI_list_free(supisList); + supisList = NULL; + } + if (excep_local_nonprim) { + OpenAPI_exception_free(excep_local_nonprim); + excep_local_nonprim = NULL; + } + if (snssai_local_nonprim) { + OpenAPI_snssai_free(snssai_local_nonprim); + snssai_local_nonprim = NULL; + } + if (addt_meas_info_local_nonprim) { + OpenAPI_additional_measurement_free(addt_meas_info_local_nonprim); + addt_meas_info_local_nonprim = NULL; + } + return NULL; +} + +OpenAPI_abnormal_behaviour_t *OpenAPI_abnormal_behaviour_copy(OpenAPI_abnormal_behaviour_t *dst, OpenAPI_abnormal_behaviour_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_abnormal_behaviour_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_abnormal_behaviour_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_abnormal_behaviour_free(dst); + dst = OpenAPI_abnormal_behaviour_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/abnormal_behaviour.h b/lib/sbi/openapi/model/abnormal_behaviour.h new file mode 100644 index 000000000..fbb5c0355 --- /dev/null +++ b/lib/sbi/openapi/model/abnormal_behaviour.h @@ -0,0 +1,57 @@ +/* + * abnormal_behaviour.h + * + * Represents the abnormal behaviour information. + */ + +#ifndef _OpenAPI_abnormal_behaviour_H_ +#define _OpenAPI_abnormal_behaviour_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "additional_measurement.h" +#include "exception.h" +#include "snssai.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_abnormal_behaviour_s OpenAPI_abnormal_behaviour_t; +typedef struct OpenAPI_abnormal_behaviour_s { + OpenAPI_list_t *supis; + struct OpenAPI_exception_s *excep; + char *dnn; + struct OpenAPI_snssai_s *snssai; + bool is_ratio; + int ratio; + bool is_confidence; + int confidence; + struct OpenAPI_additional_measurement_s *addt_meas_info; +} OpenAPI_abnormal_behaviour_t; + +OpenAPI_abnormal_behaviour_t *OpenAPI_abnormal_behaviour_create( + OpenAPI_list_t *supis, + OpenAPI_exception_t *excep, + char *dnn, + OpenAPI_snssai_t *snssai, + bool is_ratio, + int ratio, + bool is_confidence, + int confidence, + OpenAPI_additional_measurement_t *addt_meas_info +); +void OpenAPI_abnormal_behaviour_free(OpenAPI_abnormal_behaviour_t *abnormal_behaviour); +OpenAPI_abnormal_behaviour_t *OpenAPI_abnormal_behaviour_parseFromJSON(cJSON *abnormal_behaviourJSON); +cJSON *OpenAPI_abnormal_behaviour_convertToJSON(OpenAPI_abnormal_behaviour_t *abnormal_behaviour); +OpenAPI_abnormal_behaviour_t *OpenAPI_abnormal_behaviour_copy(OpenAPI_abnormal_behaviour_t *dst, OpenAPI_abnormal_behaviour_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_abnormal_behaviour_H_ */ + diff --git a/lib/sbi/openapi/model/acc_net_ch_id.c b/lib/sbi/openapi/model/acc_net_ch_id.c index 72604f732..b844ef9a3 100644 --- a/lib/sbi/openapi/model/acc_net_ch_id.c +++ b/lib/sbi/openapi/model/acc_net_ch_id.c @@ -5,7 +5,9 @@ #include "acc_net_ch_id.h" OpenAPI_acc_net_ch_id_t *OpenAPI_acc_net_ch_id_create( + bool is_acc_net_cha_id_value, int acc_net_cha_id_value, + char *acc_net_charg_id, OpenAPI_list_t *ref_pcc_rule_ids, bool is_session_ch_scope, int session_ch_scope @@ -14,7 +16,9 @@ OpenAPI_acc_net_ch_id_t *OpenAPI_acc_net_ch_id_create( OpenAPI_acc_net_ch_id_t *acc_net_ch_id_local_var = ogs_malloc(sizeof(OpenAPI_acc_net_ch_id_t)); ogs_assert(acc_net_ch_id_local_var); + acc_net_ch_id_local_var->is_acc_net_cha_id_value = is_acc_net_cha_id_value; acc_net_ch_id_local_var->acc_net_cha_id_value = acc_net_cha_id_value; + acc_net_ch_id_local_var->acc_net_charg_id = acc_net_charg_id; acc_net_ch_id_local_var->ref_pcc_rule_ids = ref_pcc_rule_ids; acc_net_ch_id_local_var->is_session_ch_scope = is_session_ch_scope; acc_net_ch_id_local_var->session_ch_scope = session_ch_scope; @@ -29,6 +33,10 @@ void OpenAPI_acc_net_ch_id_free(OpenAPI_acc_net_ch_id_t *acc_net_ch_id) if (NULL == acc_net_ch_id) { return; } + if (acc_net_ch_id->acc_net_charg_id) { + ogs_free(acc_net_ch_id->acc_net_charg_id); + acc_net_ch_id->acc_net_charg_id = NULL; + } if (acc_net_ch_id->ref_pcc_rule_ids) { OpenAPI_list_for_each(acc_net_ch_id->ref_pcc_rule_ids, node) { ogs_free(node->data); @@ -50,10 +58,19 @@ cJSON *OpenAPI_acc_net_ch_id_convertToJSON(OpenAPI_acc_net_ch_id_t *acc_net_ch_i } item = cJSON_CreateObject(); + if (acc_net_ch_id->is_acc_net_cha_id_value) { if (cJSON_AddNumberToObject(item, "accNetChaIdValue", acc_net_ch_id->acc_net_cha_id_value) == NULL) { ogs_error("OpenAPI_acc_net_ch_id_convertToJSON() failed [acc_net_cha_id_value]"); goto end; } + } + + if (acc_net_ch_id->acc_net_charg_id) { + if (cJSON_AddStringToObject(item, "accNetChargId", acc_net_ch_id->acc_net_charg_id) == NULL) { + ogs_error("OpenAPI_acc_net_ch_id_convertToJSON() failed [acc_net_charg_id]"); + goto end; + } + } if (acc_net_ch_id->ref_pcc_rule_ids) { cJSON *ref_pcc_rule_idsList = cJSON_AddArrayToObject(item, "refPccRuleIds"); @@ -85,18 +102,25 @@ OpenAPI_acc_net_ch_id_t *OpenAPI_acc_net_ch_id_parseFromJSON(cJSON *acc_net_ch_i OpenAPI_acc_net_ch_id_t *acc_net_ch_id_local_var = NULL; OpenAPI_lnode_t *node = NULL; cJSON *acc_net_cha_id_value = NULL; + cJSON *acc_net_charg_id = NULL; cJSON *ref_pcc_rule_ids = NULL; OpenAPI_list_t *ref_pcc_rule_idsList = NULL; cJSON *session_ch_scope = NULL; acc_net_cha_id_value = cJSON_GetObjectItemCaseSensitive(acc_net_ch_idJSON, "accNetChaIdValue"); - if (!acc_net_cha_id_value) { - ogs_error("OpenAPI_acc_net_ch_id_parseFromJSON() failed [acc_net_cha_id_value]"); - goto end; - } + if (acc_net_cha_id_value) { if (!cJSON_IsNumber(acc_net_cha_id_value)) { ogs_error("OpenAPI_acc_net_ch_id_parseFromJSON() failed [acc_net_cha_id_value]"); goto end; } + } + + acc_net_charg_id = cJSON_GetObjectItemCaseSensitive(acc_net_ch_idJSON, "accNetChargId"); + if (acc_net_charg_id) { + if (!cJSON_IsString(acc_net_charg_id) && !cJSON_IsNull(acc_net_charg_id)) { + ogs_error("OpenAPI_acc_net_ch_id_parseFromJSON() failed [acc_net_charg_id]"); + goto end; + } + } ref_pcc_rule_ids = cJSON_GetObjectItemCaseSensitive(acc_net_ch_idJSON, "refPccRuleIds"); if (ref_pcc_rule_ids) { @@ -128,8 +152,9 @@ OpenAPI_acc_net_ch_id_t *OpenAPI_acc_net_ch_id_parseFromJSON(cJSON *acc_net_ch_i } acc_net_ch_id_local_var = OpenAPI_acc_net_ch_id_create ( - - acc_net_cha_id_value->valuedouble, + acc_net_cha_id_value ? true : false, + acc_net_cha_id_value ? acc_net_cha_id_value->valuedouble : 0, + acc_net_charg_id && !cJSON_IsNull(acc_net_charg_id) ? ogs_strdup(acc_net_charg_id->valuestring) : NULL, ref_pcc_rule_ids ? ref_pcc_rule_idsList : NULL, session_ch_scope ? true : false, session_ch_scope ? session_ch_scope->valueint : 0 diff --git a/lib/sbi/openapi/model/acc_net_ch_id.h b/lib/sbi/openapi/model/acc_net_ch_id.h index 56e2100f6..e6c547bb2 100644 --- a/lib/sbi/openapi/model/acc_net_ch_id.h +++ b/lib/sbi/openapi/model/acc_net_ch_id.h @@ -1,7 +1,7 @@ /* * acc_net_ch_id.h * - * + * Contains the access network charging identifier for the PCC rule(s) or for the whole PDU session. */ #ifndef _OpenAPI_acc_net_ch_id_H_ @@ -19,14 +19,18 @@ extern "C" { typedef struct OpenAPI_acc_net_ch_id_s OpenAPI_acc_net_ch_id_t; typedef struct OpenAPI_acc_net_ch_id_s { + bool is_acc_net_cha_id_value; int acc_net_cha_id_value; + char *acc_net_charg_id; OpenAPI_list_t *ref_pcc_rule_ids; bool is_session_ch_scope; int session_ch_scope; } OpenAPI_acc_net_ch_id_t; OpenAPI_acc_net_ch_id_t *OpenAPI_acc_net_ch_id_create( + bool is_acc_net_cha_id_value, int acc_net_cha_id_value, + char *acc_net_charg_id, OpenAPI_list_t *ref_pcc_rule_ids, bool is_session_ch_scope, int session_ch_scope diff --git a/lib/sbi/openapi/model/access_and_mobility_data.c b/lib/sbi/openapi/model/access_and_mobility_data.c index c86699976..abc090e7f 100644 --- a/lib/sbi/openapi/model/access_and_mobility_data.c +++ b/lib/sbi/openapi/model/access_and_mobility_data.c @@ -25,7 +25,8 @@ OpenAPI_access_and_mobility_data_t *OpenAPI_access_and_mobility_data_create( char *current_plmn_ts, OpenAPI_list_t *rat_type, char *rat_types_ts, - char *supp_feat + char *supp_feat, + OpenAPI_list_t *reset_ids ) { OpenAPI_access_and_mobility_data_t *access_and_mobility_data_local_var = ogs_malloc(sizeof(OpenAPI_access_and_mobility_data_t)); @@ -52,6 +53,7 @@ OpenAPI_access_and_mobility_data_t *OpenAPI_access_and_mobility_data_create( access_and_mobility_data_local_var->rat_type = rat_type; access_and_mobility_data_local_var->rat_types_ts = rat_types_ts; access_and_mobility_data_local_var->supp_feat = supp_feat; + access_and_mobility_data_local_var->reset_ids = reset_ids; return access_and_mobility_data_local_var; } @@ -137,6 +139,13 @@ void OpenAPI_access_and_mobility_data_free(OpenAPI_access_and_mobility_data_t *a ogs_free(access_and_mobility_data->supp_feat); access_and_mobility_data->supp_feat = NULL; } + if (access_and_mobility_data->reset_ids) { + OpenAPI_list_for_each(access_and_mobility_data->reset_ids, node) { + ogs_free(node->data); + } + OpenAPI_list_free(access_and_mobility_data->reset_ids); + access_and_mobility_data->reset_ids = NULL; + } ogs_free(access_and_mobility_data); } @@ -334,6 +343,20 @@ cJSON *OpenAPI_access_and_mobility_data_convertToJSON(OpenAPI_access_and_mobilit } } + if (access_and_mobility_data->reset_ids) { + cJSON *reset_idsList = cJSON_AddArrayToObject(item, "resetIds"); + if (reset_idsList == NULL) { + ogs_error("OpenAPI_access_and_mobility_data_convertToJSON() failed [reset_ids]"); + goto end; + } + OpenAPI_list_for_each(access_and_mobility_data->reset_ids, node) { + if (cJSON_AddStringToObject(reset_idsList, "", (char*)node->data) == NULL) { + ogs_error("OpenAPI_access_and_mobility_data_convertToJSON() failed [reset_ids]"); + goto end; + } + } + } + end: return item; } @@ -370,6 +393,8 @@ OpenAPI_access_and_mobility_data_t *OpenAPI_access_and_mobility_data_parseFromJS OpenAPI_list_t *rat_typeList = NULL; cJSON *rat_types_ts = NULL; cJSON *supp_feat = NULL; + cJSON *reset_ids = NULL; + OpenAPI_list_t *reset_idsList = NULL; location = cJSON_GetObjectItemCaseSensitive(access_and_mobility_dataJSON, "location"); if (location) { location_local_nonprim = OpenAPI_user_location_parseFromJSON(location); @@ -568,6 +593,27 @@ OpenAPI_access_and_mobility_data_t *OpenAPI_access_and_mobility_data_parseFromJS } } + reset_ids = cJSON_GetObjectItemCaseSensitive(access_and_mobility_dataJSON, "resetIds"); + if (reset_ids) { + cJSON *reset_ids_local = NULL; + if (!cJSON_IsArray(reset_ids)) { + ogs_error("OpenAPI_access_and_mobility_data_parseFromJSON() failed [reset_ids]"); + goto end; + } + + reset_idsList = OpenAPI_list_create(); + + cJSON_ArrayForEach(reset_ids_local, reset_ids) { + double *localDouble = NULL; + int *localInt = NULL; + if (!cJSON_IsString(reset_ids_local)) { + ogs_error("OpenAPI_access_and_mobility_data_parseFromJSON() failed [reset_ids]"); + goto end; + } + OpenAPI_list_add(reset_idsList, ogs_strdup(reset_ids_local->valuestring)); + } + } + access_and_mobility_data_local_var = OpenAPI_access_and_mobility_data_create ( location ? location_local_nonprim : NULL, location_ts && !cJSON_IsNull(location_ts) ? ogs_strdup(location_ts->valuestring) : NULL, @@ -589,7 +635,8 @@ OpenAPI_access_and_mobility_data_t *OpenAPI_access_and_mobility_data_parseFromJS current_plmn_ts && !cJSON_IsNull(current_plmn_ts) ? ogs_strdup(current_plmn_ts->valuestring) : NULL, rat_type ? rat_typeList : NULL, rat_types_ts && !cJSON_IsNull(rat_types_ts) ? ogs_strdup(rat_types_ts->valuestring) : NULL, - supp_feat && !cJSON_IsNull(supp_feat) ? ogs_strdup(supp_feat->valuestring) : NULL + supp_feat && !cJSON_IsNull(supp_feat) ? ogs_strdup(supp_feat->valuestring) : NULL, + reset_ids ? reset_idsList : NULL ); return access_and_mobility_data_local_var; @@ -624,6 +671,13 @@ end: OpenAPI_list_free(rat_typeList); rat_typeList = NULL; } + if (reset_idsList) { + OpenAPI_list_for_each(reset_idsList, node) { + ogs_free(node->data); + } + OpenAPI_list_free(reset_idsList); + reset_idsList = NULL; + } return NULL; } diff --git a/lib/sbi/openapi/model/access_and_mobility_data.h b/lib/sbi/openapi/model/access_and_mobility_data.h index a0ffb3e3a..797cd592b 100644 --- a/lib/sbi/openapi/model/access_and_mobility_data.h +++ b/lib/sbi/openapi/model/access_and_mobility_data.h @@ -1,7 +1,7 @@ /* * access_and_mobility_data.h * - * + * Represents Access and Mobility data for a UE. */ #ifndef _OpenAPI_access_and_mobility_data_H_ @@ -48,6 +48,7 @@ typedef struct OpenAPI_access_and_mobility_data_s { OpenAPI_list_t *rat_type; char *rat_types_ts; char *supp_feat; + OpenAPI_list_t *reset_ids; } OpenAPI_access_and_mobility_data_t; OpenAPI_access_and_mobility_data_t *OpenAPI_access_and_mobility_data_create( @@ -71,7 +72,8 @@ OpenAPI_access_and_mobility_data_t *OpenAPI_access_and_mobility_data_create( char *current_plmn_ts, OpenAPI_list_t *rat_type, char *rat_types_ts, - char *supp_feat + char *supp_feat, + OpenAPI_list_t *reset_ids ); void OpenAPI_access_and_mobility_data_free(OpenAPI_access_and_mobility_data_t *access_and_mobility_data); OpenAPI_access_and_mobility_data_t *OpenAPI_access_and_mobility_data_parseFromJSON(cJSON *access_and_mobility_dataJSON); diff --git a/lib/sbi/openapi/model/access_and_mobility_subscription_data.c b/lib/sbi/openapi/model/access_and_mobility_subscription_data.c index c4bcf206c..fcf557887 100644 --- a/lib/sbi/openapi/model/access_and_mobility_subscription_data.c +++ b/lib/sbi/openapi/model/access_and_mobility_subscription_data.c @@ -7,11 +7,12 @@ OpenAPI_access_and_mobility_subscription_data_t *OpenAPI_access_and_mobility_subscription_data_create( char *supported_features, OpenAPI_list_t *gpsis, + char *hss_group_id, OpenAPI_list_t *internal_group_ids, OpenAPI_list_t* shared_vn_group_data_ids, OpenAPI_ambr_rm_t *subscribed_ue_ambr, OpenAPI_nssai_t *nssai, - OpenAPI_list_t *rat_restrictions, + OpenAPI_set_t *rat_restrictions, OpenAPI_list_t *forbidden_areas, OpenAPI_service_area_restriction_t *service_area_restriction, OpenAPI_list_t *core_network_type_restrictions, @@ -34,6 +35,7 @@ OpenAPI_access_and_mobility_subscription_data_t *OpenAPI_access_and_mobility_sub int soraf_retrieval, OpenAPI_list_t *sor_update_indicator_list, OpenAPI_upu_info_t *upu_info, + char *routing_indicator, bool is_mico_allowed, int mico_allowed, OpenAPI_list_t *shared_am_data_ids, @@ -56,14 +58,20 @@ OpenAPI_access_and_mobility_subscription_data_t *OpenAPI_access_and_mobility_sub bool is_ec_restriction_data_nb, int ec_restriction_data_nb, OpenAPI_expected_ue_behaviour_data_t *expected_ue_behaviour_list, - OpenAPI_list_t *primary_rat_restrictions, - OpenAPI_list_t *secondary_rat_restrictions, + OpenAPI_set_t *primary_rat_restrictions, + OpenAPI_set_t *secondary_rat_restrictions, OpenAPI_list_t *edrx_parameters_list, OpenAPI_list_t *ptw_parameters_list, bool is_iab_operation_allowed, int iab_operation_allowed, + OpenAPI_list_t* adjacent_plmn_restrictions, OpenAPI_list_t *wireline_forbidden_areas, - OpenAPI_wireline_service_area_restriction_t *wireline_service_area_restriction + OpenAPI_wireline_service_area_restriction_t *wireline_service_area_restriction, + OpenAPI_list_t *pcf_selection_assistance_infos, + OpenAPI_aerial_ue_subscription_info_t *aerial_ue_sub_info, + OpenAPI_roaming_restrictions_t *roaming_restrictions, + bool is_remote_prov_ind, + int remote_prov_ind ) { OpenAPI_access_and_mobility_subscription_data_t *access_and_mobility_subscription_data_local_var = ogs_malloc(sizeof(OpenAPI_access_and_mobility_subscription_data_t)); @@ -71,6 +79,7 @@ OpenAPI_access_and_mobility_subscription_data_t *OpenAPI_access_and_mobility_sub access_and_mobility_subscription_data_local_var->supported_features = supported_features; access_and_mobility_subscription_data_local_var->gpsis = gpsis; + access_and_mobility_subscription_data_local_var->hss_group_id = hss_group_id; access_and_mobility_subscription_data_local_var->internal_group_ids = internal_group_ids; access_and_mobility_subscription_data_local_var->shared_vn_group_data_ids = shared_vn_group_data_ids; access_and_mobility_subscription_data_local_var->subscribed_ue_ambr = subscribed_ue_ambr; @@ -98,6 +107,7 @@ OpenAPI_access_and_mobility_subscription_data_t *OpenAPI_access_and_mobility_sub access_and_mobility_subscription_data_local_var->soraf_retrieval = soraf_retrieval; access_and_mobility_subscription_data_local_var->sor_update_indicator_list = sor_update_indicator_list; access_and_mobility_subscription_data_local_var->upu_info = upu_info; + access_and_mobility_subscription_data_local_var->routing_indicator = routing_indicator; access_and_mobility_subscription_data_local_var->is_mico_allowed = is_mico_allowed; access_and_mobility_subscription_data_local_var->mico_allowed = mico_allowed; access_and_mobility_subscription_data_local_var->shared_am_data_ids = shared_am_data_ids; @@ -126,8 +136,14 @@ OpenAPI_access_and_mobility_subscription_data_t *OpenAPI_access_and_mobility_sub access_and_mobility_subscription_data_local_var->ptw_parameters_list = ptw_parameters_list; access_and_mobility_subscription_data_local_var->is_iab_operation_allowed = is_iab_operation_allowed; access_and_mobility_subscription_data_local_var->iab_operation_allowed = iab_operation_allowed; + access_and_mobility_subscription_data_local_var->adjacent_plmn_restrictions = adjacent_plmn_restrictions; access_and_mobility_subscription_data_local_var->wireline_forbidden_areas = wireline_forbidden_areas; access_and_mobility_subscription_data_local_var->wireline_service_area_restriction = wireline_service_area_restriction; + access_and_mobility_subscription_data_local_var->pcf_selection_assistance_infos = pcf_selection_assistance_infos; + access_and_mobility_subscription_data_local_var->aerial_ue_sub_info = aerial_ue_sub_info; + access_and_mobility_subscription_data_local_var->roaming_restrictions = roaming_restrictions; + access_and_mobility_subscription_data_local_var->is_remote_prov_ind = is_remote_prov_ind; + access_and_mobility_subscription_data_local_var->remote_prov_ind = remote_prov_ind; return access_and_mobility_subscription_data_local_var; } @@ -150,6 +166,10 @@ void OpenAPI_access_and_mobility_subscription_data_free(OpenAPI_access_and_mobil OpenAPI_list_free(access_and_mobility_subscription_data->gpsis); access_and_mobility_subscription_data->gpsis = NULL; } + if (access_and_mobility_subscription_data->hss_group_id) { + ogs_free(access_and_mobility_subscription_data->hss_group_id); + access_and_mobility_subscription_data->hss_group_id = NULL; + } if (access_and_mobility_subscription_data->internal_group_ids) { OpenAPI_list_for_each(access_and_mobility_subscription_data->internal_group_ids, node) { ogs_free(node->data); @@ -206,6 +226,10 @@ void OpenAPI_access_and_mobility_subscription_data_free(OpenAPI_access_and_mobil OpenAPI_upu_info_free(access_and_mobility_subscription_data->upu_info); access_and_mobility_subscription_data->upu_info = NULL; } + if (access_and_mobility_subscription_data->routing_indicator) { + ogs_free(access_and_mobility_subscription_data->routing_indicator); + access_and_mobility_subscription_data->routing_indicator = NULL; + } if (access_and_mobility_subscription_data->shared_am_data_ids) { OpenAPI_list_for_each(access_and_mobility_subscription_data->shared_am_data_ids, node) { ogs_free(node->data); @@ -274,6 +298,16 @@ void OpenAPI_access_and_mobility_subscription_data_free(OpenAPI_access_and_mobil OpenAPI_list_free(access_and_mobility_subscription_data->ptw_parameters_list); access_and_mobility_subscription_data->ptw_parameters_list = NULL; } + if (access_and_mobility_subscription_data->adjacent_plmn_restrictions) { + OpenAPI_list_for_each(access_and_mobility_subscription_data->adjacent_plmn_restrictions, node) { + OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*)node->data; + ogs_free(localKeyValue->key); + OpenAPI_plmn_restriction_free(localKeyValue->value); + OpenAPI_map_free(localKeyValue); + } + OpenAPI_list_free(access_and_mobility_subscription_data->adjacent_plmn_restrictions); + access_and_mobility_subscription_data->adjacent_plmn_restrictions = NULL; + } if (access_and_mobility_subscription_data->wireline_forbidden_areas) { OpenAPI_list_for_each(access_and_mobility_subscription_data->wireline_forbidden_areas, node) { OpenAPI_wireline_area_free(node->data); @@ -285,6 +319,21 @@ void OpenAPI_access_and_mobility_subscription_data_free(OpenAPI_access_and_mobil OpenAPI_wireline_service_area_restriction_free(access_and_mobility_subscription_data->wireline_service_area_restriction); access_and_mobility_subscription_data->wireline_service_area_restriction = NULL; } + if (access_and_mobility_subscription_data->pcf_selection_assistance_infos) { + OpenAPI_list_for_each(access_and_mobility_subscription_data->pcf_selection_assistance_infos, node) { + OpenAPI_pcf_selection_assistance_info_free(node->data); + } + OpenAPI_list_free(access_and_mobility_subscription_data->pcf_selection_assistance_infos); + access_and_mobility_subscription_data->pcf_selection_assistance_infos = NULL; + } + if (access_and_mobility_subscription_data->aerial_ue_sub_info) { + OpenAPI_aerial_ue_subscription_info_free(access_and_mobility_subscription_data->aerial_ue_sub_info); + access_and_mobility_subscription_data->aerial_ue_sub_info = NULL; + } + if (access_and_mobility_subscription_data->roaming_restrictions) { + OpenAPI_roaming_restrictions_free(access_and_mobility_subscription_data->roaming_restrictions); + access_and_mobility_subscription_data->roaming_restrictions = NULL; + } ogs_free(access_and_mobility_subscription_data); } @@ -320,6 +369,13 @@ cJSON *OpenAPI_access_and_mobility_subscription_data_convertToJSON(OpenAPI_acces } } + if (access_and_mobility_subscription_data->hss_group_id) { + if (cJSON_AddStringToObject(item, "hssGroupId", access_and_mobility_subscription_data->hss_group_id) == NULL) { + ogs_error("OpenAPI_access_and_mobility_subscription_data_convertToJSON() failed [hss_group_id]"); + goto end; + } + } + if (access_and_mobility_subscription_data->internal_group_ids) { cJSON *internal_group_idsList = cJSON_AddArrayToObject(item, "internalGroupIds"); if (internal_group_idsList == NULL) { @@ -531,6 +587,13 @@ cJSON *OpenAPI_access_and_mobility_subscription_data_convertToJSON(OpenAPI_acces } } + if (access_and_mobility_subscription_data->routing_indicator) { + if (cJSON_AddStringToObject(item, "routingIndicator", access_and_mobility_subscription_data->routing_indicator) == NULL) { + ogs_error("OpenAPI_access_and_mobility_subscription_data_convertToJSON() failed [routing_indicator]"); + goto end; + } + } + if (access_and_mobility_subscription_data->is_mico_allowed) { if (cJSON_AddBoolToObject(item, "micoAllowed", access_and_mobility_subscription_data->mico_allowed) == NULL) { ogs_error("OpenAPI_access_and_mobility_subscription_data_convertToJSON() failed [mico_allowed]"); @@ -761,6 +824,28 @@ cJSON *OpenAPI_access_and_mobility_subscription_data_convertToJSON(OpenAPI_acces } } + if (access_and_mobility_subscription_data->adjacent_plmn_restrictions) { + cJSON *adjacent_plmn_restrictions = cJSON_AddObjectToObject(item, "adjacentPlmnRestrictions"); + if (adjacent_plmn_restrictions == NULL) { + ogs_error("OpenAPI_access_and_mobility_subscription_data_convertToJSON() failed [adjacent_plmn_restrictions]"); + goto end; + } + cJSON *localMapObject = adjacent_plmn_restrictions; + if (access_and_mobility_subscription_data->adjacent_plmn_restrictions) { + OpenAPI_list_for_each(access_and_mobility_subscription_data->adjacent_plmn_restrictions, node) { + OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*)node->data; + cJSON *itemLocal = localKeyValue->value ? + OpenAPI_plmn_restriction_convertToJSON(localKeyValue->value) : + cJSON_CreateNull(); + if (itemLocal == NULL) { + ogs_error("OpenAPI_access_and_mobility_subscription_data_convertToJSON() failed [inner]"); + goto end; + } + cJSON_AddItemToObject(localMapObject, localKeyValue->key, itemLocal); + } + } + } + if (access_and_mobility_subscription_data->wireline_forbidden_areas) { cJSON *wireline_forbidden_areasList = cJSON_AddArrayToObject(item, "wirelineForbiddenAreas"); if (wireline_forbidden_areasList == NULL) { @@ -790,6 +875,55 @@ cJSON *OpenAPI_access_and_mobility_subscription_data_convertToJSON(OpenAPI_acces } } + if (access_and_mobility_subscription_data->pcf_selection_assistance_infos) { + cJSON *pcf_selection_assistance_infosList = cJSON_AddArrayToObject(item, "pcfSelectionAssistanceInfos"); + if (pcf_selection_assistance_infosList == NULL) { + ogs_error("OpenAPI_access_and_mobility_subscription_data_convertToJSON() failed [pcf_selection_assistance_infos]"); + goto end; + } + OpenAPI_list_for_each(access_and_mobility_subscription_data->pcf_selection_assistance_infos, node) { + cJSON *itemLocal = OpenAPI_pcf_selection_assistance_info_convertToJSON(node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_access_and_mobility_subscription_data_convertToJSON() failed [pcf_selection_assistance_infos]"); + goto end; + } + cJSON_AddItemToArray(pcf_selection_assistance_infosList, itemLocal); + } + } + + if (access_and_mobility_subscription_data->aerial_ue_sub_info) { + cJSON *aerial_ue_sub_info_local_JSON = OpenAPI_aerial_ue_subscription_info_convertToJSON(access_and_mobility_subscription_data->aerial_ue_sub_info); + if (aerial_ue_sub_info_local_JSON == NULL) { + ogs_error("OpenAPI_access_and_mobility_subscription_data_convertToJSON() failed [aerial_ue_sub_info]"); + goto end; + } + cJSON_AddItemToObject(item, "aerialUeSubInfo", aerial_ue_sub_info_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_access_and_mobility_subscription_data_convertToJSON() failed [aerial_ue_sub_info]"); + goto end; + } + } + + if (access_and_mobility_subscription_data->roaming_restrictions) { + cJSON *roaming_restrictions_local_JSON = OpenAPI_roaming_restrictions_convertToJSON(access_and_mobility_subscription_data->roaming_restrictions); + if (roaming_restrictions_local_JSON == NULL) { + ogs_error("OpenAPI_access_and_mobility_subscription_data_convertToJSON() failed [roaming_restrictions]"); + goto end; + } + cJSON_AddItemToObject(item, "roamingRestrictions", roaming_restrictions_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_access_and_mobility_subscription_data_convertToJSON() failed [roaming_restrictions]"); + goto end; + } + } + + if (access_and_mobility_subscription_data->is_remote_prov_ind) { + if (cJSON_AddBoolToObject(item, "remoteProvInd", access_and_mobility_subscription_data->remote_prov_ind) == NULL) { + ogs_error("OpenAPI_access_and_mobility_subscription_data_convertToJSON() failed [remote_prov_ind]"); + goto end; + } + } + end: return item; } @@ -801,6 +935,7 @@ OpenAPI_access_and_mobility_subscription_data_t *OpenAPI_access_and_mobility_sub cJSON *supported_features = NULL; cJSON *gpsis = NULL; OpenAPI_list_t *gpsisList = NULL; + cJSON *hss_group_id = NULL; cJSON *internal_group_ids = NULL; OpenAPI_list_t *internal_group_idsList = NULL; cJSON *shared_vn_group_data_ids = NULL; @@ -831,6 +966,7 @@ OpenAPI_access_and_mobility_subscription_data_t *OpenAPI_access_and_mobility_sub OpenAPI_list_t *sor_update_indicator_listList = NULL; cJSON *upu_info = NULL; OpenAPI_upu_info_t *upu_info_local_nonprim = NULL; + cJSON *routing_indicator = NULL; cJSON *mico_allowed = NULL; cJSON *shared_am_data_ids = NULL; OpenAPI_list_t *shared_am_data_idsList = NULL; @@ -866,10 +1002,19 @@ OpenAPI_access_and_mobility_subscription_data_t *OpenAPI_access_and_mobility_sub cJSON *ptw_parameters_list = NULL; OpenAPI_list_t *ptw_parameters_listList = NULL; cJSON *iab_operation_allowed = NULL; + cJSON *adjacent_plmn_restrictions = NULL; + OpenAPI_list_t *adjacent_plmn_restrictionsList = NULL; cJSON *wireline_forbidden_areas = NULL; OpenAPI_list_t *wireline_forbidden_areasList = NULL; cJSON *wireline_service_area_restriction = NULL; OpenAPI_wireline_service_area_restriction_t *wireline_service_area_restriction_local_nonprim = NULL; + cJSON *pcf_selection_assistance_infos = NULL; + OpenAPI_list_t *pcf_selection_assistance_infosList = NULL; + cJSON *aerial_ue_sub_info = NULL; + OpenAPI_aerial_ue_subscription_info_t *aerial_ue_sub_info_local_nonprim = NULL; + cJSON *roaming_restrictions = NULL; + OpenAPI_roaming_restrictions_t *roaming_restrictions_local_nonprim = NULL; + cJSON *remote_prov_ind = NULL; supported_features = cJSON_GetObjectItemCaseSensitive(access_and_mobility_subscription_dataJSON, "supportedFeatures"); if (supported_features) { if (!cJSON_IsString(supported_features) && !cJSON_IsNull(supported_features)) { @@ -899,6 +1044,14 @@ OpenAPI_access_and_mobility_subscription_data_t *OpenAPI_access_and_mobility_sub } } + hss_group_id = cJSON_GetObjectItemCaseSensitive(access_and_mobility_subscription_dataJSON, "hssGroupId"); + if (hss_group_id) { + if (!cJSON_IsString(hss_group_id) && !cJSON_IsNull(hss_group_id)) { + ogs_error("OpenAPI_access_and_mobility_subscription_data_parseFromJSON() failed [hss_group_id]"); + goto end; + } + } + internal_group_ids = cJSON_GetObjectItemCaseSensitive(access_and_mobility_subscription_dataJSON, "internalGroupIds"); if (internal_group_ids) { cJSON *internal_group_ids_local = NULL; @@ -1115,6 +1268,14 @@ OpenAPI_access_and_mobility_subscription_data_t *OpenAPI_access_and_mobility_sub upu_info_local_nonprim = OpenAPI_upu_info_parseFromJSON(upu_info); } + routing_indicator = cJSON_GetObjectItemCaseSensitive(access_and_mobility_subscription_dataJSON, "routingIndicator"); + if (routing_indicator) { + if (!cJSON_IsString(routing_indicator) && !cJSON_IsNull(routing_indicator)) { + ogs_error("OpenAPI_access_and_mobility_subscription_data_parseFromJSON() failed [routing_indicator]"); + goto end; + } + } + mico_allowed = cJSON_GetObjectItemCaseSensitive(access_and_mobility_subscription_dataJSON, "micoAllowed"); if (mico_allowed) { if (!cJSON_IsBool(mico_allowed)) { @@ -1360,6 +1521,32 @@ OpenAPI_access_and_mobility_subscription_data_t *OpenAPI_access_and_mobility_sub } } + adjacent_plmn_restrictions = cJSON_GetObjectItemCaseSensitive(access_and_mobility_subscription_dataJSON, "adjacentPlmnRestrictions"); + if (adjacent_plmn_restrictions) { + cJSON *adjacent_plmn_restrictions_local_map = NULL; + if (!cJSON_IsObject(adjacent_plmn_restrictions) && !cJSON_IsNull(adjacent_plmn_restrictions)) { + ogs_error("OpenAPI_access_and_mobility_subscription_data_parseFromJSON() failed [adjacent_plmn_restrictions]"); + goto end; + } + if (cJSON_IsObject(adjacent_plmn_restrictions)) { + adjacent_plmn_restrictionsList = OpenAPI_list_create(); + OpenAPI_map_t *localMapKeyPair = NULL; + cJSON_ArrayForEach(adjacent_plmn_restrictions_local_map, adjacent_plmn_restrictions) { + cJSON *localMapObject = adjacent_plmn_restrictions_local_map; + if (cJSON_IsObject(localMapObject)) { + localMapKeyPair = OpenAPI_map_create( + ogs_strdup(localMapObject->string), OpenAPI_plmn_restriction_parseFromJSON(localMapObject)); + } else if (cJSON_IsNull(localMapObject)) { + localMapKeyPair = OpenAPI_map_create(ogs_strdup(localMapObject->string), NULL); + } else { + ogs_error("OpenAPI_access_and_mobility_subscription_data_parseFromJSON() failed [inner]"); + goto end; + } + OpenAPI_list_add(adjacent_plmn_restrictionsList, localMapKeyPair); + } + } + } + wireline_forbidden_areas = cJSON_GetObjectItemCaseSensitive(access_and_mobility_subscription_dataJSON, "wirelineForbiddenAreas"); if (wireline_forbidden_areas) { cJSON *wireline_forbidden_areas_local = NULL; @@ -1390,9 +1577,53 @@ OpenAPI_access_and_mobility_subscription_data_t *OpenAPI_access_and_mobility_sub wireline_service_area_restriction_local_nonprim = OpenAPI_wireline_service_area_restriction_parseFromJSON(wireline_service_area_restriction); } + pcf_selection_assistance_infos = cJSON_GetObjectItemCaseSensitive(access_and_mobility_subscription_dataJSON, "pcfSelectionAssistanceInfos"); + if (pcf_selection_assistance_infos) { + cJSON *pcf_selection_assistance_infos_local = NULL; + if (!cJSON_IsArray(pcf_selection_assistance_infos)) { + ogs_error("OpenAPI_access_and_mobility_subscription_data_parseFromJSON() failed [pcf_selection_assistance_infos]"); + goto end; + } + + pcf_selection_assistance_infosList = OpenAPI_list_create(); + + cJSON_ArrayForEach(pcf_selection_assistance_infos_local, pcf_selection_assistance_infos) { + if (!cJSON_IsObject(pcf_selection_assistance_infos_local)) { + ogs_error("OpenAPI_access_and_mobility_subscription_data_parseFromJSON() failed [pcf_selection_assistance_infos]"); + goto end; + } + OpenAPI_pcf_selection_assistance_info_t *pcf_selection_assistance_infosItem = OpenAPI_pcf_selection_assistance_info_parseFromJSON(pcf_selection_assistance_infos_local); + if (!pcf_selection_assistance_infosItem) { + ogs_error("No pcf_selection_assistance_infosItem"); + OpenAPI_list_free(pcf_selection_assistance_infosList); + goto end; + } + OpenAPI_list_add(pcf_selection_assistance_infosList, pcf_selection_assistance_infosItem); + } + } + + aerial_ue_sub_info = cJSON_GetObjectItemCaseSensitive(access_and_mobility_subscription_dataJSON, "aerialUeSubInfo"); + if (aerial_ue_sub_info) { + aerial_ue_sub_info_local_nonprim = OpenAPI_aerial_ue_subscription_info_parseFromJSON(aerial_ue_sub_info); + } + + roaming_restrictions = cJSON_GetObjectItemCaseSensitive(access_and_mobility_subscription_dataJSON, "roamingRestrictions"); + if (roaming_restrictions) { + roaming_restrictions_local_nonprim = OpenAPI_roaming_restrictions_parseFromJSON(roaming_restrictions); + } + + remote_prov_ind = cJSON_GetObjectItemCaseSensitive(access_and_mobility_subscription_dataJSON, "remoteProvInd"); + if (remote_prov_ind) { + if (!cJSON_IsBool(remote_prov_ind)) { + ogs_error("OpenAPI_access_and_mobility_subscription_data_parseFromJSON() failed [remote_prov_ind]"); + goto end; + } + } + access_and_mobility_subscription_data_local_var = OpenAPI_access_and_mobility_subscription_data_create ( supported_features && !cJSON_IsNull(supported_features) ? ogs_strdup(supported_features->valuestring) : NULL, gpsis ? gpsisList : NULL, + hss_group_id && !cJSON_IsNull(hss_group_id) ? ogs_strdup(hss_group_id->valuestring) : NULL, internal_group_ids ? internal_group_idsList : NULL, shared_vn_group_data_ids ? shared_vn_group_data_idsList : NULL, subscribed_ue_ambr ? subscribed_ue_ambr_local_nonprim : NULL, @@ -1420,6 +1651,7 @@ OpenAPI_access_and_mobility_subscription_data_t *OpenAPI_access_and_mobility_sub soraf_retrieval ? soraf_retrieval->valueint : 0, sor_update_indicator_list ? sor_update_indicator_listList : NULL, upu_info ? upu_info_local_nonprim : NULL, + routing_indicator && !cJSON_IsNull(routing_indicator) ? ogs_strdup(routing_indicator->valuestring) : NULL, mico_allowed ? true : false, mico_allowed ? mico_allowed->valueint : 0, shared_am_data_ids ? shared_am_data_idsList : NULL, @@ -1448,8 +1680,14 @@ OpenAPI_access_and_mobility_subscription_data_t *OpenAPI_access_and_mobility_sub ptw_parameters_list ? ptw_parameters_listList : NULL, iab_operation_allowed ? true : false, iab_operation_allowed ? iab_operation_allowed->valueint : 0, + adjacent_plmn_restrictions ? adjacent_plmn_restrictionsList : NULL, wireline_forbidden_areas ? wireline_forbidden_areasList : NULL, - wireline_service_area_restriction ? wireline_service_area_restriction_local_nonprim : NULL + wireline_service_area_restriction ? wireline_service_area_restriction_local_nonprim : NULL, + pcf_selection_assistance_infos ? pcf_selection_assistance_infosList : NULL, + aerial_ue_sub_info ? aerial_ue_sub_info_local_nonprim : NULL, + roaming_restrictions ? roaming_restrictions_local_nonprim : NULL, + remote_prov_ind ? true : false, + remote_prov_ind ? remote_prov_ind->valueint : 0 ); return access_and_mobility_subscription_data_local_var; @@ -1573,6 +1811,16 @@ end: OpenAPI_list_free(ptw_parameters_listList); ptw_parameters_listList = NULL; } + if (adjacent_plmn_restrictionsList) { + OpenAPI_list_for_each(adjacent_plmn_restrictionsList, node) { + OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*) node->data; + ogs_free(localKeyValue->key); + OpenAPI_plmn_restriction_free(localKeyValue->value); + OpenAPI_map_free(localKeyValue); + } + OpenAPI_list_free(adjacent_plmn_restrictionsList); + adjacent_plmn_restrictionsList = NULL; + } if (wireline_forbidden_areasList) { OpenAPI_list_for_each(wireline_forbidden_areasList, node) { OpenAPI_wireline_area_free(node->data); @@ -1584,6 +1832,21 @@ end: OpenAPI_wireline_service_area_restriction_free(wireline_service_area_restriction_local_nonprim); wireline_service_area_restriction_local_nonprim = NULL; } + if (pcf_selection_assistance_infosList) { + OpenAPI_list_for_each(pcf_selection_assistance_infosList, node) { + OpenAPI_pcf_selection_assistance_info_free(node->data); + } + OpenAPI_list_free(pcf_selection_assistance_infosList); + pcf_selection_assistance_infosList = NULL; + } + if (aerial_ue_sub_info_local_nonprim) { + OpenAPI_aerial_ue_subscription_info_free(aerial_ue_sub_info_local_nonprim); + aerial_ue_sub_info_local_nonprim = NULL; + } + if (roaming_restrictions_local_nonprim) { + OpenAPI_roaming_restrictions_free(roaming_restrictions_local_nonprim); + roaming_restrictions_local_nonprim = NULL; + } return NULL; } diff --git a/lib/sbi/openapi/model/access_and_mobility_subscription_data.h b/lib/sbi/openapi/model/access_and_mobility_subscription_data.h index 509e86ce6..a8402de16 100644 --- a/lib/sbi/openapi/model/access_and_mobility_subscription_data.h +++ b/lib/sbi/openapi/model/access_and_mobility_subscription_data.h @@ -12,6 +12,7 @@ #include "../include/list.h" #include "../include/keyValuePair.h" #include "../include/binary.h" +#include "aerial_ue_subscription_info.h" #include "ambr_rm.h" #include "area.h" #include "cag_data.h" @@ -23,9 +24,13 @@ #include "mdt_user_consent.h" #include "nssai.h" #include "odb_packet_services.h" +#include "pcf_selection_assistance_info.h" +#include "plmn_restriction.h" #include "ptw_parameters.h" #include "rat_type.h" +#include "roaming_restrictions.h" #include "service_area_restriction.h" +#include "set.h" #include "sor_info.h" #include "sor_update_indicator.h" #include "trace_data.h" @@ -41,11 +46,12 @@ typedef struct OpenAPI_access_and_mobility_subscription_data_s OpenAPI_access_an typedef struct OpenAPI_access_and_mobility_subscription_data_s { char *supported_features; OpenAPI_list_t *gpsis; + char *hss_group_id; OpenAPI_list_t *internal_group_ids; OpenAPI_list_t* shared_vn_group_data_ids; struct OpenAPI_ambr_rm_s *subscribed_ue_ambr; struct OpenAPI_nssai_s *nssai; - OpenAPI_list_t *rat_restrictions; + OpenAPI_set_t *rat_restrictions; OpenAPI_list_t *forbidden_areas; struct OpenAPI_service_area_restriction_s *service_area_restriction; OpenAPI_list_t *core_network_type_restrictions; @@ -68,6 +74,7 @@ typedef struct OpenAPI_access_and_mobility_subscription_data_s { int soraf_retrieval; OpenAPI_list_t *sor_update_indicator_list; struct OpenAPI_upu_info_s *upu_info; + char *routing_indicator; bool is_mico_allowed; int mico_allowed; OpenAPI_list_t *shared_am_data_ids; @@ -90,24 +97,31 @@ typedef struct OpenAPI_access_and_mobility_subscription_data_s { bool is_ec_restriction_data_nb; int ec_restriction_data_nb; struct OpenAPI_expected_ue_behaviour_data_s *expected_ue_behaviour_list; - OpenAPI_list_t *primary_rat_restrictions; - OpenAPI_list_t *secondary_rat_restrictions; + OpenAPI_set_t *primary_rat_restrictions; + OpenAPI_set_t *secondary_rat_restrictions; OpenAPI_list_t *edrx_parameters_list; OpenAPI_list_t *ptw_parameters_list; bool is_iab_operation_allowed; int iab_operation_allowed; + OpenAPI_list_t* adjacent_plmn_restrictions; OpenAPI_list_t *wireline_forbidden_areas; struct OpenAPI_wireline_service_area_restriction_s *wireline_service_area_restriction; + OpenAPI_list_t *pcf_selection_assistance_infos; + struct OpenAPI_aerial_ue_subscription_info_s *aerial_ue_sub_info; + struct OpenAPI_roaming_restrictions_s *roaming_restrictions; + bool is_remote_prov_ind; + int remote_prov_ind; } OpenAPI_access_and_mobility_subscription_data_t; OpenAPI_access_and_mobility_subscription_data_t *OpenAPI_access_and_mobility_subscription_data_create( char *supported_features, OpenAPI_list_t *gpsis, + char *hss_group_id, OpenAPI_list_t *internal_group_ids, OpenAPI_list_t* shared_vn_group_data_ids, OpenAPI_ambr_rm_t *subscribed_ue_ambr, OpenAPI_nssai_t *nssai, - OpenAPI_list_t *rat_restrictions, + OpenAPI_set_t *rat_restrictions, OpenAPI_list_t *forbidden_areas, OpenAPI_service_area_restriction_t *service_area_restriction, OpenAPI_list_t *core_network_type_restrictions, @@ -130,6 +144,7 @@ OpenAPI_access_and_mobility_subscription_data_t *OpenAPI_access_and_mobility_sub int soraf_retrieval, OpenAPI_list_t *sor_update_indicator_list, OpenAPI_upu_info_t *upu_info, + char *routing_indicator, bool is_mico_allowed, int mico_allowed, OpenAPI_list_t *shared_am_data_ids, @@ -152,14 +167,20 @@ OpenAPI_access_and_mobility_subscription_data_t *OpenAPI_access_and_mobility_sub bool is_ec_restriction_data_nb, int ec_restriction_data_nb, OpenAPI_expected_ue_behaviour_data_t *expected_ue_behaviour_list, - OpenAPI_list_t *primary_rat_restrictions, - OpenAPI_list_t *secondary_rat_restrictions, + OpenAPI_set_t *primary_rat_restrictions, + OpenAPI_set_t *secondary_rat_restrictions, OpenAPI_list_t *edrx_parameters_list, OpenAPI_list_t *ptw_parameters_list, bool is_iab_operation_allowed, int iab_operation_allowed, + OpenAPI_list_t* adjacent_plmn_restrictions, OpenAPI_list_t *wireline_forbidden_areas, - OpenAPI_wireline_service_area_restriction_t *wireline_service_area_restriction + OpenAPI_wireline_service_area_restriction_t *wireline_service_area_restriction, + OpenAPI_list_t *pcf_selection_assistance_infos, + OpenAPI_aerial_ue_subscription_info_t *aerial_ue_sub_info, + OpenAPI_roaming_restrictions_t *roaming_restrictions, + bool is_remote_prov_ind, + int remote_prov_ind ); void OpenAPI_access_and_mobility_subscription_data_free(OpenAPI_access_and_mobility_subscription_data_t *access_and_mobility_subscription_data); OpenAPI_access_and_mobility_subscription_data_t *OpenAPI_access_and_mobility_subscription_data_parseFromJSON(cJSON *access_and_mobility_subscription_dataJSON); diff --git a/lib/sbi/openapi/model/access_and_mobility_subscription_data_1.c b/lib/sbi/openapi/model/access_and_mobility_subscription_data_1.c index 2833e0194..29917acac 100644 --- a/lib/sbi/openapi/model/access_and_mobility_subscription_data_1.c +++ b/lib/sbi/openapi/model/access_and_mobility_subscription_data_1.c @@ -7,11 +7,12 @@ OpenAPI_access_and_mobility_subscription_data_1_t *OpenAPI_access_and_mobility_subscription_data_1_create( char *supported_features, OpenAPI_list_t *gpsis, + char *hss_group_id, OpenAPI_list_t *internal_group_ids, OpenAPI_list_t* shared_vn_group_data_ids, OpenAPI_ambr_rm_t *subscribed_ue_ambr, OpenAPI_nssai_1_t *nssai, - OpenAPI_list_t *rat_restrictions, + OpenAPI_set_t *rat_restrictions, OpenAPI_list_t *forbidden_areas, OpenAPI_service_area_restriction_1_t *service_area_restriction, OpenAPI_list_t *core_network_type_restrictions, @@ -34,6 +35,7 @@ OpenAPI_access_and_mobility_subscription_data_1_t *OpenAPI_access_and_mobility_s int soraf_retrieval, OpenAPI_list_t *sor_update_indicator_list, OpenAPI_upu_info_1_t *upu_info, + char *routing_indicator, bool is_mico_allowed, int mico_allowed, OpenAPI_list_t *shared_am_data_ids, @@ -56,14 +58,20 @@ OpenAPI_access_and_mobility_subscription_data_1_t *OpenAPI_access_and_mobility_s bool is_ec_restriction_data_nb, int ec_restriction_data_nb, OpenAPI_expected_ue_behaviour_data_1_t *expected_ue_behaviour_list, - OpenAPI_list_t *primary_rat_restrictions, - OpenAPI_list_t *secondary_rat_restrictions, + OpenAPI_set_t *primary_rat_restrictions, + OpenAPI_set_t *secondary_rat_restrictions, OpenAPI_list_t *edrx_parameters_list, OpenAPI_list_t *ptw_parameters_list, bool is_iab_operation_allowed, int iab_operation_allowed, + OpenAPI_list_t* adjacent_plmn_restrictions, OpenAPI_list_t *wireline_forbidden_areas, - OpenAPI_wireline_service_area_restriction_1_t *wireline_service_area_restriction + OpenAPI_wireline_service_area_restriction_1_t *wireline_service_area_restriction, + OpenAPI_list_t *pcf_selection_assistance_infos, + OpenAPI_aerial_ue_subscription_info_1_t *aerial_ue_sub_info, + OpenAPI_roaming_restrictions_t *roaming_restrictions, + bool is_remote_prov_ind, + int remote_prov_ind ) { OpenAPI_access_and_mobility_subscription_data_1_t *access_and_mobility_subscription_data_1_local_var = ogs_malloc(sizeof(OpenAPI_access_and_mobility_subscription_data_1_t)); @@ -71,6 +79,7 @@ OpenAPI_access_and_mobility_subscription_data_1_t *OpenAPI_access_and_mobility_s access_and_mobility_subscription_data_1_local_var->supported_features = supported_features; access_and_mobility_subscription_data_1_local_var->gpsis = gpsis; + access_and_mobility_subscription_data_1_local_var->hss_group_id = hss_group_id; access_and_mobility_subscription_data_1_local_var->internal_group_ids = internal_group_ids; access_and_mobility_subscription_data_1_local_var->shared_vn_group_data_ids = shared_vn_group_data_ids; access_and_mobility_subscription_data_1_local_var->subscribed_ue_ambr = subscribed_ue_ambr; @@ -98,6 +107,7 @@ OpenAPI_access_and_mobility_subscription_data_1_t *OpenAPI_access_and_mobility_s access_and_mobility_subscription_data_1_local_var->soraf_retrieval = soraf_retrieval; access_and_mobility_subscription_data_1_local_var->sor_update_indicator_list = sor_update_indicator_list; access_and_mobility_subscription_data_1_local_var->upu_info = upu_info; + access_and_mobility_subscription_data_1_local_var->routing_indicator = routing_indicator; access_and_mobility_subscription_data_1_local_var->is_mico_allowed = is_mico_allowed; access_and_mobility_subscription_data_1_local_var->mico_allowed = mico_allowed; access_and_mobility_subscription_data_1_local_var->shared_am_data_ids = shared_am_data_ids; @@ -126,8 +136,14 @@ OpenAPI_access_and_mobility_subscription_data_1_t *OpenAPI_access_and_mobility_s access_and_mobility_subscription_data_1_local_var->ptw_parameters_list = ptw_parameters_list; access_and_mobility_subscription_data_1_local_var->is_iab_operation_allowed = is_iab_operation_allowed; access_and_mobility_subscription_data_1_local_var->iab_operation_allowed = iab_operation_allowed; + access_and_mobility_subscription_data_1_local_var->adjacent_plmn_restrictions = adjacent_plmn_restrictions; access_and_mobility_subscription_data_1_local_var->wireline_forbidden_areas = wireline_forbidden_areas; access_and_mobility_subscription_data_1_local_var->wireline_service_area_restriction = wireline_service_area_restriction; + access_and_mobility_subscription_data_1_local_var->pcf_selection_assistance_infos = pcf_selection_assistance_infos; + access_and_mobility_subscription_data_1_local_var->aerial_ue_sub_info = aerial_ue_sub_info; + access_and_mobility_subscription_data_1_local_var->roaming_restrictions = roaming_restrictions; + access_and_mobility_subscription_data_1_local_var->is_remote_prov_ind = is_remote_prov_ind; + access_and_mobility_subscription_data_1_local_var->remote_prov_ind = remote_prov_ind; return access_and_mobility_subscription_data_1_local_var; } @@ -150,6 +166,10 @@ void OpenAPI_access_and_mobility_subscription_data_1_free(OpenAPI_access_and_mob OpenAPI_list_free(access_and_mobility_subscription_data_1->gpsis); access_and_mobility_subscription_data_1->gpsis = NULL; } + if (access_and_mobility_subscription_data_1->hss_group_id) { + ogs_free(access_and_mobility_subscription_data_1->hss_group_id); + access_and_mobility_subscription_data_1->hss_group_id = NULL; + } if (access_and_mobility_subscription_data_1->internal_group_ids) { OpenAPI_list_for_each(access_and_mobility_subscription_data_1->internal_group_ids, node) { ogs_free(node->data); @@ -206,6 +226,10 @@ void OpenAPI_access_and_mobility_subscription_data_1_free(OpenAPI_access_and_mob OpenAPI_upu_info_1_free(access_and_mobility_subscription_data_1->upu_info); access_and_mobility_subscription_data_1->upu_info = NULL; } + if (access_and_mobility_subscription_data_1->routing_indicator) { + ogs_free(access_and_mobility_subscription_data_1->routing_indicator); + access_and_mobility_subscription_data_1->routing_indicator = NULL; + } if (access_and_mobility_subscription_data_1->shared_am_data_ids) { OpenAPI_list_for_each(access_and_mobility_subscription_data_1->shared_am_data_ids, node) { ogs_free(node->data); @@ -274,6 +298,16 @@ void OpenAPI_access_and_mobility_subscription_data_1_free(OpenAPI_access_and_mob OpenAPI_list_free(access_and_mobility_subscription_data_1->ptw_parameters_list); access_and_mobility_subscription_data_1->ptw_parameters_list = NULL; } + if (access_and_mobility_subscription_data_1->adjacent_plmn_restrictions) { + OpenAPI_list_for_each(access_and_mobility_subscription_data_1->adjacent_plmn_restrictions, node) { + OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*)node->data; + ogs_free(localKeyValue->key); + OpenAPI_plmn_restriction_1_free(localKeyValue->value); + OpenAPI_map_free(localKeyValue); + } + OpenAPI_list_free(access_and_mobility_subscription_data_1->adjacent_plmn_restrictions); + access_and_mobility_subscription_data_1->adjacent_plmn_restrictions = NULL; + } if (access_and_mobility_subscription_data_1->wireline_forbidden_areas) { OpenAPI_list_for_each(access_and_mobility_subscription_data_1->wireline_forbidden_areas, node) { OpenAPI_wireline_area_1_free(node->data); @@ -285,6 +319,21 @@ void OpenAPI_access_and_mobility_subscription_data_1_free(OpenAPI_access_and_mob OpenAPI_wireline_service_area_restriction_1_free(access_and_mobility_subscription_data_1->wireline_service_area_restriction); access_and_mobility_subscription_data_1->wireline_service_area_restriction = NULL; } + if (access_and_mobility_subscription_data_1->pcf_selection_assistance_infos) { + OpenAPI_list_for_each(access_and_mobility_subscription_data_1->pcf_selection_assistance_infos, node) { + OpenAPI_pcf_selection_assistance_info_1_free(node->data); + } + OpenAPI_list_free(access_and_mobility_subscription_data_1->pcf_selection_assistance_infos); + access_and_mobility_subscription_data_1->pcf_selection_assistance_infos = NULL; + } + if (access_and_mobility_subscription_data_1->aerial_ue_sub_info) { + OpenAPI_aerial_ue_subscription_info_1_free(access_and_mobility_subscription_data_1->aerial_ue_sub_info); + access_and_mobility_subscription_data_1->aerial_ue_sub_info = NULL; + } + if (access_and_mobility_subscription_data_1->roaming_restrictions) { + OpenAPI_roaming_restrictions_free(access_and_mobility_subscription_data_1->roaming_restrictions); + access_and_mobility_subscription_data_1->roaming_restrictions = NULL; + } ogs_free(access_and_mobility_subscription_data_1); } @@ -320,6 +369,13 @@ cJSON *OpenAPI_access_and_mobility_subscription_data_1_convertToJSON(OpenAPI_acc } } + if (access_and_mobility_subscription_data_1->hss_group_id) { + if (cJSON_AddStringToObject(item, "hssGroupId", access_and_mobility_subscription_data_1->hss_group_id) == NULL) { + ogs_error("OpenAPI_access_and_mobility_subscription_data_1_convertToJSON() failed [hss_group_id]"); + goto end; + } + } + if (access_and_mobility_subscription_data_1->internal_group_ids) { cJSON *internal_group_idsList = cJSON_AddArrayToObject(item, "internalGroupIds"); if (internal_group_idsList == NULL) { @@ -531,6 +587,13 @@ cJSON *OpenAPI_access_and_mobility_subscription_data_1_convertToJSON(OpenAPI_acc } } + if (access_and_mobility_subscription_data_1->routing_indicator) { + if (cJSON_AddStringToObject(item, "routingIndicator", access_and_mobility_subscription_data_1->routing_indicator) == NULL) { + ogs_error("OpenAPI_access_and_mobility_subscription_data_1_convertToJSON() failed [routing_indicator]"); + goto end; + } + } + if (access_and_mobility_subscription_data_1->is_mico_allowed) { if (cJSON_AddBoolToObject(item, "micoAllowed", access_and_mobility_subscription_data_1->mico_allowed) == NULL) { ogs_error("OpenAPI_access_and_mobility_subscription_data_1_convertToJSON() failed [mico_allowed]"); @@ -761,6 +824,28 @@ cJSON *OpenAPI_access_and_mobility_subscription_data_1_convertToJSON(OpenAPI_acc } } + if (access_and_mobility_subscription_data_1->adjacent_plmn_restrictions) { + cJSON *adjacent_plmn_restrictions = cJSON_AddObjectToObject(item, "adjacentPlmnRestrictions"); + if (adjacent_plmn_restrictions == NULL) { + ogs_error("OpenAPI_access_and_mobility_subscription_data_1_convertToJSON() failed [adjacent_plmn_restrictions]"); + goto end; + } + cJSON *localMapObject = adjacent_plmn_restrictions; + if (access_and_mobility_subscription_data_1->adjacent_plmn_restrictions) { + OpenAPI_list_for_each(access_and_mobility_subscription_data_1->adjacent_plmn_restrictions, node) { + OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*)node->data; + cJSON *itemLocal = localKeyValue->value ? + OpenAPI_plmn_restriction_1_convertToJSON(localKeyValue->value) : + cJSON_CreateNull(); + if (itemLocal == NULL) { + ogs_error("OpenAPI_access_and_mobility_subscription_data_1_convertToJSON() failed [inner]"); + goto end; + } + cJSON_AddItemToObject(localMapObject, localKeyValue->key, itemLocal); + } + } + } + if (access_and_mobility_subscription_data_1->wireline_forbidden_areas) { cJSON *wireline_forbidden_areasList = cJSON_AddArrayToObject(item, "wirelineForbiddenAreas"); if (wireline_forbidden_areasList == NULL) { @@ -790,6 +875,55 @@ cJSON *OpenAPI_access_and_mobility_subscription_data_1_convertToJSON(OpenAPI_acc } } + if (access_and_mobility_subscription_data_1->pcf_selection_assistance_infos) { + cJSON *pcf_selection_assistance_infosList = cJSON_AddArrayToObject(item, "pcfSelectionAssistanceInfos"); + if (pcf_selection_assistance_infosList == NULL) { + ogs_error("OpenAPI_access_and_mobility_subscription_data_1_convertToJSON() failed [pcf_selection_assistance_infos]"); + goto end; + } + OpenAPI_list_for_each(access_and_mobility_subscription_data_1->pcf_selection_assistance_infos, node) { + cJSON *itemLocal = OpenAPI_pcf_selection_assistance_info_1_convertToJSON(node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_access_and_mobility_subscription_data_1_convertToJSON() failed [pcf_selection_assistance_infos]"); + goto end; + } + cJSON_AddItemToArray(pcf_selection_assistance_infosList, itemLocal); + } + } + + if (access_and_mobility_subscription_data_1->aerial_ue_sub_info) { + cJSON *aerial_ue_sub_info_local_JSON = OpenAPI_aerial_ue_subscription_info_1_convertToJSON(access_and_mobility_subscription_data_1->aerial_ue_sub_info); + if (aerial_ue_sub_info_local_JSON == NULL) { + ogs_error("OpenAPI_access_and_mobility_subscription_data_1_convertToJSON() failed [aerial_ue_sub_info]"); + goto end; + } + cJSON_AddItemToObject(item, "aerialUeSubInfo", aerial_ue_sub_info_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_access_and_mobility_subscription_data_1_convertToJSON() failed [aerial_ue_sub_info]"); + goto end; + } + } + + if (access_and_mobility_subscription_data_1->roaming_restrictions) { + cJSON *roaming_restrictions_local_JSON = OpenAPI_roaming_restrictions_convertToJSON(access_and_mobility_subscription_data_1->roaming_restrictions); + if (roaming_restrictions_local_JSON == NULL) { + ogs_error("OpenAPI_access_and_mobility_subscription_data_1_convertToJSON() failed [roaming_restrictions]"); + goto end; + } + cJSON_AddItemToObject(item, "roamingRestrictions", roaming_restrictions_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_access_and_mobility_subscription_data_1_convertToJSON() failed [roaming_restrictions]"); + goto end; + } + } + + if (access_and_mobility_subscription_data_1->is_remote_prov_ind) { + if (cJSON_AddBoolToObject(item, "remoteProvInd", access_and_mobility_subscription_data_1->remote_prov_ind) == NULL) { + ogs_error("OpenAPI_access_and_mobility_subscription_data_1_convertToJSON() failed [remote_prov_ind]"); + goto end; + } + } + end: return item; } @@ -801,6 +935,7 @@ OpenAPI_access_and_mobility_subscription_data_1_t *OpenAPI_access_and_mobility_s cJSON *supported_features = NULL; cJSON *gpsis = NULL; OpenAPI_list_t *gpsisList = NULL; + cJSON *hss_group_id = NULL; cJSON *internal_group_ids = NULL; OpenAPI_list_t *internal_group_idsList = NULL; cJSON *shared_vn_group_data_ids = NULL; @@ -831,6 +966,7 @@ OpenAPI_access_and_mobility_subscription_data_1_t *OpenAPI_access_and_mobility_s OpenAPI_list_t *sor_update_indicator_listList = NULL; cJSON *upu_info = NULL; OpenAPI_upu_info_1_t *upu_info_local_nonprim = NULL; + cJSON *routing_indicator = NULL; cJSON *mico_allowed = NULL; cJSON *shared_am_data_ids = NULL; OpenAPI_list_t *shared_am_data_idsList = NULL; @@ -866,10 +1002,19 @@ OpenAPI_access_and_mobility_subscription_data_1_t *OpenAPI_access_and_mobility_s cJSON *ptw_parameters_list = NULL; OpenAPI_list_t *ptw_parameters_listList = NULL; cJSON *iab_operation_allowed = NULL; + cJSON *adjacent_plmn_restrictions = NULL; + OpenAPI_list_t *adjacent_plmn_restrictionsList = NULL; cJSON *wireline_forbidden_areas = NULL; OpenAPI_list_t *wireline_forbidden_areasList = NULL; cJSON *wireline_service_area_restriction = NULL; OpenAPI_wireline_service_area_restriction_1_t *wireline_service_area_restriction_local_nonprim = NULL; + cJSON *pcf_selection_assistance_infos = NULL; + OpenAPI_list_t *pcf_selection_assistance_infosList = NULL; + cJSON *aerial_ue_sub_info = NULL; + OpenAPI_aerial_ue_subscription_info_1_t *aerial_ue_sub_info_local_nonprim = NULL; + cJSON *roaming_restrictions = NULL; + OpenAPI_roaming_restrictions_t *roaming_restrictions_local_nonprim = NULL; + cJSON *remote_prov_ind = NULL; supported_features = cJSON_GetObjectItemCaseSensitive(access_and_mobility_subscription_data_1JSON, "supportedFeatures"); if (supported_features) { if (!cJSON_IsString(supported_features) && !cJSON_IsNull(supported_features)) { @@ -899,6 +1044,14 @@ OpenAPI_access_and_mobility_subscription_data_1_t *OpenAPI_access_and_mobility_s } } + hss_group_id = cJSON_GetObjectItemCaseSensitive(access_and_mobility_subscription_data_1JSON, "hssGroupId"); + if (hss_group_id) { + if (!cJSON_IsString(hss_group_id) && !cJSON_IsNull(hss_group_id)) { + ogs_error("OpenAPI_access_and_mobility_subscription_data_1_parseFromJSON() failed [hss_group_id]"); + goto end; + } + } + internal_group_ids = cJSON_GetObjectItemCaseSensitive(access_and_mobility_subscription_data_1JSON, "internalGroupIds"); if (internal_group_ids) { cJSON *internal_group_ids_local = NULL; @@ -1115,6 +1268,14 @@ OpenAPI_access_and_mobility_subscription_data_1_t *OpenAPI_access_and_mobility_s upu_info_local_nonprim = OpenAPI_upu_info_1_parseFromJSON(upu_info); } + routing_indicator = cJSON_GetObjectItemCaseSensitive(access_and_mobility_subscription_data_1JSON, "routingIndicator"); + if (routing_indicator) { + if (!cJSON_IsString(routing_indicator) && !cJSON_IsNull(routing_indicator)) { + ogs_error("OpenAPI_access_and_mobility_subscription_data_1_parseFromJSON() failed [routing_indicator]"); + goto end; + } + } + mico_allowed = cJSON_GetObjectItemCaseSensitive(access_and_mobility_subscription_data_1JSON, "micoAllowed"); if (mico_allowed) { if (!cJSON_IsBool(mico_allowed)) { @@ -1360,6 +1521,32 @@ OpenAPI_access_and_mobility_subscription_data_1_t *OpenAPI_access_and_mobility_s } } + adjacent_plmn_restrictions = cJSON_GetObjectItemCaseSensitive(access_and_mobility_subscription_data_1JSON, "adjacentPlmnRestrictions"); + if (adjacent_plmn_restrictions) { + cJSON *adjacent_plmn_restrictions_local_map = NULL; + if (!cJSON_IsObject(adjacent_plmn_restrictions) && !cJSON_IsNull(adjacent_plmn_restrictions)) { + ogs_error("OpenAPI_access_and_mobility_subscription_data_1_parseFromJSON() failed [adjacent_plmn_restrictions]"); + goto end; + } + if (cJSON_IsObject(adjacent_plmn_restrictions)) { + adjacent_plmn_restrictionsList = OpenAPI_list_create(); + OpenAPI_map_t *localMapKeyPair = NULL; + cJSON_ArrayForEach(adjacent_plmn_restrictions_local_map, adjacent_plmn_restrictions) { + cJSON *localMapObject = adjacent_plmn_restrictions_local_map; + if (cJSON_IsObject(localMapObject)) { + localMapKeyPair = OpenAPI_map_create( + ogs_strdup(localMapObject->string), OpenAPI_plmn_restriction_1_parseFromJSON(localMapObject)); + } else if (cJSON_IsNull(localMapObject)) { + localMapKeyPair = OpenAPI_map_create(ogs_strdup(localMapObject->string), NULL); + } else { + ogs_error("OpenAPI_access_and_mobility_subscription_data_1_parseFromJSON() failed [inner]"); + goto end; + } + OpenAPI_list_add(adjacent_plmn_restrictionsList, localMapKeyPair); + } + } + } + wireline_forbidden_areas = cJSON_GetObjectItemCaseSensitive(access_and_mobility_subscription_data_1JSON, "wirelineForbiddenAreas"); if (wireline_forbidden_areas) { cJSON *wireline_forbidden_areas_local = NULL; @@ -1390,9 +1577,53 @@ OpenAPI_access_and_mobility_subscription_data_1_t *OpenAPI_access_and_mobility_s wireline_service_area_restriction_local_nonprim = OpenAPI_wireline_service_area_restriction_1_parseFromJSON(wireline_service_area_restriction); } + pcf_selection_assistance_infos = cJSON_GetObjectItemCaseSensitive(access_and_mobility_subscription_data_1JSON, "pcfSelectionAssistanceInfos"); + if (pcf_selection_assistance_infos) { + cJSON *pcf_selection_assistance_infos_local = NULL; + if (!cJSON_IsArray(pcf_selection_assistance_infos)) { + ogs_error("OpenAPI_access_and_mobility_subscription_data_1_parseFromJSON() failed [pcf_selection_assistance_infos]"); + goto end; + } + + pcf_selection_assistance_infosList = OpenAPI_list_create(); + + cJSON_ArrayForEach(pcf_selection_assistance_infos_local, pcf_selection_assistance_infos) { + if (!cJSON_IsObject(pcf_selection_assistance_infos_local)) { + ogs_error("OpenAPI_access_and_mobility_subscription_data_1_parseFromJSON() failed [pcf_selection_assistance_infos]"); + goto end; + } + OpenAPI_pcf_selection_assistance_info_1_t *pcf_selection_assistance_infosItem = OpenAPI_pcf_selection_assistance_info_1_parseFromJSON(pcf_selection_assistance_infos_local); + if (!pcf_selection_assistance_infosItem) { + ogs_error("No pcf_selection_assistance_infosItem"); + OpenAPI_list_free(pcf_selection_assistance_infosList); + goto end; + } + OpenAPI_list_add(pcf_selection_assistance_infosList, pcf_selection_assistance_infosItem); + } + } + + aerial_ue_sub_info = cJSON_GetObjectItemCaseSensitive(access_and_mobility_subscription_data_1JSON, "aerialUeSubInfo"); + if (aerial_ue_sub_info) { + aerial_ue_sub_info_local_nonprim = OpenAPI_aerial_ue_subscription_info_1_parseFromJSON(aerial_ue_sub_info); + } + + roaming_restrictions = cJSON_GetObjectItemCaseSensitive(access_and_mobility_subscription_data_1JSON, "roamingRestrictions"); + if (roaming_restrictions) { + roaming_restrictions_local_nonprim = OpenAPI_roaming_restrictions_parseFromJSON(roaming_restrictions); + } + + remote_prov_ind = cJSON_GetObjectItemCaseSensitive(access_and_mobility_subscription_data_1JSON, "remoteProvInd"); + if (remote_prov_ind) { + if (!cJSON_IsBool(remote_prov_ind)) { + ogs_error("OpenAPI_access_and_mobility_subscription_data_1_parseFromJSON() failed [remote_prov_ind]"); + goto end; + } + } + access_and_mobility_subscription_data_1_local_var = OpenAPI_access_and_mobility_subscription_data_1_create ( supported_features && !cJSON_IsNull(supported_features) ? ogs_strdup(supported_features->valuestring) : NULL, gpsis ? gpsisList : NULL, + hss_group_id && !cJSON_IsNull(hss_group_id) ? ogs_strdup(hss_group_id->valuestring) : NULL, internal_group_ids ? internal_group_idsList : NULL, shared_vn_group_data_ids ? shared_vn_group_data_idsList : NULL, subscribed_ue_ambr ? subscribed_ue_ambr_local_nonprim : NULL, @@ -1420,6 +1651,7 @@ OpenAPI_access_and_mobility_subscription_data_1_t *OpenAPI_access_and_mobility_s soraf_retrieval ? soraf_retrieval->valueint : 0, sor_update_indicator_list ? sor_update_indicator_listList : NULL, upu_info ? upu_info_local_nonprim : NULL, + routing_indicator && !cJSON_IsNull(routing_indicator) ? ogs_strdup(routing_indicator->valuestring) : NULL, mico_allowed ? true : false, mico_allowed ? mico_allowed->valueint : 0, shared_am_data_ids ? shared_am_data_idsList : NULL, @@ -1448,8 +1680,14 @@ OpenAPI_access_and_mobility_subscription_data_1_t *OpenAPI_access_and_mobility_s ptw_parameters_list ? ptw_parameters_listList : NULL, iab_operation_allowed ? true : false, iab_operation_allowed ? iab_operation_allowed->valueint : 0, + adjacent_plmn_restrictions ? adjacent_plmn_restrictionsList : NULL, wireline_forbidden_areas ? wireline_forbidden_areasList : NULL, - wireline_service_area_restriction ? wireline_service_area_restriction_local_nonprim : NULL + wireline_service_area_restriction ? wireline_service_area_restriction_local_nonprim : NULL, + pcf_selection_assistance_infos ? pcf_selection_assistance_infosList : NULL, + aerial_ue_sub_info ? aerial_ue_sub_info_local_nonprim : NULL, + roaming_restrictions ? roaming_restrictions_local_nonprim : NULL, + remote_prov_ind ? true : false, + remote_prov_ind ? remote_prov_ind->valueint : 0 ); return access_and_mobility_subscription_data_1_local_var; @@ -1573,6 +1811,16 @@ end: OpenAPI_list_free(ptw_parameters_listList); ptw_parameters_listList = NULL; } + if (adjacent_plmn_restrictionsList) { + OpenAPI_list_for_each(adjacent_plmn_restrictionsList, node) { + OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*) node->data; + ogs_free(localKeyValue->key); + OpenAPI_plmn_restriction_1_free(localKeyValue->value); + OpenAPI_map_free(localKeyValue); + } + OpenAPI_list_free(adjacent_plmn_restrictionsList); + adjacent_plmn_restrictionsList = NULL; + } if (wireline_forbidden_areasList) { OpenAPI_list_for_each(wireline_forbidden_areasList, node) { OpenAPI_wireline_area_1_free(node->data); @@ -1584,6 +1832,21 @@ end: OpenAPI_wireline_service_area_restriction_1_free(wireline_service_area_restriction_local_nonprim); wireline_service_area_restriction_local_nonprim = NULL; } + if (pcf_selection_assistance_infosList) { + OpenAPI_list_for_each(pcf_selection_assistance_infosList, node) { + OpenAPI_pcf_selection_assistance_info_1_free(node->data); + } + OpenAPI_list_free(pcf_selection_assistance_infosList); + pcf_selection_assistance_infosList = NULL; + } + if (aerial_ue_sub_info_local_nonprim) { + OpenAPI_aerial_ue_subscription_info_1_free(aerial_ue_sub_info_local_nonprim); + aerial_ue_sub_info_local_nonprim = NULL; + } + if (roaming_restrictions_local_nonprim) { + OpenAPI_roaming_restrictions_free(roaming_restrictions_local_nonprim); + roaming_restrictions_local_nonprim = NULL; + } return NULL; } diff --git a/lib/sbi/openapi/model/access_and_mobility_subscription_data_1.h b/lib/sbi/openapi/model/access_and_mobility_subscription_data_1.h index 74caa5b76..41b6df07b 100644 --- a/lib/sbi/openapi/model/access_and_mobility_subscription_data_1.h +++ b/lib/sbi/openapi/model/access_and_mobility_subscription_data_1.h @@ -12,6 +12,7 @@ #include "../include/list.h" #include "../include/keyValuePair.h" #include "../include/binary.h" +#include "aerial_ue_subscription_info_1.h" #include "ambr_rm.h" #include "area_1.h" #include "cag_data_1.h" @@ -23,9 +24,13 @@ #include "mdt_user_consent.h" #include "nssai_1.h" #include "odb_packet_services.h" +#include "pcf_selection_assistance_info_1.h" +#include "plmn_restriction_1.h" #include "ptw_parameters_1.h" #include "rat_type.h" +#include "roaming_restrictions.h" #include "service_area_restriction_1.h" +#include "set.h" #include "sor_info_1.h" #include "sor_update_indicator.h" #include "trace_data.h" @@ -41,11 +46,12 @@ typedef struct OpenAPI_access_and_mobility_subscription_data_1_s OpenAPI_access_ typedef struct OpenAPI_access_and_mobility_subscription_data_1_s { char *supported_features; OpenAPI_list_t *gpsis; + char *hss_group_id; OpenAPI_list_t *internal_group_ids; OpenAPI_list_t* shared_vn_group_data_ids; struct OpenAPI_ambr_rm_s *subscribed_ue_ambr; struct OpenAPI_nssai_1_s *nssai; - OpenAPI_list_t *rat_restrictions; + OpenAPI_set_t *rat_restrictions; OpenAPI_list_t *forbidden_areas; struct OpenAPI_service_area_restriction_1_s *service_area_restriction; OpenAPI_list_t *core_network_type_restrictions; @@ -68,6 +74,7 @@ typedef struct OpenAPI_access_and_mobility_subscription_data_1_s { int soraf_retrieval; OpenAPI_list_t *sor_update_indicator_list; struct OpenAPI_upu_info_1_s *upu_info; + char *routing_indicator; bool is_mico_allowed; int mico_allowed; OpenAPI_list_t *shared_am_data_ids; @@ -90,24 +97,31 @@ typedef struct OpenAPI_access_and_mobility_subscription_data_1_s { bool is_ec_restriction_data_nb; int ec_restriction_data_nb; struct OpenAPI_expected_ue_behaviour_data_1_s *expected_ue_behaviour_list; - OpenAPI_list_t *primary_rat_restrictions; - OpenAPI_list_t *secondary_rat_restrictions; + OpenAPI_set_t *primary_rat_restrictions; + OpenAPI_set_t *secondary_rat_restrictions; OpenAPI_list_t *edrx_parameters_list; OpenAPI_list_t *ptw_parameters_list; bool is_iab_operation_allowed; int iab_operation_allowed; + OpenAPI_list_t* adjacent_plmn_restrictions; OpenAPI_list_t *wireline_forbidden_areas; struct OpenAPI_wireline_service_area_restriction_1_s *wireline_service_area_restriction; + OpenAPI_list_t *pcf_selection_assistance_infos; + struct OpenAPI_aerial_ue_subscription_info_1_s *aerial_ue_sub_info; + struct OpenAPI_roaming_restrictions_s *roaming_restrictions; + bool is_remote_prov_ind; + int remote_prov_ind; } OpenAPI_access_and_mobility_subscription_data_1_t; OpenAPI_access_and_mobility_subscription_data_1_t *OpenAPI_access_and_mobility_subscription_data_1_create( char *supported_features, OpenAPI_list_t *gpsis, + char *hss_group_id, OpenAPI_list_t *internal_group_ids, OpenAPI_list_t* shared_vn_group_data_ids, OpenAPI_ambr_rm_t *subscribed_ue_ambr, OpenAPI_nssai_1_t *nssai, - OpenAPI_list_t *rat_restrictions, + OpenAPI_set_t *rat_restrictions, OpenAPI_list_t *forbidden_areas, OpenAPI_service_area_restriction_1_t *service_area_restriction, OpenAPI_list_t *core_network_type_restrictions, @@ -130,6 +144,7 @@ OpenAPI_access_and_mobility_subscription_data_1_t *OpenAPI_access_and_mobility_s int soraf_retrieval, OpenAPI_list_t *sor_update_indicator_list, OpenAPI_upu_info_1_t *upu_info, + char *routing_indicator, bool is_mico_allowed, int mico_allowed, OpenAPI_list_t *shared_am_data_ids, @@ -152,14 +167,20 @@ OpenAPI_access_and_mobility_subscription_data_1_t *OpenAPI_access_and_mobility_s bool is_ec_restriction_data_nb, int ec_restriction_data_nb, OpenAPI_expected_ue_behaviour_data_1_t *expected_ue_behaviour_list, - OpenAPI_list_t *primary_rat_restrictions, - OpenAPI_list_t *secondary_rat_restrictions, + OpenAPI_set_t *primary_rat_restrictions, + OpenAPI_set_t *secondary_rat_restrictions, OpenAPI_list_t *edrx_parameters_list, OpenAPI_list_t *ptw_parameters_list, bool is_iab_operation_allowed, int iab_operation_allowed, + OpenAPI_list_t* adjacent_plmn_restrictions, OpenAPI_list_t *wireline_forbidden_areas, - OpenAPI_wireline_service_area_restriction_1_t *wireline_service_area_restriction + OpenAPI_wireline_service_area_restriction_1_t *wireline_service_area_restriction, + OpenAPI_list_t *pcf_selection_assistance_infos, + OpenAPI_aerial_ue_subscription_info_1_t *aerial_ue_sub_info, + OpenAPI_roaming_restrictions_t *roaming_restrictions, + bool is_remote_prov_ind, + int remote_prov_ind ); void OpenAPI_access_and_mobility_subscription_data_1_free(OpenAPI_access_and_mobility_subscription_data_1_t *access_and_mobility_subscription_data_1); OpenAPI_access_and_mobility_subscription_data_1_t *OpenAPI_access_and_mobility_subscription_data_1_parseFromJSON(cJSON *access_and_mobility_subscription_data_1JSON); diff --git a/lib/sbi/openapi/model/access_net_charging_identifier.c b/lib/sbi/openapi/model/access_net_charging_identifier.c index a996d36da..5dbd1d834 100644 --- a/lib/sbi/openapi/model/access_net_charging_identifier.c +++ b/lib/sbi/openapi/model/access_net_charging_identifier.c @@ -5,14 +5,18 @@ #include "access_net_charging_identifier.h" OpenAPI_access_net_charging_identifier_t *OpenAPI_access_net_charging_identifier_create( + bool is_acc_net_cha_id_value, int acc_net_cha_id_value, + char *acc_net_charg_id_string, OpenAPI_list_t *flows ) { OpenAPI_access_net_charging_identifier_t *access_net_charging_identifier_local_var = ogs_malloc(sizeof(OpenAPI_access_net_charging_identifier_t)); ogs_assert(access_net_charging_identifier_local_var); + access_net_charging_identifier_local_var->is_acc_net_cha_id_value = is_acc_net_cha_id_value; access_net_charging_identifier_local_var->acc_net_cha_id_value = acc_net_cha_id_value; + access_net_charging_identifier_local_var->acc_net_charg_id_string = acc_net_charg_id_string; access_net_charging_identifier_local_var->flows = flows; return access_net_charging_identifier_local_var; @@ -25,6 +29,10 @@ void OpenAPI_access_net_charging_identifier_free(OpenAPI_access_net_charging_ide if (NULL == access_net_charging_identifier) { return; } + if (access_net_charging_identifier->acc_net_charg_id_string) { + ogs_free(access_net_charging_identifier->acc_net_charg_id_string); + access_net_charging_identifier->acc_net_charg_id_string = NULL; + } if (access_net_charging_identifier->flows) { OpenAPI_list_for_each(access_net_charging_identifier->flows, node) { OpenAPI_flows_free(node->data); @@ -46,10 +54,19 @@ cJSON *OpenAPI_access_net_charging_identifier_convertToJSON(OpenAPI_access_net_c } item = cJSON_CreateObject(); + if (access_net_charging_identifier->is_acc_net_cha_id_value) { if (cJSON_AddNumberToObject(item, "accNetChaIdValue", access_net_charging_identifier->acc_net_cha_id_value) == NULL) { ogs_error("OpenAPI_access_net_charging_identifier_convertToJSON() failed [acc_net_cha_id_value]"); goto end; } + } + + if (access_net_charging_identifier->acc_net_charg_id_string) { + if (cJSON_AddStringToObject(item, "accNetChargIdString", access_net_charging_identifier->acc_net_charg_id_string) == NULL) { + ogs_error("OpenAPI_access_net_charging_identifier_convertToJSON() failed [acc_net_charg_id_string]"); + goto end; + } + } if (access_net_charging_identifier->flows) { cJSON *flowsList = cJSON_AddArrayToObject(item, "flows"); @@ -76,17 +93,24 @@ OpenAPI_access_net_charging_identifier_t *OpenAPI_access_net_charging_identifier OpenAPI_access_net_charging_identifier_t *access_net_charging_identifier_local_var = NULL; OpenAPI_lnode_t *node = NULL; cJSON *acc_net_cha_id_value = NULL; + cJSON *acc_net_charg_id_string = NULL; cJSON *flows = NULL; OpenAPI_list_t *flowsList = NULL; acc_net_cha_id_value = cJSON_GetObjectItemCaseSensitive(access_net_charging_identifierJSON, "accNetChaIdValue"); - if (!acc_net_cha_id_value) { - ogs_error("OpenAPI_access_net_charging_identifier_parseFromJSON() failed [acc_net_cha_id_value]"); - goto end; - } + if (acc_net_cha_id_value) { if (!cJSON_IsNumber(acc_net_cha_id_value)) { ogs_error("OpenAPI_access_net_charging_identifier_parseFromJSON() failed [acc_net_cha_id_value]"); goto end; } + } + + acc_net_charg_id_string = cJSON_GetObjectItemCaseSensitive(access_net_charging_identifierJSON, "accNetChargIdString"); + if (acc_net_charg_id_string) { + if (!cJSON_IsString(acc_net_charg_id_string) && !cJSON_IsNull(acc_net_charg_id_string)) { + ogs_error("OpenAPI_access_net_charging_identifier_parseFromJSON() failed [acc_net_charg_id_string]"); + goto end; + } + } flows = cJSON_GetObjectItemCaseSensitive(access_net_charging_identifierJSON, "flows"); if (flows) { @@ -114,8 +138,9 @@ OpenAPI_access_net_charging_identifier_t *OpenAPI_access_net_charging_identifier } access_net_charging_identifier_local_var = OpenAPI_access_net_charging_identifier_create ( - - acc_net_cha_id_value->valuedouble, + acc_net_cha_id_value ? true : false, + acc_net_cha_id_value ? acc_net_cha_id_value->valuedouble : 0, + acc_net_charg_id_string && !cJSON_IsNull(acc_net_charg_id_string) ? ogs_strdup(acc_net_charg_id_string->valuestring) : NULL, flows ? flowsList : NULL ); diff --git a/lib/sbi/openapi/model/access_net_charging_identifier.h b/lib/sbi/openapi/model/access_net_charging_identifier.h index 23c6aceea..75d8130e9 100644 --- a/lib/sbi/openapi/model/access_net_charging_identifier.h +++ b/lib/sbi/openapi/model/access_net_charging_identifier.h @@ -20,12 +20,16 @@ extern "C" { typedef struct OpenAPI_access_net_charging_identifier_s OpenAPI_access_net_charging_identifier_t; typedef struct OpenAPI_access_net_charging_identifier_s { + bool is_acc_net_cha_id_value; int acc_net_cha_id_value; + char *acc_net_charg_id_string; OpenAPI_list_t *flows; } OpenAPI_access_net_charging_identifier_t; OpenAPI_access_net_charging_identifier_t *OpenAPI_access_net_charging_identifier_create( + bool is_acc_net_cha_id_value, int acc_net_cha_id_value, + char *acc_net_charg_id_string, OpenAPI_list_t *flows ); void OpenAPI_access_net_charging_identifier_free(OpenAPI_access_net_charging_identifier_t *access_net_charging_identifier); diff --git a/lib/sbi/openapi/model/access_right_status.h b/lib/sbi/openapi/model/access_right_status.h index cf8797c7c..0bfa6dfa3 100644 --- a/lib/sbi/openapi/model/access_right_status.h +++ b/lib/sbi/openapi/model/access_right_status.h @@ -1,7 +1,7 @@ /* * access_right_status.h * - * Possible values are - FULLY_ALLOWED: The User is fully allowed to access to the channel. - PREVIEW_ALLOWED: The User is preview allowed to access to the channel. - NO_ALLOWED: The User is not allowed to access to the channel. + * Possible values are: - FULLY_ALLOWED: The User is fully allowed to access to the channel. - PREVIEW_ALLOWED: The User is preview allowed to access to the channel. - NO_ALLOWED: The User is not allowed to access to the channel. */ #ifndef _OpenAPI_access_right_status_H_ diff --git a/lib/sbi/openapi/model/access_tech.h b/lib/sbi/openapi/model/access_tech.h index 1da831158..7b4f402d5 100644 --- a/lib/sbi/openapi/model/access_tech.h +++ b/lib/sbi/openapi/model/access_tech.h @@ -1,7 +1,7 @@ /* * access_tech.h * - * + * Represents the access technology */ #ifndef _OpenAPI_access_tech_H_ diff --git a/lib/sbi/openapi/model/access_token_req.c b/lib/sbi/openapi/model/access_token_req.c index 6924a0a0e..5a7bf1159 100644 --- a/lib/sbi/openapi/model/access_token_req.c +++ b/lib/sbi/openapi/model/access_token_req.c @@ -40,10 +40,13 @@ OpenAPI_access_token_req_t *OpenAPI_access_token_req_create( char *requester_fqdn, OpenAPI_list_t *requester_snpn_list, OpenAPI_plmn_id_t *target_plmn, + OpenAPI_plmn_id_nid_t *target_snpn, OpenAPI_list_t *target_snssai_list, OpenAPI_list_t *target_nsi_list, char *target_nf_set_id, - char *target_nf_service_set_id + char *target_nf_service_set_id, + char *hnrf_access_token_uri, + char *source_nf_instance_id ) { OpenAPI_access_token_req_t *access_token_req_local_var = ogs_malloc(sizeof(OpenAPI_access_token_req_t)); @@ -61,10 +64,13 @@ OpenAPI_access_token_req_t *OpenAPI_access_token_req_create( access_token_req_local_var->requester_fqdn = requester_fqdn; access_token_req_local_var->requester_snpn_list = requester_snpn_list; access_token_req_local_var->target_plmn = target_plmn; + access_token_req_local_var->target_snpn = target_snpn; access_token_req_local_var->target_snssai_list = target_snssai_list; access_token_req_local_var->target_nsi_list = target_nsi_list; access_token_req_local_var->target_nf_set_id = target_nf_set_id; access_token_req_local_var->target_nf_service_set_id = target_nf_service_set_id; + access_token_req_local_var->hnrf_access_token_uri = hnrf_access_token_uri; + access_token_req_local_var->source_nf_instance_id = source_nf_instance_id; return access_token_req_local_var; } @@ -121,6 +127,10 @@ void OpenAPI_access_token_req_free(OpenAPI_access_token_req_t *access_token_req) OpenAPI_plmn_id_free(access_token_req->target_plmn); access_token_req->target_plmn = NULL; } + if (access_token_req->target_snpn) { + OpenAPI_plmn_id_nid_free(access_token_req->target_snpn); + access_token_req->target_snpn = NULL; + } if (access_token_req->target_snssai_list) { OpenAPI_list_for_each(access_token_req->target_snssai_list, node) { OpenAPI_snssai_free(node->data); @@ -143,6 +153,14 @@ void OpenAPI_access_token_req_free(OpenAPI_access_token_req_t *access_token_req) ogs_free(access_token_req->target_nf_service_set_id); access_token_req->target_nf_service_set_id = NULL; } + if (access_token_req->hnrf_access_token_uri) { + ogs_free(access_token_req->hnrf_access_token_uri); + access_token_req->hnrf_access_token_uri = NULL; + } + if (access_token_req->source_nf_instance_id) { + ogs_free(access_token_req->source_nf_instance_id); + access_token_req->source_nf_instance_id = NULL; + } ogs_free(access_token_req); } @@ -286,6 +304,19 @@ cJSON *OpenAPI_access_token_req_convertToJSON(OpenAPI_access_token_req_t *access } } + if (access_token_req->target_snpn) { + cJSON *target_snpn_local_JSON = OpenAPI_plmn_id_nid_convertToJSON(access_token_req->target_snpn); + if (target_snpn_local_JSON == NULL) { + ogs_error("OpenAPI_access_token_req_convertToJSON() failed [target_snpn]"); + goto end; + } + cJSON_AddItemToObject(item, "targetSnpn", target_snpn_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_access_token_req_convertToJSON() failed [target_snpn]"); + goto end; + } + } + if (access_token_req->target_snssai_list) { cJSON *target_snssai_listList = cJSON_AddArrayToObject(item, "targetSnssaiList"); if (target_snssai_listList == NULL) { @@ -330,6 +361,20 @@ cJSON *OpenAPI_access_token_req_convertToJSON(OpenAPI_access_token_req_t *access } } + if (access_token_req->hnrf_access_token_uri) { + if (cJSON_AddStringToObject(item, "hnrfAccessTokenUri", access_token_req->hnrf_access_token_uri) == NULL) { + ogs_error("OpenAPI_access_token_req_convertToJSON() failed [hnrf_access_token_uri]"); + goto end; + } + } + + if (access_token_req->source_nf_instance_id) { + if (cJSON_AddStringToObject(item, "sourceNfInstanceId", access_token_req->source_nf_instance_id) == NULL) { + ogs_error("OpenAPI_access_token_req_convertToJSON() failed [source_nf_instance_id]"); + goto end; + } + } + end: return item; } @@ -358,12 +403,16 @@ OpenAPI_access_token_req_t *OpenAPI_access_token_req_parseFromJSON(cJSON *access OpenAPI_list_t *requester_snpn_listList = NULL; cJSON *target_plmn = NULL; OpenAPI_plmn_id_t *target_plmn_local_nonprim = NULL; + cJSON *target_snpn = NULL; + OpenAPI_plmn_id_nid_t *target_snpn_local_nonprim = NULL; cJSON *target_snssai_list = NULL; OpenAPI_list_t *target_snssai_listList = NULL; cJSON *target_nsi_list = NULL; OpenAPI_list_t *target_nsi_listList = NULL; cJSON *target_nf_set_id = NULL; cJSON *target_nf_service_set_id = NULL; + cJSON *hnrf_access_token_uri = NULL; + cJSON *source_nf_instance_id = NULL; grant_type = cJSON_GetObjectItemCaseSensitive(access_token_reqJSON, "grant_type"); if (!grant_type) { ogs_error("OpenAPI_access_token_req_parseFromJSON() failed [grant_type]"); @@ -514,6 +563,11 @@ OpenAPI_access_token_req_t *OpenAPI_access_token_req_parseFromJSON(cJSON *access target_plmn_local_nonprim = OpenAPI_plmn_id_parseFromJSON(target_plmn); } + target_snpn = cJSON_GetObjectItemCaseSensitive(access_token_reqJSON, "targetSnpn"); + if (target_snpn) { + target_snpn_local_nonprim = OpenAPI_plmn_id_nid_parseFromJSON(target_snpn); + } + target_snssai_list = cJSON_GetObjectItemCaseSensitive(access_token_reqJSON, "targetSnssaiList"); if (target_snssai_list) { cJSON *target_snssai_list_local = NULL; @@ -576,6 +630,22 @@ OpenAPI_access_token_req_t *OpenAPI_access_token_req_parseFromJSON(cJSON *access } } + hnrf_access_token_uri = cJSON_GetObjectItemCaseSensitive(access_token_reqJSON, "hnrfAccessTokenUri"); + if (hnrf_access_token_uri) { + if (!cJSON_IsString(hnrf_access_token_uri) && !cJSON_IsNull(hnrf_access_token_uri)) { + ogs_error("OpenAPI_access_token_req_parseFromJSON() failed [hnrf_access_token_uri]"); + goto end; + } + } + + source_nf_instance_id = cJSON_GetObjectItemCaseSensitive(access_token_reqJSON, "sourceNfInstanceId"); + if (source_nf_instance_id) { + if (!cJSON_IsString(source_nf_instance_id) && !cJSON_IsNull(source_nf_instance_id)) { + ogs_error("OpenAPI_access_token_req_parseFromJSON() failed [source_nf_instance_id]"); + goto end; + } + } + access_token_req_local_var = OpenAPI_access_token_req_create ( grant_typeVariable, ogs_strdup(nf_instance_id->valuestring), @@ -589,10 +659,13 @@ OpenAPI_access_token_req_t *OpenAPI_access_token_req_parseFromJSON(cJSON *access requester_fqdn && !cJSON_IsNull(requester_fqdn) ? ogs_strdup(requester_fqdn->valuestring) : NULL, requester_snpn_list ? requester_snpn_listList : NULL, target_plmn ? target_plmn_local_nonprim : NULL, + target_snpn ? target_snpn_local_nonprim : NULL, target_snssai_list ? target_snssai_listList : NULL, target_nsi_list ? target_nsi_listList : NULL, target_nf_set_id && !cJSON_IsNull(target_nf_set_id) ? ogs_strdup(target_nf_set_id->valuestring) : NULL, - target_nf_service_set_id && !cJSON_IsNull(target_nf_service_set_id) ? ogs_strdup(target_nf_service_set_id->valuestring) : NULL + target_nf_service_set_id && !cJSON_IsNull(target_nf_service_set_id) ? ogs_strdup(target_nf_service_set_id->valuestring) : NULL, + hnrf_access_token_uri && !cJSON_IsNull(hnrf_access_token_uri) ? ogs_strdup(hnrf_access_token_uri->valuestring) : NULL, + source_nf_instance_id && !cJSON_IsNull(source_nf_instance_id) ? ogs_strdup(source_nf_instance_id->valuestring) : NULL ); return access_token_req_local_var; @@ -626,6 +699,10 @@ end: OpenAPI_plmn_id_free(target_plmn_local_nonprim); target_plmn_local_nonprim = NULL; } + if (target_snpn_local_nonprim) { + OpenAPI_plmn_id_nid_free(target_snpn_local_nonprim); + target_snpn_local_nonprim = NULL; + } if (target_snssai_listList) { OpenAPI_list_for_each(target_snssai_listList, node) { OpenAPI_snssai_free(node->data); diff --git a/lib/sbi/openapi/model/access_token_req.h b/lib/sbi/openapi/model/access_token_req.h index 843908635..fdfdb4b4f 100644 --- a/lib/sbi/openapi/model/access_token_req.h +++ b/lib/sbi/openapi/model/access_token_req.h @@ -40,10 +40,13 @@ typedef struct OpenAPI_access_token_req_s { char *requester_fqdn; OpenAPI_list_t *requester_snpn_list; struct OpenAPI_plmn_id_s *target_plmn; + struct OpenAPI_plmn_id_nid_s *target_snpn; OpenAPI_list_t *target_snssai_list; OpenAPI_list_t *target_nsi_list; char *target_nf_set_id; char *target_nf_service_set_id; + char *hnrf_access_token_uri; + char *source_nf_instance_id; } OpenAPI_access_token_req_t; OpenAPI_access_token_req_t *OpenAPI_access_token_req_create( @@ -59,10 +62,13 @@ OpenAPI_access_token_req_t *OpenAPI_access_token_req_create( char *requester_fqdn, OpenAPI_list_t *requester_snpn_list, OpenAPI_plmn_id_t *target_plmn, + OpenAPI_plmn_id_nid_t *target_snpn, OpenAPI_list_t *target_snssai_list, OpenAPI_list_t *target_nsi_list, char *target_nf_set_id, - char *target_nf_service_set_id + char *target_nf_service_set_id, + char *hnrf_access_token_uri, + char *source_nf_instance_id ); void OpenAPI_access_token_req_free(OpenAPI_access_token_req_t *access_token_req); OpenAPI_access_token_req_t *OpenAPI_access_token_req_parseFromJSON(cJSON *access_token_reqJSON); diff --git a/lib/sbi/openapi/model/access_type.h b/lib/sbi/openapi/model/access_type.h index 155ad4600..4518fbdd0 100644 --- a/lib/sbi/openapi/model/access_type.h +++ b/lib/sbi/openapi/model/access_type.h @@ -1,7 +1,7 @@ /* * access_type.h * - * + * Indicates whether the access is via 3GPP or via non-3GPP. */ #ifndef _OpenAPI_access_type_H_ diff --git a/lib/sbi/openapi/model/access_type_rm.h b/lib/sbi/openapi/model/access_type_rm.h index f98da46aa..eba2cc6a4 100644 --- a/lib/sbi/openapi/model/access_type_rm.h +++ b/lib/sbi/openapi/model/access_type_rm.h @@ -1,7 +1,7 @@ /* * access_type_rm.h * - * + * Indicates wether the access is via 3GPP or via non-3GPP but with the OpenAPI 'nullable: true' property.\" */ #ifndef _OpenAPI_access_type_rm_H_ diff --git a/lib/sbi/openapi/model/accu_usage_report.h b/lib/sbi/openapi/model/accu_usage_report.h index b78589d74..ce1ce9941 100644 --- a/lib/sbi/openapi/model/accu_usage_report.h +++ b/lib/sbi/openapi/model/accu_usage_report.h @@ -1,7 +1,7 @@ /* * accu_usage_report.h * - * + * Contains the accumulated usage report information. */ #ifndef _OpenAPI_accu_usage_report_H_ diff --git a/lib/sbi/openapi/model/accumulated_usage.h b/lib/sbi/openapi/model/accumulated_usage.h index 459fd9187..28366bb28 100644 --- a/lib/sbi/openapi/model/accumulated_usage.h +++ b/lib/sbi/openapi/model/accumulated_usage.h @@ -1,7 +1,7 @@ /* * accumulated_usage.h * - * + * Represents an accumulated usage. */ #ifndef _OpenAPI_accumulated_usage_H_ diff --git a/lib/sbi/openapi/model/accuracy.c b/lib/sbi/openapi/model/accuracy.c new file mode 100644 index 000000000..31697deaf --- /dev/null +++ b/lib/sbi/openapi/model/accuracy.c @@ -0,0 +1,87 @@ + +#include +#include +#include +#include "accuracy.h" + +OpenAPI_accuracy_t *OpenAPI_accuracy_create( +) +{ + OpenAPI_accuracy_t *accuracy_local_var = ogs_malloc(sizeof(OpenAPI_accuracy_t)); + ogs_assert(accuracy_local_var); + + + return accuracy_local_var; +} + +void OpenAPI_accuracy_free(OpenAPI_accuracy_t *accuracy) +{ + OpenAPI_lnode_t *node = NULL; + + if (NULL == accuracy) { + return; + } + ogs_free(accuracy); +} + +cJSON *OpenAPI_accuracy_convertToJSON(OpenAPI_accuracy_t *accuracy) +{ + cJSON *item = NULL; + OpenAPI_lnode_t *node = NULL; + + if (accuracy == NULL) { + ogs_error("OpenAPI_accuracy_convertToJSON() failed [Accuracy]"); + return NULL; + } + + item = cJSON_CreateObject(); +end: + return item; +} + +OpenAPI_accuracy_t *OpenAPI_accuracy_parseFromJSON(cJSON *accuracyJSON) +{ + OpenAPI_accuracy_t *accuracy_local_var = NULL; + OpenAPI_lnode_t *node = NULL; + accuracy_local_var = OpenAPI_accuracy_create ( + ); + + return accuracy_local_var; +end: + return NULL; +} + +OpenAPI_accuracy_t *OpenAPI_accuracy_copy(OpenAPI_accuracy_t *dst, OpenAPI_accuracy_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_accuracy_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_accuracy_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_accuracy_free(dst); + dst = OpenAPI_accuracy_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/accuracy.h b/lib/sbi/openapi/model/accuracy.h new file mode 100644 index 000000000..9f2e33999 --- /dev/null +++ b/lib/sbi/openapi/model/accuracy.h @@ -0,0 +1,37 @@ +/* + * accuracy.h + * + * Possible values are: - LOW: Low accuracy. - HIGH: High accuracy. + */ + +#ifndef _OpenAPI_accuracy_H_ +#define _OpenAPI_accuracy_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "accuracy_any_of.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_accuracy_s OpenAPI_accuracy_t; +typedef struct OpenAPI_accuracy_s { +} OpenAPI_accuracy_t; + +OpenAPI_accuracy_t *OpenAPI_accuracy_create( +); +void OpenAPI_accuracy_free(OpenAPI_accuracy_t *accuracy); +OpenAPI_accuracy_t *OpenAPI_accuracy_parseFromJSON(cJSON *accuracyJSON); +cJSON *OpenAPI_accuracy_convertToJSON(OpenAPI_accuracy_t *accuracy); +OpenAPI_accuracy_t *OpenAPI_accuracy_copy(OpenAPI_accuracy_t *dst, OpenAPI_accuracy_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_accuracy_H_ */ + diff --git a/lib/sbi/openapi/model/accuracy_any_of.c b/lib/sbi/openapi/model/accuracy_any_of.c new file mode 100644 index 000000000..f11cb100c --- /dev/null +++ b/lib/sbi/openapi/model/accuracy_any_of.c @@ -0,0 +1,30 @@ + +#include +#include +#include +#include "accuracy_any_of.h" + +char* OpenAPI_accuracy_any_of_ToString(OpenAPI_accuracy_any_of_e accuracy_any_of) +{ + const char *accuracy_any_ofArray[] = { "NULL", "LOW", "HIGH" }; + size_t sizeofArray = sizeof(accuracy_any_ofArray) / sizeof(accuracy_any_ofArray[0]); + if (accuracy_any_of < sizeofArray) + return (char *)accuracy_any_ofArray[accuracy_any_of]; + else + return (char *)"Unknown"; +} + +OpenAPI_accuracy_any_of_e OpenAPI_accuracy_any_of_FromString(char* accuracy_any_of) +{ + int stringToReturn = 0; + const char *accuracy_any_ofArray[] = { "NULL", "LOW", "HIGH" }; + size_t sizeofArray = sizeof(accuracy_any_ofArray) / sizeof(accuracy_any_ofArray[0]); + while (stringToReturn < sizeofArray) { + if (strcmp(accuracy_any_of, accuracy_any_ofArray[stringToReturn]) == 0) { + return stringToReturn; + } + stringToReturn++; + } + return 0; +} + diff --git a/lib/sbi/openapi/model/accuracy_any_of.h b/lib/sbi/openapi/model/accuracy_any_of.h new file mode 100644 index 000000000..927223ad2 --- /dev/null +++ b/lib/sbi/openapi/model/accuracy_any_of.h @@ -0,0 +1,31 @@ +/* + * accuracy_any_of.h + * + * + */ + +#ifndef _OpenAPI_accuracy_any_of_H_ +#define _OpenAPI_accuracy_any_of_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef enum { OpenAPI_accuracy_any_of_NULL = 0, OpenAPI_accuracy_any_of_LOW, OpenAPI_accuracy_any_of_HIGH } OpenAPI_accuracy_any_of_e; + +char* OpenAPI_accuracy_any_of_ToString(OpenAPI_accuracy_any_of_e accuracy_any_of); + +OpenAPI_accuracy_any_of_e OpenAPI_accuracy_any_of_FromString(char* accuracy_any_of); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_accuracy_any_of_H_ */ + diff --git a/lib/sbi/openapi/model/acknowledge_info.c b/lib/sbi/openapi/model/acknowledge_info.c index d5869db90..014319ffa 100644 --- a/lib/sbi/openapi/model/acknowledge_info.c +++ b/lib/sbi/openapi/model/acknowledge_info.c @@ -7,10 +7,11 @@ OpenAPI_acknowledge_info_t *OpenAPI_acknowledge_info_create( char *sor_mac_iue, char *upu_mac_iue, - char *secured_packet, char *provisioning_time, + char *sor_transparent_container, bool is_ue_not_reachable, - int ue_not_reachable + int ue_not_reachable, + char *upu_transparent_container ) { OpenAPI_acknowledge_info_t *acknowledge_info_local_var = ogs_malloc(sizeof(OpenAPI_acknowledge_info_t)); @@ -18,10 +19,11 @@ OpenAPI_acknowledge_info_t *OpenAPI_acknowledge_info_create( acknowledge_info_local_var->sor_mac_iue = sor_mac_iue; acknowledge_info_local_var->upu_mac_iue = upu_mac_iue; - acknowledge_info_local_var->secured_packet = secured_packet; acknowledge_info_local_var->provisioning_time = provisioning_time; + acknowledge_info_local_var->sor_transparent_container = sor_transparent_container; acknowledge_info_local_var->is_ue_not_reachable = is_ue_not_reachable; acknowledge_info_local_var->ue_not_reachable = ue_not_reachable; + acknowledge_info_local_var->upu_transparent_container = upu_transparent_container; return acknowledge_info_local_var; } @@ -41,14 +43,18 @@ void OpenAPI_acknowledge_info_free(OpenAPI_acknowledge_info_t *acknowledge_info) ogs_free(acknowledge_info->upu_mac_iue); acknowledge_info->upu_mac_iue = NULL; } - if (acknowledge_info->secured_packet) { - ogs_free(acknowledge_info->secured_packet); - acknowledge_info->secured_packet = NULL; - } if (acknowledge_info->provisioning_time) { ogs_free(acknowledge_info->provisioning_time); acknowledge_info->provisioning_time = NULL; } + if (acknowledge_info->sor_transparent_container) { + ogs_free(acknowledge_info->sor_transparent_container); + acknowledge_info->sor_transparent_container = NULL; + } + if (acknowledge_info->upu_transparent_container) { + ogs_free(acknowledge_info->upu_transparent_container); + acknowledge_info->upu_transparent_container = NULL; + } ogs_free(acknowledge_info); } @@ -77,13 +83,6 @@ cJSON *OpenAPI_acknowledge_info_convertToJSON(OpenAPI_acknowledge_info_t *acknow } } - if (acknowledge_info->secured_packet) { - if (cJSON_AddStringToObject(item, "securedPacket", acknowledge_info->secured_packet) == NULL) { - ogs_error("OpenAPI_acknowledge_info_convertToJSON() failed [secured_packet]"); - goto end; - } - } - if (!acknowledge_info->provisioning_time) { ogs_error("OpenAPI_acknowledge_info_convertToJSON() failed [provisioning_time]"); return NULL; @@ -93,6 +92,13 @@ cJSON *OpenAPI_acknowledge_info_convertToJSON(OpenAPI_acknowledge_info_t *acknow goto end; } + if (acknowledge_info->sor_transparent_container) { + if (cJSON_AddStringToObject(item, "sorTransparentContainer", acknowledge_info->sor_transparent_container) == NULL) { + ogs_error("OpenAPI_acknowledge_info_convertToJSON() failed [sor_transparent_container]"); + goto end; + } + } + if (acknowledge_info->is_ue_not_reachable) { if (cJSON_AddBoolToObject(item, "ueNotReachable", acknowledge_info->ue_not_reachable) == NULL) { ogs_error("OpenAPI_acknowledge_info_convertToJSON() failed [ue_not_reachable]"); @@ -100,6 +106,13 @@ cJSON *OpenAPI_acknowledge_info_convertToJSON(OpenAPI_acknowledge_info_t *acknow } } + if (acknowledge_info->upu_transparent_container) { + if (cJSON_AddStringToObject(item, "upuTransparentContainer", acknowledge_info->upu_transparent_container) == NULL) { + ogs_error("OpenAPI_acknowledge_info_convertToJSON() failed [upu_transparent_container]"); + goto end; + } + } + end: return item; } @@ -110,9 +123,10 @@ OpenAPI_acknowledge_info_t *OpenAPI_acknowledge_info_parseFromJSON(cJSON *acknow OpenAPI_lnode_t *node = NULL; cJSON *sor_mac_iue = NULL; cJSON *upu_mac_iue = NULL; - cJSON *secured_packet = NULL; cJSON *provisioning_time = NULL; + cJSON *sor_transparent_container = NULL; cJSON *ue_not_reachable = NULL; + cJSON *upu_transparent_container = NULL; sor_mac_iue = cJSON_GetObjectItemCaseSensitive(acknowledge_infoJSON, "sorMacIue"); if (sor_mac_iue) { if (!cJSON_IsString(sor_mac_iue) && !cJSON_IsNull(sor_mac_iue)) { @@ -129,14 +143,6 @@ OpenAPI_acknowledge_info_t *OpenAPI_acknowledge_info_parseFromJSON(cJSON *acknow } } - secured_packet = cJSON_GetObjectItemCaseSensitive(acknowledge_infoJSON, "securedPacket"); - if (secured_packet) { - if (!cJSON_IsString(secured_packet) && !cJSON_IsNull(secured_packet)) { - ogs_error("OpenAPI_acknowledge_info_parseFromJSON() failed [secured_packet]"); - goto end; - } - } - provisioning_time = cJSON_GetObjectItemCaseSensitive(acknowledge_infoJSON, "provisioningTime"); if (!provisioning_time) { ogs_error("OpenAPI_acknowledge_info_parseFromJSON() failed [provisioning_time]"); @@ -147,6 +153,14 @@ OpenAPI_acknowledge_info_t *OpenAPI_acknowledge_info_parseFromJSON(cJSON *acknow goto end; } + sor_transparent_container = cJSON_GetObjectItemCaseSensitive(acknowledge_infoJSON, "sorTransparentContainer"); + if (sor_transparent_container) { + if (!cJSON_IsString(sor_transparent_container) && !cJSON_IsNull(sor_transparent_container)) { + ogs_error("OpenAPI_acknowledge_info_parseFromJSON() failed [sor_transparent_container]"); + goto end; + } + } + ue_not_reachable = cJSON_GetObjectItemCaseSensitive(acknowledge_infoJSON, "ueNotReachable"); if (ue_not_reachable) { if (!cJSON_IsBool(ue_not_reachable)) { @@ -155,13 +169,22 @@ OpenAPI_acknowledge_info_t *OpenAPI_acknowledge_info_parseFromJSON(cJSON *acknow } } + upu_transparent_container = cJSON_GetObjectItemCaseSensitive(acknowledge_infoJSON, "upuTransparentContainer"); + if (upu_transparent_container) { + if (!cJSON_IsString(upu_transparent_container) && !cJSON_IsNull(upu_transparent_container)) { + ogs_error("OpenAPI_acknowledge_info_parseFromJSON() failed [upu_transparent_container]"); + goto end; + } + } + acknowledge_info_local_var = OpenAPI_acknowledge_info_create ( sor_mac_iue && !cJSON_IsNull(sor_mac_iue) ? ogs_strdup(sor_mac_iue->valuestring) : NULL, upu_mac_iue && !cJSON_IsNull(upu_mac_iue) ? ogs_strdup(upu_mac_iue->valuestring) : NULL, - secured_packet && !cJSON_IsNull(secured_packet) ? ogs_strdup(secured_packet->valuestring) : NULL, ogs_strdup(provisioning_time->valuestring), + sor_transparent_container && !cJSON_IsNull(sor_transparent_container) ? ogs_strdup(sor_transparent_container->valuestring) : NULL, ue_not_reachable ? true : false, - ue_not_reachable ? ue_not_reachable->valueint : 0 + ue_not_reachable ? ue_not_reachable->valueint : 0, + upu_transparent_container && !cJSON_IsNull(upu_transparent_container) ? ogs_strdup(upu_transparent_container->valuestring) : NULL ); return acknowledge_info_local_var; diff --git a/lib/sbi/openapi/model/acknowledge_info.h b/lib/sbi/openapi/model/acknowledge_info.h index 24dc456b8..82db87cdc 100644 --- a/lib/sbi/openapi/model/acknowledge_info.h +++ b/lib/sbi/openapi/model/acknowledge_info.h @@ -21,19 +21,21 @@ typedef struct OpenAPI_acknowledge_info_s OpenAPI_acknowledge_info_t; typedef struct OpenAPI_acknowledge_info_s { char *sor_mac_iue; char *upu_mac_iue; - char *secured_packet; char *provisioning_time; + char *sor_transparent_container; bool is_ue_not_reachable; int ue_not_reachable; + char *upu_transparent_container; } OpenAPI_acknowledge_info_t; OpenAPI_acknowledge_info_t *OpenAPI_acknowledge_info_create( char *sor_mac_iue, char *upu_mac_iue, - char *secured_packet, char *provisioning_time, + char *sor_transparent_container, bool is_ue_not_reachable, - int ue_not_reachable + int ue_not_reachable, + char *upu_transparent_container ); void OpenAPI_acknowledge_info_free(OpenAPI_acknowledge_info_t *acknowledge_info); OpenAPI_acknowledge_info_t *OpenAPI_acknowledge_info_parseFromJSON(cJSON *acknowledge_infoJSON); diff --git a/lib/sbi/openapi/model/acs_info.h b/lib/sbi/openapi/model/acs_info.h index 5de9df37c..08a8866af 100644 --- a/lib/sbi/openapi/model/acs_info.h +++ b/lib/sbi/openapi/model/acs_info.h @@ -1,7 +1,7 @@ /* * acs_info.h * - * + * The ACS information for the 5G-RG is defined in BBF TR-069 [42] or in BBF TR-369 */ #ifndef _OpenAPI_acs_info_H_ diff --git a/lib/sbi/openapi/model/acs_info_1.h b/lib/sbi/openapi/model/acs_info_1.h index dba9bf16b..c8f97f9ee 100644 --- a/lib/sbi/openapi/model/acs_info_1.h +++ b/lib/sbi/openapi/model/acs_info_1.h @@ -1,7 +1,7 @@ /* * acs_info_1.h * - * + * The ACS information for the 5G-RG is defined in BBF TR-069 [42] or in BBF TR-369 */ #ifndef _OpenAPI_acs_info_1_H_ diff --git a/lib/sbi/openapi/model/acs_info_rm.h b/lib/sbi/openapi/model/acs_info_rm.h index 85ae7af94..64fa5c77d 100644 --- a/lib/sbi/openapi/model/acs_info_rm.h +++ b/lib/sbi/openapi/model/acs_info_rm.h @@ -1,7 +1,7 @@ /* * acs_info_rm.h * - * + * This data type is defined in the same way as the 'AcsInfo' data type, but with the OpenAPI 'nullable: true' property. */ #ifndef _OpenAPI_acs_info_rm_H_ diff --git a/lib/sbi/openapi/model/additional_access_info.h b/lib/sbi/openapi/model/additional_access_info.h index 582567f7d..6e0a83caa 100644 --- a/lib/sbi/openapi/model/additional_access_info.h +++ b/lib/sbi/openapi/model/additional_access_info.h @@ -1,7 +1,7 @@ /* * additional_access_info.h * - * + * Indicates the combination of additional Access Type and RAT Type for a MA PDU session. */ #ifndef _OpenAPI_additional_access_info_H_ diff --git a/lib/sbi/openapi/model/additional_ee_subs_info.c b/lib/sbi/openapi/model/additional_ee_subs_info.c new file mode 100644 index 000000000..6ea27a58f --- /dev/null +++ b/lib/sbi/openapi/model/additional_ee_subs_info.c @@ -0,0 +1,209 @@ + +#include +#include +#include +#include "additional_ee_subs_info.h" + +OpenAPI_additional_ee_subs_info_t *OpenAPI_additional_ee_subs_info_create( + OpenAPI_list_t *amf_subscription_info_list, + OpenAPI_smf_subscription_info_t *smf_subscription_info, + OpenAPI_hss_subscription_info_t *hss_subscription_info +) +{ + OpenAPI_additional_ee_subs_info_t *additional_ee_subs_info_local_var = ogs_malloc(sizeof(OpenAPI_additional_ee_subs_info_t)); + ogs_assert(additional_ee_subs_info_local_var); + + additional_ee_subs_info_local_var->amf_subscription_info_list = amf_subscription_info_list; + additional_ee_subs_info_local_var->smf_subscription_info = smf_subscription_info; + additional_ee_subs_info_local_var->hss_subscription_info = hss_subscription_info; + + return additional_ee_subs_info_local_var; +} + +void OpenAPI_additional_ee_subs_info_free(OpenAPI_additional_ee_subs_info_t *additional_ee_subs_info) +{ + OpenAPI_lnode_t *node = NULL; + + if (NULL == additional_ee_subs_info) { + return; + } + if (additional_ee_subs_info->amf_subscription_info_list) { + OpenAPI_list_for_each(additional_ee_subs_info->amf_subscription_info_list, node) { + OpenAPI_amf_subscription_info_free(node->data); + } + OpenAPI_list_free(additional_ee_subs_info->amf_subscription_info_list); + additional_ee_subs_info->amf_subscription_info_list = NULL; + } + if (additional_ee_subs_info->smf_subscription_info) { + OpenAPI_smf_subscription_info_free(additional_ee_subs_info->smf_subscription_info); + additional_ee_subs_info->smf_subscription_info = NULL; + } + if (additional_ee_subs_info->hss_subscription_info) { + OpenAPI_hss_subscription_info_free(additional_ee_subs_info->hss_subscription_info); + additional_ee_subs_info->hss_subscription_info = NULL; + } + ogs_free(additional_ee_subs_info); +} + +cJSON *OpenAPI_additional_ee_subs_info_convertToJSON(OpenAPI_additional_ee_subs_info_t *additional_ee_subs_info) +{ + cJSON *item = NULL; + OpenAPI_lnode_t *node = NULL; + + if (additional_ee_subs_info == NULL) { + ogs_error("OpenAPI_additional_ee_subs_info_convertToJSON() failed [AdditionalEeSubsInfo]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (additional_ee_subs_info->amf_subscription_info_list) { + cJSON *amf_subscription_info_listList = cJSON_AddArrayToObject(item, "amfSubscriptionInfoList"); + if (amf_subscription_info_listList == NULL) { + ogs_error("OpenAPI_additional_ee_subs_info_convertToJSON() failed [amf_subscription_info_list]"); + goto end; + } + OpenAPI_list_for_each(additional_ee_subs_info->amf_subscription_info_list, node) { + cJSON *itemLocal = OpenAPI_amf_subscription_info_convertToJSON(node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_additional_ee_subs_info_convertToJSON() failed [amf_subscription_info_list]"); + goto end; + } + cJSON_AddItemToArray(amf_subscription_info_listList, itemLocal); + } + } + + if (additional_ee_subs_info->smf_subscription_info) { + cJSON *smf_subscription_info_local_JSON = OpenAPI_smf_subscription_info_convertToJSON(additional_ee_subs_info->smf_subscription_info); + if (smf_subscription_info_local_JSON == NULL) { + ogs_error("OpenAPI_additional_ee_subs_info_convertToJSON() failed [smf_subscription_info]"); + goto end; + } + cJSON_AddItemToObject(item, "smfSubscriptionInfo", smf_subscription_info_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_additional_ee_subs_info_convertToJSON() failed [smf_subscription_info]"); + goto end; + } + } + + if (additional_ee_subs_info->hss_subscription_info) { + cJSON *hss_subscription_info_local_JSON = OpenAPI_hss_subscription_info_convertToJSON(additional_ee_subs_info->hss_subscription_info); + if (hss_subscription_info_local_JSON == NULL) { + ogs_error("OpenAPI_additional_ee_subs_info_convertToJSON() failed [hss_subscription_info]"); + goto end; + } + cJSON_AddItemToObject(item, "hssSubscriptionInfo", hss_subscription_info_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_additional_ee_subs_info_convertToJSON() failed [hss_subscription_info]"); + goto end; + } + } + +end: + return item; +} + +OpenAPI_additional_ee_subs_info_t *OpenAPI_additional_ee_subs_info_parseFromJSON(cJSON *additional_ee_subs_infoJSON) +{ + OpenAPI_additional_ee_subs_info_t *additional_ee_subs_info_local_var = NULL; + OpenAPI_lnode_t *node = NULL; + cJSON *amf_subscription_info_list = NULL; + OpenAPI_list_t *amf_subscription_info_listList = NULL; + cJSON *smf_subscription_info = NULL; + OpenAPI_smf_subscription_info_t *smf_subscription_info_local_nonprim = NULL; + cJSON *hss_subscription_info = NULL; + OpenAPI_hss_subscription_info_t *hss_subscription_info_local_nonprim = NULL; + amf_subscription_info_list = cJSON_GetObjectItemCaseSensitive(additional_ee_subs_infoJSON, "amfSubscriptionInfoList"); + if (amf_subscription_info_list) { + cJSON *amf_subscription_info_list_local = NULL; + if (!cJSON_IsArray(amf_subscription_info_list)) { + ogs_error("OpenAPI_additional_ee_subs_info_parseFromJSON() failed [amf_subscription_info_list]"); + goto end; + } + + amf_subscription_info_listList = OpenAPI_list_create(); + + cJSON_ArrayForEach(amf_subscription_info_list_local, amf_subscription_info_list) { + if (!cJSON_IsObject(amf_subscription_info_list_local)) { + ogs_error("OpenAPI_additional_ee_subs_info_parseFromJSON() failed [amf_subscription_info_list]"); + goto end; + } + OpenAPI_amf_subscription_info_t *amf_subscription_info_listItem = OpenAPI_amf_subscription_info_parseFromJSON(amf_subscription_info_list_local); + if (!amf_subscription_info_listItem) { + ogs_error("No amf_subscription_info_listItem"); + OpenAPI_list_free(amf_subscription_info_listList); + goto end; + } + OpenAPI_list_add(amf_subscription_info_listList, amf_subscription_info_listItem); + } + } + + smf_subscription_info = cJSON_GetObjectItemCaseSensitive(additional_ee_subs_infoJSON, "smfSubscriptionInfo"); + if (smf_subscription_info) { + smf_subscription_info_local_nonprim = OpenAPI_smf_subscription_info_parseFromJSON(smf_subscription_info); + } + + hss_subscription_info = cJSON_GetObjectItemCaseSensitive(additional_ee_subs_infoJSON, "hssSubscriptionInfo"); + if (hss_subscription_info) { + hss_subscription_info_local_nonprim = OpenAPI_hss_subscription_info_parseFromJSON(hss_subscription_info); + } + + additional_ee_subs_info_local_var = OpenAPI_additional_ee_subs_info_create ( + amf_subscription_info_list ? amf_subscription_info_listList : NULL, + smf_subscription_info ? smf_subscription_info_local_nonprim : NULL, + hss_subscription_info ? hss_subscription_info_local_nonprim : NULL + ); + + return additional_ee_subs_info_local_var; +end: + if (amf_subscription_info_listList) { + OpenAPI_list_for_each(amf_subscription_info_listList, node) { + OpenAPI_amf_subscription_info_free(node->data); + } + OpenAPI_list_free(amf_subscription_info_listList); + amf_subscription_info_listList = NULL; + } + if (smf_subscription_info_local_nonprim) { + OpenAPI_smf_subscription_info_free(smf_subscription_info_local_nonprim); + smf_subscription_info_local_nonprim = NULL; + } + if (hss_subscription_info_local_nonprim) { + OpenAPI_hss_subscription_info_free(hss_subscription_info_local_nonprim); + hss_subscription_info_local_nonprim = NULL; + } + return NULL; +} + +OpenAPI_additional_ee_subs_info_t *OpenAPI_additional_ee_subs_info_copy(OpenAPI_additional_ee_subs_info_t *dst, OpenAPI_additional_ee_subs_info_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_additional_ee_subs_info_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_additional_ee_subs_info_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_additional_ee_subs_info_free(dst); + dst = OpenAPI_additional_ee_subs_info_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/additional_ee_subs_info.h b/lib/sbi/openapi/model/additional_ee_subs_info.h new file mode 100644 index 000000000..cb9f641f5 --- /dev/null +++ b/lib/sbi/openapi/model/additional_ee_subs_info.h @@ -0,0 +1,45 @@ +/* + * additional_ee_subs_info.h + * + * + */ + +#ifndef _OpenAPI_additional_ee_subs_info_H_ +#define _OpenAPI_additional_ee_subs_info_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "amf_subscription_info.h" +#include "hss_subscription_info.h" +#include "smf_subscription_info.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_additional_ee_subs_info_s OpenAPI_additional_ee_subs_info_t; +typedef struct OpenAPI_additional_ee_subs_info_s { + OpenAPI_list_t *amf_subscription_info_list; + struct OpenAPI_smf_subscription_info_s *smf_subscription_info; + struct OpenAPI_hss_subscription_info_s *hss_subscription_info; +} OpenAPI_additional_ee_subs_info_t; + +OpenAPI_additional_ee_subs_info_t *OpenAPI_additional_ee_subs_info_create( + OpenAPI_list_t *amf_subscription_info_list, + OpenAPI_smf_subscription_info_t *smf_subscription_info, + OpenAPI_hss_subscription_info_t *hss_subscription_info +); +void OpenAPI_additional_ee_subs_info_free(OpenAPI_additional_ee_subs_info_t *additional_ee_subs_info); +OpenAPI_additional_ee_subs_info_t *OpenAPI_additional_ee_subs_info_parseFromJSON(cJSON *additional_ee_subs_infoJSON); +cJSON *OpenAPI_additional_ee_subs_info_convertToJSON(OpenAPI_additional_ee_subs_info_t *additional_ee_subs_info); +OpenAPI_additional_ee_subs_info_t *OpenAPI_additional_ee_subs_info_copy(OpenAPI_additional_ee_subs_info_t *dst, OpenAPI_additional_ee_subs_info_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_additional_ee_subs_info_H_ */ + diff --git a/lib/sbi/openapi/model/additional_measurement.c b/lib/sbi/openapi/model/additional_measurement.c new file mode 100644 index 000000000..100f58184 --- /dev/null +++ b/lib/sbi/openapi/model/additional_measurement.c @@ -0,0 +1,345 @@ + +#include +#include +#include +#include "additional_measurement.h" + +OpenAPI_additional_measurement_t *OpenAPI_additional_measurement_create( + OpenAPI_network_area_info_t *unexp_loc, + OpenAPI_list_t *unexp_flow_teps, + OpenAPI_list_t *unexp_wakes, + OpenAPI_address_list_t *ddos_attack, + OpenAPI_address_list_t *wrg_dest, + OpenAPI_list_t *circums +) +{ + OpenAPI_additional_measurement_t *additional_measurement_local_var = ogs_malloc(sizeof(OpenAPI_additional_measurement_t)); + ogs_assert(additional_measurement_local_var); + + additional_measurement_local_var->unexp_loc = unexp_loc; + additional_measurement_local_var->unexp_flow_teps = unexp_flow_teps; + additional_measurement_local_var->unexp_wakes = unexp_wakes; + additional_measurement_local_var->ddos_attack = ddos_attack; + additional_measurement_local_var->wrg_dest = wrg_dest; + additional_measurement_local_var->circums = circums; + + return additional_measurement_local_var; +} + +void OpenAPI_additional_measurement_free(OpenAPI_additional_measurement_t *additional_measurement) +{ + OpenAPI_lnode_t *node = NULL; + + if (NULL == additional_measurement) { + return; + } + if (additional_measurement->unexp_loc) { + OpenAPI_network_area_info_free(additional_measurement->unexp_loc); + additional_measurement->unexp_loc = NULL; + } + if (additional_measurement->unexp_flow_teps) { + OpenAPI_list_for_each(additional_measurement->unexp_flow_teps, node) { + OpenAPI_ip_eth_flow_description_free(node->data); + } + OpenAPI_list_free(additional_measurement->unexp_flow_teps); + additional_measurement->unexp_flow_teps = NULL; + } + if (additional_measurement->unexp_wakes) { + OpenAPI_list_for_each(additional_measurement->unexp_wakes, node) { + ogs_free(node->data); + } + OpenAPI_list_free(additional_measurement->unexp_wakes); + additional_measurement->unexp_wakes = NULL; + } + if (additional_measurement->ddos_attack) { + OpenAPI_address_list_free(additional_measurement->ddos_attack); + additional_measurement->ddos_attack = NULL; + } + if (additional_measurement->wrg_dest) { + OpenAPI_address_list_free(additional_measurement->wrg_dest); + additional_measurement->wrg_dest = NULL; + } + if (additional_measurement->circums) { + OpenAPI_list_for_each(additional_measurement->circums, node) { + OpenAPI_circumstance_description_free(node->data); + } + OpenAPI_list_free(additional_measurement->circums); + additional_measurement->circums = NULL; + } + ogs_free(additional_measurement); +} + +cJSON *OpenAPI_additional_measurement_convertToJSON(OpenAPI_additional_measurement_t *additional_measurement) +{ + cJSON *item = NULL; + OpenAPI_lnode_t *node = NULL; + + if (additional_measurement == NULL) { + ogs_error("OpenAPI_additional_measurement_convertToJSON() failed [AdditionalMeasurement]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (additional_measurement->unexp_loc) { + cJSON *unexp_loc_local_JSON = OpenAPI_network_area_info_convertToJSON(additional_measurement->unexp_loc); + if (unexp_loc_local_JSON == NULL) { + ogs_error("OpenAPI_additional_measurement_convertToJSON() failed [unexp_loc]"); + goto end; + } + cJSON_AddItemToObject(item, "unexpLoc", unexp_loc_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_additional_measurement_convertToJSON() failed [unexp_loc]"); + goto end; + } + } + + if (additional_measurement->unexp_flow_teps) { + cJSON *unexp_flow_tepsList = cJSON_AddArrayToObject(item, "unexpFlowTeps"); + if (unexp_flow_tepsList == NULL) { + ogs_error("OpenAPI_additional_measurement_convertToJSON() failed [unexp_flow_teps]"); + goto end; + } + OpenAPI_list_for_each(additional_measurement->unexp_flow_teps, node) { + cJSON *itemLocal = OpenAPI_ip_eth_flow_description_convertToJSON(node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_additional_measurement_convertToJSON() failed [unexp_flow_teps]"); + goto end; + } + cJSON_AddItemToArray(unexp_flow_tepsList, itemLocal); + } + } + + if (additional_measurement->unexp_wakes) { + cJSON *unexp_wakesList = cJSON_AddArrayToObject(item, "unexpWakes"); + if (unexp_wakesList == NULL) { + ogs_error("OpenAPI_additional_measurement_convertToJSON() failed [unexp_wakes]"); + goto end; + } + OpenAPI_list_for_each(additional_measurement->unexp_wakes, node) { + } + } + + if (additional_measurement->ddos_attack) { + cJSON *ddos_attack_local_JSON = OpenAPI_address_list_convertToJSON(additional_measurement->ddos_attack); + if (ddos_attack_local_JSON == NULL) { + ogs_error("OpenAPI_additional_measurement_convertToJSON() failed [ddos_attack]"); + goto end; + } + cJSON_AddItemToObject(item, "ddosAttack", ddos_attack_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_additional_measurement_convertToJSON() failed [ddos_attack]"); + goto end; + } + } + + if (additional_measurement->wrg_dest) { + cJSON *wrg_dest_local_JSON = OpenAPI_address_list_convertToJSON(additional_measurement->wrg_dest); + if (wrg_dest_local_JSON == NULL) { + ogs_error("OpenAPI_additional_measurement_convertToJSON() failed [wrg_dest]"); + goto end; + } + cJSON_AddItemToObject(item, "wrgDest", wrg_dest_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_additional_measurement_convertToJSON() failed [wrg_dest]"); + goto end; + } + } + + if (additional_measurement->circums) { + cJSON *circumsList = cJSON_AddArrayToObject(item, "circums"); + if (circumsList == NULL) { + ogs_error("OpenAPI_additional_measurement_convertToJSON() failed [circums]"); + goto end; + } + OpenAPI_list_for_each(additional_measurement->circums, node) { + cJSON *itemLocal = OpenAPI_circumstance_description_convertToJSON(node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_additional_measurement_convertToJSON() failed [circums]"); + goto end; + } + cJSON_AddItemToArray(circumsList, itemLocal); + } + } + +end: + return item; +} + +OpenAPI_additional_measurement_t *OpenAPI_additional_measurement_parseFromJSON(cJSON *additional_measurementJSON) +{ + OpenAPI_additional_measurement_t *additional_measurement_local_var = NULL; + OpenAPI_lnode_t *node = NULL; + cJSON *unexp_loc = NULL; + OpenAPI_network_area_info_t *unexp_loc_local_nonprim = NULL; + cJSON *unexp_flow_teps = NULL; + OpenAPI_list_t *unexp_flow_tepsList = NULL; + cJSON *unexp_wakes = NULL; + OpenAPI_list_t *unexp_wakesList = NULL; + cJSON *ddos_attack = NULL; + OpenAPI_address_list_t *ddos_attack_local_nonprim = NULL; + cJSON *wrg_dest = NULL; + OpenAPI_address_list_t *wrg_dest_local_nonprim = NULL; + cJSON *circums = NULL; + OpenAPI_list_t *circumsList = NULL; + unexp_loc = cJSON_GetObjectItemCaseSensitive(additional_measurementJSON, "unexpLoc"); + if (unexp_loc) { + unexp_loc_local_nonprim = OpenAPI_network_area_info_parseFromJSON(unexp_loc); + } + + unexp_flow_teps = cJSON_GetObjectItemCaseSensitive(additional_measurementJSON, "unexpFlowTeps"); + if (unexp_flow_teps) { + cJSON *unexp_flow_teps_local = NULL; + if (!cJSON_IsArray(unexp_flow_teps)) { + ogs_error("OpenAPI_additional_measurement_parseFromJSON() failed [unexp_flow_teps]"); + goto end; + } + + unexp_flow_tepsList = OpenAPI_list_create(); + + cJSON_ArrayForEach(unexp_flow_teps_local, unexp_flow_teps) { + if (!cJSON_IsObject(unexp_flow_teps_local)) { + ogs_error("OpenAPI_additional_measurement_parseFromJSON() failed [unexp_flow_teps]"); + goto end; + } + OpenAPI_ip_eth_flow_description_t *unexp_flow_tepsItem = OpenAPI_ip_eth_flow_description_parseFromJSON(unexp_flow_teps_local); + if (!unexp_flow_tepsItem) { + ogs_error("No unexp_flow_tepsItem"); + OpenAPI_list_free(unexp_flow_tepsList); + goto end; + } + OpenAPI_list_add(unexp_flow_tepsList, unexp_flow_tepsItem); + } + } + + unexp_wakes = cJSON_GetObjectItemCaseSensitive(additional_measurementJSON, "unexpWakes"); + if (unexp_wakes) { + cJSON *unexp_wakes_local = NULL; + if (!cJSON_IsArray(unexp_wakes)) { + ogs_error("OpenAPI_additional_measurement_parseFromJSON() failed [unexp_wakes]"); + goto end; + } + + unexp_wakesList = OpenAPI_list_create(); + + cJSON_ArrayForEach(unexp_wakes_local, unexp_wakes) { + double *localDouble = NULL; + int *localInt = NULL; + } + } + + ddos_attack = cJSON_GetObjectItemCaseSensitive(additional_measurementJSON, "ddosAttack"); + if (ddos_attack) { + ddos_attack_local_nonprim = OpenAPI_address_list_parseFromJSON(ddos_attack); + } + + wrg_dest = cJSON_GetObjectItemCaseSensitive(additional_measurementJSON, "wrgDest"); + if (wrg_dest) { + wrg_dest_local_nonprim = OpenAPI_address_list_parseFromJSON(wrg_dest); + } + + circums = cJSON_GetObjectItemCaseSensitive(additional_measurementJSON, "circums"); + if (circums) { + cJSON *circums_local = NULL; + if (!cJSON_IsArray(circums)) { + ogs_error("OpenAPI_additional_measurement_parseFromJSON() failed [circums]"); + goto end; + } + + circumsList = OpenAPI_list_create(); + + cJSON_ArrayForEach(circums_local, circums) { + if (!cJSON_IsObject(circums_local)) { + ogs_error("OpenAPI_additional_measurement_parseFromJSON() failed [circums]"); + goto end; + } + OpenAPI_circumstance_description_t *circumsItem = OpenAPI_circumstance_description_parseFromJSON(circums_local); + if (!circumsItem) { + ogs_error("No circumsItem"); + OpenAPI_list_free(circumsList); + goto end; + } + OpenAPI_list_add(circumsList, circumsItem); + } + } + + additional_measurement_local_var = OpenAPI_additional_measurement_create ( + unexp_loc ? unexp_loc_local_nonprim : NULL, + unexp_flow_teps ? unexp_flow_tepsList : NULL, + unexp_wakes ? unexp_wakesList : NULL, + ddos_attack ? ddos_attack_local_nonprim : NULL, + wrg_dest ? wrg_dest_local_nonprim : NULL, + circums ? circumsList : NULL + ); + + return additional_measurement_local_var; +end: + if (unexp_loc_local_nonprim) { + OpenAPI_network_area_info_free(unexp_loc_local_nonprim); + unexp_loc_local_nonprim = NULL; + } + if (unexp_flow_tepsList) { + OpenAPI_list_for_each(unexp_flow_tepsList, node) { + OpenAPI_ip_eth_flow_description_free(node->data); + } + OpenAPI_list_free(unexp_flow_tepsList); + unexp_flow_tepsList = NULL; + } + if (unexp_wakesList) { + OpenAPI_list_for_each(unexp_wakesList, node) { + ogs_free(node->data); + } + OpenAPI_list_free(unexp_wakesList); + unexp_wakesList = NULL; + } + if (ddos_attack_local_nonprim) { + OpenAPI_address_list_free(ddos_attack_local_nonprim); + ddos_attack_local_nonprim = NULL; + } + if (wrg_dest_local_nonprim) { + OpenAPI_address_list_free(wrg_dest_local_nonprim); + wrg_dest_local_nonprim = NULL; + } + if (circumsList) { + OpenAPI_list_for_each(circumsList, node) { + OpenAPI_circumstance_description_free(node->data); + } + OpenAPI_list_free(circumsList); + circumsList = NULL; + } + return NULL; +} + +OpenAPI_additional_measurement_t *OpenAPI_additional_measurement_copy(OpenAPI_additional_measurement_t *dst, OpenAPI_additional_measurement_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_additional_measurement_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_additional_measurement_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_additional_measurement_free(dst); + dst = OpenAPI_additional_measurement_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/additional_measurement.h b/lib/sbi/openapi/model/additional_measurement.h new file mode 100644 index 000000000..302577d36 --- /dev/null +++ b/lib/sbi/openapi/model/additional_measurement.h @@ -0,0 +1,52 @@ +/* + * additional_measurement.h + * + * Represents additional measurement information. + */ + +#ifndef _OpenAPI_additional_measurement_H_ +#define _OpenAPI_additional_measurement_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "address_list.h" +#include "circumstance_description.h" +#include "ip_eth_flow_description.h" +#include "network_area_info.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_additional_measurement_s OpenAPI_additional_measurement_t; +typedef struct OpenAPI_additional_measurement_s { + struct OpenAPI_network_area_info_s *unexp_loc; + OpenAPI_list_t *unexp_flow_teps; + OpenAPI_list_t *unexp_wakes; + struct OpenAPI_address_list_s *ddos_attack; + struct OpenAPI_address_list_s *wrg_dest; + OpenAPI_list_t *circums; +} OpenAPI_additional_measurement_t; + +OpenAPI_additional_measurement_t *OpenAPI_additional_measurement_create( + OpenAPI_network_area_info_t *unexp_loc, + OpenAPI_list_t *unexp_flow_teps, + OpenAPI_list_t *unexp_wakes, + OpenAPI_address_list_t *ddos_attack, + OpenAPI_address_list_t *wrg_dest, + OpenAPI_list_t *circums +); +void OpenAPI_additional_measurement_free(OpenAPI_additional_measurement_t *additional_measurement); +OpenAPI_additional_measurement_t *OpenAPI_additional_measurement_parseFromJSON(cJSON *additional_measurementJSON); +cJSON *OpenAPI_additional_measurement_convertToJSON(OpenAPI_additional_measurement_t *additional_measurement); +OpenAPI_additional_measurement_t *OpenAPI_additional_measurement_copy(OpenAPI_additional_measurement_t *dst, OpenAPI_additional_measurement_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_additional_measurement_H_ */ + diff --git a/lib/sbi/openapi/model/additional_snssai_data.c b/lib/sbi/openapi/model/additional_snssai_data.c index 1b085a4cc..99152be3e 100644 --- a/lib/sbi/openapi/model/additional_snssai_data.c +++ b/lib/sbi/openapi/model/additional_snssai_data.c @@ -6,7 +6,9 @@ OpenAPI_additional_snssai_data_t *OpenAPI_additional_snssai_data_create( bool is_required_authn_authz, - int required_authn_authz + int required_authn_authz, + OpenAPI_slice_mbr_rm_t *subscribed_ue_slice_mbr, + OpenAPI_list_t *subscribed_ns_srg_list ) { OpenAPI_additional_snssai_data_t *additional_snssai_data_local_var = ogs_malloc(sizeof(OpenAPI_additional_snssai_data_t)); @@ -14,6 +16,8 @@ OpenAPI_additional_snssai_data_t *OpenAPI_additional_snssai_data_create( additional_snssai_data_local_var->is_required_authn_authz = is_required_authn_authz; additional_snssai_data_local_var->required_authn_authz = required_authn_authz; + additional_snssai_data_local_var->subscribed_ue_slice_mbr = subscribed_ue_slice_mbr; + additional_snssai_data_local_var->subscribed_ns_srg_list = subscribed_ns_srg_list; return additional_snssai_data_local_var; } @@ -25,6 +29,17 @@ void OpenAPI_additional_snssai_data_free(OpenAPI_additional_snssai_data_t *addit if (NULL == additional_snssai_data) { return; } + if (additional_snssai_data->subscribed_ue_slice_mbr) { + OpenAPI_slice_mbr_rm_free(additional_snssai_data->subscribed_ue_slice_mbr); + additional_snssai_data->subscribed_ue_slice_mbr = NULL; + } + if (additional_snssai_data->subscribed_ns_srg_list) { + OpenAPI_list_for_each(additional_snssai_data->subscribed_ns_srg_list, node) { + ogs_free(node->data); + } + OpenAPI_list_free(additional_snssai_data->subscribed_ns_srg_list); + additional_snssai_data->subscribed_ns_srg_list = NULL; + } ogs_free(additional_snssai_data); } @@ -46,6 +61,33 @@ cJSON *OpenAPI_additional_snssai_data_convertToJSON(OpenAPI_additional_snssai_da } } + if (additional_snssai_data->subscribed_ue_slice_mbr) { + cJSON *subscribed_ue_slice_mbr_local_JSON = OpenAPI_slice_mbr_rm_convertToJSON(additional_snssai_data->subscribed_ue_slice_mbr); + if (subscribed_ue_slice_mbr_local_JSON == NULL) { + ogs_error("OpenAPI_additional_snssai_data_convertToJSON() failed [subscribed_ue_slice_mbr]"); + goto end; + } + cJSON_AddItemToObject(item, "subscribedUeSliceMbr", subscribed_ue_slice_mbr_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_additional_snssai_data_convertToJSON() failed [subscribed_ue_slice_mbr]"); + goto end; + } + } + + if (additional_snssai_data->subscribed_ns_srg_list) { + cJSON *subscribed_ns_srg_listList = cJSON_AddArrayToObject(item, "subscribedNsSrgList"); + if (subscribed_ns_srg_listList == NULL) { + ogs_error("OpenAPI_additional_snssai_data_convertToJSON() failed [subscribed_ns_srg_list]"); + goto end; + } + OpenAPI_list_for_each(additional_snssai_data->subscribed_ns_srg_list, node) { + if (cJSON_AddStringToObject(subscribed_ns_srg_listList, "", (char*)node->data) == NULL) { + ogs_error("OpenAPI_additional_snssai_data_convertToJSON() failed [subscribed_ns_srg_list]"); + goto end; + } + } + } + end: return item; } @@ -55,6 +97,10 @@ OpenAPI_additional_snssai_data_t *OpenAPI_additional_snssai_data_parseFromJSON(c OpenAPI_additional_snssai_data_t *additional_snssai_data_local_var = NULL; OpenAPI_lnode_t *node = NULL; cJSON *required_authn_authz = NULL; + cJSON *subscribed_ue_slice_mbr = NULL; + OpenAPI_slice_mbr_rm_t *subscribed_ue_slice_mbr_local_nonprim = NULL; + cJSON *subscribed_ns_srg_list = NULL; + OpenAPI_list_t *subscribed_ns_srg_listList = NULL; required_authn_authz = cJSON_GetObjectItemCaseSensitive(additional_snssai_dataJSON, "requiredAuthnAuthz"); if (required_authn_authz) { if (!cJSON_IsBool(required_authn_authz)) { @@ -63,13 +109,52 @@ OpenAPI_additional_snssai_data_t *OpenAPI_additional_snssai_data_parseFromJSON(c } } + subscribed_ue_slice_mbr = cJSON_GetObjectItemCaseSensitive(additional_snssai_dataJSON, "subscribedUeSliceMbr"); + if (subscribed_ue_slice_mbr) { + subscribed_ue_slice_mbr_local_nonprim = OpenAPI_slice_mbr_rm_parseFromJSON(subscribed_ue_slice_mbr); + } + + subscribed_ns_srg_list = cJSON_GetObjectItemCaseSensitive(additional_snssai_dataJSON, "subscribedNsSrgList"); + if (subscribed_ns_srg_list) { + cJSON *subscribed_ns_srg_list_local = NULL; + if (!cJSON_IsArray(subscribed_ns_srg_list)) { + ogs_error("OpenAPI_additional_snssai_data_parseFromJSON() failed [subscribed_ns_srg_list]"); + goto end; + } + + subscribed_ns_srg_listList = OpenAPI_list_create(); + + cJSON_ArrayForEach(subscribed_ns_srg_list_local, subscribed_ns_srg_list) { + double *localDouble = NULL; + int *localInt = NULL; + if (!cJSON_IsString(subscribed_ns_srg_list_local)) { + ogs_error("OpenAPI_additional_snssai_data_parseFromJSON() failed [subscribed_ns_srg_list]"); + goto end; + } + OpenAPI_list_add(subscribed_ns_srg_listList, ogs_strdup(subscribed_ns_srg_list_local->valuestring)); + } + } + additional_snssai_data_local_var = OpenAPI_additional_snssai_data_create ( required_authn_authz ? true : false, - required_authn_authz ? required_authn_authz->valueint : 0 + required_authn_authz ? required_authn_authz->valueint : 0, + subscribed_ue_slice_mbr ? subscribed_ue_slice_mbr_local_nonprim : NULL, + subscribed_ns_srg_list ? subscribed_ns_srg_listList : NULL ); return additional_snssai_data_local_var; end: + if (subscribed_ue_slice_mbr_local_nonprim) { + OpenAPI_slice_mbr_rm_free(subscribed_ue_slice_mbr_local_nonprim); + subscribed_ue_slice_mbr_local_nonprim = NULL; + } + if (subscribed_ns_srg_listList) { + OpenAPI_list_for_each(subscribed_ns_srg_listList, node) { + ogs_free(node->data); + } + OpenAPI_list_free(subscribed_ns_srg_listList); + subscribed_ns_srg_listList = NULL; + } return NULL; } diff --git a/lib/sbi/openapi/model/additional_snssai_data.h b/lib/sbi/openapi/model/additional_snssai_data.h index a6abb469c..fc3da6347 100644 --- a/lib/sbi/openapi/model/additional_snssai_data.h +++ b/lib/sbi/openapi/model/additional_snssai_data.h @@ -12,6 +12,7 @@ #include "../include/list.h" #include "../include/keyValuePair.h" #include "../include/binary.h" +#include "slice_mbr_rm.h" #ifdef __cplusplus extern "C" { @@ -21,11 +22,15 @@ typedef struct OpenAPI_additional_snssai_data_s OpenAPI_additional_snssai_data_t typedef struct OpenAPI_additional_snssai_data_s { bool is_required_authn_authz; int required_authn_authz; + struct OpenAPI_slice_mbr_rm_s *subscribed_ue_slice_mbr; + OpenAPI_list_t *subscribed_ns_srg_list; } OpenAPI_additional_snssai_data_t; OpenAPI_additional_snssai_data_t *OpenAPI_additional_snssai_data_create( bool is_required_authn_authz, - int required_authn_authz + int required_authn_authz, + OpenAPI_slice_mbr_rm_t *subscribed_ue_slice_mbr, + OpenAPI_list_t *subscribed_ns_srg_list ); void OpenAPI_additional_snssai_data_free(OpenAPI_additional_snssai_data_t *additional_snssai_data); OpenAPI_additional_snssai_data_t *OpenAPI_additional_snssai_data_parseFromJSON(cJSON *additional_snssai_dataJSON); diff --git a/lib/sbi/openapi/model/additional_snssai_data_1.c b/lib/sbi/openapi/model/additional_snssai_data_1.c new file mode 100644 index 000000000..eb57d7b63 --- /dev/null +++ b/lib/sbi/openapi/model/additional_snssai_data_1.c @@ -0,0 +1,194 @@ + +#include +#include +#include +#include "additional_snssai_data_1.h" + +OpenAPI_additional_snssai_data_1_t *OpenAPI_additional_snssai_data_1_create( + bool is_required_authn_authz, + int required_authn_authz, + OpenAPI_slice_mbr_rm_t *subscribed_ue_slice_mbr, + OpenAPI_list_t *subscribed_ns_srg_list +) +{ + OpenAPI_additional_snssai_data_1_t *additional_snssai_data_1_local_var = ogs_malloc(sizeof(OpenAPI_additional_snssai_data_1_t)); + ogs_assert(additional_snssai_data_1_local_var); + + additional_snssai_data_1_local_var->is_required_authn_authz = is_required_authn_authz; + additional_snssai_data_1_local_var->required_authn_authz = required_authn_authz; + additional_snssai_data_1_local_var->subscribed_ue_slice_mbr = subscribed_ue_slice_mbr; + additional_snssai_data_1_local_var->subscribed_ns_srg_list = subscribed_ns_srg_list; + + return additional_snssai_data_1_local_var; +} + +void OpenAPI_additional_snssai_data_1_free(OpenAPI_additional_snssai_data_1_t *additional_snssai_data_1) +{ + OpenAPI_lnode_t *node = NULL; + + if (NULL == additional_snssai_data_1) { + return; + } + if (additional_snssai_data_1->subscribed_ue_slice_mbr) { + OpenAPI_slice_mbr_rm_free(additional_snssai_data_1->subscribed_ue_slice_mbr); + additional_snssai_data_1->subscribed_ue_slice_mbr = NULL; + } + if (additional_snssai_data_1->subscribed_ns_srg_list) { + OpenAPI_list_for_each(additional_snssai_data_1->subscribed_ns_srg_list, node) { + ogs_free(node->data); + } + OpenAPI_list_free(additional_snssai_data_1->subscribed_ns_srg_list); + additional_snssai_data_1->subscribed_ns_srg_list = NULL; + } + ogs_free(additional_snssai_data_1); +} + +cJSON *OpenAPI_additional_snssai_data_1_convertToJSON(OpenAPI_additional_snssai_data_1_t *additional_snssai_data_1) +{ + cJSON *item = NULL; + OpenAPI_lnode_t *node = NULL; + + if (additional_snssai_data_1 == NULL) { + ogs_error("OpenAPI_additional_snssai_data_1_convertToJSON() failed [AdditionalSnssaiData_1]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (additional_snssai_data_1->is_required_authn_authz) { + if (cJSON_AddBoolToObject(item, "requiredAuthnAuthz", additional_snssai_data_1->required_authn_authz) == NULL) { + ogs_error("OpenAPI_additional_snssai_data_1_convertToJSON() failed [required_authn_authz]"); + goto end; + } + } + + if (additional_snssai_data_1->subscribed_ue_slice_mbr) { + cJSON *subscribed_ue_slice_mbr_local_JSON = OpenAPI_slice_mbr_rm_convertToJSON(additional_snssai_data_1->subscribed_ue_slice_mbr); + if (subscribed_ue_slice_mbr_local_JSON == NULL) { + ogs_error("OpenAPI_additional_snssai_data_1_convertToJSON() failed [subscribed_ue_slice_mbr]"); + goto end; + } + cJSON_AddItemToObject(item, "subscribedUeSliceMbr", subscribed_ue_slice_mbr_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_additional_snssai_data_1_convertToJSON() failed [subscribed_ue_slice_mbr]"); + goto end; + } + } + + if (additional_snssai_data_1->subscribed_ns_srg_list) { + cJSON *subscribed_ns_srg_listList = cJSON_AddArrayToObject(item, "subscribedNsSrgList"); + if (subscribed_ns_srg_listList == NULL) { + ogs_error("OpenAPI_additional_snssai_data_1_convertToJSON() failed [subscribed_ns_srg_list]"); + goto end; + } + OpenAPI_list_for_each(additional_snssai_data_1->subscribed_ns_srg_list, node) { + if (cJSON_AddStringToObject(subscribed_ns_srg_listList, "", (char*)node->data) == NULL) { + ogs_error("OpenAPI_additional_snssai_data_1_convertToJSON() failed [subscribed_ns_srg_list]"); + goto end; + } + } + } + +end: + return item; +} + +OpenAPI_additional_snssai_data_1_t *OpenAPI_additional_snssai_data_1_parseFromJSON(cJSON *additional_snssai_data_1JSON) +{ + OpenAPI_additional_snssai_data_1_t *additional_snssai_data_1_local_var = NULL; + OpenAPI_lnode_t *node = NULL; + cJSON *required_authn_authz = NULL; + cJSON *subscribed_ue_slice_mbr = NULL; + OpenAPI_slice_mbr_rm_t *subscribed_ue_slice_mbr_local_nonprim = NULL; + cJSON *subscribed_ns_srg_list = NULL; + OpenAPI_list_t *subscribed_ns_srg_listList = NULL; + required_authn_authz = cJSON_GetObjectItemCaseSensitive(additional_snssai_data_1JSON, "requiredAuthnAuthz"); + if (required_authn_authz) { + if (!cJSON_IsBool(required_authn_authz)) { + ogs_error("OpenAPI_additional_snssai_data_1_parseFromJSON() failed [required_authn_authz]"); + goto end; + } + } + + subscribed_ue_slice_mbr = cJSON_GetObjectItemCaseSensitive(additional_snssai_data_1JSON, "subscribedUeSliceMbr"); + if (subscribed_ue_slice_mbr) { + subscribed_ue_slice_mbr_local_nonprim = OpenAPI_slice_mbr_rm_parseFromJSON(subscribed_ue_slice_mbr); + } + + subscribed_ns_srg_list = cJSON_GetObjectItemCaseSensitive(additional_snssai_data_1JSON, "subscribedNsSrgList"); + if (subscribed_ns_srg_list) { + cJSON *subscribed_ns_srg_list_local = NULL; + if (!cJSON_IsArray(subscribed_ns_srg_list)) { + ogs_error("OpenAPI_additional_snssai_data_1_parseFromJSON() failed [subscribed_ns_srg_list]"); + goto end; + } + + subscribed_ns_srg_listList = OpenAPI_list_create(); + + cJSON_ArrayForEach(subscribed_ns_srg_list_local, subscribed_ns_srg_list) { + double *localDouble = NULL; + int *localInt = NULL; + if (!cJSON_IsString(subscribed_ns_srg_list_local)) { + ogs_error("OpenAPI_additional_snssai_data_1_parseFromJSON() failed [subscribed_ns_srg_list]"); + goto end; + } + OpenAPI_list_add(subscribed_ns_srg_listList, ogs_strdup(subscribed_ns_srg_list_local->valuestring)); + } + } + + additional_snssai_data_1_local_var = OpenAPI_additional_snssai_data_1_create ( + required_authn_authz ? true : false, + required_authn_authz ? required_authn_authz->valueint : 0, + subscribed_ue_slice_mbr ? subscribed_ue_slice_mbr_local_nonprim : NULL, + subscribed_ns_srg_list ? subscribed_ns_srg_listList : NULL + ); + + return additional_snssai_data_1_local_var; +end: + if (subscribed_ue_slice_mbr_local_nonprim) { + OpenAPI_slice_mbr_rm_free(subscribed_ue_slice_mbr_local_nonprim); + subscribed_ue_slice_mbr_local_nonprim = NULL; + } + if (subscribed_ns_srg_listList) { + OpenAPI_list_for_each(subscribed_ns_srg_listList, node) { + ogs_free(node->data); + } + OpenAPI_list_free(subscribed_ns_srg_listList); + subscribed_ns_srg_listList = NULL; + } + return NULL; +} + +OpenAPI_additional_snssai_data_1_t *OpenAPI_additional_snssai_data_1_copy(OpenAPI_additional_snssai_data_1_t *dst, OpenAPI_additional_snssai_data_1_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_additional_snssai_data_1_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_additional_snssai_data_1_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_additional_snssai_data_1_free(dst); + dst = OpenAPI_additional_snssai_data_1_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/additional_snssai_data_1.h b/lib/sbi/openapi/model/additional_snssai_data_1.h new file mode 100644 index 000000000..ee0adc2e8 --- /dev/null +++ b/lib/sbi/openapi/model/additional_snssai_data_1.h @@ -0,0 +1,45 @@ +/* + * additional_snssai_data_1.h + * + * + */ + +#ifndef _OpenAPI_additional_snssai_data_1_H_ +#define _OpenAPI_additional_snssai_data_1_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "slice_mbr_rm.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_additional_snssai_data_1_s OpenAPI_additional_snssai_data_1_t; +typedef struct OpenAPI_additional_snssai_data_1_s { + bool is_required_authn_authz; + int required_authn_authz; + struct OpenAPI_slice_mbr_rm_s *subscribed_ue_slice_mbr; + OpenAPI_list_t *subscribed_ns_srg_list; +} OpenAPI_additional_snssai_data_1_t; + +OpenAPI_additional_snssai_data_1_t *OpenAPI_additional_snssai_data_1_create( + bool is_required_authn_authz, + int required_authn_authz, + OpenAPI_slice_mbr_rm_t *subscribed_ue_slice_mbr, + OpenAPI_list_t *subscribed_ns_srg_list +); +void OpenAPI_additional_snssai_data_1_free(OpenAPI_additional_snssai_data_1_t *additional_snssai_data_1); +OpenAPI_additional_snssai_data_1_t *OpenAPI_additional_snssai_data_1_parseFromJSON(cJSON *additional_snssai_data_1JSON); +cJSON *OpenAPI_additional_snssai_data_1_convertToJSON(OpenAPI_additional_snssai_data_1_t *additional_snssai_data_1); +OpenAPI_additional_snssai_data_1_t *OpenAPI_additional_snssai_data_1_copy(OpenAPI_additional_snssai_data_1_t *dst, OpenAPI_additional_snssai_data_1_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_additional_snssai_data_1_H_ */ + diff --git a/lib/sbi/openapi/model/addr_fqdn.c b/lib/sbi/openapi/model/addr_fqdn.c new file mode 100644 index 000000000..77c2018bf --- /dev/null +++ b/lib/sbi/openapi/model/addr_fqdn.c @@ -0,0 +1,141 @@ + +#include +#include +#include +#include "addr_fqdn.h" + +OpenAPI_addr_fqdn_t *OpenAPI_addr_fqdn_create( + OpenAPI_ip_addr_t *ip_addr, + char *fqdn +) +{ + OpenAPI_addr_fqdn_t *addr_fqdn_local_var = ogs_malloc(sizeof(OpenAPI_addr_fqdn_t)); + ogs_assert(addr_fqdn_local_var); + + addr_fqdn_local_var->ip_addr = ip_addr; + addr_fqdn_local_var->fqdn = fqdn; + + return addr_fqdn_local_var; +} + +void OpenAPI_addr_fqdn_free(OpenAPI_addr_fqdn_t *addr_fqdn) +{ + OpenAPI_lnode_t *node = NULL; + + if (NULL == addr_fqdn) { + return; + } + if (addr_fqdn->ip_addr) { + OpenAPI_ip_addr_free(addr_fqdn->ip_addr); + addr_fqdn->ip_addr = NULL; + } + if (addr_fqdn->fqdn) { + ogs_free(addr_fqdn->fqdn); + addr_fqdn->fqdn = NULL; + } + ogs_free(addr_fqdn); +} + +cJSON *OpenAPI_addr_fqdn_convertToJSON(OpenAPI_addr_fqdn_t *addr_fqdn) +{ + cJSON *item = NULL; + OpenAPI_lnode_t *node = NULL; + + if (addr_fqdn == NULL) { + ogs_error("OpenAPI_addr_fqdn_convertToJSON() failed [AddrFqdn]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (addr_fqdn->ip_addr) { + cJSON *ip_addr_local_JSON = OpenAPI_ip_addr_convertToJSON(addr_fqdn->ip_addr); + if (ip_addr_local_JSON == NULL) { + ogs_error("OpenAPI_addr_fqdn_convertToJSON() failed [ip_addr]"); + goto end; + } + cJSON_AddItemToObject(item, "ipAddr", ip_addr_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_addr_fqdn_convertToJSON() failed [ip_addr]"); + goto end; + } + } + + if (addr_fqdn->fqdn) { + if (cJSON_AddStringToObject(item, "fqdn", addr_fqdn->fqdn) == NULL) { + ogs_error("OpenAPI_addr_fqdn_convertToJSON() failed [fqdn]"); + goto end; + } + } + +end: + return item; +} + +OpenAPI_addr_fqdn_t *OpenAPI_addr_fqdn_parseFromJSON(cJSON *addr_fqdnJSON) +{ + OpenAPI_addr_fqdn_t *addr_fqdn_local_var = NULL; + OpenAPI_lnode_t *node = NULL; + cJSON *ip_addr = NULL; + OpenAPI_ip_addr_t *ip_addr_local_nonprim = NULL; + cJSON *fqdn = NULL; + ip_addr = cJSON_GetObjectItemCaseSensitive(addr_fqdnJSON, "ipAddr"); + if (ip_addr) { + ip_addr_local_nonprim = OpenAPI_ip_addr_parseFromJSON(ip_addr); + } + + fqdn = cJSON_GetObjectItemCaseSensitive(addr_fqdnJSON, "fqdn"); + if (fqdn) { + if (!cJSON_IsString(fqdn) && !cJSON_IsNull(fqdn)) { + ogs_error("OpenAPI_addr_fqdn_parseFromJSON() failed [fqdn]"); + goto end; + } + } + + addr_fqdn_local_var = OpenAPI_addr_fqdn_create ( + ip_addr ? ip_addr_local_nonprim : NULL, + fqdn && !cJSON_IsNull(fqdn) ? ogs_strdup(fqdn->valuestring) : NULL + ); + + return addr_fqdn_local_var; +end: + if (ip_addr_local_nonprim) { + OpenAPI_ip_addr_free(ip_addr_local_nonprim); + ip_addr_local_nonprim = NULL; + } + return NULL; +} + +OpenAPI_addr_fqdn_t *OpenAPI_addr_fqdn_copy(OpenAPI_addr_fqdn_t *dst, OpenAPI_addr_fqdn_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_addr_fqdn_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_addr_fqdn_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_addr_fqdn_free(dst); + dst = OpenAPI_addr_fqdn_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/addr_fqdn.h b/lib/sbi/openapi/model/addr_fqdn.h new file mode 100644 index 000000000..b1f7861cb --- /dev/null +++ b/lib/sbi/openapi/model/addr_fqdn.h @@ -0,0 +1,41 @@ +/* + * addr_fqdn.h + * + * IP address and/or FQDN. + */ + +#ifndef _OpenAPI_addr_fqdn_H_ +#define _OpenAPI_addr_fqdn_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "ip_addr.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_addr_fqdn_s OpenAPI_addr_fqdn_t; +typedef struct OpenAPI_addr_fqdn_s { + struct OpenAPI_ip_addr_s *ip_addr; + char *fqdn; +} OpenAPI_addr_fqdn_t; + +OpenAPI_addr_fqdn_t *OpenAPI_addr_fqdn_create( + OpenAPI_ip_addr_t *ip_addr, + char *fqdn +); +void OpenAPI_addr_fqdn_free(OpenAPI_addr_fqdn_t *addr_fqdn); +OpenAPI_addr_fqdn_t *OpenAPI_addr_fqdn_parseFromJSON(cJSON *addr_fqdnJSON); +cJSON *OpenAPI_addr_fqdn_convertToJSON(OpenAPI_addr_fqdn_t *addr_fqdn); +OpenAPI_addr_fqdn_t *OpenAPI_addr_fqdn_copy(OpenAPI_addr_fqdn_t *dst, OpenAPI_addr_fqdn_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_addr_fqdn_H_ */ + diff --git a/lib/sbi/openapi/model/address_list.c b/lib/sbi/openapi/model/address_list.c new file mode 100644 index 000000000..9de475550 --- /dev/null +++ b/lib/sbi/openapi/model/address_list.c @@ -0,0 +1,195 @@ + +#include +#include +#include +#include "address_list.h" + +OpenAPI_address_list_t *OpenAPI_address_list_create( + OpenAPI_list_t *ipv4_addrs, + OpenAPI_list_t *ipv6_addrs +) +{ + OpenAPI_address_list_t *address_list_local_var = ogs_malloc(sizeof(OpenAPI_address_list_t)); + ogs_assert(address_list_local_var); + + address_list_local_var->ipv4_addrs = ipv4_addrs; + address_list_local_var->ipv6_addrs = ipv6_addrs; + + return address_list_local_var; +} + +void OpenAPI_address_list_free(OpenAPI_address_list_t *address_list) +{ + OpenAPI_lnode_t *node = NULL; + + if (NULL == address_list) { + return; + } + if (address_list->ipv4_addrs) { + OpenAPI_list_for_each(address_list->ipv4_addrs, node) { + ogs_free(node->data); + } + OpenAPI_list_free(address_list->ipv4_addrs); + address_list->ipv4_addrs = NULL; + } + if (address_list->ipv6_addrs) { + OpenAPI_list_for_each(address_list->ipv6_addrs, node) { + ogs_free(node->data); + } + OpenAPI_list_free(address_list->ipv6_addrs); + address_list->ipv6_addrs = NULL; + } + ogs_free(address_list); +} + +cJSON *OpenAPI_address_list_convertToJSON(OpenAPI_address_list_t *address_list) +{ + cJSON *item = NULL; + OpenAPI_lnode_t *node = NULL; + + if (address_list == NULL) { + ogs_error("OpenAPI_address_list_convertToJSON() failed [AddressList]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (address_list->ipv4_addrs) { + cJSON *ipv4_addrsList = cJSON_AddArrayToObject(item, "ipv4Addrs"); + if (ipv4_addrsList == NULL) { + ogs_error("OpenAPI_address_list_convertToJSON() failed [ipv4_addrs]"); + goto end; + } + OpenAPI_list_for_each(address_list->ipv4_addrs, node) { + if (cJSON_AddStringToObject(ipv4_addrsList, "", (char*)node->data) == NULL) { + ogs_error("OpenAPI_address_list_convertToJSON() failed [ipv4_addrs]"); + goto end; + } + } + } + + if (address_list->ipv6_addrs) { + cJSON *ipv6_addrsList = cJSON_AddArrayToObject(item, "ipv6Addrs"); + if (ipv6_addrsList == NULL) { + ogs_error("OpenAPI_address_list_convertToJSON() failed [ipv6_addrs]"); + goto end; + } + OpenAPI_list_for_each(address_list->ipv6_addrs, node) { + if (cJSON_AddStringToObject(ipv6_addrsList, "", (char*)node->data) == NULL) { + ogs_error("OpenAPI_address_list_convertToJSON() failed [ipv6_addrs]"); + goto end; + } + } + } + +end: + return item; +} + +OpenAPI_address_list_t *OpenAPI_address_list_parseFromJSON(cJSON *address_listJSON) +{ + OpenAPI_address_list_t *address_list_local_var = NULL; + OpenAPI_lnode_t *node = NULL; + cJSON *ipv4_addrs = NULL; + OpenAPI_list_t *ipv4_addrsList = NULL; + cJSON *ipv6_addrs = NULL; + OpenAPI_list_t *ipv6_addrsList = NULL; + ipv4_addrs = cJSON_GetObjectItemCaseSensitive(address_listJSON, "ipv4Addrs"); + if (ipv4_addrs) { + cJSON *ipv4_addrs_local = NULL; + if (!cJSON_IsArray(ipv4_addrs)) { + ogs_error("OpenAPI_address_list_parseFromJSON() failed [ipv4_addrs]"); + goto end; + } + + ipv4_addrsList = OpenAPI_list_create(); + + cJSON_ArrayForEach(ipv4_addrs_local, ipv4_addrs) { + double *localDouble = NULL; + int *localInt = NULL; + if (!cJSON_IsString(ipv4_addrs_local)) { + ogs_error("OpenAPI_address_list_parseFromJSON() failed [ipv4_addrs]"); + goto end; + } + OpenAPI_list_add(ipv4_addrsList, ogs_strdup(ipv4_addrs_local->valuestring)); + } + } + + ipv6_addrs = cJSON_GetObjectItemCaseSensitive(address_listJSON, "ipv6Addrs"); + if (ipv6_addrs) { + cJSON *ipv6_addrs_local = NULL; + if (!cJSON_IsArray(ipv6_addrs)) { + ogs_error("OpenAPI_address_list_parseFromJSON() failed [ipv6_addrs]"); + goto end; + } + + ipv6_addrsList = OpenAPI_list_create(); + + cJSON_ArrayForEach(ipv6_addrs_local, ipv6_addrs) { + double *localDouble = NULL; + int *localInt = NULL; + if (!cJSON_IsString(ipv6_addrs_local)) { + ogs_error("OpenAPI_address_list_parseFromJSON() failed [ipv6_addrs]"); + goto end; + } + OpenAPI_list_add(ipv6_addrsList, ogs_strdup(ipv6_addrs_local->valuestring)); + } + } + + address_list_local_var = OpenAPI_address_list_create ( + ipv4_addrs ? ipv4_addrsList : NULL, + ipv6_addrs ? ipv6_addrsList : NULL + ); + + return address_list_local_var; +end: + if (ipv4_addrsList) { + OpenAPI_list_for_each(ipv4_addrsList, node) { + ogs_free(node->data); + } + OpenAPI_list_free(ipv4_addrsList); + ipv4_addrsList = NULL; + } + if (ipv6_addrsList) { + OpenAPI_list_for_each(ipv6_addrsList, node) { + ogs_free(node->data); + } + OpenAPI_list_free(ipv6_addrsList); + ipv6_addrsList = NULL; + } + return NULL; +} + +OpenAPI_address_list_t *OpenAPI_address_list_copy(OpenAPI_address_list_t *dst, OpenAPI_address_list_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_address_list_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_address_list_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_address_list_free(dst); + dst = OpenAPI_address_list_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/address_list.h b/lib/sbi/openapi/model/address_list.h new file mode 100644 index 000000000..b98078cd0 --- /dev/null +++ b/lib/sbi/openapi/model/address_list.h @@ -0,0 +1,40 @@ +/* + * address_list.h + * + * Represents a list of IPv4 and/or IPv6 addresses. + */ + +#ifndef _OpenAPI_address_list_H_ +#define _OpenAPI_address_list_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_address_list_s OpenAPI_address_list_t; +typedef struct OpenAPI_address_list_s { + OpenAPI_list_t *ipv4_addrs; + OpenAPI_list_t *ipv6_addrs; +} OpenAPI_address_list_t; + +OpenAPI_address_list_t *OpenAPI_address_list_create( + OpenAPI_list_t *ipv4_addrs, + OpenAPI_list_t *ipv6_addrs +); +void OpenAPI_address_list_free(OpenAPI_address_list_t *address_list); +OpenAPI_address_list_t *OpenAPI_address_list_parseFromJSON(cJSON *address_listJSON); +cJSON *OpenAPI_address_list_convertToJSON(OpenAPI_address_list_t *address_list); +OpenAPI_address_list_t *OpenAPI_address_list_copy(OpenAPI_address_list_t *dst, OpenAPI_address_list_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_address_list_H_ */ + diff --git a/lib/sbi/openapi/model/aerial_ue_indication.c b/lib/sbi/openapi/model/aerial_ue_indication.c new file mode 100644 index 000000000..05aec83fb --- /dev/null +++ b/lib/sbi/openapi/model/aerial_ue_indication.c @@ -0,0 +1,30 @@ + +#include +#include +#include +#include "aerial_ue_indication.h" + +char* OpenAPI_aerial_ue_indication_ToString(OpenAPI_aerial_ue_indication_e aerial_ue_indication) +{ + const char *aerial_ue_indicationArray[] = { "NULL", "AERIAL_UE_ALLOWED", "AERIAL_UE_NOT_ALLOWED" }; + size_t sizeofArray = sizeof(aerial_ue_indicationArray) / sizeof(aerial_ue_indicationArray[0]); + if (aerial_ue_indication < sizeofArray) + return (char *)aerial_ue_indicationArray[aerial_ue_indication]; + else + return (char *)"Unknown"; +} + +OpenAPI_aerial_ue_indication_e OpenAPI_aerial_ue_indication_FromString(char* aerial_ue_indication) +{ + int stringToReturn = 0; + const char *aerial_ue_indicationArray[] = { "NULL", "AERIAL_UE_ALLOWED", "AERIAL_UE_NOT_ALLOWED" }; + size_t sizeofArray = sizeof(aerial_ue_indicationArray) / sizeof(aerial_ue_indicationArray[0]); + while (stringToReturn < sizeofArray) { + if (strcmp(aerial_ue_indication, aerial_ue_indicationArray[stringToReturn]) == 0) { + return stringToReturn; + } + stringToReturn++; + } + return 0; +} + diff --git a/lib/sbi/openapi/model/aerial_ue_indication.h b/lib/sbi/openapi/model/aerial_ue_indication.h new file mode 100644 index 000000000..c0f9709e8 --- /dev/null +++ b/lib/sbi/openapi/model/aerial_ue_indication.h @@ -0,0 +1,31 @@ +/* + * aerial_ue_indication.h + * + * + */ + +#ifndef _OpenAPI_aerial_ue_indication_H_ +#define _OpenAPI_aerial_ue_indication_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef enum { OpenAPI_aerial_ue_indication_NULL = 0, OpenAPI_aerial_ue_indication_AERIAL_UE_ALLOWED, OpenAPI_aerial_ue_indication_AERIAL_UE_NOT_ALLOWED } OpenAPI_aerial_ue_indication_e; + +char* OpenAPI_aerial_ue_indication_ToString(OpenAPI_aerial_ue_indication_e aerial_ue_indication); + +OpenAPI_aerial_ue_indication_e OpenAPI_aerial_ue_indication_FromString(char* aerial_ue_indication); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_aerial_ue_indication_H_ */ + diff --git a/lib/sbi/openapi/model/aerial_ue_subscription_info.c b/lib/sbi/openapi/model/aerial_ue_subscription_info.c new file mode 100644 index 000000000..46bf9345f --- /dev/null +++ b/lib/sbi/openapi/model/aerial_ue_subscription_info.c @@ -0,0 +1,135 @@ + +#include +#include +#include +#include "aerial_ue_subscription_info.h" + +OpenAPI_aerial_ue_subscription_info_t *OpenAPI_aerial_ue_subscription_info_create( + OpenAPI_aerial_ue_indication_e aerial_ue_ind, + char *_3gpp_uav_id +) +{ + OpenAPI_aerial_ue_subscription_info_t *aerial_ue_subscription_info_local_var = ogs_malloc(sizeof(OpenAPI_aerial_ue_subscription_info_t)); + ogs_assert(aerial_ue_subscription_info_local_var); + + aerial_ue_subscription_info_local_var->aerial_ue_ind = aerial_ue_ind; + aerial_ue_subscription_info_local_var->_3gpp_uav_id = _3gpp_uav_id; + + return aerial_ue_subscription_info_local_var; +} + +void OpenAPI_aerial_ue_subscription_info_free(OpenAPI_aerial_ue_subscription_info_t *aerial_ue_subscription_info) +{ + OpenAPI_lnode_t *node = NULL; + + if (NULL == aerial_ue_subscription_info) { + return; + } + if (aerial_ue_subscription_info->_3gpp_uav_id) { + ogs_free(aerial_ue_subscription_info->_3gpp_uav_id); + aerial_ue_subscription_info->_3gpp_uav_id = NULL; + } + ogs_free(aerial_ue_subscription_info); +} + +cJSON *OpenAPI_aerial_ue_subscription_info_convertToJSON(OpenAPI_aerial_ue_subscription_info_t *aerial_ue_subscription_info) +{ + cJSON *item = NULL; + OpenAPI_lnode_t *node = NULL; + + if (aerial_ue_subscription_info == NULL) { + ogs_error("OpenAPI_aerial_ue_subscription_info_convertToJSON() failed [AerialUeSubscriptionInfo]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (aerial_ue_subscription_info->aerial_ue_ind == OpenAPI_aerial_ue_indication_NULL) { + ogs_error("OpenAPI_aerial_ue_subscription_info_convertToJSON() failed [aerial_ue_ind]"); + return NULL; + } + if (cJSON_AddStringToObject(item, "aerialUeInd", OpenAPI_aerial_ue_indication_ToString(aerial_ue_subscription_info->aerial_ue_ind)) == NULL) { + ogs_error("OpenAPI_aerial_ue_subscription_info_convertToJSON() failed [aerial_ue_ind]"); + goto end; + } + + if (aerial_ue_subscription_info->_3gpp_uav_id) { + if (cJSON_AddStringToObject(item, "3gppUavId", aerial_ue_subscription_info->_3gpp_uav_id) == NULL) { + ogs_error("OpenAPI_aerial_ue_subscription_info_convertToJSON() failed [_3gpp_uav_id]"); + goto end; + } + } + +end: + return item; +} + +OpenAPI_aerial_ue_subscription_info_t *OpenAPI_aerial_ue_subscription_info_parseFromJSON(cJSON *aerial_ue_subscription_infoJSON) +{ + OpenAPI_aerial_ue_subscription_info_t *aerial_ue_subscription_info_local_var = NULL; + OpenAPI_lnode_t *node = NULL; + cJSON *aerial_ue_ind = NULL; + OpenAPI_aerial_ue_indication_e aerial_ue_indVariable = 0; + cJSON *_3gpp_uav_id = NULL; + aerial_ue_ind = cJSON_GetObjectItemCaseSensitive(aerial_ue_subscription_infoJSON, "aerialUeInd"); + if (!aerial_ue_ind) { + ogs_error("OpenAPI_aerial_ue_subscription_info_parseFromJSON() failed [aerial_ue_ind]"); + goto end; + } + if (!cJSON_IsString(aerial_ue_ind)) { + ogs_error("OpenAPI_aerial_ue_subscription_info_parseFromJSON() failed [aerial_ue_ind]"); + goto end; + } + aerial_ue_indVariable = OpenAPI_aerial_ue_indication_FromString(aerial_ue_ind->valuestring); + + _3gpp_uav_id = cJSON_GetObjectItemCaseSensitive(aerial_ue_subscription_infoJSON, "3gppUavId"); + if (_3gpp_uav_id) { + if (!cJSON_IsString(_3gpp_uav_id) && !cJSON_IsNull(_3gpp_uav_id)) { + ogs_error("OpenAPI_aerial_ue_subscription_info_parseFromJSON() failed [_3gpp_uav_id]"); + goto end; + } + } + + aerial_ue_subscription_info_local_var = OpenAPI_aerial_ue_subscription_info_create ( + aerial_ue_indVariable, + _3gpp_uav_id && !cJSON_IsNull(_3gpp_uav_id) ? ogs_strdup(_3gpp_uav_id->valuestring) : NULL + ); + + return aerial_ue_subscription_info_local_var; +end: + return NULL; +} + +OpenAPI_aerial_ue_subscription_info_t *OpenAPI_aerial_ue_subscription_info_copy(OpenAPI_aerial_ue_subscription_info_t *dst, OpenAPI_aerial_ue_subscription_info_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_aerial_ue_subscription_info_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_aerial_ue_subscription_info_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_aerial_ue_subscription_info_free(dst); + dst = OpenAPI_aerial_ue_subscription_info_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/aerial_ue_subscription_info.h b/lib/sbi/openapi/model/aerial_ue_subscription_info.h new file mode 100644 index 000000000..49fc85fa8 --- /dev/null +++ b/lib/sbi/openapi/model/aerial_ue_subscription_info.h @@ -0,0 +1,41 @@ +/* + * aerial_ue_subscription_info.h + * + * Contains the Aerial UE Subscription Information, it at least contains the Aerial UE Indication. + */ + +#ifndef _OpenAPI_aerial_ue_subscription_info_H_ +#define _OpenAPI_aerial_ue_subscription_info_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "aerial_ue_indication.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_aerial_ue_subscription_info_s OpenAPI_aerial_ue_subscription_info_t; +typedef struct OpenAPI_aerial_ue_subscription_info_s { + OpenAPI_aerial_ue_indication_e aerial_ue_ind; + char *_3gpp_uav_id; +} OpenAPI_aerial_ue_subscription_info_t; + +OpenAPI_aerial_ue_subscription_info_t *OpenAPI_aerial_ue_subscription_info_create( + OpenAPI_aerial_ue_indication_e aerial_ue_ind, + char *_3gpp_uav_id +); +void OpenAPI_aerial_ue_subscription_info_free(OpenAPI_aerial_ue_subscription_info_t *aerial_ue_subscription_info); +OpenAPI_aerial_ue_subscription_info_t *OpenAPI_aerial_ue_subscription_info_parseFromJSON(cJSON *aerial_ue_subscription_infoJSON); +cJSON *OpenAPI_aerial_ue_subscription_info_convertToJSON(OpenAPI_aerial_ue_subscription_info_t *aerial_ue_subscription_info); +OpenAPI_aerial_ue_subscription_info_t *OpenAPI_aerial_ue_subscription_info_copy(OpenAPI_aerial_ue_subscription_info_t *dst, OpenAPI_aerial_ue_subscription_info_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_aerial_ue_subscription_info_H_ */ + diff --git a/lib/sbi/openapi/model/aerial_ue_subscription_info_1.c b/lib/sbi/openapi/model/aerial_ue_subscription_info_1.c new file mode 100644 index 000000000..b0a1fab75 --- /dev/null +++ b/lib/sbi/openapi/model/aerial_ue_subscription_info_1.c @@ -0,0 +1,135 @@ + +#include +#include +#include +#include "aerial_ue_subscription_info_1.h" + +OpenAPI_aerial_ue_subscription_info_1_t *OpenAPI_aerial_ue_subscription_info_1_create( + OpenAPI_aerial_ue_indication_e aerial_ue_ind, + char *_3gpp_uav_id +) +{ + OpenAPI_aerial_ue_subscription_info_1_t *aerial_ue_subscription_info_1_local_var = ogs_malloc(sizeof(OpenAPI_aerial_ue_subscription_info_1_t)); + ogs_assert(aerial_ue_subscription_info_1_local_var); + + aerial_ue_subscription_info_1_local_var->aerial_ue_ind = aerial_ue_ind; + aerial_ue_subscription_info_1_local_var->_3gpp_uav_id = _3gpp_uav_id; + + return aerial_ue_subscription_info_1_local_var; +} + +void OpenAPI_aerial_ue_subscription_info_1_free(OpenAPI_aerial_ue_subscription_info_1_t *aerial_ue_subscription_info_1) +{ + OpenAPI_lnode_t *node = NULL; + + if (NULL == aerial_ue_subscription_info_1) { + return; + } + if (aerial_ue_subscription_info_1->_3gpp_uav_id) { + ogs_free(aerial_ue_subscription_info_1->_3gpp_uav_id); + aerial_ue_subscription_info_1->_3gpp_uav_id = NULL; + } + ogs_free(aerial_ue_subscription_info_1); +} + +cJSON *OpenAPI_aerial_ue_subscription_info_1_convertToJSON(OpenAPI_aerial_ue_subscription_info_1_t *aerial_ue_subscription_info_1) +{ + cJSON *item = NULL; + OpenAPI_lnode_t *node = NULL; + + if (aerial_ue_subscription_info_1 == NULL) { + ogs_error("OpenAPI_aerial_ue_subscription_info_1_convertToJSON() failed [AerialUeSubscriptionInfo_1]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (aerial_ue_subscription_info_1->aerial_ue_ind == OpenAPI_aerial_ue_indication_NULL) { + ogs_error("OpenAPI_aerial_ue_subscription_info_1_convertToJSON() failed [aerial_ue_ind]"); + return NULL; + } + if (cJSON_AddStringToObject(item, "aerialUeInd", OpenAPI_aerial_ue_indication_ToString(aerial_ue_subscription_info_1->aerial_ue_ind)) == NULL) { + ogs_error("OpenAPI_aerial_ue_subscription_info_1_convertToJSON() failed [aerial_ue_ind]"); + goto end; + } + + if (aerial_ue_subscription_info_1->_3gpp_uav_id) { + if (cJSON_AddStringToObject(item, "3gppUavId", aerial_ue_subscription_info_1->_3gpp_uav_id) == NULL) { + ogs_error("OpenAPI_aerial_ue_subscription_info_1_convertToJSON() failed [_3gpp_uav_id]"); + goto end; + } + } + +end: + return item; +} + +OpenAPI_aerial_ue_subscription_info_1_t *OpenAPI_aerial_ue_subscription_info_1_parseFromJSON(cJSON *aerial_ue_subscription_info_1JSON) +{ + OpenAPI_aerial_ue_subscription_info_1_t *aerial_ue_subscription_info_1_local_var = NULL; + OpenAPI_lnode_t *node = NULL; + cJSON *aerial_ue_ind = NULL; + OpenAPI_aerial_ue_indication_e aerial_ue_indVariable = 0; + cJSON *_3gpp_uav_id = NULL; + aerial_ue_ind = cJSON_GetObjectItemCaseSensitive(aerial_ue_subscription_info_1JSON, "aerialUeInd"); + if (!aerial_ue_ind) { + ogs_error("OpenAPI_aerial_ue_subscription_info_1_parseFromJSON() failed [aerial_ue_ind]"); + goto end; + } + if (!cJSON_IsString(aerial_ue_ind)) { + ogs_error("OpenAPI_aerial_ue_subscription_info_1_parseFromJSON() failed [aerial_ue_ind]"); + goto end; + } + aerial_ue_indVariable = OpenAPI_aerial_ue_indication_FromString(aerial_ue_ind->valuestring); + + _3gpp_uav_id = cJSON_GetObjectItemCaseSensitive(aerial_ue_subscription_info_1JSON, "3gppUavId"); + if (_3gpp_uav_id) { + if (!cJSON_IsString(_3gpp_uav_id) && !cJSON_IsNull(_3gpp_uav_id)) { + ogs_error("OpenAPI_aerial_ue_subscription_info_1_parseFromJSON() failed [_3gpp_uav_id]"); + goto end; + } + } + + aerial_ue_subscription_info_1_local_var = OpenAPI_aerial_ue_subscription_info_1_create ( + aerial_ue_indVariable, + _3gpp_uav_id && !cJSON_IsNull(_3gpp_uav_id) ? ogs_strdup(_3gpp_uav_id->valuestring) : NULL + ); + + return aerial_ue_subscription_info_1_local_var; +end: + return NULL; +} + +OpenAPI_aerial_ue_subscription_info_1_t *OpenAPI_aerial_ue_subscription_info_1_copy(OpenAPI_aerial_ue_subscription_info_1_t *dst, OpenAPI_aerial_ue_subscription_info_1_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_aerial_ue_subscription_info_1_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_aerial_ue_subscription_info_1_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_aerial_ue_subscription_info_1_free(dst); + dst = OpenAPI_aerial_ue_subscription_info_1_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/aerial_ue_subscription_info_1.h b/lib/sbi/openapi/model/aerial_ue_subscription_info_1.h new file mode 100644 index 000000000..af93555d6 --- /dev/null +++ b/lib/sbi/openapi/model/aerial_ue_subscription_info_1.h @@ -0,0 +1,41 @@ +/* + * aerial_ue_subscription_info_1.h + * + * Contains the Aerial UE Subscription Information, it at least contains the Aerial UE Indication. + */ + +#ifndef _OpenAPI_aerial_ue_subscription_info_1_H_ +#define _OpenAPI_aerial_ue_subscription_info_1_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "aerial_ue_indication.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_aerial_ue_subscription_info_1_s OpenAPI_aerial_ue_subscription_info_1_t; +typedef struct OpenAPI_aerial_ue_subscription_info_1_s { + OpenAPI_aerial_ue_indication_e aerial_ue_ind; + char *_3gpp_uav_id; +} OpenAPI_aerial_ue_subscription_info_1_t; + +OpenAPI_aerial_ue_subscription_info_1_t *OpenAPI_aerial_ue_subscription_info_1_create( + OpenAPI_aerial_ue_indication_e aerial_ue_ind, + char *_3gpp_uav_id +); +void OpenAPI_aerial_ue_subscription_info_1_free(OpenAPI_aerial_ue_subscription_info_1_t *aerial_ue_subscription_info_1); +OpenAPI_aerial_ue_subscription_info_1_t *OpenAPI_aerial_ue_subscription_info_1_parseFromJSON(cJSON *aerial_ue_subscription_info_1JSON); +cJSON *OpenAPI_aerial_ue_subscription_info_1_convertToJSON(OpenAPI_aerial_ue_subscription_info_1_t *aerial_ue_subscription_info_1); +OpenAPI_aerial_ue_subscription_info_1_t *OpenAPI_aerial_ue_subscription_info_1_copy(OpenAPI_aerial_ue_subscription_info_1_t *dst, OpenAPI_aerial_ue_subscription_info_1_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_aerial_ue_subscription_info_1_H_ */ + diff --git a/lib/sbi/openapi/model/af_coordination_info.c b/lib/sbi/openapi/model/af_coordination_info.c new file mode 100644 index 000000000..1b5b3f1fc --- /dev/null +++ b/lib/sbi/openapi/model/af_coordination_info.c @@ -0,0 +1,216 @@ + +#include +#include +#include +#include "af_coordination_info.h" + +OpenAPI_af_coordination_info_t *OpenAPI_af_coordination_info_create( + char *source_dnai, + char *source_ue_ipv4_addr, + char *source_ue_ipv6_prefix, + OpenAPI_list_t *notification_info_list +) +{ + OpenAPI_af_coordination_info_t *af_coordination_info_local_var = ogs_malloc(sizeof(OpenAPI_af_coordination_info_t)); + ogs_assert(af_coordination_info_local_var); + + af_coordination_info_local_var->source_dnai = source_dnai; + af_coordination_info_local_var->source_ue_ipv4_addr = source_ue_ipv4_addr; + af_coordination_info_local_var->source_ue_ipv6_prefix = source_ue_ipv6_prefix; + af_coordination_info_local_var->notification_info_list = notification_info_list; + + return af_coordination_info_local_var; +} + +void OpenAPI_af_coordination_info_free(OpenAPI_af_coordination_info_t *af_coordination_info) +{ + OpenAPI_lnode_t *node = NULL; + + if (NULL == af_coordination_info) { + return; + } + if (af_coordination_info->source_dnai) { + ogs_free(af_coordination_info->source_dnai); + af_coordination_info->source_dnai = NULL; + } + if (af_coordination_info->source_ue_ipv4_addr) { + ogs_free(af_coordination_info->source_ue_ipv4_addr); + af_coordination_info->source_ue_ipv4_addr = NULL; + } + if (af_coordination_info->source_ue_ipv6_prefix) { + ogs_free(af_coordination_info->source_ue_ipv6_prefix); + af_coordination_info->source_ue_ipv6_prefix = NULL; + } + if (af_coordination_info->notification_info_list) { + OpenAPI_list_for_each(af_coordination_info->notification_info_list, node) { + OpenAPI_notification_info_free(node->data); + } + OpenAPI_list_free(af_coordination_info->notification_info_list); + af_coordination_info->notification_info_list = NULL; + } + ogs_free(af_coordination_info); +} + +cJSON *OpenAPI_af_coordination_info_convertToJSON(OpenAPI_af_coordination_info_t *af_coordination_info) +{ + cJSON *item = NULL; + OpenAPI_lnode_t *node = NULL; + + if (af_coordination_info == NULL) { + ogs_error("OpenAPI_af_coordination_info_convertToJSON() failed [AfCoordinationInfo]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (af_coordination_info->source_dnai) { + if (cJSON_AddStringToObject(item, "sourceDnai", af_coordination_info->source_dnai) == NULL) { + ogs_error("OpenAPI_af_coordination_info_convertToJSON() failed [source_dnai]"); + goto end; + } + } + + if (af_coordination_info->source_ue_ipv4_addr) { + if (cJSON_AddStringToObject(item, "sourceUeIpv4Addr", af_coordination_info->source_ue_ipv4_addr) == NULL) { + ogs_error("OpenAPI_af_coordination_info_convertToJSON() failed [source_ue_ipv4_addr]"); + goto end; + } + } + + if (af_coordination_info->source_ue_ipv6_prefix) { + if (cJSON_AddStringToObject(item, "sourceUeIpv6Prefix", af_coordination_info->source_ue_ipv6_prefix) == NULL) { + ogs_error("OpenAPI_af_coordination_info_convertToJSON() failed [source_ue_ipv6_prefix]"); + goto end; + } + } + + if (af_coordination_info->notification_info_list) { + cJSON *notification_info_listList = cJSON_AddArrayToObject(item, "notificationInfoList"); + if (notification_info_listList == NULL) { + ogs_error("OpenAPI_af_coordination_info_convertToJSON() failed [notification_info_list]"); + goto end; + } + OpenAPI_list_for_each(af_coordination_info->notification_info_list, node) { + cJSON *itemLocal = OpenAPI_notification_info_convertToJSON(node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_af_coordination_info_convertToJSON() failed [notification_info_list]"); + goto end; + } + cJSON_AddItemToArray(notification_info_listList, itemLocal); + } + } + +end: + return item; +} + +OpenAPI_af_coordination_info_t *OpenAPI_af_coordination_info_parseFromJSON(cJSON *af_coordination_infoJSON) +{ + OpenAPI_af_coordination_info_t *af_coordination_info_local_var = NULL; + OpenAPI_lnode_t *node = NULL; + cJSON *source_dnai = NULL; + cJSON *source_ue_ipv4_addr = NULL; + cJSON *source_ue_ipv6_prefix = NULL; + cJSON *notification_info_list = NULL; + OpenAPI_list_t *notification_info_listList = NULL; + source_dnai = cJSON_GetObjectItemCaseSensitive(af_coordination_infoJSON, "sourceDnai"); + if (source_dnai) { + if (!cJSON_IsString(source_dnai) && !cJSON_IsNull(source_dnai)) { + ogs_error("OpenAPI_af_coordination_info_parseFromJSON() failed [source_dnai]"); + goto end; + } + } + + source_ue_ipv4_addr = cJSON_GetObjectItemCaseSensitive(af_coordination_infoJSON, "sourceUeIpv4Addr"); + if (source_ue_ipv4_addr) { + if (!cJSON_IsString(source_ue_ipv4_addr) && !cJSON_IsNull(source_ue_ipv4_addr)) { + ogs_error("OpenAPI_af_coordination_info_parseFromJSON() failed [source_ue_ipv4_addr]"); + goto end; + } + } + + source_ue_ipv6_prefix = cJSON_GetObjectItemCaseSensitive(af_coordination_infoJSON, "sourceUeIpv6Prefix"); + if (source_ue_ipv6_prefix) { + if (!cJSON_IsString(source_ue_ipv6_prefix) && !cJSON_IsNull(source_ue_ipv6_prefix)) { + ogs_error("OpenAPI_af_coordination_info_parseFromJSON() failed [source_ue_ipv6_prefix]"); + goto end; + } + } + + notification_info_list = cJSON_GetObjectItemCaseSensitive(af_coordination_infoJSON, "notificationInfoList"); + if (notification_info_list) { + cJSON *notification_info_list_local = NULL; + if (!cJSON_IsArray(notification_info_list)) { + ogs_error("OpenAPI_af_coordination_info_parseFromJSON() failed [notification_info_list]"); + goto end; + } + + notification_info_listList = OpenAPI_list_create(); + + cJSON_ArrayForEach(notification_info_list_local, notification_info_list) { + if (!cJSON_IsObject(notification_info_list_local)) { + ogs_error("OpenAPI_af_coordination_info_parseFromJSON() failed [notification_info_list]"); + goto end; + } + OpenAPI_notification_info_t *notification_info_listItem = OpenAPI_notification_info_parseFromJSON(notification_info_list_local); + if (!notification_info_listItem) { + ogs_error("No notification_info_listItem"); + OpenAPI_list_free(notification_info_listList); + goto end; + } + OpenAPI_list_add(notification_info_listList, notification_info_listItem); + } + } + + af_coordination_info_local_var = OpenAPI_af_coordination_info_create ( + source_dnai && !cJSON_IsNull(source_dnai) ? ogs_strdup(source_dnai->valuestring) : NULL, + source_ue_ipv4_addr && !cJSON_IsNull(source_ue_ipv4_addr) ? ogs_strdup(source_ue_ipv4_addr->valuestring) : NULL, + source_ue_ipv6_prefix && !cJSON_IsNull(source_ue_ipv6_prefix) ? ogs_strdup(source_ue_ipv6_prefix->valuestring) : NULL, + notification_info_list ? notification_info_listList : NULL + ); + + return af_coordination_info_local_var; +end: + if (notification_info_listList) { + OpenAPI_list_for_each(notification_info_listList, node) { + OpenAPI_notification_info_free(node->data); + } + OpenAPI_list_free(notification_info_listList); + notification_info_listList = NULL; + } + return NULL; +} + +OpenAPI_af_coordination_info_t *OpenAPI_af_coordination_info_copy(OpenAPI_af_coordination_info_t *dst, OpenAPI_af_coordination_info_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_af_coordination_info_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_af_coordination_info_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_af_coordination_info_free(dst); + dst = OpenAPI_af_coordination_info_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/af_coordination_info.h b/lib/sbi/openapi/model/af_coordination_info.h new file mode 100644 index 000000000..bff1f3dc0 --- /dev/null +++ b/lib/sbi/openapi/model/af_coordination_info.h @@ -0,0 +1,45 @@ +/* + * af_coordination_info.h + * + * AF Coordination Information + */ + +#ifndef _OpenAPI_af_coordination_info_H_ +#define _OpenAPI_af_coordination_info_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "notification_info.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_af_coordination_info_s OpenAPI_af_coordination_info_t; +typedef struct OpenAPI_af_coordination_info_s { + char *source_dnai; + char *source_ue_ipv4_addr; + char *source_ue_ipv6_prefix; + OpenAPI_list_t *notification_info_list; +} OpenAPI_af_coordination_info_t; + +OpenAPI_af_coordination_info_t *OpenAPI_af_coordination_info_create( + char *source_dnai, + char *source_ue_ipv4_addr, + char *source_ue_ipv6_prefix, + OpenAPI_list_t *notification_info_list +); +void OpenAPI_af_coordination_info_free(OpenAPI_af_coordination_info_t *af_coordination_info); +OpenAPI_af_coordination_info_t *OpenAPI_af_coordination_info_parseFromJSON(cJSON *af_coordination_infoJSON); +cJSON *OpenAPI_af_coordination_info_convertToJSON(OpenAPI_af_coordination_info_t *af_coordination_info); +OpenAPI_af_coordination_info_t *OpenAPI_af_coordination_info_copy(OpenAPI_af_coordination_info_t *dst, OpenAPI_af_coordination_info_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_af_coordination_info_H_ */ + diff --git a/lib/sbi/openapi/model/af_event.c b/lib/sbi/openapi/model/af_event.c index 124111e8d..ac0175991 100644 --- a/lib/sbi/openapi/model/af_event.c +++ b/lib/sbi/openapi/model/af_event.c @@ -6,7 +6,7 @@ char* OpenAPI_af_event_ToString(OpenAPI_af_event_e af_event) { - const char *af_eventArray[] = { "NULL", "SVC_EXPERIENCE", "UE_MOBILITY", "UE_COMM", "EXCEPTIONS" }; + const char *af_eventArray[] = { "NULL", "SVC_EXPERIENCE", "UE_MOBILITY", "UE_COMM", "EXCEPTIONS", "USER_DATA_CONGESTION", "PERF_DATA", "DISPERSION", "COLLECTIVE_BEHAVIOUR", "MS_QOE_METRICS", "MS_CONSUMPTION", "MS_NET_ASSIST_INVOCATION", "MS_DYN_POLICY_INVOCATION", "MS_ACCESS_ACTIVITY" }; size_t sizeofArray = sizeof(af_eventArray) / sizeof(af_eventArray[0]); if (af_event < sizeofArray) return (char *)af_eventArray[af_event]; @@ -17,7 +17,7 @@ char* OpenAPI_af_event_ToString(OpenAPI_af_event_e af_event) OpenAPI_af_event_e OpenAPI_af_event_FromString(char* af_event) { int stringToReturn = 0; - const char *af_eventArray[] = { "NULL", "SVC_EXPERIENCE", "UE_MOBILITY", "UE_COMM", "EXCEPTIONS" }; + const char *af_eventArray[] = { "NULL", "SVC_EXPERIENCE", "UE_MOBILITY", "UE_COMM", "EXCEPTIONS", "USER_DATA_CONGESTION", "PERF_DATA", "DISPERSION", "COLLECTIVE_BEHAVIOUR", "MS_QOE_METRICS", "MS_CONSUMPTION", "MS_NET_ASSIST_INVOCATION", "MS_DYN_POLICY_INVOCATION", "MS_ACCESS_ACTIVITY" }; size_t sizeofArray = sizeof(af_eventArray) / sizeof(af_eventArray[0]); while (stringToReturn < sizeofArray) { if (strcmp(af_event, af_eventArray[stringToReturn]) == 0) { diff --git a/lib/sbi/openapi/model/af_event.h b/lib/sbi/openapi/model/af_event.h index 2279ba1ea..0221ac9b4 100644 --- a/lib/sbi/openapi/model/af_event.h +++ b/lib/sbi/openapi/model/af_event.h @@ -17,7 +17,7 @@ extern "C" { #endif -typedef enum { OpenAPI_af_event_NULL = 0, OpenAPI_af_event_SVC_EXPERIENCE, OpenAPI_af_event_UE_MOBILITY, OpenAPI_af_event_UE_COMM, OpenAPI_af_event_EXCEPTIONS } OpenAPI_af_event_e; +typedef enum { OpenAPI_af_event_NULL = 0, OpenAPI_af_event_SVC_EXPERIENCE, OpenAPI_af_event_UE_MOBILITY, OpenAPI_af_event_UE_COMM, OpenAPI_af_event_EXCEPTIONS, OpenAPI_af_event_USER_DATA_CONGESTION, OpenAPI_af_event_PERF_DATA, OpenAPI_af_event_DISPERSION, OpenAPI_af_event_COLLECTIVE_BEHAVIOUR, OpenAPI_af_event_MS_QOE_METRICS, OpenAPI_af_event_MS_CONSUMPTION, OpenAPI_af_event_MS_NET_ASSIST_INVOCATION, OpenAPI_af_event_MS_DYN_POLICY_INVOCATION, OpenAPI_af_event_MS_ACCESS_ACTIVITY } OpenAPI_af_event_e; char* OpenAPI_af_event_ToString(OpenAPI_af_event_e af_event); diff --git a/lib/sbi/openapi/model/af_event_notification.h b/lib/sbi/openapi/model/af_event_notification.h index e950bae69..44a0814c5 100644 --- a/lib/sbi/openapi/model/af_event_notification.h +++ b/lib/sbi/openapi/model/af_event_notification.h @@ -1,7 +1,7 @@ /* * af_event_notification.h * - * describes the event information delivered in the notification + * Describes the event information delivered in the notification. */ #ifndef _OpenAPI_af_event_notification_H_ diff --git a/lib/sbi/openapi/model/af_event_subscription.h b/lib/sbi/openapi/model/af_event_subscription.h index 96375bd01..6cedb3103 100644 --- a/lib/sbi/openapi/model/af_event_subscription.h +++ b/lib/sbi/openapi/model/af_event_subscription.h @@ -1,7 +1,7 @@ /* * af_event_subscription.h * - * describes the event information delivered in the subscription + * Describes the event information delivered in the subscription. */ #ifndef _OpenAPI_af_event_subscription_H_ diff --git a/lib/sbi/openapi/model/af_routing_requirement.c b/lib/sbi/openapi/model/af_routing_requirement.c index 9d903beb7..fbf781dab 100644 --- a/lib/sbi/openapi/model/af_routing_requirement.c +++ b/lib/sbi/openapi/model/af_routing_requirement.c @@ -12,7 +12,16 @@ OpenAPI_af_routing_requirement_t *OpenAPI_af_routing_requirement_create( OpenAPI_list_t *temp_vals, OpenAPI_up_path_chg_event_t *up_path_chg_sub, bool is_addr_preser_ind, - int addr_preser_ind + int addr_preser_ind, + bool is_sim_conn_ind, + int sim_conn_ind, + bool is_sim_conn_term, + int sim_conn_term, + OpenAPI_list_t *eas_ip_replace_infos, + bool is_eas_redis_ind, + int eas_redis_ind, + bool is_max_allowed_up_lat, + int max_allowed_up_lat ) { OpenAPI_af_routing_requirement_t *af_routing_requirement_local_var = ogs_malloc(sizeof(OpenAPI_af_routing_requirement_t)); @@ -26,6 +35,15 @@ OpenAPI_af_routing_requirement_t *OpenAPI_af_routing_requirement_create( af_routing_requirement_local_var->up_path_chg_sub = up_path_chg_sub; af_routing_requirement_local_var->is_addr_preser_ind = is_addr_preser_ind; af_routing_requirement_local_var->addr_preser_ind = addr_preser_ind; + af_routing_requirement_local_var->is_sim_conn_ind = is_sim_conn_ind; + af_routing_requirement_local_var->sim_conn_ind = sim_conn_ind; + af_routing_requirement_local_var->is_sim_conn_term = is_sim_conn_term; + af_routing_requirement_local_var->sim_conn_term = sim_conn_term; + af_routing_requirement_local_var->eas_ip_replace_infos = eas_ip_replace_infos; + af_routing_requirement_local_var->is_eas_redis_ind = is_eas_redis_ind; + af_routing_requirement_local_var->eas_redis_ind = eas_redis_ind; + af_routing_requirement_local_var->is_max_allowed_up_lat = is_max_allowed_up_lat; + af_routing_requirement_local_var->max_allowed_up_lat = max_allowed_up_lat; return af_routing_requirement_local_var; } @@ -59,6 +77,13 @@ void OpenAPI_af_routing_requirement_free(OpenAPI_af_routing_requirement_t *af_ro OpenAPI_up_path_chg_event_free(af_routing_requirement->up_path_chg_sub); af_routing_requirement->up_path_chg_sub = NULL; } + if (af_routing_requirement->eas_ip_replace_infos) { + OpenAPI_list_for_each(af_routing_requirement->eas_ip_replace_infos, node) { + OpenAPI_eas_ip_replacement_info_free(node->data); + } + OpenAPI_list_free(af_routing_requirement->eas_ip_replace_infos); + af_routing_requirement->eas_ip_replace_infos = NULL; + } ogs_free(af_routing_requirement); } @@ -145,6 +170,50 @@ cJSON *OpenAPI_af_routing_requirement_convertToJSON(OpenAPI_af_routing_requireme } } + if (af_routing_requirement->is_sim_conn_ind) { + if (cJSON_AddBoolToObject(item, "simConnInd", af_routing_requirement->sim_conn_ind) == NULL) { + ogs_error("OpenAPI_af_routing_requirement_convertToJSON() failed [sim_conn_ind]"); + goto end; + } + } + + if (af_routing_requirement->is_sim_conn_term) { + if (cJSON_AddNumberToObject(item, "simConnTerm", af_routing_requirement->sim_conn_term) == NULL) { + ogs_error("OpenAPI_af_routing_requirement_convertToJSON() failed [sim_conn_term]"); + goto end; + } + } + + if (af_routing_requirement->eas_ip_replace_infos) { + cJSON *eas_ip_replace_infosList = cJSON_AddArrayToObject(item, "easIpReplaceInfos"); + if (eas_ip_replace_infosList == NULL) { + ogs_error("OpenAPI_af_routing_requirement_convertToJSON() failed [eas_ip_replace_infos]"); + goto end; + } + OpenAPI_list_for_each(af_routing_requirement->eas_ip_replace_infos, node) { + cJSON *itemLocal = OpenAPI_eas_ip_replacement_info_convertToJSON(node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_af_routing_requirement_convertToJSON() failed [eas_ip_replace_infos]"); + goto end; + } + cJSON_AddItemToArray(eas_ip_replace_infosList, itemLocal); + } + } + + if (af_routing_requirement->is_eas_redis_ind) { + if (cJSON_AddBoolToObject(item, "easRedisInd", af_routing_requirement->eas_redis_ind) == NULL) { + ogs_error("OpenAPI_af_routing_requirement_convertToJSON() failed [eas_redis_ind]"); + goto end; + } + } + + if (af_routing_requirement->is_max_allowed_up_lat) { + if (cJSON_AddNumberToObject(item, "maxAllowedUpLat", af_routing_requirement->max_allowed_up_lat) == NULL) { + ogs_error("OpenAPI_af_routing_requirement_convertToJSON() failed [max_allowed_up_lat]"); + goto end; + } + } + end: return item; } @@ -163,6 +232,12 @@ OpenAPI_af_routing_requirement_t *OpenAPI_af_routing_requirement_parseFromJSON(c cJSON *up_path_chg_sub = NULL; OpenAPI_up_path_chg_event_t *up_path_chg_sub_local_nonprim = NULL; cJSON *addr_preser_ind = NULL; + cJSON *sim_conn_ind = NULL; + cJSON *sim_conn_term = NULL; + cJSON *eas_ip_replace_infos = NULL; + OpenAPI_list_t *eas_ip_replace_infosList = NULL; + cJSON *eas_redis_ind = NULL; + cJSON *max_allowed_up_lat = NULL; app_reloc = cJSON_GetObjectItemCaseSensitive(af_routing_requirementJSON, "appReloc"); if (app_reloc) { if (!cJSON_IsBool(app_reloc)) { @@ -239,6 +314,63 @@ OpenAPI_af_routing_requirement_t *OpenAPI_af_routing_requirement_parseFromJSON(c } } + sim_conn_ind = cJSON_GetObjectItemCaseSensitive(af_routing_requirementJSON, "simConnInd"); + if (sim_conn_ind) { + if (!cJSON_IsBool(sim_conn_ind)) { + ogs_error("OpenAPI_af_routing_requirement_parseFromJSON() failed [sim_conn_ind]"); + goto end; + } + } + + sim_conn_term = cJSON_GetObjectItemCaseSensitive(af_routing_requirementJSON, "simConnTerm"); + if (sim_conn_term) { + if (!cJSON_IsNumber(sim_conn_term)) { + ogs_error("OpenAPI_af_routing_requirement_parseFromJSON() failed [sim_conn_term]"); + goto end; + } + } + + eas_ip_replace_infos = cJSON_GetObjectItemCaseSensitive(af_routing_requirementJSON, "easIpReplaceInfos"); + if (eas_ip_replace_infos) { + cJSON *eas_ip_replace_infos_local = NULL; + if (!cJSON_IsArray(eas_ip_replace_infos)) { + ogs_error("OpenAPI_af_routing_requirement_parseFromJSON() failed [eas_ip_replace_infos]"); + goto end; + } + + eas_ip_replace_infosList = OpenAPI_list_create(); + + cJSON_ArrayForEach(eas_ip_replace_infos_local, eas_ip_replace_infos) { + if (!cJSON_IsObject(eas_ip_replace_infos_local)) { + ogs_error("OpenAPI_af_routing_requirement_parseFromJSON() failed [eas_ip_replace_infos]"); + goto end; + } + OpenAPI_eas_ip_replacement_info_t *eas_ip_replace_infosItem = OpenAPI_eas_ip_replacement_info_parseFromJSON(eas_ip_replace_infos_local); + if (!eas_ip_replace_infosItem) { + ogs_error("No eas_ip_replace_infosItem"); + OpenAPI_list_free(eas_ip_replace_infosList); + goto end; + } + OpenAPI_list_add(eas_ip_replace_infosList, eas_ip_replace_infosItem); + } + } + + eas_redis_ind = cJSON_GetObjectItemCaseSensitive(af_routing_requirementJSON, "easRedisInd"); + if (eas_redis_ind) { + if (!cJSON_IsBool(eas_redis_ind)) { + ogs_error("OpenAPI_af_routing_requirement_parseFromJSON() failed [eas_redis_ind]"); + goto end; + } + } + + max_allowed_up_lat = cJSON_GetObjectItemCaseSensitive(af_routing_requirementJSON, "maxAllowedUpLat"); + if (max_allowed_up_lat) { + if (!cJSON_IsNumber(max_allowed_up_lat)) { + ogs_error("OpenAPI_af_routing_requirement_parseFromJSON() failed [max_allowed_up_lat]"); + goto end; + } + } + af_routing_requirement_local_var = OpenAPI_af_routing_requirement_create ( app_reloc ? true : false, app_reloc ? app_reloc->valueint : 0, @@ -247,7 +379,16 @@ OpenAPI_af_routing_requirement_t *OpenAPI_af_routing_requirement_parseFromJSON(c temp_vals ? temp_valsList : NULL, up_path_chg_sub ? up_path_chg_sub_local_nonprim : NULL, addr_preser_ind ? true : false, - addr_preser_ind ? addr_preser_ind->valueint : 0 + addr_preser_ind ? addr_preser_ind->valueint : 0, + sim_conn_ind ? true : false, + sim_conn_ind ? sim_conn_ind->valueint : 0, + sim_conn_term ? true : false, + sim_conn_term ? sim_conn_term->valuedouble : 0, + eas_ip_replace_infos ? eas_ip_replace_infosList : NULL, + eas_redis_ind ? true : false, + eas_redis_ind ? eas_redis_ind->valueint : 0, + max_allowed_up_lat ? true : false, + max_allowed_up_lat ? max_allowed_up_lat->valuedouble : 0 ); return af_routing_requirement_local_var; @@ -274,6 +415,13 @@ end: OpenAPI_up_path_chg_event_free(up_path_chg_sub_local_nonprim); up_path_chg_sub_local_nonprim = NULL; } + if (eas_ip_replace_infosList) { + OpenAPI_list_for_each(eas_ip_replace_infosList, node) { + OpenAPI_eas_ip_replacement_info_free(node->data); + } + OpenAPI_list_free(eas_ip_replace_infosList); + eas_ip_replace_infosList = NULL; + } return NULL; } diff --git a/lib/sbi/openapi/model/af_routing_requirement.h b/lib/sbi/openapi/model/af_routing_requirement.h index ccf94d746..426ae2028 100644 --- a/lib/sbi/openapi/model/af_routing_requirement.h +++ b/lib/sbi/openapi/model/af_routing_requirement.h @@ -1,7 +1,7 @@ /* * af_routing_requirement.h * - * describes the event information delivered in the subscription + * Describes the event information delivered in the subscription. */ #ifndef _OpenAPI_af_routing_requirement_H_ @@ -12,6 +12,7 @@ #include "../include/list.h" #include "../include/keyValuePair.h" #include "../include/binary.h" +#include "eas_ip_replacement_info.h" #include "route_to_location.h" #include "spatial_validity.h" #include "temporal_validity.h" @@ -31,6 +32,15 @@ typedef struct OpenAPI_af_routing_requirement_s { struct OpenAPI_up_path_chg_event_s *up_path_chg_sub; bool is_addr_preser_ind; int addr_preser_ind; + bool is_sim_conn_ind; + int sim_conn_ind; + bool is_sim_conn_term; + int sim_conn_term; + OpenAPI_list_t *eas_ip_replace_infos; + bool is_eas_redis_ind; + int eas_redis_ind; + bool is_max_allowed_up_lat; + int max_allowed_up_lat; } OpenAPI_af_routing_requirement_t; OpenAPI_af_routing_requirement_t *OpenAPI_af_routing_requirement_create( @@ -41,7 +51,16 @@ OpenAPI_af_routing_requirement_t *OpenAPI_af_routing_requirement_create( OpenAPI_list_t *temp_vals, OpenAPI_up_path_chg_event_t *up_path_chg_sub, bool is_addr_preser_ind, - int addr_preser_ind + int addr_preser_ind, + bool is_sim_conn_ind, + int sim_conn_ind, + bool is_sim_conn_term, + int sim_conn_term, + OpenAPI_list_t *eas_ip_replace_infos, + bool is_eas_redis_ind, + int eas_redis_ind, + bool is_max_allowed_up_lat, + int max_allowed_up_lat ); void OpenAPI_af_routing_requirement_free(OpenAPI_af_routing_requirement_t *af_routing_requirement); OpenAPI_af_routing_requirement_t *OpenAPI_af_routing_requirement_parseFromJSON(cJSON *af_routing_requirementJSON); diff --git a/lib/sbi/openapi/model/af_routing_requirement_rm.c b/lib/sbi/openapi/model/af_routing_requirement_rm.c index a511ff138..a0bca0185 100644 --- a/lib/sbi/openapi/model/af_routing_requirement_rm.c +++ b/lib/sbi/openapi/model/af_routing_requirement_rm.c @@ -12,7 +12,16 @@ OpenAPI_af_routing_requirement_rm_t *OpenAPI_af_routing_requirement_rm_create( OpenAPI_list_t *temp_vals, OpenAPI_up_path_chg_event_t *up_path_chg_sub, bool is_addr_preser_ind, - int addr_preser_ind + int addr_preser_ind, + bool is_sim_conn_ind, + int sim_conn_ind, + bool is_sim_conn_term, + int sim_conn_term, + OpenAPI_list_t *eas_ip_replace_infos, + bool is_eas_redis_ind, + int eas_redis_ind, + bool is_max_allowed_up_lat, + int max_allowed_up_lat ) { OpenAPI_af_routing_requirement_rm_t *af_routing_requirement_rm_local_var = ogs_malloc(sizeof(OpenAPI_af_routing_requirement_rm_t)); @@ -26,6 +35,15 @@ OpenAPI_af_routing_requirement_rm_t *OpenAPI_af_routing_requirement_rm_create( af_routing_requirement_rm_local_var->up_path_chg_sub = up_path_chg_sub; af_routing_requirement_rm_local_var->is_addr_preser_ind = is_addr_preser_ind; af_routing_requirement_rm_local_var->addr_preser_ind = addr_preser_ind; + af_routing_requirement_rm_local_var->is_sim_conn_ind = is_sim_conn_ind; + af_routing_requirement_rm_local_var->sim_conn_ind = sim_conn_ind; + af_routing_requirement_rm_local_var->is_sim_conn_term = is_sim_conn_term; + af_routing_requirement_rm_local_var->sim_conn_term = sim_conn_term; + af_routing_requirement_rm_local_var->eas_ip_replace_infos = eas_ip_replace_infos; + af_routing_requirement_rm_local_var->is_eas_redis_ind = is_eas_redis_ind; + af_routing_requirement_rm_local_var->eas_redis_ind = eas_redis_ind; + af_routing_requirement_rm_local_var->is_max_allowed_up_lat = is_max_allowed_up_lat; + af_routing_requirement_rm_local_var->max_allowed_up_lat = max_allowed_up_lat; return af_routing_requirement_rm_local_var; } @@ -59,6 +77,13 @@ void OpenAPI_af_routing_requirement_rm_free(OpenAPI_af_routing_requirement_rm_t OpenAPI_up_path_chg_event_free(af_routing_requirement_rm->up_path_chg_sub); af_routing_requirement_rm->up_path_chg_sub = NULL; } + if (af_routing_requirement_rm->eas_ip_replace_infos) { + OpenAPI_list_for_each(af_routing_requirement_rm->eas_ip_replace_infos, node) { + OpenAPI_eas_ip_replacement_info_free(node->data); + } + OpenAPI_list_free(af_routing_requirement_rm->eas_ip_replace_infos); + af_routing_requirement_rm->eas_ip_replace_infos = NULL; + } ogs_free(af_routing_requirement_rm); } @@ -145,6 +170,50 @@ cJSON *OpenAPI_af_routing_requirement_rm_convertToJSON(OpenAPI_af_routing_requir } } + if (af_routing_requirement_rm->is_sim_conn_ind) { + if (cJSON_AddBoolToObject(item, "simConnInd", af_routing_requirement_rm->sim_conn_ind) == NULL) { + ogs_error("OpenAPI_af_routing_requirement_rm_convertToJSON() failed [sim_conn_ind]"); + goto end; + } + } + + if (af_routing_requirement_rm->is_sim_conn_term) { + if (cJSON_AddNumberToObject(item, "simConnTerm", af_routing_requirement_rm->sim_conn_term) == NULL) { + ogs_error("OpenAPI_af_routing_requirement_rm_convertToJSON() failed [sim_conn_term]"); + goto end; + } + } + + if (af_routing_requirement_rm->eas_ip_replace_infos) { + cJSON *eas_ip_replace_infosList = cJSON_AddArrayToObject(item, "easIpReplaceInfos"); + if (eas_ip_replace_infosList == NULL) { + ogs_error("OpenAPI_af_routing_requirement_rm_convertToJSON() failed [eas_ip_replace_infos]"); + goto end; + } + OpenAPI_list_for_each(af_routing_requirement_rm->eas_ip_replace_infos, node) { + cJSON *itemLocal = OpenAPI_eas_ip_replacement_info_convertToJSON(node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_af_routing_requirement_rm_convertToJSON() failed [eas_ip_replace_infos]"); + goto end; + } + cJSON_AddItemToArray(eas_ip_replace_infosList, itemLocal); + } + } + + if (af_routing_requirement_rm->is_eas_redis_ind) { + if (cJSON_AddBoolToObject(item, "easRedisInd", af_routing_requirement_rm->eas_redis_ind) == NULL) { + ogs_error("OpenAPI_af_routing_requirement_rm_convertToJSON() failed [eas_redis_ind]"); + goto end; + } + } + + if (af_routing_requirement_rm->is_max_allowed_up_lat) { + if (cJSON_AddNumberToObject(item, "maxAllowedUpLat", af_routing_requirement_rm->max_allowed_up_lat) == NULL) { + ogs_error("OpenAPI_af_routing_requirement_rm_convertToJSON() failed [max_allowed_up_lat]"); + goto end; + } + } + end: return item; } @@ -163,6 +232,12 @@ OpenAPI_af_routing_requirement_rm_t *OpenAPI_af_routing_requirement_rm_parseFrom cJSON *up_path_chg_sub = NULL; OpenAPI_up_path_chg_event_t *up_path_chg_sub_local_nonprim = NULL; cJSON *addr_preser_ind = NULL; + cJSON *sim_conn_ind = NULL; + cJSON *sim_conn_term = NULL; + cJSON *eas_ip_replace_infos = NULL; + OpenAPI_list_t *eas_ip_replace_infosList = NULL; + cJSON *eas_redis_ind = NULL; + cJSON *max_allowed_up_lat = NULL; app_reloc = cJSON_GetObjectItemCaseSensitive(af_routing_requirement_rmJSON, "appReloc"); if (app_reloc) { if (!cJSON_IsBool(app_reloc)) { @@ -239,6 +314,63 @@ OpenAPI_af_routing_requirement_rm_t *OpenAPI_af_routing_requirement_rm_parseFrom } } + sim_conn_ind = cJSON_GetObjectItemCaseSensitive(af_routing_requirement_rmJSON, "simConnInd"); + if (sim_conn_ind) { + if (!cJSON_IsBool(sim_conn_ind)) { + ogs_error("OpenAPI_af_routing_requirement_rm_parseFromJSON() failed [sim_conn_ind]"); + goto end; + } + } + + sim_conn_term = cJSON_GetObjectItemCaseSensitive(af_routing_requirement_rmJSON, "simConnTerm"); + if (sim_conn_term) { + if (!cJSON_IsNumber(sim_conn_term)) { + ogs_error("OpenAPI_af_routing_requirement_rm_parseFromJSON() failed [sim_conn_term]"); + goto end; + } + } + + eas_ip_replace_infos = cJSON_GetObjectItemCaseSensitive(af_routing_requirement_rmJSON, "easIpReplaceInfos"); + if (eas_ip_replace_infos) { + cJSON *eas_ip_replace_infos_local = NULL; + if (!cJSON_IsArray(eas_ip_replace_infos)) { + ogs_error("OpenAPI_af_routing_requirement_rm_parseFromJSON() failed [eas_ip_replace_infos]"); + goto end; + } + + eas_ip_replace_infosList = OpenAPI_list_create(); + + cJSON_ArrayForEach(eas_ip_replace_infos_local, eas_ip_replace_infos) { + if (!cJSON_IsObject(eas_ip_replace_infos_local)) { + ogs_error("OpenAPI_af_routing_requirement_rm_parseFromJSON() failed [eas_ip_replace_infos]"); + goto end; + } + OpenAPI_eas_ip_replacement_info_t *eas_ip_replace_infosItem = OpenAPI_eas_ip_replacement_info_parseFromJSON(eas_ip_replace_infos_local); + if (!eas_ip_replace_infosItem) { + ogs_error("No eas_ip_replace_infosItem"); + OpenAPI_list_free(eas_ip_replace_infosList); + goto end; + } + OpenAPI_list_add(eas_ip_replace_infosList, eas_ip_replace_infosItem); + } + } + + eas_redis_ind = cJSON_GetObjectItemCaseSensitive(af_routing_requirement_rmJSON, "easRedisInd"); + if (eas_redis_ind) { + if (!cJSON_IsBool(eas_redis_ind)) { + ogs_error("OpenAPI_af_routing_requirement_rm_parseFromJSON() failed [eas_redis_ind]"); + goto end; + } + } + + max_allowed_up_lat = cJSON_GetObjectItemCaseSensitive(af_routing_requirement_rmJSON, "maxAllowedUpLat"); + if (max_allowed_up_lat) { + if (!cJSON_IsNumber(max_allowed_up_lat)) { + ogs_error("OpenAPI_af_routing_requirement_rm_parseFromJSON() failed [max_allowed_up_lat]"); + goto end; + } + } + af_routing_requirement_rm_local_var = OpenAPI_af_routing_requirement_rm_create ( app_reloc ? true : false, app_reloc ? app_reloc->valueint : 0, @@ -247,7 +379,16 @@ OpenAPI_af_routing_requirement_rm_t *OpenAPI_af_routing_requirement_rm_parseFrom temp_vals ? temp_valsList : NULL, up_path_chg_sub ? up_path_chg_sub_local_nonprim : NULL, addr_preser_ind ? true : false, - addr_preser_ind ? addr_preser_ind->valueint : 0 + addr_preser_ind ? addr_preser_ind->valueint : 0, + sim_conn_ind ? true : false, + sim_conn_ind ? sim_conn_ind->valueint : 0, + sim_conn_term ? true : false, + sim_conn_term ? sim_conn_term->valuedouble : 0, + eas_ip_replace_infos ? eas_ip_replace_infosList : NULL, + eas_redis_ind ? true : false, + eas_redis_ind ? eas_redis_ind->valueint : 0, + max_allowed_up_lat ? true : false, + max_allowed_up_lat ? max_allowed_up_lat->valuedouble : 0 ); return af_routing_requirement_rm_local_var; @@ -274,6 +415,13 @@ end: OpenAPI_up_path_chg_event_free(up_path_chg_sub_local_nonprim); up_path_chg_sub_local_nonprim = NULL; } + if (eas_ip_replace_infosList) { + OpenAPI_list_for_each(eas_ip_replace_infosList, node) { + OpenAPI_eas_ip_replacement_info_free(node->data); + } + OpenAPI_list_free(eas_ip_replace_infosList); + eas_ip_replace_infosList = NULL; + } return NULL; } diff --git a/lib/sbi/openapi/model/af_routing_requirement_rm.h b/lib/sbi/openapi/model/af_routing_requirement_rm.h index 67a7f64a2..9ea9d21e1 100644 --- a/lib/sbi/openapi/model/af_routing_requirement_rm.h +++ b/lib/sbi/openapi/model/af_routing_requirement_rm.h @@ -1,7 +1,7 @@ /* * af_routing_requirement_rm.h * - * this data type is defined in the same way as the AfRoutingRequirement data type, but with the OpenAPI nullable property set to true and the spVal and tempVals attributes defined as removable. + * This data type is defined in the same way as the AfRoutingRequirement data type, but with the OpenAPI nullable property set to true and the spVal and tempVals attributes defined as removable. */ #ifndef _OpenAPI_af_routing_requirement_rm_H_ @@ -12,6 +12,7 @@ #include "../include/list.h" #include "../include/keyValuePair.h" #include "../include/binary.h" +#include "eas_ip_replacement_info.h" #include "route_to_location.h" #include "spatial_validity_rm.h" #include "temporal_validity.h" @@ -31,6 +32,15 @@ typedef struct OpenAPI_af_routing_requirement_rm_s { struct OpenAPI_up_path_chg_event_s *up_path_chg_sub; bool is_addr_preser_ind; int addr_preser_ind; + bool is_sim_conn_ind; + int sim_conn_ind; + bool is_sim_conn_term; + int sim_conn_term; + OpenAPI_list_t *eas_ip_replace_infos; + bool is_eas_redis_ind; + int eas_redis_ind; + bool is_max_allowed_up_lat; + int max_allowed_up_lat; } OpenAPI_af_routing_requirement_rm_t; OpenAPI_af_routing_requirement_rm_t *OpenAPI_af_routing_requirement_rm_create( @@ -41,7 +51,16 @@ OpenAPI_af_routing_requirement_rm_t *OpenAPI_af_routing_requirement_rm_create( OpenAPI_list_t *temp_vals, OpenAPI_up_path_chg_event_t *up_path_chg_sub, bool is_addr_preser_ind, - int addr_preser_ind + int addr_preser_ind, + bool is_sim_conn_ind, + int sim_conn_ind, + bool is_sim_conn_term, + int sim_conn_term, + OpenAPI_list_t *eas_ip_replace_infos, + bool is_eas_redis_ind, + int eas_redis_ind, + bool is_max_allowed_up_lat, + int max_allowed_up_lat ); void OpenAPI_af_routing_requirement_rm_free(OpenAPI_af_routing_requirement_rm_t *af_routing_requirement_rm); OpenAPI_af_routing_requirement_rm_t *OpenAPI_af_routing_requirement_rm_parseFromJSON(cJSON *af_routing_requirement_rmJSON); diff --git a/lib/sbi/openapi/model/allowed_nssai.h b/lib/sbi/openapi/model/allowed_nssai.h index e391ef069..a7a45ed21 100644 --- a/lib/sbi/openapi/model/allowed_nssai.h +++ b/lib/sbi/openapi/model/allowed_nssai.h @@ -1,7 +1,7 @@ /* * allowed_nssai.h * - * + * Contains an array of allowed S-NSSAI that constitute the allowed NSSAI information for the authorized network slice information */ #ifndef _OpenAPI_allowed_nssai_H_ diff --git a/lib/sbi/openapi/model/allowed_snssai.h b/lib/sbi/openapi/model/allowed_snssai.h index 64b8d780d..c922d1665 100644 --- a/lib/sbi/openapi/model/allowed_snssai.h +++ b/lib/sbi/openapi/model/allowed_snssai.h @@ -1,7 +1,7 @@ /* * allowed_snssai.h * - * + * Contains the authorized S-NSSAI and optional mapped home S-NSSAI and network slice instance information */ #ifndef _OpenAPI_allowed_snssai_H_ diff --git a/lib/sbi/openapi/model/alternative_qos_profile.h b/lib/sbi/openapi/model/alternative_qos_profile.h index df7cf36cd..1b100be04 100644 --- a/lib/sbi/openapi/model/alternative_qos_profile.h +++ b/lib/sbi/openapi/model/alternative_qos_profile.h @@ -1,7 +1,7 @@ /* * alternative_qos_profile.h * - * + * Alternative QoS Profile */ #ifndef _OpenAPI_alternative_qos_profile_H_ diff --git a/lib/sbi/openapi/model/alternative_service_requirements_data.c b/lib/sbi/openapi/model/alternative_service_requirements_data.c new file mode 100644 index 000000000..ad565f5a9 --- /dev/null +++ b/lib/sbi/openapi/model/alternative_service_requirements_data.c @@ -0,0 +1,182 @@ + +#include +#include +#include +#include "alternative_service_requirements_data.h" + +OpenAPI_alternative_service_requirements_data_t *OpenAPI_alternative_service_requirements_data_create( + char *alt_qos_param_set_ref, + char *gbr_ul, + char *gbr_dl, + bool is_pdb, + int pdb +) +{ + OpenAPI_alternative_service_requirements_data_t *alternative_service_requirements_data_local_var = ogs_malloc(sizeof(OpenAPI_alternative_service_requirements_data_t)); + ogs_assert(alternative_service_requirements_data_local_var); + + alternative_service_requirements_data_local_var->alt_qos_param_set_ref = alt_qos_param_set_ref; + alternative_service_requirements_data_local_var->gbr_ul = gbr_ul; + alternative_service_requirements_data_local_var->gbr_dl = gbr_dl; + alternative_service_requirements_data_local_var->is_pdb = is_pdb; + alternative_service_requirements_data_local_var->pdb = pdb; + + return alternative_service_requirements_data_local_var; +} + +void OpenAPI_alternative_service_requirements_data_free(OpenAPI_alternative_service_requirements_data_t *alternative_service_requirements_data) +{ + OpenAPI_lnode_t *node = NULL; + + if (NULL == alternative_service_requirements_data) { + return; + } + if (alternative_service_requirements_data->alt_qos_param_set_ref) { + ogs_free(alternative_service_requirements_data->alt_qos_param_set_ref); + alternative_service_requirements_data->alt_qos_param_set_ref = NULL; + } + if (alternative_service_requirements_data->gbr_ul) { + ogs_free(alternative_service_requirements_data->gbr_ul); + alternative_service_requirements_data->gbr_ul = NULL; + } + if (alternative_service_requirements_data->gbr_dl) { + ogs_free(alternative_service_requirements_data->gbr_dl); + alternative_service_requirements_data->gbr_dl = NULL; + } + ogs_free(alternative_service_requirements_data); +} + +cJSON *OpenAPI_alternative_service_requirements_data_convertToJSON(OpenAPI_alternative_service_requirements_data_t *alternative_service_requirements_data) +{ + cJSON *item = NULL; + OpenAPI_lnode_t *node = NULL; + + if (alternative_service_requirements_data == NULL) { + ogs_error("OpenAPI_alternative_service_requirements_data_convertToJSON() failed [AlternativeServiceRequirementsData]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (!alternative_service_requirements_data->alt_qos_param_set_ref) { + ogs_error("OpenAPI_alternative_service_requirements_data_convertToJSON() failed [alt_qos_param_set_ref]"); + return NULL; + } + if (cJSON_AddStringToObject(item, "altQosParamSetRef", alternative_service_requirements_data->alt_qos_param_set_ref) == NULL) { + ogs_error("OpenAPI_alternative_service_requirements_data_convertToJSON() failed [alt_qos_param_set_ref]"); + goto end; + } + + if (alternative_service_requirements_data->gbr_ul) { + if (cJSON_AddStringToObject(item, "gbrUl", alternative_service_requirements_data->gbr_ul) == NULL) { + ogs_error("OpenAPI_alternative_service_requirements_data_convertToJSON() failed [gbr_ul]"); + goto end; + } + } + + if (alternative_service_requirements_data->gbr_dl) { + if (cJSON_AddStringToObject(item, "gbrDl", alternative_service_requirements_data->gbr_dl) == NULL) { + ogs_error("OpenAPI_alternative_service_requirements_data_convertToJSON() failed [gbr_dl]"); + goto end; + } + } + + if (alternative_service_requirements_data->is_pdb) { + if (cJSON_AddNumberToObject(item, "pdb", alternative_service_requirements_data->pdb) == NULL) { + ogs_error("OpenAPI_alternative_service_requirements_data_convertToJSON() failed [pdb]"); + goto end; + } + } + +end: + return item; +} + +OpenAPI_alternative_service_requirements_data_t *OpenAPI_alternative_service_requirements_data_parseFromJSON(cJSON *alternative_service_requirements_dataJSON) +{ + OpenAPI_alternative_service_requirements_data_t *alternative_service_requirements_data_local_var = NULL; + OpenAPI_lnode_t *node = NULL; + cJSON *alt_qos_param_set_ref = NULL; + cJSON *gbr_ul = NULL; + cJSON *gbr_dl = NULL; + cJSON *pdb = NULL; + alt_qos_param_set_ref = cJSON_GetObjectItemCaseSensitive(alternative_service_requirements_dataJSON, "altQosParamSetRef"); + if (!alt_qos_param_set_ref) { + ogs_error("OpenAPI_alternative_service_requirements_data_parseFromJSON() failed [alt_qos_param_set_ref]"); + goto end; + } + if (!cJSON_IsString(alt_qos_param_set_ref)) { + ogs_error("OpenAPI_alternative_service_requirements_data_parseFromJSON() failed [alt_qos_param_set_ref]"); + goto end; + } + + gbr_ul = cJSON_GetObjectItemCaseSensitive(alternative_service_requirements_dataJSON, "gbrUl"); + if (gbr_ul) { + if (!cJSON_IsString(gbr_ul) && !cJSON_IsNull(gbr_ul)) { + ogs_error("OpenAPI_alternative_service_requirements_data_parseFromJSON() failed [gbr_ul]"); + goto end; + } + } + + gbr_dl = cJSON_GetObjectItemCaseSensitive(alternative_service_requirements_dataJSON, "gbrDl"); + if (gbr_dl) { + if (!cJSON_IsString(gbr_dl) && !cJSON_IsNull(gbr_dl)) { + ogs_error("OpenAPI_alternative_service_requirements_data_parseFromJSON() failed [gbr_dl]"); + goto end; + } + } + + pdb = cJSON_GetObjectItemCaseSensitive(alternative_service_requirements_dataJSON, "pdb"); + if (pdb) { + if (!cJSON_IsNumber(pdb)) { + ogs_error("OpenAPI_alternative_service_requirements_data_parseFromJSON() failed [pdb]"); + goto end; + } + } + + alternative_service_requirements_data_local_var = OpenAPI_alternative_service_requirements_data_create ( + ogs_strdup(alt_qos_param_set_ref->valuestring), + gbr_ul && !cJSON_IsNull(gbr_ul) ? ogs_strdup(gbr_ul->valuestring) : NULL, + gbr_dl && !cJSON_IsNull(gbr_dl) ? ogs_strdup(gbr_dl->valuestring) : NULL, + pdb ? true : false, + pdb ? pdb->valuedouble : 0 + ); + + return alternative_service_requirements_data_local_var; +end: + return NULL; +} + +OpenAPI_alternative_service_requirements_data_t *OpenAPI_alternative_service_requirements_data_copy(OpenAPI_alternative_service_requirements_data_t *dst, OpenAPI_alternative_service_requirements_data_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_alternative_service_requirements_data_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_alternative_service_requirements_data_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_alternative_service_requirements_data_free(dst); + dst = OpenAPI_alternative_service_requirements_data_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/alternative_service_requirements_data.h b/lib/sbi/openapi/model/alternative_service_requirements_data.h new file mode 100644 index 000000000..e2f35b020 --- /dev/null +++ b/lib/sbi/openapi/model/alternative_service_requirements_data.h @@ -0,0 +1,46 @@ +/* + * alternative_service_requirements_data.h + * + * Contains an alternative QoS related parameter set. + */ + +#ifndef _OpenAPI_alternative_service_requirements_data_H_ +#define _OpenAPI_alternative_service_requirements_data_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_alternative_service_requirements_data_s OpenAPI_alternative_service_requirements_data_t; +typedef struct OpenAPI_alternative_service_requirements_data_s { + char *alt_qos_param_set_ref; + char *gbr_ul; + char *gbr_dl; + bool is_pdb; + int pdb; +} OpenAPI_alternative_service_requirements_data_t; + +OpenAPI_alternative_service_requirements_data_t *OpenAPI_alternative_service_requirements_data_create( + char *alt_qos_param_set_ref, + char *gbr_ul, + char *gbr_dl, + bool is_pdb, + int pdb +); +void OpenAPI_alternative_service_requirements_data_free(OpenAPI_alternative_service_requirements_data_t *alternative_service_requirements_data); +OpenAPI_alternative_service_requirements_data_t *OpenAPI_alternative_service_requirements_data_parseFromJSON(cJSON *alternative_service_requirements_dataJSON); +cJSON *OpenAPI_alternative_service_requirements_data_convertToJSON(OpenAPI_alternative_service_requirements_data_t *alternative_service_requirements_data); +OpenAPI_alternative_service_requirements_data_t *OpenAPI_alternative_service_requirements_data_copy(OpenAPI_alternative_service_requirements_data_t *dst, OpenAPI_alternative_service_requirements_data_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_alternative_service_requirements_data_H_ */ + diff --git a/lib/sbi/openapi/model/am_influ_data.c b/lib/sbi/openapi/model/am_influ_data.c new file mode 100644 index 000000000..fbaeec513 --- /dev/null +++ b/lib/sbi/openapi/model/am_influ_data.c @@ -0,0 +1,633 @@ + +#include +#include +#include +#include "am_influ_data.h" + +OpenAPI_am_influ_data_t *OpenAPI_am_influ_data_create( + OpenAPI_list_t *app_ids, + OpenAPI_list_t *dnn_snssai_infos, + char *inter_group_id, + char *supi, + bool is_any_ue_ind, + int any_ue_ind, + bool is_policy_duration, + int policy_duration, + OpenAPI_list_t *ev_subs, + char *notif_uri, + char *notif_corr_id, + OpenAPI_list_t *headers, + bool is_thru_req, + int thru_req, + OpenAPI_list_t *cov_req, + char *supported_features, + char *res_uri, + OpenAPI_list_t *reset_ids +) +{ + OpenAPI_am_influ_data_t *am_influ_data_local_var = ogs_malloc(sizeof(OpenAPI_am_influ_data_t)); + ogs_assert(am_influ_data_local_var); + + am_influ_data_local_var->app_ids = app_ids; + am_influ_data_local_var->dnn_snssai_infos = dnn_snssai_infos; + am_influ_data_local_var->inter_group_id = inter_group_id; + am_influ_data_local_var->supi = supi; + am_influ_data_local_var->is_any_ue_ind = is_any_ue_ind; + am_influ_data_local_var->any_ue_ind = any_ue_ind; + am_influ_data_local_var->is_policy_duration = is_policy_duration; + am_influ_data_local_var->policy_duration = policy_duration; + am_influ_data_local_var->ev_subs = ev_subs; + am_influ_data_local_var->notif_uri = notif_uri; + am_influ_data_local_var->notif_corr_id = notif_corr_id; + am_influ_data_local_var->headers = headers; + am_influ_data_local_var->is_thru_req = is_thru_req; + am_influ_data_local_var->thru_req = thru_req; + am_influ_data_local_var->cov_req = cov_req; + am_influ_data_local_var->supported_features = supported_features; + am_influ_data_local_var->res_uri = res_uri; + am_influ_data_local_var->reset_ids = reset_ids; + + return am_influ_data_local_var; +} + +void OpenAPI_am_influ_data_free(OpenAPI_am_influ_data_t *am_influ_data) +{ + OpenAPI_lnode_t *node = NULL; + + if (NULL == am_influ_data) { + return; + } + if (am_influ_data->app_ids) { + OpenAPI_list_for_each(am_influ_data->app_ids, node) { + ogs_free(node->data); + } + OpenAPI_list_free(am_influ_data->app_ids); + am_influ_data->app_ids = NULL; + } + if (am_influ_data->dnn_snssai_infos) { + OpenAPI_list_for_each(am_influ_data->dnn_snssai_infos, node) { + OpenAPI_dnn_snssai_information_free(node->data); + } + OpenAPI_list_free(am_influ_data->dnn_snssai_infos); + am_influ_data->dnn_snssai_infos = NULL; + } + if (am_influ_data->inter_group_id) { + ogs_free(am_influ_data->inter_group_id); + am_influ_data->inter_group_id = NULL; + } + if (am_influ_data->supi) { + ogs_free(am_influ_data->supi); + am_influ_data->supi = NULL; + } + if (am_influ_data->ev_subs) { + OpenAPI_list_for_each(am_influ_data->ev_subs, node) { + OpenAPI_am_influ_event_free(node->data); + } + OpenAPI_list_free(am_influ_data->ev_subs); + am_influ_data->ev_subs = NULL; + } + if (am_influ_data->notif_uri) { + ogs_free(am_influ_data->notif_uri); + am_influ_data->notif_uri = NULL; + } + if (am_influ_data->notif_corr_id) { + ogs_free(am_influ_data->notif_corr_id); + am_influ_data->notif_corr_id = NULL; + } + if (am_influ_data->headers) { + OpenAPI_list_for_each(am_influ_data->headers, node) { + ogs_free(node->data); + } + OpenAPI_list_free(am_influ_data->headers); + am_influ_data->headers = NULL; + } + if (am_influ_data->cov_req) { + OpenAPI_list_for_each(am_influ_data->cov_req, node) { + OpenAPI_service_area_coverage_info_free(node->data); + } + OpenAPI_list_free(am_influ_data->cov_req); + am_influ_data->cov_req = NULL; + } + if (am_influ_data->supported_features) { + ogs_free(am_influ_data->supported_features); + am_influ_data->supported_features = NULL; + } + if (am_influ_data->res_uri) { + ogs_free(am_influ_data->res_uri); + am_influ_data->res_uri = NULL; + } + if (am_influ_data->reset_ids) { + OpenAPI_list_for_each(am_influ_data->reset_ids, node) { + ogs_free(node->data); + } + OpenAPI_list_free(am_influ_data->reset_ids); + am_influ_data->reset_ids = NULL; + } + ogs_free(am_influ_data); +} + +cJSON *OpenAPI_am_influ_data_convertToJSON(OpenAPI_am_influ_data_t *am_influ_data) +{ + cJSON *item = NULL; + OpenAPI_lnode_t *node = NULL; + + if (am_influ_data == NULL) { + ogs_error("OpenAPI_am_influ_data_convertToJSON() failed [AmInfluData]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (am_influ_data->app_ids) { + cJSON *app_idsList = cJSON_AddArrayToObject(item, "appIds"); + if (app_idsList == NULL) { + ogs_error("OpenAPI_am_influ_data_convertToJSON() failed [app_ids]"); + goto end; + } + OpenAPI_list_for_each(am_influ_data->app_ids, node) { + if (cJSON_AddStringToObject(app_idsList, "", (char*)node->data) == NULL) { + ogs_error("OpenAPI_am_influ_data_convertToJSON() failed [app_ids]"); + goto end; + } + } + } + + if (am_influ_data->dnn_snssai_infos) { + cJSON *dnn_snssai_infosList = cJSON_AddArrayToObject(item, "dnnSnssaiInfos"); + if (dnn_snssai_infosList == NULL) { + ogs_error("OpenAPI_am_influ_data_convertToJSON() failed [dnn_snssai_infos]"); + goto end; + } + OpenAPI_list_for_each(am_influ_data->dnn_snssai_infos, node) { + cJSON *itemLocal = OpenAPI_dnn_snssai_information_convertToJSON(node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_am_influ_data_convertToJSON() failed [dnn_snssai_infos]"); + goto end; + } + cJSON_AddItemToArray(dnn_snssai_infosList, itemLocal); + } + } + + if (am_influ_data->inter_group_id) { + if (cJSON_AddStringToObject(item, "interGroupId", am_influ_data->inter_group_id) == NULL) { + ogs_error("OpenAPI_am_influ_data_convertToJSON() failed [inter_group_id]"); + goto end; + } + } + + if (am_influ_data->supi) { + if (cJSON_AddStringToObject(item, "supi", am_influ_data->supi) == NULL) { + ogs_error("OpenAPI_am_influ_data_convertToJSON() failed [supi]"); + goto end; + } + } + + if (am_influ_data->is_any_ue_ind) { + if (cJSON_AddBoolToObject(item, "anyUeInd", am_influ_data->any_ue_ind) == NULL) { + ogs_error("OpenAPI_am_influ_data_convertToJSON() failed [any_ue_ind]"); + goto end; + } + } + + if (am_influ_data->is_policy_duration) { + if (cJSON_AddNumberToObject(item, "policyDuration", am_influ_data->policy_duration) == NULL) { + ogs_error("OpenAPI_am_influ_data_convertToJSON() failed [policy_duration]"); + goto end; + } + } + + if (am_influ_data->ev_subs) { + cJSON *ev_subsList = cJSON_AddArrayToObject(item, "evSubs"); + if (ev_subsList == NULL) { + ogs_error("OpenAPI_am_influ_data_convertToJSON() failed [ev_subs]"); + goto end; + } + OpenAPI_list_for_each(am_influ_data->ev_subs, node) { + cJSON *itemLocal = OpenAPI_am_influ_event_convertToJSON(node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_am_influ_data_convertToJSON() failed [ev_subs]"); + goto end; + } + cJSON_AddItemToArray(ev_subsList, itemLocal); + } + } + + if (am_influ_data->notif_uri) { + if (cJSON_AddStringToObject(item, "notifUri", am_influ_data->notif_uri) == NULL) { + ogs_error("OpenAPI_am_influ_data_convertToJSON() failed [notif_uri]"); + goto end; + } + } + + if (am_influ_data->notif_corr_id) { + if (cJSON_AddStringToObject(item, "notifCorrId", am_influ_data->notif_corr_id) == NULL) { + ogs_error("OpenAPI_am_influ_data_convertToJSON() failed [notif_corr_id]"); + goto end; + } + } + + if (am_influ_data->headers) { + cJSON *headersList = cJSON_AddArrayToObject(item, "headers"); + if (headersList == NULL) { + ogs_error("OpenAPI_am_influ_data_convertToJSON() failed [headers]"); + goto end; + } + OpenAPI_list_for_each(am_influ_data->headers, node) { + if (cJSON_AddStringToObject(headersList, "", (char*)node->data) == NULL) { + ogs_error("OpenAPI_am_influ_data_convertToJSON() failed [headers]"); + goto end; + } + } + } + + if (am_influ_data->is_thru_req) { + if (cJSON_AddBoolToObject(item, "thruReq", am_influ_data->thru_req) == NULL) { + ogs_error("OpenAPI_am_influ_data_convertToJSON() failed [thru_req]"); + goto end; + } + } + + if (am_influ_data->cov_req) { + cJSON *cov_reqList = cJSON_AddArrayToObject(item, "covReq"); + if (cov_reqList == NULL) { + ogs_error("OpenAPI_am_influ_data_convertToJSON() failed [cov_req]"); + goto end; + } + OpenAPI_list_for_each(am_influ_data->cov_req, node) { + cJSON *itemLocal = OpenAPI_service_area_coverage_info_convertToJSON(node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_am_influ_data_convertToJSON() failed [cov_req]"); + goto end; + } + cJSON_AddItemToArray(cov_reqList, itemLocal); + } + } + + if (am_influ_data->supported_features) { + if (cJSON_AddStringToObject(item, "supportedFeatures", am_influ_data->supported_features) == NULL) { + ogs_error("OpenAPI_am_influ_data_convertToJSON() failed [supported_features]"); + goto end; + } + } + + if (am_influ_data->res_uri) { + if (cJSON_AddStringToObject(item, "resUri", am_influ_data->res_uri) == NULL) { + ogs_error("OpenAPI_am_influ_data_convertToJSON() failed [res_uri]"); + goto end; + } + } + + if (am_influ_data->reset_ids) { + cJSON *reset_idsList = cJSON_AddArrayToObject(item, "resetIds"); + if (reset_idsList == NULL) { + ogs_error("OpenAPI_am_influ_data_convertToJSON() failed [reset_ids]"); + goto end; + } + OpenAPI_list_for_each(am_influ_data->reset_ids, node) { + if (cJSON_AddStringToObject(reset_idsList, "", (char*)node->data) == NULL) { + ogs_error("OpenAPI_am_influ_data_convertToJSON() failed [reset_ids]"); + goto end; + } + } + } + +end: + return item; +} + +OpenAPI_am_influ_data_t *OpenAPI_am_influ_data_parseFromJSON(cJSON *am_influ_dataJSON) +{ + OpenAPI_am_influ_data_t *am_influ_data_local_var = NULL; + OpenAPI_lnode_t *node = NULL; + cJSON *app_ids = NULL; + OpenAPI_list_t *app_idsList = NULL; + cJSON *dnn_snssai_infos = NULL; + OpenAPI_list_t *dnn_snssai_infosList = NULL; + cJSON *inter_group_id = NULL; + cJSON *supi = NULL; + cJSON *any_ue_ind = NULL; + cJSON *policy_duration = NULL; + cJSON *ev_subs = NULL; + OpenAPI_list_t *ev_subsList = NULL; + cJSON *notif_uri = NULL; + cJSON *notif_corr_id = NULL; + cJSON *headers = NULL; + OpenAPI_list_t *headersList = NULL; + cJSON *thru_req = NULL; + cJSON *cov_req = NULL; + OpenAPI_list_t *cov_reqList = NULL; + cJSON *supported_features = NULL; + cJSON *res_uri = NULL; + cJSON *reset_ids = NULL; + OpenAPI_list_t *reset_idsList = NULL; + app_ids = cJSON_GetObjectItemCaseSensitive(am_influ_dataJSON, "appIds"); + if (app_ids) { + cJSON *app_ids_local = NULL; + if (!cJSON_IsArray(app_ids)) { + ogs_error("OpenAPI_am_influ_data_parseFromJSON() failed [app_ids]"); + goto end; + } + + app_idsList = OpenAPI_list_create(); + + cJSON_ArrayForEach(app_ids_local, app_ids) { + double *localDouble = NULL; + int *localInt = NULL; + if (!cJSON_IsString(app_ids_local)) { + ogs_error("OpenAPI_am_influ_data_parseFromJSON() failed [app_ids]"); + goto end; + } + OpenAPI_list_add(app_idsList, ogs_strdup(app_ids_local->valuestring)); + } + } + + dnn_snssai_infos = cJSON_GetObjectItemCaseSensitive(am_influ_dataJSON, "dnnSnssaiInfos"); + if (dnn_snssai_infos) { + cJSON *dnn_snssai_infos_local = NULL; + if (!cJSON_IsArray(dnn_snssai_infos)) { + ogs_error("OpenAPI_am_influ_data_parseFromJSON() failed [dnn_snssai_infos]"); + goto end; + } + + dnn_snssai_infosList = OpenAPI_list_create(); + + cJSON_ArrayForEach(dnn_snssai_infos_local, dnn_snssai_infos) { + if (!cJSON_IsObject(dnn_snssai_infos_local)) { + ogs_error("OpenAPI_am_influ_data_parseFromJSON() failed [dnn_snssai_infos]"); + goto end; + } + OpenAPI_dnn_snssai_information_t *dnn_snssai_infosItem = OpenAPI_dnn_snssai_information_parseFromJSON(dnn_snssai_infos_local); + if (!dnn_snssai_infosItem) { + ogs_error("No dnn_snssai_infosItem"); + OpenAPI_list_free(dnn_snssai_infosList); + goto end; + } + OpenAPI_list_add(dnn_snssai_infosList, dnn_snssai_infosItem); + } + } + + inter_group_id = cJSON_GetObjectItemCaseSensitive(am_influ_dataJSON, "interGroupId"); + if (inter_group_id) { + if (!cJSON_IsString(inter_group_id) && !cJSON_IsNull(inter_group_id)) { + ogs_error("OpenAPI_am_influ_data_parseFromJSON() failed [inter_group_id]"); + goto end; + } + } + + supi = cJSON_GetObjectItemCaseSensitive(am_influ_dataJSON, "supi"); + if (supi) { + if (!cJSON_IsString(supi) && !cJSON_IsNull(supi)) { + ogs_error("OpenAPI_am_influ_data_parseFromJSON() failed [supi]"); + goto end; + } + } + + any_ue_ind = cJSON_GetObjectItemCaseSensitive(am_influ_dataJSON, "anyUeInd"); + if (any_ue_ind) { + if (!cJSON_IsBool(any_ue_ind)) { + ogs_error("OpenAPI_am_influ_data_parseFromJSON() failed [any_ue_ind]"); + goto end; + } + } + + policy_duration = cJSON_GetObjectItemCaseSensitive(am_influ_dataJSON, "policyDuration"); + if (policy_duration) { + if (!cJSON_IsNumber(policy_duration)) { + ogs_error("OpenAPI_am_influ_data_parseFromJSON() failed [policy_duration]"); + goto end; + } + } + + ev_subs = cJSON_GetObjectItemCaseSensitive(am_influ_dataJSON, "evSubs"); + if (ev_subs) { + cJSON *ev_subs_local = NULL; + if (!cJSON_IsArray(ev_subs)) { + ogs_error("OpenAPI_am_influ_data_parseFromJSON() failed [ev_subs]"); + goto end; + } + + ev_subsList = OpenAPI_list_create(); + + cJSON_ArrayForEach(ev_subs_local, ev_subs) { + if (!cJSON_IsObject(ev_subs_local)) { + ogs_error("OpenAPI_am_influ_data_parseFromJSON() failed [ev_subs]"); + goto end; + } + OpenAPI_am_influ_event_t *ev_subsItem = OpenAPI_am_influ_event_parseFromJSON(ev_subs_local); + if (!ev_subsItem) { + ogs_error("No ev_subsItem"); + OpenAPI_list_free(ev_subsList); + goto end; + } + OpenAPI_list_add(ev_subsList, ev_subsItem); + } + } + + notif_uri = cJSON_GetObjectItemCaseSensitive(am_influ_dataJSON, "notifUri"); + if (notif_uri) { + if (!cJSON_IsString(notif_uri) && !cJSON_IsNull(notif_uri)) { + ogs_error("OpenAPI_am_influ_data_parseFromJSON() failed [notif_uri]"); + goto end; + } + } + + notif_corr_id = cJSON_GetObjectItemCaseSensitive(am_influ_dataJSON, "notifCorrId"); + if (notif_corr_id) { + if (!cJSON_IsString(notif_corr_id) && !cJSON_IsNull(notif_corr_id)) { + ogs_error("OpenAPI_am_influ_data_parseFromJSON() failed [notif_corr_id]"); + goto end; + } + } + + headers = cJSON_GetObjectItemCaseSensitive(am_influ_dataJSON, "headers"); + if (headers) { + cJSON *headers_local = NULL; + if (!cJSON_IsArray(headers)) { + ogs_error("OpenAPI_am_influ_data_parseFromJSON() failed [headers]"); + goto end; + } + + headersList = OpenAPI_list_create(); + + cJSON_ArrayForEach(headers_local, headers) { + double *localDouble = NULL; + int *localInt = NULL; + if (!cJSON_IsString(headers_local)) { + ogs_error("OpenAPI_am_influ_data_parseFromJSON() failed [headers]"); + goto end; + } + OpenAPI_list_add(headersList, ogs_strdup(headers_local->valuestring)); + } + } + + thru_req = cJSON_GetObjectItemCaseSensitive(am_influ_dataJSON, "thruReq"); + if (thru_req) { + if (!cJSON_IsBool(thru_req)) { + ogs_error("OpenAPI_am_influ_data_parseFromJSON() failed [thru_req]"); + goto end; + } + } + + cov_req = cJSON_GetObjectItemCaseSensitive(am_influ_dataJSON, "covReq"); + if (cov_req) { + cJSON *cov_req_local = NULL; + if (!cJSON_IsArray(cov_req)) { + ogs_error("OpenAPI_am_influ_data_parseFromJSON() failed [cov_req]"); + goto end; + } + + cov_reqList = OpenAPI_list_create(); + + cJSON_ArrayForEach(cov_req_local, cov_req) { + if (!cJSON_IsObject(cov_req_local)) { + ogs_error("OpenAPI_am_influ_data_parseFromJSON() failed [cov_req]"); + goto end; + } + OpenAPI_service_area_coverage_info_t *cov_reqItem = OpenAPI_service_area_coverage_info_parseFromJSON(cov_req_local); + if (!cov_reqItem) { + ogs_error("No cov_reqItem"); + OpenAPI_list_free(cov_reqList); + goto end; + } + OpenAPI_list_add(cov_reqList, cov_reqItem); + } + } + + supported_features = cJSON_GetObjectItemCaseSensitive(am_influ_dataJSON, "supportedFeatures"); + if (supported_features) { + if (!cJSON_IsString(supported_features) && !cJSON_IsNull(supported_features)) { + ogs_error("OpenAPI_am_influ_data_parseFromJSON() failed [supported_features]"); + goto end; + } + } + + res_uri = cJSON_GetObjectItemCaseSensitive(am_influ_dataJSON, "resUri"); + if (res_uri) { + if (!cJSON_IsString(res_uri) && !cJSON_IsNull(res_uri)) { + ogs_error("OpenAPI_am_influ_data_parseFromJSON() failed [res_uri]"); + goto end; + } + } + + reset_ids = cJSON_GetObjectItemCaseSensitive(am_influ_dataJSON, "resetIds"); + if (reset_ids) { + cJSON *reset_ids_local = NULL; + if (!cJSON_IsArray(reset_ids)) { + ogs_error("OpenAPI_am_influ_data_parseFromJSON() failed [reset_ids]"); + goto end; + } + + reset_idsList = OpenAPI_list_create(); + + cJSON_ArrayForEach(reset_ids_local, reset_ids) { + double *localDouble = NULL; + int *localInt = NULL; + if (!cJSON_IsString(reset_ids_local)) { + ogs_error("OpenAPI_am_influ_data_parseFromJSON() failed [reset_ids]"); + goto end; + } + OpenAPI_list_add(reset_idsList, ogs_strdup(reset_ids_local->valuestring)); + } + } + + am_influ_data_local_var = OpenAPI_am_influ_data_create ( + app_ids ? app_idsList : NULL, + dnn_snssai_infos ? dnn_snssai_infosList : NULL, + inter_group_id && !cJSON_IsNull(inter_group_id) ? ogs_strdup(inter_group_id->valuestring) : NULL, + supi && !cJSON_IsNull(supi) ? ogs_strdup(supi->valuestring) : NULL, + any_ue_ind ? true : false, + any_ue_ind ? any_ue_ind->valueint : 0, + policy_duration ? true : false, + policy_duration ? policy_duration->valuedouble : 0, + ev_subs ? ev_subsList : NULL, + notif_uri && !cJSON_IsNull(notif_uri) ? ogs_strdup(notif_uri->valuestring) : NULL, + notif_corr_id && !cJSON_IsNull(notif_corr_id) ? ogs_strdup(notif_corr_id->valuestring) : NULL, + headers ? headersList : NULL, + thru_req ? true : false, + thru_req ? thru_req->valueint : 0, + cov_req ? cov_reqList : NULL, + supported_features && !cJSON_IsNull(supported_features) ? ogs_strdup(supported_features->valuestring) : NULL, + res_uri && !cJSON_IsNull(res_uri) ? ogs_strdup(res_uri->valuestring) : NULL, + reset_ids ? reset_idsList : NULL + ); + + return am_influ_data_local_var; +end: + if (app_idsList) { + OpenAPI_list_for_each(app_idsList, node) { + ogs_free(node->data); + } + OpenAPI_list_free(app_idsList); + app_idsList = NULL; + } + if (dnn_snssai_infosList) { + OpenAPI_list_for_each(dnn_snssai_infosList, node) { + OpenAPI_dnn_snssai_information_free(node->data); + } + OpenAPI_list_free(dnn_snssai_infosList); + dnn_snssai_infosList = NULL; + } + if (ev_subsList) { + OpenAPI_list_for_each(ev_subsList, node) { + OpenAPI_am_influ_event_free(node->data); + } + OpenAPI_list_free(ev_subsList); + ev_subsList = NULL; + } + if (headersList) { + OpenAPI_list_for_each(headersList, node) { + ogs_free(node->data); + } + OpenAPI_list_free(headersList); + headersList = NULL; + } + if (cov_reqList) { + OpenAPI_list_for_each(cov_reqList, node) { + OpenAPI_service_area_coverage_info_free(node->data); + } + OpenAPI_list_free(cov_reqList); + cov_reqList = NULL; + } + if (reset_idsList) { + OpenAPI_list_for_each(reset_idsList, node) { + ogs_free(node->data); + } + OpenAPI_list_free(reset_idsList); + reset_idsList = NULL; + } + return NULL; +} + +OpenAPI_am_influ_data_t *OpenAPI_am_influ_data_copy(OpenAPI_am_influ_data_t *dst, OpenAPI_am_influ_data_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_am_influ_data_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_am_influ_data_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_am_influ_data_free(dst); + dst = OpenAPI_am_influ_data_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/am_influ_data.h b/lib/sbi/openapi/model/am_influ_data.h new file mode 100644 index 000000000..71d2d0b77 --- /dev/null +++ b/lib/sbi/openapi/model/am_influ_data.h @@ -0,0 +1,75 @@ +/* + * am_influ_data.h + * + * Represents the AM Influence Data. + */ + +#ifndef _OpenAPI_am_influ_data_H_ +#define _OpenAPI_am_influ_data_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "am_influ_event.h" +#include "dnn_snssai_information.h" +#include "service_area_coverage_info.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_am_influ_data_s OpenAPI_am_influ_data_t; +typedef struct OpenAPI_am_influ_data_s { + OpenAPI_list_t *app_ids; + OpenAPI_list_t *dnn_snssai_infos; + char *inter_group_id; + char *supi; + bool is_any_ue_ind; + int any_ue_ind; + bool is_policy_duration; + int policy_duration; + OpenAPI_list_t *ev_subs; + char *notif_uri; + char *notif_corr_id; + OpenAPI_list_t *headers; + bool is_thru_req; + int thru_req; + OpenAPI_list_t *cov_req; + char *supported_features; + char *res_uri; + OpenAPI_list_t *reset_ids; +} OpenAPI_am_influ_data_t; + +OpenAPI_am_influ_data_t *OpenAPI_am_influ_data_create( + OpenAPI_list_t *app_ids, + OpenAPI_list_t *dnn_snssai_infos, + char *inter_group_id, + char *supi, + bool is_any_ue_ind, + int any_ue_ind, + bool is_policy_duration, + int policy_duration, + OpenAPI_list_t *ev_subs, + char *notif_uri, + char *notif_corr_id, + OpenAPI_list_t *headers, + bool is_thru_req, + int thru_req, + OpenAPI_list_t *cov_req, + char *supported_features, + char *res_uri, + OpenAPI_list_t *reset_ids +); +void OpenAPI_am_influ_data_free(OpenAPI_am_influ_data_t *am_influ_data); +OpenAPI_am_influ_data_t *OpenAPI_am_influ_data_parseFromJSON(cJSON *am_influ_dataJSON); +cJSON *OpenAPI_am_influ_data_convertToJSON(OpenAPI_am_influ_data_t *am_influ_data); +OpenAPI_am_influ_data_t *OpenAPI_am_influ_data_copy(OpenAPI_am_influ_data_t *dst, OpenAPI_am_influ_data_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_am_influ_data_H_ */ + diff --git a/lib/sbi/openapi/model/am_influ_event.c b/lib/sbi/openapi/model/am_influ_event.c new file mode 100644 index 000000000..e0182c8ff --- /dev/null +++ b/lib/sbi/openapi/model/am_influ_event.c @@ -0,0 +1,87 @@ + +#include +#include +#include +#include "am_influ_event.h" + +OpenAPI_am_influ_event_t *OpenAPI_am_influ_event_create( +) +{ + OpenAPI_am_influ_event_t *am_influ_event_local_var = ogs_malloc(sizeof(OpenAPI_am_influ_event_t)); + ogs_assert(am_influ_event_local_var); + + + return am_influ_event_local_var; +} + +void OpenAPI_am_influ_event_free(OpenAPI_am_influ_event_t *am_influ_event) +{ + OpenAPI_lnode_t *node = NULL; + + if (NULL == am_influ_event) { + return; + } + ogs_free(am_influ_event); +} + +cJSON *OpenAPI_am_influ_event_convertToJSON(OpenAPI_am_influ_event_t *am_influ_event) +{ + cJSON *item = NULL; + OpenAPI_lnode_t *node = NULL; + + if (am_influ_event == NULL) { + ogs_error("OpenAPI_am_influ_event_convertToJSON() failed [AmInfluEvent]"); + return NULL; + } + + item = cJSON_CreateObject(); +end: + return item; +} + +OpenAPI_am_influ_event_t *OpenAPI_am_influ_event_parseFromJSON(cJSON *am_influ_eventJSON) +{ + OpenAPI_am_influ_event_t *am_influ_event_local_var = NULL; + OpenAPI_lnode_t *node = NULL; + am_influ_event_local_var = OpenAPI_am_influ_event_create ( + ); + + return am_influ_event_local_var; +end: + return NULL; +} + +OpenAPI_am_influ_event_t *OpenAPI_am_influ_event_copy(OpenAPI_am_influ_event_t *dst, OpenAPI_am_influ_event_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_am_influ_event_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_am_influ_event_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_am_influ_event_free(dst); + dst = OpenAPI_am_influ_event_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/am_influ_event.h b/lib/sbi/openapi/model/am_influ_event.h new file mode 100644 index 000000000..99468dd64 --- /dev/null +++ b/lib/sbi/openapi/model/am_influ_event.h @@ -0,0 +1,37 @@ +/* + * am_influ_event.h + * + * Represents the service area coverage outcome event. + */ + +#ifndef _OpenAPI_am_influ_event_H_ +#define _OpenAPI_am_influ_event_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "am_influ_event_any_of.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_am_influ_event_s OpenAPI_am_influ_event_t; +typedef struct OpenAPI_am_influ_event_s { +} OpenAPI_am_influ_event_t; + +OpenAPI_am_influ_event_t *OpenAPI_am_influ_event_create( +); +void OpenAPI_am_influ_event_free(OpenAPI_am_influ_event_t *am_influ_event); +OpenAPI_am_influ_event_t *OpenAPI_am_influ_event_parseFromJSON(cJSON *am_influ_eventJSON); +cJSON *OpenAPI_am_influ_event_convertToJSON(OpenAPI_am_influ_event_t *am_influ_event); +OpenAPI_am_influ_event_t *OpenAPI_am_influ_event_copy(OpenAPI_am_influ_event_t *dst, OpenAPI_am_influ_event_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_am_influ_event_H_ */ + diff --git a/lib/sbi/openapi/model/am_influ_event_any_of.c b/lib/sbi/openapi/model/am_influ_event_any_of.c new file mode 100644 index 000000000..db888c84e --- /dev/null +++ b/lib/sbi/openapi/model/am_influ_event_any_of.c @@ -0,0 +1,30 @@ + +#include +#include +#include +#include "am_influ_event_any_of.h" + +char* OpenAPI_am_influ_event_any_of_ToString(OpenAPI_am_influ_event_any_of_e am_influ_event_any_of) +{ + const char *am_influ_event_any_ofArray[] = { "NULL", "SERVICE_AREA_COVRG_OUTCOME" }; + size_t sizeofArray = sizeof(am_influ_event_any_ofArray) / sizeof(am_influ_event_any_ofArray[0]); + if (am_influ_event_any_of < sizeofArray) + return (char *)am_influ_event_any_ofArray[am_influ_event_any_of]; + else + return (char *)"Unknown"; +} + +OpenAPI_am_influ_event_any_of_e OpenAPI_am_influ_event_any_of_FromString(char* am_influ_event_any_of) +{ + int stringToReturn = 0; + const char *am_influ_event_any_ofArray[] = { "NULL", "SERVICE_AREA_COVRG_OUTCOME" }; + size_t sizeofArray = sizeof(am_influ_event_any_ofArray) / sizeof(am_influ_event_any_ofArray[0]); + while (stringToReturn < sizeofArray) { + if (strcmp(am_influ_event_any_of, am_influ_event_any_ofArray[stringToReturn]) == 0) { + return stringToReturn; + } + stringToReturn++; + } + return 0; +} + diff --git a/lib/sbi/openapi/model/am_influ_event_any_of.h b/lib/sbi/openapi/model/am_influ_event_any_of.h new file mode 100644 index 000000000..a07a44d41 --- /dev/null +++ b/lib/sbi/openapi/model/am_influ_event_any_of.h @@ -0,0 +1,31 @@ +/* + * am_influ_event_any_of.h + * + * + */ + +#ifndef _OpenAPI_am_influ_event_any_of_H_ +#define _OpenAPI_am_influ_event_any_of_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef enum { OpenAPI_am_influ_event_any_of_NULL = 0, OpenAPI_am_influ_event_any_of_SERVICE_AREA_COVRG_OUTCOME } OpenAPI_am_influ_event_any_of_e; + +char* OpenAPI_am_influ_event_any_of_ToString(OpenAPI_am_influ_event_any_of_e am_influ_event_any_of); + +OpenAPI_am_influ_event_any_of_e OpenAPI_am_influ_event_any_of_FromString(char* am_influ_event_any_of); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_am_influ_event_any_of_H_ */ + diff --git a/lib/sbi/openapi/model/am_requested_value_rep.c b/lib/sbi/openapi/model/am_requested_value_rep.c new file mode 100644 index 000000000..62b952bd1 --- /dev/null +++ b/lib/sbi/openapi/model/am_requested_value_rep.c @@ -0,0 +1,403 @@ + +#include +#include +#include +#include "am_requested_value_rep.h" + +OpenAPI_am_requested_value_rep_t *OpenAPI_am_requested_value_rep_create( + OpenAPI_user_location_t *user_loc, + OpenAPI_list_t* pra_statuses, + OpenAPI_list_t *access_types, + OpenAPI_list_t *rat_types, + OpenAPI_list_t *allowed_snssais, + OpenAPI_list_t *n3g_allowed_snssais +) +{ + OpenAPI_am_requested_value_rep_t *am_requested_value_rep_local_var = ogs_malloc(sizeof(OpenAPI_am_requested_value_rep_t)); + ogs_assert(am_requested_value_rep_local_var); + + am_requested_value_rep_local_var->user_loc = user_loc; + am_requested_value_rep_local_var->pra_statuses = pra_statuses; + am_requested_value_rep_local_var->access_types = access_types; + am_requested_value_rep_local_var->rat_types = rat_types; + am_requested_value_rep_local_var->allowed_snssais = allowed_snssais; + am_requested_value_rep_local_var->n3g_allowed_snssais = n3g_allowed_snssais; + + return am_requested_value_rep_local_var; +} + +void OpenAPI_am_requested_value_rep_free(OpenAPI_am_requested_value_rep_t *am_requested_value_rep) +{ + OpenAPI_lnode_t *node = NULL; + + if (NULL == am_requested_value_rep) { + return; + } + if (am_requested_value_rep->user_loc) { + OpenAPI_user_location_free(am_requested_value_rep->user_loc); + am_requested_value_rep->user_loc = NULL; + } + if (am_requested_value_rep->pra_statuses) { + OpenAPI_list_for_each(am_requested_value_rep->pra_statuses, node) { + OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*)node->data; + ogs_free(localKeyValue->key); + OpenAPI_presence_info_free(localKeyValue->value); + OpenAPI_map_free(localKeyValue); + } + OpenAPI_list_free(am_requested_value_rep->pra_statuses); + am_requested_value_rep->pra_statuses = NULL; + } + if (am_requested_value_rep->access_types) { + OpenAPI_list_free(am_requested_value_rep->access_types); + am_requested_value_rep->access_types = NULL; + } + if (am_requested_value_rep->rat_types) { + OpenAPI_list_free(am_requested_value_rep->rat_types); + am_requested_value_rep->rat_types = NULL; + } + if (am_requested_value_rep->allowed_snssais) { + OpenAPI_list_for_each(am_requested_value_rep->allowed_snssais, node) { + OpenAPI_snssai_free(node->data); + } + OpenAPI_list_free(am_requested_value_rep->allowed_snssais); + am_requested_value_rep->allowed_snssais = NULL; + } + if (am_requested_value_rep->n3g_allowed_snssais) { + OpenAPI_list_for_each(am_requested_value_rep->n3g_allowed_snssais, node) { + OpenAPI_snssai_free(node->data); + } + OpenAPI_list_free(am_requested_value_rep->n3g_allowed_snssais); + am_requested_value_rep->n3g_allowed_snssais = NULL; + } + ogs_free(am_requested_value_rep); +} + +cJSON *OpenAPI_am_requested_value_rep_convertToJSON(OpenAPI_am_requested_value_rep_t *am_requested_value_rep) +{ + cJSON *item = NULL; + OpenAPI_lnode_t *node = NULL; + + if (am_requested_value_rep == NULL) { + ogs_error("OpenAPI_am_requested_value_rep_convertToJSON() failed [AmRequestedValueRep]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (am_requested_value_rep->user_loc) { + cJSON *user_loc_local_JSON = OpenAPI_user_location_convertToJSON(am_requested_value_rep->user_loc); + if (user_loc_local_JSON == NULL) { + ogs_error("OpenAPI_am_requested_value_rep_convertToJSON() failed [user_loc]"); + goto end; + } + cJSON_AddItemToObject(item, "userLoc", user_loc_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_am_requested_value_rep_convertToJSON() failed [user_loc]"); + goto end; + } + } + + if (am_requested_value_rep->pra_statuses) { + cJSON *pra_statuses = cJSON_AddObjectToObject(item, "praStatuses"); + if (pra_statuses == NULL) { + ogs_error("OpenAPI_am_requested_value_rep_convertToJSON() failed [pra_statuses]"); + goto end; + } + cJSON *localMapObject = pra_statuses; + if (am_requested_value_rep->pra_statuses) { + OpenAPI_list_for_each(am_requested_value_rep->pra_statuses, node) { + OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*)node->data; + cJSON *itemLocal = localKeyValue->value ? + OpenAPI_presence_info_convertToJSON(localKeyValue->value) : + cJSON_CreateNull(); + if (itemLocal == NULL) { + ogs_error("OpenAPI_am_requested_value_rep_convertToJSON() failed [inner]"); + goto end; + } + cJSON_AddItemToObject(localMapObject, localKeyValue->key, itemLocal); + } + } + } + + if (am_requested_value_rep->access_types != OpenAPI_access_type_NULL) { + cJSON *access_typesList = cJSON_AddArrayToObject(item, "accessTypes"); + if (access_typesList == NULL) { + ogs_error("OpenAPI_am_requested_value_rep_convertToJSON() failed [access_types]"); + goto end; + } + OpenAPI_list_for_each(am_requested_value_rep->access_types, node) { + if (cJSON_AddStringToObject(access_typesList, "", OpenAPI_access_type_ToString((intptr_t)node->data)) == NULL) { + ogs_error("OpenAPI_am_requested_value_rep_convertToJSON() failed [access_types]"); + goto end; + } + } + } + + if (am_requested_value_rep->rat_types != OpenAPI_rat_type_NULL) { + cJSON *rat_typesList = cJSON_AddArrayToObject(item, "ratTypes"); + if (rat_typesList == NULL) { + ogs_error("OpenAPI_am_requested_value_rep_convertToJSON() failed [rat_types]"); + goto end; + } + OpenAPI_list_for_each(am_requested_value_rep->rat_types, node) { + if (cJSON_AddStringToObject(rat_typesList, "", OpenAPI_rat_type_ToString((intptr_t)node->data)) == NULL) { + ogs_error("OpenAPI_am_requested_value_rep_convertToJSON() failed [rat_types]"); + goto end; + } + } + } + + if (am_requested_value_rep->allowed_snssais) { + cJSON *allowed_snssaisList = cJSON_AddArrayToObject(item, "allowedSnssais"); + if (allowed_snssaisList == NULL) { + ogs_error("OpenAPI_am_requested_value_rep_convertToJSON() failed [allowed_snssais]"); + goto end; + } + OpenAPI_list_for_each(am_requested_value_rep->allowed_snssais, node) { + cJSON *itemLocal = OpenAPI_snssai_convertToJSON(node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_am_requested_value_rep_convertToJSON() failed [allowed_snssais]"); + goto end; + } + cJSON_AddItemToArray(allowed_snssaisList, itemLocal); + } + } + + if (am_requested_value_rep->n3g_allowed_snssais) { + cJSON *n3g_allowed_snssaisList = cJSON_AddArrayToObject(item, "n3gAllowedSnssais"); + if (n3g_allowed_snssaisList == NULL) { + ogs_error("OpenAPI_am_requested_value_rep_convertToJSON() failed [n3g_allowed_snssais]"); + goto end; + } + OpenAPI_list_for_each(am_requested_value_rep->n3g_allowed_snssais, node) { + cJSON *itemLocal = OpenAPI_snssai_convertToJSON(node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_am_requested_value_rep_convertToJSON() failed [n3g_allowed_snssais]"); + goto end; + } + cJSON_AddItemToArray(n3g_allowed_snssaisList, itemLocal); + } + } + +end: + return item; +} + +OpenAPI_am_requested_value_rep_t *OpenAPI_am_requested_value_rep_parseFromJSON(cJSON *am_requested_value_repJSON) +{ + OpenAPI_am_requested_value_rep_t *am_requested_value_rep_local_var = NULL; + OpenAPI_lnode_t *node = NULL; + cJSON *user_loc = NULL; + OpenAPI_user_location_t *user_loc_local_nonprim = NULL; + cJSON *pra_statuses = NULL; + OpenAPI_list_t *pra_statusesList = NULL; + cJSON *access_types = NULL; + OpenAPI_list_t *access_typesList = NULL; + cJSON *rat_types = NULL; + OpenAPI_list_t *rat_typesList = NULL; + cJSON *allowed_snssais = NULL; + OpenAPI_list_t *allowed_snssaisList = NULL; + cJSON *n3g_allowed_snssais = NULL; + OpenAPI_list_t *n3g_allowed_snssaisList = NULL; + user_loc = cJSON_GetObjectItemCaseSensitive(am_requested_value_repJSON, "userLoc"); + if (user_loc) { + user_loc_local_nonprim = OpenAPI_user_location_parseFromJSON(user_loc); + } + + pra_statuses = cJSON_GetObjectItemCaseSensitive(am_requested_value_repJSON, "praStatuses"); + if (pra_statuses) { + cJSON *pra_statuses_local_map = NULL; + if (!cJSON_IsObject(pra_statuses) && !cJSON_IsNull(pra_statuses)) { + ogs_error("OpenAPI_am_requested_value_rep_parseFromJSON() failed [pra_statuses]"); + goto end; + } + if (cJSON_IsObject(pra_statuses)) { + pra_statusesList = OpenAPI_list_create(); + OpenAPI_map_t *localMapKeyPair = NULL; + cJSON_ArrayForEach(pra_statuses_local_map, pra_statuses) { + cJSON *localMapObject = pra_statuses_local_map; + if (cJSON_IsObject(localMapObject)) { + localMapKeyPair = OpenAPI_map_create( + ogs_strdup(localMapObject->string), OpenAPI_presence_info_parseFromJSON(localMapObject)); + } else if (cJSON_IsNull(localMapObject)) { + localMapKeyPair = OpenAPI_map_create(ogs_strdup(localMapObject->string), NULL); + } else { + ogs_error("OpenAPI_am_requested_value_rep_parseFromJSON() failed [inner]"); + goto end; + } + OpenAPI_list_add(pra_statusesList, localMapKeyPair); + } + } + } + + access_types = cJSON_GetObjectItemCaseSensitive(am_requested_value_repJSON, "accessTypes"); + if (access_types) { + cJSON *access_types_local = NULL; + if (!cJSON_IsArray(access_types)) { + ogs_error("OpenAPI_am_requested_value_rep_parseFromJSON() failed [access_types]"); + goto end; + } + + access_typesList = OpenAPI_list_create(); + + cJSON_ArrayForEach(access_types_local, access_types) { + if (!cJSON_IsString(access_types_local)) { + ogs_error("OpenAPI_am_requested_value_rep_parseFromJSON() failed [access_types]"); + goto end; + } + OpenAPI_list_add(access_typesList, (void *)OpenAPI_access_type_FromString(access_types_local->valuestring)); + } + } + + rat_types = cJSON_GetObjectItemCaseSensitive(am_requested_value_repJSON, "ratTypes"); + if (rat_types) { + cJSON *rat_types_local = NULL; + if (!cJSON_IsArray(rat_types)) { + ogs_error("OpenAPI_am_requested_value_rep_parseFromJSON() failed [rat_types]"); + goto end; + } + + rat_typesList = OpenAPI_list_create(); + + cJSON_ArrayForEach(rat_types_local, rat_types) { + if (!cJSON_IsString(rat_types_local)) { + ogs_error("OpenAPI_am_requested_value_rep_parseFromJSON() failed [rat_types]"); + goto end; + } + OpenAPI_list_add(rat_typesList, (void *)OpenAPI_rat_type_FromString(rat_types_local->valuestring)); + } + } + + allowed_snssais = cJSON_GetObjectItemCaseSensitive(am_requested_value_repJSON, "allowedSnssais"); + if (allowed_snssais) { + cJSON *allowed_snssais_local = NULL; + if (!cJSON_IsArray(allowed_snssais)) { + ogs_error("OpenAPI_am_requested_value_rep_parseFromJSON() failed [allowed_snssais]"); + goto end; + } + + allowed_snssaisList = OpenAPI_list_create(); + + cJSON_ArrayForEach(allowed_snssais_local, allowed_snssais) { + if (!cJSON_IsObject(allowed_snssais_local)) { + ogs_error("OpenAPI_am_requested_value_rep_parseFromJSON() failed [allowed_snssais]"); + goto end; + } + OpenAPI_snssai_t *allowed_snssaisItem = OpenAPI_snssai_parseFromJSON(allowed_snssais_local); + if (!allowed_snssaisItem) { + ogs_error("No allowed_snssaisItem"); + OpenAPI_list_free(allowed_snssaisList); + goto end; + } + OpenAPI_list_add(allowed_snssaisList, allowed_snssaisItem); + } + } + + n3g_allowed_snssais = cJSON_GetObjectItemCaseSensitive(am_requested_value_repJSON, "n3gAllowedSnssais"); + if (n3g_allowed_snssais) { + cJSON *n3g_allowed_snssais_local = NULL; + if (!cJSON_IsArray(n3g_allowed_snssais)) { + ogs_error("OpenAPI_am_requested_value_rep_parseFromJSON() failed [n3g_allowed_snssais]"); + goto end; + } + + n3g_allowed_snssaisList = OpenAPI_list_create(); + + cJSON_ArrayForEach(n3g_allowed_snssais_local, n3g_allowed_snssais) { + if (!cJSON_IsObject(n3g_allowed_snssais_local)) { + ogs_error("OpenAPI_am_requested_value_rep_parseFromJSON() failed [n3g_allowed_snssais]"); + goto end; + } + OpenAPI_snssai_t *n3g_allowed_snssaisItem = OpenAPI_snssai_parseFromJSON(n3g_allowed_snssais_local); + if (!n3g_allowed_snssaisItem) { + ogs_error("No n3g_allowed_snssaisItem"); + OpenAPI_list_free(n3g_allowed_snssaisList); + goto end; + } + OpenAPI_list_add(n3g_allowed_snssaisList, n3g_allowed_snssaisItem); + } + } + + am_requested_value_rep_local_var = OpenAPI_am_requested_value_rep_create ( + user_loc ? user_loc_local_nonprim : NULL, + pra_statuses ? pra_statusesList : NULL, + access_types ? access_typesList : NULL, + rat_types ? rat_typesList : NULL, + allowed_snssais ? allowed_snssaisList : NULL, + n3g_allowed_snssais ? n3g_allowed_snssaisList : NULL + ); + + return am_requested_value_rep_local_var; +end: + if (user_loc_local_nonprim) { + OpenAPI_user_location_free(user_loc_local_nonprim); + user_loc_local_nonprim = NULL; + } + if (pra_statusesList) { + OpenAPI_list_for_each(pra_statusesList, node) { + OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*) node->data; + ogs_free(localKeyValue->key); + OpenAPI_presence_info_free(localKeyValue->value); + OpenAPI_map_free(localKeyValue); + } + OpenAPI_list_free(pra_statusesList); + pra_statusesList = NULL; + } + if (access_typesList) { + OpenAPI_list_free(access_typesList); + access_typesList = NULL; + } + if (rat_typesList) { + OpenAPI_list_free(rat_typesList); + rat_typesList = NULL; + } + if (allowed_snssaisList) { + OpenAPI_list_for_each(allowed_snssaisList, node) { + OpenAPI_snssai_free(node->data); + } + OpenAPI_list_free(allowed_snssaisList); + allowed_snssaisList = NULL; + } + if (n3g_allowed_snssaisList) { + OpenAPI_list_for_each(n3g_allowed_snssaisList, node) { + OpenAPI_snssai_free(node->data); + } + OpenAPI_list_free(n3g_allowed_snssaisList); + n3g_allowed_snssaisList = NULL; + } + return NULL; +} + +OpenAPI_am_requested_value_rep_t *OpenAPI_am_requested_value_rep_copy(OpenAPI_am_requested_value_rep_t *dst, OpenAPI_am_requested_value_rep_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_am_requested_value_rep_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_am_requested_value_rep_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_am_requested_value_rep_free(dst); + dst = OpenAPI_am_requested_value_rep_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/am_requested_value_rep.h b/lib/sbi/openapi/model/am_requested_value_rep.h new file mode 100644 index 000000000..caff50d40 --- /dev/null +++ b/lib/sbi/openapi/model/am_requested_value_rep.h @@ -0,0 +1,53 @@ +/* + * am_requested_value_rep.h + * + * Represents the current applicable values corresponding to the policy control request triggers. + */ + +#ifndef _OpenAPI_am_requested_value_rep_H_ +#define _OpenAPI_am_requested_value_rep_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "access_type.h" +#include "presence_info.h" +#include "rat_type.h" +#include "snssai.h" +#include "user_location.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_am_requested_value_rep_s OpenAPI_am_requested_value_rep_t; +typedef struct OpenAPI_am_requested_value_rep_s { + struct OpenAPI_user_location_s *user_loc; + OpenAPI_list_t* pra_statuses; + OpenAPI_list_t *access_types; + OpenAPI_list_t *rat_types; + OpenAPI_list_t *allowed_snssais; + OpenAPI_list_t *n3g_allowed_snssais; +} OpenAPI_am_requested_value_rep_t; + +OpenAPI_am_requested_value_rep_t *OpenAPI_am_requested_value_rep_create( + OpenAPI_user_location_t *user_loc, + OpenAPI_list_t* pra_statuses, + OpenAPI_list_t *access_types, + OpenAPI_list_t *rat_types, + OpenAPI_list_t *allowed_snssais, + OpenAPI_list_t *n3g_allowed_snssais +); +void OpenAPI_am_requested_value_rep_free(OpenAPI_am_requested_value_rep_t *am_requested_value_rep); +OpenAPI_am_requested_value_rep_t *OpenAPI_am_requested_value_rep_parseFromJSON(cJSON *am_requested_value_repJSON); +cJSON *OpenAPI_am_requested_value_rep_convertToJSON(OpenAPI_am_requested_value_rep_t *am_requested_value_rep); +OpenAPI_am_requested_value_rep_t *OpenAPI_am_requested_value_rep_copy(OpenAPI_am_requested_value_rep_t *dst, OpenAPI_am_requested_value_rep_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_am_requested_value_rep_H_ */ + diff --git a/lib/sbi/openapi/model/ambr.h b/lib/sbi/openapi/model/ambr.h index a6abf69f1..d075c050d 100644 --- a/lib/sbi/openapi/model/ambr.h +++ b/lib/sbi/openapi/model/ambr.h @@ -1,7 +1,7 @@ /* * ambr.h * - * + * Contains the maximum aggregated uplink and downlink bit rates. */ #ifndef _OpenAPI_ambr_H_ diff --git a/lib/sbi/openapi/model/ambr_1.h b/lib/sbi/openapi/model/ambr_1.h index 8d9395d99..3fe55ca98 100644 --- a/lib/sbi/openapi/model/ambr_1.h +++ b/lib/sbi/openapi/model/ambr_1.h @@ -1,7 +1,7 @@ /* * ambr_1.h * - * + * Contains the maximum aggregated uplink and downlink bit rates. */ #ifndef _OpenAPI_ambr_1_H_ diff --git a/lib/sbi/openapi/model/ambr_rm.h b/lib/sbi/openapi/model/ambr_rm.h index 002cd57b0..03b217e0f 100644 --- a/lib/sbi/openapi/model/ambr_rm.h +++ b/lib/sbi/openapi/model/ambr_rm.h @@ -1,7 +1,7 @@ /* * ambr_rm.h * - * + * This data type is defined in the same way as the 'Ambr' data type, but with the OpenAPI 'nullable: true' property.\" */ #ifndef _OpenAPI_ambr_rm_H_ diff --git a/lib/sbi/openapi/model/amf3_gpp_access_registration.c b/lib/sbi/openapi/model/amf3_gpp_access_registration.c index 90b8e9d0f..d60271cba 100644 --- a/lib/sbi/openapi/model/amf3_gpp_access_registration.c +++ b/lib/sbi/openapi/model/amf3_gpp_access_registration.c @@ -17,6 +17,8 @@ OpenAPI_amf3_gpp_access_registration_t *OpenAPI_amf3_gpp_access_registration_cre char *amf_service_name_pcscf_rest, bool is_initial_registration_ind, int initial_registration_ind, + bool is_emergency_registration_ind, + int emergency_registration_ind, OpenAPI_guami_t *guami, OpenAPI_list_t *backup_amf_info, bool is_dr_flag, @@ -33,7 +35,23 @@ OpenAPI_amf3_gpp_access_registration_t *OpenAPI_amf3_gpp_access_registration_cre OpenAPI_context_info_t *context_info, bool is_no_ee_subscription_ind, int no_ee_subscription_ind, - char *supi + char *supi, + OpenAPI_ue_reachable_ind_e ue_reachable_ind, + bool is_re_registration_required, + int re_registration_required, + bool is_admin_dereg_sub_withdrawn, + int admin_dereg_sub_withdrawn, + char *data_restoration_callback_uri, + OpenAPI_list_t *reset_ids, + bool is_disaster_roaming_ind, + int disaster_roaming_ind, + bool is_ue_mint_capability, + int ue_mint_capability, + bool is_sor_snpn_si_supported, + int sor_snpn_si_supported, + bool is_udr_restart_ind, + int udr_restart_ind, + char *last_synchronization_time ) { OpenAPI_amf3_gpp_access_registration_t *amf3_gpp_access_registration_local_var = ogs_malloc(sizeof(OpenAPI_amf3_gpp_access_registration_t)); @@ -51,6 +69,8 @@ OpenAPI_amf3_gpp_access_registration_t *OpenAPI_amf3_gpp_access_registration_cre amf3_gpp_access_registration_local_var->amf_service_name_pcscf_rest = amf_service_name_pcscf_rest; amf3_gpp_access_registration_local_var->is_initial_registration_ind = is_initial_registration_ind; amf3_gpp_access_registration_local_var->initial_registration_ind = initial_registration_ind; + amf3_gpp_access_registration_local_var->is_emergency_registration_ind = is_emergency_registration_ind; + amf3_gpp_access_registration_local_var->emergency_registration_ind = emergency_registration_ind; amf3_gpp_access_registration_local_var->guami = guami; amf3_gpp_access_registration_local_var->backup_amf_info = backup_amf_info; amf3_gpp_access_registration_local_var->is_dr_flag = is_dr_flag; @@ -68,6 +88,22 @@ OpenAPI_amf3_gpp_access_registration_t *OpenAPI_amf3_gpp_access_registration_cre amf3_gpp_access_registration_local_var->is_no_ee_subscription_ind = is_no_ee_subscription_ind; amf3_gpp_access_registration_local_var->no_ee_subscription_ind = no_ee_subscription_ind; amf3_gpp_access_registration_local_var->supi = supi; + amf3_gpp_access_registration_local_var->ue_reachable_ind = ue_reachable_ind; + amf3_gpp_access_registration_local_var->is_re_registration_required = is_re_registration_required; + amf3_gpp_access_registration_local_var->re_registration_required = re_registration_required; + amf3_gpp_access_registration_local_var->is_admin_dereg_sub_withdrawn = is_admin_dereg_sub_withdrawn; + amf3_gpp_access_registration_local_var->admin_dereg_sub_withdrawn = admin_dereg_sub_withdrawn; + amf3_gpp_access_registration_local_var->data_restoration_callback_uri = data_restoration_callback_uri; + amf3_gpp_access_registration_local_var->reset_ids = reset_ids; + amf3_gpp_access_registration_local_var->is_disaster_roaming_ind = is_disaster_roaming_ind; + amf3_gpp_access_registration_local_var->disaster_roaming_ind = disaster_roaming_ind; + amf3_gpp_access_registration_local_var->is_ue_mint_capability = is_ue_mint_capability; + amf3_gpp_access_registration_local_var->ue_mint_capability = ue_mint_capability; + amf3_gpp_access_registration_local_var->is_sor_snpn_si_supported = is_sor_snpn_si_supported; + amf3_gpp_access_registration_local_var->sor_snpn_si_supported = sor_snpn_si_supported; + amf3_gpp_access_registration_local_var->is_udr_restart_ind = is_udr_restart_ind; + amf3_gpp_access_registration_local_var->udr_restart_ind = udr_restart_ind; + amf3_gpp_access_registration_local_var->last_synchronization_time = last_synchronization_time; return amf3_gpp_access_registration_local_var; } @@ -142,6 +178,21 @@ void OpenAPI_amf3_gpp_access_registration_free(OpenAPI_amf3_gpp_access_registrat ogs_free(amf3_gpp_access_registration->supi); amf3_gpp_access_registration->supi = NULL; } + if (amf3_gpp_access_registration->data_restoration_callback_uri) { + ogs_free(amf3_gpp_access_registration->data_restoration_callback_uri); + amf3_gpp_access_registration->data_restoration_callback_uri = NULL; + } + if (amf3_gpp_access_registration->reset_ids) { + OpenAPI_list_for_each(amf3_gpp_access_registration->reset_ids, node) { + ogs_free(node->data); + } + OpenAPI_list_free(amf3_gpp_access_registration->reset_ids); + amf3_gpp_access_registration->reset_ids = NULL; + } + if (amf3_gpp_access_registration->last_synchronization_time) { + ogs_free(amf3_gpp_access_registration->last_synchronization_time); + amf3_gpp_access_registration->last_synchronization_time = NULL; + } ogs_free(amf3_gpp_access_registration); } @@ -230,6 +281,13 @@ cJSON *OpenAPI_amf3_gpp_access_registration_convertToJSON(OpenAPI_amf3_gpp_acces } } + if (amf3_gpp_access_registration->is_emergency_registration_ind) { + if (cJSON_AddBoolToObject(item, "emergencyRegistrationInd", amf3_gpp_access_registration->emergency_registration_ind) == NULL) { + ogs_error("OpenAPI_amf3_gpp_access_registration_convertToJSON() failed [emergency_registration_ind]"); + goto end; + } + } + if (!amf3_gpp_access_registration->guami) { ogs_error("OpenAPI_amf3_gpp_access_registration_convertToJSON() failed [guami]"); return NULL; @@ -358,6 +416,83 @@ cJSON *OpenAPI_amf3_gpp_access_registration_convertToJSON(OpenAPI_amf3_gpp_acces } } + if (amf3_gpp_access_registration->ue_reachable_ind != OpenAPI_ue_reachable_ind_NULL) { + if (cJSON_AddStringToObject(item, "ueReachableInd", OpenAPI_ue_reachable_ind_ToString(amf3_gpp_access_registration->ue_reachable_ind)) == NULL) { + ogs_error("OpenAPI_amf3_gpp_access_registration_convertToJSON() failed [ue_reachable_ind]"); + goto end; + } + } + + if (amf3_gpp_access_registration->is_re_registration_required) { + if (cJSON_AddBoolToObject(item, "reRegistrationRequired", amf3_gpp_access_registration->re_registration_required) == NULL) { + ogs_error("OpenAPI_amf3_gpp_access_registration_convertToJSON() failed [re_registration_required]"); + goto end; + } + } + + if (amf3_gpp_access_registration->is_admin_dereg_sub_withdrawn) { + if (cJSON_AddBoolToObject(item, "adminDeregSubWithdrawn", amf3_gpp_access_registration->admin_dereg_sub_withdrawn) == NULL) { + ogs_error("OpenAPI_amf3_gpp_access_registration_convertToJSON() failed [admin_dereg_sub_withdrawn]"); + goto end; + } + } + + if (amf3_gpp_access_registration->data_restoration_callback_uri) { + if (cJSON_AddStringToObject(item, "dataRestorationCallbackUri", amf3_gpp_access_registration->data_restoration_callback_uri) == NULL) { + ogs_error("OpenAPI_amf3_gpp_access_registration_convertToJSON() failed [data_restoration_callback_uri]"); + goto end; + } + } + + if (amf3_gpp_access_registration->reset_ids) { + cJSON *reset_idsList = cJSON_AddArrayToObject(item, "resetIds"); + if (reset_idsList == NULL) { + ogs_error("OpenAPI_amf3_gpp_access_registration_convertToJSON() failed [reset_ids]"); + goto end; + } + OpenAPI_list_for_each(amf3_gpp_access_registration->reset_ids, node) { + if (cJSON_AddStringToObject(reset_idsList, "", (char*)node->data) == NULL) { + ogs_error("OpenAPI_amf3_gpp_access_registration_convertToJSON() failed [reset_ids]"); + goto end; + } + } + } + + if (amf3_gpp_access_registration->is_disaster_roaming_ind) { + if (cJSON_AddBoolToObject(item, "disasterRoamingInd", amf3_gpp_access_registration->disaster_roaming_ind) == NULL) { + ogs_error("OpenAPI_amf3_gpp_access_registration_convertToJSON() failed [disaster_roaming_ind]"); + goto end; + } + } + + if (amf3_gpp_access_registration->is_ue_mint_capability) { + if (cJSON_AddBoolToObject(item, "ueMINTCapability", amf3_gpp_access_registration->ue_mint_capability) == NULL) { + ogs_error("OpenAPI_amf3_gpp_access_registration_convertToJSON() failed [ue_mint_capability]"); + goto end; + } + } + + if (amf3_gpp_access_registration->is_sor_snpn_si_supported) { + if (cJSON_AddBoolToObject(item, "sorSnpnSiSupported", amf3_gpp_access_registration->sor_snpn_si_supported) == NULL) { + ogs_error("OpenAPI_amf3_gpp_access_registration_convertToJSON() failed [sor_snpn_si_supported]"); + goto end; + } + } + + if (amf3_gpp_access_registration->is_udr_restart_ind) { + if (cJSON_AddBoolToObject(item, "udrRestartInd", amf3_gpp_access_registration->udr_restart_ind) == NULL) { + ogs_error("OpenAPI_amf3_gpp_access_registration_convertToJSON() failed [udr_restart_ind]"); + goto end; + } + } + + if (amf3_gpp_access_registration->last_synchronization_time) { + if (cJSON_AddStringToObject(item, "lastSynchronizationTime", amf3_gpp_access_registration->last_synchronization_time) == NULL) { + ogs_error("OpenAPI_amf3_gpp_access_registration_convertToJSON() failed [last_synchronization_time]"); + goto end; + } + } + end: return item; } @@ -377,6 +512,7 @@ OpenAPI_amf3_gpp_access_registration_t *OpenAPI_amf3_gpp_access_registration_par cJSON *pcscf_restoration_callback_uri = NULL; cJSON *amf_service_name_pcscf_rest = NULL; cJSON *initial_registration_ind = NULL; + cJSON *emergency_registration_ind = NULL; cJSON *guami = NULL; OpenAPI_guami_t *guami_local_nonprim = NULL; cJSON *backup_amf_info = NULL; @@ -396,6 +532,18 @@ OpenAPI_amf3_gpp_access_registration_t *OpenAPI_amf3_gpp_access_registration_par OpenAPI_context_info_t *context_info_local_nonprim = NULL; cJSON *no_ee_subscription_ind = NULL; cJSON *supi = NULL; + cJSON *ue_reachable_ind = NULL; + OpenAPI_ue_reachable_ind_e ue_reachable_indVariable = 0; + cJSON *re_registration_required = NULL; + cJSON *admin_dereg_sub_withdrawn = NULL; + cJSON *data_restoration_callback_uri = NULL; + cJSON *reset_ids = NULL; + OpenAPI_list_t *reset_idsList = NULL; + cJSON *disaster_roaming_ind = NULL; + cJSON *ue_mint_capability = NULL; + cJSON *sor_snpn_si_supported = NULL; + cJSON *udr_restart_ind = NULL; + cJSON *last_synchronization_time = NULL; amf_instance_id = cJSON_GetObjectItemCaseSensitive(amf3_gpp_access_registrationJSON, "amfInstanceId"); if (!amf_instance_id) { ogs_error("OpenAPI_amf3_gpp_access_registration_parseFromJSON() failed [amf_instance_id]"); @@ -481,6 +629,14 @@ OpenAPI_amf3_gpp_access_registration_t *OpenAPI_amf3_gpp_access_registration_par } } + emergency_registration_ind = cJSON_GetObjectItemCaseSensitive(amf3_gpp_access_registrationJSON, "emergencyRegistrationInd"); + if (emergency_registration_ind) { + if (!cJSON_IsBool(emergency_registration_ind)) { + ogs_error("OpenAPI_amf3_gpp_access_registration_parseFromJSON() failed [emergency_registration_ind]"); + goto end; + } + } + guami = cJSON_GetObjectItemCaseSensitive(amf3_gpp_access_registrationJSON, "guami"); if (!guami) { ogs_error("OpenAPI_amf3_gpp_access_registration_parseFromJSON() failed [guami]"); @@ -595,6 +751,100 @@ OpenAPI_amf3_gpp_access_registration_t *OpenAPI_amf3_gpp_access_registration_par } } + ue_reachable_ind = cJSON_GetObjectItemCaseSensitive(amf3_gpp_access_registrationJSON, "ueReachableInd"); + if (ue_reachable_ind) { + if (!cJSON_IsString(ue_reachable_ind)) { + ogs_error("OpenAPI_amf3_gpp_access_registration_parseFromJSON() failed [ue_reachable_ind]"); + goto end; + } + ue_reachable_indVariable = OpenAPI_ue_reachable_ind_FromString(ue_reachable_ind->valuestring); + } + + re_registration_required = cJSON_GetObjectItemCaseSensitive(amf3_gpp_access_registrationJSON, "reRegistrationRequired"); + if (re_registration_required) { + if (!cJSON_IsBool(re_registration_required)) { + ogs_error("OpenAPI_amf3_gpp_access_registration_parseFromJSON() failed [re_registration_required]"); + goto end; + } + } + + admin_dereg_sub_withdrawn = cJSON_GetObjectItemCaseSensitive(amf3_gpp_access_registrationJSON, "adminDeregSubWithdrawn"); + if (admin_dereg_sub_withdrawn) { + if (!cJSON_IsBool(admin_dereg_sub_withdrawn)) { + ogs_error("OpenAPI_amf3_gpp_access_registration_parseFromJSON() failed [admin_dereg_sub_withdrawn]"); + goto end; + } + } + + data_restoration_callback_uri = cJSON_GetObjectItemCaseSensitive(amf3_gpp_access_registrationJSON, "dataRestorationCallbackUri"); + if (data_restoration_callback_uri) { + if (!cJSON_IsString(data_restoration_callback_uri) && !cJSON_IsNull(data_restoration_callback_uri)) { + ogs_error("OpenAPI_amf3_gpp_access_registration_parseFromJSON() failed [data_restoration_callback_uri]"); + goto end; + } + } + + reset_ids = cJSON_GetObjectItemCaseSensitive(amf3_gpp_access_registrationJSON, "resetIds"); + if (reset_ids) { + cJSON *reset_ids_local = NULL; + if (!cJSON_IsArray(reset_ids)) { + ogs_error("OpenAPI_amf3_gpp_access_registration_parseFromJSON() failed [reset_ids]"); + goto end; + } + + reset_idsList = OpenAPI_list_create(); + + cJSON_ArrayForEach(reset_ids_local, reset_ids) { + double *localDouble = NULL; + int *localInt = NULL; + if (!cJSON_IsString(reset_ids_local)) { + ogs_error("OpenAPI_amf3_gpp_access_registration_parseFromJSON() failed [reset_ids]"); + goto end; + } + OpenAPI_list_add(reset_idsList, ogs_strdup(reset_ids_local->valuestring)); + } + } + + disaster_roaming_ind = cJSON_GetObjectItemCaseSensitive(amf3_gpp_access_registrationJSON, "disasterRoamingInd"); + if (disaster_roaming_ind) { + if (!cJSON_IsBool(disaster_roaming_ind)) { + ogs_error("OpenAPI_amf3_gpp_access_registration_parseFromJSON() failed [disaster_roaming_ind]"); + goto end; + } + } + + ue_mint_capability = cJSON_GetObjectItemCaseSensitive(amf3_gpp_access_registrationJSON, "ueMINTCapability"); + if (ue_mint_capability) { + if (!cJSON_IsBool(ue_mint_capability)) { + ogs_error("OpenAPI_amf3_gpp_access_registration_parseFromJSON() failed [ue_mint_capability]"); + goto end; + } + } + + sor_snpn_si_supported = cJSON_GetObjectItemCaseSensitive(amf3_gpp_access_registrationJSON, "sorSnpnSiSupported"); + if (sor_snpn_si_supported) { + if (!cJSON_IsBool(sor_snpn_si_supported)) { + ogs_error("OpenAPI_amf3_gpp_access_registration_parseFromJSON() failed [sor_snpn_si_supported]"); + goto end; + } + } + + udr_restart_ind = cJSON_GetObjectItemCaseSensitive(amf3_gpp_access_registrationJSON, "udrRestartInd"); + if (udr_restart_ind) { + if (!cJSON_IsBool(udr_restart_ind)) { + ogs_error("OpenAPI_amf3_gpp_access_registration_parseFromJSON() failed [udr_restart_ind]"); + goto end; + } + } + + last_synchronization_time = cJSON_GetObjectItemCaseSensitive(amf3_gpp_access_registrationJSON, "lastSynchronizationTime"); + if (last_synchronization_time) { + if (!cJSON_IsString(last_synchronization_time) && !cJSON_IsNull(last_synchronization_time)) { + ogs_error("OpenAPI_amf3_gpp_access_registration_parseFromJSON() failed [last_synchronization_time]"); + goto end; + } + } + amf3_gpp_access_registration_local_var = OpenAPI_amf3_gpp_access_registration_create ( ogs_strdup(amf_instance_id->valuestring), supported_features && !cJSON_IsNull(supported_features) ? ogs_strdup(supported_features->valuestring) : NULL, @@ -608,6 +858,8 @@ OpenAPI_amf3_gpp_access_registration_t *OpenAPI_amf3_gpp_access_registration_par amf_service_name_pcscf_rest && !cJSON_IsNull(amf_service_name_pcscf_rest) ? ogs_strdup(amf_service_name_pcscf_rest->valuestring) : NULL, initial_registration_ind ? true : false, initial_registration_ind ? initial_registration_ind->valueint : 0, + emergency_registration_ind ? true : false, + emergency_registration_ind ? emergency_registration_ind->valueint : 0, guami_local_nonprim, backup_amf_info ? backup_amf_infoList : NULL, dr_flag ? true : false, @@ -624,7 +876,23 @@ OpenAPI_amf3_gpp_access_registration_t *OpenAPI_amf3_gpp_access_registration_par context_info ? context_info_local_nonprim : NULL, no_ee_subscription_ind ? true : false, no_ee_subscription_ind ? no_ee_subscription_ind->valueint : 0, - supi && !cJSON_IsNull(supi) ? ogs_strdup(supi->valuestring) : NULL + supi && !cJSON_IsNull(supi) ? ogs_strdup(supi->valuestring) : NULL, + ue_reachable_ind ? ue_reachable_indVariable : 0, + re_registration_required ? true : false, + re_registration_required ? re_registration_required->valueint : 0, + admin_dereg_sub_withdrawn ? true : false, + admin_dereg_sub_withdrawn ? admin_dereg_sub_withdrawn->valueint : 0, + data_restoration_callback_uri && !cJSON_IsNull(data_restoration_callback_uri) ? ogs_strdup(data_restoration_callback_uri->valuestring) : NULL, + reset_ids ? reset_idsList : NULL, + disaster_roaming_ind ? true : false, + disaster_roaming_ind ? disaster_roaming_ind->valueint : 0, + ue_mint_capability ? true : false, + ue_mint_capability ? ue_mint_capability->valueint : 0, + sor_snpn_si_supported ? true : false, + sor_snpn_si_supported ? sor_snpn_si_supported->valueint : 0, + udr_restart_ind ? true : false, + udr_restart_ind ? udr_restart_ind->valueint : 0, + last_synchronization_time && !cJSON_IsNull(last_synchronization_time) ? ogs_strdup(last_synchronization_time->valuestring) : NULL ); return amf3_gpp_access_registration_local_var; @@ -652,6 +920,13 @@ end: OpenAPI_context_info_free(context_info_local_nonprim); context_info_local_nonprim = NULL; } + if (reset_idsList) { + OpenAPI_list_for_each(reset_idsList, node) { + ogs_free(node->data); + } + OpenAPI_list_free(reset_idsList); + reset_idsList = NULL; + } return NULL; } diff --git a/lib/sbi/openapi/model/amf3_gpp_access_registration.h b/lib/sbi/openapi/model/amf3_gpp_access_registration.h index be4597331..a4754188b 100644 --- a/lib/sbi/openapi/model/amf3_gpp_access_registration.h +++ b/lib/sbi/openapi/model/amf3_gpp_access_registration.h @@ -18,6 +18,7 @@ #include "guami.h" #include "ims_vo_ps.h" #include "rat_type.h" +#include "ue_reachable_ind.h" #include "vgmlc_address.h" #ifdef __cplusplus @@ -38,6 +39,8 @@ typedef struct OpenAPI_amf3_gpp_access_registration_s { char *amf_service_name_pcscf_rest; bool is_initial_registration_ind; int initial_registration_ind; + bool is_emergency_registration_ind; + int emergency_registration_ind; struct OpenAPI_guami_s *guami; OpenAPI_list_t *backup_amf_info; bool is_dr_flag; @@ -55,6 +58,22 @@ typedef struct OpenAPI_amf3_gpp_access_registration_s { bool is_no_ee_subscription_ind; int no_ee_subscription_ind; char *supi; + OpenAPI_ue_reachable_ind_e ue_reachable_ind; + bool is_re_registration_required; + int re_registration_required; + bool is_admin_dereg_sub_withdrawn; + int admin_dereg_sub_withdrawn; + char *data_restoration_callback_uri; + OpenAPI_list_t *reset_ids; + bool is_disaster_roaming_ind; + int disaster_roaming_ind; + bool is_ue_mint_capability; + int ue_mint_capability; + bool is_sor_snpn_si_supported; + int sor_snpn_si_supported; + bool is_udr_restart_ind; + int udr_restart_ind; + char *last_synchronization_time; } OpenAPI_amf3_gpp_access_registration_t; OpenAPI_amf3_gpp_access_registration_t *OpenAPI_amf3_gpp_access_registration_create( @@ -70,6 +89,8 @@ OpenAPI_amf3_gpp_access_registration_t *OpenAPI_amf3_gpp_access_registration_cre char *amf_service_name_pcscf_rest, bool is_initial_registration_ind, int initial_registration_ind, + bool is_emergency_registration_ind, + int emergency_registration_ind, OpenAPI_guami_t *guami, OpenAPI_list_t *backup_amf_info, bool is_dr_flag, @@ -86,7 +107,23 @@ OpenAPI_amf3_gpp_access_registration_t *OpenAPI_amf3_gpp_access_registration_cre OpenAPI_context_info_t *context_info, bool is_no_ee_subscription_ind, int no_ee_subscription_ind, - char *supi + char *supi, + OpenAPI_ue_reachable_ind_e ue_reachable_ind, + bool is_re_registration_required, + int re_registration_required, + bool is_admin_dereg_sub_withdrawn, + int admin_dereg_sub_withdrawn, + char *data_restoration_callback_uri, + OpenAPI_list_t *reset_ids, + bool is_disaster_roaming_ind, + int disaster_roaming_ind, + bool is_ue_mint_capability, + int ue_mint_capability, + bool is_sor_snpn_si_supported, + int sor_snpn_si_supported, + bool is_udr_restart_ind, + int udr_restart_ind, + char *last_synchronization_time ); void OpenAPI_amf3_gpp_access_registration_free(OpenAPI_amf3_gpp_access_registration_t *amf3_gpp_access_registration); OpenAPI_amf3_gpp_access_registration_t *OpenAPI_amf3_gpp_access_registration_parseFromJSON(cJSON *amf3_gpp_access_registrationJSON); diff --git a/lib/sbi/openapi/model/amf3_gpp_access_registration_modification.c b/lib/sbi/openapi/model/amf3_gpp_access_registration_modification.c index 740893e56..ccc30e228 100644 --- a/lib/sbi/openapi/model/amf3_gpp_access_registration_modification.c +++ b/lib/sbi/openapi/model/amf3_gpp_access_registration_modification.c @@ -13,7 +13,9 @@ OpenAPI_amf3_gpp_access_registration_modification_t *OpenAPI_amf3_gpp_access_reg OpenAPI_list_t *backup_amf_info, OpenAPI_eps_interworking_info_t *eps_interworking_info, bool is_ue_srvcc_capability, - int ue_srvcc_capability + int ue_srvcc_capability, + bool is_ue_mint_capability, + int ue_mint_capability ) { OpenAPI_amf3_gpp_access_registration_modification_t *amf3_gpp_access_registration_modification_local_var = ogs_malloc(sizeof(OpenAPI_amf3_gpp_access_registration_modification_t)); @@ -28,6 +30,8 @@ OpenAPI_amf3_gpp_access_registration_modification_t *OpenAPI_amf3_gpp_access_reg amf3_gpp_access_registration_modification_local_var->eps_interworking_info = eps_interworking_info; amf3_gpp_access_registration_modification_local_var->is_ue_srvcc_capability = is_ue_srvcc_capability; amf3_gpp_access_registration_modification_local_var->ue_srvcc_capability = ue_srvcc_capability; + amf3_gpp_access_registration_modification_local_var->is_ue_mint_capability = is_ue_mint_capability; + amf3_gpp_access_registration_modification_local_var->ue_mint_capability = ue_mint_capability; return amf3_gpp_access_registration_modification_local_var; } @@ -144,6 +148,13 @@ cJSON *OpenAPI_amf3_gpp_access_registration_modification_convertToJSON(OpenAPI_a } } + if (amf3_gpp_access_registration_modification->is_ue_mint_capability) { + if (cJSON_AddBoolToObject(item, "ueMINTCapability", amf3_gpp_access_registration_modification->ue_mint_capability) == NULL) { + ogs_error("OpenAPI_amf3_gpp_access_registration_modification_convertToJSON() failed [ue_mint_capability]"); + goto end; + } + } + end: return item; } @@ -163,6 +174,7 @@ OpenAPI_amf3_gpp_access_registration_modification_t *OpenAPI_amf3_gpp_access_reg cJSON *eps_interworking_info = NULL; OpenAPI_eps_interworking_info_t *eps_interworking_info_local_nonprim = NULL; cJSON *ue_srvcc_capability = NULL; + cJSON *ue_mint_capability = NULL; guami = cJSON_GetObjectItemCaseSensitive(amf3_gpp_access_registration_modificationJSON, "guami"); if (!guami) { ogs_error("OpenAPI_amf3_gpp_access_registration_modification_parseFromJSON() failed [guami]"); @@ -233,6 +245,14 @@ OpenAPI_amf3_gpp_access_registration_modification_t *OpenAPI_amf3_gpp_access_reg } } + ue_mint_capability = cJSON_GetObjectItemCaseSensitive(amf3_gpp_access_registration_modificationJSON, "ueMINTCapability"); + if (ue_mint_capability) { + if (!cJSON_IsBool(ue_mint_capability)) { + ogs_error("OpenAPI_amf3_gpp_access_registration_modification_parseFromJSON() failed [ue_mint_capability]"); + goto end; + } + } + amf3_gpp_access_registration_modification_local_var = OpenAPI_amf3_gpp_access_registration_modification_create ( guami_local_nonprim, purge_flag ? true : false, @@ -242,7 +262,9 @@ OpenAPI_amf3_gpp_access_registration_modification_t *OpenAPI_amf3_gpp_access_reg backup_amf_info ? backup_amf_infoList : NULL, eps_interworking_info ? eps_interworking_info_local_nonprim : NULL, ue_srvcc_capability ? true : false, - ue_srvcc_capability ? ue_srvcc_capability->valueint : 0 + ue_srvcc_capability ? ue_srvcc_capability->valueint : 0, + ue_mint_capability ? true : false, + ue_mint_capability ? ue_mint_capability->valueint : 0 ); return amf3_gpp_access_registration_modification_local_var; diff --git a/lib/sbi/openapi/model/amf3_gpp_access_registration_modification.h b/lib/sbi/openapi/model/amf3_gpp_access_registration_modification.h index 45d43de1b..6a0bda70e 100644 --- a/lib/sbi/openapi/model/amf3_gpp_access_registration_modification.h +++ b/lib/sbi/openapi/model/amf3_gpp_access_registration_modification.h @@ -32,6 +32,8 @@ typedef struct OpenAPI_amf3_gpp_access_registration_modification_s { struct OpenAPI_eps_interworking_info_s *eps_interworking_info; bool is_ue_srvcc_capability; int ue_srvcc_capability; + bool is_ue_mint_capability; + int ue_mint_capability; } OpenAPI_amf3_gpp_access_registration_modification_t; OpenAPI_amf3_gpp_access_registration_modification_t *OpenAPI_amf3_gpp_access_registration_modification_create( @@ -43,7 +45,9 @@ OpenAPI_amf3_gpp_access_registration_modification_t *OpenAPI_amf3_gpp_access_reg OpenAPI_list_t *backup_amf_info, OpenAPI_eps_interworking_info_t *eps_interworking_info, bool is_ue_srvcc_capability, - int ue_srvcc_capability + int ue_srvcc_capability, + bool is_ue_mint_capability, + int ue_mint_capability ); void OpenAPI_amf3_gpp_access_registration_modification_free(OpenAPI_amf3_gpp_access_registration_modification_t *amf3_gpp_access_registration_modification); OpenAPI_amf3_gpp_access_registration_modification_t *OpenAPI_amf3_gpp_access_registration_modification_parseFromJSON(cJSON *amf3_gpp_access_registration_modificationJSON); diff --git a/lib/sbi/openapi/model/amf_event.c b/lib/sbi/openapi/model/amf_event.c index 4dd3b5bbe..d0036dd75 100644 --- a/lib/sbi/openapi/model/amf_event.c +++ b/lib/sbi/openapi/model/amf_event.c @@ -16,10 +16,22 @@ OpenAPI_amf_event_t *OpenAPI_amf_event_create( bool is_report_ue_reachable, int report_ue_reachable, OpenAPI_reachability_filter_t *reachability_filter, + bool is_udm_detect_ind, + int udm_detect_ind, bool is_max_reports, int max_reports, + OpenAPI_list_t* presence_info_list, bool is_max_response_time, - int max_response_time + int max_response_time, + OpenAPI_target_area_t *target_area, + OpenAPI_list_t *snssai_filter, + OpenAPI_ue_in_area_filter_t *ue_in_area_filter, + bool is_min_interval, + int min_interval, + char *next_report, + bool is_idle_status_ind, + int idle_status_ind, + OpenAPI_dispersion_area_t *dispersion_area ) { OpenAPI_amf_event_t *amf_event_local_var = ogs_malloc(sizeof(OpenAPI_amf_event_t)); @@ -36,10 +48,22 @@ OpenAPI_amf_event_t *OpenAPI_amf_event_create( amf_event_local_var->is_report_ue_reachable = is_report_ue_reachable; amf_event_local_var->report_ue_reachable = report_ue_reachable; amf_event_local_var->reachability_filter = reachability_filter; + amf_event_local_var->is_udm_detect_ind = is_udm_detect_ind; + amf_event_local_var->udm_detect_ind = udm_detect_ind; amf_event_local_var->is_max_reports = is_max_reports; amf_event_local_var->max_reports = max_reports; + amf_event_local_var->presence_info_list = presence_info_list; amf_event_local_var->is_max_response_time = is_max_response_time; amf_event_local_var->max_response_time = max_response_time; + amf_event_local_var->target_area = target_area; + amf_event_local_var->snssai_filter = snssai_filter; + amf_event_local_var->ue_in_area_filter = ue_in_area_filter; + amf_event_local_var->is_min_interval = is_min_interval; + amf_event_local_var->min_interval = min_interval; + amf_event_local_var->next_report = next_report; + amf_event_local_var->is_idle_status_ind = is_idle_status_ind; + amf_event_local_var->idle_status_ind = idle_status_ind; + amf_event_local_var->dispersion_area = dispersion_area; return amf_event_local_var; } @@ -80,6 +104,39 @@ void OpenAPI_amf_event_free(OpenAPI_amf_event_t *amf_event) OpenAPI_reachability_filter_free(amf_event->reachability_filter); amf_event->reachability_filter = NULL; } + if (amf_event->presence_info_list) { + OpenAPI_list_for_each(amf_event->presence_info_list, node) { + OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*)node->data; + ogs_free(localKeyValue->key); + OpenAPI_presence_info_free(localKeyValue->value); + OpenAPI_map_free(localKeyValue); + } + OpenAPI_list_free(amf_event->presence_info_list); + amf_event->presence_info_list = NULL; + } + if (amf_event->target_area) { + OpenAPI_target_area_free(amf_event->target_area); + amf_event->target_area = NULL; + } + if (amf_event->snssai_filter) { + OpenAPI_list_for_each(amf_event->snssai_filter, node) { + OpenAPI_ext_snssai_free(node->data); + } + OpenAPI_list_free(amf_event->snssai_filter); + amf_event->snssai_filter = NULL; + } + if (amf_event->ue_in_area_filter) { + OpenAPI_ue_in_area_filter_free(amf_event->ue_in_area_filter); + amf_event->ue_in_area_filter = NULL; + } + if (amf_event->next_report) { + ogs_free(amf_event->next_report); + amf_event->next_report = NULL; + } + if (amf_event->dispersion_area) { + OpenAPI_dispersion_area_free(amf_event->dispersion_area); + amf_event->dispersion_area = NULL; + } ogs_free(amf_event); } @@ -191,6 +248,13 @@ cJSON *OpenAPI_amf_event_convertToJSON(OpenAPI_amf_event_t *amf_event) } } + if (amf_event->is_udm_detect_ind) { + if (cJSON_AddBoolToObject(item, "udmDetectInd", amf_event->udm_detect_ind) == NULL) { + ogs_error("OpenAPI_amf_event_convertToJSON() failed [udm_detect_ind]"); + goto end; + } + } + if (amf_event->is_max_reports) { if (cJSON_AddNumberToObject(item, "maxReports", amf_event->max_reports) == NULL) { ogs_error("OpenAPI_amf_event_convertToJSON() failed [max_reports]"); @@ -198,6 +262,28 @@ cJSON *OpenAPI_amf_event_convertToJSON(OpenAPI_amf_event_t *amf_event) } } + if (amf_event->presence_info_list) { + cJSON *presence_info_list = cJSON_AddObjectToObject(item, "presenceInfoList"); + if (presence_info_list == NULL) { + ogs_error("OpenAPI_amf_event_convertToJSON() failed [presence_info_list]"); + goto end; + } + cJSON *localMapObject = presence_info_list; + if (amf_event->presence_info_list) { + OpenAPI_list_for_each(amf_event->presence_info_list, node) { + OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*)node->data; + cJSON *itemLocal = localKeyValue->value ? + OpenAPI_presence_info_convertToJSON(localKeyValue->value) : + cJSON_CreateNull(); + if (itemLocal == NULL) { + ogs_error("OpenAPI_amf_event_convertToJSON() failed [inner]"); + goto end; + } + cJSON_AddItemToObject(localMapObject, localKeyValue->key, itemLocal); + } + } + } + if (amf_event->is_max_response_time) { if (cJSON_AddNumberToObject(item, "maxResponseTime", amf_event->max_response_time) == NULL) { ogs_error("OpenAPI_amf_event_convertToJSON() failed [max_response_time]"); @@ -205,6 +291,82 @@ cJSON *OpenAPI_amf_event_convertToJSON(OpenAPI_amf_event_t *amf_event) } } + if (amf_event->target_area) { + cJSON *target_area_local_JSON = OpenAPI_target_area_convertToJSON(amf_event->target_area); + if (target_area_local_JSON == NULL) { + ogs_error("OpenAPI_amf_event_convertToJSON() failed [target_area]"); + goto end; + } + cJSON_AddItemToObject(item, "targetArea", target_area_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_amf_event_convertToJSON() failed [target_area]"); + goto end; + } + } + + if (amf_event->snssai_filter) { + cJSON *snssai_filterList = cJSON_AddArrayToObject(item, "snssaiFilter"); + if (snssai_filterList == NULL) { + ogs_error("OpenAPI_amf_event_convertToJSON() failed [snssai_filter]"); + goto end; + } + OpenAPI_list_for_each(amf_event->snssai_filter, node) { + cJSON *itemLocal = OpenAPI_ext_snssai_convertToJSON(node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_amf_event_convertToJSON() failed [snssai_filter]"); + goto end; + } + cJSON_AddItemToArray(snssai_filterList, itemLocal); + } + } + + if (amf_event->ue_in_area_filter) { + cJSON *ue_in_area_filter_local_JSON = OpenAPI_ue_in_area_filter_convertToJSON(amf_event->ue_in_area_filter); + if (ue_in_area_filter_local_JSON == NULL) { + ogs_error("OpenAPI_amf_event_convertToJSON() failed [ue_in_area_filter]"); + goto end; + } + cJSON_AddItemToObject(item, "ueInAreaFilter", ue_in_area_filter_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_amf_event_convertToJSON() failed [ue_in_area_filter]"); + goto end; + } + } + + if (amf_event->is_min_interval) { + if (cJSON_AddNumberToObject(item, "minInterval", amf_event->min_interval) == NULL) { + ogs_error("OpenAPI_amf_event_convertToJSON() failed [min_interval]"); + goto end; + } + } + + if (amf_event->next_report) { + if (cJSON_AddStringToObject(item, "nextReport", amf_event->next_report) == NULL) { + ogs_error("OpenAPI_amf_event_convertToJSON() failed [next_report]"); + goto end; + } + } + + if (amf_event->is_idle_status_ind) { + if (cJSON_AddBoolToObject(item, "idleStatusInd", amf_event->idle_status_ind) == NULL) { + ogs_error("OpenAPI_amf_event_convertToJSON() failed [idle_status_ind]"); + goto end; + } + } + + if (amf_event->dispersion_area) { + cJSON *dispersion_area_local_JSON = OpenAPI_dispersion_area_convertToJSON(amf_event->dispersion_area); + if (dispersion_area_local_JSON == NULL) { + ogs_error("OpenAPI_amf_event_convertToJSON() failed [dispersion_area]"); + goto end; + } + cJSON_AddItemToObject(item, "dispersionArea", dispersion_area_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_amf_event_convertToJSON() failed [dispersion_area]"); + goto end; + } + } + end: return item; } @@ -226,8 +388,22 @@ OpenAPI_amf_event_t *OpenAPI_amf_event_parseFromJSON(cJSON *amf_eventJSON) cJSON *report_ue_reachable = NULL; cJSON *reachability_filter = NULL; OpenAPI_reachability_filter_t *reachability_filter_local_nonprim = NULL; + cJSON *udm_detect_ind = NULL; cJSON *max_reports = NULL; + cJSON *presence_info_list = NULL; + OpenAPI_list_t *presence_info_listList = NULL; cJSON *max_response_time = NULL; + cJSON *target_area = NULL; + OpenAPI_target_area_t *target_area_local_nonprim = NULL; + cJSON *snssai_filter = NULL; + OpenAPI_list_t *snssai_filterList = NULL; + cJSON *ue_in_area_filter = NULL; + OpenAPI_ue_in_area_filter_t *ue_in_area_filter_local_nonprim = NULL; + cJSON *min_interval = NULL; + cJSON *next_report = NULL; + cJSON *idle_status_ind = NULL; + cJSON *dispersion_area = NULL; + OpenAPI_dispersion_area_t *dispersion_area_local_nonprim = NULL; type = cJSON_GetObjectItemCaseSensitive(amf_eventJSON, "type"); if (!type) { ogs_error("OpenAPI_amf_event_parseFromJSON() failed [type]"); @@ -339,6 +515,14 @@ OpenAPI_amf_event_t *OpenAPI_amf_event_parseFromJSON(cJSON *amf_eventJSON) reachability_filter_local_nonprim = OpenAPI_reachability_filter_parseFromJSON(reachability_filter); } + udm_detect_ind = cJSON_GetObjectItemCaseSensitive(amf_eventJSON, "udmDetectInd"); + if (udm_detect_ind) { + if (!cJSON_IsBool(udm_detect_ind)) { + ogs_error("OpenAPI_amf_event_parseFromJSON() failed [udm_detect_ind]"); + goto end; + } + } + max_reports = cJSON_GetObjectItemCaseSensitive(amf_eventJSON, "maxReports"); if (max_reports) { if (!cJSON_IsNumber(max_reports)) { @@ -347,6 +531,32 @@ OpenAPI_amf_event_t *OpenAPI_amf_event_parseFromJSON(cJSON *amf_eventJSON) } } + presence_info_list = cJSON_GetObjectItemCaseSensitive(amf_eventJSON, "presenceInfoList"); + if (presence_info_list) { + cJSON *presence_info_list_local_map = NULL; + if (!cJSON_IsObject(presence_info_list) && !cJSON_IsNull(presence_info_list)) { + ogs_error("OpenAPI_amf_event_parseFromJSON() failed [presence_info_list]"); + goto end; + } + if (cJSON_IsObject(presence_info_list)) { + presence_info_listList = OpenAPI_list_create(); + OpenAPI_map_t *localMapKeyPair = NULL; + cJSON_ArrayForEach(presence_info_list_local_map, presence_info_list) { + cJSON *localMapObject = presence_info_list_local_map; + if (cJSON_IsObject(localMapObject)) { + localMapKeyPair = OpenAPI_map_create( + ogs_strdup(localMapObject->string), OpenAPI_presence_info_parseFromJSON(localMapObject)); + } else if (cJSON_IsNull(localMapObject)) { + localMapKeyPair = OpenAPI_map_create(ogs_strdup(localMapObject->string), NULL); + } else { + ogs_error("OpenAPI_amf_event_parseFromJSON() failed [inner]"); + goto end; + } + OpenAPI_list_add(presence_info_listList, localMapKeyPair); + } + } + } + max_response_time = cJSON_GetObjectItemCaseSensitive(amf_eventJSON, "maxResponseTime"); if (max_response_time) { if (!cJSON_IsNumber(max_response_time)) { @@ -355,6 +565,70 @@ OpenAPI_amf_event_t *OpenAPI_amf_event_parseFromJSON(cJSON *amf_eventJSON) } } + target_area = cJSON_GetObjectItemCaseSensitive(amf_eventJSON, "targetArea"); + if (target_area) { + target_area_local_nonprim = OpenAPI_target_area_parseFromJSON(target_area); + } + + snssai_filter = cJSON_GetObjectItemCaseSensitive(amf_eventJSON, "snssaiFilter"); + if (snssai_filter) { + cJSON *snssai_filter_local = NULL; + if (!cJSON_IsArray(snssai_filter)) { + ogs_error("OpenAPI_amf_event_parseFromJSON() failed [snssai_filter]"); + goto end; + } + + snssai_filterList = OpenAPI_list_create(); + + cJSON_ArrayForEach(snssai_filter_local, snssai_filter) { + if (!cJSON_IsObject(snssai_filter_local)) { + ogs_error("OpenAPI_amf_event_parseFromJSON() failed [snssai_filter]"); + goto end; + } + OpenAPI_ext_snssai_t *snssai_filterItem = OpenAPI_ext_snssai_parseFromJSON(snssai_filter_local); + if (!snssai_filterItem) { + ogs_error("No snssai_filterItem"); + OpenAPI_list_free(snssai_filterList); + goto end; + } + OpenAPI_list_add(snssai_filterList, snssai_filterItem); + } + } + + ue_in_area_filter = cJSON_GetObjectItemCaseSensitive(amf_eventJSON, "ueInAreaFilter"); + if (ue_in_area_filter) { + ue_in_area_filter_local_nonprim = OpenAPI_ue_in_area_filter_parseFromJSON(ue_in_area_filter); + } + + min_interval = cJSON_GetObjectItemCaseSensitive(amf_eventJSON, "minInterval"); + if (min_interval) { + if (!cJSON_IsNumber(min_interval)) { + ogs_error("OpenAPI_amf_event_parseFromJSON() failed [min_interval]"); + goto end; + } + } + + next_report = cJSON_GetObjectItemCaseSensitive(amf_eventJSON, "nextReport"); + if (next_report) { + if (!cJSON_IsString(next_report) && !cJSON_IsNull(next_report)) { + ogs_error("OpenAPI_amf_event_parseFromJSON() failed [next_report]"); + goto end; + } + } + + idle_status_ind = cJSON_GetObjectItemCaseSensitive(amf_eventJSON, "idleStatusInd"); + if (idle_status_ind) { + if (!cJSON_IsBool(idle_status_ind)) { + ogs_error("OpenAPI_amf_event_parseFromJSON() failed [idle_status_ind]"); + goto end; + } + } + + dispersion_area = cJSON_GetObjectItemCaseSensitive(amf_eventJSON, "dispersionArea"); + if (dispersion_area) { + dispersion_area_local_nonprim = OpenAPI_dispersion_area_parseFromJSON(dispersion_area); + } + amf_event_local_var = OpenAPI_amf_event_create ( type_local_nonprim, immediate_flag ? true : false, @@ -367,10 +641,22 @@ OpenAPI_amf_event_t *OpenAPI_amf_event_parseFromJSON(cJSON *amf_eventJSON) report_ue_reachable ? true : false, report_ue_reachable ? report_ue_reachable->valueint : 0, reachability_filter ? reachability_filter_local_nonprim : NULL, + udm_detect_ind ? true : false, + udm_detect_ind ? udm_detect_ind->valueint : 0, max_reports ? true : false, max_reports ? max_reports->valuedouble : 0, + presence_info_list ? presence_info_listList : NULL, max_response_time ? true : false, - max_response_time ? max_response_time->valuedouble : 0 + max_response_time ? max_response_time->valuedouble : 0, + target_area ? target_area_local_nonprim : NULL, + snssai_filter ? snssai_filterList : NULL, + ue_in_area_filter ? ue_in_area_filter_local_nonprim : NULL, + min_interval ? true : false, + min_interval ? min_interval->valuedouble : 0, + next_report && !cJSON_IsNull(next_report) ? ogs_strdup(next_report->valuestring) : NULL, + idle_status_ind ? true : false, + idle_status_ind ? idle_status_ind->valueint : 0, + dispersion_area ? dispersion_area_local_nonprim : NULL ); return amf_event_local_var; @@ -404,6 +690,35 @@ end: OpenAPI_reachability_filter_free(reachability_filter_local_nonprim); reachability_filter_local_nonprim = NULL; } + if (presence_info_listList) { + OpenAPI_list_for_each(presence_info_listList, node) { + OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*) node->data; + ogs_free(localKeyValue->key); + OpenAPI_presence_info_free(localKeyValue->value); + OpenAPI_map_free(localKeyValue); + } + OpenAPI_list_free(presence_info_listList); + presence_info_listList = NULL; + } + if (target_area_local_nonprim) { + OpenAPI_target_area_free(target_area_local_nonprim); + target_area_local_nonprim = NULL; + } + if (snssai_filterList) { + OpenAPI_list_for_each(snssai_filterList, node) { + OpenAPI_ext_snssai_free(node->data); + } + OpenAPI_list_free(snssai_filterList); + snssai_filterList = NULL; + } + if (ue_in_area_filter_local_nonprim) { + OpenAPI_ue_in_area_filter_free(ue_in_area_filter_local_nonprim); + ue_in_area_filter_local_nonprim = NULL; + } + if (dispersion_area_local_nonprim) { + OpenAPI_dispersion_area_free(dispersion_area_local_nonprim); + dispersion_area_local_nonprim = NULL; + } return NULL; } diff --git a/lib/sbi/openapi/model/amf_event.h b/lib/sbi/openapi/model/amf_event.h index 5c48eb518..fab285a11 100644 --- a/lib/sbi/openapi/model/amf_event.h +++ b/lib/sbi/openapi/model/amf_event.h @@ -1,7 +1,7 @@ /* * amf_event.h * - * + * Describes an event to be subscribed */ #ifndef _OpenAPI_amf_event_H_ @@ -14,9 +14,14 @@ #include "../include/binary.h" #include "amf_event_area.h" #include "amf_event_type.h" +#include "dispersion_area.h" +#include "ext_snssai.h" #include "location_filter.h" +#include "presence_info.h" #include "reachability_filter.h" +#include "target_area.h" #include "traffic_descriptor.h" +#include "ue_in_area_filter.h" #ifdef __cplusplus extern "C" { @@ -35,10 +40,22 @@ typedef struct OpenAPI_amf_event_s { bool is_report_ue_reachable; int report_ue_reachable; struct OpenAPI_reachability_filter_s *reachability_filter; + bool is_udm_detect_ind; + int udm_detect_ind; bool is_max_reports; int max_reports; + OpenAPI_list_t* presence_info_list; bool is_max_response_time; int max_response_time; + struct OpenAPI_target_area_s *target_area; + OpenAPI_list_t *snssai_filter; + struct OpenAPI_ue_in_area_filter_s *ue_in_area_filter; + bool is_min_interval; + int min_interval; + char *next_report; + bool is_idle_status_ind; + int idle_status_ind; + struct OpenAPI_dispersion_area_s *dispersion_area; } OpenAPI_amf_event_t; OpenAPI_amf_event_t *OpenAPI_amf_event_create( @@ -53,10 +70,22 @@ OpenAPI_amf_event_t *OpenAPI_amf_event_create( bool is_report_ue_reachable, int report_ue_reachable, OpenAPI_reachability_filter_t *reachability_filter, + bool is_udm_detect_ind, + int udm_detect_ind, bool is_max_reports, int max_reports, + OpenAPI_list_t* presence_info_list, bool is_max_response_time, - int max_response_time + int max_response_time, + OpenAPI_target_area_t *target_area, + OpenAPI_list_t *snssai_filter, + OpenAPI_ue_in_area_filter_t *ue_in_area_filter, + bool is_min_interval, + int min_interval, + char *next_report, + bool is_idle_status_ind, + int idle_status_ind, + OpenAPI_dispersion_area_t *dispersion_area ); void OpenAPI_amf_event_free(OpenAPI_amf_event_t *amf_event); OpenAPI_amf_event_t *OpenAPI_amf_event_parseFromJSON(cJSON *amf_eventJSON); diff --git a/lib/sbi/openapi/model/amf_event_area.h b/lib/sbi/openapi/model/amf_event_area.h index b159ebba1..43e143e36 100644 --- a/lib/sbi/openapi/model/amf_event_area.h +++ b/lib/sbi/openapi/model/amf_event_area.h @@ -1,7 +1,7 @@ /* * amf_event_area.h * - * + * Represents an area to be monitored by an AMF event */ #ifndef _OpenAPI_amf_event_area_H_ diff --git a/lib/sbi/openapi/model/amf_event_mode.c b/lib/sbi/openapi/model/amf_event_mode.c index 03baff570..a41d777cd 100644 --- a/lib/sbi/openapi/model/amf_event_mode.c +++ b/lib/sbi/openapi/model/amf_event_mode.c @@ -12,7 +12,9 @@ OpenAPI_amf_event_mode_t *OpenAPI_amf_event_mode_create( bool is_rep_period, int rep_period, bool is_samp_ratio, - int samp_ratio + int samp_ratio, + OpenAPI_list_t *partitioning_criteria, + OpenAPI_notification_flag_e notif_flag ) { OpenAPI_amf_event_mode_t *amf_event_mode_local_var = ogs_malloc(sizeof(OpenAPI_amf_event_mode_t)); @@ -26,6 +28,8 @@ OpenAPI_amf_event_mode_t *OpenAPI_amf_event_mode_create( amf_event_mode_local_var->rep_period = rep_period; amf_event_mode_local_var->is_samp_ratio = is_samp_ratio; amf_event_mode_local_var->samp_ratio = samp_ratio; + amf_event_mode_local_var->partitioning_criteria = partitioning_criteria; + amf_event_mode_local_var->notif_flag = notif_flag; return amf_event_mode_local_var; } @@ -45,6 +49,10 @@ void OpenAPI_amf_event_mode_free(OpenAPI_amf_event_mode_t *amf_event_mode) ogs_free(amf_event_mode->expiry); amf_event_mode->expiry = NULL; } + if (amf_event_mode->partitioning_criteria) { + OpenAPI_list_free(amf_event_mode->partitioning_criteria); + amf_event_mode->partitioning_criteria = NULL; + } ogs_free(amf_event_mode); } @@ -102,6 +110,27 @@ cJSON *OpenAPI_amf_event_mode_convertToJSON(OpenAPI_amf_event_mode_t *amf_event_ } } + if (amf_event_mode->partitioning_criteria != OpenAPI_partitioning_criteria_NULL) { + cJSON *partitioning_criteriaList = cJSON_AddArrayToObject(item, "partitioningCriteria"); + if (partitioning_criteriaList == NULL) { + ogs_error("OpenAPI_amf_event_mode_convertToJSON() failed [partitioning_criteria]"); + goto end; + } + OpenAPI_list_for_each(amf_event_mode->partitioning_criteria, node) { + if (cJSON_AddStringToObject(partitioning_criteriaList, "", OpenAPI_partitioning_criteria_ToString((intptr_t)node->data)) == NULL) { + ogs_error("OpenAPI_amf_event_mode_convertToJSON() failed [partitioning_criteria]"); + goto end; + } + } + } + + if (amf_event_mode->notif_flag != OpenAPI_notification_flag_NULL) { + if (cJSON_AddStringToObject(item, "notifFlag", OpenAPI_notification_flag_ToString(amf_event_mode->notif_flag)) == NULL) { + ogs_error("OpenAPI_amf_event_mode_convertToJSON() failed [notif_flag]"); + goto end; + } + } + end: return item; } @@ -116,6 +145,10 @@ OpenAPI_amf_event_mode_t *OpenAPI_amf_event_mode_parseFromJSON(cJSON *amf_event_ cJSON *expiry = NULL; cJSON *rep_period = NULL; cJSON *samp_ratio = NULL; + cJSON *partitioning_criteria = NULL; + OpenAPI_list_t *partitioning_criteriaList = NULL; + cJSON *notif_flag = NULL; + OpenAPI_notification_flag_e notif_flagVariable = 0; trigger = cJSON_GetObjectItemCaseSensitive(amf_event_modeJSON, "trigger"); if (!trigger) { ogs_error("OpenAPI_amf_event_mode_parseFromJSON() failed [trigger]"); @@ -155,6 +188,34 @@ OpenAPI_amf_event_mode_t *OpenAPI_amf_event_mode_parseFromJSON(cJSON *amf_event_ } } + partitioning_criteria = cJSON_GetObjectItemCaseSensitive(amf_event_modeJSON, "partitioningCriteria"); + if (partitioning_criteria) { + cJSON *partitioning_criteria_local = NULL; + if (!cJSON_IsArray(partitioning_criteria)) { + ogs_error("OpenAPI_amf_event_mode_parseFromJSON() failed [partitioning_criteria]"); + goto end; + } + + partitioning_criteriaList = OpenAPI_list_create(); + + cJSON_ArrayForEach(partitioning_criteria_local, partitioning_criteria) { + if (!cJSON_IsString(partitioning_criteria_local)) { + ogs_error("OpenAPI_amf_event_mode_parseFromJSON() failed [partitioning_criteria]"); + goto end; + } + OpenAPI_list_add(partitioning_criteriaList, (void *)OpenAPI_partitioning_criteria_FromString(partitioning_criteria_local->valuestring)); + } + } + + notif_flag = cJSON_GetObjectItemCaseSensitive(amf_event_modeJSON, "notifFlag"); + if (notif_flag) { + if (!cJSON_IsString(notif_flag)) { + ogs_error("OpenAPI_amf_event_mode_parseFromJSON() failed [notif_flag]"); + goto end; + } + notif_flagVariable = OpenAPI_notification_flag_FromString(notif_flag->valuestring); + } + amf_event_mode_local_var = OpenAPI_amf_event_mode_create ( trigger_local_nonprim, max_reports ? true : false, @@ -163,7 +224,9 @@ OpenAPI_amf_event_mode_t *OpenAPI_amf_event_mode_parseFromJSON(cJSON *amf_event_ rep_period ? true : false, rep_period ? rep_period->valuedouble : 0, samp_ratio ? true : false, - samp_ratio ? samp_ratio->valuedouble : 0 + samp_ratio ? samp_ratio->valuedouble : 0, + partitioning_criteria ? partitioning_criteriaList : NULL, + notif_flag ? notif_flagVariable : 0 ); return amf_event_mode_local_var; @@ -172,6 +235,10 @@ end: OpenAPI_amf_event_trigger_free(trigger_local_nonprim); trigger_local_nonprim = NULL; } + if (partitioning_criteriaList) { + OpenAPI_list_free(partitioning_criteriaList); + partitioning_criteriaList = NULL; + } return NULL; } diff --git a/lib/sbi/openapi/model/amf_event_mode.h b/lib/sbi/openapi/model/amf_event_mode.h index 2601e379b..4d5125779 100644 --- a/lib/sbi/openapi/model/amf_event_mode.h +++ b/lib/sbi/openapi/model/amf_event_mode.h @@ -1,7 +1,7 @@ /* * amf_event_mode.h * - * + * Describes how the reports shall be generated by a subscribed event */ #ifndef _OpenAPI_amf_event_mode_H_ @@ -13,6 +13,8 @@ #include "../include/keyValuePair.h" #include "../include/binary.h" #include "amf_event_trigger.h" +#include "notification_flag.h" +#include "partitioning_criteria.h" #ifdef __cplusplus extern "C" { @@ -28,6 +30,8 @@ typedef struct OpenAPI_amf_event_mode_s { int rep_period; bool is_samp_ratio; int samp_ratio; + OpenAPI_list_t *partitioning_criteria; + OpenAPI_notification_flag_e notif_flag; } OpenAPI_amf_event_mode_t; OpenAPI_amf_event_mode_t *OpenAPI_amf_event_mode_create( @@ -38,7 +42,9 @@ OpenAPI_amf_event_mode_t *OpenAPI_amf_event_mode_create( bool is_rep_period, int rep_period, bool is_samp_ratio, - int samp_ratio + int samp_ratio, + OpenAPI_list_t *partitioning_criteria, + OpenAPI_notification_flag_e notif_flag ); void OpenAPI_amf_event_mode_free(OpenAPI_amf_event_mode_t *amf_event_mode); OpenAPI_amf_event_mode_t *OpenAPI_amf_event_mode_parseFromJSON(cJSON *amf_event_modeJSON); diff --git a/lib/sbi/openapi/model/amf_event_subscription.c b/lib/sbi/openapi/model/amf_event_subscription.c index bbff57c62..666783d92 100644 --- a/lib/sbi/openapi/model/amf_event_subscription.c +++ b/lib/sbi/openapi/model/amf_event_subscription.c @@ -13,6 +13,10 @@ OpenAPI_amf_event_subscription_t *OpenAPI_amf_event_subscription_create( char *subs_change_notify_correlation_id, char *supi, char *group_id, + OpenAPI_list_t *exclude_supi_list, + OpenAPI_list_t *exclude_gpsi_list, + OpenAPI_list_t *include_supi_list, + OpenAPI_list_t *include_gpsi_list, char *gpsi, char *pei, bool is_any_ue, @@ -32,6 +36,10 @@ OpenAPI_amf_event_subscription_t *OpenAPI_amf_event_subscription_create( amf_event_subscription_local_var->subs_change_notify_correlation_id = subs_change_notify_correlation_id; amf_event_subscription_local_var->supi = supi; amf_event_subscription_local_var->group_id = group_id; + amf_event_subscription_local_var->exclude_supi_list = exclude_supi_list; + amf_event_subscription_local_var->exclude_gpsi_list = exclude_gpsi_list; + amf_event_subscription_local_var->include_supi_list = include_supi_list; + amf_event_subscription_local_var->include_gpsi_list = include_gpsi_list; amf_event_subscription_local_var->gpsi = gpsi; amf_event_subscription_local_var->pei = pei; amf_event_subscription_local_var->is_any_ue = is_any_ue; @@ -84,6 +92,34 @@ void OpenAPI_amf_event_subscription_free(OpenAPI_amf_event_subscription_t *amf_e ogs_free(amf_event_subscription->group_id); amf_event_subscription->group_id = NULL; } + if (amf_event_subscription->exclude_supi_list) { + OpenAPI_list_for_each(amf_event_subscription->exclude_supi_list, node) { + ogs_free(node->data); + } + OpenAPI_list_free(amf_event_subscription->exclude_supi_list); + amf_event_subscription->exclude_supi_list = NULL; + } + if (amf_event_subscription->exclude_gpsi_list) { + OpenAPI_list_for_each(amf_event_subscription->exclude_gpsi_list, node) { + ogs_free(node->data); + } + OpenAPI_list_free(amf_event_subscription->exclude_gpsi_list); + amf_event_subscription->exclude_gpsi_list = NULL; + } + if (amf_event_subscription->include_supi_list) { + OpenAPI_list_for_each(amf_event_subscription->include_supi_list, node) { + ogs_free(node->data); + } + OpenAPI_list_free(amf_event_subscription->include_supi_list); + amf_event_subscription->include_supi_list = NULL; + } + if (amf_event_subscription->include_gpsi_list) { + OpenAPI_list_for_each(amf_event_subscription->include_gpsi_list, node) { + ogs_free(node->data); + } + OpenAPI_list_free(amf_event_subscription->include_gpsi_list); + amf_event_subscription->include_gpsi_list = NULL; + } if (amf_event_subscription->gpsi) { ogs_free(amf_event_subscription->gpsi); amf_event_subscription->gpsi = NULL; @@ -183,6 +219,62 @@ cJSON *OpenAPI_amf_event_subscription_convertToJSON(OpenAPI_amf_event_subscripti } } + if (amf_event_subscription->exclude_supi_list) { + cJSON *exclude_supi_listList = cJSON_AddArrayToObject(item, "excludeSupiList"); + if (exclude_supi_listList == NULL) { + ogs_error("OpenAPI_amf_event_subscription_convertToJSON() failed [exclude_supi_list]"); + goto end; + } + OpenAPI_list_for_each(amf_event_subscription->exclude_supi_list, node) { + if (cJSON_AddStringToObject(exclude_supi_listList, "", (char*)node->data) == NULL) { + ogs_error("OpenAPI_amf_event_subscription_convertToJSON() failed [exclude_supi_list]"); + goto end; + } + } + } + + if (amf_event_subscription->exclude_gpsi_list) { + cJSON *exclude_gpsi_listList = cJSON_AddArrayToObject(item, "excludeGpsiList"); + if (exclude_gpsi_listList == NULL) { + ogs_error("OpenAPI_amf_event_subscription_convertToJSON() failed [exclude_gpsi_list]"); + goto end; + } + OpenAPI_list_for_each(amf_event_subscription->exclude_gpsi_list, node) { + if (cJSON_AddStringToObject(exclude_gpsi_listList, "", (char*)node->data) == NULL) { + ogs_error("OpenAPI_amf_event_subscription_convertToJSON() failed [exclude_gpsi_list]"); + goto end; + } + } + } + + if (amf_event_subscription->include_supi_list) { + cJSON *include_supi_listList = cJSON_AddArrayToObject(item, "includeSupiList"); + if (include_supi_listList == NULL) { + ogs_error("OpenAPI_amf_event_subscription_convertToJSON() failed [include_supi_list]"); + goto end; + } + OpenAPI_list_for_each(amf_event_subscription->include_supi_list, node) { + if (cJSON_AddStringToObject(include_supi_listList, "", (char*)node->data) == NULL) { + ogs_error("OpenAPI_amf_event_subscription_convertToJSON() failed [include_supi_list]"); + goto end; + } + } + } + + if (amf_event_subscription->include_gpsi_list) { + cJSON *include_gpsi_listList = cJSON_AddArrayToObject(item, "includeGpsiList"); + if (include_gpsi_listList == NULL) { + ogs_error("OpenAPI_amf_event_subscription_convertToJSON() failed [include_gpsi_list]"); + goto end; + } + OpenAPI_list_for_each(amf_event_subscription->include_gpsi_list, node) { + if (cJSON_AddStringToObject(include_gpsi_listList, "", (char*)node->data) == NULL) { + ogs_error("OpenAPI_amf_event_subscription_convertToJSON() failed [include_gpsi_list]"); + goto end; + } + } + } + if (amf_event_subscription->gpsi) { if (cJSON_AddStringToObject(item, "gpsi", amf_event_subscription->gpsi) == NULL) { ogs_error("OpenAPI_amf_event_subscription_convertToJSON() failed [gpsi]"); @@ -241,6 +333,14 @@ OpenAPI_amf_event_subscription_t *OpenAPI_amf_event_subscription_parseFromJSON(c cJSON *subs_change_notify_correlation_id = NULL; cJSON *supi = NULL; cJSON *group_id = NULL; + cJSON *exclude_supi_list = NULL; + OpenAPI_list_t *exclude_supi_listList = NULL; + cJSON *exclude_gpsi_list = NULL; + OpenAPI_list_t *exclude_gpsi_listList = NULL; + cJSON *include_supi_list = NULL; + OpenAPI_list_t *include_supi_listList = NULL; + cJSON *include_gpsi_list = NULL; + OpenAPI_list_t *include_gpsi_listList = NULL; cJSON *gpsi = NULL; cJSON *pei = NULL; cJSON *any_ue = NULL; @@ -337,6 +437,90 @@ OpenAPI_amf_event_subscription_t *OpenAPI_amf_event_subscription_parseFromJSON(c } } + exclude_supi_list = cJSON_GetObjectItemCaseSensitive(amf_event_subscriptionJSON, "excludeSupiList"); + if (exclude_supi_list) { + cJSON *exclude_supi_list_local = NULL; + if (!cJSON_IsArray(exclude_supi_list)) { + ogs_error("OpenAPI_amf_event_subscription_parseFromJSON() failed [exclude_supi_list]"); + goto end; + } + + exclude_supi_listList = OpenAPI_list_create(); + + cJSON_ArrayForEach(exclude_supi_list_local, exclude_supi_list) { + double *localDouble = NULL; + int *localInt = NULL; + if (!cJSON_IsString(exclude_supi_list_local)) { + ogs_error("OpenAPI_amf_event_subscription_parseFromJSON() failed [exclude_supi_list]"); + goto end; + } + OpenAPI_list_add(exclude_supi_listList, ogs_strdup(exclude_supi_list_local->valuestring)); + } + } + + exclude_gpsi_list = cJSON_GetObjectItemCaseSensitive(amf_event_subscriptionJSON, "excludeGpsiList"); + if (exclude_gpsi_list) { + cJSON *exclude_gpsi_list_local = NULL; + if (!cJSON_IsArray(exclude_gpsi_list)) { + ogs_error("OpenAPI_amf_event_subscription_parseFromJSON() failed [exclude_gpsi_list]"); + goto end; + } + + exclude_gpsi_listList = OpenAPI_list_create(); + + cJSON_ArrayForEach(exclude_gpsi_list_local, exclude_gpsi_list) { + double *localDouble = NULL; + int *localInt = NULL; + if (!cJSON_IsString(exclude_gpsi_list_local)) { + ogs_error("OpenAPI_amf_event_subscription_parseFromJSON() failed [exclude_gpsi_list]"); + goto end; + } + OpenAPI_list_add(exclude_gpsi_listList, ogs_strdup(exclude_gpsi_list_local->valuestring)); + } + } + + include_supi_list = cJSON_GetObjectItemCaseSensitive(amf_event_subscriptionJSON, "includeSupiList"); + if (include_supi_list) { + cJSON *include_supi_list_local = NULL; + if (!cJSON_IsArray(include_supi_list)) { + ogs_error("OpenAPI_amf_event_subscription_parseFromJSON() failed [include_supi_list]"); + goto end; + } + + include_supi_listList = OpenAPI_list_create(); + + cJSON_ArrayForEach(include_supi_list_local, include_supi_list) { + double *localDouble = NULL; + int *localInt = NULL; + if (!cJSON_IsString(include_supi_list_local)) { + ogs_error("OpenAPI_amf_event_subscription_parseFromJSON() failed [include_supi_list]"); + goto end; + } + OpenAPI_list_add(include_supi_listList, ogs_strdup(include_supi_list_local->valuestring)); + } + } + + include_gpsi_list = cJSON_GetObjectItemCaseSensitive(amf_event_subscriptionJSON, "includeGpsiList"); + if (include_gpsi_list) { + cJSON *include_gpsi_list_local = NULL; + if (!cJSON_IsArray(include_gpsi_list)) { + ogs_error("OpenAPI_amf_event_subscription_parseFromJSON() failed [include_gpsi_list]"); + goto end; + } + + include_gpsi_listList = OpenAPI_list_create(); + + cJSON_ArrayForEach(include_gpsi_list_local, include_gpsi_list) { + double *localDouble = NULL; + int *localInt = NULL; + if (!cJSON_IsString(include_gpsi_list_local)) { + ogs_error("OpenAPI_amf_event_subscription_parseFromJSON() failed [include_gpsi_list]"); + goto end; + } + OpenAPI_list_add(include_gpsi_listList, ogs_strdup(include_gpsi_list_local->valuestring)); + } + } + gpsi = cJSON_GetObjectItemCaseSensitive(amf_event_subscriptionJSON, "gpsi"); if (gpsi) { if (!cJSON_IsString(gpsi) && !cJSON_IsNull(gpsi)) { @@ -384,6 +568,10 @@ OpenAPI_amf_event_subscription_t *OpenAPI_amf_event_subscription_parseFromJSON(c subs_change_notify_correlation_id && !cJSON_IsNull(subs_change_notify_correlation_id) ? ogs_strdup(subs_change_notify_correlation_id->valuestring) : NULL, supi && !cJSON_IsNull(supi) ? ogs_strdup(supi->valuestring) : NULL, group_id && !cJSON_IsNull(group_id) ? ogs_strdup(group_id->valuestring) : NULL, + exclude_supi_list ? exclude_supi_listList : NULL, + exclude_gpsi_list ? exclude_gpsi_listList : NULL, + include_supi_list ? include_supi_listList : NULL, + include_gpsi_list ? include_gpsi_listList : NULL, gpsi && !cJSON_IsNull(gpsi) ? ogs_strdup(gpsi->valuestring) : NULL, pei && !cJSON_IsNull(pei) ? ogs_strdup(pei->valuestring) : NULL, any_ue ? true : false, @@ -401,6 +589,34 @@ end: OpenAPI_list_free(event_listList); event_listList = NULL; } + if (exclude_supi_listList) { + OpenAPI_list_for_each(exclude_supi_listList, node) { + ogs_free(node->data); + } + OpenAPI_list_free(exclude_supi_listList); + exclude_supi_listList = NULL; + } + if (exclude_gpsi_listList) { + OpenAPI_list_for_each(exclude_gpsi_listList, node) { + ogs_free(node->data); + } + OpenAPI_list_free(exclude_gpsi_listList); + exclude_gpsi_listList = NULL; + } + if (include_supi_listList) { + OpenAPI_list_for_each(include_supi_listList, node) { + ogs_free(node->data); + } + OpenAPI_list_free(include_supi_listList); + include_supi_listList = NULL; + } + if (include_gpsi_listList) { + OpenAPI_list_for_each(include_gpsi_listList, node) { + ogs_free(node->data); + } + OpenAPI_list_free(include_gpsi_listList); + include_gpsi_listList = NULL; + } if (options_local_nonprim) { OpenAPI_amf_event_mode_free(options_local_nonprim); options_local_nonprim = NULL; diff --git a/lib/sbi/openapi/model/amf_event_subscription.h b/lib/sbi/openapi/model/amf_event_subscription.h index 4a958bd61..29e7f365f 100644 --- a/lib/sbi/openapi/model/amf_event_subscription.h +++ b/lib/sbi/openapi/model/amf_event_subscription.h @@ -1,7 +1,7 @@ /* * amf_event_subscription.h * - * + * Represents an individual event subscription resource on AMF */ #ifndef _OpenAPI_amf_event_subscription_H_ @@ -30,6 +30,10 @@ typedef struct OpenAPI_amf_event_subscription_s { char *subs_change_notify_correlation_id; char *supi; char *group_id; + OpenAPI_list_t *exclude_supi_list; + OpenAPI_list_t *exclude_gpsi_list; + OpenAPI_list_t *include_supi_list; + OpenAPI_list_t *include_gpsi_list; char *gpsi; char *pei; bool is_any_ue; @@ -47,6 +51,10 @@ OpenAPI_amf_event_subscription_t *OpenAPI_amf_event_subscription_create( char *subs_change_notify_correlation_id, char *supi, char *group_id, + OpenAPI_list_t *exclude_supi_list, + OpenAPI_list_t *exclude_gpsi_list, + OpenAPI_list_t *include_supi_list, + OpenAPI_list_t *include_gpsi_list, char *gpsi, char *pei, bool is_any_ue, diff --git a/lib/sbi/openapi/model/amf_event_subscription_add_info.c b/lib/sbi/openapi/model/amf_event_subscription_add_info.c index b6301867f..22c3420aa 100644 --- a/lib/sbi/openapi/model/amf_event_subscription_add_info.c +++ b/lib/sbi/openapi/model/amf_event_subscription_add_info.c @@ -6,7 +6,11 @@ OpenAPI_amf_event_subscription_add_info_t *OpenAPI_amf_event_subscription_add_info_create( OpenAPI_list_t *binding_info, - OpenAPI_nf_type_e subscribing_nf_type + OpenAPI_nf_type_e subscribing_nf_type, + bool is_event_sync_ind, + int event_sync_ind, + OpenAPI_list_t *nf_consumer_info, + OpenAPI_list_t* aoi_state_list ) { OpenAPI_amf_event_subscription_add_info_t *amf_event_subscription_add_info_local_var = ogs_malloc(sizeof(OpenAPI_amf_event_subscription_add_info_t)); @@ -14,6 +18,10 @@ OpenAPI_amf_event_subscription_add_info_t *OpenAPI_amf_event_subscription_add_in amf_event_subscription_add_info_local_var->binding_info = binding_info; amf_event_subscription_add_info_local_var->subscribing_nf_type = subscribing_nf_type; + amf_event_subscription_add_info_local_var->is_event_sync_ind = is_event_sync_ind; + amf_event_subscription_add_info_local_var->event_sync_ind = event_sync_ind; + amf_event_subscription_add_info_local_var->nf_consumer_info = nf_consumer_info; + amf_event_subscription_add_info_local_var->aoi_state_list = aoi_state_list; return amf_event_subscription_add_info_local_var; } @@ -32,6 +40,23 @@ void OpenAPI_amf_event_subscription_add_info_free(OpenAPI_amf_event_subscription OpenAPI_list_free(amf_event_subscription_add_info->binding_info); amf_event_subscription_add_info->binding_info = NULL; } + if (amf_event_subscription_add_info->nf_consumer_info) { + OpenAPI_list_for_each(amf_event_subscription_add_info->nf_consumer_info, node) { + ogs_free(node->data); + } + OpenAPI_list_free(amf_event_subscription_add_info->nf_consumer_info); + amf_event_subscription_add_info->nf_consumer_info = NULL; + } + if (amf_event_subscription_add_info->aoi_state_list) { + OpenAPI_list_for_each(amf_event_subscription_add_info->aoi_state_list, node) { + OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*)node->data; + ogs_free(localKeyValue->key); + OpenAPI_area_of_interest_event_state_free(localKeyValue->value); + OpenAPI_map_free(localKeyValue); + } + OpenAPI_list_free(amf_event_subscription_add_info->aoi_state_list); + amf_event_subscription_add_info->aoi_state_list = NULL; + } ogs_free(amf_event_subscription_add_info); } @@ -67,6 +92,49 @@ cJSON *OpenAPI_amf_event_subscription_add_info_convertToJSON(OpenAPI_amf_event_s } } + if (amf_event_subscription_add_info->is_event_sync_ind) { + if (cJSON_AddBoolToObject(item, "eventSyncInd", amf_event_subscription_add_info->event_sync_ind) == NULL) { + ogs_error("OpenAPI_amf_event_subscription_add_info_convertToJSON() failed [event_sync_ind]"); + goto end; + } + } + + if (amf_event_subscription_add_info->nf_consumer_info) { + cJSON *nf_consumer_infoList = cJSON_AddArrayToObject(item, "nfConsumerInfo"); + if (nf_consumer_infoList == NULL) { + ogs_error("OpenAPI_amf_event_subscription_add_info_convertToJSON() failed [nf_consumer_info]"); + goto end; + } + OpenAPI_list_for_each(amf_event_subscription_add_info->nf_consumer_info, node) { + if (cJSON_AddStringToObject(nf_consumer_infoList, "", (char*)node->data) == NULL) { + ogs_error("OpenAPI_amf_event_subscription_add_info_convertToJSON() failed [nf_consumer_info]"); + goto end; + } + } + } + + if (amf_event_subscription_add_info->aoi_state_list) { + cJSON *aoi_state_list = cJSON_AddObjectToObject(item, "aoiStateList"); + if (aoi_state_list == NULL) { + ogs_error("OpenAPI_amf_event_subscription_add_info_convertToJSON() failed [aoi_state_list]"); + goto end; + } + cJSON *localMapObject = aoi_state_list; + if (amf_event_subscription_add_info->aoi_state_list) { + OpenAPI_list_for_each(amf_event_subscription_add_info->aoi_state_list, node) { + OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*)node->data; + cJSON *itemLocal = localKeyValue->value ? + OpenAPI_area_of_interest_event_state_convertToJSON(localKeyValue->value) : + cJSON_CreateNull(); + if (itemLocal == NULL) { + ogs_error("OpenAPI_amf_event_subscription_add_info_convertToJSON() failed [inner]"); + goto end; + } + cJSON_AddItemToObject(localMapObject, localKeyValue->key, itemLocal); + } + } + } + end: return item; } @@ -79,6 +147,11 @@ OpenAPI_amf_event_subscription_add_info_t *OpenAPI_amf_event_subscription_add_in OpenAPI_list_t *binding_infoList = NULL; cJSON *subscribing_nf_type = NULL; OpenAPI_nf_type_e subscribing_nf_typeVariable = 0; + cJSON *event_sync_ind = NULL; + cJSON *nf_consumer_info = NULL; + OpenAPI_list_t *nf_consumer_infoList = NULL; + cJSON *aoi_state_list = NULL; + OpenAPI_list_t *aoi_state_listList = NULL; binding_info = cJSON_GetObjectItemCaseSensitive(amf_event_subscription_add_infoJSON, "bindingInfo"); if (binding_info) { cJSON *binding_info_local = NULL; @@ -109,9 +182,68 @@ OpenAPI_amf_event_subscription_add_info_t *OpenAPI_amf_event_subscription_add_in subscribing_nf_typeVariable = OpenAPI_nf_type_FromString(subscribing_nf_type->valuestring); } + event_sync_ind = cJSON_GetObjectItemCaseSensitive(amf_event_subscription_add_infoJSON, "eventSyncInd"); + if (event_sync_ind) { + if (!cJSON_IsBool(event_sync_ind)) { + ogs_error("OpenAPI_amf_event_subscription_add_info_parseFromJSON() failed [event_sync_ind]"); + goto end; + } + } + + nf_consumer_info = cJSON_GetObjectItemCaseSensitive(amf_event_subscription_add_infoJSON, "nfConsumerInfo"); + if (nf_consumer_info) { + cJSON *nf_consumer_info_local = NULL; + if (!cJSON_IsArray(nf_consumer_info)) { + ogs_error("OpenAPI_amf_event_subscription_add_info_parseFromJSON() failed [nf_consumer_info]"); + goto end; + } + + nf_consumer_infoList = OpenAPI_list_create(); + + cJSON_ArrayForEach(nf_consumer_info_local, nf_consumer_info) { + double *localDouble = NULL; + int *localInt = NULL; + if (!cJSON_IsString(nf_consumer_info_local)) { + ogs_error("OpenAPI_amf_event_subscription_add_info_parseFromJSON() failed [nf_consumer_info]"); + goto end; + } + OpenAPI_list_add(nf_consumer_infoList, ogs_strdup(nf_consumer_info_local->valuestring)); + } + } + + aoi_state_list = cJSON_GetObjectItemCaseSensitive(amf_event_subscription_add_infoJSON, "aoiStateList"); + if (aoi_state_list) { + cJSON *aoi_state_list_local_map = NULL; + if (!cJSON_IsObject(aoi_state_list) && !cJSON_IsNull(aoi_state_list)) { + ogs_error("OpenAPI_amf_event_subscription_add_info_parseFromJSON() failed [aoi_state_list]"); + goto end; + } + if (cJSON_IsObject(aoi_state_list)) { + aoi_state_listList = OpenAPI_list_create(); + OpenAPI_map_t *localMapKeyPair = NULL; + cJSON_ArrayForEach(aoi_state_list_local_map, aoi_state_list) { + cJSON *localMapObject = aoi_state_list_local_map; + if (cJSON_IsObject(localMapObject)) { + localMapKeyPair = OpenAPI_map_create( + ogs_strdup(localMapObject->string), OpenAPI_area_of_interest_event_state_parseFromJSON(localMapObject)); + } else if (cJSON_IsNull(localMapObject)) { + localMapKeyPair = OpenAPI_map_create(ogs_strdup(localMapObject->string), NULL); + } else { + ogs_error("OpenAPI_amf_event_subscription_add_info_parseFromJSON() failed [inner]"); + goto end; + } + OpenAPI_list_add(aoi_state_listList, localMapKeyPair); + } + } + } + amf_event_subscription_add_info_local_var = OpenAPI_amf_event_subscription_add_info_create ( binding_info ? binding_infoList : NULL, - subscribing_nf_type ? subscribing_nf_typeVariable : 0 + subscribing_nf_type ? subscribing_nf_typeVariable : 0, + event_sync_ind ? true : false, + event_sync_ind ? event_sync_ind->valueint : 0, + nf_consumer_info ? nf_consumer_infoList : NULL, + aoi_state_list ? aoi_state_listList : NULL ); return amf_event_subscription_add_info_local_var; @@ -123,6 +255,23 @@ end: OpenAPI_list_free(binding_infoList); binding_infoList = NULL; } + if (nf_consumer_infoList) { + OpenAPI_list_for_each(nf_consumer_infoList, node) { + ogs_free(node->data); + } + OpenAPI_list_free(nf_consumer_infoList); + nf_consumer_infoList = NULL; + } + if (aoi_state_listList) { + OpenAPI_list_for_each(aoi_state_listList, node) { + OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*) node->data; + ogs_free(localKeyValue->key); + OpenAPI_area_of_interest_event_state_free(localKeyValue->value); + OpenAPI_map_free(localKeyValue); + } + OpenAPI_list_free(aoi_state_listList); + aoi_state_listList = NULL; + } return NULL; } diff --git a/lib/sbi/openapi/model/amf_event_subscription_add_info.h b/lib/sbi/openapi/model/amf_event_subscription_add_info.h index 93751988d..dc39d784b 100644 --- a/lib/sbi/openapi/model/amf_event_subscription_add_info.h +++ b/lib/sbi/openapi/model/amf_event_subscription_add_info.h @@ -1,7 +1,7 @@ /* * amf_event_subscription_add_info.h * - * + * Additional information received for an AMF event subscription, e.g. binding indications */ #ifndef _OpenAPI_amf_event_subscription_add_info_H_ @@ -12,6 +12,7 @@ #include "../include/list.h" #include "../include/keyValuePair.h" #include "../include/binary.h" +#include "area_of_interest_event_state.h" #include "nf_type.h" #ifdef __cplusplus @@ -22,11 +23,19 @@ typedef struct OpenAPI_amf_event_subscription_add_info_s OpenAPI_amf_event_subsc typedef struct OpenAPI_amf_event_subscription_add_info_s { OpenAPI_list_t *binding_info; OpenAPI_nf_type_e subscribing_nf_type; + bool is_event_sync_ind; + int event_sync_ind; + OpenAPI_list_t *nf_consumer_info; + OpenAPI_list_t* aoi_state_list; } OpenAPI_amf_event_subscription_add_info_t; OpenAPI_amf_event_subscription_add_info_t *OpenAPI_amf_event_subscription_add_info_create( OpenAPI_list_t *binding_info, - OpenAPI_nf_type_e subscribing_nf_type + OpenAPI_nf_type_e subscribing_nf_type, + bool is_event_sync_ind, + int event_sync_ind, + OpenAPI_list_t *nf_consumer_info, + OpenAPI_list_t* aoi_state_list ); void OpenAPI_amf_event_subscription_add_info_free(OpenAPI_amf_event_subscription_add_info_t *amf_event_subscription_add_info); OpenAPI_amf_event_subscription_add_info_t *OpenAPI_amf_event_subscription_add_info_parseFromJSON(cJSON *amf_event_subscription_add_infoJSON); diff --git a/lib/sbi/openapi/model/amf_event_trigger.h b/lib/sbi/openapi/model/amf_event_trigger.h index e10740dc7..949d8352b 100644 --- a/lib/sbi/openapi/model/amf_event_trigger.h +++ b/lib/sbi/openapi/model/amf_event_trigger.h @@ -1,7 +1,7 @@ /* * amf_event_trigger.h * - * + * Describes how AMF should generate the report for the event */ #ifndef _OpenAPI_amf_event_trigger_H_ diff --git a/lib/sbi/openapi/model/amf_event_type.h b/lib/sbi/openapi/model/amf_event_type.h index 8f07c148d..a85d351ed 100644 --- a/lib/sbi/openapi/model/amf_event_type.h +++ b/lib/sbi/openapi/model/amf_event_type.h @@ -1,7 +1,7 @@ /* * amf_event_type.h * - * + * Describes the supported event types of Namf_EventExposure Service */ #ifndef _OpenAPI_amf_event_type_H_ diff --git a/lib/sbi/openapi/model/amf_event_type_any_of.c b/lib/sbi/openapi/model/amf_event_type_any_of.c index d93e9fe8d..7a97cdd07 100644 --- a/lib/sbi/openapi/model/amf_event_type_any_of.c +++ b/lib/sbi/openapi/model/amf_event_type_any_of.c @@ -6,7 +6,7 @@ char* OpenAPI_amf_event_type_any_of_ToString(OpenAPI_amf_event_type_any_of_e amf_event_type_any_of) { - const char *amf_event_type_any_ofArray[] = { "NULL", "LOCATION_REPORT", "PRESENCE_IN_AOI_REPORT", "TIMEZONE_REPORT", "ACCESS_TYPE_REPORT", "REGISTRATION_STATE_REPORT", "CONNECTIVITY_STATE_REPORT", "REACHABILITY_REPORT", "COMMUNICATION_FAILURE_REPORT", "UES_IN_AREA_REPORT", "SUBSCRIPTION_ID_CHANGE", "SUBSCRIPTION_ID_ADDITION", "LOSS_OF_CONNECTIVITY", "5GS_USER_STATE_REPORT", "AVAILABILITY_AFTER_DDN_FAILURE", "TYPE_ALLOCATION_CODE_REPORT", "FREQUENT_MOBILITY_REGISTRATION_REPORT" }; + const char *amf_event_type_any_ofArray[] = { "NULL", "LOCATION_REPORT", "PRESENCE_IN_AOI_REPORT", "TIMEZONE_REPORT", "ACCESS_TYPE_REPORT", "REGISTRATION_STATE_REPORT", "CONNECTIVITY_STATE_REPORT", "REACHABILITY_REPORT", "COMMUNICATION_FAILURE_REPORT", "UES_IN_AREA_REPORT", "SUBSCRIPTION_ID_CHANGE", "SUBSCRIPTION_ID_ADDITION", "LOSS_OF_CONNECTIVITY", "5GS_USER_STATE_REPORT", "AVAILABILITY_AFTER_DDN_FAILURE", "TYPE_ALLOCATION_CODE_REPORT", "FREQUENT_MOBILITY_REGISTRATION_REPORT", "SNSSAI_TA_MAPPING_REPORT", "UE_LOCATION_TRENDS", "UE_ACCESS_BEHAVIOR_TRENDS", "UE_MM_TRANSACTION_REPORT" }; size_t sizeofArray = sizeof(amf_event_type_any_ofArray) / sizeof(amf_event_type_any_ofArray[0]); if (amf_event_type_any_of < sizeofArray) return (char *)amf_event_type_any_ofArray[amf_event_type_any_of]; @@ -17,7 +17,7 @@ char* OpenAPI_amf_event_type_any_of_ToString(OpenAPI_amf_event_type_any_of_e amf OpenAPI_amf_event_type_any_of_e OpenAPI_amf_event_type_any_of_FromString(char* amf_event_type_any_of) { int stringToReturn = 0; - const char *amf_event_type_any_ofArray[] = { "NULL", "LOCATION_REPORT", "PRESENCE_IN_AOI_REPORT", "TIMEZONE_REPORT", "ACCESS_TYPE_REPORT", "REGISTRATION_STATE_REPORT", "CONNECTIVITY_STATE_REPORT", "REACHABILITY_REPORT", "COMMUNICATION_FAILURE_REPORT", "UES_IN_AREA_REPORT", "SUBSCRIPTION_ID_CHANGE", "SUBSCRIPTION_ID_ADDITION", "LOSS_OF_CONNECTIVITY", "5GS_USER_STATE_REPORT", "AVAILABILITY_AFTER_DDN_FAILURE", "TYPE_ALLOCATION_CODE_REPORT", "FREQUENT_MOBILITY_REGISTRATION_REPORT" }; + const char *amf_event_type_any_ofArray[] = { "NULL", "LOCATION_REPORT", "PRESENCE_IN_AOI_REPORT", "TIMEZONE_REPORT", "ACCESS_TYPE_REPORT", "REGISTRATION_STATE_REPORT", "CONNECTIVITY_STATE_REPORT", "REACHABILITY_REPORT", "COMMUNICATION_FAILURE_REPORT", "UES_IN_AREA_REPORT", "SUBSCRIPTION_ID_CHANGE", "SUBSCRIPTION_ID_ADDITION", "LOSS_OF_CONNECTIVITY", "5GS_USER_STATE_REPORT", "AVAILABILITY_AFTER_DDN_FAILURE", "TYPE_ALLOCATION_CODE_REPORT", "FREQUENT_MOBILITY_REGISTRATION_REPORT", "SNSSAI_TA_MAPPING_REPORT", "UE_LOCATION_TRENDS", "UE_ACCESS_BEHAVIOR_TRENDS", "UE_MM_TRANSACTION_REPORT" }; size_t sizeofArray = sizeof(amf_event_type_any_ofArray) / sizeof(amf_event_type_any_ofArray[0]); while (stringToReturn < sizeofArray) { if (strcmp(amf_event_type_any_of, amf_event_type_any_ofArray[stringToReturn]) == 0) { diff --git a/lib/sbi/openapi/model/amf_event_type_any_of.h b/lib/sbi/openapi/model/amf_event_type_any_of.h index e3942cb6b..42d74cb2a 100644 --- a/lib/sbi/openapi/model/amf_event_type_any_of.h +++ b/lib/sbi/openapi/model/amf_event_type_any_of.h @@ -17,7 +17,7 @@ extern "C" { #endif -typedef enum { OpenAPI_amf_event_type_any_of_NULL = 0, OpenAPI_amf_event_type_any_of_LOCATION_REPORT, OpenAPI_amf_event_type_any_of_PRESENCE_IN_AOI_REPORT, OpenAPI_amf_event_type_any_of_TIMEZONE_REPORT, OpenAPI_amf_event_type_any_of_ACCESS_TYPE_REPORT, OpenAPI_amf_event_type_any_of_REGISTRATION_STATE_REPORT, OpenAPI_amf_event_type_any_of_CONNECTIVITY_STATE_REPORT, OpenAPI_amf_event_type_any_of_REACHABILITY_REPORT, OpenAPI_amf_event_type_any_of_COMMUNICATION_FAILURE_REPORT, OpenAPI_amf_event_type_any_of_UES_IN_AREA_REPORT, OpenAPI_amf_event_type_any_of_SUBSCRIPTION_ID_CHANGE, OpenAPI_amf_event_type_any_of_SUBSCRIPTION_ID_ADDITION, OpenAPI_amf_event_type_any_of_LOSS_OF_CONNECTIVITY, OpenAPI_amf_event_type_any_of__5GS_USER_STATE_REPORT, OpenAPI_amf_event_type_any_of_AVAILABILITY_AFTER_DDN_FAILURE, OpenAPI_amf_event_type_any_of_TYPE_ALLOCATION_CODE_REPORT, OpenAPI_amf_event_type_any_of_FREQUENT_MOBILITY_REGISTRATION_REPORT } OpenAPI_amf_event_type_any_of_e; +typedef enum { OpenAPI_amf_event_type_any_of_NULL = 0, OpenAPI_amf_event_type_any_of_LOCATION_REPORT, OpenAPI_amf_event_type_any_of_PRESENCE_IN_AOI_REPORT, OpenAPI_amf_event_type_any_of_TIMEZONE_REPORT, OpenAPI_amf_event_type_any_of_ACCESS_TYPE_REPORT, OpenAPI_amf_event_type_any_of_REGISTRATION_STATE_REPORT, OpenAPI_amf_event_type_any_of_CONNECTIVITY_STATE_REPORT, OpenAPI_amf_event_type_any_of_REACHABILITY_REPORT, OpenAPI_amf_event_type_any_of_COMMUNICATION_FAILURE_REPORT, OpenAPI_amf_event_type_any_of_UES_IN_AREA_REPORT, OpenAPI_amf_event_type_any_of_SUBSCRIPTION_ID_CHANGE, OpenAPI_amf_event_type_any_of_SUBSCRIPTION_ID_ADDITION, OpenAPI_amf_event_type_any_of_LOSS_OF_CONNECTIVITY, OpenAPI_amf_event_type_any_of__5GS_USER_STATE_REPORT, OpenAPI_amf_event_type_any_of_AVAILABILITY_AFTER_DDN_FAILURE, OpenAPI_amf_event_type_any_of_TYPE_ALLOCATION_CODE_REPORT, OpenAPI_amf_event_type_any_of_FREQUENT_MOBILITY_REGISTRATION_REPORT, OpenAPI_amf_event_type_any_of_SNSSAI_TA_MAPPING_REPORT, OpenAPI_amf_event_type_any_of_UE_LOCATION_TRENDS, OpenAPI_amf_event_type_any_of_UE_ACCESS_BEHAVIOR_TRENDS, OpenAPI_amf_event_type_any_of_UE_MM_TRANSACTION_REPORT } OpenAPI_amf_event_type_any_of_e; char* OpenAPI_amf_event_type_any_of_ToString(OpenAPI_amf_event_type_any_of_e amf_event_type_any_of); diff --git a/lib/sbi/openapi/model/amf_info.c b/lib/sbi/openapi/model/amf_info.c index bccf38c3b..f28965518 100644 --- a/lib/sbi/openapi/model/amf_info.c +++ b/lib/sbi/openapi/model/amf_info.c @@ -12,7 +12,9 @@ OpenAPI_amf_info_t *OpenAPI_amf_info_create( OpenAPI_list_t *tai_range_list, OpenAPI_list_t *backup_info_amf_failure, OpenAPI_list_t *backup_info_amf_removal, - OpenAPI_n2_interface_amf_info_t *n2_interface_amf_info + OpenAPI_n2_interface_amf_info_t *n2_interface_amf_info, + bool is_amf_onboarding_capability, + int amf_onboarding_capability ) { OpenAPI_amf_info_t *amf_info_local_var = ogs_malloc(sizeof(OpenAPI_amf_info_t)); @@ -26,6 +28,8 @@ OpenAPI_amf_info_t *OpenAPI_amf_info_create( amf_info_local_var->backup_info_amf_failure = backup_info_amf_failure; amf_info_local_var->backup_info_amf_removal = backup_info_amf_removal; amf_info_local_var->n2_interface_amf_info = n2_interface_amf_info; + amf_info_local_var->is_amf_onboarding_capability = is_amf_onboarding_capability; + amf_info_local_var->amf_onboarding_capability = amf_onboarding_capability; return amf_info_local_var; } @@ -211,6 +215,13 @@ cJSON *OpenAPI_amf_info_convertToJSON(OpenAPI_amf_info_t *amf_info) } } + if (amf_info->is_amf_onboarding_capability) { + if (cJSON_AddBoolToObject(item, "amfOnboardingCapability", amf_info->amf_onboarding_capability) == NULL) { + ogs_error("OpenAPI_amf_info_convertToJSON() failed [amf_onboarding_capability]"); + goto end; + } + } + end: return item; } @@ -233,6 +244,7 @@ OpenAPI_amf_info_t *OpenAPI_amf_info_parseFromJSON(cJSON *amf_infoJSON) OpenAPI_list_t *backup_info_amf_removalList = NULL; cJSON *n2_interface_amf_info = NULL; OpenAPI_n2_interface_amf_info_t *n2_interface_amf_info_local_nonprim = NULL; + cJSON *amf_onboarding_capability = NULL; amf_set_id = cJSON_GetObjectItemCaseSensitive(amf_infoJSON, "amfSetId"); if (!amf_set_id) { ogs_error("OpenAPI_amf_info_parseFromJSON() failed [amf_set_id]"); @@ -385,6 +397,14 @@ OpenAPI_amf_info_t *OpenAPI_amf_info_parseFromJSON(cJSON *amf_infoJSON) n2_interface_amf_info_local_nonprim = OpenAPI_n2_interface_amf_info_parseFromJSON(n2_interface_amf_info); } + amf_onboarding_capability = cJSON_GetObjectItemCaseSensitive(amf_infoJSON, "amfOnboardingCapability"); + if (amf_onboarding_capability) { + if (!cJSON_IsBool(amf_onboarding_capability)) { + ogs_error("OpenAPI_amf_info_parseFromJSON() failed [amf_onboarding_capability]"); + goto end; + } + } + amf_info_local_var = OpenAPI_amf_info_create ( ogs_strdup(amf_set_id->valuestring), ogs_strdup(amf_region_id->valuestring), @@ -393,7 +413,9 @@ OpenAPI_amf_info_t *OpenAPI_amf_info_parseFromJSON(cJSON *amf_infoJSON) tai_range_list ? tai_range_listList : NULL, backup_info_amf_failure ? backup_info_amf_failureList : NULL, backup_info_amf_removal ? backup_info_amf_removalList : NULL, - n2_interface_amf_info ? n2_interface_amf_info_local_nonprim : NULL + n2_interface_amf_info ? n2_interface_amf_info_local_nonprim : NULL, + amf_onboarding_capability ? true : false, + amf_onboarding_capability ? amf_onboarding_capability->valueint : 0 ); return amf_info_local_var; diff --git a/lib/sbi/openapi/model/amf_info.h b/lib/sbi/openapi/model/amf_info.h index aa7800839..be23c0314 100644 --- a/lib/sbi/openapi/model/amf_info.h +++ b/lib/sbi/openapi/model/amf_info.h @@ -31,6 +31,8 @@ typedef struct OpenAPI_amf_info_s { OpenAPI_list_t *backup_info_amf_failure; OpenAPI_list_t *backup_info_amf_removal; struct OpenAPI_n2_interface_amf_info_s *n2_interface_amf_info; + bool is_amf_onboarding_capability; + int amf_onboarding_capability; } OpenAPI_amf_info_t; OpenAPI_amf_info_t *OpenAPI_amf_info_create( @@ -41,7 +43,9 @@ OpenAPI_amf_info_t *OpenAPI_amf_info_create( OpenAPI_list_t *tai_range_list, OpenAPI_list_t *backup_info_amf_failure, OpenAPI_list_t *backup_info_amf_removal, - OpenAPI_n2_interface_amf_info_t *n2_interface_amf_info + OpenAPI_n2_interface_amf_info_t *n2_interface_amf_info, + bool is_amf_onboarding_capability, + int amf_onboarding_capability ); void OpenAPI_amf_info_free(OpenAPI_amf_info_t *amf_info); OpenAPI_amf_info_t *OpenAPI_amf_info_parseFromJSON(cJSON *amf_infoJSON); diff --git a/lib/sbi/openapi/model/amf_non3_gpp_access_registration.c b/lib/sbi/openapi/model/amf_non3_gpp_access_registration.c index 25c2c0d23..bec8c4089 100644 --- a/lib/sbi/openapi/model/amf_non3_gpp_access_registration.c +++ b/lib/sbi/openapi/model/amf_non3_gpp_access_registration.c @@ -26,7 +26,20 @@ OpenAPI_amf_non3_gpp_access_registration_t *OpenAPI_amf_non3_gpp_access_registra OpenAPI_context_info_t *context_info, bool is_no_ee_subscription_ind, int no_ee_subscription_ind, - char *supi + char *supi, + bool is_re_registration_required, + int re_registration_required, + bool is_admin_dereg_sub_withdrawn, + int admin_dereg_sub_withdrawn, + char *data_restoration_callback_uri, + OpenAPI_list_t *reset_ids, + bool is_disaster_roaming_ind, + int disaster_roaming_ind, + bool is_sor_snpn_si_supported, + int sor_snpn_si_supported, + bool is_udr_restart_ind, + int udr_restart_ind, + char *last_synchronization_time ) { OpenAPI_amf_non3_gpp_access_registration_t *amf_non3_gpp_access_registration_local_var = ogs_malloc(sizeof(OpenAPI_amf_non3_gpp_access_registration_t)); @@ -54,6 +67,19 @@ OpenAPI_amf_non3_gpp_access_registration_t *OpenAPI_amf_non3_gpp_access_registra amf_non3_gpp_access_registration_local_var->is_no_ee_subscription_ind = is_no_ee_subscription_ind; amf_non3_gpp_access_registration_local_var->no_ee_subscription_ind = no_ee_subscription_ind; amf_non3_gpp_access_registration_local_var->supi = supi; + amf_non3_gpp_access_registration_local_var->is_re_registration_required = is_re_registration_required; + amf_non3_gpp_access_registration_local_var->re_registration_required = re_registration_required; + amf_non3_gpp_access_registration_local_var->is_admin_dereg_sub_withdrawn = is_admin_dereg_sub_withdrawn; + amf_non3_gpp_access_registration_local_var->admin_dereg_sub_withdrawn = admin_dereg_sub_withdrawn; + amf_non3_gpp_access_registration_local_var->data_restoration_callback_uri = data_restoration_callback_uri; + amf_non3_gpp_access_registration_local_var->reset_ids = reset_ids; + amf_non3_gpp_access_registration_local_var->is_disaster_roaming_ind = is_disaster_roaming_ind; + amf_non3_gpp_access_registration_local_var->disaster_roaming_ind = disaster_roaming_ind; + amf_non3_gpp_access_registration_local_var->is_sor_snpn_si_supported = is_sor_snpn_si_supported; + amf_non3_gpp_access_registration_local_var->sor_snpn_si_supported = sor_snpn_si_supported; + amf_non3_gpp_access_registration_local_var->is_udr_restart_ind = is_udr_restart_ind; + amf_non3_gpp_access_registration_local_var->udr_restart_ind = udr_restart_ind; + amf_non3_gpp_access_registration_local_var->last_synchronization_time = last_synchronization_time; return amf_non3_gpp_access_registration_local_var; } @@ -124,6 +150,21 @@ void OpenAPI_amf_non3_gpp_access_registration_free(OpenAPI_amf_non3_gpp_access_r ogs_free(amf_non3_gpp_access_registration->supi); amf_non3_gpp_access_registration->supi = NULL; } + if (amf_non3_gpp_access_registration->data_restoration_callback_uri) { + ogs_free(amf_non3_gpp_access_registration->data_restoration_callback_uri); + amf_non3_gpp_access_registration->data_restoration_callback_uri = NULL; + } + if (amf_non3_gpp_access_registration->reset_ids) { + OpenAPI_list_for_each(amf_non3_gpp_access_registration->reset_ids, node) { + ogs_free(node->data); + } + OpenAPI_list_free(amf_non3_gpp_access_registration->reset_ids); + amf_non3_gpp_access_registration->reset_ids = NULL; + } + if (amf_non3_gpp_access_registration->last_synchronization_time) { + ogs_free(amf_non3_gpp_access_registration->last_synchronization_time); + amf_non3_gpp_access_registration->last_synchronization_time = NULL; + } ogs_free(amf_non3_gpp_access_registration); } @@ -308,6 +349,69 @@ cJSON *OpenAPI_amf_non3_gpp_access_registration_convertToJSON(OpenAPI_amf_non3_g } } + if (amf_non3_gpp_access_registration->is_re_registration_required) { + if (cJSON_AddBoolToObject(item, "reRegistrationRequired", amf_non3_gpp_access_registration->re_registration_required) == NULL) { + ogs_error("OpenAPI_amf_non3_gpp_access_registration_convertToJSON() failed [re_registration_required]"); + goto end; + } + } + + if (amf_non3_gpp_access_registration->is_admin_dereg_sub_withdrawn) { + if (cJSON_AddBoolToObject(item, "adminDeregSubWithdrawn", amf_non3_gpp_access_registration->admin_dereg_sub_withdrawn) == NULL) { + ogs_error("OpenAPI_amf_non3_gpp_access_registration_convertToJSON() failed [admin_dereg_sub_withdrawn]"); + goto end; + } + } + + if (amf_non3_gpp_access_registration->data_restoration_callback_uri) { + if (cJSON_AddStringToObject(item, "dataRestorationCallbackUri", amf_non3_gpp_access_registration->data_restoration_callback_uri) == NULL) { + ogs_error("OpenAPI_amf_non3_gpp_access_registration_convertToJSON() failed [data_restoration_callback_uri]"); + goto end; + } + } + + if (amf_non3_gpp_access_registration->reset_ids) { + cJSON *reset_idsList = cJSON_AddArrayToObject(item, "resetIds"); + if (reset_idsList == NULL) { + ogs_error("OpenAPI_amf_non3_gpp_access_registration_convertToJSON() failed [reset_ids]"); + goto end; + } + OpenAPI_list_for_each(amf_non3_gpp_access_registration->reset_ids, node) { + if (cJSON_AddStringToObject(reset_idsList, "", (char*)node->data) == NULL) { + ogs_error("OpenAPI_amf_non3_gpp_access_registration_convertToJSON() failed [reset_ids]"); + goto end; + } + } + } + + if (amf_non3_gpp_access_registration->is_disaster_roaming_ind) { + if (cJSON_AddBoolToObject(item, "disasterRoamingInd", amf_non3_gpp_access_registration->disaster_roaming_ind) == NULL) { + ogs_error("OpenAPI_amf_non3_gpp_access_registration_convertToJSON() failed [disaster_roaming_ind]"); + goto end; + } + } + + if (amf_non3_gpp_access_registration->is_sor_snpn_si_supported) { + if (cJSON_AddBoolToObject(item, "sorSnpnSiSupported", amf_non3_gpp_access_registration->sor_snpn_si_supported) == NULL) { + ogs_error("OpenAPI_amf_non3_gpp_access_registration_convertToJSON() failed [sor_snpn_si_supported]"); + goto end; + } + } + + if (amf_non3_gpp_access_registration->is_udr_restart_ind) { + if (cJSON_AddBoolToObject(item, "udrRestartInd", amf_non3_gpp_access_registration->udr_restart_ind) == NULL) { + ogs_error("OpenAPI_amf_non3_gpp_access_registration_convertToJSON() failed [udr_restart_ind]"); + goto end; + } + } + + if (amf_non3_gpp_access_registration->last_synchronization_time) { + if (cJSON_AddStringToObject(item, "lastSynchronizationTime", amf_non3_gpp_access_registration->last_synchronization_time) == NULL) { + ogs_error("OpenAPI_amf_non3_gpp_access_registration_convertToJSON() failed [last_synchronization_time]"); + goto end; + } + } + end: return item; } @@ -341,6 +445,15 @@ OpenAPI_amf_non3_gpp_access_registration_t *OpenAPI_amf_non3_gpp_access_registra OpenAPI_context_info_t *context_info_local_nonprim = NULL; cJSON *no_ee_subscription_ind = NULL; cJSON *supi = NULL; + cJSON *re_registration_required = NULL; + cJSON *admin_dereg_sub_withdrawn = NULL; + cJSON *data_restoration_callback_uri = NULL; + cJSON *reset_ids = NULL; + OpenAPI_list_t *reset_idsList = NULL; + cJSON *disaster_roaming_ind = NULL; + cJSON *sor_snpn_si_supported = NULL; + cJSON *udr_restart_ind = NULL; + cJSON *last_synchronization_time = NULL; amf_instance_id = cJSON_GetObjectItemCaseSensitive(amf_non3_gpp_access_registrationJSON, "amfInstanceId"); if (!amf_instance_id) { ogs_error("OpenAPI_amf_non3_gpp_access_registration_parseFromJSON() failed [amf_instance_id]"); @@ -513,6 +626,83 @@ OpenAPI_amf_non3_gpp_access_registration_t *OpenAPI_amf_non3_gpp_access_registra } } + re_registration_required = cJSON_GetObjectItemCaseSensitive(amf_non3_gpp_access_registrationJSON, "reRegistrationRequired"); + if (re_registration_required) { + if (!cJSON_IsBool(re_registration_required)) { + ogs_error("OpenAPI_amf_non3_gpp_access_registration_parseFromJSON() failed [re_registration_required]"); + goto end; + } + } + + admin_dereg_sub_withdrawn = cJSON_GetObjectItemCaseSensitive(amf_non3_gpp_access_registrationJSON, "adminDeregSubWithdrawn"); + if (admin_dereg_sub_withdrawn) { + if (!cJSON_IsBool(admin_dereg_sub_withdrawn)) { + ogs_error("OpenAPI_amf_non3_gpp_access_registration_parseFromJSON() failed [admin_dereg_sub_withdrawn]"); + goto end; + } + } + + data_restoration_callback_uri = cJSON_GetObjectItemCaseSensitive(amf_non3_gpp_access_registrationJSON, "dataRestorationCallbackUri"); + if (data_restoration_callback_uri) { + if (!cJSON_IsString(data_restoration_callback_uri) && !cJSON_IsNull(data_restoration_callback_uri)) { + ogs_error("OpenAPI_amf_non3_gpp_access_registration_parseFromJSON() failed [data_restoration_callback_uri]"); + goto end; + } + } + + reset_ids = cJSON_GetObjectItemCaseSensitive(amf_non3_gpp_access_registrationJSON, "resetIds"); + if (reset_ids) { + cJSON *reset_ids_local = NULL; + if (!cJSON_IsArray(reset_ids)) { + ogs_error("OpenAPI_amf_non3_gpp_access_registration_parseFromJSON() failed [reset_ids]"); + goto end; + } + + reset_idsList = OpenAPI_list_create(); + + cJSON_ArrayForEach(reset_ids_local, reset_ids) { + double *localDouble = NULL; + int *localInt = NULL; + if (!cJSON_IsString(reset_ids_local)) { + ogs_error("OpenAPI_amf_non3_gpp_access_registration_parseFromJSON() failed [reset_ids]"); + goto end; + } + OpenAPI_list_add(reset_idsList, ogs_strdup(reset_ids_local->valuestring)); + } + } + + disaster_roaming_ind = cJSON_GetObjectItemCaseSensitive(amf_non3_gpp_access_registrationJSON, "disasterRoamingInd"); + if (disaster_roaming_ind) { + if (!cJSON_IsBool(disaster_roaming_ind)) { + ogs_error("OpenAPI_amf_non3_gpp_access_registration_parseFromJSON() failed [disaster_roaming_ind]"); + goto end; + } + } + + sor_snpn_si_supported = cJSON_GetObjectItemCaseSensitive(amf_non3_gpp_access_registrationJSON, "sorSnpnSiSupported"); + if (sor_snpn_si_supported) { + if (!cJSON_IsBool(sor_snpn_si_supported)) { + ogs_error("OpenAPI_amf_non3_gpp_access_registration_parseFromJSON() failed [sor_snpn_si_supported]"); + goto end; + } + } + + udr_restart_ind = cJSON_GetObjectItemCaseSensitive(amf_non3_gpp_access_registrationJSON, "udrRestartInd"); + if (udr_restart_ind) { + if (!cJSON_IsBool(udr_restart_ind)) { + ogs_error("OpenAPI_amf_non3_gpp_access_registration_parseFromJSON() failed [udr_restart_ind]"); + goto end; + } + } + + last_synchronization_time = cJSON_GetObjectItemCaseSensitive(amf_non3_gpp_access_registrationJSON, "lastSynchronizationTime"); + if (last_synchronization_time) { + if (!cJSON_IsString(last_synchronization_time) && !cJSON_IsNull(last_synchronization_time)) { + ogs_error("OpenAPI_amf_non3_gpp_access_registration_parseFromJSON() failed [last_synchronization_time]"); + goto end; + } + } + amf_non3_gpp_access_registration_local_var = OpenAPI_amf_non3_gpp_access_registration_create ( ogs_strdup(amf_instance_id->valuestring), supported_features && !cJSON_IsNull(supported_features) ? ogs_strdup(supported_features->valuestring) : NULL, @@ -535,7 +725,20 @@ OpenAPI_amf_non3_gpp_access_registration_t *OpenAPI_amf_non3_gpp_access_registra context_info ? context_info_local_nonprim : NULL, no_ee_subscription_ind ? true : false, no_ee_subscription_ind ? no_ee_subscription_ind->valueint : 0, - supi && !cJSON_IsNull(supi) ? ogs_strdup(supi->valuestring) : NULL + supi && !cJSON_IsNull(supi) ? ogs_strdup(supi->valuestring) : NULL, + re_registration_required ? true : false, + re_registration_required ? re_registration_required->valueint : 0, + admin_dereg_sub_withdrawn ? true : false, + admin_dereg_sub_withdrawn ? admin_dereg_sub_withdrawn->valueint : 0, + data_restoration_callback_uri && !cJSON_IsNull(data_restoration_callback_uri) ? ogs_strdup(data_restoration_callback_uri->valuestring) : NULL, + reset_ids ? reset_idsList : NULL, + disaster_roaming_ind ? true : false, + disaster_roaming_ind ? disaster_roaming_ind->valueint : 0, + sor_snpn_si_supported ? true : false, + sor_snpn_si_supported ? sor_snpn_si_supported->valueint : 0, + udr_restart_ind ? true : false, + udr_restart_ind ? udr_restart_ind->valueint : 0, + last_synchronization_time && !cJSON_IsNull(last_synchronization_time) ? ogs_strdup(last_synchronization_time->valuestring) : NULL ); return amf_non3_gpp_access_registration_local_var; @@ -559,6 +762,13 @@ end: OpenAPI_context_info_free(context_info_local_nonprim); context_info_local_nonprim = NULL; } + if (reset_idsList) { + OpenAPI_list_for_each(reset_idsList, node) { + ogs_free(node->data); + } + OpenAPI_list_free(reset_idsList); + reset_idsList = NULL; + } return NULL; } diff --git a/lib/sbi/openapi/model/amf_non3_gpp_access_registration.h b/lib/sbi/openapi/model/amf_non3_gpp_access_registration.h index 753b0fe69..f0b4bd66f 100644 --- a/lib/sbi/openapi/model/amf_non3_gpp_access_registration.h +++ b/lib/sbi/openapi/model/amf_non3_gpp_access_registration.h @@ -47,6 +47,19 @@ typedef struct OpenAPI_amf_non3_gpp_access_registration_s { bool is_no_ee_subscription_ind; int no_ee_subscription_ind; char *supi; + bool is_re_registration_required; + int re_registration_required; + bool is_admin_dereg_sub_withdrawn; + int admin_dereg_sub_withdrawn; + char *data_restoration_callback_uri; + OpenAPI_list_t *reset_ids; + bool is_disaster_roaming_ind; + int disaster_roaming_ind; + bool is_sor_snpn_si_supported; + int sor_snpn_si_supported; + bool is_udr_restart_ind; + int udr_restart_ind; + char *last_synchronization_time; } OpenAPI_amf_non3_gpp_access_registration_t; OpenAPI_amf_non3_gpp_access_registration_t *OpenAPI_amf_non3_gpp_access_registration_create( @@ -71,7 +84,20 @@ OpenAPI_amf_non3_gpp_access_registration_t *OpenAPI_amf_non3_gpp_access_registra OpenAPI_context_info_t *context_info, bool is_no_ee_subscription_ind, int no_ee_subscription_ind, - char *supi + char *supi, + bool is_re_registration_required, + int re_registration_required, + bool is_admin_dereg_sub_withdrawn, + int admin_dereg_sub_withdrawn, + char *data_restoration_callback_uri, + OpenAPI_list_t *reset_ids, + bool is_disaster_roaming_ind, + int disaster_roaming_ind, + bool is_sor_snpn_si_supported, + int sor_snpn_si_supported, + bool is_udr_restart_ind, + int udr_restart_ind, + char *last_synchronization_time ); void OpenAPI_amf_non3_gpp_access_registration_free(OpenAPI_amf_non3_gpp_access_registration_t *amf_non3_gpp_access_registration); OpenAPI_amf_non3_gpp_access_registration_t *OpenAPI_amf_non3_gpp_access_registration_parseFromJSON(cJSON *amf_non3_gpp_access_registrationJSON); diff --git a/lib/sbi/openapi/model/amf_status_change_notification.h b/lib/sbi/openapi/model/amf_status_change_notification.h index bf08e3650..f62b6e642 100644 --- a/lib/sbi/openapi/model/amf_status_change_notification.h +++ b/lib/sbi/openapi/model/amf_status_change_notification.h @@ -1,7 +1,7 @@ /* * amf_status_change_notification.h * - * + * Data within an AMF Status Change Notification request */ #ifndef _OpenAPI_amf_status_change_notification_H_ diff --git a/lib/sbi/openapi/model/amf_status_change_subscription_data.c b/lib/sbi/openapi/model/amf_status_change_subscription_data.c deleted file mode 100644 index e32fc4190..000000000 --- a/lib/sbi/openapi/model/amf_status_change_subscription_data.c +++ /dev/null @@ -1,174 +0,0 @@ - -#include -#include -#include -#include "amf_status_change_subscription_data.h" - -OpenAPI_amf_status_change_subscription_data_t *OpenAPI_amf_status_change_subscription_data_create( - char *amf_status_uri, - OpenAPI_list_t *guami_list -) -{ - OpenAPI_amf_status_change_subscription_data_t *amf_status_change_subscription_data_local_var = ogs_malloc(sizeof(OpenAPI_amf_status_change_subscription_data_t)); - ogs_assert(amf_status_change_subscription_data_local_var); - - amf_status_change_subscription_data_local_var->amf_status_uri = amf_status_uri; - amf_status_change_subscription_data_local_var->guami_list = guami_list; - - return amf_status_change_subscription_data_local_var; -} - -void OpenAPI_amf_status_change_subscription_data_free(OpenAPI_amf_status_change_subscription_data_t *amf_status_change_subscription_data) -{ - OpenAPI_lnode_t *node = NULL; - - if (NULL == amf_status_change_subscription_data) { - return; - } - if (amf_status_change_subscription_data->amf_status_uri) { - ogs_free(amf_status_change_subscription_data->amf_status_uri); - amf_status_change_subscription_data->amf_status_uri = NULL; - } - if (amf_status_change_subscription_data->guami_list) { - OpenAPI_list_for_each(amf_status_change_subscription_data->guami_list, node) { - OpenAPI_guami_free(node->data); - } - OpenAPI_list_free(amf_status_change_subscription_data->guami_list); - amf_status_change_subscription_data->guami_list = NULL; - } - ogs_free(amf_status_change_subscription_data); -} - -cJSON *OpenAPI_amf_status_change_subscription_data_convertToJSON(OpenAPI_amf_status_change_subscription_data_t *amf_status_change_subscription_data) -{ - cJSON *item = NULL; - OpenAPI_lnode_t *node = NULL; - - if (amf_status_change_subscription_data == NULL) { - ogs_error("OpenAPI_amf_status_change_subscription_data_convertToJSON() failed [AMFStatusChangeSubscriptionData]"); - return NULL; - } - - item = cJSON_CreateObject(); - if (!amf_status_change_subscription_data->amf_status_uri) { - ogs_error("OpenAPI_amf_status_change_subscription_data_convertToJSON() failed [amf_status_uri]"); - return NULL; - } - if (cJSON_AddStringToObject(item, "amfStatusUri", amf_status_change_subscription_data->amf_status_uri) == NULL) { - ogs_error("OpenAPI_amf_status_change_subscription_data_convertToJSON() failed [amf_status_uri]"); - goto end; - } - - if (amf_status_change_subscription_data->guami_list) { - cJSON *guami_listList = cJSON_AddArrayToObject(item, "guamiList"); - if (guami_listList == NULL) { - ogs_error("OpenAPI_amf_status_change_subscription_data_convertToJSON() failed [guami_list]"); - goto end; - } - OpenAPI_list_for_each(amf_status_change_subscription_data->guami_list, node) { - cJSON *itemLocal = OpenAPI_guami_convertToJSON(node->data); - if (itemLocal == NULL) { - ogs_error("OpenAPI_amf_status_change_subscription_data_convertToJSON() failed [guami_list]"); - goto end; - } - cJSON_AddItemToArray(guami_listList, itemLocal); - } - } - -end: - return item; -} - -OpenAPI_amf_status_change_subscription_data_t *OpenAPI_amf_status_change_subscription_data_parseFromJSON(cJSON *amf_status_change_subscription_dataJSON) -{ - OpenAPI_amf_status_change_subscription_data_t *amf_status_change_subscription_data_local_var = NULL; - OpenAPI_lnode_t *node = NULL; - cJSON *amf_status_uri = NULL; - cJSON *guami_list = NULL; - OpenAPI_list_t *guami_listList = NULL; - amf_status_uri = cJSON_GetObjectItemCaseSensitive(amf_status_change_subscription_dataJSON, "amfStatusUri"); - if (!amf_status_uri) { - ogs_error("OpenAPI_amf_status_change_subscription_data_parseFromJSON() failed [amf_status_uri]"); - goto end; - } - if (!cJSON_IsString(amf_status_uri)) { - ogs_error("OpenAPI_amf_status_change_subscription_data_parseFromJSON() failed [amf_status_uri]"); - goto end; - } - - guami_list = cJSON_GetObjectItemCaseSensitive(amf_status_change_subscription_dataJSON, "guamiList"); - if (guami_list) { - cJSON *guami_list_local = NULL; - if (!cJSON_IsArray(guami_list)) { - ogs_error("OpenAPI_amf_status_change_subscription_data_parseFromJSON() failed [guami_list]"); - goto end; - } - - guami_listList = OpenAPI_list_create(); - - cJSON_ArrayForEach(guami_list_local, guami_list) { - if (!cJSON_IsObject(guami_list_local)) { - ogs_error("OpenAPI_amf_status_change_subscription_data_parseFromJSON() failed [guami_list]"); - goto end; - } - OpenAPI_guami_t *guami_listItem = OpenAPI_guami_parseFromJSON(guami_list_local); - if (!guami_listItem) { - ogs_error("No guami_listItem"); - OpenAPI_list_free(guami_listList); - goto end; - } - OpenAPI_list_add(guami_listList, guami_listItem); - } - } - - amf_status_change_subscription_data_local_var = OpenAPI_amf_status_change_subscription_data_create ( - ogs_strdup(amf_status_uri->valuestring), - guami_list ? guami_listList : NULL - ); - - return amf_status_change_subscription_data_local_var; -end: - if (guami_listList) { - OpenAPI_list_for_each(guami_listList, node) { - OpenAPI_guami_free(node->data); - } - OpenAPI_list_free(guami_listList); - guami_listList = NULL; - } - return NULL; -} - -OpenAPI_amf_status_change_subscription_data_t *OpenAPI_amf_status_change_subscription_data_copy(OpenAPI_amf_status_change_subscription_data_t *dst, OpenAPI_amf_status_change_subscription_data_t *src) -{ - cJSON *item = NULL; - char *content = NULL; - - ogs_assert(src); - item = OpenAPI_amf_status_change_subscription_data_convertToJSON(src); - if (!item) { - ogs_error("OpenAPI_amf_status_change_subscription_data_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_amf_status_change_subscription_data_free(dst); - dst = OpenAPI_amf_status_change_subscription_data_parseFromJSON(item); - cJSON_Delete(item); - - return dst; -} - diff --git a/lib/sbi/openapi/model/amf_status_change_subscription_data.h b/lib/sbi/openapi/model/amf_status_change_subscription_data.h deleted file mode 100644 index de9276e01..000000000 --- a/lib/sbi/openapi/model/amf_status_change_subscription_data.h +++ /dev/null @@ -1,41 +0,0 @@ -/* - * amf_status_change_subscription_data.h - * - * - */ - -#ifndef _OpenAPI_amf_status_change_subscription_data_H_ -#define _OpenAPI_amf_status_change_subscription_data_H_ - -#include -#include "../external/cJSON.h" -#include "../include/list.h" -#include "../include/keyValuePair.h" -#include "../include/binary.h" -#include "guami.h" - -#ifdef __cplusplus -extern "C" { -#endif - -typedef struct OpenAPI_amf_status_change_subscription_data_s OpenAPI_amf_status_change_subscription_data_t; -typedef struct OpenAPI_amf_status_change_subscription_data_s { - char *amf_status_uri; - OpenAPI_list_t *guami_list; -} OpenAPI_amf_status_change_subscription_data_t; - -OpenAPI_amf_status_change_subscription_data_t *OpenAPI_amf_status_change_subscription_data_create( - char *amf_status_uri, - OpenAPI_list_t *guami_list -); -void OpenAPI_amf_status_change_subscription_data_free(OpenAPI_amf_status_change_subscription_data_t *amf_status_change_subscription_data); -OpenAPI_amf_status_change_subscription_data_t *OpenAPI_amf_status_change_subscription_data_parseFromJSON(cJSON *amf_status_change_subscription_dataJSON); -cJSON *OpenAPI_amf_status_change_subscription_data_convertToJSON(OpenAPI_amf_status_change_subscription_data_t *amf_status_change_subscription_data); -OpenAPI_amf_status_change_subscription_data_t *OpenAPI_amf_status_change_subscription_data_copy(OpenAPI_amf_status_change_subscription_data_t *dst, OpenAPI_amf_status_change_subscription_data_t *src); - -#ifdef __cplusplus -} -#endif - -#endif /* _OpenAPI_amf_status_change_subscription_data_H_ */ - diff --git a/lib/sbi/openapi/model/amf_status_info.h b/lib/sbi/openapi/model/amf_status_info.h index ee5957c49..54544b5b4 100644 --- a/lib/sbi/openapi/model/amf_status_info.h +++ b/lib/sbi/openapi/model/amf_status_info.h @@ -1,7 +1,7 @@ /* * amf_status_info.h * - * + * AMF Status Information */ #ifndef _OpenAPI_amf_status_info_H_ diff --git a/lib/sbi/openapi/model/amf_subscription_info.c b/lib/sbi/openapi/model/amf_subscription_info.c index 999d8403c..3179de8c2 100644 --- a/lib/sbi/openapi/model/amf_subscription_info.c +++ b/lib/sbi/openapi/model/amf_subscription_info.c @@ -7,7 +7,8 @@ OpenAPI_amf_subscription_info_t *OpenAPI_amf_subscription_info_create( char *amf_instance_id, char *subscription_id, - char *subs_change_notify_correlation_id + char *subs_change_notify_correlation_id, + OpenAPI_context_info_t *context_info ) { OpenAPI_amf_subscription_info_t *amf_subscription_info_local_var = ogs_malloc(sizeof(OpenAPI_amf_subscription_info_t)); @@ -16,6 +17,7 @@ OpenAPI_amf_subscription_info_t *OpenAPI_amf_subscription_info_create( amf_subscription_info_local_var->amf_instance_id = amf_instance_id; amf_subscription_info_local_var->subscription_id = subscription_id; amf_subscription_info_local_var->subs_change_notify_correlation_id = subs_change_notify_correlation_id; + amf_subscription_info_local_var->context_info = context_info; return amf_subscription_info_local_var; } @@ -39,6 +41,10 @@ void OpenAPI_amf_subscription_info_free(OpenAPI_amf_subscription_info_t *amf_sub ogs_free(amf_subscription_info->subs_change_notify_correlation_id); amf_subscription_info->subs_change_notify_correlation_id = NULL; } + if (amf_subscription_info->context_info) { + OpenAPI_context_info_free(amf_subscription_info->context_info); + amf_subscription_info->context_info = NULL; + } ogs_free(amf_subscription_info); } @@ -78,6 +84,19 @@ cJSON *OpenAPI_amf_subscription_info_convertToJSON(OpenAPI_amf_subscription_info } } + if (amf_subscription_info->context_info) { + cJSON *context_info_local_JSON = OpenAPI_context_info_convertToJSON(amf_subscription_info->context_info); + if (context_info_local_JSON == NULL) { + ogs_error("OpenAPI_amf_subscription_info_convertToJSON() failed [context_info]"); + goto end; + } + cJSON_AddItemToObject(item, "contextInfo", context_info_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_amf_subscription_info_convertToJSON() failed [context_info]"); + goto end; + } + } + end: return item; } @@ -89,6 +108,8 @@ OpenAPI_amf_subscription_info_t *OpenAPI_amf_subscription_info_parseFromJSON(cJS cJSON *amf_instance_id = NULL; cJSON *subscription_id = NULL; cJSON *subs_change_notify_correlation_id = NULL; + cJSON *context_info = NULL; + OpenAPI_context_info_t *context_info_local_nonprim = NULL; amf_instance_id = cJSON_GetObjectItemCaseSensitive(amf_subscription_infoJSON, "amfInstanceId"); if (!amf_instance_id) { ogs_error("OpenAPI_amf_subscription_info_parseFromJSON() failed [amf_instance_id]"); @@ -117,14 +138,24 @@ OpenAPI_amf_subscription_info_t *OpenAPI_amf_subscription_info_parseFromJSON(cJS } } + context_info = cJSON_GetObjectItemCaseSensitive(amf_subscription_infoJSON, "contextInfo"); + if (context_info) { + context_info_local_nonprim = OpenAPI_context_info_parseFromJSON(context_info); + } + amf_subscription_info_local_var = OpenAPI_amf_subscription_info_create ( ogs_strdup(amf_instance_id->valuestring), ogs_strdup(subscription_id->valuestring), - subs_change_notify_correlation_id && !cJSON_IsNull(subs_change_notify_correlation_id) ? ogs_strdup(subs_change_notify_correlation_id->valuestring) : NULL + subs_change_notify_correlation_id && !cJSON_IsNull(subs_change_notify_correlation_id) ? ogs_strdup(subs_change_notify_correlation_id->valuestring) : NULL, + context_info ? context_info_local_nonprim : NULL ); return amf_subscription_info_local_var; end: + if (context_info_local_nonprim) { + OpenAPI_context_info_free(context_info_local_nonprim); + context_info_local_nonprim = NULL; + } return NULL; } diff --git a/lib/sbi/openapi/model/amf_subscription_info.h b/lib/sbi/openapi/model/amf_subscription_info.h index 00222c8e7..6a045b108 100644 --- a/lib/sbi/openapi/model/amf_subscription_info.h +++ b/lib/sbi/openapi/model/amf_subscription_info.h @@ -1,7 +1,7 @@ /* * amf_subscription_info.h * - * + * Information the UDR stores and retrieves related to active subscriptions at the AMF(s). */ #ifndef _OpenAPI_amf_subscription_info_H_ @@ -12,6 +12,7 @@ #include "../include/list.h" #include "../include/keyValuePair.h" #include "../include/binary.h" +#include "context_info.h" #ifdef __cplusplus extern "C" { @@ -22,12 +23,14 @@ typedef struct OpenAPI_amf_subscription_info_s { char *amf_instance_id; char *subscription_id; char *subs_change_notify_correlation_id; + struct OpenAPI_context_info_s *context_info; } OpenAPI_amf_subscription_info_t; OpenAPI_amf_subscription_info_t *OpenAPI_amf_subscription_info_create( char *amf_instance_id, char *subscription_id, - char *subs_change_notify_correlation_id + char *subs_change_notify_correlation_id, + OpenAPI_context_info_t *context_info ); void OpenAPI_amf_subscription_info_free(OpenAPI_amf_subscription_info_t *amf_subscription_info); OpenAPI_amf_subscription_info_t *OpenAPI_amf_subscription_info_parseFromJSON(cJSON *amf_subscription_infoJSON); diff --git a/lib/sbi/openapi/model/an_gw_address.h b/lib/sbi/openapi/model/an_gw_address.h index ca44645dc..18bb3cc64 100644 --- a/lib/sbi/openapi/model/an_gw_address.h +++ b/lib/sbi/openapi/model/an_gw_address.h @@ -1,7 +1,7 @@ /* * an_gw_address.h * - * describes the address of the access network gateway control node + * Describes the address of the access network gateway control node. */ #ifndef _OpenAPI_an_gw_address_H_ diff --git a/lib/sbi/openapi/model/analytics_metadata.c b/lib/sbi/openapi/model/analytics_metadata.c new file mode 100644 index 000000000..3b109c5d2 --- /dev/null +++ b/lib/sbi/openapi/model/analytics_metadata.c @@ -0,0 +1,87 @@ + +#include +#include +#include +#include "analytics_metadata.h" + +OpenAPI_analytics_metadata_t *OpenAPI_analytics_metadata_create( +) +{ + OpenAPI_analytics_metadata_t *analytics_metadata_local_var = ogs_malloc(sizeof(OpenAPI_analytics_metadata_t)); + ogs_assert(analytics_metadata_local_var); + + + return analytics_metadata_local_var; +} + +void OpenAPI_analytics_metadata_free(OpenAPI_analytics_metadata_t *analytics_metadata) +{ + OpenAPI_lnode_t *node = NULL; + + if (NULL == analytics_metadata) { + return; + } + ogs_free(analytics_metadata); +} + +cJSON *OpenAPI_analytics_metadata_convertToJSON(OpenAPI_analytics_metadata_t *analytics_metadata) +{ + cJSON *item = NULL; + OpenAPI_lnode_t *node = NULL; + + if (analytics_metadata == NULL) { + ogs_error("OpenAPI_analytics_metadata_convertToJSON() failed [AnalyticsMetadata]"); + return NULL; + } + + item = cJSON_CreateObject(); +end: + return item; +} + +OpenAPI_analytics_metadata_t *OpenAPI_analytics_metadata_parseFromJSON(cJSON *analytics_metadataJSON) +{ + OpenAPI_analytics_metadata_t *analytics_metadata_local_var = NULL; + OpenAPI_lnode_t *node = NULL; + analytics_metadata_local_var = OpenAPI_analytics_metadata_create ( + ); + + return analytics_metadata_local_var; +end: + return NULL; +} + +OpenAPI_analytics_metadata_t *OpenAPI_analytics_metadata_copy(OpenAPI_analytics_metadata_t *dst, OpenAPI_analytics_metadata_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_analytics_metadata_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_analytics_metadata_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_analytics_metadata_free(dst); + dst = OpenAPI_analytics_metadata_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/analytics_metadata.h b/lib/sbi/openapi/model/analytics_metadata.h new file mode 100644 index 000000000..21334d429 --- /dev/null +++ b/lib/sbi/openapi/model/analytics_metadata.h @@ -0,0 +1,37 @@ +/* + * analytics_metadata.h + * + * Possible values are: - NUM_OF_SAMPLES: Number of data samples used for the generation of the output analytics. - DATA_WINDOW: Data time window of the data samples. - DATA_STAT_PROPS: Dataset statistical properties of the data used to generate the analytics. - STRATEGY: Output strategy used for the reporting of the analytics. - ACCURACY: Level of accuracy reached for the analytics. + */ + +#ifndef _OpenAPI_analytics_metadata_H_ +#define _OpenAPI_analytics_metadata_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "analytics_metadata_any_of.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_analytics_metadata_s OpenAPI_analytics_metadata_t; +typedef struct OpenAPI_analytics_metadata_s { +} OpenAPI_analytics_metadata_t; + +OpenAPI_analytics_metadata_t *OpenAPI_analytics_metadata_create( +); +void OpenAPI_analytics_metadata_free(OpenAPI_analytics_metadata_t *analytics_metadata); +OpenAPI_analytics_metadata_t *OpenAPI_analytics_metadata_parseFromJSON(cJSON *analytics_metadataJSON); +cJSON *OpenAPI_analytics_metadata_convertToJSON(OpenAPI_analytics_metadata_t *analytics_metadata); +OpenAPI_analytics_metadata_t *OpenAPI_analytics_metadata_copy(OpenAPI_analytics_metadata_t *dst, OpenAPI_analytics_metadata_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_analytics_metadata_H_ */ + diff --git a/lib/sbi/openapi/model/analytics_metadata_any_of.c b/lib/sbi/openapi/model/analytics_metadata_any_of.c new file mode 100644 index 000000000..18b4ad04f --- /dev/null +++ b/lib/sbi/openapi/model/analytics_metadata_any_of.c @@ -0,0 +1,30 @@ + +#include +#include +#include +#include "analytics_metadata_any_of.h" + +char* OpenAPI_analytics_metadata_any_of_ToString(OpenAPI_analytics_metadata_any_of_e analytics_metadata_any_of) +{ + const char *analytics_metadata_any_ofArray[] = { "NULL", "NUM_OF_SAMPLES", "DATA_WINDOW", "DATA_STAT_PROPS", "STRATEGY", "ACCURACY" }; + size_t sizeofArray = sizeof(analytics_metadata_any_ofArray) / sizeof(analytics_metadata_any_ofArray[0]); + if (analytics_metadata_any_of < sizeofArray) + return (char *)analytics_metadata_any_ofArray[analytics_metadata_any_of]; + else + return (char *)"Unknown"; +} + +OpenAPI_analytics_metadata_any_of_e OpenAPI_analytics_metadata_any_of_FromString(char* analytics_metadata_any_of) +{ + int stringToReturn = 0; + const char *analytics_metadata_any_ofArray[] = { "NULL", "NUM_OF_SAMPLES", "DATA_WINDOW", "DATA_STAT_PROPS", "STRATEGY", "ACCURACY" }; + size_t sizeofArray = sizeof(analytics_metadata_any_ofArray) / sizeof(analytics_metadata_any_ofArray[0]); + while (stringToReturn < sizeofArray) { + if (strcmp(analytics_metadata_any_of, analytics_metadata_any_ofArray[stringToReturn]) == 0) { + return stringToReturn; + } + stringToReturn++; + } + return 0; +} + diff --git a/lib/sbi/openapi/model/analytics_metadata_any_of.h b/lib/sbi/openapi/model/analytics_metadata_any_of.h new file mode 100644 index 000000000..f6eb022c3 --- /dev/null +++ b/lib/sbi/openapi/model/analytics_metadata_any_of.h @@ -0,0 +1,31 @@ +/* + * analytics_metadata_any_of.h + * + * + */ + +#ifndef _OpenAPI_analytics_metadata_any_of_H_ +#define _OpenAPI_analytics_metadata_any_of_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef enum { OpenAPI_analytics_metadata_any_of_NULL = 0, OpenAPI_analytics_metadata_any_of_NUM_OF_SAMPLES, OpenAPI_analytics_metadata_any_of_DATA_WINDOW, OpenAPI_analytics_metadata_any_of_DATA_STAT_PROPS, OpenAPI_analytics_metadata_any_of_STRATEGY, OpenAPI_analytics_metadata_any_of_ACCURACY } OpenAPI_analytics_metadata_any_of_e; + +char* OpenAPI_analytics_metadata_any_of_ToString(OpenAPI_analytics_metadata_any_of_e analytics_metadata_any_of); + +OpenAPI_analytics_metadata_any_of_e OpenAPI_analytics_metadata_any_of_FromString(char* analytics_metadata_any_of); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_analytics_metadata_any_of_H_ */ + diff --git a/lib/sbi/openapi/model/analytics_metadata_indication.c b/lib/sbi/openapi/model/analytics_metadata_indication.c new file mode 100644 index 000000000..c926ce3fb --- /dev/null +++ b/lib/sbi/openapi/model/analytics_metadata_indication.c @@ -0,0 +1,263 @@ + +#include +#include +#include +#include "analytics_metadata_indication.h" + +OpenAPI_analytics_metadata_indication_t *OpenAPI_analytics_metadata_indication_create( + OpenAPI_time_window_t *data_window, + OpenAPI_list_t *data_stat_props, + OpenAPI_output_strategy_t *strategy, + OpenAPI_list_t *aggr_nwdaf_ids +) +{ + OpenAPI_analytics_metadata_indication_t *analytics_metadata_indication_local_var = ogs_malloc(sizeof(OpenAPI_analytics_metadata_indication_t)); + ogs_assert(analytics_metadata_indication_local_var); + + analytics_metadata_indication_local_var->data_window = data_window; + analytics_metadata_indication_local_var->data_stat_props = data_stat_props; + analytics_metadata_indication_local_var->strategy = strategy; + analytics_metadata_indication_local_var->aggr_nwdaf_ids = aggr_nwdaf_ids; + + return analytics_metadata_indication_local_var; +} + +void OpenAPI_analytics_metadata_indication_free(OpenAPI_analytics_metadata_indication_t *analytics_metadata_indication) +{ + OpenAPI_lnode_t *node = NULL; + + if (NULL == analytics_metadata_indication) { + return; + } + if (analytics_metadata_indication->data_window) { + OpenAPI_time_window_free(analytics_metadata_indication->data_window); + analytics_metadata_indication->data_window = NULL; + } + if (analytics_metadata_indication->data_stat_props) { + OpenAPI_list_for_each(analytics_metadata_indication->data_stat_props, node) { + OpenAPI_dataset_statistical_property_free(node->data); + } + OpenAPI_list_free(analytics_metadata_indication->data_stat_props); + analytics_metadata_indication->data_stat_props = NULL; + } + if (analytics_metadata_indication->strategy) { + OpenAPI_output_strategy_free(analytics_metadata_indication->strategy); + analytics_metadata_indication->strategy = NULL; + } + if (analytics_metadata_indication->aggr_nwdaf_ids) { + OpenAPI_list_for_each(analytics_metadata_indication->aggr_nwdaf_ids, node) { + ogs_free(node->data); + } + OpenAPI_list_free(analytics_metadata_indication->aggr_nwdaf_ids); + analytics_metadata_indication->aggr_nwdaf_ids = NULL; + } + ogs_free(analytics_metadata_indication); +} + +cJSON *OpenAPI_analytics_metadata_indication_convertToJSON(OpenAPI_analytics_metadata_indication_t *analytics_metadata_indication) +{ + cJSON *item = NULL; + OpenAPI_lnode_t *node = NULL; + + if (analytics_metadata_indication == NULL) { + ogs_error("OpenAPI_analytics_metadata_indication_convertToJSON() failed [AnalyticsMetadataIndication]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (analytics_metadata_indication->data_window) { + cJSON *data_window_local_JSON = OpenAPI_time_window_convertToJSON(analytics_metadata_indication->data_window); + if (data_window_local_JSON == NULL) { + ogs_error("OpenAPI_analytics_metadata_indication_convertToJSON() failed [data_window]"); + goto end; + } + cJSON_AddItemToObject(item, "dataWindow", data_window_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_analytics_metadata_indication_convertToJSON() failed [data_window]"); + goto end; + } + } + + if (analytics_metadata_indication->data_stat_props) { + cJSON *data_stat_propsList = cJSON_AddArrayToObject(item, "dataStatProps"); + if (data_stat_propsList == NULL) { + ogs_error("OpenAPI_analytics_metadata_indication_convertToJSON() failed [data_stat_props]"); + goto end; + } + OpenAPI_list_for_each(analytics_metadata_indication->data_stat_props, node) { + cJSON *itemLocal = OpenAPI_dataset_statistical_property_convertToJSON(node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_analytics_metadata_indication_convertToJSON() failed [data_stat_props]"); + goto end; + } + cJSON_AddItemToArray(data_stat_propsList, itemLocal); + } + } + + if (analytics_metadata_indication->strategy) { + cJSON *strategy_local_JSON = OpenAPI_output_strategy_convertToJSON(analytics_metadata_indication->strategy); + if (strategy_local_JSON == NULL) { + ogs_error("OpenAPI_analytics_metadata_indication_convertToJSON() failed [strategy]"); + goto end; + } + cJSON_AddItemToObject(item, "strategy", strategy_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_analytics_metadata_indication_convertToJSON() failed [strategy]"); + goto end; + } + } + + if (analytics_metadata_indication->aggr_nwdaf_ids) { + cJSON *aggr_nwdaf_idsList = cJSON_AddArrayToObject(item, "aggrNwdafIds"); + if (aggr_nwdaf_idsList == NULL) { + ogs_error("OpenAPI_analytics_metadata_indication_convertToJSON() failed [aggr_nwdaf_ids]"); + goto end; + } + OpenAPI_list_for_each(analytics_metadata_indication->aggr_nwdaf_ids, node) { + if (cJSON_AddStringToObject(aggr_nwdaf_idsList, "", (char*)node->data) == NULL) { + ogs_error("OpenAPI_analytics_metadata_indication_convertToJSON() failed [aggr_nwdaf_ids]"); + goto end; + } + } + } + +end: + return item; +} + +OpenAPI_analytics_metadata_indication_t *OpenAPI_analytics_metadata_indication_parseFromJSON(cJSON *analytics_metadata_indicationJSON) +{ + OpenAPI_analytics_metadata_indication_t *analytics_metadata_indication_local_var = NULL; + OpenAPI_lnode_t *node = NULL; + cJSON *data_window = NULL; + OpenAPI_time_window_t *data_window_local_nonprim = NULL; + cJSON *data_stat_props = NULL; + OpenAPI_list_t *data_stat_propsList = NULL; + cJSON *strategy = NULL; + OpenAPI_output_strategy_t *strategy_local_nonprim = NULL; + cJSON *aggr_nwdaf_ids = NULL; + OpenAPI_list_t *aggr_nwdaf_idsList = NULL; + data_window = cJSON_GetObjectItemCaseSensitive(analytics_metadata_indicationJSON, "dataWindow"); + if (data_window) { + data_window_local_nonprim = OpenAPI_time_window_parseFromJSON(data_window); + } + + data_stat_props = cJSON_GetObjectItemCaseSensitive(analytics_metadata_indicationJSON, "dataStatProps"); + if (data_stat_props) { + cJSON *data_stat_props_local = NULL; + if (!cJSON_IsArray(data_stat_props)) { + ogs_error("OpenAPI_analytics_metadata_indication_parseFromJSON() failed [data_stat_props]"); + goto end; + } + + data_stat_propsList = OpenAPI_list_create(); + + cJSON_ArrayForEach(data_stat_props_local, data_stat_props) { + if (!cJSON_IsObject(data_stat_props_local)) { + ogs_error("OpenAPI_analytics_metadata_indication_parseFromJSON() failed [data_stat_props]"); + goto end; + } + OpenAPI_dataset_statistical_property_t *data_stat_propsItem = OpenAPI_dataset_statistical_property_parseFromJSON(data_stat_props_local); + if (!data_stat_propsItem) { + ogs_error("No data_stat_propsItem"); + OpenAPI_list_free(data_stat_propsList); + goto end; + } + OpenAPI_list_add(data_stat_propsList, data_stat_propsItem); + } + } + + strategy = cJSON_GetObjectItemCaseSensitive(analytics_metadata_indicationJSON, "strategy"); + if (strategy) { + strategy_local_nonprim = OpenAPI_output_strategy_parseFromJSON(strategy); + } + + aggr_nwdaf_ids = cJSON_GetObjectItemCaseSensitive(analytics_metadata_indicationJSON, "aggrNwdafIds"); + if (aggr_nwdaf_ids) { + cJSON *aggr_nwdaf_ids_local = NULL; + if (!cJSON_IsArray(aggr_nwdaf_ids)) { + ogs_error("OpenAPI_analytics_metadata_indication_parseFromJSON() failed [aggr_nwdaf_ids]"); + goto end; + } + + aggr_nwdaf_idsList = OpenAPI_list_create(); + + cJSON_ArrayForEach(aggr_nwdaf_ids_local, aggr_nwdaf_ids) { + double *localDouble = NULL; + int *localInt = NULL; + if (!cJSON_IsString(aggr_nwdaf_ids_local)) { + ogs_error("OpenAPI_analytics_metadata_indication_parseFromJSON() failed [aggr_nwdaf_ids]"); + goto end; + } + OpenAPI_list_add(aggr_nwdaf_idsList, ogs_strdup(aggr_nwdaf_ids_local->valuestring)); + } + } + + analytics_metadata_indication_local_var = OpenAPI_analytics_metadata_indication_create ( + data_window ? data_window_local_nonprim : NULL, + data_stat_props ? data_stat_propsList : NULL, + strategy ? strategy_local_nonprim : NULL, + aggr_nwdaf_ids ? aggr_nwdaf_idsList : NULL + ); + + return analytics_metadata_indication_local_var; +end: + if (data_window_local_nonprim) { + OpenAPI_time_window_free(data_window_local_nonprim); + data_window_local_nonprim = NULL; + } + if (data_stat_propsList) { + OpenAPI_list_for_each(data_stat_propsList, node) { + OpenAPI_dataset_statistical_property_free(node->data); + } + OpenAPI_list_free(data_stat_propsList); + data_stat_propsList = NULL; + } + if (strategy_local_nonprim) { + OpenAPI_output_strategy_free(strategy_local_nonprim); + strategy_local_nonprim = NULL; + } + if (aggr_nwdaf_idsList) { + OpenAPI_list_for_each(aggr_nwdaf_idsList, node) { + ogs_free(node->data); + } + OpenAPI_list_free(aggr_nwdaf_idsList); + aggr_nwdaf_idsList = NULL; + } + return NULL; +} + +OpenAPI_analytics_metadata_indication_t *OpenAPI_analytics_metadata_indication_copy(OpenAPI_analytics_metadata_indication_t *dst, OpenAPI_analytics_metadata_indication_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_analytics_metadata_indication_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_analytics_metadata_indication_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_analytics_metadata_indication_free(dst); + dst = OpenAPI_analytics_metadata_indication_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/analytics_metadata_indication.h b/lib/sbi/openapi/model/analytics_metadata_indication.h new file mode 100644 index 000000000..a7c6aa2a4 --- /dev/null +++ b/lib/sbi/openapi/model/analytics_metadata_indication.h @@ -0,0 +1,47 @@ +/* + * analytics_metadata_indication.h + * + * Contains analytics metadata information requested to be used during analytics generation. + */ + +#ifndef _OpenAPI_analytics_metadata_indication_H_ +#define _OpenAPI_analytics_metadata_indication_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "dataset_statistical_property.h" +#include "output_strategy.h" +#include "time_window.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_analytics_metadata_indication_s OpenAPI_analytics_metadata_indication_t; +typedef struct OpenAPI_analytics_metadata_indication_s { + struct OpenAPI_time_window_s *data_window; + OpenAPI_list_t *data_stat_props; + struct OpenAPI_output_strategy_s *strategy; + OpenAPI_list_t *aggr_nwdaf_ids; +} OpenAPI_analytics_metadata_indication_t; + +OpenAPI_analytics_metadata_indication_t *OpenAPI_analytics_metadata_indication_create( + OpenAPI_time_window_t *data_window, + OpenAPI_list_t *data_stat_props, + OpenAPI_output_strategy_t *strategy, + OpenAPI_list_t *aggr_nwdaf_ids +); +void OpenAPI_analytics_metadata_indication_free(OpenAPI_analytics_metadata_indication_t *analytics_metadata_indication); +OpenAPI_analytics_metadata_indication_t *OpenAPI_analytics_metadata_indication_parseFromJSON(cJSON *analytics_metadata_indicationJSON); +cJSON *OpenAPI_analytics_metadata_indication_convertToJSON(OpenAPI_analytics_metadata_indication_t *analytics_metadata_indication); +OpenAPI_analytics_metadata_indication_t *OpenAPI_analytics_metadata_indication_copy(OpenAPI_analytics_metadata_indication_t *dst, OpenAPI_analytics_metadata_indication_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_analytics_metadata_indication_H_ */ + diff --git a/lib/sbi/openapi/model/analytics_metadata_info.c b/lib/sbi/openapi/model/analytics_metadata_info.c new file mode 100644 index 000000000..9ac086199 --- /dev/null +++ b/lib/sbi/openapi/model/analytics_metadata_info.c @@ -0,0 +1,262 @@ + +#include +#include +#include +#include "analytics_metadata_info.h" + +OpenAPI_analytics_metadata_info_t *OpenAPI_analytics_metadata_info_create( + bool is_num_samples, + int num_samples, + OpenAPI_time_window_t *data_window, + OpenAPI_list_t *data_stat_props, + OpenAPI_output_strategy_t *strategy, + OpenAPI_accuracy_t *accuracy +) +{ + OpenAPI_analytics_metadata_info_t *analytics_metadata_info_local_var = ogs_malloc(sizeof(OpenAPI_analytics_metadata_info_t)); + ogs_assert(analytics_metadata_info_local_var); + + analytics_metadata_info_local_var->is_num_samples = is_num_samples; + analytics_metadata_info_local_var->num_samples = num_samples; + analytics_metadata_info_local_var->data_window = data_window; + analytics_metadata_info_local_var->data_stat_props = data_stat_props; + analytics_metadata_info_local_var->strategy = strategy; + analytics_metadata_info_local_var->accuracy = accuracy; + + return analytics_metadata_info_local_var; +} + +void OpenAPI_analytics_metadata_info_free(OpenAPI_analytics_metadata_info_t *analytics_metadata_info) +{ + OpenAPI_lnode_t *node = NULL; + + if (NULL == analytics_metadata_info) { + return; + } + if (analytics_metadata_info->data_window) { + OpenAPI_time_window_free(analytics_metadata_info->data_window); + analytics_metadata_info->data_window = NULL; + } + if (analytics_metadata_info->data_stat_props) { + OpenAPI_list_for_each(analytics_metadata_info->data_stat_props, node) { + OpenAPI_dataset_statistical_property_free(node->data); + } + OpenAPI_list_free(analytics_metadata_info->data_stat_props); + analytics_metadata_info->data_stat_props = NULL; + } + if (analytics_metadata_info->strategy) { + OpenAPI_output_strategy_free(analytics_metadata_info->strategy); + analytics_metadata_info->strategy = NULL; + } + if (analytics_metadata_info->accuracy) { + OpenAPI_accuracy_free(analytics_metadata_info->accuracy); + analytics_metadata_info->accuracy = NULL; + } + ogs_free(analytics_metadata_info); +} + +cJSON *OpenAPI_analytics_metadata_info_convertToJSON(OpenAPI_analytics_metadata_info_t *analytics_metadata_info) +{ + cJSON *item = NULL; + OpenAPI_lnode_t *node = NULL; + + if (analytics_metadata_info == NULL) { + ogs_error("OpenAPI_analytics_metadata_info_convertToJSON() failed [AnalyticsMetadataInfo]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (analytics_metadata_info->is_num_samples) { + if (cJSON_AddNumberToObject(item, "numSamples", analytics_metadata_info->num_samples) == NULL) { + ogs_error("OpenAPI_analytics_metadata_info_convertToJSON() failed [num_samples]"); + goto end; + } + } + + if (analytics_metadata_info->data_window) { + cJSON *data_window_local_JSON = OpenAPI_time_window_convertToJSON(analytics_metadata_info->data_window); + if (data_window_local_JSON == NULL) { + ogs_error("OpenAPI_analytics_metadata_info_convertToJSON() failed [data_window]"); + goto end; + } + cJSON_AddItemToObject(item, "dataWindow", data_window_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_analytics_metadata_info_convertToJSON() failed [data_window]"); + goto end; + } + } + + if (analytics_metadata_info->data_stat_props) { + cJSON *data_stat_propsList = cJSON_AddArrayToObject(item, "dataStatProps"); + if (data_stat_propsList == NULL) { + ogs_error("OpenAPI_analytics_metadata_info_convertToJSON() failed [data_stat_props]"); + goto end; + } + OpenAPI_list_for_each(analytics_metadata_info->data_stat_props, node) { + cJSON *itemLocal = OpenAPI_dataset_statistical_property_convertToJSON(node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_analytics_metadata_info_convertToJSON() failed [data_stat_props]"); + goto end; + } + cJSON_AddItemToArray(data_stat_propsList, itemLocal); + } + } + + if (analytics_metadata_info->strategy) { + cJSON *strategy_local_JSON = OpenAPI_output_strategy_convertToJSON(analytics_metadata_info->strategy); + if (strategy_local_JSON == NULL) { + ogs_error("OpenAPI_analytics_metadata_info_convertToJSON() failed [strategy]"); + goto end; + } + cJSON_AddItemToObject(item, "strategy", strategy_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_analytics_metadata_info_convertToJSON() failed [strategy]"); + goto end; + } + } + + if (analytics_metadata_info->accuracy) { + cJSON *accuracy_local_JSON = OpenAPI_accuracy_convertToJSON(analytics_metadata_info->accuracy); + if (accuracy_local_JSON == NULL) { + ogs_error("OpenAPI_analytics_metadata_info_convertToJSON() failed [accuracy]"); + goto end; + } + cJSON_AddItemToObject(item, "accuracy", accuracy_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_analytics_metadata_info_convertToJSON() failed [accuracy]"); + goto end; + } + } + +end: + return item; +} + +OpenAPI_analytics_metadata_info_t *OpenAPI_analytics_metadata_info_parseFromJSON(cJSON *analytics_metadata_infoJSON) +{ + OpenAPI_analytics_metadata_info_t *analytics_metadata_info_local_var = NULL; + OpenAPI_lnode_t *node = NULL; + cJSON *num_samples = NULL; + cJSON *data_window = NULL; + OpenAPI_time_window_t *data_window_local_nonprim = NULL; + cJSON *data_stat_props = NULL; + OpenAPI_list_t *data_stat_propsList = NULL; + cJSON *strategy = NULL; + OpenAPI_output_strategy_t *strategy_local_nonprim = NULL; + cJSON *accuracy = NULL; + OpenAPI_accuracy_t *accuracy_local_nonprim = NULL; + num_samples = cJSON_GetObjectItemCaseSensitive(analytics_metadata_infoJSON, "numSamples"); + if (num_samples) { + if (!cJSON_IsNumber(num_samples)) { + ogs_error("OpenAPI_analytics_metadata_info_parseFromJSON() failed [num_samples]"); + goto end; + } + } + + data_window = cJSON_GetObjectItemCaseSensitive(analytics_metadata_infoJSON, "dataWindow"); + if (data_window) { + data_window_local_nonprim = OpenAPI_time_window_parseFromJSON(data_window); + } + + data_stat_props = cJSON_GetObjectItemCaseSensitive(analytics_metadata_infoJSON, "dataStatProps"); + if (data_stat_props) { + cJSON *data_stat_props_local = NULL; + if (!cJSON_IsArray(data_stat_props)) { + ogs_error("OpenAPI_analytics_metadata_info_parseFromJSON() failed [data_stat_props]"); + goto end; + } + + data_stat_propsList = OpenAPI_list_create(); + + cJSON_ArrayForEach(data_stat_props_local, data_stat_props) { + if (!cJSON_IsObject(data_stat_props_local)) { + ogs_error("OpenAPI_analytics_metadata_info_parseFromJSON() failed [data_stat_props]"); + goto end; + } + OpenAPI_dataset_statistical_property_t *data_stat_propsItem = OpenAPI_dataset_statistical_property_parseFromJSON(data_stat_props_local); + if (!data_stat_propsItem) { + ogs_error("No data_stat_propsItem"); + OpenAPI_list_free(data_stat_propsList); + goto end; + } + OpenAPI_list_add(data_stat_propsList, data_stat_propsItem); + } + } + + strategy = cJSON_GetObjectItemCaseSensitive(analytics_metadata_infoJSON, "strategy"); + if (strategy) { + strategy_local_nonprim = OpenAPI_output_strategy_parseFromJSON(strategy); + } + + accuracy = cJSON_GetObjectItemCaseSensitive(analytics_metadata_infoJSON, "accuracy"); + if (accuracy) { + accuracy_local_nonprim = OpenAPI_accuracy_parseFromJSON(accuracy); + } + + analytics_metadata_info_local_var = OpenAPI_analytics_metadata_info_create ( + num_samples ? true : false, + num_samples ? num_samples->valuedouble : 0, + data_window ? data_window_local_nonprim : NULL, + data_stat_props ? data_stat_propsList : NULL, + strategy ? strategy_local_nonprim : NULL, + accuracy ? accuracy_local_nonprim : NULL + ); + + return analytics_metadata_info_local_var; +end: + if (data_window_local_nonprim) { + OpenAPI_time_window_free(data_window_local_nonprim); + data_window_local_nonprim = NULL; + } + if (data_stat_propsList) { + OpenAPI_list_for_each(data_stat_propsList, node) { + OpenAPI_dataset_statistical_property_free(node->data); + } + OpenAPI_list_free(data_stat_propsList); + data_stat_propsList = NULL; + } + if (strategy_local_nonprim) { + OpenAPI_output_strategy_free(strategy_local_nonprim); + strategy_local_nonprim = NULL; + } + if (accuracy_local_nonprim) { + OpenAPI_accuracy_free(accuracy_local_nonprim); + accuracy_local_nonprim = NULL; + } + return NULL; +} + +OpenAPI_analytics_metadata_info_t *OpenAPI_analytics_metadata_info_copy(OpenAPI_analytics_metadata_info_t *dst, OpenAPI_analytics_metadata_info_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_analytics_metadata_info_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_analytics_metadata_info_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_analytics_metadata_info_free(dst); + dst = OpenAPI_analytics_metadata_info_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/analytics_metadata_info.h b/lib/sbi/openapi/model/analytics_metadata_info.h new file mode 100644 index 000000000..2acdb95be --- /dev/null +++ b/lib/sbi/openapi/model/analytics_metadata_info.h @@ -0,0 +1,52 @@ +/* + * analytics_metadata_info.h + * + * Contains analytics metadata information required for analytics aggregation. + */ + +#ifndef _OpenAPI_analytics_metadata_info_H_ +#define _OpenAPI_analytics_metadata_info_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "accuracy.h" +#include "dataset_statistical_property.h" +#include "output_strategy.h" +#include "time_window.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_analytics_metadata_info_s OpenAPI_analytics_metadata_info_t; +typedef struct OpenAPI_analytics_metadata_info_s { + bool is_num_samples; + int num_samples; + struct OpenAPI_time_window_s *data_window; + OpenAPI_list_t *data_stat_props; + struct OpenAPI_output_strategy_s *strategy; + struct OpenAPI_accuracy_s *accuracy; +} OpenAPI_analytics_metadata_info_t; + +OpenAPI_analytics_metadata_info_t *OpenAPI_analytics_metadata_info_create( + bool is_num_samples, + int num_samples, + OpenAPI_time_window_t *data_window, + OpenAPI_list_t *data_stat_props, + OpenAPI_output_strategy_t *strategy, + OpenAPI_accuracy_t *accuracy +); +void OpenAPI_analytics_metadata_info_free(OpenAPI_analytics_metadata_info_t *analytics_metadata_info); +OpenAPI_analytics_metadata_info_t *OpenAPI_analytics_metadata_info_parseFromJSON(cJSON *analytics_metadata_infoJSON); +cJSON *OpenAPI_analytics_metadata_info_convertToJSON(OpenAPI_analytics_metadata_info_t *analytics_metadata_info); +OpenAPI_analytics_metadata_info_t *OpenAPI_analytics_metadata_info_copy(OpenAPI_analytics_metadata_info_t *dst, OpenAPI_analytics_metadata_info_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_analytics_metadata_info_H_ */ + diff --git a/lib/sbi/openapi/model/analytics_subscription.c b/lib/sbi/openapi/model/analytics_subscription.c new file mode 100644 index 000000000..a055ec6cd --- /dev/null +++ b/lib/sbi/openapi/model/analytics_subscription.c @@ -0,0 +1,197 @@ + +#include +#include +#include +#include "analytics_subscription.h" + +OpenAPI_analytics_subscription_t *OpenAPI_analytics_subscription_create( + char *nwdaf_id, + char *nwdaf_set_id, + OpenAPI_list_t *nwdaf_subscription_list +) +{ + OpenAPI_analytics_subscription_t *analytics_subscription_local_var = ogs_malloc(sizeof(OpenAPI_analytics_subscription_t)); + ogs_assert(analytics_subscription_local_var); + + analytics_subscription_local_var->nwdaf_id = nwdaf_id; + analytics_subscription_local_var->nwdaf_set_id = nwdaf_set_id; + analytics_subscription_local_var->nwdaf_subscription_list = nwdaf_subscription_list; + + return analytics_subscription_local_var; +} + +void OpenAPI_analytics_subscription_free(OpenAPI_analytics_subscription_t *analytics_subscription) +{ + OpenAPI_lnode_t *node = NULL; + + if (NULL == analytics_subscription) { + return; + } + if (analytics_subscription->nwdaf_id) { + ogs_free(analytics_subscription->nwdaf_id); + analytics_subscription->nwdaf_id = NULL; + } + if (analytics_subscription->nwdaf_set_id) { + ogs_free(analytics_subscription->nwdaf_set_id); + analytics_subscription->nwdaf_set_id = NULL; + } + if (analytics_subscription->nwdaf_subscription_list) { + OpenAPI_list_for_each(analytics_subscription->nwdaf_subscription_list, node) { + OpenAPI_nwdaf_subscription_free(node->data); + } + OpenAPI_list_free(analytics_subscription->nwdaf_subscription_list); + analytics_subscription->nwdaf_subscription_list = NULL; + } + ogs_free(analytics_subscription); +} + +cJSON *OpenAPI_analytics_subscription_convertToJSON(OpenAPI_analytics_subscription_t *analytics_subscription) +{ + cJSON *item = NULL; + OpenAPI_lnode_t *node = NULL; + + if (analytics_subscription == NULL) { + ogs_error("OpenAPI_analytics_subscription_convertToJSON() failed [AnalyticsSubscription]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (analytics_subscription->nwdaf_id) { + if (cJSON_AddStringToObject(item, "nwdafId", analytics_subscription->nwdaf_id) == NULL) { + ogs_error("OpenAPI_analytics_subscription_convertToJSON() failed [nwdaf_id]"); + goto end; + } + } + + if (analytics_subscription->nwdaf_set_id) { + if (cJSON_AddStringToObject(item, "nwdafSetId", analytics_subscription->nwdaf_set_id) == NULL) { + ogs_error("OpenAPI_analytics_subscription_convertToJSON() failed [nwdaf_set_id]"); + goto end; + } + } + + if (!analytics_subscription->nwdaf_subscription_list) { + ogs_error("OpenAPI_analytics_subscription_convertToJSON() failed [nwdaf_subscription_list]"); + return NULL; + } + cJSON *nwdaf_subscription_listList = cJSON_AddArrayToObject(item, "nwdafSubscriptionList"); + if (nwdaf_subscription_listList == NULL) { + ogs_error("OpenAPI_analytics_subscription_convertToJSON() failed [nwdaf_subscription_list]"); + goto end; + } + OpenAPI_list_for_each(analytics_subscription->nwdaf_subscription_list, node) { + cJSON *itemLocal = OpenAPI_nwdaf_subscription_convertToJSON(node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_analytics_subscription_convertToJSON() failed [nwdaf_subscription_list]"); + goto end; + } + cJSON_AddItemToArray(nwdaf_subscription_listList, itemLocal); + } + +end: + return item; +} + +OpenAPI_analytics_subscription_t *OpenAPI_analytics_subscription_parseFromJSON(cJSON *analytics_subscriptionJSON) +{ + OpenAPI_analytics_subscription_t *analytics_subscription_local_var = NULL; + OpenAPI_lnode_t *node = NULL; + cJSON *nwdaf_id = NULL; + cJSON *nwdaf_set_id = NULL; + cJSON *nwdaf_subscription_list = NULL; + OpenAPI_list_t *nwdaf_subscription_listList = NULL; + nwdaf_id = cJSON_GetObjectItemCaseSensitive(analytics_subscriptionJSON, "nwdafId"); + if (nwdaf_id) { + if (!cJSON_IsString(nwdaf_id) && !cJSON_IsNull(nwdaf_id)) { + ogs_error("OpenAPI_analytics_subscription_parseFromJSON() failed [nwdaf_id]"); + goto end; + } + } + + nwdaf_set_id = cJSON_GetObjectItemCaseSensitive(analytics_subscriptionJSON, "nwdafSetId"); + if (nwdaf_set_id) { + if (!cJSON_IsString(nwdaf_set_id) && !cJSON_IsNull(nwdaf_set_id)) { + ogs_error("OpenAPI_analytics_subscription_parseFromJSON() failed [nwdaf_set_id]"); + goto end; + } + } + + nwdaf_subscription_list = cJSON_GetObjectItemCaseSensitive(analytics_subscriptionJSON, "nwdafSubscriptionList"); + if (!nwdaf_subscription_list) { + ogs_error("OpenAPI_analytics_subscription_parseFromJSON() failed [nwdaf_subscription_list]"); + goto end; + } + cJSON *nwdaf_subscription_list_local = NULL; + if (!cJSON_IsArray(nwdaf_subscription_list)) { + ogs_error("OpenAPI_analytics_subscription_parseFromJSON() failed [nwdaf_subscription_list]"); + goto end; + } + + nwdaf_subscription_listList = OpenAPI_list_create(); + + cJSON_ArrayForEach(nwdaf_subscription_list_local, nwdaf_subscription_list) { + if (!cJSON_IsObject(nwdaf_subscription_list_local)) { + ogs_error("OpenAPI_analytics_subscription_parseFromJSON() failed [nwdaf_subscription_list]"); + goto end; + } + OpenAPI_nwdaf_subscription_t *nwdaf_subscription_listItem = OpenAPI_nwdaf_subscription_parseFromJSON(nwdaf_subscription_list_local); + if (!nwdaf_subscription_listItem) { + ogs_error("No nwdaf_subscription_listItem"); + OpenAPI_list_free(nwdaf_subscription_listList); + goto end; + } + OpenAPI_list_add(nwdaf_subscription_listList, nwdaf_subscription_listItem); + } + + analytics_subscription_local_var = OpenAPI_analytics_subscription_create ( + nwdaf_id && !cJSON_IsNull(nwdaf_id) ? ogs_strdup(nwdaf_id->valuestring) : NULL, + nwdaf_set_id && !cJSON_IsNull(nwdaf_set_id) ? ogs_strdup(nwdaf_set_id->valuestring) : NULL, + nwdaf_subscription_listList + ); + + return analytics_subscription_local_var; +end: + if (nwdaf_subscription_listList) { + OpenAPI_list_for_each(nwdaf_subscription_listList, node) { + OpenAPI_nwdaf_subscription_free(node->data); + } + OpenAPI_list_free(nwdaf_subscription_listList); + nwdaf_subscription_listList = NULL; + } + return NULL; +} + +OpenAPI_analytics_subscription_t *OpenAPI_analytics_subscription_copy(OpenAPI_analytics_subscription_t *dst, OpenAPI_analytics_subscription_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_analytics_subscription_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_analytics_subscription_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_analytics_subscription_free(dst); + dst = OpenAPI_analytics_subscription_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/analytics_subscription.h b/lib/sbi/openapi/model/analytics_subscription.h new file mode 100644 index 000000000..152673512 --- /dev/null +++ b/lib/sbi/openapi/model/analytics_subscription.h @@ -0,0 +1,43 @@ +/* + * analytics_subscription.h + * + * Analytics subscriptions created in the NWDAF. + */ + +#ifndef _OpenAPI_analytics_subscription_H_ +#define _OpenAPI_analytics_subscription_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "nwdaf_subscription.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_analytics_subscription_s OpenAPI_analytics_subscription_t; +typedef struct OpenAPI_analytics_subscription_s { + char *nwdaf_id; + char *nwdaf_set_id; + OpenAPI_list_t *nwdaf_subscription_list; +} OpenAPI_analytics_subscription_t; + +OpenAPI_analytics_subscription_t *OpenAPI_analytics_subscription_create( + char *nwdaf_id, + char *nwdaf_set_id, + OpenAPI_list_t *nwdaf_subscription_list +); +void OpenAPI_analytics_subscription_free(OpenAPI_analytics_subscription_t *analytics_subscription); +OpenAPI_analytics_subscription_t *OpenAPI_analytics_subscription_parseFromJSON(cJSON *analytics_subscriptionJSON); +cJSON *OpenAPI_analytics_subscription_convertToJSON(OpenAPI_analytics_subscription_t *analytics_subscription); +OpenAPI_analytics_subscription_t *OpenAPI_analytics_subscription_copy(OpenAPI_analytics_subscription_t *dst, OpenAPI_analytics_subscription_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_analytics_subscription_H_ */ + diff --git a/lib/sbi/openapi/model/analytics_subset.c b/lib/sbi/openapi/model/analytics_subset.c new file mode 100644 index 000000000..3cf5bffbf --- /dev/null +++ b/lib/sbi/openapi/model/analytics_subset.c @@ -0,0 +1,87 @@ + +#include +#include +#include +#include "analytics_subset.h" + +OpenAPI_analytics_subset_t *OpenAPI_analytics_subset_create( +) +{ + OpenAPI_analytics_subset_t *analytics_subset_local_var = ogs_malloc(sizeof(OpenAPI_analytics_subset_t)); + ogs_assert(analytics_subset_local_var); + + + return analytics_subset_local_var; +} + +void OpenAPI_analytics_subset_free(OpenAPI_analytics_subset_t *analytics_subset) +{ + OpenAPI_lnode_t *node = NULL; + + if (NULL == analytics_subset) { + return; + } + ogs_free(analytics_subset); +} + +cJSON *OpenAPI_analytics_subset_convertToJSON(OpenAPI_analytics_subset_t *analytics_subset) +{ + cJSON *item = NULL; + OpenAPI_lnode_t *node = NULL; + + if (analytics_subset == NULL) { + ogs_error("OpenAPI_analytics_subset_convertToJSON() failed [AnalyticsSubset]"); + return NULL; + } + + item = cJSON_CreateObject(); +end: + return item; +} + +OpenAPI_analytics_subset_t *OpenAPI_analytics_subset_parseFromJSON(cJSON *analytics_subsetJSON) +{ + OpenAPI_analytics_subset_t *analytics_subset_local_var = NULL; + OpenAPI_lnode_t *node = NULL; + analytics_subset_local_var = OpenAPI_analytics_subset_create ( + ); + + return analytics_subset_local_var; +end: + return NULL; +} + +OpenAPI_analytics_subset_t *OpenAPI_analytics_subset_copy(OpenAPI_analytics_subset_t *dst, OpenAPI_analytics_subset_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_analytics_subset_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_analytics_subset_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_analytics_subset_free(dst); + dst = OpenAPI_analytics_subset_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/analytics_subset.h b/lib/sbi/openapi/model/analytics_subset.h new file mode 100644 index 000000000..f093f1d3f --- /dev/null +++ b/lib/sbi/openapi/model/analytics_subset.h @@ -0,0 +1,37 @@ +/* + * analytics_subset.h + * + * Possible values are: - NUM_OF_UE_REG: The number of UE registered. This value is only applicable to NSI_LOAD_LEVEL event. - NUM_OF_PDU_SESS_ESTBL: The number of PDU sessions established. This value is only applicable to NSI_LOAD_LEVEL event. - RES_USAGE: The current usage of the virtual resources assigned to the NF instances belonging to a particular network slice instance. This value is only applicable to NSI_LOAD_LEVEL event. - NUM_OF_EXCEED_RES_USAGE_LOAD_LEVEL_THR: The number of times the resource usage threshold of the network slice instance is reached or exceeded if a threshold value is provided by the consumer. This value is only applicable to NSI_LOAD_LEVEL event. - PERIOD_OF_EXCEED_RES_USAGE_LOAD_LEVEL_THR: The time interval between each time the threshold being met or exceeded on the network slice (instance). This value is only applicable to NSI_LOAD_LEVEL event. - EXCEED_LOAD_LEVEL_THR_IND: Whether the Load Level Threshold is met or exceeded by the statistics value. This value is only applicable to NSI_LOAD_LEVEL event. - LIST_OF_TOP_APP_UL: The list of applications that contribute the most to the traffic in the UL direction. This value is only applicable to USER_DATA_CONGESTION event. - LIST_OF_TOP_APP_DL: The list of applications that contribute the most to the traffic in the DL direction. This value is only applicable to USER_DATA_CONGESTION event. - NF_STATUS: The availability status of the NF on the Analytics target period, expressed as a percentage of time per status value (registered, suspended, undiscoverable). This value is only applicable to NF_LOAD event. - NF_RESOURCE_USAGE: The average usage of assigned resources (CPU, memory, storage). This value is only applicable to NF_LOAD event. - NF_LOAD: The average load of the NF instance over the Analytics target period. This value is only applicable to NF_LOAD event. - NF_PEAK_LOAD: The maximum load of the NF instance over the Analytics target period. This value is only applicable to NF_LOAD event. - NF_LOAD_AVG_IN_AOI: The average load of the NF instances over the area of interest. This value is only applicable to NF_LOAD event. - DISPER_AMOUNT: Indicates the dispersion amount of the reported data volume or transaction dispersion type. This value is only applicable to DISPERSION event. - DISPER_CLASS: Indicates the dispersion mobility class: fixed, camper, traveller upon set its usage threshold, and/or the top-heavy class upon set its percentile rating threshold. This value is only applicable to DISPERSION event. - RANKING: Data/transaction usage ranking high (i.e.value 1), medium (2) or low (3). This value is only applicable to DISPERSION event. - PERCENTILE_RANKING: Percentile ranking of the target UE in the Cumulative Distribution Function of data usage for the population of all UEs. This value is only applicable to DISPERSION event. - RSSI: Indicated the RSSI in the unit of dBm. This value is only applicable to WLAN_PERFORMANCE event. - RTT: Indicates the RTT in the unit of millisecond. This value is only applicable to WLAN_PERFORMANCE event. - TRAFFIC_INFO: Traffic information including UL/DL data rate and/or Traffic volume. This value is only applicable to WLAN_PERFORMANCE event. - NUMBER_OF_UES: Number of UEs observed for the SSID. This value is only applicable to WLAN_PERFORMANCE event. - APP_LIST_FOR_UE_COMM: The analytics of the application list used by UE. This value is only applicable to UE_COMM event. - N4_SESS_INACT_TIMER_FOR_UE_COMM: The N4 Session inactivity timer. This value is only applicable to UE_COMM event. - AVG_TRAFFIC_RATE: Indicates average traffic rate. This value is only applicable to DN_PERFORMANCE event. - MAX_TRAFFIC_RATE: Indicates maximum traffic rate. This value is only applicable to DN_PERFORMANCE event. - AVG_PACKET_DELAY: Indicates average Packet Delay. This value is only applicable to DN_PERFORMANCE event. - MAX_PACKET_DELAY: Indicates maximum Packet Delay. This value is only applicable to DN_PERFORMANCE event. - AVG_PACKET_LOSS_RATE: Indicates average Loss Rate. This value is only applicable to DN_PERFORMANCE event. - UE_LOCATION: Indicates UE location information. This value is only applicable to SERVICE_EXPERIENCE event. - LIST_OF_HIGH_EXP_UE: Indicates list of high experienced UE. This value is only applicable to SM_CONGESTION event. - LIST_OF_MEDIUM_EXP_UE: Indicates list of medium experienced UE. This value is only applicable to SM_CONGESTION event. - LIST_OF_LOW_EXP_UE: Indicates list of low experienced UE. This value is only applicable to SM_CONGESTION event. - AVG_UL_PKT_DROP_RATE: Indicates average uplink packet drop rate on GTP-U path on N3. This value is only applicable to RED_TRANS_EXP event. - VAR_UL_PKT_DROP_RATE: Indicates variance of uplink packet drop rate on GTP-U path on N3. This value is only applicable to RED_TRANS_EXP event. - AVG_DL_PKT_DROP_RATE: Indicates average downlink packet drop rate on GTP-U path on N3. This value is only applicable to RED_TRANS_EXP event. - VAR_DL_PKT_DROP_RATE: Indicates variance of downlink packet drop rate on GTP-U path on N3. This value is only applicable to RED_TRANS_EXP event. - AVG_UL_PKT_DELAY: Indicates average uplink packet delay round trip on GTP-U path on N3. This value is only applicable to RED_TRANS_EXP event. - VAR_UL_PKT_DELAY: Indicates variance uplink packet delay round trip on GTP-U path on N3. This value is only applicable to RED_TRANS_EXP event. - AVG_DL_PKT_DELAY: Indicates average downlink packet delay round trip on GTP-U path on N3. This value is only applicable to RED_TRANS_EXP event. - VAR_DL_PKT_DELAY: Indicates variance downlink packet delay round trip on GTP-U path on N3. This value is only applicable to RED_TRANS_EXP event. + */ + +#ifndef _OpenAPI_analytics_subset_H_ +#define _OpenAPI_analytics_subset_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "analytics_subset_any_of.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_analytics_subset_s OpenAPI_analytics_subset_t; +typedef struct OpenAPI_analytics_subset_s { +} OpenAPI_analytics_subset_t; + +OpenAPI_analytics_subset_t *OpenAPI_analytics_subset_create( +); +void OpenAPI_analytics_subset_free(OpenAPI_analytics_subset_t *analytics_subset); +OpenAPI_analytics_subset_t *OpenAPI_analytics_subset_parseFromJSON(cJSON *analytics_subsetJSON); +cJSON *OpenAPI_analytics_subset_convertToJSON(OpenAPI_analytics_subset_t *analytics_subset); +OpenAPI_analytics_subset_t *OpenAPI_analytics_subset_copy(OpenAPI_analytics_subset_t *dst, OpenAPI_analytics_subset_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_analytics_subset_H_ */ + diff --git a/lib/sbi/openapi/model/analytics_subset_any_of.c b/lib/sbi/openapi/model/analytics_subset_any_of.c new file mode 100644 index 000000000..b2e4a0af7 --- /dev/null +++ b/lib/sbi/openapi/model/analytics_subset_any_of.c @@ -0,0 +1,30 @@ + +#include +#include +#include +#include "analytics_subset_any_of.h" + +char* OpenAPI_analytics_subset_any_of_ToString(OpenAPI_analytics_subset_any_of_e analytics_subset_any_of) +{ + const char *analytics_subset_any_ofArray[] = { "NULL", "NUM_OF_UE_REG", "NUM_OF_PDU_SESS_ESTBL", "RES_USAGE", "NUM_OF_EXCEED_RES_USAGE_LOAD_LEVEL_THR", "PERIOD_OF_EXCEED_RES_USAGE_LOAD_LEVEL_THR", "EXCEED_LOAD_LEVEL_THR_IND", "LIST_OF_TOP_APP_UL", "LIST_OF_TOP_APP_DL", "NF_STATUS", "NF_RESOURCE_USAGE", "NF_LOAD", "NF_PEAK_LOAD", "NF_LOAD_AVG_IN_AOI", "DISPER_AMOUNT", "DISPER_CLASS", "RANKING", "PERCENTILE_RANKING", "RSSI", "RTT", "TRAFFIC_INFO", "NUMBER_OF_UES", "APP_LIST_FOR_UE_COMM", "N4_SESS_INACT_TIMER_FOR_UE_COMM", "AVG_TRAFFIC_RATE", "MAX_TRAFFIC_RATE", "AVG_PACKET_DELAY", "MAX_PACKET_DELAY", "AVG_PACKET_LOSS_RATE", "UE_LOCATION", "LIST_OF_HIGH_EXP_UE", "LIST_OF_MEDIUM_EXP_UE", "LIST_OF_LOW_EXP_UE", "AVG_UL_PKT_DROP_RATE", "VAR_UL_PKT_DROP_RATE", "AVG_DL_PKT_DROP_RATE", "VAR_DL_PKT_DROP_RATE", "AVG_UL_PKT_DELAY", "VAR_UL_PKT_DELAY", "AVG_DL_PKT_DELAY", "VAR_DL_PKT_DELAY" }; + size_t sizeofArray = sizeof(analytics_subset_any_ofArray) / sizeof(analytics_subset_any_ofArray[0]); + if (analytics_subset_any_of < sizeofArray) + return (char *)analytics_subset_any_ofArray[analytics_subset_any_of]; + else + return (char *)"Unknown"; +} + +OpenAPI_analytics_subset_any_of_e OpenAPI_analytics_subset_any_of_FromString(char* analytics_subset_any_of) +{ + int stringToReturn = 0; + const char *analytics_subset_any_ofArray[] = { "NULL", "NUM_OF_UE_REG", "NUM_OF_PDU_SESS_ESTBL", "RES_USAGE", "NUM_OF_EXCEED_RES_USAGE_LOAD_LEVEL_THR", "PERIOD_OF_EXCEED_RES_USAGE_LOAD_LEVEL_THR", "EXCEED_LOAD_LEVEL_THR_IND", "LIST_OF_TOP_APP_UL", "LIST_OF_TOP_APP_DL", "NF_STATUS", "NF_RESOURCE_USAGE", "NF_LOAD", "NF_PEAK_LOAD", "NF_LOAD_AVG_IN_AOI", "DISPER_AMOUNT", "DISPER_CLASS", "RANKING", "PERCENTILE_RANKING", "RSSI", "RTT", "TRAFFIC_INFO", "NUMBER_OF_UES", "APP_LIST_FOR_UE_COMM", "N4_SESS_INACT_TIMER_FOR_UE_COMM", "AVG_TRAFFIC_RATE", "MAX_TRAFFIC_RATE", "AVG_PACKET_DELAY", "MAX_PACKET_DELAY", "AVG_PACKET_LOSS_RATE", "UE_LOCATION", "LIST_OF_HIGH_EXP_UE", "LIST_OF_MEDIUM_EXP_UE", "LIST_OF_LOW_EXP_UE", "AVG_UL_PKT_DROP_RATE", "VAR_UL_PKT_DROP_RATE", "AVG_DL_PKT_DROP_RATE", "VAR_DL_PKT_DROP_RATE", "AVG_UL_PKT_DELAY", "VAR_UL_PKT_DELAY", "AVG_DL_PKT_DELAY", "VAR_DL_PKT_DELAY" }; + size_t sizeofArray = sizeof(analytics_subset_any_ofArray) / sizeof(analytics_subset_any_ofArray[0]); + while (stringToReturn < sizeofArray) { + if (strcmp(analytics_subset_any_of, analytics_subset_any_ofArray[stringToReturn]) == 0) { + return stringToReturn; + } + stringToReturn++; + } + return 0; +} + diff --git a/lib/sbi/openapi/model/analytics_subset_any_of.h b/lib/sbi/openapi/model/analytics_subset_any_of.h new file mode 100644 index 000000000..059beb1c8 --- /dev/null +++ b/lib/sbi/openapi/model/analytics_subset_any_of.h @@ -0,0 +1,31 @@ +/* + * analytics_subset_any_of.h + * + * + */ + +#ifndef _OpenAPI_analytics_subset_any_of_H_ +#define _OpenAPI_analytics_subset_any_of_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef enum { OpenAPI_analytics_subset_any_of_NULL = 0, OpenAPI_analytics_subset_any_of_NUM_OF_UE_REG, OpenAPI_analytics_subset_any_of_NUM_OF_PDU_SESS_ESTBL, OpenAPI_analytics_subset_any_of_RES_USAGE, OpenAPI_analytics_subset_any_of_NUM_OF_EXCEED_RES_USAGE_LOAD_LEVEL_THR, OpenAPI_analytics_subset_any_of_PERIOD_OF_EXCEED_RES_USAGE_LOAD_LEVEL_THR, OpenAPI_analytics_subset_any_of_EXCEED_LOAD_LEVEL_THR_IND, OpenAPI_analytics_subset_any_of_LIST_OF_TOP_APP_UL, OpenAPI_analytics_subset_any_of_LIST_OF_TOP_APP_DL, OpenAPI_analytics_subset_any_of_NF_STATUS, OpenAPI_analytics_subset_any_of_NF_RESOURCE_USAGE, OpenAPI_analytics_subset_any_of_NF_LOAD, OpenAPI_analytics_subset_any_of_NF_PEAK_LOAD, OpenAPI_analytics_subset_any_of_NF_LOAD_AVG_IN_AOI, OpenAPI_analytics_subset_any_of_DISPER_AMOUNT, OpenAPI_analytics_subset_any_of_DISPER_CLASS, OpenAPI_analytics_subset_any_of_RANKING, OpenAPI_analytics_subset_any_of_PERCENTILE_RANKING, OpenAPI_analytics_subset_any_of_RSSI, OpenAPI_analytics_subset_any_of_RTT, OpenAPI_analytics_subset_any_of_TRAFFIC_INFO, OpenAPI_analytics_subset_any_of_NUMBER_OF_UES, OpenAPI_analytics_subset_any_of_APP_LIST_FOR_UE_COMM, OpenAPI_analytics_subset_any_of_N4_SESS_INACT_TIMER_FOR_UE_COMM, OpenAPI_analytics_subset_any_of_AVG_TRAFFIC_RATE, OpenAPI_analytics_subset_any_of_MAX_TRAFFIC_RATE, OpenAPI_analytics_subset_any_of_AVG_PACKET_DELAY, OpenAPI_analytics_subset_any_of_MAX_PACKET_DELAY, OpenAPI_analytics_subset_any_of_AVG_PACKET_LOSS_RATE, OpenAPI_analytics_subset_any_of_UE_LOCATION, OpenAPI_analytics_subset_any_of_LIST_OF_HIGH_EXP_UE, OpenAPI_analytics_subset_any_of_LIST_OF_MEDIUM_EXP_UE, OpenAPI_analytics_subset_any_of_LIST_OF_LOW_EXP_UE, OpenAPI_analytics_subset_any_of_AVG_UL_PKT_DROP_RATE, OpenAPI_analytics_subset_any_of_VAR_UL_PKT_DROP_RATE, OpenAPI_analytics_subset_any_of_AVG_DL_PKT_DROP_RATE, OpenAPI_analytics_subset_any_of_VAR_DL_PKT_DROP_RATE, OpenAPI_analytics_subset_any_of_AVG_UL_PKT_DELAY, OpenAPI_analytics_subset_any_of_VAR_UL_PKT_DELAY, OpenAPI_analytics_subset_any_of_AVG_DL_PKT_DELAY, OpenAPI_analytics_subset_any_of_VAR_DL_PKT_DELAY } OpenAPI_analytics_subset_any_of_e; + +char* OpenAPI_analytics_subset_any_of_ToString(OpenAPI_analytics_subset_any_of_e analytics_subset_any_of); + +OpenAPI_analytics_subset_any_of_e OpenAPI_analytics_subset_any_of_FromString(char* analytics_subset_any_of); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_analytics_subset_any_of_H_ */ + diff --git a/lib/sbi/openapi/model/anchor_smf_features.c b/lib/sbi/openapi/model/anchor_smf_features.c new file mode 100644 index 000000000..7bbf17536 --- /dev/null +++ b/lib/sbi/openapi/model/anchor_smf_features.c @@ -0,0 +1,109 @@ + +#include +#include +#include +#include "anchor_smf_features.h" + +OpenAPI_anchor_smf_features_t *OpenAPI_anchor_smf_features_create( + bool is_psetr_support_ind, + int psetr_support_ind +) +{ + OpenAPI_anchor_smf_features_t *anchor_smf_features_local_var = ogs_malloc(sizeof(OpenAPI_anchor_smf_features_t)); + ogs_assert(anchor_smf_features_local_var); + + anchor_smf_features_local_var->is_psetr_support_ind = is_psetr_support_ind; + anchor_smf_features_local_var->psetr_support_ind = psetr_support_ind; + + return anchor_smf_features_local_var; +} + +void OpenAPI_anchor_smf_features_free(OpenAPI_anchor_smf_features_t *anchor_smf_features) +{ + OpenAPI_lnode_t *node = NULL; + + if (NULL == anchor_smf_features) { + return; + } + ogs_free(anchor_smf_features); +} + +cJSON *OpenAPI_anchor_smf_features_convertToJSON(OpenAPI_anchor_smf_features_t *anchor_smf_features) +{ + cJSON *item = NULL; + OpenAPI_lnode_t *node = NULL; + + if (anchor_smf_features == NULL) { + ogs_error("OpenAPI_anchor_smf_features_convertToJSON() failed [AnchorSmfFeatures]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (anchor_smf_features->is_psetr_support_ind) { + if (cJSON_AddBoolToObject(item, "psetrSupportInd", anchor_smf_features->psetr_support_ind) == NULL) { + ogs_error("OpenAPI_anchor_smf_features_convertToJSON() failed [psetr_support_ind]"); + goto end; + } + } + +end: + return item; +} + +OpenAPI_anchor_smf_features_t *OpenAPI_anchor_smf_features_parseFromJSON(cJSON *anchor_smf_featuresJSON) +{ + OpenAPI_anchor_smf_features_t *anchor_smf_features_local_var = NULL; + OpenAPI_lnode_t *node = NULL; + cJSON *psetr_support_ind = NULL; + psetr_support_ind = cJSON_GetObjectItemCaseSensitive(anchor_smf_featuresJSON, "psetrSupportInd"); + if (psetr_support_ind) { + if (!cJSON_IsBool(psetr_support_ind)) { + ogs_error("OpenAPI_anchor_smf_features_parseFromJSON() failed [psetr_support_ind]"); + goto end; + } + } + + anchor_smf_features_local_var = OpenAPI_anchor_smf_features_create ( + psetr_support_ind ? true : false, + psetr_support_ind ? psetr_support_ind->valueint : 0 + ); + + return anchor_smf_features_local_var; +end: + return NULL; +} + +OpenAPI_anchor_smf_features_t *OpenAPI_anchor_smf_features_copy(OpenAPI_anchor_smf_features_t *dst, OpenAPI_anchor_smf_features_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_anchor_smf_features_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_anchor_smf_features_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_anchor_smf_features_free(dst); + dst = OpenAPI_anchor_smf_features_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/anchor_smf_features.h b/lib/sbi/openapi/model/anchor_smf_features.h new file mode 100644 index 000000000..f20fa0e14 --- /dev/null +++ b/lib/sbi/openapi/model/anchor_smf_features.h @@ -0,0 +1,40 @@ +/* + * anchor_smf_features.h + * + * Anchor SMF supported features + */ + +#ifndef _OpenAPI_anchor_smf_features_H_ +#define _OpenAPI_anchor_smf_features_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_anchor_smf_features_s OpenAPI_anchor_smf_features_t; +typedef struct OpenAPI_anchor_smf_features_s { + bool is_psetr_support_ind; + int psetr_support_ind; +} OpenAPI_anchor_smf_features_t; + +OpenAPI_anchor_smf_features_t *OpenAPI_anchor_smf_features_create( + bool is_psetr_support_ind, + int psetr_support_ind +); +void OpenAPI_anchor_smf_features_free(OpenAPI_anchor_smf_features_t *anchor_smf_features); +OpenAPI_anchor_smf_features_t *OpenAPI_anchor_smf_features_parseFromJSON(cJSON *anchor_smf_featuresJSON); +cJSON *OpenAPI_anchor_smf_features_convertToJSON(OpenAPI_anchor_smf_features_t *anchor_smf_features); +OpenAPI_anchor_smf_features_t *OpenAPI_anchor_smf_features_copy(OpenAPI_anchor_smf_features_t *dst, OpenAPI_anchor_smf_features_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_anchor_smf_features_H_ */ + diff --git a/lib/sbi/openapi/model/apn_rate_status.h b/lib/sbi/openapi/model/apn_rate_status.h index 26436434e..30c0fe6d1 100644 --- a/lib/sbi/openapi/model/apn_rate_status.h +++ b/lib/sbi/openapi/model/apn_rate_status.h @@ -1,7 +1,7 @@ /* * apn_rate_status.h * - * + * Contains the APN rate control status e.g. of the AMF. */ #ifndef _OpenAPI_apn_rate_status_H_ diff --git a/lib/sbi/openapi/model/app_descriptor_1.c b/lib/sbi/openapi/model/app_descriptor_1.c new file mode 100644 index 000000000..5e3e78946 --- /dev/null +++ b/lib/sbi/openapi/model/app_descriptor_1.c @@ -0,0 +1,185 @@ + +#include +#include +#include +#include "app_descriptor_1.h" + +OpenAPI_app_descriptor_1_t *OpenAPI_app_descriptor_1_create( + char *os_id, + OpenAPI_list_t* app_ids +) +{ + OpenAPI_app_descriptor_1_t *app_descriptor_1_local_var = ogs_malloc(sizeof(OpenAPI_app_descriptor_1_t)); + ogs_assert(app_descriptor_1_local_var); + + app_descriptor_1_local_var->os_id = os_id; + app_descriptor_1_local_var->app_ids = app_ids; + + return app_descriptor_1_local_var; +} + +void OpenAPI_app_descriptor_1_free(OpenAPI_app_descriptor_1_t *app_descriptor_1) +{ + OpenAPI_lnode_t *node = NULL; + + if (NULL == app_descriptor_1) { + return; + } + if (app_descriptor_1->os_id) { + ogs_free(app_descriptor_1->os_id); + app_descriptor_1->os_id = NULL; + } + if (app_descriptor_1->app_ids) { + OpenAPI_list_for_each(app_descriptor_1->app_ids, node) { + OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*)node->data; + ogs_free(localKeyValue->key); + ogs_free(localKeyValue->value); + OpenAPI_map_free(localKeyValue); + } + OpenAPI_list_free(app_descriptor_1->app_ids); + app_descriptor_1->app_ids = NULL; + } + ogs_free(app_descriptor_1); +} + +cJSON *OpenAPI_app_descriptor_1_convertToJSON(OpenAPI_app_descriptor_1_t *app_descriptor_1) +{ + cJSON *item = NULL; + OpenAPI_lnode_t *node = NULL; + + if (app_descriptor_1 == NULL) { + ogs_error("OpenAPI_app_descriptor_1_convertToJSON() failed [AppDescriptor_1]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (!app_descriptor_1->os_id) { + ogs_error("OpenAPI_app_descriptor_1_convertToJSON() failed [os_id]"); + return NULL; + } + if (cJSON_AddStringToObject(item, "osId", app_descriptor_1->os_id) == NULL) { + ogs_error("OpenAPI_app_descriptor_1_convertToJSON() failed [os_id]"); + goto end; + } + + if (!app_descriptor_1->app_ids) { + ogs_error("OpenAPI_app_descriptor_1_convertToJSON() failed [app_ids]"); + return NULL; + } + cJSON *app_ids = cJSON_AddObjectToObject(item, "appIds"); + if (app_ids == NULL) { + ogs_error("OpenAPI_app_descriptor_1_convertToJSON() failed [app_ids]"); + goto end; + } + cJSON *localMapObject = app_ids; + if (app_descriptor_1->app_ids) { + OpenAPI_list_for_each(app_descriptor_1->app_ids, node) { + OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*)node->data; + if (cJSON_AddStringToObject(localMapObject, localKeyValue->key, (char*)localKeyValue->value) == NULL) { + ogs_error("OpenAPI_app_descriptor_1_convertToJSON() failed [inner]"); + goto end; + } + } + } + +end: + return item; +} + +OpenAPI_app_descriptor_1_t *OpenAPI_app_descriptor_1_parseFromJSON(cJSON *app_descriptor_1JSON) +{ + OpenAPI_app_descriptor_1_t *app_descriptor_1_local_var = NULL; + OpenAPI_lnode_t *node = NULL; + cJSON *os_id = NULL; + cJSON *app_ids = NULL; + OpenAPI_list_t *app_idsList = NULL; + os_id = cJSON_GetObjectItemCaseSensitive(app_descriptor_1JSON, "osId"); + if (!os_id) { + ogs_error("OpenAPI_app_descriptor_1_parseFromJSON() failed [os_id]"); + goto end; + } + if (!cJSON_IsString(os_id)) { + ogs_error("OpenAPI_app_descriptor_1_parseFromJSON() failed [os_id]"); + goto end; + } + + app_ids = cJSON_GetObjectItemCaseSensitive(app_descriptor_1JSON, "appIds"); + if (!app_ids) { + ogs_error("OpenAPI_app_descriptor_1_parseFromJSON() failed [app_ids]"); + goto end; + } + cJSON *app_ids_local_map = NULL; + if (!cJSON_IsObject(app_ids) && !cJSON_IsNull(app_ids)) { + ogs_error("OpenAPI_app_descriptor_1_parseFromJSON() failed [app_ids]"); + goto end; + } + if (cJSON_IsObject(app_ids)) { + app_idsList = OpenAPI_list_create(); + OpenAPI_map_t *localMapKeyPair = NULL; + cJSON_ArrayForEach(app_ids_local_map, app_ids) { + cJSON *localMapObject = app_ids_local_map; + double *localDouble = NULL; + int *localInt = NULL; + if (!cJSON_IsString(localMapObject)) { + ogs_error("OpenAPI_app_descriptor_1_parseFromJSON() failed [inner]"); + goto end; + } + localMapKeyPair = OpenAPI_map_create(ogs_strdup(localMapObject->string), ogs_strdup(localMapObject->valuestring)); + OpenAPI_list_add(app_idsList, localMapKeyPair); + } + } + + app_descriptor_1_local_var = OpenAPI_app_descriptor_1_create ( + ogs_strdup(os_id->valuestring), + app_idsList + ); + + return app_descriptor_1_local_var; +end: + if (app_idsList) { + OpenAPI_list_for_each(app_idsList, node) { + OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*) node->data; + ogs_free(localKeyValue->key); + ogs_free(localKeyValue->value); + OpenAPI_map_free(localKeyValue); + } + OpenAPI_list_free(app_idsList); + app_idsList = NULL; + } + return NULL; +} + +OpenAPI_app_descriptor_1_t *OpenAPI_app_descriptor_1_copy(OpenAPI_app_descriptor_1_t *dst, OpenAPI_app_descriptor_1_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_app_descriptor_1_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_app_descriptor_1_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_app_descriptor_1_free(dst); + dst = OpenAPI_app_descriptor_1_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/app_descriptor_1.h b/lib/sbi/openapi/model/app_descriptor_1.h new file mode 100644 index 000000000..84c9b81d7 --- /dev/null +++ b/lib/sbi/openapi/model/app_descriptor_1.h @@ -0,0 +1,40 @@ +/* + * app_descriptor_1.h + * + * Represents an operation system and the corresponding applications. + */ + +#ifndef _OpenAPI_app_descriptor_1_H_ +#define _OpenAPI_app_descriptor_1_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_app_descriptor_1_s OpenAPI_app_descriptor_1_t; +typedef struct OpenAPI_app_descriptor_1_s { + char *os_id; + OpenAPI_list_t* app_ids; +} OpenAPI_app_descriptor_1_t; + +OpenAPI_app_descriptor_1_t *OpenAPI_app_descriptor_1_create( + char *os_id, + OpenAPI_list_t* app_ids +); +void OpenAPI_app_descriptor_1_free(OpenAPI_app_descriptor_1_t *app_descriptor_1); +OpenAPI_app_descriptor_1_t *OpenAPI_app_descriptor_1_parseFromJSON(cJSON *app_descriptor_1JSON); +cJSON *OpenAPI_app_descriptor_1_convertToJSON(OpenAPI_app_descriptor_1_t *app_descriptor_1); +OpenAPI_app_descriptor_1_t *OpenAPI_app_descriptor_1_copy(OpenAPI_app_descriptor_1_t *dst, OpenAPI_app_descriptor_1_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_app_descriptor_1_H_ */ + diff --git a/lib/sbi/openapi/model/app_detection_info.h b/lib/sbi/openapi/model/app_detection_info.h index 07a6b8bda..b643fe70e 100644 --- a/lib/sbi/openapi/model/app_detection_info.h +++ b/lib/sbi/openapi/model/app_detection_info.h @@ -1,7 +1,7 @@ /* * app_detection_info.h * - * + * Contains the detected application's traffic information. */ #ifndef _OpenAPI_app_detection_info_H_ diff --git a/lib/sbi/openapi/model/app_detection_notif_type.c b/lib/sbi/openapi/model/app_detection_notif_type.c new file mode 100644 index 000000000..fb1cdc890 --- /dev/null +++ b/lib/sbi/openapi/model/app_detection_notif_type.c @@ -0,0 +1,30 @@ + +#include +#include +#include +#include "app_detection_notif_type.h" + +char* OpenAPI_app_detection_notif_type_ToString(OpenAPI_app_detection_notif_type_e app_detection_notif_type) +{ + const char *app_detection_notif_typeArray[] = { "NULL", "APP_START", "APP_STOP" }; + size_t sizeofArray = sizeof(app_detection_notif_typeArray) / sizeof(app_detection_notif_typeArray[0]); + if (app_detection_notif_type < sizeofArray) + return (char *)app_detection_notif_typeArray[app_detection_notif_type]; + else + return (char *)"Unknown"; +} + +OpenAPI_app_detection_notif_type_e OpenAPI_app_detection_notif_type_FromString(char* app_detection_notif_type) +{ + int stringToReturn = 0; + const char *app_detection_notif_typeArray[] = { "NULL", "APP_START", "APP_STOP" }; + size_t sizeofArray = sizeof(app_detection_notif_typeArray) / sizeof(app_detection_notif_typeArray[0]); + while (stringToReturn < sizeofArray) { + if (strcmp(app_detection_notif_type, app_detection_notif_typeArray[stringToReturn]) == 0) { + return stringToReturn; + } + stringToReturn++; + } + return 0; +} + diff --git a/lib/sbi/openapi/model/app_detection_notif_type.h b/lib/sbi/openapi/model/app_detection_notif_type.h new file mode 100644 index 000000000..35cceb308 --- /dev/null +++ b/lib/sbi/openapi/model/app_detection_notif_type.h @@ -0,0 +1,31 @@ +/* + * app_detection_notif_type.h + * + * + */ + +#ifndef _OpenAPI_app_detection_notif_type_H_ +#define _OpenAPI_app_detection_notif_type_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef enum { OpenAPI_app_detection_notif_type_NULL = 0, OpenAPI_app_detection_notif_type_APP_START, OpenAPI_app_detection_notif_type_APP_STOP } OpenAPI_app_detection_notif_type_e; + +char* OpenAPI_app_detection_notif_type_ToString(OpenAPI_app_detection_notif_type_e app_detection_notif_type); + +OpenAPI_app_detection_notif_type_e OpenAPI_app_detection_notif_type_FromString(char* app_detection_notif_type); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_app_detection_notif_type_H_ */ + diff --git a/lib/sbi/openapi/model/app_detection_report.c b/lib/sbi/openapi/model/app_detection_report.c new file mode 100644 index 000000000..1b6a8447d --- /dev/null +++ b/lib/sbi/openapi/model/app_detection_report.c @@ -0,0 +1,139 @@ + +#include +#include +#include +#include "app_detection_report.h" + +OpenAPI_app_detection_report_t *OpenAPI_app_detection_report_create( + OpenAPI_app_detection_notif_type_e ad_notif_type, + char *af_app_id +) +{ + OpenAPI_app_detection_report_t *app_detection_report_local_var = ogs_malloc(sizeof(OpenAPI_app_detection_report_t)); + ogs_assert(app_detection_report_local_var); + + app_detection_report_local_var->ad_notif_type = ad_notif_type; + app_detection_report_local_var->af_app_id = af_app_id; + + return app_detection_report_local_var; +} + +void OpenAPI_app_detection_report_free(OpenAPI_app_detection_report_t *app_detection_report) +{ + OpenAPI_lnode_t *node = NULL; + + if (NULL == app_detection_report) { + return; + } + if (app_detection_report->af_app_id) { + ogs_free(app_detection_report->af_app_id); + app_detection_report->af_app_id = NULL; + } + ogs_free(app_detection_report); +} + +cJSON *OpenAPI_app_detection_report_convertToJSON(OpenAPI_app_detection_report_t *app_detection_report) +{ + cJSON *item = NULL; + OpenAPI_lnode_t *node = NULL; + + if (app_detection_report == NULL) { + ogs_error("OpenAPI_app_detection_report_convertToJSON() failed [AppDetectionReport]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (app_detection_report->ad_notif_type == OpenAPI_app_detection_notif_type_NULL) { + ogs_error("OpenAPI_app_detection_report_convertToJSON() failed [ad_notif_type]"); + return NULL; + } + if (cJSON_AddStringToObject(item, "adNotifType", OpenAPI_app_detection_notif_type_ToString(app_detection_report->ad_notif_type)) == NULL) { + ogs_error("OpenAPI_app_detection_report_convertToJSON() failed [ad_notif_type]"); + goto end; + } + + if (!app_detection_report->af_app_id) { + ogs_error("OpenAPI_app_detection_report_convertToJSON() failed [af_app_id]"); + return NULL; + } + if (cJSON_AddStringToObject(item, "afAppId", app_detection_report->af_app_id) == NULL) { + ogs_error("OpenAPI_app_detection_report_convertToJSON() failed [af_app_id]"); + goto end; + } + +end: + return item; +} + +OpenAPI_app_detection_report_t *OpenAPI_app_detection_report_parseFromJSON(cJSON *app_detection_reportJSON) +{ + OpenAPI_app_detection_report_t *app_detection_report_local_var = NULL; + OpenAPI_lnode_t *node = NULL; + cJSON *ad_notif_type = NULL; + OpenAPI_app_detection_notif_type_e ad_notif_typeVariable = 0; + cJSON *af_app_id = NULL; + ad_notif_type = cJSON_GetObjectItemCaseSensitive(app_detection_reportJSON, "adNotifType"); + if (!ad_notif_type) { + ogs_error("OpenAPI_app_detection_report_parseFromJSON() failed [ad_notif_type]"); + goto end; + } + if (!cJSON_IsString(ad_notif_type)) { + ogs_error("OpenAPI_app_detection_report_parseFromJSON() failed [ad_notif_type]"); + goto end; + } + ad_notif_typeVariable = OpenAPI_app_detection_notif_type_FromString(ad_notif_type->valuestring); + + af_app_id = cJSON_GetObjectItemCaseSensitive(app_detection_reportJSON, "afAppId"); + if (!af_app_id) { + ogs_error("OpenAPI_app_detection_report_parseFromJSON() failed [af_app_id]"); + goto end; + } + if (!cJSON_IsString(af_app_id)) { + ogs_error("OpenAPI_app_detection_report_parseFromJSON() failed [af_app_id]"); + goto end; + } + + app_detection_report_local_var = OpenAPI_app_detection_report_create ( + ad_notif_typeVariable, + ogs_strdup(af_app_id->valuestring) + ); + + return app_detection_report_local_var; +end: + return NULL; +} + +OpenAPI_app_detection_report_t *OpenAPI_app_detection_report_copy(OpenAPI_app_detection_report_t *dst, OpenAPI_app_detection_report_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_app_detection_report_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_app_detection_report_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_app_detection_report_free(dst); + dst = OpenAPI_app_detection_report_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/app_detection_report.h b/lib/sbi/openapi/model/app_detection_report.h new file mode 100644 index 000000000..bb9b4c8b6 --- /dev/null +++ b/lib/sbi/openapi/model/app_detection_report.h @@ -0,0 +1,41 @@ +/* + * app_detection_report.h + * + * Indicates the start or stop of the detected application traffic and the application identifier of the detected application traffic. + */ + +#ifndef _OpenAPI_app_detection_report_H_ +#define _OpenAPI_app_detection_report_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "app_detection_notif_type.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_app_detection_report_s OpenAPI_app_detection_report_t; +typedef struct OpenAPI_app_detection_report_s { + OpenAPI_app_detection_notif_type_e ad_notif_type; + char *af_app_id; +} OpenAPI_app_detection_report_t; + +OpenAPI_app_detection_report_t *OpenAPI_app_detection_report_create( + OpenAPI_app_detection_notif_type_e ad_notif_type, + char *af_app_id +); +void OpenAPI_app_detection_report_free(OpenAPI_app_detection_report_t *app_detection_report); +OpenAPI_app_detection_report_t *OpenAPI_app_detection_report_parseFromJSON(cJSON *app_detection_reportJSON); +cJSON *OpenAPI_app_detection_report_convertToJSON(OpenAPI_app_detection_report_t *app_detection_report); +OpenAPI_app_detection_report_t *OpenAPI_app_detection_report_copy(OpenAPI_app_detection_report_t *dst, OpenAPI_app_detection_report_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_app_detection_report_H_ */ + diff --git a/lib/sbi/openapi/model/app_list_for_ue_comm.c b/lib/sbi/openapi/model/app_list_for_ue_comm.c new file mode 100644 index 000000000..cb801559a --- /dev/null +++ b/lib/sbi/openapi/model/app_list_for_ue_comm.c @@ -0,0 +1,212 @@ + +#include +#include +#include +#include "app_list_for_ue_comm.h" + +OpenAPI_app_list_for_ue_comm_t *OpenAPI_app_list_for_ue_comm_create( + char *app_id, + char *start_time, + bool is_app_dur, + int app_dur, + bool is_occur_ratio, + int occur_ratio, + OpenAPI_network_area_info_t *spatial_validity +) +{ + OpenAPI_app_list_for_ue_comm_t *app_list_for_ue_comm_local_var = ogs_malloc(sizeof(OpenAPI_app_list_for_ue_comm_t)); + ogs_assert(app_list_for_ue_comm_local_var); + + app_list_for_ue_comm_local_var->app_id = app_id; + app_list_for_ue_comm_local_var->start_time = start_time; + app_list_for_ue_comm_local_var->is_app_dur = is_app_dur; + app_list_for_ue_comm_local_var->app_dur = app_dur; + app_list_for_ue_comm_local_var->is_occur_ratio = is_occur_ratio; + app_list_for_ue_comm_local_var->occur_ratio = occur_ratio; + app_list_for_ue_comm_local_var->spatial_validity = spatial_validity; + + return app_list_for_ue_comm_local_var; +} + +void OpenAPI_app_list_for_ue_comm_free(OpenAPI_app_list_for_ue_comm_t *app_list_for_ue_comm) +{ + OpenAPI_lnode_t *node = NULL; + + if (NULL == app_list_for_ue_comm) { + return; + } + if (app_list_for_ue_comm->app_id) { + ogs_free(app_list_for_ue_comm->app_id); + app_list_for_ue_comm->app_id = NULL; + } + if (app_list_for_ue_comm->start_time) { + ogs_free(app_list_for_ue_comm->start_time); + app_list_for_ue_comm->start_time = NULL; + } + if (app_list_for_ue_comm->spatial_validity) { + OpenAPI_network_area_info_free(app_list_for_ue_comm->spatial_validity); + app_list_for_ue_comm->spatial_validity = NULL; + } + ogs_free(app_list_for_ue_comm); +} + +cJSON *OpenAPI_app_list_for_ue_comm_convertToJSON(OpenAPI_app_list_for_ue_comm_t *app_list_for_ue_comm) +{ + cJSON *item = NULL; + OpenAPI_lnode_t *node = NULL; + + if (app_list_for_ue_comm == NULL) { + ogs_error("OpenAPI_app_list_for_ue_comm_convertToJSON() failed [AppListForUeComm]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (!app_list_for_ue_comm->app_id) { + ogs_error("OpenAPI_app_list_for_ue_comm_convertToJSON() failed [app_id]"); + return NULL; + } + if (cJSON_AddStringToObject(item, "appId", app_list_for_ue_comm->app_id) == NULL) { + ogs_error("OpenAPI_app_list_for_ue_comm_convertToJSON() failed [app_id]"); + goto end; + } + + if (app_list_for_ue_comm->start_time) { + if (cJSON_AddStringToObject(item, "startTime", app_list_for_ue_comm->start_time) == NULL) { + ogs_error("OpenAPI_app_list_for_ue_comm_convertToJSON() failed [start_time]"); + goto end; + } + } + + if (app_list_for_ue_comm->is_app_dur) { + if (cJSON_AddNumberToObject(item, "appDur", app_list_for_ue_comm->app_dur) == NULL) { + ogs_error("OpenAPI_app_list_for_ue_comm_convertToJSON() failed [app_dur]"); + goto end; + } + } + + if (app_list_for_ue_comm->is_occur_ratio) { + if (cJSON_AddNumberToObject(item, "occurRatio", app_list_for_ue_comm->occur_ratio) == NULL) { + ogs_error("OpenAPI_app_list_for_ue_comm_convertToJSON() failed [occur_ratio]"); + goto end; + } + } + + if (app_list_for_ue_comm->spatial_validity) { + cJSON *spatial_validity_local_JSON = OpenAPI_network_area_info_convertToJSON(app_list_for_ue_comm->spatial_validity); + if (spatial_validity_local_JSON == NULL) { + ogs_error("OpenAPI_app_list_for_ue_comm_convertToJSON() failed [spatial_validity]"); + goto end; + } + cJSON_AddItemToObject(item, "spatialValidity", spatial_validity_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_app_list_for_ue_comm_convertToJSON() failed [spatial_validity]"); + goto end; + } + } + +end: + return item; +} + +OpenAPI_app_list_for_ue_comm_t *OpenAPI_app_list_for_ue_comm_parseFromJSON(cJSON *app_list_for_ue_commJSON) +{ + OpenAPI_app_list_for_ue_comm_t *app_list_for_ue_comm_local_var = NULL; + OpenAPI_lnode_t *node = NULL; + cJSON *app_id = NULL; + cJSON *start_time = NULL; + cJSON *app_dur = NULL; + cJSON *occur_ratio = NULL; + cJSON *spatial_validity = NULL; + OpenAPI_network_area_info_t *spatial_validity_local_nonprim = NULL; + app_id = cJSON_GetObjectItemCaseSensitive(app_list_for_ue_commJSON, "appId"); + if (!app_id) { + ogs_error("OpenAPI_app_list_for_ue_comm_parseFromJSON() failed [app_id]"); + goto end; + } + if (!cJSON_IsString(app_id)) { + ogs_error("OpenAPI_app_list_for_ue_comm_parseFromJSON() failed [app_id]"); + goto end; + } + + start_time = cJSON_GetObjectItemCaseSensitive(app_list_for_ue_commJSON, "startTime"); + if (start_time) { + if (!cJSON_IsString(start_time) && !cJSON_IsNull(start_time)) { + ogs_error("OpenAPI_app_list_for_ue_comm_parseFromJSON() failed [start_time]"); + goto end; + } + } + + app_dur = cJSON_GetObjectItemCaseSensitive(app_list_for_ue_commJSON, "appDur"); + if (app_dur) { + if (!cJSON_IsNumber(app_dur)) { + ogs_error("OpenAPI_app_list_for_ue_comm_parseFromJSON() failed [app_dur]"); + goto end; + } + } + + occur_ratio = cJSON_GetObjectItemCaseSensitive(app_list_for_ue_commJSON, "occurRatio"); + if (occur_ratio) { + if (!cJSON_IsNumber(occur_ratio)) { + ogs_error("OpenAPI_app_list_for_ue_comm_parseFromJSON() failed [occur_ratio]"); + goto end; + } + } + + spatial_validity = cJSON_GetObjectItemCaseSensitive(app_list_for_ue_commJSON, "spatialValidity"); + if (spatial_validity) { + spatial_validity_local_nonprim = OpenAPI_network_area_info_parseFromJSON(spatial_validity); + } + + app_list_for_ue_comm_local_var = OpenAPI_app_list_for_ue_comm_create ( + ogs_strdup(app_id->valuestring), + start_time && !cJSON_IsNull(start_time) ? ogs_strdup(start_time->valuestring) : NULL, + app_dur ? true : false, + app_dur ? app_dur->valuedouble : 0, + occur_ratio ? true : false, + occur_ratio ? occur_ratio->valuedouble : 0, + spatial_validity ? spatial_validity_local_nonprim : NULL + ); + + return app_list_for_ue_comm_local_var; +end: + if (spatial_validity_local_nonprim) { + OpenAPI_network_area_info_free(spatial_validity_local_nonprim); + spatial_validity_local_nonprim = NULL; + } + return NULL; +} + +OpenAPI_app_list_for_ue_comm_t *OpenAPI_app_list_for_ue_comm_copy(OpenAPI_app_list_for_ue_comm_t *dst, OpenAPI_app_list_for_ue_comm_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_app_list_for_ue_comm_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_app_list_for_ue_comm_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_app_list_for_ue_comm_free(dst); + dst = OpenAPI_app_list_for_ue_comm_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/app_list_for_ue_comm.h b/lib/sbi/openapi/model/app_list_for_ue_comm.h new file mode 100644 index 000000000..c0ec3727a --- /dev/null +++ b/lib/sbi/openapi/model/app_list_for_ue_comm.h @@ -0,0 +1,51 @@ +/* + * app_list_for_ue_comm.h + * + * Represents the analytics of the application list used by UE. + */ + +#ifndef _OpenAPI_app_list_for_ue_comm_H_ +#define _OpenAPI_app_list_for_ue_comm_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "network_area_info.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_app_list_for_ue_comm_s OpenAPI_app_list_for_ue_comm_t; +typedef struct OpenAPI_app_list_for_ue_comm_s { + char *app_id; + char *start_time; + bool is_app_dur; + int app_dur; + bool is_occur_ratio; + int occur_ratio; + struct OpenAPI_network_area_info_s *spatial_validity; +} OpenAPI_app_list_for_ue_comm_t; + +OpenAPI_app_list_for_ue_comm_t *OpenAPI_app_list_for_ue_comm_create( + char *app_id, + char *start_time, + bool is_app_dur, + int app_dur, + bool is_occur_ratio, + int occur_ratio, + OpenAPI_network_area_info_t *spatial_validity +); +void OpenAPI_app_list_for_ue_comm_free(OpenAPI_app_list_for_ue_comm_t *app_list_for_ue_comm); +OpenAPI_app_list_for_ue_comm_t *OpenAPI_app_list_for_ue_comm_parseFromJSON(cJSON *app_list_for_ue_commJSON); +cJSON *OpenAPI_app_list_for_ue_comm_convertToJSON(OpenAPI_app_list_for_ue_comm_t *app_list_for_ue_comm); +OpenAPI_app_list_for_ue_comm_t *OpenAPI_app_list_for_ue_comm_copy(OpenAPI_app_list_for_ue_comm_t *dst, OpenAPI_app_list_for_ue_comm_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_app_list_for_ue_comm_H_ */ + diff --git a/lib/sbi/openapi/model/app_session_context_req_data.c b/lib/sbi/openapi/model/app_session_context_req_data.c index 75de48825..37e3194ee 100644 --- a/lib/sbi/openapi/model/app_session_context_req_data.c +++ b/lib/sbi/openapi/model/app_session_context_req_data.c @@ -17,6 +17,7 @@ OpenAPI_app_session_context_req_data_t *OpenAPI_app_session_context_req_data_cre char *mc_video_id, OpenAPI_list_t* med_components, char *ip_domain, + OpenAPI_mps_action_e mps_action, char *mps_id, char *mcs_id, OpenAPI_preemption_control_information_e preempt_control_info, @@ -53,6 +54,7 @@ OpenAPI_app_session_context_req_data_t *OpenAPI_app_session_context_req_data_cre app_session_context_req_data_local_var->mc_video_id = mc_video_id; app_session_context_req_data_local_var->med_components = med_components; app_session_context_req_data_local_var->ip_domain = ip_domain; + app_session_context_req_data_local_var->mps_action = mps_action; app_session_context_req_data_local_var->mps_id = mps_id; app_session_context_req_data_local_var->mcs_id = mcs_id; app_session_context_req_data_local_var->preempt_control_info = preempt_control_info; @@ -321,6 +323,13 @@ cJSON *OpenAPI_app_session_context_req_data_convertToJSON(OpenAPI_app_session_co } } + if (app_session_context_req_data->mps_action != OpenAPI_mps_action_NULL) { + if (cJSON_AddStringToObject(item, "mpsAction", OpenAPI_mps_action_ToString(app_session_context_req_data->mps_action)) == NULL) { + ogs_error("OpenAPI_app_session_context_req_data_convertToJSON() failed [mps_action]"); + goto end; + } + } + if (app_session_context_req_data->mps_id) { if (cJSON_AddStringToObject(item, "mpsId", app_session_context_req_data->mps_id) == NULL) { ogs_error("OpenAPI_app_session_context_req_data_convertToJSON() failed [mps_id]"); @@ -509,6 +518,8 @@ OpenAPI_app_session_context_req_data_t *OpenAPI_app_session_context_req_data_par cJSON *med_components = NULL; OpenAPI_list_t *med_componentsList = NULL; cJSON *ip_domain = NULL; + cJSON *mps_action = NULL; + OpenAPI_mps_action_e mps_actionVariable = 0; cJSON *mps_id = NULL; cJSON *mcs_id = NULL; cJSON *preempt_control_info = NULL; @@ -645,6 +656,15 @@ OpenAPI_app_session_context_req_data_t *OpenAPI_app_session_context_req_data_par } } + mps_action = cJSON_GetObjectItemCaseSensitive(app_session_context_req_dataJSON, "mpsAction"); + if (mps_action) { + if (!cJSON_IsString(mps_action)) { + ogs_error("OpenAPI_app_session_context_req_data_parseFromJSON() failed [mps_action]"); + goto end; + } + mps_actionVariable = OpenAPI_mps_action_FromString(mps_action->valuestring); + } + mps_id = cJSON_GetObjectItemCaseSensitive(app_session_context_req_dataJSON, "mpsId"); if (mps_id) { if (!cJSON_IsString(mps_id) && !cJSON_IsNull(mps_id)) { @@ -826,6 +846,7 @@ OpenAPI_app_session_context_req_data_t *OpenAPI_app_session_context_req_data_par mc_video_id && !cJSON_IsNull(mc_video_id) ? ogs_strdup(mc_video_id->valuestring) : NULL, med_components ? med_componentsList : NULL, ip_domain && !cJSON_IsNull(ip_domain) ? ogs_strdup(ip_domain->valuestring) : NULL, + mps_action ? mps_actionVariable : 0, mps_id && !cJSON_IsNull(mps_id) ? ogs_strdup(mps_id->valuestring) : NULL, mcs_id && !cJSON_IsNull(mcs_id) ? ogs_strdup(mcs_id->valuestring) : NULL, preempt_control_info ? preempt_control_infoVariable : 0, diff --git a/lib/sbi/openapi/model/app_session_context_req_data.h b/lib/sbi/openapi/model/app_session_context_req_data.h index 878653eef..2319142c1 100644 --- a/lib/sbi/openapi/model/app_session_context_req_data.h +++ b/lib/sbi/openapi/model/app_session_context_req_data.h @@ -17,6 +17,7 @@ #include "bridge_management_container.h" #include "events_subsc_req_data.h" #include "media_component.h" +#include "mps_action.h" #include "port_management_container.h" #include "preemption_control_information.h" #include "reserv_priority.h" @@ -42,6 +43,7 @@ typedef struct OpenAPI_app_session_context_req_data_s { char *mc_video_id; OpenAPI_list_t* med_components; char *ip_domain; + OpenAPI_mps_action_e mps_action; char *mps_id; char *mcs_id; OpenAPI_preemption_control_information_e preempt_control_info; @@ -76,6 +78,7 @@ OpenAPI_app_session_context_req_data_t *OpenAPI_app_session_context_req_data_cre char *mc_video_id, OpenAPI_list_t* med_components, char *ip_domain, + OpenAPI_mps_action_e mps_action, char *mps_id, char *mcs_id, OpenAPI_preemption_control_information_e preempt_control_info, diff --git a/lib/sbi/openapi/model/app_session_context_update_data.c b/lib/sbi/openapi/model/app_session_context_update_data.c index 30d0e9937..e65133ff9 100644 --- a/lib/sbi/openapi/model/app_session_context_update_data.c +++ b/lib/sbi/openapi/model/app_session_context_update_data.c @@ -13,6 +13,7 @@ OpenAPI_app_session_context_update_data_t *OpenAPI_app_session_context_update_da char *mcptt_id, char *mc_video_id, OpenAPI_list_t* med_components, + OpenAPI_mps_action_e mps_action, char *mps_id, char *mcs_id, OpenAPI_preemption_control_information_rm_t *preempt_control_info, @@ -37,6 +38,7 @@ OpenAPI_app_session_context_update_data_t *OpenAPI_app_session_context_update_da app_session_context_update_data_local_var->mcptt_id = mcptt_id; app_session_context_update_data_local_var->mc_video_id = mc_video_id; app_session_context_update_data_local_var->med_components = med_components; + app_session_context_update_data_local_var->mps_action = mps_action; app_session_context_update_data_local_var->mps_id = mps_id; app_session_context_update_data_local_var->mcs_id = mcs_id; app_session_context_update_data_local_var->preempt_control_info = preempt_control_info; @@ -225,6 +227,13 @@ cJSON *OpenAPI_app_session_context_update_data_convertToJSON(OpenAPI_app_session } } + if (app_session_context_update_data->mps_action != OpenAPI_mps_action_NULL) { + if (cJSON_AddStringToObject(item, "mpsAction", OpenAPI_mps_action_ToString(app_session_context_update_data->mps_action)) == NULL) { + ogs_error("OpenAPI_app_session_context_update_data_convertToJSON() failed [mps_action]"); + goto end; + } + } + if (app_session_context_update_data->mps_id) { if (cJSON_AddStringToObject(item, "mpsId", app_session_context_update_data->mps_id) == NULL) { ogs_error("OpenAPI_app_session_context_update_data_convertToJSON() failed [mps_id]"); @@ -348,6 +357,8 @@ OpenAPI_app_session_context_update_data_t *OpenAPI_app_session_context_update_da cJSON *mc_video_id = NULL; cJSON *med_components = NULL; OpenAPI_list_t *med_componentsList = NULL; + cJSON *mps_action = NULL; + OpenAPI_mps_action_e mps_actionVariable = 0; cJSON *mps_id = NULL; cJSON *mcs_id = NULL; cJSON *preempt_control_info = NULL; @@ -443,6 +454,15 @@ OpenAPI_app_session_context_update_data_t *OpenAPI_app_session_context_update_da } } + mps_action = cJSON_GetObjectItemCaseSensitive(app_session_context_update_dataJSON, "mpsAction"); + if (mps_action) { + if (!cJSON_IsString(mps_action)) { + ogs_error("OpenAPI_app_session_context_update_data_parseFromJSON() failed [mps_action]"); + goto end; + } + mps_actionVariable = OpenAPI_mps_action_FromString(mps_action->valuestring); + } + mps_id = cJSON_GetObjectItemCaseSensitive(app_session_context_update_dataJSON, "mpsId"); if (mps_id) { if (!cJSON_IsString(mps_id) && !cJSON_IsNull(mps_id)) { @@ -552,6 +572,7 @@ OpenAPI_app_session_context_update_data_t *OpenAPI_app_session_context_update_da mcptt_id && !cJSON_IsNull(mcptt_id) ? ogs_strdup(mcptt_id->valuestring) : NULL, mc_video_id && !cJSON_IsNull(mc_video_id) ? ogs_strdup(mc_video_id->valuestring) : NULL, med_components ? med_componentsList : NULL, + mps_action ? mps_actionVariable : 0, mps_id && !cJSON_IsNull(mps_id) ? ogs_strdup(mps_id->valuestring) : NULL, mcs_id && !cJSON_IsNull(mcs_id) ? ogs_strdup(mcs_id->valuestring) : NULL, preempt_control_info ? preempt_control_info_local_nonprim : NULL, diff --git a/lib/sbi/openapi/model/app_session_context_update_data.h b/lib/sbi/openapi/model/app_session_context_update_data.h index 823407126..c37eae464 100644 --- a/lib/sbi/openapi/model/app_session_context_update_data.h +++ b/lib/sbi/openapi/model/app_session_context_update_data.h @@ -1,7 +1,7 @@ /* * app_session_context_update_data.h * - * Identifies the modifications to the \"ascReqData\" property of an Individual Application Session Context which may include the modifications to the sub-resource Events Subscription. + * Identifies the modifications to the \"ascReqData\" property of an Individual Application Session Context which may include the modifications to the sub-resource Events Subscription. */ #ifndef _OpenAPI_app_session_context_update_data_H_ @@ -16,6 +16,7 @@ #include "bridge_management_container.h" #include "events_subsc_req_data_rm.h" #include "media_component_rm.h" +#include "mps_action.h" #include "port_management_container.h" #include "preemption_control_information_rm.h" #include "reserv_priority.h" @@ -37,6 +38,7 @@ typedef struct OpenAPI_app_session_context_update_data_s { char *mcptt_id; char *mc_video_id; OpenAPI_list_t* med_components; + OpenAPI_mps_action_e mps_action; char *mps_id; char *mcs_id; struct OpenAPI_preemption_control_information_rm_s *preempt_control_info; @@ -59,6 +61,7 @@ OpenAPI_app_session_context_update_data_t *OpenAPI_app_session_context_update_da char *mcptt_id, char *mc_video_id, OpenAPI_list_t* med_components, + OpenAPI_mps_action_e mps_action, char *mps_id, char *mcs_id, OpenAPI_preemption_control_information_rm_t *preempt_control_info, diff --git a/lib/sbi/openapi/model/application_data_change_notif.c b/lib/sbi/openapi/model/application_data_change_notif.c index 48336e533..81afea1db 100644 --- a/lib/sbi/openapi/model/application_data_change_notif.c +++ b/lib/sbi/openapi/model/application_data_change_notif.c @@ -9,7 +9,8 @@ OpenAPI_application_data_change_notif_t *OpenAPI_application_data_change_notif_c OpenAPI_pfd_change_notification_t *pfd_data, OpenAPI_bdt_policy_data_t *bdt_policy_data, char *res_uri, - OpenAPI_service_parameter_data_t *ser_param_data + OpenAPI_service_parameter_data_t *ser_param_data, + OpenAPI_am_influ_data_t *am_influ_data ) { OpenAPI_application_data_change_notif_t *application_data_change_notif_local_var = ogs_malloc(sizeof(OpenAPI_application_data_change_notif_t)); @@ -20,6 +21,7 @@ OpenAPI_application_data_change_notif_t *OpenAPI_application_data_change_notif_c application_data_change_notif_local_var->bdt_policy_data = bdt_policy_data; application_data_change_notif_local_var->res_uri = res_uri; application_data_change_notif_local_var->ser_param_data = ser_param_data; + application_data_change_notif_local_var->am_influ_data = am_influ_data; return application_data_change_notif_local_var; } @@ -51,6 +53,10 @@ void OpenAPI_application_data_change_notif_free(OpenAPI_application_data_change_ OpenAPI_service_parameter_data_free(application_data_change_notif->ser_param_data); application_data_change_notif->ser_param_data = NULL; } + if (application_data_change_notif->am_influ_data) { + OpenAPI_am_influ_data_free(application_data_change_notif->am_influ_data); + application_data_change_notif->am_influ_data = NULL; + } ogs_free(application_data_change_notif); } @@ -126,6 +132,19 @@ cJSON *OpenAPI_application_data_change_notif_convertToJSON(OpenAPI_application_d } } + if (application_data_change_notif->am_influ_data) { + cJSON *am_influ_data_local_JSON = OpenAPI_am_influ_data_convertToJSON(application_data_change_notif->am_influ_data); + if (am_influ_data_local_JSON == NULL) { + ogs_error("OpenAPI_application_data_change_notif_convertToJSON() failed [am_influ_data]"); + goto end; + } + cJSON_AddItemToObject(item, "amInfluData", am_influ_data_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_application_data_change_notif_convertToJSON() failed [am_influ_data]"); + goto end; + } + } + end: return item; } @@ -143,6 +162,8 @@ OpenAPI_application_data_change_notif_t *OpenAPI_application_data_change_notif_p cJSON *res_uri = NULL; cJSON *ser_param_data = NULL; OpenAPI_service_parameter_data_t *ser_param_data_local_nonprim = NULL; + cJSON *am_influ_data = NULL; + OpenAPI_am_influ_data_t *am_influ_data_local_nonprim = NULL; iptv_config_data = cJSON_GetObjectItemCaseSensitive(application_data_change_notifJSON, "iptvConfigData"); if (iptv_config_data) { iptv_config_data_local_nonprim = OpenAPI_iptv_config_data_parseFromJSON(iptv_config_data); @@ -173,12 +194,18 @@ OpenAPI_application_data_change_notif_t *OpenAPI_application_data_change_notif_p ser_param_data_local_nonprim = OpenAPI_service_parameter_data_parseFromJSON(ser_param_data); } + am_influ_data = cJSON_GetObjectItemCaseSensitive(application_data_change_notifJSON, "amInfluData"); + if (am_influ_data) { + am_influ_data_local_nonprim = OpenAPI_am_influ_data_parseFromJSON(am_influ_data); + } + application_data_change_notif_local_var = OpenAPI_application_data_change_notif_create ( iptv_config_data ? iptv_config_data_local_nonprim : NULL, pfd_data ? pfd_data_local_nonprim : NULL, bdt_policy_data ? bdt_policy_data_local_nonprim : NULL, ogs_strdup(res_uri->valuestring), - ser_param_data ? ser_param_data_local_nonprim : NULL + ser_param_data ? ser_param_data_local_nonprim : NULL, + am_influ_data ? am_influ_data_local_nonprim : NULL ); return application_data_change_notif_local_var; @@ -199,6 +226,10 @@ end: OpenAPI_service_parameter_data_free(ser_param_data_local_nonprim); ser_param_data_local_nonprim = NULL; } + if (am_influ_data_local_nonprim) { + OpenAPI_am_influ_data_free(am_influ_data_local_nonprim); + am_influ_data_local_nonprim = NULL; + } return NULL; } diff --git a/lib/sbi/openapi/model/application_data_change_notif.h b/lib/sbi/openapi/model/application_data_change_notif.h index 20059a881..ccb4fd22b 100644 --- a/lib/sbi/openapi/model/application_data_change_notif.h +++ b/lib/sbi/openapi/model/application_data_change_notif.h @@ -12,6 +12,7 @@ #include "../include/list.h" #include "../include/keyValuePair.h" #include "../include/binary.h" +#include "am_influ_data.h" #include "bdt_policy_data.h" #include "iptv_config_data.h" #include "pfd_change_notification.h" @@ -28,6 +29,7 @@ typedef struct OpenAPI_application_data_change_notif_s { struct OpenAPI_bdt_policy_data_s *bdt_policy_data; char *res_uri; struct OpenAPI_service_parameter_data_s *ser_param_data; + struct OpenAPI_am_influ_data_s *am_influ_data; } OpenAPI_application_data_change_notif_t; OpenAPI_application_data_change_notif_t *OpenAPI_application_data_change_notif_create( @@ -35,7 +37,8 @@ OpenAPI_application_data_change_notif_t *OpenAPI_application_data_change_notif_c OpenAPI_pfd_change_notification_t *pfd_data, OpenAPI_bdt_policy_data_t *bdt_policy_data, char *res_uri, - OpenAPI_service_parameter_data_t *ser_param_data + OpenAPI_service_parameter_data_t *ser_param_data, + OpenAPI_am_influ_data_t *am_influ_data ); void OpenAPI_application_data_change_notif_free(OpenAPI_application_data_change_notif_t *application_data_change_notif); OpenAPI_application_data_change_notif_t *OpenAPI_application_data_change_notif_parseFromJSON(cJSON *application_data_change_notifJSON); diff --git a/lib/sbi/openapi/model/application_data_subs.c b/lib/sbi/openapi/model/application_data_subs.c index 3e95f4a77..ec6f5f14b 100644 --- a/lib/sbi/openapi/model/application_data_subs.c +++ b/lib/sbi/openapi/model/application_data_subs.c @@ -8,7 +8,11 @@ OpenAPI_application_data_subs_t *OpenAPI_application_data_subs_create( char *notification_uri, OpenAPI_list_t *data_filters, char *expiry, - char *supported_features + bool is_imm_rep, + int imm_rep, + OpenAPI_list_t *am_influ_entries, + char *supported_features, + OpenAPI_list_t *reset_ids ) { OpenAPI_application_data_subs_t *application_data_subs_local_var = ogs_malloc(sizeof(OpenAPI_application_data_subs_t)); @@ -17,7 +21,11 @@ OpenAPI_application_data_subs_t *OpenAPI_application_data_subs_create( application_data_subs_local_var->notification_uri = notification_uri; application_data_subs_local_var->data_filters = data_filters; application_data_subs_local_var->expiry = expiry; + application_data_subs_local_var->is_imm_rep = is_imm_rep; + application_data_subs_local_var->imm_rep = imm_rep; + application_data_subs_local_var->am_influ_entries = am_influ_entries; application_data_subs_local_var->supported_features = supported_features; + application_data_subs_local_var->reset_ids = reset_ids; return application_data_subs_local_var; } @@ -44,10 +52,24 @@ void OpenAPI_application_data_subs_free(OpenAPI_application_data_subs_t *applica ogs_free(application_data_subs->expiry); application_data_subs->expiry = NULL; } + if (application_data_subs->am_influ_entries) { + OpenAPI_list_for_each(application_data_subs->am_influ_entries, node) { + OpenAPI_am_influ_data_free(node->data); + } + OpenAPI_list_free(application_data_subs->am_influ_entries); + application_data_subs->am_influ_entries = NULL; + } if (application_data_subs->supported_features) { ogs_free(application_data_subs->supported_features); application_data_subs->supported_features = NULL; } + if (application_data_subs->reset_ids) { + OpenAPI_list_for_each(application_data_subs->reset_ids, node) { + ogs_free(node->data); + } + OpenAPI_list_free(application_data_subs->reset_ids); + application_data_subs->reset_ids = NULL; + } ogs_free(application_data_subs); } @@ -94,6 +116,29 @@ cJSON *OpenAPI_application_data_subs_convertToJSON(OpenAPI_application_data_subs } } + if (application_data_subs->is_imm_rep) { + if (cJSON_AddBoolToObject(item, "immRep", application_data_subs->imm_rep) == NULL) { + ogs_error("OpenAPI_application_data_subs_convertToJSON() failed [imm_rep]"); + goto end; + } + } + + if (application_data_subs->am_influ_entries) { + cJSON *am_influ_entriesList = cJSON_AddArrayToObject(item, "amInfluEntries"); + if (am_influ_entriesList == NULL) { + ogs_error("OpenAPI_application_data_subs_convertToJSON() failed [am_influ_entries]"); + goto end; + } + OpenAPI_list_for_each(application_data_subs->am_influ_entries, node) { + cJSON *itemLocal = OpenAPI_am_influ_data_convertToJSON(node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_application_data_subs_convertToJSON() failed [am_influ_entries]"); + goto end; + } + cJSON_AddItemToArray(am_influ_entriesList, itemLocal); + } + } + if (application_data_subs->supported_features) { if (cJSON_AddStringToObject(item, "supportedFeatures", application_data_subs->supported_features) == NULL) { ogs_error("OpenAPI_application_data_subs_convertToJSON() failed [supported_features]"); @@ -101,6 +146,20 @@ cJSON *OpenAPI_application_data_subs_convertToJSON(OpenAPI_application_data_subs } } + if (application_data_subs->reset_ids) { + cJSON *reset_idsList = cJSON_AddArrayToObject(item, "resetIds"); + if (reset_idsList == NULL) { + ogs_error("OpenAPI_application_data_subs_convertToJSON() failed [reset_ids]"); + goto end; + } + OpenAPI_list_for_each(application_data_subs->reset_ids, node) { + if (cJSON_AddStringToObject(reset_idsList, "", (char*)node->data) == NULL) { + ogs_error("OpenAPI_application_data_subs_convertToJSON() failed [reset_ids]"); + goto end; + } + } + } + end: return item; } @@ -113,7 +172,12 @@ OpenAPI_application_data_subs_t *OpenAPI_application_data_subs_parseFromJSON(cJS cJSON *data_filters = NULL; OpenAPI_list_t *data_filtersList = NULL; cJSON *expiry = NULL; + cJSON *imm_rep = NULL; + cJSON *am_influ_entries = NULL; + OpenAPI_list_t *am_influ_entriesList = NULL; cJSON *supported_features = NULL; + cJSON *reset_ids = NULL; + OpenAPI_list_t *reset_idsList = NULL; notification_uri = cJSON_GetObjectItemCaseSensitive(application_data_subsJSON, "notificationUri"); if (!notification_uri) { ogs_error("OpenAPI_application_data_subs_parseFromJSON() failed [notification_uri]"); @@ -157,6 +221,39 @@ OpenAPI_application_data_subs_t *OpenAPI_application_data_subs_parseFromJSON(cJS } } + imm_rep = cJSON_GetObjectItemCaseSensitive(application_data_subsJSON, "immRep"); + if (imm_rep) { + if (!cJSON_IsBool(imm_rep)) { + ogs_error("OpenAPI_application_data_subs_parseFromJSON() failed [imm_rep]"); + goto end; + } + } + + am_influ_entries = cJSON_GetObjectItemCaseSensitive(application_data_subsJSON, "amInfluEntries"); + if (am_influ_entries) { + cJSON *am_influ_entries_local = NULL; + if (!cJSON_IsArray(am_influ_entries)) { + ogs_error("OpenAPI_application_data_subs_parseFromJSON() failed [am_influ_entries]"); + goto end; + } + + am_influ_entriesList = OpenAPI_list_create(); + + cJSON_ArrayForEach(am_influ_entries_local, am_influ_entries) { + if (!cJSON_IsObject(am_influ_entries_local)) { + ogs_error("OpenAPI_application_data_subs_parseFromJSON() failed [am_influ_entries]"); + goto end; + } + OpenAPI_am_influ_data_t *am_influ_entriesItem = OpenAPI_am_influ_data_parseFromJSON(am_influ_entries_local); + if (!am_influ_entriesItem) { + ogs_error("No am_influ_entriesItem"); + OpenAPI_list_free(am_influ_entriesList); + goto end; + } + OpenAPI_list_add(am_influ_entriesList, am_influ_entriesItem); + } + } + supported_features = cJSON_GetObjectItemCaseSensitive(application_data_subsJSON, "supportedFeatures"); if (supported_features) { if (!cJSON_IsString(supported_features) && !cJSON_IsNull(supported_features)) { @@ -165,11 +262,36 @@ OpenAPI_application_data_subs_t *OpenAPI_application_data_subs_parseFromJSON(cJS } } + reset_ids = cJSON_GetObjectItemCaseSensitive(application_data_subsJSON, "resetIds"); + if (reset_ids) { + cJSON *reset_ids_local = NULL; + if (!cJSON_IsArray(reset_ids)) { + ogs_error("OpenAPI_application_data_subs_parseFromJSON() failed [reset_ids]"); + goto end; + } + + reset_idsList = OpenAPI_list_create(); + + cJSON_ArrayForEach(reset_ids_local, reset_ids) { + double *localDouble = NULL; + int *localInt = NULL; + if (!cJSON_IsString(reset_ids_local)) { + ogs_error("OpenAPI_application_data_subs_parseFromJSON() failed [reset_ids]"); + goto end; + } + OpenAPI_list_add(reset_idsList, ogs_strdup(reset_ids_local->valuestring)); + } + } + application_data_subs_local_var = OpenAPI_application_data_subs_create ( ogs_strdup(notification_uri->valuestring), data_filters ? data_filtersList : NULL, expiry && !cJSON_IsNull(expiry) ? ogs_strdup(expiry->valuestring) : NULL, - supported_features && !cJSON_IsNull(supported_features) ? ogs_strdup(supported_features->valuestring) : NULL + imm_rep ? true : false, + imm_rep ? imm_rep->valueint : 0, + am_influ_entries ? am_influ_entriesList : NULL, + supported_features && !cJSON_IsNull(supported_features) ? ogs_strdup(supported_features->valuestring) : NULL, + reset_ids ? reset_idsList : NULL ); return application_data_subs_local_var; @@ -181,6 +303,20 @@ end: OpenAPI_list_free(data_filtersList); data_filtersList = NULL; } + if (am_influ_entriesList) { + OpenAPI_list_for_each(am_influ_entriesList, node) { + OpenAPI_am_influ_data_free(node->data); + } + OpenAPI_list_free(am_influ_entriesList); + am_influ_entriesList = NULL; + } + if (reset_idsList) { + OpenAPI_list_for_each(reset_idsList, node) { + ogs_free(node->data); + } + OpenAPI_list_free(reset_idsList); + reset_idsList = NULL; + } return NULL; } diff --git a/lib/sbi/openapi/model/application_data_subs.h b/lib/sbi/openapi/model/application_data_subs.h index 65fe1b85e..d8cde56dc 100644 --- a/lib/sbi/openapi/model/application_data_subs.h +++ b/lib/sbi/openapi/model/application_data_subs.h @@ -12,6 +12,7 @@ #include "../include/list.h" #include "../include/keyValuePair.h" #include "../include/binary.h" +#include "am_influ_data.h" #include "data_filter.h" #ifdef __cplusplus @@ -23,14 +24,22 @@ typedef struct OpenAPI_application_data_subs_s { char *notification_uri; OpenAPI_list_t *data_filters; char *expiry; + bool is_imm_rep; + int imm_rep; + OpenAPI_list_t *am_influ_entries; char *supported_features; + OpenAPI_list_t *reset_ids; } OpenAPI_application_data_subs_t; OpenAPI_application_data_subs_t *OpenAPI_application_data_subs_create( char *notification_uri, OpenAPI_list_t *data_filters, char *expiry, - char *supported_features + bool is_imm_rep, + int imm_rep, + OpenAPI_list_t *am_influ_entries, + char *supported_features, + OpenAPI_list_t *reset_ids ); void OpenAPI_application_data_subs_free(OpenAPI_application_data_subs_t *application_data_subs); OpenAPI_application_data_subs_t *OpenAPI_application_data_subs_parseFromJSON(cJSON *application_data_subsJSON); diff --git a/lib/sbi/openapi/model/application_volume.c b/lib/sbi/openapi/model/application_volume.c new file mode 100644 index 000000000..2252960aa --- /dev/null +++ b/lib/sbi/openapi/model/application_volume.c @@ -0,0 +1,134 @@ + +#include +#include +#include +#include "application_volume.h" + +OpenAPI_application_volume_t *OpenAPI_application_volume_create( + char *app_id, + long app_volume +) +{ + OpenAPI_application_volume_t *application_volume_local_var = ogs_malloc(sizeof(OpenAPI_application_volume_t)); + ogs_assert(application_volume_local_var); + + application_volume_local_var->app_id = app_id; + application_volume_local_var->app_volume = app_volume; + + return application_volume_local_var; +} + +void OpenAPI_application_volume_free(OpenAPI_application_volume_t *application_volume) +{ + OpenAPI_lnode_t *node = NULL; + + if (NULL == application_volume) { + return; + } + if (application_volume->app_id) { + ogs_free(application_volume->app_id); + application_volume->app_id = NULL; + } + ogs_free(application_volume); +} + +cJSON *OpenAPI_application_volume_convertToJSON(OpenAPI_application_volume_t *application_volume) +{ + cJSON *item = NULL; + OpenAPI_lnode_t *node = NULL; + + if (application_volume == NULL) { + ogs_error("OpenAPI_application_volume_convertToJSON() failed [ApplicationVolume]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (!application_volume->app_id) { + ogs_error("OpenAPI_application_volume_convertToJSON() failed [app_id]"); + return NULL; + } + if (cJSON_AddStringToObject(item, "appId", application_volume->app_id) == NULL) { + ogs_error("OpenAPI_application_volume_convertToJSON() failed [app_id]"); + goto end; + } + + if (cJSON_AddNumberToObject(item, "appVolume", application_volume->app_volume) == NULL) { + ogs_error("OpenAPI_application_volume_convertToJSON() failed [app_volume]"); + goto end; + } + +end: + return item; +} + +OpenAPI_application_volume_t *OpenAPI_application_volume_parseFromJSON(cJSON *application_volumeJSON) +{ + OpenAPI_application_volume_t *application_volume_local_var = NULL; + OpenAPI_lnode_t *node = NULL; + cJSON *app_id = NULL; + cJSON *app_volume = NULL; + app_id = cJSON_GetObjectItemCaseSensitive(application_volumeJSON, "appId"); + if (!app_id) { + ogs_error("OpenAPI_application_volume_parseFromJSON() failed [app_id]"); + goto end; + } + if (!cJSON_IsString(app_id)) { + ogs_error("OpenAPI_application_volume_parseFromJSON() failed [app_id]"); + goto end; + } + + app_volume = cJSON_GetObjectItemCaseSensitive(application_volumeJSON, "appVolume"); + if (!app_volume) { + ogs_error("OpenAPI_application_volume_parseFromJSON() failed [app_volume]"); + goto end; + } + if (!cJSON_IsNumber(app_volume)) { + ogs_error("OpenAPI_application_volume_parseFromJSON() failed [app_volume]"); + goto end; + } + + application_volume_local_var = OpenAPI_application_volume_create ( + ogs_strdup(app_id->valuestring), + + app_volume->valuedouble + ); + + return application_volume_local_var; +end: + return NULL; +} + +OpenAPI_application_volume_t *OpenAPI_application_volume_copy(OpenAPI_application_volume_t *dst, OpenAPI_application_volume_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_application_volume_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_application_volume_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_application_volume_free(dst); + dst = OpenAPI_application_volume_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/application_volume.h b/lib/sbi/openapi/model/application_volume.h new file mode 100644 index 000000000..a18dcdeb7 --- /dev/null +++ b/lib/sbi/openapi/model/application_volume.h @@ -0,0 +1,40 @@ +/* + * application_volume.h + * + * Application data volume per Application Id. + */ + +#ifndef _OpenAPI_application_volume_H_ +#define _OpenAPI_application_volume_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_application_volume_s OpenAPI_application_volume_t; +typedef struct OpenAPI_application_volume_s { + char *app_id; + long app_volume; +} OpenAPI_application_volume_t; + +OpenAPI_application_volume_t *OpenAPI_application_volume_create( + char *app_id, + long app_volume +); +void OpenAPI_application_volume_free(OpenAPI_application_volume_t *application_volume); +OpenAPI_application_volume_t *OpenAPI_application_volume_parseFromJSON(cJSON *application_volumeJSON); +cJSON *OpenAPI_application_volume_convertToJSON(OpenAPI_application_volume_t *application_volume); +OpenAPI_application_volume_t *OpenAPI_application_volume_copy(OpenAPI_application_volume_t *dst, OpenAPI_application_volume_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_application_volume_H_ */ + diff --git a/lib/sbi/openapi/model/area.h b/lib/sbi/openapi/model/area.h index 63adae58d..5619e45ea 100644 --- a/lib/sbi/openapi/model/area.h +++ b/lib/sbi/openapi/model/area.h @@ -1,7 +1,7 @@ /* * area.h * - * + * Provides area information. */ #ifndef _OpenAPI_area_H_ diff --git a/lib/sbi/openapi/model/area_1.h b/lib/sbi/openapi/model/area_1.h index 056c1c078..168799e52 100644 --- a/lib/sbi/openapi/model/area_1.h +++ b/lib/sbi/openapi/model/area_1.h @@ -1,7 +1,7 @@ /* * area_1.h * - * + * Provides area information. */ #ifndef _OpenAPI_area_1_H_ diff --git a/lib/sbi/openapi/model/area_of_interest_event_state.c b/lib/sbi/openapi/model/area_of_interest_event_state.c new file mode 100644 index 000000000..c42696ea1 --- /dev/null +++ b/lib/sbi/openapi/model/area_of_interest_event_state.c @@ -0,0 +1,166 @@ + +#include +#include +#include +#include "area_of_interest_event_state.h" + +OpenAPI_area_of_interest_event_state_t *OpenAPI_area_of_interest_event_state_create( + OpenAPI_presence_state_e presence, + OpenAPI_list_t *individual_pra_id_list +) +{ + OpenAPI_area_of_interest_event_state_t *area_of_interest_event_state_local_var = ogs_malloc(sizeof(OpenAPI_area_of_interest_event_state_t)); + ogs_assert(area_of_interest_event_state_local_var); + + area_of_interest_event_state_local_var->presence = presence; + area_of_interest_event_state_local_var->individual_pra_id_list = individual_pra_id_list; + + return area_of_interest_event_state_local_var; +} + +void OpenAPI_area_of_interest_event_state_free(OpenAPI_area_of_interest_event_state_t *area_of_interest_event_state) +{ + OpenAPI_lnode_t *node = NULL; + + if (NULL == area_of_interest_event_state) { + return; + } + if (area_of_interest_event_state->individual_pra_id_list) { + OpenAPI_list_for_each(area_of_interest_event_state->individual_pra_id_list, node) { + ogs_free(node->data); + } + OpenAPI_list_free(area_of_interest_event_state->individual_pra_id_list); + area_of_interest_event_state->individual_pra_id_list = NULL; + } + ogs_free(area_of_interest_event_state); +} + +cJSON *OpenAPI_area_of_interest_event_state_convertToJSON(OpenAPI_area_of_interest_event_state_t *area_of_interest_event_state) +{ + cJSON *item = NULL; + OpenAPI_lnode_t *node = NULL; + + if (area_of_interest_event_state == NULL) { + ogs_error("OpenAPI_area_of_interest_event_state_convertToJSON() failed [AreaOfInterestEventState]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (area_of_interest_event_state->presence == OpenAPI_presence_state_NULL) { + ogs_error("OpenAPI_area_of_interest_event_state_convertToJSON() failed [presence]"); + return NULL; + } + if (cJSON_AddStringToObject(item, "presence", OpenAPI_presence_state_ToString(area_of_interest_event_state->presence)) == NULL) { + ogs_error("OpenAPI_area_of_interest_event_state_convertToJSON() failed [presence]"); + goto end; + } + + if (area_of_interest_event_state->individual_pra_id_list) { + cJSON *individual_pra_id_listList = cJSON_AddArrayToObject(item, "individualPraIdList"); + if (individual_pra_id_listList == NULL) { + ogs_error("OpenAPI_area_of_interest_event_state_convertToJSON() failed [individual_pra_id_list]"); + goto end; + } + OpenAPI_list_for_each(area_of_interest_event_state->individual_pra_id_list, node) { + if (cJSON_AddStringToObject(individual_pra_id_listList, "", (char*)node->data) == NULL) { + ogs_error("OpenAPI_area_of_interest_event_state_convertToJSON() failed [individual_pra_id_list]"); + goto end; + } + } + } + +end: + return item; +} + +OpenAPI_area_of_interest_event_state_t *OpenAPI_area_of_interest_event_state_parseFromJSON(cJSON *area_of_interest_event_stateJSON) +{ + OpenAPI_area_of_interest_event_state_t *area_of_interest_event_state_local_var = NULL; + OpenAPI_lnode_t *node = NULL; + cJSON *presence = NULL; + OpenAPI_presence_state_e presenceVariable = 0; + cJSON *individual_pra_id_list = NULL; + OpenAPI_list_t *individual_pra_id_listList = NULL; + presence = cJSON_GetObjectItemCaseSensitive(area_of_interest_event_stateJSON, "presence"); + if (!presence) { + ogs_error("OpenAPI_area_of_interest_event_state_parseFromJSON() failed [presence]"); + goto end; + } + if (!cJSON_IsString(presence)) { + ogs_error("OpenAPI_area_of_interest_event_state_parseFromJSON() failed [presence]"); + goto end; + } + presenceVariable = OpenAPI_presence_state_FromString(presence->valuestring); + + individual_pra_id_list = cJSON_GetObjectItemCaseSensitive(area_of_interest_event_stateJSON, "individualPraIdList"); + if (individual_pra_id_list) { + cJSON *individual_pra_id_list_local = NULL; + if (!cJSON_IsArray(individual_pra_id_list)) { + ogs_error("OpenAPI_area_of_interest_event_state_parseFromJSON() failed [individual_pra_id_list]"); + goto end; + } + + individual_pra_id_listList = OpenAPI_list_create(); + + cJSON_ArrayForEach(individual_pra_id_list_local, individual_pra_id_list) { + double *localDouble = NULL; + int *localInt = NULL; + if (!cJSON_IsString(individual_pra_id_list_local)) { + ogs_error("OpenAPI_area_of_interest_event_state_parseFromJSON() failed [individual_pra_id_list]"); + goto end; + } + OpenAPI_list_add(individual_pra_id_listList, ogs_strdup(individual_pra_id_list_local->valuestring)); + } + } + + area_of_interest_event_state_local_var = OpenAPI_area_of_interest_event_state_create ( + presenceVariable, + individual_pra_id_list ? individual_pra_id_listList : NULL + ); + + return area_of_interest_event_state_local_var; +end: + if (individual_pra_id_listList) { + OpenAPI_list_for_each(individual_pra_id_listList, node) { + ogs_free(node->data); + } + OpenAPI_list_free(individual_pra_id_listList); + individual_pra_id_listList = NULL; + } + return NULL; +} + +OpenAPI_area_of_interest_event_state_t *OpenAPI_area_of_interest_event_state_copy(OpenAPI_area_of_interest_event_state_t *dst, OpenAPI_area_of_interest_event_state_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_area_of_interest_event_state_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_area_of_interest_event_state_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_area_of_interest_event_state_free(dst); + dst = OpenAPI_area_of_interest_event_state_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/area_of_interest_event_state.h b/lib/sbi/openapi/model/area_of_interest_event_state.h new file mode 100644 index 000000000..14dfb70c2 --- /dev/null +++ b/lib/sbi/openapi/model/area_of_interest_event_state.h @@ -0,0 +1,41 @@ +/* + * area_of_interest_event_state.h + * + * Event State of AoI event in old AMF + */ + +#ifndef _OpenAPI_area_of_interest_event_state_H_ +#define _OpenAPI_area_of_interest_event_state_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "presence_state.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_area_of_interest_event_state_s OpenAPI_area_of_interest_event_state_t; +typedef struct OpenAPI_area_of_interest_event_state_s { + OpenAPI_presence_state_e presence; + OpenAPI_list_t *individual_pra_id_list; +} OpenAPI_area_of_interest_event_state_t; + +OpenAPI_area_of_interest_event_state_t *OpenAPI_area_of_interest_event_state_create( + OpenAPI_presence_state_e presence, + OpenAPI_list_t *individual_pra_id_list +); +void OpenAPI_area_of_interest_event_state_free(OpenAPI_area_of_interest_event_state_t *area_of_interest_event_state); +OpenAPI_area_of_interest_event_state_t *OpenAPI_area_of_interest_event_state_parseFromJSON(cJSON *area_of_interest_event_stateJSON); +cJSON *OpenAPI_area_of_interest_event_state_convertToJSON(OpenAPI_area_of_interest_event_state_t *area_of_interest_event_state); +OpenAPI_area_of_interest_event_state_t *OpenAPI_area_of_interest_event_state_copy(OpenAPI_area_of_interest_event_state_t *dst, OpenAPI_area_of_interest_event_state_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_area_of_interest_event_state_H_ */ + diff --git a/lib/sbi/openapi/model/area_of_validity.h b/lib/sbi/openapi/model/area_of_validity.h index 802ce2ca8..ea42097c1 100644 --- a/lib/sbi/openapi/model/area_of_validity.h +++ b/lib/sbi/openapi/model/area_of_validity.h @@ -1,7 +1,7 @@ /* * area_of_validity.h * - * + * Area of validity information for N2 information transfer */ #ifndef _OpenAPI_area_of_validity_H_ diff --git a/lib/sbi/openapi/model/area_scope.h b/lib/sbi/openapi/model/area_scope.h index 646a25b34..b034c31bf 100644 --- a/lib/sbi/openapi/model/area_scope.h +++ b/lib/sbi/openapi/model/area_scope.h @@ -1,7 +1,7 @@ /* * area_scope.h * - * + * Contain the area based on Cells or Tracking Areas. */ #ifndef _OpenAPI_area_scope_H_ diff --git a/lib/sbi/openapi/model/arp.h b/lib/sbi/openapi/model/arp.h index a50c29383..0c085c256 100644 --- a/lib/sbi/openapi/model/arp.h +++ b/lib/sbi/openapi/model/arp.h @@ -1,7 +1,7 @@ /* * arp.h * - * + * Contains Allocation and Retention Priority information. */ #ifndef _OpenAPI_arp_H_ diff --git a/lib/sbi/openapi/model/arp_1.h b/lib/sbi/openapi/model/arp_1.h index 2efa5846f..245deadee 100644 --- a/lib/sbi/openapi/model/arp_1.h +++ b/lib/sbi/openapi/model/arp_1.h @@ -1,7 +1,7 @@ /* * arp_1.h * - * + * Contains Allocation and Retention Priority information. */ #ifndef _OpenAPI_arp_1_H_ diff --git a/lib/sbi/openapi/model/as_time_distribution_param.c b/lib/sbi/openapi/model/as_time_distribution_param.c new file mode 100644 index 000000000..9f81027f4 --- /dev/null +++ b/lib/sbi/openapi/model/as_time_distribution_param.c @@ -0,0 +1,131 @@ + +#include +#include +#include +#include "as_time_distribution_param.h" + +OpenAPI_as_time_distribution_param_t *OpenAPI_as_time_distribution_param_create( + bool is_as_time_dist_ind, + int as_time_dist_ind, + bool is_uu_error_budget, + int uu_error_budget +) +{ + OpenAPI_as_time_distribution_param_t *as_time_distribution_param_local_var = ogs_malloc(sizeof(OpenAPI_as_time_distribution_param_t)); + ogs_assert(as_time_distribution_param_local_var); + + as_time_distribution_param_local_var->is_as_time_dist_ind = is_as_time_dist_ind; + as_time_distribution_param_local_var->as_time_dist_ind = as_time_dist_ind; + as_time_distribution_param_local_var->is_uu_error_budget = is_uu_error_budget; + as_time_distribution_param_local_var->uu_error_budget = uu_error_budget; + + return as_time_distribution_param_local_var; +} + +void OpenAPI_as_time_distribution_param_free(OpenAPI_as_time_distribution_param_t *as_time_distribution_param) +{ + OpenAPI_lnode_t *node = NULL; + + if (NULL == as_time_distribution_param) { + return; + } + ogs_free(as_time_distribution_param); +} + +cJSON *OpenAPI_as_time_distribution_param_convertToJSON(OpenAPI_as_time_distribution_param_t *as_time_distribution_param) +{ + cJSON *item = NULL; + OpenAPI_lnode_t *node = NULL; + + if (as_time_distribution_param == NULL) { + ogs_error("OpenAPI_as_time_distribution_param_convertToJSON() failed [AsTimeDistributionParam]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (as_time_distribution_param->is_as_time_dist_ind) { + if (cJSON_AddBoolToObject(item, "asTimeDistInd", as_time_distribution_param->as_time_dist_ind) == NULL) { + ogs_error("OpenAPI_as_time_distribution_param_convertToJSON() failed [as_time_dist_ind]"); + goto end; + } + } + + if (as_time_distribution_param->is_uu_error_budget) { + if (cJSON_AddNumberToObject(item, "uuErrorBudget", as_time_distribution_param->uu_error_budget) == NULL) { + ogs_error("OpenAPI_as_time_distribution_param_convertToJSON() failed [uu_error_budget]"); + goto end; + } + } + +end: + return item; +} + +OpenAPI_as_time_distribution_param_t *OpenAPI_as_time_distribution_param_parseFromJSON(cJSON *as_time_distribution_paramJSON) +{ + OpenAPI_as_time_distribution_param_t *as_time_distribution_param_local_var = NULL; + OpenAPI_lnode_t *node = NULL; + cJSON *as_time_dist_ind = NULL; + cJSON *uu_error_budget = NULL; + as_time_dist_ind = cJSON_GetObjectItemCaseSensitive(as_time_distribution_paramJSON, "asTimeDistInd"); + if (as_time_dist_ind) { + if (!cJSON_IsBool(as_time_dist_ind)) { + ogs_error("OpenAPI_as_time_distribution_param_parseFromJSON() failed [as_time_dist_ind]"); + goto end; + } + } + + uu_error_budget = cJSON_GetObjectItemCaseSensitive(as_time_distribution_paramJSON, "uuErrorBudget"); + if (uu_error_budget) { + if (!cJSON_IsNumber(uu_error_budget)) { + ogs_error("OpenAPI_as_time_distribution_param_parseFromJSON() failed [uu_error_budget]"); + goto end; + } + } + + as_time_distribution_param_local_var = OpenAPI_as_time_distribution_param_create ( + as_time_dist_ind ? true : false, + as_time_dist_ind ? as_time_dist_ind->valueint : 0, + uu_error_budget ? true : false, + uu_error_budget ? uu_error_budget->valuedouble : 0 + ); + + return as_time_distribution_param_local_var; +end: + return NULL; +} + +OpenAPI_as_time_distribution_param_t *OpenAPI_as_time_distribution_param_copy(OpenAPI_as_time_distribution_param_t *dst, OpenAPI_as_time_distribution_param_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_as_time_distribution_param_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_as_time_distribution_param_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_as_time_distribution_param_free(dst); + dst = OpenAPI_as_time_distribution_param_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/as_time_distribution_param.h b/lib/sbi/openapi/model/as_time_distribution_param.h new file mode 100644 index 000000000..26993682b --- /dev/null +++ b/lib/sbi/openapi/model/as_time_distribution_param.h @@ -0,0 +1,44 @@ +/* + * as_time_distribution_param.h + * + * Contains the 5G acess stratum time distribution parameters. + */ + +#ifndef _OpenAPI_as_time_distribution_param_H_ +#define _OpenAPI_as_time_distribution_param_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_as_time_distribution_param_s OpenAPI_as_time_distribution_param_t; +typedef struct OpenAPI_as_time_distribution_param_s { + bool is_as_time_dist_ind; + int as_time_dist_ind; + bool is_uu_error_budget; + int uu_error_budget; +} OpenAPI_as_time_distribution_param_t; + +OpenAPI_as_time_distribution_param_t *OpenAPI_as_time_distribution_param_create( + bool is_as_time_dist_ind, + int as_time_dist_ind, + bool is_uu_error_budget, + int uu_error_budget +); +void OpenAPI_as_time_distribution_param_free(OpenAPI_as_time_distribution_param_t *as_time_distribution_param); +OpenAPI_as_time_distribution_param_t *OpenAPI_as_time_distribution_param_parseFromJSON(cJSON *as_time_distribution_paramJSON); +cJSON *OpenAPI_as_time_distribution_param_convertToJSON(OpenAPI_as_time_distribution_param_t *as_time_distribution_param); +OpenAPI_as_time_distribution_param_t *OpenAPI_as_time_distribution_param_copy(OpenAPI_as_time_distribution_param_t *dst, OpenAPI_as_time_distribution_param_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_as_time_distribution_param_H_ */ + diff --git a/lib/sbi/openapi/model/assign_ebi_data.c b/lib/sbi/openapi/model/assign_ebi_data.c index 94a1d1c47..6a55b54a1 100644 --- a/lib/sbi/openapi/model/assign_ebi_data.c +++ b/lib/sbi/openapi/model/assign_ebi_data.c @@ -8,7 +8,8 @@ OpenAPI_assign_ebi_data_t *OpenAPI_assign_ebi_data_create( int pdu_session_id, OpenAPI_list_t *arp_list, OpenAPI_list_t *released_ebi_list, - OpenAPI_guami_t *old_guami + OpenAPI_guami_t *old_guami, + OpenAPI_list_t *modified_ebi_list ) { OpenAPI_assign_ebi_data_t *assign_ebi_data_local_var = ogs_malloc(sizeof(OpenAPI_assign_ebi_data_t)); @@ -18,6 +19,7 @@ OpenAPI_assign_ebi_data_t *OpenAPI_assign_ebi_data_create( assign_ebi_data_local_var->arp_list = arp_list; assign_ebi_data_local_var->released_ebi_list = released_ebi_list; assign_ebi_data_local_var->old_guami = old_guami; + assign_ebi_data_local_var->modified_ebi_list = modified_ebi_list; return assign_ebi_data_local_var; } @@ -47,6 +49,13 @@ void OpenAPI_assign_ebi_data_free(OpenAPI_assign_ebi_data_t *assign_ebi_data) OpenAPI_guami_free(assign_ebi_data->old_guami); assign_ebi_data->old_guami = NULL; } + if (assign_ebi_data->modified_ebi_list) { + OpenAPI_list_for_each(assign_ebi_data->modified_ebi_list, node) { + OpenAPI_ebi_arp_mapping_free(node->data); + } + OpenAPI_list_free(assign_ebi_data->modified_ebi_list); + assign_ebi_data->modified_ebi_list = NULL; + } ogs_free(assign_ebi_data); } @@ -109,6 +118,22 @@ cJSON *OpenAPI_assign_ebi_data_convertToJSON(OpenAPI_assign_ebi_data_t *assign_e } } + if (assign_ebi_data->modified_ebi_list) { + cJSON *modified_ebi_listList = cJSON_AddArrayToObject(item, "modifiedEbiList"); + if (modified_ebi_listList == NULL) { + ogs_error("OpenAPI_assign_ebi_data_convertToJSON() failed [modified_ebi_list]"); + goto end; + } + OpenAPI_list_for_each(assign_ebi_data->modified_ebi_list, node) { + cJSON *itemLocal = OpenAPI_ebi_arp_mapping_convertToJSON(node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_assign_ebi_data_convertToJSON() failed [modified_ebi_list]"); + goto end; + } + cJSON_AddItemToArray(modified_ebi_listList, itemLocal); + } + } + end: return item; } @@ -124,6 +149,8 @@ OpenAPI_assign_ebi_data_t *OpenAPI_assign_ebi_data_parseFromJSON(cJSON *assign_e OpenAPI_list_t *released_ebi_listList = NULL; cJSON *old_guami = NULL; OpenAPI_guami_t *old_guami_local_nonprim = NULL; + cJSON *modified_ebi_list = NULL; + OpenAPI_list_t *modified_ebi_listList = NULL; pdu_session_id = cJSON_GetObjectItemCaseSensitive(assign_ebi_dataJSON, "pduSessionId"); if (!pdu_session_id) { ogs_error("OpenAPI_assign_ebi_data_parseFromJSON() failed [pdu_session_id]"); @@ -191,12 +218,38 @@ OpenAPI_assign_ebi_data_t *OpenAPI_assign_ebi_data_parseFromJSON(cJSON *assign_e old_guami_local_nonprim = OpenAPI_guami_parseFromJSON(old_guami); } + modified_ebi_list = cJSON_GetObjectItemCaseSensitive(assign_ebi_dataJSON, "modifiedEbiList"); + if (modified_ebi_list) { + cJSON *modified_ebi_list_local = NULL; + if (!cJSON_IsArray(modified_ebi_list)) { + ogs_error("OpenAPI_assign_ebi_data_parseFromJSON() failed [modified_ebi_list]"); + goto end; + } + + modified_ebi_listList = OpenAPI_list_create(); + + cJSON_ArrayForEach(modified_ebi_list_local, modified_ebi_list) { + if (!cJSON_IsObject(modified_ebi_list_local)) { + ogs_error("OpenAPI_assign_ebi_data_parseFromJSON() failed [modified_ebi_list]"); + goto end; + } + OpenAPI_ebi_arp_mapping_t *modified_ebi_listItem = OpenAPI_ebi_arp_mapping_parseFromJSON(modified_ebi_list_local); + if (!modified_ebi_listItem) { + ogs_error("No modified_ebi_listItem"); + OpenAPI_list_free(modified_ebi_listList); + goto end; + } + OpenAPI_list_add(modified_ebi_listList, modified_ebi_listItem); + } + } + assign_ebi_data_local_var = OpenAPI_assign_ebi_data_create ( pdu_session_id->valuedouble, arp_list ? arp_listList : NULL, released_ebi_list ? released_ebi_listList : NULL, - old_guami ? old_guami_local_nonprim : NULL + old_guami ? old_guami_local_nonprim : NULL, + modified_ebi_list ? modified_ebi_listList : NULL ); return assign_ebi_data_local_var; @@ -219,6 +272,13 @@ end: OpenAPI_guami_free(old_guami_local_nonprim); old_guami_local_nonprim = NULL; } + if (modified_ebi_listList) { + OpenAPI_list_for_each(modified_ebi_listList, node) { + OpenAPI_ebi_arp_mapping_free(node->data); + } + OpenAPI_list_free(modified_ebi_listList); + modified_ebi_listList = NULL; + } return NULL; } diff --git a/lib/sbi/openapi/model/assign_ebi_data.h b/lib/sbi/openapi/model/assign_ebi_data.h index 779dcc434..6f17804ab 100644 --- a/lib/sbi/openapi/model/assign_ebi_data.h +++ b/lib/sbi/openapi/model/assign_ebi_data.h @@ -1,7 +1,7 @@ /* * assign_ebi_data.h * - * + * Data within an EBI assignment request */ #ifndef _OpenAPI_assign_ebi_data_H_ @@ -13,6 +13,7 @@ #include "../include/keyValuePair.h" #include "../include/binary.h" #include "arp.h" +#include "ebi_arp_mapping.h" #include "guami.h" #ifdef __cplusplus @@ -25,13 +26,15 @@ typedef struct OpenAPI_assign_ebi_data_s { OpenAPI_list_t *arp_list; OpenAPI_list_t *released_ebi_list; struct OpenAPI_guami_s *old_guami; + OpenAPI_list_t *modified_ebi_list; } OpenAPI_assign_ebi_data_t; OpenAPI_assign_ebi_data_t *OpenAPI_assign_ebi_data_create( int pdu_session_id, OpenAPI_list_t *arp_list, OpenAPI_list_t *released_ebi_list, - OpenAPI_guami_t *old_guami + OpenAPI_guami_t *old_guami, + OpenAPI_list_t *modified_ebi_list ); void OpenAPI_assign_ebi_data_free(OpenAPI_assign_ebi_data_t *assign_ebi_data); OpenAPI_assign_ebi_data_t *OpenAPI_assign_ebi_data_parseFromJSON(cJSON *assign_ebi_dataJSON); diff --git a/lib/sbi/openapi/model/assign_ebi_error.h b/lib/sbi/openapi/model/assign_ebi_error.h index 1ff25d509..f419856c8 100644 --- a/lib/sbi/openapi/model/assign_ebi_error.h +++ b/lib/sbi/openapi/model/assign_ebi_error.h @@ -1,7 +1,7 @@ /* * assign_ebi_error.h * - * + * Data within a failure response to the EBI assignment request */ #ifndef _OpenAPI_assign_ebi_error_H_ diff --git a/lib/sbi/openapi/model/assign_ebi_failed.h b/lib/sbi/openapi/model/assign_ebi_failed.h index c4fbb757e..4d9c18d55 100644 --- a/lib/sbi/openapi/model/assign_ebi_failed.h +++ b/lib/sbi/openapi/model/assign_ebi_failed.h @@ -1,7 +1,7 @@ /* * assign_ebi_failed.h * - * + * Represents failed assignment of EBI(s) */ #ifndef _OpenAPI_assign_ebi_failed_H_ diff --git a/lib/sbi/openapi/model/assigned_ebi_data.c b/lib/sbi/openapi/model/assigned_ebi_data.c index 3035738d0..82eb805a4 100644 --- a/lib/sbi/openapi/model/assigned_ebi_data.c +++ b/lib/sbi/openapi/model/assigned_ebi_data.c @@ -8,7 +8,8 @@ OpenAPI_assigned_ebi_data_t *OpenAPI_assigned_ebi_data_create( int pdu_session_id, OpenAPI_list_t *assigned_ebi_list, OpenAPI_list_t *failed_arp_list, - OpenAPI_list_t *released_ebi_list + OpenAPI_list_t *released_ebi_list, + OpenAPI_list_t *modified_ebi_list ) { OpenAPI_assigned_ebi_data_t *assigned_ebi_data_local_var = ogs_malloc(sizeof(OpenAPI_assigned_ebi_data_t)); @@ -18,6 +19,7 @@ OpenAPI_assigned_ebi_data_t *OpenAPI_assigned_ebi_data_create( assigned_ebi_data_local_var->assigned_ebi_list = assigned_ebi_list; assigned_ebi_data_local_var->failed_arp_list = failed_arp_list; assigned_ebi_data_local_var->released_ebi_list = released_ebi_list; + assigned_ebi_data_local_var->modified_ebi_list = modified_ebi_list; return assigned_ebi_data_local_var; } @@ -50,6 +52,13 @@ void OpenAPI_assigned_ebi_data_free(OpenAPI_assigned_ebi_data_t *assigned_ebi_da OpenAPI_list_free(assigned_ebi_data->released_ebi_list); assigned_ebi_data->released_ebi_list = NULL; } + if (assigned_ebi_data->modified_ebi_list) { + OpenAPI_list_for_each(assigned_ebi_data->modified_ebi_list, node) { + ogs_free(node->data); + } + OpenAPI_list_free(assigned_ebi_data->modified_ebi_list); + assigned_ebi_data->modified_ebi_list = NULL; + } ogs_free(assigned_ebi_data); } @@ -117,6 +126,20 @@ cJSON *OpenAPI_assigned_ebi_data_convertToJSON(OpenAPI_assigned_ebi_data_t *assi } } + if (assigned_ebi_data->modified_ebi_list) { + cJSON *modified_ebi_listList = cJSON_AddArrayToObject(item, "modifiedEbiList"); + if (modified_ebi_listList == NULL) { + ogs_error("OpenAPI_assigned_ebi_data_convertToJSON() failed [modified_ebi_list]"); + goto end; + } + OpenAPI_list_for_each(assigned_ebi_data->modified_ebi_list, node) { + if (cJSON_AddNumberToObject(modified_ebi_listList, "", (uintptr_t)node->data) == NULL) { + ogs_error("OpenAPI_assigned_ebi_data_convertToJSON() failed [modified_ebi_list]"); + goto end; + } + } + } + end: return item; } @@ -132,6 +155,8 @@ OpenAPI_assigned_ebi_data_t *OpenAPI_assigned_ebi_data_parseFromJSON(cJSON *assi OpenAPI_list_t *failed_arp_listList = NULL; cJSON *released_ebi_list = NULL; OpenAPI_list_t *released_ebi_listList = NULL; + cJSON *modified_ebi_list = NULL; + OpenAPI_list_t *modified_ebi_listList = NULL; pdu_session_id = cJSON_GetObjectItemCaseSensitive(assigned_ebi_dataJSON, "pduSessionId"); if (!pdu_session_id) { ogs_error("OpenAPI_assigned_ebi_data_parseFromJSON() failed [pdu_session_id]"); @@ -221,12 +246,40 @@ OpenAPI_assigned_ebi_data_t *OpenAPI_assigned_ebi_data_parseFromJSON(cJSON *assi } } + modified_ebi_list = cJSON_GetObjectItemCaseSensitive(assigned_ebi_dataJSON, "modifiedEbiList"); + if (modified_ebi_list) { + cJSON *modified_ebi_list_local = NULL; + if (!cJSON_IsArray(modified_ebi_list)) { + ogs_error("OpenAPI_assigned_ebi_data_parseFromJSON() failed [modified_ebi_list]"); + goto end; + } + + modified_ebi_listList = OpenAPI_list_create(); + + cJSON_ArrayForEach(modified_ebi_list_local, modified_ebi_list) { + double *localDouble = NULL; + int *localInt = NULL; + if (!cJSON_IsNumber(modified_ebi_list_local)) { + ogs_error("OpenAPI_assigned_ebi_data_parseFromJSON() failed [modified_ebi_list]"); + goto end; + } + localDouble = (double *)ogs_calloc(1, sizeof(double)); + if (!localDouble) { + ogs_error("OpenAPI_assigned_ebi_data_parseFromJSON() failed [modified_ebi_list]"); + goto end; + } + *localDouble = modified_ebi_list_local->valuedouble; + OpenAPI_list_add(modified_ebi_listList, localDouble); + } + } + assigned_ebi_data_local_var = OpenAPI_assigned_ebi_data_create ( pdu_session_id->valuedouble, assigned_ebi_listList, failed_arp_list ? failed_arp_listList : NULL, - released_ebi_list ? released_ebi_listList : NULL + released_ebi_list ? released_ebi_listList : NULL, + modified_ebi_list ? modified_ebi_listList : NULL ); return assigned_ebi_data_local_var; @@ -252,6 +305,13 @@ end: OpenAPI_list_free(released_ebi_listList); released_ebi_listList = NULL; } + if (modified_ebi_listList) { + OpenAPI_list_for_each(modified_ebi_listList, node) { + ogs_free(node->data); + } + OpenAPI_list_free(modified_ebi_listList); + modified_ebi_listList = NULL; + } return NULL; } diff --git a/lib/sbi/openapi/model/assigned_ebi_data.h b/lib/sbi/openapi/model/assigned_ebi_data.h index 128324e9b..9da22fc73 100644 --- a/lib/sbi/openapi/model/assigned_ebi_data.h +++ b/lib/sbi/openapi/model/assigned_ebi_data.h @@ -1,7 +1,7 @@ /* * assigned_ebi_data.h * - * + * Data within a successful response to an EBI assignment request */ #ifndef _OpenAPI_assigned_ebi_data_H_ @@ -25,13 +25,15 @@ typedef struct OpenAPI_assigned_ebi_data_s { OpenAPI_list_t *assigned_ebi_list; OpenAPI_list_t *failed_arp_list; OpenAPI_list_t *released_ebi_list; + OpenAPI_list_t *modified_ebi_list; } OpenAPI_assigned_ebi_data_t; OpenAPI_assigned_ebi_data_t *OpenAPI_assigned_ebi_data_create( int pdu_session_id, OpenAPI_list_t *assigned_ebi_list, OpenAPI_list_t *failed_arp_list, - OpenAPI_list_t *released_ebi_list + OpenAPI_list_t *released_ebi_list, + OpenAPI_list_t *modified_ebi_list ); void OpenAPI_assigned_ebi_data_free(OpenAPI_assigned_ebi_data_t *assigned_ebi_data); OpenAPI_assigned_ebi_data_t *OpenAPI_assigned_ebi_data_parseFromJSON(cJSON *assigned_ebi_dataJSON); diff --git a/lib/sbi/openapi/model/atom.c b/lib/sbi/openapi/model/atom.c index 5c6584bf9..3af7f707d 100644 --- a/lib/sbi/openapi/model/atom.c +++ b/lib/sbi/openapi/model/atom.c @@ -6,7 +6,7 @@ OpenAPI_atom_t *OpenAPI_atom_create( char *attr, - char *value, + OpenAPI_any_type_t *value, bool is_negative, int negative ) @@ -34,7 +34,7 @@ void OpenAPI_atom_free(OpenAPI_atom_t *atom) atom->attr = NULL; } if (atom->value) { - ogs_free(atom->value); + OpenAPI_any_type_free(atom->value); atom->value = NULL; } ogs_free(atom); @@ -64,7 +64,13 @@ cJSON *OpenAPI_atom_convertToJSON(OpenAPI_atom_t *atom) ogs_error("OpenAPI_atom_convertToJSON() failed [value]"); return NULL; } - if (cJSON_AddStringToObject(item, "value", atom->value) == NULL) { + cJSON *value_object = OpenAPI_any_type_convertToJSON(atom->value); + if (value_object == NULL) { + ogs_error("OpenAPI_atom_convertToJSON() failed [value]"); + goto end; + } + cJSON_AddItemToObject(item, "value", value_object); + if (item->child == NULL) { ogs_error("OpenAPI_atom_convertToJSON() failed [value]"); goto end; } @@ -86,6 +92,7 @@ OpenAPI_atom_t *OpenAPI_atom_parseFromJSON(cJSON *atomJSON) OpenAPI_lnode_t *node = NULL; cJSON *attr = NULL; cJSON *value = NULL; + OpenAPI_any_type_t *value_local_object = NULL; cJSON *negative = NULL; attr = cJSON_GetObjectItemCaseSensitive(atomJSON, "attr"); if (!attr) { @@ -102,10 +109,7 @@ OpenAPI_atom_t *OpenAPI_atom_parseFromJSON(cJSON *atomJSON) ogs_error("OpenAPI_atom_parseFromJSON() failed [value]"); goto end; } - if (!cJSON_IsString(value)) { - ogs_error("OpenAPI_atom_parseFromJSON() failed [value]"); - goto end; - } + value_local_object = OpenAPI_any_type_parseFromJSON(value); negative = cJSON_GetObjectItemCaseSensitive(atomJSON, "negative"); if (negative) { @@ -117,13 +121,17 @@ OpenAPI_atom_t *OpenAPI_atom_parseFromJSON(cJSON *atomJSON) atom_local_var = OpenAPI_atom_create ( ogs_strdup(attr->valuestring), - ogs_strdup(value->valuestring), + value_local_object, negative ? true : false, negative ? negative->valueint : 0 ); return atom_local_var; end: + if (value_local_object) { + OpenAPI_any_type_free(value_local_object); + value_local_object = NULL; + } return NULL; } diff --git a/lib/sbi/openapi/model/atom.h b/lib/sbi/openapi/model/atom.h index 4d5247191..9519d06d5 100644 --- a/lib/sbi/openapi/model/atom.h +++ b/lib/sbi/openapi/model/atom.h @@ -1,7 +1,7 @@ /* * atom.h * - * + * contains a search parameter and its positive or negative content. */ #ifndef _OpenAPI_atom_H_ @@ -12,6 +12,7 @@ #include "../include/list.h" #include "../include/keyValuePair.h" #include "../include/binary.h" +#include "any_type.h" #ifdef __cplusplus extern "C" { @@ -20,14 +21,14 @@ extern "C" { typedef struct OpenAPI_atom_s OpenAPI_atom_t; typedef struct OpenAPI_atom_s { char *attr; - char *value; + OpenAPI_any_type_t *value; bool is_negative; int negative; } OpenAPI_atom_t; OpenAPI_atom_t *OpenAPI_atom_create( char *attr, - char *value, + OpenAPI_any_type_t *value, bool is_negative, int negative ); diff --git a/lib/sbi/openapi/model/atsss_capability.h b/lib/sbi/openapi/model/atsss_capability.h index 2f52ea248..f8b30d6da 100644 --- a/lib/sbi/openapi/model/atsss_capability.h +++ b/lib/sbi/openapi/model/atsss_capability.h @@ -1,7 +1,7 @@ /* * atsss_capability.h * - * + * Containes Capability to support procedures related to Access Traffic Steering, Switching, Splitting. */ #ifndef _OpenAPI_atsss_capability_H_ diff --git a/lib/sbi/openapi/model/atsss_capability_any_of.c b/lib/sbi/openapi/model/atsss_capability_any_of.c deleted file mode 100644 index 133ddd6da..000000000 --- a/lib/sbi/openapi/model/atsss_capability_any_of.c +++ /dev/null @@ -1,30 +0,0 @@ - -#include -#include -#include -#include "atsss_capability_any_of.h" - -char* OpenAPI_atsss_capability_any_of_ToString(OpenAPI_atsss_capability_any_of_e atsss_capability_any_of) -{ - const char *atsss_capability_any_ofArray[] = { "NULL", "MPTCP_ATSSS_LL_WITH_ASMODE_UL", "MPTCP_ATSSS_LL_WITH_EXSDMODE_DL_ASMODE_UL", "MPTCP_ATSSS_LL_WITH_ASMODE_DLUL", "ATSSS_LL", "MPTCP_ATSSS_LL" }; - size_t sizeofArray = sizeof(atsss_capability_any_ofArray) / sizeof(atsss_capability_any_ofArray[0]); - if (atsss_capability_any_of < sizeofArray) - return (char *)atsss_capability_any_ofArray[atsss_capability_any_of]; - else - return (char *)"Unknown"; -} - -OpenAPI_atsss_capability_any_of_e OpenAPI_atsss_capability_any_of_FromString(char* atsss_capability_any_of) -{ - int stringToReturn = 0; - const char *atsss_capability_any_ofArray[] = { "NULL", "MPTCP_ATSSS_LL_WITH_ASMODE_UL", "MPTCP_ATSSS_LL_WITH_EXSDMODE_DL_ASMODE_UL", "MPTCP_ATSSS_LL_WITH_ASMODE_DLUL", "ATSSS_LL", "MPTCP_ATSSS_LL" }; - size_t sizeofArray = sizeof(atsss_capability_any_ofArray) / sizeof(atsss_capability_any_ofArray[0]); - while (stringToReturn < sizeofArray) { - if (strcmp(atsss_capability_any_of, atsss_capability_any_ofArray[stringToReturn]) == 0) { - return stringToReturn; - } - stringToReturn++; - } - return 0; -} - diff --git a/lib/sbi/openapi/model/atsss_capability_any_of.h b/lib/sbi/openapi/model/atsss_capability_any_of.h deleted file mode 100644 index 5ddc0b677..000000000 --- a/lib/sbi/openapi/model/atsss_capability_any_of.h +++ /dev/null @@ -1,31 +0,0 @@ -/* - * atsss_capability_any_of.h - * - * - */ - -#ifndef _OpenAPI_atsss_capability_any_of_H_ -#define _OpenAPI_atsss_capability_any_of_H_ - -#include -#include "../external/cJSON.h" -#include "../include/list.h" -#include "../include/keyValuePair.h" -#include "../include/binary.h" - -#ifdef __cplusplus -extern "C" { -#endif - -typedef enum { OpenAPI_atsss_capability_any_of_NULL = 0, OpenAPI_atsss_capability_any_of_MPTCP_ATSSS_LL_WITH_ASMODE_UL, OpenAPI_atsss_capability_any_of_MPTCP_ATSSS_LL_WITH_EXSDMODE_DL_ASMODE_UL, OpenAPI_atsss_capability_any_of_MPTCP_ATSSS_LL_WITH_ASMODE_DLUL, OpenAPI_atsss_capability_any_of_ATSSS_LL, OpenAPI_atsss_capability_any_of_MPTCP_ATSSS_LL } OpenAPI_atsss_capability_any_of_e; - -char* OpenAPI_atsss_capability_any_of_ToString(OpenAPI_atsss_capability_any_of_e atsss_capability_any_of); - -OpenAPI_atsss_capability_any_of_e OpenAPI_atsss_capability_any_of_FromString(char* atsss_capability_any_of); - -#ifdef __cplusplus -} -#endif - -#endif /* _OpenAPI_atsss_capability_any_of_H_ */ - diff --git a/lib/sbi/openapi/model/ausf_info.c b/lib/sbi/openapi/model/ausf_info.c index 0b330dc3b..ecbc63f2c 100644 --- a/lib/sbi/openapi/model/ausf_info.c +++ b/lib/sbi/openapi/model/ausf_info.c @@ -7,7 +7,8 @@ OpenAPI_ausf_info_t *OpenAPI_ausf_info_create( char *group_id, OpenAPI_list_t *supi_ranges, - OpenAPI_list_t *routing_indicators + OpenAPI_list_t *routing_indicators, + OpenAPI_list_t *suci_infos ) { OpenAPI_ausf_info_t *ausf_info_local_var = ogs_malloc(sizeof(OpenAPI_ausf_info_t)); @@ -16,6 +17,7 @@ OpenAPI_ausf_info_t *OpenAPI_ausf_info_create( ausf_info_local_var->group_id = group_id; ausf_info_local_var->supi_ranges = supi_ranges; ausf_info_local_var->routing_indicators = routing_indicators; + ausf_info_local_var->suci_infos = suci_infos; return ausf_info_local_var; } @@ -45,6 +47,13 @@ void OpenAPI_ausf_info_free(OpenAPI_ausf_info_t *ausf_info) OpenAPI_list_free(ausf_info->routing_indicators); ausf_info->routing_indicators = NULL; } + if (ausf_info->suci_infos) { + OpenAPI_list_for_each(ausf_info->suci_infos, node) { + OpenAPI_suci_info_free(node->data); + } + OpenAPI_list_free(ausf_info->suci_infos); + ausf_info->suci_infos = NULL; + } ogs_free(ausf_info); } @@ -96,6 +105,22 @@ cJSON *OpenAPI_ausf_info_convertToJSON(OpenAPI_ausf_info_t *ausf_info) } } + if (ausf_info->suci_infos) { + cJSON *suci_infosList = cJSON_AddArrayToObject(item, "suciInfos"); + if (suci_infosList == NULL) { + ogs_error("OpenAPI_ausf_info_convertToJSON() failed [suci_infos]"); + goto end; + } + OpenAPI_list_for_each(ausf_info->suci_infos, node) { + cJSON *itemLocal = OpenAPI_suci_info_convertToJSON(node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_ausf_info_convertToJSON() failed [suci_infos]"); + goto end; + } + cJSON_AddItemToArray(suci_infosList, itemLocal); + } + } + end: return item; } @@ -109,6 +134,8 @@ OpenAPI_ausf_info_t *OpenAPI_ausf_info_parseFromJSON(cJSON *ausf_infoJSON) OpenAPI_list_t *supi_rangesList = NULL; cJSON *routing_indicators = NULL; OpenAPI_list_t *routing_indicatorsList = NULL; + cJSON *suci_infos = NULL; + OpenAPI_list_t *suci_infosList = NULL; group_id = cJSON_GetObjectItemCaseSensitive(ausf_infoJSON, "groupId"); if (group_id) { if (!cJSON_IsString(group_id) && !cJSON_IsNull(group_id)) { @@ -163,10 +190,36 @@ OpenAPI_ausf_info_t *OpenAPI_ausf_info_parseFromJSON(cJSON *ausf_infoJSON) } } + suci_infos = cJSON_GetObjectItemCaseSensitive(ausf_infoJSON, "suciInfos"); + if (suci_infos) { + cJSON *suci_infos_local = NULL; + if (!cJSON_IsArray(suci_infos)) { + ogs_error("OpenAPI_ausf_info_parseFromJSON() failed [suci_infos]"); + goto end; + } + + suci_infosList = OpenAPI_list_create(); + + cJSON_ArrayForEach(suci_infos_local, suci_infos) { + if (!cJSON_IsObject(suci_infos_local)) { + ogs_error("OpenAPI_ausf_info_parseFromJSON() failed [suci_infos]"); + goto end; + } + OpenAPI_suci_info_t *suci_infosItem = OpenAPI_suci_info_parseFromJSON(suci_infos_local); + if (!suci_infosItem) { + ogs_error("No suci_infosItem"); + OpenAPI_list_free(suci_infosList); + goto end; + } + OpenAPI_list_add(suci_infosList, suci_infosItem); + } + } + ausf_info_local_var = OpenAPI_ausf_info_create ( group_id && !cJSON_IsNull(group_id) ? ogs_strdup(group_id->valuestring) : NULL, supi_ranges ? supi_rangesList : NULL, - routing_indicators ? routing_indicatorsList : NULL + routing_indicators ? routing_indicatorsList : NULL, + suci_infos ? suci_infosList : NULL ); return ausf_info_local_var; @@ -185,6 +238,13 @@ end: OpenAPI_list_free(routing_indicatorsList); routing_indicatorsList = NULL; } + if (suci_infosList) { + OpenAPI_list_for_each(suci_infosList, node) { + OpenAPI_suci_info_free(node->data); + } + OpenAPI_list_free(suci_infosList); + suci_infosList = NULL; + } return NULL; } diff --git a/lib/sbi/openapi/model/ausf_info.h b/lib/sbi/openapi/model/ausf_info.h index 755ab0fa5..b464479ee 100644 --- a/lib/sbi/openapi/model/ausf_info.h +++ b/lib/sbi/openapi/model/ausf_info.h @@ -12,6 +12,7 @@ #include "../include/list.h" #include "../include/keyValuePair.h" #include "../include/binary.h" +#include "suci_info.h" #include "supi_range.h" #ifdef __cplusplus @@ -23,12 +24,14 @@ typedef struct OpenAPI_ausf_info_s { char *group_id; OpenAPI_list_t *supi_ranges; OpenAPI_list_t *routing_indicators; + OpenAPI_list_t *suci_infos; } OpenAPI_ausf_info_t; OpenAPI_ausf_info_t *OpenAPI_ausf_info_create( char *group_id, OpenAPI_list_t *supi_ranges, - OpenAPI_list_t *routing_indicators + OpenAPI_list_t *routing_indicators, + OpenAPI_list_t *suci_infos ); void OpenAPI_ausf_info_free(OpenAPI_ausf_info_t *ausf_info); OpenAPI_ausf_info_t *OpenAPI_ausf_info_parseFromJSON(cJSON *ausf_infoJSON); diff --git a/lib/sbi/openapi/model/auth_event.c b/lib/sbi/openapi/model/auth_event.c index a4259b08f..dd9d54c01 100644 --- a/lib/sbi/openapi/model/auth_event.c +++ b/lib/sbi/openapi/model/auth_event.c @@ -11,7 +11,9 @@ OpenAPI_auth_event_t *OpenAPI_auth_event_create( OpenAPI_auth_type_e auth_type, char *serving_network_name, bool is_auth_removal_ind, - int auth_removal_ind + int auth_removal_ind, + char *nf_set_id, + OpenAPI_list_t *reset_ids ) { OpenAPI_auth_event_t *auth_event_local_var = ogs_malloc(sizeof(OpenAPI_auth_event_t)); @@ -24,6 +26,8 @@ OpenAPI_auth_event_t *OpenAPI_auth_event_create( auth_event_local_var->serving_network_name = serving_network_name; auth_event_local_var->is_auth_removal_ind = is_auth_removal_ind; auth_event_local_var->auth_removal_ind = auth_removal_ind; + auth_event_local_var->nf_set_id = nf_set_id; + auth_event_local_var->reset_ids = reset_ids; return auth_event_local_var; } @@ -47,6 +51,17 @@ void OpenAPI_auth_event_free(OpenAPI_auth_event_t *auth_event) ogs_free(auth_event->serving_network_name); auth_event->serving_network_name = NULL; } + if (auth_event->nf_set_id) { + ogs_free(auth_event->nf_set_id); + auth_event->nf_set_id = NULL; + } + if (auth_event->reset_ids) { + OpenAPI_list_for_each(auth_event->reset_ids, node) { + ogs_free(node->data); + } + OpenAPI_list_free(auth_event->reset_ids); + auth_event->reset_ids = NULL; + } ogs_free(auth_event); } @@ -109,6 +124,27 @@ cJSON *OpenAPI_auth_event_convertToJSON(OpenAPI_auth_event_t *auth_event) } } + if (auth_event->nf_set_id) { + if (cJSON_AddStringToObject(item, "nfSetId", auth_event->nf_set_id) == NULL) { + ogs_error("OpenAPI_auth_event_convertToJSON() failed [nf_set_id]"); + goto end; + } + } + + if (auth_event->reset_ids) { + cJSON *reset_idsList = cJSON_AddArrayToObject(item, "resetIds"); + if (reset_idsList == NULL) { + ogs_error("OpenAPI_auth_event_convertToJSON() failed [reset_ids]"); + goto end; + } + OpenAPI_list_for_each(auth_event->reset_ids, node) { + if (cJSON_AddStringToObject(reset_idsList, "", (char*)node->data) == NULL) { + ogs_error("OpenAPI_auth_event_convertToJSON() failed [reset_ids]"); + goto end; + } + } + } + end: return item; } @@ -124,6 +160,9 @@ OpenAPI_auth_event_t *OpenAPI_auth_event_parseFromJSON(cJSON *auth_eventJSON) OpenAPI_auth_type_e auth_typeVariable = 0; cJSON *serving_network_name = NULL; cJSON *auth_removal_ind = NULL; + cJSON *nf_set_id = NULL; + cJSON *reset_ids = NULL; + OpenAPI_list_t *reset_idsList = NULL; nf_instance_id = cJSON_GetObjectItemCaseSensitive(auth_eventJSON, "nfInstanceId"); if (!nf_instance_id) { ogs_error("OpenAPI_auth_event_parseFromJSON() failed [nf_instance_id]"); @@ -183,6 +222,35 @@ OpenAPI_auth_event_t *OpenAPI_auth_event_parseFromJSON(cJSON *auth_eventJSON) } } + nf_set_id = cJSON_GetObjectItemCaseSensitive(auth_eventJSON, "nfSetId"); + if (nf_set_id) { + if (!cJSON_IsString(nf_set_id) && !cJSON_IsNull(nf_set_id)) { + ogs_error("OpenAPI_auth_event_parseFromJSON() failed [nf_set_id]"); + goto end; + } + } + + reset_ids = cJSON_GetObjectItemCaseSensitive(auth_eventJSON, "resetIds"); + if (reset_ids) { + cJSON *reset_ids_local = NULL; + if (!cJSON_IsArray(reset_ids)) { + ogs_error("OpenAPI_auth_event_parseFromJSON() failed [reset_ids]"); + goto end; + } + + reset_idsList = OpenAPI_list_create(); + + cJSON_ArrayForEach(reset_ids_local, reset_ids) { + double *localDouble = NULL; + int *localInt = NULL; + if (!cJSON_IsString(reset_ids_local)) { + ogs_error("OpenAPI_auth_event_parseFromJSON() failed [reset_ids]"); + goto end; + } + OpenAPI_list_add(reset_idsList, ogs_strdup(reset_ids_local->valuestring)); + } + } + auth_event_local_var = OpenAPI_auth_event_create ( ogs_strdup(nf_instance_id->valuestring), @@ -191,11 +259,20 @@ OpenAPI_auth_event_t *OpenAPI_auth_event_parseFromJSON(cJSON *auth_eventJSON) auth_typeVariable, ogs_strdup(serving_network_name->valuestring), auth_removal_ind ? true : false, - auth_removal_ind ? auth_removal_ind->valueint : 0 + auth_removal_ind ? auth_removal_ind->valueint : 0, + nf_set_id && !cJSON_IsNull(nf_set_id) ? ogs_strdup(nf_set_id->valuestring) : NULL, + reset_ids ? reset_idsList : NULL ); return auth_event_local_var; end: + if (reset_idsList) { + OpenAPI_list_for_each(reset_idsList, node) { + ogs_free(node->data); + } + OpenAPI_list_free(reset_idsList); + reset_idsList = NULL; + } return NULL; } diff --git a/lib/sbi/openapi/model/auth_event.h b/lib/sbi/openapi/model/auth_event.h index 3e17a6cb7..df185e55b 100644 --- a/lib/sbi/openapi/model/auth_event.h +++ b/lib/sbi/openapi/model/auth_event.h @@ -27,6 +27,8 @@ typedef struct OpenAPI_auth_event_s { char *serving_network_name; bool is_auth_removal_ind; int auth_removal_ind; + char *nf_set_id; + OpenAPI_list_t *reset_ids; } OpenAPI_auth_event_t; OpenAPI_auth_event_t *OpenAPI_auth_event_create( @@ -36,7 +38,9 @@ OpenAPI_auth_event_t *OpenAPI_auth_event_create( OpenAPI_auth_type_e auth_type, char *serving_network_name, bool is_auth_removal_ind, - int auth_removal_ind + int auth_removal_ind, + char *nf_set_id, + OpenAPI_list_t *reset_ids ); void OpenAPI_auth_event_free(OpenAPI_auth_event_t *auth_event); OpenAPI_auth_event_t *OpenAPI_auth_event_parseFromJSON(cJSON *auth_eventJSON); diff --git a/lib/sbi/openapi/model/auth_method.c b/lib/sbi/openapi/model/auth_method.c index e0d3224e9..6bf87642f 100644 --- a/lib/sbi/openapi/model/auth_method.c +++ b/lib/sbi/openapi/model/auth_method.c @@ -6,7 +6,7 @@ char* OpenAPI_auth_method_ToString(OpenAPI_auth_method_e auth_method) { - const char *auth_methodArray[] = { "NULL", "5G_AKA", "EAP_AKA_PRIME", "EAP_TLS" }; + const char *auth_methodArray[] = { "NULL", "5G_AKA", "EAP_AKA_PRIME", "EAP_TLS", "EAP_TTLS", "NONE" }; size_t sizeofArray = sizeof(auth_methodArray) / sizeof(auth_methodArray[0]); if (auth_method < sizeofArray) return (char *)auth_methodArray[auth_method]; @@ -17,7 +17,7 @@ char* OpenAPI_auth_method_ToString(OpenAPI_auth_method_e auth_method) OpenAPI_auth_method_e OpenAPI_auth_method_FromString(char* auth_method) { int stringToReturn = 0; - const char *auth_methodArray[] = { "NULL", "5G_AKA", "EAP_AKA_PRIME", "EAP_TLS" }; + const char *auth_methodArray[] = { "NULL", "5G_AKA", "EAP_AKA_PRIME", "EAP_TLS", "EAP_TTLS", "NONE" }; size_t sizeofArray = sizeof(auth_methodArray) / sizeof(auth_methodArray[0]); while (stringToReturn < sizeofArray) { if (strcmp(auth_method, auth_methodArray[stringToReturn]) == 0) { diff --git a/lib/sbi/openapi/model/auth_method.h b/lib/sbi/openapi/model/auth_method.h index e492f3462..f3e7d8688 100644 --- a/lib/sbi/openapi/model/auth_method.h +++ b/lib/sbi/openapi/model/auth_method.h @@ -17,7 +17,7 @@ extern "C" { #endif -typedef enum { OpenAPI_auth_method_NULL = 0, OpenAPI_auth_method_5G_AKA, OpenAPI_auth_method_EAP_AKA_PRIME, OpenAPI_auth_method_EAP_TLS } OpenAPI_auth_method_e; +typedef enum { OpenAPI_auth_method_NULL = 0, OpenAPI_auth_method_5G_AKA, OpenAPI_auth_method_EAP_AKA_PRIME, OpenAPI_auth_method_EAP_TLS, OpenAPI_auth_method_EAP_TTLS, OpenAPI_auth_method_NONE } OpenAPI_auth_method_e; char* OpenAPI_auth_method_ToString(OpenAPI_auth_method_e auth_method); diff --git a/lib/sbi/openapi/model/auth_result.h b/lib/sbi/openapi/model/auth_result.h index 0082c5f31..c330d04dc 100644 --- a/lib/sbi/openapi/model/auth_result.h +++ b/lib/sbi/openapi/model/auth_result.h @@ -1,7 +1,7 @@ /* * auth_result.h * - * + * Indicates the result of the authentication. */ #ifndef _OpenAPI_auth_result_H_ diff --git a/lib/sbi/openapi/model/auth_type.c b/lib/sbi/openapi/model/auth_type.c index c5f24e75e..533ec672f 100644 --- a/lib/sbi/openapi/model/auth_type.c +++ b/lib/sbi/openapi/model/auth_type.c @@ -6,7 +6,7 @@ char* OpenAPI_auth_type_ToString(OpenAPI_auth_type_e auth_type) { - const char *auth_typeArray[] = { "NULL", "5G_AKA", "EAP_AKA_PRIME", "EAP_TLS" }; + const char *auth_typeArray[] = { "NULL", "5G_AKA", "EAP_AKA_PRIME", "EAP_TLS", "EAP_TTLS" }; size_t sizeofArray = sizeof(auth_typeArray) / sizeof(auth_typeArray[0]); if (auth_type < sizeofArray) return (char *)auth_typeArray[auth_type]; @@ -17,7 +17,7 @@ char* OpenAPI_auth_type_ToString(OpenAPI_auth_type_e auth_type) OpenAPI_auth_type_e OpenAPI_auth_type_FromString(char* auth_type) { int stringToReturn = 0; - const char *auth_typeArray[] = { "NULL", "5G_AKA", "EAP_AKA_PRIME", "EAP_TLS" }; + const char *auth_typeArray[] = { "NULL", "5G_AKA", "EAP_AKA_PRIME", "EAP_TLS", "EAP_TTLS" }; size_t sizeofArray = sizeof(auth_typeArray) / sizeof(auth_typeArray[0]); while (stringToReturn < sizeofArray) { if (strcmp(auth_type, auth_typeArray[stringToReturn]) == 0) { diff --git a/lib/sbi/openapi/model/auth_type.h b/lib/sbi/openapi/model/auth_type.h index 22d1a59e7..dc2e0e9ab 100644 --- a/lib/sbi/openapi/model/auth_type.h +++ b/lib/sbi/openapi/model/auth_type.h @@ -17,7 +17,7 @@ extern "C" { #endif -typedef enum { OpenAPI_auth_type_NULL = 0, OpenAPI_auth_type_5G_AKA, OpenAPI_auth_type_EAP_AKA_PRIME, OpenAPI_auth_type_EAP_TLS } OpenAPI_auth_type_e; +typedef enum { OpenAPI_auth_type_NULL = 0, OpenAPI_auth_type_5G_AKA, OpenAPI_auth_type_EAP_AKA_PRIME, OpenAPI_auth_type_EAP_TLS, OpenAPI_auth_type_EAP_TTLS } OpenAPI_auth_type_e; char* OpenAPI_auth_type_ToString(OpenAPI_auth_type_e auth_type); diff --git a/lib/sbi/openapi/model/authentication_info.c b/lib/sbi/openapi/model/authentication_info.c index 73fdb98cf..8095ddcf0 100644 --- a/lib/sbi/openapi/model/authentication_info.c +++ b/lib/sbi/openapi/model/authentication_info.c @@ -15,7 +15,13 @@ OpenAPI_authentication_info_t *OpenAPI_authentication_info_create( OpenAPI_list_t *cell_cag_info, bool is_n5gc_ind, int n5gc_ind, - char *supported_features + char *supported_features, + bool is_nswo_ind, + int nswo_ind, + bool is_disaster_roaming_ind, + int disaster_roaming_ind, + bool is_onboarding_ind, + int onboarding_ind ) { OpenAPI_authentication_info_t *authentication_info_local_var = ogs_malloc(sizeof(OpenAPI_authentication_info_t)); @@ -32,6 +38,12 @@ OpenAPI_authentication_info_t *OpenAPI_authentication_info_create( authentication_info_local_var->is_n5gc_ind = is_n5gc_ind; authentication_info_local_var->n5gc_ind = n5gc_ind; authentication_info_local_var->supported_features = supported_features; + authentication_info_local_var->is_nswo_ind = is_nswo_ind; + authentication_info_local_var->nswo_ind = nswo_ind; + authentication_info_local_var->is_disaster_roaming_ind = is_disaster_roaming_ind; + authentication_info_local_var->disaster_roaming_ind = disaster_roaming_ind; + authentication_info_local_var->is_onboarding_ind = is_onboarding_ind; + authentication_info_local_var->onboarding_ind = onboarding_ind; return authentication_info_local_var; } @@ -189,6 +201,27 @@ cJSON *OpenAPI_authentication_info_convertToJSON(OpenAPI_authentication_info_t * } } + if (authentication_info->is_nswo_ind) { + if (cJSON_AddBoolToObject(item, "nswoInd", authentication_info->nswo_ind) == NULL) { + ogs_error("OpenAPI_authentication_info_convertToJSON() failed [nswo_ind]"); + goto end; + } + } + + if (authentication_info->is_disaster_roaming_ind) { + if (cJSON_AddBoolToObject(item, "disasterRoamingInd", authentication_info->disaster_roaming_ind) == NULL) { + ogs_error("OpenAPI_authentication_info_convertToJSON() failed [disaster_roaming_ind]"); + goto end; + } + } + + if (authentication_info->is_onboarding_ind) { + if (cJSON_AddBoolToObject(item, "onboardingInd", authentication_info->onboarding_ind) == NULL) { + ogs_error("OpenAPI_authentication_info_convertToJSON() failed [onboarding_ind]"); + goto end; + } + } + end: return item; } @@ -210,6 +243,9 @@ OpenAPI_authentication_info_t *OpenAPI_authentication_info_parseFromJSON(cJSON * OpenAPI_list_t *cell_cag_infoList = NULL; cJSON *n5gc_ind = NULL; cJSON *supported_features = NULL; + cJSON *nswo_ind = NULL; + cJSON *disaster_roaming_ind = NULL; + cJSON *onboarding_ind = NULL; supi_or_suci = cJSON_GetObjectItemCaseSensitive(authentication_infoJSON, "supiOrSuci"); if (!supi_or_suci) { ogs_error("OpenAPI_authentication_info_parseFromJSON() failed [supi_or_suci]"); @@ -301,6 +337,30 @@ OpenAPI_authentication_info_t *OpenAPI_authentication_info_parseFromJSON(cJSON * } } + nswo_ind = cJSON_GetObjectItemCaseSensitive(authentication_infoJSON, "nswoInd"); + if (nswo_ind) { + if (!cJSON_IsBool(nswo_ind)) { + ogs_error("OpenAPI_authentication_info_parseFromJSON() failed [nswo_ind]"); + goto end; + } + } + + disaster_roaming_ind = cJSON_GetObjectItemCaseSensitive(authentication_infoJSON, "disasterRoamingInd"); + if (disaster_roaming_ind) { + if (!cJSON_IsBool(disaster_roaming_ind)) { + ogs_error("OpenAPI_authentication_info_parseFromJSON() failed [disaster_roaming_ind]"); + goto end; + } + } + + onboarding_ind = cJSON_GetObjectItemCaseSensitive(authentication_infoJSON, "onboardingInd"); + if (onboarding_ind) { + if (!cJSON_IsBool(onboarding_ind)) { + ogs_error("OpenAPI_authentication_info_parseFromJSON() failed [onboarding_ind]"); + goto end; + } + } + authentication_info_local_var = OpenAPI_authentication_info_create ( ogs_strdup(supi_or_suci->valuestring), ogs_strdup(serving_network_name->valuestring), @@ -312,7 +372,13 @@ OpenAPI_authentication_info_t *OpenAPI_authentication_info_parseFromJSON(cJSON * cell_cag_info ? cell_cag_infoList : NULL, n5gc_ind ? true : false, n5gc_ind ? n5gc_ind->valueint : 0, - supported_features && !cJSON_IsNull(supported_features) ? ogs_strdup(supported_features->valuestring) : NULL + supported_features && !cJSON_IsNull(supported_features) ? ogs_strdup(supported_features->valuestring) : NULL, + nswo_ind ? true : false, + nswo_ind ? nswo_ind->valueint : 0, + disaster_roaming_ind ? true : false, + disaster_roaming_ind ? disaster_roaming_ind->valueint : 0, + onboarding_ind ? true : false, + onboarding_ind ? onboarding_ind->valueint : 0 ); return authentication_info_local_var; diff --git a/lib/sbi/openapi/model/authentication_info.h b/lib/sbi/openapi/model/authentication_info.h index ce6326682..ba43121f9 100644 --- a/lib/sbi/openapi/model/authentication_info.h +++ b/lib/sbi/openapi/model/authentication_info.h @@ -1,7 +1,7 @@ /* * authentication_info.h * - * + * Contains the UE id (i.e. SUCI or SUPI) and the Serving Network Name. */ #ifndef _OpenAPI_authentication_info_H_ @@ -32,6 +32,12 @@ typedef struct OpenAPI_authentication_info_s { bool is_n5gc_ind; int n5gc_ind; char *supported_features; + bool is_nswo_ind; + int nswo_ind; + bool is_disaster_roaming_ind; + int disaster_roaming_ind; + bool is_onboarding_ind; + int onboarding_ind; } OpenAPI_authentication_info_t; OpenAPI_authentication_info_t *OpenAPI_authentication_info_create( @@ -45,7 +51,13 @@ OpenAPI_authentication_info_t *OpenAPI_authentication_info_create( OpenAPI_list_t *cell_cag_info, bool is_n5gc_ind, int n5gc_ind, - char *supported_features + char *supported_features, + bool is_nswo_ind, + int nswo_ind, + bool is_disaster_roaming_ind, + int disaster_roaming_ind, + bool is_onboarding_ind, + int onboarding_ind ); void OpenAPI_authentication_info_free(OpenAPI_authentication_info_t *authentication_info); OpenAPI_authentication_info_t *OpenAPI_authentication_info_parseFromJSON(cJSON *authentication_infoJSON); diff --git a/lib/sbi/openapi/model/authentication_info_request.c b/lib/sbi/openapi/model/authentication_info_request.c index 9c03f27b5..3f3fc5f3e 100644 --- a/lib/sbi/openapi/model/authentication_info_request.c +++ b/lib/sbi/openapi/model/authentication_info_request.c @@ -11,7 +11,11 @@ OpenAPI_authentication_info_request_t *OpenAPI_authentication_info_request_creat char *ausf_instance_id, OpenAPI_list_t *cell_cag_info, bool is_n5gc_ind, - int n5gc_ind + int n5gc_ind, + bool is_nswo_ind, + int nswo_ind, + bool is_disaster_roaming_ind, + int disaster_roaming_ind ) { OpenAPI_authentication_info_request_t *authentication_info_request_local_var = ogs_malloc(sizeof(OpenAPI_authentication_info_request_t)); @@ -24,6 +28,10 @@ OpenAPI_authentication_info_request_t *OpenAPI_authentication_info_request_creat authentication_info_request_local_var->cell_cag_info = cell_cag_info; authentication_info_request_local_var->is_n5gc_ind = is_n5gc_ind; authentication_info_request_local_var->n5gc_ind = n5gc_ind; + authentication_info_request_local_var->is_nswo_ind = is_nswo_ind; + authentication_info_request_local_var->nswo_ind = nswo_ind; + authentication_info_request_local_var->is_disaster_roaming_ind = is_disaster_roaming_ind; + authentication_info_request_local_var->disaster_roaming_ind = disaster_roaming_ind; return authentication_info_request_local_var; } @@ -131,6 +139,20 @@ cJSON *OpenAPI_authentication_info_request_convertToJSON(OpenAPI_authentication_ } } + if (authentication_info_request->is_nswo_ind) { + if (cJSON_AddBoolToObject(item, "nswoInd", authentication_info_request->nswo_ind) == NULL) { + ogs_error("OpenAPI_authentication_info_request_convertToJSON() failed [nswo_ind]"); + goto end; + } + } + + if (authentication_info_request->is_disaster_roaming_ind) { + if (cJSON_AddBoolToObject(item, "disasterRoamingInd", authentication_info_request->disaster_roaming_ind) == NULL) { + ogs_error("OpenAPI_authentication_info_request_convertToJSON() failed [disaster_roaming_ind]"); + goto end; + } + } + end: return item; } @@ -147,6 +169,8 @@ OpenAPI_authentication_info_request_t *OpenAPI_authentication_info_request_parse cJSON *cell_cag_info = NULL; OpenAPI_list_t *cell_cag_infoList = NULL; cJSON *n5gc_ind = NULL; + cJSON *nswo_ind = NULL; + cJSON *disaster_roaming_ind = NULL; supported_features = cJSON_GetObjectItemCaseSensitive(authentication_info_requestJSON, "supportedFeatures"); if (supported_features) { if (!cJSON_IsString(supported_features) && !cJSON_IsNull(supported_features)) { @@ -209,6 +233,22 @@ OpenAPI_authentication_info_request_t *OpenAPI_authentication_info_request_parse } } + nswo_ind = cJSON_GetObjectItemCaseSensitive(authentication_info_requestJSON, "nswoInd"); + if (nswo_ind) { + if (!cJSON_IsBool(nswo_ind)) { + ogs_error("OpenAPI_authentication_info_request_parseFromJSON() failed [nswo_ind]"); + goto end; + } + } + + disaster_roaming_ind = cJSON_GetObjectItemCaseSensitive(authentication_info_requestJSON, "disasterRoamingInd"); + if (disaster_roaming_ind) { + if (!cJSON_IsBool(disaster_roaming_ind)) { + ogs_error("OpenAPI_authentication_info_request_parseFromJSON() failed [disaster_roaming_ind]"); + goto end; + } + } + authentication_info_request_local_var = OpenAPI_authentication_info_request_create ( supported_features && !cJSON_IsNull(supported_features) ? ogs_strdup(supported_features->valuestring) : NULL, ogs_strdup(serving_network_name->valuestring), @@ -216,7 +256,11 @@ OpenAPI_authentication_info_request_t *OpenAPI_authentication_info_request_parse ogs_strdup(ausf_instance_id->valuestring), cell_cag_info ? cell_cag_infoList : NULL, n5gc_ind ? true : false, - n5gc_ind ? n5gc_ind->valueint : 0 + n5gc_ind ? n5gc_ind->valueint : 0, + nswo_ind ? true : false, + nswo_ind ? nswo_ind->valueint : 0, + disaster_roaming_ind ? true : false, + disaster_roaming_ind ? disaster_roaming_ind->valueint : 0 ); return authentication_info_request_local_var; diff --git a/lib/sbi/openapi/model/authentication_info_request.h b/lib/sbi/openapi/model/authentication_info_request.h index 0e1869d9a..c5c65eed5 100644 --- a/lib/sbi/openapi/model/authentication_info_request.h +++ b/lib/sbi/openapi/model/authentication_info_request.h @@ -27,6 +27,10 @@ typedef struct OpenAPI_authentication_info_request_s { OpenAPI_list_t *cell_cag_info; bool is_n5gc_ind; int n5gc_ind; + bool is_nswo_ind; + int nswo_ind; + bool is_disaster_roaming_ind; + int disaster_roaming_ind; } OpenAPI_authentication_info_request_t; OpenAPI_authentication_info_request_t *OpenAPI_authentication_info_request_create( @@ -36,7 +40,11 @@ OpenAPI_authentication_info_request_t *OpenAPI_authentication_info_request_creat char *ausf_instance_id, OpenAPI_list_t *cell_cag_info, bool is_n5gc_ind, - int n5gc_ind + int n5gc_ind, + bool is_nswo_ind, + int nswo_ind, + bool is_disaster_roaming_ind, + int disaster_roaming_ind ); void OpenAPI_authentication_info_request_free(OpenAPI_authentication_info_request_t *authentication_info_request); OpenAPI_authentication_info_request_t *OpenAPI_authentication_info_request_parseFromJSON(cJSON *authentication_info_requestJSON); diff --git a/lib/sbi/openapi/model/authentication_info_result.c b/lib/sbi/openapi/model/authentication_info_result.c index adaacea36..8b8e53058 100644 --- a/lib/sbi/openapi/model/authentication_info_result.c +++ b/lib/sbi/openapi/model/authentication_info_result.c @@ -8,7 +8,13 @@ OpenAPI_authentication_info_result_t *OpenAPI_authentication_info_result_create( OpenAPI_auth_type_e auth_type, char *supported_features, OpenAPI_authentication_vector_t *authentication_vector, - char *supi + char *supi, + bool is_akma_ind, + int akma_ind, + bool is_auth_aaa, + int auth_aaa, + char *routing_id, + OpenAPI_list_t *pvs_info ) { OpenAPI_authentication_info_result_t *authentication_info_result_local_var = ogs_malloc(sizeof(OpenAPI_authentication_info_result_t)); @@ -18,6 +24,12 @@ OpenAPI_authentication_info_result_t *OpenAPI_authentication_info_result_create( authentication_info_result_local_var->supported_features = supported_features; authentication_info_result_local_var->authentication_vector = authentication_vector; authentication_info_result_local_var->supi = supi; + authentication_info_result_local_var->is_akma_ind = is_akma_ind; + authentication_info_result_local_var->akma_ind = akma_ind; + authentication_info_result_local_var->is_auth_aaa = is_auth_aaa; + authentication_info_result_local_var->auth_aaa = auth_aaa; + authentication_info_result_local_var->routing_id = routing_id; + authentication_info_result_local_var->pvs_info = pvs_info; return authentication_info_result_local_var; } @@ -41,6 +53,17 @@ void OpenAPI_authentication_info_result_free(OpenAPI_authentication_info_result_ ogs_free(authentication_info_result->supi); authentication_info_result->supi = NULL; } + if (authentication_info_result->routing_id) { + ogs_free(authentication_info_result->routing_id); + authentication_info_result->routing_id = NULL; + } + if (authentication_info_result->pvs_info) { + OpenAPI_list_for_each(authentication_info_result->pvs_info, node) { + OpenAPI_server_addressing_info_free(node->data); + } + OpenAPI_list_free(authentication_info_result->pvs_info); + authentication_info_result->pvs_info = NULL; + } ogs_free(authentication_info_result); } @@ -91,6 +114,43 @@ cJSON *OpenAPI_authentication_info_result_convertToJSON(OpenAPI_authentication_i } } + if (authentication_info_result->is_akma_ind) { + if (cJSON_AddBoolToObject(item, "akmaInd", authentication_info_result->akma_ind) == NULL) { + ogs_error("OpenAPI_authentication_info_result_convertToJSON() failed [akma_ind]"); + goto end; + } + } + + if (authentication_info_result->is_auth_aaa) { + if (cJSON_AddBoolToObject(item, "authAaa", authentication_info_result->auth_aaa) == NULL) { + ogs_error("OpenAPI_authentication_info_result_convertToJSON() failed [auth_aaa]"); + goto end; + } + } + + if (authentication_info_result->routing_id) { + if (cJSON_AddStringToObject(item, "routingId", authentication_info_result->routing_id) == NULL) { + ogs_error("OpenAPI_authentication_info_result_convertToJSON() failed [routing_id]"); + goto end; + } + } + + if (authentication_info_result->pvs_info) { + cJSON *pvs_infoList = cJSON_AddArrayToObject(item, "pvsInfo"); + if (pvs_infoList == NULL) { + ogs_error("OpenAPI_authentication_info_result_convertToJSON() failed [pvs_info]"); + goto end; + } + OpenAPI_list_for_each(authentication_info_result->pvs_info, node) { + cJSON *itemLocal = OpenAPI_server_addressing_info_convertToJSON(node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_authentication_info_result_convertToJSON() failed [pvs_info]"); + goto end; + } + cJSON_AddItemToArray(pvs_infoList, itemLocal); + } + } + end: return item; } @@ -105,6 +165,11 @@ OpenAPI_authentication_info_result_t *OpenAPI_authentication_info_result_parseFr cJSON *authentication_vector = NULL; OpenAPI_authentication_vector_t *authentication_vector_local_nonprim = NULL; cJSON *supi = NULL; + cJSON *akma_ind = NULL; + cJSON *auth_aaa = NULL; + cJSON *routing_id = NULL; + cJSON *pvs_info = NULL; + OpenAPI_list_t *pvs_infoList = NULL; auth_type = cJSON_GetObjectItemCaseSensitive(authentication_info_resultJSON, "authType"); if (!auth_type) { ogs_error("OpenAPI_authentication_info_result_parseFromJSON() failed [auth_type]"); @@ -137,11 +202,66 @@ OpenAPI_authentication_info_result_t *OpenAPI_authentication_info_result_parseFr } } + akma_ind = cJSON_GetObjectItemCaseSensitive(authentication_info_resultJSON, "akmaInd"); + if (akma_ind) { + if (!cJSON_IsBool(akma_ind)) { + ogs_error("OpenAPI_authentication_info_result_parseFromJSON() failed [akma_ind]"); + goto end; + } + } + + auth_aaa = cJSON_GetObjectItemCaseSensitive(authentication_info_resultJSON, "authAaa"); + if (auth_aaa) { + if (!cJSON_IsBool(auth_aaa)) { + ogs_error("OpenAPI_authentication_info_result_parseFromJSON() failed [auth_aaa]"); + goto end; + } + } + + routing_id = cJSON_GetObjectItemCaseSensitive(authentication_info_resultJSON, "routingId"); + if (routing_id) { + if (!cJSON_IsString(routing_id) && !cJSON_IsNull(routing_id)) { + ogs_error("OpenAPI_authentication_info_result_parseFromJSON() failed [routing_id]"); + goto end; + } + } + + pvs_info = cJSON_GetObjectItemCaseSensitive(authentication_info_resultJSON, "pvsInfo"); + if (pvs_info) { + cJSON *pvs_info_local = NULL; + if (!cJSON_IsArray(pvs_info)) { + ogs_error("OpenAPI_authentication_info_result_parseFromJSON() failed [pvs_info]"); + goto end; + } + + pvs_infoList = OpenAPI_list_create(); + + cJSON_ArrayForEach(pvs_info_local, pvs_info) { + if (!cJSON_IsObject(pvs_info_local)) { + ogs_error("OpenAPI_authentication_info_result_parseFromJSON() failed [pvs_info]"); + goto end; + } + OpenAPI_server_addressing_info_t *pvs_infoItem = OpenAPI_server_addressing_info_parseFromJSON(pvs_info_local); + if (!pvs_infoItem) { + ogs_error("No pvs_infoItem"); + OpenAPI_list_free(pvs_infoList); + goto end; + } + OpenAPI_list_add(pvs_infoList, pvs_infoItem); + } + } + authentication_info_result_local_var = OpenAPI_authentication_info_result_create ( auth_typeVariable, supported_features && !cJSON_IsNull(supported_features) ? ogs_strdup(supported_features->valuestring) : NULL, authentication_vector ? authentication_vector_local_nonprim : NULL, - supi && !cJSON_IsNull(supi) ? ogs_strdup(supi->valuestring) : NULL + supi && !cJSON_IsNull(supi) ? ogs_strdup(supi->valuestring) : NULL, + akma_ind ? true : false, + akma_ind ? akma_ind->valueint : 0, + auth_aaa ? true : false, + auth_aaa ? auth_aaa->valueint : 0, + routing_id && !cJSON_IsNull(routing_id) ? ogs_strdup(routing_id->valuestring) : NULL, + pvs_info ? pvs_infoList : NULL ); return authentication_info_result_local_var; @@ -150,6 +270,13 @@ end: OpenAPI_authentication_vector_free(authentication_vector_local_nonprim); authentication_vector_local_nonprim = NULL; } + if (pvs_infoList) { + OpenAPI_list_for_each(pvs_infoList, node) { + OpenAPI_server_addressing_info_free(node->data); + } + OpenAPI_list_free(pvs_infoList); + pvs_infoList = NULL; + } return NULL; } diff --git a/lib/sbi/openapi/model/authentication_info_result.h b/lib/sbi/openapi/model/authentication_info_result.h index 1515a46e6..60050f7a4 100644 --- a/lib/sbi/openapi/model/authentication_info_result.h +++ b/lib/sbi/openapi/model/authentication_info_result.h @@ -14,6 +14,7 @@ #include "../include/binary.h" #include "auth_type.h" #include "authentication_vector.h" +#include "server_addressing_info.h" #ifdef __cplusplus extern "C" { @@ -25,13 +26,25 @@ typedef struct OpenAPI_authentication_info_result_s { char *supported_features; struct OpenAPI_authentication_vector_s *authentication_vector; char *supi; + bool is_akma_ind; + int akma_ind; + bool is_auth_aaa; + int auth_aaa; + char *routing_id; + OpenAPI_list_t *pvs_info; } OpenAPI_authentication_info_result_t; OpenAPI_authentication_info_result_t *OpenAPI_authentication_info_result_create( OpenAPI_auth_type_e auth_type, char *supported_features, OpenAPI_authentication_vector_t *authentication_vector, - char *supi + char *supi, + bool is_akma_ind, + int akma_ind, + bool is_auth_aaa, + int auth_aaa, + char *routing_id, + OpenAPI_list_t *pvs_info ); void OpenAPI_authentication_info_result_free(OpenAPI_authentication_info_result_t *authentication_info_result); OpenAPI_authentication_info_result_t *OpenAPI_authentication_info_result_parseFromJSON(cJSON *authentication_info_resultJSON); diff --git a/lib/sbi/openapi/model/authentication_subscription.c b/lib/sbi/openapi/model/authentication_subscription.c index 547aa5e84..3b4adcf5f 100644 --- a/lib/sbi/openapi/model/authentication_subscription.c +++ b/lib/sbi/openapi/model/authentication_subscription.c @@ -15,10 +15,14 @@ OpenAPI_authentication_subscription_t *OpenAPI_authentication_subscription_creat char *enc_topc_key, bool is_vector_generation_in_hss, int vector_generation_in_hss, + char *hss_group_id, OpenAPI_auth_method_e n5gc_auth_method, bool is_rg_authentication_ind, int rg_authentication_ind, - char *supi + char *supi, + bool is_akma_allowed, + int akma_allowed, + char *routing_id ) { OpenAPI_authentication_subscription_t *authentication_subscription_local_var = ogs_malloc(sizeof(OpenAPI_authentication_subscription_t)); @@ -34,10 +38,14 @@ OpenAPI_authentication_subscription_t *OpenAPI_authentication_subscription_creat authentication_subscription_local_var->enc_topc_key = enc_topc_key; authentication_subscription_local_var->is_vector_generation_in_hss = is_vector_generation_in_hss; authentication_subscription_local_var->vector_generation_in_hss = vector_generation_in_hss; + authentication_subscription_local_var->hss_group_id = hss_group_id; authentication_subscription_local_var->n5gc_auth_method = n5gc_auth_method; authentication_subscription_local_var->is_rg_authentication_ind = is_rg_authentication_ind; authentication_subscription_local_var->rg_authentication_ind = rg_authentication_ind; authentication_subscription_local_var->supi = supi; + authentication_subscription_local_var->is_akma_allowed = is_akma_allowed; + authentication_subscription_local_var->akma_allowed = akma_allowed; + authentication_subscription_local_var->routing_id = routing_id; return authentication_subscription_local_var; } @@ -77,10 +85,18 @@ void OpenAPI_authentication_subscription_free(OpenAPI_authentication_subscriptio ogs_free(authentication_subscription->enc_topc_key); authentication_subscription->enc_topc_key = NULL; } + if (authentication_subscription->hss_group_id) { + ogs_free(authentication_subscription->hss_group_id); + authentication_subscription->hss_group_id = NULL; + } if (authentication_subscription->supi) { ogs_free(authentication_subscription->supi); authentication_subscription->supi = NULL; } + if (authentication_subscription->routing_id) { + ogs_free(authentication_subscription->routing_id); + authentication_subscription->routing_id = NULL; + } ogs_free(authentication_subscription); } @@ -166,6 +182,13 @@ cJSON *OpenAPI_authentication_subscription_convertToJSON(OpenAPI_authentication_ } } + if (authentication_subscription->hss_group_id) { + if (cJSON_AddStringToObject(item, "hssGroupId", authentication_subscription->hss_group_id) == NULL) { + ogs_error("OpenAPI_authentication_subscription_convertToJSON() failed [hss_group_id]"); + goto end; + } + } + if (authentication_subscription->n5gc_auth_method != OpenAPI_auth_method_NULL) { if (cJSON_AddStringToObject(item, "n5gcAuthMethod", OpenAPI_auth_method_ToString(authentication_subscription->n5gc_auth_method)) == NULL) { ogs_error("OpenAPI_authentication_subscription_convertToJSON() failed [n5gc_auth_method]"); @@ -187,6 +210,20 @@ cJSON *OpenAPI_authentication_subscription_convertToJSON(OpenAPI_authentication_ } } + if (authentication_subscription->is_akma_allowed) { + if (cJSON_AddBoolToObject(item, "akmaAllowed", authentication_subscription->akma_allowed) == NULL) { + ogs_error("OpenAPI_authentication_subscription_convertToJSON() failed [akma_allowed]"); + goto end; + } + } + + if (authentication_subscription->routing_id) { + if (cJSON_AddStringToObject(item, "routingId", authentication_subscription->routing_id) == NULL) { + ogs_error("OpenAPI_authentication_subscription_convertToJSON() failed [routing_id]"); + goto end; + } + } + end: return item; } @@ -206,10 +243,13 @@ OpenAPI_authentication_subscription_t *OpenAPI_authentication_subscription_parse cJSON *enc_opc_key = NULL; cJSON *enc_topc_key = NULL; cJSON *vector_generation_in_hss = NULL; + cJSON *hss_group_id = NULL; cJSON *n5gc_auth_method = NULL; OpenAPI_auth_method_e n5gc_auth_methodVariable = 0; cJSON *rg_authentication_ind = NULL; cJSON *supi = NULL; + cJSON *akma_allowed = NULL; + cJSON *routing_id = NULL; authentication_method = cJSON_GetObjectItemCaseSensitive(authentication_subscriptionJSON, "authenticationMethod"); if (!authentication_method) { ogs_error("OpenAPI_authentication_subscription_parseFromJSON() failed [authentication_method]"); @@ -282,6 +322,14 @@ OpenAPI_authentication_subscription_t *OpenAPI_authentication_subscription_parse } } + hss_group_id = cJSON_GetObjectItemCaseSensitive(authentication_subscriptionJSON, "hssGroupId"); + if (hss_group_id) { + if (!cJSON_IsString(hss_group_id) && !cJSON_IsNull(hss_group_id)) { + ogs_error("OpenAPI_authentication_subscription_parseFromJSON() failed [hss_group_id]"); + goto end; + } + } + n5gc_auth_method = cJSON_GetObjectItemCaseSensitive(authentication_subscriptionJSON, "n5gcAuthMethod"); if (n5gc_auth_method) { if (!cJSON_IsString(n5gc_auth_method)) { @@ -307,6 +355,22 @@ OpenAPI_authentication_subscription_t *OpenAPI_authentication_subscription_parse } } + akma_allowed = cJSON_GetObjectItemCaseSensitive(authentication_subscriptionJSON, "akmaAllowed"); + if (akma_allowed) { + if (!cJSON_IsBool(akma_allowed)) { + ogs_error("OpenAPI_authentication_subscription_parseFromJSON() failed [akma_allowed]"); + goto end; + } + } + + routing_id = cJSON_GetObjectItemCaseSensitive(authentication_subscriptionJSON, "routingId"); + if (routing_id) { + if (!cJSON_IsString(routing_id) && !cJSON_IsNull(routing_id)) { + ogs_error("OpenAPI_authentication_subscription_parseFromJSON() failed [routing_id]"); + goto end; + } + } + authentication_subscription_local_var = OpenAPI_authentication_subscription_create ( authentication_methodVariable, enc_permanent_key && !cJSON_IsNull(enc_permanent_key) ? ogs_strdup(enc_permanent_key->valuestring) : NULL, @@ -318,10 +382,14 @@ OpenAPI_authentication_subscription_t *OpenAPI_authentication_subscription_parse enc_topc_key && !cJSON_IsNull(enc_topc_key) ? ogs_strdup(enc_topc_key->valuestring) : NULL, vector_generation_in_hss ? true : false, vector_generation_in_hss ? vector_generation_in_hss->valueint : 0, + hss_group_id && !cJSON_IsNull(hss_group_id) ? ogs_strdup(hss_group_id->valuestring) : NULL, n5gc_auth_method ? n5gc_auth_methodVariable : 0, rg_authentication_ind ? true : false, rg_authentication_ind ? rg_authentication_ind->valueint : 0, - supi && !cJSON_IsNull(supi) ? ogs_strdup(supi->valuestring) : NULL + supi && !cJSON_IsNull(supi) ? ogs_strdup(supi->valuestring) : NULL, + akma_allowed ? true : false, + akma_allowed ? akma_allowed->valueint : 0, + routing_id && !cJSON_IsNull(routing_id) ? ogs_strdup(routing_id->valuestring) : NULL ); return authentication_subscription_local_var; diff --git a/lib/sbi/openapi/model/authentication_subscription.h b/lib/sbi/openapi/model/authentication_subscription.h index 12a930087..ccf05e4a6 100644 --- a/lib/sbi/openapi/model/authentication_subscription.h +++ b/lib/sbi/openapi/model/authentication_subscription.h @@ -1,7 +1,7 @@ /* * authentication_subscription.h * - * + * A UE's authentication data. */ #ifndef _OpenAPI_authentication_subscription_H_ @@ -31,10 +31,14 @@ typedef struct OpenAPI_authentication_subscription_s { char *enc_topc_key; bool is_vector_generation_in_hss; int vector_generation_in_hss; + char *hss_group_id; OpenAPI_auth_method_e n5gc_auth_method; bool is_rg_authentication_ind; int rg_authentication_ind; char *supi; + bool is_akma_allowed; + int akma_allowed; + char *routing_id; } OpenAPI_authentication_subscription_t; OpenAPI_authentication_subscription_t *OpenAPI_authentication_subscription_create( @@ -48,10 +52,14 @@ OpenAPI_authentication_subscription_t *OpenAPI_authentication_subscription_creat char *enc_topc_key, bool is_vector_generation_in_hss, int vector_generation_in_hss, + char *hss_group_id, OpenAPI_auth_method_e n5gc_auth_method, bool is_rg_authentication_ind, int rg_authentication_ind, - char *supi + char *supi, + bool is_akma_allowed, + int akma_allowed, + char *routing_id ); void OpenAPI_authentication_subscription_free(OpenAPI_authentication_subscription_t *authentication_subscription); OpenAPI_authentication_subscription_t *OpenAPI_authentication_subscription_parseFromJSON(cJSON *authentication_subscriptionJSON); diff --git a/lib/sbi/openapi/model/authorization_data.c b/lib/sbi/openapi/model/authorization_data.c index f61615be4..da6a19634 100644 --- a/lib/sbi/openapi/model/authorization_data.c +++ b/lib/sbi/openapi/model/authorization_data.c @@ -5,7 +5,10 @@ #include "authorization_data.h" OpenAPI_authorization_data_t *OpenAPI_authorization_data_create( - OpenAPI_list_t *authorization_data, + OpenAPI_set_t *authorization_data, + OpenAPI_list_t *allowed_dnn_list, + OpenAPI_list_t *allowed_snssai_list, + OpenAPI_list_t *allowed_mtc_providers, char *validity_time ) { @@ -13,6 +16,9 @@ OpenAPI_authorization_data_t *OpenAPI_authorization_data_create( ogs_assert(authorization_data_local_var); authorization_data_local_var->authorization_data = authorization_data; + authorization_data_local_var->allowed_dnn_list = allowed_dnn_list; + authorization_data_local_var->allowed_snssai_list = allowed_snssai_list; + authorization_data_local_var->allowed_mtc_providers = allowed_mtc_providers; authorization_data_local_var->validity_time = validity_time; return authorization_data_local_var; @@ -32,6 +38,27 @@ void OpenAPI_authorization_data_free(OpenAPI_authorization_data_t *authorization OpenAPI_list_free(authorization_data->authorization_data); authorization_data->authorization_data = NULL; } + if (authorization_data->allowed_dnn_list) { + OpenAPI_list_for_each(authorization_data->allowed_dnn_list, node) { + ogs_free(node->data); + } + OpenAPI_list_free(authorization_data->allowed_dnn_list); + authorization_data->allowed_dnn_list = NULL; + } + if (authorization_data->allowed_snssai_list) { + OpenAPI_list_for_each(authorization_data->allowed_snssai_list, node) { + OpenAPI_snssai_free(node->data); + } + OpenAPI_list_free(authorization_data->allowed_snssai_list); + authorization_data->allowed_snssai_list = NULL; + } + if (authorization_data->allowed_mtc_providers) { + OpenAPI_list_for_each(authorization_data->allowed_mtc_providers, node) { + OpenAPI_mtc_provider_free(node->data); + } + OpenAPI_list_free(authorization_data->allowed_mtc_providers); + authorization_data->allowed_mtc_providers = NULL; + } if (authorization_data->validity_time) { ogs_free(authorization_data->validity_time); authorization_data->validity_time = NULL; @@ -68,6 +95,52 @@ cJSON *OpenAPI_authorization_data_convertToJSON(OpenAPI_authorization_data_t *au cJSON_AddItemToArray(authorization_dataList, itemLocal); } + if (authorization_data->allowed_dnn_list) { + cJSON *allowed_dnn_listList = cJSON_AddArrayToObject(item, "allowedDnnList"); + if (allowed_dnn_listList == NULL) { + ogs_error("OpenAPI_authorization_data_convertToJSON() failed [allowed_dnn_list]"); + goto end; + } + OpenAPI_list_for_each(authorization_data->allowed_dnn_list, node) { + if (cJSON_AddStringToObject(allowed_dnn_listList, "", (char*)node->data) == NULL) { + ogs_error("OpenAPI_authorization_data_convertToJSON() failed [allowed_dnn_list]"); + goto end; + } + } + } + + if (authorization_data->allowed_snssai_list) { + cJSON *allowed_snssai_listList = cJSON_AddArrayToObject(item, "allowedSnssaiList"); + if (allowed_snssai_listList == NULL) { + ogs_error("OpenAPI_authorization_data_convertToJSON() failed [allowed_snssai_list]"); + goto end; + } + OpenAPI_list_for_each(authorization_data->allowed_snssai_list, node) { + cJSON *itemLocal = OpenAPI_snssai_convertToJSON(node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_authorization_data_convertToJSON() failed [allowed_snssai_list]"); + goto end; + } + cJSON_AddItemToArray(allowed_snssai_listList, itemLocal); + } + } + + if (authorization_data->allowed_mtc_providers) { + cJSON *allowed_mtc_providersList = cJSON_AddArrayToObject(item, "allowedMtcProviders"); + if (allowed_mtc_providersList == NULL) { + ogs_error("OpenAPI_authorization_data_convertToJSON() failed [allowed_mtc_providers]"); + goto end; + } + OpenAPI_list_for_each(authorization_data->allowed_mtc_providers, node) { + cJSON *itemLocal = OpenAPI_mtc_provider_convertToJSON(node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_authorization_data_convertToJSON() failed [allowed_mtc_providers]"); + goto end; + } + cJSON_AddItemToArray(allowed_mtc_providersList, itemLocal); + } + } + if (authorization_data->validity_time) { if (cJSON_AddStringToObject(item, "validityTime", authorization_data->validity_time) == NULL) { ogs_error("OpenAPI_authorization_data_convertToJSON() failed [validity_time]"); @@ -85,6 +158,12 @@ OpenAPI_authorization_data_t *OpenAPI_authorization_data_parseFromJSON(cJSON *au OpenAPI_lnode_t *node = NULL; cJSON *authorization_data = NULL; OpenAPI_list_t *authorization_dataList = NULL; + cJSON *allowed_dnn_list = NULL; + OpenAPI_list_t *allowed_dnn_listList = NULL; + cJSON *allowed_snssai_list = NULL; + OpenAPI_list_t *allowed_snssai_listList = NULL; + cJSON *allowed_mtc_providers = NULL; + OpenAPI_list_t *allowed_mtc_providersList = NULL; cJSON *validity_time = NULL; authorization_data = cJSON_GetObjectItemCaseSensitive(authorization_dataJSON, "authorizationData"); if (!authorization_data) { @@ -113,6 +192,77 @@ OpenAPI_authorization_data_t *OpenAPI_authorization_data_parseFromJSON(cJSON *au OpenAPI_list_add(authorization_dataList, authorization_dataItem); } + allowed_dnn_list = cJSON_GetObjectItemCaseSensitive(authorization_dataJSON, "allowedDnnList"); + if (allowed_dnn_list) { + cJSON *allowed_dnn_list_local = NULL; + if (!cJSON_IsArray(allowed_dnn_list)) { + ogs_error("OpenAPI_authorization_data_parseFromJSON() failed [allowed_dnn_list]"); + goto end; + } + + allowed_dnn_listList = OpenAPI_list_create(); + + cJSON_ArrayForEach(allowed_dnn_list_local, allowed_dnn_list) { + double *localDouble = NULL; + int *localInt = NULL; + if (!cJSON_IsString(allowed_dnn_list_local)) { + ogs_error("OpenAPI_authorization_data_parseFromJSON() failed [allowed_dnn_list]"); + goto end; + } + OpenAPI_list_add(allowed_dnn_listList, ogs_strdup(allowed_dnn_list_local->valuestring)); + } + } + + allowed_snssai_list = cJSON_GetObjectItemCaseSensitive(authorization_dataJSON, "allowedSnssaiList"); + if (allowed_snssai_list) { + cJSON *allowed_snssai_list_local = NULL; + if (!cJSON_IsArray(allowed_snssai_list)) { + ogs_error("OpenAPI_authorization_data_parseFromJSON() failed [allowed_snssai_list]"); + goto end; + } + + allowed_snssai_listList = OpenAPI_list_create(); + + cJSON_ArrayForEach(allowed_snssai_list_local, allowed_snssai_list) { + if (!cJSON_IsObject(allowed_snssai_list_local)) { + ogs_error("OpenAPI_authorization_data_parseFromJSON() failed [allowed_snssai_list]"); + goto end; + } + OpenAPI_snssai_t *allowed_snssai_listItem = OpenAPI_snssai_parseFromJSON(allowed_snssai_list_local); + if (!allowed_snssai_listItem) { + ogs_error("No allowed_snssai_listItem"); + OpenAPI_list_free(allowed_snssai_listList); + goto end; + } + OpenAPI_list_add(allowed_snssai_listList, allowed_snssai_listItem); + } + } + + allowed_mtc_providers = cJSON_GetObjectItemCaseSensitive(authorization_dataJSON, "allowedMtcProviders"); + if (allowed_mtc_providers) { + cJSON *allowed_mtc_providers_local = NULL; + if (!cJSON_IsArray(allowed_mtc_providers)) { + ogs_error("OpenAPI_authorization_data_parseFromJSON() failed [allowed_mtc_providers]"); + goto end; + } + + allowed_mtc_providersList = OpenAPI_list_create(); + + cJSON_ArrayForEach(allowed_mtc_providers_local, allowed_mtc_providers) { + if (!cJSON_IsObject(allowed_mtc_providers_local)) { + ogs_error("OpenAPI_authorization_data_parseFromJSON() failed [allowed_mtc_providers]"); + goto end; + } + OpenAPI_mtc_provider_t *allowed_mtc_providersItem = OpenAPI_mtc_provider_parseFromJSON(allowed_mtc_providers_local); + if (!allowed_mtc_providersItem) { + ogs_error("No allowed_mtc_providersItem"); + OpenAPI_list_free(allowed_mtc_providersList); + goto end; + } + OpenAPI_list_add(allowed_mtc_providersList, allowed_mtc_providersItem); + } + } + validity_time = cJSON_GetObjectItemCaseSensitive(authorization_dataJSON, "validityTime"); if (validity_time) { if (!cJSON_IsString(validity_time) && !cJSON_IsNull(validity_time)) { @@ -123,6 +273,9 @@ OpenAPI_authorization_data_t *OpenAPI_authorization_data_parseFromJSON(cJSON *au authorization_data_local_var = OpenAPI_authorization_data_create ( authorization_dataList, + allowed_dnn_list ? allowed_dnn_listList : NULL, + allowed_snssai_list ? allowed_snssai_listList : NULL, + allowed_mtc_providers ? allowed_mtc_providersList : NULL, validity_time && !cJSON_IsNull(validity_time) ? ogs_strdup(validity_time->valuestring) : NULL ); @@ -135,6 +288,27 @@ end: OpenAPI_list_free(authorization_dataList); authorization_dataList = NULL; } + if (allowed_dnn_listList) { + OpenAPI_list_for_each(allowed_dnn_listList, node) { + ogs_free(node->data); + } + OpenAPI_list_free(allowed_dnn_listList); + allowed_dnn_listList = NULL; + } + if (allowed_snssai_listList) { + OpenAPI_list_for_each(allowed_snssai_listList, node) { + OpenAPI_snssai_free(node->data); + } + OpenAPI_list_free(allowed_snssai_listList); + allowed_snssai_listList = NULL; + } + if (allowed_mtc_providersList) { + OpenAPI_list_for_each(allowed_mtc_providersList, node) { + OpenAPI_mtc_provider_free(node->data); + } + OpenAPI_list_free(allowed_mtc_providersList); + allowed_mtc_providersList = NULL; + } return NULL; } diff --git a/lib/sbi/openapi/model/authorization_data.h b/lib/sbi/openapi/model/authorization_data.h index 0b547ff6f..b6eed6977 100644 --- a/lib/sbi/openapi/model/authorization_data.h +++ b/lib/sbi/openapi/model/authorization_data.h @@ -1,7 +1,7 @@ /* * authorization_data.h * - * + * NIDD Authorization Information */ #ifndef _OpenAPI_authorization_data_H_ @@ -12,6 +12,9 @@ #include "../include/list.h" #include "../include/keyValuePair.h" #include "../include/binary.h" +#include "mtc_provider.h" +#include "set.h" +#include "snssai.h" #include "user_identifier.h" #ifdef __cplusplus @@ -20,12 +23,18 @@ extern "C" { typedef struct OpenAPI_authorization_data_s OpenAPI_authorization_data_t; typedef struct OpenAPI_authorization_data_s { - OpenAPI_list_t *authorization_data; + OpenAPI_set_t *authorization_data; + OpenAPI_list_t *allowed_dnn_list; + OpenAPI_list_t *allowed_snssai_list; + OpenAPI_list_t *allowed_mtc_providers; char *validity_time; } OpenAPI_authorization_data_t; OpenAPI_authorization_data_t *OpenAPI_authorization_data_create( - OpenAPI_list_t *authorization_data, + OpenAPI_set_t *authorization_data, + OpenAPI_list_t *allowed_dnn_list, + OpenAPI_list_t *allowed_snssai_list, + OpenAPI_list_t *allowed_mtc_providers, char *validity_time ); void OpenAPI_authorization_data_free(OpenAPI_authorization_data_t *authorization_data); diff --git a/lib/sbi/openapi/model/authorization_info.c b/lib/sbi/openapi/model/authorization_info.c new file mode 100644 index 000000000..ee9d3eab3 --- /dev/null +++ b/lib/sbi/openapi/model/authorization_info.c @@ -0,0 +1,303 @@ + +#include +#include +#include +#include "authorization_info.h" + +OpenAPI_authorization_info_t *OpenAPI_authorization_info_create( + OpenAPI_snssai_t *snssai, + char *dnn, + char *mtc_provider_information, + char *auth_update_callback_uri, + char *af_id, + char *nef_id, + char *validity_time, + OpenAPI_context_info_t *context_info +) +{ + OpenAPI_authorization_info_t *authorization_info_local_var = ogs_malloc(sizeof(OpenAPI_authorization_info_t)); + ogs_assert(authorization_info_local_var); + + authorization_info_local_var->snssai = snssai; + authorization_info_local_var->dnn = dnn; + authorization_info_local_var->mtc_provider_information = mtc_provider_information; + authorization_info_local_var->auth_update_callback_uri = auth_update_callback_uri; + authorization_info_local_var->af_id = af_id; + authorization_info_local_var->nef_id = nef_id; + authorization_info_local_var->validity_time = validity_time; + authorization_info_local_var->context_info = context_info; + + return authorization_info_local_var; +} + +void OpenAPI_authorization_info_free(OpenAPI_authorization_info_t *authorization_info) +{ + OpenAPI_lnode_t *node = NULL; + + if (NULL == authorization_info) { + return; + } + if (authorization_info->snssai) { + OpenAPI_snssai_free(authorization_info->snssai); + authorization_info->snssai = NULL; + } + if (authorization_info->dnn) { + ogs_free(authorization_info->dnn); + authorization_info->dnn = NULL; + } + if (authorization_info->mtc_provider_information) { + ogs_free(authorization_info->mtc_provider_information); + authorization_info->mtc_provider_information = NULL; + } + if (authorization_info->auth_update_callback_uri) { + ogs_free(authorization_info->auth_update_callback_uri); + authorization_info->auth_update_callback_uri = NULL; + } + if (authorization_info->af_id) { + ogs_free(authorization_info->af_id); + authorization_info->af_id = NULL; + } + if (authorization_info->nef_id) { + ogs_free(authorization_info->nef_id); + authorization_info->nef_id = NULL; + } + if (authorization_info->validity_time) { + ogs_free(authorization_info->validity_time); + authorization_info->validity_time = NULL; + } + if (authorization_info->context_info) { + OpenAPI_context_info_free(authorization_info->context_info); + authorization_info->context_info = NULL; + } + ogs_free(authorization_info); +} + +cJSON *OpenAPI_authorization_info_convertToJSON(OpenAPI_authorization_info_t *authorization_info) +{ + cJSON *item = NULL; + OpenAPI_lnode_t *node = NULL; + + if (authorization_info == NULL) { + ogs_error("OpenAPI_authorization_info_convertToJSON() failed [AuthorizationInfo]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (!authorization_info->snssai) { + ogs_error("OpenAPI_authorization_info_convertToJSON() failed [snssai]"); + return NULL; + } + cJSON *snssai_local_JSON = OpenAPI_snssai_convertToJSON(authorization_info->snssai); + if (snssai_local_JSON == NULL) { + ogs_error("OpenAPI_authorization_info_convertToJSON() failed [snssai]"); + goto end; + } + cJSON_AddItemToObject(item, "snssai", snssai_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_authorization_info_convertToJSON() failed [snssai]"); + goto end; + } + + if (!authorization_info->dnn) { + ogs_error("OpenAPI_authorization_info_convertToJSON() failed [dnn]"); + return NULL; + } + if (cJSON_AddStringToObject(item, "dnn", authorization_info->dnn) == NULL) { + ogs_error("OpenAPI_authorization_info_convertToJSON() failed [dnn]"); + goto end; + } + + if (!authorization_info->mtc_provider_information) { + ogs_error("OpenAPI_authorization_info_convertToJSON() failed [mtc_provider_information]"); + return NULL; + } + if (cJSON_AddStringToObject(item, "mtcProviderInformation", authorization_info->mtc_provider_information) == NULL) { + ogs_error("OpenAPI_authorization_info_convertToJSON() failed [mtc_provider_information]"); + goto end; + } + + if (!authorization_info->auth_update_callback_uri) { + ogs_error("OpenAPI_authorization_info_convertToJSON() failed [auth_update_callback_uri]"); + return NULL; + } + if (cJSON_AddStringToObject(item, "authUpdateCallbackUri", authorization_info->auth_update_callback_uri) == NULL) { + ogs_error("OpenAPI_authorization_info_convertToJSON() failed [auth_update_callback_uri]"); + goto end; + } + + if (authorization_info->af_id) { + if (cJSON_AddStringToObject(item, "afId", authorization_info->af_id) == NULL) { + ogs_error("OpenAPI_authorization_info_convertToJSON() failed [af_id]"); + goto end; + } + } + + if (authorization_info->nef_id) { + if (cJSON_AddStringToObject(item, "nefId", authorization_info->nef_id) == NULL) { + ogs_error("OpenAPI_authorization_info_convertToJSON() failed [nef_id]"); + goto end; + } + } + + if (authorization_info->validity_time) { + if (cJSON_AddStringToObject(item, "validityTime", authorization_info->validity_time) == NULL) { + ogs_error("OpenAPI_authorization_info_convertToJSON() failed [validity_time]"); + goto end; + } + } + + if (authorization_info->context_info) { + cJSON *context_info_local_JSON = OpenAPI_context_info_convertToJSON(authorization_info->context_info); + if (context_info_local_JSON == NULL) { + ogs_error("OpenAPI_authorization_info_convertToJSON() failed [context_info]"); + goto end; + } + cJSON_AddItemToObject(item, "contextInfo", context_info_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_authorization_info_convertToJSON() failed [context_info]"); + goto end; + } + } + +end: + return item; +} + +OpenAPI_authorization_info_t *OpenAPI_authorization_info_parseFromJSON(cJSON *authorization_infoJSON) +{ + OpenAPI_authorization_info_t *authorization_info_local_var = NULL; + OpenAPI_lnode_t *node = NULL; + cJSON *snssai = NULL; + OpenAPI_snssai_t *snssai_local_nonprim = NULL; + cJSON *dnn = NULL; + cJSON *mtc_provider_information = NULL; + cJSON *auth_update_callback_uri = NULL; + cJSON *af_id = NULL; + cJSON *nef_id = NULL; + cJSON *validity_time = NULL; + cJSON *context_info = NULL; + OpenAPI_context_info_t *context_info_local_nonprim = NULL; + snssai = cJSON_GetObjectItemCaseSensitive(authorization_infoJSON, "snssai"); + if (!snssai) { + ogs_error("OpenAPI_authorization_info_parseFromJSON() failed [snssai]"); + goto end; + } + snssai_local_nonprim = OpenAPI_snssai_parseFromJSON(snssai); + + dnn = cJSON_GetObjectItemCaseSensitive(authorization_infoJSON, "dnn"); + if (!dnn) { + ogs_error("OpenAPI_authorization_info_parseFromJSON() failed [dnn]"); + goto end; + } + if (!cJSON_IsString(dnn)) { + ogs_error("OpenAPI_authorization_info_parseFromJSON() failed [dnn]"); + goto end; + } + + mtc_provider_information = cJSON_GetObjectItemCaseSensitive(authorization_infoJSON, "mtcProviderInformation"); + if (!mtc_provider_information) { + ogs_error("OpenAPI_authorization_info_parseFromJSON() failed [mtc_provider_information]"); + goto end; + } + if (!cJSON_IsString(mtc_provider_information)) { + ogs_error("OpenAPI_authorization_info_parseFromJSON() failed [mtc_provider_information]"); + goto end; + } + + auth_update_callback_uri = cJSON_GetObjectItemCaseSensitive(authorization_infoJSON, "authUpdateCallbackUri"); + if (!auth_update_callback_uri) { + ogs_error("OpenAPI_authorization_info_parseFromJSON() failed [auth_update_callback_uri]"); + goto end; + } + if (!cJSON_IsString(auth_update_callback_uri)) { + ogs_error("OpenAPI_authorization_info_parseFromJSON() failed [auth_update_callback_uri]"); + goto end; + } + + af_id = cJSON_GetObjectItemCaseSensitive(authorization_infoJSON, "afId"); + if (af_id) { + if (!cJSON_IsString(af_id) && !cJSON_IsNull(af_id)) { + ogs_error("OpenAPI_authorization_info_parseFromJSON() failed [af_id]"); + goto end; + } + } + + nef_id = cJSON_GetObjectItemCaseSensitive(authorization_infoJSON, "nefId"); + if (nef_id) { + if (!cJSON_IsString(nef_id) && !cJSON_IsNull(nef_id)) { + ogs_error("OpenAPI_authorization_info_parseFromJSON() failed [nef_id]"); + goto end; + } + } + + validity_time = cJSON_GetObjectItemCaseSensitive(authorization_infoJSON, "validityTime"); + if (validity_time) { + if (!cJSON_IsString(validity_time) && !cJSON_IsNull(validity_time)) { + ogs_error("OpenAPI_authorization_info_parseFromJSON() failed [validity_time]"); + goto end; + } + } + + context_info = cJSON_GetObjectItemCaseSensitive(authorization_infoJSON, "contextInfo"); + if (context_info) { + context_info_local_nonprim = OpenAPI_context_info_parseFromJSON(context_info); + } + + authorization_info_local_var = OpenAPI_authorization_info_create ( + snssai_local_nonprim, + ogs_strdup(dnn->valuestring), + ogs_strdup(mtc_provider_information->valuestring), + ogs_strdup(auth_update_callback_uri->valuestring), + af_id && !cJSON_IsNull(af_id) ? ogs_strdup(af_id->valuestring) : NULL, + nef_id && !cJSON_IsNull(nef_id) ? ogs_strdup(nef_id->valuestring) : NULL, + validity_time && !cJSON_IsNull(validity_time) ? ogs_strdup(validity_time->valuestring) : NULL, + context_info ? context_info_local_nonprim : NULL + ); + + return authorization_info_local_var; +end: + if (snssai_local_nonprim) { + OpenAPI_snssai_free(snssai_local_nonprim); + snssai_local_nonprim = NULL; + } + if (context_info_local_nonprim) { + OpenAPI_context_info_free(context_info_local_nonprim); + context_info_local_nonprim = NULL; + } + return NULL; +} + +OpenAPI_authorization_info_t *OpenAPI_authorization_info_copy(OpenAPI_authorization_info_t *dst, OpenAPI_authorization_info_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_authorization_info_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_authorization_info_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_authorization_info_free(dst); + dst = OpenAPI_authorization_info_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/authorization_info.h b/lib/sbi/openapi/model/authorization_info.h new file mode 100644 index 000000000..aae8823a3 --- /dev/null +++ b/lib/sbi/openapi/model/authorization_info.h @@ -0,0 +1,54 @@ +/* + * authorization_info.h + * + * Represents NIDD authorization information. + */ + +#ifndef _OpenAPI_authorization_info_H_ +#define _OpenAPI_authorization_info_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "context_info.h" +#include "snssai.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_authorization_info_s OpenAPI_authorization_info_t; +typedef struct OpenAPI_authorization_info_s { + struct OpenAPI_snssai_s *snssai; + char *dnn; + char *mtc_provider_information; + char *auth_update_callback_uri; + char *af_id; + char *nef_id; + char *validity_time; + struct OpenAPI_context_info_s *context_info; +} OpenAPI_authorization_info_t; + +OpenAPI_authorization_info_t *OpenAPI_authorization_info_create( + OpenAPI_snssai_t *snssai, + char *dnn, + char *mtc_provider_information, + char *auth_update_callback_uri, + char *af_id, + char *nef_id, + char *validity_time, + OpenAPI_context_info_t *context_info +); +void OpenAPI_authorization_info_free(OpenAPI_authorization_info_t *authorization_info); +OpenAPI_authorization_info_t *OpenAPI_authorization_info_parseFromJSON(cJSON *authorization_infoJSON); +cJSON *OpenAPI_authorization_info_convertToJSON(OpenAPI_authorization_info_t *authorization_info); +OpenAPI_authorization_info_t *OpenAPI_authorization_info_copy(OpenAPI_authorization_info_t *dst, OpenAPI_authorization_info_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_authorization_info_H_ */ + diff --git a/lib/sbi/openapi/model/authorized_default_qos.h b/lib/sbi/openapi/model/authorized_default_qos.h index 5647d2006..acd1ca705 100644 --- a/lib/sbi/openapi/model/authorized_default_qos.h +++ b/lib/sbi/openapi/model/authorized_default_qos.h @@ -1,7 +1,7 @@ /* * authorized_default_qos.h * - * + * Represents the Authorized Default QoS. */ #ifndef _OpenAPI_authorized_default_qos_H_ diff --git a/lib/sbi/openapi/model/authorized_network_slice_info.c b/lib/sbi/openapi/model/authorized_network_slice_info.c index 138b777c9..19bbff747 100644 --- a/lib/sbi/openapi/model/authorized_network_slice_info.c +++ b/lib/sbi/openapi/model/authorized_network_slice_info.c @@ -16,7 +16,10 @@ OpenAPI_authorized_network_slice_info_t *OpenAPI_authorized_network_slice_info_c char *nrf_amf_set, char *nrf_amf_set_nf_mgt_uri, char *nrf_amf_set_access_token_uri, - char *target_amf_service_set + OpenAPI_list_t* nrf_oauth2_required, + char *target_amf_service_set, + OpenAPI_list_t *target_nssai, + OpenAPI_list_t *nsag_infos ) { OpenAPI_authorized_network_slice_info_t *authorized_network_slice_info_local_var = ogs_malloc(sizeof(OpenAPI_authorized_network_slice_info_t)); @@ -33,7 +36,10 @@ OpenAPI_authorized_network_slice_info_t *OpenAPI_authorized_network_slice_info_c authorized_network_slice_info_local_var->nrf_amf_set = nrf_amf_set; authorized_network_slice_info_local_var->nrf_amf_set_nf_mgt_uri = nrf_amf_set_nf_mgt_uri; authorized_network_slice_info_local_var->nrf_amf_set_access_token_uri = nrf_amf_set_access_token_uri; + authorized_network_slice_info_local_var->nrf_oauth2_required = nrf_oauth2_required; authorized_network_slice_info_local_var->target_amf_service_set = target_amf_service_set; + authorized_network_slice_info_local_var->target_nssai = target_nssai; + authorized_network_slice_info_local_var->nsag_infos = nsag_infos; return authorized_network_slice_info_local_var; } @@ -104,10 +110,34 @@ void OpenAPI_authorized_network_slice_info_free(OpenAPI_authorized_network_slice ogs_free(authorized_network_slice_info->nrf_amf_set_access_token_uri); authorized_network_slice_info->nrf_amf_set_access_token_uri = NULL; } + if (authorized_network_slice_info->nrf_oauth2_required) { + OpenAPI_list_for_each(authorized_network_slice_info->nrf_oauth2_required, node) { + OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*)node->data; + ogs_free(localKeyValue->key); + ogs_free(localKeyValue->value); + OpenAPI_map_free(localKeyValue); + } + OpenAPI_list_free(authorized_network_slice_info->nrf_oauth2_required); + authorized_network_slice_info->nrf_oauth2_required = NULL; + } if (authorized_network_slice_info->target_amf_service_set) { ogs_free(authorized_network_slice_info->target_amf_service_set); authorized_network_slice_info->target_amf_service_set = NULL; } + if (authorized_network_slice_info->target_nssai) { + OpenAPI_list_for_each(authorized_network_slice_info->target_nssai, node) { + OpenAPI_snssai_free(node->data); + } + OpenAPI_list_free(authorized_network_slice_info->target_nssai); + authorized_network_slice_info->target_nssai = NULL; + } + if (authorized_network_slice_info->nsag_infos) { + OpenAPI_list_for_each(authorized_network_slice_info->nsag_infos, node) { + OpenAPI_nsag_info_free(node->data); + } + OpenAPI_list_free(authorized_network_slice_info->nsag_infos); + authorized_network_slice_info->nsag_infos = NULL; + } ogs_free(authorized_network_slice_info); } @@ -248,6 +278,24 @@ cJSON *OpenAPI_authorized_network_slice_info_convertToJSON(OpenAPI_authorized_ne } } + if (authorized_network_slice_info->nrf_oauth2_required) { + cJSON *nrf_oauth2_required = cJSON_AddObjectToObject(item, "nrfOauth2Required"); + if (nrf_oauth2_required == NULL) { + ogs_error("OpenAPI_authorized_network_slice_info_convertToJSON() failed [nrf_oauth2_required]"); + goto end; + } + cJSON *localMapObject = nrf_oauth2_required; + if (authorized_network_slice_info->nrf_oauth2_required) { + OpenAPI_list_for_each(authorized_network_slice_info->nrf_oauth2_required, node) { + OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*)node->data; + if (cJSON_AddBoolToObject(localMapObject, localKeyValue->key, (uintptr_t)localKeyValue->value) == NULL) { + ogs_error("OpenAPI_authorized_network_slice_info_convertToJSON() failed [inner]"); + goto end; + } + } + } + } + if (authorized_network_slice_info->target_amf_service_set) { if (cJSON_AddStringToObject(item, "targetAmfServiceSet", authorized_network_slice_info->target_amf_service_set) == NULL) { ogs_error("OpenAPI_authorized_network_slice_info_convertToJSON() failed [target_amf_service_set]"); @@ -255,6 +303,38 @@ cJSON *OpenAPI_authorized_network_slice_info_convertToJSON(OpenAPI_authorized_ne } } + if (authorized_network_slice_info->target_nssai) { + cJSON *target_nssaiList = cJSON_AddArrayToObject(item, "targetNssai"); + if (target_nssaiList == NULL) { + ogs_error("OpenAPI_authorized_network_slice_info_convertToJSON() failed [target_nssai]"); + goto end; + } + OpenAPI_list_for_each(authorized_network_slice_info->target_nssai, node) { + cJSON *itemLocal = OpenAPI_snssai_convertToJSON(node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_authorized_network_slice_info_convertToJSON() failed [target_nssai]"); + goto end; + } + cJSON_AddItemToArray(target_nssaiList, itemLocal); + } + } + + if (authorized_network_slice_info->nsag_infos) { + cJSON *nsag_infosList = cJSON_AddArrayToObject(item, "nsagInfos"); + if (nsag_infosList == NULL) { + ogs_error("OpenAPI_authorized_network_slice_info_convertToJSON() failed [nsag_infos]"); + goto end; + } + OpenAPI_list_for_each(authorized_network_slice_info->nsag_infos, node) { + cJSON *itemLocal = OpenAPI_nsag_info_convertToJSON(node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_authorized_network_slice_info_convertToJSON() failed [nsag_infos]"); + goto end; + } + cJSON_AddItemToArray(nsag_infosList, itemLocal); + } + } + end: return item; } @@ -280,7 +360,13 @@ OpenAPI_authorized_network_slice_info_t *OpenAPI_authorized_network_slice_info_p cJSON *nrf_amf_set = NULL; cJSON *nrf_amf_set_nf_mgt_uri = NULL; cJSON *nrf_amf_set_access_token_uri = NULL; + cJSON *nrf_oauth2_required = NULL; + OpenAPI_list_t *nrf_oauth2_requiredList = NULL; cJSON *target_amf_service_set = NULL; + cJSON *target_nssai = NULL; + OpenAPI_list_t *target_nssaiList = NULL; + cJSON *nsag_infos = NULL; + OpenAPI_list_t *nsag_infosList = NULL; allowed_nssai_list = cJSON_GetObjectItemCaseSensitive(authorized_network_slice_infoJSON, "allowedNssaiList"); if (allowed_nssai_list) { cJSON *allowed_nssai_list_local = NULL; @@ -447,6 +533,36 @@ OpenAPI_authorized_network_slice_info_t *OpenAPI_authorized_network_slice_info_p } } + nrf_oauth2_required = cJSON_GetObjectItemCaseSensitive(authorized_network_slice_infoJSON, "nrfOauth2Required"); + if (nrf_oauth2_required) { + cJSON *nrf_oauth2_required_local_map = NULL; + if (!cJSON_IsObject(nrf_oauth2_required) && !cJSON_IsNull(nrf_oauth2_required)) { + ogs_error("OpenAPI_authorized_network_slice_info_parseFromJSON() failed [nrf_oauth2_required]"); + goto end; + } + if (cJSON_IsObject(nrf_oauth2_required)) { + nrf_oauth2_requiredList = OpenAPI_list_create(); + OpenAPI_map_t *localMapKeyPair = NULL; + cJSON_ArrayForEach(nrf_oauth2_required_local_map, nrf_oauth2_required) { + cJSON *localMapObject = nrf_oauth2_required_local_map; + double *localDouble = NULL; + int *localInt = NULL; + if (!cJSON_IsBool(localMapObject)) { + ogs_error("OpenAPI_authorized_network_slice_info_parseFromJSON() failed [inner]"); + goto end; + } + localInt = (int *)ogs_calloc(1, sizeof(int)); + if (!localInt) { + ogs_error("OpenAPI_authorized_network_slice_info_parseFromJSON() failed [inner]"); + goto end; + } + *localInt = localMapObject->valueint; + localMapKeyPair = OpenAPI_map_create(ogs_strdup(localMapObject->string), localInt); + OpenAPI_list_add(nrf_oauth2_requiredList, localMapKeyPair); + } + } + } + target_amf_service_set = cJSON_GetObjectItemCaseSensitive(authorized_network_slice_infoJSON, "targetAmfServiceSet"); if (target_amf_service_set) { if (!cJSON_IsString(target_amf_service_set) && !cJSON_IsNull(target_amf_service_set)) { @@ -455,6 +571,56 @@ OpenAPI_authorized_network_slice_info_t *OpenAPI_authorized_network_slice_info_p } } + target_nssai = cJSON_GetObjectItemCaseSensitive(authorized_network_slice_infoJSON, "targetNssai"); + if (target_nssai) { + cJSON *target_nssai_local = NULL; + if (!cJSON_IsArray(target_nssai)) { + ogs_error("OpenAPI_authorized_network_slice_info_parseFromJSON() failed [target_nssai]"); + goto end; + } + + target_nssaiList = OpenAPI_list_create(); + + cJSON_ArrayForEach(target_nssai_local, target_nssai) { + if (!cJSON_IsObject(target_nssai_local)) { + ogs_error("OpenAPI_authorized_network_slice_info_parseFromJSON() failed [target_nssai]"); + goto end; + } + OpenAPI_snssai_t *target_nssaiItem = OpenAPI_snssai_parseFromJSON(target_nssai_local); + if (!target_nssaiItem) { + ogs_error("No target_nssaiItem"); + OpenAPI_list_free(target_nssaiList); + goto end; + } + OpenAPI_list_add(target_nssaiList, target_nssaiItem); + } + } + + nsag_infos = cJSON_GetObjectItemCaseSensitive(authorized_network_slice_infoJSON, "nsagInfos"); + if (nsag_infos) { + cJSON *nsag_infos_local = NULL; + if (!cJSON_IsArray(nsag_infos)) { + ogs_error("OpenAPI_authorized_network_slice_info_parseFromJSON() failed [nsag_infos]"); + goto end; + } + + nsag_infosList = OpenAPI_list_create(); + + cJSON_ArrayForEach(nsag_infos_local, nsag_infos) { + if (!cJSON_IsObject(nsag_infos_local)) { + ogs_error("OpenAPI_authorized_network_slice_info_parseFromJSON() failed [nsag_infos]"); + goto end; + } + OpenAPI_nsag_info_t *nsag_infosItem = OpenAPI_nsag_info_parseFromJSON(nsag_infos_local); + if (!nsag_infosItem) { + ogs_error("No nsag_infosItem"); + OpenAPI_list_free(nsag_infosList); + goto end; + } + OpenAPI_list_add(nsag_infosList, nsag_infosItem); + } + } + authorized_network_slice_info_local_var = OpenAPI_authorized_network_slice_info_create ( allowed_nssai_list ? allowed_nssai_listList : NULL, configured_nssai ? configured_nssaiList : NULL, @@ -467,7 +633,10 @@ OpenAPI_authorized_network_slice_info_t *OpenAPI_authorized_network_slice_info_p nrf_amf_set && !cJSON_IsNull(nrf_amf_set) ? ogs_strdup(nrf_amf_set->valuestring) : NULL, nrf_amf_set_nf_mgt_uri && !cJSON_IsNull(nrf_amf_set_nf_mgt_uri) ? ogs_strdup(nrf_amf_set_nf_mgt_uri->valuestring) : NULL, nrf_amf_set_access_token_uri && !cJSON_IsNull(nrf_amf_set_access_token_uri) ? ogs_strdup(nrf_amf_set_access_token_uri->valuestring) : NULL, - target_amf_service_set && !cJSON_IsNull(target_amf_service_set) ? ogs_strdup(target_amf_service_set->valuestring) : NULL + nrf_oauth2_required ? nrf_oauth2_requiredList : NULL, + target_amf_service_set && !cJSON_IsNull(target_amf_service_set) ? ogs_strdup(target_amf_service_set->valuestring) : NULL, + target_nssai ? target_nssaiList : NULL, + nsag_infos ? nsag_infosList : NULL ); return authorized_network_slice_info_local_var; @@ -511,6 +680,30 @@ end: OpenAPI_nsi_information_free(nsi_information_local_nonprim); nsi_information_local_nonprim = NULL; } + if (nrf_oauth2_requiredList) { + OpenAPI_list_for_each(nrf_oauth2_requiredList, node) { + OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*) node->data; + ogs_free(localKeyValue->key); + ogs_free(localKeyValue->value); + OpenAPI_map_free(localKeyValue); + } + OpenAPI_list_free(nrf_oauth2_requiredList); + nrf_oauth2_requiredList = NULL; + } + if (target_nssaiList) { + OpenAPI_list_for_each(target_nssaiList, node) { + OpenAPI_snssai_free(node->data); + } + OpenAPI_list_free(target_nssaiList); + target_nssaiList = NULL; + } + if (nsag_infosList) { + OpenAPI_list_for_each(nsag_infosList, node) { + OpenAPI_nsag_info_free(node->data); + } + OpenAPI_list_free(nsag_infosList); + nsag_infosList = NULL; + } return NULL; } diff --git a/lib/sbi/openapi/model/authorized_network_slice_info.h b/lib/sbi/openapi/model/authorized_network_slice_info.h index 5ea012bf1..6f29a9ff7 100644 --- a/lib/sbi/openapi/model/authorized_network_slice_info.h +++ b/lib/sbi/openapi/model/authorized_network_slice_info.h @@ -1,7 +1,7 @@ /* * authorized_network_slice_info.h * - * + * Contains the authorized network slice information */ #ifndef _OpenAPI_authorized_network_slice_info_H_ @@ -14,6 +14,7 @@ #include "../include/binary.h" #include "allowed_nssai.h" #include "configured_snssai.h" +#include "nsag_info.h" #include "nsi_information.h" #include "snssai.h" @@ -34,7 +35,10 @@ typedef struct OpenAPI_authorized_network_slice_info_s { char *nrf_amf_set; char *nrf_amf_set_nf_mgt_uri; char *nrf_amf_set_access_token_uri; + OpenAPI_list_t* nrf_oauth2_required; char *target_amf_service_set; + OpenAPI_list_t *target_nssai; + OpenAPI_list_t *nsag_infos; } OpenAPI_authorized_network_slice_info_t; OpenAPI_authorized_network_slice_info_t *OpenAPI_authorized_network_slice_info_create( @@ -49,7 +53,10 @@ OpenAPI_authorized_network_slice_info_t *OpenAPI_authorized_network_slice_info_c char *nrf_amf_set, char *nrf_amf_set_nf_mgt_uri, char *nrf_amf_set_access_token_uri, - char *target_amf_service_set + OpenAPI_list_t* nrf_oauth2_required, + char *target_amf_service_set, + OpenAPI_list_t *target_nssai, + OpenAPI_list_t *nsag_infos ); void OpenAPI_authorized_network_slice_info_free(OpenAPI_authorized_network_slice_info_t *authorized_network_slice_info); OpenAPI_authorized_network_slice_info_t *OpenAPI_authorized_network_slice_info_parseFromJSON(cJSON *authorized_network_slice_infoJSON); diff --git a/lib/sbi/openapi/model/av5g_aka.h b/lib/sbi/openapi/model/av5g_aka.h index 2e82d39f8..774a6855e 100644 --- a/lib/sbi/openapi/model/av5g_aka.h +++ b/lib/sbi/openapi/model/av5g_aka.h @@ -1,7 +1,7 @@ /* * av5g_aka.h * - * + * Contains Authentication Vector for method 5G AKA. */ #ifndef _OpenAPI_av5g_aka_H_ diff --git a/lib/sbi/openapi/model/backup_amf_info.h b/lib/sbi/openapi/model/backup_amf_info.h index 48e13d4e8..335d87e21 100644 --- a/lib/sbi/openapi/model/backup_amf_info.h +++ b/lib/sbi/openapi/model/backup_amf_info.h @@ -1,7 +1,7 @@ /* * backup_amf_info.h * - * + * Provides details of the Backup AMF. */ #ifndef _OpenAPI_backup_amf_info_H_ diff --git a/lib/sbi/openapi/model/battery_indication.h b/lib/sbi/openapi/model/battery_indication.h index f02ad38d4..e9f8532b1 100644 --- a/lib/sbi/openapi/model/battery_indication.h +++ b/lib/sbi/openapi/model/battery_indication.h @@ -1,7 +1,7 @@ /* * battery_indication.h * - * + * Parameters \"replaceableInd\" and \"rechargeableInd\" are only included if the value of Parameter \"batteryInd\" is true. */ #ifndef _OpenAPI_battery_indication_H_ diff --git a/lib/sbi/openapi/model/battery_indication_rm.h b/lib/sbi/openapi/model/battery_indication_rm.h index 098631c3d..6d82828dd 100644 --- a/lib/sbi/openapi/model/battery_indication_rm.h +++ b/lib/sbi/openapi/model/battery_indication_rm.h @@ -1,7 +1,7 @@ /* * battery_indication_rm.h * - * + * This data type is defined in the same way as the 'BatteryIndication' data type, but with the OpenAPI 'nullable: true' property. */ #ifndef _OpenAPI_battery_indication_rm_H_ diff --git a/lib/sbi/openapi/model/bdt_data.c b/lib/sbi/openapi/model/bdt_data.c index 49aa6204a..333a5a545 100644 --- a/lib/sbi/openapi/model/bdt_data.c +++ b/lib/sbi/openapi/model/bdt_data.c @@ -8,7 +8,7 @@ OpenAPI_bdt_data_t *OpenAPI_bdt_data_create( char *asp_id, OpenAPI_transfer_policy_t *trans_policy, char *bdt_ref_id, - OpenAPI_network_area_info_1_t *nw_area_info, + OpenAPI_network_area_info_2_t *nw_area_info, bool is_num_of_ues, int num_of_ues, OpenAPI_usage_threshold_t *vol_per_ue, @@ -16,7 +16,8 @@ OpenAPI_bdt_data_t *OpenAPI_bdt_data_create( OpenAPI_snssai_t *snssai, char *traffic_des, OpenAPI_bdt_policy_status_t *bdtp_status, - char *supp_feat + char *supp_feat, + OpenAPI_list_t *reset_ids ) { OpenAPI_bdt_data_t *bdt_data_local_var = ogs_malloc(sizeof(OpenAPI_bdt_data_t)); @@ -34,6 +35,7 @@ OpenAPI_bdt_data_t *OpenAPI_bdt_data_create( bdt_data_local_var->traffic_des = traffic_des; bdt_data_local_var->bdtp_status = bdtp_status; bdt_data_local_var->supp_feat = supp_feat; + bdt_data_local_var->reset_ids = reset_ids; return bdt_data_local_var; } @@ -58,7 +60,7 @@ void OpenAPI_bdt_data_free(OpenAPI_bdt_data_t *bdt_data) bdt_data->bdt_ref_id = NULL; } if (bdt_data->nw_area_info) { - OpenAPI_network_area_info_1_free(bdt_data->nw_area_info); + OpenAPI_network_area_info_2_free(bdt_data->nw_area_info); bdt_data->nw_area_info = NULL; } if (bdt_data->vol_per_ue) { @@ -85,6 +87,13 @@ void OpenAPI_bdt_data_free(OpenAPI_bdt_data_t *bdt_data) ogs_free(bdt_data->supp_feat); bdt_data->supp_feat = NULL; } + if (bdt_data->reset_ids) { + OpenAPI_list_for_each(bdt_data->reset_ids, node) { + ogs_free(node->data); + } + OpenAPI_list_free(bdt_data->reset_ids); + bdt_data->reset_ids = NULL; + } ogs_free(bdt_data); } @@ -131,7 +140,7 @@ cJSON *OpenAPI_bdt_data_convertToJSON(OpenAPI_bdt_data_t *bdt_data) } if (bdt_data->nw_area_info) { - cJSON *nw_area_info_local_JSON = OpenAPI_network_area_info_1_convertToJSON(bdt_data->nw_area_info); + cJSON *nw_area_info_local_JSON = OpenAPI_network_area_info_2_convertToJSON(bdt_data->nw_area_info); if (nw_area_info_local_JSON == NULL) { ogs_error("OpenAPI_bdt_data_convertToJSON() failed [nw_area_info]"); goto end; @@ -210,6 +219,20 @@ cJSON *OpenAPI_bdt_data_convertToJSON(OpenAPI_bdt_data_t *bdt_data) } } + if (bdt_data->reset_ids) { + cJSON *reset_idsList = cJSON_AddArrayToObject(item, "resetIds"); + if (reset_idsList == NULL) { + ogs_error("OpenAPI_bdt_data_convertToJSON() failed [reset_ids]"); + goto end; + } + OpenAPI_list_for_each(bdt_data->reset_ids, node) { + if (cJSON_AddStringToObject(reset_idsList, "", (char*)node->data) == NULL) { + ogs_error("OpenAPI_bdt_data_convertToJSON() failed [reset_ids]"); + goto end; + } + } + } + end: return item; } @@ -223,7 +246,7 @@ OpenAPI_bdt_data_t *OpenAPI_bdt_data_parseFromJSON(cJSON *bdt_dataJSON) OpenAPI_transfer_policy_t *trans_policy_local_nonprim = NULL; cJSON *bdt_ref_id = NULL; cJSON *nw_area_info = NULL; - OpenAPI_network_area_info_1_t *nw_area_info_local_nonprim = NULL; + OpenAPI_network_area_info_2_t *nw_area_info_local_nonprim = NULL; cJSON *num_of_ues = NULL; cJSON *vol_per_ue = NULL; OpenAPI_usage_threshold_t *vol_per_ue_local_nonprim = NULL; @@ -234,6 +257,8 @@ OpenAPI_bdt_data_t *OpenAPI_bdt_data_parseFromJSON(cJSON *bdt_dataJSON) cJSON *bdtp_status = NULL; OpenAPI_bdt_policy_status_t *bdtp_status_local_nonprim = NULL; cJSON *supp_feat = NULL; + cJSON *reset_ids = NULL; + OpenAPI_list_t *reset_idsList = NULL; asp_id = cJSON_GetObjectItemCaseSensitive(bdt_dataJSON, "aspId"); if (!asp_id) { ogs_error("OpenAPI_bdt_data_parseFromJSON() failed [asp_id]"); @@ -261,7 +286,7 @@ OpenAPI_bdt_data_t *OpenAPI_bdt_data_parseFromJSON(cJSON *bdt_dataJSON) nw_area_info = cJSON_GetObjectItemCaseSensitive(bdt_dataJSON, "nwAreaInfo"); if (nw_area_info) { - nw_area_info_local_nonprim = OpenAPI_network_area_info_1_parseFromJSON(nw_area_info); + nw_area_info_local_nonprim = OpenAPI_network_area_info_2_parseFromJSON(nw_area_info); } num_of_ues = cJSON_GetObjectItemCaseSensitive(bdt_dataJSON, "numOfUes"); @@ -311,6 +336,27 @@ OpenAPI_bdt_data_t *OpenAPI_bdt_data_parseFromJSON(cJSON *bdt_dataJSON) } } + reset_ids = cJSON_GetObjectItemCaseSensitive(bdt_dataJSON, "resetIds"); + if (reset_ids) { + cJSON *reset_ids_local = NULL; + if (!cJSON_IsArray(reset_ids)) { + ogs_error("OpenAPI_bdt_data_parseFromJSON() failed [reset_ids]"); + goto end; + } + + reset_idsList = OpenAPI_list_create(); + + cJSON_ArrayForEach(reset_ids_local, reset_ids) { + double *localDouble = NULL; + int *localInt = NULL; + if (!cJSON_IsString(reset_ids_local)) { + ogs_error("OpenAPI_bdt_data_parseFromJSON() failed [reset_ids]"); + goto end; + } + OpenAPI_list_add(reset_idsList, ogs_strdup(reset_ids_local->valuestring)); + } + } + bdt_data_local_var = OpenAPI_bdt_data_create ( ogs_strdup(asp_id->valuestring), trans_policy_local_nonprim, @@ -323,7 +369,8 @@ OpenAPI_bdt_data_t *OpenAPI_bdt_data_parseFromJSON(cJSON *bdt_dataJSON) snssai ? snssai_local_nonprim : NULL, traffic_des && !cJSON_IsNull(traffic_des) ? ogs_strdup(traffic_des->valuestring) : NULL, bdtp_status ? bdtp_status_local_nonprim : NULL, - supp_feat && !cJSON_IsNull(supp_feat) ? ogs_strdup(supp_feat->valuestring) : NULL + supp_feat && !cJSON_IsNull(supp_feat) ? ogs_strdup(supp_feat->valuestring) : NULL, + reset_ids ? reset_idsList : NULL ); return bdt_data_local_var; @@ -333,7 +380,7 @@ end: trans_policy_local_nonprim = NULL; } if (nw_area_info_local_nonprim) { - OpenAPI_network_area_info_1_free(nw_area_info_local_nonprim); + OpenAPI_network_area_info_2_free(nw_area_info_local_nonprim); nw_area_info_local_nonprim = NULL; } if (vol_per_ue_local_nonprim) { @@ -348,6 +395,13 @@ end: OpenAPI_bdt_policy_status_free(bdtp_status_local_nonprim); bdtp_status_local_nonprim = NULL; } + if (reset_idsList) { + OpenAPI_list_for_each(reset_idsList, node) { + ogs_free(node->data); + } + OpenAPI_list_free(reset_idsList); + reset_idsList = NULL; + } return NULL; } diff --git a/lib/sbi/openapi/model/bdt_data.h b/lib/sbi/openapi/model/bdt_data.h index 57da4d6f6..c3c3bb18c 100644 --- a/lib/sbi/openapi/model/bdt_data.h +++ b/lib/sbi/openapi/model/bdt_data.h @@ -13,7 +13,7 @@ #include "../include/keyValuePair.h" #include "../include/binary.h" #include "bdt_policy_status.h" -#include "network_area_info_1.h" +#include "network_area_info_2.h" #include "snssai.h" #include "transfer_policy.h" #include "usage_threshold.h" @@ -27,7 +27,7 @@ typedef struct OpenAPI_bdt_data_s { char *asp_id; struct OpenAPI_transfer_policy_s *trans_policy; char *bdt_ref_id; - struct OpenAPI_network_area_info_1_s *nw_area_info; + struct OpenAPI_network_area_info_2_s *nw_area_info; bool is_num_of_ues; int num_of_ues; struct OpenAPI_usage_threshold_s *vol_per_ue; @@ -36,13 +36,14 @@ typedef struct OpenAPI_bdt_data_s { char *traffic_des; struct OpenAPI_bdt_policy_status_s *bdtp_status; char *supp_feat; + OpenAPI_list_t *reset_ids; } OpenAPI_bdt_data_t; OpenAPI_bdt_data_t *OpenAPI_bdt_data_create( char *asp_id, OpenAPI_transfer_policy_t *trans_policy, char *bdt_ref_id, - OpenAPI_network_area_info_1_t *nw_area_info, + OpenAPI_network_area_info_2_t *nw_area_info, bool is_num_of_ues, int num_of_ues, OpenAPI_usage_threshold_t *vol_per_ue, @@ -50,7 +51,8 @@ OpenAPI_bdt_data_t *OpenAPI_bdt_data_create( OpenAPI_snssai_t *snssai, char *traffic_des, OpenAPI_bdt_policy_status_t *bdtp_status, - char *supp_feat + char *supp_feat, + OpenAPI_list_t *reset_ids ); void OpenAPI_bdt_data_free(OpenAPI_bdt_data_t *bdt_data); OpenAPI_bdt_data_t *OpenAPI_bdt_data_parseFromJSON(cJSON *bdt_dataJSON); diff --git a/lib/sbi/openapi/model/bdt_policy_data.c b/lib/sbi/openapi/model/bdt_policy_data.c index fb7774894..1ec060cca 100644 --- a/lib/sbi/openapi/model/bdt_policy_data.c +++ b/lib/sbi/openapi/model/bdt_policy_data.c @@ -10,7 +10,8 @@ OpenAPI_bdt_policy_data_t *OpenAPI_bdt_policy_data_create( char *bdt_ref_id, char *dnn, OpenAPI_snssai_t *snssai, - char *res_uri + char *res_uri, + OpenAPI_list_t *reset_ids ) { OpenAPI_bdt_policy_data_t *bdt_policy_data_local_var = ogs_malloc(sizeof(OpenAPI_bdt_policy_data_t)); @@ -22,6 +23,7 @@ OpenAPI_bdt_policy_data_t *OpenAPI_bdt_policy_data_create( bdt_policy_data_local_var->dnn = dnn; bdt_policy_data_local_var->snssai = snssai; bdt_policy_data_local_var->res_uri = res_uri; + bdt_policy_data_local_var->reset_ids = reset_ids; return bdt_policy_data_local_var; } @@ -57,6 +59,13 @@ void OpenAPI_bdt_policy_data_free(OpenAPI_bdt_policy_data_t *bdt_policy_data) ogs_free(bdt_policy_data->res_uri); bdt_policy_data->res_uri = NULL; } + if (bdt_policy_data->reset_ids) { + OpenAPI_list_for_each(bdt_policy_data->reset_ids, node) { + ogs_free(node->data); + } + OpenAPI_list_free(bdt_policy_data->reset_ids); + bdt_policy_data->reset_ids = NULL; + } ogs_free(bdt_policy_data); } @@ -121,6 +130,20 @@ cJSON *OpenAPI_bdt_policy_data_convertToJSON(OpenAPI_bdt_policy_data_t *bdt_poli } } + if (bdt_policy_data->reset_ids) { + cJSON *reset_idsList = cJSON_AddArrayToObject(item, "resetIds"); + if (reset_idsList == NULL) { + ogs_error("OpenAPI_bdt_policy_data_convertToJSON() failed [reset_ids]"); + goto end; + } + OpenAPI_list_for_each(bdt_policy_data->reset_ids, node) { + if (cJSON_AddStringToObject(reset_idsList, "", (char*)node->data) == NULL) { + ogs_error("OpenAPI_bdt_policy_data_convertToJSON() failed [reset_ids]"); + goto end; + } + } + } + end: return item; } @@ -136,6 +159,8 @@ OpenAPI_bdt_policy_data_t *OpenAPI_bdt_policy_data_parseFromJSON(cJSON *bdt_poli cJSON *snssai = NULL; OpenAPI_snssai_t *snssai_local_nonprim = NULL; cJSON *res_uri = NULL; + cJSON *reset_ids = NULL; + OpenAPI_list_t *reset_idsList = NULL; inter_group_id = cJSON_GetObjectItemCaseSensitive(bdt_policy_dataJSON, "interGroupId"); if (inter_group_id) { if (!cJSON_IsString(inter_group_id) && !cJSON_IsNull(inter_group_id)) { @@ -183,13 +208,35 @@ OpenAPI_bdt_policy_data_t *OpenAPI_bdt_policy_data_parseFromJSON(cJSON *bdt_poli } } + reset_ids = cJSON_GetObjectItemCaseSensitive(bdt_policy_dataJSON, "resetIds"); + if (reset_ids) { + cJSON *reset_ids_local = NULL; + if (!cJSON_IsArray(reset_ids)) { + ogs_error("OpenAPI_bdt_policy_data_parseFromJSON() failed [reset_ids]"); + goto end; + } + + reset_idsList = OpenAPI_list_create(); + + cJSON_ArrayForEach(reset_ids_local, reset_ids) { + double *localDouble = NULL; + int *localInt = NULL; + if (!cJSON_IsString(reset_ids_local)) { + ogs_error("OpenAPI_bdt_policy_data_parseFromJSON() failed [reset_ids]"); + goto end; + } + OpenAPI_list_add(reset_idsList, ogs_strdup(reset_ids_local->valuestring)); + } + } + bdt_policy_data_local_var = OpenAPI_bdt_policy_data_create ( inter_group_id && !cJSON_IsNull(inter_group_id) ? ogs_strdup(inter_group_id->valuestring) : NULL, supi && !cJSON_IsNull(supi) ? ogs_strdup(supi->valuestring) : NULL, ogs_strdup(bdt_ref_id->valuestring), dnn && !cJSON_IsNull(dnn) ? ogs_strdup(dnn->valuestring) : NULL, snssai ? snssai_local_nonprim : NULL, - res_uri && !cJSON_IsNull(res_uri) ? ogs_strdup(res_uri->valuestring) : NULL + res_uri && !cJSON_IsNull(res_uri) ? ogs_strdup(res_uri->valuestring) : NULL, + reset_ids ? reset_idsList : NULL ); return bdt_policy_data_local_var; @@ -198,6 +245,13 @@ end: OpenAPI_snssai_free(snssai_local_nonprim); snssai_local_nonprim = NULL; } + if (reset_idsList) { + OpenAPI_list_for_each(reset_idsList, node) { + ogs_free(node->data); + } + OpenAPI_list_free(reset_idsList); + reset_idsList = NULL; + } return NULL; } diff --git a/lib/sbi/openapi/model/bdt_policy_data.h b/lib/sbi/openapi/model/bdt_policy_data.h index f30917db2..7405dfca4 100644 --- a/lib/sbi/openapi/model/bdt_policy_data.h +++ b/lib/sbi/openapi/model/bdt_policy_data.h @@ -1,7 +1,7 @@ /* * bdt_policy_data.h * - * + * Represents applied BDT policy data. */ #ifndef _OpenAPI_bdt_policy_data_H_ @@ -26,6 +26,7 @@ typedef struct OpenAPI_bdt_policy_data_s { char *dnn; struct OpenAPI_snssai_s *snssai; char *res_uri; + OpenAPI_list_t *reset_ids; } OpenAPI_bdt_policy_data_t; OpenAPI_bdt_policy_data_t *OpenAPI_bdt_policy_data_create( @@ -34,7 +35,8 @@ OpenAPI_bdt_policy_data_t *OpenAPI_bdt_policy_data_create( char *bdt_ref_id, char *dnn, OpenAPI_snssai_t *snssai, - char *res_uri + char *res_uri, + OpenAPI_list_t *reset_ids ); void OpenAPI_bdt_policy_data_free(OpenAPI_bdt_policy_data_t *bdt_policy_data); OpenAPI_bdt_policy_data_t *OpenAPI_bdt_policy_data_parseFromJSON(cJSON *bdt_policy_dataJSON); diff --git a/lib/sbi/openapi/model/bdt_policy_data_patch.h b/lib/sbi/openapi/model/bdt_policy_data_patch.h index a4db2b8b4..b2cb61ba9 100644 --- a/lib/sbi/openapi/model/bdt_policy_data_patch.h +++ b/lib/sbi/openapi/model/bdt_policy_data_patch.h @@ -1,7 +1,7 @@ /* * bdt_policy_data_patch.h * - * + * Represents modification instructions to be performed on the applied BDT policy data. */ #ifndef _OpenAPI_bdt_policy_data_patch_H_ diff --git a/lib/sbi/openapi/model/binding_resp.h b/lib/sbi/openapi/model/binding_resp.h index cffc3f42f..7dd834228 100644 --- a/lib/sbi/openapi/model/binding_resp.h +++ b/lib/sbi/openapi/model/binding_resp.h @@ -1,7 +1,7 @@ /* * binding_resp.h * - * + * Contains the binding information for a PCF for a PDU Session. */ #ifndef _OpenAPI_binding_resp_H_ diff --git a/lib/sbi/openapi/model/bridge_management_container.h b/lib/sbi/openapi/model/bridge_management_container.h index af0be3b7b..ff4344fd6 100644 --- a/lib/sbi/openapi/model/bridge_management_container.h +++ b/lib/sbi/openapi/model/bridge_management_container.h @@ -1,7 +1,7 @@ /* * bridge_management_container.h * - * + * Contains the UMIC. */ #ifndef _OpenAPI_bridge_management_container_H_ diff --git a/lib/sbi/openapi/model/bsf_event.c b/lib/sbi/openapi/model/bsf_event.c new file mode 100644 index 000000000..e057accef --- /dev/null +++ b/lib/sbi/openapi/model/bsf_event.c @@ -0,0 +1,30 @@ + +#include +#include +#include +#include "bsf_event.h" + +char* OpenAPI_bsf_event_ToString(OpenAPI_bsf_event_e bsf_event) +{ + const char *bsf_eventArray[] = { "NULL", "PCF_PDU_SESSION_BINDING_REGISTRATION", "PCF_PDU_SESSION_BINDING_DEREGISTRATION", "PCF_UE_BINDING_REGISTRATION", "PCF_UE_BINDING_DEREGISTRATION", "SNSSAI_DNN_BINDING_REGISTRATION", "SNSSAI_DNN_BINDING_DEREGISTRATION" }; + size_t sizeofArray = sizeof(bsf_eventArray) / sizeof(bsf_eventArray[0]); + if (bsf_event < sizeofArray) + return (char *)bsf_eventArray[bsf_event]; + else + return (char *)"Unknown"; +} + +OpenAPI_bsf_event_e OpenAPI_bsf_event_FromString(char* bsf_event) +{ + int stringToReturn = 0; + const char *bsf_eventArray[] = { "NULL", "PCF_PDU_SESSION_BINDING_REGISTRATION", "PCF_PDU_SESSION_BINDING_DEREGISTRATION", "PCF_UE_BINDING_REGISTRATION", "PCF_UE_BINDING_DEREGISTRATION", "SNSSAI_DNN_BINDING_REGISTRATION", "SNSSAI_DNN_BINDING_DEREGISTRATION" }; + size_t sizeofArray = sizeof(bsf_eventArray) / sizeof(bsf_eventArray[0]); + while (stringToReturn < sizeofArray) { + if (strcmp(bsf_event, bsf_eventArray[stringToReturn]) == 0) { + return stringToReturn; + } + stringToReturn++; + } + return 0; +} + diff --git a/lib/sbi/openapi/model/bsf_event.h b/lib/sbi/openapi/model/bsf_event.h new file mode 100644 index 000000000..57e8dd2b5 --- /dev/null +++ b/lib/sbi/openapi/model/bsf_event.h @@ -0,0 +1,31 @@ +/* + * bsf_event.h + * + * + */ + +#ifndef _OpenAPI_bsf_event_H_ +#define _OpenAPI_bsf_event_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef enum { OpenAPI_bsf_event_NULL = 0, OpenAPI_bsf_event_PCF_PDU_SESSION_BINDING_REGISTRATION, OpenAPI_bsf_event_PCF_PDU_SESSION_BINDING_DEREGISTRATION, OpenAPI_bsf_event_PCF_UE_BINDING_REGISTRATION, OpenAPI_bsf_event_PCF_UE_BINDING_DEREGISTRATION, OpenAPI_bsf_event_SNSSAI_DNN_BINDING_REGISTRATION, OpenAPI_bsf_event_SNSSAI_DNN_BINDING_DEREGISTRATION } OpenAPI_bsf_event_e; + +char* OpenAPI_bsf_event_ToString(OpenAPI_bsf_event_e bsf_event); + +OpenAPI_bsf_event_e OpenAPI_bsf_event_FromString(char* bsf_event); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_bsf_event_H_ */ + diff --git a/lib/sbi/openapi/model/bsf_event_notification.c b/lib/sbi/openapi/model/bsf_event_notification.c new file mode 100644 index 000000000..832b1d5e1 --- /dev/null +++ b/lib/sbi/openapi/model/bsf_event_notification.c @@ -0,0 +1,263 @@ + +#include +#include +#include +#include "bsf_event_notification.h" + +OpenAPI_bsf_event_notification_t *OpenAPI_bsf_event_notification_create( + OpenAPI_bsf_event_e event, + OpenAPI_pcf_for_ue_info_t *pcf_for_ue_info, + OpenAPI_list_t *pcf_for_pdu_sess_infos, + OpenAPI_list_t *match_snssai_dnns +) +{ + OpenAPI_bsf_event_notification_t *bsf_event_notification_local_var = ogs_malloc(sizeof(OpenAPI_bsf_event_notification_t)); + ogs_assert(bsf_event_notification_local_var); + + bsf_event_notification_local_var->event = event; + bsf_event_notification_local_var->pcf_for_ue_info = pcf_for_ue_info; + bsf_event_notification_local_var->pcf_for_pdu_sess_infos = pcf_for_pdu_sess_infos; + bsf_event_notification_local_var->match_snssai_dnns = match_snssai_dnns; + + return bsf_event_notification_local_var; +} + +void OpenAPI_bsf_event_notification_free(OpenAPI_bsf_event_notification_t *bsf_event_notification) +{ + OpenAPI_lnode_t *node = NULL; + + if (NULL == bsf_event_notification) { + return; + } + if (bsf_event_notification->pcf_for_ue_info) { + OpenAPI_pcf_for_ue_info_free(bsf_event_notification->pcf_for_ue_info); + bsf_event_notification->pcf_for_ue_info = NULL; + } + if (bsf_event_notification->pcf_for_pdu_sess_infos) { + OpenAPI_list_for_each(bsf_event_notification->pcf_for_pdu_sess_infos, node) { + OpenAPI_pcf_for_pdu_session_info_free(node->data); + } + OpenAPI_list_free(bsf_event_notification->pcf_for_pdu_sess_infos); + bsf_event_notification->pcf_for_pdu_sess_infos = NULL; + } + if (bsf_event_notification->match_snssai_dnns) { + OpenAPI_list_for_each(bsf_event_notification->match_snssai_dnns, node) { + OpenAPI_snssai_dnn_pair_free(node->data); + } + OpenAPI_list_free(bsf_event_notification->match_snssai_dnns); + bsf_event_notification->match_snssai_dnns = NULL; + } + ogs_free(bsf_event_notification); +} + +cJSON *OpenAPI_bsf_event_notification_convertToJSON(OpenAPI_bsf_event_notification_t *bsf_event_notification) +{ + cJSON *item = NULL; + OpenAPI_lnode_t *node = NULL; + + if (bsf_event_notification == NULL) { + ogs_error("OpenAPI_bsf_event_notification_convertToJSON() failed [BsfEventNotification]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (bsf_event_notification->event == OpenAPI_bsf_event_NULL) { + ogs_error("OpenAPI_bsf_event_notification_convertToJSON() failed [event]"); + return NULL; + } + if (cJSON_AddStringToObject(item, "event", OpenAPI_bsf_event_ToString(bsf_event_notification->event)) == NULL) { + ogs_error("OpenAPI_bsf_event_notification_convertToJSON() failed [event]"); + goto end; + } + + if (bsf_event_notification->pcf_for_ue_info) { + cJSON *pcf_for_ue_info_local_JSON = OpenAPI_pcf_for_ue_info_convertToJSON(bsf_event_notification->pcf_for_ue_info); + if (pcf_for_ue_info_local_JSON == NULL) { + ogs_error("OpenAPI_bsf_event_notification_convertToJSON() failed [pcf_for_ue_info]"); + goto end; + } + cJSON_AddItemToObject(item, "pcfForUeInfo", pcf_for_ue_info_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_bsf_event_notification_convertToJSON() failed [pcf_for_ue_info]"); + goto end; + } + } + + if (bsf_event_notification->pcf_for_pdu_sess_infos) { + cJSON *pcf_for_pdu_sess_infosList = cJSON_AddArrayToObject(item, "pcfForPduSessInfos"); + if (pcf_for_pdu_sess_infosList == NULL) { + ogs_error("OpenAPI_bsf_event_notification_convertToJSON() failed [pcf_for_pdu_sess_infos]"); + goto end; + } + OpenAPI_list_for_each(bsf_event_notification->pcf_for_pdu_sess_infos, node) { + cJSON *itemLocal = OpenAPI_pcf_for_pdu_session_info_convertToJSON(node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_bsf_event_notification_convertToJSON() failed [pcf_for_pdu_sess_infos]"); + goto end; + } + cJSON_AddItemToArray(pcf_for_pdu_sess_infosList, itemLocal); + } + } + + if (bsf_event_notification->match_snssai_dnns) { + cJSON *match_snssai_dnnsList = cJSON_AddArrayToObject(item, "matchSnssaiDnns"); + if (match_snssai_dnnsList == NULL) { + ogs_error("OpenAPI_bsf_event_notification_convertToJSON() failed [match_snssai_dnns]"); + goto end; + } + OpenAPI_list_for_each(bsf_event_notification->match_snssai_dnns, node) { + cJSON *itemLocal = OpenAPI_snssai_dnn_pair_convertToJSON(node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_bsf_event_notification_convertToJSON() failed [match_snssai_dnns]"); + goto end; + } + cJSON_AddItemToArray(match_snssai_dnnsList, itemLocal); + } + } + +end: + return item; +} + +OpenAPI_bsf_event_notification_t *OpenAPI_bsf_event_notification_parseFromJSON(cJSON *bsf_event_notificationJSON) +{ + OpenAPI_bsf_event_notification_t *bsf_event_notification_local_var = NULL; + OpenAPI_lnode_t *node = NULL; + cJSON *event = NULL; + OpenAPI_bsf_event_e eventVariable = 0; + cJSON *pcf_for_ue_info = NULL; + OpenAPI_pcf_for_ue_info_t *pcf_for_ue_info_local_nonprim = NULL; + cJSON *pcf_for_pdu_sess_infos = NULL; + OpenAPI_list_t *pcf_for_pdu_sess_infosList = NULL; + cJSON *match_snssai_dnns = NULL; + OpenAPI_list_t *match_snssai_dnnsList = NULL; + event = cJSON_GetObjectItemCaseSensitive(bsf_event_notificationJSON, "event"); + if (!event) { + ogs_error("OpenAPI_bsf_event_notification_parseFromJSON() failed [event]"); + goto end; + } + if (!cJSON_IsString(event)) { + ogs_error("OpenAPI_bsf_event_notification_parseFromJSON() failed [event]"); + goto end; + } + eventVariable = OpenAPI_bsf_event_FromString(event->valuestring); + + pcf_for_ue_info = cJSON_GetObjectItemCaseSensitive(bsf_event_notificationJSON, "pcfForUeInfo"); + if (pcf_for_ue_info) { + pcf_for_ue_info_local_nonprim = OpenAPI_pcf_for_ue_info_parseFromJSON(pcf_for_ue_info); + } + + pcf_for_pdu_sess_infos = cJSON_GetObjectItemCaseSensitive(bsf_event_notificationJSON, "pcfForPduSessInfos"); + if (pcf_for_pdu_sess_infos) { + cJSON *pcf_for_pdu_sess_infos_local = NULL; + if (!cJSON_IsArray(pcf_for_pdu_sess_infos)) { + ogs_error("OpenAPI_bsf_event_notification_parseFromJSON() failed [pcf_for_pdu_sess_infos]"); + goto end; + } + + pcf_for_pdu_sess_infosList = OpenAPI_list_create(); + + cJSON_ArrayForEach(pcf_for_pdu_sess_infos_local, pcf_for_pdu_sess_infos) { + if (!cJSON_IsObject(pcf_for_pdu_sess_infos_local)) { + ogs_error("OpenAPI_bsf_event_notification_parseFromJSON() failed [pcf_for_pdu_sess_infos]"); + goto end; + } + OpenAPI_pcf_for_pdu_session_info_t *pcf_for_pdu_sess_infosItem = OpenAPI_pcf_for_pdu_session_info_parseFromJSON(pcf_for_pdu_sess_infos_local); + if (!pcf_for_pdu_sess_infosItem) { + ogs_error("No pcf_for_pdu_sess_infosItem"); + OpenAPI_list_free(pcf_for_pdu_sess_infosList); + goto end; + } + OpenAPI_list_add(pcf_for_pdu_sess_infosList, pcf_for_pdu_sess_infosItem); + } + } + + match_snssai_dnns = cJSON_GetObjectItemCaseSensitive(bsf_event_notificationJSON, "matchSnssaiDnns"); + if (match_snssai_dnns) { + cJSON *match_snssai_dnns_local = NULL; + if (!cJSON_IsArray(match_snssai_dnns)) { + ogs_error("OpenAPI_bsf_event_notification_parseFromJSON() failed [match_snssai_dnns]"); + goto end; + } + + match_snssai_dnnsList = OpenAPI_list_create(); + + cJSON_ArrayForEach(match_snssai_dnns_local, match_snssai_dnns) { + if (!cJSON_IsObject(match_snssai_dnns_local)) { + ogs_error("OpenAPI_bsf_event_notification_parseFromJSON() failed [match_snssai_dnns]"); + goto end; + } + OpenAPI_snssai_dnn_pair_t *match_snssai_dnnsItem = OpenAPI_snssai_dnn_pair_parseFromJSON(match_snssai_dnns_local); + if (!match_snssai_dnnsItem) { + ogs_error("No match_snssai_dnnsItem"); + OpenAPI_list_free(match_snssai_dnnsList); + goto end; + } + OpenAPI_list_add(match_snssai_dnnsList, match_snssai_dnnsItem); + } + } + + bsf_event_notification_local_var = OpenAPI_bsf_event_notification_create ( + eventVariable, + pcf_for_ue_info ? pcf_for_ue_info_local_nonprim : NULL, + pcf_for_pdu_sess_infos ? pcf_for_pdu_sess_infosList : NULL, + match_snssai_dnns ? match_snssai_dnnsList : NULL + ); + + return bsf_event_notification_local_var; +end: + if (pcf_for_ue_info_local_nonprim) { + OpenAPI_pcf_for_ue_info_free(pcf_for_ue_info_local_nonprim); + pcf_for_ue_info_local_nonprim = NULL; + } + if (pcf_for_pdu_sess_infosList) { + OpenAPI_list_for_each(pcf_for_pdu_sess_infosList, node) { + OpenAPI_pcf_for_pdu_session_info_free(node->data); + } + OpenAPI_list_free(pcf_for_pdu_sess_infosList); + pcf_for_pdu_sess_infosList = NULL; + } + if (match_snssai_dnnsList) { + OpenAPI_list_for_each(match_snssai_dnnsList, node) { + OpenAPI_snssai_dnn_pair_free(node->data); + } + OpenAPI_list_free(match_snssai_dnnsList); + match_snssai_dnnsList = NULL; + } + return NULL; +} + +OpenAPI_bsf_event_notification_t *OpenAPI_bsf_event_notification_copy(OpenAPI_bsf_event_notification_t *dst, OpenAPI_bsf_event_notification_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_bsf_event_notification_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_bsf_event_notification_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_bsf_event_notification_free(dst); + dst = OpenAPI_bsf_event_notification_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/bsf_event_notification.h b/lib/sbi/openapi/model/bsf_event_notification.h new file mode 100644 index 000000000..97b15daa3 --- /dev/null +++ b/lib/sbi/openapi/model/bsf_event_notification.h @@ -0,0 +1,48 @@ +/* + * bsf_event_notification.h + * + * Contains an event notification. + */ + +#ifndef _OpenAPI_bsf_event_notification_H_ +#define _OpenAPI_bsf_event_notification_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "bsf_event.h" +#include "pcf_for_pdu_session_info.h" +#include "pcf_for_ue_info.h" +#include "snssai_dnn_pair.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_bsf_event_notification_s OpenAPI_bsf_event_notification_t; +typedef struct OpenAPI_bsf_event_notification_s { + OpenAPI_bsf_event_e event; + struct OpenAPI_pcf_for_ue_info_s *pcf_for_ue_info; + OpenAPI_list_t *pcf_for_pdu_sess_infos; + OpenAPI_list_t *match_snssai_dnns; +} OpenAPI_bsf_event_notification_t; + +OpenAPI_bsf_event_notification_t *OpenAPI_bsf_event_notification_create( + OpenAPI_bsf_event_e event, + OpenAPI_pcf_for_ue_info_t *pcf_for_ue_info, + OpenAPI_list_t *pcf_for_pdu_sess_infos, + OpenAPI_list_t *match_snssai_dnns +); +void OpenAPI_bsf_event_notification_free(OpenAPI_bsf_event_notification_t *bsf_event_notification); +OpenAPI_bsf_event_notification_t *OpenAPI_bsf_event_notification_parseFromJSON(cJSON *bsf_event_notificationJSON); +cJSON *OpenAPI_bsf_event_notification_convertToJSON(OpenAPI_bsf_event_notification_t *bsf_event_notification); +OpenAPI_bsf_event_notification_t *OpenAPI_bsf_event_notification_copy(OpenAPI_bsf_event_notification_t *dst, OpenAPI_bsf_event_notification_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_bsf_event_notification_H_ */ + diff --git a/lib/sbi/openapi/model/bsf_info.c b/lib/sbi/openapi/model/bsf_info.c index b6f1b70a2..8b5f52f32 100644 --- a/lib/sbi/openapi/model/bsf_info.c +++ b/lib/sbi/openapi/model/bsf_info.c @@ -8,7 +8,12 @@ OpenAPI_bsf_info_t *OpenAPI_bsf_info_create( OpenAPI_list_t *dnn_list, OpenAPI_list_t *ip_domain_list, OpenAPI_list_t *ipv4_address_ranges, - OpenAPI_list_t *ipv6_prefix_ranges + OpenAPI_list_t *ipv6_prefix_ranges, + char *rx_diam_host, + char *rx_diam_realm, + char *group_id, + OpenAPI_list_t *supi_ranges, + OpenAPI_list_t *gpsi_ranges ) { OpenAPI_bsf_info_t *bsf_info_local_var = ogs_malloc(sizeof(OpenAPI_bsf_info_t)); @@ -18,6 +23,11 @@ OpenAPI_bsf_info_t *OpenAPI_bsf_info_create( bsf_info_local_var->ip_domain_list = ip_domain_list; bsf_info_local_var->ipv4_address_ranges = ipv4_address_ranges; bsf_info_local_var->ipv6_prefix_ranges = ipv6_prefix_ranges; + bsf_info_local_var->rx_diam_host = rx_diam_host; + bsf_info_local_var->rx_diam_realm = rx_diam_realm; + bsf_info_local_var->group_id = group_id; + bsf_info_local_var->supi_ranges = supi_ranges; + bsf_info_local_var->gpsi_ranges = gpsi_ranges; return bsf_info_local_var; } @@ -57,6 +67,32 @@ void OpenAPI_bsf_info_free(OpenAPI_bsf_info_t *bsf_info) OpenAPI_list_free(bsf_info->ipv6_prefix_ranges); bsf_info->ipv6_prefix_ranges = NULL; } + if (bsf_info->rx_diam_host) { + ogs_free(bsf_info->rx_diam_host); + bsf_info->rx_diam_host = NULL; + } + if (bsf_info->rx_diam_realm) { + ogs_free(bsf_info->rx_diam_realm); + bsf_info->rx_diam_realm = NULL; + } + if (bsf_info->group_id) { + ogs_free(bsf_info->group_id); + bsf_info->group_id = NULL; + } + if (bsf_info->supi_ranges) { + OpenAPI_list_for_each(bsf_info->supi_ranges, node) { + OpenAPI_supi_range_free(node->data); + } + OpenAPI_list_free(bsf_info->supi_ranges); + bsf_info->supi_ranges = NULL; + } + if (bsf_info->gpsi_ranges) { + OpenAPI_list_for_each(bsf_info->gpsi_ranges, node) { + OpenAPI_identity_range_free(node->data); + } + OpenAPI_list_free(bsf_info->gpsi_ranges); + bsf_info->gpsi_ranges = NULL; + } ogs_free(bsf_info); } @@ -131,6 +167,59 @@ cJSON *OpenAPI_bsf_info_convertToJSON(OpenAPI_bsf_info_t *bsf_info) } } + if (bsf_info->rx_diam_host) { + if (cJSON_AddStringToObject(item, "rxDiamHost", bsf_info->rx_diam_host) == NULL) { + ogs_error("OpenAPI_bsf_info_convertToJSON() failed [rx_diam_host]"); + goto end; + } + } + + if (bsf_info->rx_diam_realm) { + if (cJSON_AddStringToObject(item, "rxDiamRealm", bsf_info->rx_diam_realm) == NULL) { + ogs_error("OpenAPI_bsf_info_convertToJSON() failed [rx_diam_realm]"); + goto end; + } + } + + if (bsf_info->group_id) { + if (cJSON_AddStringToObject(item, "groupId", bsf_info->group_id) == NULL) { + ogs_error("OpenAPI_bsf_info_convertToJSON() failed [group_id]"); + goto end; + } + } + + if (bsf_info->supi_ranges) { + cJSON *supi_rangesList = cJSON_AddArrayToObject(item, "supiRanges"); + if (supi_rangesList == NULL) { + ogs_error("OpenAPI_bsf_info_convertToJSON() failed [supi_ranges]"); + goto end; + } + OpenAPI_list_for_each(bsf_info->supi_ranges, node) { + cJSON *itemLocal = OpenAPI_supi_range_convertToJSON(node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_bsf_info_convertToJSON() failed [supi_ranges]"); + goto end; + } + cJSON_AddItemToArray(supi_rangesList, itemLocal); + } + } + + if (bsf_info->gpsi_ranges) { + cJSON *gpsi_rangesList = cJSON_AddArrayToObject(item, "gpsiRanges"); + if (gpsi_rangesList == NULL) { + ogs_error("OpenAPI_bsf_info_convertToJSON() failed [gpsi_ranges]"); + goto end; + } + OpenAPI_list_for_each(bsf_info->gpsi_ranges, node) { + cJSON *itemLocal = OpenAPI_identity_range_convertToJSON(node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_bsf_info_convertToJSON() failed [gpsi_ranges]"); + goto end; + } + cJSON_AddItemToArray(gpsi_rangesList, itemLocal); + } + } + end: return item; } @@ -147,6 +236,13 @@ OpenAPI_bsf_info_t *OpenAPI_bsf_info_parseFromJSON(cJSON *bsf_infoJSON) OpenAPI_list_t *ipv4_address_rangesList = NULL; cJSON *ipv6_prefix_ranges = NULL; OpenAPI_list_t *ipv6_prefix_rangesList = NULL; + cJSON *rx_diam_host = NULL; + cJSON *rx_diam_realm = NULL; + cJSON *group_id = NULL; + cJSON *supi_ranges = NULL; + OpenAPI_list_t *supi_rangesList = NULL; + cJSON *gpsi_ranges = NULL; + OpenAPI_list_t *gpsi_rangesList = NULL; dnn_list = cJSON_GetObjectItemCaseSensitive(bsf_infoJSON, "dnnList"); if (dnn_list) { cJSON *dnn_list_local = NULL; @@ -239,11 +335,90 @@ OpenAPI_bsf_info_t *OpenAPI_bsf_info_parseFromJSON(cJSON *bsf_infoJSON) } } + rx_diam_host = cJSON_GetObjectItemCaseSensitive(bsf_infoJSON, "rxDiamHost"); + if (rx_diam_host) { + if (!cJSON_IsString(rx_diam_host) && !cJSON_IsNull(rx_diam_host)) { + ogs_error("OpenAPI_bsf_info_parseFromJSON() failed [rx_diam_host]"); + goto end; + } + } + + rx_diam_realm = cJSON_GetObjectItemCaseSensitive(bsf_infoJSON, "rxDiamRealm"); + if (rx_diam_realm) { + if (!cJSON_IsString(rx_diam_realm) && !cJSON_IsNull(rx_diam_realm)) { + ogs_error("OpenAPI_bsf_info_parseFromJSON() failed [rx_diam_realm]"); + goto end; + } + } + + group_id = cJSON_GetObjectItemCaseSensitive(bsf_infoJSON, "groupId"); + if (group_id) { + if (!cJSON_IsString(group_id) && !cJSON_IsNull(group_id)) { + ogs_error("OpenAPI_bsf_info_parseFromJSON() failed [group_id]"); + goto end; + } + } + + supi_ranges = cJSON_GetObjectItemCaseSensitive(bsf_infoJSON, "supiRanges"); + if (supi_ranges) { + cJSON *supi_ranges_local = NULL; + if (!cJSON_IsArray(supi_ranges)) { + ogs_error("OpenAPI_bsf_info_parseFromJSON() failed [supi_ranges]"); + goto end; + } + + supi_rangesList = OpenAPI_list_create(); + + cJSON_ArrayForEach(supi_ranges_local, supi_ranges) { + if (!cJSON_IsObject(supi_ranges_local)) { + ogs_error("OpenAPI_bsf_info_parseFromJSON() failed [supi_ranges]"); + goto end; + } + OpenAPI_supi_range_t *supi_rangesItem = OpenAPI_supi_range_parseFromJSON(supi_ranges_local); + if (!supi_rangesItem) { + ogs_error("No supi_rangesItem"); + OpenAPI_list_free(supi_rangesList); + goto end; + } + OpenAPI_list_add(supi_rangesList, supi_rangesItem); + } + } + + gpsi_ranges = cJSON_GetObjectItemCaseSensitive(bsf_infoJSON, "gpsiRanges"); + if (gpsi_ranges) { + cJSON *gpsi_ranges_local = NULL; + if (!cJSON_IsArray(gpsi_ranges)) { + ogs_error("OpenAPI_bsf_info_parseFromJSON() failed [gpsi_ranges]"); + goto end; + } + + gpsi_rangesList = OpenAPI_list_create(); + + cJSON_ArrayForEach(gpsi_ranges_local, gpsi_ranges) { + if (!cJSON_IsObject(gpsi_ranges_local)) { + ogs_error("OpenAPI_bsf_info_parseFromJSON() failed [gpsi_ranges]"); + goto end; + } + OpenAPI_identity_range_t *gpsi_rangesItem = OpenAPI_identity_range_parseFromJSON(gpsi_ranges_local); + if (!gpsi_rangesItem) { + ogs_error("No gpsi_rangesItem"); + OpenAPI_list_free(gpsi_rangesList); + goto end; + } + OpenAPI_list_add(gpsi_rangesList, gpsi_rangesItem); + } + } + bsf_info_local_var = OpenAPI_bsf_info_create ( dnn_list ? dnn_listList : NULL, ip_domain_list ? ip_domain_listList : NULL, ipv4_address_ranges ? ipv4_address_rangesList : NULL, - ipv6_prefix_ranges ? ipv6_prefix_rangesList : NULL + ipv6_prefix_ranges ? ipv6_prefix_rangesList : NULL, + rx_diam_host && !cJSON_IsNull(rx_diam_host) ? ogs_strdup(rx_diam_host->valuestring) : NULL, + rx_diam_realm && !cJSON_IsNull(rx_diam_realm) ? ogs_strdup(rx_diam_realm->valuestring) : NULL, + group_id && !cJSON_IsNull(group_id) ? ogs_strdup(group_id->valuestring) : NULL, + supi_ranges ? supi_rangesList : NULL, + gpsi_ranges ? gpsi_rangesList : NULL ); return bsf_info_local_var; @@ -276,6 +451,20 @@ end: OpenAPI_list_free(ipv6_prefix_rangesList); ipv6_prefix_rangesList = NULL; } + if (supi_rangesList) { + OpenAPI_list_for_each(supi_rangesList, node) { + OpenAPI_supi_range_free(node->data); + } + OpenAPI_list_free(supi_rangesList); + supi_rangesList = NULL; + } + if (gpsi_rangesList) { + OpenAPI_list_for_each(gpsi_rangesList, node) { + OpenAPI_identity_range_free(node->data); + } + OpenAPI_list_free(gpsi_rangesList); + gpsi_rangesList = NULL; + } return NULL; } diff --git a/lib/sbi/openapi/model/bsf_info.h b/lib/sbi/openapi/model/bsf_info.h index 3db3feec5..6fbab7211 100644 --- a/lib/sbi/openapi/model/bsf_info.h +++ b/lib/sbi/openapi/model/bsf_info.h @@ -12,8 +12,10 @@ #include "../include/list.h" #include "../include/keyValuePair.h" #include "../include/binary.h" +#include "identity_range.h" #include "ipv4_address_range.h" #include "ipv6_prefix_range.h" +#include "supi_range.h" #ifdef __cplusplus extern "C" { @@ -25,13 +27,23 @@ typedef struct OpenAPI_bsf_info_s { OpenAPI_list_t *ip_domain_list; OpenAPI_list_t *ipv4_address_ranges; OpenAPI_list_t *ipv6_prefix_ranges; + char *rx_diam_host; + char *rx_diam_realm; + char *group_id; + OpenAPI_list_t *supi_ranges; + OpenAPI_list_t *gpsi_ranges; } OpenAPI_bsf_info_t; OpenAPI_bsf_info_t *OpenAPI_bsf_info_create( OpenAPI_list_t *dnn_list, OpenAPI_list_t *ip_domain_list, OpenAPI_list_t *ipv4_address_ranges, - OpenAPI_list_t *ipv6_prefix_ranges + OpenAPI_list_t *ipv6_prefix_ranges, + char *rx_diam_host, + char *rx_diam_realm, + char *group_id, + OpenAPI_list_t *supi_ranges, + OpenAPI_list_t *gpsi_ranges ); void OpenAPI_bsf_info_free(OpenAPI_bsf_info_t *bsf_info); OpenAPI_bsf_info_t *OpenAPI_bsf_info_parseFromJSON(cJSON *bsf_infoJSON); diff --git a/lib/sbi/openapi/model/bsf_notification.c b/lib/sbi/openapi/model/bsf_notification.c new file mode 100644 index 000000000..d6dfb8613 --- /dev/null +++ b/lib/sbi/openapi/model/bsf_notification.c @@ -0,0 +1,245 @@ + +#include +#include +#include +#include "bsf_notification.h" + +OpenAPI_bsf_notification_t *OpenAPI_bsf_notification_create( + char *notif_corre_id, + char *pcf_id, + char *pcf_set_id, + OpenAPI_binding_level_e bind_level, + OpenAPI_list_t *event_notifs +) +{ + OpenAPI_bsf_notification_t *bsf_notification_local_var = ogs_malloc(sizeof(OpenAPI_bsf_notification_t)); + ogs_assert(bsf_notification_local_var); + + bsf_notification_local_var->notif_corre_id = notif_corre_id; + bsf_notification_local_var->pcf_id = pcf_id; + bsf_notification_local_var->pcf_set_id = pcf_set_id; + bsf_notification_local_var->bind_level = bind_level; + bsf_notification_local_var->event_notifs = event_notifs; + + return bsf_notification_local_var; +} + +void OpenAPI_bsf_notification_free(OpenAPI_bsf_notification_t *bsf_notification) +{ + OpenAPI_lnode_t *node = NULL; + + if (NULL == bsf_notification) { + return; + } + if (bsf_notification->notif_corre_id) { + ogs_free(bsf_notification->notif_corre_id); + bsf_notification->notif_corre_id = NULL; + } + if (bsf_notification->pcf_id) { + ogs_free(bsf_notification->pcf_id); + bsf_notification->pcf_id = NULL; + } + if (bsf_notification->pcf_set_id) { + ogs_free(bsf_notification->pcf_set_id); + bsf_notification->pcf_set_id = NULL; + } + if (bsf_notification->event_notifs) { + OpenAPI_list_for_each(bsf_notification->event_notifs, node) { + OpenAPI_bsf_event_notification_free(node->data); + } + OpenAPI_list_free(bsf_notification->event_notifs); + bsf_notification->event_notifs = NULL; + } + ogs_free(bsf_notification); +} + +cJSON *OpenAPI_bsf_notification_convertToJSON(OpenAPI_bsf_notification_t *bsf_notification) +{ + cJSON *item = NULL; + OpenAPI_lnode_t *node = NULL; + + if (bsf_notification == NULL) { + ogs_error("OpenAPI_bsf_notification_convertToJSON() failed [BsfNotification]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (!bsf_notification->notif_corre_id) { + ogs_error("OpenAPI_bsf_notification_convertToJSON() failed [notif_corre_id]"); + return NULL; + } + if (cJSON_AddStringToObject(item, "notifCorreId", bsf_notification->notif_corre_id) == NULL) { + ogs_error("OpenAPI_bsf_notification_convertToJSON() failed [notif_corre_id]"); + goto end; + } + + if (bsf_notification->pcf_id) { + if (cJSON_AddStringToObject(item, "pcfId", bsf_notification->pcf_id) == NULL) { + ogs_error("OpenAPI_bsf_notification_convertToJSON() failed [pcf_id]"); + goto end; + } + } + + if (bsf_notification->pcf_set_id) { + if (cJSON_AddStringToObject(item, "pcfSetId", bsf_notification->pcf_set_id) == NULL) { + ogs_error("OpenAPI_bsf_notification_convertToJSON() failed [pcf_set_id]"); + goto end; + } + } + + if (bsf_notification->bind_level != OpenAPI_binding_level_NULL) { + if (cJSON_AddStringToObject(item, "bindLevel", OpenAPI_binding_level_ToString(bsf_notification->bind_level)) == NULL) { + ogs_error("OpenAPI_bsf_notification_convertToJSON() failed [bind_level]"); + goto end; + } + } + + if (!bsf_notification->event_notifs) { + ogs_error("OpenAPI_bsf_notification_convertToJSON() failed [event_notifs]"); + return NULL; + } + cJSON *event_notifsList = cJSON_AddArrayToObject(item, "eventNotifs"); + if (event_notifsList == NULL) { + ogs_error("OpenAPI_bsf_notification_convertToJSON() failed [event_notifs]"); + goto end; + } + OpenAPI_list_for_each(bsf_notification->event_notifs, node) { + cJSON *itemLocal = OpenAPI_bsf_event_notification_convertToJSON(node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_bsf_notification_convertToJSON() failed [event_notifs]"); + goto end; + } + cJSON_AddItemToArray(event_notifsList, itemLocal); + } + +end: + return item; +} + +OpenAPI_bsf_notification_t *OpenAPI_bsf_notification_parseFromJSON(cJSON *bsf_notificationJSON) +{ + OpenAPI_bsf_notification_t *bsf_notification_local_var = NULL; + OpenAPI_lnode_t *node = NULL; + cJSON *notif_corre_id = NULL; + cJSON *pcf_id = NULL; + cJSON *pcf_set_id = NULL; + cJSON *bind_level = NULL; + OpenAPI_binding_level_e bind_levelVariable = 0; + cJSON *event_notifs = NULL; + OpenAPI_list_t *event_notifsList = NULL; + notif_corre_id = cJSON_GetObjectItemCaseSensitive(bsf_notificationJSON, "notifCorreId"); + if (!notif_corre_id) { + ogs_error("OpenAPI_bsf_notification_parseFromJSON() failed [notif_corre_id]"); + goto end; + } + if (!cJSON_IsString(notif_corre_id)) { + ogs_error("OpenAPI_bsf_notification_parseFromJSON() failed [notif_corre_id]"); + goto end; + } + + pcf_id = cJSON_GetObjectItemCaseSensitive(bsf_notificationJSON, "pcfId"); + if (pcf_id) { + if (!cJSON_IsString(pcf_id) && !cJSON_IsNull(pcf_id)) { + ogs_error("OpenAPI_bsf_notification_parseFromJSON() failed [pcf_id]"); + goto end; + } + } + + pcf_set_id = cJSON_GetObjectItemCaseSensitive(bsf_notificationJSON, "pcfSetId"); + if (pcf_set_id) { + if (!cJSON_IsString(pcf_set_id) && !cJSON_IsNull(pcf_set_id)) { + ogs_error("OpenAPI_bsf_notification_parseFromJSON() failed [pcf_set_id]"); + goto end; + } + } + + bind_level = cJSON_GetObjectItemCaseSensitive(bsf_notificationJSON, "bindLevel"); + if (bind_level) { + if (!cJSON_IsString(bind_level)) { + ogs_error("OpenAPI_bsf_notification_parseFromJSON() failed [bind_level]"); + goto end; + } + bind_levelVariable = OpenAPI_binding_level_FromString(bind_level->valuestring); + } + + event_notifs = cJSON_GetObjectItemCaseSensitive(bsf_notificationJSON, "eventNotifs"); + if (!event_notifs) { + ogs_error("OpenAPI_bsf_notification_parseFromJSON() failed [event_notifs]"); + goto end; + } + cJSON *event_notifs_local = NULL; + if (!cJSON_IsArray(event_notifs)) { + ogs_error("OpenAPI_bsf_notification_parseFromJSON() failed [event_notifs]"); + goto end; + } + + event_notifsList = OpenAPI_list_create(); + + cJSON_ArrayForEach(event_notifs_local, event_notifs) { + if (!cJSON_IsObject(event_notifs_local)) { + ogs_error("OpenAPI_bsf_notification_parseFromJSON() failed [event_notifs]"); + goto end; + } + OpenAPI_bsf_event_notification_t *event_notifsItem = OpenAPI_bsf_event_notification_parseFromJSON(event_notifs_local); + if (!event_notifsItem) { + ogs_error("No event_notifsItem"); + OpenAPI_list_free(event_notifsList); + goto end; + } + OpenAPI_list_add(event_notifsList, event_notifsItem); + } + + bsf_notification_local_var = OpenAPI_bsf_notification_create ( + ogs_strdup(notif_corre_id->valuestring), + 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, + bind_level ? bind_levelVariable : 0, + event_notifsList + ); + + return bsf_notification_local_var; +end: + if (event_notifsList) { + OpenAPI_list_for_each(event_notifsList, node) { + OpenAPI_bsf_event_notification_free(node->data); + } + OpenAPI_list_free(event_notifsList); + event_notifsList = NULL; + } + return NULL; +} + +OpenAPI_bsf_notification_t *OpenAPI_bsf_notification_copy(OpenAPI_bsf_notification_t *dst, OpenAPI_bsf_notification_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_bsf_notification_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_bsf_notification_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_bsf_notification_free(dst); + dst = OpenAPI_bsf_notification_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/bsf_notification.h b/lib/sbi/openapi/model/bsf_notification.h new file mode 100644 index 000000000..41bb51d0c --- /dev/null +++ b/lib/sbi/openapi/model/bsf_notification.h @@ -0,0 +1,48 @@ +/* + * bsf_notification.h + * + * Contains the event notifications. + */ + +#ifndef _OpenAPI_bsf_notification_H_ +#define _OpenAPI_bsf_notification_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "binding_level.h" +#include "bsf_event_notification.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_bsf_notification_s OpenAPI_bsf_notification_t; +typedef struct OpenAPI_bsf_notification_s { + char *notif_corre_id; + char *pcf_id; + char *pcf_set_id; + OpenAPI_binding_level_e bind_level; + OpenAPI_list_t *event_notifs; +} OpenAPI_bsf_notification_t; + +OpenAPI_bsf_notification_t *OpenAPI_bsf_notification_create( + char *notif_corre_id, + char *pcf_id, + char *pcf_set_id, + OpenAPI_binding_level_e bind_level, + OpenAPI_list_t *event_notifs +); +void OpenAPI_bsf_notification_free(OpenAPI_bsf_notification_t *bsf_notification); +OpenAPI_bsf_notification_t *OpenAPI_bsf_notification_parseFromJSON(cJSON *bsf_notificationJSON); +cJSON *OpenAPI_bsf_notification_convertToJSON(OpenAPI_bsf_notification_t *bsf_notification); +OpenAPI_bsf_notification_t *OpenAPI_bsf_notification_copy(OpenAPI_bsf_notification_t *dst, OpenAPI_bsf_notification_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_bsf_notification_H_ */ + diff --git a/lib/sbi/openapi/model/bsf_subscription.c b/lib/sbi/openapi/model/bsf_subscription.c new file mode 100644 index 000000000..ee3e6a03c --- /dev/null +++ b/lib/sbi/openapi/model/bsf_subscription.c @@ -0,0 +1,355 @@ + +#include +#include +#include +#include "bsf_subscription.h" + +OpenAPI_bsf_subscription_t *OpenAPI_bsf_subscription_create( + OpenAPI_list_t *events, + char *notif_uri, + char *notif_corre_id, + char *supi, + char *gpsi, + OpenAPI_snssai_dnn_pair_t *snssai_dnn_pairs, + OpenAPI_list_t *add_snssai_dnn_pairs, + char *supp_feat +) +{ + OpenAPI_bsf_subscription_t *bsf_subscription_local_var = ogs_malloc(sizeof(OpenAPI_bsf_subscription_t)); + ogs_assert(bsf_subscription_local_var); + + bsf_subscription_local_var->events = events; + bsf_subscription_local_var->notif_uri = notif_uri; + bsf_subscription_local_var->notif_corre_id = notif_corre_id; + bsf_subscription_local_var->supi = supi; + bsf_subscription_local_var->gpsi = gpsi; + bsf_subscription_local_var->snssai_dnn_pairs = snssai_dnn_pairs; + bsf_subscription_local_var->add_snssai_dnn_pairs = add_snssai_dnn_pairs; + bsf_subscription_local_var->supp_feat = supp_feat; + + return bsf_subscription_local_var; +} + +void OpenAPI_bsf_subscription_free(OpenAPI_bsf_subscription_t *bsf_subscription) +{ + OpenAPI_lnode_t *node = NULL; + + if (NULL == bsf_subscription) { + return; + } + if (bsf_subscription->events) { + OpenAPI_list_free(bsf_subscription->events); + bsf_subscription->events = NULL; + } + if (bsf_subscription->notif_uri) { + ogs_free(bsf_subscription->notif_uri); + bsf_subscription->notif_uri = NULL; + } + if (bsf_subscription->notif_corre_id) { + ogs_free(bsf_subscription->notif_corre_id); + bsf_subscription->notif_corre_id = NULL; + } + if (bsf_subscription->supi) { + ogs_free(bsf_subscription->supi); + bsf_subscription->supi = NULL; + } + if (bsf_subscription->gpsi) { + ogs_free(bsf_subscription->gpsi); + bsf_subscription->gpsi = NULL; + } + if (bsf_subscription->snssai_dnn_pairs) { + OpenAPI_snssai_dnn_pair_free(bsf_subscription->snssai_dnn_pairs); + bsf_subscription->snssai_dnn_pairs = NULL; + } + if (bsf_subscription->add_snssai_dnn_pairs) { + OpenAPI_list_for_each(bsf_subscription->add_snssai_dnn_pairs, node) { + OpenAPI_snssai_dnn_pair_free(node->data); + } + OpenAPI_list_free(bsf_subscription->add_snssai_dnn_pairs); + bsf_subscription->add_snssai_dnn_pairs = NULL; + } + if (bsf_subscription->supp_feat) { + ogs_free(bsf_subscription->supp_feat); + bsf_subscription->supp_feat = NULL; + } + ogs_free(bsf_subscription); +} + +cJSON *OpenAPI_bsf_subscription_convertToJSON(OpenAPI_bsf_subscription_t *bsf_subscription) +{ + cJSON *item = NULL; + OpenAPI_lnode_t *node = NULL; + + if (bsf_subscription == NULL) { + ogs_error("OpenAPI_bsf_subscription_convertToJSON() failed [BsfSubscription]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (bsf_subscription->events == OpenAPI_bsf_event_NULL) { + ogs_error("OpenAPI_bsf_subscription_convertToJSON() failed [events]"); + return NULL; + } + cJSON *eventsList = cJSON_AddArrayToObject(item, "events"); + if (eventsList == NULL) { + ogs_error("OpenAPI_bsf_subscription_convertToJSON() failed [events]"); + goto end; + } + OpenAPI_list_for_each(bsf_subscription->events, node) { + if (cJSON_AddStringToObject(eventsList, "", OpenAPI_bsf_event_ToString((intptr_t)node->data)) == NULL) { + ogs_error("OpenAPI_bsf_subscription_convertToJSON() failed [events]"); + goto end; + } + } + + if (!bsf_subscription->notif_uri) { + ogs_error("OpenAPI_bsf_subscription_convertToJSON() failed [notif_uri]"); + return NULL; + } + if (cJSON_AddStringToObject(item, "notifUri", bsf_subscription->notif_uri) == NULL) { + ogs_error("OpenAPI_bsf_subscription_convertToJSON() failed [notif_uri]"); + goto end; + } + + if (!bsf_subscription->notif_corre_id) { + ogs_error("OpenAPI_bsf_subscription_convertToJSON() failed [notif_corre_id]"); + return NULL; + } + if (cJSON_AddStringToObject(item, "notifCorreId", bsf_subscription->notif_corre_id) == NULL) { + ogs_error("OpenAPI_bsf_subscription_convertToJSON() failed [notif_corre_id]"); + goto end; + } + + if (!bsf_subscription->supi) { + ogs_error("OpenAPI_bsf_subscription_convertToJSON() failed [supi]"); + return NULL; + } + if (cJSON_AddStringToObject(item, "supi", bsf_subscription->supi) == NULL) { + ogs_error("OpenAPI_bsf_subscription_convertToJSON() failed [supi]"); + goto end; + } + + if (bsf_subscription->gpsi) { + if (cJSON_AddStringToObject(item, "gpsi", bsf_subscription->gpsi) == NULL) { + ogs_error("OpenAPI_bsf_subscription_convertToJSON() failed [gpsi]"); + goto end; + } + } + + if (bsf_subscription->snssai_dnn_pairs) { + cJSON *snssai_dnn_pairs_local_JSON = OpenAPI_snssai_dnn_pair_convertToJSON(bsf_subscription->snssai_dnn_pairs); + if (snssai_dnn_pairs_local_JSON == NULL) { + ogs_error("OpenAPI_bsf_subscription_convertToJSON() failed [snssai_dnn_pairs]"); + goto end; + } + cJSON_AddItemToObject(item, "snssaiDnnPairs", snssai_dnn_pairs_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_bsf_subscription_convertToJSON() failed [snssai_dnn_pairs]"); + goto end; + } + } + + if (bsf_subscription->add_snssai_dnn_pairs) { + cJSON *add_snssai_dnn_pairsList = cJSON_AddArrayToObject(item, "addSnssaiDnnPairs"); + if (add_snssai_dnn_pairsList == NULL) { + ogs_error("OpenAPI_bsf_subscription_convertToJSON() failed [add_snssai_dnn_pairs]"); + goto end; + } + OpenAPI_list_for_each(bsf_subscription->add_snssai_dnn_pairs, node) { + cJSON *itemLocal = OpenAPI_snssai_dnn_pair_convertToJSON(node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_bsf_subscription_convertToJSON() failed [add_snssai_dnn_pairs]"); + goto end; + } + cJSON_AddItemToArray(add_snssai_dnn_pairsList, itemLocal); + } + } + + if (bsf_subscription->supp_feat) { + if (cJSON_AddStringToObject(item, "suppFeat", bsf_subscription->supp_feat) == NULL) { + ogs_error("OpenAPI_bsf_subscription_convertToJSON() failed [supp_feat]"); + goto end; + } + } + +end: + return item; +} + +OpenAPI_bsf_subscription_t *OpenAPI_bsf_subscription_parseFromJSON(cJSON *bsf_subscriptionJSON) +{ + OpenAPI_bsf_subscription_t *bsf_subscription_local_var = NULL; + OpenAPI_lnode_t *node = NULL; + cJSON *events = NULL; + OpenAPI_list_t *eventsList = NULL; + cJSON *notif_uri = NULL; + cJSON *notif_corre_id = NULL; + cJSON *supi = NULL; + cJSON *gpsi = NULL; + cJSON *snssai_dnn_pairs = NULL; + OpenAPI_snssai_dnn_pair_t *snssai_dnn_pairs_local_nonprim = NULL; + cJSON *add_snssai_dnn_pairs = NULL; + OpenAPI_list_t *add_snssai_dnn_pairsList = NULL; + cJSON *supp_feat = NULL; + events = cJSON_GetObjectItemCaseSensitive(bsf_subscriptionJSON, "events"); + if (!events) { + ogs_error("OpenAPI_bsf_subscription_parseFromJSON() failed [events]"); + goto end; + } + cJSON *events_local = NULL; + if (!cJSON_IsArray(events)) { + ogs_error("OpenAPI_bsf_subscription_parseFromJSON() failed [events]"); + goto end; + } + + eventsList = OpenAPI_list_create(); + + cJSON_ArrayForEach(events_local, events) { + if (!cJSON_IsString(events_local)) { + ogs_error("OpenAPI_bsf_subscription_parseFromJSON() failed [events]"); + goto end; + } + OpenAPI_list_add(eventsList, (void *)OpenAPI_bsf_event_FromString(events_local->valuestring)); + } + + notif_uri = cJSON_GetObjectItemCaseSensitive(bsf_subscriptionJSON, "notifUri"); + if (!notif_uri) { + ogs_error("OpenAPI_bsf_subscription_parseFromJSON() failed [notif_uri]"); + goto end; + } + if (!cJSON_IsString(notif_uri)) { + ogs_error("OpenAPI_bsf_subscription_parseFromJSON() failed [notif_uri]"); + goto end; + } + + notif_corre_id = cJSON_GetObjectItemCaseSensitive(bsf_subscriptionJSON, "notifCorreId"); + if (!notif_corre_id) { + ogs_error("OpenAPI_bsf_subscription_parseFromJSON() failed [notif_corre_id]"); + goto end; + } + if (!cJSON_IsString(notif_corre_id)) { + ogs_error("OpenAPI_bsf_subscription_parseFromJSON() failed [notif_corre_id]"); + goto end; + } + + supi = cJSON_GetObjectItemCaseSensitive(bsf_subscriptionJSON, "supi"); + if (!supi) { + ogs_error("OpenAPI_bsf_subscription_parseFromJSON() failed [supi]"); + goto end; + } + if (!cJSON_IsString(supi)) { + ogs_error("OpenAPI_bsf_subscription_parseFromJSON() failed [supi]"); + goto end; + } + + gpsi = cJSON_GetObjectItemCaseSensitive(bsf_subscriptionJSON, "gpsi"); + if (gpsi) { + if (!cJSON_IsString(gpsi) && !cJSON_IsNull(gpsi)) { + ogs_error("OpenAPI_bsf_subscription_parseFromJSON() failed [gpsi]"); + goto end; + } + } + + snssai_dnn_pairs = cJSON_GetObjectItemCaseSensitive(bsf_subscriptionJSON, "snssaiDnnPairs"); + if (snssai_dnn_pairs) { + snssai_dnn_pairs_local_nonprim = OpenAPI_snssai_dnn_pair_parseFromJSON(snssai_dnn_pairs); + } + + add_snssai_dnn_pairs = cJSON_GetObjectItemCaseSensitive(bsf_subscriptionJSON, "addSnssaiDnnPairs"); + if (add_snssai_dnn_pairs) { + cJSON *add_snssai_dnn_pairs_local = NULL; + if (!cJSON_IsArray(add_snssai_dnn_pairs)) { + ogs_error("OpenAPI_bsf_subscription_parseFromJSON() failed [add_snssai_dnn_pairs]"); + goto end; + } + + add_snssai_dnn_pairsList = OpenAPI_list_create(); + + cJSON_ArrayForEach(add_snssai_dnn_pairs_local, add_snssai_dnn_pairs) { + if (!cJSON_IsObject(add_snssai_dnn_pairs_local)) { + ogs_error("OpenAPI_bsf_subscription_parseFromJSON() failed [add_snssai_dnn_pairs]"); + goto end; + } + OpenAPI_snssai_dnn_pair_t *add_snssai_dnn_pairsItem = OpenAPI_snssai_dnn_pair_parseFromJSON(add_snssai_dnn_pairs_local); + if (!add_snssai_dnn_pairsItem) { + ogs_error("No add_snssai_dnn_pairsItem"); + OpenAPI_list_free(add_snssai_dnn_pairsList); + goto end; + } + OpenAPI_list_add(add_snssai_dnn_pairsList, add_snssai_dnn_pairsItem); + } + } + + supp_feat = cJSON_GetObjectItemCaseSensitive(bsf_subscriptionJSON, "suppFeat"); + if (supp_feat) { + if (!cJSON_IsString(supp_feat) && !cJSON_IsNull(supp_feat)) { + ogs_error("OpenAPI_bsf_subscription_parseFromJSON() failed [supp_feat]"); + goto end; + } + } + + bsf_subscription_local_var = OpenAPI_bsf_subscription_create ( + eventsList, + ogs_strdup(notif_uri->valuestring), + ogs_strdup(notif_corre_id->valuestring), + ogs_strdup(supi->valuestring), + gpsi && !cJSON_IsNull(gpsi) ? ogs_strdup(gpsi->valuestring) : NULL, + snssai_dnn_pairs ? snssai_dnn_pairs_local_nonprim : NULL, + add_snssai_dnn_pairs ? add_snssai_dnn_pairsList : NULL, + supp_feat && !cJSON_IsNull(supp_feat) ? ogs_strdup(supp_feat->valuestring) : NULL + ); + + return bsf_subscription_local_var; +end: + if (eventsList) { + OpenAPI_list_free(eventsList); + eventsList = NULL; + } + if (snssai_dnn_pairs_local_nonprim) { + OpenAPI_snssai_dnn_pair_free(snssai_dnn_pairs_local_nonprim); + snssai_dnn_pairs_local_nonprim = NULL; + } + if (add_snssai_dnn_pairsList) { + OpenAPI_list_for_each(add_snssai_dnn_pairsList, node) { + OpenAPI_snssai_dnn_pair_free(node->data); + } + OpenAPI_list_free(add_snssai_dnn_pairsList); + add_snssai_dnn_pairsList = NULL; + } + return NULL; +} + +OpenAPI_bsf_subscription_t *OpenAPI_bsf_subscription_copy(OpenAPI_bsf_subscription_t *dst, OpenAPI_bsf_subscription_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_bsf_subscription_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_bsf_subscription_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_bsf_subscription_free(dst); + dst = OpenAPI_bsf_subscription_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/bsf_subscription.h b/lib/sbi/openapi/model/bsf_subscription.h new file mode 100644 index 000000000..c18791acd --- /dev/null +++ b/lib/sbi/openapi/model/bsf_subscription.h @@ -0,0 +1,54 @@ +/* + * bsf_subscription.h + * + * Contains the event subscription data. + */ + +#ifndef _OpenAPI_bsf_subscription_H_ +#define _OpenAPI_bsf_subscription_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "bsf_event.h" +#include "snssai_dnn_pair.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_bsf_subscription_s OpenAPI_bsf_subscription_t; +typedef struct OpenAPI_bsf_subscription_s { + OpenAPI_list_t *events; + char *notif_uri; + char *notif_corre_id; + char *supi; + char *gpsi; + struct OpenAPI_snssai_dnn_pair_s *snssai_dnn_pairs; + OpenAPI_list_t *add_snssai_dnn_pairs; + char *supp_feat; +} OpenAPI_bsf_subscription_t; + +OpenAPI_bsf_subscription_t *OpenAPI_bsf_subscription_create( + OpenAPI_list_t *events, + char *notif_uri, + char *notif_corre_id, + char *supi, + char *gpsi, + OpenAPI_snssai_dnn_pair_t *snssai_dnn_pairs, + OpenAPI_list_t *add_snssai_dnn_pairs, + char *supp_feat +); +void OpenAPI_bsf_subscription_free(OpenAPI_bsf_subscription_t *bsf_subscription); +OpenAPI_bsf_subscription_t *OpenAPI_bsf_subscription_parseFromJSON(cJSON *bsf_subscriptionJSON); +cJSON *OpenAPI_bsf_subscription_convertToJSON(OpenAPI_bsf_subscription_t *bsf_subscription); +OpenAPI_bsf_subscription_t *OpenAPI_bsf_subscription_copy(OpenAPI_bsf_subscription_t *dst, OpenAPI_bsf_subscription_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_bsf_subscription_H_ */ + diff --git a/lib/sbi/openapi/model/bsf_subscription_resp.c b/lib/sbi/openapi/model/bsf_subscription_resp.c new file mode 100644 index 000000000..ec8602f41 --- /dev/null +++ b/lib/sbi/openapi/model/bsf_subscription_resp.c @@ -0,0 +1,486 @@ + +#include +#include +#include +#include "bsf_subscription_resp.h" + +OpenAPI_bsf_subscription_resp_t *OpenAPI_bsf_subscription_resp_create( + OpenAPI_list_t *events, + char *notif_uri, + char *notif_corre_id, + char *supi, + char *gpsi, + OpenAPI_snssai_dnn_pair_t *snssai_dnn_pairs, + OpenAPI_list_t *add_snssai_dnn_pairs, + char *supp_feat, + char *pcf_id, + char *pcf_set_id, + OpenAPI_binding_level_e bind_level, + OpenAPI_list_t *event_notifs +) +{ + OpenAPI_bsf_subscription_resp_t *bsf_subscription_resp_local_var = ogs_malloc(sizeof(OpenAPI_bsf_subscription_resp_t)); + ogs_assert(bsf_subscription_resp_local_var); + + bsf_subscription_resp_local_var->events = events; + bsf_subscription_resp_local_var->notif_uri = notif_uri; + bsf_subscription_resp_local_var->notif_corre_id = notif_corre_id; + bsf_subscription_resp_local_var->supi = supi; + bsf_subscription_resp_local_var->gpsi = gpsi; + bsf_subscription_resp_local_var->snssai_dnn_pairs = snssai_dnn_pairs; + bsf_subscription_resp_local_var->add_snssai_dnn_pairs = add_snssai_dnn_pairs; + bsf_subscription_resp_local_var->supp_feat = supp_feat; + bsf_subscription_resp_local_var->pcf_id = pcf_id; + bsf_subscription_resp_local_var->pcf_set_id = pcf_set_id; + bsf_subscription_resp_local_var->bind_level = bind_level; + bsf_subscription_resp_local_var->event_notifs = event_notifs; + + return bsf_subscription_resp_local_var; +} + +void OpenAPI_bsf_subscription_resp_free(OpenAPI_bsf_subscription_resp_t *bsf_subscription_resp) +{ + OpenAPI_lnode_t *node = NULL; + + if (NULL == bsf_subscription_resp) { + return; + } + if (bsf_subscription_resp->events) { + OpenAPI_list_free(bsf_subscription_resp->events); + bsf_subscription_resp->events = NULL; + } + if (bsf_subscription_resp->notif_uri) { + ogs_free(bsf_subscription_resp->notif_uri); + bsf_subscription_resp->notif_uri = NULL; + } + if (bsf_subscription_resp->notif_corre_id) { + ogs_free(bsf_subscription_resp->notif_corre_id); + bsf_subscription_resp->notif_corre_id = NULL; + } + if (bsf_subscription_resp->supi) { + ogs_free(bsf_subscription_resp->supi); + bsf_subscription_resp->supi = NULL; + } + if (bsf_subscription_resp->gpsi) { + ogs_free(bsf_subscription_resp->gpsi); + bsf_subscription_resp->gpsi = NULL; + } + if (bsf_subscription_resp->snssai_dnn_pairs) { + OpenAPI_snssai_dnn_pair_free(bsf_subscription_resp->snssai_dnn_pairs); + bsf_subscription_resp->snssai_dnn_pairs = NULL; + } + if (bsf_subscription_resp->add_snssai_dnn_pairs) { + OpenAPI_list_for_each(bsf_subscription_resp->add_snssai_dnn_pairs, node) { + OpenAPI_snssai_dnn_pair_free(node->data); + } + OpenAPI_list_free(bsf_subscription_resp->add_snssai_dnn_pairs); + bsf_subscription_resp->add_snssai_dnn_pairs = NULL; + } + if (bsf_subscription_resp->supp_feat) { + ogs_free(bsf_subscription_resp->supp_feat); + bsf_subscription_resp->supp_feat = NULL; + } + if (bsf_subscription_resp->pcf_id) { + ogs_free(bsf_subscription_resp->pcf_id); + bsf_subscription_resp->pcf_id = NULL; + } + if (bsf_subscription_resp->pcf_set_id) { + ogs_free(bsf_subscription_resp->pcf_set_id); + bsf_subscription_resp->pcf_set_id = NULL; + } + if (bsf_subscription_resp->event_notifs) { + OpenAPI_list_for_each(bsf_subscription_resp->event_notifs, node) { + OpenAPI_bsf_event_notification_free(node->data); + } + OpenAPI_list_free(bsf_subscription_resp->event_notifs); + bsf_subscription_resp->event_notifs = NULL; + } + ogs_free(bsf_subscription_resp); +} + +cJSON *OpenAPI_bsf_subscription_resp_convertToJSON(OpenAPI_bsf_subscription_resp_t *bsf_subscription_resp) +{ + cJSON *item = NULL; + OpenAPI_lnode_t *node = NULL; + + if (bsf_subscription_resp == NULL) { + ogs_error("OpenAPI_bsf_subscription_resp_convertToJSON() failed [BsfSubscriptionResp]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (bsf_subscription_resp->events == OpenAPI_bsf_event_NULL) { + ogs_error("OpenAPI_bsf_subscription_resp_convertToJSON() failed [events]"); + return NULL; + } + cJSON *eventsList = cJSON_AddArrayToObject(item, "events"); + if (eventsList == NULL) { + ogs_error("OpenAPI_bsf_subscription_resp_convertToJSON() failed [events]"); + goto end; + } + OpenAPI_list_for_each(bsf_subscription_resp->events, node) { + if (cJSON_AddStringToObject(eventsList, "", OpenAPI_bsf_event_ToString((intptr_t)node->data)) == NULL) { + ogs_error("OpenAPI_bsf_subscription_resp_convertToJSON() failed [events]"); + goto end; + } + } + + if (!bsf_subscription_resp->notif_uri) { + ogs_error("OpenAPI_bsf_subscription_resp_convertToJSON() failed [notif_uri]"); + return NULL; + } + if (cJSON_AddStringToObject(item, "notifUri", bsf_subscription_resp->notif_uri) == NULL) { + ogs_error("OpenAPI_bsf_subscription_resp_convertToJSON() failed [notif_uri]"); + goto end; + } + + if (!bsf_subscription_resp->notif_corre_id) { + ogs_error("OpenAPI_bsf_subscription_resp_convertToJSON() failed [notif_corre_id]"); + return NULL; + } + if (cJSON_AddStringToObject(item, "notifCorreId", bsf_subscription_resp->notif_corre_id) == NULL) { + ogs_error("OpenAPI_bsf_subscription_resp_convertToJSON() failed [notif_corre_id]"); + goto end; + } + + if (!bsf_subscription_resp->supi) { + ogs_error("OpenAPI_bsf_subscription_resp_convertToJSON() failed [supi]"); + return NULL; + } + if (cJSON_AddStringToObject(item, "supi", bsf_subscription_resp->supi) == NULL) { + ogs_error("OpenAPI_bsf_subscription_resp_convertToJSON() failed [supi]"); + goto end; + } + + if (bsf_subscription_resp->gpsi) { + if (cJSON_AddStringToObject(item, "gpsi", bsf_subscription_resp->gpsi) == NULL) { + ogs_error("OpenAPI_bsf_subscription_resp_convertToJSON() failed [gpsi]"); + goto end; + } + } + + if (bsf_subscription_resp->snssai_dnn_pairs) { + cJSON *snssai_dnn_pairs_local_JSON = OpenAPI_snssai_dnn_pair_convertToJSON(bsf_subscription_resp->snssai_dnn_pairs); + if (snssai_dnn_pairs_local_JSON == NULL) { + ogs_error("OpenAPI_bsf_subscription_resp_convertToJSON() failed [snssai_dnn_pairs]"); + goto end; + } + cJSON_AddItemToObject(item, "snssaiDnnPairs", snssai_dnn_pairs_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_bsf_subscription_resp_convertToJSON() failed [snssai_dnn_pairs]"); + goto end; + } + } + + if (bsf_subscription_resp->add_snssai_dnn_pairs) { + cJSON *add_snssai_dnn_pairsList = cJSON_AddArrayToObject(item, "addSnssaiDnnPairs"); + if (add_snssai_dnn_pairsList == NULL) { + ogs_error("OpenAPI_bsf_subscription_resp_convertToJSON() failed [add_snssai_dnn_pairs]"); + goto end; + } + OpenAPI_list_for_each(bsf_subscription_resp->add_snssai_dnn_pairs, node) { + cJSON *itemLocal = OpenAPI_snssai_dnn_pair_convertToJSON(node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_bsf_subscription_resp_convertToJSON() failed [add_snssai_dnn_pairs]"); + goto end; + } + cJSON_AddItemToArray(add_snssai_dnn_pairsList, itemLocal); + } + } + + if (bsf_subscription_resp->supp_feat) { + if (cJSON_AddStringToObject(item, "suppFeat", bsf_subscription_resp->supp_feat) == NULL) { + ogs_error("OpenAPI_bsf_subscription_resp_convertToJSON() failed [supp_feat]"); + goto end; + } + } + + if (bsf_subscription_resp->pcf_id) { + if (cJSON_AddStringToObject(item, "pcfId", bsf_subscription_resp->pcf_id) == NULL) { + ogs_error("OpenAPI_bsf_subscription_resp_convertToJSON() failed [pcf_id]"); + goto end; + } + } + + if (bsf_subscription_resp->pcf_set_id) { + if (cJSON_AddStringToObject(item, "pcfSetId", bsf_subscription_resp->pcf_set_id) == NULL) { + ogs_error("OpenAPI_bsf_subscription_resp_convertToJSON() failed [pcf_set_id]"); + goto end; + } + } + + if (bsf_subscription_resp->bind_level != OpenAPI_binding_level_NULL) { + if (cJSON_AddStringToObject(item, "bindLevel", OpenAPI_binding_level_ToString(bsf_subscription_resp->bind_level)) == NULL) { + ogs_error("OpenAPI_bsf_subscription_resp_convertToJSON() failed [bind_level]"); + goto end; + } + } + + if (!bsf_subscription_resp->event_notifs) { + ogs_error("OpenAPI_bsf_subscription_resp_convertToJSON() failed [event_notifs]"); + return NULL; + } + cJSON *event_notifsList = cJSON_AddArrayToObject(item, "eventNotifs"); + if (event_notifsList == NULL) { + ogs_error("OpenAPI_bsf_subscription_resp_convertToJSON() failed [event_notifs]"); + goto end; + } + OpenAPI_list_for_each(bsf_subscription_resp->event_notifs, node) { + cJSON *itemLocal = OpenAPI_bsf_event_notification_convertToJSON(node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_bsf_subscription_resp_convertToJSON() failed [event_notifs]"); + goto end; + } + cJSON_AddItemToArray(event_notifsList, itemLocal); + } + +end: + return item; +} + +OpenAPI_bsf_subscription_resp_t *OpenAPI_bsf_subscription_resp_parseFromJSON(cJSON *bsf_subscription_respJSON) +{ + OpenAPI_bsf_subscription_resp_t *bsf_subscription_resp_local_var = NULL; + OpenAPI_lnode_t *node = NULL; + cJSON *events = NULL; + OpenAPI_list_t *eventsList = NULL; + cJSON *notif_uri = NULL; + cJSON *notif_corre_id = NULL; + cJSON *supi = NULL; + cJSON *gpsi = NULL; + cJSON *snssai_dnn_pairs = NULL; + OpenAPI_snssai_dnn_pair_t *snssai_dnn_pairs_local_nonprim = NULL; + cJSON *add_snssai_dnn_pairs = NULL; + OpenAPI_list_t *add_snssai_dnn_pairsList = NULL; + cJSON *supp_feat = NULL; + cJSON *pcf_id = NULL; + cJSON *pcf_set_id = NULL; + cJSON *bind_level = NULL; + OpenAPI_binding_level_e bind_levelVariable = 0; + cJSON *event_notifs = NULL; + OpenAPI_list_t *event_notifsList = NULL; + events = cJSON_GetObjectItemCaseSensitive(bsf_subscription_respJSON, "events"); + if (!events) { + ogs_error("OpenAPI_bsf_subscription_resp_parseFromJSON() failed [events]"); + goto end; + } + cJSON *events_local = NULL; + if (!cJSON_IsArray(events)) { + ogs_error("OpenAPI_bsf_subscription_resp_parseFromJSON() failed [events]"); + goto end; + } + + eventsList = OpenAPI_list_create(); + + cJSON_ArrayForEach(events_local, events) { + if (!cJSON_IsString(events_local)) { + ogs_error("OpenAPI_bsf_subscription_resp_parseFromJSON() failed [events]"); + goto end; + } + OpenAPI_list_add(eventsList, (void *)OpenAPI_bsf_event_FromString(events_local->valuestring)); + } + + notif_uri = cJSON_GetObjectItemCaseSensitive(bsf_subscription_respJSON, "notifUri"); + if (!notif_uri) { + ogs_error("OpenAPI_bsf_subscription_resp_parseFromJSON() failed [notif_uri]"); + goto end; + } + if (!cJSON_IsString(notif_uri)) { + ogs_error("OpenAPI_bsf_subscription_resp_parseFromJSON() failed [notif_uri]"); + goto end; + } + + notif_corre_id = cJSON_GetObjectItemCaseSensitive(bsf_subscription_respJSON, "notifCorreId"); + if (!notif_corre_id) { + ogs_error("OpenAPI_bsf_subscription_resp_parseFromJSON() failed [notif_corre_id]"); + goto end; + } + if (!cJSON_IsString(notif_corre_id)) { + ogs_error("OpenAPI_bsf_subscription_resp_parseFromJSON() failed [notif_corre_id]"); + goto end; + } + + supi = cJSON_GetObjectItemCaseSensitive(bsf_subscription_respJSON, "supi"); + if (!supi) { + ogs_error("OpenAPI_bsf_subscription_resp_parseFromJSON() failed [supi]"); + goto end; + } + if (!cJSON_IsString(supi)) { + ogs_error("OpenAPI_bsf_subscription_resp_parseFromJSON() failed [supi]"); + goto end; + } + + gpsi = cJSON_GetObjectItemCaseSensitive(bsf_subscription_respJSON, "gpsi"); + if (gpsi) { + if (!cJSON_IsString(gpsi) && !cJSON_IsNull(gpsi)) { + ogs_error("OpenAPI_bsf_subscription_resp_parseFromJSON() failed [gpsi]"); + goto end; + } + } + + snssai_dnn_pairs = cJSON_GetObjectItemCaseSensitive(bsf_subscription_respJSON, "snssaiDnnPairs"); + if (snssai_dnn_pairs) { + snssai_dnn_pairs_local_nonprim = OpenAPI_snssai_dnn_pair_parseFromJSON(snssai_dnn_pairs); + } + + add_snssai_dnn_pairs = cJSON_GetObjectItemCaseSensitive(bsf_subscription_respJSON, "addSnssaiDnnPairs"); + if (add_snssai_dnn_pairs) { + cJSON *add_snssai_dnn_pairs_local = NULL; + if (!cJSON_IsArray(add_snssai_dnn_pairs)) { + ogs_error("OpenAPI_bsf_subscription_resp_parseFromJSON() failed [add_snssai_dnn_pairs]"); + goto end; + } + + add_snssai_dnn_pairsList = OpenAPI_list_create(); + + cJSON_ArrayForEach(add_snssai_dnn_pairs_local, add_snssai_dnn_pairs) { + if (!cJSON_IsObject(add_snssai_dnn_pairs_local)) { + ogs_error("OpenAPI_bsf_subscription_resp_parseFromJSON() failed [add_snssai_dnn_pairs]"); + goto end; + } + OpenAPI_snssai_dnn_pair_t *add_snssai_dnn_pairsItem = OpenAPI_snssai_dnn_pair_parseFromJSON(add_snssai_dnn_pairs_local); + if (!add_snssai_dnn_pairsItem) { + ogs_error("No add_snssai_dnn_pairsItem"); + OpenAPI_list_free(add_snssai_dnn_pairsList); + goto end; + } + OpenAPI_list_add(add_snssai_dnn_pairsList, add_snssai_dnn_pairsItem); + } + } + + supp_feat = cJSON_GetObjectItemCaseSensitive(bsf_subscription_respJSON, "suppFeat"); + if (supp_feat) { + if (!cJSON_IsString(supp_feat) && !cJSON_IsNull(supp_feat)) { + ogs_error("OpenAPI_bsf_subscription_resp_parseFromJSON() failed [supp_feat]"); + goto end; + } + } + + pcf_id = cJSON_GetObjectItemCaseSensitive(bsf_subscription_respJSON, "pcfId"); + if (pcf_id) { + if (!cJSON_IsString(pcf_id) && !cJSON_IsNull(pcf_id)) { + ogs_error("OpenAPI_bsf_subscription_resp_parseFromJSON() failed [pcf_id]"); + goto end; + } + } + + pcf_set_id = cJSON_GetObjectItemCaseSensitive(bsf_subscription_respJSON, "pcfSetId"); + if (pcf_set_id) { + if (!cJSON_IsString(pcf_set_id) && !cJSON_IsNull(pcf_set_id)) { + ogs_error("OpenAPI_bsf_subscription_resp_parseFromJSON() failed [pcf_set_id]"); + goto end; + } + } + + bind_level = cJSON_GetObjectItemCaseSensitive(bsf_subscription_respJSON, "bindLevel"); + if (bind_level) { + if (!cJSON_IsString(bind_level)) { + ogs_error("OpenAPI_bsf_subscription_resp_parseFromJSON() failed [bind_level]"); + goto end; + } + bind_levelVariable = OpenAPI_binding_level_FromString(bind_level->valuestring); + } + + event_notifs = cJSON_GetObjectItemCaseSensitive(bsf_subscription_respJSON, "eventNotifs"); + if (!event_notifs) { + ogs_error("OpenAPI_bsf_subscription_resp_parseFromJSON() failed [event_notifs]"); + goto end; + } + cJSON *event_notifs_local = NULL; + if (!cJSON_IsArray(event_notifs)) { + ogs_error("OpenAPI_bsf_subscription_resp_parseFromJSON() failed [event_notifs]"); + goto end; + } + + event_notifsList = OpenAPI_list_create(); + + cJSON_ArrayForEach(event_notifs_local, event_notifs) { + if (!cJSON_IsObject(event_notifs_local)) { + ogs_error("OpenAPI_bsf_subscription_resp_parseFromJSON() failed [event_notifs]"); + goto end; + } + OpenAPI_bsf_event_notification_t *event_notifsItem = OpenAPI_bsf_event_notification_parseFromJSON(event_notifs_local); + if (!event_notifsItem) { + ogs_error("No event_notifsItem"); + OpenAPI_list_free(event_notifsList); + goto end; + } + OpenAPI_list_add(event_notifsList, event_notifsItem); + } + + bsf_subscription_resp_local_var = OpenAPI_bsf_subscription_resp_create ( + eventsList, + ogs_strdup(notif_uri->valuestring), + ogs_strdup(notif_corre_id->valuestring), + ogs_strdup(supi->valuestring), + gpsi && !cJSON_IsNull(gpsi) ? ogs_strdup(gpsi->valuestring) : NULL, + snssai_dnn_pairs ? snssai_dnn_pairs_local_nonprim : NULL, + add_snssai_dnn_pairs ? add_snssai_dnn_pairsList : 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, + bind_level ? bind_levelVariable : 0, + event_notifsList + ); + + return bsf_subscription_resp_local_var; +end: + if (eventsList) { + OpenAPI_list_free(eventsList); + eventsList = NULL; + } + if (snssai_dnn_pairs_local_nonprim) { + OpenAPI_snssai_dnn_pair_free(snssai_dnn_pairs_local_nonprim); + snssai_dnn_pairs_local_nonprim = NULL; + } + if (add_snssai_dnn_pairsList) { + OpenAPI_list_for_each(add_snssai_dnn_pairsList, node) { + OpenAPI_snssai_dnn_pair_free(node->data); + } + OpenAPI_list_free(add_snssai_dnn_pairsList); + add_snssai_dnn_pairsList = NULL; + } + if (event_notifsList) { + OpenAPI_list_for_each(event_notifsList, node) { + OpenAPI_bsf_event_notification_free(node->data); + } + OpenAPI_list_free(event_notifsList); + event_notifsList = NULL; + } + return NULL; +} + +OpenAPI_bsf_subscription_resp_t *OpenAPI_bsf_subscription_resp_copy(OpenAPI_bsf_subscription_resp_t *dst, OpenAPI_bsf_subscription_resp_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_bsf_subscription_resp_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_bsf_subscription_resp_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_bsf_subscription_resp_free(dst); + dst = OpenAPI_bsf_subscription_resp_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/bsf_subscription_resp.h b/lib/sbi/openapi/model/bsf_subscription_resp.h new file mode 100644 index 000000000..ed6121a62 --- /dev/null +++ b/lib/sbi/openapi/model/bsf_subscription_resp.h @@ -0,0 +1,66 @@ +/* + * bsf_subscription_resp.h + * + * It represents a response to a modification or creation request of an Individual Binding Subscription resource. It may contain the notification of the already met events. + */ + +#ifndef _OpenAPI_bsf_subscription_resp_H_ +#define _OpenAPI_bsf_subscription_resp_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "binding_level.h" +#include "bsf_event.h" +#include "bsf_event_notification.h" +#include "bsf_notification.h" +#include "bsf_subscription.h" +#include "snssai_dnn_pair.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_bsf_subscription_resp_s OpenAPI_bsf_subscription_resp_t; +typedef struct OpenAPI_bsf_subscription_resp_s { + OpenAPI_list_t *events; + char *notif_uri; + char *notif_corre_id; + char *supi; + char *gpsi; + struct OpenAPI_snssai_dnn_pair_s *snssai_dnn_pairs; + OpenAPI_list_t *add_snssai_dnn_pairs; + char *supp_feat; + char *pcf_id; + char *pcf_set_id; + OpenAPI_binding_level_e bind_level; + OpenAPI_list_t *event_notifs; +} OpenAPI_bsf_subscription_resp_t; + +OpenAPI_bsf_subscription_resp_t *OpenAPI_bsf_subscription_resp_create( + OpenAPI_list_t *events, + char *notif_uri, + char *notif_corre_id, + char *supi, + char *gpsi, + OpenAPI_snssai_dnn_pair_t *snssai_dnn_pairs, + OpenAPI_list_t *add_snssai_dnn_pairs, + char *supp_feat, + char *pcf_id, + char *pcf_set_id, + OpenAPI_binding_level_e bind_level, + OpenAPI_list_t *event_notifs +); +void OpenAPI_bsf_subscription_resp_free(OpenAPI_bsf_subscription_resp_t *bsf_subscription_resp); +OpenAPI_bsf_subscription_resp_t *OpenAPI_bsf_subscription_resp_parseFromJSON(cJSON *bsf_subscription_respJSON); +cJSON *OpenAPI_bsf_subscription_resp_convertToJSON(OpenAPI_bsf_subscription_resp_t *bsf_subscription_resp); +OpenAPI_bsf_subscription_resp_t *OpenAPI_bsf_subscription_resp_copy(OpenAPI_bsf_subscription_resp_t *dst, OpenAPI_bsf_subscription_resp_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_bsf_subscription_resp_H_ */ + diff --git a/lib/sbi/openapi/model/bw_requirement.c b/lib/sbi/openapi/model/bw_requirement.c new file mode 100644 index 000000000..828aa7de7 --- /dev/null +++ b/lib/sbi/openapi/model/bw_requirement.c @@ -0,0 +1,206 @@ + +#include +#include +#include +#include "bw_requirement.h" + +OpenAPI_bw_requirement_t *OpenAPI_bw_requirement_create( + char *app_id, + char *mar_bw_dl, + char *mar_bw_ul, + char *mir_bw_dl, + char *mir_bw_ul +) +{ + OpenAPI_bw_requirement_t *bw_requirement_local_var = ogs_malloc(sizeof(OpenAPI_bw_requirement_t)); + ogs_assert(bw_requirement_local_var); + + bw_requirement_local_var->app_id = app_id; + bw_requirement_local_var->mar_bw_dl = mar_bw_dl; + bw_requirement_local_var->mar_bw_ul = mar_bw_ul; + bw_requirement_local_var->mir_bw_dl = mir_bw_dl; + bw_requirement_local_var->mir_bw_ul = mir_bw_ul; + + return bw_requirement_local_var; +} + +void OpenAPI_bw_requirement_free(OpenAPI_bw_requirement_t *bw_requirement) +{ + OpenAPI_lnode_t *node = NULL; + + if (NULL == bw_requirement) { + return; + } + if (bw_requirement->app_id) { + ogs_free(bw_requirement->app_id); + bw_requirement->app_id = NULL; + } + if (bw_requirement->mar_bw_dl) { + ogs_free(bw_requirement->mar_bw_dl); + bw_requirement->mar_bw_dl = NULL; + } + if (bw_requirement->mar_bw_ul) { + ogs_free(bw_requirement->mar_bw_ul); + bw_requirement->mar_bw_ul = NULL; + } + if (bw_requirement->mir_bw_dl) { + ogs_free(bw_requirement->mir_bw_dl); + bw_requirement->mir_bw_dl = NULL; + } + if (bw_requirement->mir_bw_ul) { + ogs_free(bw_requirement->mir_bw_ul); + bw_requirement->mir_bw_ul = NULL; + } + ogs_free(bw_requirement); +} + +cJSON *OpenAPI_bw_requirement_convertToJSON(OpenAPI_bw_requirement_t *bw_requirement) +{ + cJSON *item = NULL; + OpenAPI_lnode_t *node = NULL; + + if (bw_requirement == NULL) { + ogs_error("OpenAPI_bw_requirement_convertToJSON() failed [BwRequirement]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (!bw_requirement->app_id) { + ogs_error("OpenAPI_bw_requirement_convertToJSON() failed [app_id]"); + return NULL; + } + if (cJSON_AddStringToObject(item, "appId", bw_requirement->app_id) == NULL) { + ogs_error("OpenAPI_bw_requirement_convertToJSON() failed [app_id]"); + goto end; + } + + if (bw_requirement->mar_bw_dl) { + if (cJSON_AddStringToObject(item, "marBwDl", bw_requirement->mar_bw_dl) == NULL) { + ogs_error("OpenAPI_bw_requirement_convertToJSON() failed [mar_bw_dl]"); + goto end; + } + } + + if (bw_requirement->mar_bw_ul) { + if (cJSON_AddStringToObject(item, "marBwUl", bw_requirement->mar_bw_ul) == NULL) { + ogs_error("OpenAPI_bw_requirement_convertToJSON() failed [mar_bw_ul]"); + goto end; + } + } + + if (bw_requirement->mir_bw_dl) { + if (cJSON_AddStringToObject(item, "mirBwDl", bw_requirement->mir_bw_dl) == NULL) { + ogs_error("OpenAPI_bw_requirement_convertToJSON() failed [mir_bw_dl]"); + goto end; + } + } + + if (bw_requirement->mir_bw_ul) { + if (cJSON_AddStringToObject(item, "mirBwUl", bw_requirement->mir_bw_ul) == NULL) { + ogs_error("OpenAPI_bw_requirement_convertToJSON() failed [mir_bw_ul]"); + goto end; + } + } + +end: + return item; +} + +OpenAPI_bw_requirement_t *OpenAPI_bw_requirement_parseFromJSON(cJSON *bw_requirementJSON) +{ + OpenAPI_bw_requirement_t *bw_requirement_local_var = NULL; + OpenAPI_lnode_t *node = NULL; + cJSON *app_id = NULL; + cJSON *mar_bw_dl = NULL; + cJSON *mar_bw_ul = NULL; + cJSON *mir_bw_dl = NULL; + cJSON *mir_bw_ul = NULL; + app_id = cJSON_GetObjectItemCaseSensitive(bw_requirementJSON, "appId"); + if (!app_id) { + ogs_error("OpenAPI_bw_requirement_parseFromJSON() failed [app_id]"); + goto end; + } + if (!cJSON_IsString(app_id)) { + ogs_error("OpenAPI_bw_requirement_parseFromJSON() failed [app_id]"); + goto end; + } + + mar_bw_dl = cJSON_GetObjectItemCaseSensitive(bw_requirementJSON, "marBwDl"); + if (mar_bw_dl) { + if (!cJSON_IsString(mar_bw_dl) && !cJSON_IsNull(mar_bw_dl)) { + ogs_error("OpenAPI_bw_requirement_parseFromJSON() failed [mar_bw_dl]"); + goto end; + } + } + + mar_bw_ul = cJSON_GetObjectItemCaseSensitive(bw_requirementJSON, "marBwUl"); + if (mar_bw_ul) { + if (!cJSON_IsString(mar_bw_ul) && !cJSON_IsNull(mar_bw_ul)) { + ogs_error("OpenAPI_bw_requirement_parseFromJSON() failed [mar_bw_ul]"); + goto end; + } + } + + mir_bw_dl = cJSON_GetObjectItemCaseSensitive(bw_requirementJSON, "mirBwDl"); + if (mir_bw_dl) { + if (!cJSON_IsString(mir_bw_dl) && !cJSON_IsNull(mir_bw_dl)) { + ogs_error("OpenAPI_bw_requirement_parseFromJSON() failed [mir_bw_dl]"); + goto end; + } + } + + mir_bw_ul = cJSON_GetObjectItemCaseSensitive(bw_requirementJSON, "mirBwUl"); + if (mir_bw_ul) { + if (!cJSON_IsString(mir_bw_ul) && !cJSON_IsNull(mir_bw_ul)) { + ogs_error("OpenAPI_bw_requirement_parseFromJSON() failed [mir_bw_ul]"); + goto end; + } + } + + bw_requirement_local_var = OpenAPI_bw_requirement_create ( + ogs_strdup(app_id->valuestring), + mar_bw_dl && !cJSON_IsNull(mar_bw_dl) ? ogs_strdup(mar_bw_dl->valuestring) : NULL, + mar_bw_ul && !cJSON_IsNull(mar_bw_ul) ? ogs_strdup(mar_bw_ul->valuestring) : NULL, + mir_bw_dl && !cJSON_IsNull(mir_bw_dl) ? ogs_strdup(mir_bw_dl->valuestring) : NULL, + mir_bw_ul && !cJSON_IsNull(mir_bw_ul) ? ogs_strdup(mir_bw_ul->valuestring) : NULL + ); + + return bw_requirement_local_var; +end: + return NULL; +} + +OpenAPI_bw_requirement_t *OpenAPI_bw_requirement_copy(OpenAPI_bw_requirement_t *dst, OpenAPI_bw_requirement_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_bw_requirement_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_bw_requirement_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_bw_requirement_free(dst); + dst = OpenAPI_bw_requirement_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/bw_requirement.h b/lib/sbi/openapi/model/bw_requirement.h new file mode 100644 index 000000000..93f2821d4 --- /dev/null +++ b/lib/sbi/openapi/model/bw_requirement.h @@ -0,0 +1,46 @@ +/* + * bw_requirement.h + * + * Represents bandwidth requirements. + */ + +#ifndef _OpenAPI_bw_requirement_H_ +#define _OpenAPI_bw_requirement_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_bw_requirement_s OpenAPI_bw_requirement_t; +typedef struct OpenAPI_bw_requirement_s { + char *app_id; + char *mar_bw_dl; + char *mar_bw_ul; + char *mir_bw_dl; + char *mir_bw_ul; +} OpenAPI_bw_requirement_t; + +OpenAPI_bw_requirement_t *OpenAPI_bw_requirement_create( + char *app_id, + char *mar_bw_dl, + char *mar_bw_ul, + char *mir_bw_dl, + char *mir_bw_ul +); +void OpenAPI_bw_requirement_free(OpenAPI_bw_requirement_t *bw_requirement); +OpenAPI_bw_requirement_t *OpenAPI_bw_requirement_parseFromJSON(cJSON *bw_requirementJSON); +cJSON *OpenAPI_bw_requirement_convertToJSON(OpenAPI_bw_requirement_t *bw_requirement); +OpenAPI_bw_requirement_t *OpenAPI_bw_requirement_copy(OpenAPI_bw_requirement_t *dst, OpenAPI_bw_requirement_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_bw_requirement_H_ */ + diff --git a/lib/sbi/openapi/model/cag_ack_data.h b/lib/sbi/openapi/model/cag_ack_data.h index 253377ab0..e095908e7 100644 --- a/lib/sbi/openapi/model/cag_ack_data.h +++ b/lib/sbi/openapi/model/cag_ack_data.h @@ -1,7 +1,7 @@ /* * cag_ack_data.h * - * + * Used to store the status of the latest CAG data update. */ #ifndef _OpenAPI_cag_ack_data_H_ diff --git a/lib/sbi/openapi/model/candidate_for_replacement.h b/lib/sbi/openapi/model/candidate_for_replacement.h index 09e1e9903..93ad52053 100644 --- a/lib/sbi/openapi/model/candidate_for_replacement.h +++ b/lib/sbi/openapi/model/candidate_for_replacement.h @@ -1,7 +1,7 @@ /* * candidate_for_replacement.h * - * + * Represents a list of candidate DNNs for replacement for an S-NSSAI. */ #ifndef _OpenAPI_candidate_for_replacement_H_ diff --git a/lib/sbi/openapi/model/cause.c b/lib/sbi/openapi/model/cause.c index bfcd13c74..5bc3c2dc2 100644 --- a/lib/sbi/openapi/model/cause.c +++ b/lib/sbi/openapi/model/cause.c @@ -6,7 +6,7 @@ char* OpenAPI_cause_ToString(OpenAPI_cause_e cause) { - const char *causeArray[] = { "NULL", "REL_DUE_TO_HO", "EPS_FALLBACK", "REL_DUE_TO_UP_SEC", "DNN_CONGESTION", "S_NSSAI_CONGESTION", "REL_DUE_TO_REACTIVATION", "5G_AN_NOT_RESPONDING", "REL_DUE_TO_SLICE_NOT_AVAILABLE", "REL_DUE_TO_DUPLICATE_SESSION_ID", "PDU_SESSION_STATUS_MISMATCH", "HO_FAILURE", "INSUFFICIENT_UP_RESOURCES", "PDU_SESSION_HANDED_OVER", "PDU_SESSION_RESUMED", "CN_ASSISTED_RAN_PARAMETER_TUNING", "ISMF_CONTEXT_TRANSFER", "SMF_CONTEXT_TRANSFER", "REL_DUE_TO_PS_TO_CS_HO", "REL_DUE_TO_SUBSCRIPTION_CHANGE", "HO_CANCEL", "REL_DUE_TO_SLICE_NOT_AUTHORIZED", "PDU_SESSION_HAND_OVER_FAILURE", "DDN_FAILURE_STATUS", "REL_DUE_TO_CP_ONLY_NOT_APPLICABLE", "NOT_SUPPORTED_WITH_ISMF", "CHANGED_ANCHOR_SMF", "CHANGED_INTERMEDIATE_SMF" }; + const char *causeArray[] = { "NULL", "REL_DUE_TO_HO", "EPS_FALLBACK", "REL_DUE_TO_UP_SEC", "DNN_CONGESTION", "S_NSSAI_CONGESTION", "REL_DUE_TO_REACTIVATION", "5G_AN_NOT_RESPONDING", "REL_DUE_TO_SLICE_NOT_AVAILABLE", "REL_DUE_TO_DUPLICATE_SESSION_ID", "PDU_SESSION_STATUS_MISMATCH", "HO_FAILURE", "INSUFFICIENT_UP_RESOURCES", "PDU_SESSION_HANDED_OVER", "PDU_SESSION_RESUMED", "CN_ASSISTED_RAN_PARAMETER_TUNING", "ISMF_CONTEXT_TRANSFER", "SMF_CONTEXT_TRANSFER", "REL_DUE_TO_PS_TO_CS_HO", "REL_DUE_TO_SUBSCRIPTION_CHANGE", "HO_CANCEL", "REL_DUE_TO_SLICE_NOT_AUTHORIZED", "PDU_SESSION_HAND_OVER_FAILURE", "DDN_FAILURE_STATUS", "REL_DUE_TO_CP_ONLY_NOT_APPLICABLE", "NOT_SUPPORTED_WITH_ISMF", "CHANGED_ANCHOR_SMF", "CHANGED_INTERMEDIATE_SMF", "TARGET_DNAI_NOTIFICATION", "REL_DUE_TO_VPLMN_QOS_FAILURE", "REL_DUE_TO_SMF_NOT_SUPPORT_PSETR", "REL_DUE_TO_SNPN_SNPN_MOBILITY", "REL_DUE_TO_NO_HR_AGREEMENT", "REL_DUE_TO_UNSPECIFIED_REASON" }; size_t sizeofArray = sizeof(causeArray) / sizeof(causeArray[0]); if (cause < sizeofArray) return (char *)causeArray[cause]; @@ -17,7 +17,7 @@ char* OpenAPI_cause_ToString(OpenAPI_cause_e cause) OpenAPI_cause_e OpenAPI_cause_FromString(char* cause) { int stringToReturn = 0; - const char *causeArray[] = { "NULL", "REL_DUE_TO_HO", "EPS_FALLBACK", "REL_DUE_TO_UP_SEC", "DNN_CONGESTION", "S_NSSAI_CONGESTION", "REL_DUE_TO_REACTIVATION", "5G_AN_NOT_RESPONDING", "REL_DUE_TO_SLICE_NOT_AVAILABLE", "REL_DUE_TO_DUPLICATE_SESSION_ID", "PDU_SESSION_STATUS_MISMATCH", "HO_FAILURE", "INSUFFICIENT_UP_RESOURCES", "PDU_SESSION_HANDED_OVER", "PDU_SESSION_RESUMED", "CN_ASSISTED_RAN_PARAMETER_TUNING", "ISMF_CONTEXT_TRANSFER", "SMF_CONTEXT_TRANSFER", "REL_DUE_TO_PS_TO_CS_HO", "REL_DUE_TO_SUBSCRIPTION_CHANGE", "HO_CANCEL", "REL_DUE_TO_SLICE_NOT_AUTHORIZED", "PDU_SESSION_HAND_OVER_FAILURE", "DDN_FAILURE_STATUS", "REL_DUE_TO_CP_ONLY_NOT_APPLICABLE", "NOT_SUPPORTED_WITH_ISMF", "CHANGED_ANCHOR_SMF", "CHANGED_INTERMEDIATE_SMF" }; + const char *causeArray[] = { "NULL", "REL_DUE_TO_HO", "EPS_FALLBACK", "REL_DUE_TO_UP_SEC", "DNN_CONGESTION", "S_NSSAI_CONGESTION", "REL_DUE_TO_REACTIVATION", "5G_AN_NOT_RESPONDING", "REL_DUE_TO_SLICE_NOT_AVAILABLE", "REL_DUE_TO_DUPLICATE_SESSION_ID", "PDU_SESSION_STATUS_MISMATCH", "HO_FAILURE", "INSUFFICIENT_UP_RESOURCES", "PDU_SESSION_HANDED_OVER", "PDU_SESSION_RESUMED", "CN_ASSISTED_RAN_PARAMETER_TUNING", "ISMF_CONTEXT_TRANSFER", "SMF_CONTEXT_TRANSFER", "REL_DUE_TO_PS_TO_CS_HO", "REL_DUE_TO_SUBSCRIPTION_CHANGE", "HO_CANCEL", "REL_DUE_TO_SLICE_NOT_AUTHORIZED", "PDU_SESSION_HAND_OVER_FAILURE", "DDN_FAILURE_STATUS", "REL_DUE_TO_CP_ONLY_NOT_APPLICABLE", "NOT_SUPPORTED_WITH_ISMF", "CHANGED_ANCHOR_SMF", "CHANGED_INTERMEDIATE_SMF", "TARGET_DNAI_NOTIFICATION", "REL_DUE_TO_VPLMN_QOS_FAILURE", "REL_DUE_TO_SMF_NOT_SUPPORT_PSETR", "REL_DUE_TO_SNPN_SNPN_MOBILITY", "REL_DUE_TO_NO_HR_AGREEMENT", "REL_DUE_TO_UNSPECIFIED_REASON" }; size_t sizeofArray = sizeof(causeArray) / sizeof(causeArray[0]); while (stringToReturn < sizeofArray) { if (strcmp(cause, causeArray[stringToReturn]) == 0) { diff --git a/lib/sbi/openapi/model/cause.h b/lib/sbi/openapi/model/cause.h index f8b238688..d8225e83a 100644 --- a/lib/sbi/openapi/model/cause.h +++ b/lib/sbi/openapi/model/cause.h @@ -17,7 +17,7 @@ extern "C" { #endif -typedef enum { OpenAPI_cause_NULL = 0, OpenAPI_cause_REL_DUE_TO_HO, OpenAPI_cause_EPS_FALLBACK, OpenAPI_cause_REL_DUE_TO_UP_SEC, OpenAPI_cause_DNN_CONGESTION, OpenAPI_cause_S_NSSAI_CONGESTION, OpenAPI_cause_REL_DUE_TO_REACTIVATION, OpenAPI_cause__5G_AN_NOT_RESPONDING, OpenAPI_cause_REL_DUE_TO_SLICE_NOT_AVAILABLE, OpenAPI_cause_REL_DUE_TO_DUPLICATE_SESSION_ID, OpenAPI_cause_PDU_SESSION_STATUS_MISMATCH, OpenAPI_cause_HO_FAILURE, OpenAPI_cause_INSUFFICIENT_UP_RESOURCES, OpenAPI_cause_PDU_SESSION_HANDED_OVER, OpenAPI_cause_PDU_SESSION_RESUMED, OpenAPI_cause_CN_ASSISTED_RAN_PARAMETER_TUNING, OpenAPI_cause_ISMF_CONTEXT_TRANSFER, OpenAPI_cause_SMF_CONTEXT_TRANSFER, OpenAPI_cause_REL_DUE_TO_PS_TO_CS_HO, OpenAPI_cause_REL_DUE_TO_SUBSCRIPTION_CHANGE, OpenAPI_cause_HO_CANCEL, OpenAPI_cause_REL_DUE_TO_SLICE_NOT_AUTHORIZED, OpenAPI_cause_PDU_SESSION_HAND_OVER_FAILURE, OpenAPI_cause_DDN_FAILURE_STATUS, OpenAPI_cause_REL_DUE_TO_CP_ONLY_NOT_APPLICABLE, OpenAPI_cause_NOT_SUPPORTED_WITH_ISMF, OpenAPI_cause_CHANGED_ANCHOR_SMF, OpenAPI_cause_CHANGED_INTERMEDIATE_SMF } OpenAPI_cause_e; +typedef enum { OpenAPI_cause_NULL = 0, OpenAPI_cause_REL_DUE_TO_HO, OpenAPI_cause_EPS_FALLBACK, OpenAPI_cause_REL_DUE_TO_UP_SEC, OpenAPI_cause_DNN_CONGESTION, OpenAPI_cause_S_NSSAI_CONGESTION, OpenAPI_cause_REL_DUE_TO_REACTIVATION, OpenAPI_cause__5G_AN_NOT_RESPONDING, OpenAPI_cause_REL_DUE_TO_SLICE_NOT_AVAILABLE, OpenAPI_cause_REL_DUE_TO_DUPLICATE_SESSION_ID, OpenAPI_cause_PDU_SESSION_STATUS_MISMATCH, OpenAPI_cause_HO_FAILURE, OpenAPI_cause_INSUFFICIENT_UP_RESOURCES, OpenAPI_cause_PDU_SESSION_HANDED_OVER, OpenAPI_cause_PDU_SESSION_RESUMED, OpenAPI_cause_CN_ASSISTED_RAN_PARAMETER_TUNING, OpenAPI_cause_ISMF_CONTEXT_TRANSFER, OpenAPI_cause_SMF_CONTEXT_TRANSFER, OpenAPI_cause_REL_DUE_TO_PS_TO_CS_HO, OpenAPI_cause_REL_DUE_TO_SUBSCRIPTION_CHANGE, OpenAPI_cause_HO_CANCEL, OpenAPI_cause_REL_DUE_TO_SLICE_NOT_AUTHORIZED, OpenAPI_cause_PDU_SESSION_HAND_OVER_FAILURE, OpenAPI_cause_DDN_FAILURE_STATUS, OpenAPI_cause_REL_DUE_TO_CP_ONLY_NOT_APPLICABLE, OpenAPI_cause_NOT_SUPPORTED_WITH_ISMF, OpenAPI_cause_CHANGED_ANCHOR_SMF, OpenAPI_cause_CHANGED_INTERMEDIATE_SMF, OpenAPI_cause_TARGET_DNAI_NOTIFICATION, OpenAPI_cause_REL_DUE_TO_VPLMN_QOS_FAILURE, OpenAPI_cause_REL_DUE_TO_SMF_NOT_SUPPORT_PSETR, OpenAPI_cause_REL_DUE_TO_SNPN_SNPN_MOBILITY, OpenAPI_cause_REL_DUE_TO_NO_HR_AGREEMENT, OpenAPI_cause_REL_DUE_TO_UNSPECIFIED_REASON } OpenAPI_cause_e; char* OpenAPI_cause_ToString(OpenAPI_cause_e cause); diff --git a/lib/sbi/openapi/model/cell_global_id.c b/lib/sbi/openapi/model/cell_global_id.c new file mode 100644 index 000000000..b83fddc98 --- /dev/null +++ b/lib/sbi/openapi/model/cell_global_id.c @@ -0,0 +1,176 @@ + +#include +#include +#include +#include "cell_global_id.h" + +OpenAPI_cell_global_id_t *OpenAPI_cell_global_id_create( + OpenAPI_plmn_id_t *plmn_id, + char *lac, + char *cell_id +) +{ + OpenAPI_cell_global_id_t *cell_global_id_local_var = ogs_malloc(sizeof(OpenAPI_cell_global_id_t)); + ogs_assert(cell_global_id_local_var); + + cell_global_id_local_var->plmn_id = plmn_id; + cell_global_id_local_var->lac = lac; + cell_global_id_local_var->cell_id = cell_id; + + return cell_global_id_local_var; +} + +void OpenAPI_cell_global_id_free(OpenAPI_cell_global_id_t *cell_global_id) +{ + OpenAPI_lnode_t *node = NULL; + + if (NULL == cell_global_id) { + return; + } + if (cell_global_id->plmn_id) { + OpenAPI_plmn_id_free(cell_global_id->plmn_id); + cell_global_id->plmn_id = NULL; + } + if (cell_global_id->lac) { + ogs_free(cell_global_id->lac); + cell_global_id->lac = NULL; + } + if (cell_global_id->cell_id) { + ogs_free(cell_global_id->cell_id); + cell_global_id->cell_id = NULL; + } + ogs_free(cell_global_id); +} + +cJSON *OpenAPI_cell_global_id_convertToJSON(OpenAPI_cell_global_id_t *cell_global_id) +{ + cJSON *item = NULL; + OpenAPI_lnode_t *node = NULL; + + if (cell_global_id == NULL) { + ogs_error("OpenAPI_cell_global_id_convertToJSON() failed [CellGlobalId]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (!cell_global_id->plmn_id) { + ogs_error("OpenAPI_cell_global_id_convertToJSON() failed [plmn_id]"); + return NULL; + } + cJSON *plmn_id_local_JSON = OpenAPI_plmn_id_convertToJSON(cell_global_id->plmn_id); + if (plmn_id_local_JSON == NULL) { + ogs_error("OpenAPI_cell_global_id_convertToJSON() failed [plmn_id]"); + goto end; + } + cJSON_AddItemToObject(item, "plmnId", plmn_id_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_cell_global_id_convertToJSON() failed [plmn_id]"); + goto end; + } + + if (!cell_global_id->lac) { + ogs_error("OpenAPI_cell_global_id_convertToJSON() failed [lac]"); + return NULL; + } + if (cJSON_AddStringToObject(item, "lac", cell_global_id->lac) == NULL) { + ogs_error("OpenAPI_cell_global_id_convertToJSON() failed [lac]"); + goto end; + } + + if (!cell_global_id->cell_id) { + ogs_error("OpenAPI_cell_global_id_convertToJSON() failed [cell_id]"); + return NULL; + } + if (cJSON_AddStringToObject(item, "cellId", cell_global_id->cell_id) == NULL) { + ogs_error("OpenAPI_cell_global_id_convertToJSON() failed [cell_id]"); + goto end; + } + +end: + return item; +} + +OpenAPI_cell_global_id_t *OpenAPI_cell_global_id_parseFromJSON(cJSON *cell_global_idJSON) +{ + OpenAPI_cell_global_id_t *cell_global_id_local_var = NULL; + OpenAPI_lnode_t *node = NULL; + cJSON *plmn_id = NULL; + OpenAPI_plmn_id_t *plmn_id_local_nonprim = NULL; + cJSON *lac = NULL; + cJSON *cell_id = NULL; + plmn_id = cJSON_GetObjectItemCaseSensitive(cell_global_idJSON, "plmnId"); + if (!plmn_id) { + ogs_error("OpenAPI_cell_global_id_parseFromJSON() failed [plmn_id]"); + goto end; + } + plmn_id_local_nonprim = OpenAPI_plmn_id_parseFromJSON(plmn_id); + + lac = cJSON_GetObjectItemCaseSensitive(cell_global_idJSON, "lac"); + if (!lac) { + ogs_error("OpenAPI_cell_global_id_parseFromJSON() failed [lac]"); + goto end; + } + if (!cJSON_IsString(lac)) { + ogs_error("OpenAPI_cell_global_id_parseFromJSON() failed [lac]"); + goto end; + } + + cell_id = cJSON_GetObjectItemCaseSensitive(cell_global_idJSON, "cellId"); + if (!cell_id) { + ogs_error("OpenAPI_cell_global_id_parseFromJSON() failed [cell_id]"); + goto end; + } + if (!cJSON_IsString(cell_id)) { + ogs_error("OpenAPI_cell_global_id_parseFromJSON() failed [cell_id]"); + goto end; + } + + cell_global_id_local_var = OpenAPI_cell_global_id_create ( + plmn_id_local_nonprim, + ogs_strdup(lac->valuestring), + ogs_strdup(cell_id->valuestring) + ); + + return cell_global_id_local_var; +end: + if (plmn_id_local_nonprim) { + OpenAPI_plmn_id_free(plmn_id_local_nonprim); + plmn_id_local_nonprim = NULL; + } + return NULL; +} + +OpenAPI_cell_global_id_t *OpenAPI_cell_global_id_copy(OpenAPI_cell_global_id_t *dst, OpenAPI_cell_global_id_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_cell_global_id_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_cell_global_id_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_cell_global_id_free(dst); + dst = OpenAPI_cell_global_id_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/cell_global_id.h b/lib/sbi/openapi/model/cell_global_id.h new file mode 100644 index 000000000..6a17948b7 --- /dev/null +++ b/lib/sbi/openapi/model/cell_global_id.h @@ -0,0 +1,43 @@ +/* + * cell_global_id.h + * + * Contains a Cell Global Identification as defined in 3GPP TS 23.003, clause 4.3.1. + */ + +#ifndef _OpenAPI_cell_global_id_H_ +#define _OpenAPI_cell_global_id_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "plmn_id.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_cell_global_id_s OpenAPI_cell_global_id_t; +typedef struct OpenAPI_cell_global_id_s { + struct OpenAPI_plmn_id_s *plmn_id; + char *lac; + char *cell_id; +} OpenAPI_cell_global_id_t; + +OpenAPI_cell_global_id_t *OpenAPI_cell_global_id_create( + OpenAPI_plmn_id_t *plmn_id, + char *lac, + char *cell_id +); +void OpenAPI_cell_global_id_free(OpenAPI_cell_global_id_t *cell_global_id); +OpenAPI_cell_global_id_t *OpenAPI_cell_global_id_parseFromJSON(cJSON *cell_global_idJSON); +cJSON *OpenAPI_cell_global_id_convertToJSON(OpenAPI_cell_global_id_t *cell_global_id); +OpenAPI_cell_global_id_t *OpenAPI_cell_global_id_copy(OpenAPI_cell_global_id_t *dst, OpenAPI_cell_global_id_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_cell_global_id_H_ */ + diff --git a/lib/sbi/openapi/model/change_item.h b/lib/sbi/openapi/model/change_item.h index ec1cf9500..74fa86303 100644 --- a/lib/sbi/openapi/model/change_item.h +++ b/lib/sbi/openapi/model/change_item.h @@ -1,7 +1,7 @@ /* * change_item.h * - * + * It contains data which need to be changed. */ #ifndef _OpenAPI_change_item_H_ diff --git a/lib/sbi/openapi/model/charging_data.h b/lib/sbi/openapi/model/charging_data.h index 237380450..9c804abc8 100644 --- a/lib/sbi/openapi/model/charging_data.h +++ b/lib/sbi/openapi/model/charging_data.h @@ -1,7 +1,7 @@ /* * charging_data.h * - * + * Contains charging related parameters. */ #ifndef _OpenAPI_charging_data_H_ diff --git a/lib/sbi/openapi/model/charging_information.c b/lib/sbi/openapi/model/charging_information.c index a06b6d3bd..4491a0f60 100644 --- a/lib/sbi/openapi/model/charging_information.c +++ b/lib/sbi/openapi/model/charging_information.c @@ -80,14 +80,12 @@ cJSON *OpenAPI_charging_information_convertToJSON(OpenAPI_charging_information_t goto end; } - if (!charging_information->secondary_chf_address) { - ogs_error("OpenAPI_charging_information_convertToJSON() failed [secondary_chf_address]"); - return NULL; - } + if (charging_information->secondary_chf_address) { if (cJSON_AddStringToObject(item, "secondaryChfAddress", charging_information->secondary_chf_address) == NULL) { ogs_error("OpenAPI_charging_information_convertToJSON() failed [secondary_chf_address]"); goto end; } + } if (charging_information->primary_chf_set_id) { if (cJSON_AddStringToObject(item, "primaryChfSetId", charging_information->primary_chf_set_id) == NULL) { @@ -142,13 +140,11 @@ OpenAPI_charging_information_t *OpenAPI_charging_information_parseFromJSON(cJSON } secondary_chf_address = cJSON_GetObjectItemCaseSensitive(charging_informationJSON, "secondaryChfAddress"); - if (!secondary_chf_address) { + if (secondary_chf_address) { + if (!cJSON_IsString(secondary_chf_address) && !cJSON_IsNull(secondary_chf_address)) { ogs_error("OpenAPI_charging_information_parseFromJSON() failed [secondary_chf_address]"); goto end; } - if (!cJSON_IsString(secondary_chf_address)) { - ogs_error("OpenAPI_charging_information_parseFromJSON() failed [secondary_chf_address]"); - goto end; } primary_chf_set_id = cJSON_GetObjectItemCaseSensitive(charging_informationJSON, "primaryChfSetId"); @@ -185,7 +181,7 @@ OpenAPI_charging_information_t *OpenAPI_charging_information_parseFromJSON(cJSON charging_information_local_var = OpenAPI_charging_information_create ( ogs_strdup(primary_chf_address->valuestring), - ogs_strdup(secondary_chf_address->valuestring), + secondary_chf_address && !cJSON_IsNull(secondary_chf_address) ? ogs_strdup(secondary_chf_address->valuestring) : NULL, primary_chf_set_id && !cJSON_IsNull(primary_chf_set_id) ? ogs_strdup(primary_chf_set_id->valuestring) : NULL, primary_chf_instance_id && !cJSON_IsNull(primary_chf_instance_id) ? ogs_strdup(primary_chf_instance_id->valuestring) : NULL, secondary_chf_set_id && !cJSON_IsNull(secondary_chf_set_id) ? ogs_strdup(secondary_chf_set_id->valuestring) : NULL, diff --git a/lib/sbi/openapi/model/charging_information.h b/lib/sbi/openapi/model/charging_information.h index 444dd6519..f18ec2733 100644 --- a/lib/sbi/openapi/model/charging_information.h +++ b/lib/sbi/openapi/model/charging_information.h @@ -1,7 +1,7 @@ /* * charging_information.h * - * + * Contains the addresses of the charging functions. */ #ifndef _OpenAPI_charging_information_H_ diff --git a/lib/sbi/openapi/model/circumstance_description.c b/lib/sbi/openapi/model/circumstance_description.c new file mode 100644 index 000000000..0c4e892ef --- /dev/null +++ b/lib/sbi/openapi/model/circumstance_description.c @@ -0,0 +1,185 @@ + +#include +#include +#include +#include "circumstance_description.h" + +OpenAPI_circumstance_description_t *OpenAPI_circumstance_description_create( + bool is_freq, + float freq, + char *tm, + OpenAPI_network_area_info_t *loc_area, + bool is_vol, + long vol +) +{ + OpenAPI_circumstance_description_t *circumstance_description_local_var = ogs_malloc(sizeof(OpenAPI_circumstance_description_t)); + ogs_assert(circumstance_description_local_var); + + circumstance_description_local_var->is_freq = is_freq; + circumstance_description_local_var->freq = freq; + circumstance_description_local_var->tm = tm; + circumstance_description_local_var->loc_area = loc_area; + circumstance_description_local_var->is_vol = is_vol; + circumstance_description_local_var->vol = vol; + + return circumstance_description_local_var; +} + +void OpenAPI_circumstance_description_free(OpenAPI_circumstance_description_t *circumstance_description) +{ + OpenAPI_lnode_t *node = NULL; + + if (NULL == circumstance_description) { + return; + } + if (circumstance_description->tm) { + ogs_free(circumstance_description->tm); + circumstance_description->tm = NULL; + } + if (circumstance_description->loc_area) { + OpenAPI_network_area_info_free(circumstance_description->loc_area); + circumstance_description->loc_area = NULL; + } + ogs_free(circumstance_description); +} + +cJSON *OpenAPI_circumstance_description_convertToJSON(OpenAPI_circumstance_description_t *circumstance_description) +{ + cJSON *item = NULL; + OpenAPI_lnode_t *node = NULL; + + if (circumstance_description == NULL) { + ogs_error("OpenAPI_circumstance_description_convertToJSON() failed [CircumstanceDescription]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (circumstance_description->is_freq) { + if (cJSON_AddNumberToObject(item, "freq", circumstance_description->freq) == NULL) { + ogs_error("OpenAPI_circumstance_description_convertToJSON() failed [freq]"); + goto end; + } + } + + if (circumstance_description->tm) { + if (cJSON_AddStringToObject(item, "tm", circumstance_description->tm) == NULL) { + ogs_error("OpenAPI_circumstance_description_convertToJSON() failed [tm]"); + goto end; + } + } + + if (circumstance_description->loc_area) { + cJSON *loc_area_local_JSON = OpenAPI_network_area_info_convertToJSON(circumstance_description->loc_area); + if (loc_area_local_JSON == NULL) { + ogs_error("OpenAPI_circumstance_description_convertToJSON() failed [loc_area]"); + goto end; + } + cJSON_AddItemToObject(item, "locArea", loc_area_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_circumstance_description_convertToJSON() failed [loc_area]"); + goto end; + } + } + + if (circumstance_description->is_vol) { + if (cJSON_AddNumberToObject(item, "vol", circumstance_description->vol) == NULL) { + ogs_error("OpenAPI_circumstance_description_convertToJSON() failed [vol]"); + goto end; + } + } + +end: + return item; +} + +OpenAPI_circumstance_description_t *OpenAPI_circumstance_description_parseFromJSON(cJSON *circumstance_descriptionJSON) +{ + OpenAPI_circumstance_description_t *circumstance_description_local_var = NULL; + OpenAPI_lnode_t *node = NULL; + cJSON *freq = NULL; + cJSON *tm = NULL; + cJSON *loc_area = NULL; + OpenAPI_network_area_info_t *loc_area_local_nonprim = NULL; + cJSON *vol = NULL; + freq = cJSON_GetObjectItemCaseSensitive(circumstance_descriptionJSON, "freq"); + if (freq) { + if (!cJSON_IsNumber(freq)) { + ogs_error("OpenAPI_circumstance_description_parseFromJSON() failed [freq]"); + goto end; + } + } + + tm = cJSON_GetObjectItemCaseSensitive(circumstance_descriptionJSON, "tm"); + if (tm) { + if (!cJSON_IsString(tm) && !cJSON_IsNull(tm)) { + ogs_error("OpenAPI_circumstance_description_parseFromJSON() failed [tm]"); + goto end; + } + } + + loc_area = cJSON_GetObjectItemCaseSensitive(circumstance_descriptionJSON, "locArea"); + if (loc_area) { + loc_area_local_nonprim = OpenAPI_network_area_info_parseFromJSON(loc_area); + } + + vol = cJSON_GetObjectItemCaseSensitive(circumstance_descriptionJSON, "vol"); + if (vol) { + if (!cJSON_IsNumber(vol)) { + ogs_error("OpenAPI_circumstance_description_parseFromJSON() failed [vol]"); + goto end; + } + } + + circumstance_description_local_var = OpenAPI_circumstance_description_create ( + freq ? true : false, + freq ? freq->valuedouble : 0, + tm && !cJSON_IsNull(tm) ? ogs_strdup(tm->valuestring) : NULL, + loc_area ? loc_area_local_nonprim : NULL, + vol ? true : false, + vol ? vol->valuedouble : 0 + ); + + return circumstance_description_local_var; +end: + if (loc_area_local_nonprim) { + OpenAPI_network_area_info_free(loc_area_local_nonprim); + loc_area_local_nonprim = NULL; + } + return NULL; +} + +OpenAPI_circumstance_description_t *OpenAPI_circumstance_description_copy(OpenAPI_circumstance_description_t *dst, OpenAPI_circumstance_description_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_circumstance_description_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_circumstance_description_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_circumstance_description_free(dst); + dst = OpenAPI_circumstance_description_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/circumstance_description.h b/lib/sbi/openapi/model/circumstance_description.h new file mode 100644 index 000000000..9b654076a --- /dev/null +++ b/lib/sbi/openapi/model/circumstance_description.h @@ -0,0 +1,49 @@ +/* + * circumstance_description.h + * + * Contains the description of a circumstance. + */ + +#ifndef _OpenAPI_circumstance_description_H_ +#define _OpenAPI_circumstance_description_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "network_area_info.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_circumstance_description_s OpenAPI_circumstance_description_t; +typedef struct OpenAPI_circumstance_description_s { + bool is_freq; + float freq; + char *tm; + struct OpenAPI_network_area_info_s *loc_area; + bool is_vol; + long vol; +} OpenAPI_circumstance_description_t; + +OpenAPI_circumstance_description_t *OpenAPI_circumstance_description_create( + bool is_freq, + float freq, + char *tm, + OpenAPI_network_area_info_t *loc_area, + bool is_vol, + long vol +); +void OpenAPI_circumstance_description_free(OpenAPI_circumstance_description_t *circumstance_description); +OpenAPI_circumstance_description_t *OpenAPI_circumstance_description_parseFromJSON(cJSON *circumstance_descriptionJSON); +cJSON *OpenAPI_circumstance_description_convertToJSON(OpenAPI_circumstance_description_t *circumstance_description); +OpenAPI_circumstance_description_t *OpenAPI_circumstance_description_copy(OpenAPI_circumstance_description_t *dst, OpenAPI_circumstance_description_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_circumstance_description_H_ */ + diff --git a/lib/sbi/openapi/model/civic_address.h b/lib/sbi/openapi/model/civic_address.h index 79b846796..1bb41ea31 100644 --- a/lib/sbi/openapi/model/civic_address.h +++ b/lib/sbi/openapi/model/civic_address.h @@ -1,7 +1,7 @@ /* * civic_address.h * - * + * Indicates a Civic address. */ #ifndef _OpenAPI_civic_address_H_ diff --git a/lib/sbi/openapi/model/class_criterion.c b/lib/sbi/openapi/model/class_criterion.c new file mode 100644 index 000000000..8602e0720 --- /dev/null +++ b/lib/sbi/openapi/model/class_criterion.c @@ -0,0 +1,177 @@ + +#include +#include +#include +#include "class_criterion.h" + +OpenAPI_class_criterion_t *OpenAPI_class_criterion_create( + OpenAPI_dispersion_class_t *disper_class, + int class_threshold, + OpenAPI_matching_direction_t *thres_match +) +{ + OpenAPI_class_criterion_t *class_criterion_local_var = ogs_malloc(sizeof(OpenAPI_class_criterion_t)); + ogs_assert(class_criterion_local_var); + + class_criterion_local_var->disper_class = disper_class; + class_criterion_local_var->class_threshold = class_threshold; + class_criterion_local_var->thres_match = thres_match; + + return class_criterion_local_var; +} + +void OpenAPI_class_criterion_free(OpenAPI_class_criterion_t *class_criterion) +{ + OpenAPI_lnode_t *node = NULL; + + if (NULL == class_criterion) { + return; + } + if (class_criterion->disper_class) { + OpenAPI_dispersion_class_free(class_criterion->disper_class); + class_criterion->disper_class = NULL; + } + if (class_criterion->thres_match) { + OpenAPI_matching_direction_free(class_criterion->thres_match); + class_criterion->thres_match = NULL; + } + ogs_free(class_criterion); +} + +cJSON *OpenAPI_class_criterion_convertToJSON(OpenAPI_class_criterion_t *class_criterion) +{ + cJSON *item = NULL; + OpenAPI_lnode_t *node = NULL; + + if (class_criterion == NULL) { + ogs_error("OpenAPI_class_criterion_convertToJSON() failed [ClassCriterion]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (!class_criterion->disper_class) { + ogs_error("OpenAPI_class_criterion_convertToJSON() failed [disper_class]"); + return NULL; + } + cJSON *disper_class_local_JSON = OpenAPI_dispersion_class_convertToJSON(class_criterion->disper_class); + if (disper_class_local_JSON == NULL) { + ogs_error("OpenAPI_class_criterion_convertToJSON() failed [disper_class]"); + goto end; + } + cJSON_AddItemToObject(item, "disperClass", disper_class_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_class_criterion_convertToJSON() failed [disper_class]"); + goto end; + } + + if (cJSON_AddNumberToObject(item, "classThreshold", class_criterion->class_threshold) == NULL) { + ogs_error("OpenAPI_class_criterion_convertToJSON() failed [class_threshold]"); + goto end; + } + + if (!class_criterion->thres_match) { + ogs_error("OpenAPI_class_criterion_convertToJSON() failed [thres_match]"); + return NULL; + } + cJSON *thres_match_local_JSON = OpenAPI_matching_direction_convertToJSON(class_criterion->thres_match); + if (thres_match_local_JSON == NULL) { + ogs_error("OpenAPI_class_criterion_convertToJSON() failed [thres_match]"); + goto end; + } + cJSON_AddItemToObject(item, "thresMatch", thres_match_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_class_criterion_convertToJSON() failed [thres_match]"); + goto end; + } + +end: + return item; +} + +OpenAPI_class_criterion_t *OpenAPI_class_criterion_parseFromJSON(cJSON *class_criterionJSON) +{ + OpenAPI_class_criterion_t *class_criterion_local_var = NULL; + OpenAPI_lnode_t *node = NULL; + cJSON *disper_class = NULL; + OpenAPI_dispersion_class_t *disper_class_local_nonprim = NULL; + cJSON *class_threshold = NULL; + cJSON *thres_match = NULL; + OpenAPI_matching_direction_t *thres_match_local_nonprim = NULL; + disper_class = cJSON_GetObjectItemCaseSensitive(class_criterionJSON, "disperClass"); + if (!disper_class) { + ogs_error("OpenAPI_class_criterion_parseFromJSON() failed [disper_class]"); + goto end; + } + disper_class_local_nonprim = OpenAPI_dispersion_class_parseFromJSON(disper_class); + + class_threshold = cJSON_GetObjectItemCaseSensitive(class_criterionJSON, "classThreshold"); + if (!class_threshold) { + ogs_error("OpenAPI_class_criterion_parseFromJSON() failed [class_threshold]"); + goto end; + } + if (!cJSON_IsNumber(class_threshold)) { + ogs_error("OpenAPI_class_criterion_parseFromJSON() failed [class_threshold]"); + goto end; + } + + thres_match = cJSON_GetObjectItemCaseSensitive(class_criterionJSON, "thresMatch"); + if (!thres_match) { + ogs_error("OpenAPI_class_criterion_parseFromJSON() failed [thres_match]"); + goto end; + } + thres_match_local_nonprim = OpenAPI_matching_direction_parseFromJSON(thres_match); + + class_criterion_local_var = OpenAPI_class_criterion_create ( + disper_class_local_nonprim, + + class_threshold->valuedouble, + thres_match_local_nonprim + ); + + return class_criterion_local_var; +end: + if (disper_class_local_nonprim) { + OpenAPI_dispersion_class_free(disper_class_local_nonprim); + disper_class_local_nonprim = NULL; + } + if (thres_match_local_nonprim) { + OpenAPI_matching_direction_free(thres_match_local_nonprim); + thres_match_local_nonprim = NULL; + } + return NULL; +} + +OpenAPI_class_criterion_t *OpenAPI_class_criterion_copy(OpenAPI_class_criterion_t *dst, OpenAPI_class_criterion_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_class_criterion_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_class_criterion_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_class_criterion_free(dst); + dst = OpenAPI_class_criterion_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/class_criterion.h b/lib/sbi/openapi/model/class_criterion.h new file mode 100644 index 000000000..383842191 --- /dev/null +++ b/lib/sbi/openapi/model/class_criterion.h @@ -0,0 +1,44 @@ +/* + * class_criterion.h + * + * Indicates the dispersion class criterion for fixed, camper and/or traveller UE, and/or the top-heavy UE dispersion class criterion. + */ + +#ifndef _OpenAPI_class_criterion_H_ +#define _OpenAPI_class_criterion_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "dispersion_class.h" +#include "matching_direction.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_class_criterion_s OpenAPI_class_criterion_t; +typedef struct OpenAPI_class_criterion_s { + struct OpenAPI_dispersion_class_s *disper_class; + int class_threshold; + struct OpenAPI_matching_direction_s *thres_match; +} OpenAPI_class_criterion_t; + +OpenAPI_class_criterion_t *OpenAPI_class_criterion_create( + OpenAPI_dispersion_class_t *disper_class, + int class_threshold, + OpenAPI_matching_direction_t *thres_match +); +void OpenAPI_class_criterion_free(OpenAPI_class_criterion_t *class_criterion); +OpenAPI_class_criterion_t *OpenAPI_class_criterion_parseFromJSON(cJSON *class_criterionJSON); +cJSON *OpenAPI_class_criterion_convertToJSON(OpenAPI_class_criterion_t *class_criterion); +OpenAPI_class_criterion_t *OpenAPI_class_criterion_copy(OpenAPI_class_criterion_t *dst, OpenAPI_class_criterion_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_class_criterion_H_ */ + diff --git a/lib/sbi/openapi/model/cm_info.h b/lib/sbi/openapi/model/cm_info.h index cc3e0708b..7524af68b 100644 --- a/lib/sbi/openapi/model/cm_info.h +++ b/lib/sbi/openapi/model/cm_info.h @@ -1,7 +1,7 @@ /* * cm_info.h * - * + * Represents the connection management state of a UE for an access type */ #ifndef _OpenAPI_cm_info_H_ diff --git a/lib/sbi/openapi/model/cm_state.h b/lib/sbi/openapi/model/cm_state.h index f85a3160e..8a2c88fb9 100644 --- a/lib/sbi/openapi/model/cm_state.h +++ b/lib/sbi/openapi/model/cm_state.h @@ -1,7 +1,7 @@ /* * cm_state.h * - * + * Describes the connection management state of a UE */ #ifndef _OpenAPI_cm_state_H_ diff --git a/lib/sbi/openapi/model/cn_assisted_ran_para.h b/lib/sbi/openapi/model/cn_assisted_ran_para.h index d6ca4896f..389917bb4 100644 --- a/lib/sbi/openapi/model/cn_assisted_ran_para.h +++ b/lib/sbi/openapi/model/cn_assisted_ran_para.h @@ -1,7 +1,7 @@ /* * cn_assisted_ran_para.h * - * + * SMF derived CN assisted RAN parameters tuning */ #ifndef _OpenAPI_cn_assisted_ran_para_H_ diff --git a/lib/sbi/openapi/model/cnf.h b/lib/sbi/openapi/model/cnf.h index 27a4e5ce1..367195f53 100644 --- a/lib/sbi/openapi/model/cnf.h +++ b/lib/sbi/openapi/model/cnf.h @@ -1,7 +1,7 @@ /* * cnf.h * - * + * A conjunctive normal form */ #ifndef _OpenAPI_cnf_H_ diff --git a/lib/sbi/openapi/model/cnf_unit.h b/lib/sbi/openapi/model/cnf_unit.h index 4e5ebb159..0496032e8 100644 --- a/lib/sbi/openapi/model/cnf_unit.h +++ b/lib/sbi/openapi/model/cnf_unit.h @@ -1,7 +1,7 @@ /* * cnf_unit.h * - * + * During the processing of cnfUnits attribute, all the members in the array shall be interpreted as logically concatenated with logical \"AND\". */ #ifndef _OpenAPI_cnf_unit_H_ diff --git a/lib/sbi/openapi/model/collocated_nf_instance.c b/lib/sbi/openapi/model/collocated_nf_instance.c new file mode 100644 index 000000000..7ba979869 --- /dev/null +++ b/lib/sbi/openapi/model/collocated_nf_instance.c @@ -0,0 +1,139 @@ + +#include +#include +#include +#include "collocated_nf_instance.h" + +OpenAPI_collocated_nf_instance_t *OpenAPI_collocated_nf_instance_create( + char *nf_instance_id, + OpenAPI_collocated_nf_type_e nf_type +) +{ + OpenAPI_collocated_nf_instance_t *collocated_nf_instance_local_var = ogs_malloc(sizeof(OpenAPI_collocated_nf_instance_t)); + ogs_assert(collocated_nf_instance_local_var); + + collocated_nf_instance_local_var->nf_instance_id = nf_instance_id; + collocated_nf_instance_local_var->nf_type = nf_type; + + return collocated_nf_instance_local_var; +} + +void OpenAPI_collocated_nf_instance_free(OpenAPI_collocated_nf_instance_t *collocated_nf_instance) +{ + OpenAPI_lnode_t *node = NULL; + + if (NULL == collocated_nf_instance) { + return; + } + if (collocated_nf_instance->nf_instance_id) { + ogs_free(collocated_nf_instance->nf_instance_id); + collocated_nf_instance->nf_instance_id = NULL; + } + ogs_free(collocated_nf_instance); +} + +cJSON *OpenAPI_collocated_nf_instance_convertToJSON(OpenAPI_collocated_nf_instance_t *collocated_nf_instance) +{ + cJSON *item = NULL; + OpenAPI_lnode_t *node = NULL; + + if (collocated_nf_instance == NULL) { + ogs_error("OpenAPI_collocated_nf_instance_convertToJSON() failed [CollocatedNfInstance]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (!collocated_nf_instance->nf_instance_id) { + ogs_error("OpenAPI_collocated_nf_instance_convertToJSON() failed [nf_instance_id]"); + return NULL; + } + if (cJSON_AddStringToObject(item, "nfInstanceId", collocated_nf_instance->nf_instance_id) == NULL) { + ogs_error("OpenAPI_collocated_nf_instance_convertToJSON() failed [nf_instance_id]"); + goto end; + } + + if (collocated_nf_instance->nf_type == OpenAPI_collocated_nf_type_NULL) { + ogs_error("OpenAPI_collocated_nf_instance_convertToJSON() failed [nf_type]"); + return NULL; + } + if (cJSON_AddStringToObject(item, "nfType", OpenAPI_collocated_nf_type_ToString(collocated_nf_instance->nf_type)) == NULL) { + ogs_error("OpenAPI_collocated_nf_instance_convertToJSON() failed [nf_type]"); + goto end; + } + +end: + return item; +} + +OpenAPI_collocated_nf_instance_t *OpenAPI_collocated_nf_instance_parseFromJSON(cJSON *collocated_nf_instanceJSON) +{ + OpenAPI_collocated_nf_instance_t *collocated_nf_instance_local_var = NULL; + OpenAPI_lnode_t *node = NULL; + cJSON *nf_instance_id = NULL; + cJSON *nf_type = NULL; + OpenAPI_collocated_nf_type_e nf_typeVariable = 0; + nf_instance_id = cJSON_GetObjectItemCaseSensitive(collocated_nf_instanceJSON, "nfInstanceId"); + if (!nf_instance_id) { + ogs_error("OpenAPI_collocated_nf_instance_parseFromJSON() failed [nf_instance_id]"); + goto end; + } + if (!cJSON_IsString(nf_instance_id)) { + ogs_error("OpenAPI_collocated_nf_instance_parseFromJSON() failed [nf_instance_id]"); + goto end; + } + + nf_type = cJSON_GetObjectItemCaseSensitive(collocated_nf_instanceJSON, "nfType"); + if (!nf_type) { + ogs_error("OpenAPI_collocated_nf_instance_parseFromJSON() failed [nf_type]"); + goto end; + } + if (!cJSON_IsString(nf_type)) { + ogs_error("OpenAPI_collocated_nf_instance_parseFromJSON() failed [nf_type]"); + goto end; + } + nf_typeVariable = OpenAPI_collocated_nf_type_FromString(nf_type->valuestring); + + collocated_nf_instance_local_var = OpenAPI_collocated_nf_instance_create ( + ogs_strdup(nf_instance_id->valuestring), + nf_typeVariable + ); + + return collocated_nf_instance_local_var; +end: + return NULL; +} + +OpenAPI_collocated_nf_instance_t *OpenAPI_collocated_nf_instance_copy(OpenAPI_collocated_nf_instance_t *dst, OpenAPI_collocated_nf_instance_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_collocated_nf_instance_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_collocated_nf_instance_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_collocated_nf_instance_free(dst); + dst = OpenAPI_collocated_nf_instance_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/collocated_nf_instance.h b/lib/sbi/openapi/model/collocated_nf_instance.h new file mode 100644 index 000000000..a0f36ca8c --- /dev/null +++ b/lib/sbi/openapi/model/collocated_nf_instance.h @@ -0,0 +1,41 @@ +/* + * collocated_nf_instance.h + * + * Information of an collocated NF Instance registered in the NRF + */ + +#ifndef _OpenAPI_collocated_nf_instance_H_ +#define _OpenAPI_collocated_nf_instance_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "collocated_nf_type.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_collocated_nf_instance_s OpenAPI_collocated_nf_instance_t; +typedef struct OpenAPI_collocated_nf_instance_s { + char *nf_instance_id; + OpenAPI_collocated_nf_type_e nf_type; +} OpenAPI_collocated_nf_instance_t; + +OpenAPI_collocated_nf_instance_t *OpenAPI_collocated_nf_instance_create( + char *nf_instance_id, + OpenAPI_collocated_nf_type_e nf_type +); +void OpenAPI_collocated_nf_instance_free(OpenAPI_collocated_nf_instance_t *collocated_nf_instance); +OpenAPI_collocated_nf_instance_t *OpenAPI_collocated_nf_instance_parseFromJSON(cJSON *collocated_nf_instanceJSON); +cJSON *OpenAPI_collocated_nf_instance_convertToJSON(OpenAPI_collocated_nf_instance_t *collocated_nf_instance); +OpenAPI_collocated_nf_instance_t *OpenAPI_collocated_nf_instance_copy(OpenAPI_collocated_nf_instance_t *dst, OpenAPI_collocated_nf_instance_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_collocated_nf_instance_H_ */ + diff --git a/lib/sbi/openapi/model/collocated_nf_type.c b/lib/sbi/openapi/model/collocated_nf_type.c new file mode 100644 index 000000000..671ac1317 --- /dev/null +++ b/lib/sbi/openapi/model/collocated_nf_type.c @@ -0,0 +1,30 @@ + +#include +#include +#include +#include "collocated_nf_type.h" + +char* OpenAPI_collocated_nf_type_ToString(OpenAPI_collocated_nf_type_e collocated_nf_type) +{ + const char *collocated_nf_typeArray[] = { "NULL", "UPF", "SMF", "MB_UPF", "MB_SMF" }; + size_t sizeofArray = sizeof(collocated_nf_typeArray) / sizeof(collocated_nf_typeArray[0]); + if (collocated_nf_type < sizeofArray) + return (char *)collocated_nf_typeArray[collocated_nf_type]; + else + return (char *)"Unknown"; +} + +OpenAPI_collocated_nf_type_e OpenAPI_collocated_nf_type_FromString(char* collocated_nf_type) +{ + int stringToReturn = 0; + const char *collocated_nf_typeArray[] = { "NULL", "UPF", "SMF", "MB_UPF", "MB_SMF" }; + size_t sizeofArray = sizeof(collocated_nf_typeArray) / sizeof(collocated_nf_typeArray[0]); + while (stringToReturn < sizeofArray) { + if (strcmp(collocated_nf_type, collocated_nf_typeArray[stringToReturn]) == 0) { + return stringToReturn; + } + stringToReturn++; + } + return 0; +} + diff --git a/lib/sbi/openapi/model/collocated_nf_type.h b/lib/sbi/openapi/model/collocated_nf_type.h new file mode 100644 index 000000000..83e879fac --- /dev/null +++ b/lib/sbi/openapi/model/collocated_nf_type.h @@ -0,0 +1,31 @@ +/* + * collocated_nf_type.h + * + * + */ + +#ifndef _OpenAPI_collocated_nf_type_H_ +#define _OpenAPI_collocated_nf_type_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef enum { OpenAPI_collocated_nf_type_NULL = 0, OpenAPI_collocated_nf_type_UPF, OpenAPI_collocated_nf_type_SMF, OpenAPI_collocated_nf_type_MB_UPF, OpenAPI_collocated_nf_type_MB_SMF } OpenAPI_collocated_nf_type_e; + +char* OpenAPI_collocated_nf_type_ToString(OpenAPI_collocated_nf_type_e collocated_nf_type); + +OpenAPI_collocated_nf_type_e OpenAPI_collocated_nf_type_FromString(char* collocated_nf_type); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_collocated_nf_type_H_ */ + diff --git a/lib/sbi/openapi/model/communication_characteristics_af.c b/lib/sbi/openapi/model/communication_characteristics_af.c new file mode 100644 index 000000000..1330342fe --- /dev/null +++ b/lib/sbi/openapi/model/communication_characteristics_af.c @@ -0,0 +1,153 @@ + +#include +#include +#include +#include "communication_characteristics_af.h" + +OpenAPI_communication_characteristics_af_t *OpenAPI_communication_characteristics_af_create( + bool is_pp_dl_packet_count, + int pp_dl_packet_count, + bool is_maximum_response_time, + int maximum_response_time, + bool is_maximum_latency, + int maximum_latency +) +{ + OpenAPI_communication_characteristics_af_t *communication_characteristics_af_local_var = ogs_malloc(sizeof(OpenAPI_communication_characteristics_af_t)); + ogs_assert(communication_characteristics_af_local_var); + + communication_characteristics_af_local_var->is_pp_dl_packet_count = is_pp_dl_packet_count; + communication_characteristics_af_local_var->pp_dl_packet_count = pp_dl_packet_count; + communication_characteristics_af_local_var->is_maximum_response_time = is_maximum_response_time; + communication_characteristics_af_local_var->maximum_response_time = maximum_response_time; + communication_characteristics_af_local_var->is_maximum_latency = is_maximum_latency; + communication_characteristics_af_local_var->maximum_latency = maximum_latency; + + return communication_characteristics_af_local_var; +} + +void OpenAPI_communication_characteristics_af_free(OpenAPI_communication_characteristics_af_t *communication_characteristics_af) +{ + OpenAPI_lnode_t *node = NULL; + + if (NULL == communication_characteristics_af) { + return; + } + ogs_free(communication_characteristics_af); +} + +cJSON *OpenAPI_communication_characteristics_af_convertToJSON(OpenAPI_communication_characteristics_af_t *communication_characteristics_af) +{ + cJSON *item = NULL; + OpenAPI_lnode_t *node = NULL; + + if (communication_characteristics_af == NULL) { + ogs_error("OpenAPI_communication_characteristics_af_convertToJSON() failed [CommunicationCharacteristicsAF]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (communication_characteristics_af->is_pp_dl_packet_count) { + if (cJSON_AddNumberToObject(item, "ppDlPacketCount", communication_characteristics_af->pp_dl_packet_count) == NULL) { + ogs_error("OpenAPI_communication_characteristics_af_convertToJSON() failed [pp_dl_packet_count]"); + goto end; + } + } + + if (communication_characteristics_af->is_maximum_response_time) { + if (cJSON_AddNumberToObject(item, "maximumResponseTime", communication_characteristics_af->maximum_response_time) == NULL) { + ogs_error("OpenAPI_communication_characteristics_af_convertToJSON() failed [maximum_response_time]"); + goto end; + } + } + + if (communication_characteristics_af->is_maximum_latency) { + if (cJSON_AddNumberToObject(item, "maximumLatency", communication_characteristics_af->maximum_latency) == NULL) { + ogs_error("OpenAPI_communication_characteristics_af_convertToJSON() failed [maximum_latency]"); + goto end; + } + } + +end: + return item; +} + +OpenAPI_communication_characteristics_af_t *OpenAPI_communication_characteristics_af_parseFromJSON(cJSON *communication_characteristics_afJSON) +{ + OpenAPI_communication_characteristics_af_t *communication_characteristics_af_local_var = NULL; + OpenAPI_lnode_t *node = NULL; + cJSON *pp_dl_packet_count = NULL; + cJSON *maximum_response_time = NULL; + cJSON *maximum_latency = NULL; + pp_dl_packet_count = cJSON_GetObjectItemCaseSensitive(communication_characteristics_afJSON, "ppDlPacketCount"); + if (pp_dl_packet_count) { + if (!cJSON_IsNumber(pp_dl_packet_count)) { + ogs_error("OpenAPI_communication_characteristics_af_parseFromJSON() failed [pp_dl_packet_count]"); + goto end; + } + } + + maximum_response_time = cJSON_GetObjectItemCaseSensitive(communication_characteristics_afJSON, "maximumResponseTime"); + if (maximum_response_time) { + if (!cJSON_IsNumber(maximum_response_time)) { + ogs_error("OpenAPI_communication_characteristics_af_parseFromJSON() failed [maximum_response_time]"); + goto end; + } + } + + maximum_latency = cJSON_GetObjectItemCaseSensitive(communication_characteristics_afJSON, "maximumLatency"); + if (maximum_latency) { + if (!cJSON_IsNumber(maximum_latency)) { + ogs_error("OpenAPI_communication_characteristics_af_parseFromJSON() failed [maximum_latency]"); + goto end; + } + } + + communication_characteristics_af_local_var = OpenAPI_communication_characteristics_af_create ( + pp_dl_packet_count ? true : false, + pp_dl_packet_count ? pp_dl_packet_count->valuedouble : 0, + maximum_response_time ? true : false, + maximum_response_time ? maximum_response_time->valuedouble : 0, + maximum_latency ? true : false, + maximum_latency ? maximum_latency->valuedouble : 0 + ); + + return communication_characteristics_af_local_var; +end: + return NULL; +} + +OpenAPI_communication_characteristics_af_t *OpenAPI_communication_characteristics_af_copy(OpenAPI_communication_characteristics_af_t *dst, OpenAPI_communication_characteristics_af_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_communication_characteristics_af_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_communication_characteristics_af_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_communication_characteristics_af_free(dst); + dst = OpenAPI_communication_characteristics_af_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/communication_characteristics_af.h b/lib/sbi/openapi/model/communication_characteristics_af.h new file mode 100644 index 000000000..a426437d7 --- /dev/null +++ b/lib/sbi/openapi/model/communication_characteristics_af.h @@ -0,0 +1,48 @@ +/* + * communication_characteristics_af.h + * + * + */ + +#ifndef _OpenAPI_communication_characteristics_af_H_ +#define _OpenAPI_communication_characteristics_af_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_communication_characteristics_af_s OpenAPI_communication_characteristics_af_t; +typedef struct OpenAPI_communication_characteristics_af_s { + bool is_pp_dl_packet_count; + int pp_dl_packet_count; + bool is_maximum_response_time; + int maximum_response_time; + bool is_maximum_latency; + int maximum_latency; +} OpenAPI_communication_characteristics_af_t; + +OpenAPI_communication_characteristics_af_t *OpenAPI_communication_characteristics_af_create( + bool is_pp_dl_packet_count, + int pp_dl_packet_count, + bool is_maximum_response_time, + int maximum_response_time, + bool is_maximum_latency, + int maximum_latency +); +void OpenAPI_communication_characteristics_af_free(OpenAPI_communication_characteristics_af_t *communication_characteristics_af); +OpenAPI_communication_characteristics_af_t *OpenAPI_communication_characteristics_af_parseFromJSON(cJSON *communication_characteristics_afJSON); +cJSON *OpenAPI_communication_characteristics_af_convertToJSON(OpenAPI_communication_characteristics_af_t *communication_characteristics_af); +OpenAPI_communication_characteristics_af_t *OpenAPI_communication_characteristics_af_copy(OpenAPI_communication_characteristics_af_t *dst, OpenAPI_communication_characteristics_af_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_communication_characteristics_af_H_ */ + diff --git a/lib/sbi/openapi/model/complex_query.h b/lib/sbi/openapi/model/complex_query.h index d20730e2e..bb4069f68 100644 --- a/lib/sbi/openapi/model/complex_query.h +++ b/lib/sbi/openapi/model/complex_query.h @@ -1,7 +1,7 @@ /* * complex_query.h * - * + * The ComplexQuery data type is either a conjunctive normal form or a disjunctive normal form. The attribute names \"cnfUnits\" and \"dnfUnits\" (see clause 5.2.4.11 and clause 5.2.4.12) serve as discriminator. */ #ifndef _OpenAPI_complex_query_H_ diff --git a/lib/sbi/openapi/model/condition_data.h b/lib/sbi/openapi/model/condition_data.h index 5127f724b..4c5b91dcb 100644 --- a/lib/sbi/openapi/model/condition_data.h +++ b/lib/sbi/openapi/model/condition_data.h @@ -1,7 +1,7 @@ /* * condition_data.h * - * + * Contains conditions of applicability for a rule. */ #ifndef _OpenAPI_condition_data_H_ diff --git a/lib/sbi/openapi/model/configured_snssai.h b/lib/sbi/openapi/model/configured_snssai.h index dc7bd93eb..c7d7d043b 100644 --- a/lib/sbi/openapi/model/configured_snssai.h +++ b/lib/sbi/openapi/model/configured_snssai.h @@ -1,7 +1,7 @@ /* * configured_snssai.h * - * + * Contains the configured S-NSSAI(s) authorized by the NSSF in the serving PLMN and optional mapped home S-NSSAI */ #ifndef _OpenAPI_configured_snssai_H_ diff --git a/lib/sbi/openapi/model/confirmation_data.h b/lib/sbi/openapi/model/confirmation_data.h index 0bb85a1da..461261690 100644 --- a/lib/sbi/openapi/model/confirmation_data.h +++ b/lib/sbi/openapi/model/confirmation_data.h @@ -1,7 +1,7 @@ /* * confirmation_data.h * - * + * Contains the result of the authentication. */ #ifndef _OpenAPI_confirmation_data_H_ diff --git a/lib/sbi/openapi/model/confirmation_data_response.c b/lib/sbi/openapi/model/confirmation_data_response.c index ed91f8304..16eeb27a7 100644 --- a/lib/sbi/openapi/model/confirmation_data_response.c +++ b/lib/sbi/openapi/model/confirmation_data_response.c @@ -7,7 +7,8 @@ OpenAPI_confirmation_data_response_t *OpenAPI_confirmation_data_response_create( OpenAPI_auth_result_e auth_result, char *supi, - char *kseaf + char *kseaf, + OpenAPI_list_t *pvs_info ) { OpenAPI_confirmation_data_response_t *confirmation_data_response_local_var = ogs_malloc(sizeof(OpenAPI_confirmation_data_response_t)); @@ -16,6 +17,7 @@ OpenAPI_confirmation_data_response_t *OpenAPI_confirmation_data_response_create( confirmation_data_response_local_var->auth_result = auth_result; confirmation_data_response_local_var->supi = supi; confirmation_data_response_local_var->kseaf = kseaf; + confirmation_data_response_local_var->pvs_info = pvs_info; return confirmation_data_response_local_var; } @@ -35,6 +37,13 @@ void OpenAPI_confirmation_data_response_free(OpenAPI_confirmation_data_response_ ogs_free(confirmation_data_response->kseaf); confirmation_data_response->kseaf = NULL; } + if (confirmation_data_response->pvs_info) { + OpenAPI_list_for_each(confirmation_data_response->pvs_info, node) { + OpenAPI_server_addressing_info_free(node->data); + } + OpenAPI_list_free(confirmation_data_response->pvs_info); + confirmation_data_response->pvs_info = NULL; + } ogs_free(confirmation_data_response); } @@ -72,6 +81,22 @@ cJSON *OpenAPI_confirmation_data_response_convertToJSON(OpenAPI_confirmation_dat } } + if (confirmation_data_response->pvs_info) { + cJSON *pvs_infoList = cJSON_AddArrayToObject(item, "pvsInfo"); + if (pvs_infoList == NULL) { + ogs_error("OpenAPI_confirmation_data_response_convertToJSON() failed [pvs_info]"); + goto end; + } + OpenAPI_list_for_each(confirmation_data_response->pvs_info, node) { + cJSON *itemLocal = OpenAPI_server_addressing_info_convertToJSON(node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_confirmation_data_response_convertToJSON() failed [pvs_info]"); + goto end; + } + cJSON_AddItemToArray(pvs_infoList, itemLocal); + } + } + end: return item; } @@ -84,6 +109,8 @@ OpenAPI_confirmation_data_response_t *OpenAPI_confirmation_data_response_parseFr OpenAPI_auth_result_e auth_resultVariable = 0; cJSON *supi = NULL; cJSON *kseaf = NULL; + cJSON *pvs_info = NULL; + OpenAPI_list_t *pvs_infoList = NULL; auth_result = cJSON_GetObjectItemCaseSensitive(confirmation_data_responseJSON, "authResult"); if (!auth_result) { ogs_error("OpenAPI_confirmation_data_response_parseFromJSON() failed [auth_result]"); @@ -111,14 +138,47 @@ OpenAPI_confirmation_data_response_t *OpenAPI_confirmation_data_response_parseFr } } + pvs_info = cJSON_GetObjectItemCaseSensitive(confirmation_data_responseJSON, "pvsInfo"); + if (pvs_info) { + cJSON *pvs_info_local = NULL; + if (!cJSON_IsArray(pvs_info)) { + ogs_error("OpenAPI_confirmation_data_response_parseFromJSON() failed [pvs_info]"); + goto end; + } + + pvs_infoList = OpenAPI_list_create(); + + cJSON_ArrayForEach(pvs_info_local, pvs_info) { + if (!cJSON_IsObject(pvs_info_local)) { + ogs_error("OpenAPI_confirmation_data_response_parseFromJSON() failed [pvs_info]"); + goto end; + } + OpenAPI_server_addressing_info_t *pvs_infoItem = OpenAPI_server_addressing_info_parseFromJSON(pvs_info_local); + if (!pvs_infoItem) { + ogs_error("No pvs_infoItem"); + OpenAPI_list_free(pvs_infoList); + goto end; + } + OpenAPI_list_add(pvs_infoList, pvs_infoItem); + } + } + confirmation_data_response_local_var = OpenAPI_confirmation_data_response_create ( auth_resultVariable, supi && !cJSON_IsNull(supi) ? ogs_strdup(supi->valuestring) : NULL, - kseaf && !cJSON_IsNull(kseaf) ? ogs_strdup(kseaf->valuestring) : NULL + kseaf && !cJSON_IsNull(kseaf) ? ogs_strdup(kseaf->valuestring) : NULL, + pvs_info ? pvs_infoList : NULL ); return confirmation_data_response_local_var; end: + if (pvs_infoList) { + OpenAPI_list_for_each(pvs_infoList, node) { + OpenAPI_server_addressing_info_free(node->data); + } + OpenAPI_list_free(pvs_infoList); + pvs_infoList = NULL; + } return NULL; } diff --git a/lib/sbi/openapi/model/confirmation_data_response.h b/lib/sbi/openapi/model/confirmation_data_response.h index 4753c15ab..04b5e2fcf 100644 --- a/lib/sbi/openapi/model/confirmation_data_response.h +++ b/lib/sbi/openapi/model/confirmation_data_response.h @@ -1,7 +1,7 @@ /* * confirmation_data_response.h * - * + * Contains the result of the authentication */ #ifndef _OpenAPI_confirmation_data_response_H_ @@ -13,6 +13,7 @@ #include "../include/keyValuePair.h" #include "../include/binary.h" #include "auth_result.h" +#include "server_addressing_info.h" #ifdef __cplusplus extern "C" { @@ -23,12 +24,14 @@ typedef struct OpenAPI_confirmation_data_response_s { OpenAPI_auth_result_e auth_result; char *supi; char *kseaf; + OpenAPI_list_t *pvs_info; } OpenAPI_confirmation_data_response_t; OpenAPI_confirmation_data_response_t *OpenAPI_confirmation_data_response_create( OpenAPI_auth_result_e auth_result, char *supi, - char *kseaf + char *kseaf, + OpenAPI_list_t *pvs_info ); void OpenAPI_confirmation_data_response_free(OpenAPI_confirmation_data_response_t *confirmation_data_response); OpenAPI_confirmation_data_response_t *OpenAPI_confirmation_data_response_parseFromJSON(cJSON *confirmation_data_responseJSON); diff --git a/lib/sbi/openapi/model/congestion_info.c b/lib/sbi/openapi/model/congestion_info.c new file mode 100644 index 000000000..b808ed987 --- /dev/null +++ b/lib/sbi/openapi/model/congestion_info.c @@ -0,0 +1,334 @@ + +#include +#include +#include +#include "congestion_info.h" + +OpenAPI_congestion_info_t *OpenAPI_congestion_info_create( + OpenAPI_congestion_type_t *cong_type, + OpenAPI_time_window_t *time_intev, + OpenAPI_threshold_level_t *nsi, + bool is_confidence, + int confidence, + OpenAPI_list_t *top_app_list_ul, + OpenAPI_list_t *top_app_list_dl +) +{ + OpenAPI_congestion_info_t *congestion_info_local_var = ogs_malloc(sizeof(OpenAPI_congestion_info_t)); + ogs_assert(congestion_info_local_var); + + congestion_info_local_var->cong_type = cong_type; + congestion_info_local_var->time_intev = time_intev; + congestion_info_local_var->nsi = nsi; + congestion_info_local_var->is_confidence = is_confidence; + congestion_info_local_var->confidence = confidence; + congestion_info_local_var->top_app_list_ul = top_app_list_ul; + congestion_info_local_var->top_app_list_dl = top_app_list_dl; + + return congestion_info_local_var; +} + +void OpenAPI_congestion_info_free(OpenAPI_congestion_info_t *congestion_info) +{ + OpenAPI_lnode_t *node = NULL; + + if (NULL == congestion_info) { + return; + } + if (congestion_info->cong_type) { + OpenAPI_congestion_type_free(congestion_info->cong_type); + congestion_info->cong_type = NULL; + } + if (congestion_info->time_intev) { + OpenAPI_time_window_free(congestion_info->time_intev); + congestion_info->time_intev = NULL; + } + if (congestion_info->nsi) { + OpenAPI_threshold_level_free(congestion_info->nsi); + congestion_info->nsi = NULL; + } + if (congestion_info->top_app_list_ul) { + OpenAPI_list_for_each(congestion_info->top_app_list_ul, node) { + OpenAPI_top_application_free(node->data); + } + OpenAPI_list_free(congestion_info->top_app_list_ul); + congestion_info->top_app_list_ul = NULL; + } + if (congestion_info->top_app_list_dl) { + OpenAPI_list_for_each(congestion_info->top_app_list_dl, node) { + OpenAPI_top_application_free(node->data); + } + OpenAPI_list_free(congestion_info->top_app_list_dl); + congestion_info->top_app_list_dl = NULL; + } + ogs_free(congestion_info); +} + +cJSON *OpenAPI_congestion_info_convertToJSON(OpenAPI_congestion_info_t *congestion_info) +{ + cJSON *item = NULL; + OpenAPI_lnode_t *node = NULL; + + if (congestion_info == NULL) { + ogs_error("OpenAPI_congestion_info_convertToJSON() failed [CongestionInfo]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (!congestion_info->cong_type) { + ogs_error("OpenAPI_congestion_info_convertToJSON() failed [cong_type]"); + return NULL; + } + cJSON *cong_type_local_JSON = OpenAPI_congestion_type_convertToJSON(congestion_info->cong_type); + if (cong_type_local_JSON == NULL) { + ogs_error("OpenAPI_congestion_info_convertToJSON() failed [cong_type]"); + goto end; + } + cJSON_AddItemToObject(item, "congType", cong_type_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_congestion_info_convertToJSON() failed [cong_type]"); + goto end; + } + + if (!congestion_info->time_intev) { + ogs_error("OpenAPI_congestion_info_convertToJSON() failed [time_intev]"); + return NULL; + } + cJSON *time_intev_local_JSON = OpenAPI_time_window_convertToJSON(congestion_info->time_intev); + if (time_intev_local_JSON == NULL) { + ogs_error("OpenAPI_congestion_info_convertToJSON() failed [time_intev]"); + goto end; + } + cJSON_AddItemToObject(item, "timeIntev", time_intev_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_congestion_info_convertToJSON() failed [time_intev]"); + goto end; + } + + if (!congestion_info->nsi) { + ogs_error("OpenAPI_congestion_info_convertToJSON() failed [nsi]"); + return NULL; + } + cJSON *nsi_local_JSON = OpenAPI_threshold_level_convertToJSON(congestion_info->nsi); + if (nsi_local_JSON == NULL) { + ogs_error("OpenAPI_congestion_info_convertToJSON() failed [nsi]"); + goto end; + } + cJSON_AddItemToObject(item, "nsi", nsi_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_congestion_info_convertToJSON() failed [nsi]"); + goto end; + } + + if (congestion_info->is_confidence) { + if (cJSON_AddNumberToObject(item, "confidence", congestion_info->confidence) == NULL) { + ogs_error("OpenAPI_congestion_info_convertToJSON() failed [confidence]"); + goto end; + } + } + + if (congestion_info->top_app_list_ul) { + cJSON *top_app_list_ulList = cJSON_AddArrayToObject(item, "topAppListUl"); + if (top_app_list_ulList == NULL) { + ogs_error("OpenAPI_congestion_info_convertToJSON() failed [top_app_list_ul]"); + goto end; + } + OpenAPI_list_for_each(congestion_info->top_app_list_ul, node) { + cJSON *itemLocal = OpenAPI_top_application_convertToJSON(node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_congestion_info_convertToJSON() failed [top_app_list_ul]"); + goto end; + } + cJSON_AddItemToArray(top_app_list_ulList, itemLocal); + } + } + + if (congestion_info->top_app_list_dl) { + cJSON *top_app_list_dlList = cJSON_AddArrayToObject(item, "topAppListDl"); + if (top_app_list_dlList == NULL) { + ogs_error("OpenAPI_congestion_info_convertToJSON() failed [top_app_list_dl]"); + goto end; + } + OpenAPI_list_for_each(congestion_info->top_app_list_dl, node) { + cJSON *itemLocal = OpenAPI_top_application_convertToJSON(node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_congestion_info_convertToJSON() failed [top_app_list_dl]"); + goto end; + } + cJSON_AddItemToArray(top_app_list_dlList, itemLocal); + } + } + +end: + return item; +} + +OpenAPI_congestion_info_t *OpenAPI_congestion_info_parseFromJSON(cJSON *congestion_infoJSON) +{ + OpenAPI_congestion_info_t *congestion_info_local_var = NULL; + OpenAPI_lnode_t *node = NULL; + cJSON *cong_type = NULL; + OpenAPI_congestion_type_t *cong_type_local_nonprim = NULL; + cJSON *time_intev = NULL; + OpenAPI_time_window_t *time_intev_local_nonprim = NULL; + cJSON *nsi = NULL; + OpenAPI_threshold_level_t *nsi_local_nonprim = NULL; + cJSON *confidence = NULL; + cJSON *top_app_list_ul = NULL; + OpenAPI_list_t *top_app_list_ulList = NULL; + cJSON *top_app_list_dl = NULL; + OpenAPI_list_t *top_app_list_dlList = NULL; + cong_type = cJSON_GetObjectItemCaseSensitive(congestion_infoJSON, "congType"); + if (!cong_type) { + ogs_error("OpenAPI_congestion_info_parseFromJSON() failed [cong_type]"); + goto end; + } + cong_type_local_nonprim = OpenAPI_congestion_type_parseFromJSON(cong_type); + + time_intev = cJSON_GetObjectItemCaseSensitive(congestion_infoJSON, "timeIntev"); + if (!time_intev) { + ogs_error("OpenAPI_congestion_info_parseFromJSON() failed [time_intev]"); + goto end; + } + time_intev_local_nonprim = OpenAPI_time_window_parseFromJSON(time_intev); + + nsi = cJSON_GetObjectItemCaseSensitive(congestion_infoJSON, "nsi"); + if (!nsi) { + ogs_error("OpenAPI_congestion_info_parseFromJSON() failed [nsi]"); + goto end; + } + nsi_local_nonprim = OpenAPI_threshold_level_parseFromJSON(nsi); + + confidence = cJSON_GetObjectItemCaseSensitive(congestion_infoJSON, "confidence"); + if (confidence) { + if (!cJSON_IsNumber(confidence)) { + ogs_error("OpenAPI_congestion_info_parseFromJSON() failed [confidence]"); + goto end; + } + } + + top_app_list_ul = cJSON_GetObjectItemCaseSensitive(congestion_infoJSON, "topAppListUl"); + if (top_app_list_ul) { + cJSON *top_app_list_ul_local = NULL; + if (!cJSON_IsArray(top_app_list_ul)) { + ogs_error("OpenAPI_congestion_info_parseFromJSON() failed [top_app_list_ul]"); + goto end; + } + + top_app_list_ulList = OpenAPI_list_create(); + + cJSON_ArrayForEach(top_app_list_ul_local, top_app_list_ul) { + if (!cJSON_IsObject(top_app_list_ul_local)) { + ogs_error("OpenAPI_congestion_info_parseFromJSON() failed [top_app_list_ul]"); + goto end; + } + OpenAPI_top_application_t *top_app_list_ulItem = OpenAPI_top_application_parseFromJSON(top_app_list_ul_local); + if (!top_app_list_ulItem) { + ogs_error("No top_app_list_ulItem"); + OpenAPI_list_free(top_app_list_ulList); + goto end; + } + OpenAPI_list_add(top_app_list_ulList, top_app_list_ulItem); + } + } + + top_app_list_dl = cJSON_GetObjectItemCaseSensitive(congestion_infoJSON, "topAppListDl"); + if (top_app_list_dl) { + cJSON *top_app_list_dl_local = NULL; + if (!cJSON_IsArray(top_app_list_dl)) { + ogs_error("OpenAPI_congestion_info_parseFromJSON() failed [top_app_list_dl]"); + goto end; + } + + top_app_list_dlList = OpenAPI_list_create(); + + cJSON_ArrayForEach(top_app_list_dl_local, top_app_list_dl) { + if (!cJSON_IsObject(top_app_list_dl_local)) { + ogs_error("OpenAPI_congestion_info_parseFromJSON() failed [top_app_list_dl]"); + goto end; + } + OpenAPI_top_application_t *top_app_list_dlItem = OpenAPI_top_application_parseFromJSON(top_app_list_dl_local); + if (!top_app_list_dlItem) { + ogs_error("No top_app_list_dlItem"); + OpenAPI_list_free(top_app_list_dlList); + goto end; + } + OpenAPI_list_add(top_app_list_dlList, top_app_list_dlItem); + } + } + + congestion_info_local_var = OpenAPI_congestion_info_create ( + cong_type_local_nonprim, + time_intev_local_nonprim, + nsi_local_nonprim, + confidence ? true : false, + confidence ? confidence->valuedouble : 0, + top_app_list_ul ? top_app_list_ulList : NULL, + top_app_list_dl ? top_app_list_dlList : NULL + ); + + return congestion_info_local_var; +end: + if (cong_type_local_nonprim) { + OpenAPI_congestion_type_free(cong_type_local_nonprim); + cong_type_local_nonprim = NULL; + } + if (time_intev_local_nonprim) { + OpenAPI_time_window_free(time_intev_local_nonprim); + time_intev_local_nonprim = NULL; + } + if (nsi_local_nonprim) { + OpenAPI_threshold_level_free(nsi_local_nonprim); + nsi_local_nonprim = NULL; + } + if (top_app_list_ulList) { + OpenAPI_list_for_each(top_app_list_ulList, node) { + OpenAPI_top_application_free(node->data); + } + OpenAPI_list_free(top_app_list_ulList); + top_app_list_ulList = NULL; + } + if (top_app_list_dlList) { + OpenAPI_list_for_each(top_app_list_dlList, node) { + OpenAPI_top_application_free(node->data); + } + OpenAPI_list_free(top_app_list_dlList); + top_app_list_dlList = NULL; + } + return NULL; +} + +OpenAPI_congestion_info_t *OpenAPI_congestion_info_copy(OpenAPI_congestion_info_t *dst, OpenAPI_congestion_info_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_congestion_info_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_congestion_info_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_congestion_info_free(dst); + dst = OpenAPI_congestion_info_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/congestion_info.h b/lib/sbi/openapi/model/congestion_info.h new file mode 100644 index 000000000..9b3ddea5c --- /dev/null +++ b/lib/sbi/openapi/model/congestion_info.h @@ -0,0 +1,54 @@ +/* + * congestion_info.h + * + * Represents the congestion information. + */ + +#ifndef _OpenAPI_congestion_info_H_ +#define _OpenAPI_congestion_info_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "congestion_type.h" +#include "threshold_level.h" +#include "time_window.h" +#include "top_application.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_congestion_info_s OpenAPI_congestion_info_t; +typedef struct OpenAPI_congestion_info_s { + struct OpenAPI_congestion_type_s *cong_type; + struct OpenAPI_time_window_s *time_intev; + struct OpenAPI_threshold_level_s *nsi; + bool is_confidence; + int confidence; + OpenAPI_list_t *top_app_list_ul; + OpenAPI_list_t *top_app_list_dl; +} OpenAPI_congestion_info_t; + +OpenAPI_congestion_info_t *OpenAPI_congestion_info_create( + OpenAPI_congestion_type_t *cong_type, + OpenAPI_time_window_t *time_intev, + OpenAPI_threshold_level_t *nsi, + bool is_confidence, + int confidence, + OpenAPI_list_t *top_app_list_ul, + OpenAPI_list_t *top_app_list_dl +); +void OpenAPI_congestion_info_free(OpenAPI_congestion_info_t *congestion_info); +OpenAPI_congestion_info_t *OpenAPI_congestion_info_parseFromJSON(cJSON *congestion_infoJSON); +cJSON *OpenAPI_congestion_info_convertToJSON(OpenAPI_congestion_info_t *congestion_info); +OpenAPI_congestion_info_t *OpenAPI_congestion_info_copy(OpenAPI_congestion_info_t *dst, OpenAPI_congestion_info_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_congestion_info_H_ */ + diff --git a/lib/sbi/openapi/model/congestion_type.c b/lib/sbi/openapi/model/congestion_type.c new file mode 100644 index 000000000..e542cd1c7 --- /dev/null +++ b/lib/sbi/openapi/model/congestion_type.c @@ -0,0 +1,87 @@ + +#include +#include +#include +#include "congestion_type.h" + +OpenAPI_congestion_type_t *OpenAPI_congestion_type_create( +) +{ + OpenAPI_congestion_type_t *congestion_type_local_var = ogs_malloc(sizeof(OpenAPI_congestion_type_t)); + ogs_assert(congestion_type_local_var); + + + return congestion_type_local_var; +} + +void OpenAPI_congestion_type_free(OpenAPI_congestion_type_t *congestion_type) +{ + OpenAPI_lnode_t *node = NULL; + + if (NULL == congestion_type) { + return; + } + ogs_free(congestion_type); +} + +cJSON *OpenAPI_congestion_type_convertToJSON(OpenAPI_congestion_type_t *congestion_type) +{ + cJSON *item = NULL; + OpenAPI_lnode_t *node = NULL; + + if (congestion_type == NULL) { + ogs_error("OpenAPI_congestion_type_convertToJSON() failed [CongestionType]"); + return NULL; + } + + item = cJSON_CreateObject(); +end: + return item; +} + +OpenAPI_congestion_type_t *OpenAPI_congestion_type_parseFromJSON(cJSON *congestion_typeJSON) +{ + OpenAPI_congestion_type_t *congestion_type_local_var = NULL; + OpenAPI_lnode_t *node = NULL; + congestion_type_local_var = OpenAPI_congestion_type_create ( + ); + + return congestion_type_local_var; +end: + return NULL; +} + +OpenAPI_congestion_type_t *OpenAPI_congestion_type_copy(OpenAPI_congestion_type_t *dst, OpenAPI_congestion_type_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_congestion_type_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_congestion_type_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_congestion_type_free(dst); + dst = OpenAPI_congestion_type_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/congestion_type.h b/lib/sbi/openapi/model/congestion_type.h new file mode 100644 index 000000000..2b7c8caf8 --- /dev/null +++ b/lib/sbi/openapi/model/congestion_type.h @@ -0,0 +1,37 @@ +/* + * congestion_type.h + * + * Possible values are: - USER_PLANE: The congestion analytics type is User Plane. - CONTROL_PLANE: The congestion analytics type is Control Plane. - USER_AND_CONTROL_PLANE: The congestion analytics type is User Plane and Control Plane. + */ + +#ifndef _OpenAPI_congestion_type_H_ +#define _OpenAPI_congestion_type_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "congestion_type_any_of.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_congestion_type_s OpenAPI_congestion_type_t; +typedef struct OpenAPI_congestion_type_s { +} OpenAPI_congestion_type_t; + +OpenAPI_congestion_type_t *OpenAPI_congestion_type_create( +); +void OpenAPI_congestion_type_free(OpenAPI_congestion_type_t *congestion_type); +OpenAPI_congestion_type_t *OpenAPI_congestion_type_parseFromJSON(cJSON *congestion_typeJSON); +cJSON *OpenAPI_congestion_type_convertToJSON(OpenAPI_congestion_type_t *congestion_type); +OpenAPI_congestion_type_t *OpenAPI_congestion_type_copy(OpenAPI_congestion_type_t *dst, OpenAPI_congestion_type_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_congestion_type_H_ */ + diff --git a/lib/sbi/openapi/model/congestion_type_any_of.c b/lib/sbi/openapi/model/congestion_type_any_of.c new file mode 100644 index 000000000..785c3fb65 --- /dev/null +++ b/lib/sbi/openapi/model/congestion_type_any_of.c @@ -0,0 +1,30 @@ + +#include +#include +#include +#include "congestion_type_any_of.h" + +char* OpenAPI_congestion_type_any_of_ToString(OpenAPI_congestion_type_any_of_e congestion_type_any_of) +{ + const char *congestion_type_any_ofArray[] = { "NULL", "USER_PLANE", "CONTROL_PLANE", "USER_AND_CONTROL_PLANE" }; + size_t sizeofArray = sizeof(congestion_type_any_ofArray) / sizeof(congestion_type_any_ofArray[0]); + if (congestion_type_any_of < sizeofArray) + return (char *)congestion_type_any_ofArray[congestion_type_any_of]; + else + return (char *)"Unknown"; +} + +OpenAPI_congestion_type_any_of_e OpenAPI_congestion_type_any_of_FromString(char* congestion_type_any_of) +{ + int stringToReturn = 0; + const char *congestion_type_any_ofArray[] = { "NULL", "USER_PLANE", "CONTROL_PLANE", "USER_AND_CONTROL_PLANE" }; + size_t sizeofArray = sizeof(congestion_type_any_ofArray) / sizeof(congestion_type_any_ofArray[0]); + while (stringToReturn < sizeofArray) { + if (strcmp(congestion_type_any_of, congestion_type_any_ofArray[stringToReturn]) == 0) { + return stringToReturn; + } + stringToReturn++; + } + return 0; +} + diff --git a/lib/sbi/openapi/model/congestion_type_any_of.h b/lib/sbi/openapi/model/congestion_type_any_of.h new file mode 100644 index 000000000..88c182e3d --- /dev/null +++ b/lib/sbi/openapi/model/congestion_type_any_of.h @@ -0,0 +1,31 @@ +/* + * congestion_type_any_of.h + * + * + */ + +#ifndef _OpenAPI_congestion_type_any_of_H_ +#define _OpenAPI_congestion_type_any_of_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef enum { OpenAPI_congestion_type_any_of_NULL = 0, OpenAPI_congestion_type_any_of_USER_PLANE, OpenAPI_congestion_type_any_of_CONTROL_PLANE, OpenAPI_congestion_type_any_of_USER_AND_CONTROL_PLANE } OpenAPI_congestion_type_any_of_e; + +char* OpenAPI_congestion_type_any_of_ToString(OpenAPI_congestion_type_any_of_e congestion_type_any_of); + +OpenAPI_congestion_type_any_of_e OpenAPI_congestion_type_any_of_FromString(char* congestion_type_any_of); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_congestion_type_any_of_H_ */ + diff --git a/lib/sbi/openapi/model/connection_capabilities.c b/lib/sbi/openapi/model/connection_capabilities.c new file mode 100644 index 000000000..0551da941 --- /dev/null +++ b/lib/sbi/openapi/model/connection_capabilities.c @@ -0,0 +1,87 @@ + +#include +#include +#include +#include "connection_capabilities.h" + +OpenAPI_connection_capabilities_t *OpenAPI_connection_capabilities_create( +) +{ + OpenAPI_connection_capabilities_t *connection_capabilities_local_var = ogs_malloc(sizeof(OpenAPI_connection_capabilities_t)); + ogs_assert(connection_capabilities_local_var); + + + return connection_capabilities_local_var; +} + +void OpenAPI_connection_capabilities_free(OpenAPI_connection_capabilities_t *connection_capabilities) +{ + OpenAPI_lnode_t *node = NULL; + + if (NULL == connection_capabilities) { + return; + } + ogs_free(connection_capabilities); +} + +cJSON *OpenAPI_connection_capabilities_convertToJSON(OpenAPI_connection_capabilities_t *connection_capabilities) +{ + cJSON *item = NULL; + OpenAPI_lnode_t *node = NULL; + + if (connection_capabilities == NULL) { + ogs_error("OpenAPI_connection_capabilities_convertToJSON() failed [ConnectionCapabilities]"); + return NULL; + } + + item = cJSON_CreateObject(); +end: + return item; +} + +OpenAPI_connection_capabilities_t *OpenAPI_connection_capabilities_parseFromJSON(cJSON *connection_capabilitiesJSON) +{ + OpenAPI_connection_capabilities_t *connection_capabilities_local_var = NULL; + OpenAPI_lnode_t *node = NULL; + connection_capabilities_local_var = OpenAPI_connection_capabilities_create ( + ); + + return connection_capabilities_local_var; +end: + return NULL; +} + +OpenAPI_connection_capabilities_t *OpenAPI_connection_capabilities_copy(OpenAPI_connection_capabilities_t *dst, OpenAPI_connection_capabilities_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_connection_capabilities_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_connection_capabilities_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_connection_capabilities_free(dst); + dst = OpenAPI_connection_capabilities_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/connection_capabilities.h b/lib/sbi/openapi/model/connection_capabilities.h new file mode 100644 index 000000000..17be99c9d --- /dev/null +++ b/lib/sbi/openapi/model/connection_capabilities.h @@ -0,0 +1,37 @@ +/* + * connection_capabilities.h + * + * Possible values are - IMS: Indicates the connection capability to support IMS service. - MMS: Indicates the connection capability to support MMS service. - SUPL: Indicates the connection capability to support SUPL service. - INTERNET: Indicates the connection capability to support Internet service. + */ + +#ifndef _OpenAPI_connection_capabilities_H_ +#define _OpenAPI_connection_capabilities_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "connection_capabilities_any_of.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_connection_capabilities_s OpenAPI_connection_capabilities_t; +typedef struct OpenAPI_connection_capabilities_s { +} OpenAPI_connection_capabilities_t; + +OpenAPI_connection_capabilities_t *OpenAPI_connection_capabilities_create( +); +void OpenAPI_connection_capabilities_free(OpenAPI_connection_capabilities_t *connection_capabilities); +OpenAPI_connection_capabilities_t *OpenAPI_connection_capabilities_parseFromJSON(cJSON *connection_capabilitiesJSON); +cJSON *OpenAPI_connection_capabilities_convertToJSON(OpenAPI_connection_capabilities_t *connection_capabilities); +OpenAPI_connection_capabilities_t *OpenAPI_connection_capabilities_copy(OpenAPI_connection_capabilities_t *dst, OpenAPI_connection_capabilities_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_connection_capabilities_H_ */ + diff --git a/lib/sbi/openapi/model/connection_capabilities_any_of.c b/lib/sbi/openapi/model/connection_capabilities_any_of.c new file mode 100644 index 000000000..560dca0dc --- /dev/null +++ b/lib/sbi/openapi/model/connection_capabilities_any_of.c @@ -0,0 +1,30 @@ + +#include +#include +#include +#include "connection_capabilities_any_of.h" + +char* OpenAPI_connection_capabilities_any_of_ToString(OpenAPI_connection_capabilities_any_of_e connection_capabilities_any_of) +{ + const char *connection_capabilities_any_ofArray[] = { "NULL", "IMS", "MMS", "SUPL", "INTERNET" }; + size_t sizeofArray = sizeof(connection_capabilities_any_ofArray) / sizeof(connection_capabilities_any_ofArray[0]); + if (connection_capabilities_any_of < sizeofArray) + return (char *)connection_capabilities_any_ofArray[connection_capabilities_any_of]; + else + return (char *)"Unknown"; +} + +OpenAPI_connection_capabilities_any_of_e OpenAPI_connection_capabilities_any_of_FromString(char* connection_capabilities_any_of) +{ + int stringToReturn = 0; + const char *connection_capabilities_any_ofArray[] = { "NULL", "IMS", "MMS", "SUPL", "INTERNET" }; + size_t sizeofArray = sizeof(connection_capabilities_any_ofArray) / sizeof(connection_capabilities_any_ofArray[0]); + while (stringToReturn < sizeofArray) { + if (strcmp(connection_capabilities_any_of, connection_capabilities_any_ofArray[stringToReturn]) == 0) { + return stringToReturn; + } + stringToReturn++; + } + return 0; +} + diff --git a/lib/sbi/openapi/model/connection_capabilities_any_of.h b/lib/sbi/openapi/model/connection_capabilities_any_of.h new file mode 100644 index 000000000..a51f9f2d7 --- /dev/null +++ b/lib/sbi/openapi/model/connection_capabilities_any_of.h @@ -0,0 +1,31 @@ +/* + * connection_capabilities_any_of.h + * + * + */ + +#ifndef _OpenAPI_connection_capabilities_any_of_H_ +#define _OpenAPI_connection_capabilities_any_of_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef enum { OpenAPI_connection_capabilities_any_of_NULL = 0, OpenAPI_connection_capabilities_any_of_IMS, OpenAPI_connection_capabilities_any_of_MMS, OpenAPI_connection_capabilities_any_of_SUPL, OpenAPI_connection_capabilities_any_of_INTERNET } OpenAPI_connection_capabilities_any_of_e; + +char* OpenAPI_connection_capabilities_any_of_ToString(OpenAPI_connection_capabilities_any_of_e connection_capabilities_any_of); + +OpenAPI_connection_capabilities_any_of_e OpenAPI_connection_capabilities_any_of_FromString(char* connection_capabilities_any_of); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_connection_capabilities_any_of_H_ */ + diff --git a/lib/sbi/openapi/model/consumer_nf_information.c b/lib/sbi/openapi/model/consumer_nf_information.c new file mode 100644 index 000000000..9abbe50b6 --- /dev/null +++ b/lib/sbi/openapi/model/consumer_nf_information.c @@ -0,0 +1,193 @@ + +#include +#include +#include +#include "consumer_nf_information.h" + +OpenAPI_consumer_nf_information_t *OpenAPI_consumer_nf_information_create( + char *nf_id, + char *nf_set_id, + OpenAPI_list_t *tai_list +) +{ + OpenAPI_consumer_nf_information_t *consumer_nf_information_local_var = ogs_malloc(sizeof(OpenAPI_consumer_nf_information_t)); + ogs_assert(consumer_nf_information_local_var); + + consumer_nf_information_local_var->nf_id = nf_id; + consumer_nf_information_local_var->nf_set_id = nf_set_id; + consumer_nf_information_local_var->tai_list = tai_list; + + return consumer_nf_information_local_var; +} + +void OpenAPI_consumer_nf_information_free(OpenAPI_consumer_nf_information_t *consumer_nf_information) +{ + OpenAPI_lnode_t *node = NULL; + + if (NULL == consumer_nf_information) { + return; + } + if (consumer_nf_information->nf_id) { + ogs_free(consumer_nf_information->nf_id); + consumer_nf_information->nf_id = NULL; + } + if (consumer_nf_information->nf_set_id) { + ogs_free(consumer_nf_information->nf_set_id); + consumer_nf_information->nf_set_id = NULL; + } + if (consumer_nf_information->tai_list) { + OpenAPI_list_for_each(consumer_nf_information->tai_list, node) { + OpenAPI_tai_free(node->data); + } + OpenAPI_list_free(consumer_nf_information->tai_list); + consumer_nf_information->tai_list = NULL; + } + ogs_free(consumer_nf_information); +} + +cJSON *OpenAPI_consumer_nf_information_convertToJSON(OpenAPI_consumer_nf_information_t *consumer_nf_information) +{ + cJSON *item = NULL; + OpenAPI_lnode_t *node = NULL; + + if (consumer_nf_information == NULL) { + ogs_error("OpenAPI_consumer_nf_information_convertToJSON() failed [ConsumerNfInformation]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (consumer_nf_information->nf_id) { + if (cJSON_AddStringToObject(item, "nfId", consumer_nf_information->nf_id) == NULL) { + ogs_error("OpenAPI_consumer_nf_information_convertToJSON() failed [nf_id]"); + goto end; + } + } + + if (consumer_nf_information->nf_set_id) { + if (cJSON_AddStringToObject(item, "nfSetId", consumer_nf_information->nf_set_id) == NULL) { + ogs_error("OpenAPI_consumer_nf_information_convertToJSON() failed [nf_set_id]"); + goto end; + } + } + + if (consumer_nf_information->tai_list) { + cJSON *tai_listList = cJSON_AddArrayToObject(item, "taiList"); + if (tai_listList == NULL) { + ogs_error("OpenAPI_consumer_nf_information_convertToJSON() failed [tai_list]"); + goto end; + } + OpenAPI_list_for_each(consumer_nf_information->tai_list, node) { + cJSON *itemLocal = OpenAPI_tai_convertToJSON(node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_consumer_nf_information_convertToJSON() failed [tai_list]"); + goto end; + } + cJSON_AddItemToArray(tai_listList, itemLocal); + } + } + +end: + return item; +} + +OpenAPI_consumer_nf_information_t *OpenAPI_consumer_nf_information_parseFromJSON(cJSON *consumer_nf_informationJSON) +{ + OpenAPI_consumer_nf_information_t *consumer_nf_information_local_var = NULL; + OpenAPI_lnode_t *node = NULL; + cJSON *nf_id = NULL; + cJSON *nf_set_id = NULL; + cJSON *tai_list = NULL; + OpenAPI_list_t *tai_listList = NULL; + nf_id = cJSON_GetObjectItemCaseSensitive(consumer_nf_informationJSON, "nfId"); + if (nf_id) { + if (!cJSON_IsString(nf_id) && !cJSON_IsNull(nf_id)) { + ogs_error("OpenAPI_consumer_nf_information_parseFromJSON() failed [nf_id]"); + goto end; + } + } + + nf_set_id = cJSON_GetObjectItemCaseSensitive(consumer_nf_informationJSON, "nfSetId"); + if (nf_set_id) { + if (!cJSON_IsString(nf_set_id) && !cJSON_IsNull(nf_set_id)) { + ogs_error("OpenAPI_consumer_nf_information_parseFromJSON() failed [nf_set_id]"); + goto end; + } + } + + tai_list = cJSON_GetObjectItemCaseSensitive(consumer_nf_informationJSON, "taiList"); + if (tai_list) { + cJSON *tai_list_local = NULL; + if (!cJSON_IsArray(tai_list)) { + ogs_error("OpenAPI_consumer_nf_information_parseFromJSON() failed [tai_list]"); + goto end; + } + + tai_listList = OpenAPI_list_create(); + + cJSON_ArrayForEach(tai_list_local, tai_list) { + if (!cJSON_IsObject(tai_list_local)) { + ogs_error("OpenAPI_consumer_nf_information_parseFromJSON() failed [tai_list]"); + goto end; + } + OpenAPI_tai_t *tai_listItem = OpenAPI_tai_parseFromJSON(tai_list_local); + if (!tai_listItem) { + ogs_error("No tai_listItem"); + OpenAPI_list_free(tai_listList); + goto end; + } + OpenAPI_list_add(tai_listList, tai_listItem); + } + } + + consumer_nf_information_local_var = OpenAPI_consumer_nf_information_create ( + nf_id && !cJSON_IsNull(nf_id) ? ogs_strdup(nf_id->valuestring) : NULL, + nf_set_id && !cJSON_IsNull(nf_set_id) ? ogs_strdup(nf_set_id->valuestring) : NULL, + tai_list ? tai_listList : NULL + ); + + return consumer_nf_information_local_var; +end: + if (tai_listList) { + OpenAPI_list_for_each(tai_listList, node) { + OpenAPI_tai_free(node->data); + } + OpenAPI_list_free(tai_listList); + tai_listList = NULL; + } + return NULL; +} + +OpenAPI_consumer_nf_information_t *OpenAPI_consumer_nf_information_copy(OpenAPI_consumer_nf_information_t *dst, OpenAPI_consumer_nf_information_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_consumer_nf_information_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_consumer_nf_information_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_consumer_nf_information_free(dst); + dst = OpenAPI_consumer_nf_information_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/consumer_nf_information.h b/lib/sbi/openapi/model/consumer_nf_information.h new file mode 100644 index 000000000..136b98108 --- /dev/null +++ b/lib/sbi/openapi/model/consumer_nf_information.h @@ -0,0 +1,43 @@ +/* + * consumer_nf_information.h + * + * Represents the analytics consumer NF Information. + */ + +#ifndef _OpenAPI_consumer_nf_information_H_ +#define _OpenAPI_consumer_nf_information_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "tai.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_consumer_nf_information_s OpenAPI_consumer_nf_information_t; +typedef struct OpenAPI_consumer_nf_information_s { + char *nf_id; + char *nf_set_id; + OpenAPI_list_t *tai_list; +} OpenAPI_consumer_nf_information_t; + +OpenAPI_consumer_nf_information_t *OpenAPI_consumer_nf_information_create( + char *nf_id, + char *nf_set_id, + OpenAPI_list_t *tai_list +); +void OpenAPI_consumer_nf_information_free(OpenAPI_consumer_nf_information_t *consumer_nf_information); +OpenAPI_consumer_nf_information_t *OpenAPI_consumer_nf_information_parseFromJSON(cJSON *consumer_nf_informationJSON); +cJSON *OpenAPI_consumer_nf_information_convertToJSON(OpenAPI_consumer_nf_information_t *consumer_nf_information); +OpenAPI_consumer_nf_information_t *OpenAPI_consumer_nf_information_copy(OpenAPI_consumer_nf_information_t *dst, OpenAPI_consumer_nf_information_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_consumer_nf_information_H_ */ + diff --git a/lib/sbi/openapi/model/context_data_set_name.c b/lib/sbi/openapi/model/context_data_set_name.c index 203138fd9..c520b509b 100644 --- a/lib/sbi/openapi/model/context_data_set_name.c +++ b/lib/sbi/openapi/model/context_data_set_name.c @@ -6,7 +6,7 @@ char* OpenAPI_context_data_set_name_ToString(OpenAPI_context_data_set_name_e context_data_set_name) { - const char *context_data_set_nameArray[] = { "NULL", "AMF_3GPP", "AMF_NON_3GPP", "SDM_SUBSCRIPTIONS", "EE_SUBSCRIPTIONS", "SMSF_3GPP", "SMSF_NON_3GPP", "SUBS_TO_NOTIFY", "SMF_REG", "IP_SM_GW" }; + const char *context_data_set_nameArray[] = { "NULL", "AMF_3GPP", "AMF_NON_3GPP", "SDM_SUBSCRIPTIONS", "EE_SUBSCRIPTIONS", "SMSF_3GPP", "SMSF_NON_3GPP", "SUBS_TO_NOTIFY", "SMF_REG", "IP_SM_GW", "ROAMING_INFO", "PEI_INFO" }; size_t sizeofArray = sizeof(context_data_set_nameArray) / sizeof(context_data_set_nameArray[0]); if (context_data_set_name < sizeofArray) return (char *)context_data_set_nameArray[context_data_set_name]; @@ -17,7 +17,7 @@ char* OpenAPI_context_data_set_name_ToString(OpenAPI_context_data_set_name_e con OpenAPI_context_data_set_name_e OpenAPI_context_data_set_name_FromString(char* context_data_set_name) { int stringToReturn = 0; - const char *context_data_set_nameArray[] = { "NULL", "AMF_3GPP", "AMF_NON_3GPP", "SDM_SUBSCRIPTIONS", "EE_SUBSCRIPTIONS", "SMSF_3GPP", "SMSF_NON_3GPP", "SUBS_TO_NOTIFY", "SMF_REG", "IP_SM_GW" }; + const char *context_data_set_nameArray[] = { "NULL", "AMF_3GPP", "AMF_NON_3GPP", "SDM_SUBSCRIPTIONS", "EE_SUBSCRIPTIONS", "SMSF_3GPP", "SMSF_NON_3GPP", "SUBS_TO_NOTIFY", "SMF_REG", "IP_SM_GW", "ROAMING_INFO", "PEI_INFO" }; size_t sizeofArray = sizeof(context_data_set_nameArray) / sizeof(context_data_set_nameArray[0]); while (stringToReturn < sizeofArray) { if (strcmp(context_data_set_name, context_data_set_nameArray[stringToReturn]) == 0) { diff --git a/lib/sbi/openapi/model/context_data_set_name.h b/lib/sbi/openapi/model/context_data_set_name.h index cd85ee93e..0954686a0 100644 --- a/lib/sbi/openapi/model/context_data_set_name.h +++ b/lib/sbi/openapi/model/context_data_set_name.h @@ -17,7 +17,7 @@ extern "C" { #endif -typedef enum { OpenAPI_context_data_set_name_NULL = 0, OpenAPI_context_data_set_name_AMF_3GPP, OpenAPI_context_data_set_name_AMF_NON_3GPP, OpenAPI_context_data_set_name_SDM_SUBSCRIPTIONS, OpenAPI_context_data_set_name_EE_SUBSCRIPTIONS, OpenAPI_context_data_set_name_SMSF_3GPP, OpenAPI_context_data_set_name_SMSF_NON_3GPP, OpenAPI_context_data_set_name_SUBS_TO_NOTIFY, OpenAPI_context_data_set_name_SMF_REG, OpenAPI_context_data_set_name_IP_SM_GW } OpenAPI_context_data_set_name_e; +typedef enum { OpenAPI_context_data_set_name_NULL = 0, OpenAPI_context_data_set_name_AMF_3GPP, OpenAPI_context_data_set_name_AMF_NON_3GPP, OpenAPI_context_data_set_name_SDM_SUBSCRIPTIONS, OpenAPI_context_data_set_name_EE_SUBSCRIPTIONS, OpenAPI_context_data_set_name_SMSF_3GPP, OpenAPI_context_data_set_name_SMSF_NON_3GPP, OpenAPI_context_data_set_name_SUBS_TO_NOTIFY, OpenAPI_context_data_set_name_SMF_REG, OpenAPI_context_data_set_name_IP_SM_GW, OpenAPI_context_data_set_name_ROAMING_INFO, OpenAPI_context_data_set_name_PEI_INFO } OpenAPI_context_data_set_name_e; char* OpenAPI_context_data_set_name_ToString(OpenAPI_context_data_set_name_e context_data_set_name); diff --git a/lib/sbi/openapi/model/context_data_sets.c b/lib/sbi/openapi/model/context_data_sets.c index 9774ea31a..6b2c19691 100644 --- a/lib/sbi/openapi/model/context_data_sets.c +++ b/lib/sbi/openapi/model/context_data_sets.c @@ -13,7 +13,9 @@ OpenAPI_context_data_sets_t *OpenAPI_context_data_sets_create( OpenAPI_smsf_registration_t *smsf_non3_gpp_access, OpenAPI_list_t *subscription_data_subscriptions, OpenAPI_list_t *smf_registrations, - OpenAPI_ip_sm_gw_registration_t *ip_sm_gw + OpenAPI_ip_sm_gw_registration_t *ip_sm_gw, + OpenAPI_roaming_info_update_t *roaming_info, + OpenAPI_pei_update_info_t *pei_info ) { OpenAPI_context_data_sets_t *context_data_sets_local_var = ogs_malloc(sizeof(OpenAPI_context_data_sets_t)); @@ -28,6 +30,8 @@ OpenAPI_context_data_sets_t *OpenAPI_context_data_sets_create( context_data_sets_local_var->subscription_data_subscriptions = subscription_data_subscriptions; context_data_sets_local_var->smf_registrations = smf_registrations; context_data_sets_local_var->ip_sm_gw = ip_sm_gw; + context_data_sets_local_var->roaming_info = roaming_info; + context_data_sets_local_var->pei_info = pei_info; return context_data_sets_local_var; } @@ -87,6 +91,14 @@ void OpenAPI_context_data_sets_free(OpenAPI_context_data_sets_t *context_data_se OpenAPI_ip_sm_gw_registration_free(context_data_sets->ip_sm_gw); context_data_sets->ip_sm_gw = NULL; } + if (context_data_sets->roaming_info) { + OpenAPI_roaming_info_update_free(context_data_sets->roaming_info); + context_data_sets->roaming_info = NULL; + } + if (context_data_sets->pei_info) { + OpenAPI_pei_update_info_free(context_data_sets->pei_info); + context_data_sets->pei_info = NULL; + } ogs_free(context_data_sets); } @@ -230,6 +242,32 @@ cJSON *OpenAPI_context_data_sets_convertToJSON(OpenAPI_context_data_sets_t *cont } } + if (context_data_sets->roaming_info) { + cJSON *roaming_info_local_JSON = OpenAPI_roaming_info_update_convertToJSON(context_data_sets->roaming_info); + if (roaming_info_local_JSON == NULL) { + ogs_error("OpenAPI_context_data_sets_convertToJSON() failed [roaming_info]"); + goto end; + } + cJSON_AddItemToObject(item, "roamingInfo", roaming_info_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_context_data_sets_convertToJSON() failed [roaming_info]"); + goto end; + } + } + + if (context_data_sets->pei_info) { + cJSON *pei_info_local_JSON = OpenAPI_pei_update_info_convertToJSON(context_data_sets->pei_info); + if (pei_info_local_JSON == NULL) { + ogs_error("OpenAPI_context_data_sets_convertToJSON() failed [pei_info]"); + goto end; + } + cJSON_AddItemToObject(item, "peiInfo", pei_info_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_context_data_sets_convertToJSON() failed [pei_info]"); + goto end; + } + } + end: return item; } @@ -256,6 +294,10 @@ OpenAPI_context_data_sets_t *OpenAPI_context_data_sets_parseFromJSON(cJSON *cont OpenAPI_list_t *smf_registrationsList = NULL; cJSON *ip_sm_gw = NULL; OpenAPI_ip_sm_gw_registration_t *ip_sm_gw_local_nonprim = NULL; + cJSON *roaming_info = NULL; + OpenAPI_roaming_info_update_t *roaming_info_local_nonprim = NULL; + cJSON *pei_info = NULL; + OpenAPI_pei_update_info_t *pei_info_local_nonprim = NULL; amf3_gpp = cJSON_GetObjectItemCaseSensitive(context_data_setsJSON, "amf3Gpp"); if (amf3_gpp) { amf3_gpp_local_nonprim = OpenAPI_amf3_gpp_access_registration_parseFromJSON(amf3_gpp); @@ -381,6 +423,16 @@ OpenAPI_context_data_sets_t *OpenAPI_context_data_sets_parseFromJSON(cJSON *cont ip_sm_gw_local_nonprim = OpenAPI_ip_sm_gw_registration_parseFromJSON(ip_sm_gw); } + roaming_info = cJSON_GetObjectItemCaseSensitive(context_data_setsJSON, "roamingInfo"); + if (roaming_info) { + roaming_info_local_nonprim = OpenAPI_roaming_info_update_parseFromJSON(roaming_info); + } + + pei_info = cJSON_GetObjectItemCaseSensitive(context_data_setsJSON, "peiInfo"); + if (pei_info) { + pei_info_local_nonprim = OpenAPI_pei_update_info_parseFromJSON(pei_info); + } + context_data_sets_local_var = OpenAPI_context_data_sets_create ( amf3_gpp ? amf3_gpp_local_nonprim : NULL, amf_non3_gpp ? amf_non3_gpp_local_nonprim : NULL, @@ -390,7 +442,9 @@ OpenAPI_context_data_sets_t *OpenAPI_context_data_sets_parseFromJSON(cJSON *cont smsf_non3_gpp_access ? smsf_non3_gpp_access_local_nonprim : NULL, subscription_data_subscriptions ? subscription_data_subscriptionsList : NULL, smf_registrations ? smf_registrationsList : NULL, - ip_sm_gw ? ip_sm_gw_local_nonprim : NULL + ip_sm_gw ? ip_sm_gw_local_nonprim : NULL, + roaming_info ? roaming_info_local_nonprim : NULL, + pei_info ? pei_info_local_nonprim : NULL ); return context_data_sets_local_var; @@ -443,6 +497,14 @@ end: OpenAPI_ip_sm_gw_registration_free(ip_sm_gw_local_nonprim); ip_sm_gw_local_nonprim = NULL; } + if (roaming_info_local_nonprim) { + OpenAPI_roaming_info_update_free(roaming_info_local_nonprim); + roaming_info_local_nonprim = NULL; + } + if (pei_info_local_nonprim) { + OpenAPI_pei_update_info_free(pei_info_local_nonprim); + pei_info_local_nonprim = NULL; + } return NULL; } diff --git a/lib/sbi/openapi/model/context_data_sets.h b/lib/sbi/openapi/model/context_data_sets.h index e56db1aab..b14ab946a 100644 --- a/lib/sbi/openapi/model/context_data_sets.h +++ b/lib/sbi/openapi/model/context_data_sets.h @@ -1,7 +1,7 @@ /* * context_data_sets.h * - * + * Contains the context data sets. */ #ifndef _OpenAPI_context_data_sets_H_ @@ -16,6 +16,8 @@ #include "amf_non3_gpp_access_registration.h" #include "ee_subscription.h" #include "ip_sm_gw_registration.h" +#include "pei_update_info.h" +#include "roaming_info_update.h" #include "sdm_subscription.h" #include "smf_registration.h" #include "smsf_registration.h" @@ -36,6 +38,8 @@ typedef struct OpenAPI_context_data_sets_s { OpenAPI_list_t *subscription_data_subscriptions; OpenAPI_list_t *smf_registrations; struct OpenAPI_ip_sm_gw_registration_s *ip_sm_gw; + struct OpenAPI_roaming_info_update_s *roaming_info; + struct OpenAPI_pei_update_info_s *pei_info; } OpenAPI_context_data_sets_t; OpenAPI_context_data_sets_t *OpenAPI_context_data_sets_create( @@ -47,7 +51,9 @@ OpenAPI_context_data_sets_t *OpenAPI_context_data_sets_create( OpenAPI_smsf_registration_t *smsf_non3_gpp_access, OpenAPI_list_t *subscription_data_subscriptions, OpenAPI_list_t *smf_registrations, - OpenAPI_ip_sm_gw_registration_t *ip_sm_gw + OpenAPI_ip_sm_gw_registration_t *ip_sm_gw, + OpenAPI_roaming_info_update_t *roaming_info, + OpenAPI_pei_update_info_t *pei_info ); void OpenAPI_context_data_sets_free(OpenAPI_context_data_sets_t *context_data_sets); OpenAPI_context_data_sets_t *OpenAPI_context_data_sets_parseFromJSON(cJSON *context_data_setsJSON); diff --git a/lib/sbi/openapi/model/context_info.c b/lib/sbi/openapi/model/context_info.c index 0f9b6ac25..5b9b0e902 100644 --- a/lib/sbi/openapi/model/context_info.c +++ b/lib/sbi/openapi/model/context_info.c @@ -5,13 +5,15 @@ #include "context_info.h" OpenAPI_context_info_t *OpenAPI_context_info_create( - OpenAPI_list_t *orig_headers + OpenAPI_list_t *orig_headers, + OpenAPI_list_t *request_headers ) { OpenAPI_context_info_t *context_info_local_var = ogs_malloc(sizeof(OpenAPI_context_info_t)); ogs_assert(context_info_local_var); context_info_local_var->orig_headers = orig_headers; + context_info_local_var->request_headers = request_headers; return context_info_local_var; } @@ -30,6 +32,13 @@ void OpenAPI_context_info_free(OpenAPI_context_info_t *context_info) OpenAPI_list_free(context_info->orig_headers); context_info->orig_headers = NULL; } + if (context_info->request_headers) { + OpenAPI_list_for_each(context_info->request_headers, node) { + ogs_free(node->data); + } + OpenAPI_list_free(context_info->request_headers); + context_info->request_headers = NULL; + } ogs_free(context_info); } @@ -58,6 +67,20 @@ cJSON *OpenAPI_context_info_convertToJSON(OpenAPI_context_info_t *context_info) } } + if (context_info->request_headers) { + cJSON *request_headersList = cJSON_AddArrayToObject(item, "requestHeaders"); + if (request_headersList == NULL) { + ogs_error("OpenAPI_context_info_convertToJSON() failed [request_headers]"); + goto end; + } + OpenAPI_list_for_each(context_info->request_headers, node) { + if (cJSON_AddStringToObject(request_headersList, "", (char*)node->data) == NULL) { + ogs_error("OpenAPI_context_info_convertToJSON() failed [request_headers]"); + goto end; + } + } + } + end: return item; } @@ -68,6 +91,8 @@ OpenAPI_context_info_t *OpenAPI_context_info_parseFromJSON(cJSON *context_infoJS OpenAPI_lnode_t *node = NULL; cJSON *orig_headers = NULL; OpenAPI_list_t *orig_headersList = NULL; + cJSON *request_headers = NULL; + OpenAPI_list_t *request_headersList = NULL; orig_headers = cJSON_GetObjectItemCaseSensitive(context_infoJSON, "origHeaders"); if (orig_headers) { cJSON *orig_headers_local = NULL; @@ -89,8 +114,30 @@ OpenAPI_context_info_t *OpenAPI_context_info_parseFromJSON(cJSON *context_infoJS } } + request_headers = cJSON_GetObjectItemCaseSensitive(context_infoJSON, "requestHeaders"); + if (request_headers) { + cJSON *request_headers_local = NULL; + if (!cJSON_IsArray(request_headers)) { + ogs_error("OpenAPI_context_info_parseFromJSON() failed [request_headers]"); + goto end; + } + + request_headersList = OpenAPI_list_create(); + + cJSON_ArrayForEach(request_headers_local, request_headers) { + double *localDouble = NULL; + int *localInt = NULL; + if (!cJSON_IsString(request_headers_local)) { + ogs_error("OpenAPI_context_info_parseFromJSON() failed [request_headers]"); + goto end; + } + OpenAPI_list_add(request_headersList, ogs_strdup(request_headers_local->valuestring)); + } + } + context_info_local_var = OpenAPI_context_info_create ( - orig_headers ? orig_headersList : NULL + orig_headers ? orig_headersList : NULL, + request_headers ? request_headersList : NULL ); return context_info_local_var; @@ -102,6 +149,13 @@ end: OpenAPI_list_free(orig_headersList); orig_headersList = NULL; } + if (request_headersList) { + OpenAPI_list_for_each(request_headersList, node) { + ogs_free(node->data); + } + OpenAPI_list_free(request_headersList); + request_headersList = NULL; + } return NULL; } diff --git a/lib/sbi/openapi/model/context_info.h b/lib/sbi/openapi/model/context_info.h index a5ecbe541..d52cfd92a 100644 --- a/lib/sbi/openapi/model/context_info.h +++ b/lib/sbi/openapi/model/context_info.h @@ -20,10 +20,12 @@ extern "C" { typedef struct OpenAPI_context_info_s OpenAPI_context_info_t; typedef struct OpenAPI_context_info_s { OpenAPI_list_t *orig_headers; + OpenAPI_list_t *request_headers; } OpenAPI_context_info_t; OpenAPI_context_info_t *OpenAPI_context_info_create( - OpenAPI_list_t *orig_headers + OpenAPI_list_t *orig_headers, + OpenAPI_list_t *request_headers ); void OpenAPI_context_info_free(OpenAPI_context_info_t *context_info); OpenAPI_context_info_t *OpenAPI_context_info_parseFromJSON(cJSON *context_infoJSON); diff --git a/lib/sbi/openapi/model/create_ue_context_request.c b/lib/sbi/openapi/model/create_ue_context_request.c index a8eb83a02..69d1d9bdc 100644 --- a/lib/sbi/openapi/model/create_ue_context_request.c +++ b/lib/sbi/openapi/model/create_ue_context_request.c @@ -22,7 +22,8 @@ OpenAPI_create_ue_context_request_t *OpenAPI_create_ue_context_request_create( OpenAPI_binary_t* binary_data_n2_information_ext13, OpenAPI_binary_t* binary_data_n2_information_ext14, OpenAPI_binary_t* binary_data_n2_information_ext15, - OpenAPI_binary_t* binary_data_n2_information_ext16 + OpenAPI_binary_t* binary_data_n2_information_ext16, + OpenAPI_binary_t* binary_data_n2_information_ext17 ) { OpenAPI_create_ue_context_request_t *create_ue_context_request_local_var = ogs_malloc(sizeof(OpenAPI_create_ue_context_request_t)); @@ -46,6 +47,7 @@ OpenAPI_create_ue_context_request_t *OpenAPI_create_ue_context_request_create( create_ue_context_request_local_var->binary_data_n2_information_ext14 = binary_data_n2_information_ext14; create_ue_context_request_local_var->binary_data_n2_information_ext15 = binary_data_n2_information_ext15; create_ue_context_request_local_var->binary_data_n2_information_ext16 = binary_data_n2_information_ext16; + create_ue_context_request_local_var->binary_data_n2_information_ext17 = binary_data_n2_information_ext17; return create_ue_context_request_local_var; } @@ -129,6 +131,10 @@ void OpenAPI_create_ue_context_request_free(OpenAPI_create_ue_context_request_t ogs_free(create_ue_context_request->binary_data_n2_information_ext16->data); create_ue_context_request->binary_data_n2_information_ext16 = NULL; } + if (create_ue_context_request->binary_data_n2_information_ext17) { + ogs_free(create_ue_context_request->binary_data_n2_information_ext17->data); + create_ue_context_request->binary_data_n2_information_ext17 = NULL; + } ogs_free(create_ue_context_request); } @@ -309,6 +315,15 @@ cJSON *OpenAPI_create_ue_context_request_convertToJSON(OpenAPI_create_ue_context ogs_free(encoded_str_binary_data_n2_information_ext16); } + if (create_ue_context_request->binary_data_n2_information_ext17) { + char* encoded_str_binary_data_n2_information_ext17 = OpenAPI_base64encode(create_ue_context_request->binary_data_n2_information_ext17->data,create_ue_context_request->binary_data_n2_information_ext17->len); + if (cJSON_AddStringToObject(item, "binaryDataN2InformationExt17", encoded_str_binary_data_n2_information_ext17) == NULL) { + ogs_error("OpenAPI_create_ue_context_request_convertToJSON() failed [binary_data_n2_information_ext17]"); + goto end; + } + ogs_free(encoded_str_binary_data_n2_information_ext17); + } + end: return item; } @@ -353,6 +368,8 @@ OpenAPI_create_ue_context_request_t *OpenAPI_create_ue_context_request_parseFrom OpenAPI_binary_t *decoded_str_binary_data_n2_information_ext15 = NULL; cJSON *binary_data_n2_information_ext16 = NULL; OpenAPI_binary_t *decoded_str_binary_data_n2_information_ext16 = NULL; + cJSON *binary_data_n2_information_ext17 = NULL; + OpenAPI_binary_t *decoded_str_binary_data_n2_information_ext17 = NULL; json_data = cJSON_GetObjectItemCaseSensitive(create_ue_context_requestJSON, "jsonData"); if (json_data) { json_data_local_nonprim = OpenAPI_ue_context_create_data_parseFromJSON(json_data); @@ -613,6 +630,21 @@ OpenAPI_create_ue_context_request_t *OpenAPI_create_ue_context_request_parseFrom } } + binary_data_n2_information_ext17 = cJSON_GetObjectItemCaseSensitive(create_ue_context_requestJSON, "binaryDataN2InformationExt17"); + if (binary_data_n2_information_ext17) { + decoded_str_binary_data_n2_information_ext17 = ogs_malloc(sizeof(OpenAPI_binary_t)); + ogs_assert(decoded_str_binary_data_n2_information_ext17); + if (!cJSON_IsString(binary_data_n2_information_ext17)) { + ogs_error("OpenAPI_create_ue_context_request_parseFromJSON() failed [binary_data_n2_information_ext17]"); + goto end; + } + decoded_str_binary_data_n2_information_ext17->data = OpenAPI_base64decode(binary_data_n2_information_ext17->valuestring, strlen(binary_data_n2_information_ext17->valuestring), &decoded_str_binary_data_n2_information_ext17->len); + if (!decoded_str_binary_data_n2_information_ext17->data) { + ogs_error("OpenAPI_create_ue_context_request_parseFromJSON() failed [binary_data_n2_information_ext17]"); + goto end; + } + } + create_ue_context_request_local_var = OpenAPI_create_ue_context_request_create ( json_data ? json_data_local_nonprim : NULL, binary_data_n2_information ? decoded_str_binary_data_n2_information : NULL, @@ -631,7 +663,8 @@ OpenAPI_create_ue_context_request_t *OpenAPI_create_ue_context_request_parseFrom binary_data_n2_information_ext13 ? decoded_str_binary_data_n2_information_ext13 : NULL, binary_data_n2_information_ext14 ? decoded_str_binary_data_n2_information_ext14 : NULL, binary_data_n2_information_ext15 ? decoded_str_binary_data_n2_information_ext15 : NULL, - binary_data_n2_information_ext16 ? decoded_str_binary_data_n2_information_ext16 : NULL + binary_data_n2_information_ext16 ? decoded_str_binary_data_n2_information_ext16 : NULL, + binary_data_n2_information_ext17 ? decoded_str_binary_data_n2_information_ext17 : NULL ); return create_ue_context_request_local_var; diff --git a/lib/sbi/openapi/model/create_ue_context_request.h b/lib/sbi/openapi/model/create_ue_context_request.h index e1c42ce89..662740438 100644 --- a/lib/sbi/openapi/model/create_ue_context_request.h +++ b/lib/sbi/openapi/model/create_ue_context_request.h @@ -38,6 +38,7 @@ typedef struct OpenAPI_create_ue_context_request_s { OpenAPI_binary_t* binary_data_n2_information_ext14; OpenAPI_binary_t* binary_data_n2_information_ext15; OpenAPI_binary_t* binary_data_n2_information_ext16; + OpenAPI_binary_t* binary_data_n2_information_ext17; } OpenAPI_create_ue_context_request_t; OpenAPI_create_ue_context_request_t *OpenAPI_create_ue_context_request_create( @@ -58,7 +59,8 @@ OpenAPI_create_ue_context_request_t *OpenAPI_create_ue_context_request_create( OpenAPI_binary_t* binary_data_n2_information_ext13, OpenAPI_binary_t* binary_data_n2_information_ext14, OpenAPI_binary_t* binary_data_n2_information_ext15, - OpenAPI_binary_t* binary_data_n2_information_ext16 + OpenAPI_binary_t* binary_data_n2_information_ext16, + OpenAPI_binary_t* binary_data_n2_information_ext17 ); void OpenAPI_create_ue_context_request_free(OpenAPI_create_ue_context_request_t *create_ue_context_request); OpenAPI_create_ue_context_request_t *OpenAPI_create_ue_context_request_parseFromJSON(cJSON *create_ue_context_requestJSON); diff --git a/lib/sbi/openapi/model/data_change_notify.h b/lib/sbi/openapi/model/data_change_notify.h index ff65a6748..0355ba221 100644 --- a/lib/sbi/openapi/model/data_change_notify.h +++ b/lib/sbi/openapi/model/data_change_notify.h @@ -1,7 +1,7 @@ /* * data_change_notify.h * - * + * Container for data which have changed and notification was requested when changed. */ #ifndef _OpenAPI_data_change_notify_H_ diff --git a/lib/sbi/openapi/model/data_filter.c b/lib/sbi/openapi/model/data_filter.c index 4e667ebec..0275ccf90 100644 --- a/lib/sbi/openapi/model/data_filter.c +++ b/lib/sbi/openapi/model/data_filter.c @@ -13,7 +13,10 @@ OpenAPI_data_filter_t *OpenAPI_data_filter_create( OpenAPI_list_t *app_ids, OpenAPI_list_t *ue_ipv4s, OpenAPI_list_t *ue_ipv6s, - OpenAPI_list_t *ue_macs + OpenAPI_list_t *ue_macs, + bool is_any_ue_ind, + int any_ue_ind, + OpenAPI_list_t *dnn_snssai_infos ) { OpenAPI_data_filter_t *data_filter_local_var = ogs_malloc(sizeof(OpenAPI_data_filter_t)); @@ -28,6 +31,9 @@ OpenAPI_data_filter_t *OpenAPI_data_filter_create( data_filter_local_var->ue_ipv4s = ue_ipv4s; data_filter_local_var->ue_ipv6s = ue_ipv6s; data_filter_local_var->ue_macs = ue_macs; + data_filter_local_var->is_any_ue_ind = is_any_ue_ind; + data_filter_local_var->any_ue_ind = any_ue_ind; + data_filter_local_var->dnn_snssai_infos = dnn_snssai_infos; return data_filter_local_var; } @@ -99,6 +105,13 @@ void OpenAPI_data_filter_free(OpenAPI_data_filter_t *data_filter) OpenAPI_list_free(data_filter->ue_macs); data_filter->ue_macs = NULL; } + if (data_filter->dnn_snssai_infos) { + OpenAPI_list_for_each(data_filter->dnn_snssai_infos, node) { + OpenAPI_dnn_snssai_information_free(node->data); + } + OpenAPI_list_free(data_filter->dnn_snssai_infos); + data_filter->dnn_snssai_infos = NULL; + } ogs_free(data_filter); } @@ -242,6 +255,29 @@ cJSON *OpenAPI_data_filter_convertToJSON(OpenAPI_data_filter_t *data_filter) } } + if (data_filter->is_any_ue_ind) { + if (cJSON_AddBoolToObject(item, "anyUeInd", data_filter->any_ue_ind) == NULL) { + ogs_error("OpenAPI_data_filter_convertToJSON() failed [any_ue_ind]"); + goto end; + } + } + + if (data_filter->dnn_snssai_infos) { + cJSON *dnn_snssai_infosList = cJSON_AddArrayToObject(item, "dnnSnssaiInfos"); + if (dnn_snssai_infosList == NULL) { + ogs_error("OpenAPI_data_filter_convertToJSON() failed [dnn_snssai_infos]"); + goto end; + } + OpenAPI_list_for_each(data_filter->dnn_snssai_infos, node) { + cJSON *itemLocal = OpenAPI_dnn_snssai_information_convertToJSON(node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_data_filter_convertToJSON() failed [dnn_snssai_infos]"); + goto end; + } + cJSON_AddItemToArray(dnn_snssai_infosList, itemLocal); + } + } + end: return item; } @@ -268,6 +304,9 @@ OpenAPI_data_filter_t *OpenAPI_data_filter_parseFromJSON(cJSON *data_filterJSON) OpenAPI_list_t *ue_ipv6sList = NULL; cJSON *ue_macs = NULL; OpenAPI_list_t *ue_macsList = NULL; + cJSON *any_ue_ind = NULL; + cJSON *dnn_snssai_infos = NULL; + OpenAPI_list_t *dnn_snssai_infosList = NULL; data_ind = cJSON_GetObjectItemCaseSensitive(data_filterJSON, "dataInd"); if (!data_ind) { ogs_error("OpenAPI_data_filter_parseFromJSON() failed [data_ind]"); @@ -447,6 +486,39 @@ OpenAPI_data_filter_t *OpenAPI_data_filter_parseFromJSON(cJSON *data_filterJSON) } } + any_ue_ind = cJSON_GetObjectItemCaseSensitive(data_filterJSON, "anyUeInd"); + if (any_ue_ind) { + if (!cJSON_IsBool(any_ue_ind)) { + ogs_error("OpenAPI_data_filter_parseFromJSON() failed [any_ue_ind]"); + goto end; + } + } + + dnn_snssai_infos = cJSON_GetObjectItemCaseSensitive(data_filterJSON, "dnnSnssaiInfos"); + if (dnn_snssai_infos) { + cJSON *dnn_snssai_infos_local = NULL; + if (!cJSON_IsArray(dnn_snssai_infos)) { + ogs_error("OpenAPI_data_filter_parseFromJSON() failed [dnn_snssai_infos]"); + goto end; + } + + dnn_snssai_infosList = OpenAPI_list_create(); + + cJSON_ArrayForEach(dnn_snssai_infos_local, dnn_snssai_infos) { + if (!cJSON_IsObject(dnn_snssai_infos_local)) { + ogs_error("OpenAPI_data_filter_parseFromJSON() failed [dnn_snssai_infos]"); + goto end; + } + OpenAPI_dnn_snssai_information_t *dnn_snssai_infosItem = OpenAPI_dnn_snssai_information_parseFromJSON(dnn_snssai_infos_local); + if (!dnn_snssai_infosItem) { + ogs_error("No dnn_snssai_infosItem"); + OpenAPI_list_free(dnn_snssai_infosList); + goto end; + } + OpenAPI_list_add(dnn_snssai_infosList, dnn_snssai_infosItem); + } + } + data_filter_local_var = OpenAPI_data_filter_create ( data_ind_local_nonprim, dnns ? dnnsList : NULL, @@ -456,7 +528,10 @@ OpenAPI_data_filter_t *OpenAPI_data_filter_parseFromJSON(cJSON *data_filterJSON) app_ids ? app_idsList : NULL, ue_ipv4s ? ue_ipv4sList : NULL, ue_ipv6s ? ue_ipv6sList : NULL, - ue_macs ? ue_macsList : NULL + ue_macs ? ue_macsList : NULL, + any_ue_ind ? true : false, + any_ue_ind ? any_ue_ind->valueint : 0, + dnn_snssai_infos ? dnn_snssai_infosList : NULL ); return data_filter_local_var; @@ -521,6 +596,13 @@ end: OpenAPI_list_free(ue_macsList); ue_macsList = NULL; } + if (dnn_snssai_infosList) { + OpenAPI_list_for_each(dnn_snssai_infosList, node) { + OpenAPI_dnn_snssai_information_free(node->data); + } + OpenAPI_list_free(dnn_snssai_infosList); + dnn_snssai_infosList = NULL; + } return NULL; } diff --git a/lib/sbi/openapi/model/data_filter.h b/lib/sbi/openapi/model/data_filter.h index 6b72f2709..60ed5a54f 100644 --- a/lib/sbi/openapi/model/data_filter.h +++ b/lib/sbi/openapi/model/data_filter.h @@ -13,6 +13,7 @@ #include "../include/keyValuePair.h" #include "../include/binary.h" #include "data_ind.h" +#include "dnn_snssai_information.h" #include "snssai.h" #ifdef __cplusplus @@ -30,6 +31,9 @@ typedef struct OpenAPI_data_filter_s { OpenAPI_list_t *ue_ipv4s; OpenAPI_list_t *ue_ipv6s; OpenAPI_list_t *ue_macs; + bool is_any_ue_ind; + int any_ue_ind; + OpenAPI_list_t *dnn_snssai_infos; } OpenAPI_data_filter_t; OpenAPI_data_filter_t *OpenAPI_data_filter_create( @@ -41,7 +45,10 @@ OpenAPI_data_filter_t *OpenAPI_data_filter_create( OpenAPI_list_t *app_ids, OpenAPI_list_t *ue_ipv4s, OpenAPI_list_t *ue_ipv6s, - OpenAPI_list_t *ue_macs + OpenAPI_list_t *ue_macs, + bool is_any_ue_ind, + int any_ue_ind, + OpenAPI_list_t *dnn_snssai_infos ); void OpenAPI_data_filter_free(OpenAPI_data_filter_t *data_filter); OpenAPI_data_filter_t *OpenAPI_data_filter_parseFromJSON(cJSON *data_filterJSON); diff --git a/lib/sbi/openapi/model/data_ind.h b/lib/sbi/openapi/model/data_ind.h index e83b2a6e1..5572940ea 100644 --- a/lib/sbi/openapi/model/data_ind.h +++ b/lib/sbi/openapi/model/data_ind.h @@ -1,7 +1,7 @@ /* * data_ind.h * - * Possible values are - PFD - IPTV - BDT - SVC_PARAM + * Possible values are - PFD - IPTV - BDT - SVC_PARAM - AM */ #ifndef _OpenAPI_data_ind_H_ diff --git a/lib/sbi/openapi/model/data_ind_any_of.c b/lib/sbi/openapi/model/data_ind_any_of.c index 3e140de6b..1bc2ffbde 100644 --- a/lib/sbi/openapi/model/data_ind_any_of.c +++ b/lib/sbi/openapi/model/data_ind_any_of.c @@ -6,7 +6,7 @@ char* OpenAPI_data_ind_any_of_ToString(OpenAPI_data_ind_any_of_e data_ind_any_of) { - const char *data_ind_any_ofArray[] = { "NULL", "PFD", "IPTV", "BDT", "SVC_PARAM" }; + const char *data_ind_any_ofArray[] = { "NULL", "PFD", "IPTV", "BDT", "SVC_PARAM", "AM" }; size_t sizeofArray = sizeof(data_ind_any_ofArray) / sizeof(data_ind_any_ofArray[0]); if (data_ind_any_of < sizeofArray) return (char *)data_ind_any_ofArray[data_ind_any_of]; @@ -17,7 +17,7 @@ char* OpenAPI_data_ind_any_of_ToString(OpenAPI_data_ind_any_of_e data_ind_any_of OpenAPI_data_ind_any_of_e OpenAPI_data_ind_any_of_FromString(char* data_ind_any_of) { int stringToReturn = 0; - const char *data_ind_any_ofArray[] = { "NULL", "PFD", "IPTV", "BDT", "SVC_PARAM" }; + const char *data_ind_any_ofArray[] = { "NULL", "PFD", "IPTV", "BDT", "SVC_PARAM", "AM" }; size_t sizeofArray = sizeof(data_ind_any_ofArray) / sizeof(data_ind_any_ofArray[0]); while (stringToReturn < sizeofArray) { if (strcmp(data_ind_any_of, data_ind_any_ofArray[stringToReturn]) == 0) { diff --git a/lib/sbi/openapi/model/data_ind_any_of.h b/lib/sbi/openapi/model/data_ind_any_of.h index cb48da17d..5cdb7341c 100644 --- a/lib/sbi/openapi/model/data_ind_any_of.h +++ b/lib/sbi/openapi/model/data_ind_any_of.h @@ -17,7 +17,7 @@ extern "C" { #endif -typedef enum { OpenAPI_data_ind_any_of_NULL = 0, OpenAPI_data_ind_any_of_PFD, OpenAPI_data_ind_any_of_IPTV, OpenAPI_data_ind_any_of_BDT, OpenAPI_data_ind_any_of_SVC_PARAM } OpenAPI_data_ind_any_of_e; +typedef enum { OpenAPI_data_ind_any_of_NULL = 0, OpenAPI_data_ind_any_of_PFD, OpenAPI_data_ind_any_of_IPTV, OpenAPI_data_ind_any_of_BDT, OpenAPI_data_ind_any_of_SVC_PARAM, OpenAPI_data_ind_any_of_AM } OpenAPI_data_ind_any_of_e; char* OpenAPI_data_ind_any_of_ToString(OpenAPI_data_ind_any_of_e data_ind_any_of); diff --git a/lib/sbi/openapi/model/data_restoration_notification.c b/lib/sbi/openapi/model/data_restoration_notification.c new file mode 100644 index 000000000..e20e83d84 --- /dev/null +++ b/lib/sbi/openapi/model/data_restoration_notification.c @@ -0,0 +1,475 @@ + +#include +#include +#include +#include "data_restoration_notification.h" + +OpenAPI_data_restoration_notification_t *OpenAPI_data_restoration_notification_create( + char *last_replication_time, + char *recovery_time, + OpenAPI_plmn_id_t *plmn_id, + OpenAPI_list_t *supi_ranges, + OpenAPI_list_t *gpsi_ranges, + OpenAPI_list_t *reset_ids, + OpenAPI_list_t *s_nssai_list, + OpenAPI_list_t *dnn_list, + char *udm_group_id +) +{ + OpenAPI_data_restoration_notification_t *data_restoration_notification_local_var = ogs_malloc(sizeof(OpenAPI_data_restoration_notification_t)); + ogs_assert(data_restoration_notification_local_var); + + data_restoration_notification_local_var->last_replication_time = last_replication_time; + data_restoration_notification_local_var->recovery_time = recovery_time; + data_restoration_notification_local_var->plmn_id = plmn_id; + data_restoration_notification_local_var->supi_ranges = supi_ranges; + data_restoration_notification_local_var->gpsi_ranges = gpsi_ranges; + data_restoration_notification_local_var->reset_ids = reset_ids; + data_restoration_notification_local_var->s_nssai_list = s_nssai_list; + data_restoration_notification_local_var->dnn_list = dnn_list; + data_restoration_notification_local_var->udm_group_id = udm_group_id; + + return data_restoration_notification_local_var; +} + +void OpenAPI_data_restoration_notification_free(OpenAPI_data_restoration_notification_t *data_restoration_notification) +{ + OpenAPI_lnode_t *node = NULL; + + if (NULL == data_restoration_notification) { + return; + } + if (data_restoration_notification->last_replication_time) { + ogs_free(data_restoration_notification->last_replication_time); + data_restoration_notification->last_replication_time = NULL; + } + if (data_restoration_notification->recovery_time) { + ogs_free(data_restoration_notification->recovery_time); + data_restoration_notification->recovery_time = NULL; + } + if (data_restoration_notification->plmn_id) { + OpenAPI_plmn_id_free(data_restoration_notification->plmn_id); + data_restoration_notification->plmn_id = NULL; + } + if (data_restoration_notification->supi_ranges) { + OpenAPI_list_for_each(data_restoration_notification->supi_ranges, node) { + OpenAPI_supi_range_free(node->data); + } + OpenAPI_list_free(data_restoration_notification->supi_ranges); + data_restoration_notification->supi_ranges = NULL; + } + if (data_restoration_notification->gpsi_ranges) { + OpenAPI_list_for_each(data_restoration_notification->gpsi_ranges, node) { + OpenAPI_identity_range_free(node->data); + } + OpenAPI_list_free(data_restoration_notification->gpsi_ranges); + data_restoration_notification->gpsi_ranges = NULL; + } + if (data_restoration_notification->reset_ids) { + OpenAPI_list_for_each(data_restoration_notification->reset_ids, node) { + ogs_free(node->data); + } + OpenAPI_list_free(data_restoration_notification->reset_ids); + data_restoration_notification->reset_ids = NULL; + } + if (data_restoration_notification->s_nssai_list) { + OpenAPI_list_for_each(data_restoration_notification->s_nssai_list, node) { + OpenAPI_snssai_free(node->data); + } + OpenAPI_list_free(data_restoration_notification->s_nssai_list); + data_restoration_notification->s_nssai_list = NULL; + } + if (data_restoration_notification->dnn_list) { + OpenAPI_list_for_each(data_restoration_notification->dnn_list, node) { + ogs_free(node->data); + } + OpenAPI_list_free(data_restoration_notification->dnn_list); + data_restoration_notification->dnn_list = NULL; + } + if (data_restoration_notification->udm_group_id) { + ogs_free(data_restoration_notification->udm_group_id); + data_restoration_notification->udm_group_id = NULL; + } + ogs_free(data_restoration_notification); +} + +cJSON *OpenAPI_data_restoration_notification_convertToJSON(OpenAPI_data_restoration_notification_t *data_restoration_notification) +{ + cJSON *item = NULL; + OpenAPI_lnode_t *node = NULL; + + if (data_restoration_notification == NULL) { + ogs_error("OpenAPI_data_restoration_notification_convertToJSON() failed [DataRestorationNotification]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (data_restoration_notification->last_replication_time) { + if (cJSON_AddStringToObject(item, "lastReplicationTime", data_restoration_notification->last_replication_time) == NULL) { + ogs_error("OpenAPI_data_restoration_notification_convertToJSON() failed [last_replication_time]"); + goto end; + } + } + + if (data_restoration_notification->recovery_time) { + if (cJSON_AddStringToObject(item, "recoveryTime", data_restoration_notification->recovery_time) == NULL) { + ogs_error("OpenAPI_data_restoration_notification_convertToJSON() failed [recovery_time]"); + goto end; + } + } + + if (data_restoration_notification->plmn_id) { + cJSON *plmn_id_local_JSON = OpenAPI_plmn_id_convertToJSON(data_restoration_notification->plmn_id); + if (plmn_id_local_JSON == NULL) { + ogs_error("OpenAPI_data_restoration_notification_convertToJSON() failed [plmn_id]"); + goto end; + } + cJSON_AddItemToObject(item, "plmnId", plmn_id_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_data_restoration_notification_convertToJSON() failed [plmn_id]"); + goto end; + } + } + + if (data_restoration_notification->supi_ranges) { + cJSON *supi_rangesList = cJSON_AddArrayToObject(item, "supiRanges"); + if (supi_rangesList == NULL) { + ogs_error("OpenAPI_data_restoration_notification_convertToJSON() failed [supi_ranges]"); + goto end; + } + OpenAPI_list_for_each(data_restoration_notification->supi_ranges, node) { + cJSON *itemLocal = OpenAPI_supi_range_convertToJSON(node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_data_restoration_notification_convertToJSON() failed [supi_ranges]"); + goto end; + } + cJSON_AddItemToArray(supi_rangesList, itemLocal); + } + } + + if (data_restoration_notification->gpsi_ranges) { + cJSON *gpsi_rangesList = cJSON_AddArrayToObject(item, "gpsiRanges"); + if (gpsi_rangesList == NULL) { + ogs_error("OpenAPI_data_restoration_notification_convertToJSON() failed [gpsi_ranges]"); + goto end; + } + OpenAPI_list_for_each(data_restoration_notification->gpsi_ranges, node) { + cJSON *itemLocal = OpenAPI_identity_range_convertToJSON(node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_data_restoration_notification_convertToJSON() failed [gpsi_ranges]"); + goto end; + } + cJSON_AddItemToArray(gpsi_rangesList, itemLocal); + } + } + + if (data_restoration_notification->reset_ids) { + cJSON *reset_idsList = cJSON_AddArrayToObject(item, "resetIds"); + if (reset_idsList == NULL) { + ogs_error("OpenAPI_data_restoration_notification_convertToJSON() failed [reset_ids]"); + goto end; + } + OpenAPI_list_for_each(data_restoration_notification->reset_ids, node) { + if (cJSON_AddStringToObject(reset_idsList, "", (char*)node->data) == NULL) { + ogs_error("OpenAPI_data_restoration_notification_convertToJSON() failed [reset_ids]"); + goto end; + } + } + } + + if (data_restoration_notification->s_nssai_list) { + cJSON *s_nssai_listList = cJSON_AddArrayToObject(item, "sNssaiList"); + if (s_nssai_listList == NULL) { + ogs_error("OpenAPI_data_restoration_notification_convertToJSON() failed [s_nssai_list]"); + goto end; + } + OpenAPI_list_for_each(data_restoration_notification->s_nssai_list, node) { + cJSON *itemLocal = OpenAPI_snssai_convertToJSON(node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_data_restoration_notification_convertToJSON() failed [s_nssai_list]"); + goto end; + } + cJSON_AddItemToArray(s_nssai_listList, itemLocal); + } + } + + if (data_restoration_notification->dnn_list) { + cJSON *dnn_listList = cJSON_AddArrayToObject(item, "dnnList"); + if (dnn_listList == NULL) { + ogs_error("OpenAPI_data_restoration_notification_convertToJSON() failed [dnn_list]"); + goto end; + } + OpenAPI_list_for_each(data_restoration_notification->dnn_list, node) { + if (cJSON_AddStringToObject(dnn_listList, "", (char*)node->data) == NULL) { + ogs_error("OpenAPI_data_restoration_notification_convertToJSON() failed [dnn_list]"); + goto end; + } + } + } + + if (data_restoration_notification->udm_group_id) { + if (cJSON_AddStringToObject(item, "udmGroupId", data_restoration_notification->udm_group_id) == NULL) { + ogs_error("OpenAPI_data_restoration_notification_convertToJSON() failed [udm_group_id]"); + goto end; + } + } + +end: + return item; +} + +OpenAPI_data_restoration_notification_t *OpenAPI_data_restoration_notification_parseFromJSON(cJSON *data_restoration_notificationJSON) +{ + OpenAPI_data_restoration_notification_t *data_restoration_notification_local_var = NULL; + OpenAPI_lnode_t *node = NULL; + cJSON *last_replication_time = NULL; + cJSON *recovery_time = NULL; + cJSON *plmn_id = NULL; + OpenAPI_plmn_id_t *plmn_id_local_nonprim = NULL; + cJSON *supi_ranges = NULL; + OpenAPI_list_t *supi_rangesList = NULL; + cJSON *gpsi_ranges = NULL; + OpenAPI_list_t *gpsi_rangesList = NULL; + cJSON *reset_ids = NULL; + OpenAPI_list_t *reset_idsList = NULL; + cJSON *s_nssai_list = NULL; + OpenAPI_list_t *s_nssai_listList = NULL; + cJSON *dnn_list = NULL; + OpenAPI_list_t *dnn_listList = NULL; + cJSON *udm_group_id = NULL; + last_replication_time = cJSON_GetObjectItemCaseSensitive(data_restoration_notificationJSON, "lastReplicationTime"); + if (last_replication_time) { + if (!cJSON_IsString(last_replication_time) && !cJSON_IsNull(last_replication_time)) { + ogs_error("OpenAPI_data_restoration_notification_parseFromJSON() failed [last_replication_time]"); + goto end; + } + } + + recovery_time = cJSON_GetObjectItemCaseSensitive(data_restoration_notificationJSON, "recoveryTime"); + if (recovery_time) { + if (!cJSON_IsString(recovery_time) && !cJSON_IsNull(recovery_time)) { + ogs_error("OpenAPI_data_restoration_notification_parseFromJSON() failed [recovery_time]"); + goto end; + } + } + + plmn_id = cJSON_GetObjectItemCaseSensitive(data_restoration_notificationJSON, "plmnId"); + if (plmn_id) { + plmn_id_local_nonprim = OpenAPI_plmn_id_parseFromJSON(plmn_id); + } + + supi_ranges = cJSON_GetObjectItemCaseSensitive(data_restoration_notificationJSON, "supiRanges"); + if (supi_ranges) { + cJSON *supi_ranges_local = NULL; + if (!cJSON_IsArray(supi_ranges)) { + ogs_error("OpenAPI_data_restoration_notification_parseFromJSON() failed [supi_ranges]"); + goto end; + } + + supi_rangesList = OpenAPI_list_create(); + + cJSON_ArrayForEach(supi_ranges_local, supi_ranges) { + if (!cJSON_IsObject(supi_ranges_local)) { + ogs_error("OpenAPI_data_restoration_notification_parseFromJSON() failed [supi_ranges]"); + goto end; + } + OpenAPI_supi_range_t *supi_rangesItem = OpenAPI_supi_range_parseFromJSON(supi_ranges_local); + if (!supi_rangesItem) { + ogs_error("No supi_rangesItem"); + OpenAPI_list_free(supi_rangesList); + goto end; + } + OpenAPI_list_add(supi_rangesList, supi_rangesItem); + } + } + + gpsi_ranges = cJSON_GetObjectItemCaseSensitive(data_restoration_notificationJSON, "gpsiRanges"); + if (gpsi_ranges) { + cJSON *gpsi_ranges_local = NULL; + if (!cJSON_IsArray(gpsi_ranges)) { + ogs_error("OpenAPI_data_restoration_notification_parseFromJSON() failed [gpsi_ranges]"); + goto end; + } + + gpsi_rangesList = OpenAPI_list_create(); + + cJSON_ArrayForEach(gpsi_ranges_local, gpsi_ranges) { + if (!cJSON_IsObject(gpsi_ranges_local)) { + ogs_error("OpenAPI_data_restoration_notification_parseFromJSON() failed [gpsi_ranges]"); + goto end; + } + OpenAPI_identity_range_t *gpsi_rangesItem = OpenAPI_identity_range_parseFromJSON(gpsi_ranges_local); + if (!gpsi_rangesItem) { + ogs_error("No gpsi_rangesItem"); + OpenAPI_list_free(gpsi_rangesList); + goto end; + } + OpenAPI_list_add(gpsi_rangesList, gpsi_rangesItem); + } + } + + reset_ids = cJSON_GetObjectItemCaseSensitive(data_restoration_notificationJSON, "resetIds"); + if (reset_ids) { + cJSON *reset_ids_local = NULL; + if (!cJSON_IsArray(reset_ids)) { + ogs_error("OpenAPI_data_restoration_notification_parseFromJSON() failed [reset_ids]"); + goto end; + } + + reset_idsList = OpenAPI_list_create(); + + cJSON_ArrayForEach(reset_ids_local, reset_ids) { + double *localDouble = NULL; + int *localInt = NULL; + if (!cJSON_IsString(reset_ids_local)) { + ogs_error("OpenAPI_data_restoration_notification_parseFromJSON() failed [reset_ids]"); + goto end; + } + OpenAPI_list_add(reset_idsList, ogs_strdup(reset_ids_local->valuestring)); + } + } + + s_nssai_list = cJSON_GetObjectItemCaseSensitive(data_restoration_notificationJSON, "sNssaiList"); + if (s_nssai_list) { + cJSON *s_nssai_list_local = NULL; + if (!cJSON_IsArray(s_nssai_list)) { + ogs_error("OpenAPI_data_restoration_notification_parseFromJSON() failed [s_nssai_list]"); + goto end; + } + + s_nssai_listList = OpenAPI_list_create(); + + cJSON_ArrayForEach(s_nssai_list_local, s_nssai_list) { + if (!cJSON_IsObject(s_nssai_list_local)) { + ogs_error("OpenAPI_data_restoration_notification_parseFromJSON() failed [s_nssai_list]"); + goto end; + } + OpenAPI_snssai_t *s_nssai_listItem = OpenAPI_snssai_parseFromJSON(s_nssai_list_local); + if (!s_nssai_listItem) { + ogs_error("No s_nssai_listItem"); + OpenAPI_list_free(s_nssai_listList); + goto end; + } + OpenAPI_list_add(s_nssai_listList, s_nssai_listItem); + } + } + + dnn_list = cJSON_GetObjectItemCaseSensitive(data_restoration_notificationJSON, "dnnList"); + if (dnn_list) { + cJSON *dnn_list_local = NULL; + if (!cJSON_IsArray(dnn_list)) { + ogs_error("OpenAPI_data_restoration_notification_parseFromJSON() failed [dnn_list]"); + goto end; + } + + dnn_listList = OpenAPI_list_create(); + + cJSON_ArrayForEach(dnn_list_local, dnn_list) { + double *localDouble = NULL; + int *localInt = NULL; + if (!cJSON_IsString(dnn_list_local)) { + ogs_error("OpenAPI_data_restoration_notification_parseFromJSON() failed [dnn_list]"); + goto end; + } + OpenAPI_list_add(dnn_listList, ogs_strdup(dnn_list_local->valuestring)); + } + } + + udm_group_id = cJSON_GetObjectItemCaseSensitive(data_restoration_notificationJSON, "udmGroupId"); + if (udm_group_id) { + if (!cJSON_IsString(udm_group_id) && !cJSON_IsNull(udm_group_id)) { + ogs_error("OpenAPI_data_restoration_notification_parseFromJSON() failed [udm_group_id]"); + goto end; + } + } + + data_restoration_notification_local_var = OpenAPI_data_restoration_notification_create ( + last_replication_time && !cJSON_IsNull(last_replication_time) ? ogs_strdup(last_replication_time->valuestring) : NULL, + recovery_time && !cJSON_IsNull(recovery_time) ? ogs_strdup(recovery_time->valuestring) : NULL, + plmn_id ? plmn_id_local_nonprim : NULL, + supi_ranges ? supi_rangesList : NULL, + gpsi_ranges ? gpsi_rangesList : NULL, + reset_ids ? reset_idsList : NULL, + s_nssai_list ? s_nssai_listList : NULL, + dnn_list ? dnn_listList : NULL, + udm_group_id && !cJSON_IsNull(udm_group_id) ? ogs_strdup(udm_group_id->valuestring) : NULL + ); + + return data_restoration_notification_local_var; +end: + if (plmn_id_local_nonprim) { + OpenAPI_plmn_id_free(plmn_id_local_nonprim); + plmn_id_local_nonprim = NULL; + } + if (supi_rangesList) { + OpenAPI_list_for_each(supi_rangesList, node) { + OpenAPI_supi_range_free(node->data); + } + OpenAPI_list_free(supi_rangesList); + supi_rangesList = NULL; + } + if (gpsi_rangesList) { + OpenAPI_list_for_each(gpsi_rangesList, node) { + OpenAPI_identity_range_free(node->data); + } + OpenAPI_list_free(gpsi_rangesList); + gpsi_rangesList = NULL; + } + if (reset_idsList) { + OpenAPI_list_for_each(reset_idsList, node) { + ogs_free(node->data); + } + OpenAPI_list_free(reset_idsList); + reset_idsList = NULL; + } + if (s_nssai_listList) { + OpenAPI_list_for_each(s_nssai_listList, node) { + OpenAPI_snssai_free(node->data); + } + OpenAPI_list_free(s_nssai_listList); + s_nssai_listList = NULL; + } + if (dnn_listList) { + OpenAPI_list_for_each(dnn_listList, node) { + ogs_free(node->data); + } + OpenAPI_list_free(dnn_listList); + dnn_listList = NULL; + } + return NULL; +} + +OpenAPI_data_restoration_notification_t *OpenAPI_data_restoration_notification_copy(OpenAPI_data_restoration_notification_t *dst, OpenAPI_data_restoration_notification_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_data_restoration_notification_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_data_restoration_notification_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_data_restoration_notification_free(dst); + dst = OpenAPI_data_restoration_notification_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/data_restoration_notification.h b/lib/sbi/openapi/model/data_restoration_notification.h new file mode 100644 index 000000000..3df87c041 --- /dev/null +++ b/lib/sbi/openapi/model/data_restoration_notification.h @@ -0,0 +1,58 @@ +/* + * data_restoration_notification.h + * + * Contains identities representing those UEs potentially affected by a data-loss event at the UDR + */ + +#ifndef _OpenAPI_data_restoration_notification_H_ +#define _OpenAPI_data_restoration_notification_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "identity_range.h" +#include "plmn_id.h" +#include "snssai.h" +#include "supi_range.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_data_restoration_notification_s OpenAPI_data_restoration_notification_t; +typedef struct OpenAPI_data_restoration_notification_s { + char *last_replication_time; + char *recovery_time; + struct OpenAPI_plmn_id_s *plmn_id; + OpenAPI_list_t *supi_ranges; + OpenAPI_list_t *gpsi_ranges; + OpenAPI_list_t *reset_ids; + OpenAPI_list_t *s_nssai_list; + OpenAPI_list_t *dnn_list; + char *udm_group_id; +} OpenAPI_data_restoration_notification_t; + +OpenAPI_data_restoration_notification_t *OpenAPI_data_restoration_notification_create( + char *last_replication_time, + char *recovery_time, + OpenAPI_plmn_id_t *plmn_id, + OpenAPI_list_t *supi_ranges, + OpenAPI_list_t *gpsi_ranges, + OpenAPI_list_t *reset_ids, + OpenAPI_list_t *s_nssai_list, + OpenAPI_list_t *dnn_list, + char *udm_group_id +); +void OpenAPI_data_restoration_notification_free(OpenAPI_data_restoration_notification_t *data_restoration_notification); +OpenAPI_data_restoration_notification_t *OpenAPI_data_restoration_notification_parseFromJSON(cJSON *data_restoration_notificationJSON); +cJSON *OpenAPI_data_restoration_notification_convertToJSON(OpenAPI_data_restoration_notification_t *data_restoration_notification); +OpenAPI_data_restoration_notification_t *OpenAPI_data_restoration_notification_copy(OpenAPI_data_restoration_notification_t *dst, OpenAPI_data_restoration_notification_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_data_restoration_notification_H_ */ + diff --git a/lib/sbi/openapi/model/data_set_id.c b/lib/sbi/openapi/model/data_set_id.c index ebd686556..2c1b907d4 100644 --- a/lib/sbi/openapi/model/data_set_id.c +++ b/lib/sbi/openapi/model/data_set_id.c @@ -6,7 +6,7 @@ char* OpenAPI_data_set_id_ToString(OpenAPI_data_set_id_e data_set_id) { - const char *data_set_idArray[] = { "NULL", "SUBSCRIPTION", "POLICY", "EXPOSURE", "APPLICATION" }; + const char *data_set_idArray[] = { "NULL", "SUBSCRIPTION", "POLICY", "EXPOSURE", "APPLICATION", "A_PFD", "A_AFTI", "A_IPTV", "A_BDT", "A_SPD", "A_EASD", "A_AMI", "P_UE", "P_SCD", "P_BDT", "P_PLMNUE", "P_NSSCD" }; size_t sizeofArray = sizeof(data_set_idArray) / sizeof(data_set_idArray[0]); if (data_set_id < sizeofArray) return (char *)data_set_idArray[data_set_id]; @@ -17,7 +17,7 @@ char* OpenAPI_data_set_id_ToString(OpenAPI_data_set_id_e data_set_id) OpenAPI_data_set_id_e OpenAPI_data_set_id_FromString(char* data_set_id) { int stringToReturn = 0; - const char *data_set_idArray[] = { "NULL", "SUBSCRIPTION", "POLICY", "EXPOSURE", "APPLICATION" }; + const char *data_set_idArray[] = { "NULL", "SUBSCRIPTION", "POLICY", "EXPOSURE", "APPLICATION", "A_PFD", "A_AFTI", "A_IPTV", "A_BDT", "A_SPD", "A_EASD", "A_AMI", "P_UE", "P_SCD", "P_BDT", "P_PLMNUE", "P_NSSCD" }; size_t sizeofArray = sizeof(data_set_idArray) / sizeof(data_set_idArray[0]); while (stringToReturn < sizeofArray) { if (strcmp(data_set_id, data_set_idArray[stringToReturn]) == 0) { diff --git a/lib/sbi/openapi/model/data_set_id.h b/lib/sbi/openapi/model/data_set_id.h index 70a3221dd..c7cefda66 100644 --- a/lib/sbi/openapi/model/data_set_id.h +++ b/lib/sbi/openapi/model/data_set_id.h @@ -17,7 +17,7 @@ extern "C" { #endif -typedef enum { OpenAPI_data_set_id_NULL = 0, OpenAPI_data_set_id_SUBSCRIPTION, OpenAPI_data_set_id_POLICY, OpenAPI_data_set_id_EXPOSURE, OpenAPI_data_set_id_APPLICATION } OpenAPI_data_set_id_e; +typedef enum { OpenAPI_data_set_id_NULL = 0, OpenAPI_data_set_id_SUBSCRIPTION, OpenAPI_data_set_id_POLICY, OpenAPI_data_set_id_EXPOSURE, OpenAPI_data_set_id_APPLICATION, OpenAPI_data_set_id_A_PFD, OpenAPI_data_set_id_A_AFTI, OpenAPI_data_set_id_A_IPTV, OpenAPI_data_set_id_A_BDT, OpenAPI_data_set_id_A_SPD, OpenAPI_data_set_id_A_EASD, OpenAPI_data_set_id_A_AMI, OpenAPI_data_set_id_P_UE, OpenAPI_data_set_id_P_SCD, OpenAPI_data_set_id_P_BDT, OpenAPI_data_set_id_P_PLMNUE, OpenAPI_data_set_id_P_NSSCD } OpenAPI_data_set_id_e; char* OpenAPI_data_set_id_ToString(OpenAPI_data_set_id_e data_set_id); diff --git a/lib/sbi/openapi/model/data_set_name.c b/lib/sbi/openapi/model/data_set_name.c index 8aa5b1c9b..61656b084 100644 --- a/lib/sbi/openapi/model/data_set_name.c +++ b/lib/sbi/openapi/model/data_set_name.c @@ -6,7 +6,7 @@ char* OpenAPI_data_set_name_ToString(OpenAPI_data_set_name_e data_set_name) { - const char *data_set_nameArray[] = { "NULL", "AM", "SMF_SEL", "UEC_SMF", "UEC_SMSF", "SMS_SUB", "SM", "TRACE", "SMS_MNG", "LCS_PRIVACY", "LCS_MO", "UEC_AMF", "V2X" }; + const char *data_set_nameArray[] = { "NULL", "AM", "SMF_SEL", "UEC_SMF", "UEC_SMSF", "SMS_SUB", "SM", "TRACE", "SMS_MNG", "LCS_PRIVACY", "LCS_MO", "UEC_AMF", "V2X", "LCS_BCA", "PROSE", "UC", "MBS" }; size_t sizeofArray = sizeof(data_set_nameArray) / sizeof(data_set_nameArray[0]); if (data_set_name < sizeofArray) return (char *)data_set_nameArray[data_set_name]; @@ -17,7 +17,7 @@ char* OpenAPI_data_set_name_ToString(OpenAPI_data_set_name_e data_set_name) OpenAPI_data_set_name_e OpenAPI_data_set_name_FromString(char* data_set_name) { int stringToReturn = 0; - const char *data_set_nameArray[] = { "NULL", "AM", "SMF_SEL", "UEC_SMF", "UEC_SMSF", "SMS_SUB", "SM", "TRACE", "SMS_MNG", "LCS_PRIVACY", "LCS_MO", "UEC_AMF", "V2X" }; + const char *data_set_nameArray[] = { "NULL", "AM", "SMF_SEL", "UEC_SMF", "UEC_SMSF", "SMS_SUB", "SM", "TRACE", "SMS_MNG", "LCS_PRIVACY", "LCS_MO", "UEC_AMF", "V2X", "LCS_BCA", "PROSE", "UC", "MBS" }; size_t sizeofArray = sizeof(data_set_nameArray) / sizeof(data_set_nameArray[0]); while (stringToReturn < sizeofArray) { if (strcmp(data_set_name, data_set_nameArray[stringToReturn]) == 0) { diff --git a/lib/sbi/openapi/model/data_set_name.h b/lib/sbi/openapi/model/data_set_name.h index c48699b9a..d269f34ef 100644 --- a/lib/sbi/openapi/model/data_set_name.h +++ b/lib/sbi/openapi/model/data_set_name.h @@ -17,7 +17,7 @@ extern "C" { #endif -typedef enum { OpenAPI_data_set_name_NULL = 0, OpenAPI_data_set_name_AM, OpenAPI_data_set_name_SMF_SEL, OpenAPI_data_set_name_UEC_SMF, OpenAPI_data_set_name_UEC_SMSF, OpenAPI_data_set_name_SMS_SUB, OpenAPI_data_set_name_SM, OpenAPI_data_set_name_TRACE, OpenAPI_data_set_name_SMS_MNG, OpenAPI_data_set_name_LCS_PRIVACY, OpenAPI_data_set_name_LCS_MO, OpenAPI_data_set_name_UEC_AMF, OpenAPI_data_set_name_V2X } OpenAPI_data_set_name_e; +typedef enum { OpenAPI_data_set_name_NULL = 0, OpenAPI_data_set_name_AM, OpenAPI_data_set_name_SMF_SEL, OpenAPI_data_set_name_UEC_SMF, OpenAPI_data_set_name_UEC_SMSF, OpenAPI_data_set_name_SMS_SUB, OpenAPI_data_set_name_SM, OpenAPI_data_set_name_TRACE, OpenAPI_data_set_name_SMS_MNG, OpenAPI_data_set_name_LCS_PRIVACY, OpenAPI_data_set_name_LCS_MO, OpenAPI_data_set_name_UEC_AMF, OpenAPI_data_set_name_V2X, OpenAPI_data_set_name_LCS_BCA, OpenAPI_data_set_name_PROSE, OpenAPI_data_set_name_UC, OpenAPI_data_set_name_MBS } OpenAPI_data_set_name_e; char* OpenAPI_data_set_name_ToString(OpenAPI_data_set_name_e data_set_name); diff --git a/lib/sbi/openapi/model/datalink_reporting_configuration_1.c b/lib/sbi/openapi/model/datalink_reporting_configuration_1.c new file mode 100644 index 000000000..a64d14e89 --- /dev/null +++ b/lib/sbi/openapi/model/datalink_reporting_configuration_1.c @@ -0,0 +1,247 @@ + +#include +#include +#include +#include "datalink_reporting_configuration_1.h" + +OpenAPI_datalink_reporting_configuration_1_t *OpenAPI_datalink_reporting_configuration_1_create( + OpenAPI_list_t *ddd_traffic_des, + char *dnn, + OpenAPI_snssai_t *slice, + OpenAPI_list_t *ddd_status_list +) +{ + OpenAPI_datalink_reporting_configuration_1_t *datalink_reporting_configuration_1_local_var = ogs_malloc(sizeof(OpenAPI_datalink_reporting_configuration_1_t)); + ogs_assert(datalink_reporting_configuration_1_local_var); + + datalink_reporting_configuration_1_local_var->ddd_traffic_des = ddd_traffic_des; + datalink_reporting_configuration_1_local_var->dnn = dnn; + datalink_reporting_configuration_1_local_var->slice = slice; + datalink_reporting_configuration_1_local_var->ddd_status_list = ddd_status_list; + + return datalink_reporting_configuration_1_local_var; +} + +void OpenAPI_datalink_reporting_configuration_1_free(OpenAPI_datalink_reporting_configuration_1_t *datalink_reporting_configuration_1) +{ + OpenAPI_lnode_t *node = NULL; + + if (NULL == datalink_reporting_configuration_1) { + return; + } + if (datalink_reporting_configuration_1->ddd_traffic_des) { + OpenAPI_list_for_each(datalink_reporting_configuration_1->ddd_traffic_des, node) { + OpenAPI_ddd_traffic_descriptor_1_free(node->data); + } + OpenAPI_list_free(datalink_reporting_configuration_1->ddd_traffic_des); + datalink_reporting_configuration_1->ddd_traffic_des = NULL; + } + if (datalink_reporting_configuration_1->dnn) { + ogs_free(datalink_reporting_configuration_1->dnn); + datalink_reporting_configuration_1->dnn = NULL; + } + if (datalink_reporting_configuration_1->slice) { + OpenAPI_snssai_free(datalink_reporting_configuration_1->slice); + datalink_reporting_configuration_1->slice = NULL; + } + if (datalink_reporting_configuration_1->ddd_status_list) { + OpenAPI_list_free(datalink_reporting_configuration_1->ddd_status_list); + datalink_reporting_configuration_1->ddd_status_list = NULL; + } + ogs_free(datalink_reporting_configuration_1); +} + +cJSON *OpenAPI_datalink_reporting_configuration_1_convertToJSON(OpenAPI_datalink_reporting_configuration_1_t *datalink_reporting_configuration_1) +{ + cJSON *item = NULL; + OpenAPI_lnode_t *node = NULL; + + if (datalink_reporting_configuration_1 == NULL) { + ogs_error("OpenAPI_datalink_reporting_configuration_1_convertToJSON() failed [DatalinkReportingConfiguration_1]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (datalink_reporting_configuration_1->ddd_traffic_des) { + cJSON *ddd_traffic_desList = cJSON_AddArrayToObject(item, "dddTrafficDes"); + if (ddd_traffic_desList == NULL) { + ogs_error("OpenAPI_datalink_reporting_configuration_1_convertToJSON() failed [ddd_traffic_des]"); + goto end; + } + OpenAPI_list_for_each(datalink_reporting_configuration_1->ddd_traffic_des, node) { + cJSON *itemLocal = OpenAPI_ddd_traffic_descriptor_1_convertToJSON(node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_datalink_reporting_configuration_1_convertToJSON() failed [ddd_traffic_des]"); + goto end; + } + cJSON_AddItemToArray(ddd_traffic_desList, itemLocal); + } + } + + if (datalink_reporting_configuration_1->dnn) { + if (cJSON_AddStringToObject(item, "dnn", datalink_reporting_configuration_1->dnn) == NULL) { + ogs_error("OpenAPI_datalink_reporting_configuration_1_convertToJSON() failed [dnn]"); + goto end; + } + } + + if (datalink_reporting_configuration_1->slice) { + cJSON *slice_local_JSON = OpenAPI_snssai_convertToJSON(datalink_reporting_configuration_1->slice); + if (slice_local_JSON == NULL) { + ogs_error("OpenAPI_datalink_reporting_configuration_1_convertToJSON() failed [slice]"); + goto end; + } + cJSON_AddItemToObject(item, "slice", slice_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_datalink_reporting_configuration_1_convertToJSON() failed [slice]"); + goto end; + } + } + + if (datalink_reporting_configuration_1->ddd_status_list != OpenAPI_dl_data_delivery_status_NULL) { + cJSON *ddd_status_listList = cJSON_AddArrayToObject(item, "dddStatusList"); + if (ddd_status_listList == NULL) { + ogs_error("OpenAPI_datalink_reporting_configuration_1_convertToJSON() failed [ddd_status_list]"); + goto end; + } + OpenAPI_list_for_each(datalink_reporting_configuration_1->ddd_status_list, node) { + if (cJSON_AddStringToObject(ddd_status_listList, "", OpenAPI_dl_data_delivery_status_ToString((intptr_t)node->data)) == NULL) { + ogs_error("OpenAPI_datalink_reporting_configuration_1_convertToJSON() failed [ddd_status_list]"); + goto end; + } + } + } + +end: + return item; +} + +OpenAPI_datalink_reporting_configuration_1_t *OpenAPI_datalink_reporting_configuration_1_parseFromJSON(cJSON *datalink_reporting_configuration_1JSON) +{ + OpenAPI_datalink_reporting_configuration_1_t *datalink_reporting_configuration_1_local_var = NULL; + OpenAPI_lnode_t *node = NULL; + cJSON *ddd_traffic_des = NULL; + OpenAPI_list_t *ddd_traffic_desList = NULL; + cJSON *dnn = NULL; + cJSON *slice = NULL; + OpenAPI_snssai_t *slice_local_nonprim = NULL; + cJSON *ddd_status_list = NULL; + OpenAPI_list_t *ddd_status_listList = NULL; + ddd_traffic_des = cJSON_GetObjectItemCaseSensitive(datalink_reporting_configuration_1JSON, "dddTrafficDes"); + if (ddd_traffic_des) { + cJSON *ddd_traffic_des_local = NULL; + if (!cJSON_IsArray(ddd_traffic_des)) { + ogs_error("OpenAPI_datalink_reporting_configuration_1_parseFromJSON() failed [ddd_traffic_des]"); + goto end; + } + + ddd_traffic_desList = OpenAPI_list_create(); + + cJSON_ArrayForEach(ddd_traffic_des_local, ddd_traffic_des) { + if (!cJSON_IsObject(ddd_traffic_des_local)) { + ogs_error("OpenAPI_datalink_reporting_configuration_1_parseFromJSON() failed [ddd_traffic_des]"); + goto end; + } + OpenAPI_ddd_traffic_descriptor_1_t *ddd_traffic_desItem = OpenAPI_ddd_traffic_descriptor_1_parseFromJSON(ddd_traffic_des_local); + if (!ddd_traffic_desItem) { + ogs_error("No ddd_traffic_desItem"); + OpenAPI_list_free(ddd_traffic_desList); + goto end; + } + OpenAPI_list_add(ddd_traffic_desList, ddd_traffic_desItem); + } + } + + dnn = cJSON_GetObjectItemCaseSensitive(datalink_reporting_configuration_1JSON, "dnn"); + if (dnn) { + if (!cJSON_IsString(dnn) && !cJSON_IsNull(dnn)) { + ogs_error("OpenAPI_datalink_reporting_configuration_1_parseFromJSON() failed [dnn]"); + goto end; + } + } + + slice = cJSON_GetObjectItemCaseSensitive(datalink_reporting_configuration_1JSON, "slice"); + if (slice) { + slice_local_nonprim = OpenAPI_snssai_parseFromJSON(slice); + } + + ddd_status_list = cJSON_GetObjectItemCaseSensitive(datalink_reporting_configuration_1JSON, "dddStatusList"); + if (ddd_status_list) { + cJSON *ddd_status_list_local = NULL; + if (!cJSON_IsArray(ddd_status_list)) { + ogs_error("OpenAPI_datalink_reporting_configuration_1_parseFromJSON() failed [ddd_status_list]"); + goto end; + } + + ddd_status_listList = OpenAPI_list_create(); + + cJSON_ArrayForEach(ddd_status_list_local, ddd_status_list) { + if (!cJSON_IsString(ddd_status_list_local)) { + ogs_error("OpenAPI_datalink_reporting_configuration_1_parseFromJSON() failed [ddd_status_list]"); + goto end; + } + OpenAPI_list_add(ddd_status_listList, (void *)OpenAPI_dl_data_delivery_status_FromString(ddd_status_list_local->valuestring)); + } + } + + datalink_reporting_configuration_1_local_var = OpenAPI_datalink_reporting_configuration_1_create ( + ddd_traffic_des ? ddd_traffic_desList : NULL, + dnn && !cJSON_IsNull(dnn) ? ogs_strdup(dnn->valuestring) : NULL, + slice ? slice_local_nonprim : NULL, + ddd_status_list ? ddd_status_listList : NULL + ); + + return datalink_reporting_configuration_1_local_var; +end: + if (ddd_traffic_desList) { + OpenAPI_list_for_each(ddd_traffic_desList, node) { + OpenAPI_ddd_traffic_descriptor_1_free(node->data); + } + OpenAPI_list_free(ddd_traffic_desList); + ddd_traffic_desList = NULL; + } + if (slice_local_nonprim) { + OpenAPI_snssai_free(slice_local_nonprim); + slice_local_nonprim = NULL; + } + if (ddd_status_listList) { + OpenAPI_list_free(ddd_status_listList); + ddd_status_listList = NULL; + } + return NULL; +} + +OpenAPI_datalink_reporting_configuration_1_t *OpenAPI_datalink_reporting_configuration_1_copy(OpenAPI_datalink_reporting_configuration_1_t *dst, OpenAPI_datalink_reporting_configuration_1_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_datalink_reporting_configuration_1_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_datalink_reporting_configuration_1_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_datalink_reporting_configuration_1_free(dst); + dst = OpenAPI_datalink_reporting_configuration_1_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/datalink_reporting_configuration_1.h b/lib/sbi/openapi/model/datalink_reporting_configuration_1.h new file mode 100644 index 000000000..1f1073309 --- /dev/null +++ b/lib/sbi/openapi/model/datalink_reporting_configuration_1.h @@ -0,0 +1,47 @@ +/* + * datalink_reporting_configuration_1.h + * + * + */ + +#ifndef _OpenAPI_datalink_reporting_configuration_1_H_ +#define _OpenAPI_datalink_reporting_configuration_1_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "ddd_traffic_descriptor_1.h" +#include "dl_data_delivery_status.h" +#include "snssai.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_datalink_reporting_configuration_1_s OpenAPI_datalink_reporting_configuration_1_t; +typedef struct OpenAPI_datalink_reporting_configuration_1_s { + OpenAPI_list_t *ddd_traffic_des; + char *dnn; + struct OpenAPI_snssai_s *slice; + OpenAPI_list_t *ddd_status_list; +} OpenAPI_datalink_reporting_configuration_1_t; + +OpenAPI_datalink_reporting_configuration_1_t *OpenAPI_datalink_reporting_configuration_1_create( + OpenAPI_list_t *ddd_traffic_des, + char *dnn, + OpenAPI_snssai_t *slice, + OpenAPI_list_t *ddd_status_list +); +void OpenAPI_datalink_reporting_configuration_1_free(OpenAPI_datalink_reporting_configuration_1_t *datalink_reporting_configuration_1); +OpenAPI_datalink_reporting_configuration_1_t *OpenAPI_datalink_reporting_configuration_1_parseFromJSON(cJSON *datalink_reporting_configuration_1JSON); +cJSON *OpenAPI_datalink_reporting_configuration_1_convertToJSON(OpenAPI_datalink_reporting_configuration_1_t *datalink_reporting_configuration_1); +OpenAPI_datalink_reporting_configuration_1_t *OpenAPI_datalink_reporting_configuration_1_copy(OpenAPI_datalink_reporting_configuration_1_t *dst, OpenAPI_datalink_reporting_configuration_1_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_datalink_reporting_configuration_1_H_ */ + diff --git a/lib/sbi/openapi/model/dataset_statistical_property.c b/lib/sbi/openapi/model/dataset_statistical_property.c new file mode 100644 index 000000000..625af8276 --- /dev/null +++ b/lib/sbi/openapi/model/dataset_statistical_property.c @@ -0,0 +1,87 @@ + +#include +#include +#include +#include "dataset_statistical_property.h" + +OpenAPI_dataset_statistical_property_t *OpenAPI_dataset_statistical_property_create( +) +{ + OpenAPI_dataset_statistical_property_t *dataset_statistical_property_local_var = ogs_malloc(sizeof(OpenAPI_dataset_statistical_property_t)); + ogs_assert(dataset_statistical_property_local_var); + + + return dataset_statistical_property_local_var; +} + +void OpenAPI_dataset_statistical_property_free(OpenAPI_dataset_statistical_property_t *dataset_statistical_property) +{ + OpenAPI_lnode_t *node = NULL; + + if (NULL == dataset_statistical_property) { + return; + } + ogs_free(dataset_statistical_property); +} + +cJSON *OpenAPI_dataset_statistical_property_convertToJSON(OpenAPI_dataset_statistical_property_t *dataset_statistical_property) +{ + cJSON *item = NULL; + OpenAPI_lnode_t *node = NULL; + + if (dataset_statistical_property == NULL) { + ogs_error("OpenAPI_dataset_statistical_property_convertToJSON() failed [DatasetStatisticalProperty]"); + return NULL; + } + + item = cJSON_CreateObject(); +end: + return item; +} + +OpenAPI_dataset_statistical_property_t *OpenAPI_dataset_statistical_property_parseFromJSON(cJSON *dataset_statistical_propertyJSON) +{ + OpenAPI_dataset_statistical_property_t *dataset_statistical_property_local_var = NULL; + OpenAPI_lnode_t *node = NULL; + dataset_statistical_property_local_var = OpenAPI_dataset_statistical_property_create ( + ); + + return dataset_statistical_property_local_var; +end: + return NULL; +} + +OpenAPI_dataset_statistical_property_t *OpenAPI_dataset_statistical_property_copy(OpenAPI_dataset_statistical_property_t *dst, OpenAPI_dataset_statistical_property_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_dataset_statistical_property_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_dataset_statistical_property_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_dataset_statistical_property_free(dst); + dst = OpenAPI_dataset_statistical_property_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/dataset_statistical_property.h b/lib/sbi/openapi/model/dataset_statistical_property.h new file mode 100644 index 000000000..7e62f4501 --- /dev/null +++ b/lib/sbi/openapi/model/dataset_statistical_property.h @@ -0,0 +1,37 @@ +/* + * dataset_statistical_property.h + * + * Possible values are: - UNIFORM_DIST_DATA: Indicates the use of data samples that are uniformly distributed according to the different aspects of the requested analytics. - NO_OUTLIERS: Indicates that the data samples shall disregard data samples that are at the extreme boundaries of the value range. + */ + +#ifndef _OpenAPI_dataset_statistical_property_H_ +#define _OpenAPI_dataset_statistical_property_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "dataset_statistical_property_any_of.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_dataset_statistical_property_s OpenAPI_dataset_statistical_property_t; +typedef struct OpenAPI_dataset_statistical_property_s { +} OpenAPI_dataset_statistical_property_t; + +OpenAPI_dataset_statistical_property_t *OpenAPI_dataset_statistical_property_create( +); +void OpenAPI_dataset_statistical_property_free(OpenAPI_dataset_statistical_property_t *dataset_statistical_property); +OpenAPI_dataset_statistical_property_t *OpenAPI_dataset_statistical_property_parseFromJSON(cJSON *dataset_statistical_propertyJSON); +cJSON *OpenAPI_dataset_statistical_property_convertToJSON(OpenAPI_dataset_statistical_property_t *dataset_statistical_property); +OpenAPI_dataset_statistical_property_t *OpenAPI_dataset_statistical_property_copy(OpenAPI_dataset_statistical_property_t *dst, OpenAPI_dataset_statistical_property_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_dataset_statistical_property_H_ */ + diff --git a/lib/sbi/openapi/model/dataset_statistical_property_any_of.c b/lib/sbi/openapi/model/dataset_statistical_property_any_of.c new file mode 100644 index 000000000..22157db58 --- /dev/null +++ b/lib/sbi/openapi/model/dataset_statistical_property_any_of.c @@ -0,0 +1,30 @@ + +#include +#include +#include +#include "dataset_statistical_property_any_of.h" + +char* OpenAPI_dataset_statistical_property_any_of_ToString(OpenAPI_dataset_statistical_property_any_of_e dataset_statistical_property_any_of) +{ + const char *dataset_statistical_property_any_ofArray[] = { "NULL", "UNIFORM_DIST_DATA", "NO_OUTLIERS" }; + size_t sizeofArray = sizeof(dataset_statistical_property_any_ofArray) / sizeof(dataset_statistical_property_any_ofArray[0]); + if (dataset_statistical_property_any_of < sizeofArray) + return (char *)dataset_statistical_property_any_ofArray[dataset_statistical_property_any_of]; + else + return (char *)"Unknown"; +} + +OpenAPI_dataset_statistical_property_any_of_e OpenAPI_dataset_statistical_property_any_of_FromString(char* dataset_statistical_property_any_of) +{ + int stringToReturn = 0; + const char *dataset_statistical_property_any_ofArray[] = { "NULL", "UNIFORM_DIST_DATA", "NO_OUTLIERS" }; + size_t sizeofArray = sizeof(dataset_statistical_property_any_ofArray) / sizeof(dataset_statistical_property_any_ofArray[0]); + while (stringToReturn < sizeofArray) { + if (strcmp(dataset_statistical_property_any_of, dataset_statistical_property_any_ofArray[stringToReturn]) == 0) { + return stringToReturn; + } + stringToReturn++; + } + return 0; +} + diff --git a/lib/sbi/openapi/model/dataset_statistical_property_any_of.h b/lib/sbi/openapi/model/dataset_statistical_property_any_of.h new file mode 100644 index 000000000..7f535c832 --- /dev/null +++ b/lib/sbi/openapi/model/dataset_statistical_property_any_of.h @@ -0,0 +1,31 @@ +/* + * dataset_statistical_property_any_of.h + * + * + */ + +#ifndef _OpenAPI_dataset_statistical_property_any_of_H_ +#define _OpenAPI_dataset_statistical_property_any_of_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef enum { OpenAPI_dataset_statistical_property_any_of_NULL = 0, OpenAPI_dataset_statistical_property_any_of_UNIFORM_DIST_DATA, OpenAPI_dataset_statistical_property_any_of_NO_OUTLIERS } OpenAPI_dataset_statistical_property_any_of_e; + +char* OpenAPI_dataset_statistical_property_any_of_ToString(OpenAPI_dataset_statistical_property_any_of_e dataset_statistical_property_any_of); + +OpenAPI_dataset_statistical_property_any_of_e OpenAPI_dataset_statistical_property_any_of_FromString(char* dataset_statistical_property_any_of); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_dataset_statistical_property_any_of_H_ */ + diff --git a/lib/sbi/openapi/model/dccf_cond.c b/lib/sbi/openapi/model/dccf_cond.c new file mode 100644 index 000000000..08344f0e5 --- /dev/null +++ b/lib/sbi/openapi/model/dccf_cond.c @@ -0,0 +1,355 @@ + +#include +#include +#include +#include "dccf_cond.h" + +char *OpenAPI_condition_typedccf_cond_ToString(OpenAPI_dccf_cond_condition_type_e condition_type) +{ + const char *condition_typeArray[] = { "NULL", "DCCF_COND" }; + size_t sizeofArray = sizeof(condition_typeArray) / sizeof(condition_typeArray[0]); + if (condition_type < sizeofArray) + return (char *)condition_typeArray[condition_type]; + else + return (char *)"Unknown"; +} + +OpenAPI_dccf_cond_condition_type_e OpenAPI_condition_typedccf_cond_FromString(char* condition_type) +{ + int stringToReturn = 0; + const char *condition_typeArray[] = { "NULL", "DCCF_COND" }; + size_t sizeofArray = sizeof(condition_typeArray) / sizeof(condition_typeArray[0]); + while (stringToReturn < sizeofArray) { + if (strcmp(condition_type, condition_typeArray[stringToReturn]) == 0) { + return stringToReturn; + } + stringToReturn++; + } + return 0; +} +OpenAPI_dccf_cond_t *OpenAPI_dccf_cond_create( + OpenAPI_dccf_cond_condition_type_e condition_type, + OpenAPI_list_t *tai_list, + OpenAPI_list_t *tai_range_list, + OpenAPI_list_t *serving_nf_type_list, + OpenAPI_list_t *serving_nf_set_id_list +) +{ + OpenAPI_dccf_cond_t *dccf_cond_local_var = ogs_malloc(sizeof(OpenAPI_dccf_cond_t)); + ogs_assert(dccf_cond_local_var); + + dccf_cond_local_var->condition_type = condition_type; + dccf_cond_local_var->tai_list = tai_list; + dccf_cond_local_var->tai_range_list = tai_range_list; + dccf_cond_local_var->serving_nf_type_list = serving_nf_type_list; + dccf_cond_local_var->serving_nf_set_id_list = serving_nf_set_id_list; + + return dccf_cond_local_var; +} + +void OpenAPI_dccf_cond_free(OpenAPI_dccf_cond_t *dccf_cond) +{ + OpenAPI_lnode_t *node = NULL; + + if (NULL == dccf_cond) { + return; + } + if (dccf_cond->tai_list) { + OpenAPI_list_for_each(dccf_cond->tai_list, node) { + OpenAPI_tai_free(node->data); + } + OpenAPI_list_free(dccf_cond->tai_list); + dccf_cond->tai_list = NULL; + } + if (dccf_cond->tai_range_list) { + OpenAPI_list_for_each(dccf_cond->tai_range_list, node) { + OpenAPI_tai_range_free(node->data); + } + OpenAPI_list_free(dccf_cond->tai_range_list); + dccf_cond->tai_range_list = NULL; + } + if (dccf_cond->serving_nf_type_list) { + OpenAPI_list_free(dccf_cond->serving_nf_type_list); + dccf_cond->serving_nf_type_list = NULL; + } + if (dccf_cond->serving_nf_set_id_list) { + OpenAPI_list_for_each(dccf_cond->serving_nf_set_id_list, node) { + ogs_free(node->data); + } + OpenAPI_list_free(dccf_cond->serving_nf_set_id_list); + dccf_cond->serving_nf_set_id_list = NULL; + } + ogs_free(dccf_cond); +} + +cJSON *OpenAPI_dccf_cond_convertToJSON(OpenAPI_dccf_cond_t *dccf_cond) +{ + cJSON *item = NULL; + OpenAPI_lnode_t *node = NULL; + + if (dccf_cond == NULL) { + ogs_error("OpenAPI_dccf_cond_convertToJSON() failed [DccfCond]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (dccf_cond->condition_type == OpenAPI_dccf_cond_CONDITIONTYPE_NULL) { + ogs_error("OpenAPI_dccf_cond_convertToJSON() failed [condition_type]"); + return NULL; + } + if (cJSON_AddStringToObject(item, "conditionType", OpenAPI_condition_typedccf_cond_ToString(dccf_cond->condition_type)) == NULL) { + ogs_error("OpenAPI_dccf_cond_convertToJSON() failed [condition_type]"); + goto end; + } + + if (dccf_cond->tai_list) { + cJSON *tai_listList = cJSON_AddArrayToObject(item, "taiList"); + if (tai_listList == NULL) { + ogs_error("OpenAPI_dccf_cond_convertToJSON() failed [tai_list]"); + goto end; + } + OpenAPI_list_for_each(dccf_cond->tai_list, node) { + cJSON *itemLocal = OpenAPI_tai_convertToJSON(node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_dccf_cond_convertToJSON() failed [tai_list]"); + goto end; + } + cJSON_AddItemToArray(tai_listList, itemLocal); + } + } + + if (dccf_cond->tai_range_list) { + cJSON *tai_range_listList = cJSON_AddArrayToObject(item, "taiRangeList"); + if (tai_range_listList == NULL) { + ogs_error("OpenAPI_dccf_cond_convertToJSON() failed [tai_range_list]"); + goto end; + } + OpenAPI_list_for_each(dccf_cond->tai_range_list, node) { + cJSON *itemLocal = OpenAPI_tai_range_convertToJSON(node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_dccf_cond_convertToJSON() failed [tai_range_list]"); + goto end; + } + cJSON_AddItemToArray(tai_range_listList, itemLocal); + } + } + + if (dccf_cond->serving_nf_type_list != OpenAPI_nf_type_NULL) { + cJSON *serving_nf_type_listList = cJSON_AddArrayToObject(item, "servingNfTypeList"); + if (serving_nf_type_listList == NULL) { + ogs_error("OpenAPI_dccf_cond_convertToJSON() failed [serving_nf_type_list]"); + goto end; + } + OpenAPI_list_for_each(dccf_cond->serving_nf_type_list, node) { + if (cJSON_AddStringToObject(serving_nf_type_listList, "", OpenAPI_nf_type_ToString((intptr_t)node->data)) == NULL) { + ogs_error("OpenAPI_dccf_cond_convertToJSON() failed [serving_nf_type_list]"); + goto end; + } + } + } + + if (dccf_cond->serving_nf_set_id_list) { + cJSON *serving_nf_set_id_listList = cJSON_AddArrayToObject(item, "servingNfSetIdList"); + if (serving_nf_set_id_listList == NULL) { + ogs_error("OpenAPI_dccf_cond_convertToJSON() failed [serving_nf_set_id_list]"); + goto end; + } + OpenAPI_list_for_each(dccf_cond->serving_nf_set_id_list, node) { + if (cJSON_AddStringToObject(serving_nf_set_id_listList, "", (char*)node->data) == NULL) { + ogs_error("OpenAPI_dccf_cond_convertToJSON() failed [serving_nf_set_id_list]"); + goto end; + } + } + } + +end: + return item; +} + +OpenAPI_dccf_cond_t *OpenAPI_dccf_cond_parseFromJSON(cJSON *dccf_condJSON) +{ + OpenAPI_dccf_cond_t *dccf_cond_local_var = NULL; + OpenAPI_lnode_t *node = NULL; + cJSON *condition_type = NULL; + OpenAPI_dccf_cond_condition_type_e condition_typeVariable = 0; + cJSON *tai_list = NULL; + OpenAPI_list_t *tai_listList = NULL; + cJSON *tai_range_list = NULL; + OpenAPI_list_t *tai_range_listList = NULL; + cJSON *serving_nf_type_list = NULL; + OpenAPI_list_t *serving_nf_type_listList = NULL; + cJSON *serving_nf_set_id_list = NULL; + OpenAPI_list_t *serving_nf_set_id_listList = NULL; + condition_type = cJSON_GetObjectItemCaseSensitive(dccf_condJSON, "conditionType"); + if (!condition_type) { + ogs_error("OpenAPI_dccf_cond_parseFromJSON() failed [condition_type]"); + goto end; + } + if (!cJSON_IsString(condition_type)) { + ogs_error("OpenAPI_dccf_cond_parseFromJSON() failed [condition_type]"); + goto end; + } + condition_typeVariable = OpenAPI_condition_typedccf_cond_FromString(condition_type->valuestring); + + tai_list = cJSON_GetObjectItemCaseSensitive(dccf_condJSON, "taiList"); + if (tai_list) { + cJSON *tai_list_local = NULL; + if (!cJSON_IsArray(tai_list)) { + ogs_error("OpenAPI_dccf_cond_parseFromJSON() failed [tai_list]"); + goto end; + } + + tai_listList = OpenAPI_list_create(); + + cJSON_ArrayForEach(tai_list_local, tai_list) { + if (!cJSON_IsObject(tai_list_local)) { + ogs_error("OpenAPI_dccf_cond_parseFromJSON() failed [tai_list]"); + goto end; + } + OpenAPI_tai_t *tai_listItem = OpenAPI_tai_parseFromJSON(tai_list_local); + if (!tai_listItem) { + ogs_error("No tai_listItem"); + OpenAPI_list_free(tai_listList); + goto end; + } + OpenAPI_list_add(tai_listList, tai_listItem); + } + } + + tai_range_list = cJSON_GetObjectItemCaseSensitive(dccf_condJSON, "taiRangeList"); + if (tai_range_list) { + cJSON *tai_range_list_local = NULL; + if (!cJSON_IsArray(tai_range_list)) { + ogs_error("OpenAPI_dccf_cond_parseFromJSON() failed [tai_range_list]"); + goto end; + } + + tai_range_listList = OpenAPI_list_create(); + + cJSON_ArrayForEach(tai_range_list_local, tai_range_list) { + if (!cJSON_IsObject(tai_range_list_local)) { + ogs_error("OpenAPI_dccf_cond_parseFromJSON() failed [tai_range_list]"); + goto end; + } + OpenAPI_tai_range_t *tai_range_listItem = OpenAPI_tai_range_parseFromJSON(tai_range_list_local); + if (!tai_range_listItem) { + ogs_error("No tai_range_listItem"); + OpenAPI_list_free(tai_range_listList); + goto end; + } + OpenAPI_list_add(tai_range_listList, tai_range_listItem); + } + } + + serving_nf_type_list = cJSON_GetObjectItemCaseSensitive(dccf_condJSON, "servingNfTypeList"); + if (serving_nf_type_list) { + cJSON *serving_nf_type_list_local = NULL; + if (!cJSON_IsArray(serving_nf_type_list)) { + ogs_error("OpenAPI_dccf_cond_parseFromJSON() failed [serving_nf_type_list]"); + goto end; + } + + serving_nf_type_listList = OpenAPI_list_create(); + + cJSON_ArrayForEach(serving_nf_type_list_local, serving_nf_type_list) { + if (!cJSON_IsString(serving_nf_type_list_local)) { + ogs_error("OpenAPI_dccf_cond_parseFromJSON() failed [serving_nf_type_list]"); + goto end; + } + OpenAPI_list_add(serving_nf_type_listList, (void *)OpenAPI_nf_type_FromString(serving_nf_type_list_local->valuestring)); + } + } + + serving_nf_set_id_list = cJSON_GetObjectItemCaseSensitive(dccf_condJSON, "servingNfSetIdList"); + if (serving_nf_set_id_list) { + cJSON *serving_nf_set_id_list_local = NULL; + if (!cJSON_IsArray(serving_nf_set_id_list)) { + ogs_error("OpenAPI_dccf_cond_parseFromJSON() failed [serving_nf_set_id_list]"); + goto end; + } + + serving_nf_set_id_listList = OpenAPI_list_create(); + + cJSON_ArrayForEach(serving_nf_set_id_list_local, serving_nf_set_id_list) { + double *localDouble = NULL; + int *localInt = NULL; + if (!cJSON_IsString(serving_nf_set_id_list_local)) { + ogs_error("OpenAPI_dccf_cond_parseFromJSON() failed [serving_nf_set_id_list]"); + goto end; + } + OpenAPI_list_add(serving_nf_set_id_listList, ogs_strdup(serving_nf_set_id_list_local->valuestring)); + } + } + + dccf_cond_local_var = OpenAPI_dccf_cond_create ( + condition_typeVariable, + tai_list ? tai_listList : NULL, + tai_range_list ? tai_range_listList : NULL, + serving_nf_type_list ? serving_nf_type_listList : NULL, + serving_nf_set_id_list ? serving_nf_set_id_listList : NULL + ); + + return dccf_cond_local_var; +end: + if (tai_listList) { + OpenAPI_list_for_each(tai_listList, node) { + OpenAPI_tai_free(node->data); + } + OpenAPI_list_free(tai_listList); + tai_listList = NULL; + } + if (tai_range_listList) { + OpenAPI_list_for_each(tai_range_listList, node) { + OpenAPI_tai_range_free(node->data); + } + OpenAPI_list_free(tai_range_listList); + tai_range_listList = NULL; + } + if (serving_nf_type_listList) { + OpenAPI_list_free(serving_nf_type_listList); + serving_nf_type_listList = NULL; + } + if (serving_nf_set_id_listList) { + OpenAPI_list_for_each(serving_nf_set_id_listList, node) { + ogs_free(node->data); + } + OpenAPI_list_free(serving_nf_set_id_listList); + serving_nf_set_id_listList = NULL; + } + return NULL; +} + +OpenAPI_dccf_cond_t *OpenAPI_dccf_cond_copy(OpenAPI_dccf_cond_t *dst, OpenAPI_dccf_cond_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_dccf_cond_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_dccf_cond_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_dccf_cond_free(dst); + dst = OpenAPI_dccf_cond_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/dccf_cond.h b/lib/sbi/openapi/model/dccf_cond.h new file mode 100644 index 000000000..cdbb1fe7e --- /dev/null +++ b/lib/sbi/openapi/model/dccf_cond.h @@ -0,0 +1,54 @@ +/* + * dccf_cond.h + * + * Subscription to a set of NF Instances (DCCFs), identified by NF types, NF Set Id(s) or DCCF Serving Area information, i.e. list of TAIs served by the DCCF + */ + +#ifndef _OpenAPI_dccf_cond_H_ +#define _OpenAPI_dccf_cond_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "nf_type.h" +#include "tai.h" +#include "tai_range.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_dccf_cond_s OpenAPI_dccf_cond_t; +typedef enum { OpenAPI_dccf_cond_CONDITIONTYPE_NULL = 0, OpenAPI_dccf_cond_CONDITIONTYPE_DCCF_COND } OpenAPI_dccf_cond_condition_type_e; + +char* OpenAPI_dccf_cond_condition_type_ToString(OpenAPI_dccf_cond_condition_type_e condition_type); + +OpenAPI_dccf_cond_condition_type_e OpenAPI_dccf_cond_condition_type_FromString(char* condition_type); +typedef struct OpenAPI_dccf_cond_s { + OpenAPI_dccf_cond_condition_type_e condition_type; + OpenAPI_list_t *tai_list; + OpenAPI_list_t *tai_range_list; + OpenAPI_list_t *serving_nf_type_list; + OpenAPI_list_t *serving_nf_set_id_list; +} OpenAPI_dccf_cond_t; + +OpenAPI_dccf_cond_t *OpenAPI_dccf_cond_create( + OpenAPI_dccf_cond_condition_type_e condition_type, + OpenAPI_list_t *tai_list, + OpenAPI_list_t *tai_range_list, + OpenAPI_list_t *serving_nf_type_list, + OpenAPI_list_t *serving_nf_set_id_list +); +void OpenAPI_dccf_cond_free(OpenAPI_dccf_cond_t *dccf_cond); +OpenAPI_dccf_cond_t *OpenAPI_dccf_cond_parseFromJSON(cJSON *dccf_condJSON); +cJSON *OpenAPI_dccf_cond_convertToJSON(OpenAPI_dccf_cond_t *dccf_cond); +OpenAPI_dccf_cond_t *OpenAPI_dccf_cond_copy(OpenAPI_dccf_cond_t *dst, OpenAPI_dccf_cond_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_dccf_cond_H_ */ + diff --git a/lib/sbi/openapi/model/dccf_info.c b/lib/sbi/openapi/model/dccf_info.c new file mode 100644 index 000000000..6196b5896 --- /dev/null +++ b/lib/sbi/openapi/model/dccf_info.c @@ -0,0 +1,307 @@ + +#include +#include +#include +#include "dccf_info.h" + +OpenAPI_dccf_info_t *OpenAPI_dccf_info_create( + OpenAPI_list_t *serving_nf_type_list, + OpenAPI_list_t *serving_nf_set_id_list, + OpenAPI_list_t *tai_list, + OpenAPI_list_t *tai_range_list +) +{ + OpenAPI_dccf_info_t *dccf_info_local_var = ogs_malloc(sizeof(OpenAPI_dccf_info_t)); + ogs_assert(dccf_info_local_var); + + dccf_info_local_var->serving_nf_type_list = serving_nf_type_list; + dccf_info_local_var->serving_nf_set_id_list = serving_nf_set_id_list; + dccf_info_local_var->tai_list = tai_list; + dccf_info_local_var->tai_range_list = tai_range_list; + + return dccf_info_local_var; +} + +void OpenAPI_dccf_info_free(OpenAPI_dccf_info_t *dccf_info) +{ + OpenAPI_lnode_t *node = NULL; + + if (NULL == dccf_info) { + return; + } + if (dccf_info->serving_nf_type_list) { + OpenAPI_list_free(dccf_info->serving_nf_type_list); + dccf_info->serving_nf_type_list = NULL; + } + if (dccf_info->serving_nf_set_id_list) { + OpenAPI_list_for_each(dccf_info->serving_nf_set_id_list, node) { + ogs_free(node->data); + } + OpenAPI_list_free(dccf_info->serving_nf_set_id_list); + dccf_info->serving_nf_set_id_list = NULL; + } + if (dccf_info->tai_list) { + OpenAPI_list_for_each(dccf_info->tai_list, node) { + OpenAPI_tai_free(node->data); + } + OpenAPI_list_free(dccf_info->tai_list); + dccf_info->tai_list = NULL; + } + if (dccf_info->tai_range_list) { + OpenAPI_list_for_each(dccf_info->tai_range_list, node) { + OpenAPI_tai_range_free(node->data); + } + OpenAPI_list_free(dccf_info->tai_range_list); + dccf_info->tai_range_list = NULL; + } + ogs_free(dccf_info); +} + +cJSON *OpenAPI_dccf_info_convertToJSON(OpenAPI_dccf_info_t *dccf_info) +{ + cJSON *item = NULL; + OpenAPI_lnode_t *node = NULL; + + if (dccf_info == NULL) { + ogs_error("OpenAPI_dccf_info_convertToJSON() failed [DccfInfo]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (dccf_info->serving_nf_type_list != OpenAPI_nf_type_NULL) { + cJSON *serving_nf_type_listList = cJSON_AddArrayToObject(item, "servingNfTypeList"); + if (serving_nf_type_listList == NULL) { + ogs_error("OpenAPI_dccf_info_convertToJSON() failed [serving_nf_type_list]"); + goto end; + } + OpenAPI_list_for_each(dccf_info->serving_nf_type_list, node) { + if (cJSON_AddStringToObject(serving_nf_type_listList, "", OpenAPI_nf_type_ToString((intptr_t)node->data)) == NULL) { + ogs_error("OpenAPI_dccf_info_convertToJSON() failed [serving_nf_type_list]"); + goto end; + } + } + } + + if (dccf_info->serving_nf_set_id_list) { + cJSON *serving_nf_set_id_listList = cJSON_AddArrayToObject(item, "servingNfSetIdList"); + if (serving_nf_set_id_listList == NULL) { + ogs_error("OpenAPI_dccf_info_convertToJSON() failed [serving_nf_set_id_list]"); + goto end; + } + OpenAPI_list_for_each(dccf_info->serving_nf_set_id_list, node) { + if (cJSON_AddStringToObject(serving_nf_set_id_listList, "", (char*)node->data) == NULL) { + ogs_error("OpenAPI_dccf_info_convertToJSON() failed [serving_nf_set_id_list]"); + goto end; + } + } + } + + if (dccf_info->tai_list) { + cJSON *tai_listList = cJSON_AddArrayToObject(item, "taiList"); + if (tai_listList == NULL) { + ogs_error("OpenAPI_dccf_info_convertToJSON() failed [tai_list]"); + goto end; + } + OpenAPI_list_for_each(dccf_info->tai_list, node) { + cJSON *itemLocal = OpenAPI_tai_convertToJSON(node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_dccf_info_convertToJSON() failed [tai_list]"); + goto end; + } + cJSON_AddItemToArray(tai_listList, itemLocal); + } + } + + if (dccf_info->tai_range_list) { + cJSON *tai_range_listList = cJSON_AddArrayToObject(item, "taiRangeList"); + if (tai_range_listList == NULL) { + ogs_error("OpenAPI_dccf_info_convertToJSON() failed [tai_range_list]"); + goto end; + } + OpenAPI_list_for_each(dccf_info->tai_range_list, node) { + cJSON *itemLocal = OpenAPI_tai_range_convertToJSON(node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_dccf_info_convertToJSON() failed [tai_range_list]"); + goto end; + } + cJSON_AddItemToArray(tai_range_listList, itemLocal); + } + } + +end: + return item; +} + +OpenAPI_dccf_info_t *OpenAPI_dccf_info_parseFromJSON(cJSON *dccf_infoJSON) +{ + OpenAPI_dccf_info_t *dccf_info_local_var = NULL; + OpenAPI_lnode_t *node = NULL; + cJSON *serving_nf_type_list = NULL; + OpenAPI_list_t *serving_nf_type_listList = NULL; + cJSON *serving_nf_set_id_list = NULL; + OpenAPI_list_t *serving_nf_set_id_listList = NULL; + cJSON *tai_list = NULL; + OpenAPI_list_t *tai_listList = NULL; + cJSON *tai_range_list = NULL; + OpenAPI_list_t *tai_range_listList = NULL; + serving_nf_type_list = cJSON_GetObjectItemCaseSensitive(dccf_infoJSON, "servingNfTypeList"); + if (serving_nf_type_list) { + cJSON *serving_nf_type_list_local = NULL; + if (!cJSON_IsArray(serving_nf_type_list)) { + ogs_error("OpenAPI_dccf_info_parseFromJSON() failed [serving_nf_type_list]"); + goto end; + } + + serving_nf_type_listList = OpenAPI_list_create(); + + cJSON_ArrayForEach(serving_nf_type_list_local, serving_nf_type_list) { + if (!cJSON_IsString(serving_nf_type_list_local)) { + ogs_error("OpenAPI_dccf_info_parseFromJSON() failed [serving_nf_type_list]"); + goto end; + } + OpenAPI_list_add(serving_nf_type_listList, (void *)OpenAPI_nf_type_FromString(serving_nf_type_list_local->valuestring)); + } + } + + serving_nf_set_id_list = cJSON_GetObjectItemCaseSensitive(dccf_infoJSON, "servingNfSetIdList"); + if (serving_nf_set_id_list) { + cJSON *serving_nf_set_id_list_local = NULL; + if (!cJSON_IsArray(serving_nf_set_id_list)) { + ogs_error("OpenAPI_dccf_info_parseFromJSON() failed [serving_nf_set_id_list]"); + goto end; + } + + serving_nf_set_id_listList = OpenAPI_list_create(); + + cJSON_ArrayForEach(serving_nf_set_id_list_local, serving_nf_set_id_list) { + double *localDouble = NULL; + int *localInt = NULL; + if (!cJSON_IsString(serving_nf_set_id_list_local)) { + ogs_error("OpenAPI_dccf_info_parseFromJSON() failed [serving_nf_set_id_list]"); + goto end; + } + OpenAPI_list_add(serving_nf_set_id_listList, ogs_strdup(serving_nf_set_id_list_local->valuestring)); + } + } + + tai_list = cJSON_GetObjectItemCaseSensitive(dccf_infoJSON, "taiList"); + if (tai_list) { + cJSON *tai_list_local = NULL; + if (!cJSON_IsArray(tai_list)) { + ogs_error("OpenAPI_dccf_info_parseFromJSON() failed [tai_list]"); + goto end; + } + + tai_listList = OpenAPI_list_create(); + + cJSON_ArrayForEach(tai_list_local, tai_list) { + if (!cJSON_IsObject(tai_list_local)) { + ogs_error("OpenAPI_dccf_info_parseFromJSON() failed [tai_list]"); + goto end; + } + OpenAPI_tai_t *tai_listItem = OpenAPI_tai_parseFromJSON(tai_list_local); + if (!tai_listItem) { + ogs_error("No tai_listItem"); + OpenAPI_list_free(tai_listList); + goto end; + } + OpenAPI_list_add(tai_listList, tai_listItem); + } + } + + tai_range_list = cJSON_GetObjectItemCaseSensitive(dccf_infoJSON, "taiRangeList"); + if (tai_range_list) { + cJSON *tai_range_list_local = NULL; + if (!cJSON_IsArray(tai_range_list)) { + ogs_error("OpenAPI_dccf_info_parseFromJSON() failed [tai_range_list]"); + goto end; + } + + tai_range_listList = OpenAPI_list_create(); + + cJSON_ArrayForEach(tai_range_list_local, tai_range_list) { + if (!cJSON_IsObject(tai_range_list_local)) { + ogs_error("OpenAPI_dccf_info_parseFromJSON() failed [tai_range_list]"); + goto end; + } + OpenAPI_tai_range_t *tai_range_listItem = OpenAPI_tai_range_parseFromJSON(tai_range_list_local); + if (!tai_range_listItem) { + ogs_error("No tai_range_listItem"); + OpenAPI_list_free(tai_range_listList); + goto end; + } + OpenAPI_list_add(tai_range_listList, tai_range_listItem); + } + } + + dccf_info_local_var = OpenAPI_dccf_info_create ( + serving_nf_type_list ? serving_nf_type_listList : NULL, + serving_nf_set_id_list ? serving_nf_set_id_listList : NULL, + tai_list ? tai_listList : NULL, + tai_range_list ? tai_range_listList : NULL + ); + + return dccf_info_local_var; +end: + if (serving_nf_type_listList) { + OpenAPI_list_free(serving_nf_type_listList); + serving_nf_type_listList = NULL; + } + if (serving_nf_set_id_listList) { + OpenAPI_list_for_each(serving_nf_set_id_listList, node) { + ogs_free(node->data); + } + OpenAPI_list_free(serving_nf_set_id_listList); + serving_nf_set_id_listList = NULL; + } + if (tai_listList) { + OpenAPI_list_for_each(tai_listList, node) { + OpenAPI_tai_free(node->data); + } + OpenAPI_list_free(tai_listList); + tai_listList = NULL; + } + if (tai_range_listList) { + OpenAPI_list_for_each(tai_range_listList, node) { + OpenAPI_tai_range_free(node->data); + } + OpenAPI_list_free(tai_range_listList); + tai_range_listList = NULL; + } + return NULL; +} + +OpenAPI_dccf_info_t *OpenAPI_dccf_info_copy(OpenAPI_dccf_info_t *dst, OpenAPI_dccf_info_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_dccf_info_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_dccf_info_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_dccf_info_free(dst); + dst = OpenAPI_dccf_info_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/dccf_info.h b/lib/sbi/openapi/model/dccf_info.h new file mode 100644 index 000000000..4acbf8ab7 --- /dev/null +++ b/lib/sbi/openapi/model/dccf_info.h @@ -0,0 +1,47 @@ +/* + * dccf_info.h + * + * Information of a DCCF NF Instance + */ + +#ifndef _OpenAPI_dccf_info_H_ +#define _OpenAPI_dccf_info_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "nf_type.h" +#include "tai.h" +#include "tai_range.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_dccf_info_s OpenAPI_dccf_info_t; +typedef struct OpenAPI_dccf_info_s { + OpenAPI_list_t *serving_nf_type_list; + OpenAPI_list_t *serving_nf_set_id_list; + OpenAPI_list_t *tai_list; + OpenAPI_list_t *tai_range_list; +} OpenAPI_dccf_info_t; + +OpenAPI_dccf_info_t *OpenAPI_dccf_info_create( + OpenAPI_list_t *serving_nf_type_list, + OpenAPI_list_t *serving_nf_set_id_list, + OpenAPI_list_t *tai_list, + OpenAPI_list_t *tai_range_list +); +void OpenAPI_dccf_info_free(OpenAPI_dccf_info_t *dccf_info); +OpenAPI_dccf_info_t *OpenAPI_dccf_info_parseFromJSON(cJSON *dccf_infoJSON); +cJSON *OpenAPI_dccf_info_convertToJSON(OpenAPI_dccf_info_t *dccf_info); +OpenAPI_dccf_info_t *OpenAPI_dccf_info_copy(OpenAPI_dccf_info_t *dst, OpenAPI_dccf_info_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_dccf_info_H_ */ + diff --git a/lib/sbi/openapi/model/ddd_traffic_descriptor.h b/lib/sbi/openapi/model/ddd_traffic_descriptor.h index 807e18f24..2521036d0 100644 --- a/lib/sbi/openapi/model/ddd_traffic_descriptor.h +++ b/lib/sbi/openapi/model/ddd_traffic_descriptor.h @@ -1,7 +1,7 @@ /* * ddd_traffic_descriptor.h * - * + * Contains a Traffic Descriptor. */ #ifndef _OpenAPI_ddd_traffic_descriptor_H_ diff --git a/lib/sbi/openapi/model/ddd_traffic_descriptor_1.c b/lib/sbi/openapi/model/ddd_traffic_descriptor_1.c new file mode 100644 index 000000000..c917b3bfc --- /dev/null +++ b/lib/sbi/openapi/model/ddd_traffic_descriptor_1.c @@ -0,0 +1,178 @@ + +#include +#include +#include +#include "ddd_traffic_descriptor_1.h" + +OpenAPI_ddd_traffic_descriptor_1_t *OpenAPI_ddd_traffic_descriptor_1_create( + char *ipv4_addr, + char *ipv6_addr, + bool is_port_number, + int port_number, + char *mac_addr +) +{ + OpenAPI_ddd_traffic_descriptor_1_t *ddd_traffic_descriptor_1_local_var = ogs_malloc(sizeof(OpenAPI_ddd_traffic_descriptor_1_t)); + ogs_assert(ddd_traffic_descriptor_1_local_var); + + ddd_traffic_descriptor_1_local_var->ipv4_addr = ipv4_addr; + ddd_traffic_descriptor_1_local_var->ipv6_addr = ipv6_addr; + ddd_traffic_descriptor_1_local_var->is_port_number = is_port_number; + ddd_traffic_descriptor_1_local_var->port_number = port_number; + ddd_traffic_descriptor_1_local_var->mac_addr = mac_addr; + + return ddd_traffic_descriptor_1_local_var; +} + +void OpenAPI_ddd_traffic_descriptor_1_free(OpenAPI_ddd_traffic_descriptor_1_t *ddd_traffic_descriptor_1) +{ + OpenAPI_lnode_t *node = NULL; + + if (NULL == ddd_traffic_descriptor_1) { + return; + } + if (ddd_traffic_descriptor_1->ipv4_addr) { + ogs_free(ddd_traffic_descriptor_1->ipv4_addr); + ddd_traffic_descriptor_1->ipv4_addr = NULL; + } + if (ddd_traffic_descriptor_1->ipv6_addr) { + ogs_free(ddd_traffic_descriptor_1->ipv6_addr); + ddd_traffic_descriptor_1->ipv6_addr = NULL; + } + if (ddd_traffic_descriptor_1->mac_addr) { + ogs_free(ddd_traffic_descriptor_1->mac_addr); + ddd_traffic_descriptor_1->mac_addr = NULL; + } + ogs_free(ddd_traffic_descriptor_1); +} + +cJSON *OpenAPI_ddd_traffic_descriptor_1_convertToJSON(OpenAPI_ddd_traffic_descriptor_1_t *ddd_traffic_descriptor_1) +{ + cJSON *item = NULL; + OpenAPI_lnode_t *node = NULL; + + if (ddd_traffic_descriptor_1 == NULL) { + ogs_error("OpenAPI_ddd_traffic_descriptor_1_convertToJSON() failed [DddTrafficDescriptor_1]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (ddd_traffic_descriptor_1->ipv4_addr) { + if (cJSON_AddStringToObject(item, "ipv4Addr", ddd_traffic_descriptor_1->ipv4_addr) == NULL) { + ogs_error("OpenAPI_ddd_traffic_descriptor_1_convertToJSON() failed [ipv4_addr]"); + goto end; + } + } + + if (ddd_traffic_descriptor_1->ipv6_addr) { + if (cJSON_AddStringToObject(item, "ipv6Addr", ddd_traffic_descriptor_1->ipv6_addr) == NULL) { + ogs_error("OpenAPI_ddd_traffic_descriptor_1_convertToJSON() failed [ipv6_addr]"); + goto end; + } + } + + if (ddd_traffic_descriptor_1->is_port_number) { + if (cJSON_AddNumberToObject(item, "portNumber", ddd_traffic_descriptor_1->port_number) == NULL) { + ogs_error("OpenAPI_ddd_traffic_descriptor_1_convertToJSON() failed [port_number]"); + goto end; + } + } + + if (ddd_traffic_descriptor_1->mac_addr) { + if (cJSON_AddStringToObject(item, "macAddr", ddd_traffic_descriptor_1->mac_addr) == NULL) { + ogs_error("OpenAPI_ddd_traffic_descriptor_1_convertToJSON() failed [mac_addr]"); + goto end; + } + } + +end: + return item; +} + +OpenAPI_ddd_traffic_descriptor_1_t *OpenAPI_ddd_traffic_descriptor_1_parseFromJSON(cJSON *ddd_traffic_descriptor_1JSON) +{ + OpenAPI_ddd_traffic_descriptor_1_t *ddd_traffic_descriptor_1_local_var = NULL; + OpenAPI_lnode_t *node = NULL; + cJSON *ipv4_addr = NULL; + cJSON *ipv6_addr = NULL; + cJSON *port_number = NULL; + cJSON *mac_addr = NULL; + ipv4_addr = cJSON_GetObjectItemCaseSensitive(ddd_traffic_descriptor_1JSON, "ipv4Addr"); + if (ipv4_addr) { + if (!cJSON_IsString(ipv4_addr) && !cJSON_IsNull(ipv4_addr)) { + ogs_error("OpenAPI_ddd_traffic_descriptor_1_parseFromJSON() failed [ipv4_addr]"); + goto end; + } + } + + ipv6_addr = cJSON_GetObjectItemCaseSensitive(ddd_traffic_descriptor_1JSON, "ipv6Addr"); + if (ipv6_addr) { + if (!cJSON_IsString(ipv6_addr) && !cJSON_IsNull(ipv6_addr)) { + ogs_error("OpenAPI_ddd_traffic_descriptor_1_parseFromJSON() failed [ipv6_addr]"); + goto end; + } + } + + port_number = cJSON_GetObjectItemCaseSensitive(ddd_traffic_descriptor_1JSON, "portNumber"); + if (port_number) { + if (!cJSON_IsNumber(port_number)) { + ogs_error("OpenAPI_ddd_traffic_descriptor_1_parseFromJSON() failed [port_number]"); + goto end; + } + } + + mac_addr = cJSON_GetObjectItemCaseSensitive(ddd_traffic_descriptor_1JSON, "macAddr"); + if (mac_addr) { + if (!cJSON_IsString(mac_addr) && !cJSON_IsNull(mac_addr)) { + ogs_error("OpenAPI_ddd_traffic_descriptor_1_parseFromJSON() failed [mac_addr]"); + goto end; + } + } + + ddd_traffic_descriptor_1_local_var = OpenAPI_ddd_traffic_descriptor_1_create ( + ipv4_addr && !cJSON_IsNull(ipv4_addr) ? ogs_strdup(ipv4_addr->valuestring) : NULL, + ipv6_addr && !cJSON_IsNull(ipv6_addr) ? ogs_strdup(ipv6_addr->valuestring) : NULL, + port_number ? true : false, + port_number ? port_number->valuedouble : 0, + mac_addr && !cJSON_IsNull(mac_addr) ? ogs_strdup(mac_addr->valuestring) : NULL + ); + + return ddd_traffic_descriptor_1_local_var; +end: + return NULL; +} + +OpenAPI_ddd_traffic_descriptor_1_t *OpenAPI_ddd_traffic_descriptor_1_copy(OpenAPI_ddd_traffic_descriptor_1_t *dst, OpenAPI_ddd_traffic_descriptor_1_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_ddd_traffic_descriptor_1_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_ddd_traffic_descriptor_1_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_ddd_traffic_descriptor_1_free(dst); + dst = OpenAPI_ddd_traffic_descriptor_1_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/ddd_traffic_descriptor_1.h b/lib/sbi/openapi/model/ddd_traffic_descriptor_1.h new file mode 100644 index 000000000..99d7157e9 --- /dev/null +++ b/lib/sbi/openapi/model/ddd_traffic_descriptor_1.h @@ -0,0 +1,46 @@ +/* + * ddd_traffic_descriptor_1.h + * + * Contains a Traffic Descriptor. + */ + +#ifndef _OpenAPI_ddd_traffic_descriptor_1_H_ +#define _OpenAPI_ddd_traffic_descriptor_1_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_ddd_traffic_descriptor_1_s OpenAPI_ddd_traffic_descriptor_1_t; +typedef struct OpenAPI_ddd_traffic_descriptor_1_s { + char *ipv4_addr; + char *ipv6_addr; + bool is_port_number; + int port_number; + char *mac_addr; +} OpenAPI_ddd_traffic_descriptor_1_t; + +OpenAPI_ddd_traffic_descriptor_1_t *OpenAPI_ddd_traffic_descriptor_1_create( + char *ipv4_addr, + char *ipv6_addr, + bool is_port_number, + int port_number, + char *mac_addr +); +void OpenAPI_ddd_traffic_descriptor_1_free(OpenAPI_ddd_traffic_descriptor_1_t *ddd_traffic_descriptor_1); +OpenAPI_ddd_traffic_descriptor_1_t *OpenAPI_ddd_traffic_descriptor_1_parseFromJSON(cJSON *ddd_traffic_descriptor_1JSON); +cJSON *OpenAPI_ddd_traffic_descriptor_1_convertToJSON(OpenAPI_ddd_traffic_descriptor_1_t *ddd_traffic_descriptor_1); +OpenAPI_ddd_traffic_descriptor_1_t *OpenAPI_ddd_traffic_descriptor_1_copy(OpenAPI_ddd_traffic_descriptor_1_t *dst, OpenAPI_ddd_traffic_descriptor_1_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_ddd_traffic_descriptor_1_H_ */ + diff --git a/lib/sbi/openapi/model/ddn_failure_sub_info.h b/lib/sbi/openapi/model/ddn_failure_sub_info.h index ba1711f72..05596447f 100644 --- a/lib/sbi/openapi/model/ddn_failure_sub_info.h +++ b/lib/sbi/openapi/model/ddn_failure_sub_info.h @@ -1,7 +1,7 @@ /* * ddn_failure_sub_info.h * - * + * DDN Failure Subscription Information */ #ifndef _OpenAPI_ddn_failure_sub_info_H_ diff --git a/lib/sbi/openapi/model/ddn_failure_subs.h b/lib/sbi/openapi/model/ddn_failure_subs.h index f3807d371..cdbd56d0b 100644 --- a/lib/sbi/openapi/model/ddn_failure_subs.h +++ b/lib/sbi/openapi/model/ddn_failure_subs.h @@ -1,7 +1,7 @@ /* * ddn_failure_subs.h * - * + * DDN Failure Subscription */ #ifndef _OpenAPI_ddn_failure_subs_H_ diff --git a/lib/sbi/openapi/model/def_sub_service_info.c b/lib/sbi/openapi/model/def_sub_service_info.c new file mode 100644 index 000000000..6e8cce1a6 --- /dev/null +++ b/lib/sbi/openapi/model/def_sub_service_info.c @@ -0,0 +1,164 @@ + +#include +#include +#include +#include "def_sub_service_info.h" + +OpenAPI_def_sub_service_info_t *OpenAPI_def_sub_service_info_create( + OpenAPI_list_t *versions, + char *supported_features +) +{ + OpenAPI_def_sub_service_info_t *def_sub_service_info_local_var = ogs_malloc(sizeof(OpenAPI_def_sub_service_info_t)); + ogs_assert(def_sub_service_info_local_var); + + def_sub_service_info_local_var->versions = versions; + def_sub_service_info_local_var->supported_features = supported_features; + + return def_sub_service_info_local_var; +} + +void OpenAPI_def_sub_service_info_free(OpenAPI_def_sub_service_info_t *def_sub_service_info) +{ + OpenAPI_lnode_t *node = NULL; + + if (NULL == def_sub_service_info) { + return; + } + if (def_sub_service_info->versions) { + OpenAPI_list_for_each(def_sub_service_info->versions, node) { + ogs_free(node->data); + } + OpenAPI_list_free(def_sub_service_info->versions); + def_sub_service_info->versions = NULL; + } + if (def_sub_service_info->supported_features) { + ogs_free(def_sub_service_info->supported_features); + def_sub_service_info->supported_features = NULL; + } + ogs_free(def_sub_service_info); +} + +cJSON *OpenAPI_def_sub_service_info_convertToJSON(OpenAPI_def_sub_service_info_t *def_sub_service_info) +{ + cJSON *item = NULL; + OpenAPI_lnode_t *node = NULL; + + if (def_sub_service_info == NULL) { + ogs_error("OpenAPI_def_sub_service_info_convertToJSON() failed [DefSubServiceInfo]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (def_sub_service_info->versions) { + cJSON *versionsList = cJSON_AddArrayToObject(item, "versions"); + if (versionsList == NULL) { + ogs_error("OpenAPI_def_sub_service_info_convertToJSON() failed [versions]"); + goto end; + } + OpenAPI_list_for_each(def_sub_service_info->versions, node) { + if (cJSON_AddStringToObject(versionsList, "", (char*)node->data) == NULL) { + ogs_error("OpenAPI_def_sub_service_info_convertToJSON() failed [versions]"); + goto end; + } + } + } + + if (def_sub_service_info->supported_features) { + if (cJSON_AddStringToObject(item, "supportedFeatures", def_sub_service_info->supported_features) == NULL) { + ogs_error("OpenAPI_def_sub_service_info_convertToJSON() failed [supported_features]"); + goto end; + } + } + +end: + return item; +} + +OpenAPI_def_sub_service_info_t *OpenAPI_def_sub_service_info_parseFromJSON(cJSON *def_sub_service_infoJSON) +{ + OpenAPI_def_sub_service_info_t *def_sub_service_info_local_var = NULL; + OpenAPI_lnode_t *node = NULL; + cJSON *versions = NULL; + OpenAPI_list_t *versionsList = NULL; + cJSON *supported_features = NULL; + versions = cJSON_GetObjectItemCaseSensitive(def_sub_service_infoJSON, "versions"); + if (versions) { + cJSON *versions_local = NULL; + if (!cJSON_IsArray(versions)) { + ogs_error("OpenAPI_def_sub_service_info_parseFromJSON() failed [versions]"); + goto end; + } + + versionsList = OpenAPI_list_create(); + + cJSON_ArrayForEach(versions_local, versions) { + double *localDouble = NULL; + int *localInt = NULL; + if (!cJSON_IsString(versions_local)) { + ogs_error("OpenAPI_def_sub_service_info_parseFromJSON() failed [versions]"); + goto end; + } + OpenAPI_list_add(versionsList, ogs_strdup(versions_local->valuestring)); + } + } + + supported_features = cJSON_GetObjectItemCaseSensitive(def_sub_service_infoJSON, "supportedFeatures"); + if (supported_features) { + if (!cJSON_IsString(supported_features) && !cJSON_IsNull(supported_features)) { + ogs_error("OpenAPI_def_sub_service_info_parseFromJSON() failed [supported_features]"); + goto end; + } + } + + def_sub_service_info_local_var = OpenAPI_def_sub_service_info_create ( + versions ? versionsList : NULL, + supported_features && !cJSON_IsNull(supported_features) ? ogs_strdup(supported_features->valuestring) : NULL + ); + + return def_sub_service_info_local_var; +end: + if (versionsList) { + OpenAPI_list_for_each(versionsList, node) { + ogs_free(node->data); + } + OpenAPI_list_free(versionsList); + versionsList = NULL; + } + return NULL; +} + +OpenAPI_def_sub_service_info_t *OpenAPI_def_sub_service_info_copy(OpenAPI_def_sub_service_info_t *dst, OpenAPI_def_sub_service_info_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_def_sub_service_info_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_def_sub_service_info_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_def_sub_service_info_free(dst); + dst = OpenAPI_def_sub_service_info_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/def_sub_service_info.h b/lib/sbi/openapi/model/def_sub_service_info.h new file mode 100644 index 000000000..79cd34073 --- /dev/null +++ b/lib/sbi/openapi/model/def_sub_service_info.h @@ -0,0 +1,40 @@ +/* + * def_sub_service_info.h + * + * Service Specific information for Default Notification Subscription. + */ + +#ifndef _OpenAPI_def_sub_service_info_H_ +#define _OpenAPI_def_sub_service_info_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_def_sub_service_info_s OpenAPI_def_sub_service_info_t; +typedef struct OpenAPI_def_sub_service_info_s { + OpenAPI_list_t *versions; + char *supported_features; +} OpenAPI_def_sub_service_info_t; + +OpenAPI_def_sub_service_info_t *OpenAPI_def_sub_service_info_create( + OpenAPI_list_t *versions, + char *supported_features +); +void OpenAPI_def_sub_service_info_free(OpenAPI_def_sub_service_info_t *def_sub_service_info); +OpenAPI_def_sub_service_info_t *OpenAPI_def_sub_service_info_parseFromJSON(cJSON *def_sub_service_infoJSON); +cJSON *OpenAPI_def_sub_service_info_convertToJSON(OpenAPI_def_sub_service_info_t *def_sub_service_info); +OpenAPI_def_sub_service_info_t *OpenAPI_def_sub_service_info_copy(OpenAPI_def_sub_service_info_t *dst, OpenAPI_def_sub_service_info_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_def_sub_service_info_H_ */ + diff --git a/lib/sbi/openapi/model/default_notification_subscription.c b/lib/sbi/openapi/model/default_notification_subscription.c index ba655dfd2..909d67273 100644 --- a/lib/sbi/openapi/model/default_notification_subscription.c +++ b/lib/sbi/openapi/model/default_notification_subscription.c @@ -10,7 +10,10 @@ OpenAPI_default_notification_subscription_t *OpenAPI_default_notification_subscr OpenAPI_n1_message_class_e n1_message_class, OpenAPI_n2_information_class_e n2_information_class, OpenAPI_list_t *versions, - char *binding + char *binding, + char *accepted_encoding, + char *supported_features, + OpenAPI_list_t* service_info_list ) { OpenAPI_default_notification_subscription_t *default_notification_subscription_local_var = ogs_malloc(sizeof(OpenAPI_default_notification_subscription_t)); @@ -22,6 +25,9 @@ OpenAPI_default_notification_subscription_t *OpenAPI_default_notification_subscr default_notification_subscription_local_var->n2_information_class = n2_information_class; default_notification_subscription_local_var->versions = versions; default_notification_subscription_local_var->binding = binding; + default_notification_subscription_local_var->accepted_encoding = accepted_encoding; + default_notification_subscription_local_var->supported_features = supported_features; + default_notification_subscription_local_var->service_info_list = service_info_list; return default_notification_subscription_local_var; } @@ -48,6 +54,24 @@ void OpenAPI_default_notification_subscription_free(OpenAPI_default_notification ogs_free(default_notification_subscription->binding); default_notification_subscription->binding = NULL; } + if (default_notification_subscription->accepted_encoding) { + ogs_free(default_notification_subscription->accepted_encoding); + default_notification_subscription->accepted_encoding = NULL; + } + if (default_notification_subscription->supported_features) { + ogs_free(default_notification_subscription->supported_features); + default_notification_subscription->supported_features = NULL; + } + if (default_notification_subscription->service_info_list) { + OpenAPI_list_for_each(default_notification_subscription->service_info_list, node) { + OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*)node->data; + ogs_free(localKeyValue->key); + OpenAPI_def_sub_service_info_free(localKeyValue->value); + OpenAPI_map_free(localKeyValue); + } + OpenAPI_list_free(default_notification_subscription->service_info_list); + default_notification_subscription->service_info_list = NULL; + } ogs_free(default_notification_subscription); } @@ -115,6 +139,42 @@ cJSON *OpenAPI_default_notification_subscription_convertToJSON(OpenAPI_default_n } } + if (default_notification_subscription->accepted_encoding) { + if (cJSON_AddStringToObject(item, "acceptedEncoding", default_notification_subscription->accepted_encoding) == NULL) { + ogs_error("OpenAPI_default_notification_subscription_convertToJSON() failed [accepted_encoding]"); + goto end; + } + } + + if (default_notification_subscription->supported_features) { + if (cJSON_AddStringToObject(item, "supportedFeatures", default_notification_subscription->supported_features) == NULL) { + ogs_error("OpenAPI_default_notification_subscription_convertToJSON() failed [supported_features]"); + goto end; + } + } + + if (default_notification_subscription->service_info_list) { + cJSON *service_info_list = cJSON_AddObjectToObject(item, "serviceInfoList"); + if (service_info_list == NULL) { + ogs_error("OpenAPI_default_notification_subscription_convertToJSON() failed [service_info_list]"); + goto end; + } + cJSON *localMapObject = service_info_list; + if (default_notification_subscription->service_info_list) { + OpenAPI_list_for_each(default_notification_subscription->service_info_list, node) { + OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*)node->data; + cJSON *itemLocal = localKeyValue->value ? + OpenAPI_def_sub_service_info_convertToJSON(localKeyValue->value) : + cJSON_CreateNull(); + if (itemLocal == NULL) { + ogs_error("OpenAPI_default_notification_subscription_convertToJSON() failed [inner]"); + goto end; + } + cJSON_AddItemToObject(localMapObject, localKeyValue->key, itemLocal); + } + } + } + end: return item; } @@ -133,6 +193,10 @@ OpenAPI_default_notification_subscription_t *OpenAPI_default_notification_subscr cJSON *versions = NULL; OpenAPI_list_t *versionsList = NULL; cJSON *binding = NULL; + cJSON *accepted_encoding = NULL; + cJSON *supported_features = NULL; + cJSON *service_info_list = NULL; + OpenAPI_list_t *service_info_listList = NULL; notification_type = cJSON_GetObjectItemCaseSensitive(default_notification_subscriptionJSON, "notificationType"); if (!notification_type) { ogs_error("OpenAPI_default_notification_subscription_parseFromJSON() failed [notification_type]"); @@ -201,13 +265,58 @@ OpenAPI_default_notification_subscription_t *OpenAPI_default_notification_subscr } } + accepted_encoding = cJSON_GetObjectItemCaseSensitive(default_notification_subscriptionJSON, "acceptedEncoding"); + if (accepted_encoding) { + if (!cJSON_IsString(accepted_encoding) && !cJSON_IsNull(accepted_encoding)) { + ogs_error("OpenAPI_default_notification_subscription_parseFromJSON() failed [accepted_encoding]"); + goto end; + } + } + + supported_features = cJSON_GetObjectItemCaseSensitive(default_notification_subscriptionJSON, "supportedFeatures"); + if (supported_features) { + if (!cJSON_IsString(supported_features) && !cJSON_IsNull(supported_features)) { + ogs_error("OpenAPI_default_notification_subscription_parseFromJSON() failed [supported_features]"); + goto end; + } + } + + service_info_list = cJSON_GetObjectItemCaseSensitive(default_notification_subscriptionJSON, "serviceInfoList"); + if (service_info_list) { + cJSON *service_info_list_local_map = NULL; + if (!cJSON_IsObject(service_info_list) && !cJSON_IsNull(service_info_list)) { + ogs_error("OpenAPI_default_notification_subscription_parseFromJSON() failed [service_info_list]"); + goto end; + } + if (cJSON_IsObject(service_info_list)) { + service_info_listList = OpenAPI_list_create(); + OpenAPI_map_t *localMapKeyPair = NULL; + cJSON_ArrayForEach(service_info_list_local_map, service_info_list) { + cJSON *localMapObject = service_info_list_local_map; + if (cJSON_IsObject(localMapObject)) { + localMapKeyPair = OpenAPI_map_create( + ogs_strdup(localMapObject->string), OpenAPI_def_sub_service_info_parseFromJSON(localMapObject)); + } else if (cJSON_IsNull(localMapObject)) { + localMapKeyPair = OpenAPI_map_create(ogs_strdup(localMapObject->string), NULL); + } else { + ogs_error("OpenAPI_default_notification_subscription_parseFromJSON() failed [inner]"); + goto end; + } + OpenAPI_list_add(service_info_listList, localMapKeyPair); + } + } + } + default_notification_subscription_local_var = OpenAPI_default_notification_subscription_create ( notification_typeVariable, ogs_strdup(callback_uri->valuestring), n1_message_class ? n1_message_classVariable : 0, n2_information_class ? n2_information_classVariable : 0, versions ? versionsList : NULL, - binding && !cJSON_IsNull(binding) ? ogs_strdup(binding->valuestring) : NULL + binding && !cJSON_IsNull(binding) ? ogs_strdup(binding->valuestring) : NULL, + accepted_encoding && !cJSON_IsNull(accepted_encoding) ? ogs_strdup(accepted_encoding->valuestring) : NULL, + supported_features && !cJSON_IsNull(supported_features) ? ogs_strdup(supported_features->valuestring) : NULL, + service_info_list ? service_info_listList : NULL ); return default_notification_subscription_local_var; @@ -219,6 +328,16 @@ end: OpenAPI_list_free(versionsList); versionsList = NULL; } + if (service_info_listList) { + OpenAPI_list_for_each(service_info_listList, node) { + OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*) node->data; + ogs_free(localKeyValue->key); + OpenAPI_def_sub_service_info_free(localKeyValue->value); + OpenAPI_map_free(localKeyValue); + } + OpenAPI_list_free(service_info_listList); + service_info_listList = NULL; + } return NULL; } diff --git a/lib/sbi/openapi/model/default_notification_subscription.h b/lib/sbi/openapi/model/default_notification_subscription.h index 3de196bd9..abfa0d27b 100644 --- a/lib/sbi/openapi/model/default_notification_subscription.h +++ b/lib/sbi/openapi/model/default_notification_subscription.h @@ -1,7 +1,7 @@ /* * default_notification_subscription.h * - * Data structure for specifying the notifications the NF service subscribes by default along with callback URI + * Data structure for specifying the notifications the NF service subscribes by default, along with callback URI */ #ifndef _OpenAPI_default_notification_subscription_H_ @@ -12,6 +12,7 @@ #include "../include/list.h" #include "../include/keyValuePair.h" #include "../include/binary.h" +#include "def_sub_service_info.h" #include "n1_message_class.h" #include "n2_information_class.h" #include "notification_type.h" @@ -28,6 +29,9 @@ typedef struct OpenAPI_default_notification_subscription_s { OpenAPI_n2_information_class_e n2_information_class; OpenAPI_list_t *versions; char *binding; + char *accepted_encoding; + char *supported_features; + OpenAPI_list_t* service_info_list; } OpenAPI_default_notification_subscription_t; OpenAPI_default_notification_subscription_t *OpenAPI_default_notification_subscription_create( @@ -36,7 +40,10 @@ OpenAPI_default_notification_subscription_t *OpenAPI_default_notification_subscr OpenAPI_n1_message_class_e n1_message_class, OpenAPI_n2_information_class_e n2_information_class, OpenAPI_list_t *versions, - char *binding + char *binding, + char *accepted_encoding, + char *supported_features, + OpenAPI_list_t* service_info_list ); void OpenAPI_default_notification_subscription_free(OpenAPI_default_notification_subscription_t *default_notification_subscription); OpenAPI_default_notification_subscription_t *OpenAPI_default_notification_subscription_parseFromJSON(cJSON *default_notification_subscriptionJSON); diff --git a/lib/sbi/openapi/model/default_unrelated_class_1.c b/lib/sbi/openapi/model/default_unrelated_class_1.c deleted file mode 100644 index e7b056aad..000000000 --- a/lib/sbi/openapi/model/default_unrelated_class_1.c +++ /dev/null @@ -1,274 +0,0 @@ - -#include -#include -#include -#include "default_unrelated_class_1.h" - -OpenAPI_default_unrelated_class_1_t *OpenAPI_default_unrelated_class_1_create( - OpenAPI_list_t *allowed_geographic_area, - OpenAPI_privacy_check_related_action_e privacy_check_related_action, - OpenAPI_code_word_ind_e code_word_ind, - OpenAPI_valid_time_period_1_t *valid_time_period, - OpenAPI_list_t *code_word_list -) -{ - OpenAPI_default_unrelated_class_1_t *default_unrelated_class_1_local_var = ogs_malloc(sizeof(OpenAPI_default_unrelated_class_1_t)); - ogs_assert(default_unrelated_class_1_local_var); - - default_unrelated_class_1_local_var->allowed_geographic_area = allowed_geographic_area; - default_unrelated_class_1_local_var->privacy_check_related_action = privacy_check_related_action; - default_unrelated_class_1_local_var->code_word_ind = code_word_ind; - default_unrelated_class_1_local_var->valid_time_period = valid_time_period; - default_unrelated_class_1_local_var->code_word_list = code_word_list; - - return default_unrelated_class_1_local_var; -} - -void OpenAPI_default_unrelated_class_1_free(OpenAPI_default_unrelated_class_1_t *default_unrelated_class_1) -{ - OpenAPI_lnode_t *node = NULL; - - if (NULL == default_unrelated_class_1) { - return; - } - if (default_unrelated_class_1->allowed_geographic_area) { - OpenAPI_list_for_each(default_unrelated_class_1->allowed_geographic_area, node) { - OpenAPI_geographic_area_free(node->data); - } - OpenAPI_list_free(default_unrelated_class_1->allowed_geographic_area); - default_unrelated_class_1->allowed_geographic_area = NULL; - } - if (default_unrelated_class_1->valid_time_period) { - OpenAPI_valid_time_period_1_free(default_unrelated_class_1->valid_time_period); - default_unrelated_class_1->valid_time_period = NULL; - } - if (default_unrelated_class_1->code_word_list) { - OpenAPI_list_for_each(default_unrelated_class_1->code_word_list, node) { - ogs_free(node->data); - } - OpenAPI_list_free(default_unrelated_class_1->code_word_list); - default_unrelated_class_1->code_word_list = NULL; - } - ogs_free(default_unrelated_class_1); -} - -cJSON *OpenAPI_default_unrelated_class_1_convertToJSON(OpenAPI_default_unrelated_class_1_t *default_unrelated_class_1) -{ - cJSON *item = NULL; - OpenAPI_lnode_t *node = NULL; - - if (default_unrelated_class_1 == NULL) { - ogs_error("OpenAPI_default_unrelated_class_1_convertToJSON() failed [DefaultUnrelatedClass_1]"); - return NULL; - } - - item = cJSON_CreateObject(); - if (default_unrelated_class_1->allowed_geographic_area) { - cJSON *allowed_geographic_areaList = cJSON_AddArrayToObject(item, "allowedGeographicArea"); - if (allowed_geographic_areaList == NULL) { - ogs_error("OpenAPI_default_unrelated_class_1_convertToJSON() failed [allowed_geographic_area]"); - goto end; - } - OpenAPI_list_for_each(default_unrelated_class_1->allowed_geographic_area, node) { - cJSON *itemLocal = OpenAPI_geographic_area_convertToJSON(node->data); - if (itemLocal == NULL) { - ogs_error("OpenAPI_default_unrelated_class_1_convertToJSON() failed [allowed_geographic_area]"); - goto end; - } - cJSON_AddItemToArray(allowed_geographic_areaList, itemLocal); - } - } - - if (default_unrelated_class_1->privacy_check_related_action != OpenAPI_privacy_check_related_action_NULL) { - if (cJSON_AddStringToObject(item, "privacyCheckRelatedAction", OpenAPI_privacy_check_related_action_ToString(default_unrelated_class_1->privacy_check_related_action)) == NULL) { - ogs_error("OpenAPI_default_unrelated_class_1_convertToJSON() failed [privacy_check_related_action]"); - goto end; - } - } - - if (default_unrelated_class_1->code_word_ind != OpenAPI_code_word_ind_NULL) { - if (cJSON_AddStringToObject(item, "codeWordInd", OpenAPI_code_word_ind_ToString(default_unrelated_class_1->code_word_ind)) == NULL) { - ogs_error("OpenAPI_default_unrelated_class_1_convertToJSON() failed [code_word_ind]"); - goto end; - } - } - - if (default_unrelated_class_1->valid_time_period) { - cJSON *valid_time_period_local_JSON = OpenAPI_valid_time_period_1_convertToJSON(default_unrelated_class_1->valid_time_period); - if (valid_time_period_local_JSON == NULL) { - ogs_error("OpenAPI_default_unrelated_class_1_convertToJSON() failed [valid_time_period]"); - goto end; - } - cJSON_AddItemToObject(item, "validTimePeriod", valid_time_period_local_JSON); - if (item->child == NULL) { - ogs_error("OpenAPI_default_unrelated_class_1_convertToJSON() failed [valid_time_period]"); - goto end; - } - } - - if (default_unrelated_class_1->code_word_list) { - cJSON *code_word_listList = cJSON_AddArrayToObject(item, "codeWordList"); - if (code_word_listList == NULL) { - ogs_error("OpenAPI_default_unrelated_class_1_convertToJSON() failed [code_word_list]"); - goto end; - } - OpenAPI_list_for_each(default_unrelated_class_1->code_word_list, node) { - if (cJSON_AddStringToObject(code_word_listList, "", (char*)node->data) == NULL) { - ogs_error("OpenAPI_default_unrelated_class_1_convertToJSON() failed [code_word_list]"); - goto end; - } - } - } - -end: - return item; -} - -OpenAPI_default_unrelated_class_1_t *OpenAPI_default_unrelated_class_1_parseFromJSON(cJSON *default_unrelated_class_1JSON) -{ - OpenAPI_default_unrelated_class_1_t *default_unrelated_class_1_local_var = NULL; - OpenAPI_lnode_t *node = NULL; - cJSON *allowed_geographic_area = NULL; - OpenAPI_list_t *allowed_geographic_areaList = NULL; - cJSON *privacy_check_related_action = NULL; - OpenAPI_privacy_check_related_action_e privacy_check_related_actionVariable = 0; - cJSON *code_word_ind = NULL; - OpenAPI_code_word_ind_e code_word_indVariable = 0; - cJSON *valid_time_period = NULL; - OpenAPI_valid_time_period_1_t *valid_time_period_local_nonprim = NULL; - cJSON *code_word_list = NULL; - OpenAPI_list_t *code_word_listList = NULL; - allowed_geographic_area = cJSON_GetObjectItemCaseSensitive(default_unrelated_class_1JSON, "allowedGeographicArea"); - if (allowed_geographic_area) { - cJSON *allowed_geographic_area_local = NULL; - if (!cJSON_IsArray(allowed_geographic_area)) { - ogs_error("OpenAPI_default_unrelated_class_1_parseFromJSON() failed [allowed_geographic_area]"); - goto end; - } - - allowed_geographic_areaList = OpenAPI_list_create(); - - cJSON_ArrayForEach(allowed_geographic_area_local, allowed_geographic_area) { - if (!cJSON_IsObject(allowed_geographic_area_local)) { - ogs_error("OpenAPI_default_unrelated_class_1_parseFromJSON() failed [allowed_geographic_area]"); - goto end; - } - OpenAPI_geographic_area_t *allowed_geographic_areaItem = OpenAPI_geographic_area_parseFromJSON(allowed_geographic_area_local); - if (!allowed_geographic_areaItem) { - ogs_error("No allowed_geographic_areaItem"); - OpenAPI_list_free(allowed_geographic_areaList); - goto end; - } - OpenAPI_list_add(allowed_geographic_areaList, allowed_geographic_areaItem); - } - } - - privacy_check_related_action = cJSON_GetObjectItemCaseSensitive(default_unrelated_class_1JSON, "privacyCheckRelatedAction"); - if (privacy_check_related_action) { - if (!cJSON_IsString(privacy_check_related_action)) { - ogs_error("OpenAPI_default_unrelated_class_1_parseFromJSON() failed [privacy_check_related_action]"); - goto end; - } - privacy_check_related_actionVariable = OpenAPI_privacy_check_related_action_FromString(privacy_check_related_action->valuestring); - } - - code_word_ind = cJSON_GetObjectItemCaseSensitive(default_unrelated_class_1JSON, "codeWordInd"); - if (code_word_ind) { - if (!cJSON_IsString(code_word_ind)) { - ogs_error("OpenAPI_default_unrelated_class_1_parseFromJSON() failed [code_word_ind]"); - goto end; - } - code_word_indVariable = OpenAPI_code_word_ind_FromString(code_word_ind->valuestring); - } - - valid_time_period = cJSON_GetObjectItemCaseSensitive(default_unrelated_class_1JSON, "validTimePeriod"); - if (valid_time_period) { - valid_time_period_local_nonprim = OpenAPI_valid_time_period_1_parseFromJSON(valid_time_period); - } - - code_word_list = cJSON_GetObjectItemCaseSensitive(default_unrelated_class_1JSON, "codeWordList"); - if (code_word_list) { - cJSON *code_word_list_local = NULL; - if (!cJSON_IsArray(code_word_list)) { - ogs_error("OpenAPI_default_unrelated_class_1_parseFromJSON() failed [code_word_list]"); - goto end; - } - - code_word_listList = OpenAPI_list_create(); - - cJSON_ArrayForEach(code_word_list_local, code_word_list) { - double *localDouble = NULL; - int *localInt = NULL; - if (!cJSON_IsString(code_word_list_local)) { - ogs_error("OpenAPI_default_unrelated_class_1_parseFromJSON() failed [code_word_list]"); - goto end; - } - OpenAPI_list_add(code_word_listList, ogs_strdup(code_word_list_local->valuestring)); - } - } - - default_unrelated_class_1_local_var = OpenAPI_default_unrelated_class_1_create ( - allowed_geographic_area ? allowed_geographic_areaList : NULL, - privacy_check_related_action ? privacy_check_related_actionVariable : 0, - code_word_ind ? code_word_indVariable : 0, - valid_time_period ? valid_time_period_local_nonprim : NULL, - code_word_list ? code_word_listList : NULL - ); - - return default_unrelated_class_1_local_var; -end: - if (allowed_geographic_areaList) { - OpenAPI_list_for_each(allowed_geographic_areaList, node) { - OpenAPI_geographic_area_free(node->data); - } - OpenAPI_list_free(allowed_geographic_areaList); - allowed_geographic_areaList = NULL; - } - if (valid_time_period_local_nonprim) { - OpenAPI_valid_time_period_1_free(valid_time_period_local_nonprim); - valid_time_period_local_nonprim = NULL; - } - if (code_word_listList) { - OpenAPI_list_for_each(code_word_listList, node) { - ogs_free(node->data); - } - OpenAPI_list_free(code_word_listList); - code_word_listList = NULL; - } - return NULL; -} - -OpenAPI_default_unrelated_class_1_t *OpenAPI_default_unrelated_class_1_copy(OpenAPI_default_unrelated_class_1_t *dst, OpenAPI_default_unrelated_class_1_t *src) -{ - cJSON *item = NULL; - char *content = NULL; - - ogs_assert(src); - item = OpenAPI_default_unrelated_class_1_convertToJSON(src); - if (!item) { - ogs_error("OpenAPI_default_unrelated_class_1_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_default_unrelated_class_1_free(dst); - dst = OpenAPI_default_unrelated_class_1_parseFromJSON(item); - cJSON_Delete(item); - - return dst; -} - diff --git a/lib/sbi/openapi/model/default_unrelated_class_1.h b/lib/sbi/openapi/model/default_unrelated_class_1.h deleted file mode 100644 index 1374741de..000000000 --- a/lib/sbi/openapi/model/default_unrelated_class_1.h +++ /dev/null @@ -1,50 +0,0 @@ -/* - * default_unrelated_class_1.h - * - * - */ - -#ifndef _OpenAPI_default_unrelated_class_1_H_ -#define _OpenAPI_default_unrelated_class_1_H_ - -#include -#include "../external/cJSON.h" -#include "../include/list.h" -#include "../include/keyValuePair.h" -#include "../include/binary.h" -#include "code_word_ind.h" -#include "geographic_area.h" -#include "privacy_check_related_action.h" -#include "valid_time_period_1.h" - -#ifdef __cplusplus -extern "C" { -#endif - -typedef struct OpenAPI_default_unrelated_class_1_s OpenAPI_default_unrelated_class_1_t; -typedef struct OpenAPI_default_unrelated_class_1_s { - OpenAPI_list_t *allowed_geographic_area; - OpenAPI_privacy_check_related_action_e privacy_check_related_action; - OpenAPI_code_word_ind_e code_word_ind; - struct OpenAPI_valid_time_period_1_s *valid_time_period; - OpenAPI_list_t *code_word_list; -} OpenAPI_default_unrelated_class_1_t; - -OpenAPI_default_unrelated_class_1_t *OpenAPI_default_unrelated_class_1_create( - OpenAPI_list_t *allowed_geographic_area, - OpenAPI_privacy_check_related_action_e privacy_check_related_action, - OpenAPI_code_word_ind_e code_word_ind, - OpenAPI_valid_time_period_1_t *valid_time_period, - OpenAPI_list_t *code_word_list -); -void OpenAPI_default_unrelated_class_1_free(OpenAPI_default_unrelated_class_1_t *default_unrelated_class_1); -OpenAPI_default_unrelated_class_1_t *OpenAPI_default_unrelated_class_1_parseFromJSON(cJSON *default_unrelated_class_1JSON); -cJSON *OpenAPI_default_unrelated_class_1_convertToJSON(OpenAPI_default_unrelated_class_1_t *default_unrelated_class_1); -OpenAPI_default_unrelated_class_1_t *OpenAPI_default_unrelated_class_1_copy(OpenAPI_default_unrelated_class_1_t *dst, OpenAPI_default_unrelated_class_1_t *src); - -#ifdef __cplusplus -} -#endif - -#endif /* _OpenAPI_default_unrelated_class_1_H_ */ - diff --git a/lib/sbi/openapi/model/deregistration_info.h b/lib/sbi/openapi/model/deregistration_info.h index 87bd4b03c..abe5e7843 100644 --- a/lib/sbi/openapi/model/deregistration_info.h +++ b/lib/sbi/openapi/model/deregistration_info.h @@ -1,7 +1,7 @@ /* * deregistration_info.h * - * + * Contains the UE id (i.e. SUPI). */ #ifndef _OpenAPI_deregistration_info_H_ diff --git a/lib/sbi/openapi/model/deregistration_reason.c b/lib/sbi/openapi/model/deregistration_reason.c index b0a4cfd79..640cd12f6 100644 --- a/lib/sbi/openapi/model/deregistration_reason.c +++ b/lib/sbi/openapi/model/deregistration_reason.c @@ -6,7 +6,7 @@ char* OpenAPI_deregistration_reason_ToString(OpenAPI_deregistration_reason_e deregistration_reason) { - const char *deregistration_reasonArray[] = { "NULL", "UE_INITIAL_REGISTRATION", "UE_REGISTRATION_AREA_CHANGE", "SUBSCRIPTION_WITHDRAWN", "5GS_TO_EPS_MOBILITY", "5GS_TO_EPS_MOBILITY_UE_INITIAL_REGISTRATION", "REREGISTRATION_REQUIRED", "SMF_CONTEXT_TRANSFERRED" }; + const char *deregistration_reasonArray[] = { "NULL", "UE_INITIAL_REGISTRATION", "UE_REGISTRATION_AREA_CHANGE", "SUBSCRIPTION_WITHDRAWN", "5GS_TO_EPS_MOBILITY", "5GS_TO_EPS_MOBILITY_UE_INITIAL_REGISTRATION", "REREGISTRATION_REQUIRED", "SMF_CONTEXT_TRANSFERRED", "DUPLICATE_PDU_SESSION", "5G_SRVCC_TO_UTRAN_MOBILITY" }; size_t sizeofArray = sizeof(deregistration_reasonArray) / sizeof(deregistration_reasonArray[0]); if (deregistration_reason < sizeofArray) return (char *)deregistration_reasonArray[deregistration_reason]; @@ -17,7 +17,7 @@ char* OpenAPI_deregistration_reason_ToString(OpenAPI_deregistration_reason_e der OpenAPI_deregistration_reason_e OpenAPI_deregistration_reason_FromString(char* deregistration_reason) { int stringToReturn = 0; - const char *deregistration_reasonArray[] = { "NULL", "UE_INITIAL_REGISTRATION", "UE_REGISTRATION_AREA_CHANGE", "SUBSCRIPTION_WITHDRAWN", "5GS_TO_EPS_MOBILITY", "5GS_TO_EPS_MOBILITY_UE_INITIAL_REGISTRATION", "REREGISTRATION_REQUIRED", "SMF_CONTEXT_TRANSFERRED" }; + const char *deregistration_reasonArray[] = { "NULL", "UE_INITIAL_REGISTRATION", "UE_REGISTRATION_AREA_CHANGE", "SUBSCRIPTION_WITHDRAWN", "5GS_TO_EPS_MOBILITY", "5GS_TO_EPS_MOBILITY_UE_INITIAL_REGISTRATION", "REREGISTRATION_REQUIRED", "SMF_CONTEXT_TRANSFERRED", "DUPLICATE_PDU_SESSION", "5G_SRVCC_TO_UTRAN_MOBILITY" }; size_t sizeofArray = sizeof(deregistration_reasonArray) / sizeof(deregistration_reasonArray[0]); while (stringToReturn < sizeofArray) { if (strcmp(deregistration_reason, deregistration_reasonArray[stringToReturn]) == 0) { diff --git a/lib/sbi/openapi/model/deregistration_reason.h b/lib/sbi/openapi/model/deregistration_reason.h index cf2ed170b..644321741 100644 --- a/lib/sbi/openapi/model/deregistration_reason.h +++ b/lib/sbi/openapi/model/deregistration_reason.h @@ -17,7 +17,7 @@ extern "C" { #endif -typedef enum { OpenAPI_deregistration_reason_NULL = 0, OpenAPI_deregistration_reason_UE_INITIAL_REGISTRATION, OpenAPI_deregistration_reason_UE_REGISTRATION_AREA_CHANGE, OpenAPI_deregistration_reason_SUBSCRIPTION_WITHDRAWN, OpenAPI_deregistration_reason__5GS_TO_EPS_MOBILITY, OpenAPI_deregistration_reason__5GS_TO_EPS_MOBILITY_UE_INITIAL_REGISTRATION, OpenAPI_deregistration_reason_REREGISTRATION_REQUIRED, OpenAPI_deregistration_reason_SMF_CONTEXT_TRANSFERRED } OpenAPI_deregistration_reason_e; +typedef enum { OpenAPI_deregistration_reason_NULL = 0, OpenAPI_deregistration_reason_UE_INITIAL_REGISTRATION, OpenAPI_deregistration_reason_UE_REGISTRATION_AREA_CHANGE, OpenAPI_deregistration_reason_SUBSCRIPTION_WITHDRAWN, OpenAPI_deregistration_reason__5GS_TO_EPS_MOBILITY, OpenAPI_deregistration_reason__5GS_TO_EPS_MOBILITY_UE_INITIAL_REGISTRATION, OpenAPI_deregistration_reason_REREGISTRATION_REQUIRED, OpenAPI_deregistration_reason_SMF_CONTEXT_TRANSFERRED, OpenAPI_deregistration_reason_DUPLICATE_PDU_SESSION, OpenAPI_deregistration_reason__5G_SRVCC_TO_UTRAN_MOBILITY } OpenAPI_deregistration_reason_e; char* OpenAPI_deregistration_reason_ToString(OpenAPI_deregistration_reason_e deregistration_reason); diff --git a/lib/sbi/openapi/model/dispersion_area.c b/lib/sbi/openapi/model/dispersion_area.c new file mode 100644 index 000000000..e6325f349 --- /dev/null +++ b/lib/sbi/openapi/model/dispersion_area.c @@ -0,0 +1,289 @@ + +#include +#include +#include +#include "dispersion_area.h" + +OpenAPI_dispersion_area_t *OpenAPI_dispersion_area_create( + OpenAPI_list_t *tai_list, + OpenAPI_list_t *ncgi_list, + OpenAPI_list_t *ecgi_list, + bool is_n3ga_ind, + int n3ga_ind +) +{ + OpenAPI_dispersion_area_t *dispersion_area_local_var = ogs_malloc(sizeof(OpenAPI_dispersion_area_t)); + ogs_assert(dispersion_area_local_var); + + dispersion_area_local_var->tai_list = tai_list; + dispersion_area_local_var->ncgi_list = ncgi_list; + dispersion_area_local_var->ecgi_list = ecgi_list; + dispersion_area_local_var->is_n3ga_ind = is_n3ga_ind; + dispersion_area_local_var->n3ga_ind = n3ga_ind; + + return dispersion_area_local_var; +} + +void OpenAPI_dispersion_area_free(OpenAPI_dispersion_area_t *dispersion_area) +{ + OpenAPI_lnode_t *node = NULL; + + if (NULL == dispersion_area) { + return; + } + if (dispersion_area->tai_list) { + OpenAPI_list_for_each(dispersion_area->tai_list, node) { + OpenAPI_tai_free(node->data); + } + OpenAPI_list_free(dispersion_area->tai_list); + dispersion_area->tai_list = NULL; + } + if (dispersion_area->ncgi_list) { + OpenAPI_list_for_each(dispersion_area->ncgi_list, node) { + OpenAPI_ncgi_free(node->data); + } + OpenAPI_list_free(dispersion_area->ncgi_list); + dispersion_area->ncgi_list = NULL; + } + if (dispersion_area->ecgi_list) { + OpenAPI_list_for_each(dispersion_area->ecgi_list, node) { + OpenAPI_ecgi_free(node->data); + } + OpenAPI_list_free(dispersion_area->ecgi_list); + dispersion_area->ecgi_list = NULL; + } + ogs_free(dispersion_area); +} + +cJSON *OpenAPI_dispersion_area_convertToJSON(OpenAPI_dispersion_area_t *dispersion_area) +{ + cJSON *item = NULL; + OpenAPI_lnode_t *node = NULL; + + if (dispersion_area == NULL) { + ogs_error("OpenAPI_dispersion_area_convertToJSON() failed [DispersionArea]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (dispersion_area->tai_list) { + cJSON *tai_listList = cJSON_AddArrayToObject(item, "taiList"); + if (tai_listList == NULL) { + ogs_error("OpenAPI_dispersion_area_convertToJSON() failed [tai_list]"); + goto end; + } + OpenAPI_list_for_each(dispersion_area->tai_list, node) { + cJSON *itemLocal = OpenAPI_tai_convertToJSON(node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_dispersion_area_convertToJSON() failed [tai_list]"); + goto end; + } + cJSON_AddItemToArray(tai_listList, itemLocal); + } + } + + if (dispersion_area->ncgi_list) { + cJSON *ncgi_listList = cJSON_AddArrayToObject(item, "ncgiList"); + if (ncgi_listList == NULL) { + ogs_error("OpenAPI_dispersion_area_convertToJSON() failed [ncgi_list]"); + goto end; + } + OpenAPI_list_for_each(dispersion_area->ncgi_list, node) { + cJSON *itemLocal = OpenAPI_ncgi_convertToJSON(node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_dispersion_area_convertToJSON() failed [ncgi_list]"); + goto end; + } + cJSON_AddItemToArray(ncgi_listList, itemLocal); + } + } + + if (dispersion_area->ecgi_list) { + cJSON *ecgi_listList = cJSON_AddArrayToObject(item, "ecgiList"); + if (ecgi_listList == NULL) { + ogs_error("OpenAPI_dispersion_area_convertToJSON() failed [ecgi_list]"); + goto end; + } + OpenAPI_list_for_each(dispersion_area->ecgi_list, node) { + cJSON *itemLocal = OpenAPI_ecgi_convertToJSON(node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_dispersion_area_convertToJSON() failed [ecgi_list]"); + goto end; + } + cJSON_AddItemToArray(ecgi_listList, itemLocal); + } + } + + if (dispersion_area->is_n3ga_ind) { + if (cJSON_AddBoolToObject(item, "n3gaInd", dispersion_area->n3ga_ind) == NULL) { + ogs_error("OpenAPI_dispersion_area_convertToJSON() failed [n3ga_ind]"); + goto end; + } + } + +end: + return item; +} + +OpenAPI_dispersion_area_t *OpenAPI_dispersion_area_parseFromJSON(cJSON *dispersion_areaJSON) +{ + OpenAPI_dispersion_area_t *dispersion_area_local_var = NULL; + OpenAPI_lnode_t *node = NULL; + cJSON *tai_list = NULL; + OpenAPI_list_t *tai_listList = NULL; + cJSON *ncgi_list = NULL; + OpenAPI_list_t *ncgi_listList = NULL; + cJSON *ecgi_list = NULL; + OpenAPI_list_t *ecgi_listList = NULL; + cJSON *n3ga_ind = NULL; + tai_list = cJSON_GetObjectItemCaseSensitive(dispersion_areaJSON, "taiList"); + if (tai_list) { + cJSON *tai_list_local = NULL; + if (!cJSON_IsArray(tai_list)) { + ogs_error("OpenAPI_dispersion_area_parseFromJSON() failed [tai_list]"); + goto end; + } + + tai_listList = OpenAPI_list_create(); + + cJSON_ArrayForEach(tai_list_local, tai_list) { + if (!cJSON_IsObject(tai_list_local)) { + ogs_error("OpenAPI_dispersion_area_parseFromJSON() failed [tai_list]"); + goto end; + } + OpenAPI_tai_t *tai_listItem = OpenAPI_tai_parseFromJSON(tai_list_local); + if (!tai_listItem) { + ogs_error("No tai_listItem"); + OpenAPI_list_free(tai_listList); + goto end; + } + OpenAPI_list_add(tai_listList, tai_listItem); + } + } + + ncgi_list = cJSON_GetObjectItemCaseSensitive(dispersion_areaJSON, "ncgiList"); + if (ncgi_list) { + cJSON *ncgi_list_local = NULL; + if (!cJSON_IsArray(ncgi_list)) { + ogs_error("OpenAPI_dispersion_area_parseFromJSON() failed [ncgi_list]"); + goto end; + } + + ncgi_listList = OpenAPI_list_create(); + + cJSON_ArrayForEach(ncgi_list_local, ncgi_list) { + if (!cJSON_IsObject(ncgi_list_local)) { + ogs_error("OpenAPI_dispersion_area_parseFromJSON() failed [ncgi_list]"); + goto end; + } + OpenAPI_ncgi_t *ncgi_listItem = OpenAPI_ncgi_parseFromJSON(ncgi_list_local); + if (!ncgi_listItem) { + ogs_error("No ncgi_listItem"); + OpenAPI_list_free(ncgi_listList); + goto end; + } + OpenAPI_list_add(ncgi_listList, ncgi_listItem); + } + } + + ecgi_list = cJSON_GetObjectItemCaseSensitive(dispersion_areaJSON, "ecgiList"); + if (ecgi_list) { + cJSON *ecgi_list_local = NULL; + if (!cJSON_IsArray(ecgi_list)) { + ogs_error("OpenAPI_dispersion_area_parseFromJSON() failed [ecgi_list]"); + goto end; + } + + ecgi_listList = OpenAPI_list_create(); + + cJSON_ArrayForEach(ecgi_list_local, ecgi_list) { + if (!cJSON_IsObject(ecgi_list_local)) { + ogs_error("OpenAPI_dispersion_area_parseFromJSON() failed [ecgi_list]"); + goto end; + } + OpenAPI_ecgi_t *ecgi_listItem = OpenAPI_ecgi_parseFromJSON(ecgi_list_local); + if (!ecgi_listItem) { + ogs_error("No ecgi_listItem"); + OpenAPI_list_free(ecgi_listList); + goto end; + } + OpenAPI_list_add(ecgi_listList, ecgi_listItem); + } + } + + n3ga_ind = cJSON_GetObjectItemCaseSensitive(dispersion_areaJSON, "n3gaInd"); + if (n3ga_ind) { + if (!cJSON_IsBool(n3ga_ind)) { + ogs_error("OpenAPI_dispersion_area_parseFromJSON() failed [n3ga_ind]"); + goto end; + } + } + + dispersion_area_local_var = OpenAPI_dispersion_area_create ( + tai_list ? tai_listList : NULL, + ncgi_list ? ncgi_listList : NULL, + ecgi_list ? ecgi_listList : NULL, + n3ga_ind ? true : false, + n3ga_ind ? n3ga_ind->valueint : 0 + ); + + return dispersion_area_local_var; +end: + if (tai_listList) { + OpenAPI_list_for_each(tai_listList, node) { + OpenAPI_tai_free(node->data); + } + OpenAPI_list_free(tai_listList); + tai_listList = NULL; + } + if (ncgi_listList) { + OpenAPI_list_for_each(ncgi_listList, node) { + OpenAPI_ncgi_free(node->data); + } + OpenAPI_list_free(ncgi_listList); + ncgi_listList = NULL; + } + if (ecgi_listList) { + OpenAPI_list_for_each(ecgi_listList, node) { + OpenAPI_ecgi_free(node->data); + } + OpenAPI_list_free(ecgi_listList); + ecgi_listList = NULL; + } + return NULL; +} + +OpenAPI_dispersion_area_t *OpenAPI_dispersion_area_copy(OpenAPI_dispersion_area_t *dst, OpenAPI_dispersion_area_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_dispersion_area_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_dispersion_area_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_dispersion_area_free(dst); + dst = OpenAPI_dispersion_area_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/dispersion_area.h b/lib/sbi/openapi/model/dispersion_area.h new file mode 100644 index 000000000..2261e70ae --- /dev/null +++ b/lib/sbi/openapi/model/dispersion_area.h @@ -0,0 +1,49 @@ +/* + * dispersion_area.h + * + * Dispersion Area + */ + +#ifndef _OpenAPI_dispersion_area_H_ +#define _OpenAPI_dispersion_area_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "ecgi.h" +#include "ncgi.h" +#include "tai.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_dispersion_area_s OpenAPI_dispersion_area_t; +typedef struct OpenAPI_dispersion_area_s { + OpenAPI_list_t *tai_list; + OpenAPI_list_t *ncgi_list; + OpenAPI_list_t *ecgi_list; + bool is_n3ga_ind; + int n3ga_ind; +} OpenAPI_dispersion_area_t; + +OpenAPI_dispersion_area_t *OpenAPI_dispersion_area_create( + OpenAPI_list_t *tai_list, + OpenAPI_list_t *ncgi_list, + OpenAPI_list_t *ecgi_list, + bool is_n3ga_ind, + int n3ga_ind +); +void OpenAPI_dispersion_area_free(OpenAPI_dispersion_area_t *dispersion_area); +OpenAPI_dispersion_area_t *OpenAPI_dispersion_area_parseFromJSON(cJSON *dispersion_areaJSON); +cJSON *OpenAPI_dispersion_area_convertToJSON(OpenAPI_dispersion_area_t *dispersion_area); +OpenAPI_dispersion_area_t *OpenAPI_dispersion_area_copy(OpenAPI_dispersion_area_t *dst, OpenAPI_dispersion_area_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_dispersion_area_H_ */ + diff --git a/lib/sbi/openapi/model/dispersion_class.c b/lib/sbi/openapi/model/dispersion_class.c new file mode 100644 index 000000000..377822ecf --- /dev/null +++ b/lib/sbi/openapi/model/dispersion_class.c @@ -0,0 +1,87 @@ + +#include +#include +#include +#include "dispersion_class.h" + +OpenAPI_dispersion_class_t *OpenAPI_dispersion_class_create( +) +{ + OpenAPI_dispersion_class_t *dispersion_class_local_var = ogs_malloc(sizeof(OpenAPI_dispersion_class_t)); + ogs_assert(dispersion_class_local_var); + + + return dispersion_class_local_var; +} + +void OpenAPI_dispersion_class_free(OpenAPI_dispersion_class_t *dispersion_class) +{ + OpenAPI_lnode_t *node = NULL; + + if (NULL == dispersion_class) { + return; + } + ogs_free(dispersion_class); +} + +cJSON *OpenAPI_dispersion_class_convertToJSON(OpenAPI_dispersion_class_t *dispersion_class) +{ + cJSON *item = NULL; + OpenAPI_lnode_t *node = NULL; + + if (dispersion_class == NULL) { + ogs_error("OpenAPI_dispersion_class_convertToJSON() failed [DispersionClass]"); + return NULL; + } + + item = cJSON_CreateObject(); +end: + return item; +} + +OpenAPI_dispersion_class_t *OpenAPI_dispersion_class_parseFromJSON(cJSON *dispersion_classJSON) +{ + OpenAPI_dispersion_class_t *dispersion_class_local_var = NULL; + OpenAPI_lnode_t *node = NULL; + dispersion_class_local_var = OpenAPI_dispersion_class_create ( + ); + + return dispersion_class_local_var; +end: + return NULL; +} + +OpenAPI_dispersion_class_t *OpenAPI_dispersion_class_copy(OpenAPI_dispersion_class_t *dst, OpenAPI_dispersion_class_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_dispersion_class_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_dispersion_class_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_dispersion_class_free(dst); + dst = OpenAPI_dispersion_class_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/dispersion_class.h b/lib/sbi/openapi/model/dispersion_class.h new file mode 100644 index 000000000..8cb2da1fe --- /dev/null +++ b/lib/sbi/openapi/model/dispersion_class.h @@ -0,0 +1,37 @@ +/* + * dispersion_class.h + * + * Possible values are: - FIXED: Dispersion class as fixed UE its data or transaction usage at a location or a slice, is higher than its class threshold set for its all data or transaction usage. - CAMPER: Dispersion class as camper UE, its data or transaction usage at a location or a slice, is higher than its class threshold and lower than the fixed class threshold set for its all data or transaction usage.. - TRAVELLER: Dispersion class as traveller UE, its data or transaction usage at a location or a slice, is lower than the camper class threshold set for its all data or transaction usage. - TOP_HEAVY: Dispersion class as Top_Heavy UE, who's dispersion percentile rating at a location or a slice, is higher than its class threshold. + */ + +#ifndef _OpenAPI_dispersion_class_H_ +#define _OpenAPI_dispersion_class_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "dispersion_class_one_of.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_dispersion_class_s OpenAPI_dispersion_class_t; +typedef struct OpenAPI_dispersion_class_s { +} OpenAPI_dispersion_class_t; + +OpenAPI_dispersion_class_t *OpenAPI_dispersion_class_create( +); +void OpenAPI_dispersion_class_free(OpenAPI_dispersion_class_t *dispersion_class); +OpenAPI_dispersion_class_t *OpenAPI_dispersion_class_parseFromJSON(cJSON *dispersion_classJSON); +cJSON *OpenAPI_dispersion_class_convertToJSON(OpenAPI_dispersion_class_t *dispersion_class); +OpenAPI_dispersion_class_t *OpenAPI_dispersion_class_copy(OpenAPI_dispersion_class_t *dst, OpenAPI_dispersion_class_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_dispersion_class_H_ */ + diff --git a/lib/sbi/openapi/model/dispersion_class_one_of.c b/lib/sbi/openapi/model/dispersion_class_one_of.c new file mode 100644 index 000000000..ac931ec3c --- /dev/null +++ b/lib/sbi/openapi/model/dispersion_class_one_of.c @@ -0,0 +1,30 @@ + +#include +#include +#include +#include "dispersion_class_one_of.h" + +char* OpenAPI_dispersion_class_one_of_ToString(OpenAPI_dispersion_class_one_of_e dispersion_class_one_of) +{ + const char *dispersion_class_one_ofArray[] = { "NULL", "FIXED", "CAMPER", "TRAVELLER", "TOP_HEAVY" }; + size_t sizeofArray = sizeof(dispersion_class_one_ofArray) / sizeof(dispersion_class_one_ofArray[0]); + if (dispersion_class_one_of < sizeofArray) + return (char *)dispersion_class_one_ofArray[dispersion_class_one_of]; + else + return (char *)"Unknown"; +} + +OpenAPI_dispersion_class_one_of_e OpenAPI_dispersion_class_one_of_FromString(char* dispersion_class_one_of) +{ + int stringToReturn = 0; + const char *dispersion_class_one_ofArray[] = { "NULL", "FIXED", "CAMPER", "TRAVELLER", "TOP_HEAVY" }; + size_t sizeofArray = sizeof(dispersion_class_one_ofArray) / sizeof(dispersion_class_one_ofArray[0]); + while (stringToReturn < sizeofArray) { + if (strcmp(dispersion_class_one_of, dispersion_class_one_ofArray[stringToReturn]) == 0) { + return stringToReturn; + } + stringToReturn++; + } + return 0; +} + diff --git a/lib/sbi/openapi/model/dispersion_class_one_of.h b/lib/sbi/openapi/model/dispersion_class_one_of.h new file mode 100644 index 000000000..ae1ece45b --- /dev/null +++ b/lib/sbi/openapi/model/dispersion_class_one_of.h @@ -0,0 +1,31 @@ +/* + * dispersion_class_one_of.h + * + * + */ + +#ifndef _OpenAPI_dispersion_class_one_of_H_ +#define _OpenAPI_dispersion_class_one_of_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef enum { OpenAPI_dispersion_class_one_of_NULL = 0, OpenAPI_dispersion_class_one_of_FIXED, OpenAPI_dispersion_class_one_of_CAMPER, OpenAPI_dispersion_class_one_of_TRAVELLER, OpenAPI_dispersion_class_one_of_TOP_HEAVY } OpenAPI_dispersion_class_one_of_e; + +char* OpenAPI_dispersion_class_one_of_ToString(OpenAPI_dispersion_class_one_of_e dispersion_class_one_of); + +OpenAPI_dispersion_class_one_of_e OpenAPI_dispersion_class_one_of_FromString(char* dispersion_class_one_of); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_dispersion_class_one_of_H_ */ + diff --git a/lib/sbi/openapi/model/dispersion_collection.c b/lib/sbi/openapi/model/dispersion_collection.c new file mode 100644 index 000000000..122384049 --- /dev/null +++ b/lib/sbi/openapi/model/dispersion_collection.c @@ -0,0 +1,458 @@ + +#include +#include +#include +#include "dispersion_collection.h" + +OpenAPI_dispersion_collection_t *OpenAPI_dispersion_collection_create( + OpenAPI_user_location_t *ue_loc, + OpenAPI_snssai_t *snssai, + OpenAPI_list_t *supis, + OpenAPI_list_t *gpsis, + OpenAPI_list_t *app_volumes, + bool is_disper_amount, + int disper_amount, + OpenAPI_dispersion_class_t *disper_class, + bool is_usage_rank, + int usage_rank, + bool is_percentile_rank, + int percentile_rank, + bool is_ue_ratio, + int ue_ratio, + bool is_confidence, + int confidence +) +{ + OpenAPI_dispersion_collection_t *dispersion_collection_local_var = ogs_malloc(sizeof(OpenAPI_dispersion_collection_t)); + ogs_assert(dispersion_collection_local_var); + + dispersion_collection_local_var->ue_loc = ue_loc; + dispersion_collection_local_var->snssai = snssai; + dispersion_collection_local_var->supis = supis; + dispersion_collection_local_var->gpsis = gpsis; + dispersion_collection_local_var->app_volumes = app_volumes; + dispersion_collection_local_var->is_disper_amount = is_disper_amount; + dispersion_collection_local_var->disper_amount = disper_amount; + dispersion_collection_local_var->disper_class = disper_class; + dispersion_collection_local_var->is_usage_rank = is_usage_rank; + dispersion_collection_local_var->usage_rank = usage_rank; + dispersion_collection_local_var->is_percentile_rank = is_percentile_rank; + dispersion_collection_local_var->percentile_rank = percentile_rank; + dispersion_collection_local_var->is_ue_ratio = is_ue_ratio; + dispersion_collection_local_var->ue_ratio = ue_ratio; + dispersion_collection_local_var->is_confidence = is_confidence; + dispersion_collection_local_var->confidence = confidence; + + return dispersion_collection_local_var; +} + +void OpenAPI_dispersion_collection_free(OpenAPI_dispersion_collection_t *dispersion_collection) +{ + OpenAPI_lnode_t *node = NULL; + + if (NULL == dispersion_collection) { + return; + } + if (dispersion_collection->ue_loc) { + OpenAPI_user_location_free(dispersion_collection->ue_loc); + dispersion_collection->ue_loc = NULL; + } + if (dispersion_collection->snssai) { + OpenAPI_snssai_free(dispersion_collection->snssai); + dispersion_collection->snssai = NULL; + } + if (dispersion_collection->supis) { + OpenAPI_list_for_each(dispersion_collection->supis, node) { + ogs_free(node->data); + } + OpenAPI_list_free(dispersion_collection->supis); + dispersion_collection->supis = NULL; + } + if (dispersion_collection->gpsis) { + OpenAPI_list_for_each(dispersion_collection->gpsis, node) { + ogs_free(node->data); + } + OpenAPI_list_free(dispersion_collection->gpsis); + dispersion_collection->gpsis = NULL; + } + if (dispersion_collection->app_volumes) { + OpenAPI_list_for_each(dispersion_collection->app_volumes, node) { + OpenAPI_application_volume_free(node->data); + } + OpenAPI_list_free(dispersion_collection->app_volumes); + dispersion_collection->app_volumes = NULL; + } + if (dispersion_collection->disper_class) { + OpenAPI_dispersion_class_free(dispersion_collection->disper_class); + dispersion_collection->disper_class = NULL; + } + ogs_free(dispersion_collection); +} + +cJSON *OpenAPI_dispersion_collection_convertToJSON(OpenAPI_dispersion_collection_t *dispersion_collection) +{ + cJSON *item = NULL; + OpenAPI_lnode_t *node = NULL; + + if (dispersion_collection == NULL) { + ogs_error("OpenAPI_dispersion_collection_convertToJSON() failed [DispersionCollection]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (dispersion_collection->ue_loc) { + cJSON *ue_loc_local_JSON = OpenAPI_user_location_convertToJSON(dispersion_collection->ue_loc); + if (ue_loc_local_JSON == NULL) { + ogs_error("OpenAPI_dispersion_collection_convertToJSON() failed [ue_loc]"); + goto end; + } + cJSON_AddItemToObject(item, "ueLoc", ue_loc_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_dispersion_collection_convertToJSON() failed [ue_loc]"); + goto end; + } + } + + if (dispersion_collection->snssai) { + cJSON *snssai_local_JSON = OpenAPI_snssai_convertToJSON(dispersion_collection->snssai); + if (snssai_local_JSON == NULL) { + ogs_error("OpenAPI_dispersion_collection_convertToJSON() failed [snssai]"); + goto end; + } + cJSON_AddItemToObject(item, "snssai", snssai_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_dispersion_collection_convertToJSON() failed [snssai]"); + goto end; + } + } + + if (dispersion_collection->supis) { + cJSON *supisList = cJSON_AddArrayToObject(item, "supis"); + if (supisList == NULL) { + ogs_error("OpenAPI_dispersion_collection_convertToJSON() failed [supis]"); + goto end; + } + OpenAPI_list_for_each(dispersion_collection->supis, node) { + if (cJSON_AddStringToObject(supisList, "", (char*)node->data) == NULL) { + ogs_error("OpenAPI_dispersion_collection_convertToJSON() failed [supis]"); + goto end; + } + } + } + + if (dispersion_collection->gpsis) { + cJSON *gpsisList = cJSON_AddArrayToObject(item, "gpsis"); + if (gpsisList == NULL) { + ogs_error("OpenAPI_dispersion_collection_convertToJSON() failed [gpsis]"); + goto end; + } + OpenAPI_list_for_each(dispersion_collection->gpsis, node) { + if (cJSON_AddStringToObject(gpsisList, "", (char*)node->data) == NULL) { + ogs_error("OpenAPI_dispersion_collection_convertToJSON() failed [gpsis]"); + goto end; + } + } + } + + if (dispersion_collection->app_volumes) { + cJSON *app_volumesList = cJSON_AddArrayToObject(item, "appVolumes"); + if (app_volumesList == NULL) { + ogs_error("OpenAPI_dispersion_collection_convertToJSON() failed [app_volumes]"); + goto end; + } + OpenAPI_list_for_each(dispersion_collection->app_volumes, node) { + cJSON *itemLocal = OpenAPI_application_volume_convertToJSON(node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_dispersion_collection_convertToJSON() failed [app_volumes]"); + goto end; + } + cJSON_AddItemToArray(app_volumesList, itemLocal); + } + } + + if (dispersion_collection->is_disper_amount) { + if (cJSON_AddNumberToObject(item, "disperAmount", dispersion_collection->disper_amount) == NULL) { + ogs_error("OpenAPI_dispersion_collection_convertToJSON() failed [disper_amount]"); + goto end; + } + } + + if (dispersion_collection->disper_class) { + cJSON *disper_class_local_JSON = OpenAPI_dispersion_class_convertToJSON(dispersion_collection->disper_class); + if (disper_class_local_JSON == NULL) { + ogs_error("OpenAPI_dispersion_collection_convertToJSON() failed [disper_class]"); + goto end; + } + cJSON_AddItemToObject(item, "disperClass", disper_class_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_dispersion_collection_convertToJSON() failed [disper_class]"); + goto end; + } + } + + if (dispersion_collection->is_usage_rank) { + if (cJSON_AddNumberToObject(item, "usageRank", dispersion_collection->usage_rank) == NULL) { + ogs_error("OpenAPI_dispersion_collection_convertToJSON() failed [usage_rank]"); + goto end; + } + } + + if (dispersion_collection->is_percentile_rank) { + if (cJSON_AddNumberToObject(item, "percentileRank", dispersion_collection->percentile_rank) == NULL) { + ogs_error("OpenAPI_dispersion_collection_convertToJSON() failed [percentile_rank]"); + goto end; + } + } + + if (dispersion_collection->is_ue_ratio) { + if (cJSON_AddNumberToObject(item, "ueRatio", dispersion_collection->ue_ratio) == NULL) { + ogs_error("OpenAPI_dispersion_collection_convertToJSON() failed [ue_ratio]"); + goto end; + } + } + + if (dispersion_collection->is_confidence) { + if (cJSON_AddNumberToObject(item, "confidence", dispersion_collection->confidence) == NULL) { + ogs_error("OpenAPI_dispersion_collection_convertToJSON() failed [confidence]"); + goto end; + } + } + +end: + return item; +} + +OpenAPI_dispersion_collection_t *OpenAPI_dispersion_collection_parseFromJSON(cJSON *dispersion_collectionJSON) +{ + OpenAPI_dispersion_collection_t *dispersion_collection_local_var = NULL; + OpenAPI_lnode_t *node = NULL; + cJSON *ue_loc = NULL; + OpenAPI_user_location_t *ue_loc_local_nonprim = NULL; + cJSON *snssai = NULL; + OpenAPI_snssai_t *snssai_local_nonprim = NULL; + cJSON *supis = NULL; + OpenAPI_list_t *supisList = NULL; + cJSON *gpsis = NULL; + OpenAPI_list_t *gpsisList = NULL; + cJSON *app_volumes = NULL; + OpenAPI_list_t *app_volumesList = NULL; + cJSON *disper_amount = NULL; + cJSON *disper_class = NULL; + OpenAPI_dispersion_class_t *disper_class_local_nonprim = NULL; + cJSON *usage_rank = NULL; + cJSON *percentile_rank = NULL; + cJSON *ue_ratio = NULL; + cJSON *confidence = NULL; + ue_loc = cJSON_GetObjectItemCaseSensitive(dispersion_collectionJSON, "ueLoc"); + if (ue_loc) { + ue_loc_local_nonprim = OpenAPI_user_location_parseFromJSON(ue_loc); + } + + snssai = cJSON_GetObjectItemCaseSensitive(dispersion_collectionJSON, "snssai"); + if (snssai) { + snssai_local_nonprim = OpenAPI_snssai_parseFromJSON(snssai); + } + + supis = cJSON_GetObjectItemCaseSensitive(dispersion_collectionJSON, "supis"); + if (supis) { + cJSON *supis_local = NULL; + if (!cJSON_IsArray(supis)) { + ogs_error("OpenAPI_dispersion_collection_parseFromJSON() failed [supis]"); + goto end; + } + + supisList = OpenAPI_list_create(); + + cJSON_ArrayForEach(supis_local, supis) { + double *localDouble = NULL; + int *localInt = NULL; + if (!cJSON_IsString(supis_local)) { + ogs_error("OpenAPI_dispersion_collection_parseFromJSON() failed [supis]"); + goto end; + } + OpenAPI_list_add(supisList, ogs_strdup(supis_local->valuestring)); + } + } + + gpsis = cJSON_GetObjectItemCaseSensitive(dispersion_collectionJSON, "gpsis"); + if (gpsis) { + cJSON *gpsis_local = NULL; + if (!cJSON_IsArray(gpsis)) { + ogs_error("OpenAPI_dispersion_collection_parseFromJSON() failed [gpsis]"); + goto end; + } + + gpsisList = OpenAPI_list_create(); + + cJSON_ArrayForEach(gpsis_local, gpsis) { + double *localDouble = NULL; + int *localInt = NULL; + if (!cJSON_IsString(gpsis_local)) { + ogs_error("OpenAPI_dispersion_collection_parseFromJSON() failed [gpsis]"); + goto end; + } + OpenAPI_list_add(gpsisList, ogs_strdup(gpsis_local->valuestring)); + } + } + + app_volumes = cJSON_GetObjectItemCaseSensitive(dispersion_collectionJSON, "appVolumes"); + if (app_volumes) { + cJSON *app_volumes_local = NULL; + if (!cJSON_IsArray(app_volumes)) { + ogs_error("OpenAPI_dispersion_collection_parseFromJSON() failed [app_volumes]"); + goto end; + } + + app_volumesList = OpenAPI_list_create(); + + cJSON_ArrayForEach(app_volumes_local, app_volumes) { + if (!cJSON_IsObject(app_volumes_local)) { + ogs_error("OpenAPI_dispersion_collection_parseFromJSON() failed [app_volumes]"); + goto end; + } + OpenAPI_application_volume_t *app_volumesItem = OpenAPI_application_volume_parseFromJSON(app_volumes_local); + if (!app_volumesItem) { + ogs_error("No app_volumesItem"); + OpenAPI_list_free(app_volumesList); + goto end; + } + OpenAPI_list_add(app_volumesList, app_volumesItem); + } + } + + disper_amount = cJSON_GetObjectItemCaseSensitive(dispersion_collectionJSON, "disperAmount"); + if (disper_amount) { + if (!cJSON_IsNumber(disper_amount)) { + ogs_error("OpenAPI_dispersion_collection_parseFromJSON() failed [disper_amount]"); + goto end; + } + } + + disper_class = cJSON_GetObjectItemCaseSensitive(dispersion_collectionJSON, "disperClass"); + if (disper_class) { + disper_class_local_nonprim = OpenAPI_dispersion_class_parseFromJSON(disper_class); + } + + usage_rank = cJSON_GetObjectItemCaseSensitive(dispersion_collectionJSON, "usageRank"); + if (usage_rank) { + if (!cJSON_IsNumber(usage_rank)) { + ogs_error("OpenAPI_dispersion_collection_parseFromJSON() failed [usage_rank]"); + goto end; + } + } + + percentile_rank = cJSON_GetObjectItemCaseSensitive(dispersion_collectionJSON, "percentileRank"); + if (percentile_rank) { + if (!cJSON_IsNumber(percentile_rank)) { + ogs_error("OpenAPI_dispersion_collection_parseFromJSON() failed [percentile_rank]"); + goto end; + } + } + + ue_ratio = cJSON_GetObjectItemCaseSensitive(dispersion_collectionJSON, "ueRatio"); + if (ue_ratio) { + if (!cJSON_IsNumber(ue_ratio)) { + ogs_error("OpenAPI_dispersion_collection_parseFromJSON() failed [ue_ratio]"); + goto end; + } + } + + confidence = cJSON_GetObjectItemCaseSensitive(dispersion_collectionJSON, "confidence"); + if (confidence) { + if (!cJSON_IsNumber(confidence)) { + ogs_error("OpenAPI_dispersion_collection_parseFromJSON() failed [confidence]"); + goto end; + } + } + + dispersion_collection_local_var = OpenAPI_dispersion_collection_create ( + ue_loc ? ue_loc_local_nonprim : NULL, + snssai ? snssai_local_nonprim : NULL, + supis ? supisList : NULL, + gpsis ? gpsisList : NULL, + app_volumes ? app_volumesList : NULL, + disper_amount ? true : false, + disper_amount ? disper_amount->valuedouble : 0, + disper_class ? disper_class_local_nonprim : NULL, + usage_rank ? true : false, + usage_rank ? usage_rank->valuedouble : 0, + percentile_rank ? true : false, + percentile_rank ? percentile_rank->valuedouble : 0, + ue_ratio ? true : false, + ue_ratio ? ue_ratio->valuedouble : 0, + confidence ? true : false, + confidence ? confidence->valuedouble : 0 + ); + + return dispersion_collection_local_var; +end: + if (ue_loc_local_nonprim) { + OpenAPI_user_location_free(ue_loc_local_nonprim); + ue_loc_local_nonprim = NULL; + } + if (snssai_local_nonprim) { + OpenAPI_snssai_free(snssai_local_nonprim); + snssai_local_nonprim = NULL; + } + if (supisList) { + OpenAPI_list_for_each(supisList, node) { + ogs_free(node->data); + } + OpenAPI_list_free(supisList); + supisList = NULL; + } + if (gpsisList) { + OpenAPI_list_for_each(gpsisList, node) { + ogs_free(node->data); + } + OpenAPI_list_free(gpsisList); + gpsisList = NULL; + } + if (app_volumesList) { + OpenAPI_list_for_each(app_volumesList, node) { + OpenAPI_application_volume_free(node->data); + } + OpenAPI_list_free(app_volumesList); + app_volumesList = NULL; + } + if (disper_class_local_nonprim) { + OpenAPI_dispersion_class_free(disper_class_local_nonprim); + disper_class_local_nonprim = NULL; + } + return NULL; +} + +OpenAPI_dispersion_collection_t *OpenAPI_dispersion_collection_copy(OpenAPI_dispersion_collection_t *dst, OpenAPI_dispersion_collection_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_dispersion_collection_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_dispersion_collection_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_dispersion_collection_free(dst); + dst = OpenAPI_dispersion_collection_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/dispersion_collection.h b/lib/sbi/openapi/model/dispersion_collection.h new file mode 100644 index 000000000..6af37380e --- /dev/null +++ b/lib/sbi/openapi/model/dispersion_collection.h @@ -0,0 +1,72 @@ +/* + * dispersion_collection.h + * + * Dispersion collection per UE location or per slice. + */ + +#ifndef _OpenAPI_dispersion_collection_H_ +#define _OpenAPI_dispersion_collection_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "application_volume.h" +#include "dispersion_class.h" +#include "snssai.h" +#include "user_location.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_dispersion_collection_s OpenAPI_dispersion_collection_t; +typedef struct OpenAPI_dispersion_collection_s { + struct OpenAPI_user_location_s *ue_loc; + struct OpenAPI_snssai_s *snssai; + OpenAPI_list_t *supis; + OpenAPI_list_t *gpsis; + OpenAPI_list_t *app_volumes; + bool is_disper_amount; + int disper_amount; + struct OpenAPI_dispersion_class_s *disper_class; + bool is_usage_rank; + int usage_rank; + bool is_percentile_rank; + int percentile_rank; + bool is_ue_ratio; + int ue_ratio; + bool is_confidence; + int confidence; +} OpenAPI_dispersion_collection_t; + +OpenAPI_dispersion_collection_t *OpenAPI_dispersion_collection_create( + OpenAPI_user_location_t *ue_loc, + OpenAPI_snssai_t *snssai, + OpenAPI_list_t *supis, + OpenAPI_list_t *gpsis, + OpenAPI_list_t *app_volumes, + bool is_disper_amount, + int disper_amount, + OpenAPI_dispersion_class_t *disper_class, + bool is_usage_rank, + int usage_rank, + bool is_percentile_rank, + int percentile_rank, + bool is_ue_ratio, + int ue_ratio, + bool is_confidence, + int confidence +); +void OpenAPI_dispersion_collection_free(OpenAPI_dispersion_collection_t *dispersion_collection); +OpenAPI_dispersion_collection_t *OpenAPI_dispersion_collection_parseFromJSON(cJSON *dispersion_collectionJSON); +cJSON *OpenAPI_dispersion_collection_convertToJSON(OpenAPI_dispersion_collection_t *dispersion_collection); +OpenAPI_dispersion_collection_t *OpenAPI_dispersion_collection_copy(OpenAPI_dispersion_collection_t *dst, OpenAPI_dispersion_collection_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_dispersion_collection_H_ */ + diff --git a/lib/sbi/openapi/model/dispersion_info.c b/lib/sbi/openapi/model/dispersion_info.c new file mode 100644 index 000000000..d0ac563b4 --- /dev/null +++ b/lib/sbi/openapi/model/dispersion_info.c @@ -0,0 +1,233 @@ + +#include +#include +#include +#include "dispersion_info.h" + +OpenAPI_dispersion_info_t *OpenAPI_dispersion_info_create( + char *ts_start, + int ts_duration, + OpenAPI_list_t *disper_collects, + OpenAPI_dispersion_type_t *disper_type +) +{ + OpenAPI_dispersion_info_t *dispersion_info_local_var = ogs_malloc(sizeof(OpenAPI_dispersion_info_t)); + ogs_assert(dispersion_info_local_var); + + dispersion_info_local_var->ts_start = ts_start; + dispersion_info_local_var->ts_duration = ts_duration; + dispersion_info_local_var->disper_collects = disper_collects; + dispersion_info_local_var->disper_type = disper_type; + + return dispersion_info_local_var; +} + +void OpenAPI_dispersion_info_free(OpenAPI_dispersion_info_t *dispersion_info) +{ + OpenAPI_lnode_t *node = NULL; + + if (NULL == dispersion_info) { + return; + } + if (dispersion_info->ts_start) { + ogs_free(dispersion_info->ts_start); + dispersion_info->ts_start = NULL; + } + if (dispersion_info->disper_collects) { + OpenAPI_list_for_each(dispersion_info->disper_collects, node) { + OpenAPI_dispersion_collection_free(node->data); + } + OpenAPI_list_free(dispersion_info->disper_collects); + dispersion_info->disper_collects = NULL; + } + if (dispersion_info->disper_type) { + OpenAPI_dispersion_type_free(dispersion_info->disper_type); + dispersion_info->disper_type = NULL; + } + ogs_free(dispersion_info); +} + +cJSON *OpenAPI_dispersion_info_convertToJSON(OpenAPI_dispersion_info_t *dispersion_info) +{ + cJSON *item = NULL; + OpenAPI_lnode_t *node = NULL; + + if (dispersion_info == NULL) { + ogs_error("OpenAPI_dispersion_info_convertToJSON() failed [DispersionInfo]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (!dispersion_info->ts_start) { + ogs_error("OpenAPI_dispersion_info_convertToJSON() failed [ts_start]"); + return NULL; + } + if (cJSON_AddStringToObject(item, "tsStart", dispersion_info->ts_start) == NULL) { + ogs_error("OpenAPI_dispersion_info_convertToJSON() failed [ts_start]"); + goto end; + } + + if (cJSON_AddNumberToObject(item, "tsDuration", dispersion_info->ts_duration) == NULL) { + ogs_error("OpenAPI_dispersion_info_convertToJSON() failed [ts_duration]"); + goto end; + } + + if (!dispersion_info->disper_collects) { + ogs_error("OpenAPI_dispersion_info_convertToJSON() failed [disper_collects]"); + return NULL; + } + cJSON *disper_collectsList = cJSON_AddArrayToObject(item, "disperCollects"); + if (disper_collectsList == NULL) { + ogs_error("OpenAPI_dispersion_info_convertToJSON() failed [disper_collects]"); + goto end; + } + OpenAPI_list_for_each(dispersion_info->disper_collects, node) { + cJSON *itemLocal = OpenAPI_dispersion_collection_convertToJSON(node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_dispersion_info_convertToJSON() failed [disper_collects]"); + goto end; + } + cJSON_AddItemToArray(disper_collectsList, itemLocal); + } + + if (!dispersion_info->disper_type) { + ogs_error("OpenAPI_dispersion_info_convertToJSON() failed [disper_type]"); + return NULL; + } + cJSON *disper_type_local_JSON = OpenAPI_dispersion_type_convertToJSON(dispersion_info->disper_type); + if (disper_type_local_JSON == NULL) { + ogs_error("OpenAPI_dispersion_info_convertToJSON() failed [disper_type]"); + goto end; + } + cJSON_AddItemToObject(item, "disperType", disper_type_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_dispersion_info_convertToJSON() failed [disper_type]"); + goto end; + } + +end: + return item; +} + +OpenAPI_dispersion_info_t *OpenAPI_dispersion_info_parseFromJSON(cJSON *dispersion_infoJSON) +{ + OpenAPI_dispersion_info_t *dispersion_info_local_var = NULL; + OpenAPI_lnode_t *node = NULL; + cJSON *ts_start = NULL; + cJSON *ts_duration = NULL; + cJSON *disper_collects = NULL; + OpenAPI_list_t *disper_collectsList = NULL; + cJSON *disper_type = NULL; + OpenAPI_dispersion_type_t *disper_type_local_nonprim = NULL; + ts_start = cJSON_GetObjectItemCaseSensitive(dispersion_infoJSON, "tsStart"); + if (!ts_start) { + ogs_error("OpenAPI_dispersion_info_parseFromJSON() failed [ts_start]"); + goto end; + } + if (!cJSON_IsString(ts_start) && !cJSON_IsNull(ts_start)) { + ogs_error("OpenAPI_dispersion_info_parseFromJSON() failed [ts_start]"); + goto end; + } + + ts_duration = cJSON_GetObjectItemCaseSensitive(dispersion_infoJSON, "tsDuration"); + if (!ts_duration) { + ogs_error("OpenAPI_dispersion_info_parseFromJSON() failed [ts_duration]"); + goto end; + } + if (!cJSON_IsNumber(ts_duration)) { + ogs_error("OpenAPI_dispersion_info_parseFromJSON() failed [ts_duration]"); + goto end; + } + + disper_collects = cJSON_GetObjectItemCaseSensitive(dispersion_infoJSON, "disperCollects"); + if (!disper_collects) { + ogs_error("OpenAPI_dispersion_info_parseFromJSON() failed [disper_collects]"); + goto end; + } + cJSON *disper_collects_local = NULL; + if (!cJSON_IsArray(disper_collects)) { + ogs_error("OpenAPI_dispersion_info_parseFromJSON() failed [disper_collects]"); + goto end; + } + + disper_collectsList = OpenAPI_list_create(); + + cJSON_ArrayForEach(disper_collects_local, disper_collects) { + if (!cJSON_IsObject(disper_collects_local)) { + ogs_error("OpenAPI_dispersion_info_parseFromJSON() failed [disper_collects]"); + goto end; + } + OpenAPI_dispersion_collection_t *disper_collectsItem = OpenAPI_dispersion_collection_parseFromJSON(disper_collects_local); + if (!disper_collectsItem) { + ogs_error("No disper_collectsItem"); + OpenAPI_list_free(disper_collectsList); + goto end; + } + OpenAPI_list_add(disper_collectsList, disper_collectsItem); + } + + disper_type = cJSON_GetObjectItemCaseSensitive(dispersion_infoJSON, "disperType"); + if (!disper_type) { + ogs_error("OpenAPI_dispersion_info_parseFromJSON() failed [disper_type]"); + goto end; + } + disper_type_local_nonprim = OpenAPI_dispersion_type_parseFromJSON(disper_type); + + dispersion_info_local_var = OpenAPI_dispersion_info_create ( + ogs_strdup(ts_start->valuestring), + + ts_duration->valuedouble, + disper_collectsList, + disper_type_local_nonprim + ); + + return dispersion_info_local_var; +end: + if (disper_collectsList) { + OpenAPI_list_for_each(disper_collectsList, node) { + OpenAPI_dispersion_collection_free(node->data); + } + OpenAPI_list_free(disper_collectsList); + disper_collectsList = NULL; + } + if (disper_type_local_nonprim) { + OpenAPI_dispersion_type_free(disper_type_local_nonprim); + disper_type_local_nonprim = NULL; + } + return NULL; +} + +OpenAPI_dispersion_info_t *OpenAPI_dispersion_info_copy(OpenAPI_dispersion_info_t *dst, OpenAPI_dispersion_info_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_dispersion_info_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_dispersion_info_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_dispersion_info_free(dst); + dst = OpenAPI_dispersion_info_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/dispersion_info.h b/lib/sbi/openapi/model/dispersion_info.h new file mode 100644 index 000000000..8f482066a --- /dev/null +++ b/lib/sbi/openapi/model/dispersion_info.h @@ -0,0 +1,46 @@ +/* + * dispersion_info.h + * + * Represents the Dispersion information. When subscribed event is \"DISPERSION\", the \"disperInfos\" attribute shall be included. + */ + +#ifndef _OpenAPI_dispersion_info_H_ +#define _OpenAPI_dispersion_info_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "dispersion_collection.h" +#include "dispersion_type.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_dispersion_info_s OpenAPI_dispersion_info_t; +typedef struct OpenAPI_dispersion_info_s { + char *ts_start; + int ts_duration; + OpenAPI_list_t *disper_collects; + struct OpenAPI_dispersion_type_s *disper_type; +} OpenAPI_dispersion_info_t; + +OpenAPI_dispersion_info_t *OpenAPI_dispersion_info_create( + char *ts_start, + int ts_duration, + OpenAPI_list_t *disper_collects, + OpenAPI_dispersion_type_t *disper_type +); +void OpenAPI_dispersion_info_free(OpenAPI_dispersion_info_t *dispersion_info); +OpenAPI_dispersion_info_t *OpenAPI_dispersion_info_parseFromJSON(cJSON *dispersion_infoJSON); +cJSON *OpenAPI_dispersion_info_convertToJSON(OpenAPI_dispersion_info_t *dispersion_info); +OpenAPI_dispersion_info_t *OpenAPI_dispersion_info_copy(OpenAPI_dispersion_info_t *dst, OpenAPI_dispersion_info_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_dispersion_info_H_ */ + diff --git a/lib/sbi/openapi/model/dispersion_ordering_criterion.c b/lib/sbi/openapi/model/dispersion_ordering_criterion.c new file mode 100644 index 000000000..e3a11ad02 --- /dev/null +++ b/lib/sbi/openapi/model/dispersion_ordering_criterion.c @@ -0,0 +1,87 @@ + +#include +#include +#include +#include "dispersion_ordering_criterion.h" + +OpenAPI_dispersion_ordering_criterion_t *OpenAPI_dispersion_ordering_criterion_create( +) +{ + OpenAPI_dispersion_ordering_criterion_t *dispersion_ordering_criterion_local_var = ogs_malloc(sizeof(OpenAPI_dispersion_ordering_criterion_t)); + ogs_assert(dispersion_ordering_criterion_local_var); + + + return dispersion_ordering_criterion_local_var; +} + +void OpenAPI_dispersion_ordering_criterion_free(OpenAPI_dispersion_ordering_criterion_t *dispersion_ordering_criterion) +{ + OpenAPI_lnode_t *node = NULL; + + if (NULL == dispersion_ordering_criterion) { + return; + } + ogs_free(dispersion_ordering_criterion); +} + +cJSON *OpenAPI_dispersion_ordering_criterion_convertToJSON(OpenAPI_dispersion_ordering_criterion_t *dispersion_ordering_criterion) +{ + cJSON *item = NULL; + OpenAPI_lnode_t *node = NULL; + + if (dispersion_ordering_criterion == NULL) { + ogs_error("OpenAPI_dispersion_ordering_criterion_convertToJSON() failed [DispersionOrderingCriterion]"); + return NULL; + } + + item = cJSON_CreateObject(); +end: + return item; +} + +OpenAPI_dispersion_ordering_criterion_t *OpenAPI_dispersion_ordering_criterion_parseFromJSON(cJSON *dispersion_ordering_criterionJSON) +{ + OpenAPI_dispersion_ordering_criterion_t *dispersion_ordering_criterion_local_var = NULL; + OpenAPI_lnode_t *node = NULL; + dispersion_ordering_criterion_local_var = OpenAPI_dispersion_ordering_criterion_create ( + ); + + return dispersion_ordering_criterion_local_var; +end: + return NULL; +} + +OpenAPI_dispersion_ordering_criterion_t *OpenAPI_dispersion_ordering_criterion_copy(OpenAPI_dispersion_ordering_criterion_t *dst, OpenAPI_dispersion_ordering_criterion_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_dispersion_ordering_criterion_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_dispersion_ordering_criterion_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_dispersion_ordering_criterion_free(dst); + dst = OpenAPI_dispersion_ordering_criterion_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/dispersion_ordering_criterion.h b/lib/sbi/openapi/model/dispersion_ordering_criterion.h new file mode 100644 index 000000000..dd12d352f --- /dev/null +++ b/lib/sbi/openapi/model/dispersion_ordering_criterion.h @@ -0,0 +1,37 @@ +/* + * dispersion_ordering_criterion.h + * + * Possible values are: - TIME_SLOT_START: Indicates the order of time slot start. - DISPERSION: Indicates the order of data/transaction dispersion. - CLASSIFICATION: Indicates the order of data/transaction classification. - RANKING: Indicates the order of data/transaction ranking. - PERCENTILE_RANKING: Indicates the order of data/transaction percentile ranking. + */ + +#ifndef _OpenAPI_dispersion_ordering_criterion_H_ +#define _OpenAPI_dispersion_ordering_criterion_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "dispersion_ordering_criterion_any_of.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_dispersion_ordering_criterion_s OpenAPI_dispersion_ordering_criterion_t; +typedef struct OpenAPI_dispersion_ordering_criterion_s { +} OpenAPI_dispersion_ordering_criterion_t; + +OpenAPI_dispersion_ordering_criterion_t *OpenAPI_dispersion_ordering_criterion_create( +); +void OpenAPI_dispersion_ordering_criterion_free(OpenAPI_dispersion_ordering_criterion_t *dispersion_ordering_criterion); +OpenAPI_dispersion_ordering_criterion_t *OpenAPI_dispersion_ordering_criterion_parseFromJSON(cJSON *dispersion_ordering_criterionJSON); +cJSON *OpenAPI_dispersion_ordering_criterion_convertToJSON(OpenAPI_dispersion_ordering_criterion_t *dispersion_ordering_criterion); +OpenAPI_dispersion_ordering_criterion_t *OpenAPI_dispersion_ordering_criterion_copy(OpenAPI_dispersion_ordering_criterion_t *dst, OpenAPI_dispersion_ordering_criterion_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_dispersion_ordering_criterion_H_ */ + diff --git a/lib/sbi/openapi/model/dispersion_ordering_criterion_any_of.c b/lib/sbi/openapi/model/dispersion_ordering_criterion_any_of.c new file mode 100644 index 000000000..730cd7d5e --- /dev/null +++ b/lib/sbi/openapi/model/dispersion_ordering_criterion_any_of.c @@ -0,0 +1,30 @@ + +#include +#include +#include +#include "dispersion_ordering_criterion_any_of.h" + +char* OpenAPI_dispersion_ordering_criterion_any_of_ToString(OpenAPI_dispersion_ordering_criterion_any_of_e dispersion_ordering_criterion_any_of) +{ + const char *dispersion_ordering_criterion_any_ofArray[] = { "NULL", "TIME_SLOT_START", "DISPERSION", "CLASSIFICATION", "RANKING", "PERCENTILE_RANKING" }; + size_t sizeofArray = sizeof(dispersion_ordering_criterion_any_ofArray) / sizeof(dispersion_ordering_criterion_any_ofArray[0]); + if (dispersion_ordering_criterion_any_of < sizeofArray) + return (char *)dispersion_ordering_criterion_any_ofArray[dispersion_ordering_criterion_any_of]; + else + return (char *)"Unknown"; +} + +OpenAPI_dispersion_ordering_criterion_any_of_e OpenAPI_dispersion_ordering_criterion_any_of_FromString(char* dispersion_ordering_criterion_any_of) +{ + int stringToReturn = 0; + const char *dispersion_ordering_criterion_any_ofArray[] = { "NULL", "TIME_SLOT_START", "DISPERSION", "CLASSIFICATION", "RANKING", "PERCENTILE_RANKING" }; + size_t sizeofArray = sizeof(dispersion_ordering_criterion_any_ofArray) / sizeof(dispersion_ordering_criterion_any_ofArray[0]); + while (stringToReturn < sizeofArray) { + if (strcmp(dispersion_ordering_criterion_any_of, dispersion_ordering_criterion_any_ofArray[stringToReturn]) == 0) { + return stringToReturn; + } + stringToReturn++; + } + return 0; +} + diff --git a/lib/sbi/openapi/model/dispersion_ordering_criterion_any_of.h b/lib/sbi/openapi/model/dispersion_ordering_criterion_any_of.h new file mode 100644 index 000000000..887aa8687 --- /dev/null +++ b/lib/sbi/openapi/model/dispersion_ordering_criterion_any_of.h @@ -0,0 +1,31 @@ +/* + * dispersion_ordering_criterion_any_of.h + * + * + */ + +#ifndef _OpenAPI_dispersion_ordering_criterion_any_of_H_ +#define _OpenAPI_dispersion_ordering_criterion_any_of_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef enum { OpenAPI_dispersion_ordering_criterion_any_of_NULL = 0, OpenAPI_dispersion_ordering_criterion_any_of_TIME_SLOT_START, OpenAPI_dispersion_ordering_criterion_any_of_DISPERSION, OpenAPI_dispersion_ordering_criterion_any_of_CLASSIFICATION, OpenAPI_dispersion_ordering_criterion_any_of_RANKING, OpenAPI_dispersion_ordering_criterion_any_of_PERCENTILE_RANKING } OpenAPI_dispersion_ordering_criterion_any_of_e; + +char* OpenAPI_dispersion_ordering_criterion_any_of_ToString(OpenAPI_dispersion_ordering_criterion_any_of_e dispersion_ordering_criterion_any_of); + +OpenAPI_dispersion_ordering_criterion_any_of_e OpenAPI_dispersion_ordering_criterion_any_of_FromString(char* dispersion_ordering_criterion_any_of); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_dispersion_ordering_criterion_any_of_H_ */ + diff --git a/lib/sbi/openapi/model/dispersion_requirement.c b/lib/sbi/openapi/model/dispersion_requirement.c new file mode 100644 index 000000000..36714a6a3 --- /dev/null +++ b/lib/sbi/openapi/model/dispersion_requirement.c @@ -0,0 +1,304 @@ + +#include +#include +#include +#include "dispersion_requirement.h" + +OpenAPI_dispersion_requirement_t *OpenAPI_dispersion_requirement_create( + OpenAPI_dispersion_type_t *disper_type, + OpenAPI_list_t *class_criters, + OpenAPI_list_t *rank_criters, + OpenAPI_dispersion_ordering_criterion_t *disp_order_criter, + OpenAPI_matching_direction_t *order +) +{ + OpenAPI_dispersion_requirement_t *dispersion_requirement_local_var = ogs_malloc(sizeof(OpenAPI_dispersion_requirement_t)); + ogs_assert(dispersion_requirement_local_var); + + dispersion_requirement_local_var->disper_type = disper_type; + dispersion_requirement_local_var->class_criters = class_criters; + dispersion_requirement_local_var->rank_criters = rank_criters; + dispersion_requirement_local_var->disp_order_criter = disp_order_criter; + dispersion_requirement_local_var->order = order; + + return dispersion_requirement_local_var; +} + +void OpenAPI_dispersion_requirement_free(OpenAPI_dispersion_requirement_t *dispersion_requirement) +{ + OpenAPI_lnode_t *node = NULL; + + if (NULL == dispersion_requirement) { + return; + } + if (dispersion_requirement->disper_type) { + OpenAPI_dispersion_type_free(dispersion_requirement->disper_type); + dispersion_requirement->disper_type = NULL; + } + if (dispersion_requirement->class_criters) { + OpenAPI_list_for_each(dispersion_requirement->class_criters, node) { + OpenAPI_class_criterion_free(node->data); + } + OpenAPI_list_free(dispersion_requirement->class_criters); + dispersion_requirement->class_criters = NULL; + } + if (dispersion_requirement->rank_criters) { + OpenAPI_list_for_each(dispersion_requirement->rank_criters, node) { + OpenAPI_ranking_criterion_free(node->data); + } + OpenAPI_list_free(dispersion_requirement->rank_criters); + dispersion_requirement->rank_criters = NULL; + } + if (dispersion_requirement->disp_order_criter) { + OpenAPI_dispersion_ordering_criterion_free(dispersion_requirement->disp_order_criter); + dispersion_requirement->disp_order_criter = NULL; + } + if (dispersion_requirement->order) { + OpenAPI_matching_direction_free(dispersion_requirement->order); + dispersion_requirement->order = NULL; + } + ogs_free(dispersion_requirement); +} + +cJSON *OpenAPI_dispersion_requirement_convertToJSON(OpenAPI_dispersion_requirement_t *dispersion_requirement) +{ + cJSON *item = NULL; + OpenAPI_lnode_t *node = NULL; + + if (dispersion_requirement == NULL) { + ogs_error("OpenAPI_dispersion_requirement_convertToJSON() failed [DispersionRequirement]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (!dispersion_requirement->disper_type) { + ogs_error("OpenAPI_dispersion_requirement_convertToJSON() failed [disper_type]"); + return NULL; + } + cJSON *disper_type_local_JSON = OpenAPI_dispersion_type_convertToJSON(dispersion_requirement->disper_type); + if (disper_type_local_JSON == NULL) { + ogs_error("OpenAPI_dispersion_requirement_convertToJSON() failed [disper_type]"); + goto end; + } + cJSON_AddItemToObject(item, "disperType", disper_type_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_dispersion_requirement_convertToJSON() failed [disper_type]"); + goto end; + } + + if (dispersion_requirement->class_criters) { + cJSON *class_critersList = cJSON_AddArrayToObject(item, "classCriters"); + if (class_critersList == NULL) { + ogs_error("OpenAPI_dispersion_requirement_convertToJSON() failed [class_criters]"); + goto end; + } + OpenAPI_list_for_each(dispersion_requirement->class_criters, node) { + cJSON *itemLocal = OpenAPI_class_criterion_convertToJSON(node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_dispersion_requirement_convertToJSON() failed [class_criters]"); + goto end; + } + cJSON_AddItemToArray(class_critersList, itemLocal); + } + } + + if (dispersion_requirement->rank_criters) { + cJSON *rank_critersList = cJSON_AddArrayToObject(item, "rankCriters"); + if (rank_critersList == NULL) { + ogs_error("OpenAPI_dispersion_requirement_convertToJSON() failed [rank_criters]"); + goto end; + } + OpenAPI_list_for_each(dispersion_requirement->rank_criters, node) { + cJSON *itemLocal = OpenAPI_ranking_criterion_convertToJSON(node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_dispersion_requirement_convertToJSON() failed [rank_criters]"); + goto end; + } + cJSON_AddItemToArray(rank_critersList, itemLocal); + } + } + + if (dispersion_requirement->disp_order_criter) { + cJSON *disp_order_criter_local_JSON = OpenAPI_dispersion_ordering_criterion_convertToJSON(dispersion_requirement->disp_order_criter); + if (disp_order_criter_local_JSON == NULL) { + ogs_error("OpenAPI_dispersion_requirement_convertToJSON() failed [disp_order_criter]"); + goto end; + } + cJSON_AddItemToObject(item, "dispOrderCriter", disp_order_criter_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_dispersion_requirement_convertToJSON() failed [disp_order_criter]"); + goto end; + } + } + + if (dispersion_requirement->order) { + cJSON *order_local_JSON = OpenAPI_matching_direction_convertToJSON(dispersion_requirement->order); + if (order_local_JSON == NULL) { + ogs_error("OpenAPI_dispersion_requirement_convertToJSON() failed [order]"); + goto end; + } + cJSON_AddItemToObject(item, "order", order_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_dispersion_requirement_convertToJSON() failed [order]"); + goto end; + } + } + +end: + return item; +} + +OpenAPI_dispersion_requirement_t *OpenAPI_dispersion_requirement_parseFromJSON(cJSON *dispersion_requirementJSON) +{ + OpenAPI_dispersion_requirement_t *dispersion_requirement_local_var = NULL; + OpenAPI_lnode_t *node = NULL; + cJSON *disper_type = NULL; + OpenAPI_dispersion_type_t *disper_type_local_nonprim = NULL; + cJSON *class_criters = NULL; + OpenAPI_list_t *class_critersList = NULL; + cJSON *rank_criters = NULL; + OpenAPI_list_t *rank_critersList = NULL; + cJSON *disp_order_criter = NULL; + OpenAPI_dispersion_ordering_criterion_t *disp_order_criter_local_nonprim = NULL; + cJSON *order = NULL; + OpenAPI_matching_direction_t *order_local_nonprim = NULL; + disper_type = cJSON_GetObjectItemCaseSensitive(dispersion_requirementJSON, "disperType"); + if (!disper_type) { + ogs_error("OpenAPI_dispersion_requirement_parseFromJSON() failed [disper_type]"); + goto end; + } + disper_type_local_nonprim = OpenAPI_dispersion_type_parseFromJSON(disper_type); + + class_criters = cJSON_GetObjectItemCaseSensitive(dispersion_requirementJSON, "classCriters"); + if (class_criters) { + cJSON *class_criters_local = NULL; + if (!cJSON_IsArray(class_criters)) { + ogs_error("OpenAPI_dispersion_requirement_parseFromJSON() failed [class_criters]"); + goto end; + } + + class_critersList = OpenAPI_list_create(); + + cJSON_ArrayForEach(class_criters_local, class_criters) { + if (!cJSON_IsObject(class_criters_local)) { + ogs_error("OpenAPI_dispersion_requirement_parseFromJSON() failed [class_criters]"); + goto end; + } + OpenAPI_class_criterion_t *class_critersItem = OpenAPI_class_criterion_parseFromJSON(class_criters_local); + if (!class_critersItem) { + ogs_error("No class_critersItem"); + OpenAPI_list_free(class_critersList); + goto end; + } + OpenAPI_list_add(class_critersList, class_critersItem); + } + } + + rank_criters = cJSON_GetObjectItemCaseSensitive(dispersion_requirementJSON, "rankCriters"); + if (rank_criters) { + cJSON *rank_criters_local = NULL; + if (!cJSON_IsArray(rank_criters)) { + ogs_error("OpenAPI_dispersion_requirement_parseFromJSON() failed [rank_criters]"); + goto end; + } + + rank_critersList = OpenAPI_list_create(); + + cJSON_ArrayForEach(rank_criters_local, rank_criters) { + if (!cJSON_IsObject(rank_criters_local)) { + ogs_error("OpenAPI_dispersion_requirement_parseFromJSON() failed [rank_criters]"); + goto end; + } + OpenAPI_ranking_criterion_t *rank_critersItem = OpenAPI_ranking_criterion_parseFromJSON(rank_criters_local); + if (!rank_critersItem) { + ogs_error("No rank_critersItem"); + OpenAPI_list_free(rank_critersList); + goto end; + } + OpenAPI_list_add(rank_critersList, rank_critersItem); + } + } + + disp_order_criter = cJSON_GetObjectItemCaseSensitive(dispersion_requirementJSON, "dispOrderCriter"); + if (disp_order_criter) { + disp_order_criter_local_nonprim = OpenAPI_dispersion_ordering_criterion_parseFromJSON(disp_order_criter); + } + + order = cJSON_GetObjectItemCaseSensitive(dispersion_requirementJSON, "order"); + if (order) { + order_local_nonprim = OpenAPI_matching_direction_parseFromJSON(order); + } + + dispersion_requirement_local_var = OpenAPI_dispersion_requirement_create ( + disper_type_local_nonprim, + class_criters ? class_critersList : NULL, + rank_criters ? rank_critersList : NULL, + disp_order_criter ? disp_order_criter_local_nonprim : NULL, + order ? order_local_nonprim : NULL + ); + + return dispersion_requirement_local_var; +end: + if (disper_type_local_nonprim) { + OpenAPI_dispersion_type_free(disper_type_local_nonprim); + disper_type_local_nonprim = NULL; + } + if (class_critersList) { + OpenAPI_list_for_each(class_critersList, node) { + OpenAPI_class_criterion_free(node->data); + } + OpenAPI_list_free(class_critersList); + class_critersList = NULL; + } + if (rank_critersList) { + OpenAPI_list_for_each(rank_critersList, node) { + OpenAPI_ranking_criterion_free(node->data); + } + OpenAPI_list_free(rank_critersList); + rank_critersList = NULL; + } + if (disp_order_criter_local_nonprim) { + OpenAPI_dispersion_ordering_criterion_free(disp_order_criter_local_nonprim); + disp_order_criter_local_nonprim = NULL; + } + if (order_local_nonprim) { + OpenAPI_matching_direction_free(order_local_nonprim); + order_local_nonprim = NULL; + } + return NULL; +} + +OpenAPI_dispersion_requirement_t *OpenAPI_dispersion_requirement_copy(OpenAPI_dispersion_requirement_t *dst, OpenAPI_dispersion_requirement_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_dispersion_requirement_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_dispersion_requirement_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_dispersion_requirement_free(dst); + dst = OpenAPI_dispersion_requirement_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/dispersion_requirement.h b/lib/sbi/openapi/model/dispersion_requirement.h new file mode 100644 index 000000000..a98f206ab --- /dev/null +++ b/lib/sbi/openapi/model/dispersion_requirement.h @@ -0,0 +1,51 @@ +/* + * dispersion_requirement.h + * + * Represents the dispersion analytics requirements. + */ + +#ifndef _OpenAPI_dispersion_requirement_H_ +#define _OpenAPI_dispersion_requirement_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "class_criterion.h" +#include "dispersion_ordering_criterion.h" +#include "dispersion_type.h" +#include "matching_direction.h" +#include "ranking_criterion.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_dispersion_requirement_s OpenAPI_dispersion_requirement_t; +typedef struct OpenAPI_dispersion_requirement_s { + struct OpenAPI_dispersion_type_s *disper_type; + OpenAPI_list_t *class_criters; + OpenAPI_list_t *rank_criters; + struct OpenAPI_dispersion_ordering_criterion_s *disp_order_criter; + struct OpenAPI_matching_direction_s *order; +} OpenAPI_dispersion_requirement_t; + +OpenAPI_dispersion_requirement_t *OpenAPI_dispersion_requirement_create( + OpenAPI_dispersion_type_t *disper_type, + OpenAPI_list_t *class_criters, + OpenAPI_list_t *rank_criters, + OpenAPI_dispersion_ordering_criterion_t *disp_order_criter, + OpenAPI_matching_direction_t *order +); +void OpenAPI_dispersion_requirement_free(OpenAPI_dispersion_requirement_t *dispersion_requirement); +OpenAPI_dispersion_requirement_t *OpenAPI_dispersion_requirement_parseFromJSON(cJSON *dispersion_requirementJSON); +cJSON *OpenAPI_dispersion_requirement_convertToJSON(OpenAPI_dispersion_requirement_t *dispersion_requirement); +OpenAPI_dispersion_requirement_t *OpenAPI_dispersion_requirement_copy(OpenAPI_dispersion_requirement_t *dst, OpenAPI_dispersion_requirement_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_dispersion_requirement_H_ */ + diff --git a/lib/sbi/openapi/model/dispersion_type.c b/lib/sbi/openapi/model/dispersion_type.c new file mode 100644 index 000000000..5e0aa34c9 --- /dev/null +++ b/lib/sbi/openapi/model/dispersion_type.c @@ -0,0 +1,87 @@ + +#include +#include +#include +#include "dispersion_type.h" + +OpenAPI_dispersion_type_t *OpenAPI_dispersion_type_create( +) +{ + OpenAPI_dispersion_type_t *dispersion_type_local_var = ogs_malloc(sizeof(OpenAPI_dispersion_type_t)); + ogs_assert(dispersion_type_local_var); + + + return dispersion_type_local_var; +} + +void OpenAPI_dispersion_type_free(OpenAPI_dispersion_type_t *dispersion_type) +{ + OpenAPI_lnode_t *node = NULL; + + if (NULL == dispersion_type) { + return; + } + ogs_free(dispersion_type); +} + +cJSON *OpenAPI_dispersion_type_convertToJSON(OpenAPI_dispersion_type_t *dispersion_type) +{ + cJSON *item = NULL; + OpenAPI_lnode_t *node = NULL; + + if (dispersion_type == NULL) { + ogs_error("OpenAPI_dispersion_type_convertToJSON() failed [DispersionType]"); + return NULL; + } + + item = cJSON_CreateObject(); +end: + return item; +} + +OpenAPI_dispersion_type_t *OpenAPI_dispersion_type_parseFromJSON(cJSON *dispersion_typeJSON) +{ + OpenAPI_dispersion_type_t *dispersion_type_local_var = NULL; + OpenAPI_lnode_t *node = NULL; + dispersion_type_local_var = OpenAPI_dispersion_type_create ( + ); + + return dispersion_type_local_var; +end: + return NULL; +} + +OpenAPI_dispersion_type_t *OpenAPI_dispersion_type_copy(OpenAPI_dispersion_type_t *dst, OpenAPI_dispersion_type_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_dispersion_type_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_dispersion_type_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_dispersion_type_free(dst); + dst = OpenAPI_dispersion_type_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/dispersion_type.h b/lib/sbi/openapi/model/dispersion_type.h new file mode 100644 index 000000000..4ce96e75e --- /dev/null +++ b/lib/sbi/openapi/model/dispersion_type.h @@ -0,0 +1,37 @@ +/* + * dispersion_type.h + * + * Possible values are: - DVDA: Data Volume Dispersion Analytics. - TDA: Transactions Dispersion Analytics. - DVDA_AND_TDA: Data Volume Dispersion Analytics and Transactions Dispersion Analytics. + */ + +#ifndef _OpenAPI_dispersion_type_H_ +#define _OpenAPI_dispersion_type_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "dispersion_type_one_of.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_dispersion_type_s OpenAPI_dispersion_type_t; +typedef struct OpenAPI_dispersion_type_s { +} OpenAPI_dispersion_type_t; + +OpenAPI_dispersion_type_t *OpenAPI_dispersion_type_create( +); +void OpenAPI_dispersion_type_free(OpenAPI_dispersion_type_t *dispersion_type); +OpenAPI_dispersion_type_t *OpenAPI_dispersion_type_parseFromJSON(cJSON *dispersion_typeJSON); +cJSON *OpenAPI_dispersion_type_convertToJSON(OpenAPI_dispersion_type_t *dispersion_type); +OpenAPI_dispersion_type_t *OpenAPI_dispersion_type_copy(OpenAPI_dispersion_type_t *dst, OpenAPI_dispersion_type_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_dispersion_type_H_ */ + diff --git a/lib/sbi/openapi/model/dispersion_type_one_of.c b/lib/sbi/openapi/model/dispersion_type_one_of.c new file mode 100644 index 000000000..e2c3499fb --- /dev/null +++ b/lib/sbi/openapi/model/dispersion_type_one_of.c @@ -0,0 +1,30 @@ + +#include +#include +#include +#include "dispersion_type_one_of.h" + +char* OpenAPI_dispersion_type_one_of_ToString(OpenAPI_dispersion_type_one_of_e dispersion_type_one_of) +{ + const char *dispersion_type_one_ofArray[] = { "NULL", "DVDA", "TDA", "DVDA_AND_TDA" }; + size_t sizeofArray = sizeof(dispersion_type_one_ofArray) / sizeof(dispersion_type_one_ofArray[0]); + if (dispersion_type_one_of < sizeofArray) + return (char *)dispersion_type_one_ofArray[dispersion_type_one_of]; + else + return (char *)"Unknown"; +} + +OpenAPI_dispersion_type_one_of_e OpenAPI_dispersion_type_one_of_FromString(char* dispersion_type_one_of) +{ + int stringToReturn = 0; + const char *dispersion_type_one_ofArray[] = { "NULL", "DVDA", "TDA", "DVDA_AND_TDA" }; + size_t sizeofArray = sizeof(dispersion_type_one_ofArray) / sizeof(dispersion_type_one_ofArray[0]); + while (stringToReturn < sizeofArray) { + if (strcmp(dispersion_type_one_of, dispersion_type_one_ofArray[stringToReturn]) == 0) { + return stringToReturn; + } + stringToReturn++; + } + return 0; +} + diff --git a/lib/sbi/openapi/model/dispersion_type_one_of.h b/lib/sbi/openapi/model/dispersion_type_one_of.h new file mode 100644 index 000000000..e20a3fe56 --- /dev/null +++ b/lib/sbi/openapi/model/dispersion_type_one_of.h @@ -0,0 +1,31 @@ +/* + * dispersion_type_one_of.h + * + * + */ + +#ifndef _OpenAPI_dispersion_type_one_of_H_ +#define _OpenAPI_dispersion_type_one_of_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef enum { OpenAPI_dispersion_type_one_of_NULL = 0, OpenAPI_dispersion_type_one_of_DVDA, OpenAPI_dispersion_type_one_of_TDA, OpenAPI_dispersion_type_one_of_DVDA_AND_TDA } OpenAPI_dispersion_type_one_of_e; + +char* OpenAPI_dispersion_type_one_of_ToString(OpenAPI_dispersion_type_one_of_e dispersion_type_one_of); + +OpenAPI_dispersion_type_one_of_e OpenAPI_dispersion_type_one_of_FromString(char* dispersion_type_one_of); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_dispersion_type_one_of_H_ */ + diff --git a/lib/sbi/openapi/model/dn_perf.c b/lib/sbi/openapi/model/dn_perf.c new file mode 100644 index 000000000..592844e18 --- /dev/null +++ b/lib/sbi/openapi/model/dn_perf.c @@ -0,0 +1,269 @@ + +#include +#include +#include +#include "dn_perf.h" + +OpenAPI_dn_perf_t *OpenAPI_dn_perf_create( + OpenAPI_addr_fqdn_t *app_server_ins_addr, + OpenAPI_upf_information_t *upf_info, + char *dnai, + OpenAPI_perf_data_t *perf_data, + OpenAPI_network_area_info_t *spatial_valid_con, + OpenAPI_time_window_t *temporal_valid_con +) +{ + OpenAPI_dn_perf_t *dn_perf_local_var = ogs_malloc(sizeof(OpenAPI_dn_perf_t)); + ogs_assert(dn_perf_local_var); + + dn_perf_local_var->app_server_ins_addr = app_server_ins_addr; + dn_perf_local_var->upf_info = upf_info; + dn_perf_local_var->dnai = dnai; + dn_perf_local_var->perf_data = perf_data; + dn_perf_local_var->spatial_valid_con = spatial_valid_con; + dn_perf_local_var->temporal_valid_con = temporal_valid_con; + + return dn_perf_local_var; +} + +void OpenAPI_dn_perf_free(OpenAPI_dn_perf_t *dn_perf) +{ + OpenAPI_lnode_t *node = NULL; + + if (NULL == dn_perf) { + return; + } + if (dn_perf->app_server_ins_addr) { + OpenAPI_addr_fqdn_free(dn_perf->app_server_ins_addr); + dn_perf->app_server_ins_addr = NULL; + } + if (dn_perf->upf_info) { + OpenAPI_upf_information_free(dn_perf->upf_info); + dn_perf->upf_info = NULL; + } + if (dn_perf->dnai) { + ogs_free(dn_perf->dnai); + dn_perf->dnai = NULL; + } + if (dn_perf->perf_data) { + OpenAPI_perf_data_free(dn_perf->perf_data); + dn_perf->perf_data = NULL; + } + if (dn_perf->spatial_valid_con) { + OpenAPI_network_area_info_free(dn_perf->spatial_valid_con); + dn_perf->spatial_valid_con = NULL; + } + if (dn_perf->temporal_valid_con) { + OpenAPI_time_window_free(dn_perf->temporal_valid_con); + dn_perf->temporal_valid_con = NULL; + } + ogs_free(dn_perf); +} + +cJSON *OpenAPI_dn_perf_convertToJSON(OpenAPI_dn_perf_t *dn_perf) +{ + cJSON *item = NULL; + OpenAPI_lnode_t *node = NULL; + + if (dn_perf == NULL) { + ogs_error("OpenAPI_dn_perf_convertToJSON() failed [DnPerf]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (dn_perf->app_server_ins_addr) { + cJSON *app_server_ins_addr_local_JSON = OpenAPI_addr_fqdn_convertToJSON(dn_perf->app_server_ins_addr); + if (app_server_ins_addr_local_JSON == NULL) { + ogs_error("OpenAPI_dn_perf_convertToJSON() failed [app_server_ins_addr]"); + goto end; + } + cJSON_AddItemToObject(item, "appServerInsAddr", app_server_ins_addr_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_dn_perf_convertToJSON() failed [app_server_ins_addr]"); + goto end; + } + } + + if (dn_perf->upf_info) { + cJSON *upf_info_local_JSON = OpenAPI_upf_information_convertToJSON(dn_perf->upf_info); + if (upf_info_local_JSON == NULL) { + ogs_error("OpenAPI_dn_perf_convertToJSON() failed [upf_info]"); + goto end; + } + cJSON_AddItemToObject(item, "upfInfo", upf_info_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_dn_perf_convertToJSON() failed [upf_info]"); + goto end; + } + } + + if (dn_perf->dnai) { + if (cJSON_AddStringToObject(item, "dnai", dn_perf->dnai) == NULL) { + ogs_error("OpenAPI_dn_perf_convertToJSON() failed [dnai]"); + goto end; + } + } + + if (!dn_perf->perf_data) { + ogs_error("OpenAPI_dn_perf_convertToJSON() failed [perf_data]"); + return NULL; + } + cJSON *perf_data_local_JSON = OpenAPI_perf_data_convertToJSON(dn_perf->perf_data); + if (perf_data_local_JSON == NULL) { + ogs_error("OpenAPI_dn_perf_convertToJSON() failed [perf_data]"); + goto end; + } + cJSON_AddItemToObject(item, "perfData", perf_data_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_dn_perf_convertToJSON() failed [perf_data]"); + goto end; + } + + if (dn_perf->spatial_valid_con) { + cJSON *spatial_valid_con_local_JSON = OpenAPI_network_area_info_convertToJSON(dn_perf->spatial_valid_con); + if (spatial_valid_con_local_JSON == NULL) { + ogs_error("OpenAPI_dn_perf_convertToJSON() failed [spatial_valid_con]"); + goto end; + } + cJSON_AddItemToObject(item, "spatialValidCon", spatial_valid_con_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_dn_perf_convertToJSON() failed [spatial_valid_con]"); + goto end; + } + } + + if (dn_perf->temporal_valid_con) { + cJSON *temporal_valid_con_local_JSON = OpenAPI_time_window_convertToJSON(dn_perf->temporal_valid_con); + if (temporal_valid_con_local_JSON == NULL) { + ogs_error("OpenAPI_dn_perf_convertToJSON() failed [temporal_valid_con]"); + goto end; + } + cJSON_AddItemToObject(item, "temporalValidCon", temporal_valid_con_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_dn_perf_convertToJSON() failed [temporal_valid_con]"); + goto end; + } + } + +end: + return item; +} + +OpenAPI_dn_perf_t *OpenAPI_dn_perf_parseFromJSON(cJSON *dn_perfJSON) +{ + OpenAPI_dn_perf_t *dn_perf_local_var = NULL; + OpenAPI_lnode_t *node = NULL; + cJSON *app_server_ins_addr = NULL; + OpenAPI_addr_fqdn_t *app_server_ins_addr_local_nonprim = NULL; + cJSON *upf_info = NULL; + OpenAPI_upf_information_t *upf_info_local_nonprim = NULL; + cJSON *dnai = NULL; + cJSON *perf_data = NULL; + OpenAPI_perf_data_t *perf_data_local_nonprim = NULL; + cJSON *spatial_valid_con = NULL; + OpenAPI_network_area_info_t *spatial_valid_con_local_nonprim = NULL; + cJSON *temporal_valid_con = NULL; + OpenAPI_time_window_t *temporal_valid_con_local_nonprim = NULL; + app_server_ins_addr = cJSON_GetObjectItemCaseSensitive(dn_perfJSON, "appServerInsAddr"); + if (app_server_ins_addr) { + app_server_ins_addr_local_nonprim = OpenAPI_addr_fqdn_parseFromJSON(app_server_ins_addr); + } + + upf_info = cJSON_GetObjectItemCaseSensitive(dn_perfJSON, "upfInfo"); + if (upf_info) { + upf_info_local_nonprim = OpenAPI_upf_information_parseFromJSON(upf_info); + } + + dnai = cJSON_GetObjectItemCaseSensitive(dn_perfJSON, "dnai"); + if (dnai) { + if (!cJSON_IsString(dnai) && !cJSON_IsNull(dnai)) { + ogs_error("OpenAPI_dn_perf_parseFromJSON() failed [dnai]"); + goto end; + } + } + + perf_data = cJSON_GetObjectItemCaseSensitive(dn_perfJSON, "perfData"); + if (!perf_data) { + ogs_error("OpenAPI_dn_perf_parseFromJSON() failed [perf_data]"); + goto end; + } + perf_data_local_nonprim = OpenAPI_perf_data_parseFromJSON(perf_data); + + spatial_valid_con = cJSON_GetObjectItemCaseSensitive(dn_perfJSON, "spatialValidCon"); + if (spatial_valid_con) { + spatial_valid_con_local_nonprim = OpenAPI_network_area_info_parseFromJSON(spatial_valid_con); + } + + temporal_valid_con = cJSON_GetObjectItemCaseSensitive(dn_perfJSON, "temporalValidCon"); + if (temporal_valid_con) { + temporal_valid_con_local_nonprim = OpenAPI_time_window_parseFromJSON(temporal_valid_con); + } + + dn_perf_local_var = OpenAPI_dn_perf_create ( + app_server_ins_addr ? app_server_ins_addr_local_nonprim : NULL, + upf_info ? upf_info_local_nonprim : NULL, + dnai && !cJSON_IsNull(dnai) ? ogs_strdup(dnai->valuestring) : NULL, + perf_data_local_nonprim, + spatial_valid_con ? spatial_valid_con_local_nonprim : NULL, + temporal_valid_con ? temporal_valid_con_local_nonprim : NULL + ); + + return dn_perf_local_var; +end: + if (app_server_ins_addr_local_nonprim) { + OpenAPI_addr_fqdn_free(app_server_ins_addr_local_nonprim); + app_server_ins_addr_local_nonprim = NULL; + } + if (upf_info_local_nonprim) { + OpenAPI_upf_information_free(upf_info_local_nonprim); + upf_info_local_nonprim = NULL; + } + if (perf_data_local_nonprim) { + OpenAPI_perf_data_free(perf_data_local_nonprim); + perf_data_local_nonprim = NULL; + } + if (spatial_valid_con_local_nonprim) { + OpenAPI_network_area_info_free(spatial_valid_con_local_nonprim); + spatial_valid_con_local_nonprim = NULL; + } + if (temporal_valid_con_local_nonprim) { + OpenAPI_time_window_free(temporal_valid_con_local_nonprim); + temporal_valid_con_local_nonprim = NULL; + } + return NULL; +} + +OpenAPI_dn_perf_t *OpenAPI_dn_perf_copy(OpenAPI_dn_perf_t *dst, OpenAPI_dn_perf_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_dn_perf_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_dn_perf_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_dn_perf_free(dst); + dst = OpenAPI_dn_perf_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/dn_perf.h b/lib/sbi/openapi/model/dn_perf.h new file mode 100644 index 000000000..bf6df821a --- /dev/null +++ b/lib/sbi/openapi/model/dn_perf.h @@ -0,0 +1,53 @@ +/* + * dn_perf.h + * + * Represents DN performance for the application. + */ + +#ifndef _OpenAPI_dn_perf_H_ +#define _OpenAPI_dn_perf_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "addr_fqdn.h" +#include "network_area_info.h" +#include "perf_data.h" +#include "time_window.h" +#include "upf_information.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_dn_perf_s OpenAPI_dn_perf_t; +typedef struct OpenAPI_dn_perf_s { + struct OpenAPI_addr_fqdn_s *app_server_ins_addr; + struct OpenAPI_upf_information_s *upf_info; + char *dnai; + struct OpenAPI_perf_data_s *perf_data; + struct OpenAPI_network_area_info_s *spatial_valid_con; + struct OpenAPI_time_window_s *temporal_valid_con; +} OpenAPI_dn_perf_t; + +OpenAPI_dn_perf_t *OpenAPI_dn_perf_create( + OpenAPI_addr_fqdn_t *app_server_ins_addr, + OpenAPI_upf_information_t *upf_info, + char *dnai, + OpenAPI_perf_data_t *perf_data, + OpenAPI_network_area_info_t *spatial_valid_con, + OpenAPI_time_window_t *temporal_valid_con +); +void OpenAPI_dn_perf_free(OpenAPI_dn_perf_t *dn_perf); +OpenAPI_dn_perf_t *OpenAPI_dn_perf_parseFromJSON(cJSON *dn_perfJSON); +cJSON *OpenAPI_dn_perf_convertToJSON(OpenAPI_dn_perf_t *dn_perf); +OpenAPI_dn_perf_t *OpenAPI_dn_perf_copy(OpenAPI_dn_perf_t *dst, OpenAPI_dn_perf_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_dn_perf_H_ */ + diff --git a/lib/sbi/openapi/model/dn_perf_info.c b/lib/sbi/openapi/model/dn_perf_info.c new file mode 100644 index 000000000..ed65a3351 --- /dev/null +++ b/lib/sbi/openapi/model/dn_perf_info.c @@ -0,0 +1,250 @@ + +#include +#include +#include +#include "dn_perf_info.h" + +OpenAPI_dn_perf_info_t *OpenAPI_dn_perf_info_create( + char *app_id, + char *dnn, + OpenAPI_snssai_t *snssai, + OpenAPI_list_t *dn_perf, + bool is_confidence, + int confidence +) +{ + OpenAPI_dn_perf_info_t *dn_perf_info_local_var = ogs_malloc(sizeof(OpenAPI_dn_perf_info_t)); + ogs_assert(dn_perf_info_local_var); + + dn_perf_info_local_var->app_id = app_id; + dn_perf_info_local_var->dnn = dnn; + dn_perf_info_local_var->snssai = snssai; + dn_perf_info_local_var->dn_perf = dn_perf; + dn_perf_info_local_var->is_confidence = is_confidence; + dn_perf_info_local_var->confidence = confidence; + + return dn_perf_info_local_var; +} + +void OpenAPI_dn_perf_info_free(OpenAPI_dn_perf_info_t *dn_perf_info) +{ + OpenAPI_lnode_t *node = NULL; + + if (NULL == dn_perf_info) { + return; + } + if (dn_perf_info->app_id) { + ogs_free(dn_perf_info->app_id); + dn_perf_info->app_id = NULL; + } + if (dn_perf_info->dnn) { + ogs_free(dn_perf_info->dnn); + dn_perf_info->dnn = NULL; + } + if (dn_perf_info->snssai) { + OpenAPI_snssai_free(dn_perf_info->snssai); + dn_perf_info->snssai = NULL; + } + if (dn_perf_info->dn_perf) { + OpenAPI_list_for_each(dn_perf_info->dn_perf, node) { + OpenAPI_dn_perf_free(node->data); + } + OpenAPI_list_free(dn_perf_info->dn_perf); + dn_perf_info->dn_perf = NULL; + } + ogs_free(dn_perf_info); +} + +cJSON *OpenAPI_dn_perf_info_convertToJSON(OpenAPI_dn_perf_info_t *dn_perf_info) +{ + cJSON *item = NULL; + OpenAPI_lnode_t *node = NULL; + + if (dn_perf_info == NULL) { + ogs_error("OpenAPI_dn_perf_info_convertToJSON() failed [DnPerfInfo]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (dn_perf_info->app_id) { + if (cJSON_AddStringToObject(item, "appId", dn_perf_info->app_id) == NULL) { + ogs_error("OpenAPI_dn_perf_info_convertToJSON() failed [app_id]"); + goto end; + } + } + + if (dn_perf_info->dnn) { + if (cJSON_AddStringToObject(item, "dnn", dn_perf_info->dnn) == NULL) { + ogs_error("OpenAPI_dn_perf_info_convertToJSON() failed [dnn]"); + goto end; + } + } + + if (dn_perf_info->snssai) { + cJSON *snssai_local_JSON = OpenAPI_snssai_convertToJSON(dn_perf_info->snssai); + if (snssai_local_JSON == NULL) { + ogs_error("OpenAPI_dn_perf_info_convertToJSON() failed [snssai]"); + goto end; + } + cJSON_AddItemToObject(item, "snssai", snssai_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_dn_perf_info_convertToJSON() failed [snssai]"); + goto end; + } + } + + if (!dn_perf_info->dn_perf) { + ogs_error("OpenAPI_dn_perf_info_convertToJSON() failed [dn_perf]"); + return NULL; + } + cJSON *dn_perfList = cJSON_AddArrayToObject(item, "dnPerf"); + if (dn_perfList == NULL) { + ogs_error("OpenAPI_dn_perf_info_convertToJSON() failed [dn_perf]"); + goto end; + } + OpenAPI_list_for_each(dn_perf_info->dn_perf, node) { + cJSON *itemLocal = OpenAPI_dn_perf_convertToJSON(node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_dn_perf_info_convertToJSON() failed [dn_perf]"); + goto end; + } + cJSON_AddItemToArray(dn_perfList, itemLocal); + } + + if (dn_perf_info->is_confidence) { + if (cJSON_AddNumberToObject(item, "confidence", dn_perf_info->confidence) == NULL) { + ogs_error("OpenAPI_dn_perf_info_convertToJSON() failed [confidence]"); + goto end; + } + } + +end: + return item; +} + +OpenAPI_dn_perf_info_t *OpenAPI_dn_perf_info_parseFromJSON(cJSON *dn_perf_infoJSON) +{ + OpenAPI_dn_perf_info_t *dn_perf_info_local_var = NULL; + OpenAPI_lnode_t *node = NULL; + cJSON *app_id = NULL; + cJSON *dnn = NULL; + cJSON *snssai = NULL; + OpenAPI_snssai_t *snssai_local_nonprim = NULL; + cJSON *dn_perf = NULL; + OpenAPI_list_t *dn_perfList = NULL; + cJSON *confidence = NULL; + app_id = cJSON_GetObjectItemCaseSensitive(dn_perf_infoJSON, "appId"); + if (app_id) { + if (!cJSON_IsString(app_id) && !cJSON_IsNull(app_id)) { + ogs_error("OpenAPI_dn_perf_info_parseFromJSON() failed [app_id]"); + goto end; + } + } + + dnn = cJSON_GetObjectItemCaseSensitive(dn_perf_infoJSON, "dnn"); + if (dnn) { + if (!cJSON_IsString(dnn) && !cJSON_IsNull(dnn)) { + ogs_error("OpenAPI_dn_perf_info_parseFromJSON() failed [dnn]"); + goto end; + } + } + + snssai = cJSON_GetObjectItemCaseSensitive(dn_perf_infoJSON, "snssai"); + if (snssai) { + snssai_local_nonprim = OpenAPI_snssai_parseFromJSON(snssai); + } + + dn_perf = cJSON_GetObjectItemCaseSensitive(dn_perf_infoJSON, "dnPerf"); + if (!dn_perf) { + ogs_error("OpenAPI_dn_perf_info_parseFromJSON() failed [dn_perf]"); + goto end; + } + cJSON *dn_perf_local = NULL; + if (!cJSON_IsArray(dn_perf)) { + ogs_error("OpenAPI_dn_perf_info_parseFromJSON() failed [dn_perf]"); + goto end; + } + + dn_perfList = OpenAPI_list_create(); + + cJSON_ArrayForEach(dn_perf_local, dn_perf) { + if (!cJSON_IsObject(dn_perf_local)) { + ogs_error("OpenAPI_dn_perf_info_parseFromJSON() failed [dn_perf]"); + goto end; + } + OpenAPI_dn_perf_t *dn_perfItem = OpenAPI_dn_perf_parseFromJSON(dn_perf_local); + if (!dn_perfItem) { + ogs_error("No dn_perfItem"); + OpenAPI_list_free(dn_perfList); + goto end; + } + OpenAPI_list_add(dn_perfList, dn_perfItem); + } + + confidence = cJSON_GetObjectItemCaseSensitive(dn_perf_infoJSON, "confidence"); + if (confidence) { + if (!cJSON_IsNumber(confidence)) { + ogs_error("OpenAPI_dn_perf_info_parseFromJSON() failed [confidence]"); + goto end; + } + } + + dn_perf_info_local_var = OpenAPI_dn_perf_info_create ( + app_id && !cJSON_IsNull(app_id) ? ogs_strdup(app_id->valuestring) : NULL, + dnn && !cJSON_IsNull(dnn) ? ogs_strdup(dnn->valuestring) : NULL, + snssai ? snssai_local_nonprim : NULL, + dn_perfList, + confidence ? true : false, + confidence ? confidence->valuedouble : 0 + ); + + return dn_perf_info_local_var; +end: + if (snssai_local_nonprim) { + OpenAPI_snssai_free(snssai_local_nonprim); + snssai_local_nonprim = NULL; + } + if (dn_perfList) { + OpenAPI_list_for_each(dn_perfList, node) { + OpenAPI_dn_perf_free(node->data); + } + OpenAPI_list_free(dn_perfList); + dn_perfList = NULL; + } + return NULL; +} + +OpenAPI_dn_perf_info_t *OpenAPI_dn_perf_info_copy(OpenAPI_dn_perf_info_t *dst, OpenAPI_dn_perf_info_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_dn_perf_info_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_dn_perf_info_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_dn_perf_info_free(dst); + dst = OpenAPI_dn_perf_info_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/dn_perf_info.h b/lib/sbi/openapi/model/dn_perf_info.h new file mode 100644 index 000000000..c8258f0de --- /dev/null +++ b/lib/sbi/openapi/model/dn_perf_info.h @@ -0,0 +1,50 @@ +/* + * dn_perf_info.h + * + * Represents DN performance information. + */ + +#ifndef _OpenAPI_dn_perf_info_H_ +#define _OpenAPI_dn_perf_info_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "dn_perf.h" +#include "snssai.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_dn_perf_info_s OpenAPI_dn_perf_info_t; +typedef struct OpenAPI_dn_perf_info_s { + char *app_id; + char *dnn; + struct OpenAPI_snssai_s *snssai; + OpenAPI_list_t *dn_perf; + bool is_confidence; + int confidence; +} OpenAPI_dn_perf_info_t; + +OpenAPI_dn_perf_info_t *OpenAPI_dn_perf_info_create( + char *app_id, + char *dnn, + OpenAPI_snssai_t *snssai, + OpenAPI_list_t *dn_perf, + bool is_confidence, + int confidence +); +void OpenAPI_dn_perf_info_free(OpenAPI_dn_perf_info_t *dn_perf_info); +OpenAPI_dn_perf_info_t *OpenAPI_dn_perf_info_parseFromJSON(cJSON *dn_perf_infoJSON); +cJSON *OpenAPI_dn_perf_info_convertToJSON(OpenAPI_dn_perf_info_t *dn_perf_info); +OpenAPI_dn_perf_info_t *OpenAPI_dn_perf_info_copy(OpenAPI_dn_perf_info_t *dst, OpenAPI_dn_perf_info_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_dn_perf_info_H_ */ + diff --git a/lib/sbi/openapi/model/dn_perf_ordering_criterion.c b/lib/sbi/openapi/model/dn_perf_ordering_criterion.c new file mode 100644 index 000000000..1a654a89c --- /dev/null +++ b/lib/sbi/openapi/model/dn_perf_ordering_criterion.c @@ -0,0 +1,87 @@ + +#include +#include +#include +#include "dn_perf_ordering_criterion.h" + +OpenAPI_dn_perf_ordering_criterion_t *OpenAPI_dn_perf_ordering_criterion_create( +) +{ + OpenAPI_dn_perf_ordering_criterion_t *dn_perf_ordering_criterion_local_var = ogs_malloc(sizeof(OpenAPI_dn_perf_ordering_criterion_t)); + ogs_assert(dn_perf_ordering_criterion_local_var); + + + return dn_perf_ordering_criterion_local_var; +} + +void OpenAPI_dn_perf_ordering_criterion_free(OpenAPI_dn_perf_ordering_criterion_t *dn_perf_ordering_criterion) +{ + OpenAPI_lnode_t *node = NULL; + + if (NULL == dn_perf_ordering_criterion) { + return; + } + ogs_free(dn_perf_ordering_criterion); +} + +cJSON *OpenAPI_dn_perf_ordering_criterion_convertToJSON(OpenAPI_dn_perf_ordering_criterion_t *dn_perf_ordering_criterion) +{ + cJSON *item = NULL; + OpenAPI_lnode_t *node = NULL; + + if (dn_perf_ordering_criterion == NULL) { + ogs_error("OpenAPI_dn_perf_ordering_criterion_convertToJSON() failed [DnPerfOrderingCriterion]"); + return NULL; + } + + item = cJSON_CreateObject(); +end: + return item; +} + +OpenAPI_dn_perf_ordering_criterion_t *OpenAPI_dn_perf_ordering_criterion_parseFromJSON(cJSON *dn_perf_ordering_criterionJSON) +{ + OpenAPI_dn_perf_ordering_criterion_t *dn_perf_ordering_criterion_local_var = NULL; + OpenAPI_lnode_t *node = NULL; + dn_perf_ordering_criterion_local_var = OpenAPI_dn_perf_ordering_criterion_create ( + ); + + return dn_perf_ordering_criterion_local_var; +end: + return NULL; +} + +OpenAPI_dn_perf_ordering_criterion_t *OpenAPI_dn_perf_ordering_criterion_copy(OpenAPI_dn_perf_ordering_criterion_t *dst, OpenAPI_dn_perf_ordering_criterion_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_dn_perf_ordering_criterion_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_dn_perf_ordering_criterion_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_dn_perf_ordering_criterion_free(dst); + dst = OpenAPI_dn_perf_ordering_criterion_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/dn_perf_ordering_criterion.h b/lib/sbi/openapi/model/dn_perf_ordering_criterion.h new file mode 100644 index 000000000..d629788ae --- /dev/null +++ b/lib/sbi/openapi/model/dn_perf_ordering_criterion.h @@ -0,0 +1,37 @@ +/* + * dn_perf_ordering_criterion.h + * + * Possible values are: - AVERAGE_TRAFFIC_RATE: Indicates the average traffic rate. - MAXIMUM_TRAFFIC_RATE: Indicates the maximum traffic rate. - AVERAGE_PACKET_DELAY: Indicates the average packet delay. - MAXIMUM_PACKET_DELAY: Indicates the maximum packet delay. - AVERAGE_PACKET_LOSS_RATE: Indicates the average packet loss rate. + */ + +#ifndef _OpenAPI_dn_perf_ordering_criterion_H_ +#define _OpenAPI_dn_perf_ordering_criterion_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "dn_perf_ordering_criterion_any_of.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_dn_perf_ordering_criterion_s OpenAPI_dn_perf_ordering_criterion_t; +typedef struct OpenAPI_dn_perf_ordering_criterion_s { +} OpenAPI_dn_perf_ordering_criterion_t; + +OpenAPI_dn_perf_ordering_criterion_t *OpenAPI_dn_perf_ordering_criterion_create( +); +void OpenAPI_dn_perf_ordering_criterion_free(OpenAPI_dn_perf_ordering_criterion_t *dn_perf_ordering_criterion); +OpenAPI_dn_perf_ordering_criterion_t *OpenAPI_dn_perf_ordering_criterion_parseFromJSON(cJSON *dn_perf_ordering_criterionJSON); +cJSON *OpenAPI_dn_perf_ordering_criterion_convertToJSON(OpenAPI_dn_perf_ordering_criterion_t *dn_perf_ordering_criterion); +OpenAPI_dn_perf_ordering_criterion_t *OpenAPI_dn_perf_ordering_criterion_copy(OpenAPI_dn_perf_ordering_criterion_t *dst, OpenAPI_dn_perf_ordering_criterion_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_dn_perf_ordering_criterion_H_ */ + diff --git a/lib/sbi/openapi/model/dn_perf_ordering_criterion_any_of.c b/lib/sbi/openapi/model/dn_perf_ordering_criterion_any_of.c new file mode 100644 index 000000000..58af6be5a --- /dev/null +++ b/lib/sbi/openapi/model/dn_perf_ordering_criterion_any_of.c @@ -0,0 +1,30 @@ + +#include +#include +#include +#include "dn_perf_ordering_criterion_any_of.h" + +char* OpenAPI_dn_perf_ordering_criterion_any_of_ToString(OpenAPI_dn_perf_ordering_criterion_any_of_e dn_perf_ordering_criterion_any_of) +{ + const char *dn_perf_ordering_criterion_any_ofArray[] = { "NULL", "AVERAGE_TRAFFIC_RATE", "MAXIMUM_TRAFFIC_RATE", "AVERAGE_PACKET_DELAY", "MAXIMUM_PACKET_DELAY", "AVERAGE_PACKET_LOSS_RATE" }; + size_t sizeofArray = sizeof(dn_perf_ordering_criterion_any_ofArray) / sizeof(dn_perf_ordering_criterion_any_ofArray[0]); + if (dn_perf_ordering_criterion_any_of < sizeofArray) + return (char *)dn_perf_ordering_criterion_any_ofArray[dn_perf_ordering_criterion_any_of]; + else + return (char *)"Unknown"; +} + +OpenAPI_dn_perf_ordering_criterion_any_of_e OpenAPI_dn_perf_ordering_criterion_any_of_FromString(char* dn_perf_ordering_criterion_any_of) +{ + int stringToReturn = 0; + const char *dn_perf_ordering_criterion_any_ofArray[] = { "NULL", "AVERAGE_TRAFFIC_RATE", "MAXIMUM_TRAFFIC_RATE", "AVERAGE_PACKET_DELAY", "MAXIMUM_PACKET_DELAY", "AVERAGE_PACKET_LOSS_RATE" }; + size_t sizeofArray = sizeof(dn_perf_ordering_criterion_any_ofArray) / sizeof(dn_perf_ordering_criterion_any_ofArray[0]); + while (stringToReturn < sizeofArray) { + if (strcmp(dn_perf_ordering_criterion_any_of, dn_perf_ordering_criterion_any_ofArray[stringToReturn]) == 0) { + return stringToReturn; + } + stringToReturn++; + } + return 0; +} + diff --git a/lib/sbi/openapi/model/dn_perf_ordering_criterion_any_of.h b/lib/sbi/openapi/model/dn_perf_ordering_criterion_any_of.h new file mode 100644 index 000000000..43e87156a --- /dev/null +++ b/lib/sbi/openapi/model/dn_perf_ordering_criterion_any_of.h @@ -0,0 +1,31 @@ +/* + * dn_perf_ordering_criterion_any_of.h + * + * + */ + +#ifndef _OpenAPI_dn_perf_ordering_criterion_any_of_H_ +#define _OpenAPI_dn_perf_ordering_criterion_any_of_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef enum { OpenAPI_dn_perf_ordering_criterion_any_of_NULL = 0, OpenAPI_dn_perf_ordering_criterion_any_of_AVERAGE_TRAFFIC_RATE, OpenAPI_dn_perf_ordering_criterion_any_of_MAXIMUM_TRAFFIC_RATE, OpenAPI_dn_perf_ordering_criterion_any_of_AVERAGE_PACKET_DELAY, OpenAPI_dn_perf_ordering_criterion_any_of_MAXIMUM_PACKET_DELAY, OpenAPI_dn_perf_ordering_criterion_any_of_AVERAGE_PACKET_LOSS_RATE } OpenAPI_dn_perf_ordering_criterion_any_of_e; + +char* OpenAPI_dn_perf_ordering_criterion_any_of_ToString(OpenAPI_dn_perf_ordering_criterion_any_of_e dn_perf_ordering_criterion_any_of); + +OpenAPI_dn_perf_ordering_criterion_any_of_e OpenAPI_dn_perf_ordering_criterion_any_of_FromString(char* dn_perf_ordering_criterion_any_of); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_dn_perf_ordering_criterion_any_of_H_ */ + diff --git a/lib/sbi/openapi/model/dn_performance_req.c b/lib/sbi/openapi/model/dn_performance_req.c new file mode 100644 index 000000000..fa0122d1e --- /dev/null +++ b/lib/sbi/openapi/model/dn_performance_req.c @@ -0,0 +1,209 @@ + +#include +#include +#include +#include "dn_performance_req.h" + +OpenAPI_dn_performance_req_t *OpenAPI_dn_performance_req_create( + OpenAPI_dn_perf_ordering_criterion_t *dn_perf_order_criter, + OpenAPI_matching_direction_t *order, + OpenAPI_list_t *report_thresholds +) +{ + OpenAPI_dn_performance_req_t *dn_performance_req_local_var = ogs_malloc(sizeof(OpenAPI_dn_performance_req_t)); + ogs_assert(dn_performance_req_local_var); + + dn_performance_req_local_var->dn_perf_order_criter = dn_perf_order_criter; + dn_performance_req_local_var->order = order; + dn_performance_req_local_var->report_thresholds = report_thresholds; + + return dn_performance_req_local_var; +} + +void OpenAPI_dn_performance_req_free(OpenAPI_dn_performance_req_t *dn_performance_req) +{ + OpenAPI_lnode_t *node = NULL; + + if (NULL == dn_performance_req) { + return; + } + if (dn_performance_req->dn_perf_order_criter) { + OpenAPI_dn_perf_ordering_criterion_free(dn_performance_req->dn_perf_order_criter); + dn_performance_req->dn_perf_order_criter = NULL; + } + if (dn_performance_req->order) { + OpenAPI_matching_direction_free(dn_performance_req->order); + dn_performance_req->order = NULL; + } + if (dn_performance_req->report_thresholds) { + OpenAPI_list_for_each(dn_performance_req->report_thresholds, node) { + OpenAPI_threshold_level_free(node->data); + } + OpenAPI_list_free(dn_performance_req->report_thresholds); + dn_performance_req->report_thresholds = NULL; + } + ogs_free(dn_performance_req); +} + +cJSON *OpenAPI_dn_performance_req_convertToJSON(OpenAPI_dn_performance_req_t *dn_performance_req) +{ + cJSON *item = NULL; + OpenAPI_lnode_t *node = NULL; + + if (dn_performance_req == NULL) { + ogs_error("OpenAPI_dn_performance_req_convertToJSON() failed [DnPerformanceReq]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (dn_performance_req->dn_perf_order_criter) { + cJSON *dn_perf_order_criter_local_JSON = OpenAPI_dn_perf_ordering_criterion_convertToJSON(dn_performance_req->dn_perf_order_criter); + if (dn_perf_order_criter_local_JSON == NULL) { + ogs_error("OpenAPI_dn_performance_req_convertToJSON() failed [dn_perf_order_criter]"); + goto end; + } + cJSON_AddItemToObject(item, "dnPerfOrderCriter", dn_perf_order_criter_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_dn_performance_req_convertToJSON() failed [dn_perf_order_criter]"); + goto end; + } + } + + if (dn_performance_req->order) { + cJSON *order_local_JSON = OpenAPI_matching_direction_convertToJSON(dn_performance_req->order); + if (order_local_JSON == NULL) { + ogs_error("OpenAPI_dn_performance_req_convertToJSON() failed [order]"); + goto end; + } + cJSON_AddItemToObject(item, "order", order_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_dn_performance_req_convertToJSON() failed [order]"); + goto end; + } + } + + if (dn_performance_req->report_thresholds) { + cJSON *report_thresholdsList = cJSON_AddArrayToObject(item, "reportThresholds"); + if (report_thresholdsList == NULL) { + ogs_error("OpenAPI_dn_performance_req_convertToJSON() failed [report_thresholds]"); + goto end; + } + OpenAPI_list_for_each(dn_performance_req->report_thresholds, node) { + cJSON *itemLocal = OpenAPI_threshold_level_convertToJSON(node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_dn_performance_req_convertToJSON() failed [report_thresholds]"); + goto end; + } + cJSON_AddItemToArray(report_thresholdsList, itemLocal); + } + } + +end: + return item; +} + +OpenAPI_dn_performance_req_t *OpenAPI_dn_performance_req_parseFromJSON(cJSON *dn_performance_reqJSON) +{ + OpenAPI_dn_performance_req_t *dn_performance_req_local_var = NULL; + OpenAPI_lnode_t *node = NULL; + cJSON *dn_perf_order_criter = NULL; + OpenAPI_dn_perf_ordering_criterion_t *dn_perf_order_criter_local_nonprim = NULL; + cJSON *order = NULL; + OpenAPI_matching_direction_t *order_local_nonprim = NULL; + cJSON *report_thresholds = NULL; + OpenAPI_list_t *report_thresholdsList = NULL; + dn_perf_order_criter = cJSON_GetObjectItemCaseSensitive(dn_performance_reqJSON, "dnPerfOrderCriter"); + if (dn_perf_order_criter) { + dn_perf_order_criter_local_nonprim = OpenAPI_dn_perf_ordering_criterion_parseFromJSON(dn_perf_order_criter); + } + + order = cJSON_GetObjectItemCaseSensitive(dn_performance_reqJSON, "order"); + if (order) { + order_local_nonprim = OpenAPI_matching_direction_parseFromJSON(order); + } + + report_thresholds = cJSON_GetObjectItemCaseSensitive(dn_performance_reqJSON, "reportThresholds"); + if (report_thresholds) { + cJSON *report_thresholds_local = NULL; + if (!cJSON_IsArray(report_thresholds)) { + ogs_error("OpenAPI_dn_performance_req_parseFromJSON() failed [report_thresholds]"); + goto end; + } + + report_thresholdsList = OpenAPI_list_create(); + + cJSON_ArrayForEach(report_thresholds_local, report_thresholds) { + if (!cJSON_IsObject(report_thresholds_local)) { + ogs_error("OpenAPI_dn_performance_req_parseFromJSON() failed [report_thresholds]"); + goto end; + } + OpenAPI_threshold_level_t *report_thresholdsItem = OpenAPI_threshold_level_parseFromJSON(report_thresholds_local); + if (!report_thresholdsItem) { + ogs_error("No report_thresholdsItem"); + OpenAPI_list_free(report_thresholdsList); + goto end; + } + OpenAPI_list_add(report_thresholdsList, report_thresholdsItem); + } + } + + dn_performance_req_local_var = OpenAPI_dn_performance_req_create ( + dn_perf_order_criter ? dn_perf_order_criter_local_nonprim : NULL, + order ? order_local_nonprim : NULL, + report_thresholds ? report_thresholdsList : NULL + ); + + return dn_performance_req_local_var; +end: + if (dn_perf_order_criter_local_nonprim) { + OpenAPI_dn_perf_ordering_criterion_free(dn_perf_order_criter_local_nonprim); + dn_perf_order_criter_local_nonprim = NULL; + } + if (order_local_nonprim) { + OpenAPI_matching_direction_free(order_local_nonprim); + order_local_nonprim = NULL; + } + if (report_thresholdsList) { + OpenAPI_list_for_each(report_thresholdsList, node) { + OpenAPI_threshold_level_free(node->data); + } + OpenAPI_list_free(report_thresholdsList); + report_thresholdsList = NULL; + } + return NULL; +} + +OpenAPI_dn_performance_req_t *OpenAPI_dn_performance_req_copy(OpenAPI_dn_performance_req_t *dst, OpenAPI_dn_performance_req_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_dn_performance_req_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_dn_performance_req_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_dn_performance_req_free(dst); + dst = OpenAPI_dn_performance_req_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/dn_performance_req.h b/lib/sbi/openapi/model/dn_performance_req.h new file mode 100644 index 000000000..1f839aa60 --- /dev/null +++ b/lib/sbi/openapi/model/dn_performance_req.h @@ -0,0 +1,45 @@ +/* + * dn_performance_req.h + * + * Represents other DN performance analytics requirements. + */ + +#ifndef _OpenAPI_dn_performance_req_H_ +#define _OpenAPI_dn_performance_req_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "dn_perf_ordering_criterion.h" +#include "matching_direction.h" +#include "threshold_level.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_dn_performance_req_s OpenAPI_dn_performance_req_t; +typedef struct OpenAPI_dn_performance_req_s { + struct OpenAPI_dn_perf_ordering_criterion_s *dn_perf_order_criter; + struct OpenAPI_matching_direction_s *order; + OpenAPI_list_t *report_thresholds; +} OpenAPI_dn_performance_req_t; + +OpenAPI_dn_performance_req_t *OpenAPI_dn_performance_req_create( + OpenAPI_dn_perf_ordering_criterion_t *dn_perf_order_criter, + OpenAPI_matching_direction_t *order, + OpenAPI_list_t *report_thresholds +); +void OpenAPI_dn_performance_req_free(OpenAPI_dn_performance_req_t *dn_performance_req); +OpenAPI_dn_performance_req_t *OpenAPI_dn_performance_req_parseFromJSON(cJSON *dn_performance_reqJSON); +cJSON *OpenAPI_dn_performance_req_convertToJSON(OpenAPI_dn_performance_req_t *dn_performance_req); +OpenAPI_dn_performance_req_t *OpenAPI_dn_performance_req_copy(OpenAPI_dn_performance_req_t *dst, OpenAPI_dn_performance_req_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_dn_performance_req_H_ */ + diff --git a/lib/sbi/openapi/model/dnai_information.h b/lib/sbi/openapi/model/dnai_information.h index ff26b6095..2e31a295f 100644 --- a/lib/sbi/openapi/model/dnai_information.h +++ b/lib/sbi/openapi/model/dnai_information.h @@ -1,7 +1,7 @@ /* * dnai_information.h * - * + * DNAI Information */ #ifndef _OpenAPI_dnai_information_H_ diff --git a/lib/sbi/openapi/model/dnf.h b/lib/sbi/openapi/model/dnf.h index df6f2d178..7b94f363c 100644 --- a/lib/sbi/openapi/model/dnf.h +++ b/lib/sbi/openapi/model/dnf.h @@ -1,7 +1,7 @@ /* * dnf.h * - * + * A disjunctive normal form. */ #ifndef _OpenAPI_dnf_H_ diff --git a/lib/sbi/openapi/model/dnf_unit.h b/lib/sbi/openapi/model/dnf_unit.h index c5cd9c82c..f41307801 100644 --- a/lib/sbi/openapi/model/dnf_unit.h +++ b/lib/sbi/openapi/model/dnf_unit.h @@ -1,7 +1,7 @@ /* * dnf_unit.h * - * + * During the processing of dnfUnits attribute, all the members in the array shall be interpreted as logically concatenated with logical \"OR\". */ #ifndef _OpenAPI_dnf_unit_H_ diff --git a/lib/sbi/openapi/model/dnn_configuration.c b/lib/sbi/openapi/model/dnn_configuration.c index 94d313d5b..198b2d0db 100644 --- a/lib/sbi/openapi/model/dnn_configuration.c +++ b/lib/sbi/openapi/model/dnn_configuration.c @@ -26,10 +26,27 @@ OpenAPI_dnn_configuration_t *OpenAPI_dnn_configuration_create( int atsss_allowed, bool is_secondary_auth, int secondary_auth, + bool is_uav_secondary_auth, + int uav_secondary_auth, bool is_dn_aaa_ip_address_allocation, int dn_aaa_ip_address_allocation, OpenAPI_ip_address_t *dn_aaa_address, - char *iptv_acc_ctrl_info + OpenAPI_list_t *additional_dn_aaa_addresses, + char *dn_aaa_fqdn, + char *iptv_acc_ctrl_info, + OpenAPI_ip_index_t *ipv4_index, + OpenAPI_ip_index_t *ipv6_index, + OpenAPI_ecs_addr_config_info_t *ecs_addr_config_info, + OpenAPI_list_t *additional_ecs_addr_config_infos, + char *shared_ecs_addr_config_info, + OpenAPI_list_t *additional_shared_ecs_addr_config_info_ids, + bool is_eas_discovery_authorized, + int eas_discovery_authorized, + bool is_onboarding_ind, + int onboarding_ind, + OpenAPI_aerial_ue_indication_e aerial_ue_ind, + bool is_subscribed_max_ipv6_prefix_size, + int subscribed_max_ipv6_prefix_size ) { OpenAPI_dnn_configuration_t *dnn_configuration_local_var = ogs_malloc(sizeof(OpenAPI_dnn_configuration_t)); @@ -56,10 +73,27 @@ OpenAPI_dnn_configuration_t *OpenAPI_dnn_configuration_create( dnn_configuration_local_var->atsss_allowed = atsss_allowed; dnn_configuration_local_var->is_secondary_auth = is_secondary_auth; dnn_configuration_local_var->secondary_auth = secondary_auth; + dnn_configuration_local_var->is_uav_secondary_auth = is_uav_secondary_auth; + dnn_configuration_local_var->uav_secondary_auth = uav_secondary_auth; dnn_configuration_local_var->is_dn_aaa_ip_address_allocation = is_dn_aaa_ip_address_allocation; dnn_configuration_local_var->dn_aaa_ip_address_allocation = dn_aaa_ip_address_allocation; dnn_configuration_local_var->dn_aaa_address = dn_aaa_address; + dnn_configuration_local_var->additional_dn_aaa_addresses = additional_dn_aaa_addresses; + dnn_configuration_local_var->dn_aaa_fqdn = dn_aaa_fqdn; dnn_configuration_local_var->iptv_acc_ctrl_info = iptv_acc_ctrl_info; + dnn_configuration_local_var->ipv4_index = ipv4_index; + dnn_configuration_local_var->ipv6_index = ipv6_index; + dnn_configuration_local_var->ecs_addr_config_info = ecs_addr_config_info; + dnn_configuration_local_var->additional_ecs_addr_config_infos = additional_ecs_addr_config_infos; + dnn_configuration_local_var->shared_ecs_addr_config_info = shared_ecs_addr_config_info; + dnn_configuration_local_var->additional_shared_ecs_addr_config_info_ids = additional_shared_ecs_addr_config_info_ids; + dnn_configuration_local_var->is_eas_discovery_authorized = is_eas_discovery_authorized; + dnn_configuration_local_var->eas_discovery_authorized = eas_discovery_authorized; + dnn_configuration_local_var->is_onboarding_ind = is_onboarding_ind; + dnn_configuration_local_var->onboarding_ind = onboarding_ind; + dnn_configuration_local_var->aerial_ue_ind = aerial_ue_ind; + dnn_configuration_local_var->is_subscribed_max_ipv6_prefix_size = is_subscribed_max_ipv6_prefix_size; + dnn_configuration_local_var->subscribed_max_ipv6_prefix_size = subscribed_max_ipv6_prefix_size; return dnn_configuration_local_var; } @@ -132,10 +166,51 @@ void OpenAPI_dnn_configuration_free(OpenAPI_dnn_configuration_t *dnn_configurati OpenAPI_ip_address_free(dnn_configuration->dn_aaa_address); dnn_configuration->dn_aaa_address = NULL; } + if (dnn_configuration->additional_dn_aaa_addresses) { + OpenAPI_list_for_each(dnn_configuration->additional_dn_aaa_addresses, node) { + OpenAPI_ip_address_free(node->data); + } + OpenAPI_list_free(dnn_configuration->additional_dn_aaa_addresses); + dnn_configuration->additional_dn_aaa_addresses = NULL; + } + if (dnn_configuration->dn_aaa_fqdn) { + ogs_free(dnn_configuration->dn_aaa_fqdn); + dnn_configuration->dn_aaa_fqdn = NULL; + } if (dnn_configuration->iptv_acc_ctrl_info) { ogs_free(dnn_configuration->iptv_acc_ctrl_info); dnn_configuration->iptv_acc_ctrl_info = NULL; } + if (dnn_configuration->ipv4_index) { + OpenAPI_ip_index_free(dnn_configuration->ipv4_index); + dnn_configuration->ipv4_index = NULL; + } + if (dnn_configuration->ipv6_index) { + OpenAPI_ip_index_free(dnn_configuration->ipv6_index); + dnn_configuration->ipv6_index = NULL; + } + if (dnn_configuration->ecs_addr_config_info) { + OpenAPI_ecs_addr_config_info_free(dnn_configuration->ecs_addr_config_info); + dnn_configuration->ecs_addr_config_info = NULL; + } + if (dnn_configuration->additional_ecs_addr_config_infos) { + OpenAPI_list_for_each(dnn_configuration->additional_ecs_addr_config_infos, node) { + OpenAPI_ecs_addr_config_info_free(node->data); + } + OpenAPI_list_free(dnn_configuration->additional_ecs_addr_config_infos); + dnn_configuration->additional_ecs_addr_config_infos = NULL; + } + if (dnn_configuration->shared_ecs_addr_config_info) { + ogs_free(dnn_configuration->shared_ecs_addr_config_info); + dnn_configuration->shared_ecs_addr_config_info = NULL; + } + if (dnn_configuration->additional_shared_ecs_addr_config_info_ids) { + OpenAPI_list_for_each(dnn_configuration->additional_shared_ecs_addr_config_info_ids, node) { + ogs_free(node->data); + } + OpenAPI_list_free(dnn_configuration->additional_shared_ecs_addr_config_info_ids); + dnn_configuration->additional_shared_ecs_addr_config_info_ids = NULL; + } ogs_free(dnn_configuration); } @@ -342,6 +417,13 @@ cJSON *OpenAPI_dnn_configuration_convertToJSON(OpenAPI_dnn_configuration_t *dnn_ } } + if (dnn_configuration->is_uav_secondary_auth) { + if (cJSON_AddBoolToObject(item, "uavSecondaryAuth", dnn_configuration->uav_secondary_auth) == NULL) { + ogs_error("OpenAPI_dnn_configuration_convertToJSON() failed [uav_secondary_auth]"); + goto end; + } + } + if (dnn_configuration->is_dn_aaa_ip_address_allocation) { if (cJSON_AddBoolToObject(item, "dnAaaIpAddressAllocation", dnn_configuration->dn_aaa_ip_address_allocation) == NULL) { ogs_error("OpenAPI_dnn_configuration_convertToJSON() failed [dn_aaa_ip_address_allocation]"); @@ -362,6 +444,29 @@ cJSON *OpenAPI_dnn_configuration_convertToJSON(OpenAPI_dnn_configuration_t *dnn_ } } + if (dnn_configuration->additional_dn_aaa_addresses) { + cJSON *additional_dn_aaa_addressesList = cJSON_AddArrayToObject(item, "additionalDnAaaAddresses"); + if (additional_dn_aaa_addressesList == NULL) { + ogs_error("OpenAPI_dnn_configuration_convertToJSON() failed [additional_dn_aaa_addresses]"); + goto end; + } + OpenAPI_list_for_each(dnn_configuration->additional_dn_aaa_addresses, node) { + cJSON *itemLocal = OpenAPI_ip_address_convertToJSON(node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_dnn_configuration_convertToJSON() failed [additional_dn_aaa_addresses]"); + goto end; + } + cJSON_AddItemToArray(additional_dn_aaa_addressesList, itemLocal); + } + } + + if (dnn_configuration->dn_aaa_fqdn) { + if (cJSON_AddStringToObject(item, "dnAaaFqdn", dnn_configuration->dn_aaa_fqdn) == NULL) { + ogs_error("OpenAPI_dnn_configuration_convertToJSON() failed [dn_aaa_fqdn]"); + goto end; + } + } + if (dnn_configuration->iptv_acc_ctrl_info) { if (cJSON_AddStringToObject(item, "iptvAccCtrlInfo", dnn_configuration->iptv_acc_ctrl_info) == NULL) { ogs_error("OpenAPI_dnn_configuration_convertToJSON() failed [iptv_acc_ctrl_info]"); @@ -369,6 +474,110 @@ cJSON *OpenAPI_dnn_configuration_convertToJSON(OpenAPI_dnn_configuration_t *dnn_ } } + if (dnn_configuration->ipv4_index) { + cJSON *ipv4_index_local_JSON = OpenAPI_ip_index_convertToJSON(dnn_configuration->ipv4_index); + if (ipv4_index_local_JSON == NULL) { + ogs_error("OpenAPI_dnn_configuration_convertToJSON() failed [ipv4_index]"); + goto end; + } + cJSON_AddItemToObject(item, "ipv4Index", ipv4_index_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_dnn_configuration_convertToJSON() failed [ipv4_index]"); + goto end; + } + } + + if (dnn_configuration->ipv6_index) { + cJSON *ipv6_index_local_JSON = OpenAPI_ip_index_convertToJSON(dnn_configuration->ipv6_index); + if (ipv6_index_local_JSON == NULL) { + ogs_error("OpenAPI_dnn_configuration_convertToJSON() failed [ipv6_index]"); + goto end; + } + cJSON_AddItemToObject(item, "ipv6Index", ipv6_index_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_dnn_configuration_convertToJSON() failed [ipv6_index]"); + goto end; + } + } + + if (dnn_configuration->ecs_addr_config_info) { + cJSON *ecs_addr_config_info_local_JSON = OpenAPI_ecs_addr_config_info_convertToJSON(dnn_configuration->ecs_addr_config_info); + if (ecs_addr_config_info_local_JSON == NULL) { + ogs_error("OpenAPI_dnn_configuration_convertToJSON() failed [ecs_addr_config_info]"); + goto end; + } + cJSON_AddItemToObject(item, "ecsAddrConfigInfo", ecs_addr_config_info_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_dnn_configuration_convertToJSON() failed [ecs_addr_config_info]"); + goto end; + } + } + + if (dnn_configuration->additional_ecs_addr_config_infos) { + cJSON *additional_ecs_addr_config_infosList = cJSON_AddArrayToObject(item, "additionalEcsAddrConfigInfos"); + if (additional_ecs_addr_config_infosList == NULL) { + ogs_error("OpenAPI_dnn_configuration_convertToJSON() failed [additional_ecs_addr_config_infos]"); + goto end; + } + OpenAPI_list_for_each(dnn_configuration->additional_ecs_addr_config_infos, node) { + cJSON *itemLocal = OpenAPI_ecs_addr_config_info_convertToJSON(node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_dnn_configuration_convertToJSON() failed [additional_ecs_addr_config_infos]"); + goto end; + } + cJSON_AddItemToArray(additional_ecs_addr_config_infosList, itemLocal); + } + } + + if (dnn_configuration->shared_ecs_addr_config_info) { + if (cJSON_AddStringToObject(item, "sharedEcsAddrConfigInfo", dnn_configuration->shared_ecs_addr_config_info) == NULL) { + ogs_error("OpenAPI_dnn_configuration_convertToJSON() failed [shared_ecs_addr_config_info]"); + goto end; + } + } + + if (dnn_configuration->additional_shared_ecs_addr_config_info_ids) { + cJSON *additional_shared_ecs_addr_config_info_idsList = cJSON_AddArrayToObject(item, "additionalSharedEcsAddrConfigInfoIds"); + if (additional_shared_ecs_addr_config_info_idsList == NULL) { + ogs_error("OpenAPI_dnn_configuration_convertToJSON() failed [additional_shared_ecs_addr_config_info_ids]"); + goto end; + } + OpenAPI_list_for_each(dnn_configuration->additional_shared_ecs_addr_config_info_ids, node) { + if (cJSON_AddStringToObject(additional_shared_ecs_addr_config_info_idsList, "", (char*)node->data) == NULL) { + ogs_error("OpenAPI_dnn_configuration_convertToJSON() failed [additional_shared_ecs_addr_config_info_ids]"); + goto end; + } + } + } + + if (dnn_configuration->is_eas_discovery_authorized) { + if (cJSON_AddBoolToObject(item, "easDiscoveryAuthorized", dnn_configuration->eas_discovery_authorized) == NULL) { + ogs_error("OpenAPI_dnn_configuration_convertToJSON() failed [eas_discovery_authorized]"); + goto end; + } + } + + if (dnn_configuration->is_onboarding_ind) { + if (cJSON_AddBoolToObject(item, "onboardingInd", dnn_configuration->onboarding_ind) == NULL) { + ogs_error("OpenAPI_dnn_configuration_convertToJSON() failed [onboarding_ind]"); + goto end; + } + } + + if (dnn_configuration->aerial_ue_ind != OpenAPI_aerial_ue_indication_NULL) { + if (cJSON_AddStringToObject(item, "aerialUeInd", OpenAPI_aerial_ue_indication_ToString(dnn_configuration->aerial_ue_ind)) == NULL) { + ogs_error("OpenAPI_dnn_configuration_convertToJSON() failed [aerial_ue_ind]"); + goto end; + } + } + + if (dnn_configuration->is_subscribed_max_ipv6_prefix_size) { + if (cJSON_AddNumberToObject(item, "subscribedMaxIpv6PrefixSize", dnn_configuration->subscribed_max_ipv6_prefix_size) == NULL) { + ogs_error("OpenAPI_dnn_configuration_convertToJSON() failed [subscribed_max_ipv6_prefix_size]"); + goto end; + } + } + end: return item; } @@ -405,10 +614,30 @@ OpenAPI_dnn_configuration_t *OpenAPI_dnn_configuration_parseFromJSON(cJSON *dnn_ OpenAPI_list_t *ipv6_frame_route_listList = NULL; cJSON *atsss_allowed = NULL; cJSON *secondary_auth = NULL; + cJSON *uav_secondary_auth = NULL; cJSON *dn_aaa_ip_address_allocation = NULL; cJSON *dn_aaa_address = NULL; OpenAPI_ip_address_t *dn_aaa_address_local_nonprim = NULL; + cJSON *additional_dn_aaa_addresses = NULL; + OpenAPI_list_t *additional_dn_aaa_addressesList = NULL; + cJSON *dn_aaa_fqdn = NULL; cJSON *iptv_acc_ctrl_info = NULL; + cJSON *ipv4_index = NULL; + OpenAPI_ip_index_t *ipv4_index_local_nonprim = NULL; + cJSON *ipv6_index = NULL; + OpenAPI_ip_index_t *ipv6_index_local_nonprim = NULL; + cJSON *ecs_addr_config_info = NULL; + OpenAPI_ecs_addr_config_info_t *ecs_addr_config_info_local_nonprim = NULL; + cJSON *additional_ecs_addr_config_infos = NULL; + OpenAPI_list_t *additional_ecs_addr_config_infosList = NULL; + cJSON *shared_ecs_addr_config_info = NULL; + cJSON *additional_shared_ecs_addr_config_info_ids = NULL; + OpenAPI_list_t *additional_shared_ecs_addr_config_info_idsList = NULL; + cJSON *eas_discovery_authorized = NULL; + cJSON *onboarding_ind = NULL; + cJSON *aerial_ue_ind = NULL; + OpenAPI_aerial_ue_indication_e aerial_ue_indVariable = 0; + cJSON *subscribed_max_ipv6_prefix_size = NULL; pdu_session_types = cJSON_GetObjectItemCaseSensitive(dnn_configurationJSON, "pduSessionTypes"); if (!pdu_session_types) { ogs_error("OpenAPI_dnn_configuration_parseFromJSON() failed [pdu_session_types]"); @@ -580,6 +809,14 @@ OpenAPI_dnn_configuration_t *OpenAPI_dnn_configuration_parseFromJSON(cJSON *dnn_ } } + uav_secondary_auth = cJSON_GetObjectItemCaseSensitive(dnn_configurationJSON, "uavSecondaryAuth"); + if (uav_secondary_auth) { + if (!cJSON_IsBool(uav_secondary_auth)) { + ogs_error("OpenAPI_dnn_configuration_parseFromJSON() failed [uav_secondary_auth]"); + goto end; + } + } + dn_aaa_ip_address_allocation = cJSON_GetObjectItemCaseSensitive(dnn_configurationJSON, "dnAaaIpAddressAllocation"); if (dn_aaa_ip_address_allocation) { if (!cJSON_IsBool(dn_aaa_ip_address_allocation)) { @@ -593,6 +830,39 @@ OpenAPI_dnn_configuration_t *OpenAPI_dnn_configuration_parseFromJSON(cJSON *dnn_ dn_aaa_address_local_nonprim = OpenAPI_ip_address_parseFromJSON(dn_aaa_address); } + additional_dn_aaa_addresses = cJSON_GetObjectItemCaseSensitive(dnn_configurationJSON, "additionalDnAaaAddresses"); + if (additional_dn_aaa_addresses) { + cJSON *additional_dn_aaa_addresses_local = NULL; + if (!cJSON_IsArray(additional_dn_aaa_addresses)) { + ogs_error("OpenAPI_dnn_configuration_parseFromJSON() failed [additional_dn_aaa_addresses]"); + goto end; + } + + additional_dn_aaa_addressesList = OpenAPI_list_create(); + + cJSON_ArrayForEach(additional_dn_aaa_addresses_local, additional_dn_aaa_addresses) { + if (!cJSON_IsObject(additional_dn_aaa_addresses_local)) { + ogs_error("OpenAPI_dnn_configuration_parseFromJSON() failed [additional_dn_aaa_addresses]"); + goto end; + } + OpenAPI_ip_address_t *additional_dn_aaa_addressesItem = OpenAPI_ip_address_parseFromJSON(additional_dn_aaa_addresses_local); + if (!additional_dn_aaa_addressesItem) { + ogs_error("No additional_dn_aaa_addressesItem"); + OpenAPI_list_free(additional_dn_aaa_addressesList); + goto end; + } + OpenAPI_list_add(additional_dn_aaa_addressesList, additional_dn_aaa_addressesItem); + } + } + + dn_aaa_fqdn = cJSON_GetObjectItemCaseSensitive(dnn_configurationJSON, "dnAaaFqdn"); + if (dn_aaa_fqdn) { + if (!cJSON_IsString(dn_aaa_fqdn) && !cJSON_IsNull(dn_aaa_fqdn)) { + ogs_error("OpenAPI_dnn_configuration_parseFromJSON() failed [dn_aaa_fqdn]"); + goto end; + } + } + iptv_acc_ctrl_info = cJSON_GetObjectItemCaseSensitive(dnn_configurationJSON, "iptvAccCtrlInfo"); if (iptv_acc_ctrl_info) { if (!cJSON_IsString(iptv_acc_ctrl_info) && !cJSON_IsNull(iptv_acc_ctrl_info)) { @@ -601,6 +871,108 @@ OpenAPI_dnn_configuration_t *OpenAPI_dnn_configuration_parseFromJSON(cJSON *dnn_ } } + ipv4_index = cJSON_GetObjectItemCaseSensitive(dnn_configurationJSON, "ipv4Index"); + if (ipv4_index) { + ipv4_index_local_nonprim = OpenAPI_ip_index_parseFromJSON(ipv4_index); + } + + ipv6_index = cJSON_GetObjectItemCaseSensitive(dnn_configurationJSON, "ipv6Index"); + if (ipv6_index) { + ipv6_index_local_nonprim = OpenAPI_ip_index_parseFromJSON(ipv6_index); + } + + ecs_addr_config_info = cJSON_GetObjectItemCaseSensitive(dnn_configurationJSON, "ecsAddrConfigInfo"); + if (ecs_addr_config_info) { + ecs_addr_config_info_local_nonprim = OpenAPI_ecs_addr_config_info_parseFromJSON(ecs_addr_config_info); + } + + additional_ecs_addr_config_infos = cJSON_GetObjectItemCaseSensitive(dnn_configurationJSON, "additionalEcsAddrConfigInfos"); + if (additional_ecs_addr_config_infos) { + cJSON *additional_ecs_addr_config_infos_local = NULL; + if (!cJSON_IsArray(additional_ecs_addr_config_infos)) { + ogs_error("OpenAPI_dnn_configuration_parseFromJSON() failed [additional_ecs_addr_config_infos]"); + goto end; + } + + additional_ecs_addr_config_infosList = OpenAPI_list_create(); + + cJSON_ArrayForEach(additional_ecs_addr_config_infos_local, additional_ecs_addr_config_infos) { + if (!cJSON_IsObject(additional_ecs_addr_config_infos_local)) { + ogs_error("OpenAPI_dnn_configuration_parseFromJSON() failed [additional_ecs_addr_config_infos]"); + goto end; + } + OpenAPI_ecs_addr_config_info_t *additional_ecs_addr_config_infosItem = OpenAPI_ecs_addr_config_info_parseFromJSON(additional_ecs_addr_config_infos_local); + if (!additional_ecs_addr_config_infosItem) { + ogs_error("No additional_ecs_addr_config_infosItem"); + OpenAPI_list_free(additional_ecs_addr_config_infosList); + goto end; + } + OpenAPI_list_add(additional_ecs_addr_config_infosList, additional_ecs_addr_config_infosItem); + } + } + + shared_ecs_addr_config_info = cJSON_GetObjectItemCaseSensitive(dnn_configurationJSON, "sharedEcsAddrConfigInfo"); + if (shared_ecs_addr_config_info) { + if (!cJSON_IsString(shared_ecs_addr_config_info) && !cJSON_IsNull(shared_ecs_addr_config_info)) { + ogs_error("OpenAPI_dnn_configuration_parseFromJSON() failed [shared_ecs_addr_config_info]"); + goto end; + } + } + + additional_shared_ecs_addr_config_info_ids = cJSON_GetObjectItemCaseSensitive(dnn_configurationJSON, "additionalSharedEcsAddrConfigInfoIds"); + if (additional_shared_ecs_addr_config_info_ids) { + cJSON *additional_shared_ecs_addr_config_info_ids_local = NULL; + if (!cJSON_IsArray(additional_shared_ecs_addr_config_info_ids)) { + ogs_error("OpenAPI_dnn_configuration_parseFromJSON() failed [additional_shared_ecs_addr_config_info_ids]"); + goto end; + } + + additional_shared_ecs_addr_config_info_idsList = OpenAPI_list_create(); + + cJSON_ArrayForEach(additional_shared_ecs_addr_config_info_ids_local, additional_shared_ecs_addr_config_info_ids) { + double *localDouble = NULL; + int *localInt = NULL; + if (!cJSON_IsString(additional_shared_ecs_addr_config_info_ids_local)) { + ogs_error("OpenAPI_dnn_configuration_parseFromJSON() failed [additional_shared_ecs_addr_config_info_ids]"); + goto end; + } + OpenAPI_list_add(additional_shared_ecs_addr_config_info_idsList, ogs_strdup(additional_shared_ecs_addr_config_info_ids_local->valuestring)); + } + } + + eas_discovery_authorized = cJSON_GetObjectItemCaseSensitive(dnn_configurationJSON, "easDiscoveryAuthorized"); + if (eas_discovery_authorized) { + if (!cJSON_IsBool(eas_discovery_authorized)) { + ogs_error("OpenAPI_dnn_configuration_parseFromJSON() failed [eas_discovery_authorized]"); + goto end; + } + } + + onboarding_ind = cJSON_GetObjectItemCaseSensitive(dnn_configurationJSON, "onboardingInd"); + if (onboarding_ind) { + if (!cJSON_IsBool(onboarding_ind)) { + ogs_error("OpenAPI_dnn_configuration_parseFromJSON() failed [onboarding_ind]"); + goto end; + } + } + + aerial_ue_ind = cJSON_GetObjectItemCaseSensitive(dnn_configurationJSON, "aerialUeInd"); + if (aerial_ue_ind) { + if (!cJSON_IsString(aerial_ue_ind)) { + ogs_error("OpenAPI_dnn_configuration_parseFromJSON() failed [aerial_ue_ind]"); + goto end; + } + aerial_ue_indVariable = OpenAPI_aerial_ue_indication_FromString(aerial_ue_ind->valuestring); + } + + subscribed_max_ipv6_prefix_size = cJSON_GetObjectItemCaseSensitive(dnn_configurationJSON, "subscribedMaxIpv6PrefixSize"); + if (subscribed_max_ipv6_prefix_size) { + if (!cJSON_IsNumber(subscribed_max_ipv6_prefix_size)) { + ogs_error("OpenAPI_dnn_configuration_parseFromJSON() failed [subscribed_max_ipv6_prefix_size]"); + goto end; + } + } + dnn_configuration_local_var = OpenAPI_dnn_configuration_create ( pdu_session_types_local_nonprim, ssc_modes_local_nonprim, @@ -623,10 +995,27 @@ OpenAPI_dnn_configuration_t *OpenAPI_dnn_configuration_parseFromJSON(cJSON *dnn_ atsss_allowed ? atsss_allowed->valueint : 0, secondary_auth ? true : false, secondary_auth ? secondary_auth->valueint : 0, + uav_secondary_auth ? true : false, + uav_secondary_auth ? uav_secondary_auth->valueint : 0, dn_aaa_ip_address_allocation ? true : false, dn_aaa_ip_address_allocation ? dn_aaa_ip_address_allocation->valueint : 0, dn_aaa_address ? dn_aaa_address_local_nonprim : NULL, - iptv_acc_ctrl_info && !cJSON_IsNull(iptv_acc_ctrl_info) ? ogs_strdup(iptv_acc_ctrl_info->valuestring) : NULL + additional_dn_aaa_addresses ? additional_dn_aaa_addressesList : NULL, + dn_aaa_fqdn && !cJSON_IsNull(dn_aaa_fqdn) ? ogs_strdup(dn_aaa_fqdn->valuestring) : NULL, + iptv_acc_ctrl_info && !cJSON_IsNull(iptv_acc_ctrl_info) ? ogs_strdup(iptv_acc_ctrl_info->valuestring) : NULL, + ipv4_index ? ipv4_index_local_nonprim : NULL, + ipv6_index ? ipv6_index_local_nonprim : NULL, + ecs_addr_config_info ? ecs_addr_config_info_local_nonprim : NULL, + additional_ecs_addr_config_infos ? additional_ecs_addr_config_infosList : NULL, + shared_ecs_addr_config_info && !cJSON_IsNull(shared_ecs_addr_config_info) ? ogs_strdup(shared_ecs_addr_config_info->valuestring) : NULL, + additional_shared_ecs_addr_config_info_ids ? additional_shared_ecs_addr_config_info_idsList : NULL, + eas_discovery_authorized ? true : false, + eas_discovery_authorized ? eas_discovery_authorized->valueint : 0, + onboarding_ind ? true : false, + onboarding_ind ? onboarding_ind->valueint : 0, + aerial_ue_ind ? aerial_ue_indVariable : 0, + subscribed_max_ipv6_prefix_size ? true : false, + subscribed_max_ipv6_prefix_size ? subscribed_max_ipv6_prefix_size->valuedouble : 0 ); return dnn_configuration_local_var; @@ -684,6 +1073,39 @@ end: OpenAPI_ip_address_free(dn_aaa_address_local_nonprim); dn_aaa_address_local_nonprim = NULL; } + if (additional_dn_aaa_addressesList) { + OpenAPI_list_for_each(additional_dn_aaa_addressesList, node) { + OpenAPI_ip_address_free(node->data); + } + OpenAPI_list_free(additional_dn_aaa_addressesList); + additional_dn_aaa_addressesList = NULL; + } + if (ipv4_index_local_nonprim) { + OpenAPI_ip_index_free(ipv4_index_local_nonprim); + ipv4_index_local_nonprim = NULL; + } + if (ipv6_index_local_nonprim) { + OpenAPI_ip_index_free(ipv6_index_local_nonprim); + ipv6_index_local_nonprim = NULL; + } + if (ecs_addr_config_info_local_nonprim) { + OpenAPI_ecs_addr_config_info_free(ecs_addr_config_info_local_nonprim); + ecs_addr_config_info_local_nonprim = NULL; + } + if (additional_ecs_addr_config_infosList) { + OpenAPI_list_for_each(additional_ecs_addr_config_infosList, node) { + OpenAPI_ecs_addr_config_info_free(node->data); + } + OpenAPI_list_free(additional_ecs_addr_config_infosList); + additional_ecs_addr_config_infosList = NULL; + } + if (additional_shared_ecs_addr_config_info_idsList) { + OpenAPI_list_for_each(additional_shared_ecs_addr_config_info_idsList, node) { + ogs_free(node->data); + } + OpenAPI_list_free(additional_shared_ecs_addr_config_info_idsList); + additional_shared_ecs_addr_config_info_idsList = NULL; + } return NULL; } diff --git a/lib/sbi/openapi/model/dnn_configuration.h b/lib/sbi/openapi/model/dnn_configuration.h index d27e9aae4..c42b3659b 100644 --- a/lib/sbi/openapi/model/dnn_configuration.h +++ b/lib/sbi/openapi/model/dnn_configuration.h @@ -13,9 +13,12 @@ #include "../include/keyValuePair.h" #include "../include/binary.h" #include "acs_info.h" +#include "aerial_ue_indication.h" #include "ambr.h" +#include "ecs_addr_config_info.h" #include "frame_route_info.h" #include "ip_address.h" +#include "ip_index.h" #include "nidd_information.h" #include "pdu_session_continuity_ind.h" #include "pdu_session_types.h" @@ -50,10 +53,27 @@ typedef struct OpenAPI_dnn_configuration_s { int atsss_allowed; bool is_secondary_auth; int secondary_auth; + bool is_uav_secondary_auth; + int uav_secondary_auth; bool is_dn_aaa_ip_address_allocation; int dn_aaa_ip_address_allocation; struct OpenAPI_ip_address_s *dn_aaa_address; + OpenAPI_list_t *additional_dn_aaa_addresses; + char *dn_aaa_fqdn; char *iptv_acc_ctrl_info; + struct OpenAPI_ip_index_s *ipv4_index; + struct OpenAPI_ip_index_s *ipv6_index; + struct OpenAPI_ecs_addr_config_info_s *ecs_addr_config_info; + OpenAPI_list_t *additional_ecs_addr_config_infos; + char *shared_ecs_addr_config_info; + OpenAPI_list_t *additional_shared_ecs_addr_config_info_ids; + bool is_eas_discovery_authorized; + int eas_discovery_authorized; + bool is_onboarding_ind; + int onboarding_ind; + OpenAPI_aerial_ue_indication_e aerial_ue_ind; + bool is_subscribed_max_ipv6_prefix_size; + int subscribed_max_ipv6_prefix_size; } OpenAPI_dnn_configuration_t; OpenAPI_dnn_configuration_t *OpenAPI_dnn_configuration_create( @@ -78,10 +98,27 @@ OpenAPI_dnn_configuration_t *OpenAPI_dnn_configuration_create( int atsss_allowed, bool is_secondary_auth, int secondary_auth, + bool is_uav_secondary_auth, + int uav_secondary_auth, bool is_dn_aaa_ip_address_allocation, int dn_aaa_ip_address_allocation, OpenAPI_ip_address_t *dn_aaa_address, - char *iptv_acc_ctrl_info + OpenAPI_list_t *additional_dn_aaa_addresses, + char *dn_aaa_fqdn, + char *iptv_acc_ctrl_info, + OpenAPI_ip_index_t *ipv4_index, + OpenAPI_ip_index_t *ipv6_index, + OpenAPI_ecs_addr_config_info_t *ecs_addr_config_info, + OpenAPI_list_t *additional_ecs_addr_config_infos, + char *shared_ecs_addr_config_info, + OpenAPI_list_t *additional_shared_ecs_addr_config_info_ids, + bool is_eas_discovery_authorized, + int eas_discovery_authorized, + bool is_onboarding_ind, + int onboarding_ind, + OpenAPI_aerial_ue_indication_e aerial_ue_ind, + bool is_subscribed_max_ipv6_prefix_size, + int subscribed_max_ipv6_prefix_size ); void OpenAPI_dnn_configuration_free(OpenAPI_dnn_configuration_t *dnn_configuration); OpenAPI_dnn_configuration_t *OpenAPI_dnn_configuration_parseFromJSON(cJSON *dnn_configurationJSON); diff --git a/lib/sbi/openapi/model/dnn_configuration_1.c b/lib/sbi/openapi/model/dnn_configuration_1.c index 0aa7f83fd..999437984 100644 --- a/lib/sbi/openapi/model/dnn_configuration_1.c +++ b/lib/sbi/openapi/model/dnn_configuration_1.c @@ -26,10 +26,27 @@ OpenAPI_dnn_configuration_1_t *OpenAPI_dnn_configuration_1_create( int atsss_allowed, bool is_secondary_auth, int secondary_auth, + bool is_uav_secondary_auth, + int uav_secondary_auth, bool is_dn_aaa_ip_address_allocation, int dn_aaa_ip_address_allocation, OpenAPI_ip_address_1_t *dn_aaa_address, - char *iptv_acc_ctrl_info + OpenAPI_list_t *additional_dn_aaa_addresses, + char *dn_aaa_fqdn, + char *iptv_acc_ctrl_info, + OpenAPI_ip_index_t *ipv4_index, + OpenAPI_ip_index_t *ipv6_index, + OpenAPI_ecs_addr_config_info_1_t *ecs_addr_config_info, + OpenAPI_list_t *additional_ecs_addr_config_infos, + char *shared_ecs_addr_config_info, + OpenAPI_list_t *additional_shared_ecs_addr_config_info_ids, + bool is_eas_discovery_authorized, + int eas_discovery_authorized, + bool is_onboarding_ind, + int onboarding_ind, + OpenAPI_aerial_ue_indication_e aerial_ue_ind, + bool is_subscribed_max_ipv6_prefix_size, + int subscribed_max_ipv6_prefix_size ) { OpenAPI_dnn_configuration_1_t *dnn_configuration_1_local_var = ogs_malloc(sizeof(OpenAPI_dnn_configuration_1_t)); @@ -56,10 +73,27 @@ OpenAPI_dnn_configuration_1_t *OpenAPI_dnn_configuration_1_create( dnn_configuration_1_local_var->atsss_allowed = atsss_allowed; dnn_configuration_1_local_var->is_secondary_auth = is_secondary_auth; dnn_configuration_1_local_var->secondary_auth = secondary_auth; + dnn_configuration_1_local_var->is_uav_secondary_auth = is_uav_secondary_auth; + dnn_configuration_1_local_var->uav_secondary_auth = uav_secondary_auth; dnn_configuration_1_local_var->is_dn_aaa_ip_address_allocation = is_dn_aaa_ip_address_allocation; dnn_configuration_1_local_var->dn_aaa_ip_address_allocation = dn_aaa_ip_address_allocation; dnn_configuration_1_local_var->dn_aaa_address = dn_aaa_address; + dnn_configuration_1_local_var->additional_dn_aaa_addresses = additional_dn_aaa_addresses; + dnn_configuration_1_local_var->dn_aaa_fqdn = dn_aaa_fqdn; dnn_configuration_1_local_var->iptv_acc_ctrl_info = iptv_acc_ctrl_info; + dnn_configuration_1_local_var->ipv4_index = ipv4_index; + dnn_configuration_1_local_var->ipv6_index = ipv6_index; + dnn_configuration_1_local_var->ecs_addr_config_info = ecs_addr_config_info; + dnn_configuration_1_local_var->additional_ecs_addr_config_infos = additional_ecs_addr_config_infos; + dnn_configuration_1_local_var->shared_ecs_addr_config_info = shared_ecs_addr_config_info; + dnn_configuration_1_local_var->additional_shared_ecs_addr_config_info_ids = additional_shared_ecs_addr_config_info_ids; + dnn_configuration_1_local_var->is_eas_discovery_authorized = is_eas_discovery_authorized; + dnn_configuration_1_local_var->eas_discovery_authorized = eas_discovery_authorized; + dnn_configuration_1_local_var->is_onboarding_ind = is_onboarding_ind; + dnn_configuration_1_local_var->onboarding_ind = onboarding_ind; + dnn_configuration_1_local_var->aerial_ue_ind = aerial_ue_ind; + dnn_configuration_1_local_var->is_subscribed_max_ipv6_prefix_size = is_subscribed_max_ipv6_prefix_size; + dnn_configuration_1_local_var->subscribed_max_ipv6_prefix_size = subscribed_max_ipv6_prefix_size; return dnn_configuration_1_local_var; } @@ -132,10 +166,51 @@ void OpenAPI_dnn_configuration_1_free(OpenAPI_dnn_configuration_1_t *dnn_configu OpenAPI_ip_address_1_free(dnn_configuration_1->dn_aaa_address); dnn_configuration_1->dn_aaa_address = NULL; } + if (dnn_configuration_1->additional_dn_aaa_addresses) { + OpenAPI_list_for_each(dnn_configuration_1->additional_dn_aaa_addresses, node) { + OpenAPI_ip_address_1_free(node->data); + } + OpenAPI_list_free(dnn_configuration_1->additional_dn_aaa_addresses); + dnn_configuration_1->additional_dn_aaa_addresses = NULL; + } + if (dnn_configuration_1->dn_aaa_fqdn) { + ogs_free(dnn_configuration_1->dn_aaa_fqdn); + dnn_configuration_1->dn_aaa_fqdn = NULL; + } if (dnn_configuration_1->iptv_acc_ctrl_info) { ogs_free(dnn_configuration_1->iptv_acc_ctrl_info); dnn_configuration_1->iptv_acc_ctrl_info = NULL; } + if (dnn_configuration_1->ipv4_index) { + OpenAPI_ip_index_free(dnn_configuration_1->ipv4_index); + dnn_configuration_1->ipv4_index = NULL; + } + if (dnn_configuration_1->ipv6_index) { + OpenAPI_ip_index_free(dnn_configuration_1->ipv6_index); + dnn_configuration_1->ipv6_index = NULL; + } + if (dnn_configuration_1->ecs_addr_config_info) { + OpenAPI_ecs_addr_config_info_1_free(dnn_configuration_1->ecs_addr_config_info); + dnn_configuration_1->ecs_addr_config_info = NULL; + } + if (dnn_configuration_1->additional_ecs_addr_config_infos) { + OpenAPI_list_for_each(dnn_configuration_1->additional_ecs_addr_config_infos, node) { + OpenAPI_ecs_addr_config_info_1_free(node->data); + } + OpenAPI_list_free(dnn_configuration_1->additional_ecs_addr_config_infos); + dnn_configuration_1->additional_ecs_addr_config_infos = NULL; + } + if (dnn_configuration_1->shared_ecs_addr_config_info) { + ogs_free(dnn_configuration_1->shared_ecs_addr_config_info); + dnn_configuration_1->shared_ecs_addr_config_info = NULL; + } + if (dnn_configuration_1->additional_shared_ecs_addr_config_info_ids) { + OpenAPI_list_for_each(dnn_configuration_1->additional_shared_ecs_addr_config_info_ids, node) { + ogs_free(node->data); + } + OpenAPI_list_free(dnn_configuration_1->additional_shared_ecs_addr_config_info_ids); + dnn_configuration_1->additional_shared_ecs_addr_config_info_ids = NULL; + } ogs_free(dnn_configuration_1); } @@ -342,6 +417,13 @@ cJSON *OpenAPI_dnn_configuration_1_convertToJSON(OpenAPI_dnn_configuration_1_t * } } + if (dnn_configuration_1->is_uav_secondary_auth) { + if (cJSON_AddBoolToObject(item, "uavSecondaryAuth", dnn_configuration_1->uav_secondary_auth) == NULL) { + ogs_error("OpenAPI_dnn_configuration_1_convertToJSON() failed [uav_secondary_auth]"); + goto end; + } + } + if (dnn_configuration_1->is_dn_aaa_ip_address_allocation) { if (cJSON_AddBoolToObject(item, "dnAaaIpAddressAllocation", dnn_configuration_1->dn_aaa_ip_address_allocation) == NULL) { ogs_error("OpenAPI_dnn_configuration_1_convertToJSON() failed [dn_aaa_ip_address_allocation]"); @@ -362,6 +444,29 @@ cJSON *OpenAPI_dnn_configuration_1_convertToJSON(OpenAPI_dnn_configuration_1_t * } } + if (dnn_configuration_1->additional_dn_aaa_addresses) { + cJSON *additional_dn_aaa_addressesList = cJSON_AddArrayToObject(item, "additionalDnAaaAddresses"); + if (additional_dn_aaa_addressesList == NULL) { + ogs_error("OpenAPI_dnn_configuration_1_convertToJSON() failed [additional_dn_aaa_addresses]"); + goto end; + } + OpenAPI_list_for_each(dnn_configuration_1->additional_dn_aaa_addresses, node) { + cJSON *itemLocal = OpenAPI_ip_address_1_convertToJSON(node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_dnn_configuration_1_convertToJSON() failed [additional_dn_aaa_addresses]"); + goto end; + } + cJSON_AddItemToArray(additional_dn_aaa_addressesList, itemLocal); + } + } + + if (dnn_configuration_1->dn_aaa_fqdn) { + if (cJSON_AddStringToObject(item, "dnAaaFqdn", dnn_configuration_1->dn_aaa_fqdn) == NULL) { + ogs_error("OpenAPI_dnn_configuration_1_convertToJSON() failed [dn_aaa_fqdn]"); + goto end; + } + } + if (dnn_configuration_1->iptv_acc_ctrl_info) { if (cJSON_AddStringToObject(item, "iptvAccCtrlInfo", dnn_configuration_1->iptv_acc_ctrl_info) == NULL) { ogs_error("OpenAPI_dnn_configuration_1_convertToJSON() failed [iptv_acc_ctrl_info]"); @@ -369,6 +474,110 @@ cJSON *OpenAPI_dnn_configuration_1_convertToJSON(OpenAPI_dnn_configuration_1_t * } } + if (dnn_configuration_1->ipv4_index) { + cJSON *ipv4_index_local_JSON = OpenAPI_ip_index_convertToJSON(dnn_configuration_1->ipv4_index); + if (ipv4_index_local_JSON == NULL) { + ogs_error("OpenAPI_dnn_configuration_1_convertToJSON() failed [ipv4_index]"); + goto end; + } + cJSON_AddItemToObject(item, "ipv4Index", ipv4_index_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_dnn_configuration_1_convertToJSON() failed [ipv4_index]"); + goto end; + } + } + + if (dnn_configuration_1->ipv6_index) { + cJSON *ipv6_index_local_JSON = OpenAPI_ip_index_convertToJSON(dnn_configuration_1->ipv6_index); + if (ipv6_index_local_JSON == NULL) { + ogs_error("OpenAPI_dnn_configuration_1_convertToJSON() failed [ipv6_index]"); + goto end; + } + cJSON_AddItemToObject(item, "ipv6Index", ipv6_index_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_dnn_configuration_1_convertToJSON() failed [ipv6_index]"); + goto end; + } + } + + if (dnn_configuration_1->ecs_addr_config_info) { + cJSON *ecs_addr_config_info_local_JSON = OpenAPI_ecs_addr_config_info_1_convertToJSON(dnn_configuration_1->ecs_addr_config_info); + if (ecs_addr_config_info_local_JSON == NULL) { + ogs_error("OpenAPI_dnn_configuration_1_convertToJSON() failed [ecs_addr_config_info]"); + goto end; + } + cJSON_AddItemToObject(item, "ecsAddrConfigInfo", ecs_addr_config_info_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_dnn_configuration_1_convertToJSON() failed [ecs_addr_config_info]"); + goto end; + } + } + + if (dnn_configuration_1->additional_ecs_addr_config_infos) { + cJSON *additional_ecs_addr_config_infosList = cJSON_AddArrayToObject(item, "additionalEcsAddrConfigInfos"); + if (additional_ecs_addr_config_infosList == NULL) { + ogs_error("OpenAPI_dnn_configuration_1_convertToJSON() failed [additional_ecs_addr_config_infos]"); + goto end; + } + OpenAPI_list_for_each(dnn_configuration_1->additional_ecs_addr_config_infos, node) { + cJSON *itemLocal = OpenAPI_ecs_addr_config_info_1_convertToJSON(node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_dnn_configuration_1_convertToJSON() failed [additional_ecs_addr_config_infos]"); + goto end; + } + cJSON_AddItemToArray(additional_ecs_addr_config_infosList, itemLocal); + } + } + + if (dnn_configuration_1->shared_ecs_addr_config_info) { + if (cJSON_AddStringToObject(item, "sharedEcsAddrConfigInfo", dnn_configuration_1->shared_ecs_addr_config_info) == NULL) { + ogs_error("OpenAPI_dnn_configuration_1_convertToJSON() failed [shared_ecs_addr_config_info]"); + goto end; + } + } + + if (dnn_configuration_1->additional_shared_ecs_addr_config_info_ids) { + cJSON *additional_shared_ecs_addr_config_info_idsList = cJSON_AddArrayToObject(item, "additionalSharedEcsAddrConfigInfoIds"); + if (additional_shared_ecs_addr_config_info_idsList == NULL) { + ogs_error("OpenAPI_dnn_configuration_1_convertToJSON() failed [additional_shared_ecs_addr_config_info_ids]"); + goto end; + } + OpenAPI_list_for_each(dnn_configuration_1->additional_shared_ecs_addr_config_info_ids, node) { + if (cJSON_AddStringToObject(additional_shared_ecs_addr_config_info_idsList, "", (char*)node->data) == NULL) { + ogs_error("OpenAPI_dnn_configuration_1_convertToJSON() failed [additional_shared_ecs_addr_config_info_ids]"); + goto end; + } + } + } + + if (dnn_configuration_1->is_eas_discovery_authorized) { + if (cJSON_AddBoolToObject(item, "easDiscoveryAuthorized", dnn_configuration_1->eas_discovery_authorized) == NULL) { + ogs_error("OpenAPI_dnn_configuration_1_convertToJSON() failed [eas_discovery_authorized]"); + goto end; + } + } + + if (dnn_configuration_1->is_onboarding_ind) { + if (cJSON_AddBoolToObject(item, "onboardingInd", dnn_configuration_1->onboarding_ind) == NULL) { + ogs_error("OpenAPI_dnn_configuration_1_convertToJSON() failed [onboarding_ind]"); + goto end; + } + } + + if (dnn_configuration_1->aerial_ue_ind != OpenAPI_aerial_ue_indication_NULL) { + if (cJSON_AddStringToObject(item, "aerialUeInd", OpenAPI_aerial_ue_indication_ToString(dnn_configuration_1->aerial_ue_ind)) == NULL) { + ogs_error("OpenAPI_dnn_configuration_1_convertToJSON() failed [aerial_ue_ind]"); + goto end; + } + } + + if (dnn_configuration_1->is_subscribed_max_ipv6_prefix_size) { + if (cJSON_AddNumberToObject(item, "subscribedMaxIpv6PrefixSize", dnn_configuration_1->subscribed_max_ipv6_prefix_size) == NULL) { + ogs_error("OpenAPI_dnn_configuration_1_convertToJSON() failed [subscribed_max_ipv6_prefix_size]"); + goto end; + } + } + end: return item; } @@ -405,10 +614,30 @@ OpenAPI_dnn_configuration_1_t *OpenAPI_dnn_configuration_1_parseFromJSON(cJSON * OpenAPI_list_t *ipv6_frame_route_listList = NULL; cJSON *atsss_allowed = NULL; cJSON *secondary_auth = NULL; + cJSON *uav_secondary_auth = NULL; cJSON *dn_aaa_ip_address_allocation = NULL; cJSON *dn_aaa_address = NULL; OpenAPI_ip_address_1_t *dn_aaa_address_local_nonprim = NULL; + cJSON *additional_dn_aaa_addresses = NULL; + OpenAPI_list_t *additional_dn_aaa_addressesList = NULL; + cJSON *dn_aaa_fqdn = NULL; cJSON *iptv_acc_ctrl_info = NULL; + cJSON *ipv4_index = NULL; + OpenAPI_ip_index_t *ipv4_index_local_nonprim = NULL; + cJSON *ipv6_index = NULL; + OpenAPI_ip_index_t *ipv6_index_local_nonprim = NULL; + cJSON *ecs_addr_config_info = NULL; + OpenAPI_ecs_addr_config_info_1_t *ecs_addr_config_info_local_nonprim = NULL; + cJSON *additional_ecs_addr_config_infos = NULL; + OpenAPI_list_t *additional_ecs_addr_config_infosList = NULL; + cJSON *shared_ecs_addr_config_info = NULL; + cJSON *additional_shared_ecs_addr_config_info_ids = NULL; + OpenAPI_list_t *additional_shared_ecs_addr_config_info_idsList = NULL; + cJSON *eas_discovery_authorized = NULL; + cJSON *onboarding_ind = NULL; + cJSON *aerial_ue_ind = NULL; + OpenAPI_aerial_ue_indication_e aerial_ue_indVariable = 0; + cJSON *subscribed_max_ipv6_prefix_size = NULL; pdu_session_types = cJSON_GetObjectItemCaseSensitive(dnn_configuration_1JSON, "pduSessionTypes"); if (!pdu_session_types) { ogs_error("OpenAPI_dnn_configuration_1_parseFromJSON() failed [pdu_session_types]"); @@ -580,6 +809,14 @@ OpenAPI_dnn_configuration_1_t *OpenAPI_dnn_configuration_1_parseFromJSON(cJSON * } } + uav_secondary_auth = cJSON_GetObjectItemCaseSensitive(dnn_configuration_1JSON, "uavSecondaryAuth"); + if (uav_secondary_auth) { + if (!cJSON_IsBool(uav_secondary_auth)) { + ogs_error("OpenAPI_dnn_configuration_1_parseFromJSON() failed [uav_secondary_auth]"); + goto end; + } + } + dn_aaa_ip_address_allocation = cJSON_GetObjectItemCaseSensitive(dnn_configuration_1JSON, "dnAaaIpAddressAllocation"); if (dn_aaa_ip_address_allocation) { if (!cJSON_IsBool(dn_aaa_ip_address_allocation)) { @@ -593,6 +830,39 @@ OpenAPI_dnn_configuration_1_t *OpenAPI_dnn_configuration_1_parseFromJSON(cJSON * dn_aaa_address_local_nonprim = OpenAPI_ip_address_1_parseFromJSON(dn_aaa_address); } + additional_dn_aaa_addresses = cJSON_GetObjectItemCaseSensitive(dnn_configuration_1JSON, "additionalDnAaaAddresses"); + if (additional_dn_aaa_addresses) { + cJSON *additional_dn_aaa_addresses_local = NULL; + if (!cJSON_IsArray(additional_dn_aaa_addresses)) { + ogs_error("OpenAPI_dnn_configuration_1_parseFromJSON() failed [additional_dn_aaa_addresses]"); + goto end; + } + + additional_dn_aaa_addressesList = OpenAPI_list_create(); + + cJSON_ArrayForEach(additional_dn_aaa_addresses_local, additional_dn_aaa_addresses) { + if (!cJSON_IsObject(additional_dn_aaa_addresses_local)) { + ogs_error("OpenAPI_dnn_configuration_1_parseFromJSON() failed [additional_dn_aaa_addresses]"); + goto end; + } + OpenAPI_ip_address_1_t *additional_dn_aaa_addressesItem = OpenAPI_ip_address_1_parseFromJSON(additional_dn_aaa_addresses_local); + if (!additional_dn_aaa_addressesItem) { + ogs_error("No additional_dn_aaa_addressesItem"); + OpenAPI_list_free(additional_dn_aaa_addressesList); + goto end; + } + OpenAPI_list_add(additional_dn_aaa_addressesList, additional_dn_aaa_addressesItem); + } + } + + dn_aaa_fqdn = cJSON_GetObjectItemCaseSensitive(dnn_configuration_1JSON, "dnAaaFqdn"); + if (dn_aaa_fqdn) { + if (!cJSON_IsString(dn_aaa_fqdn) && !cJSON_IsNull(dn_aaa_fqdn)) { + ogs_error("OpenAPI_dnn_configuration_1_parseFromJSON() failed [dn_aaa_fqdn]"); + goto end; + } + } + iptv_acc_ctrl_info = cJSON_GetObjectItemCaseSensitive(dnn_configuration_1JSON, "iptvAccCtrlInfo"); if (iptv_acc_ctrl_info) { if (!cJSON_IsString(iptv_acc_ctrl_info) && !cJSON_IsNull(iptv_acc_ctrl_info)) { @@ -601,6 +871,108 @@ OpenAPI_dnn_configuration_1_t *OpenAPI_dnn_configuration_1_parseFromJSON(cJSON * } } + ipv4_index = cJSON_GetObjectItemCaseSensitive(dnn_configuration_1JSON, "ipv4Index"); + if (ipv4_index) { + ipv4_index_local_nonprim = OpenAPI_ip_index_parseFromJSON(ipv4_index); + } + + ipv6_index = cJSON_GetObjectItemCaseSensitive(dnn_configuration_1JSON, "ipv6Index"); + if (ipv6_index) { + ipv6_index_local_nonprim = OpenAPI_ip_index_parseFromJSON(ipv6_index); + } + + ecs_addr_config_info = cJSON_GetObjectItemCaseSensitive(dnn_configuration_1JSON, "ecsAddrConfigInfo"); + if (ecs_addr_config_info) { + ecs_addr_config_info_local_nonprim = OpenAPI_ecs_addr_config_info_1_parseFromJSON(ecs_addr_config_info); + } + + additional_ecs_addr_config_infos = cJSON_GetObjectItemCaseSensitive(dnn_configuration_1JSON, "additionalEcsAddrConfigInfos"); + if (additional_ecs_addr_config_infos) { + cJSON *additional_ecs_addr_config_infos_local = NULL; + if (!cJSON_IsArray(additional_ecs_addr_config_infos)) { + ogs_error("OpenAPI_dnn_configuration_1_parseFromJSON() failed [additional_ecs_addr_config_infos]"); + goto end; + } + + additional_ecs_addr_config_infosList = OpenAPI_list_create(); + + cJSON_ArrayForEach(additional_ecs_addr_config_infos_local, additional_ecs_addr_config_infos) { + if (!cJSON_IsObject(additional_ecs_addr_config_infos_local)) { + ogs_error("OpenAPI_dnn_configuration_1_parseFromJSON() failed [additional_ecs_addr_config_infos]"); + goto end; + } + OpenAPI_ecs_addr_config_info_1_t *additional_ecs_addr_config_infosItem = OpenAPI_ecs_addr_config_info_1_parseFromJSON(additional_ecs_addr_config_infos_local); + if (!additional_ecs_addr_config_infosItem) { + ogs_error("No additional_ecs_addr_config_infosItem"); + OpenAPI_list_free(additional_ecs_addr_config_infosList); + goto end; + } + OpenAPI_list_add(additional_ecs_addr_config_infosList, additional_ecs_addr_config_infosItem); + } + } + + shared_ecs_addr_config_info = cJSON_GetObjectItemCaseSensitive(dnn_configuration_1JSON, "sharedEcsAddrConfigInfo"); + if (shared_ecs_addr_config_info) { + if (!cJSON_IsString(shared_ecs_addr_config_info) && !cJSON_IsNull(shared_ecs_addr_config_info)) { + ogs_error("OpenAPI_dnn_configuration_1_parseFromJSON() failed [shared_ecs_addr_config_info]"); + goto end; + } + } + + additional_shared_ecs_addr_config_info_ids = cJSON_GetObjectItemCaseSensitive(dnn_configuration_1JSON, "additionalSharedEcsAddrConfigInfoIds"); + if (additional_shared_ecs_addr_config_info_ids) { + cJSON *additional_shared_ecs_addr_config_info_ids_local = NULL; + if (!cJSON_IsArray(additional_shared_ecs_addr_config_info_ids)) { + ogs_error("OpenAPI_dnn_configuration_1_parseFromJSON() failed [additional_shared_ecs_addr_config_info_ids]"); + goto end; + } + + additional_shared_ecs_addr_config_info_idsList = OpenAPI_list_create(); + + cJSON_ArrayForEach(additional_shared_ecs_addr_config_info_ids_local, additional_shared_ecs_addr_config_info_ids) { + double *localDouble = NULL; + int *localInt = NULL; + if (!cJSON_IsString(additional_shared_ecs_addr_config_info_ids_local)) { + ogs_error("OpenAPI_dnn_configuration_1_parseFromJSON() failed [additional_shared_ecs_addr_config_info_ids]"); + goto end; + } + OpenAPI_list_add(additional_shared_ecs_addr_config_info_idsList, ogs_strdup(additional_shared_ecs_addr_config_info_ids_local->valuestring)); + } + } + + eas_discovery_authorized = cJSON_GetObjectItemCaseSensitive(dnn_configuration_1JSON, "easDiscoveryAuthorized"); + if (eas_discovery_authorized) { + if (!cJSON_IsBool(eas_discovery_authorized)) { + ogs_error("OpenAPI_dnn_configuration_1_parseFromJSON() failed [eas_discovery_authorized]"); + goto end; + } + } + + onboarding_ind = cJSON_GetObjectItemCaseSensitive(dnn_configuration_1JSON, "onboardingInd"); + if (onboarding_ind) { + if (!cJSON_IsBool(onboarding_ind)) { + ogs_error("OpenAPI_dnn_configuration_1_parseFromJSON() failed [onboarding_ind]"); + goto end; + } + } + + aerial_ue_ind = cJSON_GetObjectItemCaseSensitive(dnn_configuration_1JSON, "aerialUeInd"); + if (aerial_ue_ind) { + if (!cJSON_IsString(aerial_ue_ind)) { + ogs_error("OpenAPI_dnn_configuration_1_parseFromJSON() failed [aerial_ue_ind]"); + goto end; + } + aerial_ue_indVariable = OpenAPI_aerial_ue_indication_FromString(aerial_ue_ind->valuestring); + } + + subscribed_max_ipv6_prefix_size = cJSON_GetObjectItemCaseSensitive(dnn_configuration_1JSON, "subscribedMaxIpv6PrefixSize"); + if (subscribed_max_ipv6_prefix_size) { + if (!cJSON_IsNumber(subscribed_max_ipv6_prefix_size)) { + ogs_error("OpenAPI_dnn_configuration_1_parseFromJSON() failed [subscribed_max_ipv6_prefix_size]"); + goto end; + } + } + dnn_configuration_1_local_var = OpenAPI_dnn_configuration_1_create ( pdu_session_types_local_nonprim, ssc_modes_local_nonprim, @@ -623,10 +995,27 @@ OpenAPI_dnn_configuration_1_t *OpenAPI_dnn_configuration_1_parseFromJSON(cJSON * atsss_allowed ? atsss_allowed->valueint : 0, secondary_auth ? true : false, secondary_auth ? secondary_auth->valueint : 0, + uav_secondary_auth ? true : false, + uav_secondary_auth ? uav_secondary_auth->valueint : 0, dn_aaa_ip_address_allocation ? true : false, dn_aaa_ip_address_allocation ? dn_aaa_ip_address_allocation->valueint : 0, dn_aaa_address ? dn_aaa_address_local_nonprim : NULL, - iptv_acc_ctrl_info && !cJSON_IsNull(iptv_acc_ctrl_info) ? ogs_strdup(iptv_acc_ctrl_info->valuestring) : NULL + additional_dn_aaa_addresses ? additional_dn_aaa_addressesList : NULL, + dn_aaa_fqdn && !cJSON_IsNull(dn_aaa_fqdn) ? ogs_strdup(dn_aaa_fqdn->valuestring) : NULL, + iptv_acc_ctrl_info && !cJSON_IsNull(iptv_acc_ctrl_info) ? ogs_strdup(iptv_acc_ctrl_info->valuestring) : NULL, + ipv4_index ? ipv4_index_local_nonprim : NULL, + ipv6_index ? ipv6_index_local_nonprim : NULL, + ecs_addr_config_info ? ecs_addr_config_info_local_nonprim : NULL, + additional_ecs_addr_config_infos ? additional_ecs_addr_config_infosList : NULL, + shared_ecs_addr_config_info && !cJSON_IsNull(shared_ecs_addr_config_info) ? ogs_strdup(shared_ecs_addr_config_info->valuestring) : NULL, + additional_shared_ecs_addr_config_info_ids ? additional_shared_ecs_addr_config_info_idsList : NULL, + eas_discovery_authorized ? true : false, + eas_discovery_authorized ? eas_discovery_authorized->valueint : 0, + onboarding_ind ? true : false, + onboarding_ind ? onboarding_ind->valueint : 0, + aerial_ue_ind ? aerial_ue_indVariable : 0, + subscribed_max_ipv6_prefix_size ? true : false, + subscribed_max_ipv6_prefix_size ? subscribed_max_ipv6_prefix_size->valuedouble : 0 ); return dnn_configuration_1_local_var; @@ -684,6 +1073,39 @@ end: OpenAPI_ip_address_1_free(dn_aaa_address_local_nonprim); dn_aaa_address_local_nonprim = NULL; } + if (additional_dn_aaa_addressesList) { + OpenAPI_list_for_each(additional_dn_aaa_addressesList, node) { + OpenAPI_ip_address_1_free(node->data); + } + OpenAPI_list_free(additional_dn_aaa_addressesList); + additional_dn_aaa_addressesList = NULL; + } + if (ipv4_index_local_nonprim) { + OpenAPI_ip_index_free(ipv4_index_local_nonprim); + ipv4_index_local_nonprim = NULL; + } + if (ipv6_index_local_nonprim) { + OpenAPI_ip_index_free(ipv6_index_local_nonprim); + ipv6_index_local_nonprim = NULL; + } + if (ecs_addr_config_info_local_nonprim) { + OpenAPI_ecs_addr_config_info_1_free(ecs_addr_config_info_local_nonprim); + ecs_addr_config_info_local_nonprim = NULL; + } + if (additional_ecs_addr_config_infosList) { + OpenAPI_list_for_each(additional_ecs_addr_config_infosList, node) { + OpenAPI_ecs_addr_config_info_1_free(node->data); + } + OpenAPI_list_free(additional_ecs_addr_config_infosList); + additional_ecs_addr_config_infosList = NULL; + } + if (additional_shared_ecs_addr_config_info_idsList) { + OpenAPI_list_for_each(additional_shared_ecs_addr_config_info_idsList, node) { + ogs_free(node->data); + } + OpenAPI_list_free(additional_shared_ecs_addr_config_info_idsList); + additional_shared_ecs_addr_config_info_idsList = NULL; + } return NULL; } diff --git a/lib/sbi/openapi/model/dnn_configuration_1.h b/lib/sbi/openapi/model/dnn_configuration_1.h index 1a7315593..6725a9d78 100644 --- a/lib/sbi/openapi/model/dnn_configuration_1.h +++ b/lib/sbi/openapi/model/dnn_configuration_1.h @@ -13,9 +13,12 @@ #include "../include/keyValuePair.h" #include "../include/binary.h" #include "acs_info_1.h" +#include "aerial_ue_indication.h" #include "ambr_1.h" +#include "ecs_addr_config_info_1.h" #include "frame_route_info_1.h" #include "ip_address_1.h" +#include "ip_index.h" #include "nidd_information_1.h" #include "pdu_session_continuity_ind.h" #include "pdu_session_types_1.h" @@ -50,10 +53,27 @@ typedef struct OpenAPI_dnn_configuration_1_s { int atsss_allowed; bool is_secondary_auth; int secondary_auth; + bool is_uav_secondary_auth; + int uav_secondary_auth; bool is_dn_aaa_ip_address_allocation; int dn_aaa_ip_address_allocation; struct OpenAPI_ip_address_1_s *dn_aaa_address; + OpenAPI_list_t *additional_dn_aaa_addresses; + char *dn_aaa_fqdn; char *iptv_acc_ctrl_info; + struct OpenAPI_ip_index_s *ipv4_index; + struct OpenAPI_ip_index_s *ipv6_index; + struct OpenAPI_ecs_addr_config_info_1_s *ecs_addr_config_info; + OpenAPI_list_t *additional_ecs_addr_config_infos; + char *shared_ecs_addr_config_info; + OpenAPI_list_t *additional_shared_ecs_addr_config_info_ids; + bool is_eas_discovery_authorized; + int eas_discovery_authorized; + bool is_onboarding_ind; + int onboarding_ind; + OpenAPI_aerial_ue_indication_e aerial_ue_ind; + bool is_subscribed_max_ipv6_prefix_size; + int subscribed_max_ipv6_prefix_size; } OpenAPI_dnn_configuration_1_t; OpenAPI_dnn_configuration_1_t *OpenAPI_dnn_configuration_1_create( @@ -78,10 +98,27 @@ OpenAPI_dnn_configuration_1_t *OpenAPI_dnn_configuration_1_create( int atsss_allowed, bool is_secondary_auth, int secondary_auth, + bool is_uav_secondary_auth, + int uav_secondary_auth, bool is_dn_aaa_ip_address_allocation, int dn_aaa_ip_address_allocation, OpenAPI_ip_address_1_t *dn_aaa_address, - char *iptv_acc_ctrl_info + OpenAPI_list_t *additional_dn_aaa_addresses, + char *dn_aaa_fqdn, + char *iptv_acc_ctrl_info, + OpenAPI_ip_index_t *ipv4_index, + OpenAPI_ip_index_t *ipv6_index, + OpenAPI_ecs_addr_config_info_1_t *ecs_addr_config_info, + OpenAPI_list_t *additional_ecs_addr_config_infos, + char *shared_ecs_addr_config_info, + OpenAPI_list_t *additional_shared_ecs_addr_config_info_ids, + bool is_eas_discovery_authorized, + int eas_discovery_authorized, + bool is_onboarding_ind, + int onboarding_ind, + OpenAPI_aerial_ue_indication_e aerial_ue_ind, + bool is_subscribed_max_ipv6_prefix_size, + int subscribed_max_ipv6_prefix_size ); void OpenAPI_dnn_configuration_1_free(OpenAPI_dnn_configuration_1_t *dnn_configuration_1); OpenAPI_dnn_configuration_1_t *OpenAPI_dnn_configuration_1_parseFromJSON(cJSON *dnn_configuration_1JSON); diff --git a/lib/sbi/openapi/model/dnn_easdf_info_item.c b/lib/sbi/openapi/model/dnn_easdf_info_item.c new file mode 100644 index 000000000..1d55ee882 --- /dev/null +++ b/lib/sbi/openapi/model/dnn_easdf_info_item.c @@ -0,0 +1,168 @@ + +#include +#include +#include +#include "dnn_easdf_info_item.h" + +OpenAPI_dnn_easdf_info_item_t *OpenAPI_dnn_easdf_info_item_create( + char *dnn, + OpenAPI_list_t *dnai_list +) +{ + OpenAPI_dnn_easdf_info_item_t *dnn_easdf_info_item_local_var = ogs_malloc(sizeof(OpenAPI_dnn_easdf_info_item_t)); + ogs_assert(dnn_easdf_info_item_local_var); + + dnn_easdf_info_item_local_var->dnn = dnn; + dnn_easdf_info_item_local_var->dnai_list = dnai_list; + + return dnn_easdf_info_item_local_var; +} + +void OpenAPI_dnn_easdf_info_item_free(OpenAPI_dnn_easdf_info_item_t *dnn_easdf_info_item) +{ + OpenAPI_lnode_t *node = NULL; + + if (NULL == dnn_easdf_info_item) { + return; + } + if (dnn_easdf_info_item->dnn) { + ogs_free(dnn_easdf_info_item->dnn); + dnn_easdf_info_item->dnn = NULL; + } + if (dnn_easdf_info_item->dnai_list) { + OpenAPI_list_for_each(dnn_easdf_info_item->dnai_list, node) { + ogs_free(node->data); + } + OpenAPI_list_free(dnn_easdf_info_item->dnai_list); + dnn_easdf_info_item->dnai_list = NULL; + } + ogs_free(dnn_easdf_info_item); +} + +cJSON *OpenAPI_dnn_easdf_info_item_convertToJSON(OpenAPI_dnn_easdf_info_item_t *dnn_easdf_info_item) +{ + cJSON *item = NULL; + OpenAPI_lnode_t *node = NULL; + + if (dnn_easdf_info_item == NULL) { + ogs_error("OpenAPI_dnn_easdf_info_item_convertToJSON() failed [DnnEasdfInfoItem]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (!dnn_easdf_info_item->dnn) { + ogs_error("OpenAPI_dnn_easdf_info_item_convertToJSON() failed [dnn]"); + return NULL; + } + if (cJSON_AddStringToObject(item, "dnn", dnn_easdf_info_item->dnn) == NULL) { + ogs_error("OpenAPI_dnn_easdf_info_item_convertToJSON() failed [dnn]"); + goto end; + } + + if (dnn_easdf_info_item->dnai_list) { + cJSON *dnai_listList = cJSON_AddArrayToObject(item, "dnaiList"); + if (dnai_listList == NULL) { + ogs_error("OpenAPI_dnn_easdf_info_item_convertToJSON() failed [dnai_list]"); + goto end; + } + OpenAPI_list_for_each(dnn_easdf_info_item->dnai_list, node) { + if (cJSON_AddStringToObject(dnai_listList, "", (char*)node->data) == NULL) { + ogs_error("OpenAPI_dnn_easdf_info_item_convertToJSON() failed [dnai_list]"); + goto end; + } + } + } + +end: + return item; +} + +OpenAPI_dnn_easdf_info_item_t *OpenAPI_dnn_easdf_info_item_parseFromJSON(cJSON *dnn_easdf_info_itemJSON) +{ + OpenAPI_dnn_easdf_info_item_t *dnn_easdf_info_item_local_var = NULL; + OpenAPI_lnode_t *node = NULL; + cJSON *dnn = NULL; + cJSON *dnai_list = NULL; + OpenAPI_list_t *dnai_listList = NULL; + dnn = cJSON_GetObjectItemCaseSensitive(dnn_easdf_info_itemJSON, "dnn"); + if (!dnn) { + ogs_error("OpenAPI_dnn_easdf_info_item_parseFromJSON() failed [dnn]"); + goto end; + } + if (!cJSON_IsString(dnn)) { + ogs_error("OpenAPI_dnn_easdf_info_item_parseFromJSON() failed [dnn]"); + goto end; + } + + dnai_list = cJSON_GetObjectItemCaseSensitive(dnn_easdf_info_itemJSON, "dnaiList"); + if (dnai_list) { + cJSON *dnai_list_local = NULL; + if (!cJSON_IsArray(dnai_list)) { + ogs_error("OpenAPI_dnn_easdf_info_item_parseFromJSON() failed [dnai_list]"); + goto end; + } + + dnai_listList = OpenAPI_list_create(); + + cJSON_ArrayForEach(dnai_list_local, dnai_list) { + double *localDouble = NULL; + int *localInt = NULL; + if (!cJSON_IsString(dnai_list_local)) { + ogs_error("OpenAPI_dnn_easdf_info_item_parseFromJSON() failed [dnai_list]"); + goto end; + } + OpenAPI_list_add(dnai_listList, ogs_strdup(dnai_list_local->valuestring)); + } + } + + dnn_easdf_info_item_local_var = OpenAPI_dnn_easdf_info_item_create ( + ogs_strdup(dnn->valuestring), + dnai_list ? dnai_listList : NULL + ); + + return dnn_easdf_info_item_local_var; +end: + if (dnai_listList) { + OpenAPI_list_for_each(dnai_listList, node) { + ogs_free(node->data); + } + OpenAPI_list_free(dnai_listList); + dnai_listList = NULL; + } + return NULL; +} + +OpenAPI_dnn_easdf_info_item_t *OpenAPI_dnn_easdf_info_item_copy(OpenAPI_dnn_easdf_info_item_t *dst, OpenAPI_dnn_easdf_info_item_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_dnn_easdf_info_item_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_dnn_easdf_info_item_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_dnn_easdf_info_item_free(dst); + dst = OpenAPI_dnn_easdf_info_item_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/dnn_easdf_info_item.h b/lib/sbi/openapi/model/dnn_easdf_info_item.h new file mode 100644 index 000000000..495692e31 --- /dev/null +++ b/lib/sbi/openapi/model/dnn_easdf_info_item.h @@ -0,0 +1,40 @@ +/* + * dnn_easdf_info_item.h + * + * Set of parameters supported by EASDF for a given DNN + */ + +#ifndef _OpenAPI_dnn_easdf_info_item_H_ +#define _OpenAPI_dnn_easdf_info_item_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_dnn_easdf_info_item_s OpenAPI_dnn_easdf_info_item_t; +typedef struct OpenAPI_dnn_easdf_info_item_s { + char *dnn; + OpenAPI_list_t *dnai_list; +} OpenAPI_dnn_easdf_info_item_t; + +OpenAPI_dnn_easdf_info_item_t *OpenAPI_dnn_easdf_info_item_create( + char *dnn, + OpenAPI_list_t *dnai_list +); +void OpenAPI_dnn_easdf_info_item_free(OpenAPI_dnn_easdf_info_item_t *dnn_easdf_info_item); +OpenAPI_dnn_easdf_info_item_t *OpenAPI_dnn_easdf_info_item_parseFromJSON(cJSON *dnn_easdf_info_itemJSON); +cJSON *OpenAPI_dnn_easdf_info_item_convertToJSON(OpenAPI_dnn_easdf_info_item_t *dnn_easdf_info_item); +OpenAPI_dnn_easdf_info_item_t *OpenAPI_dnn_easdf_info_item_copy(OpenAPI_dnn_easdf_info_item_t *dst, OpenAPI_dnn_easdf_info_item_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_dnn_easdf_info_item_H_ */ + diff --git a/lib/sbi/openapi/model/dnn_info_item.c b/lib/sbi/openapi/model/dnn_info_item.c new file mode 100644 index 000000000..fdc55b9a2 --- /dev/null +++ b/lib/sbi/openapi/model/dnn_info_item.c @@ -0,0 +1,114 @@ + +#include +#include +#include +#include "dnn_info_item.h" + +OpenAPI_dnn_info_item_t *OpenAPI_dnn_info_item_create( + char *dnn +) +{ + OpenAPI_dnn_info_item_t *dnn_info_item_local_var = ogs_malloc(sizeof(OpenAPI_dnn_info_item_t)); + ogs_assert(dnn_info_item_local_var); + + dnn_info_item_local_var->dnn = dnn; + + return dnn_info_item_local_var; +} + +void OpenAPI_dnn_info_item_free(OpenAPI_dnn_info_item_t *dnn_info_item) +{ + OpenAPI_lnode_t *node = NULL; + + if (NULL == dnn_info_item) { + return; + } + if (dnn_info_item->dnn) { + ogs_free(dnn_info_item->dnn); + dnn_info_item->dnn = NULL; + } + ogs_free(dnn_info_item); +} + +cJSON *OpenAPI_dnn_info_item_convertToJSON(OpenAPI_dnn_info_item_t *dnn_info_item) +{ + cJSON *item = NULL; + OpenAPI_lnode_t *node = NULL; + + if (dnn_info_item == NULL) { + ogs_error("OpenAPI_dnn_info_item_convertToJSON() failed [DnnInfoItem]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (!dnn_info_item->dnn) { + ogs_error("OpenAPI_dnn_info_item_convertToJSON() failed [dnn]"); + return NULL; + } + if (cJSON_AddStringToObject(item, "dnn", dnn_info_item->dnn) == NULL) { + ogs_error("OpenAPI_dnn_info_item_convertToJSON() failed [dnn]"); + goto end; + } + +end: + return item; +} + +OpenAPI_dnn_info_item_t *OpenAPI_dnn_info_item_parseFromJSON(cJSON *dnn_info_itemJSON) +{ + OpenAPI_dnn_info_item_t *dnn_info_item_local_var = NULL; + OpenAPI_lnode_t *node = NULL; + cJSON *dnn = NULL; + dnn = cJSON_GetObjectItemCaseSensitive(dnn_info_itemJSON, "dnn"); + if (!dnn) { + ogs_error("OpenAPI_dnn_info_item_parseFromJSON() failed [dnn]"); + goto end; + } + if (!cJSON_IsString(dnn)) { + ogs_error("OpenAPI_dnn_info_item_parseFromJSON() failed [dnn]"); + goto end; + } + + dnn_info_item_local_var = OpenAPI_dnn_info_item_create ( + ogs_strdup(dnn->valuestring) + ); + + return dnn_info_item_local_var; +end: + return NULL; +} + +OpenAPI_dnn_info_item_t *OpenAPI_dnn_info_item_copy(OpenAPI_dnn_info_item_t *dst, OpenAPI_dnn_info_item_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_dnn_info_item_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_dnn_info_item_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_dnn_info_item_free(dst); + dst = OpenAPI_dnn_info_item_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/dnn_info_item.h b/lib/sbi/openapi/model/dnn_info_item.h new file mode 100644 index 000000000..feb604000 --- /dev/null +++ b/lib/sbi/openapi/model/dnn_info_item.h @@ -0,0 +1,38 @@ +/* + * dnn_info_item.h + * + * Set of parameters supported by NF for a given DNN + */ + +#ifndef _OpenAPI_dnn_info_item_H_ +#define _OpenAPI_dnn_info_item_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_dnn_info_item_s OpenAPI_dnn_info_item_t; +typedef struct OpenAPI_dnn_info_item_s { + char *dnn; +} OpenAPI_dnn_info_item_t; + +OpenAPI_dnn_info_item_t *OpenAPI_dnn_info_item_create( + char *dnn +); +void OpenAPI_dnn_info_item_free(OpenAPI_dnn_info_item_t *dnn_info_item); +OpenAPI_dnn_info_item_t *OpenAPI_dnn_info_item_parseFromJSON(cJSON *dnn_info_itemJSON); +cJSON *OpenAPI_dnn_info_item_convertToJSON(OpenAPI_dnn_info_item_t *dnn_info_item); +OpenAPI_dnn_info_item_t *OpenAPI_dnn_info_item_copy(OpenAPI_dnn_info_item_t *dst, OpenAPI_dnn_info_item_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_dnn_info_item_H_ */ + diff --git a/lib/sbi/openapi/model/dnn_mb_smf_info_item.c b/lib/sbi/openapi/model/dnn_mb_smf_info_item.c new file mode 100644 index 000000000..2ecbac821 --- /dev/null +++ b/lib/sbi/openapi/model/dnn_mb_smf_info_item.c @@ -0,0 +1,114 @@ + +#include +#include +#include +#include "dnn_mb_smf_info_item.h" + +OpenAPI_dnn_mb_smf_info_item_t *OpenAPI_dnn_mb_smf_info_item_create( + char *dnn +) +{ + OpenAPI_dnn_mb_smf_info_item_t *dnn_mb_smf_info_item_local_var = ogs_malloc(sizeof(OpenAPI_dnn_mb_smf_info_item_t)); + ogs_assert(dnn_mb_smf_info_item_local_var); + + dnn_mb_smf_info_item_local_var->dnn = dnn; + + return dnn_mb_smf_info_item_local_var; +} + +void OpenAPI_dnn_mb_smf_info_item_free(OpenAPI_dnn_mb_smf_info_item_t *dnn_mb_smf_info_item) +{ + OpenAPI_lnode_t *node = NULL; + + if (NULL == dnn_mb_smf_info_item) { + return; + } + if (dnn_mb_smf_info_item->dnn) { + ogs_free(dnn_mb_smf_info_item->dnn); + dnn_mb_smf_info_item->dnn = NULL; + } + ogs_free(dnn_mb_smf_info_item); +} + +cJSON *OpenAPI_dnn_mb_smf_info_item_convertToJSON(OpenAPI_dnn_mb_smf_info_item_t *dnn_mb_smf_info_item) +{ + cJSON *item = NULL; + OpenAPI_lnode_t *node = NULL; + + if (dnn_mb_smf_info_item == NULL) { + ogs_error("OpenAPI_dnn_mb_smf_info_item_convertToJSON() failed [DnnMbSmfInfoItem]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (!dnn_mb_smf_info_item->dnn) { + ogs_error("OpenAPI_dnn_mb_smf_info_item_convertToJSON() failed [dnn]"); + return NULL; + } + if (cJSON_AddStringToObject(item, "dnn", dnn_mb_smf_info_item->dnn) == NULL) { + ogs_error("OpenAPI_dnn_mb_smf_info_item_convertToJSON() failed [dnn]"); + goto end; + } + +end: + return item; +} + +OpenAPI_dnn_mb_smf_info_item_t *OpenAPI_dnn_mb_smf_info_item_parseFromJSON(cJSON *dnn_mb_smf_info_itemJSON) +{ + OpenAPI_dnn_mb_smf_info_item_t *dnn_mb_smf_info_item_local_var = NULL; + OpenAPI_lnode_t *node = NULL; + cJSON *dnn = NULL; + dnn = cJSON_GetObjectItemCaseSensitive(dnn_mb_smf_info_itemJSON, "dnn"); + if (!dnn) { + ogs_error("OpenAPI_dnn_mb_smf_info_item_parseFromJSON() failed [dnn]"); + goto end; + } + if (!cJSON_IsString(dnn)) { + ogs_error("OpenAPI_dnn_mb_smf_info_item_parseFromJSON() failed [dnn]"); + goto end; + } + + dnn_mb_smf_info_item_local_var = OpenAPI_dnn_mb_smf_info_item_create ( + ogs_strdup(dnn->valuestring) + ); + + return dnn_mb_smf_info_item_local_var; +end: + return NULL; +} + +OpenAPI_dnn_mb_smf_info_item_t *OpenAPI_dnn_mb_smf_info_item_copy(OpenAPI_dnn_mb_smf_info_item_t *dst, OpenAPI_dnn_mb_smf_info_item_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_dnn_mb_smf_info_item_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_dnn_mb_smf_info_item_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_dnn_mb_smf_info_item_free(dst); + dst = OpenAPI_dnn_mb_smf_info_item_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/dnn_mb_smf_info_item.h b/lib/sbi/openapi/model/dnn_mb_smf_info_item.h new file mode 100644 index 000000000..9cb5cda21 --- /dev/null +++ b/lib/sbi/openapi/model/dnn_mb_smf_info_item.h @@ -0,0 +1,38 @@ +/* + * dnn_mb_smf_info_item.h + * + * Parameters supported by an MB-SMF for a given DNN + */ + +#ifndef _OpenAPI_dnn_mb_smf_info_item_H_ +#define _OpenAPI_dnn_mb_smf_info_item_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_dnn_mb_smf_info_item_s OpenAPI_dnn_mb_smf_info_item_t; +typedef struct OpenAPI_dnn_mb_smf_info_item_s { + char *dnn; +} OpenAPI_dnn_mb_smf_info_item_t; + +OpenAPI_dnn_mb_smf_info_item_t *OpenAPI_dnn_mb_smf_info_item_create( + char *dnn +); +void OpenAPI_dnn_mb_smf_info_item_free(OpenAPI_dnn_mb_smf_info_item_t *dnn_mb_smf_info_item); +OpenAPI_dnn_mb_smf_info_item_t *OpenAPI_dnn_mb_smf_info_item_parseFromJSON(cJSON *dnn_mb_smf_info_itemJSON); +cJSON *OpenAPI_dnn_mb_smf_info_item_convertToJSON(OpenAPI_dnn_mb_smf_info_item_t *dnn_mb_smf_info_item); +OpenAPI_dnn_mb_smf_info_item_t *OpenAPI_dnn_mb_smf_info_item_copy(OpenAPI_dnn_mb_smf_info_item_t *dst, OpenAPI_dnn_mb_smf_info_item_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_dnn_mb_smf_info_item_H_ */ + diff --git a/lib/sbi/openapi/model/dnn_route_selection_descriptor.h b/lib/sbi/openapi/model/dnn_route_selection_descriptor.h index 763802de7..0268e079b 100644 --- a/lib/sbi/openapi/model/dnn_route_selection_descriptor.h +++ b/lib/sbi/openapi/model/dnn_route_selection_descriptor.h @@ -1,7 +1,7 @@ /* * dnn_route_selection_descriptor.h * - * Contains the route selector parameters (PDU session types, SSC modes and ATSSS information) per DNN + * Contains the route selector parameters (PDU session types, SSC modes and ATSSS information) per DNN */ #ifndef _OpenAPI_dnn_route_selection_descriptor_H_ diff --git a/lib/sbi/openapi/model/dnn_smf_info_item.c b/lib/sbi/openapi/model/dnn_smf_info_item.c index 7d36937f3..41fb0f53c 100644 --- a/lib/sbi/openapi/model/dnn_smf_info_item.c +++ b/lib/sbi/openapi/model/dnn_smf_info_item.c @@ -5,13 +5,15 @@ #include "dnn_smf_info_item.h" OpenAPI_dnn_smf_info_item_t *OpenAPI_dnn_smf_info_item_create( - char *dnn + char *dnn, + OpenAPI_list_t *dnai_list ) { OpenAPI_dnn_smf_info_item_t *dnn_smf_info_item_local_var = ogs_malloc(sizeof(OpenAPI_dnn_smf_info_item_t)); ogs_assert(dnn_smf_info_item_local_var); dnn_smf_info_item_local_var->dnn = dnn; + dnn_smf_info_item_local_var->dnai_list = dnai_list; return dnn_smf_info_item_local_var; } @@ -27,6 +29,13 @@ void OpenAPI_dnn_smf_info_item_free(OpenAPI_dnn_smf_info_item_t *dnn_smf_info_it ogs_free(dnn_smf_info_item->dnn); dnn_smf_info_item->dnn = NULL; } + if (dnn_smf_info_item->dnai_list) { + OpenAPI_list_for_each(dnn_smf_info_item->dnai_list, node) { + OpenAPI_dnn_smf_info_item_dnai_list_inner_free(node->data); + } + OpenAPI_list_free(dnn_smf_info_item->dnai_list); + dnn_smf_info_item->dnai_list = NULL; + } ogs_free(dnn_smf_info_item); } @@ -50,6 +59,22 @@ cJSON *OpenAPI_dnn_smf_info_item_convertToJSON(OpenAPI_dnn_smf_info_item_t *dnn_ goto end; } + if (dnn_smf_info_item->dnai_list) { + cJSON *dnai_listList = cJSON_AddArrayToObject(item, "dnaiList"); + if (dnai_listList == NULL) { + ogs_error("OpenAPI_dnn_smf_info_item_convertToJSON() failed [dnai_list]"); + goto end; + } + OpenAPI_list_for_each(dnn_smf_info_item->dnai_list, node) { + cJSON *itemLocal = OpenAPI_dnn_smf_info_item_dnai_list_inner_convertToJSON(node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_dnn_smf_info_item_convertToJSON() failed [dnai_list]"); + goto end; + } + cJSON_AddItemToArray(dnai_listList, itemLocal); + } + } + end: return item; } @@ -59,6 +84,8 @@ OpenAPI_dnn_smf_info_item_t *OpenAPI_dnn_smf_info_item_parseFromJSON(cJSON *dnn_ OpenAPI_dnn_smf_info_item_t *dnn_smf_info_item_local_var = NULL; OpenAPI_lnode_t *node = NULL; cJSON *dnn = NULL; + cJSON *dnai_list = NULL; + OpenAPI_list_t *dnai_listList = NULL; dnn = cJSON_GetObjectItemCaseSensitive(dnn_smf_info_itemJSON, "dnn"); if (!dnn) { ogs_error("OpenAPI_dnn_smf_info_item_parseFromJSON() failed [dnn]"); @@ -69,12 +96,45 @@ OpenAPI_dnn_smf_info_item_t *OpenAPI_dnn_smf_info_item_parseFromJSON(cJSON *dnn_ goto end; } + dnai_list = cJSON_GetObjectItemCaseSensitive(dnn_smf_info_itemJSON, "dnaiList"); + if (dnai_list) { + cJSON *dnai_list_local = NULL; + if (!cJSON_IsArray(dnai_list)) { + ogs_error("OpenAPI_dnn_smf_info_item_parseFromJSON() failed [dnai_list]"); + goto end; + } + + dnai_listList = OpenAPI_list_create(); + + cJSON_ArrayForEach(dnai_list_local, dnai_list) { + if (!cJSON_IsObject(dnai_list_local)) { + ogs_error("OpenAPI_dnn_smf_info_item_parseFromJSON() failed [dnai_list]"); + goto end; + } + OpenAPI_dnn_smf_info_item_dnai_list_inner_t *dnai_listItem = OpenAPI_dnn_smf_info_item_dnai_list_inner_parseFromJSON(dnai_list_local); + if (!dnai_listItem) { + ogs_error("No dnai_listItem"); + OpenAPI_list_free(dnai_listList); + goto end; + } + OpenAPI_list_add(dnai_listList, dnai_listItem); + } + } + dnn_smf_info_item_local_var = OpenAPI_dnn_smf_info_item_create ( - ogs_strdup(dnn->valuestring) + ogs_strdup(dnn->valuestring), + dnai_list ? dnai_listList : NULL ); return dnn_smf_info_item_local_var; end: + if (dnai_listList) { + OpenAPI_list_for_each(dnai_listList, node) { + OpenAPI_dnn_smf_info_item_dnai_list_inner_free(node->data); + } + OpenAPI_list_free(dnai_listList); + dnai_listList = NULL; + } return NULL; } diff --git a/lib/sbi/openapi/model/dnn_smf_info_item.h b/lib/sbi/openapi/model/dnn_smf_info_item.h index 299f3daa3..33b745d5f 100644 --- a/lib/sbi/openapi/model/dnn_smf_info_item.h +++ b/lib/sbi/openapi/model/dnn_smf_info_item.h @@ -12,6 +12,7 @@ #include "../include/list.h" #include "../include/keyValuePair.h" #include "../include/binary.h" +#include "dnn_smf_info_item_dnai_list_inner.h" #ifdef __cplusplus extern "C" { @@ -20,10 +21,12 @@ extern "C" { typedef struct OpenAPI_dnn_smf_info_item_s OpenAPI_dnn_smf_info_item_t; typedef struct OpenAPI_dnn_smf_info_item_s { char *dnn; + OpenAPI_list_t *dnai_list; } OpenAPI_dnn_smf_info_item_t; OpenAPI_dnn_smf_info_item_t *OpenAPI_dnn_smf_info_item_create( - char *dnn + char *dnn, + OpenAPI_list_t *dnai_list ); void OpenAPI_dnn_smf_info_item_free(OpenAPI_dnn_smf_info_item_t *dnn_smf_info_item); OpenAPI_dnn_smf_info_item_t *OpenAPI_dnn_smf_info_item_parseFromJSON(cJSON *dnn_smf_info_itemJSON); diff --git a/lib/sbi/openapi/model/dnn_smf_info_item_dnai_list_inner.c b/lib/sbi/openapi/model/dnn_smf_info_item_dnai_list_inner.c new file mode 100644 index 000000000..995311d27 --- /dev/null +++ b/lib/sbi/openapi/model/dnn_smf_info_item_dnai_list_inner.c @@ -0,0 +1,87 @@ + +#include +#include +#include +#include "dnn_smf_info_item_dnai_list_inner.h" + +OpenAPI_dnn_smf_info_item_dnai_list_inner_t *OpenAPI_dnn_smf_info_item_dnai_list_inner_create( +) +{ + OpenAPI_dnn_smf_info_item_dnai_list_inner_t *dnn_smf_info_item_dnai_list_inner_local_var = ogs_malloc(sizeof(OpenAPI_dnn_smf_info_item_dnai_list_inner_t)); + ogs_assert(dnn_smf_info_item_dnai_list_inner_local_var); + + + return dnn_smf_info_item_dnai_list_inner_local_var; +} + +void OpenAPI_dnn_smf_info_item_dnai_list_inner_free(OpenAPI_dnn_smf_info_item_dnai_list_inner_t *dnn_smf_info_item_dnai_list_inner) +{ + OpenAPI_lnode_t *node = NULL; + + if (NULL == dnn_smf_info_item_dnai_list_inner) { + return; + } + ogs_free(dnn_smf_info_item_dnai_list_inner); +} + +cJSON *OpenAPI_dnn_smf_info_item_dnai_list_inner_convertToJSON(OpenAPI_dnn_smf_info_item_dnai_list_inner_t *dnn_smf_info_item_dnai_list_inner) +{ + cJSON *item = NULL; + OpenAPI_lnode_t *node = NULL; + + if (dnn_smf_info_item_dnai_list_inner == NULL) { + ogs_error("OpenAPI_dnn_smf_info_item_dnai_list_inner_convertToJSON() failed [DnnSmfInfoItem_dnaiList_inner]"); + return NULL; + } + + item = cJSON_CreateObject(); +end: + return item; +} + +OpenAPI_dnn_smf_info_item_dnai_list_inner_t *OpenAPI_dnn_smf_info_item_dnai_list_inner_parseFromJSON(cJSON *dnn_smf_info_item_dnai_list_innerJSON) +{ + OpenAPI_dnn_smf_info_item_dnai_list_inner_t *dnn_smf_info_item_dnai_list_inner_local_var = NULL; + OpenAPI_lnode_t *node = NULL; + dnn_smf_info_item_dnai_list_inner_local_var = OpenAPI_dnn_smf_info_item_dnai_list_inner_create ( + ); + + return dnn_smf_info_item_dnai_list_inner_local_var; +end: + return NULL; +} + +OpenAPI_dnn_smf_info_item_dnai_list_inner_t *OpenAPI_dnn_smf_info_item_dnai_list_inner_copy(OpenAPI_dnn_smf_info_item_dnai_list_inner_t *dst, OpenAPI_dnn_smf_info_item_dnai_list_inner_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_dnn_smf_info_item_dnai_list_inner_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_dnn_smf_info_item_dnai_list_inner_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_dnn_smf_info_item_dnai_list_inner_free(dst); + dst = OpenAPI_dnn_smf_info_item_dnai_list_inner_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/dnn_smf_info_item_dnai_list_inner.h b/lib/sbi/openapi/model/dnn_smf_info_item_dnai_list_inner.h new file mode 100644 index 000000000..29f35e325 --- /dev/null +++ b/lib/sbi/openapi/model/dnn_smf_info_item_dnai_list_inner.h @@ -0,0 +1,36 @@ +/* + * dnn_smf_info_item_dnai_list_inner.h + * + * + */ + +#ifndef _OpenAPI_dnn_smf_info_item_dnai_list_inner_H_ +#define _OpenAPI_dnn_smf_info_item_dnai_list_inner_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_dnn_smf_info_item_dnai_list_inner_s OpenAPI_dnn_smf_info_item_dnai_list_inner_t; +typedef struct OpenAPI_dnn_smf_info_item_dnai_list_inner_s { +} OpenAPI_dnn_smf_info_item_dnai_list_inner_t; + +OpenAPI_dnn_smf_info_item_dnai_list_inner_t *OpenAPI_dnn_smf_info_item_dnai_list_inner_create( +); +void OpenAPI_dnn_smf_info_item_dnai_list_inner_free(OpenAPI_dnn_smf_info_item_dnai_list_inner_t *dnn_smf_info_item_dnai_list_inner); +OpenAPI_dnn_smf_info_item_dnai_list_inner_t *OpenAPI_dnn_smf_info_item_dnai_list_inner_parseFromJSON(cJSON *dnn_smf_info_item_dnai_list_innerJSON); +cJSON *OpenAPI_dnn_smf_info_item_dnai_list_inner_convertToJSON(OpenAPI_dnn_smf_info_item_dnai_list_inner_t *dnn_smf_info_item_dnai_list_inner); +OpenAPI_dnn_smf_info_item_dnai_list_inner_t *OpenAPI_dnn_smf_info_item_dnai_list_inner_copy(OpenAPI_dnn_smf_info_item_dnai_list_inner_t *dst, OpenAPI_dnn_smf_info_item_dnai_list_inner_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_dnn_smf_info_item_dnai_list_inner_H_ */ + diff --git a/lib/sbi/openapi/model/dnn_snssai_information.c b/lib/sbi/openapi/model/dnn_snssai_information.c new file mode 100644 index 000000000..ee6260bc1 --- /dev/null +++ b/lib/sbi/openapi/model/dnn_snssai_information.c @@ -0,0 +1,141 @@ + +#include +#include +#include +#include "dnn_snssai_information.h" + +OpenAPI_dnn_snssai_information_t *OpenAPI_dnn_snssai_information_create( + char *dnn, + OpenAPI_snssai_t *snssai +) +{ + OpenAPI_dnn_snssai_information_t *dnn_snssai_information_local_var = ogs_malloc(sizeof(OpenAPI_dnn_snssai_information_t)); + ogs_assert(dnn_snssai_information_local_var); + + dnn_snssai_information_local_var->dnn = dnn; + dnn_snssai_information_local_var->snssai = snssai; + + return dnn_snssai_information_local_var; +} + +void OpenAPI_dnn_snssai_information_free(OpenAPI_dnn_snssai_information_t *dnn_snssai_information) +{ + OpenAPI_lnode_t *node = NULL; + + if (NULL == dnn_snssai_information) { + return; + } + if (dnn_snssai_information->dnn) { + ogs_free(dnn_snssai_information->dnn); + dnn_snssai_information->dnn = NULL; + } + if (dnn_snssai_information->snssai) { + OpenAPI_snssai_free(dnn_snssai_information->snssai); + dnn_snssai_information->snssai = NULL; + } + ogs_free(dnn_snssai_information); +} + +cJSON *OpenAPI_dnn_snssai_information_convertToJSON(OpenAPI_dnn_snssai_information_t *dnn_snssai_information) +{ + cJSON *item = NULL; + OpenAPI_lnode_t *node = NULL; + + if (dnn_snssai_information == NULL) { + ogs_error("OpenAPI_dnn_snssai_information_convertToJSON() failed [DnnSnssaiInformation]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (dnn_snssai_information->dnn) { + if (cJSON_AddStringToObject(item, "dnn", dnn_snssai_information->dnn) == NULL) { + ogs_error("OpenAPI_dnn_snssai_information_convertToJSON() failed [dnn]"); + goto end; + } + } + + if (dnn_snssai_information->snssai) { + cJSON *snssai_local_JSON = OpenAPI_snssai_convertToJSON(dnn_snssai_information->snssai); + if (snssai_local_JSON == NULL) { + ogs_error("OpenAPI_dnn_snssai_information_convertToJSON() failed [snssai]"); + goto end; + } + cJSON_AddItemToObject(item, "snssai", snssai_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_dnn_snssai_information_convertToJSON() failed [snssai]"); + goto end; + } + } + +end: + return item; +} + +OpenAPI_dnn_snssai_information_t *OpenAPI_dnn_snssai_information_parseFromJSON(cJSON *dnn_snssai_informationJSON) +{ + OpenAPI_dnn_snssai_information_t *dnn_snssai_information_local_var = NULL; + OpenAPI_lnode_t *node = NULL; + cJSON *dnn = NULL; + cJSON *snssai = NULL; + OpenAPI_snssai_t *snssai_local_nonprim = NULL; + dnn = cJSON_GetObjectItemCaseSensitive(dnn_snssai_informationJSON, "dnn"); + if (dnn) { + if (!cJSON_IsString(dnn) && !cJSON_IsNull(dnn)) { + ogs_error("OpenAPI_dnn_snssai_information_parseFromJSON() failed [dnn]"); + goto end; + } + } + + snssai = cJSON_GetObjectItemCaseSensitive(dnn_snssai_informationJSON, "snssai"); + if (snssai) { + snssai_local_nonprim = OpenAPI_snssai_parseFromJSON(snssai); + } + + dnn_snssai_information_local_var = OpenAPI_dnn_snssai_information_create ( + dnn && !cJSON_IsNull(dnn) ? ogs_strdup(dnn->valuestring) : NULL, + snssai ? snssai_local_nonprim : NULL + ); + + return dnn_snssai_information_local_var; +end: + if (snssai_local_nonprim) { + OpenAPI_snssai_free(snssai_local_nonprim); + snssai_local_nonprim = NULL; + } + return NULL; +} + +OpenAPI_dnn_snssai_information_t *OpenAPI_dnn_snssai_information_copy(OpenAPI_dnn_snssai_information_t *dst, OpenAPI_dnn_snssai_information_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_dnn_snssai_information_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_dnn_snssai_information_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_dnn_snssai_information_free(dst); + dst = OpenAPI_dnn_snssai_information_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/dnn_snssai_information.h b/lib/sbi/openapi/model/dnn_snssai_information.h new file mode 100644 index 000000000..1ca84d80f --- /dev/null +++ b/lib/sbi/openapi/model/dnn_snssai_information.h @@ -0,0 +1,41 @@ +/* + * dnn_snssai_information.h + * + * Represents a (DNN, SNSSAI) combination. + */ + +#ifndef _OpenAPI_dnn_snssai_information_H_ +#define _OpenAPI_dnn_snssai_information_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "snssai.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_dnn_snssai_information_s OpenAPI_dnn_snssai_information_t; +typedef struct OpenAPI_dnn_snssai_information_s { + char *dnn; + struct OpenAPI_snssai_s *snssai; +} OpenAPI_dnn_snssai_information_t; + +OpenAPI_dnn_snssai_information_t *OpenAPI_dnn_snssai_information_create( + char *dnn, + OpenAPI_snssai_t *snssai +); +void OpenAPI_dnn_snssai_information_free(OpenAPI_dnn_snssai_information_t *dnn_snssai_information); +OpenAPI_dnn_snssai_information_t *OpenAPI_dnn_snssai_information_parseFromJSON(cJSON *dnn_snssai_informationJSON); +cJSON *OpenAPI_dnn_snssai_information_convertToJSON(OpenAPI_dnn_snssai_information_t *dnn_snssai_information); +OpenAPI_dnn_snssai_information_t *OpenAPI_dnn_snssai_information_copy(OpenAPI_dnn_snssai_information_t *dst, OpenAPI_dnn_snssai_information_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_dnn_snssai_information_H_ */ + diff --git a/lib/sbi/openapi/model/dnn_tsctsf_info_item.c b/lib/sbi/openapi/model/dnn_tsctsf_info_item.c new file mode 100644 index 000000000..ed1d0bfa9 --- /dev/null +++ b/lib/sbi/openapi/model/dnn_tsctsf_info_item.c @@ -0,0 +1,114 @@ + +#include +#include +#include +#include "dnn_tsctsf_info_item.h" + +OpenAPI_dnn_tsctsf_info_item_t *OpenAPI_dnn_tsctsf_info_item_create( + char *dnn +) +{ + OpenAPI_dnn_tsctsf_info_item_t *dnn_tsctsf_info_item_local_var = ogs_malloc(sizeof(OpenAPI_dnn_tsctsf_info_item_t)); + ogs_assert(dnn_tsctsf_info_item_local_var); + + dnn_tsctsf_info_item_local_var->dnn = dnn; + + return dnn_tsctsf_info_item_local_var; +} + +void OpenAPI_dnn_tsctsf_info_item_free(OpenAPI_dnn_tsctsf_info_item_t *dnn_tsctsf_info_item) +{ + OpenAPI_lnode_t *node = NULL; + + if (NULL == dnn_tsctsf_info_item) { + return; + } + if (dnn_tsctsf_info_item->dnn) { + ogs_free(dnn_tsctsf_info_item->dnn); + dnn_tsctsf_info_item->dnn = NULL; + } + ogs_free(dnn_tsctsf_info_item); +} + +cJSON *OpenAPI_dnn_tsctsf_info_item_convertToJSON(OpenAPI_dnn_tsctsf_info_item_t *dnn_tsctsf_info_item) +{ + cJSON *item = NULL; + OpenAPI_lnode_t *node = NULL; + + if (dnn_tsctsf_info_item == NULL) { + ogs_error("OpenAPI_dnn_tsctsf_info_item_convertToJSON() failed [DnnTsctsfInfoItem]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (!dnn_tsctsf_info_item->dnn) { + ogs_error("OpenAPI_dnn_tsctsf_info_item_convertToJSON() failed [dnn]"); + return NULL; + } + if (cJSON_AddStringToObject(item, "dnn", dnn_tsctsf_info_item->dnn) == NULL) { + ogs_error("OpenAPI_dnn_tsctsf_info_item_convertToJSON() failed [dnn]"); + goto end; + } + +end: + return item; +} + +OpenAPI_dnn_tsctsf_info_item_t *OpenAPI_dnn_tsctsf_info_item_parseFromJSON(cJSON *dnn_tsctsf_info_itemJSON) +{ + OpenAPI_dnn_tsctsf_info_item_t *dnn_tsctsf_info_item_local_var = NULL; + OpenAPI_lnode_t *node = NULL; + cJSON *dnn = NULL; + dnn = cJSON_GetObjectItemCaseSensitive(dnn_tsctsf_info_itemJSON, "dnn"); + if (!dnn) { + ogs_error("OpenAPI_dnn_tsctsf_info_item_parseFromJSON() failed [dnn]"); + goto end; + } + if (!cJSON_IsString(dnn)) { + ogs_error("OpenAPI_dnn_tsctsf_info_item_parseFromJSON() failed [dnn]"); + goto end; + } + + dnn_tsctsf_info_item_local_var = OpenAPI_dnn_tsctsf_info_item_create ( + ogs_strdup(dnn->valuestring) + ); + + return dnn_tsctsf_info_item_local_var; +end: + return NULL; +} + +OpenAPI_dnn_tsctsf_info_item_t *OpenAPI_dnn_tsctsf_info_item_copy(OpenAPI_dnn_tsctsf_info_item_t *dst, OpenAPI_dnn_tsctsf_info_item_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_dnn_tsctsf_info_item_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_dnn_tsctsf_info_item_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_dnn_tsctsf_info_item_free(dst); + dst = OpenAPI_dnn_tsctsf_info_item_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/dnn_tsctsf_info_item.h b/lib/sbi/openapi/model/dnn_tsctsf_info_item.h new file mode 100644 index 000000000..2b3c7105e --- /dev/null +++ b/lib/sbi/openapi/model/dnn_tsctsf_info_item.h @@ -0,0 +1,38 @@ +/* + * dnn_tsctsf_info_item.h + * + * Parameters supported by an TSCTSF for a given DNN + */ + +#ifndef _OpenAPI_dnn_tsctsf_info_item_H_ +#define _OpenAPI_dnn_tsctsf_info_item_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_dnn_tsctsf_info_item_s OpenAPI_dnn_tsctsf_info_item_t; +typedef struct OpenAPI_dnn_tsctsf_info_item_s { + char *dnn; +} OpenAPI_dnn_tsctsf_info_item_t; + +OpenAPI_dnn_tsctsf_info_item_t *OpenAPI_dnn_tsctsf_info_item_create( + char *dnn +); +void OpenAPI_dnn_tsctsf_info_item_free(OpenAPI_dnn_tsctsf_info_item_t *dnn_tsctsf_info_item); +OpenAPI_dnn_tsctsf_info_item_t *OpenAPI_dnn_tsctsf_info_item_parseFromJSON(cJSON *dnn_tsctsf_info_itemJSON); +cJSON *OpenAPI_dnn_tsctsf_info_item_convertToJSON(OpenAPI_dnn_tsctsf_info_item_t *dnn_tsctsf_info_item); +OpenAPI_dnn_tsctsf_info_item_t *OpenAPI_dnn_tsctsf_info_item_copy(OpenAPI_dnn_tsctsf_info_item_t *dst, OpenAPI_dnn_tsctsf_info_item_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_dnn_tsctsf_info_item_H_ */ + diff --git a/lib/sbi/openapi/model/dnn_upf_info_item.c b/lib/sbi/openapi/model/dnn_upf_info_item.c index a09a5dd25..5986c12e4 100644 --- a/lib/sbi/openapi/model/dnn_upf_info_item.c +++ b/lib/sbi/openapi/model/dnn_upf_info_item.c @@ -10,6 +10,8 @@ OpenAPI_dnn_upf_info_item_t *OpenAPI_dnn_upf_info_item_create( OpenAPI_list_t *pdu_session_types, OpenAPI_list_t *ipv4_address_ranges, OpenAPI_list_t *ipv6_prefix_ranges, + OpenAPI_list_t *ipv4_index_list, + OpenAPI_list_t *ipv6_index_list, OpenAPI_list_t* dnai_nw_instance_list ) { @@ -21,6 +23,8 @@ OpenAPI_dnn_upf_info_item_t *OpenAPI_dnn_upf_info_item_create( dnn_upf_info_item_local_var->pdu_session_types = pdu_session_types; dnn_upf_info_item_local_var->ipv4_address_ranges = ipv4_address_ranges; dnn_upf_info_item_local_var->ipv6_prefix_ranges = ipv6_prefix_ranges; + dnn_upf_info_item_local_var->ipv4_index_list = ipv4_index_list; + dnn_upf_info_item_local_var->ipv6_index_list = ipv6_index_list; dnn_upf_info_item_local_var->dnai_nw_instance_list = dnai_nw_instance_list; return dnn_upf_info_item_local_var; @@ -62,6 +66,20 @@ void OpenAPI_dnn_upf_info_item_free(OpenAPI_dnn_upf_info_item_t *dnn_upf_info_it OpenAPI_list_free(dnn_upf_info_item->ipv6_prefix_ranges); dnn_upf_info_item->ipv6_prefix_ranges = NULL; } + if (dnn_upf_info_item->ipv4_index_list) { + OpenAPI_list_for_each(dnn_upf_info_item->ipv4_index_list, node) { + OpenAPI_ip_index_free(node->data); + } + OpenAPI_list_free(dnn_upf_info_item->ipv4_index_list); + dnn_upf_info_item->ipv4_index_list = NULL; + } + if (dnn_upf_info_item->ipv6_index_list) { + OpenAPI_list_for_each(dnn_upf_info_item->ipv6_index_list, node) { + OpenAPI_ip_index_free(node->data); + } + OpenAPI_list_free(dnn_upf_info_item->ipv6_index_list); + dnn_upf_info_item->ipv6_index_list = NULL; + } if (dnn_upf_info_item->dnai_nw_instance_list) { OpenAPI_list_for_each(dnn_upf_info_item->dnai_nw_instance_list, node) { OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*)node->data; @@ -155,6 +173,38 @@ cJSON *OpenAPI_dnn_upf_info_item_convertToJSON(OpenAPI_dnn_upf_info_item_t *dnn_ } } + if (dnn_upf_info_item->ipv4_index_list) { + cJSON *ipv4_index_listList = cJSON_AddArrayToObject(item, "ipv4IndexList"); + if (ipv4_index_listList == NULL) { + ogs_error("OpenAPI_dnn_upf_info_item_convertToJSON() failed [ipv4_index_list]"); + goto end; + } + OpenAPI_list_for_each(dnn_upf_info_item->ipv4_index_list, node) { + cJSON *itemLocal = OpenAPI_ip_index_convertToJSON(node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_dnn_upf_info_item_convertToJSON() failed [ipv4_index_list]"); + goto end; + } + cJSON_AddItemToArray(ipv4_index_listList, itemLocal); + } + } + + if (dnn_upf_info_item->ipv6_index_list) { + cJSON *ipv6_index_listList = cJSON_AddArrayToObject(item, "ipv6IndexList"); + if (ipv6_index_listList == NULL) { + ogs_error("OpenAPI_dnn_upf_info_item_convertToJSON() failed [ipv6_index_list]"); + goto end; + } + OpenAPI_list_for_each(dnn_upf_info_item->ipv6_index_list, node) { + cJSON *itemLocal = OpenAPI_ip_index_convertToJSON(node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_dnn_upf_info_item_convertToJSON() failed [ipv6_index_list]"); + goto end; + } + cJSON_AddItemToArray(ipv6_index_listList, itemLocal); + } + } + if (dnn_upf_info_item->dnai_nw_instance_list) { cJSON *dnai_nw_instance_list = cJSON_AddObjectToObject(item, "dnaiNwInstanceList"); if (dnai_nw_instance_list == NULL) { @@ -190,6 +240,10 @@ OpenAPI_dnn_upf_info_item_t *OpenAPI_dnn_upf_info_item_parseFromJSON(cJSON *dnn_ OpenAPI_list_t *ipv4_address_rangesList = NULL; cJSON *ipv6_prefix_ranges = NULL; OpenAPI_list_t *ipv6_prefix_rangesList = NULL; + cJSON *ipv4_index_list = NULL; + OpenAPI_list_t *ipv4_index_listList = NULL; + cJSON *ipv6_index_list = NULL; + OpenAPI_list_t *ipv6_index_listList = NULL; cJSON *dnai_nw_instance_list = NULL; OpenAPI_list_t *dnai_nw_instance_listList = NULL; dnn = cJSON_GetObjectItemCaseSensitive(dnn_upf_info_itemJSON, "dnn"); @@ -292,6 +346,56 @@ OpenAPI_dnn_upf_info_item_t *OpenAPI_dnn_upf_info_item_parseFromJSON(cJSON *dnn_ } } + ipv4_index_list = cJSON_GetObjectItemCaseSensitive(dnn_upf_info_itemJSON, "ipv4IndexList"); + if (ipv4_index_list) { + cJSON *ipv4_index_list_local = NULL; + if (!cJSON_IsArray(ipv4_index_list)) { + ogs_error("OpenAPI_dnn_upf_info_item_parseFromJSON() failed [ipv4_index_list]"); + goto end; + } + + ipv4_index_listList = OpenAPI_list_create(); + + cJSON_ArrayForEach(ipv4_index_list_local, ipv4_index_list) { + if (!cJSON_IsObject(ipv4_index_list_local)) { + ogs_error("OpenAPI_dnn_upf_info_item_parseFromJSON() failed [ipv4_index_list]"); + goto end; + } + OpenAPI_ip_index_t *ipv4_index_listItem = OpenAPI_ip_index_parseFromJSON(ipv4_index_list_local); + if (!ipv4_index_listItem) { + ogs_error("No ipv4_index_listItem"); + OpenAPI_list_free(ipv4_index_listList); + goto end; + } + OpenAPI_list_add(ipv4_index_listList, ipv4_index_listItem); + } + } + + ipv6_index_list = cJSON_GetObjectItemCaseSensitive(dnn_upf_info_itemJSON, "ipv6IndexList"); + if (ipv6_index_list) { + cJSON *ipv6_index_list_local = NULL; + if (!cJSON_IsArray(ipv6_index_list)) { + ogs_error("OpenAPI_dnn_upf_info_item_parseFromJSON() failed [ipv6_index_list]"); + goto end; + } + + ipv6_index_listList = OpenAPI_list_create(); + + cJSON_ArrayForEach(ipv6_index_list_local, ipv6_index_list) { + if (!cJSON_IsObject(ipv6_index_list_local)) { + ogs_error("OpenAPI_dnn_upf_info_item_parseFromJSON() failed [ipv6_index_list]"); + goto end; + } + OpenAPI_ip_index_t *ipv6_index_listItem = OpenAPI_ip_index_parseFromJSON(ipv6_index_list_local); + if (!ipv6_index_listItem) { + ogs_error("No ipv6_index_listItem"); + OpenAPI_list_free(ipv6_index_listList); + goto end; + } + OpenAPI_list_add(ipv6_index_listList, ipv6_index_listItem); + } + } + dnai_nw_instance_list = cJSON_GetObjectItemCaseSensitive(dnn_upf_info_itemJSON, "dnaiNwInstanceList"); if (dnai_nw_instance_list) { cJSON *dnai_nw_instance_list_local_map = NULL; @@ -322,6 +426,8 @@ OpenAPI_dnn_upf_info_item_t *OpenAPI_dnn_upf_info_item_parseFromJSON(cJSON *dnn_ pdu_session_types ? pdu_session_typesList : NULL, ipv4_address_ranges ? ipv4_address_rangesList : NULL, ipv6_prefix_ranges ? ipv6_prefix_rangesList : NULL, + ipv4_index_list ? ipv4_index_listList : NULL, + ipv6_index_list ? ipv6_index_listList : NULL, dnai_nw_instance_list ? dnai_nw_instance_listList : NULL ); @@ -352,6 +458,20 @@ end: OpenAPI_list_free(ipv6_prefix_rangesList); ipv6_prefix_rangesList = NULL; } + if (ipv4_index_listList) { + OpenAPI_list_for_each(ipv4_index_listList, node) { + OpenAPI_ip_index_free(node->data); + } + OpenAPI_list_free(ipv4_index_listList); + ipv4_index_listList = NULL; + } + if (ipv6_index_listList) { + OpenAPI_list_for_each(ipv6_index_listList, node) { + OpenAPI_ip_index_free(node->data); + } + OpenAPI_list_free(ipv6_index_listList); + ipv6_index_listList = NULL; + } if (dnai_nw_instance_listList) { OpenAPI_list_for_each(dnai_nw_instance_listList, node) { OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*) node->data; diff --git a/lib/sbi/openapi/model/dnn_upf_info_item.h b/lib/sbi/openapi/model/dnn_upf_info_item.h index 3f4a0b624..ca4998295 100644 --- a/lib/sbi/openapi/model/dnn_upf_info_item.h +++ b/lib/sbi/openapi/model/dnn_upf_info_item.h @@ -12,6 +12,7 @@ #include "../include/list.h" #include "../include/keyValuePair.h" #include "../include/binary.h" +#include "ip_index.h" #include "ipv4_address_range.h" #include "ipv6_prefix_range.h" #include "pdu_session_type.h" @@ -27,6 +28,8 @@ typedef struct OpenAPI_dnn_upf_info_item_s { OpenAPI_list_t *pdu_session_types; OpenAPI_list_t *ipv4_address_ranges; OpenAPI_list_t *ipv6_prefix_ranges; + OpenAPI_list_t *ipv4_index_list; + OpenAPI_list_t *ipv6_index_list; OpenAPI_list_t* dnai_nw_instance_list; } OpenAPI_dnn_upf_info_item_t; @@ -36,6 +39,8 @@ OpenAPI_dnn_upf_info_item_t *OpenAPI_dnn_upf_info_item_create( OpenAPI_list_t *pdu_session_types, OpenAPI_list_t *ipv4_address_ranges, OpenAPI_list_t *ipv6_prefix_ranges, + OpenAPI_list_t *ipv4_index_list, + OpenAPI_list_t *ipv6_index_list, OpenAPI_list_t* dnai_nw_instance_list ); void OpenAPI_dnn_upf_info_item_free(OpenAPI_dnn_upf_info_item_t *dnn_upf_info_item); diff --git a/lib/sbi/openapi/model/downlink_data_notification_control_rm.h b/lib/sbi/openapi/model/downlink_data_notification_control_rm.h index 40c47e536..e82df78ea 100644 --- a/lib/sbi/openapi/model/downlink_data_notification_control_rm.h +++ b/lib/sbi/openapi/model/downlink_data_notification_control_rm.h @@ -1,7 +1,7 @@ /* * downlink_data_notification_control_rm.h * - * this data type is defined in the same way as the DownlinkDataNotificationControl data type, but with the OpenAPI nullable property set to true. + * This data type is defined in the same way as the DownlinkDataNotificationControl data type, but with the nullable:true property. */ #ifndef _OpenAPI_downlink_data_notification_control_rm_H_ diff --git a/lib/sbi/openapi/model/dynamic5_qi.h b/lib/sbi/openapi/model/dynamic5_qi.h index 9aff134ea..bf0fd9472 100644 --- a/lib/sbi/openapi/model/dynamic5_qi.h +++ b/lib/sbi/openapi/model/dynamic5_qi.h @@ -1,7 +1,7 @@ /* * dynamic5_qi.h * - * + * It indicates the QoS Characteristics for a Non-standardised or not pre-configured 5QI for downlink and uplink. */ #ifndef _OpenAPI_dynamic5_qi_H_ diff --git a/lib/sbi/openapi/model/eap_session.c b/lib/sbi/openapi/model/eap_session.c index 474108195..7d7bbebc1 100644 --- a/lib/sbi/openapi/model/eap_session.c +++ b/lib/sbi/openapi/model/eap_session.c @@ -10,7 +10,9 @@ OpenAPI_eap_session_t *OpenAPI_eap_session_create( OpenAPI_list_t* _links, OpenAPI_auth_result_e auth_result, char *supi, - char *supported_features + char *supported_features, + OpenAPI_list_t *pvs_info, + char *msk ) { OpenAPI_eap_session_t *eap_session_local_var = ogs_malloc(sizeof(OpenAPI_eap_session_t)); @@ -22,6 +24,8 @@ OpenAPI_eap_session_t *OpenAPI_eap_session_create( eap_session_local_var->auth_result = auth_result; eap_session_local_var->supi = supi; eap_session_local_var->supported_features = supported_features; + eap_session_local_var->pvs_info = pvs_info; + eap_session_local_var->msk = msk; return eap_session_local_var; } @@ -59,6 +63,17 @@ void OpenAPI_eap_session_free(OpenAPI_eap_session_t *eap_session) ogs_free(eap_session->supported_features); eap_session->supported_features = NULL; } + if (eap_session->pvs_info) { + OpenAPI_list_for_each(eap_session->pvs_info, node) { + OpenAPI_server_addressing_info_free(node->data); + } + OpenAPI_list_free(eap_session->pvs_info); + eap_session->pvs_info = NULL; + } + if (eap_session->msk) { + ogs_free(eap_session->msk); + eap_session->msk = NULL; + } ogs_free(eap_session); } @@ -132,6 +147,29 @@ cJSON *OpenAPI_eap_session_convertToJSON(OpenAPI_eap_session_t *eap_session) } } + if (eap_session->pvs_info) { + cJSON *pvs_infoList = cJSON_AddArrayToObject(item, "pvsInfo"); + if (pvs_infoList == NULL) { + ogs_error("OpenAPI_eap_session_convertToJSON() failed [pvs_info]"); + goto end; + } + OpenAPI_list_for_each(eap_session->pvs_info, node) { + cJSON *itemLocal = OpenAPI_server_addressing_info_convertToJSON(node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_eap_session_convertToJSON() failed [pvs_info]"); + goto end; + } + cJSON_AddItemToArray(pvs_infoList, itemLocal); + } + } + + if (eap_session->msk) { + if (cJSON_AddStringToObject(item, "msk", eap_session->msk) == NULL) { + ogs_error("OpenAPI_eap_session_convertToJSON() failed [msk]"); + goto end; + } + } + end: return item; } @@ -148,6 +186,9 @@ OpenAPI_eap_session_t *OpenAPI_eap_session_parseFromJSON(cJSON *eap_sessionJSON) OpenAPI_auth_result_e auth_resultVariable = 0; cJSON *supi = NULL; cJSON *supported_features = NULL; + cJSON *pvs_info = NULL; + OpenAPI_list_t *pvs_infoList = NULL; + cJSON *msk = NULL; eap_payload = cJSON_GetObjectItemCaseSensitive(eap_sessionJSON, "eapPayload"); if (!eap_payload) { ogs_error("OpenAPI_eap_session_parseFromJSON() failed [eap_payload]"); @@ -217,13 +258,48 @@ OpenAPI_eap_session_t *OpenAPI_eap_session_parseFromJSON(cJSON *eap_sessionJSON) } } + pvs_info = cJSON_GetObjectItemCaseSensitive(eap_sessionJSON, "pvsInfo"); + if (pvs_info) { + cJSON *pvs_info_local = NULL; + if (!cJSON_IsArray(pvs_info)) { + ogs_error("OpenAPI_eap_session_parseFromJSON() failed [pvs_info]"); + goto end; + } + + pvs_infoList = OpenAPI_list_create(); + + cJSON_ArrayForEach(pvs_info_local, pvs_info) { + if (!cJSON_IsObject(pvs_info_local)) { + ogs_error("OpenAPI_eap_session_parseFromJSON() failed [pvs_info]"); + goto end; + } + OpenAPI_server_addressing_info_t *pvs_infoItem = OpenAPI_server_addressing_info_parseFromJSON(pvs_info_local); + if (!pvs_infoItem) { + ogs_error("No pvs_infoItem"); + OpenAPI_list_free(pvs_infoList); + goto end; + } + OpenAPI_list_add(pvs_infoList, pvs_infoItem); + } + } + + msk = cJSON_GetObjectItemCaseSensitive(eap_sessionJSON, "msk"); + if (msk) { + if (!cJSON_IsString(msk) && !cJSON_IsNull(msk)) { + ogs_error("OpenAPI_eap_session_parseFromJSON() failed [msk]"); + goto end; + } + } + eap_session_local_var = OpenAPI_eap_session_create ( ogs_strdup(eap_payload->valuestring), k_seaf && !cJSON_IsNull(k_seaf) ? ogs_strdup(k_seaf->valuestring) : NULL, _links ? _linksList : NULL, auth_result ? auth_resultVariable : 0, supi && !cJSON_IsNull(supi) ? ogs_strdup(supi->valuestring) : NULL, - supported_features && !cJSON_IsNull(supported_features) ? ogs_strdup(supported_features->valuestring) : NULL + supported_features && !cJSON_IsNull(supported_features) ? ogs_strdup(supported_features->valuestring) : NULL, + pvs_info ? pvs_infoList : NULL, + msk && !cJSON_IsNull(msk) ? ogs_strdup(msk->valuestring) : NULL ); return eap_session_local_var; @@ -238,6 +314,13 @@ end: OpenAPI_list_free(_linksList); _linksList = NULL; } + if (pvs_infoList) { + OpenAPI_list_for_each(pvs_infoList, node) { + OpenAPI_server_addressing_info_free(node->data); + } + OpenAPI_list_free(pvs_infoList); + pvs_infoList = NULL; + } return NULL; } diff --git a/lib/sbi/openapi/model/eap_session.h b/lib/sbi/openapi/model/eap_session.h index e0378b3a8..286cc64ac 100644 --- a/lib/sbi/openapi/model/eap_session.h +++ b/lib/sbi/openapi/model/eap_session.h @@ -1,7 +1,7 @@ /* * eap_session.h * - * + * Contains information related to the EAP session. */ #ifndef _OpenAPI_eap_session_H_ @@ -14,6 +14,7 @@ #include "../include/binary.h" #include "auth_result.h" #include "links_value_schema.h" +#include "server_addressing_info.h" #ifdef __cplusplus extern "C" { @@ -27,6 +28,8 @@ typedef struct OpenAPI_eap_session_s { OpenAPI_auth_result_e auth_result; char *supi; char *supported_features; + OpenAPI_list_t *pvs_info; + char *msk; } OpenAPI_eap_session_t; OpenAPI_eap_session_t *OpenAPI_eap_session_create( @@ -35,7 +38,9 @@ OpenAPI_eap_session_t *OpenAPI_eap_session_create( OpenAPI_list_t* _links, OpenAPI_auth_result_e auth_result, char *supi, - char *supported_features + char *supported_features, + OpenAPI_list_t *pvs_info, + char *msk ); void OpenAPI_eap_session_free(OpenAPI_eap_session_t *eap_session); OpenAPI_eap_session_t *OpenAPI_eap_session_parseFromJSON(cJSON *eap_sessionJSON); diff --git a/lib/sbi/openapi/model/eas_ip_replacement_info.c b/lib/sbi/openapi/model/eas_ip_replacement_info.c new file mode 100644 index 000000000..8833c7827 --- /dev/null +++ b/lib/sbi/openapi/model/eas_ip_replacement_info.c @@ -0,0 +1,157 @@ + +#include +#include +#include +#include "eas_ip_replacement_info.h" + +OpenAPI_eas_ip_replacement_info_t *OpenAPI_eas_ip_replacement_info_create( + OpenAPI_eas_server_address_t *source, + OpenAPI_eas_server_address_t *target +) +{ + OpenAPI_eas_ip_replacement_info_t *eas_ip_replacement_info_local_var = ogs_malloc(sizeof(OpenAPI_eas_ip_replacement_info_t)); + ogs_assert(eas_ip_replacement_info_local_var); + + eas_ip_replacement_info_local_var->source = source; + eas_ip_replacement_info_local_var->target = target; + + return eas_ip_replacement_info_local_var; +} + +void OpenAPI_eas_ip_replacement_info_free(OpenAPI_eas_ip_replacement_info_t *eas_ip_replacement_info) +{ + OpenAPI_lnode_t *node = NULL; + + if (NULL == eas_ip_replacement_info) { + return; + } + if (eas_ip_replacement_info->source) { + OpenAPI_eas_server_address_free(eas_ip_replacement_info->source); + eas_ip_replacement_info->source = NULL; + } + if (eas_ip_replacement_info->target) { + OpenAPI_eas_server_address_free(eas_ip_replacement_info->target); + eas_ip_replacement_info->target = NULL; + } + ogs_free(eas_ip_replacement_info); +} + +cJSON *OpenAPI_eas_ip_replacement_info_convertToJSON(OpenAPI_eas_ip_replacement_info_t *eas_ip_replacement_info) +{ + cJSON *item = NULL; + OpenAPI_lnode_t *node = NULL; + + if (eas_ip_replacement_info == NULL) { + ogs_error("OpenAPI_eas_ip_replacement_info_convertToJSON() failed [EasIpReplacementInfo]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (!eas_ip_replacement_info->source) { + ogs_error("OpenAPI_eas_ip_replacement_info_convertToJSON() failed [source]"); + return NULL; + } + cJSON *source_local_JSON = OpenAPI_eas_server_address_convertToJSON(eas_ip_replacement_info->source); + if (source_local_JSON == NULL) { + ogs_error("OpenAPI_eas_ip_replacement_info_convertToJSON() failed [source]"); + goto end; + } + cJSON_AddItemToObject(item, "source", source_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_eas_ip_replacement_info_convertToJSON() failed [source]"); + goto end; + } + + if (!eas_ip_replacement_info->target) { + ogs_error("OpenAPI_eas_ip_replacement_info_convertToJSON() failed [target]"); + return NULL; + } + cJSON *target_local_JSON = OpenAPI_eas_server_address_convertToJSON(eas_ip_replacement_info->target); + if (target_local_JSON == NULL) { + ogs_error("OpenAPI_eas_ip_replacement_info_convertToJSON() failed [target]"); + goto end; + } + cJSON_AddItemToObject(item, "target", target_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_eas_ip_replacement_info_convertToJSON() failed [target]"); + goto end; + } + +end: + return item; +} + +OpenAPI_eas_ip_replacement_info_t *OpenAPI_eas_ip_replacement_info_parseFromJSON(cJSON *eas_ip_replacement_infoJSON) +{ + OpenAPI_eas_ip_replacement_info_t *eas_ip_replacement_info_local_var = NULL; + OpenAPI_lnode_t *node = NULL; + cJSON *source = NULL; + OpenAPI_eas_server_address_t *source_local_nonprim = NULL; + cJSON *target = NULL; + OpenAPI_eas_server_address_t *target_local_nonprim = NULL; + source = cJSON_GetObjectItemCaseSensitive(eas_ip_replacement_infoJSON, "source"); + if (!source) { + ogs_error("OpenAPI_eas_ip_replacement_info_parseFromJSON() failed [source]"); + goto end; + } + source_local_nonprim = OpenAPI_eas_server_address_parseFromJSON(source); + + target = cJSON_GetObjectItemCaseSensitive(eas_ip_replacement_infoJSON, "target"); + if (!target) { + ogs_error("OpenAPI_eas_ip_replacement_info_parseFromJSON() failed [target]"); + goto end; + } + target_local_nonprim = OpenAPI_eas_server_address_parseFromJSON(target); + + eas_ip_replacement_info_local_var = OpenAPI_eas_ip_replacement_info_create ( + source_local_nonprim, + target_local_nonprim + ); + + return eas_ip_replacement_info_local_var; +end: + if (source_local_nonprim) { + OpenAPI_eas_server_address_free(source_local_nonprim); + source_local_nonprim = NULL; + } + if (target_local_nonprim) { + OpenAPI_eas_server_address_free(target_local_nonprim); + target_local_nonprim = NULL; + } + return NULL; +} + +OpenAPI_eas_ip_replacement_info_t *OpenAPI_eas_ip_replacement_info_copy(OpenAPI_eas_ip_replacement_info_t *dst, OpenAPI_eas_ip_replacement_info_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_eas_ip_replacement_info_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_eas_ip_replacement_info_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_eas_ip_replacement_info_free(dst); + dst = OpenAPI_eas_ip_replacement_info_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/eas_ip_replacement_info.h b/lib/sbi/openapi/model/eas_ip_replacement_info.h new file mode 100644 index 000000000..71a325c35 --- /dev/null +++ b/lib/sbi/openapi/model/eas_ip_replacement_info.h @@ -0,0 +1,41 @@ +/* + * eas_ip_replacement_info.h + * + * Contains EAS IP replacement information for a Source and a Target EAS. + */ + +#ifndef _OpenAPI_eas_ip_replacement_info_H_ +#define _OpenAPI_eas_ip_replacement_info_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "eas_server_address.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_eas_ip_replacement_info_s OpenAPI_eas_ip_replacement_info_t; +typedef struct OpenAPI_eas_ip_replacement_info_s { + struct OpenAPI_eas_server_address_s *source; + struct OpenAPI_eas_server_address_s *target; +} OpenAPI_eas_ip_replacement_info_t; + +OpenAPI_eas_ip_replacement_info_t *OpenAPI_eas_ip_replacement_info_create( + OpenAPI_eas_server_address_t *source, + OpenAPI_eas_server_address_t *target +); +void OpenAPI_eas_ip_replacement_info_free(OpenAPI_eas_ip_replacement_info_t *eas_ip_replacement_info); +OpenAPI_eas_ip_replacement_info_t *OpenAPI_eas_ip_replacement_info_parseFromJSON(cJSON *eas_ip_replacement_infoJSON); +cJSON *OpenAPI_eas_ip_replacement_info_convertToJSON(OpenAPI_eas_ip_replacement_info_t *eas_ip_replacement_info); +OpenAPI_eas_ip_replacement_info_t *OpenAPI_eas_ip_replacement_info_copy(OpenAPI_eas_ip_replacement_info_t *dst, OpenAPI_eas_ip_replacement_info_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_eas_ip_replacement_info_H_ */ + diff --git a/lib/sbi/openapi/model/eas_server_address.c b/lib/sbi/openapi/model/eas_server_address.c new file mode 100644 index 000000000..dfccdd31d --- /dev/null +++ b/lib/sbi/openapi/model/eas_server_address.c @@ -0,0 +1,142 @@ + +#include +#include +#include +#include "eas_server_address.h" + +OpenAPI_eas_server_address_t *OpenAPI_eas_server_address_create( + OpenAPI_ip_addr_t *ip, + int port +) +{ + OpenAPI_eas_server_address_t *eas_server_address_local_var = ogs_malloc(sizeof(OpenAPI_eas_server_address_t)); + ogs_assert(eas_server_address_local_var); + + eas_server_address_local_var->ip = ip; + eas_server_address_local_var->port = port; + + return eas_server_address_local_var; +} + +void OpenAPI_eas_server_address_free(OpenAPI_eas_server_address_t *eas_server_address) +{ + OpenAPI_lnode_t *node = NULL; + + if (NULL == eas_server_address) { + return; + } + if (eas_server_address->ip) { + OpenAPI_ip_addr_free(eas_server_address->ip); + eas_server_address->ip = NULL; + } + ogs_free(eas_server_address); +} + +cJSON *OpenAPI_eas_server_address_convertToJSON(OpenAPI_eas_server_address_t *eas_server_address) +{ + cJSON *item = NULL; + OpenAPI_lnode_t *node = NULL; + + if (eas_server_address == NULL) { + ogs_error("OpenAPI_eas_server_address_convertToJSON() failed [EasServerAddress]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (!eas_server_address->ip) { + ogs_error("OpenAPI_eas_server_address_convertToJSON() failed [ip]"); + return NULL; + } + cJSON *ip_local_JSON = OpenAPI_ip_addr_convertToJSON(eas_server_address->ip); + if (ip_local_JSON == NULL) { + ogs_error("OpenAPI_eas_server_address_convertToJSON() failed [ip]"); + goto end; + } + cJSON_AddItemToObject(item, "ip", ip_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_eas_server_address_convertToJSON() failed [ip]"); + goto end; + } + + if (cJSON_AddNumberToObject(item, "port", eas_server_address->port) == NULL) { + ogs_error("OpenAPI_eas_server_address_convertToJSON() failed [port]"); + goto end; + } + +end: + return item; +} + +OpenAPI_eas_server_address_t *OpenAPI_eas_server_address_parseFromJSON(cJSON *eas_server_addressJSON) +{ + OpenAPI_eas_server_address_t *eas_server_address_local_var = NULL; + OpenAPI_lnode_t *node = NULL; + cJSON *ip = NULL; + OpenAPI_ip_addr_t *ip_local_nonprim = NULL; + cJSON *port = NULL; + ip = cJSON_GetObjectItemCaseSensitive(eas_server_addressJSON, "ip"); + if (!ip) { + ogs_error("OpenAPI_eas_server_address_parseFromJSON() failed [ip]"); + goto end; + } + ip_local_nonprim = OpenAPI_ip_addr_parseFromJSON(ip); + + port = cJSON_GetObjectItemCaseSensitive(eas_server_addressJSON, "port"); + if (!port) { + ogs_error("OpenAPI_eas_server_address_parseFromJSON() failed [port]"); + goto end; + } + if (!cJSON_IsNumber(port)) { + ogs_error("OpenAPI_eas_server_address_parseFromJSON() failed [port]"); + goto end; + } + + eas_server_address_local_var = OpenAPI_eas_server_address_create ( + ip_local_nonprim, + + port->valuedouble + ); + + return eas_server_address_local_var; +end: + if (ip_local_nonprim) { + OpenAPI_ip_addr_free(ip_local_nonprim); + ip_local_nonprim = NULL; + } + return NULL; +} + +OpenAPI_eas_server_address_t *OpenAPI_eas_server_address_copy(OpenAPI_eas_server_address_t *dst, OpenAPI_eas_server_address_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_eas_server_address_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_eas_server_address_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_eas_server_address_free(dst); + dst = OpenAPI_eas_server_address_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/eas_server_address.h b/lib/sbi/openapi/model/eas_server_address.h new file mode 100644 index 000000000..756dae0f3 --- /dev/null +++ b/lib/sbi/openapi/model/eas_server_address.h @@ -0,0 +1,41 @@ +/* + * eas_server_address.h + * + * Represents the IP address and port of an EAS server. + */ + +#ifndef _OpenAPI_eas_server_address_H_ +#define _OpenAPI_eas_server_address_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "ip_addr.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_eas_server_address_s OpenAPI_eas_server_address_t; +typedef struct OpenAPI_eas_server_address_s { + struct OpenAPI_ip_addr_s *ip; + int port; +} OpenAPI_eas_server_address_t; + +OpenAPI_eas_server_address_t *OpenAPI_eas_server_address_create( + OpenAPI_ip_addr_t *ip, + int port +); +void OpenAPI_eas_server_address_free(OpenAPI_eas_server_address_t *eas_server_address); +OpenAPI_eas_server_address_t *OpenAPI_eas_server_address_parseFromJSON(cJSON *eas_server_addressJSON); +cJSON *OpenAPI_eas_server_address_convertToJSON(OpenAPI_eas_server_address_t *eas_server_address); +OpenAPI_eas_server_address_t *OpenAPI_eas_server_address_copy(OpenAPI_eas_server_address_t *dst, OpenAPI_eas_server_address_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_eas_server_address_H_ */ + diff --git a/lib/sbi/openapi/model/easdf_info.c b/lib/sbi/openapi/model/easdf_info.c new file mode 100644 index 000000000..b3efdb73e --- /dev/null +++ b/lib/sbi/openapi/model/easdf_info.c @@ -0,0 +1,267 @@ + +#include +#include +#include +#include "easdf_info.h" + +OpenAPI_easdf_info_t *OpenAPI_easdf_info_create( + OpenAPI_list_t *s_nssai_easdf_info_list, + OpenAPI_list_t *easdf_n6_ip_address_list, + OpenAPI_list_t *upf_n6_ip_address_list +) +{ + OpenAPI_easdf_info_t *easdf_info_local_var = ogs_malloc(sizeof(OpenAPI_easdf_info_t)); + ogs_assert(easdf_info_local_var); + + easdf_info_local_var->s_nssai_easdf_info_list = s_nssai_easdf_info_list; + easdf_info_local_var->easdf_n6_ip_address_list = easdf_n6_ip_address_list; + easdf_info_local_var->upf_n6_ip_address_list = upf_n6_ip_address_list; + + return easdf_info_local_var; +} + +void OpenAPI_easdf_info_free(OpenAPI_easdf_info_t *easdf_info) +{ + OpenAPI_lnode_t *node = NULL; + + if (NULL == easdf_info) { + return; + } + if (easdf_info->s_nssai_easdf_info_list) { + OpenAPI_list_for_each(easdf_info->s_nssai_easdf_info_list, node) { + OpenAPI_snssai_easdf_info_item_free(node->data); + } + OpenAPI_list_free(easdf_info->s_nssai_easdf_info_list); + easdf_info->s_nssai_easdf_info_list = NULL; + } + if (easdf_info->easdf_n6_ip_address_list) { + OpenAPI_list_for_each(easdf_info->easdf_n6_ip_address_list, node) { + OpenAPI_ip_addr_free(node->data); + } + OpenAPI_list_free(easdf_info->easdf_n6_ip_address_list); + easdf_info->easdf_n6_ip_address_list = NULL; + } + if (easdf_info->upf_n6_ip_address_list) { + OpenAPI_list_for_each(easdf_info->upf_n6_ip_address_list, node) { + OpenAPI_ip_addr_free(node->data); + } + OpenAPI_list_free(easdf_info->upf_n6_ip_address_list); + easdf_info->upf_n6_ip_address_list = NULL; + } + ogs_free(easdf_info); +} + +cJSON *OpenAPI_easdf_info_convertToJSON(OpenAPI_easdf_info_t *easdf_info) +{ + cJSON *item = NULL; + OpenAPI_lnode_t *node = NULL; + + if (easdf_info == NULL) { + ogs_error("OpenAPI_easdf_info_convertToJSON() failed [EasdfInfo]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (easdf_info->s_nssai_easdf_info_list) { + cJSON *s_nssai_easdf_info_listList = cJSON_AddArrayToObject(item, "sNssaiEasdfInfoList"); + if (s_nssai_easdf_info_listList == NULL) { + ogs_error("OpenAPI_easdf_info_convertToJSON() failed [s_nssai_easdf_info_list]"); + goto end; + } + OpenAPI_list_for_each(easdf_info->s_nssai_easdf_info_list, node) { + cJSON *itemLocal = OpenAPI_snssai_easdf_info_item_convertToJSON(node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_easdf_info_convertToJSON() failed [s_nssai_easdf_info_list]"); + goto end; + } + cJSON_AddItemToArray(s_nssai_easdf_info_listList, itemLocal); + } + } + + if (easdf_info->easdf_n6_ip_address_list) { + cJSON *easdf_n6_ip_address_listList = cJSON_AddArrayToObject(item, "easdfN6IpAddressList"); + if (easdf_n6_ip_address_listList == NULL) { + ogs_error("OpenAPI_easdf_info_convertToJSON() failed [easdf_n6_ip_address_list]"); + goto end; + } + OpenAPI_list_for_each(easdf_info->easdf_n6_ip_address_list, node) { + cJSON *itemLocal = OpenAPI_ip_addr_convertToJSON(node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_easdf_info_convertToJSON() failed [easdf_n6_ip_address_list]"); + goto end; + } + cJSON_AddItemToArray(easdf_n6_ip_address_listList, itemLocal); + } + } + + if (easdf_info->upf_n6_ip_address_list) { + cJSON *upf_n6_ip_address_listList = cJSON_AddArrayToObject(item, "upfN6IpAddressList"); + if (upf_n6_ip_address_listList == NULL) { + ogs_error("OpenAPI_easdf_info_convertToJSON() failed [upf_n6_ip_address_list]"); + goto end; + } + OpenAPI_list_for_each(easdf_info->upf_n6_ip_address_list, node) { + cJSON *itemLocal = OpenAPI_ip_addr_convertToJSON(node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_easdf_info_convertToJSON() failed [upf_n6_ip_address_list]"); + goto end; + } + cJSON_AddItemToArray(upf_n6_ip_address_listList, itemLocal); + } + } + +end: + return item; +} + +OpenAPI_easdf_info_t *OpenAPI_easdf_info_parseFromJSON(cJSON *easdf_infoJSON) +{ + OpenAPI_easdf_info_t *easdf_info_local_var = NULL; + OpenAPI_lnode_t *node = NULL; + cJSON *s_nssai_easdf_info_list = NULL; + OpenAPI_list_t *s_nssai_easdf_info_listList = NULL; + cJSON *easdf_n6_ip_address_list = NULL; + OpenAPI_list_t *easdf_n6_ip_address_listList = NULL; + cJSON *upf_n6_ip_address_list = NULL; + OpenAPI_list_t *upf_n6_ip_address_listList = NULL; + s_nssai_easdf_info_list = cJSON_GetObjectItemCaseSensitive(easdf_infoJSON, "sNssaiEasdfInfoList"); + if (s_nssai_easdf_info_list) { + cJSON *s_nssai_easdf_info_list_local = NULL; + if (!cJSON_IsArray(s_nssai_easdf_info_list)) { + ogs_error("OpenAPI_easdf_info_parseFromJSON() failed [s_nssai_easdf_info_list]"); + goto end; + } + + s_nssai_easdf_info_listList = OpenAPI_list_create(); + + cJSON_ArrayForEach(s_nssai_easdf_info_list_local, s_nssai_easdf_info_list) { + if (!cJSON_IsObject(s_nssai_easdf_info_list_local)) { + ogs_error("OpenAPI_easdf_info_parseFromJSON() failed [s_nssai_easdf_info_list]"); + goto end; + } + OpenAPI_snssai_easdf_info_item_t *s_nssai_easdf_info_listItem = OpenAPI_snssai_easdf_info_item_parseFromJSON(s_nssai_easdf_info_list_local); + if (!s_nssai_easdf_info_listItem) { + ogs_error("No s_nssai_easdf_info_listItem"); + OpenAPI_list_free(s_nssai_easdf_info_listList); + goto end; + } + OpenAPI_list_add(s_nssai_easdf_info_listList, s_nssai_easdf_info_listItem); + } + } + + easdf_n6_ip_address_list = cJSON_GetObjectItemCaseSensitive(easdf_infoJSON, "easdfN6IpAddressList"); + if (easdf_n6_ip_address_list) { + cJSON *easdf_n6_ip_address_list_local = NULL; + if (!cJSON_IsArray(easdf_n6_ip_address_list)) { + ogs_error("OpenAPI_easdf_info_parseFromJSON() failed [easdf_n6_ip_address_list]"); + goto end; + } + + easdf_n6_ip_address_listList = OpenAPI_list_create(); + + cJSON_ArrayForEach(easdf_n6_ip_address_list_local, easdf_n6_ip_address_list) { + if (!cJSON_IsObject(easdf_n6_ip_address_list_local)) { + ogs_error("OpenAPI_easdf_info_parseFromJSON() failed [easdf_n6_ip_address_list]"); + goto end; + } + OpenAPI_ip_addr_t *easdf_n6_ip_address_listItem = OpenAPI_ip_addr_parseFromJSON(easdf_n6_ip_address_list_local); + if (!easdf_n6_ip_address_listItem) { + ogs_error("No easdf_n6_ip_address_listItem"); + OpenAPI_list_free(easdf_n6_ip_address_listList); + goto end; + } + OpenAPI_list_add(easdf_n6_ip_address_listList, easdf_n6_ip_address_listItem); + } + } + + upf_n6_ip_address_list = cJSON_GetObjectItemCaseSensitive(easdf_infoJSON, "upfN6IpAddressList"); + if (upf_n6_ip_address_list) { + cJSON *upf_n6_ip_address_list_local = NULL; + if (!cJSON_IsArray(upf_n6_ip_address_list)) { + ogs_error("OpenAPI_easdf_info_parseFromJSON() failed [upf_n6_ip_address_list]"); + goto end; + } + + upf_n6_ip_address_listList = OpenAPI_list_create(); + + cJSON_ArrayForEach(upf_n6_ip_address_list_local, upf_n6_ip_address_list) { + if (!cJSON_IsObject(upf_n6_ip_address_list_local)) { + ogs_error("OpenAPI_easdf_info_parseFromJSON() failed [upf_n6_ip_address_list]"); + goto end; + } + OpenAPI_ip_addr_t *upf_n6_ip_address_listItem = OpenAPI_ip_addr_parseFromJSON(upf_n6_ip_address_list_local); + if (!upf_n6_ip_address_listItem) { + ogs_error("No upf_n6_ip_address_listItem"); + OpenAPI_list_free(upf_n6_ip_address_listList); + goto end; + } + OpenAPI_list_add(upf_n6_ip_address_listList, upf_n6_ip_address_listItem); + } + } + + easdf_info_local_var = OpenAPI_easdf_info_create ( + s_nssai_easdf_info_list ? s_nssai_easdf_info_listList : NULL, + easdf_n6_ip_address_list ? easdf_n6_ip_address_listList : NULL, + upf_n6_ip_address_list ? upf_n6_ip_address_listList : NULL + ); + + return easdf_info_local_var; +end: + if (s_nssai_easdf_info_listList) { + OpenAPI_list_for_each(s_nssai_easdf_info_listList, node) { + OpenAPI_snssai_easdf_info_item_free(node->data); + } + OpenAPI_list_free(s_nssai_easdf_info_listList); + s_nssai_easdf_info_listList = NULL; + } + if (easdf_n6_ip_address_listList) { + OpenAPI_list_for_each(easdf_n6_ip_address_listList, node) { + OpenAPI_ip_addr_free(node->data); + } + OpenAPI_list_free(easdf_n6_ip_address_listList); + easdf_n6_ip_address_listList = NULL; + } + if (upf_n6_ip_address_listList) { + OpenAPI_list_for_each(upf_n6_ip_address_listList, node) { + OpenAPI_ip_addr_free(node->data); + } + OpenAPI_list_free(upf_n6_ip_address_listList); + upf_n6_ip_address_listList = NULL; + } + return NULL; +} + +OpenAPI_easdf_info_t *OpenAPI_easdf_info_copy(OpenAPI_easdf_info_t *dst, OpenAPI_easdf_info_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_easdf_info_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_easdf_info_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_easdf_info_free(dst); + dst = OpenAPI_easdf_info_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/easdf_info.h b/lib/sbi/openapi/model/easdf_info.h new file mode 100644 index 000000000..af6b81a17 --- /dev/null +++ b/lib/sbi/openapi/model/easdf_info.h @@ -0,0 +1,44 @@ +/* + * easdf_info.h + * + * Information of an EASDF NF Instance + */ + +#ifndef _OpenAPI_easdf_info_H_ +#define _OpenAPI_easdf_info_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "ip_addr.h" +#include "snssai_easdf_info_item.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_easdf_info_s OpenAPI_easdf_info_t; +typedef struct OpenAPI_easdf_info_s { + OpenAPI_list_t *s_nssai_easdf_info_list; + OpenAPI_list_t *easdf_n6_ip_address_list; + OpenAPI_list_t *upf_n6_ip_address_list; +} OpenAPI_easdf_info_t; + +OpenAPI_easdf_info_t *OpenAPI_easdf_info_create( + OpenAPI_list_t *s_nssai_easdf_info_list, + OpenAPI_list_t *easdf_n6_ip_address_list, + OpenAPI_list_t *upf_n6_ip_address_list +); +void OpenAPI_easdf_info_free(OpenAPI_easdf_info_t *easdf_info); +OpenAPI_easdf_info_t *OpenAPI_easdf_info_parseFromJSON(cJSON *easdf_infoJSON); +cJSON *OpenAPI_easdf_info_convertToJSON(OpenAPI_easdf_info_t *easdf_info); +OpenAPI_easdf_info_t *OpenAPI_easdf_info_copy(OpenAPI_easdf_info_t *dst, OpenAPI_easdf_info_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_easdf_info_H_ */ + diff --git a/lib/sbi/openapi/model/ebi_arp_mapping.h b/lib/sbi/openapi/model/ebi_arp_mapping.h index dd90a03f4..63b03505e 100644 --- a/lib/sbi/openapi/model/ebi_arp_mapping.h +++ b/lib/sbi/openapi/model/ebi_arp_mapping.h @@ -1,7 +1,7 @@ /* * ebi_arp_mapping.h * - * + * EBI to ARP mapping */ #ifndef _OpenAPI_ebi_arp_mapping_H_ diff --git a/lib/sbi/openapi/model/ec_restriction_1.c b/lib/sbi/openapi/model/ec_restriction_1.c new file mode 100644 index 000000000..9ac356d5d --- /dev/null +++ b/lib/sbi/openapi/model/ec_restriction_1.c @@ -0,0 +1,217 @@ + +#include +#include +#include +#include "ec_restriction_1.h" + +OpenAPI_ec_restriction_1_t *OpenAPI_ec_restriction_1_create( + char *af_instance_id, + int reference_id, + OpenAPI_list_t *plmn_ec_infos, + char *mtc_provider_information +) +{ + OpenAPI_ec_restriction_1_t *ec_restriction_1_local_var = ogs_malloc(sizeof(OpenAPI_ec_restriction_1_t)); + ogs_assert(ec_restriction_1_local_var); + + ec_restriction_1_local_var->af_instance_id = af_instance_id; + ec_restriction_1_local_var->reference_id = reference_id; + ec_restriction_1_local_var->plmn_ec_infos = plmn_ec_infos; + ec_restriction_1_local_var->mtc_provider_information = mtc_provider_information; + + return ec_restriction_1_local_var; +} + +void OpenAPI_ec_restriction_1_free(OpenAPI_ec_restriction_1_t *ec_restriction_1) +{ + OpenAPI_lnode_t *node = NULL; + + if (NULL == ec_restriction_1) { + return; + } + if (ec_restriction_1->af_instance_id) { + ogs_free(ec_restriction_1->af_instance_id); + ec_restriction_1->af_instance_id = NULL; + } + if (ec_restriction_1->plmn_ec_infos) { + OpenAPI_list_for_each(ec_restriction_1->plmn_ec_infos, node) { + OpenAPI_plmn_ec_info_1_free(node->data); + } + OpenAPI_list_free(ec_restriction_1->plmn_ec_infos); + ec_restriction_1->plmn_ec_infos = NULL; + } + if (ec_restriction_1->mtc_provider_information) { + ogs_free(ec_restriction_1->mtc_provider_information); + ec_restriction_1->mtc_provider_information = NULL; + } + ogs_free(ec_restriction_1); +} + +cJSON *OpenAPI_ec_restriction_1_convertToJSON(OpenAPI_ec_restriction_1_t *ec_restriction_1) +{ + cJSON *item = NULL; + OpenAPI_lnode_t *node = NULL; + + if (ec_restriction_1 == NULL) { + ogs_error("OpenAPI_ec_restriction_1_convertToJSON() failed [EcRestriction_1]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (!ec_restriction_1->af_instance_id) { + ogs_error("OpenAPI_ec_restriction_1_convertToJSON() failed [af_instance_id]"); + return NULL; + } + if (cJSON_AddStringToObject(item, "afInstanceId", ec_restriction_1->af_instance_id) == NULL) { + ogs_error("OpenAPI_ec_restriction_1_convertToJSON() failed [af_instance_id]"); + goto end; + } + + if (cJSON_AddNumberToObject(item, "referenceId", ec_restriction_1->reference_id) == NULL) { + ogs_error("OpenAPI_ec_restriction_1_convertToJSON() failed [reference_id]"); + goto end; + } + + if (ec_restriction_1->plmn_ec_infos) { + cJSON *plmn_ec_infosList = cJSON_AddArrayToObject(item, "plmnEcInfos"); + if (plmn_ec_infosList == NULL) { + ogs_error("OpenAPI_ec_restriction_1_convertToJSON() failed [plmn_ec_infos]"); + goto end; + } + OpenAPI_list_for_each(ec_restriction_1->plmn_ec_infos, node) { + cJSON *itemLocal = OpenAPI_plmn_ec_info_1_convertToJSON(node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_ec_restriction_1_convertToJSON() failed [plmn_ec_infos]"); + goto end; + } + cJSON_AddItemToArray(plmn_ec_infosList, itemLocal); + } + } + + if (ec_restriction_1->mtc_provider_information) { + if (cJSON_AddStringToObject(item, "mtcProviderInformation", ec_restriction_1->mtc_provider_information) == NULL) { + ogs_error("OpenAPI_ec_restriction_1_convertToJSON() failed [mtc_provider_information]"); + goto end; + } + } + +end: + return item; +} + +OpenAPI_ec_restriction_1_t *OpenAPI_ec_restriction_1_parseFromJSON(cJSON *ec_restriction_1JSON) +{ + OpenAPI_ec_restriction_1_t *ec_restriction_1_local_var = NULL; + OpenAPI_lnode_t *node = NULL; + cJSON *af_instance_id = NULL; + cJSON *reference_id = NULL; + cJSON *plmn_ec_infos = NULL; + OpenAPI_list_t *plmn_ec_infosList = NULL; + cJSON *mtc_provider_information = NULL; + af_instance_id = cJSON_GetObjectItemCaseSensitive(ec_restriction_1JSON, "afInstanceId"); + if (!af_instance_id) { + ogs_error("OpenAPI_ec_restriction_1_parseFromJSON() failed [af_instance_id]"); + goto end; + } + if (!cJSON_IsString(af_instance_id)) { + ogs_error("OpenAPI_ec_restriction_1_parseFromJSON() failed [af_instance_id]"); + goto end; + } + + reference_id = cJSON_GetObjectItemCaseSensitive(ec_restriction_1JSON, "referenceId"); + if (!reference_id) { + ogs_error("OpenAPI_ec_restriction_1_parseFromJSON() failed [reference_id]"); + goto end; + } + if (!cJSON_IsNumber(reference_id)) { + ogs_error("OpenAPI_ec_restriction_1_parseFromJSON() failed [reference_id]"); + goto end; + } + + plmn_ec_infos = cJSON_GetObjectItemCaseSensitive(ec_restriction_1JSON, "plmnEcInfos"); + if (plmn_ec_infos) { + cJSON *plmn_ec_infos_local = NULL; + if (!cJSON_IsArray(plmn_ec_infos)) { + ogs_error("OpenAPI_ec_restriction_1_parseFromJSON() failed [plmn_ec_infos]"); + goto end; + } + + plmn_ec_infosList = OpenAPI_list_create(); + + cJSON_ArrayForEach(plmn_ec_infos_local, plmn_ec_infos) { + if (!cJSON_IsObject(plmn_ec_infos_local)) { + ogs_error("OpenAPI_ec_restriction_1_parseFromJSON() failed [plmn_ec_infos]"); + goto end; + } + OpenAPI_plmn_ec_info_1_t *plmn_ec_infosItem = OpenAPI_plmn_ec_info_1_parseFromJSON(plmn_ec_infos_local); + if (!plmn_ec_infosItem) { + ogs_error("No plmn_ec_infosItem"); + OpenAPI_list_free(plmn_ec_infosList); + goto end; + } + OpenAPI_list_add(plmn_ec_infosList, plmn_ec_infosItem); + } + } + + mtc_provider_information = cJSON_GetObjectItemCaseSensitive(ec_restriction_1JSON, "mtcProviderInformation"); + if (mtc_provider_information) { + if (!cJSON_IsString(mtc_provider_information) && !cJSON_IsNull(mtc_provider_information)) { + ogs_error("OpenAPI_ec_restriction_1_parseFromJSON() failed [mtc_provider_information]"); + goto end; + } + } + + ec_restriction_1_local_var = OpenAPI_ec_restriction_1_create ( + ogs_strdup(af_instance_id->valuestring), + + reference_id->valuedouble, + plmn_ec_infos ? plmn_ec_infosList : NULL, + mtc_provider_information && !cJSON_IsNull(mtc_provider_information) ? ogs_strdup(mtc_provider_information->valuestring) : NULL + ); + + return ec_restriction_1_local_var; +end: + if (plmn_ec_infosList) { + OpenAPI_list_for_each(plmn_ec_infosList, node) { + OpenAPI_plmn_ec_info_1_free(node->data); + } + OpenAPI_list_free(plmn_ec_infosList); + plmn_ec_infosList = NULL; + } + return NULL; +} + +OpenAPI_ec_restriction_1_t *OpenAPI_ec_restriction_1_copy(OpenAPI_ec_restriction_1_t *dst, OpenAPI_ec_restriction_1_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_ec_restriction_1_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_ec_restriction_1_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_ec_restriction_1_free(dst); + dst = OpenAPI_ec_restriction_1_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/ec_restriction_1.h b/lib/sbi/openapi/model/ec_restriction_1.h new file mode 100644 index 000000000..3a6194d7c --- /dev/null +++ b/lib/sbi/openapi/model/ec_restriction_1.h @@ -0,0 +1,45 @@ +/* + * ec_restriction_1.h + * + * + */ + +#ifndef _OpenAPI_ec_restriction_1_H_ +#define _OpenAPI_ec_restriction_1_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "plmn_ec_info_1.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_ec_restriction_1_s OpenAPI_ec_restriction_1_t; +typedef struct OpenAPI_ec_restriction_1_s { + char *af_instance_id; + int reference_id; + OpenAPI_list_t *plmn_ec_infos; + char *mtc_provider_information; +} OpenAPI_ec_restriction_1_t; + +OpenAPI_ec_restriction_1_t *OpenAPI_ec_restriction_1_create( + char *af_instance_id, + int reference_id, + OpenAPI_list_t *plmn_ec_infos, + char *mtc_provider_information +); +void OpenAPI_ec_restriction_1_free(OpenAPI_ec_restriction_1_t *ec_restriction_1); +OpenAPI_ec_restriction_1_t *OpenAPI_ec_restriction_1_parseFromJSON(cJSON *ec_restriction_1JSON); +cJSON *OpenAPI_ec_restriction_1_convertToJSON(OpenAPI_ec_restriction_1_t *ec_restriction_1); +OpenAPI_ec_restriction_1_t *OpenAPI_ec_restriction_1_copy(OpenAPI_ec_restriction_1_t *dst, OpenAPI_ec_restriction_1_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_ec_restriction_1_H_ */ + diff --git a/lib/sbi/openapi/model/ec_restriction_data_wb.h b/lib/sbi/openapi/model/ec_restriction_data_wb.h index 615f8b1ce..95ab3028f 100644 --- a/lib/sbi/openapi/model/ec_restriction_data_wb.h +++ b/lib/sbi/openapi/model/ec_restriction_data_wb.h @@ -1,7 +1,7 @@ /* * ec_restriction_data_wb.h * - * + * Enhanced Coverage Restriction Data for WB-N1 mode */ #ifndef _OpenAPI_ec_restriction_data_wb_H_ diff --git a/lib/sbi/openapi/model/ecgi.h b/lib/sbi/openapi/model/ecgi.h index d41920383..2dfc5d710 100644 --- a/lib/sbi/openapi/model/ecgi.h +++ b/lib/sbi/openapi/model/ecgi.h @@ -1,7 +1,7 @@ /* * ecgi.h * - * + * Contains the ECGI (E-UTRAN Cell Global Identity), as described in 3GPP 23.003 */ #ifndef _OpenAPI_ecgi_H_ diff --git a/lib/sbi/openapi/model/ecgi_1.h b/lib/sbi/openapi/model/ecgi_1.h index f90c1336c..8a5b3e973 100644 --- a/lib/sbi/openapi/model/ecgi_1.h +++ b/lib/sbi/openapi/model/ecgi_1.h @@ -1,7 +1,7 @@ /* * ecgi_1.h * - * + * Contains the ECGI (E-UTRAN Cell Global Identity), as described in 3GPP 23.003 */ #ifndef _OpenAPI_ecgi_1_H_ diff --git a/lib/sbi/openapi/model/ecs_addr_config_info.c b/lib/sbi/openapi/model/ecs_addr_config_info.c new file mode 100644 index 000000000..c2a104e92 --- /dev/null +++ b/lib/sbi/openapi/model/ecs_addr_config_info.c @@ -0,0 +1,149 @@ + +#include +#include +#include +#include "ecs_addr_config_info.h" + +OpenAPI_ecs_addr_config_info_t *OpenAPI_ecs_addr_config_info_create( + OpenAPI_ecs_server_addr_t *ecs_server_addr, + OpenAPI_spatial_validity_cond_t *spatial_validity_cond +) +{ + OpenAPI_ecs_addr_config_info_t *ecs_addr_config_info_local_var = ogs_malloc(sizeof(OpenAPI_ecs_addr_config_info_t)); + ogs_assert(ecs_addr_config_info_local_var); + + ecs_addr_config_info_local_var->ecs_server_addr = ecs_server_addr; + ecs_addr_config_info_local_var->spatial_validity_cond = spatial_validity_cond; + + return ecs_addr_config_info_local_var; +} + +void OpenAPI_ecs_addr_config_info_free(OpenAPI_ecs_addr_config_info_t *ecs_addr_config_info) +{ + OpenAPI_lnode_t *node = NULL; + + if (NULL == ecs_addr_config_info) { + return; + } + if (ecs_addr_config_info->ecs_server_addr) { + OpenAPI_ecs_server_addr_free(ecs_addr_config_info->ecs_server_addr); + ecs_addr_config_info->ecs_server_addr = NULL; + } + if (ecs_addr_config_info->spatial_validity_cond) { + OpenAPI_spatial_validity_cond_free(ecs_addr_config_info->spatial_validity_cond); + ecs_addr_config_info->spatial_validity_cond = NULL; + } + ogs_free(ecs_addr_config_info); +} + +cJSON *OpenAPI_ecs_addr_config_info_convertToJSON(OpenAPI_ecs_addr_config_info_t *ecs_addr_config_info) +{ + cJSON *item = NULL; + OpenAPI_lnode_t *node = NULL; + + if (ecs_addr_config_info == NULL) { + ogs_error("OpenAPI_ecs_addr_config_info_convertToJSON() failed [EcsAddrConfigInfo]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (ecs_addr_config_info->ecs_server_addr) { + cJSON *ecs_server_addr_local_JSON = OpenAPI_ecs_server_addr_convertToJSON(ecs_addr_config_info->ecs_server_addr); + if (ecs_server_addr_local_JSON == NULL) { + ogs_error("OpenAPI_ecs_addr_config_info_convertToJSON() failed [ecs_server_addr]"); + goto end; + } + cJSON_AddItemToObject(item, "ecsServerAddr", ecs_server_addr_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_ecs_addr_config_info_convertToJSON() failed [ecs_server_addr]"); + goto end; + } + } + + if (ecs_addr_config_info->spatial_validity_cond) { + cJSON *spatial_validity_cond_local_JSON = OpenAPI_spatial_validity_cond_convertToJSON(ecs_addr_config_info->spatial_validity_cond); + if (spatial_validity_cond_local_JSON == NULL) { + ogs_error("OpenAPI_ecs_addr_config_info_convertToJSON() failed [spatial_validity_cond]"); + goto end; + } + cJSON_AddItemToObject(item, "spatialValidityCond", spatial_validity_cond_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_ecs_addr_config_info_convertToJSON() failed [spatial_validity_cond]"); + goto end; + } + } + +end: + return item; +} + +OpenAPI_ecs_addr_config_info_t *OpenAPI_ecs_addr_config_info_parseFromJSON(cJSON *ecs_addr_config_infoJSON) +{ + OpenAPI_ecs_addr_config_info_t *ecs_addr_config_info_local_var = NULL; + OpenAPI_lnode_t *node = NULL; + cJSON *ecs_server_addr = NULL; + OpenAPI_ecs_server_addr_t *ecs_server_addr_local_nonprim = NULL; + cJSON *spatial_validity_cond = NULL; + OpenAPI_spatial_validity_cond_t *spatial_validity_cond_local_nonprim = NULL; + ecs_server_addr = cJSON_GetObjectItemCaseSensitive(ecs_addr_config_infoJSON, "ecsServerAddr"); + if (ecs_server_addr) { + ecs_server_addr_local_nonprim = OpenAPI_ecs_server_addr_parseFromJSON(ecs_server_addr); + } + + spatial_validity_cond = cJSON_GetObjectItemCaseSensitive(ecs_addr_config_infoJSON, "spatialValidityCond"); + if (spatial_validity_cond) { + spatial_validity_cond_local_nonprim = OpenAPI_spatial_validity_cond_parseFromJSON(spatial_validity_cond); + } + + ecs_addr_config_info_local_var = OpenAPI_ecs_addr_config_info_create ( + ecs_server_addr ? ecs_server_addr_local_nonprim : NULL, + spatial_validity_cond ? spatial_validity_cond_local_nonprim : NULL + ); + + return ecs_addr_config_info_local_var; +end: + if (ecs_server_addr_local_nonprim) { + OpenAPI_ecs_server_addr_free(ecs_server_addr_local_nonprim); + ecs_server_addr_local_nonprim = NULL; + } + if (spatial_validity_cond_local_nonprim) { + OpenAPI_spatial_validity_cond_free(spatial_validity_cond_local_nonprim); + spatial_validity_cond_local_nonprim = NULL; + } + return NULL; +} + +OpenAPI_ecs_addr_config_info_t *OpenAPI_ecs_addr_config_info_copy(OpenAPI_ecs_addr_config_info_t *dst, OpenAPI_ecs_addr_config_info_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_ecs_addr_config_info_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_ecs_addr_config_info_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_ecs_addr_config_info_free(dst); + dst = OpenAPI_ecs_addr_config_info_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/ecs_addr_config_info.h b/lib/sbi/openapi/model/ecs_addr_config_info.h new file mode 100644 index 000000000..42b08bd48 --- /dev/null +++ b/lib/sbi/openapi/model/ecs_addr_config_info.h @@ -0,0 +1,42 @@ +/* + * ecs_addr_config_info.h + * + * + */ + +#ifndef _OpenAPI_ecs_addr_config_info_H_ +#define _OpenAPI_ecs_addr_config_info_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "ecs_server_addr.h" +#include "spatial_validity_cond.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_ecs_addr_config_info_s OpenAPI_ecs_addr_config_info_t; +typedef struct OpenAPI_ecs_addr_config_info_s { + struct OpenAPI_ecs_server_addr_s *ecs_server_addr; + struct OpenAPI_spatial_validity_cond_s *spatial_validity_cond; +} OpenAPI_ecs_addr_config_info_t; + +OpenAPI_ecs_addr_config_info_t *OpenAPI_ecs_addr_config_info_create( + OpenAPI_ecs_server_addr_t *ecs_server_addr, + OpenAPI_spatial_validity_cond_t *spatial_validity_cond +); +void OpenAPI_ecs_addr_config_info_free(OpenAPI_ecs_addr_config_info_t *ecs_addr_config_info); +OpenAPI_ecs_addr_config_info_t *OpenAPI_ecs_addr_config_info_parseFromJSON(cJSON *ecs_addr_config_infoJSON); +cJSON *OpenAPI_ecs_addr_config_info_convertToJSON(OpenAPI_ecs_addr_config_info_t *ecs_addr_config_info); +OpenAPI_ecs_addr_config_info_t *OpenAPI_ecs_addr_config_info_copy(OpenAPI_ecs_addr_config_info_t *dst, OpenAPI_ecs_addr_config_info_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_ecs_addr_config_info_H_ */ + diff --git a/lib/sbi/openapi/model/ecs_addr_config_info_1.c b/lib/sbi/openapi/model/ecs_addr_config_info_1.c new file mode 100644 index 000000000..68018331d --- /dev/null +++ b/lib/sbi/openapi/model/ecs_addr_config_info_1.c @@ -0,0 +1,149 @@ + +#include +#include +#include +#include "ecs_addr_config_info_1.h" + +OpenAPI_ecs_addr_config_info_1_t *OpenAPI_ecs_addr_config_info_1_create( + OpenAPI_ecs_server_addr_t *ecs_server_addr, + OpenAPI_spatial_validity_cond_1_t *spatial_validity_cond +) +{ + OpenAPI_ecs_addr_config_info_1_t *ecs_addr_config_info_1_local_var = ogs_malloc(sizeof(OpenAPI_ecs_addr_config_info_1_t)); + ogs_assert(ecs_addr_config_info_1_local_var); + + ecs_addr_config_info_1_local_var->ecs_server_addr = ecs_server_addr; + ecs_addr_config_info_1_local_var->spatial_validity_cond = spatial_validity_cond; + + return ecs_addr_config_info_1_local_var; +} + +void OpenAPI_ecs_addr_config_info_1_free(OpenAPI_ecs_addr_config_info_1_t *ecs_addr_config_info_1) +{ + OpenAPI_lnode_t *node = NULL; + + if (NULL == ecs_addr_config_info_1) { + return; + } + if (ecs_addr_config_info_1->ecs_server_addr) { + OpenAPI_ecs_server_addr_free(ecs_addr_config_info_1->ecs_server_addr); + ecs_addr_config_info_1->ecs_server_addr = NULL; + } + if (ecs_addr_config_info_1->spatial_validity_cond) { + OpenAPI_spatial_validity_cond_1_free(ecs_addr_config_info_1->spatial_validity_cond); + ecs_addr_config_info_1->spatial_validity_cond = NULL; + } + ogs_free(ecs_addr_config_info_1); +} + +cJSON *OpenAPI_ecs_addr_config_info_1_convertToJSON(OpenAPI_ecs_addr_config_info_1_t *ecs_addr_config_info_1) +{ + cJSON *item = NULL; + OpenAPI_lnode_t *node = NULL; + + if (ecs_addr_config_info_1 == NULL) { + ogs_error("OpenAPI_ecs_addr_config_info_1_convertToJSON() failed [EcsAddrConfigInfo_1]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (ecs_addr_config_info_1->ecs_server_addr) { + cJSON *ecs_server_addr_local_JSON = OpenAPI_ecs_server_addr_convertToJSON(ecs_addr_config_info_1->ecs_server_addr); + if (ecs_server_addr_local_JSON == NULL) { + ogs_error("OpenAPI_ecs_addr_config_info_1_convertToJSON() failed [ecs_server_addr]"); + goto end; + } + cJSON_AddItemToObject(item, "ecsServerAddr", ecs_server_addr_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_ecs_addr_config_info_1_convertToJSON() failed [ecs_server_addr]"); + goto end; + } + } + + if (ecs_addr_config_info_1->spatial_validity_cond) { + cJSON *spatial_validity_cond_local_JSON = OpenAPI_spatial_validity_cond_1_convertToJSON(ecs_addr_config_info_1->spatial_validity_cond); + if (spatial_validity_cond_local_JSON == NULL) { + ogs_error("OpenAPI_ecs_addr_config_info_1_convertToJSON() failed [spatial_validity_cond]"); + goto end; + } + cJSON_AddItemToObject(item, "spatialValidityCond", spatial_validity_cond_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_ecs_addr_config_info_1_convertToJSON() failed [spatial_validity_cond]"); + goto end; + } + } + +end: + return item; +} + +OpenAPI_ecs_addr_config_info_1_t *OpenAPI_ecs_addr_config_info_1_parseFromJSON(cJSON *ecs_addr_config_info_1JSON) +{ + OpenAPI_ecs_addr_config_info_1_t *ecs_addr_config_info_1_local_var = NULL; + OpenAPI_lnode_t *node = NULL; + cJSON *ecs_server_addr = NULL; + OpenAPI_ecs_server_addr_t *ecs_server_addr_local_nonprim = NULL; + cJSON *spatial_validity_cond = NULL; + OpenAPI_spatial_validity_cond_1_t *spatial_validity_cond_local_nonprim = NULL; + ecs_server_addr = cJSON_GetObjectItemCaseSensitive(ecs_addr_config_info_1JSON, "ecsServerAddr"); + if (ecs_server_addr) { + ecs_server_addr_local_nonprim = OpenAPI_ecs_server_addr_parseFromJSON(ecs_server_addr); + } + + spatial_validity_cond = cJSON_GetObjectItemCaseSensitive(ecs_addr_config_info_1JSON, "spatialValidityCond"); + if (spatial_validity_cond) { + spatial_validity_cond_local_nonprim = OpenAPI_spatial_validity_cond_1_parseFromJSON(spatial_validity_cond); + } + + ecs_addr_config_info_1_local_var = OpenAPI_ecs_addr_config_info_1_create ( + ecs_server_addr ? ecs_server_addr_local_nonprim : NULL, + spatial_validity_cond ? spatial_validity_cond_local_nonprim : NULL + ); + + return ecs_addr_config_info_1_local_var; +end: + if (ecs_server_addr_local_nonprim) { + OpenAPI_ecs_server_addr_free(ecs_server_addr_local_nonprim); + ecs_server_addr_local_nonprim = NULL; + } + if (spatial_validity_cond_local_nonprim) { + OpenAPI_spatial_validity_cond_1_free(spatial_validity_cond_local_nonprim); + spatial_validity_cond_local_nonprim = NULL; + } + return NULL; +} + +OpenAPI_ecs_addr_config_info_1_t *OpenAPI_ecs_addr_config_info_1_copy(OpenAPI_ecs_addr_config_info_1_t *dst, OpenAPI_ecs_addr_config_info_1_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_ecs_addr_config_info_1_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_ecs_addr_config_info_1_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_ecs_addr_config_info_1_free(dst); + dst = OpenAPI_ecs_addr_config_info_1_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/ecs_addr_config_info_1.h b/lib/sbi/openapi/model/ecs_addr_config_info_1.h new file mode 100644 index 000000000..01a2fcdaa --- /dev/null +++ b/lib/sbi/openapi/model/ecs_addr_config_info_1.h @@ -0,0 +1,42 @@ +/* + * ecs_addr_config_info_1.h + * + * + */ + +#ifndef _OpenAPI_ecs_addr_config_info_1_H_ +#define _OpenAPI_ecs_addr_config_info_1_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "ecs_server_addr.h" +#include "spatial_validity_cond_1.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_ecs_addr_config_info_1_s OpenAPI_ecs_addr_config_info_1_t; +typedef struct OpenAPI_ecs_addr_config_info_1_s { + struct OpenAPI_ecs_server_addr_s *ecs_server_addr; + struct OpenAPI_spatial_validity_cond_1_s *spatial_validity_cond; +} OpenAPI_ecs_addr_config_info_1_t; + +OpenAPI_ecs_addr_config_info_1_t *OpenAPI_ecs_addr_config_info_1_create( + OpenAPI_ecs_server_addr_t *ecs_server_addr, + OpenAPI_spatial_validity_cond_1_t *spatial_validity_cond +); +void OpenAPI_ecs_addr_config_info_1_free(OpenAPI_ecs_addr_config_info_1_t *ecs_addr_config_info_1); +OpenAPI_ecs_addr_config_info_1_t *OpenAPI_ecs_addr_config_info_1_parseFromJSON(cJSON *ecs_addr_config_info_1JSON); +cJSON *OpenAPI_ecs_addr_config_info_1_convertToJSON(OpenAPI_ecs_addr_config_info_1_t *ecs_addr_config_info_1); +OpenAPI_ecs_addr_config_info_1_t *OpenAPI_ecs_addr_config_info_1_copy(OpenAPI_ecs_addr_config_info_1_t *dst, OpenAPI_ecs_addr_config_info_1_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_ecs_addr_config_info_1_H_ */ + diff --git a/lib/sbi/openapi/model/ecs_server_addr.c b/lib/sbi/openapi/model/ecs_server_addr.c new file mode 100644 index 000000000..913c5cdbc --- /dev/null +++ b/lib/sbi/openapi/model/ecs_server_addr.c @@ -0,0 +1,278 @@ + +#include +#include +#include +#include "ecs_server_addr.h" + +OpenAPI_ecs_server_addr_t *OpenAPI_ecs_server_addr_create( + OpenAPI_list_t *ecs_fqdn_list, + OpenAPI_list_t *ecs_ip_address_list, + OpenAPI_list_t *ecs_uri_list, + char *ecs_provider_id +) +{ + OpenAPI_ecs_server_addr_t *ecs_server_addr_local_var = ogs_malloc(sizeof(OpenAPI_ecs_server_addr_t)); + ogs_assert(ecs_server_addr_local_var); + + ecs_server_addr_local_var->ecs_fqdn_list = ecs_fqdn_list; + ecs_server_addr_local_var->ecs_ip_address_list = ecs_ip_address_list; + ecs_server_addr_local_var->ecs_uri_list = ecs_uri_list; + ecs_server_addr_local_var->ecs_provider_id = ecs_provider_id; + + return ecs_server_addr_local_var; +} + +void OpenAPI_ecs_server_addr_free(OpenAPI_ecs_server_addr_t *ecs_server_addr) +{ + OpenAPI_lnode_t *node = NULL; + + if (NULL == ecs_server_addr) { + return; + } + if (ecs_server_addr->ecs_fqdn_list) { + OpenAPI_list_for_each(ecs_server_addr->ecs_fqdn_list, node) { + ogs_free(node->data); + } + OpenAPI_list_free(ecs_server_addr->ecs_fqdn_list); + ecs_server_addr->ecs_fqdn_list = NULL; + } + if (ecs_server_addr->ecs_ip_address_list) { + OpenAPI_list_for_each(ecs_server_addr->ecs_ip_address_list, node) { + OpenAPI_ip_addr_free(node->data); + } + OpenAPI_list_free(ecs_server_addr->ecs_ip_address_list); + ecs_server_addr->ecs_ip_address_list = NULL; + } + if (ecs_server_addr->ecs_uri_list) { + OpenAPI_list_for_each(ecs_server_addr->ecs_uri_list, node) { + ogs_free(node->data); + } + OpenAPI_list_free(ecs_server_addr->ecs_uri_list); + ecs_server_addr->ecs_uri_list = NULL; + } + if (ecs_server_addr->ecs_provider_id) { + ogs_free(ecs_server_addr->ecs_provider_id); + ecs_server_addr->ecs_provider_id = NULL; + } + ogs_free(ecs_server_addr); +} + +cJSON *OpenAPI_ecs_server_addr_convertToJSON(OpenAPI_ecs_server_addr_t *ecs_server_addr) +{ + cJSON *item = NULL; + OpenAPI_lnode_t *node = NULL; + + if (ecs_server_addr == NULL) { + ogs_error("OpenAPI_ecs_server_addr_convertToJSON() failed [EcsServerAddr]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (ecs_server_addr->ecs_fqdn_list) { + cJSON *ecs_fqdn_listList = cJSON_AddArrayToObject(item, "ecsFqdnList"); + if (ecs_fqdn_listList == NULL) { + ogs_error("OpenAPI_ecs_server_addr_convertToJSON() failed [ecs_fqdn_list]"); + goto end; + } + OpenAPI_list_for_each(ecs_server_addr->ecs_fqdn_list, node) { + if (cJSON_AddStringToObject(ecs_fqdn_listList, "", (char*)node->data) == NULL) { + ogs_error("OpenAPI_ecs_server_addr_convertToJSON() failed [ecs_fqdn_list]"); + goto end; + } + } + } + + if (ecs_server_addr->ecs_ip_address_list) { + cJSON *ecs_ip_address_listList = cJSON_AddArrayToObject(item, "ecsIpAddressList"); + if (ecs_ip_address_listList == NULL) { + ogs_error("OpenAPI_ecs_server_addr_convertToJSON() failed [ecs_ip_address_list]"); + goto end; + } + OpenAPI_list_for_each(ecs_server_addr->ecs_ip_address_list, node) { + cJSON *itemLocal = OpenAPI_ip_addr_convertToJSON(node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_ecs_server_addr_convertToJSON() failed [ecs_ip_address_list]"); + goto end; + } + cJSON_AddItemToArray(ecs_ip_address_listList, itemLocal); + } + } + + if (ecs_server_addr->ecs_uri_list) { + cJSON *ecs_uri_listList = cJSON_AddArrayToObject(item, "ecsUriList"); + if (ecs_uri_listList == NULL) { + ogs_error("OpenAPI_ecs_server_addr_convertToJSON() failed [ecs_uri_list]"); + goto end; + } + OpenAPI_list_for_each(ecs_server_addr->ecs_uri_list, node) { + if (cJSON_AddStringToObject(ecs_uri_listList, "", (char*)node->data) == NULL) { + ogs_error("OpenAPI_ecs_server_addr_convertToJSON() failed [ecs_uri_list]"); + goto end; + } + } + } + + if (ecs_server_addr->ecs_provider_id) { + if (cJSON_AddStringToObject(item, "ecsProviderId", ecs_server_addr->ecs_provider_id) == NULL) { + ogs_error("OpenAPI_ecs_server_addr_convertToJSON() failed [ecs_provider_id]"); + goto end; + } + } + +end: + return item; +} + +OpenAPI_ecs_server_addr_t *OpenAPI_ecs_server_addr_parseFromJSON(cJSON *ecs_server_addrJSON) +{ + OpenAPI_ecs_server_addr_t *ecs_server_addr_local_var = NULL; + OpenAPI_lnode_t *node = NULL; + cJSON *ecs_fqdn_list = NULL; + OpenAPI_list_t *ecs_fqdn_listList = NULL; + cJSON *ecs_ip_address_list = NULL; + OpenAPI_list_t *ecs_ip_address_listList = NULL; + cJSON *ecs_uri_list = NULL; + OpenAPI_list_t *ecs_uri_listList = NULL; + cJSON *ecs_provider_id = NULL; + ecs_fqdn_list = cJSON_GetObjectItemCaseSensitive(ecs_server_addrJSON, "ecsFqdnList"); + if (ecs_fqdn_list) { + cJSON *ecs_fqdn_list_local = NULL; + if (!cJSON_IsArray(ecs_fqdn_list)) { + ogs_error("OpenAPI_ecs_server_addr_parseFromJSON() failed [ecs_fqdn_list]"); + goto end; + } + + ecs_fqdn_listList = OpenAPI_list_create(); + + cJSON_ArrayForEach(ecs_fqdn_list_local, ecs_fqdn_list) { + double *localDouble = NULL; + int *localInt = NULL; + if (!cJSON_IsString(ecs_fqdn_list_local)) { + ogs_error("OpenAPI_ecs_server_addr_parseFromJSON() failed [ecs_fqdn_list]"); + goto end; + } + OpenAPI_list_add(ecs_fqdn_listList, ogs_strdup(ecs_fqdn_list_local->valuestring)); + } + } + + ecs_ip_address_list = cJSON_GetObjectItemCaseSensitive(ecs_server_addrJSON, "ecsIpAddressList"); + if (ecs_ip_address_list) { + cJSON *ecs_ip_address_list_local = NULL; + if (!cJSON_IsArray(ecs_ip_address_list)) { + ogs_error("OpenAPI_ecs_server_addr_parseFromJSON() failed [ecs_ip_address_list]"); + goto end; + } + + ecs_ip_address_listList = OpenAPI_list_create(); + + cJSON_ArrayForEach(ecs_ip_address_list_local, ecs_ip_address_list) { + if (!cJSON_IsObject(ecs_ip_address_list_local)) { + ogs_error("OpenAPI_ecs_server_addr_parseFromJSON() failed [ecs_ip_address_list]"); + goto end; + } + OpenAPI_ip_addr_t *ecs_ip_address_listItem = OpenAPI_ip_addr_parseFromJSON(ecs_ip_address_list_local); + if (!ecs_ip_address_listItem) { + ogs_error("No ecs_ip_address_listItem"); + OpenAPI_list_free(ecs_ip_address_listList); + goto end; + } + OpenAPI_list_add(ecs_ip_address_listList, ecs_ip_address_listItem); + } + } + + ecs_uri_list = cJSON_GetObjectItemCaseSensitive(ecs_server_addrJSON, "ecsUriList"); + if (ecs_uri_list) { + cJSON *ecs_uri_list_local = NULL; + if (!cJSON_IsArray(ecs_uri_list)) { + ogs_error("OpenAPI_ecs_server_addr_parseFromJSON() failed [ecs_uri_list]"); + goto end; + } + + ecs_uri_listList = OpenAPI_list_create(); + + cJSON_ArrayForEach(ecs_uri_list_local, ecs_uri_list) { + double *localDouble = NULL; + int *localInt = NULL; + if (!cJSON_IsString(ecs_uri_list_local)) { + ogs_error("OpenAPI_ecs_server_addr_parseFromJSON() failed [ecs_uri_list]"); + goto end; + } + OpenAPI_list_add(ecs_uri_listList, ogs_strdup(ecs_uri_list_local->valuestring)); + } + } + + ecs_provider_id = cJSON_GetObjectItemCaseSensitive(ecs_server_addrJSON, "ecsProviderId"); + if (ecs_provider_id) { + if (!cJSON_IsString(ecs_provider_id) && !cJSON_IsNull(ecs_provider_id)) { + ogs_error("OpenAPI_ecs_server_addr_parseFromJSON() failed [ecs_provider_id]"); + goto end; + } + } + + ecs_server_addr_local_var = OpenAPI_ecs_server_addr_create ( + ecs_fqdn_list ? ecs_fqdn_listList : NULL, + ecs_ip_address_list ? ecs_ip_address_listList : NULL, + ecs_uri_list ? ecs_uri_listList : NULL, + ecs_provider_id && !cJSON_IsNull(ecs_provider_id) ? ogs_strdup(ecs_provider_id->valuestring) : NULL + ); + + return ecs_server_addr_local_var; +end: + if (ecs_fqdn_listList) { + OpenAPI_list_for_each(ecs_fqdn_listList, node) { + ogs_free(node->data); + } + OpenAPI_list_free(ecs_fqdn_listList); + ecs_fqdn_listList = NULL; + } + if (ecs_ip_address_listList) { + OpenAPI_list_for_each(ecs_ip_address_listList, node) { + OpenAPI_ip_addr_free(node->data); + } + OpenAPI_list_free(ecs_ip_address_listList); + ecs_ip_address_listList = NULL; + } + if (ecs_uri_listList) { + OpenAPI_list_for_each(ecs_uri_listList, node) { + ogs_free(node->data); + } + OpenAPI_list_free(ecs_uri_listList); + ecs_uri_listList = NULL; + } + return NULL; +} + +OpenAPI_ecs_server_addr_t *OpenAPI_ecs_server_addr_copy(OpenAPI_ecs_server_addr_t *dst, OpenAPI_ecs_server_addr_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_ecs_server_addr_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_ecs_server_addr_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_ecs_server_addr_free(dst); + dst = OpenAPI_ecs_server_addr_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/ecs_server_addr.h b/lib/sbi/openapi/model/ecs_server_addr.h new file mode 100644 index 000000000..2e9277c38 --- /dev/null +++ b/lib/sbi/openapi/model/ecs_server_addr.h @@ -0,0 +1,45 @@ +/* + * ecs_server_addr.h + * + * Contains the Edge Configuration Server Address Configuration Information as defined in clause 5.2.3.6.1 of 3GPP TS 23.502. + */ + +#ifndef _OpenAPI_ecs_server_addr_H_ +#define _OpenAPI_ecs_server_addr_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "ip_addr.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_ecs_server_addr_s OpenAPI_ecs_server_addr_t; +typedef struct OpenAPI_ecs_server_addr_s { + OpenAPI_list_t *ecs_fqdn_list; + OpenAPI_list_t *ecs_ip_address_list; + OpenAPI_list_t *ecs_uri_list; + char *ecs_provider_id; +} OpenAPI_ecs_server_addr_t; + +OpenAPI_ecs_server_addr_t *OpenAPI_ecs_server_addr_create( + OpenAPI_list_t *ecs_fqdn_list, + OpenAPI_list_t *ecs_ip_address_list, + OpenAPI_list_t *ecs_uri_list, + char *ecs_provider_id +); +void OpenAPI_ecs_server_addr_free(OpenAPI_ecs_server_addr_t *ecs_server_addr); +OpenAPI_ecs_server_addr_t *OpenAPI_ecs_server_addr_parseFromJSON(cJSON *ecs_server_addrJSON); +cJSON *OpenAPI_ecs_server_addr_convertToJSON(OpenAPI_ecs_server_addr_t *ecs_server_addr); +OpenAPI_ecs_server_addr_t *OpenAPI_ecs_server_addr_copy(OpenAPI_ecs_server_addr_t *dst, OpenAPI_ecs_server_addr_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_ecs_server_addr_H_ */ + diff --git a/lib/sbi/openapi/model/ee_group_profile_data.c b/lib/sbi/openapi/model/ee_group_profile_data.c index 25cbbed05..f93dc5b70 100644 --- a/lib/sbi/openapi/model/ee_group_profile_data.c +++ b/lib/sbi/openapi/model/ee_group_profile_data.c @@ -7,7 +7,11 @@ OpenAPI_ee_group_profile_data_t *OpenAPI_ee_group_profile_data_create( OpenAPI_list_t *restricted_event_types, OpenAPI_list_t* allowed_mtc_provider, - char *supported_features + char *supported_features, + bool is_iwk_epc_restricted, + int iwk_epc_restricted, + char *ext_group_id, + char *hss_group_id ) { OpenAPI_ee_group_profile_data_t *ee_group_profile_data_local_var = ogs_malloc(sizeof(OpenAPI_ee_group_profile_data_t)); @@ -16,6 +20,10 @@ OpenAPI_ee_group_profile_data_t *OpenAPI_ee_group_profile_data_create( ee_group_profile_data_local_var->restricted_event_types = restricted_event_types; ee_group_profile_data_local_var->allowed_mtc_provider = allowed_mtc_provider; ee_group_profile_data_local_var->supported_features = supported_features; + ee_group_profile_data_local_var->is_iwk_epc_restricted = is_iwk_epc_restricted; + ee_group_profile_data_local_var->iwk_epc_restricted = iwk_epc_restricted; + ee_group_profile_data_local_var->ext_group_id = ext_group_id; + ee_group_profile_data_local_var->hss_group_id = hss_group_id; return ee_group_profile_data_local_var; } @@ -48,6 +56,14 @@ void OpenAPI_ee_group_profile_data_free(OpenAPI_ee_group_profile_data_t *ee_grou ogs_free(ee_group_profile_data->supported_features); ee_group_profile_data->supported_features = NULL; } + if (ee_group_profile_data->ext_group_id) { + ogs_free(ee_group_profile_data->ext_group_id); + ee_group_profile_data->ext_group_id = NULL; + } + if (ee_group_profile_data->hss_group_id) { + ogs_free(ee_group_profile_data->hss_group_id); + ee_group_profile_data->hss_group_id = NULL; + } ogs_free(ee_group_profile_data); } @@ -107,6 +123,27 @@ cJSON *OpenAPI_ee_group_profile_data_convertToJSON(OpenAPI_ee_group_profile_data } } + if (ee_group_profile_data->is_iwk_epc_restricted) { + if (cJSON_AddBoolToObject(item, "iwkEpcRestricted", ee_group_profile_data->iwk_epc_restricted) == NULL) { + ogs_error("OpenAPI_ee_group_profile_data_convertToJSON() failed [iwk_epc_restricted]"); + goto end; + } + } + + if (ee_group_profile_data->ext_group_id) { + if (cJSON_AddStringToObject(item, "extGroupId", ee_group_profile_data->ext_group_id) == NULL) { + ogs_error("OpenAPI_ee_group_profile_data_convertToJSON() failed [ext_group_id]"); + goto end; + } + } + + if (ee_group_profile_data->hss_group_id) { + if (cJSON_AddStringToObject(item, "hssGroupId", ee_group_profile_data->hss_group_id) == NULL) { + ogs_error("OpenAPI_ee_group_profile_data_convertToJSON() failed [hss_group_id]"); + goto end; + } + } + end: return item; } @@ -120,6 +157,9 @@ OpenAPI_ee_group_profile_data_t *OpenAPI_ee_group_profile_data_parseFromJSON(cJS cJSON *allowed_mtc_provider = NULL; OpenAPI_list_t *allowed_mtc_providerList = NULL; cJSON *supported_features = NULL; + cJSON *iwk_epc_restricted = NULL; + cJSON *ext_group_id = NULL; + cJSON *hss_group_id = NULL; restricted_event_types = cJSON_GetObjectItemCaseSensitive(ee_group_profile_dataJSON, "restrictedEventTypes"); if (restricted_event_types) { cJSON *restricted_event_types_local = NULL; @@ -181,10 +221,38 @@ OpenAPI_ee_group_profile_data_t *OpenAPI_ee_group_profile_data_parseFromJSON(cJS } } + iwk_epc_restricted = cJSON_GetObjectItemCaseSensitive(ee_group_profile_dataJSON, "iwkEpcRestricted"); + if (iwk_epc_restricted) { + if (!cJSON_IsBool(iwk_epc_restricted)) { + ogs_error("OpenAPI_ee_group_profile_data_parseFromJSON() failed [iwk_epc_restricted]"); + goto end; + } + } + + ext_group_id = cJSON_GetObjectItemCaseSensitive(ee_group_profile_dataJSON, "extGroupId"); + if (ext_group_id) { + if (!cJSON_IsString(ext_group_id) && !cJSON_IsNull(ext_group_id)) { + ogs_error("OpenAPI_ee_group_profile_data_parseFromJSON() failed [ext_group_id]"); + goto end; + } + } + + hss_group_id = cJSON_GetObjectItemCaseSensitive(ee_group_profile_dataJSON, "hssGroupId"); + if (hss_group_id) { + if (!cJSON_IsString(hss_group_id) && !cJSON_IsNull(hss_group_id)) { + ogs_error("OpenAPI_ee_group_profile_data_parseFromJSON() failed [hss_group_id]"); + goto end; + } + } + ee_group_profile_data_local_var = OpenAPI_ee_group_profile_data_create ( restricted_event_types ? restricted_event_typesList : NULL, allowed_mtc_provider ? allowed_mtc_providerList : NULL, - supported_features && !cJSON_IsNull(supported_features) ? ogs_strdup(supported_features->valuestring) : NULL + supported_features && !cJSON_IsNull(supported_features) ? ogs_strdup(supported_features->valuestring) : NULL, + iwk_epc_restricted ? true : false, + iwk_epc_restricted ? iwk_epc_restricted->valueint : 0, + ext_group_id && !cJSON_IsNull(ext_group_id) ? ogs_strdup(ext_group_id->valuestring) : NULL, + hss_group_id && !cJSON_IsNull(hss_group_id) ? ogs_strdup(hss_group_id->valuestring) : NULL ); return ee_group_profile_data_local_var; diff --git a/lib/sbi/openapi/model/ee_group_profile_data.h b/lib/sbi/openapi/model/ee_group_profile_data.h index cd45cbd11..ed2c40bc8 100644 --- a/lib/sbi/openapi/model/ee_group_profile_data.h +++ b/lib/sbi/openapi/model/ee_group_profile_data.h @@ -24,12 +24,20 @@ typedef struct OpenAPI_ee_group_profile_data_s { OpenAPI_list_t *restricted_event_types; OpenAPI_list_t* allowed_mtc_provider; char *supported_features; + bool is_iwk_epc_restricted; + int iwk_epc_restricted; + char *ext_group_id; + char *hss_group_id; } OpenAPI_ee_group_profile_data_t; OpenAPI_ee_group_profile_data_t *OpenAPI_ee_group_profile_data_create( OpenAPI_list_t *restricted_event_types, OpenAPI_list_t* allowed_mtc_provider, - char *supported_features + char *supported_features, + bool is_iwk_epc_restricted, + int iwk_epc_restricted, + char *ext_group_id, + char *hss_group_id ); void OpenAPI_ee_group_profile_data_free(OpenAPI_ee_group_profile_data_t *ee_group_profile_data); OpenAPI_ee_group_profile_data_t *OpenAPI_ee_group_profile_data_parseFromJSON(cJSON *ee_group_profile_dataJSON); diff --git a/lib/sbi/openapi/model/ee_profile_data.c b/lib/sbi/openapi/model/ee_profile_data.c index 132bb2f6b..6f2d8ea83 100644 --- a/lib/sbi/openapi/model/ee_profile_data.c +++ b/lib/sbi/openapi/model/ee_profile_data.c @@ -7,7 +7,11 @@ OpenAPI_ee_profile_data_t *OpenAPI_ee_profile_data_create( OpenAPI_list_t *restricted_event_types, char *supported_features, - OpenAPI_list_t* allowed_mtc_provider + OpenAPI_list_t* allowed_mtc_provider, + bool is_iwk_epc_restricted, + int iwk_epc_restricted, + char *imsi, + char *hss_group_id ) { OpenAPI_ee_profile_data_t *ee_profile_data_local_var = ogs_malloc(sizeof(OpenAPI_ee_profile_data_t)); @@ -16,6 +20,10 @@ OpenAPI_ee_profile_data_t *OpenAPI_ee_profile_data_create( ee_profile_data_local_var->restricted_event_types = restricted_event_types; ee_profile_data_local_var->supported_features = supported_features; ee_profile_data_local_var->allowed_mtc_provider = allowed_mtc_provider; + ee_profile_data_local_var->is_iwk_epc_restricted = is_iwk_epc_restricted; + ee_profile_data_local_var->iwk_epc_restricted = iwk_epc_restricted; + ee_profile_data_local_var->imsi = imsi; + ee_profile_data_local_var->hss_group_id = hss_group_id; return ee_profile_data_local_var; } @@ -48,6 +56,14 @@ void OpenAPI_ee_profile_data_free(OpenAPI_ee_profile_data_t *ee_profile_data) OpenAPI_list_free(ee_profile_data->allowed_mtc_provider); ee_profile_data->allowed_mtc_provider = NULL; } + if (ee_profile_data->imsi) { + ogs_free(ee_profile_data->imsi); + ee_profile_data->imsi = NULL; + } + if (ee_profile_data->hss_group_id) { + ogs_free(ee_profile_data->hss_group_id); + ee_profile_data->hss_group_id = NULL; + } ogs_free(ee_profile_data); } @@ -107,6 +123,27 @@ cJSON *OpenAPI_ee_profile_data_convertToJSON(OpenAPI_ee_profile_data_t *ee_profi } } + if (ee_profile_data->is_iwk_epc_restricted) { + if (cJSON_AddBoolToObject(item, "iwkEpcRestricted", ee_profile_data->iwk_epc_restricted) == NULL) { + ogs_error("OpenAPI_ee_profile_data_convertToJSON() failed [iwk_epc_restricted]"); + goto end; + } + } + + if (ee_profile_data->imsi) { + if (cJSON_AddStringToObject(item, "imsi", ee_profile_data->imsi) == NULL) { + ogs_error("OpenAPI_ee_profile_data_convertToJSON() failed [imsi]"); + goto end; + } + } + + if (ee_profile_data->hss_group_id) { + if (cJSON_AddStringToObject(item, "hssGroupId", ee_profile_data->hss_group_id) == NULL) { + ogs_error("OpenAPI_ee_profile_data_convertToJSON() failed [hss_group_id]"); + goto end; + } + } + end: return item; } @@ -120,6 +157,9 @@ OpenAPI_ee_profile_data_t *OpenAPI_ee_profile_data_parseFromJSON(cJSON *ee_profi cJSON *supported_features = NULL; cJSON *allowed_mtc_provider = NULL; OpenAPI_list_t *allowed_mtc_providerList = NULL; + cJSON *iwk_epc_restricted = NULL; + cJSON *imsi = NULL; + cJSON *hss_group_id = NULL; restricted_event_types = cJSON_GetObjectItemCaseSensitive(ee_profile_dataJSON, "restrictedEventTypes"); if (restricted_event_types) { cJSON *restricted_event_types_local = NULL; @@ -181,10 +221,38 @@ OpenAPI_ee_profile_data_t *OpenAPI_ee_profile_data_parseFromJSON(cJSON *ee_profi } } + iwk_epc_restricted = cJSON_GetObjectItemCaseSensitive(ee_profile_dataJSON, "iwkEpcRestricted"); + if (iwk_epc_restricted) { + if (!cJSON_IsBool(iwk_epc_restricted)) { + ogs_error("OpenAPI_ee_profile_data_parseFromJSON() failed [iwk_epc_restricted]"); + goto end; + } + } + + imsi = cJSON_GetObjectItemCaseSensitive(ee_profile_dataJSON, "imsi"); + if (imsi) { + if (!cJSON_IsString(imsi) && !cJSON_IsNull(imsi)) { + ogs_error("OpenAPI_ee_profile_data_parseFromJSON() failed [imsi]"); + goto end; + } + } + + hss_group_id = cJSON_GetObjectItemCaseSensitive(ee_profile_dataJSON, "hssGroupId"); + if (hss_group_id) { + if (!cJSON_IsString(hss_group_id) && !cJSON_IsNull(hss_group_id)) { + ogs_error("OpenAPI_ee_profile_data_parseFromJSON() failed [hss_group_id]"); + goto end; + } + } + ee_profile_data_local_var = OpenAPI_ee_profile_data_create ( restricted_event_types ? restricted_event_typesList : NULL, supported_features && !cJSON_IsNull(supported_features) ? ogs_strdup(supported_features->valuestring) : NULL, - allowed_mtc_provider ? allowed_mtc_providerList : NULL + allowed_mtc_provider ? allowed_mtc_providerList : NULL, + iwk_epc_restricted ? true : false, + iwk_epc_restricted ? iwk_epc_restricted->valueint : 0, + imsi && !cJSON_IsNull(imsi) ? ogs_strdup(imsi->valuestring) : NULL, + hss_group_id && !cJSON_IsNull(hss_group_id) ? ogs_strdup(hss_group_id->valuestring) : NULL ); return ee_profile_data_local_var; diff --git a/lib/sbi/openapi/model/ee_profile_data.h b/lib/sbi/openapi/model/ee_profile_data.h index ee6009da0..9469513bc 100644 --- a/lib/sbi/openapi/model/ee_profile_data.h +++ b/lib/sbi/openapi/model/ee_profile_data.h @@ -1,7 +1,7 @@ /* * ee_profile_data.h * - * + * Event Exposure Profile Data. */ #ifndef _OpenAPI_ee_profile_data_H_ @@ -24,12 +24,20 @@ typedef struct OpenAPI_ee_profile_data_s { OpenAPI_list_t *restricted_event_types; char *supported_features; OpenAPI_list_t* allowed_mtc_provider; + bool is_iwk_epc_restricted; + int iwk_epc_restricted; + char *imsi; + char *hss_group_id; } OpenAPI_ee_profile_data_t; OpenAPI_ee_profile_data_t *OpenAPI_ee_profile_data_create( OpenAPI_list_t *restricted_event_types, char *supported_features, - OpenAPI_list_t* allowed_mtc_provider + OpenAPI_list_t* allowed_mtc_provider, + bool is_iwk_epc_restricted, + int iwk_epc_restricted, + char *imsi, + char *hss_group_id ); void OpenAPI_ee_profile_data_free(OpenAPI_ee_profile_data_t *ee_profile_data); OpenAPI_ee_profile_data_t *OpenAPI_ee_profile_data_parseFromJSON(cJSON *ee_profile_dataJSON); diff --git a/lib/sbi/openapi/model/ee_subscription.c b/lib/sbi/openapi/model/ee_subscription.c index 01d0c2cc2..b687ac840 100644 --- a/lib/sbi/openapi/model/ee_subscription.c +++ b/lib/sbi/openapi/model/ee_subscription.c @@ -15,7 +15,12 @@ OpenAPI_ee_subscription_t *OpenAPI_ee_subscription_create( int epc_applied_ind, char *scef_diam_host, char *scef_diam_realm, - char *notify_correlation_id + char *notify_correlation_id, + char *second_callback_ref, + char *gpsi, + OpenAPI_list_t *exclude_gpsi_list, + OpenAPI_list_t *include_gpsi_list, + char *data_restoration_callback_uri ) { OpenAPI_ee_subscription_t *ee_subscription_local_var = ogs_malloc(sizeof(OpenAPI_ee_subscription_t)); @@ -32,6 +37,11 @@ OpenAPI_ee_subscription_t *OpenAPI_ee_subscription_create( ee_subscription_local_var->scef_diam_host = scef_diam_host; ee_subscription_local_var->scef_diam_realm = scef_diam_realm; ee_subscription_local_var->notify_correlation_id = notify_correlation_id; + ee_subscription_local_var->second_callback_ref = second_callback_ref; + ee_subscription_local_var->gpsi = gpsi; + ee_subscription_local_var->exclude_gpsi_list = exclude_gpsi_list; + ee_subscription_local_var->include_gpsi_list = include_gpsi_list; + ee_subscription_local_var->data_restoration_callback_uri = data_restoration_callback_uri; return ee_subscription_local_var; } @@ -85,6 +95,32 @@ void OpenAPI_ee_subscription_free(OpenAPI_ee_subscription_t *ee_subscription) ogs_free(ee_subscription->notify_correlation_id); ee_subscription->notify_correlation_id = NULL; } + if (ee_subscription->second_callback_ref) { + ogs_free(ee_subscription->second_callback_ref); + ee_subscription->second_callback_ref = NULL; + } + if (ee_subscription->gpsi) { + ogs_free(ee_subscription->gpsi); + ee_subscription->gpsi = NULL; + } + if (ee_subscription->exclude_gpsi_list) { + OpenAPI_list_for_each(ee_subscription->exclude_gpsi_list, node) { + ogs_free(node->data); + } + OpenAPI_list_free(ee_subscription->exclude_gpsi_list); + ee_subscription->exclude_gpsi_list = NULL; + } + if (ee_subscription->include_gpsi_list) { + OpenAPI_list_for_each(ee_subscription->include_gpsi_list, node) { + ogs_free(node->data); + } + OpenAPI_list_free(ee_subscription->include_gpsi_list); + ee_subscription->include_gpsi_list = NULL; + } + if (ee_subscription->data_restoration_callback_uri) { + ogs_free(ee_subscription->data_restoration_callback_uri); + ee_subscription->data_restoration_callback_uri = NULL; + } ogs_free(ee_subscription); } @@ -200,6 +236,55 @@ cJSON *OpenAPI_ee_subscription_convertToJSON(OpenAPI_ee_subscription_t *ee_subsc } } + if (ee_subscription->second_callback_ref) { + if (cJSON_AddStringToObject(item, "secondCallbackRef", ee_subscription->second_callback_ref) == NULL) { + ogs_error("OpenAPI_ee_subscription_convertToJSON() failed [second_callback_ref]"); + goto end; + } + } + + if (ee_subscription->gpsi) { + if (cJSON_AddStringToObject(item, "gpsi", ee_subscription->gpsi) == NULL) { + ogs_error("OpenAPI_ee_subscription_convertToJSON() failed [gpsi]"); + goto end; + } + } + + if (ee_subscription->exclude_gpsi_list) { + cJSON *exclude_gpsi_listList = cJSON_AddArrayToObject(item, "excludeGpsiList"); + if (exclude_gpsi_listList == NULL) { + ogs_error("OpenAPI_ee_subscription_convertToJSON() failed [exclude_gpsi_list]"); + goto end; + } + OpenAPI_list_for_each(ee_subscription->exclude_gpsi_list, node) { + if (cJSON_AddStringToObject(exclude_gpsi_listList, "", (char*)node->data) == NULL) { + ogs_error("OpenAPI_ee_subscription_convertToJSON() failed [exclude_gpsi_list]"); + goto end; + } + } + } + + if (ee_subscription->include_gpsi_list) { + cJSON *include_gpsi_listList = cJSON_AddArrayToObject(item, "includeGpsiList"); + if (include_gpsi_listList == NULL) { + ogs_error("OpenAPI_ee_subscription_convertToJSON() failed [include_gpsi_list]"); + goto end; + } + OpenAPI_list_for_each(ee_subscription->include_gpsi_list, node) { + if (cJSON_AddStringToObject(include_gpsi_listList, "", (char*)node->data) == NULL) { + ogs_error("OpenAPI_ee_subscription_convertToJSON() failed [include_gpsi_list]"); + goto end; + } + } + } + + if (ee_subscription->data_restoration_callback_uri) { + if (cJSON_AddStringToObject(item, "dataRestorationCallbackUri", ee_subscription->data_restoration_callback_uri) == NULL) { + ogs_error("OpenAPI_ee_subscription_convertToJSON() failed [data_restoration_callback_uri]"); + goto end; + } + } + end: return item; } @@ -221,6 +306,13 @@ OpenAPI_ee_subscription_t *OpenAPI_ee_subscription_parseFromJSON(cJSON *ee_subsc cJSON *scef_diam_host = NULL; cJSON *scef_diam_realm = NULL; cJSON *notify_correlation_id = NULL; + cJSON *second_callback_ref = NULL; + cJSON *gpsi = NULL; + cJSON *exclude_gpsi_list = NULL; + OpenAPI_list_t *exclude_gpsi_listList = NULL; + cJSON *include_gpsi_list = NULL; + OpenAPI_list_t *include_gpsi_listList = NULL; + cJSON *data_restoration_callback_uri = NULL; callback_reference = cJSON_GetObjectItemCaseSensitive(ee_subscriptionJSON, "callbackReference"); if (!callback_reference) { ogs_error("OpenAPI_ee_subscription_parseFromJSON() failed [callback_reference]"); @@ -317,6 +409,72 @@ OpenAPI_ee_subscription_t *OpenAPI_ee_subscription_parseFromJSON(cJSON *ee_subsc } } + second_callback_ref = cJSON_GetObjectItemCaseSensitive(ee_subscriptionJSON, "secondCallbackRef"); + if (second_callback_ref) { + if (!cJSON_IsString(second_callback_ref) && !cJSON_IsNull(second_callback_ref)) { + ogs_error("OpenAPI_ee_subscription_parseFromJSON() failed [second_callback_ref]"); + goto end; + } + } + + gpsi = cJSON_GetObjectItemCaseSensitive(ee_subscriptionJSON, "gpsi"); + if (gpsi) { + if (!cJSON_IsString(gpsi) && !cJSON_IsNull(gpsi)) { + ogs_error("OpenAPI_ee_subscription_parseFromJSON() failed [gpsi]"); + goto end; + } + } + + exclude_gpsi_list = cJSON_GetObjectItemCaseSensitive(ee_subscriptionJSON, "excludeGpsiList"); + if (exclude_gpsi_list) { + cJSON *exclude_gpsi_list_local = NULL; + if (!cJSON_IsArray(exclude_gpsi_list)) { + ogs_error("OpenAPI_ee_subscription_parseFromJSON() failed [exclude_gpsi_list]"); + goto end; + } + + exclude_gpsi_listList = OpenAPI_list_create(); + + cJSON_ArrayForEach(exclude_gpsi_list_local, exclude_gpsi_list) { + double *localDouble = NULL; + int *localInt = NULL; + if (!cJSON_IsString(exclude_gpsi_list_local)) { + ogs_error("OpenAPI_ee_subscription_parseFromJSON() failed [exclude_gpsi_list]"); + goto end; + } + OpenAPI_list_add(exclude_gpsi_listList, ogs_strdup(exclude_gpsi_list_local->valuestring)); + } + } + + include_gpsi_list = cJSON_GetObjectItemCaseSensitive(ee_subscriptionJSON, "includeGpsiList"); + if (include_gpsi_list) { + cJSON *include_gpsi_list_local = NULL; + if (!cJSON_IsArray(include_gpsi_list)) { + ogs_error("OpenAPI_ee_subscription_parseFromJSON() failed [include_gpsi_list]"); + goto end; + } + + include_gpsi_listList = OpenAPI_list_create(); + + cJSON_ArrayForEach(include_gpsi_list_local, include_gpsi_list) { + double *localDouble = NULL; + int *localInt = NULL; + if (!cJSON_IsString(include_gpsi_list_local)) { + ogs_error("OpenAPI_ee_subscription_parseFromJSON() failed [include_gpsi_list]"); + goto end; + } + OpenAPI_list_add(include_gpsi_listList, ogs_strdup(include_gpsi_list_local->valuestring)); + } + } + + data_restoration_callback_uri = cJSON_GetObjectItemCaseSensitive(ee_subscriptionJSON, "dataRestorationCallbackUri"); + if (data_restoration_callback_uri) { + if (!cJSON_IsString(data_restoration_callback_uri) && !cJSON_IsNull(data_restoration_callback_uri)) { + ogs_error("OpenAPI_ee_subscription_parseFromJSON() failed [data_restoration_callback_uri]"); + goto end; + } + } + ee_subscription_local_var = OpenAPI_ee_subscription_create ( ogs_strdup(callback_reference->valuestring), monitoring_configurationsList, @@ -328,7 +486,12 @@ OpenAPI_ee_subscription_t *OpenAPI_ee_subscription_parseFromJSON(cJSON *ee_subsc epc_applied_ind ? epc_applied_ind->valueint : 0, scef_diam_host && !cJSON_IsNull(scef_diam_host) ? ogs_strdup(scef_diam_host->valuestring) : NULL, scef_diam_realm && !cJSON_IsNull(scef_diam_realm) ? ogs_strdup(scef_diam_realm->valuestring) : NULL, - notify_correlation_id && !cJSON_IsNull(notify_correlation_id) ? ogs_strdup(notify_correlation_id->valuestring) : NULL + notify_correlation_id && !cJSON_IsNull(notify_correlation_id) ? ogs_strdup(notify_correlation_id->valuestring) : NULL, + second_callback_ref && !cJSON_IsNull(second_callback_ref) ? ogs_strdup(second_callback_ref->valuestring) : NULL, + gpsi && !cJSON_IsNull(gpsi) ? ogs_strdup(gpsi->valuestring) : NULL, + exclude_gpsi_list ? exclude_gpsi_listList : NULL, + include_gpsi_list ? include_gpsi_listList : NULL, + data_restoration_callback_uri && !cJSON_IsNull(data_restoration_callback_uri) ? ogs_strdup(data_restoration_callback_uri->valuestring) : NULL ); return ee_subscription_local_var; @@ -351,6 +514,20 @@ end: OpenAPI_context_info_free(context_info_local_nonprim); context_info_local_nonprim = NULL; } + if (exclude_gpsi_listList) { + OpenAPI_list_for_each(exclude_gpsi_listList, node) { + ogs_free(node->data); + } + OpenAPI_list_free(exclude_gpsi_listList); + exclude_gpsi_listList = NULL; + } + if (include_gpsi_listList) { + OpenAPI_list_for_each(include_gpsi_listList, node) { + ogs_free(node->data); + } + OpenAPI_list_free(include_gpsi_listList); + include_gpsi_listList = NULL; + } return NULL; } diff --git a/lib/sbi/openapi/model/ee_subscription.h b/lib/sbi/openapi/model/ee_subscription.h index 0c705e2cd..a66e1e15f 100644 --- a/lib/sbi/openapi/model/ee_subscription.h +++ b/lib/sbi/openapi/model/ee_subscription.h @@ -33,6 +33,11 @@ typedef struct OpenAPI_ee_subscription_s { char *scef_diam_host; char *scef_diam_realm; char *notify_correlation_id; + char *second_callback_ref; + char *gpsi; + OpenAPI_list_t *exclude_gpsi_list; + OpenAPI_list_t *include_gpsi_list; + char *data_restoration_callback_uri; } OpenAPI_ee_subscription_t; OpenAPI_ee_subscription_t *OpenAPI_ee_subscription_create( @@ -46,7 +51,12 @@ OpenAPI_ee_subscription_t *OpenAPI_ee_subscription_create( int epc_applied_ind, char *scef_diam_host, char *scef_diam_realm, - char *notify_correlation_id + char *notify_correlation_id, + char *second_callback_ref, + char *gpsi, + OpenAPI_list_t *exclude_gpsi_list, + OpenAPI_list_t *include_gpsi_list, + char *data_restoration_callback_uri ); void OpenAPI_ee_subscription_free(OpenAPI_ee_subscription_t *ee_subscription); OpenAPI_ee_subscription_t *OpenAPI_ee_subscription_parseFromJSON(cJSON *ee_subscriptionJSON); diff --git a/lib/sbi/openapi/model/ee_subscription_1.c b/lib/sbi/openapi/model/ee_subscription_1.c new file mode 100644 index 000000000..a754927d7 --- /dev/null +++ b/lib/sbi/openapi/model/ee_subscription_1.c @@ -0,0 +1,567 @@ + +#include +#include +#include +#include "ee_subscription_1.h" + +OpenAPI_ee_subscription_1_t *OpenAPI_ee_subscription_1_create( + char *callback_reference, + OpenAPI_list_t* monitoring_configurations, + OpenAPI_reporting_options_1_t *reporting_options, + char *supported_features, + char *subscription_id, + OpenAPI_context_info_t *context_info, + bool is_epc_applied_ind, + int epc_applied_ind, + char *scef_diam_host, + char *scef_diam_realm, + char *notify_correlation_id, + char *second_callback_ref, + char *gpsi, + OpenAPI_list_t *exclude_gpsi_list, + OpenAPI_list_t *include_gpsi_list, + char *data_restoration_callback_uri +) +{ + OpenAPI_ee_subscription_1_t *ee_subscription_1_local_var = ogs_malloc(sizeof(OpenAPI_ee_subscription_1_t)); + ogs_assert(ee_subscription_1_local_var); + + ee_subscription_1_local_var->callback_reference = callback_reference; + ee_subscription_1_local_var->monitoring_configurations = monitoring_configurations; + ee_subscription_1_local_var->reporting_options = reporting_options; + ee_subscription_1_local_var->supported_features = supported_features; + ee_subscription_1_local_var->subscription_id = subscription_id; + ee_subscription_1_local_var->context_info = context_info; + ee_subscription_1_local_var->is_epc_applied_ind = is_epc_applied_ind; + ee_subscription_1_local_var->epc_applied_ind = epc_applied_ind; + ee_subscription_1_local_var->scef_diam_host = scef_diam_host; + ee_subscription_1_local_var->scef_diam_realm = scef_diam_realm; + ee_subscription_1_local_var->notify_correlation_id = notify_correlation_id; + ee_subscription_1_local_var->second_callback_ref = second_callback_ref; + ee_subscription_1_local_var->gpsi = gpsi; + ee_subscription_1_local_var->exclude_gpsi_list = exclude_gpsi_list; + ee_subscription_1_local_var->include_gpsi_list = include_gpsi_list; + ee_subscription_1_local_var->data_restoration_callback_uri = data_restoration_callback_uri; + + return ee_subscription_1_local_var; +} + +void OpenAPI_ee_subscription_1_free(OpenAPI_ee_subscription_1_t *ee_subscription_1) +{ + OpenAPI_lnode_t *node = NULL; + + if (NULL == ee_subscription_1) { + return; + } + if (ee_subscription_1->callback_reference) { + ogs_free(ee_subscription_1->callback_reference); + ee_subscription_1->callback_reference = NULL; + } + if (ee_subscription_1->monitoring_configurations) { + OpenAPI_list_for_each(ee_subscription_1->monitoring_configurations, node) { + OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*)node->data; + ogs_free(localKeyValue->key); + OpenAPI_monitoring_configuration_1_free(localKeyValue->value); + OpenAPI_map_free(localKeyValue); + } + OpenAPI_list_free(ee_subscription_1->monitoring_configurations); + ee_subscription_1->monitoring_configurations = NULL; + } + if (ee_subscription_1->reporting_options) { + OpenAPI_reporting_options_1_free(ee_subscription_1->reporting_options); + ee_subscription_1->reporting_options = NULL; + } + if (ee_subscription_1->supported_features) { + ogs_free(ee_subscription_1->supported_features); + ee_subscription_1->supported_features = NULL; + } + if (ee_subscription_1->subscription_id) { + ogs_free(ee_subscription_1->subscription_id); + ee_subscription_1->subscription_id = NULL; + } + if (ee_subscription_1->context_info) { + OpenAPI_context_info_free(ee_subscription_1->context_info); + ee_subscription_1->context_info = NULL; + } + if (ee_subscription_1->scef_diam_host) { + ogs_free(ee_subscription_1->scef_diam_host); + ee_subscription_1->scef_diam_host = NULL; + } + if (ee_subscription_1->scef_diam_realm) { + ogs_free(ee_subscription_1->scef_diam_realm); + ee_subscription_1->scef_diam_realm = NULL; + } + if (ee_subscription_1->notify_correlation_id) { + ogs_free(ee_subscription_1->notify_correlation_id); + ee_subscription_1->notify_correlation_id = NULL; + } + if (ee_subscription_1->second_callback_ref) { + ogs_free(ee_subscription_1->second_callback_ref); + ee_subscription_1->second_callback_ref = NULL; + } + if (ee_subscription_1->gpsi) { + ogs_free(ee_subscription_1->gpsi); + ee_subscription_1->gpsi = NULL; + } + if (ee_subscription_1->exclude_gpsi_list) { + OpenAPI_list_for_each(ee_subscription_1->exclude_gpsi_list, node) { + ogs_free(node->data); + } + OpenAPI_list_free(ee_subscription_1->exclude_gpsi_list); + ee_subscription_1->exclude_gpsi_list = NULL; + } + if (ee_subscription_1->include_gpsi_list) { + OpenAPI_list_for_each(ee_subscription_1->include_gpsi_list, node) { + ogs_free(node->data); + } + OpenAPI_list_free(ee_subscription_1->include_gpsi_list); + ee_subscription_1->include_gpsi_list = NULL; + } + if (ee_subscription_1->data_restoration_callback_uri) { + ogs_free(ee_subscription_1->data_restoration_callback_uri); + ee_subscription_1->data_restoration_callback_uri = NULL; + } + ogs_free(ee_subscription_1); +} + +cJSON *OpenAPI_ee_subscription_1_convertToJSON(OpenAPI_ee_subscription_1_t *ee_subscription_1) +{ + cJSON *item = NULL; + OpenAPI_lnode_t *node = NULL; + + if (ee_subscription_1 == NULL) { + ogs_error("OpenAPI_ee_subscription_1_convertToJSON() failed [EeSubscription_1]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (!ee_subscription_1->callback_reference) { + ogs_error("OpenAPI_ee_subscription_1_convertToJSON() failed [callback_reference]"); + return NULL; + } + if (cJSON_AddStringToObject(item, "callbackReference", ee_subscription_1->callback_reference) == NULL) { + ogs_error("OpenAPI_ee_subscription_1_convertToJSON() failed [callback_reference]"); + goto end; + } + + if (!ee_subscription_1->monitoring_configurations) { + ogs_error("OpenAPI_ee_subscription_1_convertToJSON() failed [monitoring_configurations]"); + return NULL; + } + cJSON *monitoring_configurations = cJSON_AddObjectToObject(item, "monitoringConfigurations"); + if (monitoring_configurations == NULL) { + ogs_error("OpenAPI_ee_subscription_1_convertToJSON() failed [monitoring_configurations]"); + goto end; + } + cJSON *localMapObject = monitoring_configurations; + if (ee_subscription_1->monitoring_configurations) { + OpenAPI_list_for_each(ee_subscription_1->monitoring_configurations, node) { + OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*)node->data; + cJSON *itemLocal = localKeyValue->value ? + OpenAPI_monitoring_configuration_1_convertToJSON(localKeyValue->value) : + cJSON_CreateNull(); + if (itemLocal == NULL) { + ogs_error("OpenAPI_ee_subscription_1_convertToJSON() failed [inner]"); + goto end; + } + cJSON_AddItemToObject(localMapObject, localKeyValue->key, itemLocal); + } + } + + if (ee_subscription_1->reporting_options) { + cJSON *reporting_options_local_JSON = OpenAPI_reporting_options_1_convertToJSON(ee_subscription_1->reporting_options); + if (reporting_options_local_JSON == NULL) { + ogs_error("OpenAPI_ee_subscription_1_convertToJSON() failed [reporting_options]"); + goto end; + } + cJSON_AddItemToObject(item, "reportingOptions", reporting_options_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_ee_subscription_1_convertToJSON() failed [reporting_options]"); + goto end; + } + } + + if (ee_subscription_1->supported_features) { + if (cJSON_AddStringToObject(item, "supportedFeatures", ee_subscription_1->supported_features) == NULL) { + ogs_error("OpenAPI_ee_subscription_1_convertToJSON() failed [supported_features]"); + goto end; + } + } + + if (ee_subscription_1->subscription_id) { + if (cJSON_AddStringToObject(item, "subscriptionId", ee_subscription_1->subscription_id) == NULL) { + ogs_error("OpenAPI_ee_subscription_1_convertToJSON() failed [subscription_id]"); + goto end; + } + } + + if (ee_subscription_1->context_info) { + cJSON *context_info_local_JSON = OpenAPI_context_info_convertToJSON(ee_subscription_1->context_info); + if (context_info_local_JSON == NULL) { + ogs_error("OpenAPI_ee_subscription_1_convertToJSON() failed [context_info]"); + goto end; + } + cJSON_AddItemToObject(item, "contextInfo", context_info_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_ee_subscription_1_convertToJSON() failed [context_info]"); + goto end; + } + } + + if (ee_subscription_1->is_epc_applied_ind) { + if (cJSON_AddBoolToObject(item, "epcAppliedInd", ee_subscription_1->epc_applied_ind) == NULL) { + ogs_error("OpenAPI_ee_subscription_1_convertToJSON() failed [epc_applied_ind]"); + goto end; + } + } + + if (ee_subscription_1->scef_diam_host) { + if (cJSON_AddStringToObject(item, "scefDiamHost", ee_subscription_1->scef_diam_host) == NULL) { + ogs_error("OpenAPI_ee_subscription_1_convertToJSON() failed [scef_diam_host]"); + goto end; + } + } + + if (ee_subscription_1->scef_diam_realm) { + if (cJSON_AddStringToObject(item, "scefDiamRealm", ee_subscription_1->scef_diam_realm) == NULL) { + ogs_error("OpenAPI_ee_subscription_1_convertToJSON() failed [scef_diam_realm]"); + goto end; + } + } + + if (ee_subscription_1->notify_correlation_id) { + if (cJSON_AddStringToObject(item, "notifyCorrelationId", ee_subscription_1->notify_correlation_id) == NULL) { + ogs_error("OpenAPI_ee_subscription_1_convertToJSON() failed [notify_correlation_id]"); + goto end; + } + } + + if (ee_subscription_1->second_callback_ref) { + if (cJSON_AddStringToObject(item, "secondCallbackRef", ee_subscription_1->second_callback_ref) == NULL) { + ogs_error("OpenAPI_ee_subscription_1_convertToJSON() failed [second_callback_ref]"); + goto end; + } + } + + if (ee_subscription_1->gpsi) { + if (cJSON_AddStringToObject(item, "gpsi", ee_subscription_1->gpsi) == NULL) { + ogs_error("OpenAPI_ee_subscription_1_convertToJSON() failed [gpsi]"); + goto end; + } + } + + if (ee_subscription_1->exclude_gpsi_list) { + cJSON *exclude_gpsi_listList = cJSON_AddArrayToObject(item, "excludeGpsiList"); + if (exclude_gpsi_listList == NULL) { + ogs_error("OpenAPI_ee_subscription_1_convertToJSON() failed [exclude_gpsi_list]"); + goto end; + } + OpenAPI_list_for_each(ee_subscription_1->exclude_gpsi_list, node) { + if (cJSON_AddStringToObject(exclude_gpsi_listList, "", (char*)node->data) == NULL) { + ogs_error("OpenAPI_ee_subscription_1_convertToJSON() failed [exclude_gpsi_list]"); + goto end; + } + } + } + + if (ee_subscription_1->include_gpsi_list) { + cJSON *include_gpsi_listList = cJSON_AddArrayToObject(item, "includeGpsiList"); + if (include_gpsi_listList == NULL) { + ogs_error("OpenAPI_ee_subscription_1_convertToJSON() failed [include_gpsi_list]"); + goto end; + } + OpenAPI_list_for_each(ee_subscription_1->include_gpsi_list, node) { + if (cJSON_AddStringToObject(include_gpsi_listList, "", (char*)node->data) == NULL) { + ogs_error("OpenAPI_ee_subscription_1_convertToJSON() failed [include_gpsi_list]"); + goto end; + } + } + } + + if (ee_subscription_1->data_restoration_callback_uri) { + if (cJSON_AddStringToObject(item, "dataRestorationCallbackUri", ee_subscription_1->data_restoration_callback_uri) == NULL) { + ogs_error("OpenAPI_ee_subscription_1_convertToJSON() failed [data_restoration_callback_uri]"); + goto end; + } + } + +end: + return item; +} + +OpenAPI_ee_subscription_1_t *OpenAPI_ee_subscription_1_parseFromJSON(cJSON *ee_subscription_1JSON) +{ + OpenAPI_ee_subscription_1_t *ee_subscription_1_local_var = NULL; + OpenAPI_lnode_t *node = NULL; + cJSON *callback_reference = NULL; + cJSON *monitoring_configurations = NULL; + OpenAPI_list_t *monitoring_configurationsList = NULL; + cJSON *reporting_options = NULL; + OpenAPI_reporting_options_1_t *reporting_options_local_nonprim = NULL; + cJSON *supported_features = NULL; + cJSON *subscription_id = NULL; + cJSON *context_info = NULL; + OpenAPI_context_info_t *context_info_local_nonprim = NULL; + cJSON *epc_applied_ind = NULL; + cJSON *scef_diam_host = NULL; + cJSON *scef_diam_realm = NULL; + cJSON *notify_correlation_id = NULL; + cJSON *second_callback_ref = NULL; + cJSON *gpsi = NULL; + cJSON *exclude_gpsi_list = NULL; + OpenAPI_list_t *exclude_gpsi_listList = NULL; + cJSON *include_gpsi_list = NULL; + OpenAPI_list_t *include_gpsi_listList = NULL; + cJSON *data_restoration_callback_uri = NULL; + callback_reference = cJSON_GetObjectItemCaseSensitive(ee_subscription_1JSON, "callbackReference"); + if (!callback_reference) { + ogs_error("OpenAPI_ee_subscription_1_parseFromJSON() failed [callback_reference]"); + goto end; + } + if (!cJSON_IsString(callback_reference)) { + ogs_error("OpenAPI_ee_subscription_1_parseFromJSON() failed [callback_reference]"); + goto end; + } + + monitoring_configurations = cJSON_GetObjectItemCaseSensitive(ee_subscription_1JSON, "monitoringConfigurations"); + if (!monitoring_configurations) { + ogs_error("OpenAPI_ee_subscription_1_parseFromJSON() failed [monitoring_configurations]"); + goto end; + } + cJSON *monitoring_configurations_local_map = NULL; + if (!cJSON_IsObject(monitoring_configurations) && !cJSON_IsNull(monitoring_configurations)) { + ogs_error("OpenAPI_ee_subscription_1_parseFromJSON() failed [monitoring_configurations]"); + goto end; + } + if (cJSON_IsObject(monitoring_configurations)) { + monitoring_configurationsList = OpenAPI_list_create(); + OpenAPI_map_t *localMapKeyPair = NULL; + cJSON_ArrayForEach(monitoring_configurations_local_map, monitoring_configurations) { + cJSON *localMapObject = monitoring_configurations_local_map; + if (cJSON_IsObject(localMapObject)) { + localMapKeyPair = OpenAPI_map_create( + ogs_strdup(localMapObject->string), OpenAPI_monitoring_configuration_1_parseFromJSON(localMapObject)); + } else if (cJSON_IsNull(localMapObject)) { + localMapKeyPair = OpenAPI_map_create(ogs_strdup(localMapObject->string), NULL); + } else { + ogs_error("OpenAPI_ee_subscription_1_parseFromJSON() failed [inner]"); + goto end; + } + OpenAPI_list_add(monitoring_configurationsList, localMapKeyPair); + } + } + + reporting_options = cJSON_GetObjectItemCaseSensitive(ee_subscription_1JSON, "reportingOptions"); + if (reporting_options) { + reporting_options_local_nonprim = OpenAPI_reporting_options_1_parseFromJSON(reporting_options); + } + + supported_features = cJSON_GetObjectItemCaseSensitive(ee_subscription_1JSON, "supportedFeatures"); + if (supported_features) { + if (!cJSON_IsString(supported_features) && !cJSON_IsNull(supported_features)) { + ogs_error("OpenAPI_ee_subscription_1_parseFromJSON() failed [supported_features]"); + goto end; + } + } + + subscription_id = cJSON_GetObjectItemCaseSensitive(ee_subscription_1JSON, "subscriptionId"); + if (subscription_id) { + if (!cJSON_IsString(subscription_id) && !cJSON_IsNull(subscription_id)) { + ogs_error("OpenAPI_ee_subscription_1_parseFromJSON() failed [subscription_id]"); + goto end; + } + } + + context_info = cJSON_GetObjectItemCaseSensitive(ee_subscription_1JSON, "contextInfo"); + if (context_info) { + context_info_local_nonprim = OpenAPI_context_info_parseFromJSON(context_info); + } + + epc_applied_ind = cJSON_GetObjectItemCaseSensitive(ee_subscription_1JSON, "epcAppliedInd"); + if (epc_applied_ind) { + if (!cJSON_IsBool(epc_applied_ind)) { + ogs_error("OpenAPI_ee_subscription_1_parseFromJSON() failed [epc_applied_ind]"); + goto end; + } + } + + scef_diam_host = cJSON_GetObjectItemCaseSensitive(ee_subscription_1JSON, "scefDiamHost"); + if (scef_diam_host) { + if (!cJSON_IsString(scef_diam_host) && !cJSON_IsNull(scef_diam_host)) { + ogs_error("OpenAPI_ee_subscription_1_parseFromJSON() failed [scef_diam_host]"); + goto end; + } + } + + scef_diam_realm = cJSON_GetObjectItemCaseSensitive(ee_subscription_1JSON, "scefDiamRealm"); + if (scef_diam_realm) { + if (!cJSON_IsString(scef_diam_realm) && !cJSON_IsNull(scef_diam_realm)) { + ogs_error("OpenAPI_ee_subscription_1_parseFromJSON() failed [scef_diam_realm]"); + goto end; + } + } + + notify_correlation_id = cJSON_GetObjectItemCaseSensitive(ee_subscription_1JSON, "notifyCorrelationId"); + if (notify_correlation_id) { + if (!cJSON_IsString(notify_correlation_id) && !cJSON_IsNull(notify_correlation_id)) { + ogs_error("OpenAPI_ee_subscription_1_parseFromJSON() failed [notify_correlation_id]"); + goto end; + } + } + + second_callback_ref = cJSON_GetObjectItemCaseSensitive(ee_subscription_1JSON, "secondCallbackRef"); + if (second_callback_ref) { + if (!cJSON_IsString(second_callback_ref) && !cJSON_IsNull(second_callback_ref)) { + ogs_error("OpenAPI_ee_subscription_1_parseFromJSON() failed [second_callback_ref]"); + goto end; + } + } + + gpsi = cJSON_GetObjectItemCaseSensitive(ee_subscription_1JSON, "gpsi"); + if (gpsi) { + if (!cJSON_IsString(gpsi) && !cJSON_IsNull(gpsi)) { + ogs_error("OpenAPI_ee_subscription_1_parseFromJSON() failed [gpsi]"); + goto end; + } + } + + exclude_gpsi_list = cJSON_GetObjectItemCaseSensitive(ee_subscription_1JSON, "excludeGpsiList"); + if (exclude_gpsi_list) { + cJSON *exclude_gpsi_list_local = NULL; + if (!cJSON_IsArray(exclude_gpsi_list)) { + ogs_error("OpenAPI_ee_subscription_1_parseFromJSON() failed [exclude_gpsi_list]"); + goto end; + } + + exclude_gpsi_listList = OpenAPI_list_create(); + + cJSON_ArrayForEach(exclude_gpsi_list_local, exclude_gpsi_list) { + double *localDouble = NULL; + int *localInt = NULL; + if (!cJSON_IsString(exclude_gpsi_list_local)) { + ogs_error("OpenAPI_ee_subscription_1_parseFromJSON() failed [exclude_gpsi_list]"); + goto end; + } + OpenAPI_list_add(exclude_gpsi_listList, ogs_strdup(exclude_gpsi_list_local->valuestring)); + } + } + + include_gpsi_list = cJSON_GetObjectItemCaseSensitive(ee_subscription_1JSON, "includeGpsiList"); + if (include_gpsi_list) { + cJSON *include_gpsi_list_local = NULL; + if (!cJSON_IsArray(include_gpsi_list)) { + ogs_error("OpenAPI_ee_subscription_1_parseFromJSON() failed [include_gpsi_list]"); + goto end; + } + + include_gpsi_listList = OpenAPI_list_create(); + + cJSON_ArrayForEach(include_gpsi_list_local, include_gpsi_list) { + double *localDouble = NULL; + int *localInt = NULL; + if (!cJSON_IsString(include_gpsi_list_local)) { + ogs_error("OpenAPI_ee_subscription_1_parseFromJSON() failed [include_gpsi_list]"); + goto end; + } + OpenAPI_list_add(include_gpsi_listList, ogs_strdup(include_gpsi_list_local->valuestring)); + } + } + + data_restoration_callback_uri = cJSON_GetObjectItemCaseSensitive(ee_subscription_1JSON, "dataRestorationCallbackUri"); + if (data_restoration_callback_uri) { + if (!cJSON_IsString(data_restoration_callback_uri) && !cJSON_IsNull(data_restoration_callback_uri)) { + ogs_error("OpenAPI_ee_subscription_1_parseFromJSON() failed [data_restoration_callback_uri]"); + goto end; + } + } + + ee_subscription_1_local_var = OpenAPI_ee_subscription_1_create ( + ogs_strdup(callback_reference->valuestring), + monitoring_configurationsList, + reporting_options ? reporting_options_local_nonprim : NULL, + supported_features && !cJSON_IsNull(supported_features) ? ogs_strdup(supported_features->valuestring) : NULL, + subscription_id && !cJSON_IsNull(subscription_id) ? ogs_strdup(subscription_id->valuestring) : NULL, + context_info ? context_info_local_nonprim : NULL, + epc_applied_ind ? true : false, + epc_applied_ind ? epc_applied_ind->valueint : 0, + scef_diam_host && !cJSON_IsNull(scef_diam_host) ? ogs_strdup(scef_diam_host->valuestring) : NULL, + scef_diam_realm && !cJSON_IsNull(scef_diam_realm) ? ogs_strdup(scef_diam_realm->valuestring) : NULL, + notify_correlation_id && !cJSON_IsNull(notify_correlation_id) ? ogs_strdup(notify_correlation_id->valuestring) : NULL, + second_callback_ref && !cJSON_IsNull(second_callback_ref) ? ogs_strdup(second_callback_ref->valuestring) : NULL, + gpsi && !cJSON_IsNull(gpsi) ? ogs_strdup(gpsi->valuestring) : NULL, + exclude_gpsi_list ? exclude_gpsi_listList : NULL, + include_gpsi_list ? include_gpsi_listList : NULL, + data_restoration_callback_uri && !cJSON_IsNull(data_restoration_callback_uri) ? ogs_strdup(data_restoration_callback_uri->valuestring) : NULL + ); + + return ee_subscription_1_local_var; +end: + if (monitoring_configurationsList) { + OpenAPI_list_for_each(monitoring_configurationsList, node) { + OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*) node->data; + ogs_free(localKeyValue->key); + OpenAPI_monitoring_configuration_1_free(localKeyValue->value); + OpenAPI_map_free(localKeyValue); + } + OpenAPI_list_free(monitoring_configurationsList); + monitoring_configurationsList = NULL; + } + if (reporting_options_local_nonprim) { + OpenAPI_reporting_options_1_free(reporting_options_local_nonprim); + reporting_options_local_nonprim = NULL; + } + if (context_info_local_nonprim) { + OpenAPI_context_info_free(context_info_local_nonprim); + context_info_local_nonprim = NULL; + } + if (exclude_gpsi_listList) { + OpenAPI_list_for_each(exclude_gpsi_listList, node) { + ogs_free(node->data); + } + OpenAPI_list_free(exclude_gpsi_listList); + exclude_gpsi_listList = NULL; + } + if (include_gpsi_listList) { + OpenAPI_list_for_each(include_gpsi_listList, node) { + ogs_free(node->data); + } + OpenAPI_list_free(include_gpsi_listList); + include_gpsi_listList = NULL; + } + return NULL; +} + +OpenAPI_ee_subscription_1_t *OpenAPI_ee_subscription_1_copy(OpenAPI_ee_subscription_1_t *dst, OpenAPI_ee_subscription_1_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_ee_subscription_1_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_ee_subscription_1_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_ee_subscription_1_free(dst); + dst = OpenAPI_ee_subscription_1_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/ee_subscription_1.h b/lib/sbi/openapi/model/ee_subscription_1.h new file mode 100644 index 000000000..2d87ee670 --- /dev/null +++ b/lib/sbi/openapi/model/ee_subscription_1.h @@ -0,0 +1,71 @@ +/* + * ee_subscription_1.h + * + * + */ + +#ifndef _OpenAPI_ee_subscription_1_H_ +#define _OpenAPI_ee_subscription_1_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "context_info.h" +#include "monitoring_configuration_1.h" +#include "reporting_options_1.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_ee_subscription_1_s OpenAPI_ee_subscription_1_t; +typedef struct OpenAPI_ee_subscription_1_s { + char *callback_reference; + OpenAPI_list_t* monitoring_configurations; + struct OpenAPI_reporting_options_1_s *reporting_options; + char *supported_features; + char *subscription_id; + struct OpenAPI_context_info_s *context_info; + bool is_epc_applied_ind; + int epc_applied_ind; + char *scef_diam_host; + char *scef_diam_realm; + char *notify_correlation_id; + char *second_callback_ref; + char *gpsi; + OpenAPI_list_t *exclude_gpsi_list; + OpenAPI_list_t *include_gpsi_list; + char *data_restoration_callback_uri; +} OpenAPI_ee_subscription_1_t; + +OpenAPI_ee_subscription_1_t *OpenAPI_ee_subscription_1_create( + char *callback_reference, + OpenAPI_list_t* monitoring_configurations, + OpenAPI_reporting_options_1_t *reporting_options, + char *supported_features, + char *subscription_id, + OpenAPI_context_info_t *context_info, + bool is_epc_applied_ind, + int epc_applied_ind, + char *scef_diam_host, + char *scef_diam_realm, + char *notify_correlation_id, + char *second_callback_ref, + char *gpsi, + OpenAPI_list_t *exclude_gpsi_list, + OpenAPI_list_t *include_gpsi_list, + char *data_restoration_callback_uri +); +void OpenAPI_ee_subscription_1_free(OpenAPI_ee_subscription_1_t *ee_subscription_1); +OpenAPI_ee_subscription_1_t *OpenAPI_ee_subscription_1_parseFromJSON(cJSON *ee_subscription_1JSON); +cJSON *OpenAPI_ee_subscription_1_convertToJSON(OpenAPI_ee_subscription_1_t *ee_subscription_1); +OpenAPI_ee_subscription_1_t *OpenAPI_ee_subscription_1_copy(OpenAPI_ee_subscription_1_t *dst, OpenAPI_ee_subscription_1_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_ee_subscription_1_H_ */ + diff --git a/lib/sbi/openapi/model/ee_subscription_ext.c b/lib/sbi/openapi/model/ee_subscription_ext.c new file mode 100644 index 000000000..36dc176ea --- /dev/null +++ b/lib/sbi/openapi/model/ee_subscription_ext.c @@ -0,0 +1,689 @@ + +#include +#include +#include +#include "ee_subscription_ext.h" + +OpenAPI_ee_subscription_ext_t *OpenAPI_ee_subscription_ext_create( + char *callback_reference, + OpenAPI_list_t* monitoring_configurations, + OpenAPI_reporting_options_1_t *reporting_options, + char *supported_features, + char *subscription_id, + OpenAPI_context_info_t *context_info, + bool is_epc_applied_ind, + int epc_applied_ind, + char *scef_diam_host, + char *scef_diam_realm, + char *notify_correlation_id, + char *second_callback_ref, + char *gpsi, + OpenAPI_list_t *exclude_gpsi_list, + OpenAPI_list_t *include_gpsi_list, + char *data_restoration_callback_uri, + OpenAPI_list_t *amf_subscription_info_list, + OpenAPI_smf_subscription_info_t *smf_subscription_info, + OpenAPI_hss_subscription_info_t *hss_subscription_info +) +{ + OpenAPI_ee_subscription_ext_t *ee_subscription_ext_local_var = ogs_malloc(sizeof(OpenAPI_ee_subscription_ext_t)); + ogs_assert(ee_subscription_ext_local_var); + + ee_subscription_ext_local_var->callback_reference = callback_reference; + ee_subscription_ext_local_var->monitoring_configurations = monitoring_configurations; + ee_subscription_ext_local_var->reporting_options = reporting_options; + ee_subscription_ext_local_var->supported_features = supported_features; + ee_subscription_ext_local_var->subscription_id = subscription_id; + ee_subscription_ext_local_var->context_info = context_info; + ee_subscription_ext_local_var->is_epc_applied_ind = is_epc_applied_ind; + ee_subscription_ext_local_var->epc_applied_ind = epc_applied_ind; + ee_subscription_ext_local_var->scef_diam_host = scef_diam_host; + ee_subscription_ext_local_var->scef_diam_realm = scef_diam_realm; + ee_subscription_ext_local_var->notify_correlation_id = notify_correlation_id; + ee_subscription_ext_local_var->second_callback_ref = second_callback_ref; + ee_subscription_ext_local_var->gpsi = gpsi; + ee_subscription_ext_local_var->exclude_gpsi_list = exclude_gpsi_list; + ee_subscription_ext_local_var->include_gpsi_list = include_gpsi_list; + ee_subscription_ext_local_var->data_restoration_callback_uri = data_restoration_callback_uri; + ee_subscription_ext_local_var->amf_subscription_info_list = amf_subscription_info_list; + ee_subscription_ext_local_var->smf_subscription_info = smf_subscription_info; + ee_subscription_ext_local_var->hss_subscription_info = hss_subscription_info; + + return ee_subscription_ext_local_var; +} + +void OpenAPI_ee_subscription_ext_free(OpenAPI_ee_subscription_ext_t *ee_subscription_ext) +{ + OpenAPI_lnode_t *node = NULL; + + if (NULL == ee_subscription_ext) { + return; + } + if (ee_subscription_ext->callback_reference) { + ogs_free(ee_subscription_ext->callback_reference); + ee_subscription_ext->callback_reference = NULL; + } + if (ee_subscription_ext->monitoring_configurations) { + OpenAPI_list_for_each(ee_subscription_ext->monitoring_configurations, node) { + OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*)node->data; + ogs_free(localKeyValue->key); + OpenAPI_monitoring_configuration_1_free(localKeyValue->value); + OpenAPI_map_free(localKeyValue); + } + OpenAPI_list_free(ee_subscription_ext->monitoring_configurations); + ee_subscription_ext->monitoring_configurations = NULL; + } + if (ee_subscription_ext->reporting_options) { + OpenAPI_reporting_options_1_free(ee_subscription_ext->reporting_options); + ee_subscription_ext->reporting_options = NULL; + } + if (ee_subscription_ext->supported_features) { + ogs_free(ee_subscription_ext->supported_features); + ee_subscription_ext->supported_features = NULL; + } + if (ee_subscription_ext->subscription_id) { + ogs_free(ee_subscription_ext->subscription_id); + ee_subscription_ext->subscription_id = NULL; + } + if (ee_subscription_ext->context_info) { + OpenAPI_context_info_free(ee_subscription_ext->context_info); + ee_subscription_ext->context_info = NULL; + } + if (ee_subscription_ext->scef_diam_host) { + ogs_free(ee_subscription_ext->scef_diam_host); + ee_subscription_ext->scef_diam_host = NULL; + } + if (ee_subscription_ext->scef_diam_realm) { + ogs_free(ee_subscription_ext->scef_diam_realm); + ee_subscription_ext->scef_diam_realm = NULL; + } + if (ee_subscription_ext->notify_correlation_id) { + ogs_free(ee_subscription_ext->notify_correlation_id); + ee_subscription_ext->notify_correlation_id = NULL; + } + if (ee_subscription_ext->second_callback_ref) { + ogs_free(ee_subscription_ext->second_callback_ref); + ee_subscription_ext->second_callback_ref = NULL; + } + if (ee_subscription_ext->gpsi) { + ogs_free(ee_subscription_ext->gpsi); + ee_subscription_ext->gpsi = NULL; + } + if (ee_subscription_ext->exclude_gpsi_list) { + OpenAPI_list_for_each(ee_subscription_ext->exclude_gpsi_list, node) { + ogs_free(node->data); + } + OpenAPI_list_free(ee_subscription_ext->exclude_gpsi_list); + ee_subscription_ext->exclude_gpsi_list = NULL; + } + if (ee_subscription_ext->include_gpsi_list) { + OpenAPI_list_for_each(ee_subscription_ext->include_gpsi_list, node) { + ogs_free(node->data); + } + OpenAPI_list_free(ee_subscription_ext->include_gpsi_list); + ee_subscription_ext->include_gpsi_list = NULL; + } + if (ee_subscription_ext->data_restoration_callback_uri) { + ogs_free(ee_subscription_ext->data_restoration_callback_uri); + ee_subscription_ext->data_restoration_callback_uri = NULL; + } + if (ee_subscription_ext->amf_subscription_info_list) { + OpenAPI_list_for_each(ee_subscription_ext->amf_subscription_info_list, node) { + OpenAPI_amf_subscription_info_free(node->data); + } + OpenAPI_list_free(ee_subscription_ext->amf_subscription_info_list); + ee_subscription_ext->amf_subscription_info_list = NULL; + } + if (ee_subscription_ext->smf_subscription_info) { + OpenAPI_smf_subscription_info_free(ee_subscription_ext->smf_subscription_info); + ee_subscription_ext->smf_subscription_info = NULL; + } + if (ee_subscription_ext->hss_subscription_info) { + OpenAPI_hss_subscription_info_free(ee_subscription_ext->hss_subscription_info); + ee_subscription_ext->hss_subscription_info = NULL; + } + ogs_free(ee_subscription_ext); +} + +cJSON *OpenAPI_ee_subscription_ext_convertToJSON(OpenAPI_ee_subscription_ext_t *ee_subscription_ext) +{ + cJSON *item = NULL; + OpenAPI_lnode_t *node = NULL; + + if (ee_subscription_ext == NULL) { + ogs_error("OpenAPI_ee_subscription_ext_convertToJSON() failed [EeSubscriptionExt]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (!ee_subscription_ext->callback_reference) { + ogs_error("OpenAPI_ee_subscription_ext_convertToJSON() failed [callback_reference]"); + return NULL; + } + if (cJSON_AddStringToObject(item, "callbackReference", ee_subscription_ext->callback_reference) == NULL) { + ogs_error("OpenAPI_ee_subscription_ext_convertToJSON() failed [callback_reference]"); + goto end; + } + + if (!ee_subscription_ext->monitoring_configurations) { + ogs_error("OpenAPI_ee_subscription_ext_convertToJSON() failed [monitoring_configurations]"); + return NULL; + } + cJSON *monitoring_configurations = cJSON_AddObjectToObject(item, "monitoringConfigurations"); + if (monitoring_configurations == NULL) { + ogs_error("OpenAPI_ee_subscription_ext_convertToJSON() failed [monitoring_configurations]"); + goto end; + } + cJSON *localMapObject = monitoring_configurations; + if (ee_subscription_ext->monitoring_configurations) { + OpenAPI_list_for_each(ee_subscription_ext->monitoring_configurations, node) { + OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*)node->data; + cJSON *itemLocal = localKeyValue->value ? + OpenAPI_monitoring_configuration_1_convertToJSON(localKeyValue->value) : + cJSON_CreateNull(); + if (itemLocal == NULL) { + ogs_error("OpenAPI_ee_subscription_ext_convertToJSON() failed [inner]"); + goto end; + } + cJSON_AddItemToObject(localMapObject, localKeyValue->key, itemLocal); + } + } + + if (ee_subscription_ext->reporting_options) { + cJSON *reporting_options_local_JSON = OpenAPI_reporting_options_1_convertToJSON(ee_subscription_ext->reporting_options); + if (reporting_options_local_JSON == NULL) { + ogs_error("OpenAPI_ee_subscription_ext_convertToJSON() failed [reporting_options]"); + goto end; + } + cJSON_AddItemToObject(item, "reportingOptions", reporting_options_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_ee_subscription_ext_convertToJSON() failed [reporting_options]"); + goto end; + } + } + + if (ee_subscription_ext->supported_features) { + if (cJSON_AddStringToObject(item, "supportedFeatures", ee_subscription_ext->supported_features) == NULL) { + ogs_error("OpenAPI_ee_subscription_ext_convertToJSON() failed [supported_features]"); + goto end; + } + } + + if (ee_subscription_ext->subscription_id) { + if (cJSON_AddStringToObject(item, "subscriptionId", ee_subscription_ext->subscription_id) == NULL) { + ogs_error("OpenAPI_ee_subscription_ext_convertToJSON() failed [subscription_id]"); + goto end; + } + } + + if (ee_subscription_ext->context_info) { + cJSON *context_info_local_JSON = OpenAPI_context_info_convertToJSON(ee_subscription_ext->context_info); + if (context_info_local_JSON == NULL) { + ogs_error("OpenAPI_ee_subscription_ext_convertToJSON() failed [context_info]"); + goto end; + } + cJSON_AddItemToObject(item, "contextInfo", context_info_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_ee_subscription_ext_convertToJSON() failed [context_info]"); + goto end; + } + } + + if (ee_subscription_ext->is_epc_applied_ind) { + if (cJSON_AddBoolToObject(item, "epcAppliedInd", ee_subscription_ext->epc_applied_ind) == NULL) { + ogs_error("OpenAPI_ee_subscription_ext_convertToJSON() failed [epc_applied_ind]"); + goto end; + } + } + + if (ee_subscription_ext->scef_diam_host) { + if (cJSON_AddStringToObject(item, "scefDiamHost", ee_subscription_ext->scef_diam_host) == NULL) { + ogs_error("OpenAPI_ee_subscription_ext_convertToJSON() failed [scef_diam_host]"); + goto end; + } + } + + if (ee_subscription_ext->scef_diam_realm) { + if (cJSON_AddStringToObject(item, "scefDiamRealm", ee_subscription_ext->scef_diam_realm) == NULL) { + ogs_error("OpenAPI_ee_subscription_ext_convertToJSON() failed [scef_diam_realm]"); + goto end; + } + } + + if (ee_subscription_ext->notify_correlation_id) { + if (cJSON_AddStringToObject(item, "notifyCorrelationId", ee_subscription_ext->notify_correlation_id) == NULL) { + ogs_error("OpenAPI_ee_subscription_ext_convertToJSON() failed [notify_correlation_id]"); + goto end; + } + } + + if (ee_subscription_ext->second_callback_ref) { + if (cJSON_AddStringToObject(item, "secondCallbackRef", ee_subscription_ext->second_callback_ref) == NULL) { + ogs_error("OpenAPI_ee_subscription_ext_convertToJSON() failed [second_callback_ref]"); + goto end; + } + } + + if (ee_subscription_ext->gpsi) { + if (cJSON_AddStringToObject(item, "gpsi", ee_subscription_ext->gpsi) == NULL) { + ogs_error("OpenAPI_ee_subscription_ext_convertToJSON() failed [gpsi]"); + goto end; + } + } + + if (ee_subscription_ext->exclude_gpsi_list) { + cJSON *exclude_gpsi_listList = cJSON_AddArrayToObject(item, "excludeGpsiList"); + if (exclude_gpsi_listList == NULL) { + ogs_error("OpenAPI_ee_subscription_ext_convertToJSON() failed [exclude_gpsi_list]"); + goto end; + } + OpenAPI_list_for_each(ee_subscription_ext->exclude_gpsi_list, node) { + if (cJSON_AddStringToObject(exclude_gpsi_listList, "", (char*)node->data) == NULL) { + ogs_error("OpenAPI_ee_subscription_ext_convertToJSON() failed [exclude_gpsi_list]"); + goto end; + } + } + } + + if (ee_subscription_ext->include_gpsi_list) { + cJSON *include_gpsi_listList = cJSON_AddArrayToObject(item, "includeGpsiList"); + if (include_gpsi_listList == NULL) { + ogs_error("OpenAPI_ee_subscription_ext_convertToJSON() failed [include_gpsi_list]"); + goto end; + } + OpenAPI_list_for_each(ee_subscription_ext->include_gpsi_list, node) { + if (cJSON_AddStringToObject(include_gpsi_listList, "", (char*)node->data) == NULL) { + ogs_error("OpenAPI_ee_subscription_ext_convertToJSON() failed [include_gpsi_list]"); + goto end; + } + } + } + + if (ee_subscription_ext->data_restoration_callback_uri) { + if (cJSON_AddStringToObject(item, "dataRestorationCallbackUri", ee_subscription_ext->data_restoration_callback_uri) == NULL) { + ogs_error("OpenAPI_ee_subscription_ext_convertToJSON() failed [data_restoration_callback_uri]"); + goto end; + } + } + + if (ee_subscription_ext->amf_subscription_info_list) { + cJSON *amf_subscription_info_listList = cJSON_AddArrayToObject(item, "amfSubscriptionInfoList"); + if (amf_subscription_info_listList == NULL) { + ogs_error("OpenAPI_ee_subscription_ext_convertToJSON() failed [amf_subscription_info_list]"); + goto end; + } + OpenAPI_list_for_each(ee_subscription_ext->amf_subscription_info_list, node) { + cJSON *itemLocal = OpenAPI_amf_subscription_info_convertToJSON(node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_ee_subscription_ext_convertToJSON() failed [amf_subscription_info_list]"); + goto end; + } + cJSON_AddItemToArray(amf_subscription_info_listList, itemLocal); + } + } + + if (ee_subscription_ext->smf_subscription_info) { + cJSON *smf_subscription_info_local_JSON = OpenAPI_smf_subscription_info_convertToJSON(ee_subscription_ext->smf_subscription_info); + if (smf_subscription_info_local_JSON == NULL) { + ogs_error("OpenAPI_ee_subscription_ext_convertToJSON() failed [smf_subscription_info]"); + goto end; + } + cJSON_AddItemToObject(item, "smfSubscriptionInfo", smf_subscription_info_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_ee_subscription_ext_convertToJSON() failed [smf_subscription_info]"); + goto end; + } + } + + if (ee_subscription_ext->hss_subscription_info) { + cJSON *hss_subscription_info_local_JSON = OpenAPI_hss_subscription_info_convertToJSON(ee_subscription_ext->hss_subscription_info); + if (hss_subscription_info_local_JSON == NULL) { + ogs_error("OpenAPI_ee_subscription_ext_convertToJSON() failed [hss_subscription_info]"); + goto end; + } + cJSON_AddItemToObject(item, "hssSubscriptionInfo", hss_subscription_info_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_ee_subscription_ext_convertToJSON() failed [hss_subscription_info]"); + goto end; + } + } + +end: + return item; +} + +OpenAPI_ee_subscription_ext_t *OpenAPI_ee_subscription_ext_parseFromJSON(cJSON *ee_subscription_extJSON) +{ + OpenAPI_ee_subscription_ext_t *ee_subscription_ext_local_var = NULL; + OpenAPI_lnode_t *node = NULL; + cJSON *callback_reference = NULL; + cJSON *monitoring_configurations = NULL; + OpenAPI_list_t *monitoring_configurationsList = NULL; + cJSON *reporting_options = NULL; + OpenAPI_reporting_options_1_t *reporting_options_local_nonprim = NULL; + cJSON *supported_features = NULL; + cJSON *subscription_id = NULL; + cJSON *context_info = NULL; + OpenAPI_context_info_t *context_info_local_nonprim = NULL; + cJSON *epc_applied_ind = NULL; + cJSON *scef_diam_host = NULL; + cJSON *scef_diam_realm = NULL; + cJSON *notify_correlation_id = NULL; + cJSON *second_callback_ref = NULL; + cJSON *gpsi = NULL; + cJSON *exclude_gpsi_list = NULL; + OpenAPI_list_t *exclude_gpsi_listList = NULL; + cJSON *include_gpsi_list = NULL; + OpenAPI_list_t *include_gpsi_listList = NULL; + cJSON *data_restoration_callback_uri = NULL; + cJSON *amf_subscription_info_list = NULL; + OpenAPI_list_t *amf_subscription_info_listList = NULL; + cJSON *smf_subscription_info = NULL; + OpenAPI_smf_subscription_info_t *smf_subscription_info_local_nonprim = NULL; + cJSON *hss_subscription_info = NULL; + OpenAPI_hss_subscription_info_t *hss_subscription_info_local_nonprim = NULL; + callback_reference = cJSON_GetObjectItemCaseSensitive(ee_subscription_extJSON, "callbackReference"); + if (!callback_reference) { + ogs_error("OpenAPI_ee_subscription_ext_parseFromJSON() failed [callback_reference]"); + goto end; + } + if (!cJSON_IsString(callback_reference)) { + ogs_error("OpenAPI_ee_subscription_ext_parseFromJSON() failed [callback_reference]"); + goto end; + } + + monitoring_configurations = cJSON_GetObjectItemCaseSensitive(ee_subscription_extJSON, "monitoringConfigurations"); + if (!monitoring_configurations) { + ogs_error("OpenAPI_ee_subscription_ext_parseFromJSON() failed [monitoring_configurations]"); + goto end; + } + cJSON *monitoring_configurations_local_map = NULL; + if (!cJSON_IsObject(monitoring_configurations) && !cJSON_IsNull(monitoring_configurations)) { + ogs_error("OpenAPI_ee_subscription_ext_parseFromJSON() failed [monitoring_configurations]"); + goto end; + } + if (cJSON_IsObject(monitoring_configurations)) { + monitoring_configurationsList = OpenAPI_list_create(); + OpenAPI_map_t *localMapKeyPair = NULL; + cJSON_ArrayForEach(monitoring_configurations_local_map, monitoring_configurations) { + cJSON *localMapObject = monitoring_configurations_local_map; + if (cJSON_IsObject(localMapObject)) { + localMapKeyPair = OpenAPI_map_create( + ogs_strdup(localMapObject->string), OpenAPI_monitoring_configuration_1_parseFromJSON(localMapObject)); + } else if (cJSON_IsNull(localMapObject)) { + localMapKeyPair = OpenAPI_map_create(ogs_strdup(localMapObject->string), NULL); + } else { + ogs_error("OpenAPI_ee_subscription_ext_parseFromJSON() failed [inner]"); + goto end; + } + OpenAPI_list_add(monitoring_configurationsList, localMapKeyPair); + } + } + + reporting_options = cJSON_GetObjectItemCaseSensitive(ee_subscription_extJSON, "reportingOptions"); + if (reporting_options) { + reporting_options_local_nonprim = OpenAPI_reporting_options_1_parseFromJSON(reporting_options); + } + + supported_features = cJSON_GetObjectItemCaseSensitive(ee_subscription_extJSON, "supportedFeatures"); + if (supported_features) { + if (!cJSON_IsString(supported_features) && !cJSON_IsNull(supported_features)) { + ogs_error("OpenAPI_ee_subscription_ext_parseFromJSON() failed [supported_features]"); + goto end; + } + } + + subscription_id = cJSON_GetObjectItemCaseSensitive(ee_subscription_extJSON, "subscriptionId"); + if (subscription_id) { + if (!cJSON_IsString(subscription_id) && !cJSON_IsNull(subscription_id)) { + ogs_error("OpenAPI_ee_subscription_ext_parseFromJSON() failed [subscription_id]"); + goto end; + } + } + + context_info = cJSON_GetObjectItemCaseSensitive(ee_subscription_extJSON, "contextInfo"); + if (context_info) { + context_info_local_nonprim = OpenAPI_context_info_parseFromJSON(context_info); + } + + epc_applied_ind = cJSON_GetObjectItemCaseSensitive(ee_subscription_extJSON, "epcAppliedInd"); + if (epc_applied_ind) { + if (!cJSON_IsBool(epc_applied_ind)) { + ogs_error("OpenAPI_ee_subscription_ext_parseFromJSON() failed [epc_applied_ind]"); + goto end; + } + } + + scef_diam_host = cJSON_GetObjectItemCaseSensitive(ee_subscription_extJSON, "scefDiamHost"); + if (scef_diam_host) { + if (!cJSON_IsString(scef_diam_host) && !cJSON_IsNull(scef_diam_host)) { + ogs_error("OpenAPI_ee_subscription_ext_parseFromJSON() failed [scef_diam_host]"); + goto end; + } + } + + scef_diam_realm = cJSON_GetObjectItemCaseSensitive(ee_subscription_extJSON, "scefDiamRealm"); + if (scef_diam_realm) { + if (!cJSON_IsString(scef_diam_realm) && !cJSON_IsNull(scef_diam_realm)) { + ogs_error("OpenAPI_ee_subscription_ext_parseFromJSON() failed [scef_diam_realm]"); + goto end; + } + } + + notify_correlation_id = cJSON_GetObjectItemCaseSensitive(ee_subscription_extJSON, "notifyCorrelationId"); + if (notify_correlation_id) { + if (!cJSON_IsString(notify_correlation_id) && !cJSON_IsNull(notify_correlation_id)) { + ogs_error("OpenAPI_ee_subscription_ext_parseFromJSON() failed [notify_correlation_id]"); + goto end; + } + } + + second_callback_ref = cJSON_GetObjectItemCaseSensitive(ee_subscription_extJSON, "secondCallbackRef"); + if (second_callback_ref) { + if (!cJSON_IsString(second_callback_ref) && !cJSON_IsNull(second_callback_ref)) { + ogs_error("OpenAPI_ee_subscription_ext_parseFromJSON() failed [second_callback_ref]"); + goto end; + } + } + + gpsi = cJSON_GetObjectItemCaseSensitive(ee_subscription_extJSON, "gpsi"); + if (gpsi) { + if (!cJSON_IsString(gpsi) && !cJSON_IsNull(gpsi)) { + ogs_error("OpenAPI_ee_subscription_ext_parseFromJSON() failed [gpsi]"); + goto end; + } + } + + exclude_gpsi_list = cJSON_GetObjectItemCaseSensitive(ee_subscription_extJSON, "excludeGpsiList"); + if (exclude_gpsi_list) { + cJSON *exclude_gpsi_list_local = NULL; + if (!cJSON_IsArray(exclude_gpsi_list)) { + ogs_error("OpenAPI_ee_subscription_ext_parseFromJSON() failed [exclude_gpsi_list]"); + goto end; + } + + exclude_gpsi_listList = OpenAPI_list_create(); + + cJSON_ArrayForEach(exclude_gpsi_list_local, exclude_gpsi_list) { + double *localDouble = NULL; + int *localInt = NULL; + if (!cJSON_IsString(exclude_gpsi_list_local)) { + ogs_error("OpenAPI_ee_subscription_ext_parseFromJSON() failed [exclude_gpsi_list]"); + goto end; + } + OpenAPI_list_add(exclude_gpsi_listList, ogs_strdup(exclude_gpsi_list_local->valuestring)); + } + } + + include_gpsi_list = cJSON_GetObjectItemCaseSensitive(ee_subscription_extJSON, "includeGpsiList"); + if (include_gpsi_list) { + cJSON *include_gpsi_list_local = NULL; + if (!cJSON_IsArray(include_gpsi_list)) { + ogs_error("OpenAPI_ee_subscription_ext_parseFromJSON() failed [include_gpsi_list]"); + goto end; + } + + include_gpsi_listList = OpenAPI_list_create(); + + cJSON_ArrayForEach(include_gpsi_list_local, include_gpsi_list) { + double *localDouble = NULL; + int *localInt = NULL; + if (!cJSON_IsString(include_gpsi_list_local)) { + ogs_error("OpenAPI_ee_subscription_ext_parseFromJSON() failed [include_gpsi_list]"); + goto end; + } + OpenAPI_list_add(include_gpsi_listList, ogs_strdup(include_gpsi_list_local->valuestring)); + } + } + + data_restoration_callback_uri = cJSON_GetObjectItemCaseSensitive(ee_subscription_extJSON, "dataRestorationCallbackUri"); + if (data_restoration_callback_uri) { + if (!cJSON_IsString(data_restoration_callback_uri) && !cJSON_IsNull(data_restoration_callback_uri)) { + ogs_error("OpenAPI_ee_subscription_ext_parseFromJSON() failed [data_restoration_callback_uri]"); + goto end; + } + } + + amf_subscription_info_list = cJSON_GetObjectItemCaseSensitive(ee_subscription_extJSON, "amfSubscriptionInfoList"); + if (amf_subscription_info_list) { + cJSON *amf_subscription_info_list_local = NULL; + if (!cJSON_IsArray(amf_subscription_info_list)) { + ogs_error("OpenAPI_ee_subscription_ext_parseFromJSON() failed [amf_subscription_info_list]"); + goto end; + } + + amf_subscription_info_listList = OpenAPI_list_create(); + + cJSON_ArrayForEach(amf_subscription_info_list_local, amf_subscription_info_list) { + if (!cJSON_IsObject(amf_subscription_info_list_local)) { + ogs_error("OpenAPI_ee_subscription_ext_parseFromJSON() failed [amf_subscription_info_list]"); + goto end; + } + OpenAPI_amf_subscription_info_t *amf_subscription_info_listItem = OpenAPI_amf_subscription_info_parseFromJSON(amf_subscription_info_list_local); + if (!amf_subscription_info_listItem) { + ogs_error("No amf_subscription_info_listItem"); + OpenAPI_list_free(amf_subscription_info_listList); + goto end; + } + OpenAPI_list_add(amf_subscription_info_listList, amf_subscription_info_listItem); + } + } + + smf_subscription_info = cJSON_GetObjectItemCaseSensitive(ee_subscription_extJSON, "smfSubscriptionInfo"); + if (smf_subscription_info) { + smf_subscription_info_local_nonprim = OpenAPI_smf_subscription_info_parseFromJSON(smf_subscription_info); + } + + hss_subscription_info = cJSON_GetObjectItemCaseSensitive(ee_subscription_extJSON, "hssSubscriptionInfo"); + if (hss_subscription_info) { + hss_subscription_info_local_nonprim = OpenAPI_hss_subscription_info_parseFromJSON(hss_subscription_info); + } + + ee_subscription_ext_local_var = OpenAPI_ee_subscription_ext_create ( + ogs_strdup(callback_reference->valuestring), + monitoring_configurationsList, + reporting_options ? reporting_options_local_nonprim : NULL, + supported_features && !cJSON_IsNull(supported_features) ? ogs_strdup(supported_features->valuestring) : NULL, + subscription_id && !cJSON_IsNull(subscription_id) ? ogs_strdup(subscription_id->valuestring) : NULL, + context_info ? context_info_local_nonprim : NULL, + epc_applied_ind ? true : false, + epc_applied_ind ? epc_applied_ind->valueint : 0, + scef_diam_host && !cJSON_IsNull(scef_diam_host) ? ogs_strdup(scef_diam_host->valuestring) : NULL, + scef_diam_realm && !cJSON_IsNull(scef_diam_realm) ? ogs_strdup(scef_diam_realm->valuestring) : NULL, + notify_correlation_id && !cJSON_IsNull(notify_correlation_id) ? ogs_strdup(notify_correlation_id->valuestring) : NULL, + second_callback_ref && !cJSON_IsNull(second_callback_ref) ? ogs_strdup(second_callback_ref->valuestring) : NULL, + gpsi && !cJSON_IsNull(gpsi) ? ogs_strdup(gpsi->valuestring) : NULL, + exclude_gpsi_list ? exclude_gpsi_listList : NULL, + include_gpsi_list ? include_gpsi_listList : NULL, + data_restoration_callback_uri && !cJSON_IsNull(data_restoration_callback_uri) ? ogs_strdup(data_restoration_callback_uri->valuestring) : NULL, + amf_subscription_info_list ? amf_subscription_info_listList : NULL, + smf_subscription_info ? smf_subscription_info_local_nonprim : NULL, + hss_subscription_info ? hss_subscription_info_local_nonprim : NULL + ); + + return ee_subscription_ext_local_var; +end: + if (monitoring_configurationsList) { + OpenAPI_list_for_each(monitoring_configurationsList, node) { + OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*) node->data; + ogs_free(localKeyValue->key); + OpenAPI_monitoring_configuration_1_free(localKeyValue->value); + OpenAPI_map_free(localKeyValue); + } + OpenAPI_list_free(monitoring_configurationsList); + monitoring_configurationsList = NULL; + } + if (reporting_options_local_nonprim) { + OpenAPI_reporting_options_1_free(reporting_options_local_nonprim); + reporting_options_local_nonprim = NULL; + } + if (context_info_local_nonprim) { + OpenAPI_context_info_free(context_info_local_nonprim); + context_info_local_nonprim = NULL; + } + if (exclude_gpsi_listList) { + OpenAPI_list_for_each(exclude_gpsi_listList, node) { + ogs_free(node->data); + } + OpenAPI_list_free(exclude_gpsi_listList); + exclude_gpsi_listList = NULL; + } + if (include_gpsi_listList) { + OpenAPI_list_for_each(include_gpsi_listList, node) { + ogs_free(node->data); + } + OpenAPI_list_free(include_gpsi_listList); + include_gpsi_listList = NULL; + } + if (amf_subscription_info_listList) { + OpenAPI_list_for_each(amf_subscription_info_listList, node) { + OpenAPI_amf_subscription_info_free(node->data); + } + OpenAPI_list_free(amf_subscription_info_listList); + amf_subscription_info_listList = NULL; + } + if (smf_subscription_info_local_nonprim) { + OpenAPI_smf_subscription_info_free(smf_subscription_info_local_nonprim); + smf_subscription_info_local_nonprim = NULL; + } + if (hss_subscription_info_local_nonprim) { + OpenAPI_hss_subscription_info_free(hss_subscription_info_local_nonprim); + hss_subscription_info_local_nonprim = NULL; + } + return NULL; +} + +OpenAPI_ee_subscription_ext_t *OpenAPI_ee_subscription_ext_copy(OpenAPI_ee_subscription_ext_t *dst, OpenAPI_ee_subscription_ext_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_ee_subscription_ext_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_ee_subscription_ext_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_ee_subscription_ext_free(dst); + dst = OpenAPI_ee_subscription_ext_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/ee_subscription_ext.h b/lib/sbi/openapi/model/ee_subscription_ext.h new file mode 100644 index 000000000..3be54c7ba --- /dev/null +++ b/lib/sbi/openapi/model/ee_subscription_ext.h @@ -0,0 +1,80 @@ +/* + * ee_subscription_ext.h + * + * + */ + +#ifndef _OpenAPI_ee_subscription_ext_H_ +#define _OpenAPI_ee_subscription_ext_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "amf_subscription_info.h" +#include "context_info.h" +#include "hss_subscription_info.h" +#include "monitoring_configuration_1.h" +#include "reporting_options_1.h" +#include "smf_subscription_info.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_ee_subscription_ext_s OpenAPI_ee_subscription_ext_t; +typedef struct OpenAPI_ee_subscription_ext_s { + char *callback_reference; + OpenAPI_list_t* monitoring_configurations; + struct OpenAPI_reporting_options_1_s *reporting_options; + char *supported_features; + char *subscription_id; + struct OpenAPI_context_info_s *context_info; + bool is_epc_applied_ind; + int epc_applied_ind; + char *scef_diam_host; + char *scef_diam_realm; + char *notify_correlation_id; + char *second_callback_ref; + char *gpsi; + OpenAPI_list_t *exclude_gpsi_list; + OpenAPI_list_t *include_gpsi_list; + char *data_restoration_callback_uri; + OpenAPI_list_t *amf_subscription_info_list; + struct OpenAPI_smf_subscription_info_s *smf_subscription_info; + struct OpenAPI_hss_subscription_info_s *hss_subscription_info; +} OpenAPI_ee_subscription_ext_t; + +OpenAPI_ee_subscription_ext_t *OpenAPI_ee_subscription_ext_create( + char *callback_reference, + OpenAPI_list_t* monitoring_configurations, + OpenAPI_reporting_options_1_t *reporting_options, + char *supported_features, + char *subscription_id, + OpenAPI_context_info_t *context_info, + bool is_epc_applied_ind, + int epc_applied_ind, + char *scef_diam_host, + char *scef_diam_realm, + char *notify_correlation_id, + char *second_callback_ref, + char *gpsi, + OpenAPI_list_t *exclude_gpsi_list, + OpenAPI_list_t *include_gpsi_list, + char *data_restoration_callback_uri, + OpenAPI_list_t *amf_subscription_info_list, + OpenAPI_smf_subscription_info_t *smf_subscription_info, + OpenAPI_hss_subscription_info_t *hss_subscription_info +); +void OpenAPI_ee_subscription_ext_free(OpenAPI_ee_subscription_ext_t *ee_subscription_ext); +OpenAPI_ee_subscription_ext_t *OpenAPI_ee_subscription_ext_parseFromJSON(cJSON *ee_subscription_extJSON); +cJSON *OpenAPI_ee_subscription_ext_convertToJSON(OpenAPI_ee_subscription_ext_t *ee_subscription_ext); +OpenAPI_ee_subscription_ext_t *OpenAPI_ee_subscription_ext_copy(OpenAPI_ee_subscription_ext_t *dst, OpenAPI_ee_subscription_ext_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_ee_subscription_ext_H_ */ + diff --git a/lib/sbi/openapi/model/ellipsoid_arc.h b/lib/sbi/openapi/model/ellipsoid_arc.h index 053d0e8d9..8136f4ec6 100644 --- a/lib/sbi/openapi/model/ellipsoid_arc.h +++ b/lib/sbi/openapi/model/ellipsoid_arc.h @@ -1,7 +1,7 @@ /* * ellipsoid_arc.h * - * + * Ellipsoid Arc. */ #ifndef _OpenAPI_ellipsoid_arc_H_ diff --git a/lib/sbi/openapi/model/emergency_info.c b/lib/sbi/openapi/model/emergency_info.c index 838122171..fe2ebba95 100644 --- a/lib/sbi/openapi/model/emergency_info.c +++ b/lib/sbi/openapi/model/emergency_info.c @@ -9,7 +9,8 @@ OpenAPI_emergency_info_t *OpenAPI_emergency_info_create( OpenAPI_ip_address_t *pgw_ip_address, char *smf_instance_id, bool is_epdg_ind, - int epdg_ind + int epdg_ind, + OpenAPI_plmn_id_t *plmn_id ) { OpenAPI_emergency_info_t *emergency_info_local_var = ogs_malloc(sizeof(OpenAPI_emergency_info_t)); @@ -20,6 +21,7 @@ OpenAPI_emergency_info_t *OpenAPI_emergency_info_create( emergency_info_local_var->smf_instance_id = smf_instance_id; emergency_info_local_var->is_epdg_ind = is_epdg_ind; emergency_info_local_var->epdg_ind = epdg_ind; + emergency_info_local_var->plmn_id = plmn_id; return emergency_info_local_var; } @@ -43,6 +45,10 @@ void OpenAPI_emergency_info_free(OpenAPI_emergency_info_t *emergency_info) ogs_free(emergency_info->smf_instance_id); emergency_info->smf_instance_id = NULL; } + if (emergency_info->plmn_id) { + OpenAPI_plmn_id_free(emergency_info->plmn_id); + emergency_info->plmn_id = NULL; + } ogs_free(emergency_info); } @@ -91,6 +97,19 @@ cJSON *OpenAPI_emergency_info_convertToJSON(OpenAPI_emergency_info_t *emergency_ } } + if (emergency_info->plmn_id) { + cJSON *plmn_id_local_JSON = OpenAPI_plmn_id_convertToJSON(emergency_info->plmn_id); + if (plmn_id_local_JSON == NULL) { + ogs_error("OpenAPI_emergency_info_convertToJSON() failed [plmn_id]"); + goto end; + } + cJSON_AddItemToObject(item, "plmnId", plmn_id_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_emergency_info_convertToJSON() failed [plmn_id]"); + goto end; + } + } + end: return item; } @@ -104,6 +123,8 @@ OpenAPI_emergency_info_t *OpenAPI_emergency_info_parseFromJSON(cJSON *emergency_ OpenAPI_ip_address_t *pgw_ip_address_local_nonprim = NULL; cJSON *smf_instance_id = NULL; cJSON *epdg_ind = NULL; + cJSON *plmn_id = NULL; + OpenAPI_plmn_id_t *plmn_id_local_nonprim = NULL; pgw_fqdn = cJSON_GetObjectItemCaseSensitive(emergency_infoJSON, "pgwFqdn"); if (pgw_fqdn) { if (!cJSON_IsString(pgw_fqdn) && !cJSON_IsNull(pgw_fqdn)) { @@ -133,12 +154,18 @@ OpenAPI_emergency_info_t *OpenAPI_emergency_info_parseFromJSON(cJSON *emergency_ } } + plmn_id = cJSON_GetObjectItemCaseSensitive(emergency_infoJSON, "plmnId"); + if (plmn_id) { + plmn_id_local_nonprim = OpenAPI_plmn_id_parseFromJSON(plmn_id); + } + emergency_info_local_var = OpenAPI_emergency_info_create ( pgw_fqdn && !cJSON_IsNull(pgw_fqdn) ? ogs_strdup(pgw_fqdn->valuestring) : NULL, pgw_ip_address ? pgw_ip_address_local_nonprim : NULL, smf_instance_id && !cJSON_IsNull(smf_instance_id) ? ogs_strdup(smf_instance_id->valuestring) : NULL, epdg_ind ? true : false, - epdg_ind ? epdg_ind->valueint : 0 + epdg_ind ? epdg_ind->valueint : 0, + plmn_id ? plmn_id_local_nonprim : NULL ); return emergency_info_local_var; @@ -147,6 +174,10 @@ end: OpenAPI_ip_address_free(pgw_ip_address_local_nonprim); pgw_ip_address_local_nonprim = NULL; } + if (plmn_id_local_nonprim) { + OpenAPI_plmn_id_free(plmn_id_local_nonprim); + plmn_id_local_nonprim = NULL; + } return NULL; } diff --git a/lib/sbi/openapi/model/emergency_info.h b/lib/sbi/openapi/model/emergency_info.h index 66fe5238f..d5fe4ead3 100644 --- a/lib/sbi/openapi/model/emergency_info.h +++ b/lib/sbi/openapi/model/emergency_info.h @@ -13,6 +13,7 @@ #include "../include/keyValuePair.h" #include "../include/binary.h" #include "ip_address.h" +#include "plmn_id.h" #ifdef __cplusplus extern "C" { @@ -25,6 +26,7 @@ typedef struct OpenAPI_emergency_info_s { char *smf_instance_id; bool is_epdg_ind; int epdg_ind; + struct OpenAPI_plmn_id_s *plmn_id; } OpenAPI_emergency_info_t; OpenAPI_emergency_info_t *OpenAPI_emergency_info_create( @@ -32,7 +34,8 @@ OpenAPI_emergency_info_t *OpenAPI_emergency_info_create( OpenAPI_ip_address_t *pgw_ip_address, char *smf_instance_id, bool is_epdg_ind, - int epdg_ind + int epdg_ind, + OpenAPI_plmn_id_t *plmn_id ); void OpenAPI_emergency_info_free(OpenAPI_emergency_info_t *emergency_info); OpenAPI_emergency_info_t *OpenAPI_emergency_info_parseFromJSON(cJSON *emergency_infoJSON); diff --git a/lib/sbi/openapi/model/emergency_info_1.c b/lib/sbi/openapi/model/emergency_info_1.c deleted file mode 100644 index 5c2afbdf8..000000000 --- a/lib/sbi/openapi/model/emergency_info_1.c +++ /dev/null @@ -1,186 +0,0 @@ - -#include -#include -#include -#include "emergency_info_1.h" - -OpenAPI_emergency_info_1_t *OpenAPI_emergency_info_1_create( - char *pgw_fqdn, - OpenAPI_ip_address_1_t *pgw_ip_address, - char *smf_instance_id, - bool is_epdg_ind, - int epdg_ind -) -{ - OpenAPI_emergency_info_1_t *emergency_info_1_local_var = ogs_malloc(sizeof(OpenAPI_emergency_info_1_t)); - ogs_assert(emergency_info_1_local_var); - - emergency_info_1_local_var->pgw_fqdn = pgw_fqdn; - emergency_info_1_local_var->pgw_ip_address = pgw_ip_address; - emergency_info_1_local_var->smf_instance_id = smf_instance_id; - emergency_info_1_local_var->is_epdg_ind = is_epdg_ind; - emergency_info_1_local_var->epdg_ind = epdg_ind; - - return emergency_info_1_local_var; -} - -void OpenAPI_emergency_info_1_free(OpenAPI_emergency_info_1_t *emergency_info_1) -{ - OpenAPI_lnode_t *node = NULL; - - if (NULL == emergency_info_1) { - return; - } - if (emergency_info_1->pgw_fqdn) { - ogs_free(emergency_info_1->pgw_fqdn); - emergency_info_1->pgw_fqdn = NULL; - } - if (emergency_info_1->pgw_ip_address) { - OpenAPI_ip_address_1_free(emergency_info_1->pgw_ip_address); - emergency_info_1->pgw_ip_address = NULL; - } - if (emergency_info_1->smf_instance_id) { - ogs_free(emergency_info_1->smf_instance_id); - emergency_info_1->smf_instance_id = NULL; - } - ogs_free(emergency_info_1); -} - -cJSON *OpenAPI_emergency_info_1_convertToJSON(OpenAPI_emergency_info_1_t *emergency_info_1) -{ - cJSON *item = NULL; - OpenAPI_lnode_t *node = NULL; - - if (emergency_info_1 == NULL) { - ogs_error("OpenAPI_emergency_info_1_convertToJSON() failed [EmergencyInfo_1]"); - return NULL; - } - - item = cJSON_CreateObject(); - if (emergency_info_1->pgw_fqdn) { - if (cJSON_AddStringToObject(item, "pgwFqdn", emergency_info_1->pgw_fqdn) == NULL) { - ogs_error("OpenAPI_emergency_info_1_convertToJSON() failed [pgw_fqdn]"); - goto end; - } - } - - if (emergency_info_1->pgw_ip_address) { - cJSON *pgw_ip_address_local_JSON = OpenAPI_ip_address_1_convertToJSON(emergency_info_1->pgw_ip_address); - if (pgw_ip_address_local_JSON == NULL) { - ogs_error("OpenAPI_emergency_info_1_convertToJSON() failed [pgw_ip_address]"); - goto end; - } - cJSON_AddItemToObject(item, "pgwIpAddress", pgw_ip_address_local_JSON); - if (item->child == NULL) { - ogs_error("OpenAPI_emergency_info_1_convertToJSON() failed [pgw_ip_address]"); - goto end; - } - } - - if (emergency_info_1->smf_instance_id) { - if (cJSON_AddStringToObject(item, "smfInstanceId", emergency_info_1->smf_instance_id) == NULL) { - ogs_error("OpenAPI_emergency_info_1_convertToJSON() failed [smf_instance_id]"); - goto end; - } - } - - if (emergency_info_1->is_epdg_ind) { - if (cJSON_AddBoolToObject(item, "epdgInd", emergency_info_1->epdg_ind) == NULL) { - ogs_error("OpenAPI_emergency_info_1_convertToJSON() failed [epdg_ind]"); - goto end; - } - } - -end: - return item; -} - -OpenAPI_emergency_info_1_t *OpenAPI_emergency_info_1_parseFromJSON(cJSON *emergency_info_1JSON) -{ - OpenAPI_emergency_info_1_t *emergency_info_1_local_var = NULL; - OpenAPI_lnode_t *node = NULL; - cJSON *pgw_fqdn = NULL; - cJSON *pgw_ip_address = NULL; - OpenAPI_ip_address_1_t *pgw_ip_address_local_nonprim = NULL; - cJSON *smf_instance_id = NULL; - cJSON *epdg_ind = NULL; - pgw_fqdn = cJSON_GetObjectItemCaseSensitive(emergency_info_1JSON, "pgwFqdn"); - if (pgw_fqdn) { - if (!cJSON_IsString(pgw_fqdn) && !cJSON_IsNull(pgw_fqdn)) { - ogs_error("OpenAPI_emergency_info_1_parseFromJSON() failed [pgw_fqdn]"); - goto end; - } - } - - pgw_ip_address = cJSON_GetObjectItemCaseSensitive(emergency_info_1JSON, "pgwIpAddress"); - if (pgw_ip_address) { - pgw_ip_address_local_nonprim = OpenAPI_ip_address_1_parseFromJSON(pgw_ip_address); - } - - smf_instance_id = cJSON_GetObjectItemCaseSensitive(emergency_info_1JSON, "smfInstanceId"); - if (smf_instance_id) { - if (!cJSON_IsString(smf_instance_id) && !cJSON_IsNull(smf_instance_id)) { - ogs_error("OpenAPI_emergency_info_1_parseFromJSON() failed [smf_instance_id]"); - goto end; - } - } - - epdg_ind = cJSON_GetObjectItemCaseSensitive(emergency_info_1JSON, "epdgInd"); - if (epdg_ind) { - if (!cJSON_IsBool(epdg_ind)) { - ogs_error("OpenAPI_emergency_info_1_parseFromJSON() failed [epdg_ind]"); - goto end; - } - } - - emergency_info_1_local_var = OpenAPI_emergency_info_1_create ( - pgw_fqdn && !cJSON_IsNull(pgw_fqdn) ? ogs_strdup(pgw_fqdn->valuestring) : NULL, - pgw_ip_address ? pgw_ip_address_local_nonprim : NULL, - smf_instance_id && !cJSON_IsNull(smf_instance_id) ? ogs_strdup(smf_instance_id->valuestring) : NULL, - epdg_ind ? true : false, - epdg_ind ? epdg_ind->valueint : 0 - ); - - return emergency_info_1_local_var; -end: - if (pgw_ip_address_local_nonprim) { - OpenAPI_ip_address_1_free(pgw_ip_address_local_nonprim); - pgw_ip_address_local_nonprim = NULL; - } - return NULL; -} - -OpenAPI_emergency_info_1_t *OpenAPI_emergency_info_1_copy(OpenAPI_emergency_info_1_t *dst, OpenAPI_emergency_info_1_t *src) -{ - cJSON *item = NULL; - char *content = NULL; - - ogs_assert(src); - item = OpenAPI_emergency_info_1_convertToJSON(src); - if (!item) { - ogs_error("OpenAPI_emergency_info_1_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_emergency_info_1_free(dst); - dst = OpenAPI_emergency_info_1_parseFromJSON(item); - cJSON_Delete(item); - - return dst; -} - diff --git a/lib/sbi/openapi/model/emergency_info_1.h b/lib/sbi/openapi/model/emergency_info_1.h deleted file mode 100644 index 2e7547c71..000000000 --- a/lib/sbi/openapi/model/emergency_info_1.h +++ /dev/null @@ -1,47 +0,0 @@ -/* - * emergency_info_1.h - * - * - */ - -#ifndef _OpenAPI_emergency_info_1_H_ -#define _OpenAPI_emergency_info_1_H_ - -#include -#include "../external/cJSON.h" -#include "../include/list.h" -#include "../include/keyValuePair.h" -#include "../include/binary.h" -#include "ip_address_1.h" - -#ifdef __cplusplus -extern "C" { -#endif - -typedef struct OpenAPI_emergency_info_1_s OpenAPI_emergency_info_1_t; -typedef struct OpenAPI_emergency_info_1_s { - char *pgw_fqdn; - struct OpenAPI_ip_address_1_s *pgw_ip_address; - char *smf_instance_id; - bool is_epdg_ind; - int epdg_ind; -} OpenAPI_emergency_info_1_t; - -OpenAPI_emergency_info_1_t *OpenAPI_emergency_info_1_create( - char *pgw_fqdn, - OpenAPI_ip_address_1_t *pgw_ip_address, - char *smf_instance_id, - bool is_epdg_ind, - int epdg_ind -); -void OpenAPI_emergency_info_1_free(OpenAPI_emergency_info_1_t *emergency_info_1); -OpenAPI_emergency_info_1_t *OpenAPI_emergency_info_1_parseFromJSON(cJSON *emergency_info_1JSON); -cJSON *OpenAPI_emergency_info_1_convertToJSON(OpenAPI_emergency_info_1_t *emergency_info_1); -OpenAPI_emergency_info_1_t *OpenAPI_emergency_info_1_copy(OpenAPI_emergency_info_1_t *dst, OpenAPI_emergency_info_1_t *src); - -#ifdef __cplusplus -} -#endif - -#endif /* _OpenAPI_emergency_info_1_H_ */ - diff --git a/lib/sbi/openapi/model/eps_bearer_info.h b/lib/sbi/openapi/model/eps_bearer_info.h index b9c11a7b2..5d8009306 100644 --- a/lib/sbi/openapi/model/eps_bearer_info.h +++ b/lib/sbi/openapi/model/eps_bearer_info.h @@ -1,7 +1,7 @@ /* * eps_bearer_info.h * - * + * EPS Bearer Information from H-SMF to V-SMF, or from SMF to I-SMF */ #ifndef _OpenAPI_eps_bearer_info_H_ diff --git a/lib/sbi/openapi/model/eps_iwk_pgw.c b/lib/sbi/openapi/model/eps_iwk_pgw.c index 5a093c17e..cdce42d7c 100644 --- a/lib/sbi/openapi/model/eps_iwk_pgw.c +++ b/lib/sbi/openapi/model/eps_iwk_pgw.c @@ -6,7 +6,8 @@ OpenAPI_eps_iwk_pgw_t *OpenAPI_eps_iwk_pgw_create( char *pgw_fqdn, - char *smf_instance_id + char *smf_instance_id, + OpenAPI_plmn_id_t *plmn_id ) { OpenAPI_eps_iwk_pgw_t *eps_iwk_pgw_local_var = ogs_malloc(sizeof(OpenAPI_eps_iwk_pgw_t)); @@ -14,6 +15,7 @@ OpenAPI_eps_iwk_pgw_t *OpenAPI_eps_iwk_pgw_create( eps_iwk_pgw_local_var->pgw_fqdn = pgw_fqdn; eps_iwk_pgw_local_var->smf_instance_id = smf_instance_id; + eps_iwk_pgw_local_var->plmn_id = plmn_id; return eps_iwk_pgw_local_var; } @@ -33,6 +35,10 @@ void OpenAPI_eps_iwk_pgw_free(OpenAPI_eps_iwk_pgw_t *eps_iwk_pgw) ogs_free(eps_iwk_pgw->smf_instance_id); eps_iwk_pgw->smf_instance_id = NULL; } + if (eps_iwk_pgw->plmn_id) { + OpenAPI_plmn_id_free(eps_iwk_pgw->plmn_id); + eps_iwk_pgw->plmn_id = NULL; + } ogs_free(eps_iwk_pgw); } @@ -65,6 +71,19 @@ cJSON *OpenAPI_eps_iwk_pgw_convertToJSON(OpenAPI_eps_iwk_pgw_t *eps_iwk_pgw) goto end; } + if (eps_iwk_pgw->plmn_id) { + cJSON *plmn_id_local_JSON = OpenAPI_plmn_id_convertToJSON(eps_iwk_pgw->plmn_id); + if (plmn_id_local_JSON == NULL) { + ogs_error("OpenAPI_eps_iwk_pgw_convertToJSON() failed [plmn_id]"); + goto end; + } + cJSON_AddItemToObject(item, "plmnId", plmn_id_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_eps_iwk_pgw_convertToJSON() failed [plmn_id]"); + goto end; + } + } + end: return item; } @@ -75,6 +94,8 @@ OpenAPI_eps_iwk_pgw_t *OpenAPI_eps_iwk_pgw_parseFromJSON(cJSON *eps_iwk_pgwJSON) OpenAPI_lnode_t *node = NULL; cJSON *pgw_fqdn = NULL; cJSON *smf_instance_id = NULL; + cJSON *plmn_id = NULL; + OpenAPI_plmn_id_t *plmn_id_local_nonprim = NULL; pgw_fqdn = cJSON_GetObjectItemCaseSensitive(eps_iwk_pgwJSON, "pgwFqdn"); if (!pgw_fqdn) { ogs_error("OpenAPI_eps_iwk_pgw_parseFromJSON() failed [pgw_fqdn]"); @@ -95,13 +116,23 @@ OpenAPI_eps_iwk_pgw_t *OpenAPI_eps_iwk_pgw_parseFromJSON(cJSON *eps_iwk_pgwJSON) goto end; } + plmn_id = cJSON_GetObjectItemCaseSensitive(eps_iwk_pgwJSON, "plmnId"); + if (plmn_id) { + plmn_id_local_nonprim = OpenAPI_plmn_id_parseFromJSON(plmn_id); + } + eps_iwk_pgw_local_var = OpenAPI_eps_iwk_pgw_create ( ogs_strdup(pgw_fqdn->valuestring), - ogs_strdup(smf_instance_id->valuestring) + ogs_strdup(smf_instance_id->valuestring), + plmn_id ? plmn_id_local_nonprim : NULL ); return eps_iwk_pgw_local_var; end: + if (plmn_id_local_nonprim) { + OpenAPI_plmn_id_free(plmn_id_local_nonprim); + plmn_id_local_nonprim = NULL; + } return NULL; } diff --git a/lib/sbi/openapi/model/eps_iwk_pgw.h b/lib/sbi/openapi/model/eps_iwk_pgw.h index b74ef76d8..146f26f5c 100644 --- a/lib/sbi/openapi/model/eps_iwk_pgw.h +++ b/lib/sbi/openapi/model/eps_iwk_pgw.h @@ -12,6 +12,7 @@ #include "../include/list.h" #include "../include/keyValuePair.h" #include "../include/binary.h" +#include "plmn_id.h" #ifdef __cplusplus extern "C" { @@ -21,11 +22,13 @@ typedef struct OpenAPI_eps_iwk_pgw_s OpenAPI_eps_iwk_pgw_t; typedef struct OpenAPI_eps_iwk_pgw_s { char *pgw_fqdn; char *smf_instance_id; + struct OpenAPI_plmn_id_s *plmn_id; } OpenAPI_eps_iwk_pgw_t; OpenAPI_eps_iwk_pgw_t *OpenAPI_eps_iwk_pgw_create( char *pgw_fqdn, - char *smf_instance_id + char *smf_instance_id, + OpenAPI_plmn_id_t *plmn_id ); void OpenAPI_eps_iwk_pgw_free(OpenAPI_eps_iwk_pgw_t *eps_iwk_pgw); OpenAPI_eps_iwk_pgw_t *OpenAPI_eps_iwk_pgw_parseFromJSON(cJSON *eps_iwk_pgwJSON); diff --git a/lib/sbi/openapi/model/eps_nas_security_mode.h b/lib/sbi/openapi/model/eps_nas_security_mode.h index 815435165..b5f0d1343 100644 --- a/lib/sbi/openapi/model/eps_nas_security_mode.h +++ b/lib/sbi/openapi/model/eps_nas_security_mode.h @@ -1,7 +1,7 @@ /* * eps_nas_security_mode.h * - * + * Indicates the EPS NAS Security Mode */ #ifndef _OpenAPI_eps_nas_security_mode_H_ diff --git a/lib/sbi/openapi/model/eps_pdn_cnx_info.h b/lib/sbi/openapi/model/eps_pdn_cnx_info.h index 2722da600..b636415dc 100644 --- a/lib/sbi/openapi/model/eps_pdn_cnx_info.h +++ b/lib/sbi/openapi/model/eps_pdn_cnx_info.h @@ -1,7 +1,7 @@ /* * eps_pdn_cnx_info.h * - * + * EPS PDN Connection Information from H-SMF to V-SMF, or from SMF to I-SMF */ #ifndef _OpenAPI_eps_pdn_cnx_info_H_ diff --git a/lib/sbi/openapi/model/error_report.c b/lib/sbi/openapi/model/error_report.c index 7cbf0bc94..dec319ba2 100644 --- a/lib/sbi/openapi/model/error_report.c +++ b/lib/sbi/openapi/model/error_report.c @@ -9,7 +9,7 @@ OpenAPI_error_report_t *OpenAPI_error_report_create( OpenAPI_list_t *rule_reports, OpenAPI_list_t *sess_rule_reports, OpenAPI_list_t *pol_dec_failure_reports, - char *alt_qos_param_id + OpenAPI_list_t *invalid_policy_decs ) { OpenAPI_error_report_t *error_report_local_var = ogs_malloc(sizeof(OpenAPI_error_report_t)); @@ -19,7 +19,7 @@ OpenAPI_error_report_t *OpenAPI_error_report_create( error_report_local_var->rule_reports = rule_reports; error_report_local_var->sess_rule_reports = sess_rule_reports; error_report_local_var->pol_dec_failure_reports = pol_dec_failure_reports; - error_report_local_var->alt_qos_param_id = alt_qos_param_id; + error_report_local_var->invalid_policy_decs = invalid_policy_decs; return error_report_local_var; } @@ -53,9 +53,12 @@ void OpenAPI_error_report_free(OpenAPI_error_report_t *error_report) OpenAPI_list_free(error_report->pol_dec_failure_reports); error_report->pol_dec_failure_reports = NULL; } - if (error_report->alt_qos_param_id) { - ogs_free(error_report->alt_qos_param_id); - error_report->alt_qos_param_id = NULL; + if (error_report->invalid_policy_decs) { + OpenAPI_list_for_each(error_report->invalid_policy_decs, node) { + OpenAPI_invalid_param_free(node->data); + } + OpenAPI_list_free(error_report->invalid_policy_decs); + error_report->invalid_policy_decs = NULL; } ogs_free(error_report); } @@ -130,11 +133,20 @@ cJSON *OpenAPI_error_report_convertToJSON(OpenAPI_error_report_t *error_report) } } - if (error_report->alt_qos_param_id) { - if (cJSON_AddStringToObject(item, "altQosParamId", error_report->alt_qos_param_id) == NULL) { - ogs_error("OpenAPI_error_report_convertToJSON() failed [alt_qos_param_id]"); + if (error_report->invalid_policy_decs) { + cJSON *invalid_policy_decsList = cJSON_AddArrayToObject(item, "invalidPolicyDecs"); + if (invalid_policy_decsList == NULL) { + ogs_error("OpenAPI_error_report_convertToJSON() failed [invalid_policy_decs]"); goto end; } + OpenAPI_list_for_each(error_report->invalid_policy_decs, node) { + cJSON *itemLocal = OpenAPI_invalid_param_convertToJSON(node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_error_report_convertToJSON() failed [invalid_policy_decs]"); + goto end; + } + cJSON_AddItemToArray(invalid_policy_decsList, itemLocal); + } } end: @@ -153,7 +165,8 @@ OpenAPI_error_report_t *OpenAPI_error_report_parseFromJSON(cJSON *error_reportJS OpenAPI_list_t *sess_rule_reportsList = NULL; cJSON *pol_dec_failure_reports = NULL; OpenAPI_list_t *pol_dec_failure_reportsList = NULL; - cJSON *alt_qos_param_id = NULL; + cJSON *invalid_policy_decs = NULL; + OpenAPI_list_t *invalid_policy_decsList = NULL; error = cJSON_GetObjectItemCaseSensitive(error_reportJSON, "error"); if (error) { error_local_nonprim = OpenAPI_problem_details_parseFromJSON(error); @@ -228,12 +241,29 @@ OpenAPI_error_report_t *OpenAPI_error_report_parseFromJSON(cJSON *error_reportJS } } - alt_qos_param_id = cJSON_GetObjectItemCaseSensitive(error_reportJSON, "altQosParamId"); - if (alt_qos_param_id) { - if (!cJSON_IsString(alt_qos_param_id) && !cJSON_IsNull(alt_qos_param_id)) { - ogs_error("OpenAPI_error_report_parseFromJSON() failed [alt_qos_param_id]"); - goto end; - } + invalid_policy_decs = cJSON_GetObjectItemCaseSensitive(error_reportJSON, "invalidPolicyDecs"); + if (invalid_policy_decs) { + cJSON *invalid_policy_decs_local = NULL; + if (!cJSON_IsArray(invalid_policy_decs)) { + ogs_error("OpenAPI_error_report_parseFromJSON() failed [invalid_policy_decs]"); + goto end; + } + + invalid_policy_decsList = OpenAPI_list_create(); + + cJSON_ArrayForEach(invalid_policy_decs_local, invalid_policy_decs) { + if (!cJSON_IsObject(invalid_policy_decs_local)) { + ogs_error("OpenAPI_error_report_parseFromJSON() failed [invalid_policy_decs]"); + goto end; + } + OpenAPI_invalid_param_t *invalid_policy_decsItem = OpenAPI_invalid_param_parseFromJSON(invalid_policy_decs_local); + if (!invalid_policy_decsItem) { + ogs_error("No invalid_policy_decsItem"); + OpenAPI_list_free(invalid_policy_decsList); + goto end; + } + OpenAPI_list_add(invalid_policy_decsList, invalid_policy_decsItem); + } } error_report_local_var = OpenAPI_error_report_create ( @@ -241,7 +271,7 @@ OpenAPI_error_report_t *OpenAPI_error_report_parseFromJSON(cJSON *error_reportJS rule_reports ? rule_reportsList : NULL, sess_rule_reports ? sess_rule_reportsList : NULL, pol_dec_failure_reports ? pol_dec_failure_reportsList : NULL, - alt_qos_param_id && !cJSON_IsNull(alt_qos_param_id) ? ogs_strdup(alt_qos_param_id->valuestring) : NULL + invalid_policy_decs ? invalid_policy_decsList : NULL ); return error_report_local_var; @@ -268,6 +298,13 @@ end: OpenAPI_list_free(pol_dec_failure_reportsList); pol_dec_failure_reportsList = NULL; } + if (invalid_policy_decsList) { + OpenAPI_list_for_each(invalid_policy_decsList, node) { + OpenAPI_invalid_param_free(node->data); + } + OpenAPI_list_free(invalid_policy_decsList); + invalid_policy_decsList = NULL; + } return NULL; } diff --git a/lib/sbi/openapi/model/error_report.h b/lib/sbi/openapi/model/error_report.h index e64f9835a..1379998a7 100644 --- a/lib/sbi/openapi/model/error_report.h +++ b/lib/sbi/openapi/model/error_report.h @@ -1,7 +1,7 @@ /* * error_report.h * - * + * Contains the rule error reports. */ #ifndef _OpenAPI_error_report_H_ @@ -12,6 +12,7 @@ #include "../include/list.h" #include "../include/keyValuePair.h" #include "../include/binary.h" +#include "invalid_param.h" #include "policy_decision_failure_code.h" #include "problem_details.h" #include "rule_report.h" @@ -27,7 +28,7 @@ typedef struct OpenAPI_error_report_s { OpenAPI_list_t *rule_reports; OpenAPI_list_t *sess_rule_reports; OpenAPI_list_t *pol_dec_failure_reports; - char *alt_qos_param_id; + OpenAPI_list_t *invalid_policy_decs; } OpenAPI_error_report_t; OpenAPI_error_report_t *OpenAPI_error_report_create( @@ -35,7 +36,7 @@ OpenAPI_error_report_t *OpenAPI_error_report_create( OpenAPI_list_t *rule_reports, OpenAPI_list_t *sess_rule_reports, OpenAPI_list_t *pol_dec_failure_reports, - char *alt_qos_param_id + OpenAPI_list_t *invalid_policy_decs ); void OpenAPI_error_report_free(OpenAPI_error_report_t *error_report); OpenAPI_error_report_t *OpenAPI_error_report_parseFromJSON(cJSON *error_reportJSON); diff --git a/lib/sbi/openapi/model/eth_flow_description.h b/lib/sbi/openapi/model/eth_flow_description.h index d9dfeca69..f20447b08 100644 --- a/lib/sbi/openapi/model/eth_flow_description.h +++ b/lib/sbi/openapi/model/eth_flow_description.h @@ -1,7 +1,7 @@ /* * eth_flow_description.h * - * Identifies an Ethernet flow + * Identifies an Ethernet flow. */ #ifndef _OpenAPI_eth_flow_description_H_ diff --git a/lib/sbi/openapi/model/eutra_location.h b/lib/sbi/openapi/model/eutra_location.h index 98d219687..7d97e6342 100644 --- a/lib/sbi/openapi/model/eutra_location.h +++ b/lib/sbi/openapi/model/eutra_location.h @@ -1,7 +1,7 @@ /* * eutra_location.h * - * + * Contains the E-UTRA user location. */ #ifndef _OpenAPI_eutra_location_H_ diff --git a/lib/sbi/openapi/model/event.c b/lib/sbi/openapi/model/event.c new file mode 100644 index 000000000..c320978ca --- /dev/null +++ b/lib/sbi/openapi/model/event.c @@ -0,0 +1,87 @@ + +#include +#include +#include +#include "event.h" + +OpenAPI_event_t *OpenAPI_event_create( +) +{ + OpenAPI_event_t *event_local_var = ogs_malloc(sizeof(OpenAPI_event_t)); + ogs_assert(event_local_var); + + + return event_local_var; +} + +void OpenAPI_event_free(OpenAPI_event_t *event) +{ + OpenAPI_lnode_t *node = NULL; + + if (NULL == event) { + return; + } + ogs_free(event); +} + +cJSON *OpenAPI_event_convertToJSON(OpenAPI_event_t *event) +{ + cJSON *item = NULL; + OpenAPI_lnode_t *node = NULL; + + if (event == NULL) { + ogs_error("OpenAPI_event_convertToJSON() failed [Event]"); + return NULL; + } + + item = cJSON_CreateObject(); +end: + return item; +} + +OpenAPI_event_t *OpenAPI_event_parseFromJSON(cJSON *eventJSON) +{ + OpenAPI_event_t *event_local_var = NULL; + OpenAPI_lnode_t *node = NULL; + event_local_var = OpenAPI_event_create ( + ); + + return event_local_var; +end: + return NULL; +} + +OpenAPI_event_t *OpenAPI_event_copy(OpenAPI_event_t *dst, OpenAPI_event_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_event_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_event_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_event_free(dst); + dst = OpenAPI_event_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/event.h b/lib/sbi/openapi/model/event.h new file mode 100644 index 000000000..4c33ac348 --- /dev/null +++ b/lib/sbi/openapi/model/event.h @@ -0,0 +1,37 @@ +/* + * event.h + * + * Possible values are: - SUCCESS_UE_POL_DEL_SP: Successful UE Policy Delivery related to the invocation of AF provisioned Service Parameters. - UNSUCCESS_UE_POL_DEL_SP: Unsuccessful UE Policy Delivery related to the invocation of AF provisioned Service Parameters. + */ + +#ifndef _OpenAPI_event_H_ +#define _OpenAPI_event_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "event_any_of.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_event_s OpenAPI_event_t; +typedef struct OpenAPI_event_s { +} OpenAPI_event_t; + +OpenAPI_event_t *OpenAPI_event_create( +); +void OpenAPI_event_free(OpenAPI_event_t *event); +OpenAPI_event_t *OpenAPI_event_parseFromJSON(cJSON *eventJSON); +cJSON *OpenAPI_event_convertToJSON(OpenAPI_event_t *event); +OpenAPI_event_t *OpenAPI_event_copy(OpenAPI_event_t *dst, OpenAPI_event_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_event_H_ */ + diff --git a/lib/sbi/openapi/model/event_any_of.c b/lib/sbi/openapi/model/event_any_of.c new file mode 100644 index 000000000..4c0ec2319 --- /dev/null +++ b/lib/sbi/openapi/model/event_any_of.c @@ -0,0 +1,30 @@ + +#include +#include +#include +#include "event_any_of.h" + +char* OpenAPI_event_any_of_ToString(OpenAPI_event_any_of_e event_any_of) +{ + const char *event_any_ofArray[] = { "NULL", "SUCCESS_UE_POL_DEL_SP", "UNSUCCESS_UE_POL_DEL_SP" }; + size_t sizeofArray = sizeof(event_any_ofArray) / sizeof(event_any_ofArray[0]); + if (event_any_of < sizeofArray) + return (char *)event_any_ofArray[event_any_of]; + else + return (char *)"Unknown"; +} + +OpenAPI_event_any_of_e OpenAPI_event_any_of_FromString(char* event_any_of) +{ + int stringToReturn = 0; + const char *event_any_ofArray[] = { "NULL", "SUCCESS_UE_POL_DEL_SP", "UNSUCCESS_UE_POL_DEL_SP" }; + size_t sizeofArray = sizeof(event_any_ofArray) / sizeof(event_any_ofArray[0]); + while (stringToReturn < sizeofArray) { + if (strcmp(event_any_of, event_any_ofArray[stringToReturn]) == 0) { + return stringToReturn; + } + stringToReturn++; + } + return 0; +} + diff --git a/lib/sbi/openapi/model/event_any_of.h b/lib/sbi/openapi/model/event_any_of.h new file mode 100644 index 000000000..7091eb6d4 --- /dev/null +++ b/lib/sbi/openapi/model/event_any_of.h @@ -0,0 +1,31 @@ +/* + * event_any_of.h + * + * + */ + +#ifndef _OpenAPI_event_any_of_H_ +#define _OpenAPI_event_any_of_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef enum { OpenAPI_event_any_of_NULL = 0, OpenAPI_event_any_of_SUCCESS_UE_POL_DEL_SP, OpenAPI_event_any_of_UNSUCCESS_UE_POL_DEL_SP } OpenAPI_event_any_of_e; + +char* OpenAPI_event_any_of_ToString(OpenAPI_event_any_of_e event_any_of); + +OpenAPI_event_any_of_e OpenAPI_event_any_of_FromString(char* event_any_of); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_event_any_of_H_ */ + diff --git a/lib/sbi/openapi/model/event_id.h b/lib/sbi/openapi/model/event_id.h index 3eceb20f7..2adf38dad 100644 --- a/lib/sbi/openapi/model/event_id.h +++ b/lib/sbi/openapi/model/event_id.h @@ -1,7 +1,7 @@ /* * event_id.h * - * Possible values are - LOAD_LEVEL_INFORMATION: Represent the analytics of load level information of corresponding network slice. - NETWORK_PERFORMANCE: Represent the analytics of network performance information. - NF_LOAD: Indicates that the event subscribed is NF Load. - SERVICE_EXPERIENCE: Represent the analytics of service experience information of the specific applications. - UE_MOBILITY: Represent the analytics of UE mobility. - UE_COMMUNICATION: Represent the analytics of UE communication. - QOS_SUSTAINABILITY: Represent the analytics of QoS sustainability information in the certain area. - ABNORMAL_BEHAVIOUR: Indicates that the event subscribed is abnormal behaviour information. - USER_DATA_CONGESTION: Represent the analytics of the user data congestion in the certain area. - NSI_LOAD_LEVEL: Represent the analytics of Network Slice and the optionally associated Network Slice Instance. + * Possible values are: - LOAD_LEVEL_INFORMATION: Represent the analytics of load level information of corresponding network slice. - NETWORK_PERFORMANCE: Represent the analytics of network performance information. - NF_LOAD: Indicates that the event subscribed is NF Load. - SERVICE_EXPERIENCE: Represent the analytics of service experience information of the specific applications. - UE_MOBILITY: Represent the analytics of UE mobility. - UE_COMMUNICATION: Represent the analytics of UE communication. - QOS_SUSTAINABILITY: Represent the analytics of QoS sustainability information in the certain area. - ABNORMAL_BEHAVIOUR: Indicates that the event subscribed is abnormal behaviour information. - USER_DATA_CONGESTION: Represent the analytics of the user data congestion in the certain area. - NSI_LOAD_LEVEL: Represent the analytics of Network Slice and the optionally associated Network Slice Instance. - SM_CONGESTION: Represent the analytics of Session Management congestion control experience information for specific DNN and/or S-NSSAI. - DISPERSION: Represents the analytics of dispersion. - RED_TRANS_EXP: Represents the analytics of Redundant Transmission Experience. - WLAN_PERFORMANCE: Represents the analytics of WLAN performance. - DN_PERFORMANCE: Represents the analytics of DN performance. */ #ifndef _OpenAPI_event_id_H_ diff --git a/lib/sbi/openapi/model/event_id_any_of.c b/lib/sbi/openapi/model/event_id_any_of.c index 52d7f08c5..0bc48d59a 100644 --- a/lib/sbi/openapi/model/event_id_any_of.c +++ b/lib/sbi/openapi/model/event_id_any_of.c @@ -6,7 +6,7 @@ char* OpenAPI_event_id_any_of_ToString(OpenAPI_event_id_any_of_e event_id_any_of) { - const char *event_id_any_ofArray[] = { "NULL", "LOAD_LEVEL_INFORMATION", "NETWORK_PERFORMANCE", "NF_LOAD", "SERVICE_EXPERIENCE", "UE_MOBILITY", "UE_COMMUNICATION", "QOS_SUSTAINABILITY", "ABNORMAL_BEHAVIOUR", "USER_DATA_CONGESTION", "NSI_LOAD_LEVEL" }; + const char *event_id_any_ofArray[] = { "NULL", "LOAD_LEVEL_INFORMATION", "NETWORK_PERFORMANCE", "NF_LOAD", "SERVICE_EXPERIENCE", "UE_MOBILITY", "UE_COMMUNICATION", "QOS_SUSTAINABILITY", "ABNORMAL_BEHAVIOUR", "USER_DATA_CONGESTION", "NSI_LOAD_LEVEL", "SM_CONGESTION", "DISPERSION", "RED_TRANS_EXP", "WLAN_PERFORMANCE", "DN_PERFORMANCE" }; size_t sizeofArray = sizeof(event_id_any_ofArray) / sizeof(event_id_any_ofArray[0]); if (event_id_any_of < sizeofArray) return (char *)event_id_any_ofArray[event_id_any_of]; @@ -17,7 +17,7 @@ char* OpenAPI_event_id_any_of_ToString(OpenAPI_event_id_any_of_e event_id_any_of OpenAPI_event_id_any_of_e OpenAPI_event_id_any_of_FromString(char* event_id_any_of) { int stringToReturn = 0; - const char *event_id_any_ofArray[] = { "NULL", "LOAD_LEVEL_INFORMATION", "NETWORK_PERFORMANCE", "NF_LOAD", "SERVICE_EXPERIENCE", "UE_MOBILITY", "UE_COMMUNICATION", "QOS_SUSTAINABILITY", "ABNORMAL_BEHAVIOUR", "USER_DATA_CONGESTION", "NSI_LOAD_LEVEL" }; + const char *event_id_any_ofArray[] = { "NULL", "LOAD_LEVEL_INFORMATION", "NETWORK_PERFORMANCE", "NF_LOAD", "SERVICE_EXPERIENCE", "UE_MOBILITY", "UE_COMMUNICATION", "QOS_SUSTAINABILITY", "ABNORMAL_BEHAVIOUR", "USER_DATA_CONGESTION", "NSI_LOAD_LEVEL", "SM_CONGESTION", "DISPERSION", "RED_TRANS_EXP", "WLAN_PERFORMANCE", "DN_PERFORMANCE" }; size_t sizeofArray = sizeof(event_id_any_ofArray) / sizeof(event_id_any_ofArray[0]); while (stringToReturn < sizeofArray) { if (strcmp(event_id_any_of, event_id_any_ofArray[stringToReturn]) == 0) { diff --git a/lib/sbi/openapi/model/event_id_any_of.h b/lib/sbi/openapi/model/event_id_any_of.h index da2f3f4c6..b8980bfe9 100644 --- a/lib/sbi/openapi/model/event_id_any_of.h +++ b/lib/sbi/openapi/model/event_id_any_of.h @@ -17,7 +17,7 @@ extern "C" { #endif -typedef enum { OpenAPI_event_id_any_of_NULL = 0, OpenAPI_event_id_any_of_LOAD_LEVEL_INFORMATION, OpenAPI_event_id_any_of_NETWORK_PERFORMANCE, OpenAPI_event_id_any_of_NF_LOAD, OpenAPI_event_id_any_of_SERVICE_EXPERIENCE, OpenAPI_event_id_any_of_UE_MOBILITY, OpenAPI_event_id_any_of_UE_COMMUNICATION, OpenAPI_event_id_any_of_QOS_SUSTAINABILITY, OpenAPI_event_id_any_of_ABNORMAL_BEHAVIOUR, OpenAPI_event_id_any_of_USER_DATA_CONGESTION, OpenAPI_event_id_any_of_NSI_LOAD_LEVEL } OpenAPI_event_id_any_of_e; +typedef enum { OpenAPI_event_id_any_of_NULL = 0, OpenAPI_event_id_any_of_LOAD_LEVEL_INFORMATION, OpenAPI_event_id_any_of_NETWORK_PERFORMANCE, OpenAPI_event_id_any_of_NF_LOAD, OpenAPI_event_id_any_of_SERVICE_EXPERIENCE, OpenAPI_event_id_any_of_UE_MOBILITY, OpenAPI_event_id_any_of_UE_COMMUNICATION, OpenAPI_event_id_any_of_QOS_SUSTAINABILITY, OpenAPI_event_id_any_of_ABNORMAL_BEHAVIOUR, OpenAPI_event_id_any_of_USER_DATA_CONGESTION, OpenAPI_event_id_any_of_NSI_LOAD_LEVEL, OpenAPI_event_id_any_of_SM_CONGESTION, OpenAPI_event_id_any_of_DISPERSION, OpenAPI_event_id_any_of_RED_TRANS_EXP, OpenAPI_event_id_any_of_WLAN_PERFORMANCE, OpenAPI_event_id_any_of_DN_PERFORMANCE } OpenAPI_event_id_any_of_e; char* OpenAPI_event_id_any_of_ToString(OpenAPI_event_id_any_of_e event_id_any_of); diff --git a/lib/sbi/openapi/model/event_notification.c b/lib/sbi/openapi/model/event_notification.c new file mode 100644 index 000000000..406970ce6 --- /dev/null +++ b/lib/sbi/openapi/model/event_notification.c @@ -0,0 +1,1146 @@ + +#include +#include +#include +#include "event_notification.h" + +OpenAPI_event_notification_t *OpenAPI_event_notification_create( + OpenAPI_nwdaf_event_t *event, + char *start, + char *expiry, + char *time_stamp_gen, + OpenAPI_nwdaf_failure_code_t *fail_notify_code, + bool is_rv_wait_time, + int rv_wait_time, + OpenAPI_analytics_metadata_info_t *ana_meta_info, + OpenAPI_list_t *nf_load_level_infos, + OpenAPI_list_t *nsi_load_level_infos, + OpenAPI_slice_load_level_information_t *slice_load_level_info, + OpenAPI_list_t *svc_exps, + OpenAPI_list_t *qos_sustain_infos, + OpenAPI_list_t *ue_comms, + OpenAPI_list_t *ue_mobs, + OpenAPI_list_t *user_data_cong_infos, + OpenAPI_list_t *abnor_behavrs, + OpenAPI_list_t *nw_perfs, + OpenAPI_list_t *dn_perf_infos, + OpenAPI_list_t *disper_infos, + OpenAPI_list_t *red_trans_infos, + OpenAPI_list_t *wlan_infos, + OpenAPI_list_t *smcc_exps +) +{ + OpenAPI_event_notification_t *event_notification_local_var = ogs_malloc(sizeof(OpenAPI_event_notification_t)); + ogs_assert(event_notification_local_var); + + event_notification_local_var->event = event; + event_notification_local_var->start = start; + event_notification_local_var->expiry = expiry; + event_notification_local_var->time_stamp_gen = time_stamp_gen; + event_notification_local_var->fail_notify_code = fail_notify_code; + event_notification_local_var->is_rv_wait_time = is_rv_wait_time; + event_notification_local_var->rv_wait_time = rv_wait_time; + event_notification_local_var->ana_meta_info = ana_meta_info; + event_notification_local_var->nf_load_level_infos = nf_load_level_infos; + event_notification_local_var->nsi_load_level_infos = nsi_load_level_infos; + event_notification_local_var->slice_load_level_info = slice_load_level_info; + event_notification_local_var->svc_exps = svc_exps; + event_notification_local_var->qos_sustain_infos = qos_sustain_infos; + event_notification_local_var->ue_comms = ue_comms; + event_notification_local_var->ue_mobs = ue_mobs; + event_notification_local_var->user_data_cong_infos = user_data_cong_infos; + event_notification_local_var->abnor_behavrs = abnor_behavrs; + event_notification_local_var->nw_perfs = nw_perfs; + event_notification_local_var->dn_perf_infos = dn_perf_infos; + event_notification_local_var->disper_infos = disper_infos; + event_notification_local_var->red_trans_infos = red_trans_infos; + event_notification_local_var->wlan_infos = wlan_infos; + event_notification_local_var->smcc_exps = smcc_exps; + + return event_notification_local_var; +} + +void OpenAPI_event_notification_free(OpenAPI_event_notification_t *event_notification) +{ + OpenAPI_lnode_t *node = NULL; + + if (NULL == event_notification) { + return; + } + if (event_notification->event) { + OpenAPI_nwdaf_event_free(event_notification->event); + event_notification->event = NULL; + } + if (event_notification->start) { + ogs_free(event_notification->start); + event_notification->start = NULL; + } + if (event_notification->expiry) { + ogs_free(event_notification->expiry); + event_notification->expiry = NULL; + } + if (event_notification->time_stamp_gen) { + ogs_free(event_notification->time_stamp_gen); + event_notification->time_stamp_gen = NULL; + } + if (event_notification->fail_notify_code) { + OpenAPI_nwdaf_failure_code_free(event_notification->fail_notify_code); + event_notification->fail_notify_code = NULL; + } + if (event_notification->ana_meta_info) { + OpenAPI_analytics_metadata_info_free(event_notification->ana_meta_info); + event_notification->ana_meta_info = NULL; + } + if (event_notification->nf_load_level_infos) { + OpenAPI_list_for_each(event_notification->nf_load_level_infos, node) { + OpenAPI_nf_load_level_information_free(node->data); + } + OpenAPI_list_free(event_notification->nf_load_level_infos); + event_notification->nf_load_level_infos = NULL; + } + if (event_notification->nsi_load_level_infos) { + OpenAPI_list_for_each(event_notification->nsi_load_level_infos, node) { + OpenAPI_nsi_load_level_info_free(node->data); + } + OpenAPI_list_free(event_notification->nsi_load_level_infos); + event_notification->nsi_load_level_infos = NULL; + } + if (event_notification->slice_load_level_info) { + OpenAPI_slice_load_level_information_free(event_notification->slice_load_level_info); + event_notification->slice_load_level_info = NULL; + } + if (event_notification->svc_exps) { + OpenAPI_list_for_each(event_notification->svc_exps, node) { + OpenAPI_service_experience_info_free(node->data); + } + OpenAPI_list_free(event_notification->svc_exps); + event_notification->svc_exps = NULL; + } + if (event_notification->qos_sustain_infos) { + OpenAPI_list_for_each(event_notification->qos_sustain_infos, node) { + OpenAPI_qos_sustainability_info_free(node->data); + } + OpenAPI_list_free(event_notification->qos_sustain_infos); + event_notification->qos_sustain_infos = NULL; + } + if (event_notification->ue_comms) { + OpenAPI_list_for_each(event_notification->ue_comms, node) { + OpenAPI_ue_communication_free(node->data); + } + OpenAPI_list_free(event_notification->ue_comms); + event_notification->ue_comms = NULL; + } + if (event_notification->ue_mobs) { + OpenAPI_list_for_each(event_notification->ue_mobs, node) { + OpenAPI_ue_mobility_free(node->data); + } + OpenAPI_list_free(event_notification->ue_mobs); + event_notification->ue_mobs = NULL; + } + if (event_notification->user_data_cong_infos) { + OpenAPI_list_for_each(event_notification->user_data_cong_infos, node) { + OpenAPI_user_data_congestion_info_free(node->data); + } + OpenAPI_list_free(event_notification->user_data_cong_infos); + event_notification->user_data_cong_infos = NULL; + } + if (event_notification->abnor_behavrs) { + OpenAPI_list_for_each(event_notification->abnor_behavrs, node) { + OpenAPI_abnormal_behaviour_free(node->data); + } + OpenAPI_list_free(event_notification->abnor_behavrs); + event_notification->abnor_behavrs = NULL; + } + if (event_notification->nw_perfs) { + OpenAPI_list_for_each(event_notification->nw_perfs, node) { + OpenAPI_network_perf_info_free(node->data); + } + OpenAPI_list_free(event_notification->nw_perfs); + event_notification->nw_perfs = NULL; + } + if (event_notification->dn_perf_infos) { + OpenAPI_list_for_each(event_notification->dn_perf_infos, node) { + OpenAPI_dn_perf_info_free(node->data); + } + OpenAPI_list_free(event_notification->dn_perf_infos); + event_notification->dn_perf_infos = NULL; + } + if (event_notification->disper_infos) { + OpenAPI_list_for_each(event_notification->disper_infos, node) { + OpenAPI_dispersion_info_free(node->data); + } + OpenAPI_list_free(event_notification->disper_infos); + event_notification->disper_infos = NULL; + } + if (event_notification->red_trans_infos) { + OpenAPI_list_for_each(event_notification->red_trans_infos, node) { + OpenAPI_redundant_transmission_exp_info_free(node->data); + } + OpenAPI_list_free(event_notification->red_trans_infos); + event_notification->red_trans_infos = NULL; + } + if (event_notification->wlan_infos) { + OpenAPI_list_for_each(event_notification->wlan_infos, node) { + OpenAPI_wlan_performance_info_free(node->data); + } + OpenAPI_list_free(event_notification->wlan_infos); + event_notification->wlan_infos = NULL; + } + if (event_notification->smcc_exps) { + OpenAPI_list_for_each(event_notification->smcc_exps, node) { + OpenAPI_smcce_info_free(node->data); + } + OpenAPI_list_free(event_notification->smcc_exps); + event_notification->smcc_exps = NULL; + } + ogs_free(event_notification); +} + +cJSON *OpenAPI_event_notification_convertToJSON(OpenAPI_event_notification_t *event_notification) +{ + cJSON *item = NULL; + OpenAPI_lnode_t *node = NULL; + + if (event_notification == NULL) { + ogs_error("OpenAPI_event_notification_convertToJSON() failed [EventNotification]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (!event_notification->event) { + ogs_error("OpenAPI_event_notification_convertToJSON() failed [event]"); + return NULL; + } + cJSON *event_local_JSON = OpenAPI_nwdaf_event_convertToJSON(event_notification->event); + if (event_local_JSON == NULL) { + ogs_error("OpenAPI_event_notification_convertToJSON() failed [event]"); + goto end; + } + cJSON_AddItemToObject(item, "event", event_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_event_notification_convertToJSON() failed [event]"); + goto end; + } + + if (event_notification->start) { + if (cJSON_AddStringToObject(item, "start", event_notification->start) == NULL) { + ogs_error("OpenAPI_event_notification_convertToJSON() failed [start]"); + goto end; + } + } + + if (event_notification->expiry) { + if (cJSON_AddStringToObject(item, "expiry", event_notification->expiry) == NULL) { + ogs_error("OpenAPI_event_notification_convertToJSON() failed [expiry]"); + goto end; + } + } + + if (event_notification->time_stamp_gen) { + if (cJSON_AddStringToObject(item, "timeStampGen", event_notification->time_stamp_gen) == NULL) { + ogs_error("OpenAPI_event_notification_convertToJSON() failed [time_stamp_gen]"); + goto end; + } + } + + if (event_notification->fail_notify_code) { + cJSON *fail_notify_code_local_JSON = OpenAPI_nwdaf_failure_code_convertToJSON(event_notification->fail_notify_code); + if (fail_notify_code_local_JSON == NULL) { + ogs_error("OpenAPI_event_notification_convertToJSON() failed [fail_notify_code]"); + goto end; + } + cJSON_AddItemToObject(item, "failNotifyCode", fail_notify_code_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_event_notification_convertToJSON() failed [fail_notify_code]"); + goto end; + } + } + + if (event_notification->is_rv_wait_time) { + if (cJSON_AddNumberToObject(item, "rvWaitTime", event_notification->rv_wait_time) == NULL) { + ogs_error("OpenAPI_event_notification_convertToJSON() failed [rv_wait_time]"); + goto end; + } + } + + if (event_notification->ana_meta_info) { + cJSON *ana_meta_info_local_JSON = OpenAPI_analytics_metadata_info_convertToJSON(event_notification->ana_meta_info); + if (ana_meta_info_local_JSON == NULL) { + ogs_error("OpenAPI_event_notification_convertToJSON() failed [ana_meta_info]"); + goto end; + } + cJSON_AddItemToObject(item, "anaMetaInfo", ana_meta_info_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_event_notification_convertToJSON() failed [ana_meta_info]"); + goto end; + } + } + + if (event_notification->nf_load_level_infos) { + cJSON *nf_load_level_infosList = cJSON_AddArrayToObject(item, "nfLoadLevelInfos"); + if (nf_load_level_infosList == NULL) { + ogs_error("OpenAPI_event_notification_convertToJSON() failed [nf_load_level_infos]"); + goto end; + } + OpenAPI_list_for_each(event_notification->nf_load_level_infos, node) { + cJSON *itemLocal = OpenAPI_nf_load_level_information_convertToJSON(node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_event_notification_convertToJSON() failed [nf_load_level_infos]"); + goto end; + } + cJSON_AddItemToArray(nf_load_level_infosList, itemLocal); + } + } + + if (event_notification->nsi_load_level_infos) { + cJSON *nsi_load_level_infosList = cJSON_AddArrayToObject(item, "nsiLoadLevelInfos"); + if (nsi_load_level_infosList == NULL) { + ogs_error("OpenAPI_event_notification_convertToJSON() failed [nsi_load_level_infos]"); + goto end; + } + OpenAPI_list_for_each(event_notification->nsi_load_level_infos, node) { + cJSON *itemLocal = OpenAPI_nsi_load_level_info_convertToJSON(node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_event_notification_convertToJSON() failed [nsi_load_level_infos]"); + goto end; + } + cJSON_AddItemToArray(nsi_load_level_infosList, itemLocal); + } + } + + if (event_notification->slice_load_level_info) { + cJSON *slice_load_level_info_local_JSON = OpenAPI_slice_load_level_information_convertToJSON(event_notification->slice_load_level_info); + if (slice_load_level_info_local_JSON == NULL) { + ogs_error("OpenAPI_event_notification_convertToJSON() failed [slice_load_level_info]"); + goto end; + } + cJSON_AddItemToObject(item, "sliceLoadLevelInfo", slice_load_level_info_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_event_notification_convertToJSON() failed [slice_load_level_info]"); + goto end; + } + } + + if (event_notification->svc_exps) { + cJSON *svc_expsList = cJSON_AddArrayToObject(item, "svcExps"); + if (svc_expsList == NULL) { + ogs_error("OpenAPI_event_notification_convertToJSON() failed [svc_exps]"); + goto end; + } + OpenAPI_list_for_each(event_notification->svc_exps, node) { + cJSON *itemLocal = OpenAPI_service_experience_info_convertToJSON(node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_event_notification_convertToJSON() failed [svc_exps]"); + goto end; + } + cJSON_AddItemToArray(svc_expsList, itemLocal); + } + } + + if (event_notification->qos_sustain_infos) { + cJSON *qos_sustain_infosList = cJSON_AddArrayToObject(item, "qosSustainInfos"); + if (qos_sustain_infosList == NULL) { + ogs_error("OpenAPI_event_notification_convertToJSON() failed [qos_sustain_infos]"); + goto end; + } + OpenAPI_list_for_each(event_notification->qos_sustain_infos, node) { + cJSON *itemLocal = OpenAPI_qos_sustainability_info_convertToJSON(node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_event_notification_convertToJSON() failed [qos_sustain_infos]"); + goto end; + } + cJSON_AddItemToArray(qos_sustain_infosList, itemLocal); + } + } + + if (event_notification->ue_comms) { + cJSON *ue_commsList = cJSON_AddArrayToObject(item, "ueComms"); + if (ue_commsList == NULL) { + ogs_error("OpenAPI_event_notification_convertToJSON() failed [ue_comms]"); + goto end; + } + OpenAPI_list_for_each(event_notification->ue_comms, node) { + cJSON *itemLocal = OpenAPI_ue_communication_convertToJSON(node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_event_notification_convertToJSON() failed [ue_comms]"); + goto end; + } + cJSON_AddItemToArray(ue_commsList, itemLocal); + } + } + + if (event_notification->ue_mobs) { + cJSON *ue_mobsList = cJSON_AddArrayToObject(item, "ueMobs"); + if (ue_mobsList == NULL) { + ogs_error("OpenAPI_event_notification_convertToJSON() failed [ue_mobs]"); + goto end; + } + OpenAPI_list_for_each(event_notification->ue_mobs, node) { + cJSON *itemLocal = OpenAPI_ue_mobility_convertToJSON(node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_event_notification_convertToJSON() failed [ue_mobs]"); + goto end; + } + cJSON_AddItemToArray(ue_mobsList, itemLocal); + } + } + + if (event_notification->user_data_cong_infos) { + cJSON *user_data_cong_infosList = cJSON_AddArrayToObject(item, "userDataCongInfos"); + if (user_data_cong_infosList == NULL) { + ogs_error("OpenAPI_event_notification_convertToJSON() failed [user_data_cong_infos]"); + goto end; + } + OpenAPI_list_for_each(event_notification->user_data_cong_infos, node) { + cJSON *itemLocal = OpenAPI_user_data_congestion_info_convertToJSON(node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_event_notification_convertToJSON() failed [user_data_cong_infos]"); + goto end; + } + cJSON_AddItemToArray(user_data_cong_infosList, itemLocal); + } + } + + if (event_notification->abnor_behavrs) { + cJSON *abnor_behavrsList = cJSON_AddArrayToObject(item, "abnorBehavrs"); + if (abnor_behavrsList == NULL) { + ogs_error("OpenAPI_event_notification_convertToJSON() failed [abnor_behavrs]"); + goto end; + } + OpenAPI_list_for_each(event_notification->abnor_behavrs, node) { + cJSON *itemLocal = OpenAPI_abnormal_behaviour_convertToJSON(node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_event_notification_convertToJSON() failed [abnor_behavrs]"); + goto end; + } + cJSON_AddItemToArray(abnor_behavrsList, itemLocal); + } + } + + if (event_notification->nw_perfs) { + cJSON *nw_perfsList = cJSON_AddArrayToObject(item, "nwPerfs"); + if (nw_perfsList == NULL) { + ogs_error("OpenAPI_event_notification_convertToJSON() failed [nw_perfs]"); + goto end; + } + OpenAPI_list_for_each(event_notification->nw_perfs, node) { + cJSON *itemLocal = OpenAPI_network_perf_info_convertToJSON(node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_event_notification_convertToJSON() failed [nw_perfs]"); + goto end; + } + cJSON_AddItemToArray(nw_perfsList, itemLocal); + } + } + + if (event_notification->dn_perf_infos) { + cJSON *dn_perf_infosList = cJSON_AddArrayToObject(item, "dnPerfInfos"); + if (dn_perf_infosList == NULL) { + ogs_error("OpenAPI_event_notification_convertToJSON() failed [dn_perf_infos]"); + goto end; + } + OpenAPI_list_for_each(event_notification->dn_perf_infos, node) { + cJSON *itemLocal = OpenAPI_dn_perf_info_convertToJSON(node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_event_notification_convertToJSON() failed [dn_perf_infos]"); + goto end; + } + cJSON_AddItemToArray(dn_perf_infosList, itemLocal); + } + } + + if (event_notification->disper_infos) { + cJSON *disper_infosList = cJSON_AddArrayToObject(item, "disperInfos"); + if (disper_infosList == NULL) { + ogs_error("OpenAPI_event_notification_convertToJSON() failed [disper_infos]"); + goto end; + } + OpenAPI_list_for_each(event_notification->disper_infos, node) { + cJSON *itemLocal = OpenAPI_dispersion_info_convertToJSON(node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_event_notification_convertToJSON() failed [disper_infos]"); + goto end; + } + cJSON_AddItemToArray(disper_infosList, itemLocal); + } + } + + if (event_notification->red_trans_infos) { + cJSON *red_trans_infosList = cJSON_AddArrayToObject(item, "redTransInfos"); + if (red_trans_infosList == NULL) { + ogs_error("OpenAPI_event_notification_convertToJSON() failed [red_trans_infos]"); + goto end; + } + OpenAPI_list_for_each(event_notification->red_trans_infos, node) { + cJSON *itemLocal = OpenAPI_redundant_transmission_exp_info_convertToJSON(node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_event_notification_convertToJSON() failed [red_trans_infos]"); + goto end; + } + cJSON_AddItemToArray(red_trans_infosList, itemLocal); + } + } + + if (event_notification->wlan_infos) { + cJSON *wlan_infosList = cJSON_AddArrayToObject(item, "wlanInfos"); + if (wlan_infosList == NULL) { + ogs_error("OpenAPI_event_notification_convertToJSON() failed [wlan_infos]"); + goto end; + } + OpenAPI_list_for_each(event_notification->wlan_infos, node) { + cJSON *itemLocal = OpenAPI_wlan_performance_info_convertToJSON(node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_event_notification_convertToJSON() failed [wlan_infos]"); + goto end; + } + cJSON_AddItemToArray(wlan_infosList, itemLocal); + } + } + + if (event_notification->smcc_exps) { + cJSON *smcc_expsList = cJSON_AddArrayToObject(item, "smccExps"); + if (smcc_expsList == NULL) { + ogs_error("OpenAPI_event_notification_convertToJSON() failed [smcc_exps]"); + goto end; + } + OpenAPI_list_for_each(event_notification->smcc_exps, node) { + cJSON *itemLocal = OpenAPI_smcce_info_convertToJSON(node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_event_notification_convertToJSON() failed [smcc_exps]"); + goto end; + } + cJSON_AddItemToArray(smcc_expsList, itemLocal); + } + } + +end: + return item; +} + +OpenAPI_event_notification_t *OpenAPI_event_notification_parseFromJSON(cJSON *event_notificationJSON) +{ + OpenAPI_event_notification_t *event_notification_local_var = NULL; + OpenAPI_lnode_t *node = NULL; + cJSON *event = NULL; + OpenAPI_nwdaf_event_t *event_local_nonprim = NULL; + cJSON *start = NULL; + cJSON *expiry = NULL; + cJSON *time_stamp_gen = NULL; + cJSON *fail_notify_code = NULL; + OpenAPI_nwdaf_failure_code_t *fail_notify_code_local_nonprim = NULL; + cJSON *rv_wait_time = NULL; + cJSON *ana_meta_info = NULL; + OpenAPI_analytics_metadata_info_t *ana_meta_info_local_nonprim = NULL; + cJSON *nf_load_level_infos = NULL; + OpenAPI_list_t *nf_load_level_infosList = NULL; + cJSON *nsi_load_level_infos = NULL; + OpenAPI_list_t *nsi_load_level_infosList = NULL; + cJSON *slice_load_level_info = NULL; + OpenAPI_slice_load_level_information_t *slice_load_level_info_local_nonprim = NULL; + cJSON *svc_exps = NULL; + OpenAPI_list_t *svc_expsList = NULL; + cJSON *qos_sustain_infos = NULL; + OpenAPI_list_t *qos_sustain_infosList = NULL; + cJSON *ue_comms = NULL; + OpenAPI_list_t *ue_commsList = NULL; + cJSON *ue_mobs = NULL; + OpenAPI_list_t *ue_mobsList = NULL; + cJSON *user_data_cong_infos = NULL; + OpenAPI_list_t *user_data_cong_infosList = NULL; + cJSON *abnor_behavrs = NULL; + OpenAPI_list_t *abnor_behavrsList = NULL; + cJSON *nw_perfs = NULL; + OpenAPI_list_t *nw_perfsList = NULL; + cJSON *dn_perf_infos = NULL; + OpenAPI_list_t *dn_perf_infosList = NULL; + cJSON *disper_infos = NULL; + OpenAPI_list_t *disper_infosList = NULL; + cJSON *red_trans_infos = NULL; + OpenAPI_list_t *red_trans_infosList = NULL; + cJSON *wlan_infos = NULL; + OpenAPI_list_t *wlan_infosList = NULL; + cJSON *smcc_exps = NULL; + OpenAPI_list_t *smcc_expsList = NULL; + event = cJSON_GetObjectItemCaseSensitive(event_notificationJSON, "event"); + if (!event) { + ogs_error("OpenAPI_event_notification_parseFromJSON() failed [event]"); + goto end; + } + event_local_nonprim = OpenAPI_nwdaf_event_parseFromJSON(event); + + start = cJSON_GetObjectItemCaseSensitive(event_notificationJSON, "start"); + if (start) { + if (!cJSON_IsString(start) && !cJSON_IsNull(start)) { + ogs_error("OpenAPI_event_notification_parseFromJSON() failed [start]"); + goto end; + } + } + + expiry = cJSON_GetObjectItemCaseSensitive(event_notificationJSON, "expiry"); + if (expiry) { + if (!cJSON_IsString(expiry) && !cJSON_IsNull(expiry)) { + ogs_error("OpenAPI_event_notification_parseFromJSON() failed [expiry]"); + goto end; + } + } + + time_stamp_gen = cJSON_GetObjectItemCaseSensitive(event_notificationJSON, "timeStampGen"); + if (time_stamp_gen) { + if (!cJSON_IsString(time_stamp_gen) && !cJSON_IsNull(time_stamp_gen)) { + ogs_error("OpenAPI_event_notification_parseFromJSON() failed [time_stamp_gen]"); + goto end; + } + } + + fail_notify_code = cJSON_GetObjectItemCaseSensitive(event_notificationJSON, "failNotifyCode"); + if (fail_notify_code) { + fail_notify_code_local_nonprim = OpenAPI_nwdaf_failure_code_parseFromJSON(fail_notify_code); + } + + rv_wait_time = cJSON_GetObjectItemCaseSensitive(event_notificationJSON, "rvWaitTime"); + if (rv_wait_time) { + if (!cJSON_IsNumber(rv_wait_time)) { + ogs_error("OpenAPI_event_notification_parseFromJSON() failed [rv_wait_time]"); + goto end; + } + } + + ana_meta_info = cJSON_GetObjectItemCaseSensitive(event_notificationJSON, "anaMetaInfo"); + if (ana_meta_info) { + ana_meta_info_local_nonprim = OpenAPI_analytics_metadata_info_parseFromJSON(ana_meta_info); + } + + nf_load_level_infos = cJSON_GetObjectItemCaseSensitive(event_notificationJSON, "nfLoadLevelInfos"); + if (nf_load_level_infos) { + cJSON *nf_load_level_infos_local = NULL; + if (!cJSON_IsArray(nf_load_level_infos)) { + ogs_error("OpenAPI_event_notification_parseFromJSON() failed [nf_load_level_infos]"); + goto end; + } + + nf_load_level_infosList = OpenAPI_list_create(); + + cJSON_ArrayForEach(nf_load_level_infos_local, nf_load_level_infos) { + if (!cJSON_IsObject(nf_load_level_infos_local)) { + ogs_error("OpenAPI_event_notification_parseFromJSON() failed [nf_load_level_infos]"); + goto end; + } + OpenAPI_nf_load_level_information_t *nf_load_level_infosItem = OpenAPI_nf_load_level_information_parseFromJSON(nf_load_level_infos_local); + if (!nf_load_level_infosItem) { + ogs_error("No nf_load_level_infosItem"); + OpenAPI_list_free(nf_load_level_infosList); + goto end; + } + OpenAPI_list_add(nf_load_level_infosList, nf_load_level_infosItem); + } + } + + nsi_load_level_infos = cJSON_GetObjectItemCaseSensitive(event_notificationJSON, "nsiLoadLevelInfos"); + if (nsi_load_level_infos) { + cJSON *nsi_load_level_infos_local = NULL; + if (!cJSON_IsArray(nsi_load_level_infos)) { + ogs_error("OpenAPI_event_notification_parseFromJSON() failed [nsi_load_level_infos]"); + goto end; + } + + nsi_load_level_infosList = OpenAPI_list_create(); + + cJSON_ArrayForEach(nsi_load_level_infos_local, nsi_load_level_infos) { + if (!cJSON_IsObject(nsi_load_level_infos_local)) { + ogs_error("OpenAPI_event_notification_parseFromJSON() failed [nsi_load_level_infos]"); + goto end; + } + OpenAPI_nsi_load_level_info_t *nsi_load_level_infosItem = OpenAPI_nsi_load_level_info_parseFromJSON(nsi_load_level_infos_local); + if (!nsi_load_level_infosItem) { + ogs_error("No nsi_load_level_infosItem"); + OpenAPI_list_free(nsi_load_level_infosList); + goto end; + } + OpenAPI_list_add(nsi_load_level_infosList, nsi_load_level_infosItem); + } + } + + slice_load_level_info = cJSON_GetObjectItemCaseSensitive(event_notificationJSON, "sliceLoadLevelInfo"); + if (slice_load_level_info) { + slice_load_level_info_local_nonprim = OpenAPI_slice_load_level_information_parseFromJSON(slice_load_level_info); + } + + svc_exps = cJSON_GetObjectItemCaseSensitive(event_notificationJSON, "svcExps"); + if (svc_exps) { + cJSON *svc_exps_local = NULL; + if (!cJSON_IsArray(svc_exps)) { + ogs_error("OpenAPI_event_notification_parseFromJSON() failed [svc_exps]"); + goto end; + } + + svc_expsList = OpenAPI_list_create(); + + cJSON_ArrayForEach(svc_exps_local, svc_exps) { + if (!cJSON_IsObject(svc_exps_local)) { + ogs_error("OpenAPI_event_notification_parseFromJSON() failed [svc_exps]"); + goto end; + } + OpenAPI_service_experience_info_t *svc_expsItem = OpenAPI_service_experience_info_parseFromJSON(svc_exps_local); + if (!svc_expsItem) { + ogs_error("No svc_expsItem"); + OpenAPI_list_free(svc_expsList); + goto end; + } + OpenAPI_list_add(svc_expsList, svc_expsItem); + } + } + + qos_sustain_infos = cJSON_GetObjectItemCaseSensitive(event_notificationJSON, "qosSustainInfos"); + if (qos_sustain_infos) { + cJSON *qos_sustain_infos_local = NULL; + if (!cJSON_IsArray(qos_sustain_infos)) { + ogs_error("OpenAPI_event_notification_parseFromJSON() failed [qos_sustain_infos]"); + goto end; + } + + qos_sustain_infosList = OpenAPI_list_create(); + + cJSON_ArrayForEach(qos_sustain_infos_local, qos_sustain_infos) { + if (!cJSON_IsObject(qos_sustain_infos_local)) { + ogs_error("OpenAPI_event_notification_parseFromJSON() failed [qos_sustain_infos]"); + goto end; + } + OpenAPI_qos_sustainability_info_t *qos_sustain_infosItem = OpenAPI_qos_sustainability_info_parseFromJSON(qos_sustain_infos_local); + if (!qos_sustain_infosItem) { + ogs_error("No qos_sustain_infosItem"); + OpenAPI_list_free(qos_sustain_infosList); + goto end; + } + OpenAPI_list_add(qos_sustain_infosList, qos_sustain_infosItem); + } + } + + ue_comms = cJSON_GetObjectItemCaseSensitive(event_notificationJSON, "ueComms"); + if (ue_comms) { + cJSON *ue_comms_local = NULL; + if (!cJSON_IsArray(ue_comms)) { + ogs_error("OpenAPI_event_notification_parseFromJSON() failed [ue_comms]"); + goto end; + } + + ue_commsList = OpenAPI_list_create(); + + cJSON_ArrayForEach(ue_comms_local, ue_comms) { + if (!cJSON_IsObject(ue_comms_local)) { + ogs_error("OpenAPI_event_notification_parseFromJSON() failed [ue_comms]"); + goto end; + } + OpenAPI_ue_communication_t *ue_commsItem = OpenAPI_ue_communication_parseFromJSON(ue_comms_local); + if (!ue_commsItem) { + ogs_error("No ue_commsItem"); + OpenAPI_list_free(ue_commsList); + goto end; + } + OpenAPI_list_add(ue_commsList, ue_commsItem); + } + } + + ue_mobs = cJSON_GetObjectItemCaseSensitive(event_notificationJSON, "ueMobs"); + if (ue_mobs) { + cJSON *ue_mobs_local = NULL; + if (!cJSON_IsArray(ue_mobs)) { + ogs_error("OpenAPI_event_notification_parseFromJSON() failed [ue_mobs]"); + goto end; + } + + ue_mobsList = OpenAPI_list_create(); + + cJSON_ArrayForEach(ue_mobs_local, ue_mobs) { + if (!cJSON_IsObject(ue_mobs_local)) { + ogs_error("OpenAPI_event_notification_parseFromJSON() failed [ue_mobs]"); + goto end; + } + OpenAPI_ue_mobility_t *ue_mobsItem = OpenAPI_ue_mobility_parseFromJSON(ue_mobs_local); + if (!ue_mobsItem) { + ogs_error("No ue_mobsItem"); + OpenAPI_list_free(ue_mobsList); + goto end; + } + OpenAPI_list_add(ue_mobsList, ue_mobsItem); + } + } + + user_data_cong_infos = cJSON_GetObjectItemCaseSensitive(event_notificationJSON, "userDataCongInfos"); + if (user_data_cong_infos) { + cJSON *user_data_cong_infos_local = NULL; + if (!cJSON_IsArray(user_data_cong_infos)) { + ogs_error("OpenAPI_event_notification_parseFromJSON() failed [user_data_cong_infos]"); + goto end; + } + + user_data_cong_infosList = OpenAPI_list_create(); + + cJSON_ArrayForEach(user_data_cong_infos_local, user_data_cong_infos) { + if (!cJSON_IsObject(user_data_cong_infos_local)) { + ogs_error("OpenAPI_event_notification_parseFromJSON() failed [user_data_cong_infos]"); + goto end; + } + OpenAPI_user_data_congestion_info_t *user_data_cong_infosItem = OpenAPI_user_data_congestion_info_parseFromJSON(user_data_cong_infos_local); + if (!user_data_cong_infosItem) { + ogs_error("No user_data_cong_infosItem"); + OpenAPI_list_free(user_data_cong_infosList); + goto end; + } + OpenAPI_list_add(user_data_cong_infosList, user_data_cong_infosItem); + } + } + + abnor_behavrs = cJSON_GetObjectItemCaseSensitive(event_notificationJSON, "abnorBehavrs"); + if (abnor_behavrs) { + cJSON *abnor_behavrs_local = NULL; + if (!cJSON_IsArray(abnor_behavrs)) { + ogs_error("OpenAPI_event_notification_parseFromJSON() failed [abnor_behavrs]"); + goto end; + } + + abnor_behavrsList = OpenAPI_list_create(); + + cJSON_ArrayForEach(abnor_behavrs_local, abnor_behavrs) { + if (!cJSON_IsObject(abnor_behavrs_local)) { + ogs_error("OpenAPI_event_notification_parseFromJSON() failed [abnor_behavrs]"); + goto end; + } + OpenAPI_abnormal_behaviour_t *abnor_behavrsItem = OpenAPI_abnormal_behaviour_parseFromJSON(abnor_behavrs_local); + if (!abnor_behavrsItem) { + ogs_error("No abnor_behavrsItem"); + OpenAPI_list_free(abnor_behavrsList); + goto end; + } + OpenAPI_list_add(abnor_behavrsList, abnor_behavrsItem); + } + } + + nw_perfs = cJSON_GetObjectItemCaseSensitive(event_notificationJSON, "nwPerfs"); + if (nw_perfs) { + cJSON *nw_perfs_local = NULL; + if (!cJSON_IsArray(nw_perfs)) { + ogs_error("OpenAPI_event_notification_parseFromJSON() failed [nw_perfs]"); + goto end; + } + + nw_perfsList = OpenAPI_list_create(); + + cJSON_ArrayForEach(nw_perfs_local, nw_perfs) { + if (!cJSON_IsObject(nw_perfs_local)) { + ogs_error("OpenAPI_event_notification_parseFromJSON() failed [nw_perfs]"); + goto end; + } + OpenAPI_network_perf_info_t *nw_perfsItem = OpenAPI_network_perf_info_parseFromJSON(nw_perfs_local); + if (!nw_perfsItem) { + ogs_error("No nw_perfsItem"); + OpenAPI_list_free(nw_perfsList); + goto end; + } + OpenAPI_list_add(nw_perfsList, nw_perfsItem); + } + } + + dn_perf_infos = cJSON_GetObjectItemCaseSensitive(event_notificationJSON, "dnPerfInfos"); + if (dn_perf_infos) { + cJSON *dn_perf_infos_local = NULL; + if (!cJSON_IsArray(dn_perf_infos)) { + ogs_error("OpenAPI_event_notification_parseFromJSON() failed [dn_perf_infos]"); + goto end; + } + + dn_perf_infosList = OpenAPI_list_create(); + + cJSON_ArrayForEach(dn_perf_infos_local, dn_perf_infos) { + if (!cJSON_IsObject(dn_perf_infos_local)) { + ogs_error("OpenAPI_event_notification_parseFromJSON() failed [dn_perf_infos]"); + goto end; + } + OpenAPI_dn_perf_info_t *dn_perf_infosItem = OpenAPI_dn_perf_info_parseFromJSON(dn_perf_infos_local); + if (!dn_perf_infosItem) { + ogs_error("No dn_perf_infosItem"); + OpenAPI_list_free(dn_perf_infosList); + goto end; + } + OpenAPI_list_add(dn_perf_infosList, dn_perf_infosItem); + } + } + + disper_infos = cJSON_GetObjectItemCaseSensitive(event_notificationJSON, "disperInfos"); + if (disper_infos) { + cJSON *disper_infos_local = NULL; + if (!cJSON_IsArray(disper_infos)) { + ogs_error("OpenAPI_event_notification_parseFromJSON() failed [disper_infos]"); + goto end; + } + + disper_infosList = OpenAPI_list_create(); + + cJSON_ArrayForEach(disper_infos_local, disper_infos) { + if (!cJSON_IsObject(disper_infos_local)) { + ogs_error("OpenAPI_event_notification_parseFromJSON() failed [disper_infos]"); + goto end; + } + OpenAPI_dispersion_info_t *disper_infosItem = OpenAPI_dispersion_info_parseFromJSON(disper_infos_local); + if (!disper_infosItem) { + ogs_error("No disper_infosItem"); + OpenAPI_list_free(disper_infosList); + goto end; + } + OpenAPI_list_add(disper_infosList, disper_infosItem); + } + } + + red_trans_infos = cJSON_GetObjectItemCaseSensitive(event_notificationJSON, "redTransInfos"); + if (red_trans_infos) { + cJSON *red_trans_infos_local = NULL; + if (!cJSON_IsArray(red_trans_infos)) { + ogs_error("OpenAPI_event_notification_parseFromJSON() failed [red_trans_infos]"); + goto end; + } + + red_trans_infosList = OpenAPI_list_create(); + + cJSON_ArrayForEach(red_trans_infos_local, red_trans_infos) { + if (!cJSON_IsObject(red_trans_infos_local)) { + ogs_error("OpenAPI_event_notification_parseFromJSON() failed [red_trans_infos]"); + goto end; + } + OpenAPI_redundant_transmission_exp_info_t *red_trans_infosItem = OpenAPI_redundant_transmission_exp_info_parseFromJSON(red_trans_infos_local); + if (!red_trans_infosItem) { + ogs_error("No red_trans_infosItem"); + OpenAPI_list_free(red_trans_infosList); + goto end; + } + OpenAPI_list_add(red_trans_infosList, red_trans_infosItem); + } + } + + wlan_infos = cJSON_GetObjectItemCaseSensitive(event_notificationJSON, "wlanInfos"); + if (wlan_infos) { + cJSON *wlan_infos_local = NULL; + if (!cJSON_IsArray(wlan_infos)) { + ogs_error("OpenAPI_event_notification_parseFromJSON() failed [wlan_infos]"); + goto end; + } + + wlan_infosList = OpenAPI_list_create(); + + cJSON_ArrayForEach(wlan_infos_local, wlan_infos) { + if (!cJSON_IsObject(wlan_infos_local)) { + ogs_error("OpenAPI_event_notification_parseFromJSON() failed [wlan_infos]"); + goto end; + } + OpenAPI_wlan_performance_info_t *wlan_infosItem = OpenAPI_wlan_performance_info_parseFromJSON(wlan_infos_local); + if (!wlan_infosItem) { + ogs_error("No wlan_infosItem"); + OpenAPI_list_free(wlan_infosList); + goto end; + } + OpenAPI_list_add(wlan_infosList, wlan_infosItem); + } + } + + smcc_exps = cJSON_GetObjectItemCaseSensitive(event_notificationJSON, "smccExps"); + if (smcc_exps) { + cJSON *smcc_exps_local = NULL; + if (!cJSON_IsArray(smcc_exps)) { + ogs_error("OpenAPI_event_notification_parseFromJSON() failed [smcc_exps]"); + goto end; + } + + smcc_expsList = OpenAPI_list_create(); + + cJSON_ArrayForEach(smcc_exps_local, smcc_exps) { + if (!cJSON_IsObject(smcc_exps_local)) { + ogs_error("OpenAPI_event_notification_parseFromJSON() failed [smcc_exps]"); + goto end; + } + OpenAPI_smcce_info_t *smcc_expsItem = OpenAPI_smcce_info_parseFromJSON(smcc_exps_local); + if (!smcc_expsItem) { + ogs_error("No smcc_expsItem"); + OpenAPI_list_free(smcc_expsList); + goto end; + } + OpenAPI_list_add(smcc_expsList, smcc_expsItem); + } + } + + event_notification_local_var = OpenAPI_event_notification_create ( + event_local_nonprim, + start && !cJSON_IsNull(start) ? ogs_strdup(start->valuestring) : NULL, + expiry && !cJSON_IsNull(expiry) ? ogs_strdup(expiry->valuestring) : NULL, + time_stamp_gen && !cJSON_IsNull(time_stamp_gen) ? ogs_strdup(time_stamp_gen->valuestring) : NULL, + fail_notify_code ? fail_notify_code_local_nonprim : NULL, + rv_wait_time ? true : false, + rv_wait_time ? rv_wait_time->valuedouble : 0, + ana_meta_info ? ana_meta_info_local_nonprim : NULL, + nf_load_level_infos ? nf_load_level_infosList : NULL, + nsi_load_level_infos ? nsi_load_level_infosList : NULL, + slice_load_level_info ? slice_load_level_info_local_nonprim : NULL, + svc_exps ? svc_expsList : NULL, + qos_sustain_infos ? qos_sustain_infosList : NULL, + ue_comms ? ue_commsList : NULL, + ue_mobs ? ue_mobsList : NULL, + user_data_cong_infos ? user_data_cong_infosList : NULL, + abnor_behavrs ? abnor_behavrsList : NULL, + nw_perfs ? nw_perfsList : NULL, + dn_perf_infos ? dn_perf_infosList : NULL, + disper_infos ? disper_infosList : NULL, + red_trans_infos ? red_trans_infosList : NULL, + wlan_infos ? wlan_infosList : NULL, + smcc_exps ? smcc_expsList : NULL + ); + + return event_notification_local_var; +end: + if (event_local_nonprim) { + OpenAPI_nwdaf_event_free(event_local_nonprim); + event_local_nonprim = NULL; + } + if (fail_notify_code_local_nonprim) { + OpenAPI_nwdaf_failure_code_free(fail_notify_code_local_nonprim); + fail_notify_code_local_nonprim = NULL; + } + if (ana_meta_info_local_nonprim) { + OpenAPI_analytics_metadata_info_free(ana_meta_info_local_nonprim); + ana_meta_info_local_nonprim = NULL; + } + if (nf_load_level_infosList) { + OpenAPI_list_for_each(nf_load_level_infosList, node) { + OpenAPI_nf_load_level_information_free(node->data); + } + OpenAPI_list_free(nf_load_level_infosList); + nf_load_level_infosList = NULL; + } + if (nsi_load_level_infosList) { + OpenAPI_list_for_each(nsi_load_level_infosList, node) { + OpenAPI_nsi_load_level_info_free(node->data); + } + OpenAPI_list_free(nsi_load_level_infosList); + nsi_load_level_infosList = NULL; + } + if (slice_load_level_info_local_nonprim) { + OpenAPI_slice_load_level_information_free(slice_load_level_info_local_nonprim); + slice_load_level_info_local_nonprim = NULL; + } + if (svc_expsList) { + OpenAPI_list_for_each(svc_expsList, node) { + OpenAPI_service_experience_info_free(node->data); + } + OpenAPI_list_free(svc_expsList); + svc_expsList = NULL; + } + if (qos_sustain_infosList) { + OpenAPI_list_for_each(qos_sustain_infosList, node) { + OpenAPI_qos_sustainability_info_free(node->data); + } + OpenAPI_list_free(qos_sustain_infosList); + qos_sustain_infosList = NULL; + } + if (ue_commsList) { + OpenAPI_list_for_each(ue_commsList, node) { + OpenAPI_ue_communication_free(node->data); + } + OpenAPI_list_free(ue_commsList); + ue_commsList = NULL; + } + if (ue_mobsList) { + OpenAPI_list_for_each(ue_mobsList, node) { + OpenAPI_ue_mobility_free(node->data); + } + OpenAPI_list_free(ue_mobsList); + ue_mobsList = NULL; + } + if (user_data_cong_infosList) { + OpenAPI_list_for_each(user_data_cong_infosList, node) { + OpenAPI_user_data_congestion_info_free(node->data); + } + OpenAPI_list_free(user_data_cong_infosList); + user_data_cong_infosList = NULL; + } + if (abnor_behavrsList) { + OpenAPI_list_for_each(abnor_behavrsList, node) { + OpenAPI_abnormal_behaviour_free(node->data); + } + OpenAPI_list_free(abnor_behavrsList); + abnor_behavrsList = NULL; + } + if (nw_perfsList) { + OpenAPI_list_for_each(nw_perfsList, node) { + OpenAPI_network_perf_info_free(node->data); + } + OpenAPI_list_free(nw_perfsList); + nw_perfsList = NULL; + } + if (dn_perf_infosList) { + OpenAPI_list_for_each(dn_perf_infosList, node) { + OpenAPI_dn_perf_info_free(node->data); + } + OpenAPI_list_free(dn_perf_infosList); + dn_perf_infosList = NULL; + } + if (disper_infosList) { + OpenAPI_list_for_each(disper_infosList, node) { + OpenAPI_dispersion_info_free(node->data); + } + OpenAPI_list_free(disper_infosList); + disper_infosList = NULL; + } + if (red_trans_infosList) { + OpenAPI_list_for_each(red_trans_infosList, node) { + OpenAPI_redundant_transmission_exp_info_free(node->data); + } + OpenAPI_list_free(red_trans_infosList); + red_trans_infosList = NULL; + } + if (wlan_infosList) { + OpenAPI_list_for_each(wlan_infosList, node) { + OpenAPI_wlan_performance_info_free(node->data); + } + OpenAPI_list_free(wlan_infosList); + wlan_infosList = NULL; + } + if (smcc_expsList) { + OpenAPI_list_for_each(smcc_expsList, node) { + OpenAPI_smcce_info_free(node->data); + } + OpenAPI_list_free(smcc_expsList); + smcc_expsList = NULL; + } + return NULL; +} + +OpenAPI_event_notification_t *OpenAPI_event_notification_copy(OpenAPI_event_notification_t *dst, OpenAPI_event_notification_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_event_notification_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_event_notification_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_event_notification_free(dst); + dst = OpenAPI_event_notification_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/event_notification.h b/lib/sbi/openapi/model/event_notification.h new file mode 100644 index 000000000..2186b3f4e --- /dev/null +++ b/lib/sbi/openapi/model/event_notification.h @@ -0,0 +1,100 @@ +/* + * event_notification.h + * + * Represents a notification on events that occurred. + */ + +#ifndef _OpenAPI_event_notification_H_ +#define _OpenAPI_event_notification_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "abnormal_behaviour.h" +#include "analytics_metadata_info.h" +#include "dispersion_info.h" +#include "dn_perf_info.h" +#include "network_perf_info.h" +#include "nf_load_level_information.h" +#include "nsi_load_level_info.h" +#include "nwdaf_event.h" +#include "nwdaf_failure_code.h" +#include "qos_sustainability_info.h" +#include "redundant_transmission_exp_info.h" +#include "service_experience_info.h" +#include "slice_load_level_information.h" +#include "smcce_info.h" +#include "ue_communication.h" +#include "ue_mobility.h" +#include "user_data_congestion_info.h" +#include "wlan_performance_info.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_event_notification_s OpenAPI_event_notification_t; +typedef struct OpenAPI_event_notification_s { + struct OpenAPI_nwdaf_event_s *event; + char *start; + char *expiry; + char *time_stamp_gen; + struct OpenAPI_nwdaf_failure_code_s *fail_notify_code; + bool is_rv_wait_time; + int rv_wait_time; + struct OpenAPI_analytics_metadata_info_s *ana_meta_info; + OpenAPI_list_t *nf_load_level_infos; + OpenAPI_list_t *nsi_load_level_infos; + struct OpenAPI_slice_load_level_information_s *slice_load_level_info; + OpenAPI_list_t *svc_exps; + OpenAPI_list_t *qos_sustain_infos; + OpenAPI_list_t *ue_comms; + OpenAPI_list_t *ue_mobs; + OpenAPI_list_t *user_data_cong_infos; + OpenAPI_list_t *abnor_behavrs; + OpenAPI_list_t *nw_perfs; + OpenAPI_list_t *dn_perf_infos; + OpenAPI_list_t *disper_infos; + OpenAPI_list_t *red_trans_infos; + OpenAPI_list_t *wlan_infos; + OpenAPI_list_t *smcc_exps; +} OpenAPI_event_notification_t; + +OpenAPI_event_notification_t *OpenAPI_event_notification_create( + OpenAPI_nwdaf_event_t *event, + char *start, + char *expiry, + char *time_stamp_gen, + OpenAPI_nwdaf_failure_code_t *fail_notify_code, + bool is_rv_wait_time, + int rv_wait_time, + OpenAPI_analytics_metadata_info_t *ana_meta_info, + OpenAPI_list_t *nf_load_level_infos, + OpenAPI_list_t *nsi_load_level_infos, + OpenAPI_slice_load_level_information_t *slice_load_level_info, + OpenAPI_list_t *svc_exps, + OpenAPI_list_t *qos_sustain_infos, + OpenAPI_list_t *ue_comms, + OpenAPI_list_t *ue_mobs, + OpenAPI_list_t *user_data_cong_infos, + OpenAPI_list_t *abnor_behavrs, + OpenAPI_list_t *nw_perfs, + OpenAPI_list_t *dn_perf_infos, + OpenAPI_list_t *disper_infos, + OpenAPI_list_t *red_trans_infos, + OpenAPI_list_t *wlan_infos, + OpenAPI_list_t *smcc_exps +); +void OpenAPI_event_notification_free(OpenAPI_event_notification_t *event_notification); +OpenAPI_event_notification_t *OpenAPI_event_notification_parseFromJSON(cJSON *event_notificationJSON); +cJSON *OpenAPI_event_notification_convertToJSON(OpenAPI_event_notification_t *event_notification); +OpenAPI_event_notification_t *OpenAPI_event_notification_copy(OpenAPI_event_notification_t *dst, OpenAPI_event_notification_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_event_notification_H_ */ + diff --git a/lib/sbi/openapi/model/event_reporting_requirement.c b/lib/sbi/openapi/model/event_reporting_requirement.c new file mode 100644 index 000000000..94f0a3f7d --- /dev/null +++ b/lib/sbi/openapi/model/event_reporting_requirement.c @@ -0,0 +1,426 @@ + +#include +#include +#include +#include "event_reporting_requirement.h" + +OpenAPI_event_reporting_requirement_t *OpenAPI_event_reporting_requirement_create( + OpenAPI_accuracy_t *accuracy, + OpenAPI_list_t *acc_per_subset, + char *start_ts, + char *end_ts, + bool is_offset_period, + int offset_period, + bool is_samp_ratio, + int samp_ratio, + bool is_max_object_nbr, + int max_object_nbr, + bool is_max_supi_nbr, + int max_supi_nbr, + char *time_ana_needed, + OpenAPI_list_t *ana_meta, + OpenAPI_analytics_metadata_indication_t *ana_meta_ind +) +{ + OpenAPI_event_reporting_requirement_t *event_reporting_requirement_local_var = ogs_malloc(sizeof(OpenAPI_event_reporting_requirement_t)); + ogs_assert(event_reporting_requirement_local_var); + + event_reporting_requirement_local_var->accuracy = accuracy; + event_reporting_requirement_local_var->acc_per_subset = acc_per_subset; + event_reporting_requirement_local_var->start_ts = start_ts; + event_reporting_requirement_local_var->end_ts = end_ts; + event_reporting_requirement_local_var->is_offset_period = is_offset_period; + event_reporting_requirement_local_var->offset_period = offset_period; + event_reporting_requirement_local_var->is_samp_ratio = is_samp_ratio; + event_reporting_requirement_local_var->samp_ratio = samp_ratio; + event_reporting_requirement_local_var->is_max_object_nbr = is_max_object_nbr; + event_reporting_requirement_local_var->max_object_nbr = max_object_nbr; + event_reporting_requirement_local_var->is_max_supi_nbr = is_max_supi_nbr; + event_reporting_requirement_local_var->max_supi_nbr = max_supi_nbr; + event_reporting_requirement_local_var->time_ana_needed = time_ana_needed; + event_reporting_requirement_local_var->ana_meta = ana_meta; + event_reporting_requirement_local_var->ana_meta_ind = ana_meta_ind; + + return event_reporting_requirement_local_var; +} + +void OpenAPI_event_reporting_requirement_free(OpenAPI_event_reporting_requirement_t *event_reporting_requirement) +{ + OpenAPI_lnode_t *node = NULL; + + if (NULL == event_reporting_requirement) { + return; + } + if (event_reporting_requirement->accuracy) { + OpenAPI_accuracy_free(event_reporting_requirement->accuracy); + event_reporting_requirement->accuracy = NULL; + } + if (event_reporting_requirement->acc_per_subset) { + OpenAPI_list_for_each(event_reporting_requirement->acc_per_subset, node) { + OpenAPI_accuracy_free(node->data); + } + OpenAPI_list_free(event_reporting_requirement->acc_per_subset); + event_reporting_requirement->acc_per_subset = NULL; + } + if (event_reporting_requirement->start_ts) { + ogs_free(event_reporting_requirement->start_ts); + event_reporting_requirement->start_ts = NULL; + } + if (event_reporting_requirement->end_ts) { + ogs_free(event_reporting_requirement->end_ts); + event_reporting_requirement->end_ts = NULL; + } + if (event_reporting_requirement->time_ana_needed) { + ogs_free(event_reporting_requirement->time_ana_needed); + event_reporting_requirement->time_ana_needed = NULL; + } + if (event_reporting_requirement->ana_meta) { + OpenAPI_list_for_each(event_reporting_requirement->ana_meta, node) { + OpenAPI_analytics_metadata_free(node->data); + } + OpenAPI_list_free(event_reporting_requirement->ana_meta); + event_reporting_requirement->ana_meta = NULL; + } + if (event_reporting_requirement->ana_meta_ind) { + OpenAPI_analytics_metadata_indication_free(event_reporting_requirement->ana_meta_ind); + event_reporting_requirement->ana_meta_ind = NULL; + } + ogs_free(event_reporting_requirement); +} + +cJSON *OpenAPI_event_reporting_requirement_convertToJSON(OpenAPI_event_reporting_requirement_t *event_reporting_requirement) +{ + cJSON *item = NULL; + OpenAPI_lnode_t *node = NULL; + + if (event_reporting_requirement == NULL) { + ogs_error("OpenAPI_event_reporting_requirement_convertToJSON() failed [EventReportingRequirement]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (event_reporting_requirement->accuracy) { + cJSON *accuracy_local_JSON = OpenAPI_accuracy_convertToJSON(event_reporting_requirement->accuracy); + if (accuracy_local_JSON == NULL) { + ogs_error("OpenAPI_event_reporting_requirement_convertToJSON() failed [accuracy]"); + goto end; + } + cJSON_AddItemToObject(item, "accuracy", accuracy_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_event_reporting_requirement_convertToJSON() failed [accuracy]"); + goto end; + } + } + + if (event_reporting_requirement->acc_per_subset) { + cJSON *acc_per_subsetList = cJSON_AddArrayToObject(item, "accPerSubset"); + if (acc_per_subsetList == NULL) { + ogs_error("OpenAPI_event_reporting_requirement_convertToJSON() failed [acc_per_subset]"); + goto end; + } + OpenAPI_list_for_each(event_reporting_requirement->acc_per_subset, node) { + cJSON *itemLocal = OpenAPI_accuracy_convertToJSON(node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_event_reporting_requirement_convertToJSON() failed [acc_per_subset]"); + goto end; + } + cJSON_AddItemToArray(acc_per_subsetList, itemLocal); + } + } + + if (event_reporting_requirement->start_ts) { + if (cJSON_AddStringToObject(item, "startTs", event_reporting_requirement->start_ts) == NULL) { + ogs_error("OpenAPI_event_reporting_requirement_convertToJSON() failed [start_ts]"); + goto end; + } + } + + if (event_reporting_requirement->end_ts) { + if (cJSON_AddStringToObject(item, "endTs", event_reporting_requirement->end_ts) == NULL) { + ogs_error("OpenAPI_event_reporting_requirement_convertToJSON() failed [end_ts]"); + goto end; + } + } + + if (event_reporting_requirement->is_offset_period) { + if (cJSON_AddNumberToObject(item, "offsetPeriod", event_reporting_requirement->offset_period) == NULL) { + ogs_error("OpenAPI_event_reporting_requirement_convertToJSON() failed [offset_period]"); + goto end; + } + } + + if (event_reporting_requirement->is_samp_ratio) { + if (cJSON_AddNumberToObject(item, "sampRatio", event_reporting_requirement->samp_ratio) == NULL) { + ogs_error("OpenAPI_event_reporting_requirement_convertToJSON() failed [samp_ratio]"); + goto end; + } + } + + if (event_reporting_requirement->is_max_object_nbr) { + if (cJSON_AddNumberToObject(item, "maxObjectNbr", event_reporting_requirement->max_object_nbr) == NULL) { + ogs_error("OpenAPI_event_reporting_requirement_convertToJSON() failed [max_object_nbr]"); + goto end; + } + } + + if (event_reporting_requirement->is_max_supi_nbr) { + if (cJSON_AddNumberToObject(item, "maxSupiNbr", event_reporting_requirement->max_supi_nbr) == NULL) { + ogs_error("OpenAPI_event_reporting_requirement_convertToJSON() failed [max_supi_nbr]"); + goto end; + } + } + + if (event_reporting_requirement->time_ana_needed) { + if (cJSON_AddStringToObject(item, "timeAnaNeeded", event_reporting_requirement->time_ana_needed) == NULL) { + ogs_error("OpenAPI_event_reporting_requirement_convertToJSON() failed [time_ana_needed]"); + goto end; + } + } + + if (event_reporting_requirement->ana_meta) { + cJSON *ana_metaList = cJSON_AddArrayToObject(item, "anaMeta"); + if (ana_metaList == NULL) { + ogs_error("OpenAPI_event_reporting_requirement_convertToJSON() failed [ana_meta]"); + goto end; + } + OpenAPI_list_for_each(event_reporting_requirement->ana_meta, node) { + cJSON *itemLocal = OpenAPI_analytics_metadata_convertToJSON(node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_event_reporting_requirement_convertToJSON() failed [ana_meta]"); + goto end; + } + cJSON_AddItemToArray(ana_metaList, itemLocal); + } + } + + if (event_reporting_requirement->ana_meta_ind) { + cJSON *ana_meta_ind_local_JSON = OpenAPI_analytics_metadata_indication_convertToJSON(event_reporting_requirement->ana_meta_ind); + if (ana_meta_ind_local_JSON == NULL) { + ogs_error("OpenAPI_event_reporting_requirement_convertToJSON() failed [ana_meta_ind]"); + goto end; + } + cJSON_AddItemToObject(item, "anaMetaInd", ana_meta_ind_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_event_reporting_requirement_convertToJSON() failed [ana_meta_ind]"); + goto end; + } + } + +end: + return item; +} + +OpenAPI_event_reporting_requirement_t *OpenAPI_event_reporting_requirement_parseFromJSON(cJSON *event_reporting_requirementJSON) +{ + OpenAPI_event_reporting_requirement_t *event_reporting_requirement_local_var = NULL; + OpenAPI_lnode_t *node = NULL; + cJSON *accuracy = NULL; + OpenAPI_accuracy_t *accuracy_local_nonprim = NULL; + cJSON *acc_per_subset = NULL; + OpenAPI_list_t *acc_per_subsetList = NULL; + cJSON *start_ts = NULL; + cJSON *end_ts = NULL; + cJSON *offset_period = NULL; + cJSON *samp_ratio = NULL; + cJSON *max_object_nbr = NULL; + cJSON *max_supi_nbr = NULL; + cJSON *time_ana_needed = NULL; + cJSON *ana_meta = NULL; + OpenAPI_list_t *ana_metaList = NULL; + cJSON *ana_meta_ind = NULL; + OpenAPI_analytics_metadata_indication_t *ana_meta_ind_local_nonprim = NULL; + accuracy = cJSON_GetObjectItemCaseSensitive(event_reporting_requirementJSON, "accuracy"); + if (accuracy) { + accuracy_local_nonprim = OpenAPI_accuracy_parseFromJSON(accuracy); + } + + acc_per_subset = cJSON_GetObjectItemCaseSensitive(event_reporting_requirementJSON, "accPerSubset"); + if (acc_per_subset) { + cJSON *acc_per_subset_local = NULL; + if (!cJSON_IsArray(acc_per_subset)) { + ogs_error("OpenAPI_event_reporting_requirement_parseFromJSON() failed [acc_per_subset]"); + goto end; + } + + acc_per_subsetList = OpenAPI_list_create(); + + cJSON_ArrayForEach(acc_per_subset_local, acc_per_subset) { + if (!cJSON_IsObject(acc_per_subset_local)) { + ogs_error("OpenAPI_event_reporting_requirement_parseFromJSON() failed [acc_per_subset]"); + goto end; + } + OpenAPI_accuracy_t *acc_per_subsetItem = OpenAPI_accuracy_parseFromJSON(acc_per_subset_local); + if (!acc_per_subsetItem) { + ogs_error("No acc_per_subsetItem"); + OpenAPI_list_free(acc_per_subsetList); + goto end; + } + OpenAPI_list_add(acc_per_subsetList, acc_per_subsetItem); + } + } + + start_ts = cJSON_GetObjectItemCaseSensitive(event_reporting_requirementJSON, "startTs"); + if (start_ts) { + if (!cJSON_IsString(start_ts) && !cJSON_IsNull(start_ts)) { + ogs_error("OpenAPI_event_reporting_requirement_parseFromJSON() failed [start_ts]"); + goto end; + } + } + + end_ts = cJSON_GetObjectItemCaseSensitive(event_reporting_requirementJSON, "endTs"); + if (end_ts) { + if (!cJSON_IsString(end_ts) && !cJSON_IsNull(end_ts)) { + ogs_error("OpenAPI_event_reporting_requirement_parseFromJSON() failed [end_ts]"); + goto end; + } + } + + offset_period = cJSON_GetObjectItemCaseSensitive(event_reporting_requirementJSON, "offsetPeriod"); + if (offset_period) { + if (!cJSON_IsNumber(offset_period)) { + ogs_error("OpenAPI_event_reporting_requirement_parseFromJSON() failed [offset_period]"); + goto end; + } + } + + samp_ratio = cJSON_GetObjectItemCaseSensitive(event_reporting_requirementJSON, "sampRatio"); + if (samp_ratio) { + if (!cJSON_IsNumber(samp_ratio)) { + ogs_error("OpenAPI_event_reporting_requirement_parseFromJSON() failed [samp_ratio]"); + goto end; + } + } + + max_object_nbr = cJSON_GetObjectItemCaseSensitive(event_reporting_requirementJSON, "maxObjectNbr"); + if (max_object_nbr) { + if (!cJSON_IsNumber(max_object_nbr)) { + ogs_error("OpenAPI_event_reporting_requirement_parseFromJSON() failed [max_object_nbr]"); + goto end; + } + } + + max_supi_nbr = cJSON_GetObjectItemCaseSensitive(event_reporting_requirementJSON, "maxSupiNbr"); + if (max_supi_nbr) { + if (!cJSON_IsNumber(max_supi_nbr)) { + ogs_error("OpenAPI_event_reporting_requirement_parseFromJSON() failed [max_supi_nbr]"); + goto end; + } + } + + time_ana_needed = cJSON_GetObjectItemCaseSensitive(event_reporting_requirementJSON, "timeAnaNeeded"); + if (time_ana_needed) { + if (!cJSON_IsString(time_ana_needed) && !cJSON_IsNull(time_ana_needed)) { + ogs_error("OpenAPI_event_reporting_requirement_parseFromJSON() failed [time_ana_needed]"); + goto end; + } + } + + ana_meta = cJSON_GetObjectItemCaseSensitive(event_reporting_requirementJSON, "anaMeta"); + if (ana_meta) { + cJSON *ana_meta_local = NULL; + if (!cJSON_IsArray(ana_meta)) { + ogs_error("OpenAPI_event_reporting_requirement_parseFromJSON() failed [ana_meta]"); + goto end; + } + + ana_metaList = OpenAPI_list_create(); + + cJSON_ArrayForEach(ana_meta_local, ana_meta) { + if (!cJSON_IsObject(ana_meta_local)) { + ogs_error("OpenAPI_event_reporting_requirement_parseFromJSON() failed [ana_meta]"); + goto end; + } + OpenAPI_analytics_metadata_t *ana_metaItem = OpenAPI_analytics_metadata_parseFromJSON(ana_meta_local); + if (!ana_metaItem) { + ogs_error("No ana_metaItem"); + OpenAPI_list_free(ana_metaList); + goto end; + } + OpenAPI_list_add(ana_metaList, ana_metaItem); + } + } + + ana_meta_ind = cJSON_GetObjectItemCaseSensitive(event_reporting_requirementJSON, "anaMetaInd"); + if (ana_meta_ind) { + ana_meta_ind_local_nonprim = OpenAPI_analytics_metadata_indication_parseFromJSON(ana_meta_ind); + } + + event_reporting_requirement_local_var = OpenAPI_event_reporting_requirement_create ( + accuracy ? accuracy_local_nonprim : NULL, + acc_per_subset ? acc_per_subsetList : NULL, + start_ts && !cJSON_IsNull(start_ts) ? ogs_strdup(start_ts->valuestring) : NULL, + end_ts && !cJSON_IsNull(end_ts) ? ogs_strdup(end_ts->valuestring) : NULL, + offset_period ? true : false, + offset_period ? offset_period->valuedouble : 0, + samp_ratio ? true : false, + samp_ratio ? samp_ratio->valuedouble : 0, + max_object_nbr ? true : false, + max_object_nbr ? max_object_nbr->valuedouble : 0, + max_supi_nbr ? true : false, + max_supi_nbr ? max_supi_nbr->valuedouble : 0, + time_ana_needed && !cJSON_IsNull(time_ana_needed) ? ogs_strdup(time_ana_needed->valuestring) : NULL, + ana_meta ? ana_metaList : NULL, + ana_meta_ind ? ana_meta_ind_local_nonprim : NULL + ); + + return event_reporting_requirement_local_var; +end: + if (accuracy_local_nonprim) { + OpenAPI_accuracy_free(accuracy_local_nonprim); + accuracy_local_nonprim = NULL; + } + if (acc_per_subsetList) { + OpenAPI_list_for_each(acc_per_subsetList, node) { + OpenAPI_accuracy_free(node->data); + } + OpenAPI_list_free(acc_per_subsetList); + acc_per_subsetList = NULL; + } + if (ana_metaList) { + OpenAPI_list_for_each(ana_metaList, node) { + OpenAPI_analytics_metadata_free(node->data); + } + OpenAPI_list_free(ana_metaList); + ana_metaList = NULL; + } + if (ana_meta_ind_local_nonprim) { + OpenAPI_analytics_metadata_indication_free(ana_meta_ind_local_nonprim); + ana_meta_ind_local_nonprim = NULL; + } + return NULL; +} + +OpenAPI_event_reporting_requirement_t *OpenAPI_event_reporting_requirement_copy(OpenAPI_event_reporting_requirement_t *dst, OpenAPI_event_reporting_requirement_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_event_reporting_requirement_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_event_reporting_requirement_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_event_reporting_requirement_free(dst); + dst = OpenAPI_event_reporting_requirement_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/event_reporting_requirement.h b/lib/sbi/openapi/model/event_reporting_requirement.h new file mode 100644 index 000000000..8938b8273 --- /dev/null +++ b/lib/sbi/openapi/model/event_reporting_requirement.h @@ -0,0 +1,69 @@ +/* + * event_reporting_requirement.h + * + * Represents the type of reporting that the subscription requires. + */ + +#ifndef _OpenAPI_event_reporting_requirement_H_ +#define _OpenAPI_event_reporting_requirement_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "accuracy.h" +#include "analytics_metadata.h" +#include "analytics_metadata_indication.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_event_reporting_requirement_s OpenAPI_event_reporting_requirement_t; +typedef struct OpenAPI_event_reporting_requirement_s { + struct OpenAPI_accuracy_s *accuracy; + OpenAPI_list_t *acc_per_subset; + char *start_ts; + char *end_ts; + bool is_offset_period; + int offset_period; + bool is_samp_ratio; + int samp_ratio; + bool is_max_object_nbr; + int max_object_nbr; + bool is_max_supi_nbr; + int max_supi_nbr; + char *time_ana_needed; + OpenAPI_list_t *ana_meta; + struct OpenAPI_analytics_metadata_indication_s *ana_meta_ind; +} OpenAPI_event_reporting_requirement_t; + +OpenAPI_event_reporting_requirement_t *OpenAPI_event_reporting_requirement_create( + OpenAPI_accuracy_t *accuracy, + OpenAPI_list_t *acc_per_subset, + char *start_ts, + char *end_ts, + bool is_offset_period, + int offset_period, + bool is_samp_ratio, + int samp_ratio, + bool is_max_object_nbr, + int max_object_nbr, + bool is_max_supi_nbr, + int max_supi_nbr, + char *time_ana_needed, + OpenAPI_list_t *ana_meta, + OpenAPI_analytics_metadata_indication_t *ana_meta_ind +); +void OpenAPI_event_reporting_requirement_free(OpenAPI_event_reporting_requirement_t *event_reporting_requirement); +OpenAPI_event_reporting_requirement_t *OpenAPI_event_reporting_requirement_parseFromJSON(cJSON *event_reporting_requirementJSON); +cJSON *OpenAPI_event_reporting_requirement_convertToJSON(OpenAPI_event_reporting_requirement_t *event_reporting_requirement); +OpenAPI_event_reporting_requirement_t *OpenAPI_event_reporting_requirement_copy(OpenAPI_event_reporting_requirement_t *dst, OpenAPI_event_reporting_requirement_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_event_reporting_requirement_H_ */ + diff --git a/lib/sbi/openapi/model/event_subscription.c b/lib/sbi/openapi/model/event_subscription.c new file mode 100644 index 000000000..11c2f8541 --- /dev/null +++ b/lib/sbi/openapi/model/event_subscription.c @@ -0,0 +1,1955 @@ + +#include +#include +#include +#include "event_subscription.h" + +OpenAPI_event_subscription_t *OpenAPI_event_subscription_create( + bool is_any_slice, + int any_slice, + OpenAPI_list_t *app_ids, + OpenAPI_list_t *dnns, + OpenAPI_list_t *dnais, + OpenAPI_nwdaf_event_t *event, + OpenAPI_event_reporting_requirement_t *extra_report_req, + OpenAPI_list_t *ladn_dnns, + bool is_load_level_threshold, + int load_level_threshold, + OpenAPI_notification_method_t *notification_method, + OpenAPI_matching_direction_t *matching_dir, + OpenAPI_list_t *nf_load_lvl_thds, + OpenAPI_list_t *nf_instance_ids, + OpenAPI_list_t *nf_set_ids, + OpenAPI_list_t *nf_types, + OpenAPI_network_area_info_t *network_area, + OpenAPI_list_t *visited_areas, + bool is_max_top_app_ul_nbr, + int max_top_app_ul_nbr, + bool is_max_top_app_dl_nbr, + int max_top_app_dl_nbr, + OpenAPI_list_t *nsi_id_infos, + OpenAPI_list_t *nsi_level_thrds, + OpenAPI_qos_requirement_t *qos_requ, + OpenAPI_list_t *qos_flow_ret_thds, + OpenAPI_list_t *ran_ue_throu_thds, + bool is_repetition_period, + int repetition_period, + OpenAPI_list_t *snssaia, + OpenAPI_target_ue_information_t *tgt_ue, + OpenAPI_list_t *cong_thresholds, + OpenAPI_list_t *nw_perf_requs, + OpenAPI_list_t *bw_requs, + OpenAPI_list_t *excep_requs, + OpenAPI_expected_analytics_type_t *expt_ana_type, + OpenAPI_expected_ue_behaviour_data_t *expt_ue_behav, + OpenAPI_list_t *rat_freqs, + OpenAPI_list_t *list_of_ana_subsets, + OpenAPI_list_t *disper_reqs, + OpenAPI_list_t *red_trans_reqs, + OpenAPI_list_t *wlan_reqs, + OpenAPI_upf_information_t *upf_info, + OpenAPI_list_t *app_server_addrs, + OpenAPI_list_t *dn_perf_reqs +) +{ + OpenAPI_event_subscription_t *event_subscription_local_var = ogs_malloc(sizeof(OpenAPI_event_subscription_t)); + ogs_assert(event_subscription_local_var); + + event_subscription_local_var->is_any_slice = is_any_slice; + event_subscription_local_var->any_slice = any_slice; + event_subscription_local_var->app_ids = app_ids; + event_subscription_local_var->dnns = dnns; + event_subscription_local_var->dnais = dnais; + event_subscription_local_var->event = event; + event_subscription_local_var->extra_report_req = extra_report_req; + event_subscription_local_var->ladn_dnns = ladn_dnns; + event_subscription_local_var->is_load_level_threshold = is_load_level_threshold; + event_subscription_local_var->load_level_threshold = load_level_threshold; + event_subscription_local_var->notification_method = notification_method; + event_subscription_local_var->matching_dir = matching_dir; + event_subscription_local_var->nf_load_lvl_thds = nf_load_lvl_thds; + event_subscription_local_var->nf_instance_ids = nf_instance_ids; + event_subscription_local_var->nf_set_ids = nf_set_ids; + event_subscription_local_var->nf_types = nf_types; + event_subscription_local_var->network_area = network_area; + event_subscription_local_var->visited_areas = visited_areas; + event_subscription_local_var->is_max_top_app_ul_nbr = is_max_top_app_ul_nbr; + event_subscription_local_var->max_top_app_ul_nbr = max_top_app_ul_nbr; + event_subscription_local_var->is_max_top_app_dl_nbr = is_max_top_app_dl_nbr; + event_subscription_local_var->max_top_app_dl_nbr = max_top_app_dl_nbr; + event_subscription_local_var->nsi_id_infos = nsi_id_infos; + event_subscription_local_var->nsi_level_thrds = nsi_level_thrds; + event_subscription_local_var->qos_requ = qos_requ; + event_subscription_local_var->qos_flow_ret_thds = qos_flow_ret_thds; + event_subscription_local_var->ran_ue_throu_thds = ran_ue_throu_thds; + event_subscription_local_var->is_repetition_period = is_repetition_period; + event_subscription_local_var->repetition_period = repetition_period; + event_subscription_local_var->snssaia = snssaia; + event_subscription_local_var->tgt_ue = tgt_ue; + event_subscription_local_var->cong_thresholds = cong_thresholds; + event_subscription_local_var->nw_perf_requs = nw_perf_requs; + event_subscription_local_var->bw_requs = bw_requs; + event_subscription_local_var->excep_requs = excep_requs; + event_subscription_local_var->expt_ana_type = expt_ana_type; + event_subscription_local_var->expt_ue_behav = expt_ue_behav; + event_subscription_local_var->rat_freqs = rat_freqs; + event_subscription_local_var->list_of_ana_subsets = list_of_ana_subsets; + event_subscription_local_var->disper_reqs = disper_reqs; + event_subscription_local_var->red_trans_reqs = red_trans_reqs; + event_subscription_local_var->wlan_reqs = wlan_reqs; + event_subscription_local_var->upf_info = upf_info; + event_subscription_local_var->app_server_addrs = app_server_addrs; + event_subscription_local_var->dn_perf_reqs = dn_perf_reqs; + + return event_subscription_local_var; +} + +void OpenAPI_event_subscription_free(OpenAPI_event_subscription_t *event_subscription) +{ + OpenAPI_lnode_t *node = NULL; + + if (NULL == event_subscription) { + return; + } + if (event_subscription->app_ids) { + OpenAPI_list_for_each(event_subscription->app_ids, node) { + ogs_free(node->data); + } + OpenAPI_list_free(event_subscription->app_ids); + event_subscription->app_ids = NULL; + } + if (event_subscription->dnns) { + OpenAPI_list_for_each(event_subscription->dnns, node) { + ogs_free(node->data); + } + OpenAPI_list_free(event_subscription->dnns); + event_subscription->dnns = NULL; + } + if (event_subscription->dnais) { + OpenAPI_list_for_each(event_subscription->dnais, node) { + ogs_free(node->data); + } + OpenAPI_list_free(event_subscription->dnais); + event_subscription->dnais = NULL; + } + if (event_subscription->event) { + OpenAPI_nwdaf_event_free(event_subscription->event); + event_subscription->event = NULL; + } + if (event_subscription->extra_report_req) { + OpenAPI_event_reporting_requirement_free(event_subscription->extra_report_req); + event_subscription->extra_report_req = NULL; + } + if (event_subscription->ladn_dnns) { + OpenAPI_list_for_each(event_subscription->ladn_dnns, node) { + ogs_free(node->data); + } + OpenAPI_list_free(event_subscription->ladn_dnns); + event_subscription->ladn_dnns = NULL; + } + if (event_subscription->notification_method) { + OpenAPI_notification_method_free(event_subscription->notification_method); + event_subscription->notification_method = NULL; + } + if (event_subscription->matching_dir) { + OpenAPI_matching_direction_free(event_subscription->matching_dir); + event_subscription->matching_dir = NULL; + } + if (event_subscription->nf_load_lvl_thds) { + OpenAPI_list_for_each(event_subscription->nf_load_lvl_thds, node) { + OpenAPI_threshold_level_free(node->data); + } + OpenAPI_list_free(event_subscription->nf_load_lvl_thds); + event_subscription->nf_load_lvl_thds = NULL; + } + if (event_subscription->nf_instance_ids) { + OpenAPI_list_for_each(event_subscription->nf_instance_ids, node) { + ogs_free(node->data); + } + OpenAPI_list_free(event_subscription->nf_instance_ids); + event_subscription->nf_instance_ids = NULL; + } + if (event_subscription->nf_set_ids) { + OpenAPI_list_for_each(event_subscription->nf_set_ids, node) { + ogs_free(node->data); + } + OpenAPI_list_free(event_subscription->nf_set_ids); + event_subscription->nf_set_ids = NULL; + } + if (event_subscription->nf_types) { + OpenAPI_list_free(event_subscription->nf_types); + event_subscription->nf_types = NULL; + } + if (event_subscription->network_area) { + OpenAPI_network_area_info_free(event_subscription->network_area); + event_subscription->network_area = NULL; + } + if (event_subscription->visited_areas) { + OpenAPI_list_for_each(event_subscription->visited_areas, node) { + OpenAPI_network_area_info_free(node->data); + } + OpenAPI_list_free(event_subscription->visited_areas); + event_subscription->visited_areas = NULL; + } + if (event_subscription->nsi_id_infos) { + OpenAPI_list_for_each(event_subscription->nsi_id_infos, node) { + OpenAPI_nsi_id_info_free(node->data); + } + OpenAPI_list_free(event_subscription->nsi_id_infos); + event_subscription->nsi_id_infos = NULL; + } + if (event_subscription->nsi_level_thrds) { + OpenAPI_list_for_each(event_subscription->nsi_level_thrds, node) { + ogs_free(node->data); + } + OpenAPI_list_free(event_subscription->nsi_level_thrds); + event_subscription->nsi_level_thrds = NULL; + } + if (event_subscription->qos_requ) { + OpenAPI_qos_requirement_free(event_subscription->qos_requ); + event_subscription->qos_requ = NULL; + } + if (event_subscription->qos_flow_ret_thds) { + OpenAPI_list_for_each(event_subscription->qos_flow_ret_thds, node) { + OpenAPI_retainability_threshold_free(node->data); + } + OpenAPI_list_free(event_subscription->qos_flow_ret_thds); + event_subscription->qos_flow_ret_thds = NULL; + } + if (event_subscription->ran_ue_throu_thds) { + OpenAPI_list_for_each(event_subscription->ran_ue_throu_thds, node) { + ogs_free(node->data); + } + OpenAPI_list_free(event_subscription->ran_ue_throu_thds); + event_subscription->ran_ue_throu_thds = NULL; + } + if (event_subscription->snssaia) { + OpenAPI_list_for_each(event_subscription->snssaia, node) { + OpenAPI_snssai_free(node->data); + } + OpenAPI_list_free(event_subscription->snssaia); + event_subscription->snssaia = NULL; + } + if (event_subscription->tgt_ue) { + OpenAPI_target_ue_information_free(event_subscription->tgt_ue); + event_subscription->tgt_ue = NULL; + } + if (event_subscription->cong_thresholds) { + OpenAPI_list_for_each(event_subscription->cong_thresholds, node) { + OpenAPI_threshold_level_free(node->data); + } + OpenAPI_list_free(event_subscription->cong_thresholds); + event_subscription->cong_thresholds = NULL; + } + if (event_subscription->nw_perf_requs) { + OpenAPI_list_for_each(event_subscription->nw_perf_requs, node) { + OpenAPI_network_perf_requirement_free(node->data); + } + OpenAPI_list_free(event_subscription->nw_perf_requs); + event_subscription->nw_perf_requs = NULL; + } + if (event_subscription->bw_requs) { + OpenAPI_list_for_each(event_subscription->bw_requs, node) { + OpenAPI_bw_requirement_free(node->data); + } + OpenAPI_list_free(event_subscription->bw_requs); + event_subscription->bw_requs = NULL; + } + if (event_subscription->excep_requs) { + OpenAPI_list_for_each(event_subscription->excep_requs, node) { + OpenAPI_exception_free(node->data); + } + OpenAPI_list_free(event_subscription->excep_requs); + event_subscription->excep_requs = NULL; + } + if (event_subscription->expt_ana_type) { + OpenAPI_expected_analytics_type_free(event_subscription->expt_ana_type); + event_subscription->expt_ana_type = NULL; + } + if (event_subscription->expt_ue_behav) { + OpenAPI_expected_ue_behaviour_data_free(event_subscription->expt_ue_behav); + event_subscription->expt_ue_behav = NULL; + } + if (event_subscription->rat_freqs) { + OpenAPI_list_for_each(event_subscription->rat_freqs, node) { + OpenAPI_rat_freq_information_free(node->data); + } + OpenAPI_list_free(event_subscription->rat_freqs); + event_subscription->rat_freqs = NULL; + } + if (event_subscription->list_of_ana_subsets) { + OpenAPI_list_for_each(event_subscription->list_of_ana_subsets, node) { + OpenAPI_analytics_subset_free(node->data); + } + OpenAPI_list_free(event_subscription->list_of_ana_subsets); + event_subscription->list_of_ana_subsets = NULL; + } + if (event_subscription->disper_reqs) { + OpenAPI_list_for_each(event_subscription->disper_reqs, node) { + OpenAPI_dispersion_requirement_free(node->data); + } + OpenAPI_list_free(event_subscription->disper_reqs); + event_subscription->disper_reqs = NULL; + } + if (event_subscription->red_trans_reqs) { + OpenAPI_list_for_each(event_subscription->red_trans_reqs, node) { + OpenAPI_redundant_transmission_exp_req_free(node->data); + } + OpenAPI_list_free(event_subscription->red_trans_reqs); + event_subscription->red_trans_reqs = NULL; + } + if (event_subscription->wlan_reqs) { + OpenAPI_list_for_each(event_subscription->wlan_reqs, node) { + OpenAPI_wlan_performance_req_free(node->data); + } + OpenAPI_list_free(event_subscription->wlan_reqs); + event_subscription->wlan_reqs = NULL; + } + if (event_subscription->upf_info) { + OpenAPI_upf_information_free(event_subscription->upf_info); + event_subscription->upf_info = NULL; + } + if (event_subscription->app_server_addrs) { + OpenAPI_list_for_each(event_subscription->app_server_addrs, node) { + OpenAPI_addr_fqdn_free(node->data); + } + OpenAPI_list_free(event_subscription->app_server_addrs); + event_subscription->app_server_addrs = NULL; + } + if (event_subscription->dn_perf_reqs) { + OpenAPI_list_for_each(event_subscription->dn_perf_reqs, node) { + OpenAPI_dn_performance_req_free(node->data); + } + OpenAPI_list_free(event_subscription->dn_perf_reqs); + event_subscription->dn_perf_reqs = NULL; + } + ogs_free(event_subscription); +} + +cJSON *OpenAPI_event_subscription_convertToJSON(OpenAPI_event_subscription_t *event_subscription) +{ + cJSON *item = NULL; + OpenAPI_lnode_t *node = NULL; + + if (event_subscription == NULL) { + ogs_error("OpenAPI_event_subscription_convertToJSON() failed [EventSubscription]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (event_subscription->is_any_slice) { + if (cJSON_AddBoolToObject(item, "anySlice", event_subscription->any_slice) == NULL) { + ogs_error("OpenAPI_event_subscription_convertToJSON() failed [any_slice]"); + goto end; + } + } + + if (event_subscription->app_ids) { + cJSON *app_idsList = cJSON_AddArrayToObject(item, "appIds"); + if (app_idsList == NULL) { + ogs_error("OpenAPI_event_subscription_convertToJSON() failed [app_ids]"); + goto end; + } + OpenAPI_list_for_each(event_subscription->app_ids, node) { + if (cJSON_AddStringToObject(app_idsList, "", (char*)node->data) == NULL) { + ogs_error("OpenAPI_event_subscription_convertToJSON() failed [app_ids]"); + goto end; + } + } + } + + if (event_subscription->dnns) { + cJSON *dnnsList = cJSON_AddArrayToObject(item, "dnns"); + if (dnnsList == NULL) { + ogs_error("OpenAPI_event_subscription_convertToJSON() failed [dnns]"); + goto end; + } + OpenAPI_list_for_each(event_subscription->dnns, node) { + if (cJSON_AddStringToObject(dnnsList, "", (char*)node->data) == NULL) { + ogs_error("OpenAPI_event_subscription_convertToJSON() failed [dnns]"); + goto end; + } + } + } + + if (event_subscription->dnais) { + cJSON *dnaisList = cJSON_AddArrayToObject(item, "dnais"); + if (dnaisList == NULL) { + ogs_error("OpenAPI_event_subscription_convertToJSON() failed [dnais]"); + goto end; + } + OpenAPI_list_for_each(event_subscription->dnais, node) { + if (cJSON_AddStringToObject(dnaisList, "", (char*)node->data) == NULL) { + ogs_error("OpenAPI_event_subscription_convertToJSON() failed [dnais]"); + goto end; + } + } + } + + if (!event_subscription->event) { + ogs_error("OpenAPI_event_subscription_convertToJSON() failed [event]"); + return NULL; + } + cJSON *event_local_JSON = OpenAPI_nwdaf_event_convertToJSON(event_subscription->event); + if (event_local_JSON == NULL) { + ogs_error("OpenAPI_event_subscription_convertToJSON() failed [event]"); + goto end; + } + cJSON_AddItemToObject(item, "event", event_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_event_subscription_convertToJSON() failed [event]"); + goto end; + } + + if (event_subscription->extra_report_req) { + cJSON *extra_report_req_local_JSON = OpenAPI_event_reporting_requirement_convertToJSON(event_subscription->extra_report_req); + if (extra_report_req_local_JSON == NULL) { + ogs_error("OpenAPI_event_subscription_convertToJSON() failed [extra_report_req]"); + goto end; + } + cJSON_AddItemToObject(item, "extraReportReq", extra_report_req_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_event_subscription_convertToJSON() failed [extra_report_req]"); + goto end; + } + } + + if (event_subscription->ladn_dnns) { + cJSON *ladn_dnnsList = cJSON_AddArrayToObject(item, "ladnDnns"); + if (ladn_dnnsList == NULL) { + ogs_error("OpenAPI_event_subscription_convertToJSON() failed [ladn_dnns]"); + goto end; + } + OpenAPI_list_for_each(event_subscription->ladn_dnns, node) { + if (cJSON_AddStringToObject(ladn_dnnsList, "", (char*)node->data) == NULL) { + ogs_error("OpenAPI_event_subscription_convertToJSON() failed [ladn_dnns]"); + goto end; + } + } + } + + if (event_subscription->is_load_level_threshold) { + if (cJSON_AddNumberToObject(item, "loadLevelThreshold", event_subscription->load_level_threshold) == NULL) { + ogs_error("OpenAPI_event_subscription_convertToJSON() failed [load_level_threshold]"); + goto end; + } + } + + if (event_subscription->notification_method) { + cJSON *notification_method_local_JSON = OpenAPI_notification_method_convertToJSON(event_subscription->notification_method); + if (notification_method_local_JSON == NULL) { + ogs_error("OpenAPI_event_subscription_convertToJSON() failed [notification_method]"); + goto end; + } + cJSON_AddItemToObject(item, "notificationMethod", notification_method_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_event_subscription_convertToJSON() failed [notification_method]"); + goto end; + } + } + + if (event_subscription->matching_dir) { + cJSON *matching_dir_local_JSON = OpenAPI_matching_direction_convertToJSON(event_subscription->matching_dir); + if (matching_dir_local_JSON == NULL) { + ogs_error("OpenAPI_event_subscription_convertToJSON() failed [matching_dir]"); + goto end; + } + cJSON_AddItemToObject(item, "matchingDir", matching_dir_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_event_subscription_convertToJSON() failed [matching_dir]"); + goto end; + } + } + + if (event_subscription->nf_load_lvl_thds) { + cJSON *nf_load_lvl_thdsList = cJSON_AddArrayToObject(item, "nfLoadLvlThds"); + if (nf_load_lvl_thdsList == NULL) { + ogs_error("OpenAPI_event_subscription_convertToJSON() failed [nf_load_lvl_thds]"); + goto end; + } + OpenAPI_list_for_each(event_subscription->nf_load_lvl_thds, node) { + cJSON *itemLocal = OpenAPI_threshold_level_convertToJSON(node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_event_subscription_convertToJSON() failed [nf_load_lvl_thds]"); + goto end; + } + cJSON_AddItemToArray(nf_load_lvl_thdsList, itemLocal); + } + } + + if (event_subscription->nf_instance_ids) { + cJSON *nf_instance_idsList = cJSON_AddArrayToObject(item, "nfInstanceIds"); + if (nf_instance_idsList == NULL) { + ogs_error("OpenAPI_event_subscription_convertToJSON() failed [nf_instance_ids]"); + goto end; + } + OpenAPI_list_for_each(event_subscription->nf_instance_ids, node) { + if (cJSON_AddStringToObject(nf_instance_idsList, "", (char*)node->data) == NULL) { + ogs_error("OpenAPI_event_subscription_convertToJSON() failed [nf_instance_ids]"); + goto end; + } + } + } + + if (event_subscription->nf_set_ids) { + cJSON *nf_set_idsList = cJSON_AddArrayToObject(item, "nfSetIds"); + if (nf_set_idsList == NULL) { + ogs_error("OpenAPI_event_subscription_convertToJSON() failed [nf_set_ids]"); + goto end; + } + OpenAPI_list_for_each(event_subscription->nf_set_ids, node) { + if (cJSON_AddStringToObject(nf_set_idsList, "", (char*)node->data) == NULL) { + ogs_error("OpenAPI_event_subscription_convertToJSON() failed [nf_set_ids]"); + goto end; + } + } + } + + if (event_subscription->nf_types != OpenAPI_nf_type_NULL) { + cJSON *nf_typesList = cJSON_AddArrayToObject(item, "nfTypes"); + if (nf_typesList == NULL) { + ogs_error("OpenAPI_event_subscription_convertToJSON() failed [nf_types]"); + goto end; + } + OpenAPI_list_for_each(event_subscription->nf_types, node) { + if (cJSON_AddStringToObject(nf_typesList, "", OpenAPI_nf_type_ToString((intptr_t)node->data)) == NULL) { + ogs_error("OpenAPI_event_subscription_convertToJSON() failed [nf_types]"); + goto end; + } + } + } + + if (event_subscription->network_area) { + cJSON *network_area_local_JSON = OpenAPI_network_area_info_convertToJSON(event_subscription->network_area); + if (network_area_local_JSON == NULL) { + ogs_error("OpenAPI_event_subscription_convertToJSON() failed [network_area]"); + goto end; + } + cJSON_AddItemToObject(item, "networkArea", network_area_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_event_subscription_convertToJSON() failed [network_area]"); + goto end; + } + } + + if (event_subscription->visited_areas) { + cJSON *visited_areasList = cJSON_AddArrayToObject(item, "visitedAreas"); + if (visited_areasList == NULL) { + ogs_error("OpenAPI_event_subscription_convertToJSON() failed [visited_areas]"); + goto end; + } + OpenAPI_list_for_each(event_subscription->visited_areas, node) { + cJSON *itemLocal = OpenAPI_network_area_info_convertToJSON(node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_event_subscription_convertToJSON() failed [visited_areas]"); + goto end; + } + cJSON_AddItemToArray(visited_areasList, itemLocal); + } + } + + if (event_subscription->is_max_top_app_ul_nbr) { + if (cJSON_AddNumberToObject(item, "maxTopAppUlNbr", event_subscription->max_top_app_ul_nbr) == NULL) { + ogs_error("OpenAPI_event_subscription_convertToJSON() failed [max_top_app_ul_nbr]"); + goto end; + } + } + + if (event_subscription->is_max_top_app_dl_nbr) { + if (cJSON_AddNumberToObject(item, "maxTopAppDlNbr", event_subscription->max_top_app_dl_nbr) == NULL) { + ogs_error("OpenAPI_event_subscription_convertToJSON() failed [max_top_app_dl_nbr]"); + goto end; + } + } + + if (event_subscription->nsi_id_infos) { + cJSON *nsi_id_infosList = cJSON_AddArrayToObject(item, "nsiIdInfos"); + if (nsi_id_infosList == NULL) { + ogs_error("OpenAPI_event_subscription_convertToJSON() failed [nsi_id_infos]"); + goto end; + } + OpenAPI_list_for_each(event_subscription->nsi_id_infos, node) { + cJSON *itemLocal = OpenAPI_nsi_id_info_convertToJSON(node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_event_subscription_convertToJSON() failed [nsi_id_infos]"); + goto end; + } + cJSON_AddItemToArray(nsi_id_infosList, itemLocal); + } + } + + if (event_subscription->nsi_level_thrds) { + cJSON *nsi_level_thrdsList = cJSON_AddArrayToObject(item, "nsiLevelThrds"); + if (nsi_level_thrdsList == NULL) { + ogs_error("OpenAPI_event_subscription_convertToJSON() failed [nsi_level_thrds]"); + goto end; + } + OpenAPI_list_for_each(event_subscription->nsi_level_thrds, node) { + if (cJSON_AddNumberToObject(nsi_level_thrdsList, "", (uintptr_t)node->data) == NULL) { + ogs_error("OpenAPI_event_subscription_convertToJSON() failed [nsi_level_thrds]"); + goto end; + } + } + } + + if (event_subscription->qos_requ) { + cJSON *qos_requ_local_JSON = OpenAPI_qos_requirement_convertToJSON(event_subscription->qos_requ); + if (qos_requ_local_JSON == NULL) { + ogs_error("OpenAPI_event_subscription_convertToJSON() failed [qos_requ]"); + goto end; + } + cJSON_AddItemToObject(item, "qosRequ", qos_requ_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_event_subscription_convertToJSON() failed [qos_requ]"); + goto end; + } + } + + if (event_subscription->qos_flow_ret_thds) { + cJSON *qos_flow_ret_thdsList = cJSON_AddArrayToObject(item, "qosFlowRetThds"); + if (qos_flow_ret_thdsList == NULL) { + ogs_error("OpenAPI_event_subscription_convertToJSON() failed [qos_flow_ret_thds]"); + goto end; + } + OpenAPI_list_for_each(event_subscription->qos_flow_ret_thds, node) { + cJSON *itemLocal = OpenAPI_retainability_threshold_convertToJSON(node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_event_subscription_convertToJSON() failed [qos_flow_ret_thds]"); + goto end; + } + cJSON_AddItemToArray(qos_flow_ret_thdsList, itemLocal); + } + } + + if (event_subscription->ran_ue_throu_thds) { + cJSON *ran_ue_throu_thdsList = cJSON_AddArrayToObject(item, "ranUeThrouThds"); + if (ran_ue_throu_thdsList == NULL) { + ogs_error("OpenAPI_event_subscription_convertToJSON() failed [ran_ue_throu_thds]"); + goto end; + } + OpenAPI_list_for_each(event_subscription->ran_ue_throu_thds, node) { + if (cJSON_AddStringToObject(ran_ue_throu_thdsList, "", (char*)node->data) == NULL) { + ogs_error("OpenAPI_event_subscription_convertToJSON() failed [ran_ue_throu_thds]"); + goto end; + } + } + } + + if (event_subscription->is_repetition_period) { + if (cJSON_AddNumberToObject(item, "repetitionPeriod", event_subscription->repetition_period) == NULL) { + ogs_error("OpenAPI_event_subscription_convertToJSON() failed [repetition_period]"); + goto end; + } + } + + if (event_subscription->snssaia) { + cJSON *snssaiaList = cJSON_AddArrayToObject(item, "snssaia"); + if (snssaiaList == NULL) { + ogs_error("OpenAPI_event_subscription_convertToJSON() failed [snssaia]"); + goto end; + } + OpenAPI_list_for_each(event_subscription->snssaia, node) { + cJSON *itemLocal = OpenAPI_snssai_convertToJSON(node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_event_subscription_convertToJSON() failed [snssaia]"); + goto end; + } + cJSON_AddItemToArray(snssaiaList, itemLocal); + } + } + + if (event_subscription->tgt_ue) { + cJSON *tgt_ue_local_JSON = OpenAPI_target_ue_information_convertToJSON(event_subscription->tgt_ue); + if (tgt_ue_local_JSON == NULL) { + ogs_error("OpenAPI_event_subscription_convertToJSON() failed [tgt_ue]"); + goto end; + } + cJSON_AddItemToObject(item, "tgtUe", tgt_ue_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_event_subscription_convertToJSON() failed [tgt_ue]"); + goto end; + } + } + + if (event_subscription->cong_thresholds) { + cJSON *cong_thresholdsList = cJSON_AddArrayToObject(item, "congThresholds"); + if (cong_thresholdsList == NULL) { + ogs_error("OpenAPI_event_subscription_convertToJSON() failed [cong_thresholds]"); + goto end; + } + OpenAPI_list_for_each(event_subscription->cong_thresholds, node) { + cJSON *itemLocal = OpenAPI_threshold_level_convertToJSON(node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_event_subscription_convertToJSON() failed [cong_thresholds]"); + goto end; + } + cJSON_AddItemToArray(cong_thresholdsList, itemLocal); + } + } + + if (event_subscription->nw_perf_requs) { + cJSON *nw_perf_requsList = cJSON_AddArrayToObject(item, "nwPerfRequs"); + if (nw_perf_requsList == NULL) { + ogs_error("OpenAPI_event_subscription_convertToJSON() failed [nw_perf_requs]"); + goto end; + } + OpenAPI_list_for_each(event_subscription->nw_perf_requs, node) { + cJSON *itemLocal = OpenAPI_network_perf_requirement_convertToJSON(node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_event_subscription_convertToJSON() failed [nw_perf_requs]"); + goto end; + } + cJSON_AddItemToArray(nw_perf_requsList, itemLocal); + } + } + + if (event_subscription->bw_requs) { + cJSON *bw_requsList = cJSON_AddArrayToObject(item, "bwRequs"); + if (bw_requsList == NULL) { + ogs_error("OpenAPI_event_subscription_convertToJSON() failed [bw_requs]"); + goto end; + } + OpenAPI_list_for_each(event_subscription->bw_requs, node) { + cJSON *itemLocal = OpenAPI_bw_requirement_convertToJSON(node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_event_subscription_convertToJSON() failed [bw_requs]"); + goto end; + } + cJSON_AddItemToArray(bw_requsList, itemLocal); + } + } + + if (event_subscription->excep_requs) { + cJSON *excep_requsList = cJSON_AddArrayToObject(item, "excepRequs"); + if (excep_requsList == NULL) { + ogs_error("OpenAPI_event_subscription_convertToJSON() failed [excep_requs]"); + goto end; + } + OpenAPI_list_for_each(event_subscription->excep_requs, node) { + cJSON *itemLocal = OpenAPI_exception_convertToJSON(node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_event_subscription_convertToJSON() failed [excep_requs]"); + goto end; + } + cJSON_AddItemToArray(excep_requsList, itemLocal); + } + } + + if (event_subscription->expt_ana_type) { + cJSON *expt_ana_type_local_JSON = OpenAPI_expected_analytics_type_convertToJSON(event_subscription->expt_ana_type); + if (expt_ana_type_local_JSON == NULL) { + ogs_error("OpenAPI_event_subscription_convertToJSON() failed [expt_ana_type]"); + goto end; + } + cJSON_AddItemToObject(item, "exptAnaType", expt_ana_type_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_event_subscription_convertToJSON() failed [expt_ana_type]"); + goto end; + } + } + + if (event_subscription->expt_ue_behav) { + cJSON *expt_ue_behav_local_JSON = OpenAPI_expected_ue_behaviour_data_convertToJSON(event_subscription->expt_ue_behav); + if (expt_ue_behav_local_JSON == NULL) { + ogs_error("OpenAPI_event_subscription_convertToJSON() failed [expt_ue_behav]"); + goto end; + } + cJSON_AddItemToObject(item, "exptUeBehav", expt_ue_behav_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_event_subscription_convertToJSON() failed [expt_ue_behav]"); + goto end; + } + } + + if (event_subscription->rat_freqs) { + cJSON *rat_freqsList = cJSON_AddArrayToObject(item, "ratFreqs"); + if (rat_freqsList == NULL) { + ogs_error("OpenAPI_event_subscription_convertToJSON() failed [rat_freqs]"); + goto end; + } + OpenAPI_list_for_each(event_subscription->rat_freqs, node) { + cJSON *itemLocal = OpenAPI_rat_freq_information_convertToJSON(node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_event_subscription_convertToJSON() failed [rat_freqs]"); + goto end; + } + cJSON_AddItemToArray(rat_freqsList, itemLocal); + } + } + + if (event_subscription->list_of_ana_subsets) { + cJSON *list_of_ana_subsetsList = cJSON_AddArrayToObject(item, "listOfAnaSubsets"); + if (list_of_ana_subsetsList == NULL) { + ogs_error("OpenAPI_event_subscription_convertToJSON() failed [list_of_ana_subsets]"); + goto end; + } + OpenAPI_list_for_each(event_subscription->list_of_ana_subsets, node) { + cJSON *itemLocal = OpenAPI_analytics_subset_convertToJSON(node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_event_subscription_convertToJSON() failed [list_of_ana_subsets]"); + goto end; + } + cJSON_AddItemToArray(list_of_ana_subsetsList, itemLocal); + } + } + + if (event_subscription->disper_reqs) { + cJSON *disper_reqsList = cJSON_AddArrayToObject(item, "disperReqs"); + if (disper_reqsList == NULL) { + ogs_error("OpenAPI_event_subscription_convertToJSON() failed [disper_reqs]"); + goto end; + } + OpenAPI_list_for_each(event_subscription->disper_reqs, node) { + cJSON *itemLocal = OpenAPI_dispersion_requirement_convertToJSON(node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_event_subscription_convertToJSON() failed [disper_reqs]"); + goto end; + } + cJSON_AddItemToArray(disper_reqsList, itemLocal); + } + } + + if (event_subscription->red_trans_reqs) { + cJSON *red_trans_reqsList = cJSON_AddArrayToObject(item, "redTransReqs"); + if (red_trans_reqsList == NULL) { + ogs_error("OpenAPI_event_subscription_convertToJSON() failed [red_trans_reqs]"); + goto end; + } + OpenAPI_list_for_each(event_subscription->red_trans_reqs, node) { + cJSON *itemLocal = OpenAPI_redundant_transmission_exp_req_convertToJSON(node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_event_subscription_convertToJSON() failed [red_trans_reqs]"); + goto end; + } + cJSON_AddItemToArray(red_trans_reqsList, itemLocal); + } + } + + if (event_subscription->wlan_reqs) { + cJSON *wlan_reqsList = cJSON_AddArrayToObject(item, "wlanReqs"); + if (wlan_reqsList == NULL) { + ogs_error("OpenAPI_event_subscription_convertToJSON() failed [wlan_reqs]"); + goto end; + } + OpenAPI_list_for_each(event_subscription->wlan_reqs, node) { + cJSON *itemLocal = OpenAPI_wlan_performance_req_convertToJSON(node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_event_subscription_convertToJSON() failed [wlan_reqs]"); + goto end; + } + cJSON_AddItemToArray(wlan_reqsList, itemLocal); + } + } + + if (event_subscription->upf_info) { + cJSON *upf_info_local_JSON = OpenAPI_upf_information_convertToJSON(event_subscription->upf_info); + if (upf_info_local_JSON == NULL) { + ogs_error("OpenAPI_event_subscription_convertToJSON() failed [upf_info]"); + goto end; + } + cJSON_AddItemToObject(item, "upfInfo", upf_info_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_event_subscription_convertToJSON() failed [upf_info]"); + goto end; + } + } + + if (event_subscription->app_server_addrs) { + cJSON *app_server_addrsList = cJSON_AddArrayToObject(item, "appServerAddrs"); + if (app_server_addrsList == NULL) { + ogs_error("OpenAPI_event_subscription_convertToJSON() failed [app_server_addrs]"); + goto end; + } + OpenAPI_list_for_each(event_subscription->app_server_addrs, node) { + cJSON *itemLocal = OpenAPI_addr_fqdn_convertToJSON(node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_event_subscription_convertToJSON() failed [app_server_addrs]"); + goto end; + } + cJSON_AddItemToArray(app_server_addrsList, itemLocal); + } + } + + if (event_subscription->dn_perf_reqs) { + cJSON *dn_perf_reqsList = cJSON_AddArrayToObject(item, "dnPerfReqs"); + if (dn_perf_reqsList == NULL) { + ogs_error("OpenAPI_event_subscription_convertToJSON() failed [dn_perf_reqs]"); + goto end; + } + OpenAPI_list_for_each(event_subscription->dn_perf_reqs, node) { + cJSON *itemLocal = OpenAPI_dn_performance_req_convertToJSON(node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_event_subscription_convertToJSON() failed [dn_perf_reqs]"); + goto end; + } + cJSON_AddItemToArray(dn_perf_reqsList, itemLocal); + } + } + +end: + return item; +} + +OpenAPI_event_subscription_t *OpenAPI_event_subscription_parseFromJSON(cJSON *event_subscriptionJSON) +{ + OpenAPI_event_subscription_t *event_subscription_local_var = NULL; + OpenAPI_lnode_t *node = NULL; + cJSON *any_slice = NULL; + cJSON *app_ids = NULL; + OpenAPI_list_t *app_idsList = NULL; + cJSON *dnns = NULL; + OpenAPI_list_t *dnnsList = NULL; + cJSON *dnais = NULL; + OpenAPI_list_t *dnaisList = NULL; + cJSON *event = NULL; + OpenAPI_nwdaf_event_t *event_local_nonprim = NULL; + cJSON *extra_report_req = NULL; + OpenAPI_event_reporting_requirement_t *extra_report_req_local_nonprim = NULL; + cJSON *ladn_dnns = NULL; + OpenAPI_list_t *ladn_dnnsList = NULL; + cJSON *load_level_threshold = NULL; + cJSON *notification_method = NULL; + OpenAPI_notification_method_t *notification_method_local_nonprim = NULL; + cJSON *matching_dir = NULL; + OpenAPI_matching_direction_t *matching_dir_local_nonprim = NULL; + cJSON *nf_load_lvl_thds = NULL; + OpenAPI_list_t *nf_load_lvl_thdsList = NULL; + cJSON *nf_instance_ids = NULL; + OpenAPI_list_t *nf_instance_idsList = NULL; + cJSON *nf_set_ids = NULL; + OpenAPI_list_t *nf_set_idsList = NULL; + cJSON *nf_types = NULL; + OpenAPI_list_t *nf_typesList = NULL; + cJSON *network_area = NULL; + OpenAPI_network_area_info_t *network_area_local_nonprim = NULL; + cJSON *visited_areas = NULL; + OpenAPI_list_t *visited_areasList = NULL; + cJSON *max_top_app_ul_nbr = NULL; + cJSON *max_top_app_dl_nbr = NULL; + cJSON *nsi_id_infos = NULL; + OpenAPI_list_t *nsi_id_infosList = NULL; + cJSON *nsi_level_thrds = NULL; + OpenAPI_list_t *nsi_level_thrdsList = NULL; + cJSON *qos_requ = NULL; + OpenAPI_qos_requirement_t *qos_requ_local_nonprim = NULL; + cJSON *qos_flow_ret_thds = NULL; + OpenAPI_list_t *qos_flow_ret_thdsList = NULL; + cJSON *ran_ue_throu_thds = NULL; + OpenAPI_list_t *ran_ue_throu_thdsList = NULL; + cJSON *repetition_period = NULL; + cJSON *snssaia = NULL; + OpenAPI_list_t *snssaiaList = NULL; + cJSON *tgt_ue = NULL; + OpenAPI_target_ue_information_t *tgt_ue_local_nonprim = NULL; + cJSON *cong_thresholds = NULL; + OpenAPI_list_t *cong_thresholdsList = NULL; + cJSON *nw_perf_requs = NULL; + OpenAPI_list_t *nw_perf_requsList = NULL; + cJSON *bw_requs = NULL; + OpenAPI_list_t *bw_requsList = NULL; + cJSON *excep_requs = NULL; + OpenAPI_list_t *excep_requsList = NULL; + cJSON *expt_ana_type = NULL; + OpenAPI_expected_analytics_type_t *expt_ana_type_local_nonprim = NULL; + cJSON *expt_ue_behav = NULL; + OpenAPI_expected_ue_behaviour_data_t *expt_ue_behav_local_nonprim = NULL; + cJSON *rat_freqs = NULL; + OpenAPI_list_t *rat_freqsList = NULL; + cJSON *list_of_ana_subsets = NULL; + OpenAPI_list_t *list_of_ana_subsetsList = NULL; + cJSON *disper_reqs = NULL; + OpenAPI_list_t *disper_reqsList = NULL; + cJSON *red_trans_reqs = NULL; + OpenAPI_list_t *red_trans_reqsList = NULL; + cJSON *wlan_reqs = NULL; + OpenAPI_list_t *wlan_reqsList = NULL; + cJSON *upf_info = NULL; + OpenAPI_upf_information_t *upf_info_local_nonprim = NULL; + cJSON *app_server_addrs = NULL; + OpenAPI_list_t *app_server_addrsList = NULL; + cJSON *dn_perf_reqs = NULL; + OpenAPI_list_t *dn_perf_reqsList = NULL; + any_slice = cJSON_GetObjectItemCaseSensitive(event_subscriptionJSON, "anySlice"); + if (any_slice) { + if (!cJSON_IsBool(any_slice)) { + ogs_error("OpenAPI_event_subscription_parseFromJSON() failed [any_slice]"); + goto end; + } + } + + app_ids = cJSON_GetObjectItemCaseSensitive(event_subscriptionJSON, "appIds"); + if (app_ids) { + cJSON *app_ids_local = NULL; + if (!cJSON_IsArray(app_ids)) { + ogs_error("OpenAPI_event_subscription_parseFromJSON() failed [app_ids]"); + goto end; + } + + app_idsList = OpenAPI_list_create(); + + cJSON_ArrayForEach(app_ids_local, app_ids) { + double *localDouble = NULL; + int *localInt = NULL; + if (!cJSON_IsString(app_ids_local)) { + ogs_error("OpenAPI_event_subscription_parseFromJSON() failed [app_ids]"); + goto end; + } + OpenAPI_list_add(app_idsList, ogs_strdup(app_ids_local->valuestring)); + } + } + + dnns = cJSON_GetObjectItemCaseSensitive(event_subscriptionJSON, "dnns"); + if (dnns) { + cJSON *dnns_local = NULL; + if (!cJSON_IsArray(dnns)) { + ogs_error("OpenAPI_event_subscription_parseFromJSON() failed [dnns]"); + goto end; + } + + dnnsList = OpenAPI_list_create(); + + cJSON_ArrayForEach(dnns_local, dnns) { + double *localDouble = NULL; + int *localInt = NULL; + if (!cJSON_IsString(dnns_local)) { + ogs_error("OpenAPI_event_subscription_parseFromJSON() failed [dnns]"); + goto end; + } + OpenAPI_list_add(dnnsList, ogs_strdup(dnns_local->valuestring)); + } + } + + dnais = cJSON_GetObjectItemCaseSensitive(event_subscriptionJSON, "dnais"); + if (dnais) { + cJSON *dnais_local = NULL; + if (!cJSON_IsArray(dnais)) { + ogs_error("OpenAPI_event_subscription_parseFromJSON() failed [dnais]"); + goto end; + } + + dnaisList = OpenAPI_list_create(); + + cJSON_ArrayForEach(dnais_local, dnais) { + double *localDouble = NULL; + int *localInt = NULL; + if (!cJSON_IsString(dnais_local)) { + ogs_error("OpenAPI_event_subscription_parseFromJSON() failed [dnais]"); + goto end; + } + OpenAPI_list_add(dnaisList, ogs_strdup(dnais_local->valuestring)); + } + } + + event = cJSON_GetObjectItemCaseSensitive(event_subscriptionJSON, "event"); + if (!event) { + ogs_error("OpenAPI_event_subscription_parseFromJSON() failed [event]"); + goto end; + } + event_local_nonprim = OpenAPI_nwdaf_event_parseFromJSON(event); + + extra_report_req = cJSON_GetObjectItemCaseSensitive(event_subscriptionJSON, "extraReportReq"); + if (extra_report_req) { + extra_report_req_local_nonprim = OpenAPI_event_reporting_requirement_parseFromJSON(extra_report_req); + } + + ladn_dnns = cJSON_GetObjectItemCaseSensitive(event_subscriptionJSON, "ladnDnns"); + if (ladn_dnns) { + cJSON *ladn_dnns_local = NULL; + if (!cJSON_IsArray(ladn_dnns)) { + ogs_error("OpenAPI_event_subscription_parseFromJSON() failed [ladn_dnns]"); + goto end; + } + + ladn_dnnsList = OpenAPI_list_create(); + + cJSON_ArrayForEach(ladn_dnns_local, ladn_dnns) { + double *localDouble = NULL; + int *localInt = NULL; + if (!cJSON_IsString(ladn_dnns_local)) { + ogs_error("OpenAPI_event_subscription_parseFromJSON() failed [ladn_dnns]"); + goto end; + } + OpenAPI_list_add(ladn_dnnsList, ogs_strdup(ladn_dnns_local->valuestring)); + } + } + + load_level_threshold = cJSON_GetObjectItemCaseSensitive(event_subscriptionJSON, "loadLevelThreshold"); + if (load_level_threshold) { + if (!cJSON_IsNumber(load_level_threshold)) { + ogs_error("OpenAPI_event_subscription_parseFromJSON() failed [load_level_threshold]"); + goto end; + } + } + + notification_method = cJSON_GetObjectItemCaseSensitive(event_subscriptionJSON, "notificationMethod"); + if (notification_method) { + notification_method_local_nonprim = OpenAPI_notification_method_parseFromJSON(notification_method); + } + + matching_dir = cJSON_GetObjectItemCaseSensitive(event_subscriptionJSON, "matchingDir"); + if (matching_dir) { + matching_dir_local_nonprim = OpenAPI_matching_direction_parseFromJSON(matching_dir); + } + + nf_load_lvl_thds = cJSON_GetObjectItemCaseSensitive(event_subscriptionJSON, "nfLoadLvlThds"); + if (nf_load_lvl_thds) { + cJSON *nf_load_lvl_thds_local = NULL; + if (!cJSON_IsArray(nf_load_lvl_thds)) { + ogs_error("OpenAPI_event_subscription_parseFromJSON() failed [nf_load_lvl_thds]"); + goto end; + } + + nf_load_lvl_thdsList = OpenAPI_list_create(); + + cJSON_ArrayForEach(nf_load_lvl_thds_local, nf_load_lvl_thds) { + if (!cJSON_IsObject(nf_load_lvl_thds_local)) { + ogs_error("OpenAPI_event_subscription_parseFromJSON() failed [nf_load_lvl_thds]"); + goto end; + } + OpenAPI_threshold_level_t *nf_load_lvl_thdsItem = OpenAPI_threshold_level_parseFromJSON(nf_load_lvl_thds_local); + if (!nf_load_lvl_thdsItem) { + ogs_error("No nf_load_lvl_thdsItem"); + OpenAPI_list_free(nf_load_lvl_thdsList); + goto end; + } + OpenAPI_list_add(nf_load_lvl_thdsList, nf_load_lvl_thdsItem); + } + } + + nf_instance_ids = cJSON_GetObjectItemCaseSensitive(event_subscriptionJSON, "nfInstanceIds"); + if (nf_instance_ids) { + cJSON *nf_instance_ids_local = NULL; + if (!cJSON_IsArray(nf_instance_ids)) { + ogs_error("OpenAPI_event_subscription_parseFromJSON() failed [nf_instance_ids]"); + goto end; + } + + nf_instance_idsList = OpenAPI_list_create(); + + cJSON_ArrayForEach(nf_instance_ids_local, nf_instance_ids) { + double *localDouble = NULL; + int *localInt = NULL; + if (!cJSON_IsString(nf_instance_ids_local)) { + ogs_error("OpenAPI_event_subscription_parseFromJSON() failed [nf_instance_ids]"); + goto end; + } + OpenAPI_list_add(nf_instance_idsList, ogs_strdup(nf_instance_ids_local->valuestring)); + } + } + + nf_set_ids = cJSON_GetObjectItemCaseSensitive(event_subscriptionJSON, "nfSetIds"); + if (nf_set_ids) { + cJSON *nf_set_ids_local = NULL; + if (!cJSON_IsArray(nf_set_ids)) { + ogs_error("OpenAPI_event_subscription_parseFromJSON() failed [nf_set_ids]"); + goto end; + } + + nf_set_idsList = OpenAPI_list_create(); + + cJSON_ArrayForEach(nf_set_ids_local, nf_set_ids) { + double *localDouble = NULL; + int *localInt = NULL; + if (!cJSON_IsString(nf_set_ids_local)) { + ogs_error("OpenAPI_event_subscription_parseFromJSON() failed [nf_set_ids]"); + goto end; + } + OpenAPI_list_add(nf_set_idsList, ogs_strdup(nf_set_ids_local->valuestring)); + } + } + + nf_types = cJSON_GetObjectItemCaseSensitive(event_subscriptionJSON, "nfTypes"); + if (nf_types) { + cJSON *nf_types_local = NULL; + if (!cJSON_IsArray(nf_types)) { + ogs_error("OpenAPI_event_subscription_parseFromJSON() failed [nf_types]"); + goto end; + } + + nf_typesList = OpenAPI_list_create(); + + cJSON_ArrayForEach(nf_types_local, nf_types) { + if (!cJSON_IsString(nf_types_local)) { + ogs_error("OpenAPI_event_subscription_parseFromJSON() failed [nf_types]"); + goto end; + } + OpenAPI_list_add(nf_typesList, (void *)OpenAPI_nf_type_FromString(nf_types_local->valuestring)); + } + } + + network_area = cJSON_GetObjectItemCaseSensitive(event_subscriptionJSON, "networkArea"); + if (network_area) { + network_area_local_nonprim = OpenAPI_network_area_info_parseFromJSON(network_area); + } + + visited_areas = cJSON_GetObjectItemCaseSensitive(event_subscriptionJSON, "visitedAreas"); + if (visited_areas) { + cJSON *visited_areas_local = NULL; + if (!cJSON_IsArray(visited_areas)) { + ogs_error("OpenAPI_event_subscription_parseFromJSON() failed [visited_areas]"); + goto end; + } + + visited_areasList = OpenAPI_list_create(); + + cJSON_ArrayForEach(visited_areas_local, visited_areas) { + if (!cJSON_IsObject(visited_areas_local)) { + ogs_error("OpenAPI_event_subscription_parseFromJSON() failed [visited_areas]"); + goto end; + } + OpenAPI_network_area_info_t *visited_areasItem = OpenAPI_network_area_info_parseFromJSON(visited_areas_local); + if (!visited_areasItem) { + ogs_error("No visited_areasItem"); + OpenAPI_list_free(visited_areasList); + goto end; + } + OpenAPI_list_add(visited_areasList, visited_areasItem); + } + } + + max_top_app_ul_nbr = cJSON_GetObjectItemCaseSensitive(event_subscriptionJSON, "maxTopAppUlNbr"); + if (max_top_app_ul_nbr) { + if (!cJSON_IsNumber(max_top_app_ul_nbr)) { + ogs_error("OpenAPI_event_subscription_parseFromJSON() failed [max_top_app_ul_nbr]"); + goto end; + } + } + + max_top_app_dl_nbr = cJSON_GetObjectItemCaseSensitive(event_subscriptionJSON, "maxTopAppDlNbr"); + if (max_top_app_dl_nbr) { + if (!cJSON_IsNumber(max_top_app_dl_nbr)) { + ogs_error("OpenAPI_event_subscription_parseFromJSON() failed [max_top_app_dl_nbr]"); + goto end; + } + } + + nsi_id_infos = cJSON_GetObjectItemCaseSensitive(event_subscriptionJSON, "nsiIdInfos"); + if (nsi_id_infos) { + cJSON *nsi_id_infos_local = NULL; + if (!cJSON_IsArray(nsi_id_infos)) { + ogs_error("OpenAPI_event_subscription_parseFromJSON() failed [nsi_id_infos]"); + goto end; + } + + nsi_id_infosList = OpenAPI_list_create(); + + cJSON_ArrayForEach(nsi_id_infos_local, nsi_id_infos) { + if (!cJSON_IsObject(nsi_id_infos_local)) { + ogs_error("OpenAPI_event_subscription_parseFromJSON() failed [nsi_id_infos]"); + goto end; + } + OpenAPI_nsi_id_info_t *nsi_id_infosItem = OpenAPI_nsi_id_info_parseFromJSON(nsi_id_infos_local); + if (!nsi_id_infosItem) { + ogs_error("No nsi_id_infosItem"); + OpenAPI_list_free(nsi_id_infosList); + goto end; + } + OpenAPI_list_add(nsi_id_infosList, nsi_id_infosItem); + } + } + + nsi_level_thrds = cJSON_GetObjectItemCaseSensitive(event_subscriptionJSON, "nsiLevelThrds"); + if (nsi_level_thrds) { + cJSON *nsi_level_thrds_local = NULL; + if (!cJSON_IsArray(nsi_level_thrds)) { + ogs_error("OpenAPI_event_subscription_parseFromJSON() failed [nsi_level_thrds]"); + goto end; + } + + nsi_level_thrdsList = OpenAPI_list_create(); + + cJSON_ArrayForEach(nsi_level_thrds_local, nsi_level_thrds) { + double *localDouble = NULL; + int *localInt = NULL; + if (!cJSON_IsNumber(nsi_level_thrds_local)) { + ogs_error("OpenAPI_event_subscription_parseFromJSON() failed [nsi_level_thrds]"); + goto end; + } + localDouble = (double *)ogs_calloc(1, sizeof(double)); + if (!localDouble) { + ogs_error("OpenAPI_event_subscription_parseFromJSON() failed [nsi_level_thrds]"); + goto end; + } + *localDouble = nsi_level_thrds_local->valuedouble; + OpenAPI_list_add(nsi_level_thrdsList, localDouble); + } + } + + qos_requ = cJSON_GetObjectItemCaseSensitive(event_subscriptionJSON, "qosRequ"); + if (qos_requ) { + qos_requ_local_nonprim = OpenAPI_qos_requirement_parseFromJSON(qos_requ); + } + + qos_flow_ret_thds = cJSON_GetObjectItemCaseSensitive(event_subscriptionJSON, "qosFlowRetThds"); + if (qos_flow_ret_thds) { + cJSON *qos_flow_ret_thds_local = NULL; + if (!cJSON_IsArray(qos_flow_ret_thds)) { + ogs_error("OpenAPI_event_subscription_parseFromJSON() failed [qos_flow_ret_thds]"); + goto end; + } + + qos_flow_ret_thdsList = OpenAPI_list_create(); + + cJSON_ArrayForEach(qos_flow_ret_thds_local, qos_flow_ret_thds) { + if (!cJSON_IsObject(qos_flow_ret_thds_local)) { + ogs_error("OpenAPI_event_subscription_parseFromJSON() failed [qos_flow_ret_thds]"); + goto end; + } + OpenAPI_retainability_threshold_t *qos_flow_ret_thdsItem = OpenAPI_retainability_threshold_parseFromJSON(qos_flow_ret_thds_local); + if (!qos_flow_ret_thdsItem) { + ogs_error("No qos_flow_ret_thdsItem"); + OpenAPI_list_free(qos_flow_ret_thdsList); + goto end; + } + OpenAPI_list_add(qos_flow_ret_thdsList, qos_flow_ret_thdsItem); + } + } + + ran_ue_throu_thds = cJSON_GetObjectItemCaseSensitive(event_subscriptionJSON, "ranUeThrouThds"); + if (ran_ue_throu_thds) { + cJSON *ran_ue_throu_thds_local = NULL; + if (!cJSON_IsArray(ran_ue_throu_thds)) { + ogs_error("OpenAPI_event_subscription_parseFromJSON() failed [ran_ue_throu_thds]"); + goto end; + } + + ran_ue_throu_thdsList = OpenAPI_list_create(); + + cJSON_ArrayForEach(ran_ue_throu_thds_local, ran_ue_throu_thds) { + double *localDouble = NULL; + int *localInt = NULL; + if (!cJSON_IsString(ran_ue_throu_thds_local)) { + ogs_error("OpenAPI_event_subscription_parseFromJSON() failed [ran_ue_throu_thds]"); + goto end; + } + OpenAPI_list_add(ran_ue_throu_thdsList, ogs_strdup(ran_ue_throu_thds_local->valuestring)); + } + } + + repetition_period = cJSON_GetObjectItemCaseSensitive(event_subscriptionJSON, "repetitionPeriod"); + if (repetition_period) { + if (!cJSON_IsNumber(repetition_period)) { + ogs_error("OpenAPI_event_subscription_parseFromJSON() failed [repetition_period]"); + goto end; + } + } + + snssaia = cJSON_GetObjectItemCaseSensitive(event_subscriptionJSON, "snssaia"); + if (snssaia) { + cJSON *snssaia_local = NULL; + if (!cJSON_IsArray(snssaia)) { + ogs_error("OpenAPI_event_subscription_parseFromJSON() failed [snssaia]"); + goto end; + } + + snssaiaList = OpenAPI_list_create(); + + cJSON_ArrayForEach(snssaia_local, snssaia) { + if (!cJSON_IsObject(snssaia_local)) { + ogs_error("OpenAPI_event_subscription_parseFromJSON() failed [snssaia]"); + goto end; + } + OpenAPI_snssai_t *snssaiaItem = OpenAPI_snssai_parseFromJSON(snssaia_local); + if (!snssaiaItem) { + ogs_error("No snssaiaItem"); + OpenAPI_list_free(snssaiaList); + goto end; + } + OpenAPI_list_add(snssaiaList, snssaiaItem); + } + } + + tgt_ue = cJSON_GetObjectItemCaseSensitive(event_subscriptionJSON, "tgtUe"); + if (tgt_ue) { + tgt_ue_local_nonprim = OpenAPI_target_ue_information_parseFromJSON(tgt_ue); + } + + cong_thresholds = cJSON_GetObjectItemCaseSensitive(event_subscriptionJSON, "congThresholds"); + if (cong_thresholds) { + cJSON *cong_thresholds_local = NULL; + if (!cJSON_IsArray(cong_thresholds)) { + ogs_error("OpenAPI_event_subscription_parseFromJSON() failed [cong_thresholds]"); + goto end; + } + + cong_thresholdsList = OpenAPI_list_create(); + + cJSON_ArrayForEach(cong_thresholds_local, cong_thresholds) { + if (!cJSON_IsObject(cong_thresholds_local)) { + ogs_error("OpenAPI_event_subscription_parseFromJSON() failed [cong_thresholds]"); + goto end; + } + OpenAPI_threshold_level_t *cong_thresholdsItem = OpenAPI_threshold_level_parseFromJSON(cong_thresholds_local); + if (!cong_thresholdsItem) { + ogs_error("No cong_thresholdsItem"); + OpenAPI_list_free(cong_thresholdsList); + goto end; + } + OpenAPI_list_add(cong_thresholdsList, cong_thresholdsItem); + } + } + + nw_perf_requs = cJSON_GetObjectItemCaseSensitive(event_subscriptionJSON, "nwPerfRequs"); + if (nw_perf_requs) { + cJSON *nw_perf_requs_local = NULL; + if (!cJSON_IsArray(nw_perf_requs)) { + ogs_error("OpenAPI_event_subscription_parseFromJSON() failed [nw_perf_requs]"); + goto end; + } + + nw_perf_requsList = OpenAPI_list_create(); + + cJSON_ArrayForEach(nw_perf_requs_local, nw_perf_requs) { + if (!cJSON_IsObject(nw_perf_requs_local)) { + ogs_error("OpenAPI_event_subscription_parseFromJSON() failed [nw_perf_requs]"); + goto end; + } + OpenAPI_network_perf_requirement_t *nw_perf_requsItem = OpenAPI_network_perf_requirement_parseFromJSON(nw_perf_requs_local); + if (!nw_perf_requsItem) { + ogs_error("No nw_perf_requsItem"); + OpenAPI_list_free(nw_perf_requsList); + goto end; + } + OpenAPI_list_add(nw_perf_requsList, nw_perf_requsItem); + } + } + + bw_requs = cJSON_GetObjectItemCaseSensitive(event_subscriptionJSON, "bwRequs"); + if (bw_requs) { + cJSON *bw_requs_local = NULL; + if (!cJSON_IsArray(bw_requs)) { + ogs_error("OpenAPI_event_subscription_parseFromJSON() failed [bw_requs]"); + goto end; + } + + bw_requsList = OpenAPI_list_create(); + + cJSON_ArrayForEach(bw_requs_local, bw_requs) { + if (!cJSON_IsObject(bw_requs_local)) { + ogs_error("OpenAPI_event_subscription_parseFromJSON() failed [bw_requs]"); + goto end; + } + OpenAPI_bw_requirement_t *bw_requsItem = OpenAPI_bw_requirement_parseFromJSON(bw_requs_local); + if (!bw_requsItem) { + ogs_error("No bw_requsItem"); + OpenAPI_list_free(bw_requsList); + goto end; + } + OpenAPI_list_add(bw_requsList, bw_requsItem); + } + } + + excep_requs = cJSON_GetObjectItemCaseSensitive(event_subscriptionJSON, "excepRequs"); + if (excep_requs) { + cJSON *excep_requs_local = NULL; + if (!cJSON_IsArray(excep_requs)) { + ogs_error("OpenAPI_event_subscription_parseFromJSON() failed [excep_requs]"); + goto end; + } + + excep_requsList = OpenAPI_list_create(); + + cJSON_ArrayForEach(excep_requs_local, excep_requs) { + if (!cJSON_IsObject(excep_requs_local)) { + ogs_error("OpenAPI_event_subscription_parseFromJSON() failed [excep_requs]"); + goto end; + } + OpenAPI_exception_t *excep_requsItem = OpenAPI_exception_parseFromJSON(excep_requs_local); + if (!excep_requsItem) { + ogs_error("No excep_requsItem"); + OpenAPI_list_free(excep_requsList); + goto end; + } + OpenAPI_list_add(excep_requsList, excep_requsItem); + } + } + + expt_ana_type = cJSON_GetObjectItemCaseSensitive(event_subscriptionJSON, "exptAnaType"); + if (expt_ana_type) { + expt_ana_type_local_nonprim = OpenAPI_expected_analytics_type_parseFromJSON(expt_ana_type); + } + + expt_ue_behav = cJSON_GetObjectItemCaseSensitive(event_subscriptionJSON, "exptUeBehav"); + if (expt_ue_behav) { + expt_ue_behav_local_nonprim = OpenAPI_expected_ue_behaviour_data_parseFromJSON(expt_ue_behav); + } + + rat_freqs = cJSON_GetObjectItemCaseSensitive(event_subscriptionJSON, "ratFreqs"); + if (rat_freqs) { + cJSON *rat_freqs_local = NULL; + if (!cJSON_IsArray(rat_freqs)) { + ogs_error("OpenAPI_event_subscription_parseFromJSON() failed [rat_freqs]"); + goto end; + } + + rat_freqsList = OpenAPI_list_create(); + + cJSON_ArrayForEach(rat_freqs_local, rat_freqs) { + if (!cJSON_IsObject(rat_freqs_local)) { + ogs_error("OpenAPI_event_subscription_parseFromJSON() failed [rat_freqs]"); + goto end; + } + OpenAPI_rat_freq_information_t *rat_freqsItem = OpenAPI_rat_freq_information_parseFromJSON(rat_freqs_local); + if (!rat_freqsItem) { + ogs_error("No rat_freqsItem"); + OpenAPI_list_free(rat_freqsList); + goto end; + } + OpenAPI_list_add(rat_freqsList, rat_freqsItem); + } + } + + list_of_ana_subsets = cJSON_GetObjectItemCaseSensitive(event_subscriptionJSON, "listOfAnaSubsets"); + if (list_of_ana_subsets) { + cJSON *list_of_ana_subsets_local = NULL; + if (!cJSON_IsArray(list_of_ana_subsets)) { + ogs_error("OpenAPI_event_subscription_parseFromJSON() failed [list_of_ana_subsets]"); + goto end; + } + + list_of_ana_subsetsList = OpenAPI_list_create(); + + cJSON_ArrayForEach(list_of_ana_subsets_local, list_of_ana_subsets) { + if (!cJSON_IsObject(list_of_ana_subsets_local)) { + ogs_error("OpenAPI_event_subscription_parseFromJSON() failed [list_of_ana_subsets]"); + goto end; + } + OpenAPI_analytics_subset_t *list_of_ana_subsetsItem = OpenAPI_analytics_subset_parseFromJSON(list_of_ana_subsets_local); + if (!list_of_ana_subsetsItem) { + ogs_error("No list_of_ana_subsetsItem"); + OpenAPI_list_free(list_of_ana_subsetsList); + goto end; + } + OpenAPI_list_add(list_of_ana_subsetsList, list_of_ana_subsetsItem); + } + } + + disper_reqs = cJSON_GetObjectItemCaseSensitive(event_subscriptionJSON, "disperReqs"); + if (disper_reqs) { + cJSON *disper_reqs_local = NULL; + if (!cJSON_IsArray(disper_reqs)) { + ogs_error("OpenAPI_event_subscription_parseFromJSON() failed [disper_reqs]"); + goto end; + } + + disper_reqsList = OpenAPI_list_create(); + + cJSON_ArrayForEach(disper_reqs_local, disper_reqs) { + if (!cJSON_IsObject(disper_reqs_local)) { + ogs_error("OpenAPI_event_subscription_parseFromJSON() failed [disper_reqs]"); + goto end; + } + OpenAPI_dispersion_requirement_t *disper_reqsItem = OpenAPI_dispersion_requirement_parseFromJSON(disper_reqs_local); + if (!disper_reqsItem) { + ogs_error("No disper_reqsItem"); + OpenAPI_list_free(disper_reqsList); + goto end; + } + OpenAPI_list_add(disper_reqsList, disper_reqsItem); + } + } + + red_trans_reqs = cJSON_GetObjectItemCaseSensitive(event_subscriptionJSON, "redTransReqs"); + if (red_trans_reqs) { + cJSON *red_trans_reqs_local = NULL; + if (!cJSON_IsArray(red_trans_reqs)) { + ogs_error("OpenAPI_event_subscription_parseFromJSON() failed [red_trans_reqs]"); + goto end; + } + + red_trans_reqsList = OpenAPI_list_create(); + + cJSON_ArrayForEach(red_trans_reqs_local, red_trans_reqs) { + if (!cJSON_IsObject(red_trans_reqs_local)) { + ogs_error("OpenAPI_event_subscription_parseFromJSON() failed [red_trans_reqs]"); + goto end; + } + OpenAPI_redundant_transmission_exp_req_t *red_trans_reqsItem = OpenAPI_redundant_transmission_exp_req_parseFromJSON(red_trans_reqs_local); + if (!red_trans_reqsItem) { + ogs_error("No red_trans_reqsItem"); + OpenAPI_list_free(red_trans_reqsList); + goto end; + } + OpenAPI_list_add(red_trans_reqsList, red_trans_reqsItem); + } + } + + wlan_reqs = cJSON_GetObjectItemCaseSensitive(event_subscriptionJSON, "wlanReqs"); + if (wlan_reqs) { + cJSON *wlan_reqs_local = NULL; + if (!cJSON_IsArray(wlan_reqs)) { + ogs_error("OpenAPI_event_subscription_parseFromJSON() failed [wlan_reqs]"); + goto end; + } + + wlan_reqsList = OpenAPI_list_create(); + + cJSON_ArrayForEach(wlan_reqs_local, wlan_reqs) { + if (!cJSON_IsObject(wlan_reqs_local)) { + ogs_error("OpenAPI_event_subscription_parseFromJSON() failed [wlan_reqs]"); + goto end; + } + OpenAPI_wlan_performance_req_t *wlan_reqsItem = OpenAPI_wlan_performance_req_parseFromJSON(wlan_reqs_local); + if (!wlan_reqsItem) { + ogs_error("No wlan_reqsItem"); + OpenAPI_list_free(wlan_reqsList); + goto end; + } + OpenAPI_list_add(wlan_reqsList, wlan_reqsItem); + } + } + + upf_info = cJSON_GetObjectItemCaseSensitive(event_subscriptionJSON, "upfInfo"); + if (upf_info) { + upf_info_local_nonprim = OpenAPI_upf_information_parseFromJSON(upf_info); + } + + app_server_addrs = cJSON_GetObjectItemCaseSensitive(event_subscriptionJSON, "appServerAddrs"); + if (app_server_addrs) { + cJSON *app_server_addrs_local = NULL; + if (!cJSON_IsArray(app_server_addrs)) { + ogs_error("OpenAPI_event_subscription_parseFromJSON() failed [app_server_addrs]"); + goto end; + } + + app_server_addrsList = OpenAPI_list_create(); + + cJSON_ArrayForEach(app_server_addrs_local, app_server_addrs) { + if (!cJSON_IsObject(app_server_addrs_local)) { + ogs_error("OpenAPI_event_subscription_parseFromJSON() failed [app_server_addrs]"); + goto end; + } + OpenAPI_addr_fqdn_t *app_server_addrsItem = OpenAPI_addr_fqdn_parseFromJSON(app_server_addrs_local); + if (!app_server_addrsItem) { + ogs_error("No app_server_addrsItem"); + OpenAPI_list_free(app_server_addrsList); + goto end; + } + OpenAPI_list_add(app_server_addrsList, app_server_addrsItem); + } + } + + dn_perf_reqs = cJSON_GetObjectItemCaseSensitive(event_subscriptionJSON, "dnPerfReqs"); + if (dn_perf_reqs) { + cJSON *dn_perf_reqs_local = NULL; + if (!cJSON_IsArray(dn_perf_reqs)) { + ogs_error("OpenAPI_event_subscription_parseFromJSON() failed [dn_perf_reqs]"); + goto end; + } + + dn_perf_reqsList = OpenAPI_list_create(); + + cJSON_ArrayForEach(dn_perf_reqs_local, dn_perf_reqs) { + if (!cJSON_IsObject(dn_perf_reqs_local)) { + ogs_error("OpenAPI_event_subscription_parseFromJSON() failed [dn_perf_reqs]"); + goto end; + } + OpenAPI_dn_performance_req_t *dn_perf_reqsItem = OpenAPI_dn_performance_req_parseFromJSON(dn_perf_reqs_local); + if (!dn_perf_reqsItem) { + ogs_error("No dn_perf_reqsItem"); + OpenAPI_list_free(dn_perf_reqsList); + goto end; + } + OpenAPI_list_add(dn_perf_reqsList, dn_perf_reqsItem); + } + } + + event_subscription_local_var = OpenAPI_event_subscription_create ( + any_slice ? true : false, + any_slice ? any_slice->valueint : 0, + app_ids ? app_idsList : NULL, + dnns ? dnnsList : NULL, + dnais ? dnaisList : NULL, + event_local_nonprim, + extra_report_req ? extra_report_req_local_nonprim : NULL, + ladn_dnns ? ladn_dnnsList : NULL, + load_level_threshold ? true : false, + load_level_threshold ? load_level_threshold->valuedouble : 0, + notification_method ? notification_method_local_nonprim : NULL, + matching_dir ? matching_dir_local_nonprim : NULL, + nf_load_lvl_thds ? nf_load_lvl_thdsList : NULL, + nf_instance_ids ? nf_instance_idsList : NULL, + nf_set_ids ? nf_set_idsList : NULL, + nf_types ? nf_typesList : NULL, + network_area ? network_area_local_nonprim : NULL, + visited_areas ? visited_areasList : NULL, + max_top_app_ul_nbr ? true : false, + max_top_app_ul_nbr ? max_top_app_ul_nbr->valuedouble : 0, + max_top_app_dl_nbr ? true : false, + max_top_app_dl_nbr ? max_top_app_dl_nbr->valuedouble : 0, + nsi_id_infos ? nsi_id_infosList : NULL, + nsi_level_thrds ? nsi_level_thrdsList : NULL, + qos_requ ? qos_requ_local_nonprim : NULL, + qos_flow_ret_thds ? qos_flow_ret_thdsList : NULL, + ran_ue_throu_thds ? ran_ue_throu_thdsList : NULL, + repetition_period ? true : false, + repetition_period ? repetition_period->valuedouble : 0, + snssaia ? snssaiaList : NULL, + tgt_ue ? tgt_ue_local_nonprim : NULL, + cong_thresholds ? cong_thresholdsList : NULL, + nw_perf_requs ? nw_perf_requsList : NULL, + bw_requs ? bw_requsList : NULL, + excep_requs ? excep_requsList : NULL, + expt_ana_type ? expt_ana_type_local_nonprim : NULL, + expt_ue_behav ? expt_ue_behav_local_nonprim : NULL, + rat_freqs ? rat_freqsList : NULL, + list_of_ana_subsets ? list_of_ana_subsetsList : NULL, + disper_reqs ? disper_reqsList : NULL, + red_trans_reqs ? red_trans_reqsList : NULL, + wlan_reqs ? wlan_reqsList : NULL, + upf_info ? upf_info_local_nonprim : NULL, + app_server_addrs ? app_server_addrsList : NULL, + dn_perf_reqs ? dn_perf_reqsList : NULL + ); + + return event_subscription_local_var; +end: + if (app_idsList) { + OpenAPI_list_for_each(app_idsList, node) { + ogs_free(node->data); + } + OpenAPI_list_free(app_idsList); + app_idsList = NULL; + } + if (dnnsList) { + OpenAPI_list_for_each(dnnsList, node) { + ogs_free(node->data); + } + OpenAPI_list_free(dnnsList); + dnnsList = NULL; + } + if (dnaisList) { + OpenAPI_list_for_each(dnaisList, node) { + ogs_free(node->data); + } + OpenAPI_list_free(dnaisList); + dnaisList = NULL; + } + if (event_local_nonprim) { + OpenAPI_nwdaf_event_free(event_local_nonprim); + event_local_nonprim = NULL; + } + if (extra_report_req_local_nonprim) { + OpenAPI_event_reporting_requirement_free(extra_report_req_local_nonprim); + extra_report_req_local_nonprim = NULL; + } + if (ladn_dnnsList) { + OpenAPI_list_for_each(ladn_dnnsList, node) { + ogs_free(node->data); + } + OpenAPI_list_free(ladn_dnnsList); + ladn_dnnsList = NULL; + } + if (notification_method_local_nonprim) { + OpenAPI_notification_method_free(notification_method_local_nonprim); + notification_method_local_nonprim = NULL; + } + if (matching_dir_local_nonprim) { + OpenAPI_matching_direction_free(matching_dir_local_nonprim); + matching_dir_local_nonprim = NULL; + } + if (nf_load_lvl_thdsList) { + OpenAPI_list_for_each(nf_load_lvl_thdsList, node) { + OpenAPI_threshold_level_free(node->data); + } + OpenAPI_list_free(nf_load_lvl_thdsList); + nf_load_lvl_thdsList = NULL; + } + if (nf_instance_idsList) { + OpenAPI_list_for_each(nf_instance_idsList, node) { + ogs_free(node->data); + } + OpenAPI_list_free(nf_instance_idsList); + nf_instance_idsList = NULL; + } + if (nf_set_idsList) { + OpenAPI_list_for_each(nf_set_idsList, node) { + ogs_free(node->data); + } + OpenAPI_list_free(nf_set_idsList); + nf_set_idsList = NULL; + } + if (nf_typesList) { + OpenAPI_list_free(nf_typesList); + nf_typesList = NULL; + } + if (network_area_local_nonprim) { + OpenAPI_network_area_info_free(network_area_local_nonprim); + network_area_local_nonprim = NULL; + } + if (visited_areasList) { + OpenAPI_list_for_each(visited_areasList, node) { + OpenAPI_network_area_info_free(node->data); + } + OpenAPI_list_free(visited_areasList); + visited_areasList = NULL; + } + if (nsi_id_infosList) { + OpenAPI_list_for_each(nsi_id_infosList, node) { + OpenAPI_nsi_id_info_free(node->data); + } + OpenAPI_list_free(nsi_id_infosList); + nsi_id_infosList = NULL; + } + if (nsi_level_thrdsList) { + OpenAPI_list_for_each(nsi_level_thrdsList, node) { + ogs_free(node->data); + } + OpenAPI_list_free(nsi_level_thrdsList); + nsi_level_thrdsList = NULL; + } + if (qos_requ_local_nonprim) { + OpenAPI_qos_requirement_free(qos_requ_local_nonprim); + qos_requ_local_nonprim = NULL; + } + if (qos_flow_ret_thdsList) { + OpenAPI_list_for_each(qos_flow_ret_thdsList, node) { + OpenAPI_retainability_threshold_free(node->data); + } + OpenAPI_list_free(qos_flow_ret_thdsList); + qos_flow_ret_thdsList = NULL; + } + if (ran_ue_throu_thdsList) { + OpenAPI_list_for_each(ran_ue_throu_thdsList, node) { + ogs_free(node->data); + } + OpenAPI_list_free(ran_ue_throu_thdsList); + ran_ue_throu_thdsList = NULL; + } + if (snssaiaList) { + OpenAPI_list_for_each(snssaiaList, node) { + OpenAPI_snssai_free(node->data); + } + OpenAPI_list_free(snssaiaList); + snssaiaList = NULL; + } + if (tgt_ue_local_nonprim) { + OpenAPI_target_ue_information_free(tgt_ue_local_nonprim); + tgt_ue_local_nonprim = NULL; + } + if (cong_thresholdsList) { + OpenAPI_list_for_each(cong_thresholdsList, node) { + OpenAPI_threshold_level_free(node->data); + } + OpenAPI_list_free(cong_thresholdsList); + cong_thresholdsList = NULL; + } + if (nw_perf_requsList) { + OpenAPI_list_for_each(nw_perf_requsList, node) { + OpenAPI_network_perf_requirement_free(node->data); + } + OpenAPI_list_free(nw_perf_requsList); + nw_perf_requsList = NULL; + } + if (bw_requsList) { + OpenAPI_list_for_each(bw_requsList, node) { + OpenAPI_bw_requirement_free(node->data); + } + OpenAPI_list_free(bw_requsList); + bw_requsList = NULL; + } + if (excep_requsList) { + OpenAPI_list_for_each(excep_requsList, node) { + OpenAPI_exception_free(node->data); + } + OpenAPI_list_free(excep_requsList); + excep_requsList = NULL; + } + if (expt_ana_type_local_nonprim) { + OpenAPI_expected_analytics_type_free(expt_ana_type_local_nonprim); + expt_ana_type_local_nonprim = NULL; + } + if (expt_ue_behav_local_nonprim) { + OpenAPI_expected_ue_behaviour_data_free(expt_ue_behav_local_nonprim); + expt_ue_behav_local_nonprim = NULL; + } + if (rat_freqsList) { + OpenAPI_list_for_each(rat_freqsList, node) { + OpenAPI_rat_freq_information_free(node->data); + } + OpenAPI_list_free(rat_freqsList); + rat_freqsList = NULL; + } + if (list_of_ana_subsetsList) { + OpenAPI_list_for_each(list_of_ana_subsetsList, node) { + OpenAPI_analytics_subset_free(node->data); + } + OpenAPI_list_free(list_of_ana_subsetsList); + list_of_ana_subsetsList = NULL; + } + if (disper_reqsList) { + OpenAPI_list_for_each(disper_reqsList, node) { + OpenAPI_dispersion_requirement_free(node->data); + } + OpenAPI_list_free(disper_reqsList); + disper_reqsList = NULL; + } + if (red_trans_reqsList) { + OpenAPI_list_for_each(red_trans_reqsList, node) { + OpenAPI_redundant_transmission_exp_req_free(node->data); + } + OpenAPI_list_free(red_trans_reqsList); + red_trans_reqsList = NULL; + } + if (wlan_reqsList) { + OpenAPI_list_for_each(wlan_reqsList, node) { + OpenAPI_wlan_performance_req_free(node->data); + } + OpenAPI_list_free(wlan_reqsList); + wlan_reqsList = NULL; + } + if (upf_info_local_nonprim) { + OpenAPI_upf_information_free(upf_info_local_nonprim); + upf_info_local_nonprim = NULL; + } + if (app_server_addrsList) { + OpenAPI_list_for_each(app_server_addrsList, node) { + OpenAPI_addr_fqdn_free(node->data); + } + OpenAPI_list_free(app_server_addrsList); + app_server_addrsList = NULL; + } + if (dn_perf_reqsList) { + OpenAPI_list_for_each(dn_perf_reqsList, node) { + OpenAPI_dn_performance_req_free(node->data); + } + OpenAPI_list_free(dn_perf_reqsList); + dn_perf_reqsList = NULL; + } + return NULL; +} + +OpenAPI_event_subscription_t *OpenAPI_event_subscription_copy(OpenAPI_event_subscription_t *dst, OpenAPI_event_subscription_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_event_subscription_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_event_subscription_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_event_subscription_free(dst); + dst = OpenAPI_event_subscription_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/event_subscription.h b/lib/sbi/openapi/model/event_subscription.h new file mode 100644 index 000000000..740edf9d9 --- /dev/null +++ b/lib/sbi/openapi/model/event_subscription.h @@ -0,0 +1,151 @@ +/* + * event_subscription.h + * + * Represents a subscription to a single event. + */ + +#ifndef _OpenAPI_event_subscription_H_ +#define _OpenAPI_event_subscription_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "addr_fqdn.h" +#include "analytics_subset.h" +#include "bw_requirement.h" +#include "dispersion_requirement.h" +#include "dn_performance_req.h" +#include "event_reporting_requirement.h" +#include "exception.h" +#include "expected_analytics_type.h" +#include "expected_ue_behaviour_data.h" +#include "matching_direction.h" +#include "network_area_info.h" +#include "network_perf_requirement.h" +#include "nf_type.h" +#include "notification_method.h" +#include "nsi_id_info.h" +#include "nwdaf_event.h" +#include "qos_requirement.h" +#include "rat_freq_information.h" +#include "redundant_transmission_exp_req.h" +#include "retainability_threshold.h" +#include "snssai.h" +#include "target_ue_information.h" +#include "threshold_level.h" +#include "upf_information.h" +#include "wlan_performance_req.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_event_subscription_s OpenAPI_event_subscription_t; +typedef struct OpenAPI_event_subscription_s { + bool is_any_slice; + int any_slice; + OpenAPI_list_t *app_ids; + OpenAPI_list_t *dnns; + OpenAPI_list_t *dnais; + struct OpenAPI_nwdaf_event_s *event; + struct OpenAPI_event_reporting_requirement_s *extra_report_req; + OpenAPI_list_t *ladn_dnns; + bool is_load_level_threshold; + int load_level_threshold; + struct OpenAPI_notification_method_s *notification_method; + struct OpenAPI_matching_direction_s *matching_dir; + OpenAPI_list_t *nf_load_lvl_thds; + OpenAPI_list_t *nf_instance_ids; + OpenAPI_list_t *nf_set_ids; + OpenAPI_list_t *nf_types; + struct OpenAPI_network_area_info_s *network_area; + OpenAPI_list_t *visited_areas; + bool is_max_top_app_ul_nbr; + int max_top_app_ul_nbr; + bool is_max_top_app_dl_nbr; + int max_top_app_dl_nbr; + OpenAPI_list_t *nsi_id_infos; + OpenAPI_list_t *nsi_level_thrds; + struct OpenAPI_qos_requirement_s *qos_requ; + OpenAPI_list_t *qos_flow_ret_thds; + OpenAPI_list_t *ran_ue_throu_thds; + bool is_repetition_period; + int repetition_period; + OpenAPI_list_t *snssaia; + struct OpenAPI_target_ue_information_s *tgt_ue; + OpenAPI_list_t *cong_thresholds; + OpenAPI_list_t *nw_perf_requs; + OpenAPI_list_t *bw_requs; + OpenAPI_list_t *excep_requs; + struct OpenAPI_expected_analytics_type_s *expt_ana_type; + struct OpenAPI_expected_ue_behaviour_data_s *expt_ue_behav; + OpenAPI_list_t *rat_freqs; + OpenAPI_list_t *list_of_ana_subsets; + OpenAPI_list_t *disper_reqs; + OpenAPI_list_t *red_trans_reqs; + OpenAPI_list_t *wlan_reqs; + struct OpenAPI_upf_information_s *upf_info; + OpenAPI_list_t *app_server_addrs; + OpenAPI_list_t *dn_perf_reqs; +} OpenAPI_event_subscription_t; + +OpenAPI_event_subscription_t *OpenAPI_event_subscription_create( + bool is_any_slice, + int any_slice, + OpenAPI_list_t *app_ids, + OpenAPI_list_t *dnns, + OpenAPI_list_t *dnais, + OpenAPI_nwdaf_event_t *event, + OpenAPI_event_reporting_requirement_t *extra_report_req, + OpenAPI_list_t *ladn_dnns, + bool is_load_level_threshold, + int load_level_threshold, + OpenAPI_notification_method_t *notification_method, + OpenAPI_matching_direction_t *matching_dir, + OpenAPI_list_t *nf_load_lvl_thds, + OpenAPI_list_t *nf_instance_ids, + OpenAPI_list_t *nf_set_ids, + OpenAPI_list_t *nf_types, + OpenAPI_network_area_info_t *network_area, + OpenAPI_list_t *visited_areas, + bool is_max_top_app_ul_nbr, + int max_top_app_ul_nbr, + bool is_max_top_app_dl_nbr, + int max_top_app_dl_nbr, + OpenAPI_list_t *nsi_id_infos, + OpenAPI_list_t *nsi_level_thrds, + OpenAPI_qos_requirement_t *qos_requ, + OpenAPI_list_t *qos_flow_ret_thds, + OpenAPI_list_t *ran_ue_throu_thds, + bool is_repetition_period, + int repetition_period, + OpenAPI_list_t *snssaia, + OpenAPI_target_ue_information_t *tgt_ue, + OpenAPI_list_t *cong_thresholds, + OpenAPI_list_t *nw_perf_requs, + OpenAPI_list_t *bw_requs, + OpenAPI_list_t *excep_requs, + OpenAPI_expected_analytics_type_t *expt_ana_type, + OpenAPI_expected_ue_behaviour_data_t *expt_ue_behav, + OpenAPI_list_t *rat_freqs, + OpenAPI_list_t *list_of_ana_subsets, + OpenAPI_list_t *disper_reqs, + OpenAPI_list_t *red_trans_reqs, + OpenAPI_list_t *wlan_reqs, + OpenAPI_upf_information_t *upf_info, + OpenAPI_list_t *app_server_addrs, + OpenAPI_list_t *dn_perf_reqs +); +void OpenAPI_event_subscription_free(OpenAPI_event_subscription_t *event_subscription); +OpenAPI_event_subscription_t *OpenAPI_event_subscription_parseFromJSON(cJSON *event_subscriptionJSON); +cJSON *OpenAPI_event_subscription_convertToJSON(OpenAPI_event_subscription_t *event_subscription); +OpenAPI_event_subscription_t *OpenAPI_event_subscription_copy(OpenAPI_event_subscription_t *dst, OpenAPI_event_subscription_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_event_subscription_H_ */ + diff --git a/lib/sbi/openapi/model/event_type_any_of.c b/lib/sbi/openapi/model/event_type_any_of.c index facee9098..9986760bf 100644 --- a/lib/sbi/openapi/model/event_type_any_of.c +++ b/lib/sbi/openapi/model/event_type_any_of.c @@ -6,7 +6,7 @@ char* OpenAPI_event_type_any_of_ToString(OpenAPI_event_type_any_of_e event_type_any_of) { - const char *event_type_any_ofArray[] = { "NULL", "LOSS_OF_CONNECTIVITY", "UE_REACHABILITY_FOR_DATA", "UE_REACHABILITY_FOR_SMS", "LOCATION_REPORTING", "CHANGE_OF_SUPI_PEI_ASSOCIATION", "ROAMING_STATUS", "COMMUNICATION_FAILURE", "AVAILABILITY_AFTER_DDN_FAILURE", "CN_TYPE_CHANGE", "DL_DATA_DELIVERY_STATUS", "PDN_CONNECTIVITY_STATUS", "UE_CONNECTION_MANAGEMENT_STATE" }; + const char *event_type_any_ofArray[] = { "NULL", "LOSS_OF_CONNECTIVITY", "UE_REACHABILITY_FOR_DATA", "UE_REACHABILITY_FOR_SMS", "LOCATION_REPORTING", "CHANGE_OF_SUPI_PEI_ASSOCIATION", "ROAMING_STATUS", "COMMUNICATION_FAILURE", "AVAILABILITY_AFTER_DDN_FAILURE", "CN_TYPE_CHANGE", "DL_DATA_DELIVERY_STATUS", "PDN_CONNECTIVITY_STATUS", "UE_CONNECTION_MANAGEMENT_STATE", "ACCESS_TYPE_REPORT", "REGISTRATION_STATE_REPORT", "CONNECTIVITY_STATE_REPORT", "TYPE_ALLOCATION_CODE_REPORT", "FREQUENT_MOBILITY_REGISTRATION_REPORT", "PDU_SES_REL", "PDU_SES_EST", "UE_MEMORY_AVAILABLE_FOR_SMS" }; size_t sizeofArray = sizeof(event_type_any_ofArray) / sizeof(event_type_any_ofArray[0]); if (event_type_any_of < sizeofArray) return (char *)event_type_any_ofArray[event_type_any_of]; @@ -17,7 +17,7 @@ char* OpenAPI_event_type_any_of_ToString(OpenAPI_event_type_any_of_e event_type_ OpenAPI_event_type_any_of_e OpenAPI_event_type_any_of_FromString(char* event_type_any_of) { int stringToReturn = 0; - const char *event_type_any_ofArray[] = { "NULL", "LOSS_OF_CONNECTIVITY", "UE_REACHABILITY_FOR_DATA", "UE_REACHABILITY_FOR_SMS", "LOCATION_REPORTING", "CHANGE_OF_SUPI_PEI_ASSOCIATION", "ROAMING_STATUS", "COMMUNICATION_FAILURE", "AVAILABILITY_AFTER_DDN_FAILURE", "CN_TYPE_CHANGE", "DL_DATA_DELIVERY_STATUS", "PDN_CONNECTIVITY_STATUS", "UE_CONNECTION_MANAGEMENT_STATE" }; + const char *event_type_any_ofArray[] = { "NULL", "LOSS_OF_CONNECTIVITY", "UE_REACHABILITY_FOR_DATA", "UE_REACHABILITY_FOR_SMS", "LOCATION_REPORTING", "CHANGE_OF_SUPI_PEI_ASSOCIATION", "ROAMING_STATUS", "COMMUNICATION_FAILURE", "AVAILABILITY_AFTER_DDN_FAILURE", "CN_TYPE_CHANGE", "DL_DATA_DELIVERY_STATUS", "PDN_CONNECTIVITY_STATUS", "UE_CONNECTION_MANAGEMENT_STATE", "ACCESS_TYPE_REPORT", "REGISTRATION_STATE_REPORT", "CONNECTIVITY_STATE_REPORT", "TYPE_ALLOCATION_CODE_REPORT", "FREQUENT_MOBILITY_REGISTRATION_REPORT", "PDU_SES_REL", "PDU_SES_EST", "UE_MEMORY_AVAILABLE_FOR_SMS" }; size_t sizeofArray = sizeof(event_type_any_ofArray) / sizeof(event_type_any_ofArray[0]); while (stringToReturn < sizeofArray) { if (strcmp(event_type_any_of, event_type_any_ofArray[stringToReturn]) == 0) { diff --git a/lib/sbi/openapi/model/event_type_any_of.h b/lib/sbi/openapi/model/event_type_any_of.h index 41a0705fe..487e595ba 100644 --- a/lib/sbi/openapi/model/event_type_any_of.h +++ b/lib/sbi/openapi/model/event_type_any_of.h @@ -17,7 +17,7 @@ extern "C" { #endif -typedef enum { OpenAPI_event_type_any_of_NULL = 0, OpenAPI_event_type_any_of_LOSS_OF_CONNECTIVITY, OpenAPI_event_type_any_of_UE_REACHABILITY_FOR_DATA, OpenAPI_event_type_any_of_UE_REACHABILITY_FOR_SMS, OpenAPI_event_type_any_of_LOCATION_REPORTING, OpenAPI_event_type_any_of_CHANGE_OF_SUPI_PEI_ASSOCIATION, OpenAPI_event_type_any_of_ROAMING_STATUS, OpenAPI_event_type_any_of_COMMUNICATION_FAILURE, OpenAPI_event_type_any_of_AVAILABILITY_AFTER_DDN_FAILURE, OpenAPI_event_type_any_of_CN_TYPE_CHANGE, OpenAPI_event_type_any_of_DL_DATA_DELIVERY_STATUS, OpenAPI_event_type_any_of_PDN_CONNECTIVITY_STATUS, OpenAPI_event_type_any_of_UE_CONNECTION_MANAGEMENT_STATE } OpenAPI_event_type_any_of_e; +typedef enum { OpenAPI_event_type_any_of_NULL = 0, OpenAPI_event_type_any_of_LOSS_OF_CONNECTIVITY, OpenAPI_event_type_any_of_UE_REACHABILITY_FOR_DATA, OpenAPI_event_type_any_of_UE_REACHABILITY_FOR_SMS, OpenAPI_event_type_any_of_LOCATION_REPORTING, OpenAPI_event_type_any_of_CHANGE_OF_SUPI_PEI_ASSOCIATION, OpenAPI_event_type_any_of_ROAMING_STATUS, OpenAPI_event_type_any_of_COMMUNICATION_FAILURE, OpenAPI_event_type_any_of_AVAILABILITY_AFTER_DDN_FAILURE, OpenAPI_event_type_any_of_CN_TYPE_CHANGE, OpenAPI_event_type_any_of_DL_DATA_DELIVERY_STATUS, OpenAPI_event_type_any_of_PDN_CONNECTIVITY_STATUS, OpenAPI_event_type_any_of_UE_CONNECTION_MANAGEMENT_STATE, OpenAPI_event_type_any_of_ACCESS_TYPE_REPORT, OpenAPI_event_type_any_of_REGISTRATION_STATE_REPORT, OpenAPI_event_type_any_of_CONNECTIVITY_STATE_REPORT, OpenAPI_event_type_any_of_TYPE_ALLOCATION_CODE_REPORT, OpenAPI_event_type_any_of_FREQUENT_MOBILITY_REGISTRATION_REPORT, OpenAPI_event_type_any_of_PDU_SES_REL, OpenAPI_event_type_any_of_PDU_SES_EST, OpenAPI_event_type_any_of_UE_MEMORY_AVAILABLE_FOR_SMS } OpenAPI_event_type_any_of_e; char* OpenAPI_event_type_any_of_ToString(OpenAPI_event_type_any_of_e event_type_any_of); diff --git a/lib/sbi/openapi/model/events_notification.c b/lib/sbi/openapi/model/events_notification.c index 3865eb2c5..ce1f26634 100644 --- a/lib/sbi/openapi/model/events_notification.c +++ b/lib/sbi/openapi/model/events_notification.c @@ -5,6 +5,7 @@ #include "events_notification.h" OpenAPI_events_notification_t *OpenAPI_events_notification_create( + OpenAPI_list_t *ad_reports, OpenAPI_access_type_e access_type, OpenAPI_additional_access_info_t *add_access_info, OpenAPI_additional_access_info_t *rel_access_info, @@ -22,7 +23,9 @@ OpenAPI_events_notification_t *OpenAPI_events_notification_create( OpenAPI_list_t *qos_mon_reports, OpenAPI_list_t *ran_nas_rel_causes, OpenAPI_rat_type_e rat_type, + OpenAPI_satellite_backhaul_category_e sat_backhaul_category, OpenAPI_user_location_t *ue_loc, + char *ue_loc_time, char *ue_time_zone, OpenAPI_accumulated_usage_t *usg_rep, OpenAPI_bridge_management_container_t *tsn_bridge_man_cont, @@ -33,6 +36,7 @@ OpenAPI_events_notification_t *OpenAPI_events_notification_create( OpenAPI_events_notification_t *events_notification_local_var = ogs_malloc(sizeof(OpenAPI_events_notification_t)); ogs_assert(events_notification_local_var); + events_notification_local_var->ad_reports = ad_reports; events_notification_local_var->access_type = access_type; events_notification_local_var->add_access_info = add_access_info; events_notification_local_var->rel_access_info = rel_access_info; @@ -50,7 +54,9 @@ OpenAPI_events_notification_t *OpenAPI_events_notification_create( events_notification_local_var->qos_mon_reports = qos_mon_reports; events_notification_local_var->ran_nas_rel_causes = ran_nas_rel_causes; events_notification_local_var->rat_type = rat_type; + events_notification_local_var->sat_backhaul_category = sat_backhaul_category; events_notification_local_var->ue_loc = ue_loc; + events_notification_local_var->ue_loc_time = ue_loc_time; events_notification_local_var->ue_time_zone = ue_time_zone; events_notification_local_var->usg_rep = usg_rep; events_notification_local_var->tsn_bridge_man_cont = tsn_bridge_man_cont; @@ -67,6 +73,13 @@ void OpenAPI_events_notification_free(OpenAPI_events_notification_t *events_noti if (NULL == events_notification) { return; } + if (events_notification->ad_reports) { + OpenAPI_list_for_each(events_notification->ad_reports, node) { + OpenAPI_app_detection_report_free(node->data); + } + OpenAPI_list_free(events_notification->ad_reports); + events_notification->ad_reports = NULL; + } if (events_notification->add_access_info) { OpenAPI_additional_access_info_free(events_notification->add_access_info); events_notification->add_access_info = NULL; @@ -151,6 +164,10 @@ void OpenAPI_events_notification_free(OpenAPI_events_notification_t *events_noti OpenAPI_user_location_free(events_notification->ue_loc); events_notification->ue_loc = NULL; } + if (events_notification->ue_loc_time) { + ogs_free(events_notification->ue_loc_time); + events_notification->ue_loc_time = NULL; + } if (events_notification->ue_time_zone) { ogs_free(events_notification->ue_time_zone); events_notification->ue_time_zone = NULL; @@ -188,6 +205,22 @@ cJSON *OpenAPI_events_notification_convertToJSON(OpenAPI_events_notification_t * } item = cJSON_CreateObject(); + if (events_notification->ad_reports) { + cJSON *ad_reportsList = cJSON_AddArrayToObject(item, "adReports"); + if (ad_reportsList == NULL) { + ogs_error("OpenAPI_events_notification_convertToJSON() failed [ad_reports]"); + goto end; + } + OpenAPI_list_for_each(events_notification->ad_reports, node) { + cJSON *itemLocal = OpenAPI_app_detection_report_convertToJSON(node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_events_notification_convertToJSON() failed [ad_reports]"); + goto end; + } + cJSON_AddItemToArray(ad_reportsList, itemLocal); + } + } + if (events_notification->access_type != OpenAPI_access_type_NULL) { if (cJSON_AddStringToObject(item, "accessType", OpenAPI_access_type_ToString(events_notification->access_type)) == NULL) { ogs_error("OpenAPI_events_notification_convertToJSON() failed [access_type]"); @@ -413,6 +446,13 @@ cJSON *OpenAPI_events_notification_convertToJSON(OpenAPI_events_notification_t * } } + if (events_notification->sat_backhaul_category != OpenAPI_satellite_backhaul_category_NULL) { + if (cJSON_AddStringToObject(item, "satBackhaulCategory", OpenAPI_satellite_backhaul_category_ToString(events_notification->sat_backhaul_category)) == NULL) { + ogs_error("OpenAPI_events_notification_convertToJSON() failed [sat_backhaul_category]"); + goto end; + } + } + if (events_notification->ue_loc) { cJSON *ue_loc_local_JSON = OpenAPI_user_location_convertToJSON(events_notification->ue_loc); if (ue_loc_local_JSON == NULL) { @@ -426,6 +466,13 @@ cJSON *OpenAPI_events_notification_convertToJSON(OpenAPI_events_notification_t * } } + if (events_notification->ue_loc_time) { + if (cJSON_AddStringToObject(item, "ueLocTime", events_notification->ue_loc_time) == NULL) { + ogs_error("OpenAPI_events_notification_convertToJSON() failed [ue_loc_time]"); + goto end; + } + } + if (events_notification->ue_time_zone) { if (cJSON_AddStringToObject(item, "ueTimeZone", events_notification->ue_time_zone) == NULL) { ogs_error("OpenAPI_events_notification_convertToJSON() failed [ue_time_zone]"); @@ -496,6 +543,8 @@ OpenAPI_events_notification_t *OpenAPI_events_notification_parseFromJSON(cJSON * { OpenAPI_events_notification_t *events_notification_local_var = NULL; OpenAPI_lnode_t *node = NULL; + cJSON *ad_reports = NULL; + OpenAPI_list_t *ad_reportsList = NULL; cJSON *access_type = NULL; OpenAPI_access_type_e access_typeVariable = 0; cJSON *add_access_info = NULL; @@ -529,8 +578,11 @@ OpenAPI_events_notification_t *OpenAPI_events_notification_parseFromJSON(cJSON * OpenAPI_list_t *ran_nas_rel_causesList = NULL; cJSON *rat_type = NULL; OpenAPI_rat_type_e rat_typeVariable = 0; + cJSON *sat_backhaul_category = NULL; + OpenAPI_satellite_backhaul_category_e sat_backhaul_categoryVariable = 0; cJSON *ue_loc = NULL; OpenAPI_user_location_t *ue_loc_local_nonprim = NULL; + cJSON *ue_loc_time = NULL; cJSON *ue_time_zone = NULL; cJSON *usg_rep = NULL; OpenAPI_accumulated_usage_t *usg_rep_local_nonprim = NULL; @@ -540,6 +592,31 @@ OpenAPI_events_notification_t *OpenAPI_events_notification_parseFromJSON(cJSON * 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; + ad_reports = cJSON_GetObjectItemCaseSensitive(events_notificationJSON, "adReports"); + if (ad_reports) { + cJSON *ad_reports_local = NULL; + if (!cJSON_IsArray(ad_reports)) { + ogs_error("OpenAPI_events_notification_parseFromJSON() failed [ad_reports]"); + goto end; + } + + ad_reportsList = OpenAPI_list_create(); + + cJSON_ArrayForEach(ad_reports_local, ad_reports) { + if (!cJSON_IsObject(ad_reports_local)) { + ogs_error("OpenAPI_events_notification_parseFromJSON() failed [ad_reports]"); + goto end; + } + OpenAPI_app_detection_report_t *ad_reportsItem = OpenAPI_app_detection_report_parseFromJSON(ad_reports_local); + if (!ad_reportsItem) { + ogs_error("No ad_reportsItem"); + OpenAPI_list_free(ad_reportsList); + goto end; + } + OpenAPI_list_add(ad_reportsList, ad_reportsItem); + } + } + access_type = cJSON_GetObjectItemCaseSensitive(events_notificationJSON, "accessType"); if (access_type) { if (!cJSON_IsString(access_type)) { @@ -804,11 +881,28 @@ OpenAPI_events_notification_t *OpenAPI_events_notification_parseFromJSON(cJSON * rat_typeVariable = OpenAPI_rat_type_FromString(rat_type->valuestring); } + sat_backhaul_category = cJSON_GetObjectItemCaseSensitive(events_notificationJSON, "satBackhaulCategory"); + if (sat_backhaul_category) { + if (!cJSON_IsString(sat_backhaul_category)) { + ogs_error("OpenAPI_events_notification_parseFromJSON() failed [sat_backhaul_category]"); + goto end; + } + sat_backhaul_categoryVariable = OpenAPI_satellite_backhaul_category_FromString(sat_backhaul_category->valuestring); + } + ue_loc = cJSON_GetObjectItemCaseSensitive(events_notificationJSON, "ueLoc"); if (ue_loc) { ue_loc_local_nonprim = OpenAPI_user_location_parseFromJSON(ue_loc); } + ue_loc_time = cJSON_GetObjectItemCaseSensitive(events_notificationJSON, "ueLocTime"); + if (ue_loc_time) { + if (!cJSON_IsString(ue_loc_time) && !cJSON_IsNull(ue_loc_time)) { + ogs_error("OpenAPI_events_notification_parseFromJSON() failed [ue_loc_time]"); + goto end; + } + } + ue_time_zone = cJSON_GetObjectItemCaseSensitive(events_notificationJSON, "ueTimeZone"); if (ue_time_zone) { if (!cJSON_IsString(ue_time_zone) && !cJSON_IsNull(ue_time_zone)) { @@ -858,6 +952,7 @@ OpenAPI_events_notification_t *OpenAPI_events_notification_parseFromJSON(cJSON * } events_notification_local_var = OpenAPI_events_notification_create ( + ad_reports ? ad_reportsList : NULL, access_type ? access_typeVariable : 0, add_access_info ? add_access_info_local_nonprim : NULL, rel_access_info ? rel_access_info_local_nonprim : NULL, @@ -875,7 +970,9 @@ OpenAPI_events_notification_t *OpenAPI_events_notification_parseFromJSON(cJSON * qos_mon_reports ? qos_mon_reportsList : NULL, ran_nas_rel_causes ? ran_nas_rel_causesList : NULL, rat_type ? rat_typeVariable : 0, + sat_backhaul_category ? sat_backhaul_categoryVariable : 0, ue_loc ? ue_loc_local_nonprim : NULL, + ue_loc_time && !cJSON_IsNull(ue_loc_time) ? ogs_strdup(ue_loc_time->valuestring) : NULL, ue_time_zone && !cJSON_IsNull(ue_time_zone) ? ogs_strdup(ue_time_zone->valuestring) : NULL, usg_rep ? usg_rep_local_nonprim : NULL, tsn_bridge_man_cont ? tsn_bridge_man_cont_local_nonprim : NULL, @@ -885,6 +982,13 @@ OpenAPI_events_notification_t *OpenAPI_events_notification_parseFromJSON(cJSON * return events_notification_local_var; end: + if (ad_reportsList) { + OpenAPI_list_for_each(ad_reportsList, node) { + OpenAPI_app_detection_report_free(node->data); + } + OpenAPI_list_free(ad_reportsList); + ad_reportsList = NULL; + } if (add_access_info_local_nonprim) { OpenAPI_additional_access_info_free(add_access_info_local_nonprim); add_access_info_local_nonprim = NULL; diff --git a/lib/sbi/openapi/model/events_notification.h b/lib/sbi/openapi/model/events_notification.h index 19b1feee9..7f4039e28 100644 --- a/lib/sbi/openapi/model/events_notification.h +++ b/lib/sbi/openapi/model/events_notification.h @@ -1,7 +1,7 @@ /* * events_notification.h * - * describes the notification of a matched event + * Describes the notification of a matched event. */ #ifndef _OpenAPI_events_notification_H_ @@ -19,6 +19,7 @@ #include "additional_access_info.h" #include "af_event_notification.h" #include "an_gw_address.h" +#include "app_detection_report.h" #include "bridge_management_container.h" #include "net_loc_access_support.h" #include "out_of_credit_information.h" @@ -29,6 +30,7 @@ #include "ran_nas_rel_cause.h" #include "rat_type.h" #include "resources_allocation_info.h" +#include "satellite_backhaul_category.h" #include "user_location.h" #ifdef __cplusplus @@ -37,6 +39,7 @@ extern "C" { typedef struct OpenAPI_events_notification_s OpenAPI_events_notification_t; typedef struct OpenAPI_events_notification_s { + OpenAPI_list_t *ad_reports; OpenAPI_access_type_e access_type; struct OpenAPI_additional_access_info_s *add_access_info; struct OpenAPI_additional_access_info_s *rel_access_info; @@ -54,7 +57,9 @@ typedef struct OpenAPI_events_notification_s { OpenAPI_list_t *qos_mon_reports; OpenAPI_list_t *ran_nas_rel_causes; OpenAPI_rat_type_e rat_type; + OpenAPI_satellite_backhaul_category_e sat_backhaul_category; struct OpenAPI_user_location_s *ue_loc; + char *ue_loc_time; char *ue_time_zone; struct OpenAPI_accumulated_usage_s *usg_rep; struct OpenAPI_bridge_management_container_s *tsn_bridge_man_cont; @@ -63,6 +68,7 @@ typedef struct OpenAPI_events_notification_s { } OpenAPI_events_notification_t; OpenAPI_events_notification_t *OpenAPI_events_notification_create( + OpenAPI_list_t *ad_reports, OpenAPI_access_type_e access_type, OpenAPI_additional_access_info_t *add_access_info, OpenAPI_additional_access_info_t *rel_access_info, @@ -80,7 +86,9 @@ OpenAPI_events_notification_t *OpenAPI_events_notification_create( OpenAPI_list_t *qos_mon_reports, OpenAPI_list_t *ran_nas_rel_causes, OpenAPI_rat_type_e rat_type, + OpenAPI_satellite_backhaul_category_e sat_backhaul_category, OpenAPI_user_location_t *ue_loc, + char *ue_loc_time, char *ue_time_zone, OpenAPI_accumulated_usage_t *usg_rep, OpenAPI_bridge_management_container_t *tsn_bridge_man_cont, diff --git a/lib/sbi/openapi/model/events_subsc_put_data.c b/lib/sbi/openapi/model/events_subsc_put_data.c index 1e41a741f..3ab2f9165 100644 --- a/lib/sbi/openapi/model/events_subsc_put_data.c +++ b/lib/sbi/openapi/model/events_subsc_put_data.c @@ -12,6 +12,10 @@ OpenAPI_events_subsc_put_data_t *OpenAPI_events_subsc_put_data_create( OpenAPI_list_t *req_anis, OpenAPI_usage_threshold_t *usg_thres, char *notif_corre_id, + OpenAPI_list_t *af_app_ids, + bool is_direct_notif_ind, + int direct_notif_ind, + OpenAPI_list_t *ad_reports, OpenAPI_access_type_e access_type, OpenAPI_additional_access_info_t *add_access_info, OpenAPI_additional_access_info_t *rel_access_info, @@ -29,7 +33,9 @@ OpenAPI_events_subsc_put_data_t *OpenAPI_events_subsc_put_data_create( OpenAPI_list_t *qos_mon_reports, OpenAPI_list_t *ran_nas_rel_causes, OpenAPI_rat_type_e rat_type, + OpenAPI_satellite_backhaul_category_e sat_backhaul_category, OpenAPI_user_location_t *ue_loc, + char *ue_loc_time, char *ue_time_zone, OpenAPI_accumulated_usage_t *usg_rep, OpenAPI_bridge_management_container_t *tsn_bridge_man_cont, @@ -47,6 +53,10 @@ OpenAPI_events_subsc_put_data_t *OpenAPI_events_subsc_put_data_create( events_subsc_put_data_local_var->req_anis = req_anis; events_subsc_put_data_local_var->usg_thres = usg_thres; events_subsc_put_data_local_var->notif_corre_id = notif_corre_id; + events_subsc_put_data_local_var->af_app_ids = af_app_ids; + events_subsc_put_data_local_var->is_direct_notif_ind = is_direct_notif_ind; + events_subsc_put_data_local_var->direct_notif_ind = direct_notif_ind; + events_subsc_put_data_local_var->ad_reports = ad_reports; events_subsc_put_data_local_var->access_type = access_type; events_subsc_put_data_local_var->add_access_info = add_access_info; events_subsc_put_data_local_var->rel_access_info = rel_access_info; @@ -64,7 +74,9 @@ OpenAPI_events_subsc_put_data_t *OpenAPI_events_subsc_put_data_create( events_subsc_put_data_local_var->qos_mon_reports = qos_mon_reports; events_subsc_put_data_local_var->ran_nas_rel_causes = ran_nas_rel_causes; events_subsc_put_data_local_var->rat_type = rat_type; + events_subsc_put_data_local_var->sat_backhaul_category = sat_backhaul_category; events_subsc_put_data_local_var->ue_loc = ue_loc; + events_subsc_put_data_local_var->ue_loc_time = ue_loc_time; events_subsc_put_data_local_var->ue_time_zone = ue_time_zone; events_subsc_put_data_local_var->usg_rep = usg_rep; events_subsc_put_data_local_var->tsn_bridge_man_cont = tsn_bridge_man_cont; @@ -112,6 +124,20 @@ void OpenAPI_events_subsc_put_data_free(OpenAPI_events_subsc_put_data_t *events_ ogs_free(events_subsc_put_data->notif_corre_id); events_subsc_put_data->notif_corre_id = NULL; } + if (events_subsc_put_data->af_app_ids) { + OpenAPI_list_for_each(events_subsc_put_data->af_app_ids, node) { + ogs_free(node->data); + } + OpenAPI_list_free(events_subsc_put_data->af_app_ids); + events_subsc_put_data->af_app_ids = NULL; + } + if (events_subsc_put_data->ad_reports) { + OpenAPI_list_for_each(events_subsc_put_data->ad_reports, node) { + OpenAPI_app_detection_report_free(node->data); + } + OpenAPI_list_free(events_subsc_put_data->ad_reports); + events_subsc_put_data->ad_reports = NULL; + } if (events_subsc_put_data->add_access_info) { OpenAPI_additional_access_info_free(events_subsc_put_data->add_access_info); events_subsc_put_data->add_access_info = NULL; @@ -196,6 +222,10 @@ void OpenAPI_events_subsc_put_data_free(OpenAPI_events_subsc_put_data_t *events_ OpenAPI_user_location_free(events_subsc_put_data->ue_loc); events_subsc_put_data->ue_loc = NULL; } + if (events_subsc_put_data->ue_loc_time) { + ogs_free(events_subsc_put_data->ue_loc_time); + events_subsc_put_data->ue_loc_time = NULL; + } if (events_subsc_put_data->ue_time_zone) { ogs_free(events_subsc_put_data->ue_time_zone); events_subsc_put_data->ue_time_zone = NULL; @@ -319,6 +349,43 @@ cJSON *OpenAPI_events_subsc_put_data_convertToJSON(OpenAPI_events_subsc_put_data } } + if (events_subsc_put_data->af_app_ids) { + cJSON *af_app_idsList = cJSON_AddArrayToObject(item, "afAppIds"); + if (af_app_idsList == NULL) { + ogs_error("OpenAPI_events_subsc_put_data_convertToJSON() failed [af_app_ids]"); + goto end; + } + OpenAPI_list_for_each(events_subsc_put_data->af_app_ids, node) { + if (cJSON_AddStringToObject(af_app_idsList, "", (char*)node->data) == NULL) { + ogs_error("OpenAPI_events_subsc_put_data_convertToJSON() failed [af_app_ids]"); + goto end; + } + } + } + + if (events_subsc_put_data->is_direct_notif_ind) { + if (cJSON_AddBoolToObject(item, "directNotifInd", events_subsc_put_data->direct_notif_ind) == NULL) { + ogs_error("OpenAPI_events_subsc_put_data_convertToJSON() failed [direct_notif_ind]"); + goto end; + } + } + + if (events_subsc_put_data->ad_reports) { + cJSON *ad_reportsList = cJSON_AddArrayToObject(item, "adReports"); + if (ad_reportsList == NULL) { + ogs_error("OpenAPI_events_subsc_put_data_convertToJSON() failed [ad_reports]"); + goto end; + } + OpenAPI_list_for_each(events_subsc_put_data->ad_reports, node) { + cJSON *itemLocal = OpenAPI_app_detection_report_convertToJSON(node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_events_subsc_put_data_convertToJSON() failed [ad_reports]"); + goto end; + } + cJSON_AddItemToArray(ad_reportsList, itemLocal); + } + } + if (events_subsc_put_data->access_type != OpenAPI_access_type_NULL) { if (cJSON_AddStringToObject(item, "accessType", OpenAPI_access_type_ToString(events_subsc_put_data->access_type)) == NULL) { ogs_error("OpenAPI_events_subsc_put_data_convertToJSON() failed [access_type]"); @@ -544,6 +611,13 @@ cJSON *OpenAPI_events_subsc_put_data_convertToJSON(OpenAPI_events_subsc_put_data } } + if (events_subsc_put_data->sat_backhaul_category != OpenAPI_satellite_backhaul_category_NULL) { + if (cJSON_AddStringToObject(item, "satBackhaulCategory", OpenAPI_satellite_backhaul_category_ToString(events_subsc_put_data->sat_backhaul_category)) == NULL) { + ogs_error("OpenAPI_events_subsc_put_data_convertToJSON() failed [sat_backhaul_category]"); + goto end; + } + } + if (events_subsc_put_data->ue_loc) { cJSON *ue_loc_local_JSON = OpenAPI_user_location_convertToJSON(events_subsc_put_data->ue_loc); if (ue_loc_local_JSON == NULL) { @@ -557,6 +631,13 @@ cJSON *OpenAPI_events_subsc_put_data_convertToJSON(OpenAPI_events_subsc_put_data } } + if (events_subsc_put_data->ue_loc_time) { + if (cJSON_AddStringToObject(item, "ueLocTime", events_subsc_put_data->ue_loc_time) == NULL) { + ogs_error("OpenAPI_events_subsc_put_data_convertToJSON() failed [ue_loc_time]"); + goto end; + } + } + if (events_subsc_put_data->ue_time_zone) { if (cJSON_AddStringToObject(item, "ueTimeZone", events_subsc_put_data->ue_time_zone) == NULL) { ogs_error("OpenAPI_events_subsc_put_data_convertToJSON() failed [ue_time_zone]"); @@ -639,6 +720,11 @@ OpenAPI_events_subsc_put_data_t *OpenAPI_events_subsc_put_data_parseFromJSON(cJS cJSON *usg_thres = NULL; OpenAPI_usage_threshold_t *usg_thres_local_nonprim = NULL; cJSON *notif_corre_id = NULL; + cJSON *af_app_ids = NULL; + OpenAPI_list_t *af_app_idsList = NULL; + cJSON *direct_notif_ind = NULL; + cJSON *ad_reports = NULL; + OpenAPI_list_t *ad_reportsList = NULL; cJSON *access_type = NULL; OpenAPI_access_type_e access_typeVariable = 0; cJSON *add_access_info = NULL; @@ -672,8 +758,11 @@ OpenAPI_events_subsc_put_data_t *OpenAPI_events_subsc_put_data_parseFromJSON(cJS OpenAPI_list_t *ran_nas_rel_causesList = NULL; cJSON *rat_type = NULL; OpenAPI_rat_type_e rat_typeVariable = 0; + cJSON *sat_backhaul_category = NULL; + OpenAPI_satellite_backhaul_category_e sat_backhaul_categoryVariable = 0; cJSON *ue_loc = NULL; OpenAPI_user_location_t *ue_loc_local_nonprim = NULL; + cJSON *ue_loc_time = NULL; cJSON *ue_time_zone = NULL; cJSON *usg_rep = NULL; OpenAPI_accumulated_usage_t *usg_rep_local_nonprim = NULL; @@ -774,6 +863,60 @@ OpenAPI_events_subsc_put_data_t *OpenAPI_events_subsc_put_data_parseFromJSON(cJS } } + af_app_ids = cJSON_GetObjectItemCaseSensitive(events_subsc_put_dataJSON, "afAppIds"); + if (af_app_ids) { + cJSON *af_app_ids_local = NULL; + if (!cJSON_IsArray(af_app_ids)) { + ogs_error("OpenAPI_events_subsc_put_data_parseFromJSON() failed [af_app_ids]"); + goto end; + } + + af_app_idsList = OpenAPI_list_create(); + + cJSON_ArrayForEach(af_app_ids_local, af_app_ids) { + double *localDouble = NULL; + int *localInt = NULL; + if (!cJSON_IsString(af_app_ids_local)) { + ogs_error("OpenAPI_events_subsc_put_data_parseFromJSON() failed [af_app_ids]"); + goto end; + } + OpenAPI_list_add(af_app_idsList, ogs_strdup(af_app_ids_local->valuestring)); + } + } + + direct_notif_ind = cJSON_GetObjectItemCaseSensitive(events_subsc_put_dataJSON, "directNotifInd"); + if (direct_notif_ind) { + if (!cJSON_IsBool(direct_notif_ind)) { + ogs_error("OpenAPI_events_subsc_put_data_parseFromJSON() failed [direct_notif_ind]"); + goto end; + } + } + + ad_reports = cJSON_GetObjectItemCaseSensitive(events_subsc_put_dataJSON, "adReports"); + if (ad_reports) { + cJSON *ad_reports_local = NULL; + if (!cJSON_IsArray(ad_reports)) { + ogs_error("OpenAPI_events_subsc_put_data_parseFromJSON() failed [ad_reports]"); + goto end; + } + + ad_reportsList = OpenAPI_list_create(); + + cJSON_ArrayForEach(ad_reports_local, ad_reports) { + if (!cJSON_IsObject(ad_reports_local)) { + ogs_error("OpenAPI_events_subsc_put_data_parseFromJSON() failed [ad_reports]"); + goto end; + } + OpenAPI_app_detection_report_t *ad_reportsItem = OpenAPI_app_detection_report_parseFromJSON(ad_reports_local); + if (!ad_reportsItem) { + ogs_error("No ad_reportsItem"); + OpenAPI_list_free(ad_reportsList); + goto end; + } + OpenAPI_list_add(ad_reportsList, ad_reportsItem); + } + } + access_type = cJSON_GetObjectItemCaseSensitive(events_subsc_put_dataJSON, "accessType"); if (access_type) { if (!cJSON_IsString(access_type)) { @@ -1038,11 +1181,28 @@ OpenAPI_events_subsc_put_data_t *OpenAPI_events_subsc_put_data_parseFromJSON(cJS rat_typeVariable = OpenAPI_rat_type_FromString(rat_type->valuestring); } + sat_backhaul_category = cJSON_GetObjectItemCaseSensitive(events_subsc_put_dataJSON, "satBackhaulCategory"); + if (sat_backhaul_category) { + if (!cJSON_IsString(sat_backhaul_category)) { + ogs_error("OpenAPI_events_subsc_put_data_parseFromJSON() failed [sat_backhaul_category]"); + goto end; + } + sat_backhaul_categoryVariable = OpenAPI_satellite_backhaul_category_FromString(sat_backhaul_category->valuestring); + } + ue_loc = cJSON_GetObjectItemCaseSensitive(events_subsc_put_dataJSON, "ueLoc"); if (ue_loc) { ue_loc_local_nonprim = OpenAPI_user_location_parseFromJSON(ue_loc); } + ue_loc_time = cJSON_GetObjectItemCaseSensitive(events_subsc_put_dataJSON, "ueLocTime"); + if (ue_loc_time) { + if (!cJSON_IsString(ue_loc_time) && !cJSON_IsNull(ue_loc_time)) { + ogs_error("OpenAPI_events_subsc_put_data_parseFromJSON() failed [ue_loc_time]"); + goto end; + } + } + ue_time_zone = cJSON_GetObjectItemCaseSensitive(events_subsc_put_dataJSON, "ueTimeZone"); if (ue_time_zone) { if (!cJSON_IsString(ue_time_zone) && !cJSON_IsNull(ue_time_zone)) { @@ -1099,6 +1259,10 @@ OpenAPI_events_subsc_put_data_t *OpenAPI_events_subsc_put_data_parseFromJSON(cJS req_anis ? req_anisList : NULL, usg_thres ? usg_thres_local_nonprim : NULL, notif_corre_id && !cJSON_IsNull(notif_corre_id) ? ogs_strdup(notif_corre_id->valuestring) : NULL, + af_app_ids ? af_app_idsList : NULL, + direct_notif_ind ? true : false, + direct_notif_ind ? direct_notif_ind->valueint : 0, + ad_reports ? ad_reportsList : NULL, access_type ? access_typeVariable : 0, add_access_info ? add_access_info_local_nonprim : NULL, rel_access_info ? rel_access_info_local_nonprim : NULL, @@ -1116,7 +1280,9 @@ OpenAPI_events_subsc_put_data_t *OpenAPI_events_subsc_put_data_parseFromJSON(cJS qos_mon_reports ? qos_mon_reportsList : NULL, ran_nas_rel_causes ? ran_nas_rel_causesList : NULL, rat_type ? rat_typeVariable : 0, + sat_backhaul_category ? sat_backhaul_categoryVariable : 0, ue_loc ? ue_loc_local_nonprim : NULL, + ue_loc_time && !cJSON_IsNull(ue_loc_time) ? ogs_strdup(ue_loc_time->valuestring) : NULL, ue_time_zone && !cJSON_IsNull(ue_time_zone) ? ogs_strdup(ue_time_zone->valuestring) : NULL, usg_rep ? usg_rep_local_nonprim : NULL, tsn_bridge_man_cont ? tsn_bridge_man_cont_local_nonprim : NULL, @@ -1149,6 +1315,20 @@ end: OpenAPI_usage_threshold_free(usg_thres_local_nonprim); usg_thres_local_nonprim = NULL; } + if (af_app_idsList) { + OpenAPI_list_for_each(af_app_idsList, node) { + ogs_free(node->data); + } + OpenAPI_list_free(af_app_idsList); + af_app_idsList = NULL; + } + if (ad_reportsList) { + OpenAPI_list_for_each(ad_reportsList, node) { + OpenAPI_app_detection_report_free(node->data); + } + OpenAPI_list_free(ad_reportsList); + ad_reportsList = NULL; + } if (add_access_info_local_nonprim) { OpenAPI_additional_access_info_free(add_access_info_local_nonprim); add_access_info_local_nonprim = NULL; diff --git a/lib/sbi/openapi/model/events_subsc_put_data.h b/lib/sbi/openapi/model/events_subsc_put_data.h index 90cf6e00b..1174deb9e 100644 --- a/lib/sbi/openapi/model/events_subsc_put_data.h +++ b/lib/sbi/openapi/model/events_subsc_put_data.h @@ -1,7 +1,7 @@ /* * events_subsc_put_data.h * - * Identifies the events the application subscribes to within an Events Subscription sub-resource data. It may contain the notification of the already met events + * Identifies the events the application subscribes to within an Events Subscription sub-resource data. It may contain the notification of the already met events. */ #ifndef _OpenAPI_events_subsc_put_data_H_ @@ -20,6 +20,7 @@ #include "af_event_notification.h" #include "af_event_subscription.h" #include "an_gw_address.h" +#include "app_detection_report.h" #include "bridge_management_container.h" #include "events_notification.h" #include "events_subsc_req_data.h" @@ -35,6 +36,7 @@ #include "requested_qos_monitoring_parameter.h" #include "required_access_info.h" #include "resources_allocation_info.h" +#include "satellite_backhaul_category.h" #include "usage_threshold.h" #include "user_location.h" @@ -51,6 +53,10 @@ typedef struct OpenAPI_events_subsc_put_data_s { OpenAPI_list_t *req_anis; struct OpenAPI_usage_threshold_s *usg_thres; char *notif_corre_id; + OpenAPI_list_t *af_app_ids; + bool is_direct_notif_ind; + int direct_notif_ind; + OpenAPI_list_t *ad_reports; OpenAPI_access_type_e access_type; struct OpenAPI_additional_access_info_s *add_access_info; struct OpenAPI_additional_access_info_s *rel_access_info; @@ -68,7 +74,9 @@ typedef struct OpenAPI_events_subsc_put_data_s { OpenAPI_list_t *qos_mon_reports; OpenAPI_list_t *ran_nas_rel_causes; OpenAPI_rat_type_e rat_type; + OpenAPI_satellite_backhaul_category_e sat_backhaul_category; struct OpenAPI_user_location_s *ue_loc; + char *ue_loc_time; char *ue_time_zone; struct OpenAPI_accumulated_usage_s *usg_rep; struct OpenAPI_bridge_management_container_s *tsn_bridge_man_cont; @@ -84,6 +92,10 @@ OpenAPI_events_subsc_put_data_t *OpenAPI_events_subsc_put_data_create( OpenAPI_list_t *req_anis, OpenAPI_usage_threshold_t *usg_thres, char *notif_corre_id, + OpenAPI_list_t *af_app_ids, + bool is_direct_notif_ind, + int direct_notif_ind, + OpenAPI_list_t *ad_reports, OpenAPI_access_type_e access_type, OpenAPI_additional_access_info_t *add_access_info, OpenAPI_additional_access_info_t *rel_access_info, @@ -101,7 +113,9 @@ OpenAPI_events_subsc_put_data_t *OpenAPI_events_subsc_put_data_create( OpenAPI_list_t *qos_mon_reports, OpenAPI_list_t *ran_nas_rel_causes, OpenAPI_rat_type_e rat_type, + OpenAPI_satellite_backhaul_category_e sat_backhaul_category, OpenAPI_user_location_t *ue_loc, + char *ue_loc_time, char *ue_time_zone, OpenAPI_accumulated_usage_t *usg_rep, OpenAPI_bridge_management_container_t *tsn_bridge_man_cont, diff --git a/lib/sbi/openapi/model/events_subsc_req_data.c b/lib/sbi/openapi/model/events_subsc_req_data.c index b5fbfdc51..fcc6893c3 100644 --- a/lib/sbi/openapi/model/events_subsc_req_data.c +++ b/lib/sbi/openapi/model/events_subsc_req_data.c @@ -11,7 +11,10 @@ OpenAPI_events_subsc_req_data_t *OpenAPI_events_subsc_req_data_create( OpenAPI_qos_monitoring_information_t *qos_mon, OpenAPI_list_t *req_anis, OpenAPI_usage_threshold_t *usg_thres, - char *notif_corre_id + char *notif_corre_id, + OpenAPI_list_t *af_app_ids, + bool is_direct_notif_ind, + int direct_notif_ind ) { OpenAPI_events_subsc_req_data_t *events_subsc_req_data_local_var = ogs_malloc(sizeof(OpenAPI_events_subsc_req_data_t)); @@ -24,6 +27,9 @@ OpenAPI_events_subsc_req_data_t *OpenAPI_events_subsc_req_data_create( events_subsc_req_data_local_var->req_anis = req_anis; events_subsc_req_data_local_var->usg_thres = usg_thres; events_subsc_req_data_local_var->notif_corre_id = notif_corre_id; + events_subsc_req_data_local_var->af_app_ids = af_app_ids; + events_subsc_req_data_local_var->is_direct_notif_ind = is_direct_notif_ind; + events_subsc_req_data_local_var->direct_notif_ind = direct_notif_ind; return events_subsc_req_data_local_var; } @@ -66,6 +72,13 @@ void OpenAPI_events_subsc_req_data_free(OpenAPI_events_subsc_req_data_t *events_ ogs_free(events_subsc_req_data->notif_corre_id); events_subsc_req_data->notif_corre_id = NULL; } + if (events_subsc_req_data->af_app_ids) { + OpenAPI_list_for_each(events_subsc_req_data->af_app_ids, node) { + ogs_free(node->data); + } + OpenAPI_list_free(events_subsc_req_data->af_app_ids); + events_subsc_req_data->af_app_ids = NULL; + } ogs_free(events_subsc_req_data); } @@ -166,6 +179,27 @@ cJSON *OpenAPI_events_subsc_req_data_convertToJSON(OpenAPI_events_subsc_req_data } } + if (events_subsc_req_data->af_app_ids) { + cJSON *af_app_idsList = cJSON_AddArrayToObject(item, "afAppIds"); + if (af_app_idsList == NULL) { + ogs_error("OpenAPI_events_subsc_req_data_convertToJSON() failed [af_app_ids]"); + goto end; + } + OpenAPI_list_for_each(events_subsc_req_data->af_app_ids, node) { + if (cJSON_AddStringToObject(af_app_idsList, "", (char*)node->data) == NULL) { + ogs_error("OpenAPI_events_subsc_req_data_convertToJSON() failed [af_app_ids]"); + goto end; + } + } + } + + if (events_subsc_req_data->is_direct_notif_ind) { + if (cJSON_AddBoolToObject(item, "directNotifInd", events_subsc_req_data->direct_notif_ind) == NULL) { + ogs_error("OpenAPI_events_subsc_req_data_convertToJSON() failed [direct_notif_ind]"); + goto end; + } + } + end: return item; } @@ -186,6 +220,9 @@ OpenAPI_events_subsc_req_data_t *OpenAPI_events_subsc_req_data_parseFromJSON(cJS cJSON *usg_thres = NULL; OpenAPI_usage_threshold_t *usg_thres_local_nonprim = NULL; cJSON *notif_corre_id = NULL; + cJSON *af_app_ids = NULL; + OpenAPI_list_t *af_app_idsList = NULL; + cJSON *direct_notif_ind = NULL; events = cJSON_GetObjectItemCaseSensitive(events_subsc_req_dataJSON, "events"); if (!events) { ogs_error("OpenAPI_events_subsc_req_data_parseFromJSON() failed [events]"); @@ -277,6 +314,35 @@ OpenAPI_events_subsc_req_data_t *OpenAPI_events_subsc_req_data_parseFromJSON(cJS } } + af_app_ids = cJSON_GetObjectItemCaseSensitive(events_subsc_req_dataJSON, "afAppIds"); + if (af_app_ids) { + cJSON *af_app_ids_local = NULL; + if (!cJSON_IsArray(af_app_ids)) { + ogs_error("OpenAPI_events_subsc_req_data_parseFromJSON() failed [af_app_ids]"); + goto end; + } + + af_app_idsList = OpenAPI_list_create(); + + cJSON_ArrayForEach(af_app_ids_local, af_app_ids) { + double *localDouble = NULL; + int *localInt = NULL; + if (!cJSON_IsString(af_app_ids_local)) { + ogs_error("OpenAPI_events_subsc_req_data_parseFromJSON() failed [af_app_ids]"); + goto end; + } + OpenAPI_list_add(af_app_idsList, ogs_strdup(af_app_ids_local->valuestring)); + } + } + + direct_notif_ind = cJSON_GetObjectItemCaseSensitive(events_subsc_req_dataJSON, "directNotifInd"); + if (direct_notif_ind) { + if (!cJSON_IsBool(direct_notif_ind)) { + ogs_error("OpenAPI_events_subsc_req_data_parseFromJSON() failed [direct_notif_ind]"); + goto end; + } + } + events_subsc_req_data_local_var = OpenAPI_events_subsc_req_data_create ( eventsList, notif_uri && !cJSON_IsNull(notif_uri) ? ogs_strdup(notif_uri->valuestring) : NULL, @@ -284,7 +350,10 @@ OpenAPI_events_subsc_req_data_t *OpenAPI_events_subsc_req_data_parseFromJSON(cJS qos_mon ? qos_mon_local_nonprim : NULL, req_anis ? req_anisList : NULL, usg_thres ? usg_thres_local_nonprim : NULL, - notif_corre_id && !cJSON_IsNull(notif_corre_id) ? ogs_strdup(notif_corre_id->valuestring) : NULL + notif_corre_id && !cJSON_IsNull(notif_corre_id) ? ogs_strdup(notif_corre_id->valuestring) : NULL, + af_app_ids ? af_app_idsList : NULL, + direct_notif_ind ? true : false, + direct_notif_ind ? direct_notif_ind->valueint : 0 ); return events_subsc_req_data_local_var; @@ -312,6 +381,13 @@ end: OpenAPI_usage_threshold_free(usg_thres_local_nonprim); usg_thres_local_nonprim = NULL; } + if (af_app_idsList) { + OpenAPI_list_for_each(af_app_idsList, node) { + ogs_free(node->data); + } + OpenAPI_list_free(af_app_idsList); + af_app_idsList = NULL; + } return NULL; } diff --git a/lib/sbi/openapi/model/events_subsc_req_data.h b/lib/sbi/openapi/model/events_subsc_req_data.h index 8fe9121a5..daeaa445e 100644 --- a/lib/sbi/openapi/model/events_subsc_req_data.h +++ b/lib/sbi/openapi/model/events_subsc_req_data.h @@ -31,6 +31,9 @@ typedef struct OpenAPI_events_subsc_req_data_s { OpenAPI_list_t *req_anis; struct OpenAPI_usage_threshold_s *usg_thres; char *notif_corre_id; + OpenAPI_list_t *af_app_ids; + bool is_direct_notif_ind; + int direct_notif_ind; } OpenAPI_events_subsc_req_data_t; OpenAPI_events_subsc_req_data_t *OpenAPI_events_subsc_req_data_create( @@ -40,7 +43,10 @@ OpenAPI_events_subsc_req_data_t *OpenAPI_events_subsc_req_data_create( OpenAPI_qos_monitoring_information_t *qos_mon, OpenAPI_list_t *req_anis, OpenAPI_usage_threshold_t *usg_thres, - char *notif_corre_id + char *notif_corre_id, + OpenAPI_list_t *af_app_ids, + bool is_direct_notif_ind, + int direct_notif_ind ); void OpenAPI_events_subsc_req_data_free(OpenAPI_events_subsc_req_data_t *events_subsc_req_data); OpenAPI_events_subsc_req_data_t *OpenAPI_events_subsc_req_data_parseFromJSON(cJSON *events_subsc_req_dataJSON); diff --git a/lib/sbi/openapi/model/events_subsc_req_data_rm.c b/lib/sbi/openapi/model/events_subsc_req_data_rm.c index f1849ba91..39b1b85cd 100644 --- a/lib/sbi/openapi/model/events_subsc_req_data_rm.c +++ b/lib/sbi/openapi/model/events_subsc_req_data_rm.c @@ -11,7 +11,9 @@ OpenAPI_events_subsc_req_data_rm_t *OpenAPI_events_subsc_req_data_rm_create( OpenAPI_qos_monitoring_information_rm_t *qos_mon, OpenAPI_list_t *req_anis, OpenAPI_usage_threshold_rm_t *usg_thres, - char *notif_corre_id + char *notif_corre_id, + bool is_direct_notif_ind, + int direct_notif_ind ) { OpenAPI_events_subsc_req_data_rm_t *events_subsc_req_data_rm_local_var = ogs_malloc(sizeof(OpenAPI_events_subsc_req_data_rm_t)); @@ -24,6 +26,8 @@ OpenAPI_events_subsc_req_data_rm_t *OpenAPI_events_subsc_req_data_rm_create( events_subsc_req_data_rm_local_var->req_anis = req_anis; events_subsc_req_data_rm_local_var->usg_thres = usg_thres; events_subsc_req_data_rm_local_var->notif_corre_id = notif_corre_id; + events_subsc_req_data_rm_local_var->is_direct_notif_ind = is_direct_notif_ind; + events_subsc_req_data_rm_local_var->direct_notif_ind = direct_notif_ind; return events_subsc_req_data_rm_local_var; } @@ -166,6 +170,13 @@ cJSON *OpenAPI_events_subsc_req_data_rm_convertToJSON(OpenAPI_events_subsc_req_d } } + if (events_subsc_req_data_rm->is_direct_notif_ind) { + if (cJSON_AddBoolToObject(item, "directNotifInd", events_subsc_req_data_rm->direct_notif_ind) == NULL) { + ogs_error("OpenAPI_events_subsc_req_data_rm_convertToJSON() failed [direct_notif_ind]"); + goto end; + } + } + end: return item; } @@ -186,6 +197,7 @@ OpenAPI_events_subsc_req_data_rm_t *OpenAPI_events_subsc_req_data_rm_parseFromJS cJSON *usg_thres = NULL; OpenAPI_usage_threshold_rm_t *usg_thres_local_nonprim = NULL; cJSON *notif_corre_id = NULL; + cJSON *direct_notif_ind = NULL; events = cJSON_GetObjectItemCaseSensitive(events_subsc_req_data_rmJSON, "events"); if (!events) { ogs_error("OpenAPI_events_subsc_req_data_rm_parseFromJSON() failed [events]"); @@ -277,6 +289,14 @@ OpenAPI_events_subsc_req_data_rm_t *OpenAPI_events_subsc_req_data_rm_parseFromJS } } + direct_notif_ind = cJSON_GetObjectItemCaseSensitive(events_subsc_req_data_rmJSON, "directNotifInd"); + if (direct_notif_ind) { + if (!cJSON_IsBool(direct_notif_ind)) { + ogs_error("OpenAPI_events_subsc_req_data_rm_parseFromJSON() failed [direct_notif_ind]"); + goto end; + } + } + events_subsc_req_data_rm_local_var = OpenAPI_events_subsc_req_data_rm_create ( eventsList, notif_uri && !cJSON_IsNull(notif_uri) ? ogs_strdup(notif_uri->valuestring) : NULL, @@ -284,7 +304,9 @@ OpenAPI_events_subsc_req_data_rm_t *OpenAPI_events_subsc_req_data_rm_parseFromJS qos_mon ? qos_mon_local_nonprim : NULL, req_anis ? req_anisList : NULL, usg_thres ? usg_thres_local_nonprim : NULL, - notif_corre_id && !cJSON_IsNull(notif_corre_id) ? ogs_strdup(notif_corre_id->valuestring) : NULL + notif_corre_id && !cJSON_IsNull(notif_corre_id) ? ogs_strdup(notif_corre_id->valuestring) : NULL, + direct_notif_ind ? true : false, + direct_notif_ind ? direct_notif_ind->valueint : 0 ); return events_subsc_req_data_rm_local_var; diff --git a/lib/sbi/openapi/model/events_subsc_req_data_rm.h b/lib/sbi/openapi/model/events_subsc_req_data_rm.h index 0db47e1a3..4bbdf281d 100644 --- a/lib/sbi/openapi/model/events_subsc_req_data_rm.h +++ b/lib/sbi/openapi/model/events_subsc_req_data_rm.h @@ -1,7 +1,7 @@ /* * events_subsc_req_data_rm.h * - * this data type is defined in the same way as the EventsSubscReqData data type, but with the OpenAPI nullable property set to true. + * This data type is defined in the same way as the EventsSubscReqData data type, but with the OpenAPI nullable property set to true. */ #ifndef _OpenAPI_events_subsc_req_data_rm_H_ @@ -31,6 +31,8 @@ typedef struct OpenAPI_events_subsc_req_data_rm_s { OpenAPI_list_t *req_anis; struct OpenAPI_usage_threshold_rm_s *usg_thres; char *notif_corre_id; + bool is_direct_notif_ind; + int direct_notif_ind; } OpenAPI_events_subsc_req_data_rm_t; OpenAPI_events_subsc_req_data_rm_t *OpenAPI_events_subsc_req_data_rm_create( @@ -40,7 +42,9 @@ OpenAPI_events_subsc_req_data_rm_t *OpenAPI_events_subsc_req_data_rm_create( OpenAPI_qos_monitoring_information_rm_t *qos_mon, OpenAPI_list_t *req_anis, OpenAPI_usage_threshold_rm_t *usg_thres, - char *notif_corre_id + char *notif_corre_id, + bool is_direct_notif_ind, + int direct_notif_ind ); void OpenAPI_events_subsc_req_data_rm_free(OpenAPI_events_subsc_req_data_rm_t *events_subsc_req_data_rm); OpenAPI_events_subsc_req_data_rm_t *OpenAPI_events_subsc_req_data_rm_parseFromJSON(cJSON *events_subsc_req_data_rmJSON); diff --git a/lib/sbi/openapi/model/exception.c b/lib/sbi/openapi/model/exception.c new file mode 100644 index 000000000..de8251afa --- /dev/null +++ b/lib/sbi/openapi/model/exception.c @@ -0,0 +1,175 @@ + +#include +#include +#include +#include "exception.h" + +OpenAPI_exception_t *OpenAPI_exception_create( + OpenAPI_exception_id_t *excep_id, + bool is_excep_level, + int excep_level, + OpenAPI_exception_trend_t *excep_trend +) +{ + OpenAPI_exception_t *exception_local_var = ogs_malloc(sizeof(OpenAPI_exception_t)); + ogs_assert(exception_local_var); + + exception_local_var->excep_id = excep_id; + exception_local_var->is_excep_level = is_excep_level; + exception_local_var->excep_level = excep_level; + exception_local_var->excep_trend = excep_trend; + + return exception_local_var; +} + +void OpenAPI_exception_free(OpenAPI_exception_t *exception) +{ + OpenAPI_lnode_t *node = NULL; + + if (NULL == exception) { + return; + } + if (exception->excep_id) { + OpenAPI_exception_id_free(exception->excep_id); + exception->excep_id = NULL; + } + if (exception->excep_trend) { + OpenAPI_exception_trend_free(exception->excep_trend); + exception->excep_trend = NULL; + } + ogs_free(exception); +} + +cJSON *OpenAPI_exception_convertToJSON(OpenAPI_exception_t *exception) +{ + cJSON *item = NULL; + OpenAPI_lnode_t *node = NULL; + + if (exception == NULL) { + ogs_error("OpenAPI_exception_convertToJSON() failed [Exception]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (!exception->excep_id) { + ogs_error("OpenAPI_exception_convertToJSON() failed [excep_id]"); + return NULL; + } + cJSON *excep_id_local_JSON = OpenAPI_exception_id_convertToJSON(exception->excep_id); + if (excep_id_local_JSON == NULL) { + ogs_error("OpenAPI_exception_convertToJSON() failed [excep_id]"); + goto end; + } + cJSON_AddItemToObject(item, "excepId", excep_id_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_exception_convertToJSON() failed [excep_id]"); + goto end; + } + + if (exception->is_excep_level) { + if (cJSON_AddNumberToObject(item, "excepLevel", exception->excep_level) == NULL) { + ogs_error("OpenAPI_exception_convertToJSON() failed [excep_level]"); + goto end; + } + } + + if (exception->excep_trend) { + cJSON *excep_trend_local_JSON = OpenAPI_exception_trend_convertToJSON(exception->excep_trend); + if (excep_trend_local_JSON == NULL) { + ogs_error("OpenAPI_exception_convertToJSON() failed [excep_trend]"); + goto end; + } + cJSON_AddItemToObject(item, "excepTrend", excep_trend_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_exception_convertToJSON() failed [excep_trend]"); + goto end; + } + } + +end: + return item; +} + +OpenAPI_exception_t *OpenAPI_exception_parseFromJSON(cJSON *exceptionJSON) +{ + OpenAPI_exception_t *exception_local_var = NULL; + OpenAPI_lnode_t *node = NULL; + cJSON *excep_id = NULL; + OpenAPI_exception_id_t *excep_id_local_nonprim = NULL; + cJSON *excep_level = NULL; + cJSON *excep_trend = NULL; + OpenAPI_exception_trend_t *excep_trend_local_nonprim = NULL; + excep_id = cJSON_GetObjectItemCaseSensitive(exceptionJSON, "excepId"); + if (!excep_id) { + ogs_error("OpenAPI_exception_parseFromJSON() failed [excep_id]"); + goto end; + } + excep_id_local_nonprim = OpenAPI_exception_id_parseFromJSON(excep_id); + + excep_level = cJSON_GetObjectItemCaseSensitive(exceptionJSON, "excepLevel"); + if (excep_level) { + if (!cJSON_IsNumber(excep_level)) { + ogs_error("OpenAPI_exception_parseFromJSON() failed [excep_level]"); + goto end; + } + } + + excep_trend = cJSON_GetObjectItemCaseSensitive(exceptionJSON, "excepTrend"); + if (excep_trend) { + excep_trend_local_nonprim = OpenAPI_exception_trend_parseFromJSON(excep_trend); + } + + exception_local_var = OpenAPI_exception_create ( + excep_id_local_nonprim, + excep_level ? true : false, + excep_level ? excep_level->valuedouble : 0, + excep_trend ? excep_trend_local_nonprim : NULL + ); + + return exception_local_var; +end: + if (excep_id_local_nonprim) { + OpenAPI_exception_id_free(excep_id_local_nonprim); + excep_id_local_nonprim = NULL; + } + if (excep_trend_local_nonprim) { + OpenAPI_exception_trend_free(excep_trend_local_nonprim); + excep_trend_local_nonprim = NULL; + } + return NULL; +} + +OpenAPI_exception_t *OpenAPI_exception_copy(OpenAPI_exception_t *dst, OpenAPI_exception_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_exception_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_exception_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_exception_free(dst); + dst = OpenAPI_exception_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/exception.h b/lib/sbi/openapi/model/exception.h new file mode 100644 index 000000000..a47fa09df --- /dev/null +++ b/lib/sbi/openapi/model/exception.h @@ -0,0 +1,46 @@ +/* + * exception.h + * + * Represents the Exception information. + */ + +#ifndef _OpenAPI_exception_H_ +#define _OpenAPI_exception_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "exception_id.h" +#include "exception_trend.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_exception_s OpenAPI_exception_t; +typedef struct OpenAPI_exception_s { + struct OpenAPI_exception_id_s *excep_id; + bool is_excep_level; + int excep_level; + struct OpenAPI_exception_trend_s *excep_trend; +} OpenAPI_exception_t; + +OpenAPI_exception_t *OpenAPI_exception_create( + OpenAPI_exception_id_t *excep_id, + bool is_excep_level, + int excep_level, + OpenAPI_exception_trend_t *excep_trend +); +void OpenAPI_exception_free(OpenAPI_exception_t *exception); +OpenAPI_exception_t *OpenAPI_exception_parseFromJSON(cJSON *exceptionJSON); +cJSON *OpenAPI_exception_convertToJSON(OpenAPI_exception_t *exception); +OpenAPI_exception_t *OpenAPI_exception_copy(OpenAPI_exception_t *dst, OpenAPI_exception_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_exception_H_ */ + diff --git a/lib/sbi/openapi/model/exception_id.c b/lib/sbi/openapi/model/exception_id.c new file mode 100644 index 000000000..de34aebd8 --- /dev/null +++ b/lib/sbi/openapi/model/exception_id.c @@ -0,0 +1,87 @@ + +#include +#include +#include +#include "exception_id.h" + +OpenAPI_exception_id_t *OpenAPI_exception_id_create( +) +{ + OpenAPI_exception_id_t *exception_id_local_var = ogs_malloc(sizeof(OpenAPI_exception_id_t)); + ogs_assert(exception_id_local_var); + + + return exception_id_local_var; +} + +void OpenAPI_exception_id_free(OpenAPI_exception_id_t *exception_id) +{ + OpenAPI_lnode_t *node = NULL; + + if (NULL == exception_id) { + return; + } + ogs_free(exception_id); +} + +cJSON *OpenAPI_exception_id_convertToJSON(OpenAPI_exception_id_t *exception_id) +{ + cJSON *item = NULL; + OpenAPI_lnode_t *node = NULL; + + if (exception_id == NULL) { + ogs_error("OpenAPI_exception_id_convertToJSON() failed [ExceptionId]"); + return NULL; + } + + item = cJSON_CreateObject(); +end: + return item; +} + +OpenAPI_exception_id_t *OpenAPI_exception_id_parseFromJSON(cJSON *exception_idJSON) +{ + OpenAPI_exception_id_t *exception_id_local_var = NULL; + OpenAPI_lnode_t *node = NULL; + exception_id_local_var = OpenAPI_exception_id_create ( + ); + + return exception_id_local_var; +end: + return NULL; +} + +OpenAPI_exception_id_t *OpenAPI_exception_id_copy(OpenAPI_exception_id_t *dst, OpenAPI_exception_id_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_exception_id_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_exception_id_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_exception_id_free(dst); + dst = OpenAPI_exception_id_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/exception_id.h b/lib/sbi/openapi/model/exception_id.h new file mode 100644 index 000000000..876b5b183 --- /dev/null +++ b/lib/sbi/openapi/model/exception_id.h @@ -0,0 +1,37 @@ +/* + * exception_id.h + * + * Possible values are: - UNEXPECTED_UE_LOCATION: Unexpected UE location - UNEXPECTED_LONG_LIVE_FLOW: Unexpected long-live rate flows - UNEXPECTED_LARGE_RATE_FLOW: Unexpected large rate flows - UNEXPECTED_WAKEUP: Unexpected wakeup - SUSPICION_OF_DDOS_ATTACK: Suspicion of DDoS attack - WRONG_DESTINATION_ADDRESS: Wrong destination address - TOO_FREQUENT_SERVICE_ACCESS: Too frequent Service Access - UNEXPECTED_RADIO_LINK_FAILURES: Unexpected radio link failures - PING_PONG_ACROSS_CELLS: Ping-ponging across neighbouring cells + */ + +#ifndef _OpenAPI_exception_id_H_ +#define _OpenAPI_exception_id_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "exception_id_any_of.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_exception_id_s OpenAPI_exception_id_t; +typedef struct OpenAPI_exception_id_s { +} OpenAPI_exception_id_t; + +OpenAPI_exception_id_t *OpenAPI_exception_id_create( +); +void OpenAPI_exception_id_free(OpenAPI_exception_id_t *exception_id); +OpenAPI_exception_id_t *OpenAPI_exception_id_parseFromJSON(cJSON *exception_idJSON); +cJSON *OpenAPI_exception_id_convertToJSON(OpenAPI_exception_id_t *exception_id); +OpenAPI_exception_id_t *OpenAPI_exception_id_copy(OpenAPI_exception_id_t *dst, OpenAPI_exception_id_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_exception_id_H_ */ + diff --git a/lib/sbi/openapi/model/exception_id_any_of.c b/lib/sbi/openapi/model/exception_id_any_of.c new file mode 100644 index 000000000..49ab3d510 --- /dev/null +++ b/lib/sbi/openapi/model/exception_id_any_of.c @@ -0,0 +1,30 @@ + +#include +#include +#include +#include "exception_id_any_of.h" + +char* OpenAPI_exception_id_any_of_ToString(OpenAPI_exception_id_any_of_e exception_id_any_of) +{ + const char *exception_id_any_ofArray[] = { "NULL", "UNEXPECTED_UE_LOCATION", "UNEXPECTED_LONG_LIVE_FLOW", "UNEXPECTED_LARGE_RATE_FLOW", "UNEXPECTED_WAKEUP", "SUSPICION_OF_DDOS_ATTACK", "WRONG_DESTINATION_ADDRESS", "TOO_FREQUENT_SERVICE_ACCESS", "UNEXPECTED_RADIO_LINK_FAILURES", "PING_PONG_ACROSS_CELLS" }; + size_t sizeofArray = sizeof(exception_id_any_ofArray) / sizeof(exception_id_any_ofArray[0]); + if (exception_id_any_of < sizeofArray) + return (char *)exception_id_any_ofArray[exception_id_any_of]; + else + return (char *)"Unknown"; +} + +OpenAPI_exception_id_any_of_e OpenAPI_exception_id_any_of_FromString(char* exception_id_any_of) +{ + int stringToReturn = 0; + const char *exception_id_any_ofArray[] = { "NULL", "UNEXPECTED_UE_LOCATION", "UNEXPECTED_LONG_LIVE_FLOW", "UNEXPECTED_LARGE_RATE_FLOW", "UNEXPECTED_WAKEUP", "SUSPICION_OF_DDOS_ATTACK", "WRONG_DESTINATION_ADDRESS", "TOO_FREQUENT_SERVICE_ACCESS", "UNEXPECTED_RADIO_LINK_FAILURES", "PING_PONG_ACROSS_CELLS" }; + size_t sizeofArray = sizeof(exception_id_any_ofArray) / sizeof(exception_id_any_ofArray[0]); + while (stringToReturn < sizeofArray) { + if (strcmp(exception_id_any_of, exception_id_any_ofArray[stringToReturn]) == 0) { + return stringToReturn; + } + stringToReturn++; + } + return 0; +} + diff --git a/lib/sbi/openapi/model/exception_id_any_of.h b/lib/sbi/openapi/model/exception_id_any_of.h new file mode 100644 index 000000000..00c27c299 --- /dev/null +++ b/lib/sbi/openapi/model/exception_id_any_of.h @@ -0,0 +1,31 @@ +/* + * exception_id_any_of.h + * + * + */ + +#ifndef _OpenAPI_exception_id_any_of_H_ +#define _OpenAPI_exception_id_any_of_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef enum { OpenAPI_exception_id_any_of_NULL = 0, OpenAPI_exception_id_any_of_UNEXPECTED_UE_LOCATION, OpenAPI_exception_id_any_of_UNEXPECTED_LONG_LIVE_FLOW, OpenAPI_exception_id_any_of_UNEXPECTED_LARGE_RATE_FLOW, OpenAPI_exception_id_any_of_UNEXPECTED_WAKEUP, OpenAPI_exception_id_any_of_SUSPICION_OF_DDOS_ATTACK, OpenAPI_exception_id_any_of_WRONG_DESTINATION_ADDRESS, OpenAPI_exception_id_any_of_TOO_FREQUENT_SERVICE_ACCESS, OpenAPI_exception_id_any_of_UNEXPECTED_RADIO_LINK_FAILURES, OpenAPI_exception_id_any_of_PING_PONG_ACROSS_CELLS } OpenAPI_exception_id_any_of_e; + +char* OpenAPI_exception_id_any_of_ToString(OpenAPI_exception_id_any_of_e exception_id_any_of); + +OpenAPI_exception_id_any_of_e OpenAPI_exception_id_any_of_FromString(char* exception_id_any_of); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_exception_id_any_of_H_ */ + diff --git a/lib/sbi/openapi/model/exception_trend.c b/lib/sbi/openapi/model/exception_trend.c new file mode 100644 index 000000000..d9acd248d --- /dev/null +++ b/lib/sbi/openapi/model/exception_trend.c @@ -0,0 +1,87 @@ + +#include +#include +#include +#include "exception_trend.h" + +OpenAPI_exception_trend_t *OpenAPI_exception_trend_create( +) +{ + OpenAPI_exception_trend_t *exception_trend_local_var = ogs_malloc(sizeof(OpenAPI_exception_trend_t)); + ogs_assert(exception_trend_local_var); + + + return exception_trend_local_var; +} + +void OpenAPI_exception_trend_free(OpenAPI_exception_trend_t *exception_trend) +{ + OpenAPI_lnode_t *node = NULL; + + if (NULL == exception_trend) { + return; + } + ogs_free(exception_trend); +} + +cJSON *OpenAPI_exception_trend_convertToJSON(OpenAPI_exception_trend_t *exception_trend) +{ + cJSON *item = NULL; + OpenAPI_lnode_t *node = NULL; + + if (exception_trend == NULL) { + ogs_error("OpenAPI_exception_trend_convertToJSON() failed [ExceptionTrend]"); + return NULL; + } + + item = cJSON_CreateObject(); +end: + return item; +} + +OpenAPI_exception_trend_t *OpenAPI_exception_trend_parseFromJSON(cJSON *exception_trendJSON) +{ + OpenAPI_exception_trend_t *exception_trend_local_var = NULL; + OpenAPI_lnode_t *node = NULL; + exception_trend_local_var = OpenAPI_exception_trend_create ( + ); + + return exception_trend_local_var; +end: + return NULL; +} + +OpenAPI_exception_trend_t *OpenAPI_exception_trend_copy(OpenAPI_exception_trend_t *dst, OpenAPI_exception_trend_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_exception_trend_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_exception_trend_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_exception_trend_free(dst); + dst = OpenAPI_exception_trend_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/exception_trend.h b/lib/sbi/openapi/model/exception_trend.h new file mode 100644 index 000000000..ff7b0a01d --- /dev/null +++ b/lib/sbi/openapi/model/exception_trend.h @@ -0,0 +1,37 @@ +/* + * exception_trend.h + * + * Possible values are: - UP: Up trend of the exception level. - DOWN: Down trend of the exception level. - UNKNOW: Unknown trend of the exception level. - STABLE: Stable trend of the exception level. + */ + +#ifndef _OpenAPI_exception_trend_H_ +#define _OpenAPI_exception_trend_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "exception_trend_any_of.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_exception_trend_s OpenAPI_exception_trend_t; +typedef struct OpenAPI_exception_trend_s { +} OpenAPI_exception_trend_t; + +OpenAPI_exception_trend_t *OpenAPI_exception_trend_create( +); +void OpenAPI_exception_trend_free(OpenAPI_exception_trend_t *exception_trend); +OpenAPI_exception_trend_t *OpenAPI_exception_trend_parseFromJSON(cJSON *exception_trendJSON); +cJSON *OpenAPI_exception_trend_convertToJSON(OpenAPI_exception_trend_t *exception_trend); +OpenAPI_exception_trend_t *OpenAPI_exception_trend_copy(OpenAPI_exception_trend_t *dst, OpenAPI_exception_trend_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_exception_trend_H_ */ + diff --git a/lib/sbi/openapi/model/exception_trend_any_of.c b/lib/sbi/openapi/model/exception_trend_any_of.c new file mode 100644 index 000000000..3de8bc219 --- /dev/null +++ b/lib/sbi/openapi/model/exception_trend_any_of.c @@ -0,0 +1,30 @@ + +#include +#include +#include +#include "exception_trend_any_of.h" + +char* OpenAPI_exception_trend_any_of_ToString(OpenAPI_exception_trend_any_of_e exception_trend_any_of) +{ + const char *exception_trend_any_ofArray[] = { "NULL", "UP", "DOWN", "UNKNOW", "STABLE" }; + size_t sizeofArray = sizeof(exception_trend_any_ofArray) / sizeof(exception_trend_any_ofArray[0]); + if (exception_trend_any_of < sizeofArray) + return (char *)exception_trend_any_ofArray[exception_trend_any_of]; + else + return (char *)"Unknown"; +} + +OpenAPI_exception_trend_any_of_e OpenAPI_exception_trend_any_of_FromString(char* exception_trend_any_of) +{ + int stringToReturn = 0; + const char *exception_trend_any_ofArray[] = { "NULL", "UP", "DOWN", "UNKNOW", "STABLE" }; + size_t sizeofArray = sizeof(exception_trend_any_ofArray) / sizeof(exception_trend_any_ofArray[0]); + while (stringToReturn < sizeofArray) { + if (strcmp(exception_trend_any_of, exception_trend_any_ofArray[stringToReturn]) == 0) { + return stringToReturn; + } + stringToReturn++; + } + return 0; +} + diff --git a/lib/sbi/openapi/model/exception_trend_any_of.h b/lib/sbi/openapi/model/exception_trend_any_of.h new file mode 100644 index 000000000..6c0803700 --- /dev/null +++ b/lib/sbi/openapi/model/exception_trend_any_of.h @@ -0,0 +1,31 @@ +/* + * exception_trend_any_of.h + * + * + */ + +#ifndef _OpenAPI_exception_trend_any_of_H_ +#define _OpenAPI_exception_trend_any_of_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef enum { OpenAPI_exception_trend_any_of_NULL = 0, OpenAPI_exception_trend_any_of_UP, OpenAPI_exception_trend_any_of_DOWN, OpenAPI_exception_trend_any_of_UNKNOW, OpenAPI_exception_trend_any_of_STABLE } OpenAPI_exception_trend_any_of_e; + +char* OpenAPI_exception_trend_any_of_ToString(OpenAPI_exception_trend_any_of_e exception_trend_any_of); + +OpenAPI_exception_trend_any_of_e OpenAPI_exception_trend_any_of_FromString(char* exception_trend_any_of); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_exception_trend_any_of_H_ */ + diff --git a/lib/sbi/openapi/model/exemption_ind.h b/lib/sbi/openapi/model/exemption_ind.h index 16b16f043..88c79da4e 100644 --- a/lib/sbi/openapi/model/exemption_ind.h +++ b/lib/sbi/openapi/model/exemption_ind.h @@ -1,7 +1,7 @@ /* * exemption_ind.h * - * + * Exemption Indication */ #ifndef _OpenAPI_exemption_ind_H_ diff --git a/lib/sbi/openapi/model/expected_analytics_type.c b/lib/sbi/openapi/model/expected_analytics_type.c new file mode 100644 index 000000000..3c23e83d1 --- /dev/null +++ b/lib/sbi/openapi/model/expected_analytics_type.c @@ -0,0 +1,87 @@ + +#include +#include +#include +#include "expected_analytics_type.h" + +OpenAPI_expected_analytics_type_t *OpenAPI_expected_analytics_type_create( +) +{ + OpenAPI_expected_analytics_type_t *expected_analytics_type_local_var = ogs_malloc(sizeof(OpenAPI_expected_analytics_type_t)); + ogs_assert(expected_analytics_type_local_var); + + + return expected_analytics_type_local_var; +} + +void OpenAPI_expected_analytics_type_free(OpenAPI_expected_analytics_type_t *expected_analytics_type) +{ + OpenAPI_lnode_t *node = NULL; + + if (NULL == expected_analytics_type) { + return; + } + ogs_free(expected_analytics_type); +} + +cJSON *OpenAPI_expected_analytics_type_convertToJSON(OpenAPI_expected_analytics_type_t *expected_analytics_type) +{ + cJSON *item = NULL; + OpenAPI_lnode_t *node = NULL; + + if (expected_analytics_type == NULL) { + ogs_error("OpenAPI_expected_analytics_type_convertToJSON() failed [ExpectedAnalyticsType]"); + return NULL; + } + + item = cJSON_CreateObject(); +end: + return item; +} + +OpenAPI_expected_analytics_type_t *OpenAPI_expected_analytics_type_parseFromJSON(cJSON *expected_analytics_typeJSON) +{ + OpenAPI_expected_analytics_type_t *expected_analytics_type_local_var = NULL; + OpenAPI_lnode_t *node = NULL; + expected_analytics_type_local_var = OpenAPI_expected_analytics_type_create ( + ); + + return expected_analytics_type_local_var; +end: + return NULL; +} + +OpenAPI_expected_analytics_type_t *OpenAPI_expected_analytics_type_copy(OpenAPI_expected_analytics_type_t *dst, OpenAPI_expected_analytics_type_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_expected_analytics_type_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_expected_analytics_type_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_expected_analytics_type_free(dst); + dst = OpenAPI_expected_analytics_type_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/expected_analytics_type.h b/lib/sbi/openapi/model/expected_analytics_type.h new file mode 100644 index 000000000..854a11fef --- /dev/null +++ b/lib/sbi/openapi/model/expected_analytics_type.h @@ -0,0 +1,37 @@ +/* + * expected_analytics_type.h + * + * Possible values are: - MOBILITY: Mobility related abnormal behaviour analytics is expected by the consumer. - COMMUN: Communication related abnormal behaviour analytics is expected by the consumer. - MOBILITY_AND_COMMUN: Both mobility and communication related abnormal behaviour analytics is expected by the consumer. + */ + +#ifndef _OpenAPI_expected_analytics_type_H_ +#define _OpenAPI_expected_analytics_type_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "expected_analytics_type_any_of.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_expected_analytics_type_s OpenAPI_expected_analytics_type_t; +typedef struct OpenAPI_expected_analytics_type_s { +} OpenAPI_expected_analytics_type_t; + +OpenAPI_expected_analytics_type_t *OpenAPI_expected_analytics_type_create( +); +void OpenAPI_expected_analytics_type_free(OpenAPI_expected_analytics_type_t *expected_analytics_type); +OpenAPI_expected_analytics_type_t *OpenAPI_expected_analytics_type_parseFromJSON(cJSON *expected_analytics_typeJSON); +cJSON *OpenAPI_expected_analytics_type_convertToJSON(OpenAPI_expected_analytics_type_t *expected_analytics_type); +OpenAPI_expected_analytics_type_t *OpenAPI_expected_analytics_type_copy(OpenAPI_expected_analytics_type_t *dst, OpenAPI_expected_analytics_type_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_expected_analytics_type_H_ */ + diff --git a/lib/sbi/openapi/model/expected_analytics_type_any_of.c b/lib/sbi/openapi/model/expected_analytics_type_any_of.c new file mode 100644 index 000000000..2de76d143 --- /dev/null +++ b/lib/sbi/openapi/model/expected_analytics_type_any_of.c @@ -0,0 +1,30 @@ + +#include +#include +#include +#include "expected_analytics_type_any_of.h" + +char* OpenAPI_expected_analytics_type_any_of_ToString(OpenAPI_expected_analytics_type_any_of_e expected_analytics_type_any_of) +{ + const char *expected_analytics_type_any_ofArray[] = { "NULL", "MOBILITY", "COMMUN", "MOBILITY_AND_COMMUN" }; + size_t sizeofArray = sizeof(expected_analytics_type_any_ofArray) / sizeof(expected_analytics_type_any_ofArray[0]); + if (expected_analytics_type_any_of < sizeofArray) + return (char *)expected_analytics_type_any_ofArray[expected_analytics_type_any_of]; + else + return (char *)"Unknown"; +} + +OpenAPI_expected_analytics_type_any_of_e OpenAPI_expected_analytics_type_any_of_FromString(char* expected_analytics_type_any_of) +{ + int stringToReturn = 0; + const char *expected_analytics_type_any_ofArray[] = { "NULL", "MOBILITY", "COMMUN", "MOBILITY_AND_COMMUN" }; + size_t sizeofArray = sizeof(expected_analytics_type_any_ofArray) / sizeof(expected_analytics_type_any_ofArray[0]); + while (stringToReturn < sizeofArray) { + if (strcmp(expected_analytics_type_any_of, expected_analytics_type_any_ofArray[stringToReturn]) == 0) { + return stringToReturn; + } + stringToReturn++; + } + return 0; +} + diff --git a/lib/sbi/openapi/model/expected_analytics_type_any_of.h b/lib/sbi/openapi/model/expected_analytics_type_any_of.h new file mode 100644 index 000000000..58856f5ba --- /dev/null +++ b/lib/sbi/openapi/model/expected_analytics_type_any_of.h @@ -0,0 +1,31 @@ +/* + * expected_analytics_type_any_of.h + * + * + */ + +#ifndef _OpenAPI_expected_analytics_type_any_of_H_ +#define _OpenAPI_expected_analytics_type_any_of_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef enum { OpenAPI_expected_analytics_type_any_of_NULL = 0, OpenAPI_expected_analytics_type_any_of_MOBILITY, OpenAPI_expected_analytics_type_any_of_COMMUN, OpenAPI_expected_analytics_type_any_of_MOBILITY_AND_COMMUN } OpenAPI_expected_analytics_type_any_of_e; + +char* OpenAPI_expected_analytics_type_any_of_ToString(OpenAPI_expected_analytics_type_any_of_e expected_analytics_type_any_of); + +OpenAPI_expected_analytics_type_any_of_e OpenAPI_expected_analytics_type_any_of_FromString(char* expected_analytics_type_any_of); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_expected_analytics_type_any_of_H_ */ + diff --git a/lib/sbi/openapi/model/expected_ue_behavior.h b/lib/sbi/openapi/model/expected_ue_behavior.h index c28061b49..f4d54bcbf 100644 --- a/lib/sbi/openapi/model/expected_ue_behavior.h +++ b/lib/sbi/openapi/model/expected_ue_behavior.h @@ -1,7 +1,7 @@ /* * expected_ue_behavior.h * - * + * Represents the expected UE behavior (e.g. UE moving trajectory) and its validity period */ #ifndef _OpenAPI_expected_ue_behavior_H_ diff --git a/lib/sbi/openapi/model/exposure_data_change_notification.h b/lib/sbi/openapi/model/exposure_data_change_notification.h index d06b632cf..a82e8c2bb 100644 --- a/lib/sbi/openapi/model/exposure_data_change_notification.h +++ b/lib/sbi/openapi/model/exposure_data_change_notification.h @@ -1,7 +1,7 @@ /* * exposure_data_change_notification.h * - * + * Represents changed exposure data for one UE for which Notification was requested. */ #ifndef _OpenAPI_exposure_data_change_notification_H_ diff --git a/lib/sbi/openapi/model/exposure_data_subscription.c b/lib/sbi/openapi/model/exposure_data_subscription.c index d02f692d3..022bee63f 100644 --- a/lib/sbi/openapi/model/exposure_data_subscription.c +++ b/lib/sbi/openapi/model/exposure_data_subscription.c @@ -8,7 +8,8 @@ OpenAPI_exposure_data_subscription_t *OpenAPI_exposure_data_subscription_create( char *notification_uri, OpenAPI_list_t *monitored_resource_uris, char *expiry, - char *supported_features + char *supported_features, + OpenAPI_list_t *reset_ids ) { OpenAPI_exposure_data_subscription_t *exposure_data_subscription_local_var = ogs_malloc(sizeof(OpenAPI_exposure_data_subscription_t)); @@ -18,6 +19,7 @@ OpenAPI_exposure_data_subscription_t *OpenAPI_exposure_data_subscription_create( exposure_data_subscription_local_var->monitored_resource_uris = monitored_resource_uris; exposure_data_subscription_local_var->expiry = expiry; exposure_data_subscription_local_var->supported_features = supported_features; + exposure_data_subscription_local_var->reset_ids = reset_ids; return exposure_data_subscription_local_var; } @@ -48,6 +50,13 @@ void OpenAPI_exposure_data_subscription_free(OpenAPI_exposure_data_subscription_ ogs_free(exposure_data_subscription->supported_features); exposure_data_subscription->supported_features = NULL; } + if (exposure_data_subscription->reset_ids) { + OpenAPI_list_for_each(exposure_data_subscription->reset_ids, node) { + ogs_free(node->data); + } + OpenAPI_list_free(exposure_data_subscription->reset_ids); + exposure_data_subscription->reset_ids = NULL; + } ogs_free(exposure_data_subscription); } @@ -101,6 +110,20 @@ cJSON *OpenAPI_exposure_data_subscription_convertToJSON(OpenAPI_exposure_data_su } } + if (exposure_data_subscription->reset_ids) { + cJSON *reset_idsList = cJSON_AddArrayToObject(item, "resetIds"); + if (reset_idsList == NULL) { + ogs_error("OpenAPI_exposure_data_subscription_convertToJSON() failed [reset_ids]"); + goto end; + } + OpenAPI_list_for_each(exposure_data_subscription->reset_ids, node) { + if (cJSON_AddStringToObject(reset_idsList, "", (char*)node->data) == NULL) { + ogs_error("OpenAPI_exposure_data_subscription_convertToJSON() failed [reset_ids]"); + goto end; + } + } + } + end: return item; } @@ -114,6 +137,8 @@ OpenAPI_exposure_data_subscription_t *OpenAPI_exposure_data_subscription_parseFr OpenAPI_list_t *monitored_resource_urisList = NULL; cJSON *expiry = NULL; cJSON *supported_features = NULL; + cJSON *reset_ids = NULL; + OpenAPI_list_t *reset_idsList = NULL; notification_uri = cJSON_GetObjectItemCaseSensitive(exposure_data_subscriptionJSON, "notificationUri"); if (!notification_uri) { ogs_error("OpenAPI_exposure_data_subscription_parseFromJSON() failed [notification_uri]"); @@ -163,11 +188,33 @@ OpenAPI_exposure_data_subscription_t *OpenAPI_exposure_data_subscription_parseFr } } + reset_ids = cJSON_GetObjectItemCaseSensitive(exposure_data_subscriptionJSON, "resetIds"); + if (reset_ids) { + cJSON *reset_ids_local = NULL; + if (!cJSON_IsArray(reset_ids)) { + ogs_error("OpenAPI_exposure_data_subscription_parseFromJSON() failed [reset_ids]"); + goto end; + } + + reset_idsList = OpenAPI_list_create(); + + cJSON_ArrayForEach(reset_ids_local, reset_ids) { + double *localDouble = NULL; + int *localInt = NULL; + if (!cJSON_IsString(reset_ids_local)) { + ogs_error("OpenAPI_exposure_data_subscription_parseFromJSON() failed [reset_ids]"); + goto end; + } + OpenAPI_list_add(reset_idsList, ogs_strdup(reset_ids_local->valuestring)); + } + } + exposure_data_subscription_local_var = OpenAPI_exposure_data_subscription_create ( ogs_strdup(notification_uri->valuestring), monitored_resource_urisList, expiry && !cJSON_IsNull(expiry) ? ogs_strdup(expiry->valuestring) : NULL, - supported_features && !cJSON_IsNull(supported_features) ? ogs_strdup(supported_features->valuestring) : NULL + supported_features && !cJSON_IsNull(supported_features) ? ogs_strdup(supported_features->valuestring) : NULL, + reset_ids ? reset_idsList : NULL ); return exposure_data_subscription_local_var; @@ -179,6 +226,13 @@ end: OpenAPI_list_free(monitored_resource_urisList); monitored_resource_urisList = NULL; } + if (reset_idsList) { + OpenAPI_list_for_each(reset_idsList, node) { + ogs_free(node->data); + } + OpenAPI_list_free(reset_idsList); + reset_idsList = NULL; + } return NULL; } diff --git a/lib/sbi/openapi/model/exposure_data_subscription.h b/lib/sbi/openapi/model/exposure_data_subscription.h index 2ab67508c..1384f284f 100644 --- a/lib/sbi/openapi/model/exposure_data_subscription.h +++ b/lib/sbi/openapi/model/exposure_data_subscription.h @@ -1,7 +1,7 @@ /* * exposure_data_subscription.h * - * + * Represents a Subscription to Notifications about Exposure Data. */ #ifndef _OpenAPI_exposure_data_subscription_H_ @@ -23,13 +23,15 @@ typedef struct OpenAPI_exposure_data_subscription_s { OpenAPI_list_t *monitored_resource_uris; char *expiry; char *supported_features; + OpenAPI_list_t *reset_ids; } OpenAPI_exposure_data_subscription_t; OpenAPI_exposure_data_subscription_t *OpenAPI_exposure_data_subscription_create( char *notification_uri, OpenAPI_list_t *monitored_resource_uris, char *expiry, - char *supported_features + char *supported_features, + OpenAPI_list_t *reset_ids ); void OpenAPI_exposure_data_subscription_free(OpenAPI_exposure_data_subscription_t *exposure_data_subscription); OpenAPI_exposure_data_subscription_t *OpenAPI_exposure_data_subscription_parseFromJSON(cJSON *exposure_data_subscriptionJSON); diff --git a/lib/sbi/openapi/model/ext_amf_event_subscription.c b/lib/sbi/openapi/model/ext_amf_event_subscription.c index 963b237c9..961e0890a 100644 --- a/lib/sbi/openapi/model/ext_amf_event_subscription.c +++ b/lib/sbi/openapi/model/ext_amf_event_subscription.c @@ -13,6 +13,10 @@ OpenAPI_ext_amf_event_subscription_t *OpenAPI_ext_amf_event_subscription_create( char *subs_change_notify_correlation_id, char *supi, char *group_id, + OpenAPI_list_t *exclude_supi_list, + OpenAPI_list_t *exclude_gpsi_list, + OpenAPI_list_t *include_supi_list, + OpenAPI_list_t *include_gpsi_list, char *gpsi, char *pei, bool is_any_ue, @@ -20,7 +24,11 @@ OpenAPI_ext_amf_event_subscription_t *OpenAPI_ext_amf_event_subscription_create( OpenAPI_amf_event_mode_t *options, OpenAPI_nf_type_e source_nf_type, OpenAPI_list_t *binding_info, - OpenAPI_nf_type_e subscribing_nf_type + OpenAPI_nf_type_e subscribing_nf_type, + bool is_event_sync_ind, + int event_sync_ind, + OpenAPI_list_t *nf_consumer_info, + OpenAPI_list_t* aoi_state_list ) { OpenAPI_ext_amf_event_subscription_t *ext_amf_event_subscription_local_var = ogs_malloc(sizeof(OpenAPI_ext_amf_event_subscription_t)); @@ -34,6 +42,10 @@ OpenAPI_ext_amf_event_subscription_t *OpenAPI_ext_amf_event_subscription_create( ext_amf_event_subscription_local_var->subs_change_notify_correlation_id = subs_change_notify_correlation_id; ext_amf_event_subscription_local_var->supi = supi; ext_amf_event_subscription_local_var->group_id = group_id; + ext_amf_event_subscription_local_var->exclude_supi_list = exclude_supi_list; + ext_amf_event_subscription_local_var->exclude_gpsi_list = exclude_gpsi_list; + ext_amf_event_subscription_local_var->include_supi_list = include_supi_list; + ext_amf_event_subscription_local_var->include_gpsi_list = include_gpsi_list; ext_amf_event_subscription_local_var->gpsi = gpsi; ext_amf_event_subscription_local_var->pei = pei; ext_amf_event_subscription_local_var->is_any_ue = is_any_ue; @@ -42,6 +54,10 @@ OpenAPI_ext_amf_event_subscription_t *OpenAPI_ext_amf_event_subscription_create( ext_amf_event_subscription_local_var->source_nf_type = source_nf_type; ext_amf_event_subscription_local_var->binding_info = binding_info; ext_amf_event_subscription_local_var->subscribing_nf_type = subscribing_nf_type; + ext_amf_event_subscription_local_var->is_event_sync_ind = is_event_sync_ind; + ext_amf_event_subscription_local_var->event_sync_ind = event_sync_ind; + ext_amf_event_subscription_local_var->nf_consumer_info = nf_consumer_info; + ext_amf_event_subscription_local_var->aoi_state_list = aoi_state_list; return ext_amf_event_subscription_local_var; } @@ -88,6 +104,34 @@ void OpenAPI_ext_amf_event_subscription_free(OpenAPI_ext_amf_event_subscription_ ogs_free(ext_amf_event_subscription->group_id); ext_amf_event_subscription->group_id = NULL; } + if (ext_amf_event_subscription->exclude_supi_list) { + OpenAPI_list_for_each(ext_amf_event_subscription->exclude_supi_list, node) { + ogs_free(node->data); + } + OpenAPI_list_free(ext_amf_event_subscription->exclude_supi_list); + ext_amf_event_subscription->exclude_supi_list = NULL; + } + if (ext_amf_event_subscription->exclude_gpsi_list) { + OpenAPI_list_for_each(ext_amf_event_subscription->exclude_gpsi_list, node) { + ogs_free(node->data); + } + OpenAPI_list_free(ext_amf_event_subscription->exclude_gpsi_list); + ext_amf_event_subscription->exclude_gpsi_list = NULL; + } + if (ext_amf_event_subscription->include_supi_list) { + OpenAPI_list_for_each(ext_amf_event_subscription->include_supi_list, node) { + ogs_free(node->data); + } + OpenAPI_list_free(ext_amf_event_subscription->include_supi_list); + ext_amf_event_subscription->include_supi_list = NULL; + } + if (ext_amf_event_subscription->include_gpsi_list) { + OpenAPI_list_for_each(ext_amf_event_subscription->include_gpsi_list, node) { + ogs_free(node->data); + } + OpenAPI_list_free(ext_amf_event_subscription->include_gpsi_list); + ext_amf_event_subscription->include_gpsi_list = NULL; + } if (ext_amf_event_subscription->gpsi) { ogs_free(ext_amf_event_subscription->gpsi); ext_amf_event_subscription->gpsi = NULL; @@ -107,6 +151,23 @@ void OpenAPI_ext_amf_event_subscription_free(OpenAPI_ext_amf_event_subscription_ OpenAPI_list_free(ext_amf_event_subscription->binding_info); ext_amf_event_subscription->binding_info = NULL; } + if (ext_amf_event_subscription->nf_consumer_info) { + OpenAPI_list_for_each(ext_amf_event_subscription->nf_consumer_info, node) { + ogs_free(node->data); + } + OpenAPI_list_free(ext_amf_event_subscription->nf_consumer_info); + ext_amf_event_subscription->nf_consumer_info = NULL; + } + if (ext_amf_event_subscription->aoi_state_list) { + OpenAPI_list_for_each(ext_amf_event_subscription->aoi_state_list, node) { + OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*)node->data; + ogs_free(localKeyValue->key); + OpenAPI_area_of_interest_event_state_free(localKeyValue->value); + OpenAPI_map_free(localKeyValue); + } + OpenAPI_list_free(ext_amf_event_subscription->aoi_state_list); + ext_amf_event_subscription->aoi_state_list = NULL; + } ogs_free(ext_amf_event_subscription); } @@ -194,6 +255,62 @@ cJSON *OpenAPI_ext_amf_event_subscription_convertToJSON(OpenAPI_ext_amf_event_su } } + if (ext_amf_event_subscription->exclude_supi_list) { + cJSON *exclude_supi_listList = cJSON_AddArrayToObject(item, "excludeSupiList"); + if (exclude_supi_listList == NULL) { + ogs_error("OpenAPI_ext_amf_event_subscription_convertToJSON() failed [exclude_supi_list]"); + goto end; + } + OpenAPI_list_for_each(ext_amf_event_subscription->exclude_supi_list, node) { + if (cJSON_AddStringToObject(exclude_supi_listList, "", (char*)node->data) == NULL) { + ogs_error("OpenAPI_ext_amf_event_subscription_convertToJSON() failed [exclude_supi_list]"); + goto end; + } + } + } + + if (ext_amf_event_subscription->exclude_gpsi_list) { + cJSON *exclude_gpsi_listList = cJSON_AddArrayToObject(item, "excludeGpsiList"); + if (exclude_gpsi_listList == NULL) { + ogs_error("OpenAPI_ext_amf_event_subscription_convertToJSON() failed [exclude_gpsi_list]"); + goto end; + } + OpenAPI_list_for_each(ext_amf_event_subscription->exclude_gpsi_list, node) { + if (cJSON_AddStringToObject(exclude_gpsi_listList, "", (char*)node->data) == NULL) { + ogs_error("OpenAPI_ext_amf_event_subscription_convertToJSON() failed [exclude_gpsi_list]"); + goto end; + } + } + } + + if (ext_amf_event_subscription->include_supi_list) { + cJSON *include_supi_listList = cJSON_AddArrayToObject(item, "includeSupiList"); + if (include_supi_listList == NULL) { + ogs_error("OpenAPI_ext_amf_event_subscription_convertToJSON() failed [include_supi_list]"); + goto end; + } + OpenAPI_list_for_each(ext_amf_event_subscription->include_supi_list, node) { + if (cJSON_AddStringToObject(include_supi_listList, "", (char*)node->data) == NULL) { + ogs_error("OpenAPI_ext_amf_event_subscription_convertToJSON() failed [include_supi_list]"); + goto end; + } + } + } + + if (ext_amf_event_subscription->include_gpsi_list) { + cJSON *include_gpsi_listList = cJSON_AddArrayToObject(item, "includeGpsiList"); + if (include_gpsi_listList == NULL) { + ogs_error("OpenAPI_ext_amf_event_subscription_convertToJSON() failed [include_gpsi_list]"); + goto end; + } + OpenAPI_list_for_each(ext_amf_event_subscription->include_gpsi_list, node) { + if (cJSON_AddStringToObject(include_gpsi_listList, "", (char*)node->data) == NULL) { + ogs_error("OpenAPI_ext_amf_event_subscription_convertToJSON() failed [include_gpsi_list]"); + goto end; + } + } + } + if (ext_amf_event_subscription->gpsi) { if (cJSON_AddStringToObject(item, "gpsi", ext_amf_event_subscription->gpsi) == NULL) { ogs_error("OpenAPI_ext_amf_event_subscription_convertToJSON() failed [gpsi]"); @@ -256,6 +373,49 @@ cJSON *OpenAPI_ext_amf_event_subscription_convertToJSON(OpenAPI_ext_amf_event_su } } + if (ext_amf_event_subscription->is_event_sync_ind) { + if (cJSON_AddBoolToObject(item, "eventSyncInd", ext_amf_event_subscription->event_sync_ind) == NULL) { + ogs_error("OpenAPI_ext_amf_event_subscription_convertToJSON() failed [event_sync_ind]"); + goto end; + } + } + + if (ext_amf_event_subscription->nf_consumer_info) { + cJSON *nf_consumer_infoList = cJSON_AddArrayToObject(item, "nfConsumerInfo"); + if (nf_consumer_infoList == NULL) { + ogs_error("OpenAPI_ext_amf_event_subscription_convertToJSON() failed [nf_consumer_info]"); + goto end; + } + OpenAPI_list_for_each(ext_amf_event_subscription->nf_consumer_info, node) { + if (cJSON_AddStringToObject(nf_consumer_infoList, "", (char*)node->data) == NULL) { + ogs_error("OpenAPI_ext_amf_event_subscription_convertToJSON() failed [nf_consumer_info]"); + goto end; + } + } + } + + if (ext_amf_event_subscription->aoi_state_list) { + cJSON *aoi_state_list = cJSON_AddObjectToObject(item, "aoiStateList"); + if (aoi_state_list == NULL) { + ogs_error("OpenAPI_ext_amf_event_subscription_convertToJSON() failed [aoi_state_list]"); + goto end; + } + cJSON *localMapObject = aoi_state_list; + if (ext_amf_event_subscription->aoi_state_list) { + OpenAPI_list_for_each(ext_amf_event_subscription->aoi_state_list, node) { + OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*)node->data; + cJSON *itemLocal = localKeyValue->value ? + OpenAPI_area_of_interest_event_state_convertToJSON(localKeyValue->value) : + cJSON_CreateNull(); + if (itemLocal == NULL) { + ogs_error("OpenAPI_ext_amf_event_subscription_convertToJSON() failed [inner]"); + goto end; + } + cJSON_AddItemToObject(localMapObject, localKeyValue->key, itemLocal); + } + } + } + end: return item; } @@ -273,6 +433,14 @@ OpenAPI_ext_amf_event_subscription_t *OpenAPI_ext_amf_event_subscription_parseFr cJSON *subs_change_notify_correlation_id = NULL; cJSON *supi = NULL; cJSON *group_id = NULL; + cJSON *exclude_supi_list = NULL; + OpenAPI_list_t *exclude_supi_listList = NULL; + cJSON *exclude_gpsi_list = NULL; + OpenAPI_list_t *exclude_gpsi_listList = NULL; + cJSON *include_supi_list = NULL; + OpenAPI_list_t *include_supi_listList = NULL; + cJSON *include_gpsi_list = NULL; + OpenAPI_list_t *include_gpsi_listList = NULL; cJSON *gpsi = NULL; cJSON *pei = NULL; cJSON *any_ue = NULL; @@ -284,6 +452,11 @@ OpenAPI_ext_amf_event_subscription_t *OpenAPI_ext_amf_event_subscription_parseFr OpenAPI_list_t *binding_infoList = NULL; cJSON *subscribing_nf_type = NULL; OpenAPI_nf_type_e subscribing_nf_typeVariable = 0; + cJSON *event_sync_ind = NULL; + cJSON *nf_consumer_info = NULL; + OpenAPI_list_t *nf_consumer_infoList = NULL; + cJSON *aoi_state_list = NULL; + OpenAPI_list_t *aoi_state_listList = NULL; event_list = cJSON_GetObjectItemCaseSensitive(ext_amf_event_subscriptionJSON, "eventList"); if (!event_list) { ogs_error("OpenAPI_ext_amf_event_subscription_parseFromJSON() failed [event_list]"); @@ -373,6 +546,90 @@ OpenAPI_ext_amf_event_subscription_t *OpenAPI_ext_amf_event_subscription_parseFr } } + exclude_supi_list = cJSON_GetObjectItemCaseSensitive(ext_amf_event_subscriptionJSON, "excludeSupiList"); + if (exclude_supi_list) { + cJSON *exclude_supi_list_local = NULL; + if (!cJSON_IsArray(exclude_supi_list)) { + ogs_error("OpenAPI_ext_amf_event_subscription_parseFromJSON() failed [exclude_supi_list]"); + goto end; + } + + exclude_supi_listList = OpenAPI_list_create(); + + cJSON_ArrayForEach(exclude_supi_list_local, exclude_supi_list) { + double *localDouble = NULL; + int *localInt = NULL; + if (!cJSON_IsString(exclude_supi_list_local)) { + ogs_error("OpenAPI_ext_amf_event_subscription_parseFromJSON() failed [exclude_supi_list]"); + goto end; + } + OpenAPI_list_add(exclude_supi_listList, ogs_strdup(exclude_supi_list_local->valuestring)); + } + } + + exclude_gpsi_list = cJSON_GetObjectItemCaseSensitive(ext_amf_event_subscriptionJSON, "excludeGpsiList"); + if (exclude_gpsi_list) { + cJSON *exclude_gpsi_list_local = NULL; + if (!cJSON_IsArray(exclude_gpsi_list)) { + ogs_error("OpenAPI_ext_amf_event_subscription_parseFromJSON() failed [exclude_gpsi_list]"); + goto end; + } + + exclude_gpsi_listList = OpenAPI_list_create(); + + cJSON_ArrayForEach(exclude_gpsi_list_local, exclude_gpsi_list) { + double *localDouble = NULL; + int *localInt = NULL; + if (!cJSON_IsString(exclude_gpsi_list_local)) { + ogs_error("OpenAPI_ext_amf_event_subscription_parseFromJSON() failed [exclude_gpsi_list]"); + goto end; + } + OpenAPI_list_add(exclude_gpsi_listList, ogs_strdup(exclude_gpsi_list_local->valuestring)); + } + } + + include_supi_list = cJSON_GetObjectItemCaseSensitive(ext_amf_event_subscriptionJSON, "includeSupiList"); + if (include_supi_list) { + cJSON *include_supi_list_local = NULL; + if (!cJSON_IsArray(include_supi_list)) { + ogs_error("OpenAPI_ext_amf_event_subscription_parseFromJSON() failed [include_supi_list]"); + goto end; + } + + include_supi_listList = OpenAPI_list_create(); + + cJSON_ArrayForEach(include_supi_list_local, include_supi_list) { + double *localDouble = NULL; + int *localInt = NULL; + if (!cJSON_IsString(include_supi_list_local)) { + ogs_error("OpenAPI_ext_amf_event_subscription_parseFromJSON() failed [include_supi_list]"); + goto end; + } + OpenAPI_list_add(include_supi_listList, ogs_strdup(include_supi_list_local->valuestring)); + } + } + + include_gpsi_list = cJSON_GetObjectItemCaseSensitive(ext_amf_event_subscriptionJSON, "includeGpsiList"); + if (include_gpsi_list) { + cJSON *include_gpsi_list_local = NULL; + if (!cJSON_IsArray(include_gpsi_list)) { + ogs_error("OpenAPI_ext_amf_event_subscription_parseFromJSON() failed [include_gpsi_list]"); + goto end; + } + + include_gpsi_listList = OpenAPI_list_create(); + + cJSON_ArrayForEach(include_gpsi_list_local, include_gpsi_list) { + double *localDouble = NULL; + int *localInt = NULL; + if (!cJSON_IsString(include_gpsi_list_local)) { + ogs_error("OpenAPI_ext_amf_event_subscription_parseFromJSON() failed [include_gpsi_list]"); + goto end; + } + OpenAPI_list_add(include_gpsi_listList, ogs_strdup(include_gpsi_list_local->valuestring)); + } + } + gpsi = cJSON_GetObjectItemCaseSensitive(ext_amf_event_subscriptionJSON, "gpsi"); if (gpsi) { if (!cJSON_IsString(gpsi) && !cJSON_IsNull(gpsi)) { @@ -441,6 +698,61 @@ OpenAPI_ext_amf_event_subscription_t *OpenAPI_ext_amf_event_subscription_parseFr subscribing_nf_typeVariable = OpenAPI_nf_type_FromString(subscribing_nf_type->valuestring); } + event_sync_ind = cJSON_GetObjectItemCaseSensitive(ext_amf_event_subscriptionJSON, "eventSyncInd"); + if (event_sync_ind) { + if (!cJSON_IsBool(event_sync_ind)) { + ogs_error("OpenAPI_ext_amf_event_subscription_parseFromJSON() failed [event_sync_ind]"); + goto end; + } + } + + nf_consumer_info = cJSON_GetObjectItemCaseSensitive(ext_amf_event_subscriptionJSON, "nfConsumerInfo"); + if (nf_consumer_info) { + cJSON *nf_consumer_info_local = NULL; + if (!cJSON_IsArray(nf_consumer_info)) { + ogs_error("OpenAPI_ext_amf_event_subscription_parseFromJSON() failed [nf_consumer_info]"); + goto end; + } + + nf_consumer_infoList = OpenAPI_list_create(); + + cJSON_ArrayForEach(nf_consumer_info_local, nf_consumer_info) { + double *localDouble = NULL; + int *localInt = NULL; + if (!cJSON_IsString(nf_consumer_info_local)) { + ogs_error("OpenAPI_ext_amf_event_subscription_parseFromJSON() failed [nf_consumer_info]"); + goto end; + } + OpenAPI_list_add(nf_consumer_infoList, ogs_strdup(nf_consumer_info_local->valuestring)); + } + } + + aoi_state_list = cJSON_GetObjectItemCaseSensitive(ext_amf_event_subscriptionJSON, "aoiStateList"); + if (aoi_state_list) { + cJSON *aoi_state_list_local_map = NULL; + if (!cJSON_IsObject(aoi_state_list) && !cJSON_IsNull(aoi_state_list)) { + ogs_error("OpenAPI_ext_amf_event_subscription_parseFromJSON() failed [aoi_state_list]"); + goto end; + } + if (cJSON_IsObject(aoi_state_list)) { + aoi_state_listList = OpenAPI_list_create(); + OpenAPI_map_t *localMapKeyPair = NULL; + cJSON_ArrayForEach(aoi_state_list_local_map, aoi_state_list) { + cJSON *localMapObject = aoi_state_list_local_map; + if (cJSON_IsObject(localMapObject)) { + localMapKeyPair = OpenAPI_map_create( + ogs_strdup(localMapObject->string), OpenAPI_area_of_interest_event_state_parseFromJSON(localMapObject)); + } else if (cJSON_IsNull(localMapObject)) { + localMapKeyPair = OpenAPI_map_create(ogs_strdup(localMapObject->string), NULL); + } else { + ogs_error("OpenAPI_ext_amf_event_subscription_parseFromJSON() failed [inner]"); + goto end; + } + OpenAPI_list_add(aoi_state_listList, localMapKeyPair); + } + } + } + ext_amf_event_subscription_local_var = OpenAPI_ext_amf_event_subscription_create ( event_listList, ogs_strdup(event_notify_uri->valuestring), @@ -450,6 +762,10 @@ OpenAPI_ext_amf_event_subscription_t *OpenAPI_ext_amf_event_subscription_parseFr subs_change_notify_correlation_id && !cJSON_IsNull(subs_change_notify_correlation_id) ? ogs_strdup(subs_change_notify_correlation_id->valuestring) : NULL, supi && !cJSON_IsNull(supi) ? ogs_strdup(supi->valuestring) : NULL, group_id && !cJSON_IsNull(group_id) ? ogs_strdup(group_id->valuestring) : NULL, + exclude_supi_list ? exclude_supi_listList : NULL, + exclude_gpsi_list ? exclude_gpsi_listList : NULL, + include_supi_list ? include_supi_listList : NULL, + include_gpsi_list ? include_gpsi_listList : NULL, gpsi && !cJSON_IsNull(gpsi) ? ogs_strdup(gpsi->valuestring) : NULL, pei && !cJSON_IsNull(pei) ? ogs_strdup(pei->valuestring) : NULL, any_ue ? true : false, @@ -457,7 +773,11 @@ OpenAPI_ext_amf_event_subscription_t *OpenAPI_ext_amf_event_subscription_parseFr options ? options_local_nonprim : NULL, source_nf_type ? source_nf_typeVariable : 0, binding_info ? binding_infoList : NULL, - subscribing_nf_type ? subscribing_nf_typeVariable : 0 + subscribing_nf_type ? subscribing_nf_typeVariable : 0, + event_sync_ind ? true : false, + event_sync_ind ? event_sync_ind->valueint : 0, + nf_consumer_info ? nf_consumer_infoList : NULL, + aoi_state_list ? aoi_state_listList : NULL ); return ext_amf_event_subscription_local_var; @@ -469,6 +789,34 @@ end: OpenAPI_list_free(event_listList); event_listList = NULL; } + if (exclude_supi_listList) { + OpenAPI_list_for_each(exclude_supi_listList, node) { + ogs_free(node->data); + } + OpenAPI_list_free(exclude_supi_listList); + exclude_supi_listList = NULL; + } + if (exclude_gpsi_listList) { + OpenAPI_list_for_each(exclude_gpsi_listList, node) { + ogs_free(node->data); + } + OpenAPI_list_free(exclude_gpsi_listList); + exclude_gpsi_listList = NULL; + } + if (include_supi_listList) { + OpenAPI_list_for_each(include_supi_listList, node) { + ogs_free(node->data); + } + OpenAPI_list_free(include_supi_listList); + include_supi_listList = NULL; + } + if (include_gpsi_listList) { + OpenAPI_list_for_each(include_gpsi_listList, node) { + ogs_free(node->data); + } + OpenAPI_list_free(include_gpsi_listList); + include_gpsi_listList = NULL; + } if (options_local_nonprim) { OpenAPI_amf_event_mode_free(options_local_nonprim); options_local_nonprim = NULL; @@ -480,6 +828,23 @@ end: OpenAPI_list_free(binding_infoList); binding_infoList = NULL; } + if (nf_consumer_infoList) { + OpenAPI_list_for_each(nf_consumer_infoList, node) { + ogs_free(node->data); + } + OpenAPI_list_free(nf_consumer_infoList); + nf_consumer_infoList = NULL; + } + if (aoi_state_listList) { + OpenAPI_list_for_each(aoi_state_listList, node) { + OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*) node->data; + ogs_free(localKeyValue->key); + OpenAPI_area_of_interest_event_state_free(localKeyValue->value); + OpenAPI_map_free(localKeyValue); + } + OpenAPI_list_free(aoi_state_listList); + aoi_state_listList = NULL; + } return NULL; } diff --git a/lib/sbi/openapi/model/ext_amf_event_subscription.h b/lib/sbi/openapi/model/ext_amf_event_subscription.h index f1317bee0..23752d9a1 100644 --- a/lib/sbi/openapi/model/ext_amf_event_subscription.h +++ b/lib/sbi/openapi/model/ext_amf_event_subscription.h @@ -1,7 +1,7 @@ /* * ext_amf_event_subscription.h * - * + * AMF event subscription extended with additional information received for the subscription */ #ifndef _OpenAPI_ext_amf_event_subscription_H_ @@ -14,6 +14,7 @@ #include "../include/binary.h" #include "amf_event.h" #include "amf_event_mode.h" +#include "area_of_interest_event_state.h" #include "nf_type.h" #ifdef __cplusplus @@ -30,6 +31,10 @@ typedef struct OpenAPI_ext_amf_event_subscription_s { char *subs_change_notify_correlation_id; char *supi; char *group_id; + OpenAPI_list_t *exclude_supi_list; + OpenAPI_list_t *exclude_gpsi_list; + OpenAPI_list_t *include_supi_list; + OpenAPI_list_t *include_gpsi_list; char *gpsi; char *pei; bool is_any_ue; @@ -38,6 +43,10 @@ typedef struct OpenAPI_ext_amf_event_subscription_s { OpenAPI_nf_type_e source_nf_type; OpenAPI_list_t *binding_info; OpenAPI_nf_type_e subscribing_nf_type; + bool is_event_sync_ind; + int event_sync_ind; + OpenAPI_list_t *nf_consumer_info; + OpenAPI_list_t* aoi_state_list; } OpenAPI_ext_amf_event_subscription_t; OpenAPI_ext_amf_event_subscription_t *OpenAPI_ext_amf_event_subscription_create( @@ -49,6 +58,10 @@ OpenAPI_ext_amf_event_subscription_t *OpenAPI_ext_amf_event_subscription_create( char *subs_change_notify_correlation_id, char *supi, char *group_id, + OpenAPI_list_t *exclude_supi_list, + OpenAPI_list_t *exclude_gpsi_list, + OpenAPI_list_t *include_supi_list, + OpenAPI_list_t *include_gpsi_list, char *gpsi, char *pei, bool is_any_ue, @@ -56,7 +69,11 @@ OpenAPI_ext_amf_event_subscription_t *OpenAPI_ext_amf_event_subscription_create( OpenAPI_amf_event_mode_t *options, OpenAPI_nf_type_e source_nf_type, OpenAPI_list_t *binding_info, - OpenAPI_nf_type_e subscribing_nf_type + OpenAPI_nf_type_e subscribing_nf_type, + bool is_event_sync_ind, + int event_sync_ind, + OpenAPI_list_t *nf_consumer_info, + OpenAPI_list_t* aoi_state_list ); void OpenAPI_ext_amf_event_subscription_free(OpenAPI_ext_amf_event_subscription_t *ext_amf_event_subscription); OpenAPI_ext_amf_event_subscription_t *OpenAPI_ext_amf_event_subscription_parseFromJSON(cJSON *ext_amf_event_subscriptionJSON); diff --git a/lib/sbi/openapi/model/ext_problem_details.h b/lib/sbi/openapi/model/ext_problem_details.h index ce1314041..c90b2aa66 100644 --- a/lib/sbi/openapi/model/ext_problem_details.h +++ b/lib/sbi/openapi/model/ext_problem_details.h @@ -1,7 +1,7 @@ /* * ext_problem_details.h * - * + * Extended Problem Details */ #ifndef _OpenAPI_ext_problem_details_H_ diff --git a/lib/sbi/openapi/model/ext_snssai.c b/lib/sbi/openapi/model/ext_snssai.c index 7eaffb8ec..7fd3955ac 100644 --- a/lib/sbi/openapi/model/ext_snssai.c +++ b/lib/sbi/openapi/model/ext_snssai.c @@ -4,12 +4,34 @@ #include #include "ext_snssai.h" +char *OpenAPI_wildcard_sdext_snssai_ToString(OpenAPI_ext_snssai_wildcard_sd_e wildcard_sd) +{ + const char *wildcard_sdArray[] = { "NULL", "true" }; + size_t sizeofArray = sizeof(wildcard_sdArray) / sizeof(wildcard_sdArray[0]); + if (wildcard_sd < sizeofArray) + return (char *)wildcard_sdArray[wildcard_sd]; + else + return (char *)"Unknown"; +} + +OpenAPI_ext_snssai_wildcard_sd_e OpenAPI_wildcard_sdext_snssai_FromString(char* wildcard_sd) +{ + int stringToReturn = 0; + const char *wildcard_sdArray[] = { "NULL", "true" }; + size_t sizeofArray = sizeof(wildcard_sdArray) / sizeof(wildcard_sdArray[0]); + while (stringToReturn < sizeofArray) { + if (strcmp(wildcard_sd, wildcard_sdArray[stringToReturn]) == 0) { + return stringToReturn; + } + stringToReturn++; + } + return 0; +} OpenAPI_ext_snssai_t *OpenAPI_ext_snssai_create( int sst, char *sd, OpenAPI_list_t *sd_ranges, - bool is_wildcard_sd, - int wildcard_sd + OpenAPI_ext_snssai_wildcard_sd_e wildcard_sd ) { OpenAPI_ext_snssai_t *ext_snssai_local_var = ogs_malloc(sizeof(OpenAPI_ext_snssai_t)); @@ -18,7 +40,6 @@ OpenAPI_ext_snssai_t *OpenAPI_ext_snssai_create( ext_snssai_local_var->sst = sst; ext_snssai_local_var->sd = sd; ext_snssai_local_var->sd_ranges = sd_ranges; - ext_snssai_local_var->is_wildcard_sd = is_wildcard_sd; ext_snssai_local_var->wildcard_sd = wildcard_sd; return ext_snssai_local_var; @@ -84,8 +105,8 @@ cJSON *OpenAPI_ext_snssai_convertToJSON(OpenAPI_ext_snssai_t *ext_snssai) } } - if (ext_snssai->is_wildcard_sd) { - if (cJSON_AddBoolToObject(item, "wildcardSd", ext_snssai->wildcard_sd) == NULL) { + if (ext_snssai->wildcard_sd != OpenAPI_ext_snssai_WILDCARDSD_NULL) { + if (cJSON_AddStringToObject(item, "wildcardSd", OpenAPI_wildcard_sdext_snssai_ToString(ext_snssai->wildcard_sd)) == NULL) { ogs_error("OpenAPI_ext_snssai_convertToJSON() failed [wildcard_sd]"); goto end; } @@ -104,6 +125,7 @@ OpenAPI_ext_snssai_t *OpenAPI_ext_snssai_parseFromJSON(cJSON *ext_snssaiJSON) cJSON *sd_ranges = NULL; OpenAPI_list_t *sd_rangesList = NULL; cJSON *wildcard_sd = NULL; + OpenAPI_ext_snssai_wildcard_sd_e wildcard_sdVariable = 0; sst = cJSON_GetObjectItemCaseSensitive(ext_snssaiJSON, "sst"); if (!sst) { ogs_error("OpenAPI_ext_snssai_parseFromJSON() failed [sst]"); @@ -149,10 +171,11 @@ OpenAPI_ext_snssai_t *OpenAPI_ext_snssai_parseFromJSON(cJSON *ext_snssaiJSON) wildcard_sd = cJSON_GetObjectItemCaseSensitive(ext_snssaiJSON, "wildcardSd"); if (wildcard_sd) { - if (!cJSON_IsBool(wildcard_sd)) { + if (!cJSON_IsString(wildcard_sd)) { ogs_error("OpenAPI_ext_snssai_parseFromJSON() failed [wildcard_sd]"); goto end; } + wildcard_sdVariable = OpenAPI_wildcard_sdext_snssai_FromString(wildcard_sd->valuestring); } ext_snssai_local_var = OpenAPI_ext_snssai_create ( @@ -160,8 +183,7 @@ OpenAPI_ext_snssai_t *OpenAPI_ext_snssai_parseFromJSON(cJSON *ext_snssaiJSON) sst->valuedouble, sd && !cJSON_IsNull(sd) ? ogs_strdup(sd->valuestring) : NULL, sd_ranges ? sd_rangesList : NULL, - wildcard_sd ? true : false, - wildcard_sd ? wildcard_sd->valueint : 0 + wildcard_sd ? wildcard_sdVariable : 0 ); return ext_snssai_local_var; diff --git a/lib/sbi/openapi/model/ext_snssai.h b/lib/sbi/openapi/model/ext_snssai.h index 726de69db..63bdf4f5c 100644 --- a/lib/sbi/openapi/model/ext_snssai.h +++ b/lib/sbi/openapi/model/ext_snssai.h @@ -1,7 +1,7 @@ /* * ext_snssai.h * - * + * The sdRanges and wildcardSd attributes shall be exclusive from each other. If one of these attributes is present, the sd attribute shall also be present and it shall contain one Slice Differentiator value within the range of SD (if the sdRanges attribute is present) or with any value (if the wildcardSd attribute is present). */ #ifndef _OpenAPI_ext_snssai_H_ @@ -19,20 +19,23 @@ extern "C" { #endif typedef struct OpenAPI_ext_snssai_s OpenAPI_ext_snssai_t; +typedef enum { OpenAPI_ext_snssai_WILDCARDSD_NULL = 0, OpenAPI_ext_snssai_WILDCARDSD__true } OpenAPI_ext_snssai_wildcard_sd_e; + +char* OpenAPI_ext_snssai_wildcard_sd_ToString(OpenAPI_ext_snssai_wildcard_sd_e wildcard_sd); + +OpenAPI_ext_snssai_wildcard_sd_e OpenAPI_ext_snssai_wildcard_sd_FromString(char* wildcard_sd); typedef struct OpenAPI_ext_snssai_s { int sst; char *sd; OpenAPI_list_t *sd_ranges; - bool is_wildcard_sd; - int wildcard_sd; + OpenAPI_ext_snssai_wildcard_sd_e wildcard_sd; } OpenAPI_ext_snssai_t; OpenAPI_ext_snssai_t *OpenAPI_ext_snssai_create( int sst, char *sd, OpenAPI_list_t *sd_ranges, - bool is_wildcard_sd, - int wildcard_sd + OpenAPI_ext_snssai_wildcard_sd_e wildcard_sd ); void OpenAPI_ext_snssai_free(OpenAPI_ext_snssai_t *ext_snssai); OpenAPI_ext_snssai_t *OpenAPI_ext_snssai_parseFromJSON(cJSON *ext_snssaiJSON); diff --git a/lib/sbi/openapi/model/extended_sm_subs_data.c b/lib/sbi/openapi/model/extended_sm_subs_data.c new file mode 100644 index 000000000..534583d8f --- /dev/null +++ b/lib/sbi/openapi/model/extended_sm_subs_data.c @@ -0,0 +1,205 @@ + +#include +#include +#include +#include "extended_sm_subs_data.h" + +OpenAPI_extended_sm_subs_data_t *OpenAPI_extended_sm_subs_data_create( + OpenAPI_list_t *shared_sm_subs_data_ids, + OpenAPI_list_t *individual_sm_subs_data +) +{ + OpenAPI_extended_sm_subs_data_t *extended_sm_subs_data_local_var = ogs_malloc(sizeof(OpenAPI_extended_sm_subs_data_t)); + ogs_assert(extended_sm_subs_data_local_var); + + extended_sm_subs_data_local_var->shared_sm_subs_data_ids = shared_sm_subs_data_ids; + extended_sm_subs_data_local_var->individual_sm_subs_data = individual_sm_subs_data; + + return extended_sm_subs_data_local_var; +} + +void OpenAPI_extended_sm_subs_data_free(OpenAPI_extended_sm_subs_data_t *extended_sm_subs_data) +{ + OpenAPI_lnode_t *node = NULL; + + if (NULL == extended_sm_subs_data) { + return; + } + if (extended_sm_subs_data->shared_sm_subs_data_ids) { + OpenAPI_list_for_each(extended_sm_subs_data->shared_sm_subs_data_ids, node) { + ogs_free(node->data); + } + OpenAPI_list_free(extended_sm_subs_data->shared_sm_subs_data_ids); + extended_sm_subs_data->shared_sm_subs_data_ids = NULL; + } + if (extended_sm_subs_data->individual_sm_subs_data) { + OpenAPI_list_for_each(extended_sm_subs_data->individual_sm_subs_data, node) { + OpenAPI_session_management_subscription_data_free(node->data); + } + OpenAPI_list_free(extended_sm_subs_data->individual_sm_subs_data); + extended_sm_subs_data->individual_sm_subs_data = NULL; + } + ogs_free(extended_sm_subs_data); +} + +cJSON *OpenAPI_extended_sm_subs_data_convertToJSON(OpenAPI_extended_sm_subs_data_t *extended_sm_subs_data) +{ + cJSON *item = NULL; + OpenAPI_lnode_t *node = NULL; + + if (extended_sm_subs_data == NULL) { + ogs_error("OpenAPI_extended_sm_subs_data_convertToJSON() failed [ExtendedSmSubsData]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (!extended_sm_subs_data->shared_sm_subs_data_ids) { + ogs_error("OpenAPI_extended_sm_subs_data_convertToJSON() failed [shared_sm_subs_data_ids]"); + return NULL; + } + cJSON *shared_sm_subs_data_idsList = cJSON_AddArrayToObject(item, "sharedSmSubsDataIds"); + if (shared_sm_subs_data_idsList == NULL) { + ogs_error("OpenAPI_extended_sm_subs_data_convertToJSON() failed [shared_sm_subs_data_ids]"); + goto end; + } + OpenAPI_list_for_each(extended_sm_subs_data->shared_sm_subs_data_ids, node) { + if (cJSON_AddStringToObject(shared_sm_subs_data_idsList, "", (char*)node->data) == NULL) { + ogs_error("OpenAPI_extended_sm_subs_data_convertToJSON() failed [shared_sm_subs_data_ids]"); + goto end; + } + } + + if (extended_sm_subs_data->individual_sm_subs_data) { + cJSON *individual_sm_subs_dataList = cJSON_AddArrayToObject(item, "individualSmSubsData"); + if (individual_sm_subs_dataList == NULL) { + ogs_error("OpenAPI_extended_sm_subs_data_convertToJSON() failed [individual_sm_subs_data]"); + goto end; + } + OpenAPI_list_for_each(extended_sm_subs_data->individual_sm_subs_data, node) { + cJSON *itemLocal = OpenAPI_session_management_subscription_data_convertToJSON(node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_extended_sm_subs_data_convertToJSON() failed [individual_sm_subs_data]"); + goto end; + } + cJSON_AddItemToArray(individual_sm_subs_dataList, itemLocal); + } + } + +end: + return item; +} + +OpenAPI_extended_sm_subs_data_t *OpenAPI_extended_sm_subs_data_parseFromJSON(cJSON *extended_sm_subs_dataJSON) +{ + OpenAPI_extended_sm_subs_data_t *extended_sm_subs_data_local_var = NULL; + OpenAPI_lnode_t *node = NULL; + cJSON *shared_sm_subs_data_ids = NULL; + OpenAPI_list_t *shared_sm_subs_data_idsList = NULL; + cJSON *individual_sm_subs_data = NULL; + OpenAPI_list_t *individual_sm_subs_dataList = NULL; + shared_sm_subs_data_ids = cJSON_GetObjectItemCaseSensitive(extended_sm_subs_dataJSON, "sharedSmSubsDataIds"); + if (!shared_sm_subs_data_ids) { + ogs_error("OpenAPI_extended_sm_subs_data_parseFromJSON() failed [shared_sm_subs_data_ids]"); + goto end; + } + cJSON *shared_sm_subs_data_ids_local = NULL; + if (!cJSON_IsArray(shared_sm_subs_data_ids)) { + ogs_error("OpenAPI_extended_sm_subs_data_parseFromJSON() failed [shared_sm_subs_data_ids]"); + goto end; + } + + shared_sm_subs_data_idsList = OpenAPI_list_create(); + + cJSON_ArrayForEach(shared_sm_subs_data_ids_local, shared_sm_subs_data_ids) { + double *localDouble = NULL; + int *localInt = NULL; + if (!cJSON_IsString(shared_sm_subs_data_ids_local)) { + ogs_error("OpenAPI_extended_sm_subs_data_parseFromJSON() failed [shared_sm_subs_data_ids]"); + goto end; + } + OpenAPI_list_add(shared_sm_subs_data_idsList, ogs_strdup(shared_sm_subs_data_ids_local->valuestring)); + } + + individual_sm_subs_data = cJSON_GetObjectItemCaseSensitive(extended_sm_subs_dataJSON, "individualSmSubsData"); + if (individual_sm_subs_data) { + cJSON *individual_sm_subs_data_local = NULL; + if (!cJSON_IsArray(individual_sm_subs_data)) { + ogs_error("OpenAPI_extended_sm_subs_data_parseFromJSON() failed [individual_sm_subs_data]"); + goto end; + } + + individual_sm_subs_dataList = OpenAPI_list_create(); + + cJSON_ArrayForEach(individual_sm_subs_data_local, individual_sm_subs_data) { + if (!cJSON_IsObject(individual_sm_subs_data_local)) { + ogs_error("OpenAPI_extended_sm_subs_data_parseFromJSON() failed [individual_sm_subs_data]"); + goto end; + } + OpenAPI_session_management_subscription_data_t *individual_sm_subs_dataItem = OpenAPI_session_management_subscription_data_parseFromJSON(individual_sm_subs_data_local); + if (!individual_sm_subs_dataItem) { + ogs_error("No individual_sm_subs_dataItem"); + OpenAPI_list_free(individual_sm_subs_dataList); + goto end; + } + OpenAPI_list_add(individual_sm_subs_dataList, individual_sm_subs_dataItem); + } + } + + extended_sm_subs_data_local_var = OpenAPI_extended_sm_subs_data_create ( + shared_sm_subs_data_idsList, + individual_sm_subs_data ? individual_sm_subs_dataList : NULL + ); + + return extended_sm_subs_data_local_var; +end: + if (shared_sm_subs_data_idsList) { + OpenAPI_list_for_each(shared_sm_subs_data_idsList, node) { + ogs_free(node->data); + } + OpenAPI_list_free(shared_sm_subs_data_idsList); + shared_sm_subs_data_idsList = NULL; + } + if (individual_sm_subs_dataList) { + OpenAPI_list_for_each(individual_sm_subs_dataList, node) { + OpenAPI_session_management_subscription_data_free(node->data); + } + OpenAPI_list_free(individual_sm_subs_dataList); + individual_sm_subs_dataList = NULL; + } + return NULL; +} + +OpenAPI_extended_sm_subs_data_t *OpenAPI_extended_sm_subs_data_copy(OpenAPI_extended_sm_subs_data_t *dst, OpenAPI_extended_sm_subs_data_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_extended_sm_subs_data_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_extended_sm_subs_data_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_extended_sm_subs_data_free(dst); + dst = OpenAPI_extended_sm_subs_data_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/extended_sm_subs_data.h b/lib/sbi/openapi/model/extended_sm_subs_data.h new file mode 100644 index 000000000..8a512ab32 --- /dev/null +++ b/lib/sbi/openapi/model/extended_sm_subs_data.h @@ -0,0 +1,41 @@ +/* + * extended_sm_subs_data.h + * + * Contains identifiers of shared Session Management Subscription Data and optionally individual Session Management Subscription Data. + */ + +#ifndef _OpenAPI_extended_sm_subs_data_H_ +#define _OpenAPI_extended_sm_subs_data_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "session_management_subscription_data.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_extended_sm_subs_data_s OpenAPI_extended_sm_subs_data_t; +typedef struct OpenAPI_extended_sm_subs_data_s { + OpenAPI_list_t *shared_sm_subs_data_ids; + OpenAPI_list_t *individual_sm_subs_data; +} OpenAPI_extended_sm_subs_data_t; + +OpenAPI_extended_sm_subs_data_t *OpenAPI_extended_sm_subs_data_create( + OpenAPI_list_t *shared_sm_subs_data_ids, + OpenAPI_list_t *individual_sm_subs_data +); +void OpenAPI_extended_sm_subs_data_free(OpenAPI_extended_sm_subs_data_t *extended_sm_subs_data); +OpenAPI_extended_sm_subs_data_t *OpenAPI_extended_sm_subs_data_parseFromJSON(cJSON *extended_sm_subs_dataJSON); +cJSON *OpenAPI_extended_sm_subs_data_convertToJSON(OpenAPI_extended_sm_subs_data_t *extended_sm_subs_data); +OpenAPI_extended_sm_subs_data_t *OpenAPI_extended_sm_subs_data_copy(OpenAPI_extended_sm_subs_data_t *dst, OpenAPI_extended_sm_subs_data_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_extended_sm_subs_data_H_ */ + diff --git a/lib/sbi/openapi/model/external_client_type.h b/lib/sbi/openapi/model/external_client_type.h index 4996a435b..062d7dd84 100644 --- a/lib/sbi/openapi/model/external_client_type.h +++ b/lib/sbi/openapi/model/external_client_type.h @@ -1,7 +1,7 @@ /* * external_client_type.h * - * + * Indicates types of External Clients. */ #ifndef _OpenAPI_external_client_type_H_ diff --git a/lib/sbi/openapi/model/failure_code.c b/lib/sbi/openapi/model/failure_code.c index ad11b65d3..4c7f3e40e 100644 --- a/lib/sbi/openapi/model/failure_code.c +++ b/lib/sbi/openapi/model/failure_code.c @@ -6,7 +6,7 @@ char* OpenAPI_failure_code_ToString(OpenAPI_failure_code_e failure_code) { - const char *failure_codeArray[] = { "NULL", "UNK_RULE_ID", "RA_GR_ERR", "SER_ID_ERR", "NF_MAL", "RES_LIM", "MAX_NR_QoS_FLOW", "MISS_FLOW_INFO", "RES_ALLO_FAIL", "UNSUCC_QOS_VAL", "INCOR_FLOW_INFO", "PS_TO_CS_HAN", "APP_ID_ERR", "NO_QOS_FLOW_BOUND", "FILTER_RES", "MISS_REDI_SER_ADDR", "CM_END_USER_SER_DENIED", "CM_CREDIT_CON_NOT_APP", "CM_AUTH_REJ", "CM_USER_UNK", "CM_RAT_FAILED", "UE_STA_SUSP" }; + const char *failure_codeArray[] = { "NULL", "UNK_RULE_ID", "RA_GR_ERR", "SER_ID_ERR", "NF_MAL", "RES_LIM", "MAX_NR_QoS_FLOW", "MISS_FLOW_INFO", "RES_ALLO_FAIL", "UNSUCC_QOS_VAL", "INCOR_FLOW_INFO", "PS_TO_CS_HAN", "APP_ID_ERR", "NO_QOS_FLOW_BOUND", "FILTER_RES", "MISS_REDI_SER_ADDR", "CM_END_USER_SER_DENIED", "CM_CREDIT_CON_NOT_APP", "CM_AUTH_REJ", "CM_USER_UNK", "CM_RAT_FAILED", "UE_STA_SUSP", "UNKNOWN_REF_ID", "INCORRECT_COND_DATA", "REF_ID_COLLISION", "TRAFFIC_STEERING_ERROR", "DNAI_STEERING_ERROR", "AN_GW_FAILE", "MAX_NR_PACKET_FILTERS_EXCEEDED", "PACKET_FILTER_TFT_ALLOCATION_EXCEEDED", "MUTE_CHG_NOT_ALLOWED" }; size_t sizeofArray = sizeof(failure_codeArray) / sizeof(failure_codeArray[0]); if (failure_code < sizeofArray) return (char *)failure_codeArray[failure_code]; @@ -17,7 +17,7 @@ char* OpenAPI_failure_code_ToString(OpenAPI_failure_code_e failure_code) OpenAPI_failure_code_e OpenAPI_failure_code_FromString(char* failure_code) { int stringToReturn = 0; - const char *failure_codeArray[] = { "NULL", "UNK_RULE_ID", "RA_GR_ERR", "SER_ID_ERR", "NF_MAL", "RES_LIM", "MAX_NR_QoS_FLOW", "MISS_FLOW_INFO", "RES_ALLO_FAIL", "UNSUCC_QOS_VAL", "INCOR_FLOW_INFO", "PS_TO_CS_HAN", "APP_ID_ERR", "NO_QOS_FLOW_BOUND", "FILTER_RES", "MISS_REDI_SER_ADDR", "CM_END_USER_SER_DENIED", "CM_CREDIT_CON_NOT_APP", "CM_AUTH_REJ", "CM_USER_UNK", "CM_RAT_FAILED", "UE_STA_SUSP" }; + const char *failure_codeArray[] = { "NULL", "UNK_RULE_ID", "RA_GR_ERR", "SER_ID_ERR", "NF_MAL", "RES_LIM", "MAX_NR_QoS_FLOW", "MISS_FLOW_INFO", "RES_ALLO_FAIL", "UNSUCC_QOS_VAL", "INCOR_FLOW_INFO", "PS_TO_CS_HAN", "APP_ID_ERR", "NO_QOS_FLOW_BOUND", "FILTER_RES", "MISS_REDI_SER_ADDR", "CM_END_USER_SER_DENIED", "CM_CREDIT_CON_NOT_APP", "CM_AUTH_REJ", "CM_USER_UNK", "CM_RAT_FAILED", "UE_STA_SUSP", "UNKNOWN_REF_ID", "INCORRECT_COND_DATA", "REF_ID_COLLISION", "TRAFFIC_STEERING_ERROR", "DNAI_STEERING_ERROR", "AN_GW_FAILE", "MAX_NR_PACKET_FILTERS_EXCEEDED", "PACKET_FILTER_TFT_ALLOCATION_EXCEEDED", "MUTE_CHG_NOT_ALLOWED" }; size_t sizeofArray = sizeof(failure_codeArray) / sizeof(failure_codeArray[0]); while (stringToReturn < sizeofArray) { if (strcmp(failure_code, failure_codeArray[stringToReturn]) == 0) { diff --git a/lib/sbi/openapi/model/failure_code.h b/lib/sbi/openapi/model/failure_code.h index 33667c507..492b7b07e 100644 --- a/lib/sbi/openapi/model/failure_code.h +++ b/lib/sbi/openapi/model/failure_code.h @@ -17,7 +17,7 @@ extern "C" { #endif -typedef enum { OpenAPI_failure_code_NULL = 0, OpenAPI_failure_code_UNK_RULE_ID, OpenAPI_failure_code_RA_GR_ERR, OpenAPI_failure_code_SER_ID_ERR, OpenAPI_failure_code_NF_MAL, OpenAPI_failure_code_RES_LIM, OpenAPI_failure_code_MAX_NR_QoS_FLOW, OpenAPI_failure_code_MISS_FLOW_INFO, OpenAPI_failure_code_RES_ALLO_FAIL, OpenAPI_failure_code_UNSUCC_QOS_VAL, OpenAPI_failure_code_INCOR_FLOW_INFO, OpenAPI_failure_code_PS_TO_CS_HAN, OpenAPI_failure_code_APP_ID_ERR, OpenAPI_failure_code_NO_QOS_FLOW_BOUND, OpenAPI_failure_code_FILTER_RES, OpenAPI_failure_code_MISS_REDI_SER_ADDR, OpenAPI_failure_code_CM_END_USER_SER_DENIED, OpenAPI_failure_code_CM_CREDIT_CON_NOT_APP, OpenAPI_failure_code_CM_AUTH_REJ, OpenAPI_failure_code_CM_USER_UNK, OpenAPI_failure_code_CM_RAT_FAILED, OpenAPI_failure_code_UE_STA_SUSP } OpenAPI_failure_code_e; +typedef enum { OpenAPI_failure_code_NULL = 0, OpenAPI_failure_code_UNK_RULE_ID, OpenAPI_failure_code_RA_GR_ERR, OpenAPI_failure_code_SER_ID_ERR, OpenAPI_failure_code_NF_MAL, OpenAPI_failure_code_RES_LIM, OpenAPI_failure_code_MAX_NR_QoS_FLOW, OpenAPI_failure_code_MISS_FLOW_INFO, OpenAPI_failure_code_RES_ALLO_FAIL, OpenAPI_failure_code_UNSUCC_QOS_VAL, OpenAPI_failure_code_INCOR_FLOW_INFO, OpenAPI_failure_code_PS_TO_CS_HAN, OpenAPI_failure_code_APP_ID_ERR, OpenAPI_failure_code_NO_QOS_FLOW_BOUND, OpenAPI_failure_code_FILTER_RES, OpenAPI_failure_code_MISS_REDI_SER_ADDR, OpenAPI_failure_code_CM_END_USER_SER_DENIED, OpenAPI_failure_code_CM_CREDIT_CON_NOT_APP, OpenAPI_failure_code_CM_AUTH_REJ, OpenAPI_failure_code_CM_USER_UNK, OpenAPI_failure_code_CM_RAT_FAILED, OpenAPI_failure_code_UE_STA_SUSP, OpenAPI_failure_code_UNKNOWN_REF_ID, OpenAPI_failure_code_INCORRECT_COND_DATA, OpenAPI_failure_code_REF_ID_COLLISION, OpenAPI_failure_code_TRAFFIC_STEERING_ERROR, OpenAPI_failure_code_DNAI_STEERING_ERROR, OpenAPI_failure_code_AN_GW_FAILE, OpenAPI_failure_code_MAX_NR_PACKET_FILTERS_EXCEEDED, OpenAPI_failure_code_PACKET_FILTER_TFT_ALLOCATION_EXCEEDED, OpenAPI_failure_code_MUTE_CHG_NOT_ALLOWED } OpenAPI_failure_code_e; char* OpenAPI_failure_code_ToString(OpenAPI_failure_code_e failure_code); diff --git a/lib/sbi/openapi/model/failure_event_info.c b/lib/sbi/openapi/model/failure_event_info.c new file mode 100644 index 000000000..204853b3d --- /dev/null +++ b/lib/sbi/openapi/model/failure_event_info.c @@ -0,0 +1,157 @@ + +#include +#include +#include +#include "failure_event_info.h" + +OpenAPI_failure_event_info_t *OpenAPI_failure_event_info_create( + OpenAPI_nwdaf_event_t *event, + OpenAPI_nwdaf_failure_code_t *failure_code +) +{ + OpenAPI_failure_event_info_t *failure_event_info_local_var = ogs_malloc(sizeof(OpenAPI_failure_event_info_t)); + ogs_assert(failure_event_info_local_var); + + failure_event_info_local_var->event = event; + failure_event_info_local_var->failure_code = failure_code; + + return failure_event_info_local_var; +} + +void OpenAPI_failure_event_info_free(OpenAPI_failure_event_info_t *failure_event_info) +{ + OpenAPI_lnode_t *node = NULL; + + if (NULL == failure_event_info) { + return; + } + if (failure_event_info->event) { + OpenAPI_nwdaf_event_free(failure_event_info->event); + failure_event_info->event = NULL; + } + if (failure_event_info->failure_code) { + OpenAPI_nwdaf_failure_code_free(failure_event_info->failure_code); + failure_event_info->failure_code = NULL; + } + ogs_free(failure_event_info); +} + +cJSON *OpenAPI_failure_event_info_convertToJSON(OpenAPI_failure_event_info_t *failure_event_info) +{ + cJSON *item = NULL; + OpenAPI_lnode_t *node = NULL; + + if (failure_event_info == NULL) { + ogs_error("OpenAPI_failure_event_info_convertToJSON() failed [FailureEventInfo]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (!failure_event_info->event) { + ogs_error("OpenAPI_failure_event_info_convertToJSON() failed [event]"); + return NULL; + } + cJSON *event_local_JSON = OpenAPI_nwdaf_event_convertToJSON(failure_event_info->event); + if (event_local_JSON == NULL) { + ogs_error("OpenAPI_failure_event_info_convertToJSON() failed [event]"); + goto end; + } + cJSON_AddItemToObject(item, "event", event_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_failure_event_info_convertToJSON() failed [event]"); + goto end; + } + + if (!failure_event_info->failure_code) { + ogs_error("OpenAPI_failure_event_info_convertToJSON() failed [failure_code]"); + return NULL; + } + cJSON *failure_code_local_JSON = OpenAPI_nwdaf_failure_code_convertToJSON(failure_event_info->failure_code); + if (failure_code_local_JSON == NULL) { + ogs_error("OpenAPI_failure_event_info_convertToJSON() failed [failure_code]"); + goto end; + } + cJSON_AddItemToObject(item, "failureCode", failure_code_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_failure_event_info_convertToJSON() failed [failure_code]"); + goto end; + } + +end: + return item; +} + +OpenAPI_failure_event_info_t *OpenAPI_failure_event_info_parseFromJSON(cJSON *failure_event_infoJSON) +{ + OpenAPI_failure_event_info_t *failure_event_info_local_var = NULL; + OpenAPI_lnode_t *node = NULL; + cJSON *event = NULL; + OpenAPI_nwdaf_event_t *event_local_nonprim = NULL; + cJSON *failure_code = NULL; + OpenAPI_nwdaf_failure_code_t *failure_code_local_nonprim = NULL; + event = cJSON_GetObjectItemCaseSensitive(failure_event_infoJSON, "event"); + if (!event) { + ogs_error("OpenAPI_failure_event_info_parseFromJSON() failed [event]"); + goto end; + } + event_local_nonprim = OpenAPI_nwdaf_event_parseFromJSON(event); + + failure_code = cJSON_GetObjectItemCaseSensitive(failure_event_infoJSON, "failureCode"); + if (!failure_code) { + ogs_error("OpenAPI_failure_event_info_parseFromJSON() failed [failure_code]"); + goto end; + } + failure_code_local_nonprim = OpenAPI_nwdaf_failure_code_parseFromJSON(failure_code); + + failure_event_info_local_var = OpenAPI_failure_event_info_create ( + event_local_nonprim, + failure_code_local_nonprim + ); + + return failure_event_info_local_var; +end: + if (event_local_nonprim) { + OpenAPI_nwdaf_event_free(event_local_nonprim); + event_local_nonprim = NULL; + } + if (failure_code_local_nonprim) { + OpenAPI_nwdaf_failure_code_free(failure_code_local_nonprim); + failure_code_local_nonprim = NULL; + } + return NULL; +} + +OpenAPI_failure_event_info_t *OpenAPI_failure_event_info_copy(OpenAPI_failure_event_info_t *dst, OpenAPI_failure_event_info_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_failure_event_info_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_failure_event_info_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_failure_event_info_free(dst); + dst = OpenAPI_failure_event_info_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/failure_event_info.h b/lib/sbi/openapi/model/failure_event_info.h new file mode 100644 index 000000000..4c8bd2e0b --- /dev/null +++ b/lib/sbi/openapi/model/failure_event_info.h @@ -0,0 +1,42 @@ +/* + * failure_event_info.h + * + * Contains information on the event for which the subscription is not successful. + */ + +#ifndef _OpenAPI_failure_event_info_H_ +#define _OpenAPI_failure_event_info_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "nwdaf_event.h" +#include "nwdaf_failure_code.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_failure_event_info_s OpenAPI_failure_event_info_t; +typedef struct OpenAPI_failure_event_info_s { + struct OpenAPI_nwdaf_event_s *event; + struct OpenAPI_nwdaf_failure_code_s *failure_code; +} OpenAPI_failure_event_info_t; + +OpenAPI_failure_event_info_t *OpenAPI_failure_event_info_create( + OpenAPI_nwdaf_event_t *event, + OpenAPI_nwdaf_failure_code_t *failure_code +); +void OpenAPI_failure_event_info_free(OpenAPI_failure_event_info_t *failure_event_info); +OpenAPI_failure_event_info_t *OpenAPI_failure_event_info_parseFromJSON(cJSON *failure_event_infoJSON); +cJSON *OpenAPI_failure_event_info_convertToJSON(OpenAPI_failure_event_info_t *failure_event_info); +OpenAPI_failure_event_info_t *OpenAPI_failure_event_info_copy(OpenAPI_failure_event_info_t *dst, OpenAPI_failure_event_info_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_failure_event_info_H_ */ + diff --git a/lib/sbi/openapi/model/flow_direction_rm.c b/lib/sbi/openapi/model/flow_direction_rm.c new file mode 100644 index 000000000..34f6f24af --- /dev/null +++ b/lib/sbi/openapi/model/flow_direction_rm.c @@ -0,0 +1,87 @@ + +#include +#include +#include +#include "flow_direction_rm.h" + +OpenAPI_flow_direction_rm_t *OpenAPI_flow_direction_rm_create( +) +{ + OpenAPI_flow_direction_rm_t *flow_direction_rm_local_var = ogs_malloc(sizeof(OpenAPI_flow_direction_rm_t)); + ogs_assert(flow_direction_rm_local_var); + + + return flow_direction_rm_local_var; +} + +void OpenAPI_flow_direction_rm_free(OpenAPI_flow_direction_rm_t *flow_direction_rm) +{ + OpenAPI_lnode_t *node = NULL; + + if (NULL == flow_direction_rm) { + return; + } + ogs_free(flow_direction_rm); +} + +cJSON *OpenAPI_flow_direction_rm_convertToJSON(OpenAPI_flow_direction_rm_t *flow_direction_rm) +{ + cJSON *item = NULL; + OpenAPI_lnode_t *node = NULL; + + if (flow_direction_rm == NULL) { + ogs_error("OpenAPI_flow_direction_rm_convertToJSON() failed [FlowDirectionRm]"); + return NULL; + } + + item = cJSON_CreateObject(); +end: + return item; +} + +OpenAPI_flow_direction_rm_t *OpenAPI_flow_direction_rm_parseFromJSON(cJSON *flow_direction_rmJSON) +{ + OpenAPI_flow_direction_rm_t *flow_direction_rm_local_var = NULL; + OpenAPI_lnode_t *node = NULL; + flow_direction_rm_local_var = OpenAPI_flow_direction_rm_create ( + ); + + return flow_direction_rm_local_var; +end: + return NULL; +} + +OpenAPI_flow_direction_rm_t *OpenAPI_flow_direction_rm_copy(OpenAPI_flow_direction_rm_t *dst, OpenAPI_flow_direction_rm_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_flow_direction_rm_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_flow_direction_rm_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_flow_direction_rm_free(dst); + dst = OpenAPI_flow_direction_rm_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/flow_direction_rm.h b/lib/sbi/openapi/model/flow_direction_rm.h new file mode 100644 index 000000000..79ddf02f0 --- /dev/null +++ b/lib/sbi/openapi/model/flow_direction_rm.h @@ -0,0 +1,38 @@ +/* + * flow_direction_rm.h + * + * This data type is defined in the same way as the \"FlowDirection\" data type, with the only difference that it allows null value. + */ + +#ifndef _OpenAPI_flow_direction_rm_H_ +#define _OpenAPI_flow_direction_rm_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "flow_direction.h" +#include "null_value.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_flow_direction_rm_s OpenAPI_flow_direction_rm_t; +typedef struct OpenAPI_flow_direction_rm_s { +} OpenAPI_flow_direction_rm_t; + +OpenAPI_flow_direction_rm_t *OpenAPI_flow_direction_rm_create( +); +void OpenAPI_flow_direction_rm_free(OpenAPI_flow_direction_rm_t *flow_direction_rm); +OpenAPI_flow_direction_rm_t *OpenAPI_flow_direction_rm_parseFromJSON(cJSON *flow_direction_rmJSON); +cJSON *OpenAPI_flow_direction_rm_convertToJSON(OpenAPI_flow_direction_rm_t *flow_direction_rm); +OpenAPI_flow_direction_rm_t *OpenAPI_flow_direction_rm_copy(OpenAPI_flow_direction_rm_t *dst, OpenAPI_flow_direction_rm_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_flow_direction_rm_H_ */ + diff --git a/lib/sbi/openapi/model/flow_info.h b/lib/sbi/openapi/model/flow_info.h index 6b5fda14d..830d4eaff 100644 --- a/lib/sbi/openapi/model/flow_info.h +++ b/lib/sbi/openapi/model/flow_info.h @@ -1,7 +1,7 @@ /* * flow_info.h * - * + * Represents IP flow information. */ #ifndef _OpenAPI_flow_info_H_ diff --git a/lib/sbi/openapi/model/flow_information.h b/lib/sbi/openapi/model/flow_information.h index d016d7279..2af9da409 100644 --- a/lib/sbi/openapi/model/flow_information.h +++ b/lib/sbi/openapi/model/flow_information.h @@ -1,7 +1,7 @@ /* * flow_information.h * - * + * Contains the flow information. */ #ifndef _OpenAPI_flow_information_H_ diff --git a/lib/sbi/openapi/model/flows.h b/lib/sbi/openapi/model/flows.h index 66399559f..7d2ab2004 100644 --- a/lib/sbi/openapi/model/flows.h +++ b/lib/sbi/openapi/model/flows.h @@ -1,7 +1,7 @@ /* * flows.h * - * Identifies the flows + * Identifies the flows. */ #ifndef _OpenAPI_flows_H_ diff --git a/lib/sbi/openapi/model/fqdn_rm.c b/lib/sbi/openapi/model/fqdn_rm.c new file mode 100644 index 000000000..8303e4a0c --- /dev/null +++ b/lib/sbi/openapi/model/fqdn_rm.c @@ -0,0 +1,87 @@ + +#include +#include +#include +#include "fqdn_rm.h" + +OpenAPI_fqdn_rm_t *OpenAPI_fqdn_rm_create( +) +{ + OpenAPI_fqdn_rm_t *fqdn_rm_local_var = ogs_malloc(sizeof(OpenAPI_fqdn_rm_t)); + ogs_assert(fqdn_rm_local_var); + + + return fqdn_rm_local_var; +} + +void OpenAPI_fqdn_rm_free(OpenAPI_fqdn_rm_t *fqdn_rm) +{ + OpenAPI_lnode_t *node = NULL; + + if (NULL == fqdn_rm) { + return; + } + ogs_free(fqdn_rm); +} + +cJSON *OpenAPI_fqdn_rm_convertToJSON(OpenAPI_fqdn_rm_t *fqdn_rm) +{ + cJSON *item = NULL; + OpenAPI_lnode_t *node = NULL; + + if (fqdn_rm == NULL) { + ogs_error("OpenAPI_fqdn_rm_convertToJSON() failed [FqdnRm]"); + return NULL; + } + + item = cJSON_CreateObject(); +end: + return item; +} + +OpenAPI_fqdn_rm_t *OpenAPI_fqdn_rm_parseFromJSON(cJSON *fqdn_rmJSON) +{ + OpenAPI_fqdn_rm_t *fqdn_rm_local_var = NULL; + OpenAPI_lnode_t *node = NULL; + fqdn_rm_local_var = OpenAPI_fqdn_rm_create ( + ); + + return fqdn_rm_local_var; +end: + return NULL; +} + +OpenAPI_fqdn_rm_t *OpenAPI_fqdn_rm_copy(OpenAPI_fqdn_rm_t *dst, OpenAPI_fqdn_rm_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_fqdn_rm_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_fqdn_rm_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_fqdn_rm_free(dst); + dst = OpenAPI_fqdn_rm_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/fqdn_rm.h b/lib/sbi/openapi/model/fqdn_rm.h new file mode 100644 index 000000000..5506ffa60 --- /dev/null +++ b/lib/sbi/openapi/model/fqdn_rm.h @@ -0,0 +1,37 @@ +/* + * fqdn_rm.h + * + * Fully Qualified Domain Name, but it also allows the null value + */ + +#ifndef _OpenAPI_fqdn_rm_H_ +#define _OpenAPI_fqdn_rm_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "null_value.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_fqdn_rm_s OpenAPI_fqdn_rm_t; +typedef struct OpenAPI_fqdn_rm_s { +} OpenAPI_fqdn_rm_t; + +OpenAPI_fqdn_rm_t *OpenAPI_fqdn_rm_create( +); +void OpenAPI_fqdn_rm_free(OpenAPI_fqdn_rm_t *fqdn_rm); +OpenAPI_fqdn_rm_t *OpenAPI_fqdn_rm_parseFromJSON(cJSON *fqdn_rmJSON); +cJSON *OpenAPI_fqdn_rm_convertToJSON(OpenAPI_fqdn_rm_t *fqdn_rm); +OpenAPI_fqdn_rm_t *OpenAPI_fqdn_rm_copy(OpenAPI_fqdn_rm_t *dst, OpenAPI_fqdn_rm_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_fqdn_rm_H_ */ + diff --git a/lib/sbi/openapi/model/gad_shape.h b/lib/sbi/openapi/model/gad_shape.h index 4c09c3edf..8aa6dbae1 100644 --- a/lib/sbi/openapi/model/gad_shape.h +++ b/lib/sbi/openapi/model/gad_shape.h @@ -1,7 +1,7 @@ /* * gad_shape.h * - * + * Common base type for GAD shapes. */ #ifndef _OpenAPI_gad_shape_H_ diff --git a/lib/sbi/openapi/model/gba_auth_type.c b/lib/sbi/openapi/model/gba_auth_type.c new file mode 100644 index 000000000..50385c435 --- /dev/null +++ b/lib/sbi/openapi/model/gba_auth_type.c @@ -0,0 +1,30 @@ + +#include +#include +#include +#include "gba_auth_type.h" + +char* OpenAPI_gba_auth_type_ToString(OpenAPI_gba_auth_type_e gba_auth_type) +{ + const char *gba_auth_typeArray[] = { "NULL", "DIGEST_AKAV1_MD5" }; + size_t sizeofArray = sizeof(gba_auth_typeArray) / sizeof(gba_auth_typeArray[0]); + if (gba_auth_type < sizeofArray) + return (char *)gba_auth_typeArray[gba_auth_type]; + else + return (char *)"Unknown"; +} + +OpenAPI_gba_auth_type_e OpenAPI_gba_auth_type_FromString(char* gba_auth_type) +{ + int stringToReturn = 0; + const char *gba_auth_typeArray[] = { "NULL", "DIGEST_AKAV1_MD5" }; + size_t sizeofArray = sizeof(gba_auth_typeArray) / sizeof(gba_auth_typeArray[0]); + while (stringToReturn < sizeofArray) { + if (strcmp(gba_auth_type, gba_auth_typeArray[stringToReturn]) == 0) { + return stringToReturn; + } + stringToReturn++; + } + return 0; +} + diff --git a/lib/sbi/openapi/model/gba_auth_type.h b/lib/sbi/openapi/model/gba_auth_type.h new file mode 100644 index 000000000..29eb7feb2 --- /dev/null +++ b/lib/sbi/openapi/model/gba_auth_type.h @@ -0,0 +1,31 @@ +/* + * gba_auth_type.h + * + * + */ + +#ifndef _OpenAPI_gba_auth_type_H_ +#define _OpenAPI_gba_auth_type_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef enum { OpenAPI_gba_auth_type_NULL = 0, OpenAPI_gba_auth_type_DIGEST_AKAV1_MD5 } OpenAPI_gba_auth_type_e; + +char* OpenAPI_gba_auth_type_ToString(OpenAPI_gba_auth_type_e gba_auth_type); + +OpenAPI_gba_auth_type_e OpenAPI_gba_auth_type_FromString(char* gba_auth_type); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_gba_auth_type_H_ */ + diff --git a/lib/sbi/openapi/model/gba_authentication_info_request.c b/lib/sbi/openapi/model/gba_authentication_info_request.c new file mode 100644 index 000000000..37d458078 --- /dev/null +++ b/lib/sbi/openapi/model/gba_authentication_info_request.c @@ -0,0 +1,166 @@ + +#include +#include +#include +#include "gba_authentication_info_request.h" + +OpenAPI_gba_authentication_info_request_t *OpenAPI_gba_authentication_info_request_create( + OpenAPI_gba_auth_type_e auth_type, + OpenAPI_resynchronization_info_1_t *resynchronization_info, + char *supported_features +) +{ + OpenAPI_gba_authentication_info_request_t *gba_authentication_info_request_local_var = ogs_malloc(sizeof(OpenAPI_gba_authentication_info_request_t)); + ogs_assert(gba_authentication_info_request_local_var); + + gba_authentication_info_request_local_var->auth_type = auth_type; + gba_authentication_info_request_local_var->resynchronization_info = resynchronization_info; + gba_authentication_info_request_local_var->supported_features = supported_features; + + return gba_authentication_info_request_local_var; +} + +void OpenAPI_gba_authentication_info_request_free(OpenAPI_gba_authentication_info_request_t *gba_authentication_info_request) +{ + OpenAPI_lnode_t *node = NULL; + + if (NULL == gba_authentication_info_request) { + return; + } + if (gba_authentication_info_request->resynchronization_info) { + OpenAPI_resynchronization_info_1_free(gba_authentication_info_request->resynchronization_info); + gba_authentication_info_request->resynchronization_info = NULL; + } + if (gba_authentication_info_request->supported_features) { + ogs_free(gba_authentication_info_request->supported_features); + gba_authentication_info_request->supported_features = NULL; + } + ogs_free(gba_authentication_info_request); +} + +cJSON *OpenAPI_gba_authentication_info_request_convertToJSON(OpenAPI_gba_authentication_info_request_t *gba_authentication_info_request) +{ + cJSON *item = NULL; + OpenAPI_lnode_t *node = NULL; + + if (gba_authentication_info_request == NULL) { + ogs_error("OpenAPI_gba_authentication_info_request_convertToJSON() failed [GbaAuthenticationInfoRequest]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (gba_authentication_info_request->auth_type == OpenAPI_gba_auth_type_NULL) { + ogs_error("OpenAPI_gba_authentication_info_request_convertToJSON() failed [auth_type]"); + return NULL; + } + if (cJSON_AddStringToObject(item, "authType", OpenAPI_gba_auth_type_ToString(gba_authentication_info_request->auth_type)) == NULL) { + ogs_error("OpenAPI_gba_authentication_info_request_convertToJSON() failed [auth_type]"); + goto end; + } + + if (gba_authentication_info_request->resynchronization_info) { + cJSON *resynchronization_info_local_JSON = OpenAPI_resynchronization_info_1_convertToJSON(gba_authentication_info_request->resynchronization_info); + if (resynchronization_info_local_JSON == NULL) { + ogs_error("OpenAPI_gba_authentication_info_request_convertToJSON() failed [resynchronization_info]"); + goto end; + } + cJSON_AddItemToObject(item, "resynchronizationInfo", resynchronization_info_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_gba_authentication_info_request_convertToJSON() failed [resynchronization_info]"); + goto end; + } + } + + if (gba_authentication_info_request->supported_features) { + if (cJSON_AddStringToObject(item, "supportedFeatures", gba_authentication_info_request->supported_features) == NULL) { + ogs_error("OpenAPI_gba_authentication_info_request_convertToJSON() failed [supported_features]"); + goto end; + } + } + +end: + return item; +} + +OpenAPI_gba_authentication_info_request_t *OpenAPI_gba_authentication_info_request_parseFromJSON(cJSON *gba_authentication_info_requestJSON) +{ + OpenAPI_gba_authentication_info_request_t *gba_authentication_info_request_local_var = NULL; + OpenAPI_lnode_t *node = NULL; + cJSON *auth_type = NULL; + OpenAPI_gba_auth_type_e auth_typeVariable = 0; + cJSON *resynchronization_info = NULL; + OpenAPI_resynchronization_info_1_t *resynchronization_info_local_nonprim = NULL; + cJSON *supported_features = NULL; + auth_type = cJSON_GetObjectItemCaseSensitive(gba_authentication_info_requestJSON, "authType"); + if (!auth_type) { + ogs_error("OpenAPI_gba_authentication_info_request_parseFromJSON() failed [auth_type]"); + goto end; + } + if (!cJSON_IsString(auth_type)) { + ogs_error("OpenAPI_gba_authentication_info_request_parseFromJSON() failed [auth_type]"); + goto end; + } + auth_typeVariable = OpenAPI_gba_auth_type_FromString(auth_type->valuestring); + + resynchronization_info = cJSON_GetObjectItemCaseSensitive(gba_authentication_info_requestJSON, "resynchronizationInfo"); + if (resynchronization_info) { + resynchronization_info_local_nonprim = OpenAPI_resynchronization_info_1_parseFromJSON(resynchronization_info); + } + + supported_features = cJSON_GetObjectItemCaseSensitive(gba_authentication_info_requestJSON, "supportedFeatures"); + if (supported_features) { + if (!cJSON_IsString(supported_features) && !cJSON_IsNull(supported_features)) { + ogs_error("OpenAPI_gba_authentication_info_request_parseFromJSON() failed [supported_features]"); + goto end; + } + } + + gba_authentication_info_request_local_var = OpenAPI_gba_authentication_info_request_create ( + auth_typeVariable, + resynchronization_info ? resynchronization_info_local_nonprim : NULL, + supported_features && !cJSON_IsNull(supported_features) ? ogs_strdup(supported_features->valuestring) : NULL + ); + + return gba_authentication_info_request_local_var; +end: + if (resynchronization_info_local_nonprim) { + OpenAPI_resynchronization_info_1_free(resynchronization_info_local_nonprim); + resynchronization_info_local_nonprim = NULL; + } + return NULL; +} + +OpenAPI_gba_authentication_info_request_t *OpenAPI_gba_authentication_info_request_copy(OpenAPI_gba_authentication_info_request_t *dst, OpenAPI_gba_authentication_info_request_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_gba_authentication_info_request_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_gba_authentication_info_request_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_gba_authentication_info_request_free(dst); + dst = OpenAPI_gba_authentication_info_request_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/gba_authentication_info_request.h b/lib/sbi/openapi/model/gba_authentication_info_request.h new file mode 100644 index 000000000..e719c1377 --- /dev/null +++ b/lib/sbi/openapi/model/gba_authentication_info_request.h @@ -0,0 +1,44 @@ +/* + * gba_authentication_info_request.h + * + * + */ + +#ifndef _OpenAPI_gba_authentication_info_request_H_ +#define _OpenAPI_gba_authentication_info_request_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "gba_auth_type.h" +#include "resynchronization_info_1.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_gba_authentication_info_request_s OpenAPI_gba_authentication_info_request_t; +typedef struct OpenAPI_gba_authentication_info_request_s { + OpenAPI_gba_auth_type_e auth_type; + struct OpenAPI_resynchronization_info_1_s *resynchronization_info; + char *supported_features; +} OpenAPI_gba_authentication_info_request_t; + +OpenAPI_gba_authentication_info_request_t *OpenAPI_gba_authentication_info_request_create( + OpenAPI_gba_auth_type_e auth_type, + OpenAPI_resynchronization_info_1_t *resynchronization_info, + char *supported_features +); +void OpenAPI_gba_authentication_info_request_free(OpenAPI_gba_authentication_info_request_t *gba_authentication_info_request); +OpenAPI_gba_authentication_info_request_t *OpenAPI_gba_authentication_info_request_parseFromJSON(cJSON *gba_authentication_info_requestJSON); +cJSON *OpenAPI_gba_authentication_info_request_convertToJSON(OpenAPI_gba_authentication_info_request_t *gba_authentication_info_request); +OpenAPI_gba_authentication_info_request_t *OpenAPI_gba_authentication_info_request_copy(OpenAPI_gba_authentication_info_request_t *dst, OpenAPI_gba_authentication_info_request_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_gba_authentication_info_request_H_ */ + diff --git a/lib/sbi/openapi/model/gba_authentication_info_result.c b/lib/sbi/openapi/model/gba_authentication_info_result.c new file mode 100644 index 000000000..93af383d1 --- /dev/null +++ b/lib/sbi/openapi/model/gba_authentication_info_result.c @@ -0,0 +1,141 @@ + +#include +#include +#include +#include "gba_authentication_info_result.h" + +OpenAPI_gba_authentication_info_result_t *OpenAPI_gba_authentication_info_result_create( + OpenAPI_model_3_g_aka_av_t *_3g_aka_av, + char *supported_features +) +{ + OpenAPI_gba_authentication_info_result_t *gba_authentication_info_result_local_var = ogs_malloc(sizeof(OpenAPI_gba_authentication_info_result_t)); + ogs_assert(gba_authentication_info_result_local_var); + + gba_authentication_info_result_local_var->_3g_aka_av = _3g_aka_av; + gba_authentication_info_result_local_var->supported_features = supported_features; + + return gba_authentication_info_result_local_var; +} + +void OpenAPI_gba_authentication_info_result_free(OpenAPI_gba_authentication_info_result_t *gba_authentication_info_result) +{ + OpenAPI_lnode_t *node = NULL; + + if (NULL == gba_authentication_info_result) { + return; + } + if (gba_authentication_info_result->_3g_aka_av) { + OpenAPI_model_3_g_aka_av_free(gba_authentication_info_result->_3g_aka_av); + gba_authentication_info_result->_3g_aka_av = NULL; + } + if (gba_authentication_info_result->supported_features) { + ogs_free(gba_authentication_info_result->supported_features); + gba_authentication_info_result->supported_features = NULL; + } + ogs_free(gba_authentication_info_result); +} + +cJSON *OpenAPI_gba_authentication_info_result_convertToJSON(OpenAPI_gba_authentication_info_result_t *gba_authentication_info_result) +{ + cJSON *item = NULL; + OpenAPI_lnode_t *node = NULL; + + if (gba_authentication_info_result == NULL) { + ogs_error("OpenAPI_gba_authentication_info_result_convertToJSON() failed [GbaAuthenticationInfoResult]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (gba_authentication_info_result->_3g_aka_av) { + cJSON *_3g_aka_av_local_JSON = OpenAPI_model_3_g_aka_av_convertToJSON(gba_authentication_info_result->_3g_aka_av); + if (_3g_aka_av_local_JSON == NULL) { + ogs_error("OpenAPI_gba_authentication_info_result_convertToJSON() failed [_3g_aka_av]"); + goto end; + } + cJSON_AddItemToObject(item, "3gAkaAv", _3g_aka_av_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_gba_authentication_info_result_convertToJSON() failed [_3g_aka_av]"); + goto end; + } + } + + if (gba_authentication_info_result->supported_features) { + if (cJSON_AddStringToObject(item, "supportedFeatures", gba_authentication_info_result->supported_features) == NULL) { + ogs_error("OpenAPI_gba_authentication_info_result_convertToJSON() failed [supported_features]"); + goto end; + } + } + +end: + return item; +} + +OpenAPI_gba_authentication_info_result_t *OpenAPI_gba_authentication_info_result_parseFromJSON(cJSON *gba_authentication_info_resultJSON) +{ + OpenAPI_gba_authentication_info_result_t *gba_authentication_info_result_local_var = NULL; + OpenAPI_lnode_t *node = NULL; + cJSON *_3g_aka_av = NULL; + OpenAPI_model_3_g_aka_av_t *_3g_aka_av_local_nonprim = NULL; + cJSON *supported_features = NULL; + _3g_aka_av = cJSON_GetObjectItemCaseSensitive(gba_authentication_info_resultJSON, "3gAkaAv"); + if (_3g_aka_av) { + _3g_aka_av_local_nonprim = OpenAPI_model_3_g_aka_av_parseFromJSON(_3g_aka_av); + } + + supported_features = cJSON_GetObjectItemCaseSensitive(gba_authentication_info_resultJSON, "supportedFeatures"); + if (supported_features) { + if (!cJSON_IsString(supported_features) && !cJSON_IsNull(supported_features)) { + ogs_error("OpenAPI_gba_authentication_info_result_parseFromJSON() failed [supported_features]"); + goto end; + } + } + + gba_authentication_info_result_local_var = OpenAPI_gba_authentication_info_result_create ( + _3g_aka_av ? _3g_aka_av_local_nonprim : NULL, + supported_features && !cJSON_IsNull(supported_features) ? ogs_strdup(supported_features->valuestring) : NULL + ); + + return gba_authentication_info_result_local_var; +end: + if (_3g_aka_av_local_nonprim) { + OpenAPI_model_3_g_aka_av_free(_3g_aka_av_local_nonprim); + _3g_aka_av_local_nonprim = NULL; + } + return NULL; +} + +OpenAPI_gba_authentication_info_result_t *OpenAPI_gba_authentication_info_result_copy(OpenAPI_gba_authentication_info_result_t *dst, OpenAPI_gba_authentication_info_result_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_gba_authentication_info_result_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_gba_authentication_info_result_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_gba_authentication_info_result_free(dst); + dst = OpenAPI_gba_authentication_info_result_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/gba_authentication_info_result.h b/lib/sbi/openapi/model/gba_authentication_info_result.h new file mode 100644 index 000000000..9a7c5bf45 --- /dev/null +++ b/lib/sbi/openapi/model/gba_authentication_info_result.h @@ -0,0 +1,41 @@ +/* + * gba_authentication_info_result.h + * + * + */ + +#ifndef _OpenAPI_gba_authentication_info_result_H_ +#define _OpenAPI_gba_authentication_info_result_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "model_3_g_aka_av.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_gba_authentication_info_result_s OpenAPI_gba_authentication_info_result_t; +typedef struct OpenAPI_gba_authentication_info_result_s { + struct OpenAPI_model_3_g_aka_av_s *_3g_aka_av; + char *supported_features; +} OpenAPI_gba_authentication_info_result_t; + +OpenAPI_gba_authentication_info_result_t *OpenAPI_gba_authentication_info_result_create( + OpenAPI_model_3_g_aka_av_t *_3g_aka_av, + char *supported_features +); +void OpenAPI_gba_authentication_info_result_free(OpenAPI_gba_authentication_info_result_t *gba_authentication_info_result); +OpenAPI_gba_authentication_info_result_t *OpenAPI_gba_authentication_info_result_parseFromJSON(cJSON *gba_authentication_info_resultJSON); +cJSON *OpenAPI_gba_authentication_info_result_convertToJSON(OpenAPI_gba_authentication_info_result_t *gba_authentication_info_result); +OpenAPI_gba_authentication_info_result_t *OpenAPI_gba_authentication_info_result_copy(OpenAPI_gba_authentication_info_result_t *dst, OpenAPI_gba_authentication_info_result_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_gba_authentication_info_result_H_ */ + diff --git a/lib/sbi/openapi/model/gbr_qos_flow_information.h b/lib/sbi/openapi/model/gbr_qos_flow_information.h index 532997ed5..26465c8f1 100644 --- a/lib/sbi/openapi/model/gbr_qos_flow_information.h +++ b/lib/sbi/openapi/model/gbr_qos_flow_information.h @@ -1,7 +1,7 @@ /* * gbr_qos_flow_information.h * - * + * GBR QoS flow information */ #ifndef _OpenAPI_gbr_qos_flow_information_H_ diff --git a/lib/sbi/openapi/model/geo_service_area.c b/lib/sbi/openapi/model/geo_service_area.c new file mode 100644 index 000000000..25d8b953b --- /dev/null +++ b/lib/sbi/openapi/model/geo_service_area.c @@ -0,0 +1,207 @@ + +#include +#include +#include +#include "geo_service_area.h" + +OpenAPI_geo_service_area_t *OpenAPI_geo_service_area_create( + OpenAPI_list_t *geographic_area_list, + OpenAPI_list_t *civic_address_list +) +{ + OpenAPI_geo_service_area_t *geo_service_area_local_var = ogs_malloc(sizeof(OpenAPI_geo_service_area_t)); + ogs_assert(geo_service_area_local_var); + + geo_service_area_local_var->geographic_area_list = geographic_area_list; + geo_service_area_local_var->civic_address_list = civic_address_list; + + return geo_service_area_local_var; +} + +void OpenAPI_geo_service_area_free(OpenAPI_geo_service_area_t *geo_service_area) +{ + OpenAPI_lnode_t *node = NULL; + + if (NULL == geo_service_area) { + return; + } + if (geo_service_area->geographic_area_list) { + OpenAPI_list_for_each(geo_service_area->geographic_area_list, node) { + OpenAPI_geographic_area_free(node->data); + } + OpenAPI_list_free(geo_service_area->geographic_area_list); + geo_service_area->geographic_area_list = NULL; + } + if (geo_service_area->civic_address_list) { + OpenAPI_list_for_each(geo_service_area->civic_address_list, node) { + OpenAPI_civic_address_free(node->data); + } + OpenAPI_list_free(geo_service_area->civic_address_list); + geo_service_area->civic_address_list = NULL; + } + ogs_free(geo_service_area); +} + +cJSON *OpenAPI_geo_service_area_convertToJSON(OpenAPI_geo_service_area_t *geo_service_area) +{ + cJSON *item = NULL; + OpenAPI_lnode_t *node = NULL; + + if (geo_service_area == NULL) { + ogs_error("OpenAPI_geo_service_area_convertToJSON() failed [GeoServiceArea]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (geo_service_area->geographic_area_list) { + cJSON *geographic_area_listList = cJSON_AddArrayToObject(item, "geographicAreaList"); + if (geographic_area_listList == NULL) { + ogs_error("OpenAPI_geo_service_area_convertToJSON() failed [geographic_area_list]"); + goto end; + } + OpenAPI_list_for_each(geo_service_area->geographic_area_list, node) { + cJSON *itemLocal = OpenAPI_geographic_area_convertToJSON(node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_geo_service_area_convertToJSON() failed [geographic_area_list]"); + goto end; + } + cJSON_AddItemToArray(geographic_area_listList, itemLocal); + } + } + + if (geo_service_area->civic_address_list) { + cJSON *civic_address_listList = cJSON_AddArrayToObject(item, "civicAddressList"); + if (civic_address_listList == NULL) { + ogs_error("OpenAPI_geo_service_area_convertToJSON() failed [civic_address_list]"); + goto end; + } + OpenAPI_list_for_each(geo_service_area->civic_address_list, node) { + cJSON *itemLocal = OpenAPI_civic_address_convertToJSON(node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_geo_service_area_convertToJSON() failed [civic_address_list]"); + goto end; + } + cJSON_AddItemToArray(civic_address_listList, itemLocal); + } + } + +end: + return item; +} + +OpenAPI_geo_service_area_t *OpenAPI_geo_service_area_parseFromJSON(cJSON *geo_service_areaJSON) +{ + OpenAPI_geo_service_area_t *geo_service_area_local_var = NULL; + OpenAPI_lnode_t *node = NULL; + cJSON *geographic_area_list = NULL; + OpenAPI_list_t *geographic_area_listList = NULL; + cJSON *civic_address_list = NULL; + OpenAPI_list_t *civic_address_listList = NULL; + geographic_area_list = cJSON_GetObjectItemCaseSensitive(geo_service_areaJSON, "geographicAreaList"); + if (geographic_area_list) { + cJSON *geographic_area_list_local = NULL; + if (!cJSON_IsArray(geographic_area_list)) { + ogs_error("OpenAPI_geo_service_area_parseFromJSON() failed [geographic_area_list]"); + goto end; + } + + geographic_area_listList = OpenAPI_list_create(); + + cJSON_ArrayForEach(geographic_area_list_local, geographic_area_list) { + if (!cJSON_IsObject(geographic_area_list_local)) { + ogs_error("OpenAPI_geo_service_area_parseFromJSON() failed [geographic_area_list]"); + goto end; + } + OpenAPI_geographic_area_t *geographic_area_listItem = OpenAPI_geographic_area_parseFromJSON(geographic_area_list_local); + if (!geographic_area_listItem) { + ogs_error("No geographic_area_listItem"); + OpenAPI_list_free(geographic_area_listList); + goto end; + } + OpenAPI_list_add(geographic_area_listList, geographic_area_listItem); + } + } + + civic_address_list = cJSON_GetObjectItemCaseSensitive(geo_service_areaJSON, "civicAddressList"); + if (civic_address_list) { + cJSON *civic_address_list_local = NULL; + if (!cJSON_IsArray(civic_address_list)) { + ogs_error("OpenAPI_geo_service_area_parseFromJSON() failed [civic_address_list]"); + goto end; + } + + civic_address_listList = OpenAPI_list_create(); + + cJSON_ArrayForEach(civic_address_list_local, civic_address_list) { + if (!cJSON_IsObject(civic_address_list_local)) { + ogs_error("OpenAPI_geo_service_area_parseFromJSON() failed [civic_address_list]"); + goto end; + } + OpenAPI_civic_address_t *civic_address_listItem = OpenAPI_civic_address_parseFromJSON(civic_address_list_local); + if (!civic_address_listItem) { + ogs_error("No civic_address_listItem"); + OpenAPI_list_free(civic_address_listList); + goto end; + } + OpenAPI_list_add(civic_address_listList, civic_address_listItem); + } + } + + geo_service_area_local_var = OpenAPI_geo_service_area_create ( + geographic_area_list ? geographic_area_listList : NULL, + civic_address_list ? civic_address_listList : NULL + ); + + return geo_service_area_local_var; +end: + if (geographic_area_listList) { + OpenAPI_list_for_each(geographic_area_listList, node) { + OpenAPI_geographic_area_free(node->data); + } + OpenAPI_list_free(geographic_area_listList); + geographic_area_listList = NULL; + } + if (civic_address_listList) { + OpenAPI_list_for_each(civic_address_listList, node) { + OpenAPI_civic_address_free(node->data); + } + OpenAPI_list_free(civic_address_listList); + civic_address_listList = NULL; + } + return NULL; +} + +OpenAPI_geo_service_area_t *OpenAPI_geo_service_area_copy(OpenAPI_geo_service_area_t *dst, OpenAPI_geo_service_area_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_geo_service_area_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_geo_service_area_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_geo_service_area_free(dst); + dst = OpenAPI_geo_service_area_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/geo_service_area.h b/lib/sbi/openapi/model/geo_service_area.h new file mode 100644 index 000000000..a498a6e2f --- /dev/null +++ b/lib/sbi/openapi/model/geo_service_area.h @@ -0,0 +1,42 @@ +/* + * geo_service_area.h + * + * List of geographic area or list of civic address info + */ + +#ifndef _OpenAPI_geo_service_area_H_ +#define _OpenAPI_geo_service_area_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "civic_address.h" +#include "geographic_area.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_geo_service_area_s OpenAPI_geo_service_area_t; +typedef struct OpenAPI_geo_service_area_s { + OpenAPI_list_t *geographic_area_list; + OpenAPI_list_t *civic_address_list; +} OpenAPI_geo_service_area_t; + +OpenAPI_geo_service_area_t *OpenAPI_geo_service_area_create( + OpenAPI_list_t *geographic_area_list, + OpenAPI_list_t *civic_address_list +); +void OpenAPI_geo_service_area_free(OpenAPI_geo_service_area_t *geo_service_area); +OpenAPI_geo_service_area_t *OpenAPI_geo_service_area_parseFromJSON(cJSON *geo_service_areaJSON); +cJSON *OpenAPI_geo_service_area_convertToJSON(OpenAPI_geo_service_area_t *geo_service_area); +OpenAPI_geo_service_area_t *OpenAPI_geo_service_area_copy(OpenAPI_geo_service_area_t *dst, OpenAPI_geo_service_area_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_geo_service_area_H_ */ + diff --git a/lib/sbi/openapi/model/geo_service_area_1.c b/lib/sbi/openapi/model/geo_service_area_1.c new file mode 100644 index 000000000..1c2128bc0 --- /dev/null +++ b/lib/sbi/openapi/model/geo_service_area_1.c @@ -0,0 +1,207 @@ + +#include +#include +#include +#include "geo_service_area_1.h" + +OpenAPI_geo_service_area_1_t *OpenAPI_geo_service_area_1_create( + OpenAPI_list_t *geographic_area_list, + OpenAPI_list_t *civic_address_list +) +{ + OpenAPI_geo_service_area_1_t *geo_service_area_1_local_var = ogs_malloc(sizeof(OpenAPI_geo_service_area_1_t)); + ogs_assert(geo_service_area_1_local_var); + + geo_service_area_1_local_var->geographic_area_list = geographic_area_list; + geo_service_area_1_local_var->civic_address_list = civic_address_list; + + return geo_service_area_1_local_var; +} + +void OpenAPI_geo_service_area_1_free(OpenAPI_geo_service_area_1_t *geo_service_area_1) +{ + OpenAPI_lnode_t *node = NULL; + + if (NULL == geo_service_area_1) { + return; + } + if (geo_service_area_1->geographic_area_list) { + OpenAPI_list_for_each(geo_service_area_1->geographic_area_list, node) { + OpenAPI_geographic_area_free(node->data); + } + OpenAPI_list_free(geo_service_area_1->geographic_area_list); + geo_service_area_1->geographic_area_list = NULL; + } + if (geo_service_area_1->civic_address_list) { + OpenAPI_list_for_each(geo_service_area_1->civic_address_list, node) { + OpenAPI_civic_address_free(node->data); + } + OpenAPI_list_free(geo_service_area_1->civic_address_list); + geo_service_area_1->civic_address_list = NULL; + } + ogs_free(geo_service_area_1); +} + +cJSON *OpenAPI_geo_service_area_1_convertToJSON(OpenAPI_geo_service_area_1_t *geo_service_area_1) +{ + cJSON *item = NULL; + OpenAPI_lnode_t *node = NULL; + + if (geo_service_area_1 == NULL) { + ogs_error("OpenAPI_geo_service_area_1_convertToJSON() failed [GeoServiceArea_1]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (geo_service_area_1->geographic_area_list) { + cJSON *geographic_area_listList = cJSON_AddArrayToObject(item, "geographicAreaList"); + if (geographic_area_listList == NULL) { + ogs_error("OpenAPI_geo_service_area_1_convertToJSON() failed [geographic_area_list]"); + goto end; + } + OpenAPI_list_for_each(geo_service_area_1->geographic_area_list, node) { + cJSON *itemLocal = OpenAPI_geographic_area_convertToJSON(node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_geo_service_area_1_convertToJSON() failed [geographic_area_list]"); + goto end; + } + cJSON_AddItemToArray(geographic_area_listList, itemLocal); + } + } + + if (geo_service_area_1->civic_address_list) { + cJSON *civic_address_listList = cJSON_AddArrayToObject(item, "civicAddressList"); + if (civic_address_listList == NULL) { + ogs_error("OpenAPI_geo_service_area_1_convertToJSON() failed [civic_address_list]"); + goto end; + } + OpenAPI_list_for_each(geo_service_area_1->civic_address_list, node) { + cJSON *itemLocal = OpenAPI_civic_address_convertToJSON(node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_geo_service_area_1_convertToJSON() failed [civic_address_list]"); + goto end; + } + cJSON_AddItemToArray(civic_address_listList, itemLocal); + } + } + +end: + return item; +} + +OpenAPI_geo_service_area_1_t *OpenAPI_geo_service_area_1_parseFromJSON(cJSON *geo_service_area_1JSON) +{ + OpenAPI_geo_service_area_1_t *geo_service_area_1_local_var = NULL; + OpenAPI_lnode_t *node = NULL; + cJSON *geographic_area_list = NULL; + OpenAPI_list_t *geographic_area_listList = NULL; + cJSON *civic_address_list = NULL; + OpenAPI_list_t *civic_address_listList = NULL; + geographic_area_list = cJSON_GetObjectItemCaseSensitive(geo_service_area_1JSON, "geographicAreaList"); + if (geographic_area_list) { + cJSON *geographic_area_list_local = NULL; + if (!cJSON_IsArray(geographic_area_list)) { + ogs_error("OpenAPI_geo_service_area_1_parseFromJSON() failed [geographic_area_list]"); + goto end; + } + + geographic_area_listList = OpenAPI_list_create(); + + cJSON_ArrayForEach(geographic_area_list_local, geographic_area_list) { + if (!cJSON_IsObject(geographic_area_list_local)) { + ogs_error("OpenAPI_geo_service_area_1_parseFromJSON() failed [geographic_area_list]"); + goto end; + } + OpenAPI_geographic_area_t *geographic_area_listItem = OpenAPI_geographic_area_parseFromJSON(geographic_area_list_local); + if (!geographic_area_listItem) { + ogs_error("No geographic_area_listItem"); + OpenAPI_list_free(geographic_area_listList); + goto end; + } + OpenAPI_list_add(geographic_area_listList, geographic_area_listItem); + } + } + + civic_address_list = cJSON_GetObjectItemCaseSensitive(geo_service_area_1JSON, "civicAddressList"); + if (civic_address_list) { + cJSON *civic_address_list_local = NULL; + if (!cJSON_IsArray(civic_address_list)) { + ogs_error("OpenAPI_geo_service_area_1_parseFromJSON() failed [civic_address_list]"); + goto end; + } + + civic_address_listList = OpenAPI_list_create(); + + cJSON_ArrayForEach(civic_address_list_local, civic_address_list) { + if (!cJSON_IsObject(civic_address_list_local)) { + ogs_error("OpenAPI_geo_service_area_1_parseFromJSON() failed [civic_address_list]"); + goto end; + } + OpenAPI_civic_address_t *civic_address_listItem = OpenAPI_civic_address_parseFromJSON(civic_address_list_local); + if (!civic_address_listItem) { + ogs_error("No civic_address_listItem"); + OpenAPI_list_free(civic_address_listList); + goto end; + } + OpenAPI_list_add(civic_address_listList, civic_address_listItem); + } + } + + geo_service_area_1_local_var = OpenAPI_geo_service_area_1_create ( + geographic_area_list ? geographic_area_listList : NULL, + civic_address_list ? civic_address_listList : NULL + ); + + return geo_service_area_1_local_var; +end: + if (geographic_area_listList) { + OpenAPI_list_for_each(geographic_area_listList, node) { + OpenAPI_geographic_area_free(node->data); + } + OpenAPI_list_free(geographic_area_listList); + geographic_area_listList = NULL; + } + if (civic_address_listList) { + OpenAPI_list_for_each(civic_address_listList, node) { + OpenAPI_civic_address_free(node->data); + } + OpenAPI_list_free(civic_address_listList); + civic_address_listList = NULL; + } + return NULL; +} + +OpenAPI_geo_service_area_1_t *OpenAPI_geo_service_area_1_copy(OpenAPI_geo_service_area_1_t *dst, OpenAPI_geo_service_area_1_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_geo_service_area_1_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_geo_service_area_1_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_geo_service_area_1_free(dst); + dst = OpenAPI_geo_service_area_1_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/geo_service_area_1.h b/lib/sbi/openapi/model/geo_service_area_1.h new file mode 100644 index 000000000..8c31f33b5 --- /dev/null +++ b/lib/sbi/openapi/model/geo_service_area_1.h @@ -0,0 +1,42 @@ +/* + * geo_service_area_1.h + * + * List of geographic area or list of civic address info + */ + +#ifndef _OpenAPI_geo_service_area_1_H_ +#define _OpenAPI_geo_service_area_1_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "civic_address.h" +#include "geographic_area.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_geo_service_area_1_s OpenAPI_geo_service_area_1_t; +typedef struct OpenAPI_geo_service_area_1_s { + OpenAPI_list_t *geographic_area_list; + OpenAPI_list_t *civic_address_list; +} OpenAPI_geo_service_area_1_t; + +OpenAPI_geo_service_area_1_t *OpenAPI_geo_service_area_1_create( + OpenAPI_list_t *geographic_area_list, + OpenAPI_list_t *civic_address_list +); +void OpenAPI_geo_service_area_1_free(OpenAPI_geo_service_area_1_t *geo_service_area_1); +OpenAPI_geo_service_area_1_t *OpenAPI_geo_service_area_1_parseFromJSON(cJSON *geo_service_area_1JSON); +cJSON *OpenAPI_geo_service_area_1_convertToJSON(OpenAPI_geo_service_area_1_t *geo_service_area_1); +OpenAPI_geo_service_area_1_t *OpenAPI_geo_service_area_1_copy(OpenAPI_geo_service_area_1_t *dst, OpenAPI_geo_service_area_1_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_geo_service_area_1_H_ */ + diff --git a/lib/sbi/openapi/model/geographic_area.h b/lib/sbi/openapi/model/geographic_area.h index 3ee6d5b67..068b7b4fd 100644 --- a/lib/sbi/openapi/model/geographic_area.h +++ b/lib/sbi/openapi/model/geographic_area.h @@ -1,7 +1,7 @@ /* * geographic_area.h * - * + * Geographic area specified by different shape. */ #ifndef _OpenAPI_geographic_area_H_ diff --git a/lib/sbi/openapi/model/geographical_area.c b/lib/sbi/openapi/model/geographical_area.c new file mode 100644 index 000000000..db5e16b34 --- /dev/null +++ b/lib/sbi/openapi/model/geographical_area.c @@ -0,0 +1,149 @@ + +#include +#include +#include +#include "geographical_area.h" + +OpenAPI_geographical_area_t *OpenAPI_geographical_area_create( + OpenAPI_civic_address_t *civic_address, + OpenAPI_geographic_area_t *shapes +) +{ + OpenAPI_geographical_area_t *geographical_area_local_var = ogs_malloc(sizeof(OpenAPI_geographical_area_t)); + ogs_assert(geographical_area_local_var); + + geographical_area_local_var->civic_address = civic_address; + geographical_area_local_var->shapes = shapes; + + return geographical_area_local_var; +} + +void OpenAPI_geographical_area_free(OpenAPI_geographical_area_t *geographical_area) +{ + OpenAPI_lnode_t *node = NULL; + + if (NULL == geographical_area) { + return; + } + if (geographical_area->civic_address) { + OpenAPI_civic_address_free(geographical_area->civic_address); + geographical_area->civic_address = NULL; + } + if (geographical_area->shapes) { + OpenAPI_geographic_area_free(geographical_area->shapes); + geographical_area->shapes = NULL; + } + ogs_free(geographical_area); +} + +cJSON *OpenAPI_geographical_area_convertToJSON(OpenAPI_geographical_area_t *geographical_area) +{ + cJSON *item = NULL; + OpenAPI_lnode_t *node = NULL; + + if (geographical_area == NULL) { + ogs_error("OpenAPI_geographical_area_convertToJSON() failed [GeographicalArea]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (geographical_area->civic_address) { + cJSON *civic_address_local_JSON = OpenAPI_civic_address_convertToJSON(geographical_area->civic_address); + if (civic_address_local_JSON == NULL) { + ogs_error("OpenAPI_geographical_area_convertToJSON() failed [civic_address]"); + goto end; + } + cJSON_AddItemToObject(item, "civicAddress", civic_address_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_geographical_area_convertToJSON() failed [civic_address]"); + goto end; + } + } + + if (geographical_area->shapes) { + cJSON *shapes_local_JSON = OpenAPI_geographic_area_convertToJSON(geographical_area->shapes); + if (shapes_local_JSON == NULL) { + ogs_error("OpenAPI_geographical_area_convertToJSON() failed [shapes]"); + goto end; + } + cJSON_AddItemToObject(item, "shapes", shapes_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_geographical_area_convertToJSON() failed [shapes]"); + goto end; + } + } + +end: + return item; +} + +OpenAPI_geographical_area_t *OpenAPI_geographical_area_parseFromJSON(cJSON *geographical_areaJSON) +{ + OpenAPI_geographical_area_t *geographical_area_local_var = NULL; + OpenAPI_lnode_t *node = NULL; + cJSON *civic_address = NULL; + OpenAPI_civic_address_t *civic_address_local_nonprim = NULL; + cJSON *shapes = NULL; + OpenAPI_geographic_area_t *shapes_local_nonprim = NULL; + civic_address = cJSON_GetObjectItemCaseSensitive(geographical_areaJSON, "civicAddress"); + if (civic_address) { + civic_address_local_nonprim = OpenAPI_civic_address_parseFromJSON(civic_address); + } + + shapes = cJSON_GetObjectItemCaseSensitive(geographical_areaJSON, "shapes"); + if (shapes) { + shapes_local_nonprim = OpenAPI_geographic_area_parseFromJSON(shapes); + } + + geographical_area_local_var = OpenAPI_geographical_area_create ( + civic_address ? civic_address_local_nonprim : NULL, + shapes ? shapes_local_nonprim : NULL + ); + + return geographical_area_local_var; +end: + if (civic_address_local_nonprim) { + OpenAPI_civic_address_free(civic_address_local_nonprim); + civic_address_local_nonprim = NULL; + } + if (shapes_local_nonprim) { + OpenAPI_geographic_area_free(shapes_local_nonprim); + shapes_local_nonprim = NULL; + } + return NULL; +} + +OpenAPI_geographical_area_t *OpenAPI_geographical_area_copy(OpenAPI_geographical_area_t *dst, OpenAPI_geographical_area_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_geographical_area_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_geographical_area_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_geographical_area_free(dst); + dst = OpenAPI_geographical_area_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/geographical_area.h b/lib/sbi/openapi/model/geographical_area.h new file mode 100644 index 000000000..8322149c8 --- /dev/null +++ b/lib/sbi/openapi/model/geographical_area.h @@ -0,0 +1,42 @@ +/* + * geographical_area.h + * + * Contains geographical area information (e.g.a civic address or shapes). + */ + +#ifndef _OpenAPI_geographical_area_H_ +#define _OpenAPI_geographical_area_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "civic_address.h" +#include "geographic_area.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_geographical_area_s OpenAPI_geographical_area_t; +typedef struct OpenAPI_geographical_area_s { + struct OpenAPI_civic_address_s *civic_address; + struct OpenAPI_geographic_area_s *shapes; +} OpenAPI_geographical_area_t; + +OpenAPI_geographical_area_t *OpenAPI_geographical_area_create( + OpenAPI_civic_address_t *civic_address, + OpenAPI_geographic_area_t *shapes +); +void OpenAPI_geographical_area_free(OpenAPI_geographical_area_t *geographical_area); +OpenAPI_geographical_area_t *OpenAPI_geographical_area_parseFromJSON(cJSON *geographical_areaJSON); +cJSON *OpenAPI_geographical_area_convertToJSON(OpenAPI_geographical_area_t *geographical_area); +OpenAPI_geographical_area_t *OpenAPI_geographical_area_copy(OpenAPI_geographical_area_t *dst, OpenAPI_geographical_area_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_geographical_area_H_ */ + diff --git a/lib/sbi/openapi/model/geographical_coordinates.h b/lib/sbi/openapi/model/geographical_coordinates.h index 46bf0de6a..53f27fab2 100644 --- a/lib/sbi/openapi/model/geographical_coordinates.h +++ b/lib/sbi/openapi/model/geographical_coordinates.h @@ -1,7 +1,7 @@ /* * geographical_coordinates.h * - * + * Geographical coordinates. */ #ifndef _OpenAPI_geographical_coordinates_H_ diff --git a/lib/sbi/openapi/model/gera_location.c b/lib/sbi/openapi/model/gera_location.c new file mode 100644 index 000000000..cbe1c7dd2 --- /dev/null +++ b/lib/sbi/openapi/model/gera_location.c @@ -0,0 +1,371 @@ + +#include +#include +#include +#include "gera_location.h" + +OpenAPI_gera_location_t *OpenAPI_gera_location_create( + char *location_number, + OpenAPI_cell_global_id_t *cgi, + OpenAPI_routing_area_id_t *rai, + OpenAPI_service_area_id_t *sai, + OpenAPI_location_area_id_t *lai, + char *vlr_number, + char *msc_number, + bool is_age_of_location_information, + int age_of_location_information, + char *ue_location_timestamp, + char *geographical_information, + char *geodetic_information +) +{ + OpenAPI_gera_location_t *gera_location_local_var = ogs_malloc(sizeof(OpenAPI_gera_location_t)); + ogs_assert(gera_location_local_var); + + gera_location_local_var->location_number = location_number; + gera_location_local_var->cgi = cgi; + gera_location_local_var->rai = rai; + gera_location_local_var->sai = sai; + gera_location_local_var->lai = lai; + gera_location_local_var->vlr_number = vlr_number; + gera_location_local_var->msc_number = msc_number; + gera_location_local_var->is_age_of_location_information = is_age_of_location_information; + gera_location_local_var->age_of_location_information = age_of_location_information; + gera_location_local_var->ue_location_timestamp = ue_location_timestamp; + gera_location_local_var->geographical_information = geographical_information; + gera_location_local_var->geodetic_information = geodetic_information; + + return gera_location_local_var; +} + +void OpenAPI_gera_location_free(OpenAPI_gera_location_t *gera_location) +{ + OpenAPI_lnode_t *node = NULL; + + if (NULL == gera_location) { + return; + } + if (gera_location->location_number) { + ogs_free(gera_location->location_number); + gera_location->location_number = NULL; + } + if (gera_location->cgi) { + OpenAPI_cell_global_id_free(gera_location->cgi); + gera_location->cgi = NULL; + } + if (gera_location->rai) { + OpenAPI_routing_area_id_free(gera_location->rai); + gera_location->rai = NULL; + } + if (gera_location->sai) { + OpenAPI_service_area_id_free(gera_location->sai); + gera_location->sai = NULL; + } + if (gera_location->lai) { + OpenAPI_location_area_id_free(gera_location->lai); + gera_location->lai = NULL; + } + if (gera_location->vlr_number) { + ogs_free(gera_location->vlr_number); + gera_location->vlr_number = NULL; + } + if (gera_location->msc_number) { + ogs_free(gera_location->msc_number); + gera_location->msc_number = NULL; + } + if (gera_location->ue_location_timestamp) { + ogs_free(gera_location->ue_location_timestamp); + gera_location->ue_location_timestamp = NULL; + } + if (gera_location->geographical_information) { + ogs_free(gera_location->geographical_information); + gera_location->geographical_information = NULL; + } + if (gera_location->geodetic_information) { + ogs_free(gera_location->geodetic_information); + gera_location->geodetic_information = NULL; + } + ogs_free(gera_location); +} + +cJSON *OpenAPI_gera_location_convertToJSON(OpenAPI_gera_location_t *gera_location) +{ + cJSON *item = NULL; + OpenAPI_lnode_t *node = NULL; + + if (gera_location == NULL) { + ogs_error("OpenAPI_gera_location_convertToJSON() failed [GeraLocation]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (gera_location->location_number) { + if (cJSON_AddStringToObject(item, "locationNumber", gera_location->location_number) == NULL) { + ogs_error("OpenAPI_gera_location_convertToJSON() failed [location_number]"); + goto end; + } + } + + if (gera_location->cgi) { + cJSON *cgi_local_JSON = OpenAPI_cell_global_id_convertToJSON(gera_location->cgi); + if (cgi_local_JSON == NULL) { + ogs_error("OpenAPI_gera_location_convertToJSON() failed [cgi]"); + goto end; + } + cJSON_AddItemToObject(item, "cgi", cgi_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_gera_location_convertToJSON() failed [cgi]"); + goto end; + } + } + + if (gera_location->rai) { + cJSON *rai_local_JSON = OpenAPI_routing_area_id_convertToJSON(gera_location->rai); + if (rai_local_JSON == NULL) { + ogs_error("OpenAPI_gera_location_convertToJSON() failed [rai]"); + goto end; + } + cJSON_AddItemToObject(item, "rai", rai_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_gera_location_convertToJSON() failed [rai]"); + goto end; + } + } + + if (gera_location->sai) { + cJSON *sai_local_JSON = OpenAPI_service_area_id_convertToJSON(gera_location->sai); + if (sai_local_JSON == NULL) { + ogs_error("OpenAPI_gera_location_convertToJSON() failed [sai]"); + goto end; + } + cJSON_AddItemToObject(item, "sai", sai_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_gera_location_convertToJSON() failed [sai]"); + goto end; + } + } + + if (gera_location->lai) { + cJSON *lai_local_JSON = OpenAPI_location_area_id_convertToJSON(gera_location->lai); + if (lai_local_JSON == NULL) { + ogs_error("OpenAPI_gera_location_convertToJSON() failed [lai]"); + goto end; + } + cJSON_AddItemToObject(item, "lai", lai_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_gera_location_convertToJSON() failed [lai]"); + goto end; + } + } + + if (gera_location->vlr_number) { + if (cJSON_AddStringToObject(item, "vlrNumber", gera_location->vlr_number) == NULL) { + ogs_error("OpenAPI_gera_location_convertToJSON() failed [vlr_number]"); + goto end; + } + } + + if (gera_location->msc_number) { + if (cJSON_AddStringToObject(item, "mscNumber", gera_location->msc_number) == NULL) { + ogs_error("OpenAPI_gera_location_convertToJSON() failed [msc_number]"); + goto end; + } + } + + if (gera_location->is_age_of_location_information) { + if (cJSON_AddNumberToObject(item, "ageOfLocationInformation", gera_location->age_of_location_information) == NULL) { + ogs_error("OpenAPI_gera_location_convertToJSON() failed [age_of_location_information]"); + goto end; + } + } + + if (gera_location->ue_location_timestamp) { + if (cJSON_AddStringToObject(item, "ueLocationTimestamp", gera_location->ue_location_timestamp) == NULL) { + ogs_error("OpenAPI_gera_location_convertToJSON() failed [ue_location_timestamp]"); + goto end; + } + } + + if (gera_location->geographical_information) { + if (cJSON_AddStringToObject(item, "geographicalInformation", gera_location->geographical_information) == NULL) { + ogs_error("OpenAPI_gera_location_convertToJSON() failed [geographical_information]"); + goto end; + } + } + + if (gera_location->geodetic_information) { + if (cJSON_AddStringToObject(item, "geodeticInformation", gera_location->geodetic_information) == NULL) { + ogs_error("OpenAPI_gera_location_convertToJSON() failed [geodetic_information]"); + goto end; + } + } + +end: + return item; +} + +OpenAPI_gera_location_t *OpenAPI_gera_location_parseFromJSON(cJSON *gera_locationJSON) +{ + OpenAPI_gera_location_t *gera_location_local_var = NULL; + OpenAPI_lnode_t *node = NULL; + cJSON *location_number = NULL; + cJSON *cgi = NULL; + OpenAPI_cell_global_id_t *cgi_local_nonprim = NULL; + cJSON *rai = NULL; + OpenAPI_routing_area_id_t *rai_local_nonprim = NULL; + cJSON *sai = NULL; + OpenAPI_service_area_id_t *sai_local_nonprim = NULL; + cJSON *lai = NULL; + OpenAPI_location_area_id_t *lai_local_nonprim = NULL; + cJSON *vlr_number = NULL; + cJSON *msc_number = NULL; + cJSON *age_of_location_information = NULL; + cJSON *ue_location_timestamp = NULL; + cJSON *geographical_information = NULL; + cJSON *geodetic_information = NULL; + location_number = cJSON_GetObjectItemCaseSensitive(gera_locationJSON, "locationNumber"); + if (location_number) { + if (!cJSON_IsString(location_number) && !cJSON_IsNull(location_number)) { + ogs_error("OpenAPI_gera_location_parseFromJSON() failed [location_number]"); + goto end; + } + } + + cgi = cJSON_GetObjectItemCaseSensitive(gera_locationJSON, "cgi"); + if (cgi) { + cgi_local_nonprim = OpenAPI_cell_global_id_parseFromJSON(cgi); + } + + rai = cJSON_GetObjectItemCaseSensitive(gera_locationJSON, "rai"); + if (rai) { + rai_local_nonprim = OpenAPI_routing_area_id_parseFromJSON(rai); + } + + sai = cJSON_GetObjectItemCaseSensitive(gera_locationJSON, "sai"); + if (sai) { + sai_local_nonprim = OpenAPI_service_area_id_parseFromJSON(sai); + } + + lai = cJSON_GetObjectItemCaseSensitive(gera_locationJSON, "lai"); + if (lai) { + lai_local_nonprim = OpenAPI_location_area_id_parseFromJSON(lai); + } + + vlr_number = cJSON_GetObjectItemCaseSensitive(gera_locationJSON, "vlrNumber"); + if (vlr_number) { + if (!cJSON_IsString(vlr_number) && !cJSON_IsNull(vlr_number)) { + ogs_error("OpenAPI_gera_location_parseFromJSON() failed [vlr_number]"); + goto end; + } + } + + msc_number = cJSON_GetObjectItemCaseSensitive(gera_locationJSON, "mscNumber"); + if (msc_number) { + if (!cJSON_IsString(msc_number) && !cJSON_IsNull(msc_number)) { + ogs_error("OpenAPI_gera_location_parseFromJSON() failed [msc_number]"); + goto end; + } + } + + age_of_location_information = cJSON_GetObjectItemCaseSensitive(gera_locationJSON, "ageOfLocationInformation"); + if (age_of_location_information) { + if (!cJSON_IsNumber(age_of_location_information)) { + ogs_error("OpenAPI_gera_location_parseFromJSON() failed [age_of_location_information]"); + goto end; + } + } + + ue_location_timestamp = cJSON_GetObjectItemCaseSensitive(gera_locationJSON, "ueLocationTimestamp"); + if (ue_location_timestamp) { + if (!cJSON_IsString(ue_location_timestamp) && !cJSON_IsNull(ue_location_timestamp)) { + ogs_error("OpenAPI_gera_location_parseFromJSON() failed [ue_location_timestamp]"); + goto end; + } + } + + geographical_information = cJSON_GetObjectItemCaseSensitive(gera_locationJSON, "geographicalInformation"); + if (geographical_information) { + if (!cJSON_IsString(geographical_information) && !cJSON_IsNull(geographical_information)) { + ogs_error("OpenAPI_gera_location_parseFromJSON() failed [geographical_information]"); + goto end; + } + } + + geodetic_information = cJSON_GetObjectItemCaseSensitive(gera_locationJSON, "geodeticInformation"); + if (geodetic_information) { + if (!cJSON_IsString(geodetic_information) && !cJSON_IsNull(geodetic_information)) { + ogs_error("OpenAPI_gera_location_parseFromJSON() failed [geodetic_information]"); + goto end; + } + } + + gera_location_local_var = OpenAPI_gera_location_create ( + location_number && !cJSON_IsNull(location_number) ? ogs_strdup(location_number->valuestring) : NULL, + cgi ? cgi_local_nonprim : NULL, + rai ? rai_local_nonprim : NULL, + sai ? sai_local_nonprim : NULL, + lai ? lai_local_nonprim : NULL, + vlr_number && !cJSON_IsNull(vlr_number) ? ogs_strdup(vlr_number->valuestring) : NULL, + msc_number && !cJSON_IsNull(msc_number) ? ogs_strdup(msc_number->valuestring) : NULL, + age_of_location_information ? true : false, + age_of_location_information ? age_of_location_information->valuedouble : 0, + ue_location_timestamp && !cJSON_IsNull(ue_location_timestamp) ? ogs_strdup(ue_location_timestamp->valuestring) : NULL, + geographical_information && !cJSON_IsNull(geographical_information) ? ogs_strdup(geographical_information->valuestring) : NULL, + geodetic_information && !cJSON_IsNull(geodetic_information) ? ogs_strdup(geodetic_information->valuestring) : NULL + ); + + return gera_location_local_var; +end: + if (cgi_local_nonprim) { + OpenAPI_cell_global_id_free(cgi_local_nonprim); + cgi_local_nonprim = NULL; + } + if (rai_local_nonprim) { + OpenAPI_routing_area_id_free(rai_local_nonprim); + rai_local_nonprim = NULL; + } + if (sai_local_nonprim) { + OpenAPI_service_area_id_free(sai_local_nonprim); + sai_local_nonprim = NULL; + } + if (lai_local_nonprim) { + OpenAPI_location_area_id_free(lai_local_nonprim); + lai_local_nonprim = NULL; + } + return NULL; +} + +OpenAPI_gera_location_t *OpenAPI_gera_location_copy(OpenAPI_gera_location_t *dst, OpenAPI_gera_location_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_gera_location_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_gera_location_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_gera_location_free(dst); + dst = OpenAPI_gera_location_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/gera_location.h b/lib/sbi/openapi/model/gera_location.h new file mode 100644 index 000000000..6961fad4a --- /dev/null +++ b/lib/sbi/openapi/model/gera_location.h @@ -0,0 +1,64 @@ +/* + * gera_location.h + * + * Exactly one of cgi, sai or lai shall be present. + */ + +#ifndef _OpenAPI_gera_location_H_ +#define _OpenAPI_gera_location_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "cell_global_id.h" +#include "location_area_id.h" +#include "routing_area_id.h" +#include "service_area_id.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_gera_location_s OpenAPI_gera_location_t; +typedef struct OpenAPI_gera_location_s { + char *location_number; + struct OpenAPI_cell_global_id_s *cgi; + struct OpenAPI_routing_area_id_s *rai; + struct OpenAPI_service_area_id_s *sai; + struct OpenAPI_location_area_id_s *lai; + char *vlr_number; + char *msc_number; + bool is_age_of_location_information; + int age_of_location_information; + char *ue_location_timestamp; + char *geographical_information; + char *geodetic_information; +} OpenAPI_gera_location_t; + +OpenAPI_gera_location_t *OpenAPI_gera_location_create( + char *location_number, + OpenAPI_cell_global_id_t *cgi, + OpenAPI_routing_area_id_t *rai, + OpenAPI_service_area_id_t *sai, + OpenAPI_location_area_id_t *lai, + char *vlr_number, + char *msc_number, + bool is_age_of_location_information, + int age_of_location_information, + char *ue_location_timestamp, + char *geographical_information, + char *geodetic_information +); +void OpenAPI_gera_location_free(OpenAPI_gera_location_t *gera_location); +OpenAPI_gera_location_t *OpenAPI_gera_location_parseFromJSON(cJSON *gera_locationJSON); +cJSON *OpenAPI_gera_location_convertToJSON(OpenAPI_gera_location_t *gera_location); +OpenAPI_gera_location_t *OpenAPI_gera_location_copy(OpenAPI_gera_location_t *dst, OpenAPI_gera_location_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_gera_location_H_ */ + diff --git a/lib/sbi/openapi/model/get_multiple_pp_data_entries_ue_id_parameter.c b/lib/sbi/openapi/model/get_multiple_pp_data_entries_ue_id_parameter.c new file mode 100644 index 000000000..8a99b9f2e --- /dev/null +++ b/lib/sbi/openapi/model/get_multiple_pp_data_entries_ue_id_parameter.c @@ -0,0 +1,87 @@ + +#include +#include +#include +#include "get_multiple_pp_data_entries_ue_id_parameter.h" + +OpenAPI_get_multiple_pp_data_entries_ue_id_parameter_t *OpenAPI_get_multiple_pp_data_entries_ue_id_parameter_create( +) +{ + OpenAPI_get_multiple_pp_data_entries_ue_id_parameter_t *get_multiple_pp_data_entries_ue_id_parameter_local_var = ogs_malloc(sizeof(OpenAPI_get_multiple_pp_data_entries_ue_id_parameter_t)); + ogs_assert(get_multiple_pp_data_entries_ue_id_parameter_local_var); + + + return get_multiple_pp_data_entries_ue_id_parameter_local_var; +} + +void OpenAPI_get_multiple_pp_data_entries_ue_id_parameter_free(OpenAPI_get_multiple_pp_data_entries_ue_id_parameter_t *get_multiple_pp_data_entries_ue_id_parameter) +{ + OpenAPI_lnode_t *node = NULL; + + if (NULL == get_multiple_pp_data_entries_ue_id_parameter) { + return; + } + ogs_free(get_multiple_pp_data_entries_ue_id_parameter); +} + +cJSON *OpenAPI_get_multiple_pp_data_entries_ue_id_parameter_convertToJSON(OpenAPI_get_multiple_pp_data_entries_ue_id_parameter_t *get_multiple_pp_data_entries_ue_id_parameter) +{ + cJSON *item = NULL; + OpenAPI_lnode_t *node = NULL; + + if (get_multiple_pp_data_entries_ue_id_parameter == NULL) { + ogs_error("OpenAPI_get_multiple_pp_data_entries_ue_id_parameter_convertToJSON() failed [Get_Multiple_PP_Data_Entries_ueId_parameter]"); + return NULL; + } + + item = cJSON_CreateObject(); +end: + return item; +} + +OpenAPI_get_multiple_pp_data_entries_ue_id_parameter_t *OpenAPI_get_multiple_pp_data_entries_ue_id_parameter_parseFromJSON(cJSON *get_multiple_pp_data_entries_ue_id_parameterJSON) +{ + OpenAPI_get_multiple_pp_data_entries_ue_id_parameter_t *get_multiple_pp_data_entries_ue_id_parameter_local_var = NULL; + OpenAPI_lnode_t *node = NULL; + get_multiple_pp_data_entries_ue_id_parameter_local_var = OpenAPI_get_multiple_pp_data_entries_ue_id_parameter_create ( + ); + + return get_multiple_pp_data_entries_ue_id_parameter_local_var; +end: + return NULL; +} + +OpenAPI_get_multiple_pp_data_entries_ue_id_parameter_t *OpenAPI_get_multiple_pp_data_entries_ue_id_parameter_copy(OpenAPI_get_multiple_pp_data_entries_ue_id_parameter_t *dst, OpenAPI_get_multiple_pp_data_entries_ue_id_parameter_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_get_multiple_pp_data_entries_ue_id_parameter_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_get_multiple_pp_data_entries_ue_id_parameter_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_get_multiple_pp_data_entries_ue_id_parameter_free(dst); + dst = OpenAPI_get_multiple_pp_data_entries_ue_id_parameter_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/get_multiple_pp_data_entries_ue_id_parameter.h b/lib/sbi/openapi/model/get_multiple_pp_data_entries_ue_id_parameter.h new file mode 100644 index 000000000..bbc3256b1 --- /dev/null +++ b/lib/sbi/openapi/model/get_multiple_pp_data_entries_ue_id_parameter.h @@ -0,0 +1,36 @@ +/* + * get_multiple_pp_data_entries_ue_id_parameter.h + * + * + */ + +#ifndef _OpenAPI_get_multiple_pp_data_entries_ue_id_parameter_H_ +#define _OpenAPI_get_multiple_pp_data_entries_ue_id_parameter_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_get_multiple_pp_data_entries_ue_id_parameter_s OpenAPI_get_multiple_pp_data_entries_ue_id_parameter_t; +typedef struct OpenAPI_get_multiple_pp_data_entries_ue_id_parameter_s { +} OpenAPI_get_multiple_pp_data_entries_ue_id_parameter_t; + +OpenAPI_get_multiple_pp_data_entries_ue_id_parameter_t *OpenAPI_get_multiple_pp_data_entries_ue_id_parameter_create( +); +void OpenAPI_get_multiple_pp_data_entries_ue_id_parameter_free(OpenAPI_get_multiple_pp_data_entries_ue_id_parameter_t *get_multiple_pp_data_entries_ue_id_parameter); +OpenAPI_get_multiple_pp_data_entries_ue_id_parameter_t *OpenAPI_get_multiple_pp_data_entries_ue_id_parameter_parseFromJSON(cJSON *get_multiple_pp_data_entries_ue_id_parameterJSON); +cJSON *OpenAPI_get_multiple_pp_data_entries_ue_id_parameter_convertToJSON(OpenAPI_get_multiple_pp_data_entries_ue_id_parameter_t *get_multiple_pp_data_entries_ue_id_parameter); +OpenAPI_get_multiple_pp_data_entries_ue_id_parameter_t *OpenAPI_get_multiple_pp_data_entries_ue_id_parameter_copy(OpenAPI_get_multiple_pp_data_entries_ue_id_parameter_t *dst, OpenAPI_get_multiple_pp_data_entries_ue_id_parameter_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_get_multiple_pp_data_entries_ue_id_parameter_H_ */ + diff --git a/lib/sbi/openapi/model/get_nf_instances_200_response.h b/lib/sbi/openapi/model/get_nf_instances_200_response.h deleted file mode 100644 index d488bd5e3..000000000 --- a/lib/sbi/openapi/model/get_nf_instances_200_response.h +++ /dev/null @@ -1,39 +0,0 @@ -/* - * get_nf_instances_200_response.h - * - * - */ - -#ifndef _OpenAPI_get_nf_instances_200_response_H_ -#define _OpenAPI_get_nf_instances_200_response_H_ - -#include -#include "../external/cJSON.h" -#include "../include/list.h" -#include "../include/keyValuePair.h" -#include "../include/binary.h" -#include "links_value_schema.h" - -#ifdef __cplusplus -extern "C" { -#endif - -typedef struct OpenAPI_get_nf_instances_200_response_s OpenAPI_get_nf_instances_200_response_t; -typedef struct OpenAPI_get_nf_instances_200_response_s { - OpenAPI_list_t* _links; -} OpenAPI_get_nf_instances_200_response_t; - -OpenAPI_get_nf_instances_200_response_t *OpenAPI_get_nf_instances_200_response_create( - OpenAPI_list_t* _links -); -void OpenAPI_get_nf_instances_200_response_free(OpenAPI_get_nf_instances_200_response_t *get_nf_instances_200_response); -OpenAPI_get_nf_instances_200_response_t *OpenAPI_get_nf_instances_200_response_parseFromJSON(cJSON *get_nf_instances_200_responseJSON); -cJSON *OpenAPI_get_nf_instances_200_response_convertToJSON(OpenAPI_get_nf_instances_200_response_t *get_nf_instances_200_response); -OpenAPI_get_nf_instances_200_response_t *OpenAPI_get_nf_instances_200_response_copy(OpenAPI_get_nf_instances_200_response_t *dst, OpenAPI_get_nf_instances_200_response_t *src); - -#ifdef __cplusplus -} -#endif - -#endif /* _OpenAPI_get_nf_instances_200_response_H_ */ - diff --git a/lib/sbi/openapi/model/global_ran_node_id.h b/lib/sbi/openapi/model/global_ran_node_id.h index fd600f87b..9fc1b4697 100644 --- a/lib/sbi/openapi/model/global_ran_node_id.h +++ b/lib/sbi/openapi/model/global_ran_node_id.h @@ -1,7 +1,7 @@ /* * global_ran_node_id.h * - * + * One of the six attributes n3IwfId, gNbIdm, ngeNbId, wagfId, tngfId, eNbId shall be present. */ #ifndef _OpenAPI_global_ran_node_id_H_ diff --git a/lib/sbi/openapi/model/global_ran_node_id_1.h b/lib/sbi/openapi/model/global_ran_node_id_1.h index 4228cc145..13d347b8a 100644 --- a/lib/sbi/openapi/model/global_ran_node_id_1.h +++ b/lib/sbi/openapi/model/global_ran_node_id_1.h @@ -1,7 +1,7 @@ /* * global_ran_node_id_1.h * - * + * One of the six attributes n3IwfId, gNbIdm, ngeNbId, wagfId, tngfId, eNbId shall be present. */ #ifndef _OpenAPI_global_ran_node_id_1_H_ diff --git a/lib/sbi/openapi/model/gmlc_info.c b/lib/sbi/openapi/model/gmlc_info.c index 6b829acdb..f6f9a958d 100644 --- a/lib/sbi/openapi/model/gmlc_info.c +++ b/lib/sbi/openapi/model/gmlc_info.c @@ -5,13 +5,15 @@ #include "gmlc_info.h" OpenAPI_gmlc_info_t *OpenAPI_gmlc_info_create( - OpenAPI_list_t *serving_client_types + OpenAPI_list_t *serving_client_types, + OpenAPI_list_t *gmlc_numbers ) { OpenAPI_gmlc_info_t *gmlc_info_local_var = ogs_malloc(sizeof(OpenAPI_gmlc_info_t)); ogs_assert(gmlc_info_local_var); gmlc_info_local_var->serving_client_types = serving_client_types; + gmlc_info_local_var->gmlc_numbers = gmlc_numbers; return gmlc_info_local_var; } @@ -30,6 +32,13 @@ void OpenAPI_gmlc_info_free(OpenAPI_gmlc_info_t *gmlc_info) OpenAPI_list_free(gmlc_info->serving_client_types); gmlc_info->serving_client_types = NULL; } + if (gmlc_info->gmlc_numbers) { + OpenAPI_list_for_each(gmlc_info->gmlc_numbers, node) { + ogs_free(node->data); + } + OpenAPI_list_free(gmlc_info->gmlc_numbers); + gmlc_info->gmlc_numbers = NULL; + } ogs_free(gmlc_info); } @@ -60,6 +69,20 @@ cJSON *OpenAPI_gmlc_info_convertToJSON(OpenAPI_gmlc_info_t *gmlc_info) } } + if (gmlc_info->gmlc_numbers) { + cJSON *gmlc_numbersList = cJSON_AddArrayToObject(item, "gmlcNumbers"); + if (gmlc_numbersList == NULL) { + ogs_error("OpenAPI_gmlc_info_convertToJSON() failed [gmlc_numbers]"); + goto end; + } + OpenAPI_list_for_each(gmlc_info->gmlc_numbers, node) { + if (cJSON_AddStringToObject(gmlc_numbersList, "", (char*)node->data) == NULL) { + ogs_error("OpenAPI_gmlc_info_convertToJSON() failed [gmlc_numbers]"); + goto end; + } + } + } + end: return item; } @@ -70,6 +93,8 @@ OpenAPI_gmlc_info_t *OpenAPI_gmlc_info_parseFromJSON(cJSON *gmlc_infoJSON) OpenAPI_lnode_t *node = NULL; cJSON *serving_client_types = NULL; OpenAPI_list_t *serving_client_typesList = NULL; + cJSON *gmlc_numbers = NULL; + OpenAPI_list_t *gmlc_numbersList = NULL; serving_client_types = cJSON_GetObjectItemCaseSensitive(gmlc_infoJSON, "servingClientTypes"); if (serving_client_types) { cJSON *serving_client_types_local = NULL; @@ -95,8 +120,30 @@ OpenAPI_gmlc_info_t *OpenAPI_gmlc_info_parseFromJSON(cJSON *gmlc_infoJSON) } } + gmlc_numbers = cJSON_GetObjectItemCaseSensitive(gmlc_infoJSON, "gmlcNumbers"); + if (gmlc_numbers) { + cJSON *gmlc_numbers_local = NULL; + if (!cJSON_IsArray(gmlc_numbers)) { + ogs_error("OpenAPI_gmlc_info_parseFromJSON() failed [gmlc_numbers]"); + goto end; + } + + gmlc_numbersList = OpenAPI_list_create(); + + cJSON_ArrayForEach(gmlc_numbers_local, gmlc_numbers) { + double *localDouble = NULL; + int *localInt = NULL; + if (!cJSON_IsString(gmlc_numbers_local)) { + ogs_error("OpenAPI_gmlc_info_parseFromJSON() failed [gmlc_numbers]"); + goto end; + } + OpenAPI_list_add(gmlc_numbersList, ogs_strdup(gmlc_numbers_local->valuestring)); + } + } + gmlc_info_local_var = OpenAPI_gmlc_info_create ( - serving_client_types ? serving_client_typesList : NULL + serving_client_types ? serving_client_typesList : NULL, + gmlc_numbers ? gmlc_numbersList : NULL ); return gmlc_info_local_var; @@ -108,6 +155,13 @@ end: OpenAPI_list_free(serving_client_typesList); serving_client_typesList = NULL; } + if (gmlc_numbersList) { + OpenAPI_list_for_each(gmlc_numbersList, node) { + ogs_free(node->data); + } + OpenAPI_list_free(gmlc_numbersList); + gmlc_numbersList = NULL; + } return NULL; } diff --git a/lib/sbi/openapi/model/gmlc_info.h b/lib/sbi/openapi/model/gmlc_info.h index 2464ed4a8..9d56863af 100644 --- a/lib/sbi/openapi/model/gmlc_info.h +++ b/lib/sbi/openapi/model/gmlc_info.h @@ -21,10 +21,12 @@ extern "C" { typedef struct OpenAPI_gmlc_info_s OpenAPI_gmlc_info_t; typedef struct OpenAPI_gmlc_info_s { OpenAPI_list_t *serving_client_types; + OpenAPI_list_t *gmlc_numbers; } OpenAPI_gmlc_info_t; OpenAPI_gmlc_info_t *OpenAPI_gmlc_info_create( - OpenAPI_list_t *serving_client_types + OpenAPI_list_t *serving_client_types, + OpenAPI_list_t *gmlc_numbers ); void OpenAPI_gmlc_info_free(OpenAPI_gmlc_info_t *gmlc_info); OpenAPI_gmlc_info_t *OpenAPI_gmlc_info_parseFromJSON(cJSON *gmlc_infoJSON); diff --git a/lib/sbi/openapi/model/gnb_id.h b/lib/sbi/openapi/model/gnb_id.h index 601fea99b..7bcb5da90 100644 --- a/lib/sbi/openapi/model/gnb_id.h +++ b/lib/sbi/openapi/model/gnb_id.h @@ -1,7 +1,7 @@ /* * gnb_id.h * - * + * Provides the G-NB identifier. */ #ifndef _OpenAPI_gnb_id_H_ diff --git a/lib/sbi/openapi/model/gpsi_type.c b/lib/sbi/openapi/model/gpsi_type.c new file mode 100644 index 000000000..8e65ea7cf --- /dev/null +++ b/lib/sbi/openapi/model/gpsi_type.c @@ -0,0 +1,30 @@ + +#include +#include +#include +#include "gpsi_type.h" + +char* OpenAPI_gpsi_type_ToString(OpenAPI_gpsi_type_e gpsi_type) +{ + const char *gpsi_typeArray[] = { "NULL", "MSISDN", "EXT_ID", "EXT_GROUP_ID" }; + size_t sizeofArray = sizeof(gpsi_typeArray) / sizeof(gpsi_typeArray[0]); + if (gpsi_type < sizeofArray) + return (char *)gpsi_typeArray[gpsi_type]; + else + return (char *)"Unknown"; +} + +OpenAPI_gpsi_type_e OpenAPI_gpsi_type_FromString(char* gpsi_type) +{ + int stringToReturn = 0; + const char *gpsi_typeArray[] = { "NULL", "MSISDN", "EXT_ID", "EXT_GROUP_ID" }; + size_t sizeofArray = sizeof(gpsi_typeArray) / sizeof(gpsi_typeArray[0]); + while (stringToReturn < sizeofArray) { + if (strcmp(gpsi_type, gpsi_typeArray[stringToReturn]) == 0) { + return stringToReturn; + } + stringToReturn++; + } + return 0; +} + diff --git a/lib/sbi/openapi/model/gpsi_type.h b/lib/sbi/openapi/model/gpsi_type.h new file mode 100644 index 000000000..ead9241b2 --- /dev/null +++ b/lib/sbi/openapi/model/gpsi_type.h @@ -0,0 +1,31 @@ +/* + * gpsi_type.h + * + * + */ + +#ifndef _OpenAPI_gpsi_type_H_ +#define _OpenAPI_gpsi_type_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef enum { OpenAPI_gpsi_type_NULL = 0, OpenAPI_gpsi_type_MSISDN, OpenAPI_gpsi_type_EXT_ID, OpenAPI_gpsi_type_EXT_GROUP_ID } OpenAPI_gpsi_type_e; + +char* OpenAPI_gpsi_type_ToString(OpenAPI_gpsi_type_e gpsi_type); + +OpenAPI_gpsi_type_e OpenAPI_gpsi_type_FromString(char* gpsi_type); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_gpsi_type_H_ */ + diff --git a/lib/sbi/openapi/model/guami.h b/lib/sbi/openapi/model/guami.h index 54d27d410..b14c64a55 100644 --- a/lib/sbi/openapi/model/guami.h +++ b/lib/sbi/openapi/model/guami.h @@ -1,7 +1,7 @@ /* * guami.h * - * + * Globally Unique AMF Identifier constructed out of PLMN, Network and AMF identity. */ #ifndef _OpenAPI_guami_H_ diff --git a/lib/sbi/openapi/model/hfc_node_id.h b/lib/sbi/openapi/model/hfc_node_id.h index bf98c61ca..67c99454c 100644 --- a/lib/sbi/openapi/model/hfc_node_id.h +++ b/lib/sbi/openapi/model/hfc_node_id.h @@ -1,7 +1,7 @@ /* * hfc_node_id.h * - * + * REpresents the HFC Node Identifer received over NGAP. */ #ifndef _OpenAPI_hfc_node_id_H_ diff --git a/lib/sbi/openapi/model/hsmf_update_data.c b/lib/sbi/openapi/model/hsmf_update_data.c index 8eaaa5f75..404e71e8e 100644 --- a/lib/sbi/openapi/model/hsmf_update_data.c +++ b/lib/sbi/openapi/model/hsmf_update_data.c @@ -4,6 +4,29 @@ #include #include "hsmf_update_data.h" +char *OpenAPI_sm_policy_notify_indhsmf_update_data_ToString(OpenAPI_hsmf_update_data_sm_policy_notify_ind_e sm_policy_notify_ind) +{ + const char *sm_policy_notify_indArray[] = { "NULL", "true" }; + size_t sizeofArray = sizeof(sm_policy_notify_indArray) / sizeof(sm_policy_notify_indArray[0]); + if (sm_policy_notify_ind < sizeofArray) + return (char *)sm_policy_notify_indArray[sm_policy_notify_ind]; + else + return (char *)"Unknown"; +} + +OpenAPI_hsmf_update_data_sm_policy_notify_ind_e OpenAPI_sm_policy_notify_indhsmf_update_data_FromString(char* sm_policy_notify_ind) +{ + int stringToReturn = 0; + const char *sm_policy_notify_indArray[] = { "NULL", "true" }; + size_t sizeofArray = sizeof(sm_policy_notify_indArray) / sizeof(sm_policy_notify_indArray[0]); + while (stringToReturn < sizeofArray) { + if (strcmp(sm_policy_notify_ind, sm_policy_notify_indArray[stringToReturn]) == 0) { + return stringToReturn; + } + stringToReturn++; + } + return 0; +} OpenAPI_hsmf_update_data_t *OpenAPI_hsmf_update_data_create( OpenAPI_request_indication_e request_indication, char *pei, @@ -69,7 +92,14 @@ OpenAPI_hsmf_update_data_t *OpenAPI_hsmf_update_data_create( OpenAPI_security_result_t *security_result, OpenAPI_up_security_info_t *up_security_info, char *amf_nf_id, - OpenAPI_guami_t *guami + OpenAPI_guami_t *guami, + OpenAPI_list_t *secondary_rat_usage_data_report_container, + OpenAPI_hsmf_update_data_sm_policy_notify_ind_e sm_policy_notify_ind, + OpenAPI_pcf_ue_callback_info_t *pcf_ue_callback_info, + OpenAPI_satellite_backhaul_category_e satellite_backhaul_cat, + OpenAPI_max_integrity_protected_data_rate_e max_integrity_protected_data_rate_ul, + OpenAPI_max_integrity_protected_data_rate_e max_integrity_protected_data_rate_dl, + OpenAPI_up_cnx_state_e up_cnx_state ) { OpenAPI_hsmf_update_data_t *hsmf_update_data_local_var = ogs_malloc(sizeof(OpenAPI_hsmf_update_data_t)); @@ -140,6 +170,13 @@ OpenAPI_hsmf_update_data_t *OpenAPI_hsmf_update_data_create( hsmf_update_data_local_var->up_security_info = up_security_info; hsmf_update_data_local_var->amf_nf_id = amf_nf_id; hsmf_update_data_local_var->guami = guami; + hsmf_update_data_local_var->secondary_rat_usage_data_report_container = secondary_rat_usage_data_report_container; + hsmf_update_data_local_var->sm_policy_notify_ind = sm_policy_notify_ind; + hsmf_update_data_local_var->pcf_ue_callback_info = pcf_ue_callback_info; + hsmf_update_data_local_var->satellite_backhaul_cat = satellite_backhaul_cat; + hsmf_update_data_local_var->max_integrity_protected_data_rate_ul = max_integrity_protected_data_rate_ul; + hsmf_update_data_local_var->max_integrity_protected_data_rate_dl = max_integrity_protected_data_rate_dl; + hsmf_update_data_local_var->up_cnx_state = up_cnx_state; return hsmf_update_data_local_var; } @@ -330,6 +367,17 @@ void OpenAPI_hsmf_update_data_free(OpenAPI_hsmf_update_data_t *hsmf_update_data) OpenAPI_guami_free(hsmf_update_data->guami); hsmf_update_data->guami = NULL; } + if (hsmf_update_data->secondary_rat_usage_data_report_container) { + OpenAPI_list_for_each(hsmf_update_data->secondary_rat_usage_data_report_container, node) { + ogs_free(node->data); + } + OpenAPI_list_free(hsmf_update_data->secondary_rat_usage_data_report_container); + hsmf_update_data->secondary_rat_usage_data_report_container = NULL; + } + if (hsmf_update_data->pcf_ue_callback_info) { + OpenAPI_pcf_ue_callback_info_free(hsmf_update_data->pcf_ue_callback_info); + hsmf_update_data->pcf_ue_callback_info = NULL; + } ogs_free(hsmf_update_data); } @@ -927,6 +975,68 @@ cJSON *OpenAPI_hsmf_update_data_convertToJSON(OpenAPI_hsmf_update_data_t *hsmf_u } } + if (hsmf_update_data->secondary_rat_usage_data_report_container) { + cJSON *secondary_rat_usage_data_report_containerList = cJSON_AddArrayToObject(item, "secondaryRatUsageDataReportContainer"); + if (secondary_rat_usage_data_report_containerList == NULL) { + ogs_error("OpenAPI_hsmf_update_data_convertToJSON() failed [secondary_rat_usage_data_report_container]"); + goto end; + } + OpenAPI_list_for_each(hsmf_update_data->secondary_rat_usage_data_report_container, node) { + if (cJSON_AddStringToObject(secondary_rat_usage_data_report_containerList, "", (char*)node->data) == NULL) { + ogs_error("OpenAPI_hsmf_update_data_convertToJSON() failed [secondary_rat_usage_data_report_container]"); + goto end; + } + } + } + + if (hsmf_update_data->sm_policy_notify_ind != OpenAPI_hsmf_update_data_SMPOLICYNOTIFYIND_NULL) { + if (cJSON_AddStringToObject(item, "smPolicyNotifyInd", OpenAPI_sm_policy_notify_indhsmf_update_data_ToString(hsmf_update_data->sm_policy_notify_ind)) == NULL) { + ogs_error("OpenAPI_hsmf_update_data_convertToJSON() failed [sm_policy_notify_ind]"); + goto end; + } + } + + if (hsmf_update_data->pcf_ue_callback_info) { + cJSON *pcf_ue_callback_info_local_JSON = OpenAPI_pcf_ue_callback_info_convertToJSON(hsmf_update_data->pcf_ue_callback_info); + if (pcf_ue_callback_info_local_JSON == NULL) { + ogs_error("OpenAPI_hsmf_update_data_convertToJSON() failed [pcf_ue_callback_info]"); + goto end; + } + cJSON_AddItemToObject(item, "pcfUeCallbackInfo", pcf_ue_callback_info_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_hsmf_update_data_convertToJSON() failed [pcf_ue_callback_info]"); + goto end; + } + } + + if (hsmf_update_data->satellite_backhaul_cat != OpenAPI_satellite_backhaul_category_NULL) { + if (cJSON_AddStringToObject(item, "satelliteBackhaulCat", OpenAPI_satellite_backhaul_category_ToString(hsmf_update_data->satellite_backhaul_cat)) == NULL) { + ogs_error("OpenAPI_hsmf_update_data_convertToJSON() failed [satellite_backhaul_cat]"); + goto end; + } + } + + if (hsmf_update_data->max_integrity_protected_data_rate_ul != OpenAPI_max_integrity_protected_data_rate_NULL) { + if (cJSON_AddStringToObject(item, "maxIntegrityProtectedDataRateUl", OpenAPI_max_integrity_protected_data_rate_ToString(hsmf_update_data->max_integrity_protected_data_rate_ul)) == NULL) { + ogs_error("OpenAPI_hsmf_update_data_convertToJSON() failed [max_integrity_protected_data_rate_ul]"); + goto end; + } + } + + if (hsmf_update_data->max_integrity_protected_data_rate_dl != OpenAPI_max_integrity_protected_data_rate_NULL) { + if (cJSON_AddStringToObject(item, "maxIntegrityProtectedDataRateDl", OpenAPI_max_integrity_protected_data_rate_ToString(hsmf_update_data->max_integrity_protected_data_rate_dl)) == NULL) { + ogs_error("OpenAPI_hsmf_update_data_convertToJSON() failed [max_integrity_protected_data_rate_dl]"); + goto end; + } + } + + if (hsmf_update_data->up_cnx_state != OpenAPI_up_cnx_state_NULL) { + if (cJSON_AddStringToObject(item, "upCnxState", OpenAPI_up_cnx_state_ToString(hsmf_update_data->up_cnx_state)) == NULL) { + ogs_error("OpenAPI_hsmf_update_data_convertToJSON() failed [up_cnx_state]"); + goto end; + } + } + end: return item; } @@ -1028,6 +1138,20 @@ OpenAPI_hsmf_update_data_t *OpenAPI_hsmf_update_data_parseFromJSON(cJSON *hsmf_u cJSON *amf_nf_id = NULL; cJSON *guami = NULL; OpenAPI_guami_t *guami_local_nonprim = NULL; + cJSON *secondary_rat_usage_data_report_container = NULL; + OpenAPI_list_t *secondary_rat_usage_data_report_containerList = NULL; + cJSON *sm_policy_notify_ind = NULL; + OpenAPI_hsmf_update_data_sm_policy_notify_ind_e sm_policy_notify_indVariable = 0; + cJSON *pcf_ue_callback_info = NULL; + OpenAPI_pcf_ue_callback_info_t *pcf_ue_callback_info_local_nonprim = NULL; + cJSON *satellite_backhaul_cat = NULL; + OpenAPI_satellite_backhaul_category_e satellite_backhaul_catVariable = 0; + cJSON *max_integrity_protected_data_rate_ul = NULL; + OpenAPI_max_integrity_protected_data_rate_e max_integrity_protected_data_rate_ulVariable = 0; + cJSON *max_integrity_protected_data_rate_dl = NULL; + OpenAPI_max_integrity_protected_data_rate_e max_integrity_protected_data_rate_dlVariable = 0; + cJSON *up_cnx_state = NULL; + OpenAPI_up_cnx_state_e up_cnx_stateVariable = 0; request_indication = cJSON_GetObjectItemCaseSensitive(hsmf_update_dataJSON, "requestIndication"); if (!request_indication) { ogs_error("OpenAPI_hsmf_update_data_parseFromJSON() failed [request_indication]"); @@ -1583,6 +1707,77 @@ OpenAPI_hsmf_update_data_t *OpenAPI_hsmf_update_data_parseFromJSON(cJSON *hsmf_u guami_local_nonprim = OpenAPI_guami_parseFromJSON(guami); } + secondary_rat_usage_data_report_container = cJSON_GetObjectItemCaseSensitive(hsmf_update_dataJSON, "secondaryRatUsageDataReportContainer"); + if (secondary_rat_usage_data_report_container) { + cJSON *secondary_rat_usage_data_report_container_local = NULL; + if (!cJSON_IsArray(secondary_rat_usage_data_report_container)) { + ogs_error("OpenAPI_hsmf_update_data_parseFromJSON() failed [secondary_rat_usage_data_report_container]"); + goto end; + } + + secondary_rat_usage_data_report_containerList = OpenAPI_list_create(); + + cJSON_ArrayForEach(secondary_rat_usage_data_report_container_local, secondary_rat_usage_data_report_container) { + double *localDouble = NULL; + int *localInt = NULL; + if (!cJSON_IsString(secondary_rat_usage_data_report_container_local)) { + ogs_error("OpenAPI_hsmf_update_data_parseFromJSON() failed [secondary_rat_usage_data_report_container]"); + goto end; + } + OpenAPI_list_add(secondary_rat_usage_data_report_containerList, ogs_strdup(secondary_rat_usage_data_report_container_local->valuestring)); + } + } + + sm_policy_notify_ind = cJSON_GetObjectItemCaseSensitive(hsmf_update_dataJSON, "smPolicyNotifyInd"); + if (sm_policy_notify_ind) { + if (!cJSON_IsString(sm_policy_notify_ind)) { + ogs_error("OpenAPI_hsmf_update_data_parseFromJSON() failed [sm_policy_notify_ind]"); + goto end; + } + sm_policy_notify_indVariable = OpenAPI_sm_policy_notify_indhsmf_update_data_FromString(sm_policy_notify_ind->valuestring); + } + + pcf_ue_callback_info = cJSON_GetObjectItemCaseSensitive(hsmf_update_dataJSON, "pcfUeCallbackInfo"); + if (pcf_ue_callback_info) { + pcf_ue_callback_info_local_nonprim = OpenAPI_pcf_ue_callback_info_parseFromJSON(pcf_ue_callback_info); + } + + satellite_backhaul_cat = cJSON_GetObjectItemCaseSensitive(hsmf_update_dataJSON, "satelliteBackhaulCat"); + if (satellite_backhaul_cat) { + if (!cJSON_IsString(satellite_backhaul_cat)) { + ogs_error("OpenAPI_hsmf_update_data_parseFromJSON() failed [satellite_backhaul_cat]"); + goto end; + } + satellite_backhaul_catVariable = OpenAPI_satellite_backhaul_category_FromString(satellite_backhaul_cat->valuestring); + } + + max_integrity_protected_data_rate_ul = cJSON_GetObjectItemCaseSensitive(hsmf_update_dataJSON, "maxIntegrityProtectedDataRateUl"); + if (max_integrity_protected_data_rate_ul) { + if (!cJSON_IsString(max_integrity_protected_data_rate_ul)) { + ogs_error("OpenAPI_hsmf_update_data_parseFromJSON() failed [max_integrity_protected_data_rate_ul]"); + goto end; + } + max_integrity_protected_data_rate_ulVariable = OpenAPI_max_integrity_protected_data_rate_FromString(max_integrity_protected_data_rate_ul->valuestring); + } + + max_integrity_protected_data_rate_dl = cJSON_GetObjectItemCaseSensitive(hsmf_update_dataJSON, "maxIntegrityProtectedDataRateDl"); + if (max_integrity_protected_data_rate_dl) { + if (!cJSON_IsString(max_integrity_protected_data_rate_dl)) { + ogs_error("OpenAPI_hsmf_update_data_parseFromJSON() failed [max_integrity_protected_data_rate_dl]"); + goto end; + } + max_integrity_protected_data_rate_dlVariable = OpenAPI_max_integrity_protected_data_rate_FromString(max_integrity_protected_data_rate_dl->valuestring); + } + + up_cnx_state = cJSON_GetObjectItemCaseSensitive(hsmf_update_dataJSON, "upCnxState"); + if (up_cnx_state) { + if (!cJSON_IsString(up_cnx_state)) { + ogs_error("OpenAPI_hsmf_update_data_parseFromJSON() failed [up_cnx_state]"); + goto end; + } + up_cnx_stateVariable = OpenAPI_up_cnx_state_FromString(up_cnx_state->valuestring); + } + hsmf_update_data_local_var = OpenAPI_hsmf_update_data_create ( request_indicationVariable, pei && !cJSON_IsNull(pei) ? ogs_strdup(pei->valuestring) : NULL, @@ -1648,7 +1843,14 @@ OpenAPI_hsmf_update_data_t *OpenAPI_hsmf_update_data_parseFromJSON(cJSON *hsmf_u security_result ? security_result_local_nonprim : NULL, up_security_info ? up_security_info_local_nonprim : NULL, amf_nf_id && !cJSON_IsNull(amf_nf_id) ? ogs_strdup(amf_nf_id->valuestring) : NULL, - guami ? guami_local_nonprim : NULL + guami ? guami_local_nonprim : NULL, + secondary_rat_usage_data_report_container ? secondary_rat_usage_data_report_containerList : NULL, + sm_policy_notify_ind ? sm_policy_notify_indVariable : 0, + pcf_ue_callback_info ? pcf_ue_callback_info_local_nonprim : NULL, + satellite_backhaul_cat ? satellite_backhaul_catVariable : 0, + max_integrity_protected_data_rate_ul ? max_integrity_protected_data_rate_ulVariable : 0, + max_integrity_protected_data_rate_dl ? max_integrity_protected_data_rate_dlVariable : 0, + up_cnx_state ? up_cnx_stateVariable : 0 ); return hsmf_update_data_local_var; @@ -1792,6 +1994,17 @@ end: OpenAPI_guami_free(guami_local_nonprim); guami_local_nonprim = NULL; } + if (secondary_rat_usage_data_report_containerList) { + OpenAPI_list_for_each(secondary_rat_usage_data_report_containerList, node) { + ogs_free(node->data); + } + OpenAPI_list_free(secondary_rat_usage_data_report_containerList); + secondary_rat_usage_data_report_containerList = NULL; + } + if (pcf_ue_callback_info_local_nonprim) { + OpenAPI_pcf_ue_callback_info_free(pcf_ue_callback_info_local_nonprim); + pcf_ue_callback_info_local_nonprim = NULL; + } return NULL; } diff --git a/lib/sbi/openapi/model/hsmf_update_data.h b/lib/sbi/openapi/model/hsmf_update_data.h index 08cd2ecae..4567fc867 100644 --- a/lib/sbi/openapi/model/hsmf_update_data.h +++ b/lib/sbi/openapi/model/hsmf_update_data.h @@ -1,7 +1,7 @@ /* * hsmf_update_data.h * - * + * Data within Update Request towards H-SMF, or from I-SMF to SMF */ #ifndef _OpenAPI_hsmf_update_data_H_ @@ -17,9 +17,11 @@ #include "eps_interworking_indication.h" #include "guami.h" #include "ma_release_indication.h" +#include "max_integrity_protected_data_rate.h" #include "mo_exp_data_counter.h" #include "n4_information.h" #include "ng_ap_cause.h" +#include "pcf_ue_callback_info.h" #include "pdu_session_notify_item.h" #include "plmn_id_nid.h" #include "presence_state.h" @@ -30,12 +32,14 @@ #include "ref_to_binary_data.h" #include "request_indication.h" #include "roaming_charging_profile.h" +#include "satellite_backhaul_category.h" #include "secondary_rat_usage_info.h" #include "secondary_rat_usage_report.h" #include "security_result.h" #include "tunnel_info.h" #include "ulcl_bp_information.h" #include "unavailable_access_indication.h" +#include "up_cnx_state.h" #include "up_security_info.h" #include "user_location.h" #include "vplmn_qos.h" @@ -45,6 +49,11 @@ extern "C" { #endif typedef struct OpenAPI_hsmf_update_data_s OpenAPI_hsmf_update_data_t; +typedef enum { OpenAPI_hsmf_update_data_SMPOLICYNOTIFYIND_NULL = 0, OpenAPI_hsmf_update_data_SMPOLICYNOTIFYIND__true } OpenAPI_hsmf_update_data_sm_policy_notify_ind_e; + +char* OpenAPI_hsmf_update_data_sm_policy_notify_ind_ToString(OpenAPI_hsmf_update_data_sm_policy_notify_ind_e sm_policy_notify_ind); + +OpenAPI_hsmf_update_data_sm_policy_notify_ind_e OpenAPI_hsmf_update_data_sm_policy_notify_ind_FromString(char* sm_policy_notify_ind); typedef struct OpenAPI_hsmf_update_data_s { OpenAPI_request_indication_e request_indication; char *pei; @@ -111,6 +120,13 @@ typedef struct OpenAPI_hsmf_update_data_s { struct OpenAPI_up_security_info_s *up_security_info; char *amf_nf_id; struct OpenAPI_guami_s *guami; + OpenAPI_list_t *secondary_rat_usage_data_report_container; + OpenAPI_hsmf_update_data_sm_policy_notify_ind_e sm_policy_notify_ind; + struct OpenAPI_pcf_ue_callback_info_s *pcf_ue_callback_info; + OpenAPI_satellite_backhaul_category_e satellite_backhaul_cat; + OpenAPI_max_integrity_protected_data_rate_e max_integrity_protected_data_rate_ul; + OpenAPI_max_integrity_protected_data_rate_e max_integrity_protected_data_rate_dl; + OpenAPI_up_cnx_state_e up_cnx_state; } OpenAPI_hsmf_update_data_t; OpenAPI_hsmf_update_data_t *OpenAPI_hsmf_update_data_create( @@ -178,7 +194,14 @@ OpenAPI_hsmf_update_data_t *OpenAPI_hsmf_update_data_create( OpenAPI_security_result_t *security_result, OpenAPI_up_security_info_t *up_security_info, char *amf_nf_id, - OpenAPI_guami_t *guami + OpenAPI_guami_t *guami, + OpenAPI_list_t *secondary_rat_usage_data_report_container, + OpenAPI_hsmf_update_data_sm_policy_notify_ind_e sm_policy_notify_ind, + OpenAPI_pcf_ue_callback_info_t *pcf_ue_callback_info, + OpenAPI_satellite_backhaul_category_e satellite_backhaul_cat, + OpenAPI_max_integrity_protected_data_rate_e max_integrity_protected_data_rate_ul, + OpenAPI_max_integrity_protected_data_rate_e max_integrity_protected_data_rate_dl, + OpenAPI_up_cnx_state_e up_cnx_state ); void OpenAPI_hsmf_update_data_free(OpenAPI_hsmf_update_data_t *hsmf_update_data); OpenAPI_hsmf_update_data_t *OpenAPI_hsmf_update_data_parseFromJSON(cJSON *hsmf_update_dataJSON); diff --git a/lib/sbi/openapi/model/hsmf_update_error.h b/lib/sbi/openapi/model/hsmf_update_error.h index dc10cfc25..3e5d64449 100644 --- a/lib/sbi/openapi/model/hsmf_update_error.h +++ b/lib/sbi/openapi/model/hsmf_update_error.h @@ -1,7 +1,7 @@ /* * hsmf_update_error.h * - * + * Error within Update Response from H-SMF, or from SMF to I-SMF */ #ifndef _OpenAPI_hsmf_update_error_H_ diff --git a/lib/sbi/openapi/model/hsmf_updated_data.c b/lib/sbi/openapi/model/hsmf_updated_data.c index 8278623bc..d337284db 100644 --- a/lib/sbi/openapi/model/hsmf_updated_data.c +++ b/lib/sbi/openapi/model/hsmf_updated_data.c @@ -12,6 +12,7 @@ OpenAPI_hsmf_updated_data_t *OpenAPI_hsmf_updated_data_create( OpenAPI_list_t *dnai_list, char *supported_features, OpenAPI_roaming_charging_profile_t *roaming_charging_profile, + char *home_provided_charging_id, OpenAPI_up_security_t *up_security, OpenAPI_max_integrity_protected_data_rate_e max_integrity_protected_data_rate_ul, OpenAPI_max_integrity_protected_data_rate_e max_integrity_protected_data_rate_dl, @@ -22,7 +23,9 @@ OpenAPI_hsmf_updated_data_t *OpenAPI_hsmf_updated_data_create( OpenAPI_eps_pdn_cnx_info_t *eps_pdn_cnx_info, OpenAPI_list_t *eps_bearer_info, bool is_pti, - int pti + int pti, + char *inter_plmn_api_root, + char *intra_plmn_api_root ) { OpenAPI_hsmf_updated_data_t *hsmf_updated_data_local_var = ogs_malloc(sizeof(OpenAPI_hsmf_updated_data_t)); @@ -35,6 +38,7 @@ OpenAPI_hsmf_updated_data_t *OpenAPI_hsmf_updated_data_create( hsmf_updated_data_local_var->dnai_list = dnai_list; hsmf_updated_data_local_var->supported_features = supported_features; hsmf_updated_data_local_var->roaming_charging_profile = roaming_charging_profile; + hsmf_updated_data_local_var->home_provided_charging_id = home_provided_charging_id; hsmf_updated_data_local_var->up_security = up_security; hsmf_updated_data_local_var->max_integrity_protected_data_rate_ul = max_integrity_protected_data_rate_ul; hsmf_updated_data_local_var->max_integrity_protected_data_rate_dl = max_integrity_protected_data_rate_dl; @@ -46,6 +50,8 @@ OpenAPI_hsmf_updated_data_t *OpenAPI_hsmf_updated_data_create( hsmf_updated_data_local_var->eps_bearer_info = eps_bearer_info; hsmf_updated_data_local_var->is_pti = is_pti; hsmf_updated_data_local_var->pti = pti; + hsmf_updated_data_local_var->inter_plmn_api_root = inter_plmn_api_root; + hsmf_updated_data_local_var->intra_plmn_api_root = intra_plmn_api_root; return hsmf_updated_data_local_var; } @@ -88,6 +94,10 @@ void OpenAPI_hsmf_updated_data_free(OpenAPI_hsmf_updated_data_t *hsmf_updated_da OpenAPI_roaming_charging_profile_free(hsmf_updated_data->roaming_charging_profile); hsmf_updated_data->roaming_charging_profile = NULL; } + if (hsmf_updated_data->home_provided_charging_id) { + ogs_free(hsmf_updated_data->home_provided_charging_id); + hsmf_updated_data->home_provided_charging_id = NULL; + } if (hsmf_updated_data->up_security) { OpenAPI_up_security_free(hsmf_updated_data->up_security); hsmf_updated_data->up_security = NULL; @@ -114,6 +124,14 @@ void OpenAPI_hsmf_updated_data_free(OpenAPI_hsmf_updated_data_t *hsmf_updated_da OpenAPI_list_free(hsmf_updated_data->eps_bearer_info); hsmf_updated_data->eps_bearer_info = NULL; } + if (hsmf_updated_data->inter_plmn_api_root) { + ogs_free(hsmf_updated_data->inter_plmn_api_root); + hsmf_updated_data->inter_plmn_api_root = NULL; + } + if (hsmf_updated_data->intra_plmn_api_root) { + ogs_free(hsmf_updated_data->intra_plmn_api_root); + hsmf_updated_data->intra_plmn_api_root = NULL; + } ogs_free(hsmf_updated_data); } @@ -214,6 +232,13 @@ cJSON *OpenAPI_hsmf_updated_data_convertToJSON(OpenAPI_hsmf_updated_data_t *hsmf } } + if (hsmf_updated_data->home_provided_charging_id) { + if (cJSON_AddStringToObject(item, "homeProvidedChargingId", hsmf_updated_data->home_provided_charging_id) == NULL) { + ogs_error("OpenAPI_hsmf_updated_data_convertToJSON() failed [home_provided_charging_id]"); + goto end; + } + } + if (hsmf_updated_data->up_security) { cJSON *up_security_local_JSON = OpenAPI_up_security_convertToJSON(hsmf_updated_data->up_security); if (up_security_local_JSON == NULL) { @@ -313,6 +338,20 @@ cJSON *OpenAPI_hsmf_updated_data_convertToJSON(OpenAPI_hsmf_updated_data_t *hsmf } } + if (hsmf_updated_data->inter_plmn_api_root) { + if (cJSON_AddStringToObject(item, "interPlmnApiRoot", hsmf_updated_data->inter_plmn_api_root) == NULL) { + ogs_error("OpenAPI_hsmf_updated_data_convertToJSON() failed [inter_plmn_api_root]"); + goto end; + } + } + + if (hsmf_updated_data->intra_plmn_api_root) { + if (cJSON_AddStringToObject(item, "intraPlmnApiRoot", hsmf_updated_data->intra_plmn_api_root) == NULL) { + ogs_error("OpenAPI_hsmf_updated_data_convertToJSON() failed [intra_plmn_api_root]"); + goto end; + } + } + end: return item; } @@ -334,6 +373,7 @@ OpenAPI_hsmf_updated_data_t *OpenAPI_hsmf_updated_data_parseFromJSON(cJSON *hsmf cJSON *supported_features = NULL; cJSON *roaming_charging_profile = NULL; OpenAPI_roaming_charging_profile_t *roaming_charging_profile_local_nonprim = NULL; + cJSON *home_provided_charging_id = NULL; cJSON *up_security = NULL; OpenAPI_up_security_t *up_security_local_nonprim = NULL; cJSON *max_integrity_protected_data_rate_ul = NULL; @@ -350,6 +390,8 @@ OpenAPI_hsmf_updated_data_t *OpenAPI_hsmf_updated_data_parseFromJSON(cJSON *hsmf cJSON *eps_bearer_info = NULL; OpenAPI_list_t *eps_bearer_infoList = NULL; cJSON *pti = NULL; + cJSON *inter_plmn_api_root = NULL; + cJSON *intra_plmn_api_root = NULL; n1_sm_info_to_ue = cJSON_GetObjectItemCaseSensitive(hsmf_updated_dataJSON, "n1SmInfoToUe"); if (n1_sm_info_to_ue) { n1_sm_info_to_ue_local_nonprim = OpenAPI_ref_to_binary_data_parseFromJSON(n1_sm_info_to_ue); @@ -404,6 +446,14 @@ OpenAPI_hsmf_updated_data_t *OpenAPI_hsmf_updated_data_parseFromJSON(cJSON *hsmf roaming_charging_profile_local_nonprim = OpenAPI_roaming_charging_profile_parseFromJSON(roaming_charging_profile); } + home_provided_charging_id = cJSON_GetObjectItemCaseSensitive(hsmf_updated_dataJSON, "homeProvidedChargingId"); + if (home_provided_charging_id) { + if (!cJSON_IsString(home_provided_charging_id) && !cJSON_IsNull(home_provided_charging_id)) { + ogs_error("OpenAPI_hsmf_updated_data_parseFromJSON() failed [home_provided_charging_id]"); + goto end; + } + } + up_security = cJSON_GetObjectItemCaseSensitive(hsmf_updated_dataJSON, "upSecurity"); if (up_security) { up_security_local_nonprim = OpenAPI_up_security_parseFromJSON(up_security); @@ -503,6 +553,22 @@ OpenAPI_hsmf_updated_data_t *OpenAPI_hsmf_updated_data_parseFromJSON(cJSON *hsmf } } + inter_plmn_api_root = cJSON_GetObjectItemCaseSensitive(hsmf_updated_dataJSON, "interPlmnApiRoot"); + if (inter_plmn_api_root) { + if (!cJSON_IsString(inter_plmn_api_root) && !cJSON_IsNull(inter_plmn_api_root)) { + ogs_error("OpenAPI_hsmf_updated_data_parseFromJSON() failed [inter_plmn_api_root]"); + goto end; + } + } + + intra_plmn_api_root = cJSON_GetObjectItemCaseSensitive(hsmf_updated_dataJSON, "intraPlmnApiRoot"); + if (intra_plmn_api_root) { + if (!cJSON_IsString(intra_plmn_api_root) && !cJSON_IsNull(intra_plmn_api_root)) { + ogs_error("OpenAPI_hsmf_updated_data_parseFromJSON() failed [intra_plmn_api_root]"); + goto end; + } + } + hsmf_updated_data_local_var = OpenAPI_hsmf_updated_data_create ( n1_sm_info_to_ue ? n1_sm_info_to_ue_local_nonprim : NULL, n4_info ? n4_info_local_nonprim : NULL, @@ -511,6 +577,7 @@ OpenAPI_hsmf_updated_data_t *OpenAPI_hsmf_updated_data_parseFromJSON(cJSON *hsmf dnai_list ? dnai_listList : NULL, supported_features && !cJSON_IsNull(supported_features) ? ogs_strdup(supported_features->valuestring) : NULL, roaming_charging_profile ? roaming_charging_profile_local_nonprim : NULL, + home_provided_charging_id && !cJSON_IsNull(home_provided_charging_id) ? ogs_strdup(home_provided_charging_id->valuestring) : NULL, up_security ? up_security_local_nonprim : NULL, max_integrity_protected_data_rate_ul ? max_integrity_protected_data_rate_ulVariable : 0, max_integrity_protected_data_rate_dl ? max_integrity_protected_data_rate_dlVariable : 0, @@ -521,7 +588,9 @@ OpenAPI_hsmf_updated_data_t *OpenAPI_hsmf_updated_data_parseFromJSON(cJSON *hsmf eps_pdn_cnx_info ? eps_pdn_cnx_info_local_nonprim : NULL, eps_bearer_info ? eps_bearer_infoList : NULL, pti ? true : false, - pti ? pti->valuedouble : 0 + pti ? pti->valuedouble : 0, + inter_plmn_api_root && !cJSON_IsNull(inter_plmn_api_root) ? ogs_strdup(inter_plmn_api_root->valuestring) : NULL, + intra_plmn_api_root && !cJSON_IsNull(intra_plmn_api_root) ? ogs_strdup(intra_plmn_api_root->valuestring) : NULL ); return hsmf_updated_data_local_var; diff --git a/lib/sbi/openapi/model/hsmf_updated_data.h b/lib/sbi/openapi/model/hsmf_updated_data.h index a211fd728..3442fada1 100644 --- a/lib/sbi/openapi/model/hsmf_updated_data.h +++ b/lib/sbi/openapi/model/hsmf_updated_data.h @@ -1,7 +1,7 @@ /* * hsmf_updated_data.h * - * + * Data within Update Response from H-SMF, or from SMF to I-SMF */ #ifndef _OpenAPI_hsmf_updated_data_H_ @@ -35,6 +35,7 @@ typedef struct OpenAPI_hsmf_updated_data_s { OpenAPI_list_t *dnai_list; char *supported_features; struct OpenAPI_roaming_charging_profile_s *roaming_charging_profile; + char *home_provided_charging_id; struct OpenAPI_up_security_s *up_security; OpenAPI_max_integrity_protected_data_rate_e max_integrity_protected_data_rate_ul; OpenAPI_max_integrity_protected_data_rate_e max_integrity_protected_data_rate_dl; @@ -46,6 +47,8 @@ typedef struct OpenAPI_hsmf_updated_data_s { OpenAPI_list_t *eps_bearer_info; bool is_pti; int pti; + char *inter_plmn_api_root; + char *intra_plmn_api_root; } OpenAPI_hsmf_updated_data_t; OpenAPI_hsmf_updated_data_t *OpenAPI_hsmf_updated_data_create( @@ -56,6 +59,7 @@ OpenAPI_hsmf_updated_data_t *OpenAPI_hsmf_updated_data_create( OpenAPI_list_t *dnai_list, char *supported_features, OpenAPI_roaming_charging_profile_t *roaming_charging_profile, + char *home_provided_charging_id, OpenAPI_up_security_t *up_security, OpenAPI_max_integrity_protected_data_rate_e max_integrity_protected_data_rate_ul, OpenAPI_max_integrity_protected_data_rate_e max_integrity_protected_data_rate_dl, @@ -66,7 +70,9 @@ OpenAPI_hsmf_updated_data_t *OpenAPI_hsmf_updated_data_create( OpenAPI_eps_pdn_cnx_info_t *eps_pdn_cnx_info, OpenAPI_list_t *eps_bearer_info, bool is_pti, - int pti + int pti, + char *inter_plmn_api_root, + char *intra_plmn_api_root ); void OpenAPI_hsmf_updated_data_free(OpenAPI_hsmf_updated_data_t *hsmf_updated_data); OpenAPI_hsmf_updated_data_t *OpenAPI_hsmf_updated_data_parseFromJSON(cJSON *hsmf_updated_dataJSON); diff --git a/lib/sbi/openapi/model/hss_info.c b/lib/sbi/openapi/model/hss_info.c index 91781fa95..d8cd7cf56 100644 --- a/lib/sbi/openapi/model/hss_info.c +++ b/lib/sbi/openapi/model/hss_info.c @@ -9,7 +9,9 @@ OpenAPI_hss_info_t *OpenAPI_hss_info_create( OpenAPI_list_t *imsi_ranges, OpenAPI_list_t *ims_private_identity_ranges, OpenAPI_list_t *ims_public_identity_ranges, - OpenAPI_list_t *msisdn_ranges + OpenAPI_list_t *msisdn_ranges, + OpenAPI_list_t *external_group_identifiers_ranges, + OpenAPI_network_node_diameter_address_t *hss_diameter_address ) { OpenAPI_hss_info_t *hss_info_local_var = ogs_malloc(sizeof(OpenAPI_hss_info_t)); @@ -20,6 +22,8 @@ OpenAPI_hss_info_t *OpenAPI_hss_info_create( hss_info_local_var->ims_private_identity_ranges = ims_private_identity_ranges; hss_info_local_var->ims_public_identity_ranges = ims_public_identity_ranges; hss_info_local_var->msisdn_ranges = msisdn_ranges; + hss_info_local_var->external_group_identifiers_ranges = external_group_identifiers_ranges; + hss_info_local_var->hss_diameter_address = hss_diameter_address; return hss_info_local_var; } @@ -63,6 +67,17 @@ void OpenAPI_hss_info_free(OpenAPI_hss_info_t *hss_info) OpenAPI_list_free(hss_info->msisdn_ranges); hss_info->msisdn_ranges = NULL; } + if (hss_info->external_group_identifiers_ranges) { + OpenAPI_list_for_each(hss_info->external_group_identifiers_ranges, node) { + OpenAPI_identity_range_free(node->data); + } + OpenAPI_list_free(hss_info->external_group_identifiers_ranges); + hss_info->external_group_identifiers_ranges = NULL; + } + if (hss_info->hss_diameter_address) { + OpenAPI_network_node_diameter_address_free(hss_info->hss_diameter_address); + hss_info->hss_diameter_address = NULL; + } ogs_free(hss_info); } @@ -148,6 +163,35 @@ cJSON *OpenAPI_hss_info_convertToJSON(OpenAPI_hss_info_t *hss_info) } } + if (hss_info->external_group_identifiers_ranges) { + cJSON *external_group_identifiers_rangesList = cJSON_AddArrayToObject(item, "externalGroupIdentifiersRanges"); + if (external_group_identifiers_rangesList == NULL) { + ogs_error("OpenAPI_hss_info_convertToJSON() failed [external_group_identifiers_ranges]"); + goto end; + } + OpenAPI_list_for_each(hss_info->external_group_identifiers_ranges, node) { + cJSON *itemLocal = OpenAPI_identity_range_convertToJSON(node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_hss_info_convertToJSON() failed [external_group_identifiers_ranges]"); + goto end; + } + cJSON_AddItemToArray(external_group_identifiers_rangesList, itemLocal); + } + } + + if (hss_info->hss_diameter_address) { + cJSON *hss_diameter_address_local_JSON = OpenAPI_network_node_diameter_address_convertToJSON(hss_info->hss_diameter_address); + if (hss_diameter_address_local_JSON == NULL) { + ogs_error("OpenAPI_hss_info_convertToJSON() failed [hss_diameter_address]"); + goto end; + } + cJSON_AddItemToObject(item, "hssDiameterAddress", hss_diameter_address_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_hss_info_convertToJSON() failed [hss_diameter_address]"); + goto end; + } + } + end: return item; } @@ -165,6 +209,10 @@ OpenAPI_hss_info_t *OpenAPI_hss_info_parseFromJSON(cJSON *hss_infoJSON) OpenAPI_list_t *ims_public_identity_rangesList = NULL; cJSON *msisdn_ranges = NULL; OpenAPI_list_t *msisdn_rangesList = NULL; + cJSON *external_group_identifiers_ranges = NULL; + OpenAPI_list_t *external_group_identifiers_rangesList = NULL; + cJSON *hss_diameter_address = NULL; + OpenAPI_network_node_diameter_address_t *hss_diameter_address_local_nonprim = NULL; group_id = cJSON_GetObjectItemCaseSensitive(hss_infoJSON, "groupId"); if (group_id) { if (!cJSON_IsString(group_id) && !cJSON_IsNull(group_id)) { @@ -273,12 +321,44 @@ OpenAPI_hss_info_t *OpenAPI_hss_info_parseFromJSON(cJSON *hss_infoJSON) } } + external_group_identifiers_ranges = cJSON_GetObjectItemCaseSensitive(hss_infoJSON, "externalGroupIdentifiersRanges"); + if (external_group_identifiers_ranges) { + cJSON *external_group_identifiers_ranges_local = NULL; + if (!cJSON_IsArray(external_group_identifiers_ranges)) { + ogs_error("OpenAPI_hss_info_parseFromJSON() failed [external_group_identifiers_ranges]"); + goto end; + } + + external_group_identifiers_rangesList = OpenAPI_list_create(); + + cJSON_ArrayForEach(external_group_identifiers_ranges_local, external_group_identifiers_ranges) { + if (!cJSON_IsObject(external_group_identifiers_ranges_local)) { + ogs_error("OpenAPI_hss_info_parseFromJSON() failed [external_group_identifiers_ranges]"); + goto end; + } + OpenAPI_identity_range_t *external_group_identifiers_rangesItem = OpenAPI_identity_range_parseFromJSON(external_group_identifiers_ranges_local); + if (!external_group_identifiers_rangesItem) { + ogs_error("No external_group_identifiers_rangesItem"); + OpenAPI_list_free(external_group_identifiers_rangesList); + goto end; + } + OpenAPI_list_add(external_group_identifiers_rangesList, external_group_identifiers_rangesItem); + } + } + + hss_diameter_address = cJSON_GetObjectItemCaseSensitive(hss_infoJSON, "hssDiameterAddress"); + if (hss_diameter_address) { + hss_diameter_address_local_nonprim = OpenAPI_network_node_diameter_address_parseFromJSON(hss_diameter_address); + } + hss_info_local_var = OpenAPI_hss_info_create ( group_id && !cJSON_IsNull(group_id) ? ogs_strdup(group_id->valuestring) : NULL, imsi_ranges ? imsi_rangesList : NULL, ims_private_identity_ranges ? ims_private_identity_rangesList : NULL, ims_public_identity_ranges ? ims_public_identity_rangesList : NULL, - msisdn_ranges ? msisdn_rangesList : NULL + msisdn_ranges ? msisdn_rangesList : NULL, + external_group_identifiers_ranges ? external_group_identifiers_rangesList : NULL, + hss_diameter_address ? hss_diameter_address_local_nonprim : NULL ); return hss_info_local_var; @@ -311,6 +391,17 @@ end: OpenAPI_list_free(msisdn_rangesList); msisdn_rangesList = NULL; } + if (external_group_identifiers_rangesList) { + OpenAPI_list_for_each(external_group_identifiers_rangesList, node) { + OpenAPI_identity_range_free(node->data); + } + OpenAPI_list_free(external_group_identifiers_rangesList); + external_group_identifiers_rangesList = NULL; + } + if (hss_diameter_address_local_nonprim) { + OpenAPI_network_node_diameter_address_free(hss_diameter_address_local_nonprim); + hss_diameter_address_local_nonprim = NULL; + } return NULL; } diff --git a/lib/sbi/openapi/model/hss_info.h b/lib/sbi/openapi/model/hss_info.h index cd42a8bbf..ec3883615 100644 --- a/lib/sbi/openapi/model/hss_info.h +++ b/lib/sbi/openapi/model/hss_info.h @@ -14,6 +14,7 @@ #include "../include/binary.h" #include "identity_range.h" #include "imsi_range.h" +#include "network_node_diameter_address.h" #ifdef __cplusplus extern "C" { @@ -26,6 +27,8 @@ typedef struct OpenAPI_hss_info_s { OpenAPI_list_t *ims_private_identity_ranges; OpenAPI_list_t *ims_public_identity_ranges; OpenAPI_list_t *msisdn_ranges; + OpenAPI_list_t *external_group_identifiers_ranges; + struct OpenAPI_network_node_diameter_address_s *hss_diameter_address; } OpenAPI_hss_info_t; OpenAPI_hss_info_t *OpenAPI_hss_info_create( @@ -33,7 +36,9 @@ OpenAPI_hss_info_t *OpenAPI_hss_info_create( OpenAPI_list_t *imsi_ranges, OpenAPI_list_t *ims_private_identity_ranges, OpenAPI_list_t *ims_public_identity_ranges, - OpenAPI_list_t *msisdn_ranges + OpenAPI_list_t *msisdn_ranges, + OpenAPI_list_t *external_group_identifiers_ranges, + OpenAPI_network_node_diameter_address_t *hss_diameter_address ); void OpenAPI_hss_info_free(OpenAPI_hss_info_t *hss_info); OpenAPI_hss_info_t *OpenAPI_hss_info_parseFromJSON(cJSON *hss_infoJSON); diff --git a/lib/sbi/openapi/model/hss_subscription_info.c b/lib/sbi/openapi/model/hss_subscription_info.c new file mode 100644 index 000000000..a654c8361 --- /dev/null +++ b/lib/sbi/openapi/model/hss_subscription_info.c @@ -0,0 +1,151 @@ + +#include +#include +#include +#include "hss_subscription_info.h" + +OpenAPI_hss_subscription_info_t *OpenAPI_hss_subscription_info_create( + OpenAPI_list_t *hss_subscription_list +) +{ + OpenAPI_hss_subscription_info_t *hss_subscription_info_local_var = ogs_malloc(sizeof(OpenAPI_hss_subscription_info_t)); + ogs_assert(hss_subscription_info_local_var); + + hss_subscription_info_local_var->hss_subscription_list = hss_subscription_list; + + return hss_subscription_info_local_var; +} + +void OpenAPI_hss_subscription_info_free(OpenAPI_hss_subscription_info_t *hss_subscription_info) +{ + OpenAPI_lnode_t *node = NULL; + + if (NULL == hss_subscription_info) { + return; + } + if (hss_subscription_info->hss_subscription_list) { + OpenAPI_list_for_each(hss_subscription_info->hss_subscription_list, node) { + OpenAPI_hss_subscription_item_free(node->data); + } + OpenAPI_list_free(hss_subscription_info->hss_subscription_list); + hss_subscription_info->hss_subscription_list = NULL; + } + ogs_free(hss_subscription_info); +} + +cJSON *OpenAPI_hss_subscription_info_convertToJSON(OpenAPI_hss_subscription_info_t *hss_subscription_info) +{ + cJSON *item = NULL; + OpenAPI_lnode_t *node = NULL; + + if (hss_subscription_info == NULL) { + ogs_error("OpenAPI_hss_subscription_info_convertToJSON() failed [HssSubscriptionInfo]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (!hss_subscription_info->hss_subscription_list) { + ogs_error("OpenAPI_hss_subscription_info_convertToJSON() failed [hss_subscription_list]"); + return NULL; + } + cJSON *hss_subscription_listList = cJSON_AddArrayToObject(item, "hssSubscriptionList"); + if (hss_subscription_listList == NULL) { + ogs_error("OpenAPI_hss_subscription_info_convertToJSON() failed [hss_subscription_list]"); + goto end; + } + OpenAPI_list_for_each(hss_subscription_info->hss_subscription_list, node) { + cJSON *itemLocal = OpenAPI_hss_subscription_item_convertToJSON(node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_hss_subscription_info_convertToJSON() failed [hss_subscription_list]"); + goto end; + } + cJSON_AddItemToArray(hss_subscription_listList, itemLocal); + } + +end: + return item; +} + +OpenAPI_hss_subscription_info_t *OpenAPI_hss_subscription_info_parseFromJSON(cJSON *hss_subscription_infoJSON) +{ + OpenAPI_hss_subscription_info_t *hss_subscription_info_local_var = NULL; + OpenAPI_lnode_t *node = NULL; + cJSON *hss_subscription_list = NULL; + OpenAPI_list_t *hss_subscription_listList = NULL; + hss_subscription_list = cJSON_GetObjectItemCaseSensitive(hss_subscription_infoJSON, "hssSubscriptionList"); + if (!hss_subscription_list) { + ogs_error("OpenAPI_hss_subscription_info_parseFromJSON() failed [hss_subscription_list]"); + goto end; + } + cJSON *hss_subscription_list_local = NULL; + if (!cJSON_IsArray(hss_subscription_list)) { + ogs_error("OpenAPI_hss_subscription_info_parseFromJSON() failed [hss_subscription_list]"); + goto end; + } + + hss_subscription_listList = OpenAPI_list_create(); + + cJSON_ArrayForEach(hss_subscription_list_local, hss_subscription_list) { + if (!cJSON_IsObject(hss_subscription_list_local)) { + ogs_error("OpenAPI_hss_subscription_info_parseFromJSON() failed [hss_subscription_list]"); + goto end; + } + OpenAPI_hss_subscription_item_t *hss_subscription_listItem = OpenAPI_hss_subscription_item_parseFromJSON(hss_subscription_list_local); + if (!hss_subscription_listItem) { + ogs_error("No hss_subscription_listItem"); + OpenAPI_list_free(hss_subscription_listList); + goto end; + } + OpenAPI_list_add(hss_subscription_listList, hss_subscription_listItem); + } + + hss_subscription_info_local_var = OpenAPI_hss_subscription_info_create ( + hss_subscription_listList + ); + + return hss_subscription_info_local_var; +end: + if (hss_subscription_listList) { + OpenAPI_list_for_each(hss_subscription_listList, node) { + OpenAPI_hss_subscription_item_free(node->data); + } + OpenAPI_list_free(hss_subscription_listList); + hss_subscription_listList = NULL; + } + return NULL; +} + +OpenAPI_hss_subscription_info_t *OpenAPI_hss_subscription_info_copy(OpenAPI_hss_subscription_info_t *dst, OpenAPI_hss_subscription_info_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_hss_subscription_info_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_hss_subscription_info_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_hss_subscription_info_free(dst); + dst = OpenAPI_hss_subscription_info_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/hss_subscription_info.h b/lib/sbi/openapi/model/hss_subscription_info.h new file mode 100644 index 000000000..db8017310 --- /dev/null +++ b/lib/sbi/openapi/model/hss_subscription_info.h @@ -0,0 +1,39 @@ +/* + * hss_subscription_info.h + * + * Information related to active subscriptions at the HSS(s) + */ + +#ifndef _OpenAPI_hss_subscription_info_H_ +#define _OpenAPI_hss_subscription_info_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "hss_subscription_item.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_hss_subscription_info_s OpenAPI_hss_subscription_info_t; +typedef struct OpenAPI_hss_subscription_info_s { + OpenAPI_list_t *hss_subscription_list; +} OpenAPI_hss_subscription_info_t; + +OpenAPI_hss_subscription_info_t *OpenAPI_hss_subscription_info_create( + OpenAPI_list_t *hss_subscription_list +); +void OpenAPI_hss_subscription_info_free(OpenAPI_hss_subscription_info_t *hss_subscription_info); +OpenAPI_hss_subscription_info_t *OpenAPI_hss_subscription_info_parseFromJSON(cJSON *hss_subscription_infoJSON); +cJSON *OpenAPI_hss_subscription_info_convertToJSON(OpenAPI_hss_subscription_info_t *hss_subscription_info); +OpenAPI_hss_subscription_info_t *OpenAPI_hss_subscription_info_copy(OpenAPI_hss_subscription_info_t *dst, OpenAPI_hss_subscription_info_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_hss_subscription_info_H_ */ + diff --git a/lib/sbi/openapi/model/hss_subscription_item.c b/lib/sbi/openapi/model/hss_subscription_item.c new file mode 100644 index 000000000..b34375250 --- /dev/null +++ b/lib/sbi/openapi/model/hss_subscription_item.c @@ -0,0 +1,172 @@ + +#include +#include +#include +#include "hss_subscription_item.h" + +OpenAPI_hss_subscription_item_t *OpenAPI_hss_subscription_item_create( + char *hss_instance_id, + char *subscription_id, + OpenAPI_context_info_t *context_info +) +{ + OpenAPI_hss_subscription_item_t *hss_subscription_item_local_var = ogs_malloc(sizeof(OpenAPI_hss_subscription_item_t)); + ogs_assert(hss_subscription_item_local_var); + + hss_subscription_item_local_var->hss_instance_id = hss_instance_id; + hss_subscription_item_local_var->subscription_id = subscription_id; + hss_subscription_item_local_var->context_info = context_info; + + return hss_subscription_item_local_var; +} + +void OpenAPI_hss_subscription_item_free(OpenAPI_hss_subscription_item_t *hss_subscription_item) +{ + OpenAPI_lnode_t *node = NULL; + + if (NULL == hss_subscription_item) { + return; + } + if (hss_subscription_item->hss_instance_id) { + ogs_free(hss_subscription_item->hss_instance_id); + hss_subscription_item->hss_instance_id = NULL; + } + if (hss_subscription_item->subscription_id) { + ogs_free(hss_subscription_item->subscription_id); + hss_subscription_item->subscription_id = NULL; + } + if (hss_subscription_item->context_info) { + OpenAPI_context_info_free(hss_subscription_item->context_info); + hss_subscription_item->context_info = NULL; + } + ogs_free(hss_subscription_item); +} + +cJSON *OpenAPI_hss_subscription_item_convertToJSON(OpenAPI_hss_subscription_item_t *hss_subscription_item) +{ + cJSON *item = NULL; + OpenAPI_lnode_t *node = NULL; + + if (hss_subscription_item == NULL) { + ogs_error("OpenAPI_hss_subscription_item_convertToJSON() failed [HssSubscriptionItem]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (!hss_subscription_item->hss_instance_id) { + ogs_error("OpenAPI_hss_subscription_item_convertToJSON() failed [hss_instance_id]"); + return NULL; + } + if (cJSON_AddStringToObject(item, "hssInstanceId", hss_subscription_item->hss_instance_id) == NULL) { + ogs_error("OpenAPI_hss_subscription_item_convertToJSON() failed [hss_instance_id]"); + goto end; + } + + if (!hss_subscription_item->subscription_id) { + ogs_error("OpenAPI_hss_subscription_item_convertToJSON() failed [subscription_id]"); + return NULL; + } + if (cJSON_AddStringToObject(item, "subscriptionId", hss_subscription_item->subscription_id) == NULL) { + ogs_error("OpenAPI_hss_subscription_item_convertToJSON() failed [subscription_id]"); + goto end; + } + + if (hss_subscription_item->context_info) { + cJSON *context_info_local_JSON = OpenAPI_context_info_convertToJSON(hss_subscription_item->context_info); + if (context_info_local_JSON == NULL) { + ogs_error("OpenAPI_hss_subscription_item_convertToJSON() failed [context_info]"); + goto end; + } + cJSON_AddItemToObject(item, "contextInfo", context_info_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_hss_subscription_item_convertToJSON() failed [context_info]"); + goto end; + } + } + +end: + return item; +} + +OpenAPI_hss_subscription_item_t *OpenAPI_hss_subscription_item_parseFromJSON(cJSON *hss_subscription_itemJSON) +{ + OpenAPI_hss_subscription_item_t *hss_subscription_item_local_var = NULL; + OpenAPI_lnode_t *node = NULL; + cJSON *hss_instance_id = NULL; + cJSON *subscription_id = NULL; + cJSON *context_info = NULL; + OpenAPI_context_info_t *context_info_local_nonprim = NULL; + hss_instance_id = cJSON_GetObjectItemCaseSensitive(hss_subscription_itemJSON, "hssInstanceId"); + if (!hss_instance_id) { + ogs_error("OpenAPI_hss_subscription_item_parseFromJSON() failed [hss_instance_id]"); + goto end; + } + if (!cJSON_IsString(hss_instance_id)) { + ogs_error("OpenAPI_hss_subscription_item_parseFromJSON() failed [hss_instance_id]"); + goto end; + } + + subscription_id = cJSON_GetObjectItemCaseSensitive(hss_subscription_itemJSON, "subscriptionId"); + if (!subscription_id) { + ogs_error("OpenAPI_hss_subscription_item_parseFromJSON() failed [subscription_id]"); + goto end; + } + if (!cJSON_IsString(subscription_id)) { + ogs_error("OpenAPI_hss_subscription_item_parseFromJSON() failed [subscription_id]"); + goto end; + } + + context_info = cJSON_GetObjectItemCaseSensitive(hss_subscription_itemJSON, "contextInfo"); + if (context_info) { + context_info_local_nonprim = OpenAPI_context_info_parseFromJSON(context_info); + } + + hss_subscription_item_local_var = OpenAPI_hss_subscription_item_create ( + ogs_strdup(hss_instance_id->valuestring), + ogs_strdup(subscription_id->valuestring), + context_info ? context_info_local_nonprim : NULL + ); + + return hss_subscription_item_local_var; +end: + if (context_info_local_nonprim) { + OpenAPI_context_info_free(context_info_local_nonprim); + context_info_local_nonprim = NULL; + } + return NULL; +} + +OpenAPI_hss_subscription_item_t *OpenAPI_hss_subscription_item_copy(OpenAPI_hss_subscription_item_t *dst, OpenAPI_hss_subscription_item_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_hss_subscription_item_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_hss_subscription_item_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_hss_subscription_item_free(dst); + dst = OpenAPI_hss_subscription_item_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/hss_subscription_item.h b/lib/sbi/openapi/model/hss_subscription_item.h new file mode 100644 index 000000000..dd6f166d1 --- /dev/null +++ b/lib/sbi/openapi/model/hss_subscription_item.h @@ -0,0 +1,43 @@ +/* + * hss_subscription_item.h + * + * Contains info about a single HSS event subscription + */ + +#ifndef _OpenAPI_hss_subscription_item_H_ +#define _OpenAPI_hss_subscription_item_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "context_info.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_hss_subscription_item_s OpenAPI_hss_subscription_item_t; +typedef struct OpenAPI_hss_subscription_item_s { + char *hss_instance_id; + char *subscription_id; + struct OpenAPI_context_info_s *context_info; +} OpenAPI_hss_subscription_item_t; + +OpenAPI_hss_subscription_item_t *OpenAPI_hss_subscription_item_create( + char *hss_instance_id, + char *subscription_id, + OpenAPI_context_info_t *context_info +); +void OpenAPI_hss_subscription_item_free(OpenAPI_hss_subscription_item_t *hss_subscription_item); +OpenAPI_hss_subscription_item_t *OpenAPI_hss_subscription_item_parseFromJSON(cJSON *hss_subscription_itemJSON); +cJSON *OpenAPI_hss_subscription_item_convertToJSON(OpenAPI_hss_subscription_item_t *hss_subscription_item); +OpenAPI_hss_subscription_item_t *OpenAPI_hss_subscription_item_copy(OpenAPI_hss_subscription_item_t *dst, OpenAPI_hss_subscription_item_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_hss_subscription_item_H_ */ + diff --git a/lib/sbi/openapi/model/id_translation_result.c b/lib/sbi/openapi/model/id_translation_result.c index 5310cc349..ddd58a6e2 100644 --- a/lib/sbi/openapi/model/id_translation_result.c +++ b/lib/sbi/openapi/model/id_translation_result.c @@ -7,7 +7,9 @@ OpenAPI_id_translation_result_t *OpenAPI_id_translation_result_create( char *supported_features, char *supi, - char *gpsi + char *gpsi, + OpenAPI_list_t *additional_supis, + OpenAPI_list_t *additional_gpsis ) { OpenAPI_id_translation_result_t *id_translation_result_local_var = ogs_malloc(sizeof(OpenAPI_id_translation_result_t)); @@ -16,6 +18,8 @@ OpenAPI_id_translation_result_t *OpenAPI_id_translation_result_create( id_translation_result_local_var->supported_features = supported_features; id_translation_result_local_var->supi = supi; id_translation_result_local_var->gpsi = gpsi; + id_translation_result_local_var->additional_supis = additional_supis; + id_translation_result_local_var->additional_gpsis = additional_gpsis; return id_translation_result_local_var; } @@ -39,6 +43,20 @@ void OpenAPI_id_translation_result_free(OpenAPI_id_translation_result_t *id_tran ogs_free(id_translation_result->gpsi); id_translation_result->gpsi = NULL; } + if (id_translation_result->additional_supis) { + OpenAPI_list_for_each(id_translation_result->additional_supis, node) { + ogs_free(node->data); + } + OpenAPI_list_free(id_translation_result->additional_supis); + id_translation_result->additional_supis = NULL; + } + if (id_translation_result->additional_gpsis) { + OpenAPI_list_for_each(id_translation_result->additional_gpsis, node) { + ogs_free(node->data); + } + OpenAPI_list_free(id_translation_result->additional_gpsis); + id_translation_result->additional_gpsis = NULL; + } ogs_free(id_translation_result); } @@ -76,6 +94,34 @@ cJSON *OpenAPI_id_translation_result_convertToJSON(OpenAPI_id_translation_result } } + if (id_translation_result->additional_supis) { + cJSON *additional_supisList = cJSON_AddArrayToObject(item, "additionalSupis"); + if (additional_supisList == NULL) { + ogs_error("OpenAPI_id_translation_result_convertToJSON() failed [additional_supis]"); + goto end; + } + OpenAPI_list_for_each(id_translation_result->additional_supis, node) { + if (cJSON_AddStringToObject(additional_supisList, "", (char*)node->data) == NULL) { + ogs_error("OpenAPI_id_translation_result_convertToJSON() failed [additional_supis]"); + goto end; + } + } + } + + if (id_translation_result->additional_gpsis) { + cJSON *additional_gpsisList = cJSON_AddArrayToObject(item, "additionalGpsis"); + if (additional_gpsisList == NULL) { + ogs_error("OpenAPI_id_translation_result_convertToJSON() failed [additional_gpsis]"); + goto end; + } + OpenAPI_list_for_each(id_translation_result->additional_gpsis, node) { + if (cJSON_AddStringToObject(additional_gpsisList, "", (char*)node->data) == NULL) { + ogs_error("OpenAPI_id_translation_result_convertToJSON() failed [additional_gpsis]"); + goto end; + } + } + } + end: return item; } @@ -87,6 +133,10 @@ OpenAPI_id_translation_result_t *OpenAPI_id_translation_result_parseFromJSON(cJS cJSON *supported_features = NULL; cJSON *supi = NULL; cJSON *gpsi = NULL; + cJSON *additional_supis = NULL; + OpenAPI_list_t *additional_supisList = NULL; + cJSON *additional_gpsis = NULL; + OpenAPI_list_t *additional_gpsisList = NULL; supported_features = cJSON_GetObjectItemCaseSensitive(id_translation_resultJSON, "supportedFeatures"); if (supported_features) { if (!cJSON_IsString(supported_features) && !cJSON_IsNull(supported_features)) { @@ -113,14 +163,72 @@ OpenAPI_id_translation_result_t *OpenAPI_id_translation_result_parseFromJSON(cJS } } + additional_supis = cJSON_GetObjectItemCaseSensitive(id_translation_resultJSON, "additionalSupis"); + if (additional_supis) { + cJSON *additional_supis_local = NULL; + if (!cJSON_IsArray(additional_supis)) { + ogs_error("OpenAPI_id_translation_result_parseFromJSON() failed [additional_supis]"); + goto end; + } + + additional_supisList = OpenAPI_list_create(); + + cJSON_ArrayForEach(additional_supis_local, additional_supis) { + double *localDouble = NULL; + int *localInt = NULL; + if (!cJSON_IsString(additional_supis_local)) { + ogs_error("OpenAPI_id_translation_result_parseFromJSON() failed [additional_supis]"); + goto end; + } + OpenAPI_list_add(additional_supisList, ogs_strdup(additional_supis_local->valuestring)); + } + } + + additional_gpsis = cJSON_GetObjectItemCaseSensitive(id_translation_resultJSON, "additionalGpsis"); + if (additional_gpsis) { + cJSON *additional_gpsis_local = NULL; + if (!cJSON_IsArray(additional_gpsis)) { + ogs_error("OpenAPI_id_translation_result_parseFromJSON() failed [additional_gpsis]"); + goto end; + } + + additional_gpsisList = OpenAPI_list_create(); + + cJSON_ArrayForEach(additional_gpsis_local, additional_gpsis) { + double *localDouble = NULL; + int *localInt = NULL; + if (!cJSON_IsString(additional_gpsis_local)) { + ogs_error("OpenAPI_id_translation_result_parseFromJSON() failed [additional_gpsis]"); + goto end; + } + OpenAPI_list_add(additional_gpsisList, ogs_strdup(additional_gpsis_local->valuestring)); + } + } + id_translation_result_local_var = OpenAPI_id_translation_result_create ( supported_features && !cJSON_IsNull(supported_features) ? ogs_strdup(supported_features->valuestring) : NULL, ogs_strdup(supi->valuestring), - gpsi && !cJSON_IsNull(gpsi) ? ogs_strdup(gpsi->valuestring) : NULL + gpsi && !cJSON_IsNull(gpsi) ? ogs_strdup(gpsi->valuestring) : NULL, + additional_supis ? additional_supisList : NULL, + additional_gpsis ? additional_gpsisList : NULL ); return id_translation_result_local_var; end: + if (additional_supisList) { + OpenAPI_list_for_each(additional_supisList, node) { + ogs_free(node->data); + } + OpenAPI_list_free(additional_supisList); + additional_supisList = NULL; + } + if (additional_gpsisList) { + OpenAPI_list_for_each(additional_gpsisList, node) { + ogs_free(node->data); + } + OpenAPI_list_free(additional_gpsisList); + additional_gpsisList = NULL; + } return NULL; } diff --git a/lib/sbi/openapi/model/id_translation_result.h b/lib/sbi/openapi/model/id_translation_result.h index 58723ec83..0d2e0ddf7 100644 --- a/lib/sbi/openapi/model/id_translation_result.h +++ b/lib/sbi/openapi/model/id_translation_result.h @@ -22,12 +22,16 @@ typedef struct OpenAPI_id_translation_result_s { char *supported_features; char *supi; char *gpsi; + OpenAPI_list_t *additional_supis; + OpenAPI_list_t *additional_gpsis; } OpenAPI_id_translation_result_t; OpenAPI_id_translation_result_t *OpenAPI_id_translation_result_create( char *supported_features, char *supi, - char *gpsi + char *gpsi, + OpenAPI_list_t *additional_supis, + OpenAPI_list_t *additional_gpsis ); void OpenAPI_id_translation_result_free(OpenAPI_id_translation_result_t *id_translation_result); OpenAPI_id_translation_result_t *OpenAPI_id_translation_result_parseFromJSON(cJSON *id_translation_resultJSON); diff --git a/lib/sbi/openapi/model/identity_data.c b/lib/sbi/openapi/model/identity_data.c index 3a3ee1090..d8344adc0 100644 --- a/lib/sbi/openapi/model/identity_data.c +++ b/lib/sbi/openapi/model/identity_data.c @@ -6,7 +6,9 @@ OpenAPI_identity_data_t *OpenAPI_identity_data_create( OpenAPI_list_t *supi_list, - OpenAPI_list_t *gpsi_list + OpenAPI_list_t *gpsi_list, + OpenAPI_list_t *allowed_af_ids, + OpenAPI_list_t* application_port_ids ) { OpenAPI_identity_data_t *identity_data_local_var = ogs_malloc(sizeof(OpenAPI_identity_data_t)); @@ -14,6 +16,8 @@ OpenAPI_identity_data_t *OpenAPI_identity_data_create( identity_data_local_var->supi_list = supi_list; identity_data_local_var->gpsi_list = gpsi_list; + identity_data_local_var->allowed_af_ids = allowed_af_ids; + identity_data_local_var->application_port_ids = application_port_ids; return identity_data_local_var; } @@ -39,6 +43,23 @@ void OpenAPI_identity_data_free(OpenAPI_identity_data_t *identity_data) OpenAPI_list_free(identity_data->gpsi_list); identity_data->gpsi_list = NULL; } + if (identity_data->allowed_af_ids) { + OpenAPI_list_for_each(identity_data->allowed_af_ids, node) { + ogs_free(node->data); + } + OpenAPI_list_free(identity_data->allowed_af_ids); + identity_data->allowed_af_ids = NULL; + } + if (identity_data->application_port_ids) { + OpenAPI_list_for_each(identity_data->application_port_ids, node) { + OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*)node->data; + ogs_free(localKeyValue->key); + ogs_free(localKeyValue->value); + OpenAPI_map_free(localKeyValue); + } + OpenAPI_list_free(identity_data->application_port_ids); + identity_data->application_port_ids = NULL; + } ogs_free(identity_data); } @@ -81,6 +102,38 @@ cJSON *OpenAPI_identity_data_convertToJSON(OpenAPI_identity_data_t *identity_dat } } + if (identity_data->allowed_af_ids) { + cJSON *allowed_af_idsList = cJSON_AddArrayToObject(item, "allowedAfIds"); + if (allowed_af_idsList == NULL) { + ogs_error("OpenAPI_identity_data_convertToJSON() failed [allowed_af_ids]"); + goto end; + } + OpenAPI_list_for_each(identity_data->allowed_af_ids, node) { + if (cJSON_AddStringToObject(allowed_af_idsList, "", (char*)node->data) == NULL) { + ogs_error("OpenAPI_identity_data_convertToJSON() failed [allowed_af_ids]"); + goto end; + } + } + } + + if (identity_data->application_port_ids) { + cJSON *application_port_ids = cJSON_AddObjectToObject(item, "applicationPortIds"); + if (application_port_ids == NULL) { + ogs_error("OpenAPI_identity_data_convertToJSON() failed [application_port_ids]"); + goto end; + } + cJSON *localMapObject = application_port_ids; + if (identity_data->application_port_ids) { + OpenAPI_list_for_each(identity_data->application_port_ids, node) { + OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*)node->data; + if (cJSON_AddStringToObject(localMapObject, localKeyValue->key, (char*)localKeyValue->value) == NULL) { + ogs_error("OpenAPI_identity_data_convertToJSON() failed [inner]"); + goto end; + } + } + } + } + end: return item; } @@ -93,6 +146,10 @@ OpenAPI_identity_data_t *OpenAPI_identity_data_parseFromJSON(cJSON *identity_dat OpenAPI_list_t *supi_listList = NULL; cJSON *gpsi_list = NULL; OpenAPI_list_t *gpsi_listList = NULL; + cJSON *allowed_af_ids = NULL; + OpenAPI_list_t *allowed_af_idsList = NULL; + cJSON *application_port_ids = NULL; + OpenAPI_list_t *application_port_idsList = NULL; supi_list = cJSON_GetObjectItemCaseSensitive(identity_dataJSON, "supiList"); if (supi_list) { cJSON *supi_list_local = NULL; @@ -135,9 +192,56 @@ OpenAPI_identity_data_t *OpenAPI_identity_data_parseFromJSON(cJSON *identity_dat } } + allowed_af_ids = cJSON_GetObjectItemCaseSensitive(identity_dataJSON, "allowedAfIds"); + if (allowed_af_ids) { + cJSON *allowed_af_ids_local = NULL; + if (!cJSON_IsArray(allowed_af_ids)) { + ogs_error("OpenAPI_identity_data_parseFromJSON() failed [allowed_af_ids]"); + goto end; + } + + allowed_af_idsList = OpenAPI_list_create(); + + cJSON_ArrayForEach(allowed_af_ids_local, allowed_af_ids) { + double *localDouble = NULL; + int *localInt = NULL; + if (!cJSON_IsString(allowed_af_ids_local)) { + ogs_error("OpenAPI_identity_data_parseFromJSON() failed [allowed_af_ids]"); + goto end; + } + OpenAPI_list_add(allowed_af_idsList, ogs_strdup(allowed_af_ids_local->valuestring)); + } + } + + application_port_ids = cJSON_GetObjectItemCaseSensitive(identity_dataJSON, "applicationPortIds"); + if (application_port_ids) { + cJSON *application_port_ids_local_map = NULL; + if (!cJSON_IsObject(application_port_ids) && !cJSON_IsNull(application_port_ids)) { + ogs_error("OpenAPI_identity_data_parseFromJSON() failed [application_port_ids]"); + goto end; + } + if (cJSON_IsObject(application_port_ids)) { + application_port_idsList = OpenAPI_list_create(); + OpenAPI_map_t *localMapKeyPair = NULL; + cJSON_ArrayForEach(application_port_ids_local_map, application_port_ids) { + cJSON *localMapObject = application_port_ids_local_map; + double *localDouble = NULL; + int *localInt = NULL; + if (!cJSON_IsString(localMapObject)) { + ogs_error("OpenAPI_identity_data_parseFromJSON() failed [inner]"); + goto end; + } + localMapKeyPair = OpenAPI_map_create(ogs_strdup(localMapObject->string), ogs_strdup(localMapObject->valuestring)); + OpenAPI_list_add(application_port_idsList, localMapKeyPair); + } + } + } + identity_data_local_var = OpenAPI_identity_data_create ( supi_list ? supi_listList : NULL, - gpsi_list ? gpsi_listList : NULL + gpsi_list ? gpsi_listList : NULL, + allowed_af_ids ? allowed_af_idsList : NULL, + application_port_ids ? application_port_idsList : NULL ); return identity_data_local_var; @@ -156,6 +260,23 @@ end: OpenAPI_list_free(gpsi_listList); gpsi_listList = NULL; } + if (allowed_af_idsList) { + OpenAPI_list_for_each(allowed_af_idsList, node) { + ogs_free(node->data); + } + OpenAPI_list_free(allowed_af_idsList); + allowed_af_idsList = NULL; + } + if (application_port_idsList) { + OpenAPI_list_for_each(application_port_idsList, node) { + OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*) node->data; + ogs_free(localKeyValue->key); + ogs_free(localKeyValue->value); + OpenAPI_map_free(localKeyValue); + } + OpenAPI_list_free(application_port_idsList); + application_port_idsList = NULL; + } return NULL; } diff --git a/lib/sbi/openapi/model/identity_data.h b/lib/sbi/openapi/model/identity_data.h index 210edac1a..0a4ca68d5 100644 --- a/lib/sbi/openapi/model/identity_data.h +++ b/lib/sbi/openapi/model/identity_data.h @@ -1,7 +1,7 @@ /* * identity_data.h * - * + * Identity data corresponds to the provided ueId. */ #ifndef _OpenAPI_identity_data_H_ @@ -21,11 +21,15 @@ typedef struct OpenAPI_identity_data_s OpenAPI_identity_data_t; typedef struct OpenAPI_identity_data_s { OpenAPI_list_t *supi_list; OpenAPI_list_t *gpsi_list; + OpenAPI_list_t *allowed_af_ids; + OpenAPI_list_t* application_port_ids; } OpenAPI_identity_data_t; OpenAPI_identity_data_t *OpenAPI_identity_data_create( OpenAPI_list_t *supi_list, - OpenAPI_list_t *gpsi_list + OpenAPI_list_t *gpsi_list, + OpenAPI_list_t *allowed_af_ids, + OpenAPI_list_t* application_port_ids ); void OpenAPI_identity_data_free(OpenAPI_identity_data_t *identity_data); OpenAPI_identity_data_t *OpenAPI_identity_data_parseFromJSON(cJSON *identity_dataJSON); diff --git a/lib/sbi/openapi/model/identity_range.h b/lib/sbi/openapi/model/identity_range.h index 588d82f2f..7e8f93d19 100644 --- a/lib/sbi/openapi/model/identity_range.h +++ b/lib/sbi/openapi/model/identity_range.h @@ -1,7 +1,7 @@ /* * identity_range.h * - * A range of GPSIs (subscriber identities), either based on a numeric range, or based on regular-expression matching + * A range of GPSIs (subscriber identities), either based on a numeric range, or based on regular-expression matching */ #ifndef _OpenAPI_identity_range_H_ diff --git a/lib/sbi/openapi/model/immediate_mdt_conf.h b/lib/sbi/openapi/model/immediate_mdt_conf.h index 4f46167c4..b031f9860 100644 --- a/lib/sbi/openapi/model/immediate_mdt_conf.h +++ b/lib/sbi/openapi/model/immediate_mdt_conf.h @@ -1,7 +1,7 @@ /* * immediate_mdt_conf.h * - * + * Immediate MDT Configuration */ #ifndef _OpenAPI_immediate_mdt_conf_H_ diff --git a/lib/sbi/openapi/model/immediate_report.c b/lib/sbi/openapi/model/immediate_report.c new file mode 100644 index 000000000..fa1dde62e --- /dev/null +++ b/lib/sbi/openapi/model/immediate_report.c @@ -0,0 +1,583 @@ + +#include +#include +#include +#include "immediate_report.h" + +OpenAPI_immediate_report_t *OpenAPI_immediate_report_create( + OpenAPI_access_and_mobility_subscription_data_t *am_data, + OpenAPI_smf_selection_subscription_data_t *smf_sel_data, + OpenAPI_ue_context_in_amf_data_t *uec_amf_data, + OpenAPI_ue_context_in_smf_data_t *uec_smf_data, + OpenAPI_ue_context_in_smsf_data_t *uec_smsf_data, + OpenAPI_sms_subscription_data_t *sms_subs_data, + OpenAPI_sm_subs_data_t *sm_data, + OpenAPI_trace_data_t *trace_data, + OpenAPI_sms_management_subscription_data_t *sms_mng_data, + OpenAPI_lcs_privacy_data_t *lcs_privacy_data, + OpenAPI_lcs_mo_data_t *lcs_mo_data, + OpenAPI_v2x_subscription_data_t *v2x_data, + OpenAPI_lcs_broadcast_assistance_types_data_t *lcs_broadcast_assistance_types_data, + OpenAPI_prose_subscription_data_t *prose_data, + OpenAPI_mbs_subscription_data_t *mbs_data, + OpenAPI_uc_subscription_data_t *uc_data +) +{ + OpenAPI_immediate_report_t *immediate_report_local_var = ogs_malloc(sizeof(OpenAPI_immediate_report_t)); + ogs_assert(immediate_report_local_var); + + immediate_report_local_var->am_data = am_data; + immediate_report_local_var->smf_sel_data = smf_sel_data; + immediate_report_local_var->uec_amf_data = uec_amf_data; + immediate_report_local_var->uec_smf_data = uec_smf_data; + immediate_report_local_var->uec_smsf_data = uec_smsf_data; + immediate_report_local_var->sms_subs_data = sms_subs_data; + immediate_report_local_var->sm_data = sm_data; + immediate_report_local_var->trace_data = trace_data; + immediate_report_local_var->sms_mng_data = sms_mng_data; + immediate_report_local_var->lcs_privacy_data = lcs_privacy_data; + immediate_report_local_var->lcs_mo_data = lcs_mo_data; + immediate_report_local_var->v2x_data = v2x_data; + immediate_report_local_var->lcs_broadcast_assistance_types_data = lcs_broadcast_assistance_types_data; + immediate_report_local_var->prose_data = prose_data; + immediate_report_local_var->mbs_data = mbs_data; + immediate_report_local_var->uc_data = uc_data; + + return immediate_report_local_var; +} + +void OpenAPI_immediate_report_free(OpenAPI_immediate_report_t *immediate_report) +{ + OpenAPI_lnode_t *node = NULL; + + if (NULL == immediate_report) { + return; + } + if (immediate_report->am_data) { + OpenAPI_access_and_mobility_subscription_data_free(immediate_report->am_data); + immediate_report->am_data = NULL; + } + if (immediate_report->smf_sel_data) { + OpenAPI_smf_selection_subscription_data_free(immediate_report->smf_sel_data); + immediate_report->smf_sel_data = NULL; + } + if (immediate_report->uec_amf_data) { + OpenAPI_ue_context_in_amf_data_free(immediate_report->uec_amf_data); + immediate_report->uec_amf_data = NULL; + } + if (immediate_report->uec_smf_data) { + OpenAPI_ue_context_in_smf_data_free(immediate_report->uec_smf_data); + immediate_report->uec_smf_data = NULL; + } + if (immediate_report->uec_smsf_data) { + OpenAPI_ue_context_in_smsf_data_free(immediate_report->uec_smsf_data); + immediate_report->uec_smsf_data = NULL; + } + if (immediate_report->sms_subs_data) { + OpenAPI_sms_subscription_data_free(immediate_report->sms_subs_data); + immediate_report->sms_subs_data = NULL; + } + if (immediate_report->sm_data) { + OpenAPI_sm_subs_data_free(immediate_report->sm_data); + immediate_report->sm_data = NULL; + } + if (immediate_report->trace_data) { + OpenAPI_trace_data_free(immediate_report->trace_data); + immediate_report->trace_data = NULL; + } + if (immediate_report->sms_mng_data) { + OpenAPI_sms_management_subscription_data_free(immediate_report->sms_mng_data); + immediate_report->sms_mng_data = NULL; + } + if (immediate_report->lcs_privacy_data) { + OpenAPI_lcs_privacy_data_free(immediate_report->lcs_privacy_data); + immediate_report->lcs_privacy_data = NULL; + } + if (immediate_report->lcs_mo_data) { + OpenAPI_lcs_mo_data_free(immediate_report->lcs_mo_data); + immediate_report->lcs_mo_data = NULL; + } + if (immediate_report->v2x_data) { + OpenAPI_v2x_subscription_data_free(immediate_report->v2x_data); + immediate_report->v2x_data = NULL; + } + if (immediate_report->lcs_broadcast_assistance_types_data) { + OpenAPI_lcs_broadcast_assistance_types_data_free(immediate_report->lcs_broadcast_assistance_types_data); + immediate_report->lcs_broadcast_assistance_types_data = NULL; + } + if (immediate_report->prose_data) { + OpenAPI_prose_subscription_data_free(immediate_report->prose_data); + immediate_report->prose_data = NULL; + } + if (immediate_report->mbs_data) { + OpenAPI_mbs_subscription_data_free(immediate_report->mbs_data); + immediate_report->mbs_data = NULL; + } + if (immediate_report->uc_data) { + OpenAPI_uc_subscription_data_free(immediate_report->uc_data); + immediate_report->uc_data = NULL; + } + ogs_free(immediate_report); +} + +cJSON *OpenAPI_immediate_report_convertToJSON(OpenAPI_immediate_report_t *immediate_report) +{ + cJSON *item = NULL; + OpenAPI_lnode_t *node = NULL; + + if (immediate_report == NULL) { + ogs_error("OpenAPI_immediate_report_convertToJSON() failed [ImmediateReport]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (immediate_report->am_data) { + cJSON *am_data_local_JSON = OpenAPI_access_and_mobility_subscription_data_convertToJSON(immediate_report->am_data); + if (am_data_local_JSON == NULL) { + ogs_error("OpenAPI_immediate_report_convertToJSON() failed [am_data]"); + goto end; + } + cJSON_AddItemToObject(item, "amData", am_data_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_immediate_report_convertToJSON() failed [am_data]"); + goto end; + } + } + + if (immediate_report->smf_sel_data) { + cJSON *smf_sel_data_local_JSON = OpenAPI_smf_selection_subscription_data_convertToJSON(immediate_report->smf_sel_data); + if (smf_sel_data_local_JSON == NULL) { + ogs_error("OpenAPI_immediate_report_convertToJSON() failed [smf_sel_data]"); + goto end; + } + cJSON_AddItemToObject(item, "smfSelData", smf_sel_data_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_immediate_report_convertToJSON() failed [smf_sel_data]"); + goto end; + } + } + + if (immediate_report->uec_amf_data) { + cJSON *uec_amf_data_local_JSON = OpenAPI_ue_context_in_amf_data_convertToJSON(immediate_report->uec_amf_data); + if (uec_amf_data_local_JSON == NULL) { + ogs_error("OpenAPI_immediate_report_convertToJSON() failed [uec_amf_data]"); + goto end; + } + cJSON_AddItemToObject(item, "uecAmfData", uec_amf_data_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_immediate_report_convertToJSON() failed [uec_amf_data]"); + goto end; + } + } + + if (immediate_report->uec_smf_data) { + cJSON *uec_smf_data_local_JSON = OpenAPI_ue_context_in_smf_data_convertToJSON(immediate_report->uec_smf_data); + if (uec_smf_data_local_JSON == NULL) { + ogs_error("OpenAPI_immediate_report_convertToJSON() failed [uec_smf_data]"); + goto end; + } + cJSON_AddItemToObject(item, "uecSmfData", uec_smf_data_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_immediate_report_convertToJSON() failed [uec_smf_data]"); + goto end; + } + } + + if (immediate_report->uec_smsf_data) { + cJSON *uec_smsf_data_local_JSON = OpenAPI_ue_context_in_smsf_data_convertToJSON(immediate_report->uec_smsf_data); + if (uec_smsf_data_local_JSON == NULL) { + ogs_error("OpenAPI_immediate_report_convertToJSON() failed [uec_smsf_data]"); + goto end; + } + cJSON_AddItemToObject(item, "uecSmsfData", uec_smsf_data_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_immediate_report_convertToJSON() failed [uec_smsf_data]"); + goto end; + } + } + + if (immediate_report->sms_subs_data) { + cJSON *sms_subs_data_local_JSON = OpenAPI_sms_subscription_data_convertToJSON(immediate_report->sms_subs_data); + if (sms_subs_data_local_JSON == NULL) { + ogs_error("OpenAPI_immediate_report_convertToJSON() failed [sms_subs_data]"); + goto end; + } + cJSON_AddItemToObject(item, "smsSubsData", sms_subs_data_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_immediate_report_convertToJSON() failed [sms_subs_data]"); + goto end; + } + } + + if (immediate_report->sm_data) { + cJSON *sm_data_local_JSON = OpenAPI_sm_subs_data_convertToJSON(immediate_report->sm_data); + if (sm_data_local_JSON == NULL) { + ogs_error("OpenAPI_immediate_report_convertToJSON() failed [sm_data]"); + goto end; + } + cJSON_AddItemToObject(item, "smData", sm_data_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_immediate_report_convertToJSON() failed [sm_data]"); + goto end; + } + } + + if (immediate_report->trace_data) { + cJSON *trace_data_local_JSON = OpenAPI_trace_data_convertToJSON(immediate_report->trace_data); + if (trace_data_local_JSON == NULL) { + ogs_error("OpenAPI_immediate_report_convertToJSON() failed [trace_data]"); + goto end; + } + cJSON_AddItemToObject(item, "traceData", trace_data_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_immediate_report_convertToJSON() failed [trace_data]"); + goto end; + } + } + + if (immediate_report->sms_mng_data) { + cJSON *sms_mng_data_local_JSON = OpenAPI_sms_management_subscription_data_convertToJSON(immediate_report->sms_mng_data); + if (sms_mng_data_local_JSON == NULL) { + ogs_error("OpenAPI_immediate_report_convertToJSON() failed [sms_mng_data]"); + goto end; + } + cJSON_AddItemToObject(item, "smsMngData", sms_mng_data_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_immediate_report_convertToJSON() failed [sms_mng_data]"); + goto end; + } + } + + if (immediate_report->lcs_privacy_data) { + cJSON *lcs_privacy_data_local_JSON = OpenAPI_lcs_privacy_data_convertToJSON(immediate_report->lcs_privacy_data); + if (lcs_privacy_data_local_JSON == NULL) { + ogs_error("OpenAPI_immediate_report_convertToJSON() failed [lcs_privacy_data]"); + goto end; + } + cJSON_AddItemToObject(item, "lcsPrivacyData", lcs_privacy_data_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_immediate_report_convertToJSON() failed [lcs_privacy_data]"); + goto end; + } + } + + if (immediate_report->lcs_mo_data) { + cJSON *lcs_mo_data_local_JSON = OpenAPI_lcs_mo_data_convertToJSON(immediate_report->lcs_mo_data); + if (lcs_mo_data_local_JSON == NULL) { + ogs_error("OpenAPI_immediate_report_convertToJSON() failed [lcs_mo_data]"); + goto end; + } + cJSON_AddItemToObject(item, "lcsMoData", lcs_mo_data_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_immediate_report_convertToJSON() failed [lcs_mo_data]"); + goto end; + } + } + + if (immediate_report->v2x_data) { + cJSON *v2x_data_local_JSON = OpenAPI_v2x_subscription_data_convertToJSON(immediate_report->v2x_data); + if (v2x_data_local_JSON == NULL) { + ogs_error("OpenAPI_immediate_report_convertToJSON() failed [v2x_data]"); + goto end; + } + cJSON_AddItemToObject(item, "v2xData", v2x_data_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_immediate_report_convertToJSON() failed [v2x_data]"); + goto end; + } + } + + if (immediate_report->lcs_broadcast_assistance_types_data) { + cJSON *lcs_broadcast_assistance_types_data_local_JSON = OpenAPI_lcs_broadcast_assistance_types_data_convertToJSON(immediate_report->lcs_broadcast_assistance_types_data); + if (lcs_broadcast_assistance_types_data_local_JSON == NULL) { + ogs_error("OpenAPI_immediate_report_convertToJSON() failed [lcs_broadcast_assistance_types_data]"); + goto end; + } + cJSON_AddItemToObject(item, "lcsBroadcastAssistanceTypesData", lcs_broadcast_assistance_types_data_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_immediate_report_convertToJSON() failed [lcs_broadcast_assistance_types_data]"); + goto end; + } + } + + if (immediate_report->prose_data) { + cJSON *prose_data_local_JSON = OpenAPI_prose_subscription_data_convertToJSON(immediate_report->prose_data); + if (prose_data_local_JSON == NULL) { + ogs_error("OpenAPI_immediate_report_convertToJSON() failed [prose_data]"); + goto end; + } + cJSON_AddItemToObject(item, "proseData", prose_data_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_immediate_report_convertToJSON() failed [prose_data]"); + goto end; + } + } + + if (immediate_report->mbs_data) { + cJSON *mbs_data_local_JSON = OpenAPI_mbs_subscription_data_convertToJSON(immediate_report->mbs_data); + if (mbs_data_local_JSON == NULL) { + ogs_error("OpenAPI_immediate_report_convertToJSON() failed [mbs_data]"); + goto end; + } + cJSON_AddItemToObject(item, "mbsData", mbs_data_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_immediate_report_convertToJSON() failed [mbs_data]"); + goto end; + } + } + + if (immediate_report->uc_data) { + cJSON *uc_data_local_JSON = OpenAPI_uc_subscription_data_convertToJSON(immediate_report->uc_data); + if (uc_data_local_JSON == NULL) { + ogs_error("OpenAPI_immediate_report_convertToJSON() failed [uc_data]"); + goto end; + } + cJSON_AddItemToObject(item, "ucData", uc_data_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_immediate_report_convertToJSON() failed [uc_data]"); + goto end; + } + } + +end: + return item; +} + +OpenAPI_immediate_report_t *OpenAPI_immediate_report_parseFromJSON(cJSON *immediate_reportJSON) +{ + OpenAPI_immediate_report_t *immediate_report_local_var = NULL; + OpenAPI_lnode_t *node = NULL; + cJSON *am_data = NULL; + OpenAPI_access_and_mobility_subscription_data_t *am_data_local_nonprim = NULL; + cJSON *smf_sel_data = NULL; + OpenAPI_smf_selection_subscription_data_t *smf_sel_data_local_nonprim = NULL; + cJSON *uec_amf_data = NULL; + OpenAPI_ue_context_in_amf_data_t *uec_amf_data_local_nonprim = NULL; + cJSON *uec_smf_data = NULL; + OpenAPI_ue_context_in_smf_data_t *uec_smf_data_local_nonprim = NULL; + cJSON *uec_smsf_data = NULL; + OpenAPI_ue_context_in_smsf_data_t *uec_smsf_data_local_nonprim = NULL; + cJSON *sms_subs_data = NULL; + OpenAPI_sms_subscription_data_t *sms_subs_data_local_nonprim = NULL; + cJSON *sm_data = NULL; + OpenAPI_sm_subs_data_t *sm_data_local_nonprim = NULL; + cJSON *trace_data = NULL; + OpenAPI_trace_data_t *trace_data_local_nonprim = NULL; + cJSON *sms_mng_data = NULL; + OpenAPI_sms_management_subscription_data_t *sms_mng_data_local_nonprim = NULL; + cJSON *lcs_privacy_data = NULL; + OpenAPI_lcs_privacy_data_t *lcs_privacy_data_local_nonprim = NULL; + cJSON *lcs_mo_data = NULL; + OpenAPI_lcs_mo_data_t *lcs_mo_data_local_nonprim = NULL; + cJSON *v2x_data = NULL; + OpenAPI_v2x_subscription_data_t *v2x_data_local_nonprim = NULL; + cJSON *lcs_broadcast_assistance_types_data = NULL; + OpenAPI_lcs_broadcast_assistance_types_data_t *lcs_broadcast_assistance_types_data_local_nonprim = NULL; + cJSON *prose_data = NULL; + OpenAPI_prose_subscription_data_t *prose_data_local_nonprim = NULL; + cJSON *mbs_data = NULL; + OpenAPI_mbs_subscription_data_t *mbs_data_local_nonprim = NULL; + cJSON *uc_data = NULL; + OpenAPI_uc_subscription_data_t *uc_data_local_nonprim = NULL; + am_data = cJSON_GetObjectItemCaseSensitive(immediate_reportJSON, "amData"); + if (am_data) { + am_data_local_nonprim = OpenAPI_access_and_mobility_subscription_data_parseFromJSON(am_data); + } + + smf_sel_data = cJSON_GetObjectItemCaseSensitive(immediate_reportJSON, "smfSelData"); + if (smf_sel_data) { + smf_sel_data_local_nonprim = OpenAPI_smf_selection_subscription_data_parseFromJSON(smf_sel_data); + } + + uec_amf_data = cJSON_GetObjectItemCaseSensitive(immediate_reportJSON, "uecAmfData"); + if (uec_amf_data) { + uec_amf_data_local_nonprim = OpenAPI_ue_context_in_amf_data_parseFromJSON(uec_amf_data); + } + + uec_smf_data = cJSON_GetObjectItemCaseSensitive(immediate_reportJSON, "uecSmfData"); + if (uec_smf_data) { + uec_smf_data_local_nonprim = OpenAPI_ue_context_in_smf_data_parseFromJSON(uec_smf_data); + } + + uec_smsf_data = cJSON_GetObjectItemCaseSensitive(immediate_reportJSON, "uecSmsfData"); + if (uec_smsf_data) { + uec_smsf_data_local_nonprim = OpenAPI_ue_context_in_smsf_data_parseFromJSON(uec_smsf_data); + } + + sms_subs_data = cJSON_GetObjectItemCaseSensitive(immediate_reportJSON, "smsSubsData"); + if (sms_subs_data) { + sms_subs_data_local_nonprim = OpenAPI_sms_subscription_data_parseFromJSON(sms_subs_data); + } + + sm_data = cJSON_GetObjectItemCaseSensitive(immediate_reportJSON, "smData"); + if (sm_data) { + sm_data_local_nonprim = OpenAPI_sm_subs_data_parseFromJSON(sm_data); + } + + trace_data = cJSON_GetObjectItemCaseSensitive(immediate_reportJSON, "traceData"); + if (trace_data) { + trace_data_local_nonprim = OpenAPI_trace_data_parseFromJSON(trace_data); + } + + sms_mng_data = cJSON_GetObjectItemCaseSensitive(immediate_reportJSON, "smsMngData"); + if (sms_mng_data) { + sms_mng_data_local_nonprim = OpenAPI_sms_management_subscription_data_parseFromJSON(sms_mng_data); + } + + lcs_privacy_data = cJSON_GetObjectItemCaseSensitive(immediate_reportJSON, "lcsPrivacyData"); + if (lcs_privacy_data) { + lcs_privacy_data_local_nonprim = OpenAPI_lcs_privacy_data_parseFromJSON(lcs_privacy_data); + } + + lcs_mo_data = cJSON_GetObjectItemCaseSensitive(immediate_reportJSON, "lcsMoData"); + if (lcs_mo_data) { + lcs_mo_data_local_nonprim = OpenAPI_lcs_mo_data_parseFromJSON(lcs_mo_data); + } + + v2x_data = cJSON_GetObjectItemCaseSensitive(immediate_reportJSON, "v2xData"); + if (v2x_data) { + v2x_data_local_nonprim = OpenAPI_v2x_subscription_data_parseFromJSON(v2x_data); + } + + lcs_broadcast_assistance_types_data = cJSON_GetObjectItemCaseSensitive(immediate_reportJSON, "lcsBroadcastAssistanceTypesData"); + if (lcs_broadcast_assistance_types_data) { + lcs_broadcast_assistance_types_data_local_nonprim = OpenAPI_lcs_broadcast_assistance_types_data_parseFromJSON(lcs_broadcast_assistance_types_data); + } + + prose_data = cJSON_GetObjectItemCaseSensitive(immediate_reportJSON, "proseData"); + if (prose_data) { + prose_data_local_nonprim = OpenAPI_prose_subscription_data_parseFromJSON(prose_data); + } + + mbs_data = cJSON_GetObjectItemCaseSensitive(immediate_reportJSON, "mbsData"); + if (mbs_data) { + mbs_data_local_nonprim = OpenAPI_mbs_subscription_data_parseFromJSON(mbs_data); + } + + uc_data = cJSON_GetObjectItemCaseSensitive(immediate_reportJSON, "ucData"); + if (uc_data) { + uc_data_local_nonprim = OpenAPI_uc_subscription_data_parseFromJSON(uc_data); + } + + immediate_report_local_var = OpenAPI_immediate_report_create ( + am_data ? am_data_local_nonprim : NULL, + smf_sel_data ? smf_sel_data_local_nonprim : NULL, + uec_amf_data ? uec_amf_data_local_nonprim : NULL, + uec_smf_data ? uec_smf_data_local_nonprim : NULL, + uec_smsf_data ? uec_smsf_data_local_nonprim : NULL, + sms_subs_data ? sms_subs_data_local_nonprim : NULL, + sm_data ? sm_data_local_nonprim : NULL, + trace_data ? trace_data_local_nonprim : NULL, + sms_mng_data ? sms_mng_data_local_nonprim : NULL, + lcs_privacy_data ? lcs_privacy_data_local_nonprim : NULL, + lcs_mo_data ? lcs_mo_data_local_nonprim : NULL, + v2x_data ? v2x_data_local_nonprim : NULL, + lcs_broadcast_assistance_types_data ? lcs_broadcast_assistance_types_data_local_nonprim : NULL, + prose_data ? prose_data_local_nonprim : NULL, + mbs_data ? mbs_data_local_nonprim : NULL, + uc_data ? uc_data_local_nonprim : NULL + ); + + return immediate_report_local_var; +end: + if (am_data_local_nonprim) { + OpenAPI_access_and_mobility_subscription_data_free(am_data_local_nonprim); + am_data_local_nonprim = NULL; + } + if (smf_sel_data_local_nonprim) { + OpenAPI_smf_selection_subscription_data_free(smf_sel_data_local_nonprim); + smf_sel_data_local_nonprim = NULL; + } + if (uec_amf_data_local_nonprim) { + OpenAPI_ue_context_in_amf_data_free(uec_amf_data_local_nonprim); + uec_amf_data_local_nonprim = NULL; + } + if (uec_smf_data_local_nonprim) { + OpenAPI_ue_context_in_smf_data_free(uec_smf_data_local_nonprim); + uec_smf_data_local_nonprim = NULL; + } + if (uec_smsf_data_local_nonprim) { + OpenAPI_ue_context_in_smsf_data_free(uec_smsf_data_local_nonprim); + uec_smsf_data_local_nonprim = NULL; + } + if (sms_subs_data_local_nonprim) { + OpenAPI_sms_subscription_data_free(sms_subs_data_local_nonprim); + sms_subs_data_local_nonprim = NULL; + } + if (sm_data_local_nonprim) { + OpenAPI_sm_subs_data_free(sm_data_local_nonprim); + sm_data_local_nonprim = NULL; + } + if (trace_data_local_nonprim) { + OpenAPI_trace_data_free(trace_data_local_nonprim); + trace_data_local_nonprim = NULL; + } + if (sms_mng_data_local_nonprim) { + OpenAPI_sms_management_subscription_data_free(sms_mng_data_local_nonprim); + sms_mng_data_local_nonprim = NULL; + } + if (lcs_privacy_data_local_nonprim) { + OpenAPI_lcs_privacy_data_free(lcs_privacy_data_local_nonprim); + lcs_privacy_data_local_nonprim = NULL; + } + if (lcs_mo_data_local_nonprim) { + OpenAPI_lcs_mo_data_free(lcs_mo_data_local_nonprim); + lcs_mo_data_local_nonprim = NULL; + } + if (v2x_data_local_nonprim) { + OpenAPI_v2x_subscription_data_free(v2x_data_local_nonprim); + v2x_data_local_nonprim = NULL; + } + if (lcs_broadcast_assistance_types_data_local_nonprim) { + OpenAPI_lcs_broadcast_assistance_types_data_free(lcs_broadcast_assistance_types_data_local_nonprim); + lcs_broadcast_assistance_types_data_local_nonprim = NULL; + } + if (prose_data_local_nonprim) { + OpenAPI_prose_subscription_data_free(prose_data_local_nonprim); + prose_data_local_nonprim = NULL; + } + if (mbs_data_local_nonprim) { + OpenAPI_mbs_subscription_data_free(mbs_data_local_nonprim); + mbs_data_local_nonprim = NULL; + } + if (uc_data_local_nonprim) { + OpenAPI_uc_subscription_data_free(uc_data_local_nonprim); + uc_data_local_nonprim = NULL; + } + return NULL; +} + +OpenAPI_immediate_report_t *OpenAPI_immediate_report_copy(OpenAPI_immediate_report_t *dst, OpenAPI_immediate_report_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_immediate_report_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_immediate_report_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_immediate_report_free(dst); + dst = OpenAPI_immediate_report_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/immediate_report.h b/lib/sbi/openapi/model/immediate_report.h new file mode 100644 index 000000000..8830ad714 --- /dev/null +++ b/lib/sbi/openapi/model/immediate_report.h @@ -0,0 +1,86 @@ +/* + * immediate_report.h + * + * + */ + +#ifndef _OpenAPI_immediate_report_H_ +#define _OpenAPI_immediate_report_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "access_and_mobility_subscription_data.h" +#include "lcs_broadcast_assistance_types_data.h" +#include "lcs_mo_data.h" +#include "lcs_privacy_data.h" +#include "mbs_subscription_data.h" +#include "prose_subscription_data.h" +#include "shared_data.h" +#include "sm_subs_data.h" +#include "smf_selection_subscription_data.h" +#include "sms_management_subscription_data.h" +#include "sms_subscription_data.h" +#include "subscription_data_sets.h" +#include "trace_data.h" +#include "uc_subscription_data.h" +#include "ue_context_in_amf_data.h" +#include "ue_context_in_smf_data.h" +#include "ue_context_in_smsf_data.h" +#include "v2x_subscription_data.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_immediate_report_s OpenAPI_immediate_report_t; +typedef struct OpenAPI_immediate_report_s { + struct OpenAPI_access_and_mobility_subscription_data_s *am_data; + struct OpenAPI_smf_selection_subscription_data_s *smf_sel_data; + struct OpenAPI_ue_context_in_amf_data_s *uec_amf_data; + struct OpenAPI_ue_context_in_smf_data_s *uec_smf_data; + struct OpenAPI_ue_context_in_smsf_data_s *uec_smsf_data; + struct OpenAPI_sms_subscription_data_s *sms_subs_data; + struct OpenAPI_sm_subs_data_s *sm_data; + struct OpenAPI_trace_data_s *trace_data; + struct OpenAPI_sms_management_subscription_data_s *sms_mng_data; + struct OpenAPI_lcs_privacy_data_s *lcs_privacy_data; + struct OpenAPI_lcs_mo_data_s *lcs_mo_data; + struct OpenAPI_v2x_subscription_data_s *v2x_data; + struct OpenAPI_lcs_broadcast_assistance_types_data_s *lcs_broadcast_assistance_types_data; + struct OpenAPI_prose_subscription_data_s *prose_data; + struct OpenAPI_mbs_subscription_data_s *mbs_data; + struct OpenAPI_uc_subscription_data_s *uc_data; +} OpenAPI_immediate_report_t; + +OpenAPI_immediate_report_t *OpenAPI_immediate_report_create( + OpenAPI_access_and_mobility_subscription_data_t *am_data, + OpenAPI_smf_selection_subscription_data_t *smf_sel_data, + OpenAPI_ue_context_in_amf_data_t *uec_amf_data, + OpenAPI_ue_context_in_smf_data_t *uec_smf_data, + OpenAPI_ue_context_in_smsf_data_t *uec_smsf_data, + OpenAPI_sms_subscription_data_t *sms_subs_data, + OpenAPI_sm_subs_data_t *sm_data, + OpenAPI_trace_data_t *trace_data, + OpenAPI_sms_management_subscription_data_t *sms_mng_data, + OpenAPI_lcs_privacy_data_t *lcs_privacy_data, + OpenAPI_lcs_mo_data_t *lcs_mo_data, + OpenAPI_v2x_subscription_data_t *v2x_data, + OpenAPI_lcs_broadcast_assistance_types_data_t *lcs_broadcast_assistance_types_data, + OpenAPI_prose_subscription_data_t *prose_data, + OpenAPI_mbs_subscription_data_t *mbs_data, + OpenAPI_uc_subscription_data_t *uc_data +); +void OpenAPI_immediate_report_free(OpenAPI_immediate_report_t *immediate_report); +OpenAPI_immediate_report_t *OpenAPI_immediate_report_parseFromJSON(cJSON *immediate_reportJSON); +cJSON *OpenAPI_immediate_report_convertToJSON(OpenAPI_immediate_report_t *immediate_report); +OpenAPI_immediate_report_t *OpenAPI_immediate_report_copy(OpenAPI_immediate_report_t *dst, OpenAPI_immediate_report_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_immediate_report_H_ */ + diff --git a/lib/sbi/openapi/model/imsi_range.h b/lib/sbi/openapi/model/imsi_range.h index 1d761b470..31acf629c 100644 --- a/lib/sbi/openapi/model/imsi_range.h +++ b/lib/sbi/openapi/model/imsi_range.h @@ -1,7 +1,7 @@ /* * imsi_range.h * - * A range of IMSIs (subscriber identities), either based on a numeric range, or based on regular-expression matching + * A range of IMSIs (subscriber identities), either based on a numeric range, or based on regular-expression matching */ #ifndef _OpenAPI_imsi_range_H_ diff --git a/lib/sbi/openapi/model/indirect_data_forwarding_tunnel_info.h b/lib/sbi/openapi/model/indirect_data_forwarding_tunnel_info.h index bf780b4d6..5e20287be 100644 --- a/lib/sbi/openapi/model/indirect_data_forwarding_tunnel_info.h +++ b/lib/sbi/openapi/model/indirect_data_forwarding_tunnel_info.h @@ -1,7 +1,7 @@ /* * indirect_data_forwarding_tunnel_info.h * - * + * Indirect Data Forwarding Tunnel Information */ #ifndef _OpenAPI_indirect_data_forwarding_tunnel_info_H_ diff --git a/lib/sbi/openapi/model/inter_freq_target_info.h b/lib/sbi/openapi/model/inter_freq_target_info.h index d2163cb0d..fe8022f4f 100644 --- a/lib/sbi/openapi/model/inter_freq_target_info.h +++ b/lib/sbi/openapi/model/inter_freq_target_info.h @@ -1,7 +1,7 @@ /* * inter_freq_target_info.h * - * + * Indicates the Inter Frequency Target information. */ #ifndef _OpenAPI_inter_freq_target_info_H_ diff --git a/lib/sbi/openapi/model/inter_freq_target_info_1.h b/lib/sbi/openapi/model/inter_freq_target_info_1.h index ba5e4d475..be0226444 100644 --- a/lib/sbi/openapi/model/inter_freq_target_info_1.h +++ b/lib/sbi/openapi/model/inter_freq_target_info_1.h @@ -1,7 +1,7 @@ /* * inter_freq_target_info_1.h * - * + * Indicates the Inter Frequency Target information. */ #ifndef _OpenAPI_inter_freq_target_info_1_H_ diff --git a/lib/sbi/openapi/model/internal_group_id_range.h b/lib/sbi/openapi/model/internal_group_id_range.h index 73e4a1283..1fcf96bb6 100644 --- a/lib/sbi/openapi/model/internal_group_id_range.h +++ b/lib/sbi/openapi/model/internal_group_id_range.h @@ -1,7 +1,7 @@ /* * internal_group_id_range.h * - * A range of Group IDs (internal group identities), either based on a numeric range, or based on regular-expression matching + * A range of Group IDs (internal group identities), either based on a numeric range, or based on regular-expression matching */ #ifndef _OpenAPI_internal_group_id_range_H_ diff --git a/lib/sbi/openapi/model/invalid_param.h b/lib/sbi/openapi/model/invalid_param.h index 94948fac2..6b777cf63 100644 --- a/lib/sbi/openapi/model/invalid_param.h +++ b/lib/sbi/openapi/model/invalid_param.h @@ -1,7 +1,7 @@ /* * invalid_param.h * - * + * It contains an invalid parameter and a related description. */ #ifndef _OpenAPI_invalid_param_H_ diff --git a/lib/sbi/openapi/model/invalid_param_1.c b/lib/sbi/openapi/model/invalid_param_1.c deleted file mode 100644 index 6354e4d87..000000000 --- a/lib/sbi/openapi/model/invalid_param_1.c +++ /dev/null @@ -1,137 +0,0 @@ - -#include -#include -#include -#include "invalid_param_1.h" - -OpenAPI_invalid_param_1_t *OpenAPI_invalid_param_1_create( - char *param, - char *reason -) -{ - OpenAPI_invalid_param_1_t *invalid_param_1_local_var = ogs_malloc(sizeof(OpenAPI_invalid_param_1_t)); - ogs_assert(invalid_param_1_local_var); - - invalid_param_1_local_var->param = param; - invalid_param_1_local_var->reason = reason; - - return invalid_param_1_local_var; -} - -void OpenAPI_invalid_param_1_free(OpenAPI_invalid_param_1_t *invalid_param_1) -{ - OpenAPI_lnode_t *node = NULL; - - if (NULL == invalid_param_1) { - return; - } - if (invalid_param_1->param) { - ogs_free(invalid_param_1->param); - invalid_param_1->param = NULL; - } - if (invalid_param_1->reason) { - ogs_free(invalid_param_1->reason); - invalid_param_1->reason = NULL; - } - ogs_free(invalid_param_1); -} - -cJSON *OpenAPI_invalid_param_1_convertToJSON(OpenAPI_invalid_param_1_t *invalid_param_1) -{ - cJSON *item = NULL; - OpenAPI_lnode_t *node = NULL; - - if (invalid_param_1 == NULL) { - ogs_error("OpenAPI_invalid_param_1_convertToJSON() failed [InvalidParam_1]"); - return NULL; - } - - item = cJSON_CreateObject(); - if (!invalid_param_1->param) { - ogs_error("OpenAPI_invalid_param_1_convertToJSON() failed [param]"); - return NULL; - } - if (cJSON_AddStringToObject(item, "param", invalid_param_1->param) == NULL) { - ogs_error("OpenAPI_invalid_param_1_convertToJSON() failed [param]"); - goto end; - } - - if (invalid_param_1->reason) { - if (cJSON_AddStringToObject(item, "reason", invalid_param_1->reason) == NULL) { - ogs_error("OpenAPI_invalid_param_1_convertToJSON() failed [reason]"); - goto end; - } - } - -end: - return item; -} - -OpenAPI_invalid_param_1_t *OpenAPI_invalid_param_1_parseFromJSON(cJSON *invalid_param_1JSON) -{ - OpenAPI_invalid_param_1_t *invalid_param_1_local_var = NULL; - OpenAPI_lnode_t *node = NULL; - cJSON *param = NULL; - cJSON *reason = NULL; - param = cJSON_GetObjectItemCaseSensitive(invalid_param_1JSON, "param"); - if (!param) { - ogs_error("OpenAPI_invalid_param_1_parseFromJSON() failed [param]"); - goto end; - } - if (!cJSON_IsString(param)) { - ogs_error("OpenAPI_invalid_param_1_parseFromJSON() failed [param]"); - goto end; - } - - reason = cJSON_GetObjectItemCaseSensitive(invalid_param_1JSON, "reason"); - if (reason) { - if (!cJSON_IsString(reason) && !cJSON_IsNull(reason)) { - ogs_error("OpenAPI_invalid_param_1_parseFromJSON() failed [reason]"); - goto end; - } - } - - invalid_param_1_local_var = OpenAPI_invalid_param_1_create ( - ogs_strdup(param->valuestring), - reason && !cJSON_IsNull(reason) ? ogs_strdup(reason->valuestring) : NULL - ); - - return invalid_param_1_local_var; -end: - return NULL; -} - -OpenAPI_invalid_param_1_t *OpenAPI_invalid_param_1_copy(OpenAPI_invalid_param_1_t *dst, OpenAPI_invalid_param_1_t *src) -{ - cJSON *item = NULL; - char *content = NULL; - - ogs_assert(src); - item = OpenAPI_invalid_param_1_convertToJSON(src); - if (!item) { - ogs_error("OpenAPI_invalid_param_1_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_invalid_param_1_free(dst); - dst = OpenAPI_invalid_param_1_parseFromJSON(item); - cJSON_Delete(item); - - return dst; -} - diff --git a/lib/sbi/openapi/model/invalid_param_1.h b/lib/sbi/openapi/model/invalid_param_1.h deleted file mode 100644 index a36830490..000000000 --- a/lib/sbi/openapi/model/invalid_param_1.h +++ /dev/null @@ -1,40 +0,0 @@ -/* - * invalid_param_1.h - * - * - */ - -#ifndef _OpenAPI_invalid_param_1_H_ -#define _OpenAPI_invalid_param_1_H_ - -#include -#include "../external/cJSON.h" -#include "../include/list.h" -#include "../include/keyValuePair.h" -#include "../include/binary.h" - -#ifdef __cplusplus -extern "C" { -#endif - -typedef struct OpenAPI_invalid_param_1_s OpenAPI_invalid_param_1_t; -typedef struct OpenAPI_invalid_param_1_s { - char *param; - char *reason; -} OpenAPI_invalid_param_1_t; - -OpenAPI_invalid_param_1_t *OpenAPI_invalid_param_1_create( - char *param, - char *reason -); -void OpenAPI_invalid_param_1_free(OpenAPI_invalid_param_1_t *invalid_param_1); -OpenAPI_invalid_param_1_t *OpenAPI_invalid_param_1_parseFromJSON(cJSON *invalid_param_1JSON); -cJSON *OpenAPI_invalid_param_1_convertToJSON(OpenAPI_invalid_param_1_t *invalid_param_1); -OpenAPI_invalid_param_1_t *OpenAPI_invalid_param_1_copy(OpenAPI_invalid_param_1_t *dst, OpenAPI_invalid_param_1_t *src); - -#ifdef __cplusplus -} -#endif - -#endif /* _OpenAPI_invalid_param_1_H_ */ - diff --git a/lib/sbi/openapi/model/ip_addr.c b/lib/sbi/openapi/model/ip_addr.c new file mode 100644 index 000000000..3d6731a55 --- /dev/null +++ b/lib/sbi/openapi/model/ip_addr.c @@ -0,0 +1,156 @@ + +#include +#include +#include +#include "ip_addr.h" + +OpenAPI_ip_addr_t *OpenAPI_ip_addr_create( + char *ipv4_addr, + char *ipv6_addr, + char *ipv6_prefix +) +{ + OpenAPI_ip_addr_t *ip_addr_local_var = ogs_malloc(sizeof(OpenAPI_ip_addr_t)); + ogs_assert(ip_addr_local_var); + + ip_addr_local_var->ipv4_addr = ipv4_addr; + ip_addr_local_var->ipv6_addr = ipv6_addr; + ip_addr_local_var->ipv6_prefix = ipv6_prefix; + + return ip_addr_local_var; +} + +void OpenAPI_ip_addr_free(OpenAPI_ip_addr_t *ip_addr) +{ + OpenAPI_lnode_t *node = NULL; + + if (NULL == ip_addr) { + return; + } + if (ip_addr->ipv4_addr) { + ogs_free(ip_addr->ipv4_addr); + ip_addr->ipv4_addr = NULL; + } + if (ip_addr->ipv6_addr) { + ogs_free(ip_addr->ipv6_addr); + ip_addr->ipv6_addr = NULL; + } + if (ip_addr->ipv6_prefix) { + ogs_free(ip_addr->ipv6_prefix); + ip_addr->ipv6_prefix = NULL; + } + ogs_free(ip_addr); +} + +cJSON *OpenAPI_ip_addr_convertToJSON(OpenAPI_ip_addr_t *ip_addr) +{ + cJSON *item = NULL; + OpenAPI_lnode_t *node = NULL; + + if (ip_addr == NULL) { + ogs_error("OpenAPI_ip_addr_convertToJSON() failed [IpAddr]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (ip_addr->ipv4_addr) { + if (cJSON_AddStringToObject(item, "ipv4Addr", ip_addr->ipv4_addr) == NULL) { + ogs_error("OpenAPI_ip_addr_convertToJSON() failed [ipv4_addr]"); + goto end; + } + } + + if (ip_addr->ipv6_addr) { + if (cJSON_AddStringToObject(item, "ipv6Addr", ip_addr->ipv6_addr) == NULL) { + ogs_error("OpenAPI_ip_addr_convertToJSON() failed [ipv6_addr]"); + goto end; + } + } + + if (ip_addr->ipv6_prefix) { + if (cJSON_AddStringToObject(item, "ipv6Prefix", ip_addr->ipv6_prefix) == NULL) { + ogs_error("OpenAPI_ip_addr_convertToJSON() failed [ipv6_prefix]"); + goto end; + } + } + +end: + return item; +} + +OpenAPI_ip_addr_t *OpenAPI_ip_addr_parseFromJSON(cJSON *ip_addrJSON) +{ + OpenAPI_ip_addr_t *ip_addr_local_var = NULL; + OpenAPI_lnode_t *node = NULL; + cJSON *ipv4_addr = NULL; + cJSON *ipv6_addr = NULL; + cJSON *ipv6_prefix = NULL; + ipv4_addr = cJSON_GetObjectItemCaseSensitive(ip_addrJSON, "ipv4Addr"); + if (ipv4_addr) { + if (!cJSON_IsString(ipv4_addr) && !cJSON_IsNull(ipv4_addr)) { + ogs_error("OpenAPI_ip_addr_parseFromJSON() failed [ipv4_addr]"); + goto end; + } + } + + ipv6_addr = cJSON_GetObjectItemCaseSensitive(ip_addrJSON, "ipv6Addr"); + if (ipv6_addr) { + if (!cJSON_IsString(ipv6_addr) && !cJSON_IsNull(ipv6_addr)) { + ogs_error("OpenAPI_ip_addr_parseFromJSON() failed [ipv6_addr]"); + goto end; + } + } + + ipv6_prefix = cJSON_GetObjectItemCaseSensitive(ip_addrJSON, "ipv6Prefix"); + if (ipv6_prefix) { + if (!cJSON_IsString(ipv6_prefix) && !cJSON_IsNull(ipv6_prefix)) { + ogs_error("OpenAPI_ip_addr_parseFromJSON() failed [ipv6_prefix]"); + goto end; + } + } + + ip_addr_local_var = OpenAPI_ip_addr_create ( + ipv4_addr && !cJSON_IsNull(ipv4_addr) ? ogs_strdup(ipv4_addr->valuestring) : NULL, + ipv6_addr && !cJSON_IsNull(ipv6_addr) ? ogs_strdup(ipv6_addr->valuestring) : NULL, + ipv6_prefix && !cJSON_IsNull(ipv6_prefix) ? ogs_strdup(ipv6_prefix->valuestring) : NULL + ); + + return ip_addr_local_var; +end: + return NULL; +} + +OpenAPI_ip_addr_t *OpenAPI_ip_addr_copy(OpenAPI_ip_addr_t *dst, OpenAPI_ip_addr_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_ip_addr_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_ip_addr_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_ip_addr_free(dst); + dst = OpenAPI_ip_addr_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/ip_addr.h b/lib/sbi/openapi/model/ip_addr.h new file mode 100644 index 000000000..5378eebc6 --- /dev/null +++ b/lib/sbi/openapi/model/ip_addr.h @@ -0,0 +1,42 @@ +/* + * ip_addr.h + * + * Contains an IP adresse. + */ + +#ifndef _OpenAPI_ip_addr_H_ +#define _OpenAPI_ip_addr_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_ip_addr_s OpenAPI_ip_addr_t; +typedef struct OpenAPI_ip_addr_s { + char *ipv4_addr; + char *ipv6_addr; + char *ipv6_prefix; +} OpenAPI_ip_addr_t; + +OpenAPI_ip_addr_t *OpenAPI_ip_addr_create( + char *ipv4_addr, + char *ipv6_addr, + char *ipv6_prefix +); +void OpenAPI_ip_addr_free(OpenAPI_ip_addr_t *ip_addr); +OpenAPI_ip_addr_t *OpenAPI_ip_addr_parseFromJSON(cJSON *ip_addrJSON); +cJSON *OpenAPI_ip_addr_convertToJSON(OpenAPI_ip_addr_t *ip_addr); +OpenAPI_ip_addr_t *OpenAPI_ip_addr_copy(OpenAPI_ip_addr_t *dst, OpenAPI_ip_addr_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_ip_addr_H_ */ + diff --git a/lib/sbi/openapi/model/ip_addr_1.c b/lib/sbi/openapi/model/ip_addr_1.c new file mode 100644 index 000000000..4691edefd --- /dev/null +++ b/lib/sbi/openapi/model/ip_addr_1.c @@ -0,0 +1,156 @@ + +#include +#include +#include +#include "ip_addr_1.h" + +OpenAPI_ip_addr_1_t *OpenAPI_ip_addr_1_create( + char *ipv4_addr, + char *ipv6_addr, + char *ipv6_prefix +) +{ + OpenAPI_ip_addr_1_t *ip_addr_1_local_var = ogs_malloc(sizeof(OpenAPI_ip_addr_1_t)); + ogs_assert(ip_addr_1_local_var); + + ip_addr_1_local_var->ipv4_addr = ipv4_addr; + ip_addr_1_local_var->ipv6_addr = ipv6_addr; + ip_addr_1_local_var->ipv6_prefix = ipv6_prefix; + + return ip_addr_1_local_var; +} + +void OpenAPI_ip_addr_1_free(OpenAPI_ip_addr_1_t *ip_addr_1) +{ + OpenAPI_lnode_t *node = NULL; + + if (NULL == ip_addr_1) { + return; + } + if (ip_addr_1->ipv4_addr) { + ogs_free(ip_addr_1->ipv4_addr); + ip_addr_1->ipv4_addr = NULL; + } + if (ip_addr_1->ipv6_addr) { + ogs_free(ip_addr_1->ipv6_addr); + ip_addr_1->ipv6_addr = NULL; + } + if (ip_addr_1->ipv6_prefix) { + ogs_free(ip_addr_1->ipv6_prefix); + ip_addr_1->ipv6_prefix = NULL; + } + ogs_free(ip_addr_1); +} + +cJSON *OpenAPI_ip_addr_1_convertToJSON(OpenAPI_ip_addr_1_t *ip_addr_1) +{ + cJSON *item = NULL; + OpenAPI_lnode_t *node = NULL; + + if (ip_addr_1 == NULL) { + ogs_error("OpenAPI_ip_addr_1_convertToJSON() failed [IpAddr_1]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (ip_addr_1->ipv4_addr) { + if (cJSON_AddStringToObject(item, "ipv4Addr", ip_addr_1->ipv4_addr) == NULL) { + ogs_error("OpenAPI_ip_addr_1_convertToJSON() failed [ipv4_addr]"); + goto end; + } + } + + if (ip_addr_1->ipv6_addr) { + if (cJSON_AddStringToObject(item, "ipv6Addr", ip_addr_1->ipv6_addr) == NULL) { + ogs_error("OpenAPI_ip_addr_1_convertToJSON() failed [ipv6_addr]"); + goto end; + } + } + + if (ip_addr_1->ipv6_prefix) { + if (cJSON_AddStringToObject(item, "ipv6Prefix", ip_addr_1->ipv6_prefix) == NULL) { + ogs_error("OpenAPI_ip_addr_1_convertToJSON() failed [ipv6_prefix]"); + goto end; + } + } + +end: + return item; +} + +OpenAPI_ip_addr_1_t *OpenAPI_ip_addr_1_parseFromJSON(cJSON *ip_addr_1JSON) +{ + OpenAPI_ip_addr_1_t *ip_addr_1_local_var = NULL; + OpenAPI_lnode_t *node = NULL; + cJSON *ipv4_addr = NULL; + cJSON *ipv6_addr = NULL; + cJSON *ipv6_prefix = NULL; + ipv4_addr = cJSON_GetObjectItemCaseSensitive(ip_addr_1JSON, "ipv4Addr"); + if (ipv4_addr) { + if (!cJSON_IsString(ipv4_addr) && !cJSON_IsNull(ipv4_addr)) { + ogs_error("OpenAPI_ip_addr_1_parseFromJSON() failed [ipv4_addr]"); + goto end; + } + } + + ipv6_addr = cJSON_GetObjectItemCaseSensitive(ip_addr_1JSON, "ipv6Addr"); + if (ipv6_addr) { + if (!cJSON_IsString(ipv6_addr) && !cJSON_IsNull(ipv6_addr)) { + ogs_error("OpenAPI_ip_addr_1_parseFromJSON() failed [ipv6_addr]"); + goto end; + } + } + + ipv6_prefix = cJSON_GetObjectItemCaseSensitive(ip_addr_1JSON, "ipv6Prefix"); + if (ipv6_prefix) { + if (!cJSON_IsString(ipv6_prefix) && !cJSON_IsNull(ipv6_prefix)) { + ogs_error("OpenAPI_ip_addr_1_parseFromJSON() failed [ipv6_prefix]"); + goto end; + } + } + + ip_addr_1_local_var = OpenAPI_ip_addr_1_create ( + ipv4_addr && !cJSON_IsNull(ipv4_addr) ? ogs_strdup(ipv4_addr->valuestring) : NULL, + ipv6_addr && !cJSON_IsNull(ipv6_addr) ? ogs_strdup(ipv6_addr->valuestring) : NULL, + ipv6_prefix && !cJSON_IsNull(ipv6_prefix) ? ogs_strdup(ipv6_prefix->valuestring) : NULL + ); + + return ip_addr_1_local_var; +end: + return NULL; +} + +OpenAPI_ip_addr_1_t *OpenAPI_ip_addr_1_copy(OpenAPI_ip_addr_1_t *dst, OpenAPI_ip_addr_1_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_ip_addr_1_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_ip_addr_1_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_ip_addr_1_free(dst); + dst = OpenAPI_ip_addr_1_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/ip_addr_1.h b/lib/sbi/openapi/model/ip_addr_1.h new file mode 100644 index 000000000..5e7be5686 --- /dev/null +++ b/lib/sbi/openapi/model/ip_addr_1.h @@ -0,0 +1,42 @@ +/* + * ip_addr_1.h + * + * Contains an IP adresse. + */ + +#ifndef _OpenAPI_ip_addr_1_H_ +#define _OpenAPI_ip_addr_1_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_ip_addr_1_s OpenAPI_ip_addr_1_t; +typedef struct OpenAPI_ip_addr_1_s { + char *ipv4_addr; + char *ipv6_addr; + char *ipv6_prefix; +} OpenAPI_ip_addr_1_t; + +OpenAPI_ip_addr_1_t *OpenAPI_ip_addr_1_create( + char *ipv4_addr, + char *ipv6_addr, + char *ipv6_prefix +); +void OpenAPI_ip_addr_1_free(OpenAPI_ip_addr_1_t *ip_addr_1); +OpenAPI_ip_addr_1_t *OpenAPI_ip_addr_1_parseFromJSON(cJSON *ip_addr_1JSON); +cJSON *OpenAPI_ip_addr_1_convertToJSON(OpenAPI_ip_addr_1_t *ip_addr_1); +OpenAPI_ip_addr_1_t *OpenAPI_ip_addr_1_copy(OpenAPI_ip_addr_1_t *dst, OpenAPI_ip_addr_1_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_ip_addr_1_H_ */ + diff --git a/lib/sbi/openapi/model/ip_end_point.h b/lib/sbi/openapi/model/ip_end_point.h index f767d09f0..5a887092c 100644 --- a/lib/sbi/openapi/model/ip_end_point.h +++ b/lib/sbi/openapi/model/ip_end_point.h @@ -1,7 +1,7 @@ /* * ip_end_point.h * - * IP addressing information of a given NFService; it consists on, e.g. IP address, TCP port, transport protocol... + * IP addressing information of a given NFService; it consists on, e.g. IP address, TCP port, transport protocol... */ #ifndef _OpenAPI_ip_end_point_H_ diff --git a/lib/sbi/openapi/model/ip_eth_flow_description.c b/lib/sbi/openapi/model/ip_eth_flow_description.c new file mode 100644 index 000000000..1ca1a778a --- /dev/null +++ b/lib/sbi/openapi/model/ip_eth_flow_description.c @@ -0,0 +1,141 @@ + +#include +#include +#include +#include "ip_eth_flow_description.h" + +OpenAPI_ip_eth_flow_description_t *OpenAPI_ip_eth_flow_description_create( + char *ip_traffic_filter, + OpenAPI_eth_flow_description_t *eth_traffic_filter +) +{ + OpenAPI_ip_eth_flow_description_t *ip_eth_flow_description_local_var = ogs_malloc(sizeof(OpenAPI_ip_eth_flow_description_t)); + ogs_assert(ip_eth_flow_description_local_var); + + ip_eth_flow_description_local_var->ip_traffic_filter = ip_traffic_filter; + ip_eth_flow_description_local_var->eth_traffic_filter = eth_traffic_filter; + + return ip_eth_flow_description_local_var; +} + +void OpenAPI_ip_eth_flow_description_free(OpenAPI_ip_eth_flow_description_t *ip_eth_flow_description) +{ + OpenAPI_lnode_t *node = NULL; + + if (NULL == ip_eth_flow_description) { + return; + } + if (ip_eth_flow_description->ip_traffic_filter) { + ogs_free(ip_eth_flow_description->ip_traffic_filter); + ip_eth_flow_description->ip_traffic_filter = NULL; + } + if (ip_eth_flow_description->eth_traffic_filter) { + OpenAPI_eth_flow_description_free(ip_eth_flow_description->eth_traffic_filter); + ip_eth_flow_description->eth_traffic_filter = NULL; + } + ogs_free(ip_eth_flow_description); +} + +cJSON *OpenAPI_ip_eth_flow_description_convertToJSON(OpenAPI_ip_eth_flow_description_t *ip_eth_flow_description) +{ + cJSON *item = NULL; + OpenAPI_lnode_t *node = NULL; + + if (ip_eth_flow_description == NULL) { + ogs_error("OpenAPI_ip_eth_flow_description_convertToJSON() failed [IpEthFlowDescription]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (ip_eth_flow_description->ip_traffic_filter) { + if (cJSON_AddStringToObject(item, "ipTrafficFilter", ip_eth_flow_description->ip_traffic_filter) == NULL) { + ogs_error("OpenAPI_ip_eth_flow_description_convertToJSON() failed [ip_traffic_filter]"); + goto end; + } + } + + if (ip_eth_flow_description->eth_traffic_filter) { + cJSON *eth_traffic_filter_local_JSON = OpenAPI_eth_flow_description_convertToJSON(ip_eth_flow_description->eth_traffic_filter); + if (eth_traffic_filter_local_JSON == NULL) { + ogs_error("OpenAPI_ip_eth_flow_description_convertToJSON() failed [eth_traffic_filter]"); + goto end; + } + cJSON_AddItemToObject(item, "ethTrafficFilter", eth_traffic_filter_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_ip_eth_flow_description_convertToJSON() failed [eth_traffic_filter]"); + goto end; + } + } + +end: + return item; +} + +OpenAPI_ip_eth_flow_description_t *OpenAPI_ip_eth_flow_description_parseFromJSON(cJSON *ip_eth_flow_descriptionJSON) +{ + OpenAPI_ip_eth_flow_description_t *ip_eth_flow_description_local_var = NULL; + OpenAPI_lnode_t *node = NULL; + cJSON *ip_traffic_filter = NULL; + cJSON *eth_traffic_filter = NULL; + OpenAPI_eth_flow_description_t *eth_traffic_filter_local_nonprim = NULL; + ip_traffic_filter = cJSON_GetObjectItemCaseSensitive(ip_eth_flow_descriptionJSON, "ipTrafficFilter"); + if (ip_traffic_filter) { + if (!cJSON_IsString(ip_traffic_filter) && !cJSON_IsNull(ip_traffic_filter)) { + ogs_error("OpenAPI_ip_eth_flow_description_parseFromJSON() failed [ip_traffic_filter]"); + goto end; + } + } + + eth_traffic_filter = cJSON_GetObjectItemCaseSensitive(ip_eth_flow_descriptionJSON, "ethTrafficFilter"); + if (eth_traffic_filter) { + eth_traffic_filter_local_nonprim = OpenAPI_eth_flow_description_parseFromJSON(eth_traffic_filter); + } + + ip_eth_flow_description_local_var = OpenAPI_ip_eth_flow_description_create ( + ip_traffic_filter && !cJSON_IsNull(ip_traffic_filter) ? ogs_strdup(ip_traffic_filter->valuestring) : NULL, + eth_traffic_filter ? eth_traffic_filter_local_nonprim : NULL + ); + + return ip_eth_flow_description_local_var; +end: + if (eth_traffic_filter_local_nonprim) { + OpenAPI_eth_flow_description_free(eth_traffic_filter_local_nonprim); + eth_traffic_filter_local_nonprim = NULL; + } + return NULL; +} + +OpenAPI_ip_eth_flow_description_t *OpenAPI_ip_eth_flow_description_copy(OpenAPI_ip_eth_flow_description_t *dst, OpenAPI_ip_eth_flow_description_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_ip_eth_flow_description_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_ip_eth_flow_description_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_ip_eth_flow_description_free(dst); + dst = OpenAPI_ip_eth_flow_description_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/ip_eth_flow_description.h b/lib/sbi/openapi/model/ip_eth_flow_description.h new file mode 100644 index 000000000..a1c3c1984 --- /dev/null +++ b/lib/sbi/openapi/model/ip_eth_flow_description.h @@ -0,0 +1,41 @@ +/* + * ip_eth_flow_description.h + * + * Contains the description of an Uplink and/or Downlink Ethernet flow. + */ + +#ifndef _OpenAPI_ip_eth_flow_description_H_ +#define _OpenAPI_ip_eth_flow_description_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "eth_flow_description.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_ip_eth_flow_description_s OpenAPI_ip_eth_flow_description_t; +typedef struct OpenAPI_ip_eth_flow_description_s { + char *ip_traffic_filter; + struct OpenAPI_eth_flow_description_s *eth_traffic_filter; +} OpenAPI_ip_eth_flow_description_t; + +OpenAPI_ip_eth_flow_description_t *OpenAPI_ip_eth_flow_description_create( + char *ip_traffic_filter, + OpenAPI_eth_flow_description_t *eth_traffic_filter +); +void OpenAPI_ip_eth_flow_description_free(OpenAPI_ip_eth_flow_description_t *ip_eth_flow_description); +OpenAPI_ip_eth_flow_description_t *OpenAPI_ip_eth_flow_description_parseFromJSON(cJSON *ip_eth_flow_descriptionJSON); +cJSON *OpenAPI_ip_eth_flow_description_convertToJSON(OpenAPI_ip_eth_flow_description_t *ip_eth_flow_description); +OpenAPI_ip_eth_flow_description_t *OpenAPI_ip_eth_flow_description_copy(OpenAPI_ip_eth_flow_description_t *dst, OpenAPI_ip_eth_flow_description_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_ip_eth_flow_description_H_ */ + diff --git a/lib/sbi/openapi/model/ip_index.c b/lib/sbi/openapi/model/ip_index.c new file mode 100644 index 000000000..e122c640a --- /dev/null +++ b/lib/sbi/openapi/model/ip_index.c @@ -0,0 +1,87 @@ + +#include +#include +#include +#include "ip_index.h" + +OpenAPI_ip_index_t *OpenAPI_ip_index_create( +) +{ + OpenAPI_ip_index_t *ip_index_local_var = ogs_malloc(sizeof(OpenAPI_ip_index_t)); + ogs_assert(ip_index_local_var); + + + return ip_index_local_var; +} + +void OpenAPI_ip_index_free(OpenAPI_ip_index_t *ip_index) +{ + OpenAPI_lnode_t *node = NULL; + + if (NULL == ip_index) { + return; + } + ogs_free(ip_index); +} + +cJSON *OpenAPI_ip_index_convertToJSON(OpenAPI_ip_index_t *ip_index) +{ + cJSON *item = NULL; + OpenAPI_lnode_t *node = NULL; + + if (ip_index == NULL) { + ogs_error("OpenAPI_ip_index_convertToJSON() failed [IpIndex]"); + return NULL; + } + + item = cJSON_CreateObject(); +end: + return item; +} + +OpenAPI_ip_index_t *OpenAPI_ip_index_parseFromJSON(cJSON *ip_indexJSON) +{ + OpenAPI_ip_index_t *ip_index_local_var = NULL; + OpenAPI_lnode_t *node = NULL; + ip_index_local_var = OpenAPI_ip_index_create ( + ); + + return ip_index_local_var; +end: + return NULL; +} + +OpenAPI_ip_index_t *OpenAPI_ip_index_copy(OpenAPI_ip_index_t *dst, OpenAPI_ip_index_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_ip_index_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_ip_index_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_ip_index_free(dst); + dst = OpenAPI_ip_index_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/ip_index.h b/lib/sbi/openapi/model/ip_index.h new file mode 100644 index 000000000..26eedd810 --- /dev/null +++ b/lib/sbi/openapi/model/ip_index.h @@ -0,0 +1,36 @@ +/* + * ip_index.h + * + * Represents the IP Index to be sent from UDM to the SMF (its value can be either an integer or a string) + */ + +#ifndef _OpenAPI_ip_index_H_ +#define _OpenAPI_ip_index_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_ip_index_s OpenAPI_ip_index_t; +typedef struct OpenAPI_ip_index_s { +} OpenAPI_ip_index_t; + +OpenAPI_ip_index_t *OpenAPI_ip_index_create( +); +void OpenAPI_ip_index_free(OpenAPI_ip_index_t *ip_index); +OpenAPI_ip_index_t *OpenAPI_ip_index_parseFromJSON(cJSON *ip_indexJSON); +cJSON *OpenAPI_ip_index_convertToJSON(OpenAPI_ip_index_t *ip_index); +OpenAPI_ip_index_t *OpenAPI_ip_index_copy(OpenAPI_ip_index_t *dst, OpenAPI_ip_index_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_ip_index_H_ */ + diff --git a/lib/sbi/openapi/model/ip_multicast_address_info.h b/lib/sbi/openapi/model/ip_multicast_address_info.h index 850cc75de..439ec595a 100644 --- a/lib/sbi/openapi/model/ip_multicast_address_info.h +++ b/lib/sbi/openapi/model/ip_multicast_address_info.h @@ -1,7 +1,7 @@ /* * ip_multicast_address_info.h * - * + * Contains the IP multicast addressing information. */ #ifndef _OpenAPI_ip_multicast_address_info_H_ diff --git a/lib/sbi/openapi/model/ip_sm_gw_guidance.c b/lib/sbi/openapi/model/ip_sm_gw_guidance.c new file mode 100644 index 000000000..c663e6d9a --- /dev/null +++ b/lib/sbi/openapi/model/ip_sm_gw_guidance.c @@ -0,0 +1,127 @@ + +#include +#include +#include +#include "ip_sm_gw_guidance.h" + +OpenAPI_ip_sm_gw_guidance_t *OpenAPI_ip_sm_gw_guidance_create( + int min_delivery_time, + int recomm_delivery_time +) +{ + OpenAPI_ip_sm_gw_guidance_t *ip_sm_gw_guidance_local_var = ogs_malloc(sizeof(OpenAPI_ip_sm_gw_guidance_t)); + ogs_assert(ip_sm_gw_guidance_local_var); + + ip_sm_gw_guidance_local_var->min_delivery_time = min_delivery_time; + ip_sm_gw_guidance_local_var->recomm_delivery_time = recomm_delivery_time; + + return ip_sm_gw_guidance_local_var; +} + +void OpenAPI_ip_sm_gw_guidance_free(OpenAPI_ip_sm_gw_guidance_t *ip_sm_gw_guidance) +{ + OpenAPI_lnode_t *node = NULL; + + if (NULL == ip_sm_gw_guidance) { + return; + } + ogs_free(ip_sm_gw_guidance); +} + +cJSON *OpenAPI_ip_sm_gw_guidance_convertToJSON(OpenAPI_ip_sm_gw_guidance_t *ip_sm_gw_guidance) +{ + cJSON *item = NULL; + OpenAPI_lnode_t *node = NULL; + + if (ip_sm_gw_guidance == NULL) { + ogs_error("OpenAPI_ip_sm_gw_guidance_convertToJSON() failed [IpSmGwGuidance]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (cJSON_AddNumberToObject(item, "minDeliveryTime", ip_sm_gw_guidance->min_delivery_time) == NULL) { + ogs_error("OpenAPI_ip_sm_gw_guidance_convertToJSON() failed [min_delivery_time]"); + goto end; + } + + if (cJSON_AddNumberToObject(item, "recommDeliveryTime", ip_sm_gw_guidance->recomm_delivery_time) == NULL) { + ogs_error("OpenAPI_ip_sm_gw_guidance_convertToJSON() failed [recomm_delivery_time]"); + goto end; + } + +end: + return item; +} + +OpenAPI_ip_sm_gw_guidance_t *OpenAPI_ip_sm_gw_guidance_parseFromJSON(cJSON *ip_sm_gw_guidanceJSON) +{ + OpenAPI_ip_sm_gw_guidance_t *ip_sm_gw_guidance_local_var = NULL; + OpenAPI_lnode_t *node = NULL; + cJSON *min_delivery_time = NULL; + cJSON *recomm_delivery_time = NULL; + min_delivery_time = cJSON_GetObjectItemCaseSensitive(ip_sm_gw_guidanceJSON, "minDeliveryTime"); + if (!min_delivery_time) { + ogs_error("OpenAPI_ip_sm_gw_guidance_parseFromJSON() failed [min_delivery_time]"); + goto end; + } + if (!cJSON_IsNumber(min_delivery_time)) { + ogs_error("OpenAPI_ip_sm_gw_guidance_parseFromJSON() failed [min_delivery_time]"); + goto end; + } + + recomm_delivery_time = cJSON_GetObjectItemCaseSensitive(ip_sm_gw_guidanceJSON, "recommDeliveryTime"); + if (!recomm_delivery_time) { + ogs_error("OpenAPI_ip_sm_gw_guidance_parseFromJSON() failed [recomm_delivery_time]"); + goto end; + } + if (!cJSON_IsNumber(recomm_delivery_time)) { + ogs_error("OpenAPI_ip_sm_gw_guidance_parseFromJSON() failed [recomm_delivery_time]"); + goto end; + } + + ip_sm_gw_guidance_local_var = OpenAPI_ip_sm_gw_guidance_create ( + + min_delivery_time->valuedouble, + + recomm_delivery_time->valuedouble + ); + + return ip_sm_gw_guidance_local_var; +end: + return NULL; +} + +OpenAPI_ip_sm_gw_guidance_t *OpenAPI_ip_sm_gw_guidance_copy(OpenAPI_ip_sm_gw_guidance_t *dst, OpenAPI_ip_sm_gw_guidance_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_ip_sm_gw_guidance_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_ip_sm_gw_guidance_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_ip_sm_gw_guidance_free(dst); + dst = OpenAPI_ip_sm_gw_guidance_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/ip_sm_gw_guidance.h b/lib/sbi/openapi/model/ip_sm_gw_guidance.h new file mode 100644 index 000000000..48e88cfc9 --- /dev/null +++ b/lib/sbi/openapi/model/ip_sm_gw_guidance.h @@ -0,0 +1,40 @@ +/* + * ip_sm_gw_guidance.h + * + * Contains guidance information (e.g. minimum and recommended delivery times) of the IP-SM-GW + */ + +#ifndef _OpenAPI_ip_sm_gw_guidance_H_ +#define _OpenAPI_ip_sm_gw_guidance_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_ip_sm_gw_guidance_s OpenAPI_ip_sm_gw_guidance_t; +typedef struct OpenAPI_ip_sm_gw_guidance_s { + int min_delivery_time; + int recomm_delivery_time; +} OpenAPI_ip_sm_gw_guidance_t; + +OpenAPI_ip_sm_gw_guidance_t *OpenAPI_ip_sm_gw_guidance_create( + int min_delivery_time, + int recomm_delivery_time +); +void OpenAPI_ip_sm_gw_guidance_free(OpenAPI_ip_sm_gw_guidance_t *ip_sm_gw_guidance); +OpenAPI_ip_sm_gw_guidance_t *OpenAPI_ip_sm_gw_guidance_parseFromJSON(cJSON *ip_sm_gw_guidanceJSON); +cJSON *OpenAPI_ip_sm_gw_guidance_convertToJSON(OpenAPI_ip_sm_gw_guidance_t *ip_sm_gw_guidance); +OpenAPI_ip_sm_gw_guidance_t *OpenAPI_ip_sm_gw_guidance_copy(OpenAPI_ip_sm_gw_guidance_t *dst, OpenAPI_ip_sm_gw_guidance_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_ip_sm_gw_guidance_H_ */ + diff --git a/lib/sbi/openapi/model/ip_sm_gw_info.c b/lib/sbi/openapi/model/ip_sm_gw_info.c new file mode 100644 index 000000000..923551ee0 --- /dev/null +++ b/lib/sbi/openapi/model/ip_sm_gw_info.c @@ -0,0 +1,149 @@ + +#include +#include +#include +#include "ip_sm_gw_info.h" + +OpenAPI_ip_sm_gw_info_t *OpenAPI_ip_sm_gw_info_create( + OpenAPI_ip_sm_gw_registration_t *ip_sm_gw_registration, + OpenAPI_ip_sm_gw_guidance_t *ip_sm_gw_guidance +) +{ + OpenAPI_ip_sm_gw_info_t *ip_sm_gw_info_local_var = ogs_malloc(sizeof(OpenAPI_ip_sm_gw_info_t)); + ogs_assert(ip_sm_gw_info_local_var); + + ip_sm_gw_info_local_var->ip_sm_gw_registration = ip_sm_gw_registration; + ip_sm_gw_info_local_var->ip_sm_gw_guidance = ip_sm_gw_guidance; + + return ip_sm_gw_info_local_var; +} + +void OpenAPI_ip_sm_gw_info_free(OpenAPI_ip_sm_gw_info_t *ip_sm_gw_info) +{ + OpenAPI_lnode_t *node = NULL; + + if (NULL == ip_sm_gw_info) { + return; + } + if (ip_sm_gw_info->ip_sm_gw_registration) { + OpenAPI_ip_sm_gw_registration_free(ip_sm_gw_info->ip_sm_gw_registration); + ip_sm_gw_info->ip_sm_gw_registration = NULL; + } + if (ip_sm_gw_info->ip_sm_gw_guidance) { + OpenAPI_ip_sm_gw_guidance_free(ip_sm_gw_info->ip_sm_gw_guidance); + ip_sm_gw_info->ip_sm_gw_guidance = NULL; + } + ogs_free(ip_sm_gw_info); +} + +cJSON *OpenAPI_ip_sm_gw_info_convertToJSON(OpenAPI_ip_sm_gw_info_t *ip_sm_gw_info) +{ + cJSON *item = NULL; + OpenAPI_lnode_t *node = NULL; + + if (ip_sm_gw_info == NULL) { + ogs_error("OpenAPI_ip_sm_gw_info_convertToJSON() failed [IpSmGwInfo]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (ip_sm_gw_info->ip_sm_gw_registration) { + cJSON *ip_sm_gw_registration_local_JSON = OpenAPI_ip_sm_gw_registration_convertToJSON(ip_sm_gw_info->ip_sm_gw_registration); + if (ip_sm_gw_registration_local_JSON == NULL) { + ogs_error("OpenAPI_ip_sm_gw_info_convertToJSON() failed [ip_sm_gw_registration]"); + goto end; + } + cJSON_AddItemToObject(item, "ipSmGwRegistration", ip_sm_gw_registration_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_ip_sm_gw_info_convertToJSON() failed [ip_sm_gw_registration]"); + goto end; + } + } + + if (ip_sm_gw_info->ip_sm_gw_guidance) { + cJSON *ip_sm_gw_guidance_local_JSON = OpenAPI_ip_sm_gw_guidance_convertToJSON(ip_sm_gw_info->ip_sm_gw_guidance); + if (ip_sm_gw_guidance_local_JSON == NULL) { + ogs_error("OpenAPI_ip_sm_gw_info_convertToJSON() failed [ip_sm_gw_guidance]"); + goto end; + } + cJSON_AddItemToObject(item, "ipSmGwGuidance", ip_sm_gw_guidance_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_ip_sm_gw_info_convertToJSON() failed [ip_sm_gw_guidance]"); + goto end; + } + } + +end: + return item; +} + +OpenAPI_ip_sm_gw_info_t *OpenAPI_ip_sm_gw_info_parseFromJSON(cJSON *ip_sm_gw_infoJSON) +{ + OpenAPI_ip_sm_gw_info_t *ip_sm_gw_info_local_var = NULL; + OpenAPI_lnode_t *node = NULL; + cJSON *ip_sm_gw_registration = NULL; + OpenAPI_ip_sm_gw_registration_t *ip_sm_gw_registration_local_nonprim = NULL; + cJSON *ip_sm_gw_guidance = NULL; + OpenAPI_ip_sm_gw_guidance_t *ip_sm_gw_guidance_local_nonprim = NULL; + ip_sm_gw_registration = cJSON_GetObjectItemCaseSensitive(ip_sm_gw_infoJSON, "ipSmGwRegistration"); + if (ip_sm_gw_registration) { + ip_sm_gw_registration_local_nonprim = OpenAPI_ip_sm_gw_registration_parseFromJSON(ip_sm_gw_registration); + } + + ip_sm_gw_guidance = cJSON_GetObjectItemCaseSensitive(ip_sm_gw_infoJSON, "ipSmGwGuidance"); + if (ip_sm_gw_guidance) { + ip_sm_gw_guidance_local_nonprim = OpenAPI_ip_sm_gw_guidance_parseFromJSON(ip_sm_gw_guidance); + } + + ip_sm_gw_info_local_var = OpenAPI_ip_sm_gw_info_create ( + ip_sm_gw_registration ? ip_sm_gw_registration_local_nonprim : NULL, + ip_sm_gw_guidance ? ip_sm_gw_guidance_local_nonprim : NULL + ); + + return ip_sm_gw_info_local_var; +end: + if (ip_sm_gw_registration_local_nonprim) { + OpenAPI_ip_sm_gw_registration_free(ip_sm_gw_registration_local_nonprim); + ip_sm_gw_registration_local_nonprim = NULL; + } + if (ip_sm_gw_guidance_local_nonprim) { + OpenAPI_ip_sm_gw_guidance_free(ip_sm_gw_guidance_local_nonprim); + ip_sm_gw_guidance_local_nonprim = NULL; + } + return NULL; +} + +OpenAPI_ip_sm_gw_info_t *OpenAPI_ip_sm_gw_info_copy(OpenAPI_ip_sm_gw_info_t *dst, OpenAPI_ip_sm_gw_info_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_ip_sm_gw_info_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_ip_sm_gw_info_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_ip_sm_gw_info_free(dst); + dst = OpenAPI_ip_sm_gw_info_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/ip_sm_gw_info.h b/lib/sbi/openapi/model/ip_sm_gw_info.h new file mode 100644 index 000000000..94359b389 --- /dev/null +++ b/lib/sbi/openapi/model/ip_sm_gw_info.h @@ -0,0 +1,42 @@ +/* + * ip_sm_gw_info.h + * + * Contains the IP-SM-GW Information + */ + +#ifndef _OpenAPI_ip_sm_gw_info_H_ +#define _OpenAPI_ip_sm_gw_info_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "ip_sm_gw_guidance.h" +#include "ip_sm_gw_registration.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_ip_sm_gw_info_s OpenAPI_ip_sm_gw_info_t; +typedef struct OpenAPI_ip_sm_gw_info_s { + struct OpenAPI_ip_sm_gw_registration_s *ip_sm_gw_registration; + struct OpenAPI_ip_sm_gw_guidance_s *ip_sm_gw_guidance; +} OpenAPI_ip_sm_gw_info_t; + +OpenAPI_ip_sm_gw_info_t *OpenAPI_ip_sm_gw_info_create( + OpenAPI_ip_sm_gw_registration_t *ip_sm_gw_registration, + OpenAPI_ip_sm_gw_guidance_t *ip_sm_gw_guidance +); +void OpenAPI_ip_sm_gw_info_free(OpenAPI_ip_sm_gw_info_t *ip_sm_gw_info); +OpenAPI_ip_sm_gw_info_t *OpenAPI_ip_sm_gw_info_parseFromJSON(cJSON *ip_sm_gw_infoJSON); +cJSON *OpenAPI_ip_sm_gw_info_convertToJSON(OpenAPI_ip_sm_gw_info_t *ip_sm_gw_info); +OpenAPI_ip_sm_gw_info_t *OpenAPI_ip_sm_gw_info_copy(OpenAPI_ip_sm_gw_info_t *dst, OpenAPI_ip_sm_gw_info_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_ip_sm_gw_info_H_ */ + diff --git a/lib/sbi/openapi/model/ip_sm_gw_registration.c b/lib/sbi/openapi/model/ip_sm_gw_registration.c index dbd57c4c8..658b48a66 100644 --- a/lib/sbi/openapi/model/ip_sm_gw_registration.c +++ b/lib/sbi/openapi/model/ip_sm_gw_registration.c @@ -7,8 +7,15 @@ OpenAPI_ip_sm_gw_registration_t *OpenAPI_ip_sm_gw_registration_create( char *ip_sm_gw_map_address, OpenAPI_network_node_diameter_address_t *ip_sm_gw_diameter_address, + char *ipsmgw_ipv4, + char *ipsmgw_ipv6, + char *ipsmgw_fqdn, + char *nf_instance_id, bool is_unri_indicator, - int unri_indicator + int unri_indicator, + OpenAPI_list_t *reset_ids, + bool is_ip_sm_gw_sbi_sup_ind, + int ip_sm_gw_sbi_sup_ind ) { OpenAPI_ip_sm_gw_registration_t *ip_sm_gw_registration_local_var = ogs_malloc(sizeof(OpenAPI_ip_sm_gw_registration_t)); @@ -16,8 +23,15 @@ OpenAPI_ip_sm_gw_registration_t *OpenAPI_ip_sm_gw_registration_create( ip_sm_gw_registration_local_var->ip_sm_gw_map_address = ip_sm_gw_map_address; ip_sm_gw_registration_local_var->ip_sm_gw_diameter_address = ip_sm_gw_diameter_address; + ip_sm_gw_registration_local_var->ipsmgw_ipv4 = ipsmgw_ipv4; + ip_sm_gw_registration_local_var->ipsmgw_ipv6 = ipsmgw_ipv6; + ip_sm_gw_registration_local_var->ipsmgw_fqdn = ipsmgw_fqdn; + ip_sm_gw_registration_local_var->nf_instance_id = nf_instance_id; ip_sm_gw_registration_local_var->is_unri_indicator = is_unri_indicator; ip_sm_gw_registration_local_var->unri_indicator = unri_indicator; + ip_sm_gw_registration_local_var->reset_ids = reset_ids; + ip_sm_gw_registration_local_var->is_ip_sm_gw_sbi_sup_ind = is_ip_sm_gw_sbi_sup_ind; + ip_sm_gw_registration_local_var->ip_sm_gw_sbi_sup_ind = ip_sm_gw_sbi_sup_ind; return ip_sm_gw_registration_local_var; } @@ -37,6 +51,29 @@ void OpenAPI_ip_sm_gw_registration_free(OpenAPI_ip_sm_gw_registration_t *ip_sm_g OpenAPI_network_node_diameter_address_free(ip_sm_gw_registration->ip_sm_gw_diameter_address); ip_sm_gw_registration->ip_sm_gw_diameter_address = NULL; } + if (ip_sm_gw_registration->ipsmgw_ipv4) { + ogs_free(ip_sm_gw_registration->ipsmgw_ipv4); + ip_sm_gw_registration->ipsmgw_ipv4 = NULL; + } + if (ip_sm_gw_registration->ipsmgw_ipv6) { + ogs_free(ip_sm_gw_registration->ipsmgw_ipv6); + ip_sm_gw_registration->ipsmgw_ipv6 = NULL; + } + if (ip_sm_gw_registration->ipsmgw_fqdn) { + ogs_free(ip_sm_gw_registration->ipsmgw_fqdn); + ip_sm_gw_registration->ipsmgw_fqdn = NULL; + } + if (ip_sm_gw_registration->nf_instance_id) { + ogs_free(ip_sm_gw_registration->nf_instance_id); + ip_sm_gw_registration->nf_instance_id = NULL; + } + if (ip_sm_gw_registration->reset_ids) { + OpenAPI_list_for_each(ip_sm_gw_registration->reset_ids, node) { + ogs_free(node->data); + } + OpenAPI_list_free(ip_sm_gw_registration->reset_ids); + ip_sm_gw_registration->reset_ids = NULL; + } ogs_free(ip_sm_gw_registration); } @@ -71,6 +108,34 @@ cJSON *OpenAPI_ip_sm_gw_registration_convertToJSON(OpenAPI_ip_sm_gw_registration } } + if (ip_sm_gw_registration->ipsmgw_ipv4) { + if (cJSON_AddStringToObject(item, "ipsmgwIpv4", ip_sm_gw_registration->ipsmgw_ipv4) == NULL) { + ogs_error("OpenAPI_ip_sm_gw_registration_convertToJSON() failed [ipsmgw_ipv4]"); + goto end; + } + } + + if (ip_sm_gw_registration->ipsmgw_ipv6) { + if (cJSON_AddStringToObject(item, "ipsmgwIpv6", ip_sm_gw_registration->ipsmgw_ipv6) == NULL) { + ogs_error("OpenAPI_ip_sm_gw_registration_convertToJSON() failed [ipsmgw_ipv6]"); + goto end; + } + } + + if (ip_sm_gw_registration->ipsmgw_fqdn) { + if (cJSON_AddStringToObject(item, "ipsmgwFqdn", ip_sm_gw_registration->ipsmgw_fqdn) == NULL) { + ogs_error("OpenAPI_ip_sm_gw_registration_convertToJSON() failed [ipsmgw_fqdn]"); + goto end; + } + } + + if (ip_sm_gw_registration->nf_instance_id) { + if (cJSON_AddStringToObject(item, "nfInstanceId", ip_sm_gw_registration->nf_instance_id) == NULL) { + ogs_error("OpenAPI_ip_sm_gw_registration_convertToJSON() failed [nf_instance_id]"); + goto end; + } + } + if (ip_sm_gw_registration->is_unri_indicator) { if (cJSON_AddBoolToObject(item, "unriIndicator", ip_sm_gw_registration->unri_indicator) == NULL) { ogs_error("OpenAPI_ip_sm_gw_registration_convertToJSON() failed [unri_indicator]"); @@ -78,6 +143,27 @@ cJSON *OpenAPI_ip_sm_gw_registration_convertToJSON(OpenAPI_ip_sm_gw_registration } } + if (ip_sm_gw_registration->reset_ids) { + cJSON *reset_idsList = cJSON_AddArrayToObject(item, "resetIds"); + if (reset_idsList == NULL) { + ogs_error("OpenAPI_ip_sm_gw_registration_convertToJSON() failed [reset_ids]"); + goto end; + } + OpenAPI_list_for_each(ip_sm_gw_registration->reset_ids, node) { + if (cJSON_AddStringToObject(reset_idsList, "", (char*)node->data) == NULL) { + ogs_error("OpenAPI_ip_sm_gw_registration_convertToJSON() failed [reset_ids]"); + goto end; + } + } + } + + if (ip_sm_gw_registration->is_ip_sm_gw_sbi_sup_ind) { + if (cJSON_AddBoolToObject(item, "ipSmGwSbiSupInd", ip_sm_gw_registration->ip_sm_gw_sbi_sup_ind) == NULL) { + ogs_error("OpenAPI_ip_sm_gw_registration_convertToJSON() failed [ip_sm_gw_sbi_sup_ind]"); + goto end; + } + } + end: return item; } @@ -89,7 +175,14 @@ OpenAPI_ip_sm_gw_registration_t *OpenAPI_ip_sm_gw_registration_parseFromJSON(cJS cJSON *ip_sm_gw_map_address = NULL; cJSON *ip_sm_gw_diameter_address = NULL; OpenAPI_network_node_diameter_address_t *ip_sm_gw_diameter_address_local_nonprim = NULL; + cJSON *ipsmgw_ipv4 = NULL; + cJSON *ipsmgw_ipv6 = NULL; + cJSON *ipsmgw_fqdn = NULL; + cJSON *nf_instance_id = NULL; cJSON *unri_indicator = NULL; + cJSON *reset_ids = NULL; + OpenAPI_list_t *reset_idsList = NULL; + cJSON *ip_sm_gw_sbi_sup_ind = NULL; ip_sm_gw_map_address = cJSON_GetObjectItemCaseSensitive(ip_sm_gw_registrationJSON, "ipSmGwMapAddress"); if (ip_sm_gw_map_address) { if (!cJSON_IsString(ip_sm_gw_map_address) && !cJSON_IsNull(ip_sm_gw_map_address)) { @@ -103,6 +196,38 @@ OpenAPI_ip_sm_gw_registration_t *OpenAPI_ip_sm_gw_registration_parseFromJSON(cJS ip_sm_gw_diameter_address_local_nonprim = OpenAPI_network_node_diameter_address_parseFromJSON(ip_sm_gw_diameter_address); } + ipsmgw_ipv4 = cJSON_GetObjectItemCaseSensitive(ip_sm_gw_registrationJSON, "ipsmgwIpv4"); + if (ipsmgw_ipv4) { + if (!cJSON_IsString(ipsmgw_ipv4) && !cJSON_IsNull(ipsmgw_ipv4)) { + ogs_error("OpenAPI_ip_sm_gw_registration_parseFromJSON() failed [ipsmgw_ipv4]"); + goto end; + } + } + + ipsmgw_ipv6 = cJSON_GetObjectItemCaseSensitive(ip_sm_gw_registrationJSON, "ipsmgwIpv6"); + if (ipsmgw_ipv6) { + if (!cJSON_IsString(ipsmgw_ipv6) && !cJSON_IsNull(ipsmgw_ipv6)) { + ogs_error("OpenAPI_ip_sm_gw_registration_parseFromJSON() failed [ipsmgw_ipv6]"); + goto end; + } + } + + ipsmgw_fqdn = cJSON_GetObjectItemCaseSensitive(ip_sm_gw_registrationJSON, "ipsmgwFqdn"); + if (ipsmgw_fqdn) { + if (!cJSON_IsString(ipsmgw_fqdn) && !cJSON_IsNull(ipsmgw_fqdn)) { + ogs_error("OpenAPI_ip_sm_gw_registration_parseFromJSON() failed [ipsmgw_fqdn]"); + goto end; + } + } + + nf_instance_id = cJSON_GetObjectItemCaseSensitive(ip_sm_gw_registrationJSON, "nfInstanceId"); + if (nf_instance_id) { + if (!cJSON_IsString(nf_instance_id) && !cJSON_IsNull(nf_instance_id)) { + ogs_error("OpenAPI_ip_sm_gw_registration_parseFromJSON() failed [nf_instance_id]"); + goto end; + } + } + unri_indicator = cJSON_GetObjectItemCaseSensitive(ip_sm_gw_registrationJSON, "unriIndicator"); if (unri_indicator) { if (!cJSON_IsBool(unri_indicator)) { @@ -111,11 +236,47 @@ OpenAPI_ip_sm_gw_registration_t *OpenAPI_ip_sm_gw_registration_parseFromJSON(cJS } } + reset_ids = cJSON_GetObjectItemCaseSensitive(ip_sm_gw_registrationJSON, "resetIds"); + if (reset_ids) { + cJSON *reset_ids_local = NULL; + if (!cJSON_IsArray(reset_ids)) { + ogs_error("OpenAPI_ip_sm_gw_registration_parseFromJSON() failed [reset_ids]"); + goto end; + } + + reset_idsList = OpenAPI_list_create(); + + cJSON_ArrayForEach(reset_ids_local, reset_ids) { + double *localDouble = NULL; + int *localInt = NULL; + if (!cJSON_IsString(reset_ids_local)) { + ogs_error("OpenAPI_ip_sm_gw_registration_parseFromJSON() failed [reset_ids]"); + goto end; + } + OpenAPI_list_add(reset_idsList, ogs_strdup(reset_ids_local->valuestring)); + } + } + + ip_sm_gw_sbi_sup_ind = cJSON_GetObjectItemCaseSensitive(ip_sm_gw_registrationJSON, "ipSmGwSbiSupInd"); + if (ip_sm_gw_sbi_sup_ind) { + if (!cJSON_IsBool(ip_sm_gw_sbi_sup_ind)) { + ogs_error("OpenAPI_ip_sm_gw_registration_parseFromJSON() failed [ip_sm_gw_sbi_sup_ind]"); + goto end; + } + } + ip_sm_gw_registration_local_var = OpenAPI_ip_sm_gw_registration_create ( ip_sm_gw_map_address && !cJSON_IsNull(ip_sm_gw_map_address) ? ogs_strdup(ip_sm_gw_map_address->valuestring) : NULL, ip_sm_gw_diameter_address ? ip_sm_gw_diameter_address_local_nonprim : NULL, + ipsmgw_ipv4 && !cJSON_IsNull(ipsmgw_ipv4) ? ogs_strdup(ipsmgw_ipv4->valuestring) : NULL, + ipsmgw_ipv6 && !cJSON_IsNull(ipsmgw_ipv6) ? ogs_strdup(ipsmgw_ipv6->valuestring) : NULL, + ipsmgw_fqdn && !cJSON_IsNull(ipsmgw_fqdn) ? ogs_strdup(ipsmgw_fqdn->valuestring) : NULL, + nf_instance_id && !cJSON_IsNull(nf_instance_id) ? ogs_strdup(nf_instance_id->valuestring) : NULL, unri_indicator ? true : false, - unri_indicator ? unri_indicator->valueint : 0 + unri_indicator ? unri_indicator->valueint : 0, + reset_ids ? reset_idsList : NULL, + ip_sm_gw_sbi_sup_ind ? true : false, + ip_sm_gw_sbi_sup_ind ? ip_sm_gw_sbi_sup_ind->valueint : 0 ); return ip_sm_gw_registration_local_var; @@ -124,6 +285,13 @@ end: OpenAPI_network_node_diameter_address_free(ip_sm_gw_diameter_address_local_nonprim); ip_sm_gw_diameter_address_local_nonprim = NULL; } + if (reset_idsList) { + OpenAPI_list_for_each(reset_idsList, node) { + ogs_free(node->data); + } + OpenAPI_list_free(reset_idsList); + reset_idsList = NULL; + } return NULL; } diff --git a/lib/sbi/openapi/model/ip_sm_gw_registration.h b/lib/sbi/openapi/model/ip_sm_gw_registration.h index f1a160fb9..0c760eb76 100644 --- a/lib/sbi/openapi/model/ip_sm_gw_registration.h +++ b/lib/sbi/openapi/model/ip_sm_gw_registration.h @@ -22,15 +22,29 @@ typedef struct OpenAPI_ip_sm_gw_registration_s OpenAPI_ip_sm_gw_registration_t; typedef struct OpenAPI_ip_sm_gw_registration_s { char *ip_sm_gw_map_address; struct OpenAPI_network_node_diameter_address_s *ip_sm_gw_diameter_address; + char *ipsmgw_ipv4; + char *ipsmgw_ipv6; + char *ipsmgw_fqdn; + char *nf_instance_id; bool is_unri_indicator; int unri_indicator; + OpenAPI_list_t *reset_ids; + bool is_ip_sm_gw_sbi_sup_ind; + int ip_sm_gw_sbi_sup_ind; } OpenAPI_ip_sm_gw_registration_t; OpenAPI_ip_sm_gw_registration_t *OpenAPI_ip_sm_gw_registration_create( char *ip_sm_gw_map_address, OpenAPI_network_node_diameter_address_t *ip_sm_gw_diameter_address, + char *ipsmgw_ipv4, + char *ipsmgw_ipv6, + char *ipsmgw_fqdn, + char *nf_instance_id, bool is_unri_indicator, - int unri_indicator + int unri_indicator, + OpenAPI_list_t *reset_ids, + bool is_ip_sm_gw_sbi_sup_ind, + int ip_sm_gw_sbi_sup_ind ); void OpenAPI_ip_sm_gw_registration_free(OpenAPI_ip_sm_gw_registration_t *ip_sm_gw_registration); OpenAPI_ip_sm_gw_registration_t *OpenAPI_ip_sm_gw_registration_parseFromJSON(cJSON *ip_sm_gw_registrationJSON); diff --git a/lib/sbi/openapi/model/iptv_config_data.c b/lib/sbi/openapi/model/iptv_config_data.c index 9f3e3a460..51eb58a7f 100644 --- a/lib/sbi/openapi/model/iptv_config_data.c +++ b/lib/sbi/openapi/model/iptv_config_data.c @@ -6,13 +6,14 @@ OpenAPI_iptv_config_data_t *OpenAPI_iptv_config_data_create( char *supi, - char *inter_group_id, + OpenAPI_any_type_t *inter_group_id, char *dnn, OpenAPI_snssai_t *snssai, char *af_app_id, OpenAPI_list_t* multi_acc_ctrls, char *supp_feat, - char *res_uri + char *res_uri, + OpenAPI_list_t *reset_ids ) { OpenAPI_iptv_config_data_t *iptv_config_data_local_var = ogs_malloc(sizeof(OpenAPI_iptv_config_data_t)); @@ -26,6 +27,7 @@ OpenAPI_iptv_config_data_t *OpenAPI_iptv_config_data_create( iptv_config_data_local_var->multi_acc_ctrls = multi_acc_ctrls; iptv_config_data_local_var->supp_feat = supp_feat; iptv_config_data_local_var->res_uri = res_uri; + iptv_config_data_local_var->reset_ids = reset_ids; return iptv_config_data_local_var; } @@ -42,7 +44,7 @@ void OpenAPI_iptv_config_data_free(OpenAPI_iptv_config_data_t *iptv_config_data) iptv_config_data->supi = NULL; } if (iptv_config_data->inter_group_id) { - ogs_free(iptv_config_data->inter_group_id); + OpenAPI_any_type_free(iptv_config_data->inter_group_id); iptv_config_data->inter_group_id = NULL; } if (iptv_config_data->dnn) { @@ -75,6 +77,13 @@ void OpenAPI_iptv_config_data_free(OpenAPI_iptv_config_data_t *iptv_config_data) ogs_free(iptv_config_data->res_uri); iptv_config_data->res_uri = NULL; } + if (iptv_config_data->reset_ids) { + OpenAPI_list_for_each(iptv_config_data->reset_ids, node) { + ogs_free(node->data); + } + OpenAPI_list_free(iptv_config_data->reset_ids); + iptv_config_data->reset_ids = NULL; + } ogs_free(iptv_config_data); } @@ -97,7 +106,13 @@ cJSON *OpenAPI_iptv_config_data_convertToJSON(OpenAPI_iptv_config_data_t *iptv_c } if (iptv_config_data->inter_group_id) { - if (cJSON_AddStringToObject(item, "interGroupId", iptv_config_data->inter_group_id) == NULL) { + cJSON *inter_group_id_object = OpenAPI_any_type_convertToJSON(iptv_config_data->inter_group_id); + if (inter_group_id_object == NULL) { + ogs_error("OpenAPI_iptv_config_data_convertToJSON() failed [inter_group_id]"); + goto end; + } + cJSON_AddItemToObject(item, "interGroupId", inter_group_id_object); + if (item->child == NULL) { ogs_error("OpenAPI_iptv_config_data_convertToJSON() failed [inter_group_id]"); goto end; } @@ -170,6 +185,20 @@ cJSON *OpenAPI_iptv_config_data_convertToJSON(OpenAPI_iptv_config_data_t *iptv_c } } + if (iptv_config_data->reset_ids) { + cJSON *reset_idsList = cJSON_AddArrayToObject(item, "resetIds"); + if (reset_idsList == NULL) { + ogs_error("OpenAPI_iptv_config_data_convertToJSON() failed [reset_ids]"); + goto end; + } + OpenAPI_list_for_each(iptv_config_data->reset_ids, node) { + if (cJSON_AddStringToObject(reset_idsList, "", (char*)node->data) == NULL) { + ogs_error("OpenAPI_iptv_config_data_convertToJSON() failed [reset_ids]"); + goto end; + } + } + } + end: return item; } @@ -180,6 +209,7 @@ OpenAPI_iptv_config_data_t *OpenAPI_iptv_config_data_parseFromJSON(cJSON *iptv_c OpenAPI_lnode_t *node = NULL; cJSON *supi = NULL; cJSON *inter_group_id = NULL; + OpenAPI_any_type_t *inter_group_id_local_object = NULL; cJSON *dnn = NULL; cJSON *snssai = NULL; OpenAPI_snssai_t *snssai_local_nonprim = NULL; @@ -188,6 +218,8 @@ OpenAPI_iptv_config_data_t *OpenAPI_iptv_config_data_parseFromJSON(cJSON *iptv_c OpenAPI_list_t *multi_acc_ctrlsList = NULL; cJSON *supp_feat = NULL; cJSON *res_uri = NULL; + cJSON *reset_ids = NULL; + OpenAPI_list_t *reset_idsList = NULL; supi = cJSON_GetObjectItemCaseSensitive(iptv_config_dataJSON, "supi"); if (supi) { if (!cJSON_IsString(supi) && !cJSON_IsNull(supi)) { @@ -198,10 +230,7 @@ OpenAPI_iptv_config_data_t *OpenAPI_iptv_config_data_parseFromJSON(cJSON *iptv_c inter_group_id = cJSON_GetObjectItemCaseSensitive(iptv_config_dataJSON, "interGroupId"); if (inter_group_id) { - if (!cJSON_IsString(inter_group_id) && !cJSON_IsNull(inter_group_id)) { - ogs_error("OpenAPI_iptv_config_data_parseFromJSON() failed [inter_group_id]"); - goto end; - } + inter_group_id_local_object = OpenAPI_any_type_parseFromJSON(inter_group_id); } dnn = cJSON_GetObjectItemCaseSensitive(iptv_config_dataJSON, "dnn"); @@ -271,19 +300,45 @@ OpenAPI_iptv_config_data_t *OpenAPI_iptv_config_data_parseFromJSON(cJSON *iptv_c } } + reset_ids = cJSON_GetObjectItemCaseSensitive(iptv_config_dataJSON, "resetIds"); + if (reset_ids) { + cJSON *reset_ids_local = NULL; + if (!cJSON_IsArray(reset_ids)) { + ogs_error("OpenAPI_iptv_config_data_parseFromJSON() failed [reset_ids]"); + goto end; + } + + reset_idsList = OpenAPI_list_create(); + + cJSON_ArrayForEach(reset_ids_local, reset_ids) { + double *localDouble = NULL; + int *localInt = NULL; + if (!cJSON_IsString(reset_ids_local)) { + ogs_error("OpenAPI_iptv_config_data_parseFromJSON() failed [reset_ids]"); + goto end; + } + OpenAPI_list_add(reset_idsList, ogs_strdup(reset_ids_local->valuestring)); + } + } + iptv_config_data_local_var = OpenAPI_iptv_config_data_create ( supi && !cJSON_IsNull(supi) ? ogs_strdup(supi->valuestring) : NULL, - inter_group_id && !cJSON_IsNull(inter_group_id) ? ogs_strdup(inter_group_id->valuestring) : NULL, + inter_group_id ? inter_group_id_local_object : NULL, dnn && !cJSON_IsNull(dnn) ? ogs_strdup(dnn->valuestring) : NULL, snssai ? snssai_local_nonprim : NULL, ogs_strdup(af_app_id->valuestring), multi_acc_ctrlsList, supp_feat && !cJSON_IsNull(supp_feat) ? ogs_strdup(supp_feat->valuestring) : NULL, - res_uri && !cJSON_IsNull(res_uri) ? ogs_strdup(res_uri->valuestring) : NULL + res_uri && !cJSON_IsNull(res_uri) ? ogs_strdup(res_uri->valuestring) : NULL, + reset_ids ? reset_idsList : NULL ); return iptv_config_data_local_var; end: + if (inter_group_id_local_object) { + OpenAPI_any_type_free(inter_group_id_local_object); + inter_group_id_local_object = NULL; + } if (snssai_local_nonprim) { OpenAPI_snssai_free(snssai_local_nonprim); snssai_local_nonprim = NULL; @@ -298,6 +353,13 @@ end: OpenAPI_list_free(multi_acc_ctrlsList); multi_acc_ctrlsList = NULL; } + if (reset_idsList) { + OpenAPI_list_for_each(reset_idsList, node) { + ogs_free(node->data); + } + OpenAPI_list_free(reset_idsList); + reset_idsList = NULL; + } return NULL; } diff --git a/lib/sbi/openapi/model/iptv_config_data.h b/lib/sbi/openapi/model/iptv_config_data.h index 0f582abde..a644e6eb5 100644 --- a/lib/sbi/openapi/model/iptv_config_data.h +++ b/lib/sbi/openapi/model/iptv_config_data.h @@ -1,7 +1,7 @@ /* * iptv_config_data.h * - * + * Represents IPTV configuration data information. */ #ifndef _OpenAPI_iptv_config_data_H_ @@ -12,6 +12,7 @@ #include "../include/list.h" #include "../include/keyValuePair.h" #include "../include/binary.h" +#include "any_type.h" #include "multicast_access_control.h" #include "snssai.h" @@ -22,24 +23,26 @@ extern "C" { typedef struct OpenAPI_iptv_config_data_s OpenAPI_iptv_config_data_t; typedef struct OpenAPI_iptv_config_data_s { char *supi; - char *inter_group_id; + OpenAPI_any_type_t *inter_group_id; char *dnn; struct OpenAPI_snssai_s *snssai; char *af_app_id; OpenAPI_list_t* multi_acc_ctrls; char *supp_feat; char *res_uri; + OpenAPI_list_t *reset_ids; } OpenAPI_iptv_config_data_t; OpenAPI_iptv_config_data_t *OpenAPI_iptv_config_data_create( char *supi, - char *inter_group_id, + OpenAPI_any_type_t *inter_group_id, char *dnn, OpenAPI_snssai_t *snssai, char *af_app_id, OpenAPI_list_t* multi_acc_ctrls, char *supp_feat, - char *res_uri + char *res_uri, + OpenAPI_list_t *reset_ids ); void OpenAPI_iptv_config_data_free(OpenAPI_iptv_config_data_t *iptv_config_data); OpenAPI_iptv_config_data_t *OpenAPI_iptv_config_data_parseFromJSON(cJSON *iptv_config_dataJSON); diff --git a/lib/sbi/openapi/model/iptv_config_data_patch.h b/lib/sbi/openapi/model/iptv_config_data_patch.h index 41a2e02f7..bb37ff088 100644 --- a/lib/sbi/openapi/model/iptv_config_data_patch.h +++ b/lib/sbi/openapi/model/iptv_config_data_patch.h @@ -1,7 +1,7 @@ /* * iptv_config_data_patch.h * - * + * Represents the parameters to request the modification of an IPTV Configuration resource. */ #ifndef _OpenAPI_iptv_config_data_patch_H_ diff --git a/lib/sbi/openapi/model/iwmsc_info.c b/lib/sbi/openapi/model/iwmsc_info.c new file mode 100644 index 000000000..1c53cf8a3 --- /dev/null +++ b/lib/sbi/openapi/model/iwmsc_info.c @@ -0,0 +1,290 @@ + +#include +#include +#include +#include "iwmsc_info.h" + +OpenAPI_iwmsc_info_t *OpenAPI_iwmsc_info_create( + OpenAPI_list_t *msisdn_ranges, + OpenAPI_list_t *supi_ranges, + OpenAPI_list_t *tai_range_list, + char *sc_number +) +{ + OpenAPI_iwmsc_info_t *iwmsc_info_local_var = ogs_malloc(sizeof(OpenAPI_iwmsc_info_t)); + ogs_assert(iwmsc_info_local_var); + + iwmsc_info_local_var->msisdn_ranges = msisdn_ranges; + iwmsc_info_local_var->supi_ranges = supi_ranges; + iwmsc_info_local_var->tai_range_list = tai_range_list; + iwmsc_info_local_var->sc_number = sc_number; + + return iwmsc_info_local_var; +} + +void OpenAPI_iwmsc_info_free(OpenAPI_iwmsc_info_t *iwmsc_info) +{ + OpenAPI_lnode_t *node = NULL; + + if (NULL == iwmsc_info) { + return; + } + if (iwmsc_info->msisdn_ranges) { + OpenAPI_list_for_each(iwmsc_info->msisdn_ranges, node) { + OpenAPI_identity_range_free(node->data); + } + OpenAPI_list_free(iwmsc_info->msisdn_ranges); + iwmsc_info->msisdn_ranges = NULL; + } + if (iwmsc_info->supi_ranges) { + OpenAPI_list_for_each(iwmsc_info->supi_ranges, node) { + OpenAPI_supi_range_free(node->data); + } + OpenAPI_list_free(iwmsc_info->supi_ranges); + iwmsc_info->supi_ranges = NULL; + } + if (iwmsc_info->tai_range_list) { + OpenAPI_list_for_each(iwmsc_info->tai_range_list, node) { + OpenAPI_tai_range_free(node->data); + } + OpenAPI_list_free(iwmsc_info->tai_range_list); + iwmsc_info->tai_range_list = NULL; + } + if (iwmsc_info->sc_number) { + ogs_free(iwmsc_info->sc_number); + iwmsc_info->sc_number = NULL; + } + ogs_free(iwmsc_info); +} + +cJSON *OpenAPI_iwmsc_info_convertToJSON(OpenAPI_iwmsc_info_t *iwmsc_info) +{ + cJSON *item = NULL; + OpenAPI_lnode_t *node = NULL; + + if (iwmsc_info == NULL) { + ogs_error("OpenAPI_iwmsc_info_convertToJSON() failed [IwmscInfo]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (iwmsc_info->msisdn_ranges) { + cJSON *msisdn_rangesList = cJSON_AddArrayToObject(item, "msisdnRanges"); + if (msisdn_rangesList == NULL) { + ogs_error("OpenAPI_iwmsc_info_convertToJSON() failed [msisdn_ranges]"); + goto end; + } + OpenAPI_list_for_each(iwmsc_info->msisdn_ranges, node) { + cJSON *itemLocal = OpenAPI_identity_range_convertToJSON(node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_iwmsc_info_convertToJSON() failed [msisdn_ranges]"); + goto end; + } + cJSON_AddItemToArray(msisdn_rangesList, itemLocal); + } + } + + if (iwmsc_info->supi_ranges) { + cJSON *supi_rangesList = cJSON_AddArrayToObject(item, "supiRanges"); + if (supi_rangesList == NULL) { + ogs_error("OpenAPI_iwmsc_info_convertToJSON() failed [supi_ranges]"); + goto end; + } + OpenAPI_list_for_each(iwmsc_info->supi_ranges, node) { + cJSON *itemLocal = OpenAPI_supi_range_convertToJSON(node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_iwmsc_info_convertToJSON() failed [supi_ranges]"); + goto end; + } + cJSON_AddItemToArray(supi_rangesList, itemLocal); + } + } + + if (iwmsc_info->tai_range_list) { + cJSON *tai_range_listList = cJSON_AddArrayToObject(item, "taiRangeList"); + if (tai_range_listList == NULL) { + ogs_error("OpenAPI_iwmsc_info_convertToJSON() failed [tai_range_list]"); + goto end; + } + OpenAPI_list_for_each(iwmsc_info->tai_range_list, node) { + cJSON *itemLocal = OpenAPI_tai_range_convertToJSON(node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_iwmsc_info_convertToJSON() failed [tai_range_list]"); + goto end; + } + cJSON_AddItemToArray(tai_range_listList, itemLocal); + } + } + + if (iwmsc_info->sc_number) { + if (cJSON_AddStringToObject(item, "scNumber", iwmsc_info->sc_number) == NULL) { + ogs_error("OpenAPI_iwmsc_info_convertToJSON() failed [sc_number]"); + goto end; + } + } + +end: + return item; +} + +OpenAPI_iwmsc_info_t *OpenAPI_iwmsc_info_parseFromJSON(cJSON *iwmsc_infoJSON) +{ + OpenAPI_iwmsc_info_t *iwmsc_info_local_var = NULL; + OpenAPI_lnode_t *node = NULL; + cJSON *msisdn_ranges = NULL; + OpenAPI_list_t *msisdn_rangesList = NULL; + cJSON *supi_ranges = NULL; + OpenAPI_list_t *supi_rangesList = NULL; + cJSON *tai_range_list = NULL; + OpenAPI_list_t *tai_range_listList = NULL; + cJSON *sc_number = NULL; + msisdn_ranges = cJSON_GetObjectItemCaseSensitive(iwmsc_infoJSON, "msisdnRanges"); + if (msisdn_ranges) { + cJSON *msisdn_ranges_local = NULL; + if (!cJSON_IsArray(msisdn_ranges)) { + ogs_error("OpenAPI_iwmsc_info_parseFromJSON() failed [msisdn_ranges]"); + goto end; + } + + msisdn_rangesList = OpenAPI_list_create(); + + cJSON_ArrayForEach(msisdn_ranges_local, msisdn_ranges) { + if (!cJSON_IsObject(msisdn_ranges_local)) { + ogs_error("OpenAPI_iwmsc_info_parseFromJSON() failed [msisdn_ranges]"); + goto end; + } + OpenAPI_identity_range_t *msisdn_rangesItem = OpenAPI_identity_range_parseFromJSON(msisdn_ranges_local); + if (!msisdn_rangesItem) { + ogs_error("No msisdn_rangesItem"); + OpenAPI_list_free(msisdn_rangesList); + goto end; + } + OpenAPI_list_add(msisdn_rangesList, msisdn_rangesItem); + } + } + + supi_ranges = cJSON_GetObjectItemCaseSensitive(iwmsc_infoJSON, "supiRanges"); + if (supi_ranges) { + cJSON *supi_ranges_local = NULL; + if (!cJSON_IsArray(supi_ranges)) { + ogs_error("OpenAPI_iwmsc_info_parseFromJSON() failed [supi_ranges]"); + goto end; + } + + supi_rangesList = OpenAPI_list_create(); + + cJSON_ArrayForEach(supi_ranges_local, supi_ranges) { + if (!cJSON_IsObject(supi_ranges_local)) { + ogs_error("OpenAPI_iwmsc_info_parseFromJSON() failed [supi_ranges]"); + goto end; + } + OpenAPI_supi_range_t *supi_rangesItem = OpenAPI_supi_range_parseFromJSON(supi_ranges_local); + if (!supi_rangesItem) { + ogs_error("No supi_rangesItem"); + OpenAPI_list_free(supi_rangesList); + goto end; + } + OpenAPI_list_add(supi_rangesList, supi_rangesItem); + } + } + + tai_range_list = cJSON_GetObjectItemCaseSensitive(iwmsc_infoJSON, "taiRangeList"); + if (tai_range_list) { + cJSON *tai_range_list_local = NULL; + if (!cJSON_IsArray(tai_range_list)) { + ogs_error("OpenAPI_iwmsc_info_parseFromJSON() failed [tai_range_list]"); + goto end; + } + + tai_range_listList = OpenAPI_list_create(); + + cJSON_ArrayForEach(tai_range_list_local, tai_range_list) { + if (!cJSON_IsObject(tai_range_list_local)) { + ogs_error("OpenAPI_iwmsc_info_parseFromJSON() failed [tai_range_list]"); + goto end; + } + OpenAPI_tai_range_t *tai_range_listItem = OpenAPI_tai_range_parseFromJSON(tai_range_list_local); + if (!tai_range_listItem) { + ogs_error("No tai_range_listItem"); + OpenAPI_list_free(tai_range_listList); + goto end; + } + OpenAPI_list_add(tai_range_listList, tai_range_listItem); + } + } + + sc_number = cJSON_GetObjectItemCaseSensitive(iwmsc_infoJSON, "scNumber"); + if (sc_number) { + if (!cJSON_IsString(sc_number) && !cJSON_IsNull(sc_number)) { + ogs_error("OpenAPI_iwmsc_info_parseFromJSON() failed [sc_number]"); + goto end; + } + } + + iwmsc_info_local_var = OpenAPI_iwmsc_info_create ( + msisdn_ranges ? msisdn_rangesList : NULL, + supi_ranges ? supi_rangesList : NULL, + tai_range_list ? tai_range_listList : NULL, + sc_number && !cJSON_IsNull(sc_number) ? ogs_strdup(sc_number->valuestring) : NULL + ); + + return iwmsc_info_local_var; +end: + if (msisdn_rangesList) { + OpenAPI_list_for_each(msisdn_rangesList, node) { + OpenAPI_identity_range_free(node->data); + } + OpenAPI_list_free(msisdn_rangesList); + msisdn_rangesList = NULL; + } + if (supi_rangesList) { + OpenAPI_list_for_each(supi_rangesList, node) { + OpenAPI_supi_range_free(node->data); + } + OpenAPI_list_free(supi_rangesList); + supi_rangesList = NULL; + } + if (tai_range_listList) { + OpenAPI_list_for_each(tai_range_listList, node) { + OpenAPI_tai_range_free(node->data); + } + OpenAPI_list_free(tai_range_listList); + tai_range_listList = NULL; + } + return NULL; +} + +OpenAPI_iwmsc_info_t *OpenAPI_iwmsc_info_copy(OpenAPI_iwmsc_info_t *dst, OpenAPI_iwmsc_info_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_iwmsc_info_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_iwmsc_info_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_iwmsc_info_free(dst); + dst = OpenAPI_iwmsc_info_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/iwmsc_info.h b/lib/sbi/openapi/model/iwmsc_info.h new file mode 100644 index 000000000..48e69a889 --- /dev/null +++ b/lib/sbi/openapi/model/iwmsc_info.h @@ -0,0 +1,47 @@ +/* + * iwmsc_info.h + * + * Information of an SMS-IWMSC NF Instance + */ + +#ifndef _OpenAPI_iwmsc_info_H_ +#define _OpenAPI_iwmsc_info_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "identity_range.h" +#include "supi_range.h" +#include "tai_range.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_iwmsc_info_s OpenAPI_iwmsc_info_t; +typedef struct OpenAPI_iwmsc_info_s { + OpenAPI_list_t *msisdn_ranges; + OpenAPI_list_t *supi_ranges; + OpenAPI_list_t *tai_range_list; + char *sc_number; +} OpenAPI_iwmsc_info_t; + +OpenAPI_iwmsc_info_t *OpenAPI_iwmsc_info_create( + OpenAPI_list_t *msisdn_ranges, + OpenAPI_list_t *supi_ranges, + OpenAPI_list_t *tai_range_list, + char *sc_number +); +void OpenAPI_iwmsc_info_free(OpenAPI_iwmsc_info_t *iwmsc_info); +OpenAPI_iwmsc_info_t *OpenAPI_iwmsc_info_parseFromJSON(cJSON *iwmsc_infoJSON); +cJSON *OpenAPI_iwmsc_info_convertToJSON(OpenAPI_iwmsc_info_t *iwmsc_info); +OpenAPI_iwmsc_info_t *OpenAPI_iwmsc_info_copy(OpenAPI_iwmsc_info_t *dst, OpenAPI_iwmsc_info_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_iwmsc_info_H_ */ + diff --git a/lib/sbi/openapi/model/key_amf.h b/lib/sbi/openapi/model/key_amf.h index a9599c5b3..0becaac75 100644 --- a/lib/sbi/openapi/model/key_amf.h +++ b/lib/sbi/openapi/model/key_amf.h @@ -1,7 +1,7 @@ /* * key_amf.h * - * + * Represents the Kamf or K'amf */ #ifndef _OpenAPI_key_amf_H_ diff --git a/lib/sbi/openapi/model/ladn_info.h b/lib/sbi/openapi/model/ladn_info.h index 40bf37a83..694f0ae64 100644 --- a/lib/sbi/openapi/model/ladn_info.h +++ b/lib/sbi/openapi/model/ladn_info.h @@ -1,7 +1,7 @@ /* * ladn_info.h * - * + * LADN Information */ #ifndef _OpenAPI_ladn_info_H_ diff --git a/lib/sbi/openapi/model/lcs_broadcast_assistance_types_data.c b/lib/sbi/openapi/model/lcs_broadcast_assistance_types_data.c index 4d4514620..72c2b2833 100644 --- a/lib/sbi/openapi/model/lcs_broadcast_assistance_types_data.c +++ b/lib/sbi/openapi/model/lcs_broadcast_assistance_types_data.c @@ -5,7 +5,7 @@ #include "lcs_broadcast_assistance_types_data.h" OpenAPI_lcs_broadcast_assistance_types_data_t *OpenAPI_lcs_broadcast_assistance_types_data_create( - OpenAPI_list_t *location_assistance_type + OpenAPI_binary_t* location_assistance_type ) { OpenAPI_lcs_broadcast_assistance_types_data_t *lcs_broadcast_assistance_types_data_local_var = ogs_malloc(sizeof(OpenAPI_lcs_broadcast_assistance_types_data_t)); @@ -24,10 +24,7 @@ void OpenAPI_lcs_broadcast_assistance_types_data_free(OpenAPI_lcs_broadcast_assi return; } if (lcs_broadcast_assistance_types_data->location_assistance_type) { - OpenAPI_list_for_each(lcs_broadcast_assistance_types_data->location_assistance_type, node) { - ogs_free(node->data); - } - OpenAPI_list_free(lcs_broadcast_assistance_types_data->location_assistance_type); + ogs_free(lcs_broadcast_assistance_types_data->location_assistance_type->data); lcs_broadcast_assistance_types_data->location_assistance_type = NULL; } ogs_free(lcs_broadcast_assistance_types_data); @@ -48,13 +45,12 @@ cJSON *OpenAPI_lcs_broadcast_assistance_types_data_convertToJSON(OpenAPI_lcs_bro ogs_error("OpenAPI_lcs_broadcast_assistance_types_data_convertToJSON() failed [location_assistance_type]"); return NULL; } - cJSON *location_assistance_typeList = cJSON_AddArrayToObject(item, "locationAssistanceType"); - if (location_assistance_typeList == NULL) { + char* encoded_str_location_assistance_type = OpenAPI_base64encode(lcs_broadcast_assistance_types_data->location_assistance_type->data,lcs_broadcast_assistance_types_data->location_assistance_type->len); + if (cJSON_AddStringToObject(item, "locationAssistanceType", encoded_str_location_assistance_type) == NULL) { ogs_error("OpenAPI_lcs_broadcast_assistance_types_data_convertToJSON() failed [location_assistance_type]"); goto end; } - OpenAPI_list_for_each(lcs_broadcast_assistance_types_data->location_assistance_type, node) { - } + ogs_free(encoded_str_location_assistance_type); end: return item; @@ -65,38 +61,30 @@ OpenAPI_lcs_broadcast_assistance_types_data_t *OpenAPI_lcs_broadcast_assistance_ OpenAPI_lcs_broadcast_assistance_types_data_t *lcs_broadcast_assistance_types_data_local_var = NULL; OpenAPI_lnode_t *node = NULL; cJSON *location_assistance_type = NULL; - OpenAPI_list_t *location_assistance_typeList = NULL; + OpenAPI_binary_t *decoded_str_location_assistance_type = NULL; location_assistance_type = cJSON_GetObjectItemCaseSensitive(lcs_broadcast_assistance_types_dataJSON, "locationAssistanceType"); if (!location_assistance_type) { ogs_error("OpenAPI_lcs_broadcast_assistance_types_data_parseFromJSON() failed [location_assistance_type]"); goto end; } - cJSON *location_assistance_type_local = NULL; - if (!cJSON_IsArray(location_assistance_type)) { - ogs_error("OpenAPI_lcs_broadcast_assistance_types_data_parseFromJSON() failed [location_assistance_type]"); - goto end; - } - - location_assistance_typeList = OpenAPI_list_create(); - - cJSON_ArrayForEach(location_assistance_type_local, location_assistance_type) { - double *localDouble = NULL; - int *localInt = NULL; - } + decoded_str_location_assistance_type = ogs_malloc(sizeof(OpenAPI_binary_t)); + ogs_assert(decoded_str_location_assistance_type); + if (!cJSON_IsString(location_assistance_type)) { + ogs_error("OpenAPI_lcs_broadcast_assistance_types_data_parseFromJSON() failed [location_assistance_type]"); + goto end; + } + decoded_str_location_assistance_type->data = OpenAPI_base64decode(location_assistance_type->valuestring, strlen(location_assistance_type->valuestring), &decoded_str_location_assistance_type->len); + if (!decoded_str_location_assistance_type->data) { + ogs_error("OpenAPI_lcs_broadcast_assistance_types_data_parseFromJSON() failed [location_assistance_type]"); + goto end; + } lcs_broadcast_assistance_types_data_local_var = OpenAPI_lcs_broadcast_assistance_types_data_create ( - location_assistance_typeList + decoded_str_location_assistance_type ); return lcs_broadcast_assistance_types_data_local_var; end: - if (location_assistance_typeList) { - OpenAPI_list_for_each(location_assistance_typeList, node) { - ogs_free(node->data); - } - OpenAPI_list_free(location_assistance_typeList); - location_assistance_typeList = NULL; - } return NULL; } diff --git a/lib/sbi/openapi/model/lcs_broadcast_assistance_types_data.h b/lib/sbi/openapi/model/lcs_broadcast_assistance_types_data.h index 06f64ae68..28c0a6187 100644 --- a/lib/sbi/openapi/model/lcs_broadcast_assistance_types_data.h +++ b/lib/sbi/openapi/model/lcs_broadcast_assistance_types_data.h @@ -19,11 +19,11 @@ extern "C" { typedef struct OpenAPI_lcs_broadcast_assistance_types_data_s OpenAPI_lcs_broadcast_assistance_types_data_t; typedef struct OpenAPI_lcs_broadcast_assistance_types_data_s { - OpenAPI_list_t *location_assistance_type; + OpenAPI_binary_t* location_assistance_type; } OpenAPI_lcs_broadcast_assistance_types_data_t; OpenAPI_lcs_broadcast_assistance_types_data_t *OpenAPI_lcs_broadcast_assistance_types_data_create( - OpenAPI_list_t *location_assistance_type + OpenAPI_binary_t* location_assistance_type ); void OpenAPI_lcs_broadcast_assistance_types_data_free(OpenAPI_lcs_broadcast_assistance_types_data_t *lcs_broadcast_assistance_types_data); OpenAPI_lcs_broadcast_assistance_types_data_t *OpenAPI_lcs_broadcast_assistance_types_data_parseFromJSON(cJSON *lcs_broadcast_assistance_types_dataJSON); diff --git a/lib/sbi/openapi/model/lcs_broadcast_assistance_types_data_1.c b/lib/sbi/openapi/model/lcs_broadcast_assistance_types_data_1.c deleted file mode 100644 index b989c2a6c..000000000 --- a/lib/sbi/openapi/model/lcs_broadcast_assistance_types_data_1.c +++ /dev/null @@ -1,136 +0,0 @@ - -#include -#include -#include -#include "lcs_broadcast_assistance_types_data_1.h" - -OpenAPI_lcs_broadcast_assistance_types_data_1_t *OpenAPI_lcs_broadcast_assistance_types_data_1_create( - OpenAPI_list_t *location_assistance_type -) -{ - OpenAPI_lcs_broadcast_assistance_types_data_1_t *lcs_broadcast_assistance_types_data_1_local_var = ogs_malloc(sizeof(OpenAPI_lcs_broadcast_assistance_types_data_1_t)); - ogs_assert(lcs_broadcast_assistance_types_data_1_local_var); - - lcs_broadcast_assistance_types_data_1_local_var->location_assistance_type = location_assistance_type; - - return lcs_broadcast_assistance_types_data_1_local_var; -} - -void OpenAPI_lcs_broadcast_assistance_types_data_1_free(OpenAPI_lcs_broadcast_assistance_types_data_1_t *lcs_broadcast_assistance_types_data_1) -{ - OpenAPI_lnode_t *node = NULL; - - if (NULL == lcs_broadcast_assistance_types_data_1) { - return; - } - if (lcs_broadcast_assistance_types_data_1->location_assistance_type) { - OpenAPI_list_for_each(lcs_broadcast_assistance_types_data_1->location_assistance_type, node) { - ogs_free(node->data); - } - OpenAPI_list_free(lcs_broadcast_assistance_types_data_1->location_assistance_type); - lcs_broadcast_assistance_types_data_1->location_assistance_type = NULL; - } - ogs_free(lcs_broadcast_assistance_types_data_1); -} - -cJSON *OpenAPI_lcs_broadcast_assistance_types_data_1_convertToJSON(OpenAPI_lcs_broadcast_assistance_types_data_1_t *lcs_broadcast_assistance_types_data_1) -{ - cJSON *item = NULL; - OpenAPI_lnode_t *node = NULL; - - if (lcs_broadcast_assistance_types_data_1 == NULL) { - ogs_error("OpenAPI_lcs_broadcast_assistance_types_data_1_convertToJSON() failed [LcsBroadcastAssistanceTypesData_1]"); - return NULL; - } - - item = cJSON_CreateObject(); - if (!lcs_broadcast_assistance_types_data_1->location_assistance_type) { - ogs_error("OpenAPI_lcs_broadcast_assistance_types_data_1_convertToJSON() failed [location_assistance_type]"); - return NULL; - } - cJSON *location_assistance_typeList = cJSON_AddArrayToObject(item, "locationAssistanceType"); - if (location_assistance_typeList == NULL) { - ogs_error("OpenAPI_lcs_broadcast_assistance_types_data_1_convertToJSON() failed [location_assistance_type]"); - goto end; - } - OpenAPI_list_for_each(lcs_broadcast_assistance_types_data_1->location_assistance_type, node) { - } - -end: - return item; -} - -OpenAPI_lcs_broadcast_assistance_types_data_1_t *OpenAPI_lcs_broadcast_assistance_types_data_1_parseFromJSON(cJSON *lcs_broadcast_assistance_types_data_1JSON) -{ - OpenAPI_lcs_broadcast_assistance_types_data_1_t *lcs_broadcast_assistance_types_data_1_local_var = NULL; - OpenAPI_lnode_t *node = NULL; - cJSON *location_assistance_type = NULL; - OpenAPI_list_t *location_assistance_typeList = NULL; - location_assistance_type = cJSON_GetObjectItemCaseSensitive(lcs_broadcast_assistance_types_data_1JSON, "locationAssistanceType"); - if (!location_assistance_type) { - ogs_error("OpenAPI_lcs_broadcast_assistance_types_data_1_parseFromJSON() failed [location_assistance_type]"); - goto end; - } - cJSON *location_assistance_type_local = NULL; - if (!cJSON_IsArray(location_assistance_type)) { - ogs_error("OpenAPI_lcs_broadcast_assistance_types_data_1_parseFromJSON() failed [location_assistance_type]"); - goto end; - } - - location_assistance_typeList = OpenAPI_list_create(); - - cJSON_ArrayForEach(location_assistance_type_local, location_assistance_type) { - double *localDouble = NULL; - int *localInt = NULL; - } - - lcs_broadcast_assistance_types_data_1_local_var = OpenAPI_lcs_broadcast_assistance_types_data_1_create ( - location_assistance_typeList - ); - - return lcs_broadcast_assistance_types_data_1_local_var; -end: - if (location_assistance_typeList) { - OpenAPI_list_for_each(location_assistance_typeList, node) { - ogs_free(node->data); - } - OpenAPI_list_free(location_assistance_typeList); - location_assistance_typeList = NULL; - } - return NULL; -} - -OpenAPI_lcs_broadcast_assistance_types_data_1_t *OpenAPI_lcs_broadcast_assistance_types_data_1_copy(OpenAPI_lcs_broadcast_assistance_types_data_1_t *dst, OpenAPI_lcs_broadcast_assistance_types_data_1_t *src) -{ - cJSON *item = NULL; - char *content = NULL; - - ogs_assert(src); - item = OpenAPI_lcs_broadcast_assistance_types_data_1_convertToJSON(src); - if (!item) { - ogs_error("OpenAPI_lcs_broadcast_assistance_types_data_1_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_lcs_broadcast_assistance_types_data_1_free(dst); - dst = OpenAPI_lcs_broadcast_assistance_types_data_1_parseFromJSON(item); - cJSON_Delete(item); - - return dst; -} - diff --git a/lib/sbi/openapi/model/lcs_broadcast_assistance_types_data_1.h b/lib/sbi/openapi/model/lcs_broadcast_assistance_types_data_1.h deleted file mode 100644 index 3084a74a3..000000000 --- a/lib/sbi/openapi/model/lcs_broadcast_assistance_types_data_1.h +++ /dev/null @@ -1,38 +0,0 @@ -/* - * lcs_broadcast_assistance_types_data_1.h - * - * - */ - -#ifndef _OpenAPI_lcs_broadcast_assistance_types_data_1_H_ -#define _OpenAPI_lcs_broadcast_assistance_types_data_1_H_ - -#include -#include "../external/cJSON.h" -#include "../include/list.h" -#include "../include/keyValuePair.h" -#include "../include/binary.h" - -#ifdef __cplusplus -extern "C" { -#endif - -typedef struct OpenAPI_lcs_broadcast_assistance_types_data_1_s OpenAPI_lcs_broadcast_assistance_types_data_1_t; -typedef struct OpenAPI_lcs_broadcast_assistance_types_data_1_s { - OpenAPI_list_t *location_assistance_type; -} OpenAPI_lcs_broadcast_assistance_types_data_1_t; - -OpenAPI_lcs_broadcast_assistance_types_data_1_t *OpenAPI_lcs_broadcast_assistance_types_data_1_create( - OpenAPI_list_t *location_assistance_type -); -void OpenAPI_lcs_broadcast_assistance_types_data_1_free(OpenAPI_lcs_broadcast_assistance_types_data_1_t *lcs_broadcast_assistance_types_data_1); -OpenAPI_lcs_broadcast_assistance_types_data_1_t *OpenAPI_lcs_broadcast_assistance_types_data_1_parseFromJSON(cJSON *lcs_broadcast_assistance_types_data_1JSON); -cJSON *OpenAPI_lcs_broadcast_assistance_types_data_1_convertToJSON(OpenAPI_lcs_broadcast_assistance_types_data_1_t *lcs_broadcast_assistance_types_data_1); -OpenAPI_lcs_broadcast_assistance_types_data_1_t *OpenAPI_lcs_broadcast_assistance_types_data_1_copy(OpenAPI_lcs_broadcast_assistance_types_data_1_t *dst, OpenAPI_lcs_broadcast_assistance_types_data_1_t *src); - -#ifdef __cplusplus -} -#endif - -#endif /* _OpenAPI_lcs_broadcast_assistance_types_data_1_H_ */ - diff --git a/lib/sbi/openapi/model/lcs_mo_data.c b/lib/sbi/openapi/model/lcs_mo_data.c index 6fd5e2fc5..49ff871ba 100644 --- a/lib/sbi/openapi/model/lcs_mo_data.c +++ b/lib/sbi/openapi/model/lcs_mo_data.c @@ -5,13 +5,15 @@ #include "lcs_mo_data.h" OpenAPI_lcs_mo_data_t *OpenAPI_lcs_mo_data_create( - OpenAPI_list_t *allowed_service_classes + OpenAPI_list_t *allowed_service_classes, + OpenAPI_lcs_broadcast_assistance_types_data_t *mo_assistance_data_types ) { OpenAPI_lcs_mo_data_t *lcs_mo_data_local_var = ogs_malloc(sizeof(OpenAPI_lcs_mo_data_t)); ogs_assert(lcs_mo_data_local_var); lcs_mo_data_local_var->allowed_service_classes = allowed_service_classes; + lcs_mo_data_local_var->mo_assistance_data_types = mo_assistance_data_types; return lcs_mo_data_local_var; } @@ -27,6 +29,10 @@ void OpenAPI_lcs_mo_data_free(OpenAPI_lcs_mo_data_t *lcs_mo_data) OpenAPI_list_free(lcs_mo_data->allowed_service_classes); lcs_mo_data->allowed_service_classes = NULL; } + if (lcs_mo_data->mo_assistance_data_types) { + OpenAPI_lcs_broadcast_assistance_types_data_free(lcs_mo_data->mo_assistance_data_types); + lcs_mo_data->mo_assistance_data_types = NULL; + } ogs_free(lcs_mo_data); } @@ -57,6 +63,19 @@ cJSON *OpenAPI_lcs_mo_data_convertToJSON(OpenAPI_lcs_mo_data_t *lcs_mo_data) } } + if (lcs_mo_data->mo_assistance_data_types) { + cJSON *mo_assistance_data_types_local_JSON = OpenAPI_lcs_broadcast_assistance_types_data_convertToJSON(lcs_mo_data->mo_assistance_data_types); + if (mo_assistance_data_types_local_JSON == NULL) { + ogs_error("OpenAPI_lcs_mo_data_convertToJSON() failed [mo_assistance_data_types]"); + goto end; + } + cJSON_AddItemToObject(item, "moAssistanceDataTypes", mo_assistance_data_types_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_lcs_mo_data_convertToJSON() failed [mo_assistance_data_types]"); + goto end; + } + } + end: return item; } @@ -67,6 +86,8 @@ OpenAPI_lcs_mo_data_t *OpenAPI_lcs_mo_data_parseFromJSON(cJSON *lcs_mo_dataJSON) OpenAPI_lnode_t *node = NULL; cJSON *allowed_service_classes = NULL; OpenAPI_list_t *allowed_service_classesList = NULL; + cJSON *mo_assistance_data_types = NULL; + OpenAPI_lcs_broadcast_assistance_types_data_t *mo_assistance_data_types_local_nonprim = NULL; allowed_service_classes = cJSON_GetObjectItemCaseSensitive(lcs_mo_dataJSON, "allowedServiceClasses"); if (!allowed_service_classes) { ogs_error("OpenAPI_lcs_mo_data_parseFromJSON() failed [allowed_service_classes]"); @@ -88,8 +109,14 @@ OpenAPI_lcs_mo_data_t *OpenAPI_lcs_mo_data_parseFromJSON(cJSON *lcs_mo_dataJSON) OpenAPI_list_add(allowed_service_classesList, (void *)OpenAPI_lcs_mo_service_class_FromString(allowed_service_classes_local->valuestring)); } + mo_assistance_data_types = cJSON_GetObjectItemCaseSensitive(lcs_mo_dataJSON, "moAssistanceDataTypes"); + if (mo_assistance_data_types) { + mo_assistance_data_types_local_nonprim = OpenAPI_lcs_broadcast_assistance_types_data_parseFromJSON(mo_assistance_data_types); + } + lcs_mo_data_local_var = OpenAPI_lcs_mo_data_create ( - allowed_service_classesList + allowed_service_classesList, + mo_assistance_data_types ? mo_assistance_data_types_local_nonprim : NULL ); return lcs_mo_data_local_var; @@ -98,6 +125,10 @@ end: OpenAPI_list_free(allowed_service_classesList); allowed_service_classesList = NULL; } + if (mo_assistance_data_types_local_nonprim) { + OpenAPI_lcs_broadcast_assistance_types_data_free(mo_assistance_data_types_local_nonprim); + mo_assistance_data_types_local_nonprim = NULL; + } return NULL; } diff --git a/lib/sbi/openapi/model/lcs_mo_data.h b/lib/sbi/openapi/model/lcs_mo_data.h index 5e798072b..906f28995 100644 --- a/lib/sbi/openapi/model/lcs_mo_data.h +++ b/lib/sbi/openapi/model/lcs_mo_data.h @@ -12,6 +12,7 @@ #include "../include/list.h" #include "../include/keyValuePair.h" #include "../include/binary.h" +#include "lcs_broadcast_assistance_types_data.h" #include "lcs_mo_service_class.h" #ifdef __cplusplus @@ -21,10 +22,12 @@ extern "C" { typedef struct OpenAPI_lcs_mo_data_s OpenAPI_lcs_mo_data_t; typedef struct OpenAPI_lcs_mo_data_s { OpenAPI_list_t *allowed_service_classes; + struct OpenAPI_lcs_broadcast_assistance_types_data_s *mo_assistance_data_types; } OpenAPI_lcs_mo_data_t; OpenAPI_lcs_mo_data_t *OpenAPI_lcs_mo_data_create( - OpenAPI_list_t *allowed_service_classes + OpenAPI_list_t *allowed_service_classes, + OpenAPI_lcs_broadcast_assistance_types_data_t *mo_assistance_data_types ); void OpenAPI_lcs_mo_data_free(OpenAPI_lcs_mo_data_t *lcs_mo_data); OpenAPI_lcs_mo_data_t *OpenAPI_lcs_mo_data_parseFromJSON(cJSON *lcs_mo_dataJSON); diff --git a/lib/sbi/openapi/model/lcs_privacy_data_1.c b/lib/sbi/openapi/model/lcs_privacy_data_1.c deleted file mode 100644 index b4b8e5fef..000000000 --- a/lib/sbi/openapi/model/lcs_privacy_data_1.c +++ /dev/null @@ -1,209 +0,0 @@ - -#include -#include -#include -#include "lcs_privacy_data_1.h" - -OpenAPI_lcs_privacy_data_1_t *OpenAPI_lcs_privacy_data_1_create( - OpenAPI_lpi_1_t *lpi, - OpenAPI_unrelated_class_1_t *unrelated_class, - OpenAPI_list_t *plmn_operator_classes -) -{ - OpenAPI_lcs_privacy_data_1_t *lcs_privacy_data_1_local_var = ogs_malloc(sizeof(OpenAPI_lcs_privacy_data_1_t)); - ogs_assert(lcs_privacy_data_1_local_var); - - lcs_privacy_data_1_local_var->lpi = lpi; - lcs_privacy_data_1_local_var->unrelated_class = unrelated_class; - lcs_privacy_data_1_local_var->plmn_operator_classes = plmn_operator_classes; - - return lcs_privacy_data_1_local_var; -} - -void OpenAPI_lcs_privacy_data_1_free(OpenAPI_lcs_privacy_data_1_t *lcs_privacy_data_1) -{ - OpenAPI_lnode_t *node = NULL; - - if (NULL == lcs_privacy_data_1) { - return; - } - if (lcs_privacy_data_1->lpi) { - OpenAPI_lpi_1_free(lcs_privacy_data_1->lpi); - lcs_privacy_data_1->lpi = NULL; - } - if (lcs_privacy_data_1->unrelated_class) { - OpenAPI_unrelated_class_1_free(lcs_privacy_data_1->unrelated_class); - lcs_privacy_data_1->unrelated_class = NULL; - } - if (lcs_privacy_data_1->plmn_operator_classes) { - OpenAPI_list_for_each(lcs_privacy_data_1->plmn_operator_classes, node) { - OpenAPI_plmn_operator_class_1_free(node->data); - } - OpenAPI_list_free(lcs_privacy_data_1->plmn_operator_classes); - lcs_privacy_data_1->plmn_operator_classes = NULL; - } - ogs_free(lcs_privacy_data_1); -} - -cJSON *OpenAPI_lcs_privacy_data_1_convertToJSON(OpenAPI_lcs_privacy_data_1_t *lcs_privacy_data_1) -{ - cJSON *item = NULL; - OpenAPI_lnode_t *node = NULL; - - if (lcs_privacy_data_1 == NULL) { - ogs_error("OpenAPI_lcs_privacy_data_1_convertToJSON() failed [LcsPrivacyData_1]"); - return NULL; - } - - item = cJSON_CreateObject(); - if (lcs_privacy_data_1->lpi) { - cJSON *lpi_local_JSON = OpenAPI_lpi_1_convertToJSON(lcs_privacy_data_1->lpi); - if (lpi_local_JSON == NULL) { - ogs_error("OpenAPI_lcs_privacy_data_1_convertToJSON() failed [lpi]"); - goto end; - } - cJSON_AddItemToObject(item, "lpi", lpi_local_JSON); - if (item->child == NULL) { - ogs_error("OpenAPI_lcs_privacy_data_1_convertToJSON() failed [lpi]"); - goto end; - } - } - - if (lcs_privacy_data_1->unrelated_class) { - cJSON *unrelated_class_local_JSON = OpenAPI_unrelated_class_1_convertToJSON(lcs_privacy_data_1->unrelated_class); - if (unrelated_class_local_JSON == NULL) { - ogs_error("OpenAPI_lcs_privacy_data_1_convertToJSON() failed [unrelated_class]"); - goto end; - } - cJSON_AddItemToObject(item, "unrelatedClass", unrelated_class_local_JSON); - if (item->child == NULL) { - ogs_error("OpenAPI_lcs_privacy_data_1_convertToJSON() failed [unrelated_class]"); - goto end; - } - } - - if (lcs_privacy_data_1->plmn_operator_classes) { - cJSON *plmn_operator_classesList = cJSON_AddArrayToObject(item, "plmnOperatorClasses"); - if (plmn_operator_classesList == NULL) { - ogs_error("OpenAPI_lcs_privacy_data_1_convertToJSON() failed [plmn_operator_classes]"); - goto end; - } - OpenAPI_list_for_each(lcs_privacy_data_1->plmn_operator_classes, node) { - cJSON *itemLocal = OpenAPI_plmn_operator_class_1_convertToJSON(node->data); - if (itemLocal == NULL) { - ogs_error("OpenAPI_lcs_privacy_data_1_convertToJSON() failed [plmn_operator_classes]"); - goto end; - } - cJSON_AddItemToArray(plmn_operator_classesList, itemLocal); - } - } - -end: - return item; -} - -OpenAPI_lcs_privacy_data_1_t *OpenAPI_lcs_privacy_data_1_parseFromJSON(cJSON *lcs_privacy_data_1JSON) -{ - OpenAPI_lcs_privacy_data_1_t *lcs_privacy_data_1_local_var = NULL; - OpenAPI_lnode_t *node = NULL; - cJSON *lpi = NULL; - OpenAPI_lpi_1_t *lpi_local_nonprim = NULL; - cJSON *unrelated_class = NULL; - OpenAPI_unrelated_class_1_t *unrelated_class_local_nonprim = NULL; - cJSON *plmn_operator_classes = NULL; - OpenAPI_list_t *plmn_operator_classesList = NULL; - lpi = cJSON_GetObjectItemCaseSensitive(lcs_privacy_data_1JSON, "lpi"); - if (lpi) { - lpi_local_nonprim = OpenAPI_lpi_1_parseFromJSON(lpi); - } - - unrelated_class = cJSON_GetObjectItemCaseSensitive(lcs_privacy_data_1JSON, "unrelatedClass"); - if (unrelated_class) { - unrelated_class_local_nonprim = OpenAPI_unrelated_class_1_parseFromJSON(unrelated_class); - } - - plmn_operator_classes = cJSON_GetObjectItemCaseSensitive(lcs_privacy_data_1JSON, "plmnOperatorClasses"); - if (plmn_operator_classes) { - cJSON *plmn_operator_classes_local = NULL; - if (!cJSON_IsArray(plmn_operator_classes)) { - ogs_error("OpenAPI_lcs_privacy_data_1_parseFromJSON() failed [plmn_operator_classes]"); - goto end; - } - - plmn_operator_classesList = OpenAPI_list_create(); - - cJSON_ArrayForEach(plmn_operator_classes_local, plmn_operator_classes) { - if (!cJSON_IsObject(plmn_operator_classes_local)) { - ogs_error("OpenAPI_lcs_privacy_data_1_parseFromJSON() failed [plmn_operator_classes]"); - goto end; - } - OpenAPI_plmn_operator_class_1_t *plmn_operator_classesItem = OpenAPI_plmn_operator_class_1_parseFromJSON(plmn_operator_classes_local); - if (!plmn_operator_classesItem) { - ogs_error("No plmn_operator_classesItem"); - OpenAPI_list_free(plmn_operator_classesList); - goto end; - } - OpenAPI_list_add(plmn_operator_classesList, plmn_operator_classesItem); - } - } - - lcs_privacy_data_1_local_var = OpenAPI_lcs_privacy_data_1_create ( - lpi ? lpi_local_nonprim : NULL, - unrelated_class ? unrelated_class_local_nonprim : NULL, - plmn_operator_classes ? plmn_operator_classesList : NULL - ); - - return lcs_privacy_data_1_local_var; -end: - if (lpi_local_nonprim) { - OpenAPI_lpi_1_free(lpi_local_nonprim); - lpi_local_nonprim = NULL; - } - if (unrelated_class_local_nonprim) { - OpenAPI_unrelated_class_1_free(unrelated_class_local_nonprim); - unrelated_class_local_nonprim = NULL; - } - if (plmn_operator_classesList) { - OpenAPI_list_for_each(plmn_operator_classesList, node) { - OpenAPI_plmn_operator_class_1_free(node->data); - } - OpenAPI_list_free(plmn_operator_classesList); - plmn_operator_classesList = NULL; - } - return NULL; -} - -OpenAPI_lcs_privacy_data_1_t *OpenAPI_lcs_privacy_data_1_copy(OpenAPI_lcs_privacy_data_1_t *dst, OpenAPI_lcs_privacy_data_1_t *src) -{ - cJSON *item = NULL; - char *content = NULL; - - ogs_assert(src); - item = OpenAPI_lcs_privacy_data_1_convertToJSON(src); - if (!item) { - ogs_error("OpenAPI_lcs_privacy_data_1_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_lcs_privacy_data_1_free(dst); - dst = OpenAPI_lcs_privacy_data_1_parseFromJSON(item); - cJSON_Delete(item); - - return dst; -} - diff --git a/lib/sbi/openapi/model/lcs_privacy_data_1.h b/lib/sbi/openapi/model/lcs_privacy_data_1.h deleted file mode 100644 index 0354fc531..000000000 --- a/lib/sbi/openapi/model/lcs_privacy_data_1.h +++ /dev/null @@ -1,45 +0,0 @@ -/* - * lcs_privacy_data_1.h - * - * - */ - -#ifndef _OpenAPI_lcs_privacy_data_1_H_ -#define _OpenAPI_lcs_privacy_data_1_H_ - -#include -#include "../external/cJSON.h" -#include "../include/list.h" -#include "../include/keyValuePair.h" -#include "../include/binary.h" -#include "lpi_1.h" -#include "plmn_operator_class_1.h" -#include "unrelated_class_1.h" - -#ifdef __cplusplus -extern "C" { -#endif - -typedef struct OpenAPI_lcs_privacy_data_1_s OpenAPI_lcs_privacy_data_1_t; -typedef struct OpenAPI_lcs_privacy_data_1_s { - struct OpenAPI_lpi_1_s *lpi; - struct OpenAPI_unrelated_class_1_s *unrelated_class; - OpenAPI_list_t *plmn_operator_classes; -} OpenAPI_lcs_privacy_data_1_t; - -OpenAPI_lcs_privacy_data_1_t *OpenAPI_lcs_privacy_data_1_create( - OpenAPI_lpi_1_t *lpi, - OpenAPI_unrelated_class_1_t *unrelated_class, - OpenAPI_list_t *plmn_operator_classes -); -void OpenAPI_lcs_privacy_data_1_free(OpenAPI_lcs_privacy_data_1_t *lcs_privacy_data_1); -OpenAPI_lcs_privacy_data_1_t *OpenAPI_lcs_privacy_data_1_parseFromJSON(cJSON *lcs_privacy_data_1JSON); -cJSON *OpenAPI_lcs_privacy_data_1_convertToJSON(OpenAPI_lcs_privacy_data_1_t *lcs_privacy_data_1); -OpenAPI_lcs_privacy_data_1_t *OpenAPI_lcs_privacy_data_1_copy(OpenAPI_lcs_privacy_data_1_t *dst, OpenAPI_lcs_privacy_data_1_t *src); - -#ifdef __cplusplus -} -#endif - -#endif /* _OpenAPI_lcs_privacy_data_1_H_ */ - diff --git a/lib/sbi/openapi/model/limit_id_to_monitoring_key.h b/lib/sbi/openapi/model/limit_id_to_monitoring_key.h index 76699c032..c0fd5a376 100644 --- a/lib/sbi/openapi/model/limit_id_to_monitoring_key.h +++ b/lib/sbi/openapi/model/limit_id_to_monitoring_key.h @@ -1,7 +1,7 @@ /* * limit_id_to_monitoring_key.h * - * Contains the limit identifier and the corresponding monitoring key for a given S-NSSAI and DNN. + * Contains the limit identifier and the corresponding monitoring key for a given S-NSSAI and DNN. */ #ifndef _OpenAPI_limit_id_to_monitoring_key_H_ diff --git a/lib/sbi/openapi/model/link.h b/lib/sbi/openapi/model/link.h index 061d50838..3b8215bc9 100644 --- a/lib/sbi/openapi/model/link.h +++ b/lib/sbi/openapi/model/link.h @@ -1,7 +1,7 @@ /* * link.h * - * + * It contains the URI of the linked resource. */ #ifndef _OpenAPI_link_H_ diff --git a/lib/sbi/openapi/model/links_value_schema.h b/lib/sbi/openapi/model/links_value_schema.h index 141088151..924a6e079 100644 --- a/lib/sbi/openapi/model/links_value_schema.h +++ b/lib/sbi/openapi/model/links_value_schema.h @@ -1,7 +1,7 @@ /* * links_value_schema.h * - * + * A list of mutually exclusive alternatives of 1 or more links. */ #ifndef _OpenAPI_links_value_schema_H_ diff --git a/lib/sbi/openapi/model/lmf_info.c b/lib/sbi/openapi/model/lmf_info.c index 275b38a48..f0b76ff4b 100644 --- a/lib/sbi/openapi/model/lmf_info.c +++ b/lib/sbi/openapi/model/lmf_info.c @@ -9,7 +9,10 @@ OpenAPI_lmf_info_t *OpenAPI_lmf_info_create( char *lmf_id, OpenAPI_list_t *serving_access_types, OpenAPI_list_t *serving_an_node_types, - OpenAPI_list_t *serving_rat_types + OpenAPI_list_t *serving_rat_types, + OpenAPI_list_t *tai_list, + OpenAPI_list_t *tai_range_list, + OpenAPI_list_t *supported_gad_shapes ) { OpenAPI_lmf_info_t *lmf_info_local_var = ogs_malloc(sizeof(OpenAPI_lmf_info_t)); @@ -20,6 +23,9 @@ OpenAPI_lmf_info_t *OpenAPI_lmf_info_create( lmf_info_local_var->serving_access_types = serving_access_types; lmf_info_local_var->serving_an_node_types = serving_an_node_types; lmf_info_local_var->serving_rat_types = serving_rat_types; + lmf_info_local_var->tai_list = tai_list; + lmf_info_local_var->tai_range_list = tai_range_list; + lmf_info_local_var->supported_gad_shapes = supported_gad_shapes; return lmf_info_local_var; } @@ -54,6 +60,27 @@ void OpenAPI_lmf_info_free(OpenAPI_lmf_info_t *lmf_info) OpenAPI_list_free(lmf_info->serving_rat_types); lmf_info->serving_rat_types = NULL; } + if (lmf_info->tai_list) { + OpenAPI_list_for_each(lmf_info->tai_list, node) { + OpenAPI_tai_free(node->data); + } + OpenAPI_list_free(lmf_info->tai_list); + lmf_info->tai_list = NULL; + } + if (lmf_info->tai_range_list) { + OpenAPI_list_for_each(lmf_info->tai_range_list, node) { + OpenAPI_tai_range_free(node->data); + } + OpenAPI_list_free(lmf_info->tai_range_list); + lmf_info->tai_range_list = NULL; + } + if (lmf_info->supported_gad_shapes) { + OpenAPI_list_for_each(lmf_info->supported_gad_shapes, node) { + OpenAPI_supported_gad_shapes_free(node->data); + } + OpenAPI_list_free(lmf_info->supported_gad_shapes); + lmf_info->supported_gad_shapes = NULL; + } ogs_free(lmf_info); } @@ -133,6 +160,54 @@ cJSON *OpenAPI_lmf_info_convertToJSON(OpenAPI_lmf_info_t *lmf_info) } } + if (lmf_info->tai_list) { + cJSON *tai_listList = cJSON_AddArrayToObject(item, "taiList"); + if (tai_listList == NULL) { + ogs_error("OpenAPI_lmf_info_convertToJSON() failed [tai_list]"); + goto end; + } + OpenAPI_list_for_each(lmf_info->tai_list, node) { + cJSON *itemLocal = OpenAPI_tai_convertToJSON(node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_lmf_info_convertToJSON() failed [tai_list]"); + goto end; + } + cJSON_AddItemToArray(tai_listList, itemLocal); + } + } + + if (lmf_info->tai_range_list) { + cJSON *tai_range_listList = cJSON_AddArrayToObject(item, "taiRangeList"); + if (tai_range_listList == NULL) { + ogs_error("OpenAPI_lmf_info_convertToJSON() failed [tai_range_list]"); + goto end; + } + OpenAPI_list_for_each(lmf_info->tai_range_list, node) { + cJSON *itemLocal = OpenAPI_tai_range_convertToJSON(node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_lmf_info_convertToJSON() failed [tai_range_list]"); + goto end; + } + cJSON_AddItemToArray(tai_range_listList, itemLocal); + } + } + + if (lmf_info->supported_gad_shapes) { + cJSON *supported_gad_shapesList = cJSON_AddArrayToObject(item, "supportedGADShapes"); + if (supported_gad_shapesList == NULL) { + ogs_error("OpenAPI_lmf_info_convertToJSON() failed [supported_gad_shapes]"); + goto end; + } + OpenAPI_list_for_each(lmf_info->supported_gad_shapes, node) { + cJSON *itemLocal = OpenAPI_supported_gad_shapes_convertToJSON(node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_lmf_info_convertToJSON() failed [supported_gad_shapes]"); + goto end; + } + cJSON_AddItemToArray(supported_gad_shapesList, itemLocal); + } + } + end: return item; } @@ -150,6 +225,12 @@ OpenAPI_lmf_info_t *OpenAPI_lmf_info_parseFromJSON(cJSON *lmf_infoJSON) OpenAPI_list_t *serving_an_node_typesList = NULL; cJSON *serving_rat_types = NULL; OpenAPI_list_t *serving_rat_typesList = NULL; + cJSON *tai_list = NULL; + OpenAPI_list_t *tai_listList = NULL; + cJSON *tai_range_list = NULL; + OpenAPI_list_t *tai_range_listList = NULL; + cJSON *supported_gad_shapes = NULL; + OpenAPI_list_t *supported_gad_shapesList = NULL; serving_client_types = cJSON_GetObjectItemCaseSensitive(lmf_infoJSON, "servingClientTypes"); if (serving_client_types) { cJSON *serving_client_types_local = NULL; @@ -240,12 +321,90 @@ OpenAPI_lmf_info_t *OpenAPI_lmf_info_parseFromJSON(cJSON *lmf_infoJSON) } } + tai_list = cJSON_GetObjectItemCaseSensitive(lmf_infoJSON, "taiList"); + if (tai_list) { + cJSON *tai_list_local = NULL; + if (!cJSON_IsArray(tai_list)) { + ogs_error("OpenAPI_lmf_info_parseFromJSON() failed [tai_list]"); + goto end; + } + + tai_listList = OpenAPI_list_create(); + + cJSON_ArrayForEach(tai_list_local, tai_list) { + if (!cJSON_IsObject(tai_list_local)) { + ogs_error("OpenAPI_lmf_info_parseFromJSON() failed [tai_list]"); + goto end; + } + OpenAPI_tai_t *tai_listItem = OpenAPI_tai_parseFromJSON(tai_list_local); + if (!tai_listItem) { + ogs_error("No tai_listItem"); + OpenAPI_list_free(tai_listList); + goto end; + } + OpenAPI_list_add(tai_listList, tai_listItem); + } + } + + tai_range_list = cJSON_GetObjectItemCaseSensitive(lmf_infoJSON, "taiRangeList"); + if (tai_range_list) { + cJSON *tai_range_list_local = NULL; + if (!cJSON_IsArray(tai_range_list)) { + ogs_error("OpenAPI_lmf_info_parseFromJSON() failed [tai_range_list]"); + goto end; + } + + tai_range_listList = OpenAPI_list_create(); + + cJSON_ArrayForEach(tai_range_list_local, tai_range_list) { + if (!cJSON_IsObject(tai_range_list_local)) { + ogs_error("OpenAPI_lmf_info_parseFromJSON() failed [tai_range_list]"); + goto end; + } + OpenAPI_tai_range_t *tai_range_listItem = OpenAPI_tai_range_parseFromJSON(tai_range_list_local); + if (!tai_range_listItem) { + ogs_error("No tai_range_listItem"); + OpenAPI_list_free(tai_range_listList); + goto end; + } + OpenAPI_list_add(tai_range_listList, tai_range_listItem); + } + } + + supported_gad_shapes = cJSON_GetObjectItemCaseSensitive(lmf_infoJSON, "supportedGADShapes"); + if (supported_gad_shapes) { + cJSON *supported_gad_shapes_local = NULL; + if (!cJSON_IsArray(supported_gad_shapes)) { + ogs_error("OpenAPI_lmf_info_parseFromJSON() failed [supported_gad_shapes]"); + goto end; + } + + supported_gad_shapesList = OpenAPI_list_create(); + + cJSON_ArrayForEach(supported_gad_shapes_local, supported_gad_shapes) { + if (!cJSON_IsObject(supported_gad_shapes_local)) { + ogs_error("OpenAPI_lmf_info_parseFromJSON() failed [supported_gad_shapes]"); + goto end; + } + OpenAPI_supported_gad_shapes_t *supported_gad_shapesItem = OpenAPI_supported_gad_shapes_parseFromJSON(supported_gad_shapes_local); + if (!supported_gad_shapesItem) { + ogs_error("No supported_gad_shapesItem"); + OpenAPI_list_free(supported_gad_shapesList); + goto end; + } + OpenAPI_list_add(supported_gad_shapesList, supported_gad_shapesItem); + } + } + lmf_info_local_var = OpenAPI_lmf_info_create ( serving_client_types ? serving_client_typesList : NULL, lmf_id && !cJSON_IsNull(lmf_id) ? ogs_strdup(lmf_id->valuestring) : NULL, serving_access_types ? serving_access_typesList : NULL, serving_an_node_types ? serving_an_node_typesList : NULL, - serving_rat_types ? serving_rat_typesList : NULL + serving_rat_types ? serving_rat_typesList : NULL, + tai_list ? tai_listList : NULL, + tai_range_list ? tai_range_listList : NULL, + supported_gad_shapes ? supported_gad_shapesList : NULL ); return lmf_info_local_var; @@ -269,6 +428,27 @@ end: OpenAPI_list_free(serving_rat_typesList); serving_rat_typesList = NULL; } + if (tai_listList) { + OpenAPI_list_for_each(tai_listList, node) { + OpenAPI_tai_free(node->data); + } + OpenAPI_list_free(tai_listList); + tai_listList = NULL; + } + if (tai_range_listList) { + OpenAPI_list_for_each(tai_range_listList, node) { + OpenAPI_tai_range_free(node->data); + } + OpenAPI_list_free(tai_range_listList); + tai_range_listList = NULL; + } + if (supported_gad_shapesList) { + OpenAPI_list_for_each(supported_gad_shapesList, node) { + OpenAPI_supported_gad_shapes_free(node->data); + } + OpenAPI_list_free(supported_gad_shapesList); + supported_gad_shapesList = NULL; + } return NULL; } diff --git a/lib/sbi/openapi/model/lmf_info.h b/lib/sbi/openapi/model/lmf_info.h index ed6ff1a83..d916a5416 100644 --- a/lib/sbi/openapi/model/lmf_info.h +++ b/lib/sbi/openapi/model/lmf_info.h @@ -16,6 +16,9 @@ #include "an_node_type.h" #include "external_client_type.h" #include "rat_type.h" +#include "supported_gad_shapes.h" +#include "tai.h" +#include "tai_range.h" #ifdef __cplusplus extern "C" { @@ -28,6 +31,9 @@ typedef struct OpenAPI_lmf_info_s { OpenAPI_list_t *serving_access_types; OpenAPI_list_t *serving_an_node_types; OpenAPI_list_t *serving_rat_types; + OpenAPI_list_t *tai_list; + OpenAPI_list_t *tai_range_list; + OpenAPI_list_t *supported_gad_shapes; } OpenAPI_lmf_info_t; OpenAPI_lmf_info_t *OpenAPI_lmf_info_create( @@ -35,7 +41,10 @@ OpenAPI_lmf_info_t *OpenAPI_lmf_info_create( char *lmf_id, OpenAPI_list_t *serving_access_types, OpenAPI_list_t *serving_an_node_types, - OpenAPI_list_t *serving_rat_types + OpenAPI_list_t *serving_rat_types, + OpenAPI_list_t *tai_list, + OpenAPI_list_t *tai_range_list, + OpenAPI_list_t *supported_gad_shapes ); void OpenAPI_lmf_info_free(OpenAPI_lmf_info_t *lmf_info); OpenAPI_lmf_info_t *OpenAPI_lmf_info_parseFromJSON(cJSON *lmf_infoJSON); diff --git a/lib/sbi/openapi/model/local2d_point_uncertainty_ellipse.c b/lib/sbi/openapi/model/local2d_point_uncertainty_ellipse.c new file mode 100644 index 000000000..5dad075fd --- /dev/null +++ b/lib/sbi/openapi/model/local2d_point_uncertainty_ellipse.c @@ -0,0 +1,247 @@ + +#include +#include +#include +#include "local2d_point_uncertainty_ellipse.h" + +OpenAPI_local2d_point_uncertainty_ellipse_t *OpenAPI_local2d_point_uncertainty_ellipse_create( + OpenAPI_supported_gad_shapes_t *shape, + OpenAPI_local_origin_t *local_origin, + OpenAPI_relative_cartesian_location_t *point, + OpenAPI_uncertainty_ellipse_t *uncertainty_ellipse, + int confidence +) +{ + OpenAPI_local2d_point_uncertainty_ellipse_t *local2d_point_uncertainty_ellipse_local_var = ogs_malloc(sizeof(OpenAPI_local2d_point_uncertainty_ellipse_t)); + ogs_assert(local2d_point_uncertainty_ellipse_local_var); + + local2d_point_uncertainty_ellipse_local_var->shape = shape; + local2d_point_uncertainty_ellipse_local_var->local_origin = local_origin; + local2d_point_uncertainty_ellipse_local_var->point = point; + local2d_point_uncertainty_ellipse_local_var->uncertainty_ellipse = uncertainty_ellipse; + local2d_point_uncertainty_ellipse_local_var->confidence = confidence; + + return local2d_point_uncertainty_ellipse_local_var; +} + +void OpenAPI_local2d_point_uncertainty_ellipse_free(OpenAPI_local2d_point_uncertainty_ellipse_t *local2d_point_uncertainty_ellipse) +{ + OpenAPI_lnode_t *node = NULL; + + if (NULL == local2d_point_uncertainty_ellipse) { + return; + } + if (local2d_point_uncertainty_ellipse->shape) { + OpenAPI_supported_gad_shapes_free(local2d_point_uncertainty_ellipse->shape); + local2d_point_uncertainty_ellipse->shape = NULL; + } + if (local2d_point_uncertainty_ellipse->local_origin) { + OpenAPI_local_origin_free(local2d_point_uncertainty_ellipse->local_origin); + local2d_point_uncertainty_ellipse->local_origin = NULL; + } + if (local2d_point_uncertainty_ellipse->point) { + OpenAPI_relative_cartesian_location_free(local2d_point_uncertainty_ellipse->point); + local2d_point_uncertainty_ellipse->point = NULL; + } + if (local2d_point_uncertainty_ellipse->uncertainty_ellipse) { + OpenAPI_uncertainty_ellipse_free(local2d_point_uncertainty_ellipse->uncertainty_ellipse); + local2d_point_uncertainty_ellipse->uncertainty_ellipse = NULL; + } + ogs_free(local2d_point_uncertainty_ellipse); +} + +cJSON *OpenAPI_local2d_point_uncertainty_ellipse_convertToJSON(OpenAPI_local2d_point_uncertainty_ellipse_t *local2d_point_uncertainty_ellipse) +{ + cJSON *item = NULL; + OpenAPI_lnode_t *node = NULL; + + if (local2d_point_uncertainty_ellipse == NULL) { + ogs_error("OpenAPI_local2d_point_uncertainty_ellipse_convertToJSON() failed [Local2dPointUncertaintyEllipse]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (!local2d_point_uncertainty_ellipse->shape) { + ogs_error("OpenAPI_local2d_point_uncertainty_ellipse_convertToJSON() failed [shape]"); + return NULL; + } + cJSON *shape_local_JSON = OpenAPI_supported_gad_shapes_convertToJSON(local2d_point_uncertainty_ellipse->shape); + if (shape_local_JSON == NULL) { + ogs_error("OpenAPI_local2d_point_uncertainty_ellipse_convertToJSON() failed [shape]"); + goto end; + } + cJSON_AddItemToObject(item, "shape", shape_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_local2d_point_uncertainty_ellipse_convertToJSON() failed [shape]"); + goto end; + } + + if (!local2d_point_uncertainty_ellipse->local_origin) { + ogs_error("OpenAPI_local2d_point_uncertainty_ellipse_convertToJSON() failed [local_origin]"); + return NULL; + } + cJSON *local_origin_local_JSON = OpenAPI_local_origin_convertToJSON(local2d_point_uncertainty_ellipse->local_origin); + if (local_origin_local_JSON == NULL) { + ogs_error("OpenAPI_local2d_point_uncertainty_ellipse_convertToJSON() failed [local_origin]"); + goto end; + } + cJSON_AddItemToObject(item, "localOrigin", local_origin_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_local2d_point_uncertainty_ellipse_convertToJSON() failed [local_origin]"); + goto end; + } + + if (!local2d_point_uncertainty_ellipse->point) { + ogs_error("OpenAPI_local2d_point_uncertainty_ellipse_convertToJSON() failed [point]"); + return NULL; + } + cJSON *point_local_JSON = OpenAPI_relative_cartesian_location_convertToJSON(local2d_point_uncertainty_ellipse->point); + if (point_local_JSON == NULL) { + ogs_error("OpenAPI_local2d_point_uncertainty_ellipse_convertToJSON() failed [point]"); + goto end; + } + cJSON_AddItemToObject(item, "point", point_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_local2d_point_uncertainty_ellipse_convertToJSON() failed [point]"); + goto end; + } + + if (!local2d_point_uncertainty_ellipse->uncertainty_ellipse) { + ogs_error("OpenAPI_local2d_point_uncertainty_ellipse_convertToJSON() failed [uncertainty_ellipse]"); + return NULL; + } + cJSON *uncertainty_ellipse_local_JSON = OpenAPI_uncertainty_ellipse_convertToJSON(local2d_point_uncertainty_ellipse->uncertainty_ellipse); + if (uncertainty_ellipse_local_JSON == NULL) { + ogs_error("OpenAPI_local2d_point_uncertainty_ellipse_convertToJSON() failed [uncertainty_ellipse]"); + goto end; + } + cJSON_AddItemToObject(item, "uncertaintyEllipse", uncertainty_ellipse_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_local2d_point_uncertainty_ellipse_convertToJSON() failed [uncertainty_ellipse]"); + goto end; + } + + if (cJSON_AddNumberToObject(item, "confidence", local2d_point_uncertainty_ellipse->confidence) == NULL) { + ogs_error("OpenAPI_local2d_point_uncertainty_ellipse_convertToJSON() failed [confidence]"); + goto end; + } + +end: + return item; +} + +OpenAPI_local2d_point_uncertainty_ellipse_t *OpenAPI_local2d_point_uncertainty_ellipse_parseFromJSON(cJSON *local2d_point_uncertainty_ellipseJSON) +{ + OpenAPI_local2d_point_uncertainty_ellipse_t *local2d_point_uncertainty_ellipse_local_var = NULL; + OpenAPI_lnode_t *node = NULL; + cJSON *shape = NULL; + OpenAPI_supported_gad_shapes_t *shape_local_nonprim = NULL; + cJSON *local_origin = NULL; + OpenAPI_local_origin_t *local_origin_local_nonprim = NULL; + cJSON *point = NULL; + OpenAPI_relative_cartesian_location_t *point_local_nonprim = NULL; + cJSON *uncertainty_ellipse = NULL; + OpenAPI_uncertainty_ellipse_t *uncertainty_ellipse_local_nonprim = NULL; + cJSON *confidence = NULL; + shape = cJSON_GetObjectItemCaseSensitive(local2d_point_uncertainty_ellipseJSON, "shape"); + if (!shape) { + ogs_error("OpenAPI_local2d_point_uncertainty_ellipse_parseFromJSON() failed [shape]"); + goto end; + } + shape_local_nonprim = OpenAPI_supported_gad_shapes_parseFromJSON(shape); + + local_origin = cJSON_GetObjectItemCaseSensitive(local2d_point_uncertainty_ellipseJSON, "localOrigin"); + if (!local_origin) { + ogs_error("OpenAPI_local2d_point_uncertainty_ellipse_parseFromJSON() failed [local_origin]"); + goto end; + } + local_origin_local_nonprim = OpenAPI_local_origin_parseFromJSON(local_origin); + + point = cJSON_GetObjectItemCaseSensitive(local2d_point_uncertainty_ellipseJSON, "point"); + if (!point) { + ogs_error("OpenAPI_local2d_point_uncertainty_ellipse_parseFromJSON() failed [point]"); + goto end; + } + point_local_nonprim = OpenAPI_relative_cartesian_location_parseFromJSON(point); + + uncertainty_ellipse = cJSON_GetObjectItemCaseSensitive(local2d_point_uncertainty_ellipseJSON, "uncertaintyEllipse"); + if (!uncertainty_ellipse) { + ogs_error("OpenAPI_local2d_point_uncertainty_ellipse_parseFromJSON() failed [uncertainty_ellipse]"); + goto end; + } + uncertainty_ellipse_local_nonprim = OpenAPI_uncertainty_ellipse_parseFromJSON(uncertainty_ellipse); + + confidence = cJSON_GetObjectItemCaseSensitive(local2d_point_uncertainty_ellipseJSON, "confidence"); + if (!confidence) { + ogs_error("OpenAPI_local2d_point_uncertainty_ellipse_parseFromJSON() failed [confidence]"); + goto end; + } + if (!cJSON_IsNumber(confidence)) { + ogs_error("OpenAPI_local2d_point_uncertainty_ellipse_parseFromJSON() failed [confidence]"); + goto end; + } + + local2d_point_uncertainty_ellipse_local_var = OpenAPI_local2d_point_uncertainty_ellipse_create ( + shape_local_nonprim, + local_origin_local_nonprim, + point_local_nonprim, + uncertainty_ellipse_local_nonprim, + + confidence->valuedouble + ); + + return local2d_point_uncertainty_ellipse_local_var; +end: + if (shape_local_nonprim) { + OpenAPI_supported_gad_shapes_free(shape_local_nonprim); + shape_local_nonprim = NULL; + } + if (local_origin_local_nonprim) { + OpenAPI_local_origin_free(local_origin_local_nonprim); + local_origin_local_nonprim = NULL; + } + if (point_local_nonprim) { + OpenAPI_relative_cartesian_location_free(point_local_nonprim); + point_local_nonprim = NULL; + } + if (uncertainty_ellipse_local_nonprim) { + OpenAPI_uncertainty_ellipse_free(uncertainty_ellipse_local_nonprim); + uncertainty_ellipse_local_nonprim = NULL; + } + return NULL; +} + +OpenAPI_local2d_point_uncertainty_ellipse_t *OpenAPI_local2d_point_uncertainty_ellipse_copy(OpenAPI_local2d_point_uncertainty_ellipse_t *dst, OpenAPI_local2d_point_uncertainty_ellipse_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_local2d_point_uncertainty_ellipse_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_local2d_point_uncertainty_ellipse_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_local2d_point_uncertainty_ellipse_free(dst); + dst = OpenAPI_local2d_point_uncertainty_ellipse_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/local2d_point_uncertainty_ellipse.h b/lib/sbi/openapi/model/local2d_point_uncertainty_ellipse.h new file mode 100644 index 000000000..e1150e79a --- /dev/null +++ b/lib/sbi/openapi/model/local2d_point_uncertainty_ellipse.h @@ -0,0 +1,51 @@ +/* + * local2d_point_uncertainty_ellipse.h + * + * Local 2D point with uncertainty ellipse + */ + +#ifndef _OpenAPI_local2d_point_uncertainty_ellipse_H_ +#define _OpenAPI_local2d_point_uncertainty_ellipse_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "gad_shape.h" +#include "local_origin.h" +#include "relative_cartesian_location.h" +#include "supported_gad_shapes.h" +#include "uncertainty_ellipse.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_local2d_point_uncertainty_ellipse_s OpenAPI_local2d_point_uncertainty_ellipse_t; +typedef struct OpenAPI_local2d_point_uncertainty_ellipse_s { + struct OpenAPI_supported_gad_shapes_s *shape; + struct OpenAPI_local_origin_s *local_origin; + struct OpenAPI_relative_cartesian_location_s *point; + struct OpenAPI_uncertainty_ellipse_s *uncertainty_ellipse; + int confidence; +} OpenAPI_local2d_point_uncertainty_ellipse_t; + +OpenAPI_local2d_point_uncertainty_ellipse_t *OpenAPI_local2d_point_uncertainty_ellipse_create( + OpenAPI_supported_gad_shapes_t *shape, + OpenAPI_local_origin_t *local_origin, + OpenAPI_relative_cartesian_location_t *point, + OpenAPI_uncertainty_ellipse_t *uncertainty_ellipse, + int confidence +); +void OpenAPI_local2d_point_uncertainty_ellipse_free(OpenAPI_local2d_point_uncertainty_ellipse_t *local2d_point_uncertainty_ellipse); +OpenAPI_local2d_point_uncertainty_ellipse_t *OpenAPI_local2d_point_uncertainty_ellipse_parseFromJSON(cJSON *local2d_point_uncertainty_ellipseJSON); +cJSON *OpenAPI_local2d_point_uncertainty_ellipse_convertToJSON(OpenAPI_local2d_point_uncertainty_ellipse_t *local2d_point_uncertainty_ellipse); +OpenAPI_local2d_point_uncertainty_ellipse_t *OpenAPI_local2d_point_uncertainty_ellipse_copy(OpenAPI_local2d_point_uncertainty_ellipse_t *dst, OpenAPI_local2d_point_uncertainty_ellipse_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_local2d_point_uncertainty_ellipse_H_ */ + diff --git a/lib/sbi/openapi/model/local2d_point_uncertainty_ellipse_all_of.c b/lib/sbi/openapi/model/local2d_point_uncertainty_ellipse_all_of.c new file mode 100644 index 000000000..1f7db4e8f --- /dev/null +++ b/lib/sbi/openapi/model/local2d_point_uncertainty_ellipse_all_of.c @@ -0,0 +1,212 @@ + +#include +#include +#include +#include "local2d_point_uncertainty_ellipse_all_of.h" + +OpenAPI_local2d_point_uncertainty_ellipse_all_of_t *OpenAPI_local2d_point_uncertainty_ellipse_all_of_create( + OpenAPI_local_origin_t *local_origin, + OpenAPI_relative_cartesian_location_t *point, + OpenAPI_uncertainty_ellipse_t *uncertainty_ellipse, + int confidence +) +{ + OpenAPI_local2d_point_uncertainty_ellipse_all_of_t *local2d_point_uncertainty_ellipse_all_of_local_var = ogs_malloc(sizeof(OpenAPI_local2d_point_uncertainty_ellipse_all_of_t)); + ogs_assert(local2d_point_uncertainty_ellipse_all_of_local_var); + + local2d_point_uncertainty_ellipse_all_of_local_var->local_origin = local_origin; + local2d_point_uncertainty_ellipse_all_of_local_var->point = point; + local2d_point_uncertainty_ellipse_all_of_local_var->uncertainty_ellipse = uncertainty_ellipse; + local2d_point_uncertainty_ellipse_all_of_local_var->confidence = confidence; + + return local2d_point_uncertainty_ellipse_all_of_local_var; +} + +void OpenAPI_local2d_point_uncertainty_ellipse_all_of_free(OpenAPI_local2d_point_uncertainty_ellipse_all_of_t *local2d_point_uncertainty_ellipse_all_of) +{ + OpenAPI_lnode_t *node = NULL; + + if (NULL == local2d_point_uncertainty_ellipse_all_of) { + return; + } + if (local2d_point_uncertainty_ellipse_all_of->local_origin) { + OpenAPI_local_origin_free(local2d_point_uncertainty_ellipse_all_of->local_origin); + local2d_point_uncertainty_ellipse_all_of->local_origin = NULL; + } + if (local2d_point_uncertainty_ellipse_all_of->point) { + OpenAPI_relative_cartesian_location_free(local2d_point_uncertainty_ellipse_all_of->point); + local2d_point_uncertainty_ellipse_all_of->point = NULL; + } + if (local2d_point_uncertainty_ellipse_all_of->uncertainty_ellipse) { + OpenAPI_uncertainty_ellipse_free(local2d_point_uncertainty_ellipse_all_of->uncertainty_ellipse); + local2d_point_uncertainty_ellipse_all_of->uncertainty_ellipse = NULL; + } + ogs_free(local2d_point_uncertainty_ellipse_all_of); +} + +cJSON *OpenAPI_local2d_point_uncertainty_ellipse_all_of_convertToJSON(OpenAPI_local2d_point_uncertainty_ellipse_all_of_t *local2d_point_uncertainty_ellipse_all_of) +{ + cJSON *item = NULL; + OpenAPI_lnode_t *node = NULL; + + if (local2d_point_uncertainty_ellipse_all_of == NULL) { + ogs_error("OpenAPI_local2d_point_uncertainty_ellipse_all_of_convertToJSON() failed [Local2dPointUncertaintyEllipse_allOf]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (!local2d_point_uncertainty_ellipse_all_of->local_origin) { + ogs_error("OpenAPI_local2d_point_uncertainty_ellipse_all_of_convertToJSON() failed [local_origin]"); + return NULL; + } + cJSON *local_origin_local_JSON = OpenAPI_local_origin_convertToJSON(local2d_point_uncertainty_ellipse_all_of->local_origin); + if (local_origin_local_JSON == NULL) { + ogs_error("OpenAPI_local2d_point_uncertainty_ellipse_all_of_convertToJSON() failed [local_origin]"); + goto end; + } + cJSON_AddItemToObject(item, "localOrigin", local_origin_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_local2d_point_uncertainty_ellipse_all_of_convertToJSON() failed [local_origin]"); + goto end; + } + + if (!local2d_point_uncertainty_ellipse_all_of->point) { + ogs_error("OpenAPI_local2d_point_uncertainty_ellipse_all_of_convertToJSON() failed [point]"); + return NULL; + } + cJSON *point_local_JSON = OpenAPI_relative_cartesian_location_convertToJSON(local2d_point_uncertainty_ellipse_all_of->point); + if (point_local_JSON == NULL) { + ogs_error("OpenAPI_local2d_point_uncertainty_ellipse_all_of_convertToJSON() failed [point]"); + goto end; + } + cJSON_AddItemToObject(item, "point", point_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_local2d_point_uncertainty_ellipse_all_of_convertToJSON() failed [point]"); + goto end; + } + + if (!local2d_point_uncertainty_ellipse_all_of->uncertainty_ellipse) { + ogs_error("OpenAPI_local2d_point_uncertainty_ellipse_all_of_convertToJSON() failed [uncertainty_ellipse]"); + return NULL; + } + cJSON *uncertainty_ellipse_local_JSON = OpenAPI_uncertainty_ellipse_convertToJSON(local2d_point_uncertainty_ellipse_all_of->uncertainty_ellipse); + if (uncertainty_ellipse_local_JSON == NULL) { + ogs_error("OpenAPI_local2d_point_uncertainty_ellipse_all_of_convertToJSON() failed [uncertainty_ellipse]"); + goto end; + } + cJSON_AddItemToObject(item, "uncertaintyEllipse", uncertainty_ellipse_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_local2d_point_uncertainty_ellipse_all_of_convertToJSON() failed [uncertainty_ellipse]"); + goto end; + } + + if (cJSON_AddNumberToObject(item, "confidence", local2d_point_uncertainty_ellipse_all_of->confidence) == NULL) { + ogs_error("OpenAPI_local2d_point_uncertainty_ellipse_all_of_convertToJSON() failed [confidence]"); + goto end; + } + +end: + return item; +} + +OpenAPI_local2d_point_uncertainty_ellipse_all_of_t *OpenAPI_local2d_point_uncertainty_ellipse_all_of_parseFromJSON(cJSON *local2d_point_uncertainty_ellipse_all_ofJSON) +{ + OpenAPI_local2d_point_uncertainty_ellipse_all_of_t *local2d_point_uncertainty_ellipse_all_of_local_var = NULL; + OpenAPI_lnode_t *node = NULL; + cJSON *local_origin = NULL; + OpenAPI_local_origin_t *local_origin_local_nonprim = NULL; + cJSON *point = NULL; + OpenAPI_relative_cartesian_location_t *point_local_nonprim = NULL; + cJSON *uncertainty_ellipse = NULL; + OpenAPI_uncertainty_ellipse_t *uncertainty_ellipse_local_nonprim = NULL; + cJSON *confidence = NULL; + local_origin = cJSON_GetObjectItemCaseSensitive(local2d_point_uncertainty_ellipse_all_ofJSON, "localOrigin"); + if (!local_origin) { + ogs_error("OpenAPI_local2d_point_uncertainty_ellipse_all_of_parseFromJSON() failed [local_origin]"); + goto end; + } + local_origin_local_nonprim = OpenAPI_local_origin_parseFromJSON(local_origin); + + point = cJSON_GetObjectItemCaseSensitive(local2d_point_uncertainty_ellipse_all_ofJSON, "point"); + if (!point) { + ogs_error("OpenAPI_local2d_point_uncertainty_ellipse_all_of_parseFromJSON() failed [point]"); + goto end; + } + point_local_nonprim = OpenAPI_relative_cartesian_location_parseFromJSON(point); + + uncertainty_ellipse = cJSON_GetObjectItemCaseSensitive(local2d_point_uncertainty_ellipse_all_ofJSON, "uncertaintyEllipse"); + if (!uncertainty_ellipse) { + ogs_error("OpenAPI_local2d_point_uncertainty_ellipse_all_of_parseFromJSON() failed [uncertainty_ellipse]"); + goto end; + } + uncertainty_ellipse_local_nonprim = OpenAPI_uncertainty_ellipse_parseFromJSON(uncertainty_ellipse); + + confidence = cJSON_GetObjectItemCaseSensitive(local2d_point_uncertainty_ellipse_all_ofJSON, "confidence"); + if (!confidence) { + ogs_error("OpenAPI_local2d_point_uncertainty_ellipse_all_of_parseFromJSON() failed [confidence]"); + goto end; + } + if (!cJSON_IsNumber(confidence)) { + ogs_error("OpenAPI_local2d_point_uncertainty_ellipse_all_of_parseFromJSON() failed [confidence]"); + goto end; + } + + local2d_point_uncertainty_ellipse_all_of_local_var = OpenAPI_local2d_point_uncertainty_ellipse_all_of_create ( + local_origin_local_nonprim, + point_local_nonprim, + uncertainty_ellipse_local_nonprim, + + confidence->valuedouble + ); + + return local2d_point_uncertainty_ellipse_all_of_local_var; +end: + if (local_origin_local_nonprim) { + OpenAPI_local_origin_free(local_origin_local_nonprim); + local_origin_local_nonprim = NULL; + } + if (point_local_nonprim) { + OpenAPI_relative_cartesian_location_free(point_local_nonprim); + point_local_nonprim = NULL; + } + if (uncertainty_ellipse_local_nonprim) { + OpenAPI_uncertainty_ellipse_free(uncertainty_ellipse_local_nonprim); + uncertainty_ellipse_local_nonprim = NULL; + } + return NULL; +} + +OpenAPI_local2d_point_uncertainty_ellipse_all_of_t *OpenAPI_local2d_point_uncertainty_ellipse_all_of_copy(OpenAPI_local2d_point_uncertainty_ellipse_all_of_t *dst, OpenAPI_local2d_point_uncertainty_ellipse_all_of_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_local2d_point_uncertainty_ellipse_all_of_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_local2d_point_uncertainty_ellipse_all_of_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_local2d_point_uncertainty_ellipse_all_of_free(dst); + dst = OpenAPI_local2d_point_uncertainty_ellipse_all_of_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/local2d_point_uncertainty_ellipse_all_of.h b/lib/sbi/openapi/model/local2d_point_uncertainty_ellipse_all_of.h new file mode 100644 index 000000000..35b467692 --- /dev/null +++ b/lib/sbi/openapi/model/local2d_point_uncertainty_ellipse_all_of.h @@ -0,0 +1,47 @@ +/* + * local2d_point_uncertainty_ellipse_all_of.h + * + * + */ + +#ifndef _OpenAPI_local2d_point_uncertainty_ellipse_all_of_H_ +#define _OpenAPI_local2d_point_uncertainty_ellipse_all_of_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "local_origin.h" +#include "relative_cartesian_location.h" +#include "uncertainty_ellipse.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_local2d_point_uncertainty_ellipse_all_of_s OpenAPI_local2d_point_uncertainty_ellipse_all_of_t; +typedef struct OpenAPI_local2d_point_uncertainty_ellipse_all_of_s { + struct OpenAPI_local_origin_s *local_origin; + struct OpenAPI_relative_cartesian_location_s *point; + struct OpenAPI_uncertainty_ellipse_s *uncertainty_ellipse; + int confidence; +} OpenAPI_local2d_point_uncertainty_ellipse_all_of_t; + +OpenAPI_local2d_point_uncertainty_ellipse_all_of_t *OpenAPI_local2d_point_uncertainty_ellipse_all_of_create( + OpenAPI_local_origin_t *local_origin, + OpenAPI_relative_cartesian_location_t *point, + OpenAPI_uncertainty_ellipse_t *uncertainty_ellipse, + int confidence +); +void OpenAPI_local2d_point_uncertainty_ellipse_all_of_free(OpenAPI_local2d_point_uncertainty_ellipse_all_of_t *local2d_point_uncertainty_ellipse_all_of); +OpenAPI_local2d_point_uncertainty_ellipse_all_of_t *OpenAPI_local2d_point_uncertainty_ellipse_all_of_parseFromJSON(cJSON *local2d_point_uncertainty_ellipse_all_ofJSON); +cJSON *OpenAPI_local2d_point_uncertainty_ellipse_all_of_convertToJSON(OpenAPI_local2d_point_uncertainty_ellipse_all_of_t *local2d_point_uncertainty_ellipse_all_of); +OpenAPI_local2d_point_uncertainty_ellipse_all_of_t *OpenAPI_local2d_point_uncertainty_ellipse_all_of_copy(OpenAPI_local2d_point_uncertainty_ellipse_all_of_t *dst, OpenAPI_local2d_point_uncertainty_ellipse_all_of_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_local2d_point_uncertainty_ellipse_all_of_H_ */ + diff --git a/lib/sbi/openapi/model/local3d_point_uncertainty_ellipsoid.c b/lib/sbi/openapi/model/local3d_point_uncertainty_ellipsoid.c new file mode 100644 index 000000000..85feec5da --- /dev/null +++ b/lib/sbi/openapi/model/local3d_point_uncertainty_ellipsoid.c @@ -0,0 +1,247 @@ + +#include +#include +#include +#include "local3d_point_uncertainty_ellipsoid.h" + +OpenAPI_local3d_point_uncertainty_ellipsoid_t *OpenAPI_local3d_point_uncertainty_ellipsoid_create( + OpenAPI_supported_gad_shapes_t *shape, + OpenAPI_local_origin_t *local_origin, + OpenAPI_relative_cartesian_location_t *point, + OpenAPI_uncertainty_ellipsoid_t *uncertainty_ellipsoid, + int confidence +) +{ + OpenAPI_local3d_point_uncertainty_ellipsoid_t *local3d_point_uncertainty_ellipsoid_local_var = ogs_malloc(sizeof(OpenAPI_local3d_point_uncertainty_ellipsoid_t)); + ogs_assert(local3d_point_uncertainty_ellipsoid_local_var); + + local3d_point_uncertainty_ellipsoid_local_var->shape = shape; + local3d_point_uncertainty_ellipsoid_local_var->local_origin = local_origin; + local3d_point_uncertainty_ellipsoid_local_var->point = point; + local3d_point_uncertainty_ellipsoid_local_var->uncertainty_ellipsoid = uncertainty_ellipsoid; + local3d_point_uncertainty_ellipsoid_local_var->confidence = confidence; + + return local3d_point_uncertainty_ellipsoid_local_var; +} + +void OpenAPI_local3d_point_uncertainty_ellipsoid_free(OpenAPI_local3d_point_uncertainty_ellipsoid_t *local3d_point_uncertainty_ellipsoid) +{ + OpenAPI_lnode_t *node = NULL; + + if (NULL == local3d_point_uncertainty_ellipsoid) { + return; + } + if (local3d_point_uncertainty_ellipsoid->shape) { + OpenAPI_supported_gad_shapes_free(local3d_point_uncertainty_ellipsoid->shape); + local3d_point_uncertainty_ellipsoid->shape = NULL; + } + if (local3d_point_uncertainty_ellipsoid->local_origin) { + OpenAPI_local_origin_free(local3d_point_uncertainty_ellipsoid->local_origin); + local3d_point_uncertainty_ellipsoid->local_origin = NULL; + } + if (local3d_point_uncertainty_ellipsoid->point) { + OpenAPI_relative_cartesian_location_free(local3d_point_uncertainty_ellipsoid->point); + local3d_point_uncertainty_ellipsoid->point = NULL; + } + if (local3d_point_uncertainty_ellipsoid->uncertainty_ellipsoid) { + OpenAPI_uncertainty_ellipsoid_free(local3d_point_uncertainty_ellipsoid->uncertainty_ellipsoid); + local3d_point_uncertainty_ellipsoid->uncertainty_ellipsoid = NULL; + } + ogs_free(local3d_point_uncertainty_ellipsoid); +} + +cJSON *OpenAPI_local3d_point_uncertainty_ellipsoid_convertToJSON(OpenAPI_local3d_point_uncertainty_ellipsoid_t *local3d_point_uncertainty_ellipsoid) +{ + cJSON *item = NULL; + OpenAPI_lnode_t *node = NULL; + + if (local3d_point_uncertainty_ellipsoid == NULL) { + ogs_error("OpenAPI_local3d_point_uncertainty_ellipsoid_convertToJSON() failed [Local3dPointUncertaintyEllipsoid]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (!local3d_point_uncertainty_ellipsoid->shape) { + ogs_error("OpenAPI_local3d_point_uncertainty_ellipsoid_convertToJSON() failed [shape]"); + return NULL; + } + cJSON *shape_local_JSON = OpenAPI_supported_gad_shapes_convertToJSON(local3d_point_uncertainty_ellipsoid->shape); + if (shape_local_JSON == NULL) { + ogs_error("OpenAPI_local3d_point_uncertainty_ellipsoid_convertToJSON() failed [shape]"); + goto end; + } + cJSON_AddItemToObject(item, "shape", shape_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_local3d_point_uncertainty_ellipsoid_convertToJSON() failed [shape]"); + goto end; + } + + if (!local3d_point_uncertainty_ellipsoid->local_origin) { + ogs_error("OpenAPI_local3d_point_uncertainty_ellipsoid_convertToJSON() failed [local_origin]"); + return NULL; + } + cJSON *local_origin_local_JSON = OpenAPI_local_origin_convertToJSON(local3d_point_uncertainty_ellipsoid->local_origin); + if (local_origin_local_JSON == NULL) { + ogs_error("OpenAPI_local3d_point_uncertainty_ellipsoid_convertToJSON() failed [local_origin]"); + goto end; + } + cJSON_AddItemToObject(item, "localOrigin", local_origin_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_local3d_point_uncertainty_ellipsoid_convertToJSON() failed [local_origin]"); + goto end; + } + + if (!local3d_point_uncertainty_ellipsoid->point) { + ogs_error("OpenAPI_local3d_point_uncertainty_ellipsoid_convertToJSON() failed [point]"); + return NULL; + } + cJSON *point_local_JSON = OpenAPI_relative_cartesian_location_convertToJSON(local3d_point_uncertainty_ellipsoid->point); + if (point_local_JSON == NULL) { + ogs_error("OpenAPI_local3d_point_uncertainty_ellipsoid_convertToJSON() failed [point]"); + goto end; + } + cJSON_AddItemToObject(item, "point", point_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_local3d_point_uncertainty_ellipsoid_convertToJSON() failed [point]"); + goto end; + } + + if (!local3d_point_uncertainty_ellipsoid->uncertainty_ellipsoid) { + ogs_error("OpenAPI_local3d_point_uncertainty_ellipsoid_convertToJSON() failed [uncertainty_ellipsoid]"); + return NULL; + } + cJSON *uncertainty_ellipsoid_local_JSON = OpenAPI_uncertainty_ellipsoid_convertToJSON(local3d_point_uncertainty_ellipsoid->uncertainty_ellipsoid); + if (uncertainty_ellipsoid_local_JSON == NULL) { + ogs_error("OpenAPI_local3d_point_uncertainty_ellipsoid_convertToJSON() failed [uncertainty_ellipsoid]"); + goto end; + } + cJSON_AddItemToObject(item, "uncertaintyEllipsoid", uncertainty_ellipsoid_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_local3d_point_uncertainty_ellipsoid_convertToJSON() failed [uncertainty_ellipsoid]"); + goto end; + } + + if (cJSON_AddNumberToObject(item, "confidence", local3d_point_uncertainty_ellipsoid->confidence) == NULL) { + ogs_error("OpenAPI_local3d_point_uncertainty_ellipsoid_convertToJSON() failed [confidence]"); + goto end; + } + +end: + return item; +} + +OpenAPI_local3d_point_uncertainty_ellipsoid_t *OpenAPI_local3d_point_uncertainty_ellipsoid_parseFromJSON(cJSON *local3d_point_uncertainty_ellipsoidJSON) +{ + OpenAPI_local3d_point_uncertainty_ellipsoid_t *local3d_point_uncertainty_ellipsoid_local_var = NULL; + OpenAPI_lnode_t *node = NULL; + cJSON *shape = NULL; + OpenAPI_supported_gad_shapes_t *shape_local_nonprim = NULL; + cJSON *local_origin = NULL; + OpenAPI_local_origin_t *local_origin_local_nonprim = NULL; + cJSON *point = NULL; + OpenAPI_relative_cartesian_location_t *point_local_nonprim = NULL; + cJSON *uncertainty_ellipsoid = NULL; + OpenAPI_uncertainty_ellipsoid_t *uncertainty_ellipsoid_local_nonprim = NULL; + cJSON *confidence = NULL; + shape = cJSON_GetObjectItemCaseSensitive(local3d_point_uncertainty_ellipsoidJSON, "shape"); + if (!shape) { + ogs_error("OpenAPI_local3d_point_uncertainty_ellipsoid_parseFromJSON() failed [shape]"); + goto end; + } + shape_local_nonprim = OpenAPI_supported_gad_shapes_parseFromJSON(shape); + + local_origin = cJSON_GetObjectItemCaseSensitive(local3d_point_uncertainty_ellipsoidJSON, "localOrigin"); + if (!local_origin) { + ogs_error("OpenAPI_local3d_point_uncertainty_ellipsoid_parseFromJSON() failed [local_origin]"); + goto end; + } + local_origin_local_nonprim = OpenAPI_local_origin_parseFromJSON(local_origin); + + point = cJSON_GetObjectItemCaseSensitive(local3d_point_uncertainty_ellipsoidJSON, "point"); + if (!point) { + ogs_error("OpenAPI_local3d_point_uncertainty_ellipsoid_parseFromJSON() failed [point]"); + goto end; + } + point_local_nonprim = OpenAPI_relative_cartesian_location_parseFromJSON(point); + + uncertainty_ellipsoid = cJSON_GetObjectItemCaseSensitive(local3d_point_uncertainty_ellipsoidJSON, "uncertaintyEllipsoid"); + if (!uncertainty_ellipsoid) { + ogs_error("OpenAPI_local3d_point_uncertainty_ellipsoid_parseFromJSON() failed [uncertainty_ellipsoid]"); + goto end; + } + uncertainty_ellipsoid_local_nonprim = OpenAPI_uncertainty_ellipsoid_parseFromJSON(uncertainty_ellipsoid); + + confidence = cJSON_GetObjectItemCaseSensitive(local3d_point_uncertainty_ellipsoidJSON, "confidence"); + if (!confidence) { + ogs_error("OpenAPI_local3d_point_uncertainty_ellipsoid_parseFromJSON() failed [confidence]"); + goto end; + } + if (!cJSON_IsNumber(confidence)) { + ogs_error("OpenAPI_local3d_point_uncertainty_ellipsoid_parseFromJSON() failed [confidence]"); + goto end; + } + + local3d_point_uncertainty_ellipsoid_local_var = OpenAPI_local3d_point_uncertainty_ellipsoid_create ( + shape_local_nonprim, + local_origin_local_nonprim, + point_local_nonprim, + uncertainty_ellipsoid_local_nonprim, + + confidence->valuedouble + ); + + return local3d_point_uncertainty_ellipsoid_local_var; +end: + if (shape_local_nonprim) { + OpenAPI_supported_gad_shapes_free(shape_local_nonprim); + shape_local_nonprim = NULL; + } + if (local_origin_local_nonprim) { + OpenAPI_local_origin_free(local_origin_local_nonprim); + local_origin_local_nonprim = NULL; + } + if (point_local_nonprim) { + OpenAPI_relative_cartesian_location_free(point_local_nonprim); + point_local_nonprim = NULL; + } + if (uncertainty_ellipsoid_local_nonprim) { + OpenAPI_uncertainty_ellipsoid_free(uncertainty_ellipsoid_local_nonprim); + uncertainty_ellipsoid_local_nonprim = NULL; + } + return NULL; +} + +OpenAPI_local3d_point_uncertainty_ellipsoid_t *OpenAPI_local3d_point_uncertainty_ellipsoid_copy(OpenAPI_local3d_point_uncertainty_ellipsoid_t *dst, OpenAPI_local3d_point_uncertainty_ellipsoid_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_local3d_point_uncertainty_ellipsoid_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_local3d_point_uncertainty_ellipsoid_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_local3d_point_uncertainty_ellipsoid_free(dst); + dst = OpenAPI_local3d_point_uncertainty_ellipsoid_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/local3d_point_uncertainty_ellipsoid.h b/lib/sbi/openapi/model/local3d_point_uncertainty_ellipsoid.h new file mode 100644 index 000000000..74d717b57 --- /dev/null +++ b/lib/sbi/openapi/model/local3d_point_uncertainty_ellipsoid.h @@ -0,0 +1,51 @@ +/* + * local3d_point_uncertainty_ellipsoid.h + * + * Local 3D point with uncertainty ellipsoid + */ + +#ifndef _OpenAPI_local3d_point_uncertainty_ellipsoid_H_ +#define _OpenAPI_local3d_point_uncertainty_ellipsoid_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "gad_shape.h" +#include "local_origin.h" +#include "relative_cartesian_location.h" +#include "supported_gad_shapes.h" +#include "uncertainty_ellipsoid.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_local3d_point_uncertainty_ellipsoid_s OpenAPI_local3d_point_uncertainty_ellipsoid_t; +typedef struct OpenAPI_local3d_point_uncertainty_ellipsoid_s { + struct OpenAPI_supported_gad_shapes_s *shape; + struct OpenAPI_local_origin_s *local_origin; + struct OpenAPI_relative_cartesian_location_s *point; + struct OpenAPI_uncertainty_ellipsoid_s *uncertainty_ellipsoid; + int confidence; +} OpenAPI_local3d_point_uncertainty_ellipsoid_t; + +OpenAPI_local3d_point_uncertainty_ellipsoid_t *OpenAPI_local3d_point_uncertainty_ellipsoid_create( + OpenAPI_supported_gad_shapes_t *shape, + OpenAPI_local_origin_t *local_origin, + OpenAPI_relative_cartesian_location_t *point, + OpenAPI_uncertainty_ellipsoid_t *uncertainty_ellipsoid, + int confidence +); +void OpenAPI_local3d_point_uncertainty_ellipsoid_free(OpenAPI_local3d_point_uncertainty_ellipsoid_t *local3d_point_uncertainty_ellipsoid); +OpenAPI_local3d_point_uncertainty_ellipsoid_t *OpenAPI_local3d_point_uncertainty_ellipsoid_parseFromJSON(cJSON *local3d_point_uncertainty_ellipsoidJSON); +cJSON *OpenAPI_local3d_point_uncertainty_ellipsoid_convertToJSON(OpenAPI_local3d_point_uncertainty_ellipsoid_t *local3d_point_uncertainty_ellipsoid); +OpenAPI_local3d_point_uncertainty_ellipsoid_t *OpenAPI_local3d_point_uncertainty_ellipsoid_copy(OpenAPI_local3d_point_uncertainty_ellipsoid_t *dst, OpenAPI_local3d_point_uncertainty_ellipsoid_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_local3d_point_uncertainty_ellipsoid_H_ */ + diff --git a/lib/sbi/openapi/model/local3d_point_uncertainty_ellipsoid_all_of.c b/lib/sbi/openapi/model/local3d_point_uncertainty_ellipsoid_all_of.c new file mode 100644 index 000000000..48d19e31e --- /dev/null +++ b/lib/sbi/openapi/model/local3d_point_uncertainty_ellipsoid_all_of.c @@ -0,0 +1,212 @@ + +#include +#include +#include +#include "local3d_point_uncertainty_ellipsoid_all_of.h" + +OpenAPI_local3d_point_uncertainty_ellipsoid_all_of_t *OpenAPI_local3d_point_uncertainty_ellipsoid_all_of_create( + OpenAPI_local_origin_t *local_origin, + OpenAPI_relative_cartesian_location_t *point, + OpenAPI_uncertainty_ellipsoid_t *uncertainty_ellipsoid, + int confidence +) +{ + OpenAPI_local3d_point_uncertainty_ellipsoid_all_of_t *local3d_point_uncertainty_ellipsoid_all_of_local_var = ogs_malloc(sizeof(OpenAPI_local3d_point_uncertainty_ellipsoid_all_of_t)); + ogs_assert(local3d_point_uncertainty_ellipsoid_all_of_local_var); + + local3d_point_uncertainty_ellipsoid_all_of_local_var->local_origin = local_origin; + local3d_point_uncertainty_ellipsoid_all_of_local_var->point = point; + local3d_point_uncertainty_ellipsoid_all_of_local_var->uncertainty_ellipsoid = uncertainty_ellipsoid; + local3d_point_uncertainty_ellipsoid_all_of_local_var->confidence = confidence; + + return local3d_point_uncertainty_ellipsoid_all_of_local_var; +} + +void OpenAPI_local3d_point_uncertainty_ellipsoid_all_of_free(OpenAPI_local3d_point_uncertainty_ellipsoid_all_of_t *local3d_point_uncertainty_ellipsoid_all_of) +{ + OpenAPI_lnode_t *node = NULL; + + if (NULL == local3d_point_uncertainty_ellipsoid_all_of) { + return; + } + if (local3d_point_uncertainty_ellipsoid_all_of->local_origin) { + OpenAPI_local_origin_free(local3d_point_uncertainty_ellipsoid_all_of->local_origin); + local3d_point_uncertainty_ellipsoid_all_of->local_origin = NULL; + } + if (local3d_point_uncertainty_ellipsoid_all_of->point) { + OpenAPI_relative_cartesian_location_free(local3d_point_uncertainty_ellipsoid_all_of->point); + local3d_point_uncertainty_ellipsoid_all_of->point = NULL; + } + if (local3d_point_uncertainty_ellipsoid_all_of->uncertainty_ellipsoid) { + OpenAPI_uncertainty_ellipsoid_free(local3d_point_uncertainty_ellipsoid_all_of->uncertainty_ellipsoid); + local3d_point_uncertainty_ellipsoid_all_of->uncertainty_ellipsoid = NULL; + } + ogs_free(local3d_point_uncertainty_ellipsoid_all_of); +} + +cJSON *OpenAPI_local3d_point_uncertainty_ellipsoid_all_of_convertToJSON(OpenAPI_local3d_point_uncertainty_ellipsoid_all_of_t *local3d_point_uncertainty_ellipsoid_all_of) +{ + cJSON *item = NULL; + OpenAPI_lnode_t *node = NULL; + + if (local3d_point_uncertainty_ellipsoid_all_of == NULL) { + ogs_error("OpenAPI_local3d_point_uncertainty_ellipsoid_all_of_convertToJSON() failed [Local3dPointUncertaintyEllipsoid_allOf]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (!local3d_point_uncertainty_ellipsoid_all_of->local_origin) { + ogs_error("OpenAPI_local3d_point_uncertainty_ellipsoid_all_of_convertToJSON() failed [local_origin]"); + return NULL; + } + cJSON *local_origin_local_JSON = OpenAPI_local_origin_convertToJSON(local3d_point_uncertainty_ellipsoid_all_of->local_origin); + if (local_origin_local_JSON == NULL) { + ogs_error("OpenAPI_local3d_point_uncertainty_ellipsoid_all_of_convertToJSON() failed [local_origin]"); + goto end; + } + cJSON_AddItemToObject(item, "localOrigin", local_origin_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_local3d_point_uncertainty_ellipsoid_all_of_convertToJSON() failed [local_origin]"); + goto end; + } + + if (!local3d_point_uncertainty_ellipsoid_all_of->point) { + ogs_error("OpenAPI_local3d_point_uncertainty_ellipsoid_all_of_convertToJSON() failed [point]"); + return NULL; + } + cJSON *point_local_JSON = OpenAPI_relative_cartesian_location_convertToJSON(local3d_point_uncertainty_ellipsoid_all_of->point); + if (point_local_JSON == NULL) { + ogs_error("OpenAPI_local3d_point_uncertainty_ellipsoid_all_of_convertToJSON() failed [point]"); + goto end; + } + cJSON_AddItemToObject(item, "point", point_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_local3d_point_uncertainty_ellipsoid_all_of_convertToJSON() failed [point]"); + goto end; + } + + if (!local3d_point_uncertainty_ellipsoid_all_of->uncertainty_ellipsoid) { + ogs_error("OpenAPI_local3d_point_uncertainty_ellipsoid_all_of_convertToJSON() failed [uncertainty_ellipsoid]"); + return NULL; + } + cJSON *uncertainty_ellipsoid_local_JSON = OpenAPI_uncertainty_ellipsoid_convertToJSON(local3d_point_uncertainty_ellipsoid_all_of->uncertainty_ellipsoid); + if (uncertainty_ellipsoid_local_JSON == NULL) { + ogs_error("OpenAPI_local3d_point_uncertainty_ellipsoid_all_of_convertToJSON() failed [uncertainty_ellipsoid]"); + goto end; + } + cJSON_AddItemToObject(item, "uncertaintyEllipsoid", uncertainty_ellipsoid_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_local3d_point_uncertainty_ellipsoid_all_of_convertToJSON() failed [uncertainty_ellipsoid]"); + goto end; + } + + if (cJSON_AddNumberToObject(item, "confidence", local3d_point_uncertainty_ellipsoid_all_of->confidence) == NULL) { + ogs_error("OpenAPI_local3d_point_uncertainty_ellipsoid_all_of_convertToJSON() failed [confidence]"); + goto end; + } + +end: + return item; +} + +OpenAPI_local3d_point_uncertainty_ellipsoid_all_of_t *OpenAPI_local3d_point_uncertainty_ellipsoid_all_of_parseFromJSON(cJSON *local3d_point_uncertainty_ellipsoid_all_ofJSON) +{ + OpenAPI_local3d_point_uncertainty_ellipsoid_all_of_t *local3d_point_uncertainty_ellipsoid_all_of_local_var = NULL; + OpenAPI_lnode_t *node = NULL; + cJSON *local_origin = NULL; + OpenAPI_local_origin_t *local_origin_local_nonprim = NULL; + cJSON *point = NULL; + OpenAPI_relative_cartesian_location_t *point_local_nonprim = NULL; + cJSON *uncertainty_ellipsoid = NULL; + OpenAPI_uncertainty_ellipsoid_t *uncertainty_ellipsoid_local_nonprim = NULL; + cJSON *confidence = NULL; + local_origin = cJSON_GetObjectItemCaseSensitive(local3d_point_uncertainty_ellipsoid_all_ofJSON, "localOrigin"); + if (!local_origin) { + ogs_error("OpenAPI_local3d_point_uncertainty_ellipsoid_all_of_parseFromJSON() failed [local_origin]"); + goto end; + } + local_origin_local_nonprim = OpenAPI_local_origin_parseFromJSON(local_origin); + + point = cJSON_GetObjectItemCaseSensitive(local3d_point_uncertainty_ellipsoid_all_ofJSON, "point"); + if (!point) { + ogs_error("OpenAPI_local3d_point_uncertainty_ellipsoid_all_of_parseFromJSON() failed [point]"); + goto end; + } + point_local_nonprim = OpenAPI_relative_cartesian_location_parseFromJSON(point); + + uncertainty_ellipsoid = cJSON_GetObjectItemCaseSensitive(local3d_point_uncertainty_ellipsoid_all_ofJSON, "uncertaintyEllipsoid"); + if (!uncertainty_ellipsoid) { + ogs_error("OpenAPI_local3d_point_uncertainty_ellipsoid_all_of_parseFromJSON() failed [uncertainty_ellipsoid]"); + goto end; + } + uncertainty_ellipsoid_local_nonprim = OpenAPI_uncertainty_ellipsoid_parseFromJSON(uncertainty_ellipsoid); + + confidence = cJSON_GetObjectItemCaseSensitive(local3d_point_uncertainty_ellipsoid_all_ofJSON, "confidence"); + if (!confidence) { + ogs_error("OpenAPI_local3d_point_uncertainty_ellipsoid_all_of_parseFromJSON() failed [confidence]"); + goto end; + } + if (!cJSON_IsNumber(confidence)) { + ogs_error("OpenAPI_local3d_point_uncertainty_ellipsoid_all_of_parseFromJSON() failed [confidence]"); + goto end; + } + + local3d_point_uncertainty_ellipsoid_all_of_local_var = OpenAPI_local3d_point_uncertainty_ellipsoid_all_of_create ( + local_origin_local_nonprim, + point_local_nonprim, + uncertainty_ellipsoid_local_nonprim, + + confidence->valuedouble + ); + + return local3d_point_uncertainty_ellipsoid_all_of_local_var; +end: + if (local_origin_local_nonprim) { + OpenAPI_local_origin_free(local_origin_local_nonprim); + local_origin_local_nonprim = NULL; + } + if (point_local_nonprim) { + OpenAPI_relative_cartesian_location_free(point_local_nonprim); + point_local_nonprim = NULL; + } + if (uncertainty_ellipsoid_local_nonprim) { + OpenAPI_uncertainty_ellipsoid_free(uncertainty_ellipsoid_local_nonprim); + uncertainty_ellipsoid_local_nonprim = NULL; + } + return NULL; +} + +OpenAPI_local3d_point_uncertainty_ellipsoid_all_of_t *OpenAPI_local3d_point_uncertainty_ellipsoid_all_of_copy(OpenAPI_local3d_point_uncertainty_ellipsoid_all_of_t *dst, OpenAPI_local3d_point_uncertainty_ellipsoid_all_of_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_local3d_point_uncertainty_ellipsoid_all_of_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_local3d_point_uncertainty_ellipsoid_all_of_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_local3d_point_uncertainty_ellipsoid_all_of_free(dst); + dst = OpenAPI_local3d_point_uncertainty_ellipsoid_all_of_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/local3d_point_uncertainty_ellipsoid_all_of.h b/lib/sbi/openapi/model/local3d_point_uncertainty_ellipsoid_all_of.h new file mode 100644 index 000000000..cb66624dc --- /dev/null +++ b/lib/sbi/openapi/model/local3d_point_uncertainty_ellipsoid_all_of.h @@ -0,0 +1,47 @@ +/* + * local3d_point_uncertainty_ellipsoid_all_of.h + * + * + */ + +#ifndef _OpenAPI_local3d_point_uncertainty_ellipsoid_all_of_H_ +#define _OpenAPI_local3d_point_uncertainty_ellipsoid_all_of_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "local_origin.h" +#include "relative_cartesian_location.h" +#include "uncertainty_ellipsoid.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_local3d_point_uncertainty_ellipsoid_all_of_s OpenAPI_local3d_point_uncertainty_ellipsoid_all_of_t; +typedef struct OpenAPI_local3d_point_uncertainty_ellipsoid_all_of_s { + struct OpenAPI_local_origin_s *local_origin; + struct OpenAPI_relative_cartesian_location_s *point; + struct OpenAPI_uncertainty_ellipsoid_s *uncertainty_ellipsoid; + int confidence; +} OpenAPI_local3d_point_uncertainty_ellipsoid_all_of_t; + +OpenAPI_local3d_point_uncertainty_ellipsoid_all_of_t *OpenAPI_local3d_point_uncertainty_ellipsoid_all_of_create( + OpenAPI_local_origin_t *local_origin, + OpenAPI_relative_cartesian_location_t *point, + OpenAPI_uncertainty_ellipsoid_t *uncertainty_ellipsoid, + int confidence +); +void OpenAPI_local3d_point_uncertainty_ellipsoid_all_of_free(OpenAPI_local3d_point_uncertainty_ellipsoid_all_of_t *local3d_point_uncertainty_ellipsoid_all_of); +OpenAPI_local3d_point_uncertainty_ellipsoid_all_of_t *OpenAPI_local3d_point_uncertainty_ellipsoid_all_of_parseFromJSON(cJSON *local3d_point_uncertainty_ellipsoid_all_ofJSON); +cJSON *OpenAPI_local3d_point_uncertainty_ellipsoid_all_of_convertToJSON(OpenAPI_local3d_point_uncertainty_ellipsoid_all_of_t *local3d_point_uncertainty_ellipsoid_all_of); +OpenAPI_local3d_point_uncertainty_ellipsoid_all_of_t *OpenAPI_local3d_point_uncertainty_ellipsoid_all_of_copy(OpenAPI_local3d_point_uncertainty_ellipsoid_all_of_t *dst, OpenAPI_local3d_point_uncertainty_ellipsoid_all_of_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_local3d_point_uncertainty_ellipsoid_all_of_H_ */ + diff --git a/lib/sbi/openapi/model/local_origin.c b/lib/sbi/openapi/model/local_origin.c new file mode 100644 index 000000000..be7f7b007 --- /dev/null +++ b/lib/sbi/openapi/model/local_origin.c @@ -0,0 +1,141 @@ + +#include +#include +#include +#include "local_origin.h" + +OpenAPI_local_origin_t *OpenAPI_local_origin_create( + char *coordinate_id, + OpenAPI_geographical_coordinates_t *point +) +{ + OpenAPI_local_origin_t *local_origin_local_var = ogs_malloc(sizeof(OpenAPI_local_origin_t)); + ogs_assert(local_origin_local_var); + + local_origin_local_var->coordinate_id = coordinate_id; + local_origin_local_var->point = point; + + return local_origin_local_var; +} + +void OpenAPI_local_origin_free(OpenAPI_local_origin_t *local_origin) +{ + OpenAPI_lnode_t *node = NULL; + + if (NULL == local_origin) { + return; + } + if (local_origin->coordinate_id) { + ogs_free(local_origin->coordinate_id); + local_origin->coordinate_id = NULL; + } + if (local_origin->point) { + OpenAPI_geographical_coordinates_free(local_origin->point); + local_origin->point = NULL; + } + ogs_free(local_origin); +} + +cJSON *OpenAPI_local_origin_convertToJSON(OpenAPI_local_origin_t *local_origin) +{ + cJSON *item = NULL; + OpenAPI_lnode_t *node = NULL; + + if (local_origin == NULL) { + ogs_error("OpenAPI_local_origin_convertToJSON() failed [LocalOrigin]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (local_origin->coordinate_id) { + if (cJSON_AddStringToObject(item, "coordinateId", local_origin->coordinate_id) == NULL) { + ogs_error("OpenAPI_local_origin_convertToJSON() failed [coordinate_id]"); + goto end; + } + } + + if (local_origin->point) { + cJSON *point_local_JSON = OpenAPI_geographical_coordinates_convertToJSON(local_origin->point); + if (point_local_JSON == NULL) { + ogs_error("OpenAPI_local_origin_convertToJSON() failed [point]"); + goto end; + } + cJSON_AddItemToObject(item, "point", point_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_local_origin_convertToJSON() failed [point]"); + goto end; + } + } + +end: + return item; +} + +OpenAPI_local_origin_t *OpenAPI_local_origin_parseFromJSON(cJSON *local_originJSON) +{ + OpenAPI_local_origin_t *local_origin_local_var = NULL; + OpenAPI_lnode_t *node = NULL; + cJSON *coordinate_id = NULL; + cJSON *point = NULL; + OpenAPI_geographical_coordinates_t *point_local_nonprim = NULL; + coordinate_id = cJSON_GetObjectItemCaseSensitive(local_originJSON, "coordinateId"); + if (coordinate_id) { + if (!cJSON_IsString(coordinate_id) && !cJSON_IsNull(coordinate_id)) { + ogs_error("OpenAPI_local_origin_parseFromJSON() failed [coordinate_id]"); + goto end; + } + } + + point = cJSON_GetObjectItemCaseSensitive(local_originJSON, "point"); + if (point) { + point_local_nonprim = OpenAPI_geographical_coordinates_parseFromJSON(point); + } + + local_origin_local_var = OpenAPI_local_origin_create ( + coordinate_id && !cJSON_IsNull(coordinate_id) ? ogs_strdup(coordinate_id->valuestring) : NULL, + point ? point_local_nonprim : NULL + ); + + return local_origin_local_var; +end: + if (point_local_nonprim) { + OpenAPI_geographical_coordinates_free(point_local_nonprim); + point_local_nonprim = NULL; + } + return NULL; +} + +OpenAPI_local_origin_t *OpenAPI_local_origin_copy(OpenAPI_local_origin_t *dst, OpenAPI_local_origin_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_local_origin_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_local_origin_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_local_origin_free(dst); + dst = OpenAPI_local_origin_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/local_origin.h b/lib/sbi/openapi/model/local_origin.h new file mode 100644 index 000000000..9ab71a32c --- /dev/null +++ b/lib/sbi/openapi/model/local_origin.h @@ -0,0 +1,41 @@ +/* + * local_origin.h + * + * Indicates a Local origin in a reference system + */ + +#ifndef _OpenAPI_local_origin_H_ +#define _OpenAPI_local_origin_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "geographical_coordinates.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_local_origin_s OpenAPI_local_origin_t; +typedef struct OpenAPI_local_origin_s { + char *coordinate_id; + struct OpenAPI_geographical_coordinates_s *point; +} OpenAPI_local_origin_t; + +OpenAPI_local_origin_t *OpenAPI_local_origin_create( + char *coordinate_id, + OpenAPI_geographical_coordinates_t *point +); +void OpenAPI_local_origin_free(OpenAPI_local_origin_t *local_origin); +OpenAPI_local_origin_t *OpenAPI_local_origin_parseFromJSON(cJSON *local_originJSON); +cJSON *OpenAPI_local_origin_convertToJSON(OpenAPI_local_origin_t *local_origin); +OpenAPI_local_origin_t *OpenAPI_local_origin_copy(OpenAPI_local_origin_t *dst, OpenAPI_local_origin_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_local_origin_H_ */ + diff --git a/lib/sbi/openapi/model/location_accuracy_any_of.c b/lib/sbi/openapi/model/location_accuracy_any_of.c index 357252934..9a44c1ce5 100644 --- a/lib/sbi/openapi/model/location_accuracy_any_of.c +++ b/lib/sbi/openapi/model/location_accuracy_any_of.c @@ -6,7 +6,7 @@ char* OpenAPI_location_accuracy_any_of_ToString(OpenAPI_location_accuracy_any_of_e location_accuracy_any_of) { - const char *location_accuracy_any_ofArray[] = { "NULL", "CELL_LEVEL", "TA_LEVEL", "N3IWF_LEVEL", "UE_IP", "UE_PORT" }; + const char *location_accuracy_any_ofArray[] = { "NULL", "CELL_LEVEL", "RAN_NODE_LEVEL", "TA_LEVEL", "N3IWF_LEVEL", "UE_IP", "UE_PORT" }; size_t sizeofArray = sizeof(location_accuracy_any_ofArray) / sizeof(location_accuracy_any_ofArray[0]); if (location_accuracy_any_of < sizeofArray) return (char *)location_accuracy_any_ofArray[location_accuracy_any_of]; @@ -17,7 +17,7 @@ char* OpenAPI_location_accuracy_any_of_ToString(OpenAPI_location_accuracy_any_of OpenAPI_location_accuracy_any_of_e OpenAPI_location_accuracy_any_of_FromString(char* location_accuracy_any_of) { int stringToReturn = 0; - const char *location_accuracy_any_ofArray[] = { "NULL", "CELL_LEVEL", "TA_LEVEL", "N3IWF_LEVEL", "UE_IP", "UE_PORT" }; + const char *location_accuracy_any_ofArray[] = { "NULL", "CELL_LEVEL", "RAN_NODE_LEVEL", "TA_LEVEL", "N3IWF_LEVEL", "UE_IP", "UE_PORT" }; size_t sizeofArray = sizeof(location_accuracy_any_ofArray) / sizeof(location_accuracy_any_ofArray[0]); while (stringToReturn < sizeofArray) { if (strcmp(location_accuracy_any_of, location_accuracy_any_ofArray[stringToReturn]) == 0) { diff --git a/lib/sbi/openapi/model/location_accuracy_any_of.h b/lib/sbi/openapi/model/location_accuracy_any_of.h index 8010bf7b3..2d769865e 100644 --- a/lib/sbi/openapi/model/location_accuracy_any_of.h +++ b/lib/sbi/openapi/model/location_accuracy_any_of.h @@ -17,7 +17,7 @@ extern "C" { #endif -typedef enum { OpenAPI_location_accuracy_any_of_NULL = 0, OpenAPI_location_accuracy_any_of_CELL_LEVEL, OpenAPI_location_accuracy_any_of_TA_LEVEL, OpenAPI_location_accuracy_any_of_N3IWF_LEVEL, OpenAPI_location_accuracy_any_of_UE_IP, OpenAPI_location_accuracy_any_of_UE_PORT } OpenAPI_location_accuracy_any_of_e; +typedef enum { OpenAPI_location_accuracy_any_of_NULL = 0, OpenAPI_location_accuracy_any_of_CELL_LEVEL, OpenAPI_location_accuracy_any_of_RAN_NODE_LEVEL, OpenAPI_location_accuracy_any_of_TA_LEVEL, OpenAPI_location_accuracy_any_of_N3IWF_LEVEL, OpenAPI_location_accuracy_any_of_UE_IP, OpenAPI_location_accuracy_any_of_UE_PORT } OpenAPI_location_accuracy_any_of_e; char* OpenAPI_location_accuracy_any_of_ToString(OpenAPI_location_accuracy_any_of_e location_accuracy_any_of); diff --git a/lib/sbi/openapi/model/location_area.c b/lib/sbi/openapi/model/location_area.c index b429283e8..dbbb89e64 100644 --- a/lib/sbi/openapi/model/location_area.c +++ b/lib/sbi/openapi/model/location_area.c @@ -7,7 +7,8 @@ OpenAPI_location_area_t *OpenAPI_location_area_create( OpenAPI_list_t *geographic_areas, OpenAPI_list_t *civic_addresses, - OpenAPI_network_area_info_t *nw_area_info + OpenAPI_network_area_info_1_t *nw_area_info, + OpenAPI_umt_time_t *umt_time ) { OpenAPI_location_area_t *location_area_local_var = ogs_malloc(sizeof(OpenAPI_location_area_t)); @@ -16,6 +17,7 @@ OpenAPI_location_area_t *OpenAPI_location_area_create( location_area_local_var->geographic_areas = geographic_areas; location_area_local_var->civic_addresses = civic_addresses; location_area_local_var->nw_area_info = nw_area_info; + location_area_local_var->umt_time = umt_time; return location_area_local_var; } @@ -42,9 +44,13 @@ void OpenAPI_location_area_free(OpenAPI_location_area_t *location_area) location_area->civic_addresses = NULL; } if (location_area->nw_area_info) { - OpenAPI_network_area_info_free(location_area->nw_area_info); + OpenAPI_network_area_info_1_free(location_area->nw_area_info); location_area->nw_area_info = NULL; } + if (location_area->umt_time) { + OpenAPI_umt_time_free(location_area->umt_time); + location_area->umt_time = NULL; + } ogs_free(location_area); } @@ -92,7 +98,7 @@ cJSON *OpenAPI_location_area_convertToJSON(OpenAPI_location_area_t *location_are } if (location_area->nw_area_info) { - cJSON *nw_area_info_local_JSON = OpenAPI_network_area_info_convertToJSON(location_area->nw_area_info); + cJSON *nw_area_info_local_JSON = OpenAPI_network_area_info_1_convertToJSON(location_area->nw_area_info); if (nw_area_info_local_JSON == NULL) { ogs_error("OpenAPI_location_area_convertToJSON() failed [nw_area_info]"); goto end; @@ -104,6 +110,19 @@ cJSON *OpenAPI_location_area_convertToJSON(OpenAPI_location_area_t *location_are } } + if (location_area->umt_time) { + cJSON *umt_time_local_JSON = OpenAPI_umt_time_convertToJSON(location_area->umt_time); + if (umt_time_local_JSON == NULL) { + ogs_error("OpenAPI_location_area_convertToJSON() failed [umt_time]"); + goto end; + } + cJSON_AddItemToObject(item, "umtTime", umt_time_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_location_area_convertToJSON() failed [umt_time]"); + goto end; + } + } + end: return item; } @@ -117,7 +136,9 @@ OpenAPI_location_area_t *OpenAPI_location_area_parseFromJSON(cJSON *location_are cJSON *civic_addresses = NULL; OpenAPI_list_t *civic_addressesList = NULL; cJSON *nw_area_info = NULL; - OpenAPI_network_area_info_t *nw_area_info_local_nonprim = NULL; + OpenAPI_network_area_info_1_t *nw_area_info_local_nonprim = NULL; + cJSON *umt_time = NULL; + OpenAPI_umt_time_t *umt_time_local_nonprim = NULL; geographic_areas = cJSON_GetObjectItemCaseSensitive(location_areaJSON, "geographicAreas"); if (geographic_areas) { cJSON *geographic_areas_local = NULL; @@ -170,13 +191,19 @@ OpenAPI_location_area_t *OpenAPI_location_area_parseFromJSON(cJSON *location_are nw_area_info = cJSON_GetObjectItemCaseSensitive(location_areaJSON, "nwAreaInfo"); if (nw_area_info) { - nw_area_info_local_nonprim = OpenAPI_network_area_info_parseFromJSON(nw_area_info); + nw_area_info_local_nonprim = OpenAPI_network_area_info_1_parseFromJSON(nw_area_info); + } + + umt_time = cJSON_GetObjectItemCaseSensitive(location_areaJSON, "umtTime"); + if (umt_time) { + umt_time_local_nonprim = OpenAPI_umt_time_parseFromJSON(umt_time); } location_area_local_var = OpenAPI_location_area_create ( geographic_areas ? geographic_areasList : NULL, civic_addresses ? civic_addressesList : NULL, - nw_area_info ? nw_area_info_local_nonprim : NULL + nw_area_info ? nw_area_info_local_nonprim : NULL, + umt_time ? umt_time_local_nonprim : NULL ); return location_area_local_var; @@ -196,9 +223,13 @@ end: civic_addressesList = NULL; } if (nw_area_info_local_nonprim) { - OpenAPI_network_area_info_free(nw_area_info_local_nonprim); + OpenAPI_network_area_info_1_free(nw_area_info_local_nonprim); nw_area_info_local_nonprim = NULL; } + if (umt_time_local_nonprim) { + OpenAPI_umt_time_free(umt_time_local_nonprim); + umt_time_local_nonprim = NULL; + } return NULL; } diff --git a/lib/sbi/openapi/model/location_area.h b/lib/sbi/openapi/model/location_area.h index ffd65e1e3..943efd31c 100644 --- a/lib/sbi/openapi/model/location_area.h +++ b/lib/sbi/openapi/model/location_area.h @@ -14,7 +14,8 @@ #include "../include/binary.h" #include "civic_address.h" #include "geographic_area.h" -#include "network_area_info.h" +#include "network_area_info_1.h" +#include "umt_time.h" #ifdef __cplusplus extern "C" { @@ -24,13 +25,15 @@ typedef struct OpenAPI_location_area_s OpenAPI_location_area_t; typedef struct OpenAPI_location_area_s { OpenAPI_list_t *geographic_areas; OpenAPI_list_t *civic_addresses; - struct OpenAPI_network_area_info_s *nw_area_info; + struct OpenAPI_network_area_info_1_s *nw_area_info; + struct OpenAPI_umt_time_s *umt_time; } OpenAPI_location_area_t; OpenAPI_location_area_t *OpenAPI_location_area_create( OpenAPI_list_t *geographic_areas, OpenAPI_list_t *civic_addresses, - OpenAPI_network_area_info_t *nw_area_info + OpenAPI_network_area_info_1_t *nw_area_info, + OpenAPI_umt_time_t *umt_time ); void OpenAPI_location_area_free(OpenAPI_location_area_t *location_area); OpenAPI_location_area_t *OpenAPI_location_area_parseFromJSON(cJSON *location_areaJSON); diff --git a/lib/sbi/openapi/model/location_area_1.c b/lib/sbi/openapi/model/location_area_1.c index 347cd6654..988fb025d 100644 --- a/lib/sbi/openapi/model/location_area_1.c +++ b/lib/sbi/openapi/model/location_area_1.c @@ -7,7 +7,8 @@ OpenAPI_location_area_1_t *OpenAPI_location_area_1_create( OpenAPI_list_t *geographic_areas, OpenAPI_list_t *civic_addresses, - OpenAPI_network_area_info_1_t *nw_area_info + OpenAPI_network_area_info_1_t *nw_area_info, + OpenAPI_umt_time_1_t *umt_time ) { OpenAPI_location_area_1_t *location_area_1_local_var = ogs_malloc(sizeof(OpenAPI_location_area_1_t)); @@ -16,6 +17,7 @@ OpenAPI_location_area_1_t *OpenAPI_location_area_1_create( location_area_1_local_var->geographic_areas = geographic_areas; location_area_1_local_var->civic_addresses = civic_addresses; location_area_1_local_var->nw_area_info = nw_area_info; + location_area_1_local_var->umt_time = umt_time; return location_area_1_local_var; } @@ -45,6 +47,10 @@ void OpenAPI_location_area_1_free(OpenAPI_location_area_1_t *location_area_1) OpenAPI_network_area_info_1_free(location_area_1->nw_area_info); location_area_1->nw_area_info = NULL; } + if (location_area_1->umt_time) { + OpenAPI_umt_time_1_free(location_area_1->umt_time); + location_area_1->umt_time = NULL; + } ogs_free(location_area_1); } @@ -104,6 +110,19 @@ cJSON *OpenAPI_location_area_1_convertToJSON(OpenAPI_location_area_1_t *location } } + if (location_area_1->umt_time) { + cJSON *umt_time_local_JSON = OpenAPI_umt_time_1_convertToJSON(location_area_1->umt_time); + if (umt_time_local_JSON == NULL) { + ogs_error("OpenAPI_location_area_1_convertToJSON() failed [umt_time]"); + goto end; + } + cJSON_AddItemToObject(item, "umtTime", umt_time_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_location_area_1_convertToJSON() failed [umt_time]"); + goto end; + } + } + end: return item; } @@ -118,6 +137,8 @@ OpenAPI_location_area_1_t *OpenAPI_location_area_1_parseFromJSON(cJSON *location OpenAPI_list_t *civic_addressesList = NULL; cJSON *nw_area_info = NULL; OpenAPI_network_area_info_1_t *nw_area_info_local_nonprim = NULL; + cJSON *umt_time = NULL; + OpenAPI_umt_time_1_t *umt_time_local_nonprim = NULL; geographic_areas = cJSON_GetObjectItemCaseSensitive(location_area_1JSON, "geographicAreas"); if (geographic_areas) { cJSON *geographic_areas_local = NULL; @@ -173,10 +194,16 @@ OpenAPI_location_area_1_t *OpenAPI_location_area_1_parseFromJSON(cJSON *location nw_area_info_local_nonprim = OpenAPI_network_area_info_1_parseFromJSON(nw_area_info); } + umt_time = cJSON_GetObjectItemCaseSensitive(location_area_1JSON, "umtTime"); + if (umt_time) { + umt_time_local_nonprim = OpenAPI_umt_time_1_parseFromJSON(umt_time); + } + location_area_1_local_var = OpenAPI_location_area_1_create ( geographic_areas ? geographic_areasList : NULL, civic_addresses ? civic_addressesList : NULL, - nw_area_info ? nw_area_info_local_nonprim : NULL + nw_area_info ? nw_area_info_local_nonprim : NULL, + umt_time ? umt_time_local_nonprim : NULL ); return location_area_1_local_var; @@ -199,6 +226,10 @@ end: OpenAPI_network_area_info_1_free(nw_area_info_local_nonprim); nw_area_info_local_nonprim = NULL; } + if (umt_time_local_nonprim) { + OpenAPI_umt_time_1_free(umt_time_local_nonprim); + umt_time_local_nonprim = NULL; + } return NULL; } diff --git a/lib/sbi/openapi/model/location_area_1.h b/lib/sbi/openapi/model/location_area_1.h index 227f9ca6a..12dd8c53b 100644 --- a/lib/sbi/openapi/model/location_area_1.h +++ b/lib/sbi/openapi/model/location_area_1.h @@ -15,6 +15,7 @@ #include "civic_address.h" #include "geographic_area.h" #include "network_area_info_1.h" +#include "umt_time_1.h" #ifdef __cplusplus extern "C" { @@ -25,12 +26,14 @@ typedef struct OpenAPI_location_area_1_s { OpenAPI_list_t *geographic_areas; OpenAPI_list_t *civic_addresses; struct OpenAPI_network_area_info_1_s *nw_area_info; + struct OpenAPI_umt_time_1_s *umt_time; } OpenAPI_location_area_1_t; OpenAPI_location_area_1_t *OpenAPI_location_area_1_create( OpenAPI_list_t *geographic_areas, OpenAPI_list_t *civic_addresses, - OpenAPI_network_area_info_1_t *nw_area_info + OpenAPI_network_area_info_1_t *nw_area_info, + OpenAPI_umt_time_1_t *umt_time ); void OpenAPI_location_area_1_free(OpenAPI_location_area_1_t *location_area_1); OpenAPI_location_area_1_t *OpenAPI_location_area_1_parseFromJSON(cJSON *location_area_1JSON); diff --git a/lib/sbi/openapi/model/location_area_id.c b/lib/sbi/openapi/model/location_area_id.c new file mode 100644 index 000000000..9bebbcc6e --- /dev/null +++ b/lib/sbi/openapi/model/location_area_id.c @@ -0,0 +1,149 @@ + +#include +#include +#include +#include "location_area_id.h" + +OpenAPI_location_area_id_t *OpenAPI_location_area_id_create( + OpenAPI_plmn_id_t *plmn_id, + char *lac +) +{ + OpenAPI_location_area_id_t *location_area_id_local_var = ogs_malloc(sizeof(OpenAPI_location_area_id_t)); + ogs_assert(location_area_id_local_var); + + location_area_id_local_var->plmn_id = plmn_id; + location_area_id_local_var->lac = lac; + + return location_area_id_local_var; +} + +void OpenAPI_location_area_id_free(OpenAPI_location_area_id_t *location_area_id) +{ + OpenAPI_lnode_t *node = NULL; + + if (NULL == location_area_id) { + return; + } + if (location_area_id->plmn_id) { + OpenAPI_plmn_id_free(location_area_id->plmn_id); + location_area_id->plmn_id = NULL; + } + if (location_area_id->lac) { + ogs_free(location_area_id->lac); + location_area_id->lac = NULL; + } + ogs_free(location_area_id); +} + +cJSON *OpenAPI_location_area_id_convertToJSON(OpenAPI_location_area_id_t *location_area_id) +{ + cJSON *item = NULL; + OpenAPI_lnode_t *node = NULL; + + if (location_area_id == NULL) { + ogs_error("OpenAPI_location_area_id_convertToJSON() failed [LocationAreaId]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (!location_area_id->plmn_id) { + ogs_error("OpenAPI_location_area_id_convertToJSON() failed [plmn_id]"); + return NULL; + } + cJSON *plmn_id_local_JSON = OpenAPI_plmn_id_convertToJSON(location_area_id->plmn_id); + if (plmn_id_local_JSON == NULL) { + ogs_error("OpenAPI_location_area_id_convertToJSON() failed [plmn_id]"); + goto end; + } + cJSON_AddItemToObject(item, "plmnId", plmn_id_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_location_area_id_convertToJSON() failed [plmn_id]"); + goto end; + } + + if (!location_area_id->lac) { + ogs_error("OpenAPI_location_area_id_convertToJSON() failed [lac]"); + return NULL; + } + if (cJSON_AddStringToObject(item, "lac", location_area_id->lac) == NULL) { + ogs_error("OpenAPI_location_area_id_convertToJSON() failed [lac]"); + goto end; + } + +end: + return item; +} + +OpenAPI_location_area_id_t *OpenAPI_location_area_id_parseFromJSON(cJSON *location_area_idJSON) +{ + OpenAPI_location_area_id_t *location_area_id_local_var = NULL; + OpenAPI_lnode_t *node = NULL; + cJSON *plmn_id = NULL; + OpenAPI_plmn_id_t *plmn_id_local_nonprim = NULL; + cJSON *lac = NULL; + plmn_id = cJSON_GetObjectItemCaseSensitive(location_area_idJSON, "plmnId"); + if (!plmn_id) { + ogs_error("OpenAPI_location_area_id_parseFromJSON() failed [plmn_id]"); + goto end; + } + plmn_id_local_nonprim = OpenAPI_plmn_id_parseFromJSON(plmn_id); + + lac = cJSON_GetObjectItemCaseSensitive(location_area_idJSON, "lac"); + if (!lac) { + ogs_error("OpenAPI_location_area_id_parseFromJSON() failed [lac]"); + goto end; + } + if (!cJSON_IsString(lac)) { + ogs_error("OpenAPI_location_area_id_parseFromJSON() failed [lac]"); + goto end; + } + + location_area_id_local_var = OpenAPI_location_area_id_create ( + plmn_id_local_nonprim, + ogs_strdup(lac->valuestring) + ); + + return location_area_id_local_var; +end: + if (plmn_id_local_nonprim) { + OpenAPI_plmn_id_free(plmn_id_local_nonprim); + plmn_id_local_nonprim = NULL; + } + return NULL; +} + +OpenAPI_location_area_id_t *OpenAPI_location_area_id_copy(OpenAPI_location_area_id_t *dst, OpenAPI_location_area_id_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_location_area_id_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_location_area_id_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_location_area_id_free(dst); + dst = OpenAPI_location_area_id_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/location_area_id.h b/lib/sbi/openapi/model/location_area_id.h new file mode 100644 index 000000000..d8ed1e284 --- /dev/null +++ b/lib/sbi/openapi/model/location_area_id.h @@ -0,0 +1,41 @@ +/* + * location_area_id.h + * + * Contains a Location area identification as defined in 3GPP TS 23.003, clause 4.1. + */ + +#ifndef _OpenAPI_location_area_id_H_ +#define _OpenAPI_location_area_id_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "plmn_id.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_location_area_id_s OpenAPI_location_area_id_t; +typedef struct OpenAPI_location_area_id_s { + struct OpenAPI_plmn_id_s *plmn_id; + char *lac; +} OpenAPI_location_area_id_t; + +OpenAPI_location_area_id_t *OpenAPI_location_area_id_create( + OpenAPI_plmn_id_t *plmn_id, + char *lac +); +void OpenAPI_location_area_id_free(OpenAPI_location_area_id_t *location_area_id); +OpenAPI_location_area_id_t *OpenAPI_location_area_id_parseFromJSON(cJSON *location_area_idJSON); +cJSON *OpenAPI_location_area_id_convertToJSON(OpenAPI_location_area_id_t *location_area_id); +OpenAPI_location_area_id_t *OpenAPI_location_area_id_copy(OpenAPI_location_area_id_t *dst, OpenAPI_location_area_id_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_location_area_id_H_ */ + diff --git a/lib/sbi/openapi/model/location_filter.h b/lib/sbi/openapi/model/location_filter.h index f7ed158c1..c8552c918 100644 --- a/lib/sbi/openapi/model/location_filter.h +++ b/lib/sbi/openapi/model/location_filter.h @@ -1,7 +1,7 @@ /* * location_filter.h * - * + * Describes the supported filters of LOCATION_REPORT event type */ #ifndef _OpenAPI_location_filter_H_ diff --git a/lib/sbi/openapi/model/location_filter_any_of.c b/lib/sbi/openapi/model/location_filter_any_of.c index cf42e40c3..64bfe012a 100644 --- a/lib/sbi/openapi/model/location_filter_any_of.c +++ b/lib/sbi/openapi/model/location_filter_any_of.c @@ -6,7 +6,7 @@ char* OpenAPI_location_filter_any_of_ToString(OpenAPI_location_filter_any_of_e location_filter_any_of) { - const char *location_filter_any_ofArray[] = { "NULL", "TAI", "CELL_ID", "N3IWF", "UE_IP", "UDP_PORT", "TNAP_ID", "GLI", "TWAP_ID" }; + const char *location_filter_any_ofArray[] = { "NULL", "TAI", "CELL_ID", "RAN_NODE", "N3IWF", "UE_IP", "UDP_PORT", "TNAP_ID", "GLI", "TWAP_ID" }; size_t sizeofArray = sizeof(location_filter_any_ofArray) / sizeof(location_filter_any_ofArray[0]); if (location_filter_any_of < sizeofArray) return (char *)location_filter_any_ofArray[location_filter_any_of]; @@ -17,7 +17,7 @@ char* OpenAPI_location_filter_any_of_ToString(OpenAPI_location_filter_any_of_e l OpenAPI_location_filter_any_of_e OpenAPI_location_filter_any_of_FromString(char* location_filter_any_of) { int stringToReturn = 0; - const char *location_filter_any_ofArray[] = { "NULL", "TAI", "CELL_ID", "N3IWF", "UE_IP", "UDP_PORT", "TNAP_ID", "GLI", "TWAP_ID" }; + const char *location_filter_any_ofArray[] = { "NULL", "TAI", "CELL_ID", "RAN_NODE", "N3IWF", "UE_IP", "UDP_PORT", "TNAP_ID", "GLI", "TWAP_ID" }; size_t sizeofArray = sizeof(location_filter_any_ofArray) / sizeof(location_filter_any_ofArray[0]); while (stringToReturn < sizeofArray) { if (strcmp(location_filter_any_of, location_filter_any_ofArray[stringToReturn]) == 0) { diff --git a/lib/sbi/openapi/model/location_filter_any_of.h b/lib/sbi/openapi/model/location_filter_any_of.h index 5f45151d0..68ffc42d5 100644 --- a/lib/sbi/openapi/model/location_filter_any_of.h +++ b/lib/sbi/openapi/model/location_filter_any_of.h @@ -17,7 +17,7 @@ extern "C" { #endif -typedef enum { OpenAPI_location_filter_any_of_NULL = 0, OpenAPI_location_filter_any_of_TAI, OpenAPI_location_filter_any_of_CELL_ID, OpenAPI_location_filter_any_of_N3IWF, OpenAPI_location_filter_any_of_UE_IP, OpenAPI_location_filter_any_of_UDP_PORT, OpenAPI_location_filter_any_of_TNAP_ID, OpenAPI_location_filter_any_of_GLI, OpenAPI_location_filter_any_of_TWAP_ID } OpenAPI_location_filter_any_of_e; +typedef enum { OpenAPI_location_filter_any_of_NULL = 0, OpenAPI_location_filter_any_of_TAI, OpenAPI_location_filter_any_of_CELL_ID, OpenAPI_location_filter_any_of_RAN_NODE, OpenAPI_location_filter_any_of_N3IWF, OpenAPI_location_filter_any_of_UE_IP, OpenAPI_location_filter_any_of_UDP_PORT, OpenAPI_location_filter_any_of_TNAP_ID, OpenAPI_location_filter_any_of_GLI, OpenAPI_location_filter_any_of_TWAP_ID } OpenAPI_location_filter_any_of_e; char* OpenAPI_location_filter_any_of_ToString(OpenAPI_location_filter_any_of_e location_filter_any_of); diff --git a/lib/sbi/openapi/model/location_info.c b/lib/sbi/openapi/model/location_info.c index 23d200ec6..97422c582 100644 --- a/lib/sbi/openapi/model/location_info.c +++ b/lib/sbi/openapi/model/location_info.c @@ -5,19 +5,21 @@ #include "location_info.h" OpenAPI_location_info_t *OpenAPI_location_info_create( - char *supi, - char *gpsi, - OpenAPI_list_t *registration_location_info_list, - char *supported_features + OpenAPI_user_location_t *loc, + bool is_ratio, + int ratio, + bool is_confidence, + int confidence ) { OpenAPI_location_info_t *location_info_local_var = ogs_malloc(sizeof(OpenAPI_location_info_t)); ogs_assert(location_info_local_var); - location_info_local_var->supi = supi; - location_info_local_var->gpsi = gpsi; - location_info_local_var->registration_location_info_list = registration_location_info_list; - location_info_local_var->supported_features = supported_features; + location_info_local_var->loc = loc; + location_info_local_var->is_ratio = is_ratio; + location_info_local_var->ratio = ratio; + location_info_local_var->is_confidence = is_confidence; + location_info_local_var->confidence = confidence; return location_info_local_var; } @@ -29,24 +31,9 @@ void OpenAPI_location_info_free(OpenAPI_location_info_t *location_info) if (NULL == location_info) { return; } - if (location_info->supi) { - ogs_free(location_info->supi); - location_info->supi = NULL; - } - if (location_info->gpsi) { - ogs_free(location_info->gpsi); - location_info->gpsi = NULL; - } - if (location_info->registration_location_info_list) { - OpenAPI_list_for_each(location_info->registration_location_info_list, node) { - OpenAPI_registration_location_info_free(node->data); - } - OpenAPI_list_free(location_info->registration_location_info_list); - location_info->registration_location_info_list = NULL; - } - if (location_info->supported_features) { - ogs_free(location_info->supported_features); - location_info->supported_features = NULL; + if (location_info->loc) { + OpenAPI_user_location_free(location_info->loc); + location_info->loc = NULL; } ogs_free(location_info); } @@ -62,41 +49,31 @@ cJSON *OpenAPI_location_info_convertToJSON(OpenAPI_location_info_t *location_inf } item = cJSON_CreateObject(); - if (location_info->supi) { - if (cJSON_AddStringToObject(item, "supi", location_info->supi) == NULL) { - ogs_error("OpenAPI_location_info_convertToJSON() failed [supi]"); - goto end; - } - } - - if (location_info->gpsi) { - if (cJSON_AddStringToObject(item, "gpsi", location_info->gpsi) == NULL) { - ogs_error("OpenAPI_location_info_convertToJSON() failed [gpsi]"); - goto end; - } - } - - if (!location_info->registration_location_info_list) { - ogs_error("OpenAPI_location_info_convertToJSON() failed [registration_location_info_list]"); + if (!location_info->loc) { + ogs_error("OpenAPI_location_info_convertToJSON() failed [loc]"); return NULL; } - cJSON *registration_location_info_listList = cJSON_AddArrayToObject(item, "registrationLocationInfoList"); - if (registration_location_info_listList == NULL) { - ogs_error("OpenAPI_location_info_convertToJSON() failed [registration_location_info_list]"); + cJSON *loc_local_JSON = OpenAPI_user_location_convertToJSON(location_info->loc); + if (loc_local_JSON == NULL) { + ogs_error("OpenAPI_location_info_convertToJSON() failed [loc]"); goto end; } - OpenAPI_list_for_each(location_info->registration_location_info_list, node) { - cJSON *itemLocal = OpenAPI_registration_location_info_convertToJSON(node->data); - if (itemLocal == NULL) { - ogs_error("OpenAPI_location_info_convertToJSON() failed [registration_location_info_list]"); - goto end; - } - cJSON_AddItemToArray(registration_location_info_listList, itemLocal); + cJSON_AddItemToObject(item, "loc", loc_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_location_info_convertToJSON() failed [loc]"); + goto end; } - if (location_info->supported_features) { - if (cJSON_AddStringToObject(item, "supportedFeatures", location_info->supported_features) == NULL) { - ogs_error("OpenAPI_location_info_convertToJSON() failed [supported_features]"); + if (location_info->is_ratio) { + if (cJSON_AddNumberToObject(item, "ratio", location_info->ratio) == NULL) { + ogs_error("OpenAPI_location_info_convertToJSON() failed [ratio]"); + goto end; + } + } + + if (location_info->is_confidence) { + if (cJSON_AddNumberToObject(item, "confidence", location_info->confidence) == NULL) { + ogs_error("OpenAPI_location_info_convertToJSON() failed [confidence]"); goto end; } } @@ -109,77 +86,46 @@ OpenAPI_location_info_t *OpenAPI_location_info_parseFromJSON(cJSON *location_inf { OpenAPI_location_info_t *location_info_local_var = NULL; OpenAPI_lnode_t *node = NULL; - cJSON *supi = NULL; - cJSON *gpsi = NULL; - cJSON *registration_location_info_list = NULL; - OpenAPI_list_t *registration_location_info_listList = NULL; - cJSON *supported_features = NULL; - supi = cJSON_GetObjectItemCaseSensitive(location_infoJSON, "supi"); - if (supi) { - if (!cJSON_IsString(supi) && !cJSON_IsNull(supi)) { - ogs_error("OpenAPI_location_info_parseFromJSON() failed [supi]"); + cJSON *loc = NULL; + OpenAPI_user_location_t *loc_local_nonprim = NULL; + cJSON *ratio = NULL; + cJSON *confidence = NULL; + loc = cJSON_GetObjectItemCaseSensitive(location_infoJSON, "loc"); + if (!loc) { + ogs_error("OpenAPI_location_info_parseFromJSON() failed [loc]"); + goto end; + } + loc_local_nonprim = OpenAPI_user_location_parseFromJSON(loc); + + ratio = cJSON_GetObjectItemCaseSensitive(location_infoJSON, "ratio"); + if (ratio) { + if (!cJSON_IsNumber(ratio)) { + ogs_error("OpenAPI_location_info_parseFromJSON() failed [ratio]"); goto end; } } - gpsi = cJSON_GetObjectItemCaseSensitive(location_infoJSON, "gpsi"); - if (gpsi) { - if (!cJSON_IsString(gpsi) && !cJSON_IsNull(gpsi)) { - ogs_error("OpenAPI_location_info_parseFromJSON() failed [gpsi]"); - goto end; - } - } - - registration_location_info_list = cJSON_GetObjectItemCaseSensitive(location_infoJSON, "registrationLocationInfoList"); - if (!registration_location_info_list) { - ogs_error("OpenAPI_location_info_parseFromJSON() failed [registration_location_info_list]"); - goto end; - } - cJSON *registration_location_info_list_local = NULL; - if (!cJSON_IsArray(registration_location_info_list)) { - ogs_error("OpenAPI_location_info_parseFromJSON() failed [registration_location_info_list]"); - goto end; - } - - registration_location_info_listList = OpenAPI_list_create(); - - cJSON_ArrayForEach(registration_location_info_list_local, registration_location_info_list) { - if (!cJSON_IsObject(registration_location_info_list_local)) { - ogs_error("OpenAPI_location_info_parseFromJSON() failed [registration_location_info_list]"); - goto end; - } - OpenAPI_registration_location_info_t *registration_location_info_listItem = OpenAPI_registration_location_info_parseFromJSON(registration_location_info_list_local); - if (!registration_location_info_listItem) { - ogs_error("No registration_location_info_listItem"); - OpenAPI_list_free(registration_location_info_listList); - goto end; - } - OpenAPI_list_add(registration_location_info_listList, registration_location_info_listItem); - } - - supported_features = cJSON_GetObjectItemCaseSensitive(location_infoJSON, "supportedFeatures"); - if (supported_features) { - if (!cJSON_IsString(supported_features) && !cJSON_IsNull(supported_features)) { - ogs_error("OpenAPI_location_info_parseFromJSON() failed [supported_features]"); + confidence = cJSON_GetObjectItemCaseSensitive(location_infoJSON, "confidence"); + if (confidence) { + if (!cJSON_IsNumber(confidence)) { + ogs_error("OpenAPI_location_info_parseFromJSON() failed [confidence]"); goto end; } } location_info_local_var = OpenAPI_location_info_create ( - supi && !cJSON_IsNull(supi) ? ogs_strdup(supi->valuestring) : NULL, - gpsi && !cJSON_IsNull(gpsi) ? ogs_strdup(gpsi->valuestring) : NULL, - registration_location_info_listList, - supported_features && !cJSON_IsNull(supported_features) ? ogs_strdup(supported_features->valuestring) : NULL + loc_local_nonprim, + ratio ? true : false, + ratio ? ratio->valuedouble : 0, + confidence ? true : false, + confidence ? confidence->valuedouble : 0 ); return location_info_local_var; end: - if (registration_location_info_listList) { - OpenAPI_list_for_each(registration_location_info_listList, node) { - OpenAPI_registration_location_info_free(node->data); - } - OpenAPI_list_free(registration_location_info_listList); - registration_location_info_listList = NULL; + if (loc_local_nonprim) { + OpenAPI_user_location_free(loc_local_nonprim); + loc_local_nonprim = NULL; } return NULL; } diff --git a/lib/sbi/openapi/model/location_info.h b/lib/sbi/openapi/model/location_info.h index a8c65bca4..a16266761 100644 --- a/lib/sbi/openapi/model/location_info.h +++ b/lib/sbi/openapi/model/location_info.h @@ -1,7 +1,7 @@ /* * location_info.h * - * + * Represents UE location information. */ #ifndef _OpenAPI_location_info_H_ @@ -12,7 +12,7 @@ #include "../include/list.h" #include "../include/keyValuePair.h" #include "../include/binary.h" -#include "registration_location_info.h" +#include "user_location.h" #ifdef __cplusplus extern "C" { @@ -20,17 +20,19 @@ extern "C" { typedef struct OpenAPI_location_info_s OpenAPI_location_info_t; typedef struct OpenAPI_location_info_s { - char *supi; - char *gpsi; - OpenAPI_list_t *registration_location_info_list; - char *supported_features; + struct OpenAPI_user_location_s *loc; + bool is_ratio; + int ratio; + bool is_confidence; + int confidence; } OpenAPI_location_info_t; OpenAPI_location_info_t *OpenAPI_location_info_create( - char *supi, - char *gpsi, - OpenAPI_list_t *registration_location_info_list, - char *supported_features + OpenAPI_user_location_t *loc, + bool is_ratio, + int ratio, + bool is_confidence, + int confidence ); void OpenAPI_location_info_free(OpenAPI_location_info_t *location_info); OpenAPI_location_info_t *OpenAPI_location_info_parseFromJSON(cJSON *location_infoJSON); diff --git a/lib/sbi/openapi/model/location_reporting_configuration_1.c b/lib/sbi/openapi/model/location_reporting_configuration_1.c new file mode 100644 index 000000000..1dd984d65 --- /dev/null +++ b/lib/sbi/openapi/model/location_reporting_configuration_1.c @@ -0,0 +1,191 @@ + +#include +#include +#include +#include "location_reporting_configuration_1.h" + +OpenAPI_location_reporting_configuration_1_t *OpenAPI_location_reporting_configuration_1_create( + int current_location, + bool is_one_time, + int one_time, + OpenAPI_location_accuracy_t *accuracy, + OpenAPI_location_accuracy_t *n3gpp_accuracy +) +{ + OpenAPI_location_reporting_configuration_1_t *location_reporting_configuration_1_local_var = ogs_malloc(sizeof(OpenAPI_location_reporting_configuration_1_t)); + ogs_assert(location_reporting_configuration_1_local_var); + + location_reporting_configuration_1_local_var->current_location = current_location; + location_reporting_configuration_1_local_var->is_one_time = is_one_time; + location_reporting_configuration_1_local_var->one_time = one_time; + location_reporting_configuration_1_local_var->accuracy = accuracy; + location_reporting_configuration_1_local_var->n3gpp_accuracy = n3gpp_accuracy; + + return location_reporting_configuration_1_local_var; +} + +void OpenAPI_location_reporting_configuration_1_free(OpenAPI_location_reporting_configuration_1_t *location_reporting_configuration_1) +{ + OpenAPI_lnode_t *node = NULL; + + if (NULL == location_reporting_configuration_1) { + return; + } + if (location_reporting_configuration_1->accuracy) { + OpenAPI_location_accuracy_free(location_reporting_configuration_1->accuracy); + location_reporting_configuration_1->accuracy = NULL; + } + if (location_reporting_configuration_1->n3gpp_accuracy) { + OpenAPI_location_accuracy_free(location_reporting_configuration_1->n3gpp_accuracy); + location_reporting_configuration_1->n3gpp_accuracy = NULL; + } + ogs_free(location_reporting_configuration_1); +} + +cJSON *OpenAPI_location_reporting_configuration_1_convertToJSON(OpenAPI_location_reporting_configuration_1_t *location_reporting_configuration_1) +{ + cJSON *item = NULL; + OpenAPI_lnode_t *node = NULL; + + if (location_reporting_configuration_1 == NULL) { + ogs_error("OpenAPI_location_reporting_configuration_1_convertToJSON() failed [LocationReportingConfiguration_1]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (cJSON_AddBoolToObject(item, "currentLocation", location_reporting_configuration_1->current_location) == NULL) { + ogs_error("OpenAPI_location_reporting_configuration_1_convertToJSON() failed [current_location]"); + goto end; + } + + if (location_reporting_configuration_1->is_one_time) { + if (cJSON_AddBoolToObject(item, "oneTime", location_reporting_configuration_1->one_time) == NULL) { + ogs_error("OpenAPI_location_reporting_configuration_1_convertToJSON() failed [one_time]"); + goto end; + } + } + + if (location_reporting_configuration_1->accuracy) { + cJSON *accuracy_local_JSON = OpenAPI_location_accuracy_convertToJSON(location_reporting_configuration_1->accuracy); + if (accuracy_local_JSON == NULL) { + ogs_error("OpenAPI_location_reporting_configuration_1_convertToJSON() failed [accuracy]"); + goto end; + } + cJSON_AddItemToObject(item, "accuracy", accuracy_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_location_reporting_configuration_1_convertToJSON() failed [accuracy]"); + goto end; + } + } + + if (location_reporting_configuration_1->n3gpp_accuracy) { + cJSON *n3gpp_accuracy_local_JSON = OpenAPI_location_accuracy_convertToJSON(location_reporting_configuration_1->n3gpp_accuracy); + if (n3gpp_accuracy_local_JSON == NULL) { + ogs_error("OpenAPI_location_reporting_configuration_1_convertToJSON() failed [n3gpp_accuracy]"); + goto end; + } + cJSON_AddItemToObject(item, "n3gppAccuracy", n3gpp_accuracy_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_location_reporting_configuration_1_convertToJSON() failed [n3gpp_accuracy]"); + goto end; + } + } + +end: + return item; +} + +OpenAPI_location_reporting_configuration_1_t *OpenAPI_location_reporting_configuration_1_parseFromJSON(cJSON *location_reporting_configuration_1JSON) +{ + OpenAPI_location_reporting_configuration_1_t *location_reporting_configuration_1_local_var = NULL; + OpenAPI_lnode_t *node = NULL; + cJSON *current_location = NULL; + cJSON *one_time = NULL; + cJSON *accuracy = NULL; + OpenAPI_location_accuracy_t *accuracy_local_nonprim = NULL; + cJSON *n3gpp_accuracy = NULL; + OpenAPI_location_accuracy_t *n3gpp_accuracy_local_nonprim = NULL; + current_location = cJSON_GetObjectItemCaseSensitive(location_reporting_configuration_1JSON, "currentLocation"); + if (!current_location) { + ogs_error("OpenAPI_location_reporting_configuration_1_parseFromJSON() failed [current_location]"); + goto end; + } + if (!cJSON_IsBool(current_location)) { + ogs_error("OpenAPI_location_reporting_configuration_1_parseFromJSON() failed [current_location]"); + goto end; + } + + one_time = cJSON_GetObjectItemCaseSensitive(location_reporting_configuration_1JSON, "oneTime"); + if (one_time) { + if (!cJSON_IsBool(one_time)) { + ogs_error("OpenAPI_location_reporting_configuration_1_parseFromJSON() failed [one_time]"); + goto end; + } + } + + accuracy = cJSON_GetObjectItemCaseSensitive(location_reporting_configuration_1JSON, "accuracy"); + if (accuracy) { + accuracy_local_nonprim = OpenAPI_location_accuracy_parseFromJSON(accuracy); + } + + n3gpp_accuracy = cJSON_GetObjectItemCaseSensitive(location_reporting_configuration_1JSON, "n3gppAccuracy"); + if (n3gpp_accuracy) { + n3gpp_accuracy_local_nonprim = OpenAPI_location_accuracy_parseFromJSON(n3gpp_accuracy); + } + + location_reporting_configuration_1_local_var = OpenAPI_location_reporting_configuration_1_create ( + + current_location->valueint, + one_time ? true : false, + one_time ? one_time->valueint : 0, + accuracy ? accuracy_local_nonprim : NULL, + n3gpp_accuracy ? n3gpp_accuracy_local_nonprim : NULL + ); + + return location_reporting_configuration_1_local_var; +end: + if (accuracy_local_nonprim) { + OpenAPI_location_accuracy_free(accuracy_local_nonprim); + accuracy_local_nonprim = NULL; + } + if (n3gpp_accuracy_local_nonprim) { + OpenAPI_location_accuracy_free(n3gpp_accuracy_local_nonprim); + n3gpp_accuracy_local_nonprim = NULL; + } + return NULL; +} + +OpenAPI_location_reporting_configuration_1_t *OpenAPI_location_reporting_configuration_1_copy(OpenAPI_location_reporting_configuration_1_t *dst, OpenAPI_location_reporting_configuration_1_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_location_reporting_configuration_1_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_location_reporting_configuration_1_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_location_reporting_configuration_1_free(dst); + dst = OpenAPI_location_reporting_configuration_1_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/location_reporting_configuration_1.h b/lib/sbi/openapi/model/location_reporting_configuration_1.h new file mode 100644 index 000000000..84e61c091 --- /dev/null +++ b/lib/sbi/openapi/model/location_reporting_configuration_1.h @@ -0,0 +1,47 @@ +/* + * location_reporting_configuration_1.h + * + * + */ + +#ifndef _OpenAPI_location_reporting_configuration_1_H_ +#define _OpenAPI_location_reporting_configuration_1_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "location_accuracy.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_location_reporting_configuration_1_s OpenAPI_location_reporting_configuration_1_t; +typedef struct OpenAPI_location_reporting_configuration_1_s { + int current_location; + bool is_one_time; + int one_time; + struct OpenAPI_location_accuracy_s *accuracy; + struct OpenAPI_location_accuracy_s *n3gpp_accuracy; +} OpenAPI_location_reporting_configuration_1_t; + +OpenAPI_location_reporting_configuration_1_t *OpenAPI_location_reporting_configuration_1_create( + int current_location, + bool is_one_time, + int one_time, + OpenAPI_location_accuracy_t *accuracy, + OpenAPI_location_accuracy_t *n3gpp_accuracy +); +void OpenAPI_location_reporting_configuration_1_free(OpenAPI_location_reporting_configuration_1_t *location_reporting_configuration_1); +OpenAPI_location_reporting_configuration_1_t *OpenAPI_location_reporting_configuration_1_parseFromJSON(cJSON *location_reporting_configuration_1JSON); +cJSON *OpenAPI_location_reporting_configuration_1_convertToJSON(OpenAPI_location_reporting_configuration_1_t *location_reporting_configuration_1); +OpenAPI_location_reporting_configuration_1_t *OpenAPI_location_reporting_configuration_1_copy(OpenAPI_location_reporting_configuration_1_t *dst, OpenAPI_location_reporting_configuration_1_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_location_reporting_configuration_1_H_ */ + diff --git a/lib/sbi/openapi/model/loss_connectivity_cfg_1.c b/lib/sbi/openapi/model/loss_connectivity_cfg_1.c new file mode 100644 index 000000000..67fe4b324 --- /dev/null +++ b/lib/sbi/openapi/model/loss_connectivity_cfg_1.c @@ -0,0 +1,109 @@ + +#include +#include +#include +#include "loss_connectivity_cfg_1.h" + +OpenAPI_loss_connectivity_cfg_1_t *OpenAPI_loss_connectivity_cfg_1_create( + bool is_max_detection_time, + int max_detection_time +) +{ + OpenAPI_loss_connectivity_cfg_1_t *loss_connectivity_cfg_1_local_var = ogs_malloc(sizeof(OpenAPI_loss_connectivity_cfg_1_t)); + ogs_assert(loss_connectivity_cfg_1_local_var); + + loss_connectivity_cfg_1_local_var->is_max_detection_time = is_max_detection_time; + loss_connectivity_cfg_1_local_var->max_detection_time = max_detection_time; + + return loss_connectivity_cfg_1_local_var; +} + +void OpenAPI_loss_connectivity_cfg_1_free(OpenAPI_loss_connectivity_cfg_1_t *loss_connectivity_cfg_1) +{ + OpenAPI_lnode_t *node = NULL; + + if (NULL == loss_connectivity_cfg_1) { + return; + } + ogs_free(loss_connectivity_cfg_1); +} + +cJSON *OpenAPI_loss_connectivity_cfg_1_convertToJSON(OpenAPI_loss_connectivity_cfg_1_t *loss_connectivity_cfg_1) +{ + cJSON *item = NULL; + OpenAPI_lnode_t *node = NULL; + + if (loss_connectivity_cfg_1 == NULL) { + ogs_error("OpenAPI_loss_connectivity_cfg_1_convertToJSON() failed [LossConnectivityCfg_1]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (loss_connectivity_cfg_1->is_max_detection_time) { + if (cJSON_AddNumberToObject(item, "maxDetectionTime", loss_connectivity_cfg_1->max_detection_time) == NULL) { + ogs_error("OpenAPI_loss_connectivity_cfg_1_convertToJSON() failed [max_detection_time]"); + goto end; + } + } + +end: + return item; +} + +OpenAPI_loss_connectivity_cfg_1_t *OpenAPI_loss_connectivity_cfg_1_parseFromJSON(cJSON *loss_connectivity_cfg_1JSON) +{ + OpenAPI_loss_connectivity_cfg_1_t *loss_connectivity_cfg_1_local_var = NULL; + OpenAPI_lnode_t *node = NULL; + cJSON *max_detection_time = NULL; + max_detection_time = cJSON_GetObjectItemCaseSensitive(loss_connectivity_cfg_1JSON, "maxDetectionTime"); + if (max_detection_time) { + if (!cJSON_IsNumber(max_detection_time)) { + ogs_error("OpenAPI_loss_connectivity_cfg_1_parseFromJSON() failed [max_detection_time]"); + goto end; + } + } + + loss_connectivity_cfg_1_local_var = OpenAPI_loss_connectivity_cfg_1_create ( + max_detection_time ? true : false, + max_detection_time ? max_detection_time->valuedouble : 0 + ); + + return loss_connectivity_cfg_1_local_var; +end: + return NULL; +} + +OpenAPI_loss_connectivity_cfg_1_t *OpenAPI_loss_connectivity_cfg_1_copy(OpenAPI_loss_connectivity_cfg_1_t *dst, OpenAPI_loss_connectivity_cfg_1_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_loss_connectivity_cfg_1_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_loss_connectivity_cfg_1_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_loss_connectivity_cfg_1_free(dst); + dst = OpenAPI_loss_connectivity_cfg_1_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/loss_connectivity_cfg_1.h b/lib/sbi/openapi/model/loss_connectivity_cfg_1.h new file mode 100644 index 000000000..31d124aa3 --- /dev/null +++ b/lib/sbi/openapi/model/loss_connectivity_cfg_1.h @@ -0,0 +1,40 @@ +/* + * loss_connectivity_cfg_1.h + * + * + */ + +#ifndef _OpenAPI_loss_connectivity_cfg_1_H_ +#define _OpenAPI_loss_connectivity_cfg_1_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_loss_connectivity_cfg_1_s OpenAPI_loss_connectivity_cfg_1_t; +typedef struct OpenAPI_loss_connectivity_cfg_1_s { + bool is_max_detection_time; + int max_detection_time; +} OpenAPI_loss_connectivity_cfg_1_t; + +OpenAPI_loss_connectivity_cfg_1_t *OpenAPI_loss_connectivity_cfg_1_create( + bool is_max_detection_time, + int max_detection_time +); +void OpenAPI_loss_connectivity_cfg_1_free(OpenAPI_loss_connectivity_cfg_1_t *loss_connectivity_cfg_1); +OpenAPI_loss_connectivity_cfg_1_t *OpenAPI_loss_connectivity_cfg_1_parseFromJSON(cJSON *loss_connectivity_cfg_1JSON); +cJSON *OpenAPI_loss_connectivity_cfg_1_convertToJSON(OpenAPI_loss_connectivity_cfg_1_t *loss_connectivity_cfg_1); +OpenAPI_loss_connectivity_cfg_1_t *OpenAPI_loss_connectivity_cfg_1_copy(OpenAPI_loss_connectivity_cfg_1_t *dst, OpenAPI_loss_connectivity_cfg_1_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_loss_connectivity_cfg_1_H_ */ + diff --git a/lib/sbi/openapi/model/lpi_1.c b/lib/sbi/openapi/model/lpi_1.c deleted file mode 100644 index 3a0fb534a..000000000 --- a/lib/sbi/openapi/model/lpi_1.c +++ /dev/null @@ -1,143 +0,0 @@ - -#include -#include -#include -#include "lpi_1.h" - -OpenAPI_lpi_1_t *OpenAPI_lpi_1_create( - OpenAPI_location_privacy_ind_e location_privacy_ind, - OpenAPI_valid_time_period_1_t *valid_time_period -) -{ - OpenAPI_lpi_1_t *lpi_1_local_var = ogs_malloc(sizeof(OpenAPI_lpi_1_t)); - ogs_assert(lpi_1_local_var); - - lpi_1_local_var->location_privacy_ind = location_privacy_ind; - lpi_1_local_var->valid_time_period = valid_time_period; - - return lpi_1_local_var; -} - -void OpenAPI_lpi_1_free(OpenAPI_lpi_1_t *lpi_1) -{ - OpenAPI_lnode_t *node = NULL; - - if (NULL == lpi_1) { - return; - } - if (lpi_1->valid_time_period) { - OpenAPI_valid_time_period_1_free(lpi_1->valid_time_period); - lpi_1->valid_time_period = NULL; - } - ogs_free(lpi_1); -} - -cJSON *OpenAPI_lpi_1_convertToJSON(OpenAPI_lpi_1_t *lpi_1) -{ - cJSON *item = NULL; - OpenAPI_lnode_t *node = NULL; - - if (lpi_1 == NULL) { - ogs_error("OpenAPI_lpi_1_convertToJSON() failed [Lpi_1]"); - return NULL; - } - - item = cJSON_CreateObject(); - if (lpi_1->location_privacy_ind == OpenAPI_location_privacy_ind_NULL) { - ogs_error("OpenAPI_lpi_1_convertToJSON() failed [location_privacy_ind]"); - return NULL; - } - if (cJSON_AddStringToObject(item, "locationPrivacyInd", OpenAPI_location_privacy_ind_ToString(lpi_1->location_privacy_ind)) == NULL) { - ogs_error("OpenAPI_lpi_1_convertToJSON() failed [location_privacy_ind]"); - goto end; - } - - if (lpi_1->valid_time_period) { - cJSON *valid_time_period_local_JSON = OpenAPI_valid_time_period_1_convertToJSON(lpi_1->valid_time_period); - if (valid_time_period_local_JSON == NULL) { - ogs_error("OpenAPI_lpi_1_convertToJSON() failed [valid_time_period]"); - goto end; - } - cJSON_AddItemToObject(item, "validTimePeriod", valid_time_period_local_JSON); - if (item->child == NULL) { - ogs_error("OpenAPI_lpi_1_convertToJSON() failed [valid_time_period]"); - goto end; - } - } - -end: - return item; -} - -OpenAPI_lpi_1_t *OpenAPI_lpi_1_parseFromJSON(cJSON *lpi_1JSON) -{ - OpenAPI_lpi_1_t *lpi_1_local_var = NULL; - OpenAPI_lnode_t *node = NULL; - cJSON *location_privacy_ind = NULL; - OpenAPI_location_privacy_ind_e location_privacy_indVariable = 0; - cJSON *valid_time_period = NULL; - OpenAPI_valid_time_period_1_t *valid_time_period_local_nonprim = NULL; - location_privacy_ind = cJSON_GetObjectItemCaseSensitive(lpi_1JSON, "locationPrivacyInd"); - if (!location_privacy_ind) { - ogs_error("OpenAPI_lpi_1_parseFromJSON() failed [location_privacy_ind]"); - goto end; - } - if (!cJSON_IsString(location_privacy_ind)) { - ogs_error("OpenAPI_lpi_1_parseFromJSON() failed [location_privacy_ind]"); - goto end; - } - location_privacy_indVariable = OpenAPI_location_privacy_ind_FromString(location_privacy_ind->valuestring); - - valid_time_period = cJSON_GetObjectItemCaseSensitive(lpi_1JSON, "validTimePeriod"); - if (valid_time_period) { - valid_time_period_local_nonprim = OpenAPI_valid_time_period_1_parseFromJSON(valid_time_period); - } - - lpi_1_local_var = OpenAPI_lpi_1_create ( - location_privacy_indVariable, - valid_time_period ? valid_time_period_local_nonprim : NULL - ); - - return lpi_1_local_var; -end: - if (valid_time_period_local_nonprim) { - OpenAPI_valid_time_period_1_free(valid_time_period_local_nonprim); - valid_time_period_local_nonprim = NULL; - } - return NULL; -} - -OpenAPI_lpi_1_t *OpenAPI_lpi_1_copy(OpenAPI_lpi_1_t *dst, OpenAPI_lpi_1_t *src) -{ - cJSON *item = NULL; - char *content = NULL; - - ogs_assert(src); - item = OpenAPI_lpi_1_convertToJSON(src); - if (!item) { - ogs_error("OpenAPI_lpi_1_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_lpi_1_free(dst); - dst = OpenAPI_lpi_1_parseFromJSON(item); - cJSON_Delete(item); - - return dst; -} - diff --git a/lib/sbi/openapi/model/lpi_1.h b/lib/sbi/openapi/model/lpi_1.h deleted file mode 100644 index 4f29c0722..000000000 --- a/lib/sbi/openapi/model/lpi_1.h +++ /dev/null @@ -1,42 +0,0 @@ -/* - * lpi_1.h - * - * - */ - -#ifndef _OpenAPI_lpi_1_H_ -#define _OpenAPI_lpi_1_H_ - -#include -#include "../external/cJSON.h" -#include "../include/list.h" -#include "../include/keyValuePair.h" -#include "../include/binary.h" -#include "location_privacy_ind.h" -#include "valid_time_period_1.h" - -#ifdef __cplusplus -extern "C" { -#endif - -typedef struct OpenAPI_lpi_1_s OpenAPI_lpi_1_t; -typedef struct OpenAPI_lpi_1_s { - OpenAPI_location_privacy_ind_e location_privacy_ind; - struct OpenAPI_valid_time_period_1_s *valid_time_period; -} OpenAPI_lpi_1_t; - -OpenAPI_lpi_1_t *OpenAPI_lpi_1_create( - OpenAPI_location_privacy_ind_e location_privacy_ind, - OpenAPI_valid_time_period_1_t *valid_time_period -); -void OpenAPI_lpi_1_free(OpenAPI_lpi_1_t *lpi_1); -OpenAPI_lpi_1_t *OpenAPI_lpi_1_parseFromJSON(cJSON *lpi_1JSON); -cJSON *OpenAPI_lpi_1_convertToJSON(OpenAPI_lpi_1_t *lpi_1); -OpenAPI_lpi_1_t *OpenAPI_lpi_1_copy(OpenAPI_lpi_1_t *dst, OpenAPI_lpi_1_t *src); - -#ifdef __cplusplus -} -#endif - -#endif /* _OpenAPI_lpi_1_H_ */ - diff --git a/lib/sbi/openapi/model/lte_v2x_auth.h b/lib/sbi/openapi/model/lte_v2x_auth.h index c8e65bfa8..4821e7ec3 100644 --- a/lib/sbi/openapi/model/lte_v2x_auth.h +++ b/lib/sbi/openapi/model/lte_v2x_auth.h @@ -1,7 +1,7 @@ /* * lte_v2x_auth.h * - * + * Contains LTE V2X services authorized information. */ #ifndef _OpenAPI_lte_v2x_auth_H_ diff --git a/lib/sbi/openapi/model/lte_v2x_auth_1.c b/lib/sbi/openapi/model/lte_v2x_auth_1.c deleted file mode 100644 index 6fee11d5c..000000000 --- a/lib/sbi/openapi/model/lte_v2x_auth_1.c +++ /dev/null @@ -1,129 +0,0 @@ - -#include -#include -#include -#include "lte_v2x_auth_1.h" - -OpenAPI_lte_v2x_auth_1_t *OpenAPI_lte_v2x_auth_1_create( - OpenAPI_ue_auth_e vehicle_ue_auth, - OpenAPI_ue_auth_e pedestrian_ue_auth -) -{ - OpenAPI_lte_v2x_auth_1_t *lte_v2x_auth_1_local_var = ogs_malloc(sizeof(OpenAPI_lte_v2x_auth_1_t)); - ogs_assert(lte_v2x_auth_1_local_var); - - lte_v2x_auth_1_local_var->vehicle_ue_auth = vehicle_ue_auth; - lte_v2x_auth_1_local_var->pedestrian_ue_auth = pedestrian_ue_auth; - - return lte_v2x_auth_1_local_var; -} - -void OpenAPI_lte_v2x_auth_1_free(OpenAPI_lte_v2x_auth_1_t *lte_v2x_auth_1) -{ - OpenAPI_lnode_t *node = NULL; - - if (NULL == lte_v2x_auth_1) { - return; - } - ogs_free(lte_v2x_auth_1); -} - -cJSON *OpenAPI_lte_v2x_auth_1_convertToJSON(OpenAPI_lte_v2x_auth_1_t *lte_v2x_auth_1) -{ - cJSON *item = NULL; - OpenAPI_lnode_t *node = NULL; - - if (lte_v2x_auth_1 == NULL) { - ogs_error("OpenAPI_lte_v2x_auth_1_convertToJSON() failed [LteV2xAuth_1]"); - return NULL; - } - - item = cJSON_CreateObject(); - if (lte_v2x_auth_1->vehicle_ue_auth != OpenAPI_ue_auth_NULL) { - if (cJSON_AddStringToObject(item, "vehicleUeAuth", OpenAPI_ue_auth_ToString(lte_v2x_auth_1->vehicle_ue_auth)) == NULL) { - ogs_error("OpenAPI_lte_v2x_auth_1_convertToJSON() failed [vehicle_ue_auth]"); - goto end; - } - } - - if (lte_v2x_auth_1->pedestrian_ue_auth != OpenAPI_ue_auth_NULL) { - if (cJSON_AddStringToObject(item, "pedestrianUeAuth", OpenAPI_ue_auth_ToString(lte_v2x_auth_1->pedestrian_ue_auth)) == NULL) { - ogs_error("OpenAPI_lte_v2x_auth_1_convertToJSON() failed [pedestrian_ue_auth]"); - goto end; - } - } - -end: - return item; -} - -OpenAPI_lte_v2x_auth_1_t *OpenAPI_lte_v2x_auth_1_parseFromJSON(cJSON *lte_v2x_auth_1JSON) -{ - OpenAPI_lte_v2x_auth_1_t *lte_v2x_auth_1_local_var = NULL; - OpenAPI_lnode_t *node = NULL; - cJSON *vehicle_ue_auth = NULL; - OpenAPI_ue_auth_e vehicle_ue_authVariable = 0; - cJSON *pedestrian_ue_auth = NULL; - OpenAPI_ue_auth_e pedestrian_ue_authVariable = 0; - vehicle_ue_auth = cJSON_GetObjectItemCaseSensitive(lte_v2x_auth_1JSON, "vehicleUeAuth"); - if (vehicle_ue_auth) { - if (!cJSON_IsString(vehicle_ue_auth)) { - ogs_error("OpenAPI_lte_v2x_auth_1_parseFromJSON() failed [vehicle_ue_auth]"); - goto end; - } - vehicle_ue_authVariable = OpenAPI_ue_auth_FromString(vehicle_ue_auth->valuestring); - } - - pedestrian_ue_auth = cJSON_GetObjectItemCaseSensitive(lte_v2x_auth_1JSON, "pedestrianUeAuth"); - if (pedestrian_ue_auth) { - if (!cJSON_IsString(pedestrian_ue_auth)) { - ogs_error("OpenAPI_lte_v2x_auth_1_parseFromJSON() failed [pedestrian_ue_auth]"); - goto end; - } - pedestrian_ue_authVariable = OpenAPI_ue_auth_FromString(pedestrian_ue_auth->valuestring); - } - - lte_v2x_auth_1_local_var = OpenAPI_lte_v2x_auth_1_create ( - vehicle_ue_auth ? vehicle_ue_authVariable : 0, - pedestrian_ue_auth ? pedestrian_ue_authVariable : 0 - ); - - return lte_v2x_auth_1_local_var; -end: - return NULL; -} - -OpenAPI_lte_v2x_auth_1_t *OpenAPI_lte_v2x_auth_1_copy(OpenAPI_lte_v2x_auth_1_t *dst, OpenAPI_lte_v2x_auth_1_t *src) -{ - cJSON *item = NULL; - char *content = NULL; - - ogs_assert(src); - item = OpenAPI_lte_v2x_auth_1_convertToJSON(src); - if (!item) { - ogs_error("OpenAPI_lte_v2x_auth_1_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_lte_v2x_auth_1_free(dst); - dst = OpenAPI_lte_v2x_auth_1_parseFromJSON(item); - cJSON_Delete(item); - - return dst; -} - diff --git a/lib/sbi/openapi/model/lte_v2x_auth_1.h b/lib/sbi/openapi/model/lte_v2x_auth_1.h deleted file mode 100644 index 5405bf333..000000000 --- a/lib/sbi/openapi/model/lte_v2x_auth_1.h +++ /dev/null @@ -1,41 +0,0 @@ -/* - * lte_v2x_auth_1.h - * - * - */ - -#ifndef _OpenAPI_lte_v2x_auth_1_H_ -#define _OpenAPI_lte_v2x_auth_1_H_ - -#include -#include "../external/cJSON.h" -#include "../include/list.h" -#include "../include/keyValuePair.h" -#include "../include/binary.h" -#include "ue_auth.h" - -#ifdef __cplusplus -extern "C" { -#endif - -typedef struct OpenAPI_lte_v2x_auth_1_s OpenAPI_lte_v2x_auth_1_t; -typedef struct OpenAPI_lte_v2x_auth_1_s { - OpenAPI_ue_auth_e vehicle_ue_auth; - OpenAPI_ue_auth_e pedestrian_ue_auth; -} OpenAPI_lte_v2x_auth_1_t; - -OpenAPI_lte_v2x_auth_1_t *OpenAPI_lte_v2x_auth_1_create( - OpenAPI_ue_auth_e vehicle_ue_auth, - OpenAPI_ue_auth_e pedestrian_ue_auth -); -void OpenAPI_lte_v2x_auth_1_free(OpenAPI_lte_v2x_auth_1_t *lte_v2x_auth_1); -OpenAPI_lte_v2x_auth_1_t *OpenAPI_lte_v2x_auth_1_parseFromJSON(cJSON *lte_v2x_auth_1JSON); -cJSON *OpenAPI_lte_v2x_auth_1_convertToJSON(OpenAPI_lte_v2x_auth_1_t *lte_v2x_auth_1); -OpenAPI_lte_v2x_auth_1_t *OpenAPI_lte_v2x_auth_1_copy(OpenAPI_lte_v2x_auth_1_t *dst, OpenAPI_lte_v2x_auth_1_t *src); - -#ifdef __cplusplus -} -#endif - -#endif /* _OpenAPI_lte_v2x_auth_1_H_ */ - diff --git a/lib/sbi/openapi/model/mapping_of_snssai.h b/lib/sbi/openapi/model/mapping_of_snssai.h index 6131c7abf..686ae6256 100644 --- a/lib/sbi/openapi/model/mapping_of_snssai.h +++ b/lib/sbi/openapi/model/mapping_of_snssai.h @@ -1,7 +1,7 @@ /* * mapping_of_snssai.h * - * + * Contains the mapping of S-NSSAI in the serving network and the value of the home network */ #ifndef _OpenAPI_mapping_of_snssai_H_ diff --git a/lib/sbi/openapi/model/matching_direction.c b/lib/sbi/openapi/model/matching_direction.c new file mode 100644 index 000000000..860bcb3fd --- /dev/null +++ b/lib/sbi/openapi/model/matching_direction.c @@ -0,0 +1,87 @@ + +#include +#include +#include +#include "matching_direction.h" + +OpenAPI_matching_direction_t *OpenAPI_matching_direction_create( +) +{ + OpenAPI_matching_direction_t *matching_direction_local_var = ogs_malloc(sizeof(OpenAPI_matching_direction_t)); + ogs_assert(matching_direction_local_var); + + + return matching_direction_local_var; +} + +void OpenAPI_matching_direction_free(OpenAPI_matching_direction_t *matching_direction) +{ + OpenAPI_lnode_t *node = NULL; + + if (NULL == matching_direction) { + return; + } + ogs_free(matching_direction); +} + +cJSON *OpenAPI_matching_direction_convertToJSON(OpenAPI_matching_direction_t *matching_direction) +{ + cJSON *item = NULL; + OpenAPI_lnode_t *node = NULL; + + if (matching_direction == NULL) { + ogs_error("OpenAPI_matching_direction_convertToJSON() failed [MatchingDirection]"); + return NULL; + } + + item = cJSON_CreateObject(); +end: + return item; +} + +OpenAPI_matching_direction_t *OpenAPI_matching_direction_parseFromJSON(cJSON *matching_directionJSON) +{ + OpenAPI_matching_direction_t *matching_direction_local_var = NULL; + OpenAPI_lnode_t *node = NULL; + matching_direction_local_var = OpenAPI_matching_direction_create ( + ); + + return matching_direction_local_var; +end: + return NULL; +} + +OpenAPI_matching_direction_t *OpenAPI_matching_direction_copy(OpenAPI_matching_direction_t *dst, OpenAPI_matching_direction_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_matching_direction_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_matching_direction_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_matching_direction_free(dst); + dst = OpenAPI_matching_direction_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/matching_direction.h b/lib/sbi/openapi/model/matching_direction.h new file mode 100644 index 000000000..c5f6887df --- /dev/null +++ b/lib/sbi/openapi/model/matching_direction.h @@ -0,0 +1,37 @@ +/* + * matching_direction.h + * + * Possible values are: - ASCENDING: Threshold is crossed in ascending direction. - DESCENDING: Threshold is crossed in descending direction. - CROSSED: Threshold is crossed either in ascending or descending direction. + */ + +#ifndef _OpenAPI_matching_direction_H_ +#define _OpenAPI_matching_direction_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "matching_direction_any_of.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_matching_direction_s OpenAPI_matching_direction_t; +typedef struct OpenAPI_matching_direction_s { +} OpenAPI_matching_direction_t; + +OpenAPI_matching_direction_t *OpenAPI_matching_direction_create( +); +void OpenAPI_matching_direction_free(OpenAPI_matching_direction_t *matching_direction); +OpenAPI_matching_direction_t *OpenAPI_matching_direction_parseFromJSON(cJSON *matching_directionJSON); +cJSON *OpenAPI_matching_direction_convertToJSON(OpenAPI_matching_direction_t *matching_direction); +OpenAPI_matching_direction_t *OpenAPI_matching_direction_copy(OpenAPI_matching_direction_t *dst, OpenAPI_matching_direction_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_matching_direction_H_ */ + diff --git a/lib/sbi/openapi/model/matching_direction_any_of.c b/lib/sbi/openapi/model/matching_direction_any_of.c new file mode 100644 index 000000000..628177a64 --- /dev/null +++ b/lib/sbi/openapi/model/matching_direction_any_of.c @@ -0,0 +1,30 @@ + +#include +#include +#include +#include "matching_direction_any_of.h" + +char* OpenAPI_matching_direction_any_of_ToString(OpenAPI_matching_direction_any_of_e matching_direction_any_of) +{ + const char *matching_direction_any_ofArray[] = { "NULL", "ASCENDING", "DESCENDING", "CROSSED" }; + size_t sizeofArray = sizeof(matching_direction_any_ofArray) / sizeof(matching_direction_any_ofArray[0]); + if (matching_direction_any_of < sizeofArray) + return (char *)matching_direction_any_ofArray[matching_direction_any_of]; + else + return (char *)"Unknown"; +} + +OpenAPI_matching_direction_any_of_e OpenAPI_matching_direction_any_of_FromString(char* matching_direction_any_of) +{ + int stringToReturn = 0; + const char *matching_direction_any_ofArray[] = { "NULL", "ASCENDING", "DESCENDING", "CROSSED" }; + size_t sizeofArray = sizeof(matching_direction_any_ofArray) / sizeof(matching_direction_any_ofArray[0]); + while (stringToReturn < sizeofArray) { + if (strcmp(matching_direction_any_of, matching_direction_any_ofArray[stringToReturn]) == 0) { + return stringToReturn; + } + stringToReturn++; + } + return 0; +} + diff --git a/lib/sbi/openapi/model/matching_direction_any_of.h b/lib/sbi/openapi/model/matching_direction_any_of.h new file mode 100644 index 000000000..5db7bcf7b --- /dev/null +++ b/lib/sbi/openapi/model/matching_direction_any_of.h @@ -0,0 +1,31 @@ +/* + * matching_direction_any_of.h + * + * + */ + +#ifndef _OpenAPI_matching_direction_any_of_H_ +#define _OpenAPI_matching_direction_any_of_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef enum { OpenAPI_matching_direction_any_of_NULL = 0, OpenAPI_matching_direction_any_of_ASCENDING, OpenAPI_matching_direction_any_of_DESCENDING, OpenAPI_matching_direction_any_of_CROSSED } OpenAPI_matching_direction_any_of_e; + +char* OpenAPI_matching_direction_any_of_ToString(OpenAPI_matching_direction_any_of_e matching_direction_any_of); + +OpenAPI_matching_direction_any_of_e OpenAPI_matching_direction_any_of_FromString(char* matching_direction_any_of); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_matching_direction_any_of_H_ */ + diff --git a/lib/sbi/openapi/model/mb_smf_info.c b/lib/sbi/openapi/model/mb_smf_info.c new file mode 100644 index 000000000..63a0fb95b --- /dev/null +++ b/lib/sbi/openapi/model/mb_smf_info.c @@ -0,0 +1,426 @@ + +#include +#include +#include +#include "mb_smf_info.h" + +OpenAPI_mb_smf_info_t *OpenAPI_mb_smf_info_create( + OpenAPI_list_t* s_nssai_info_list, + OpenAPI_list_t* tmgi_range_list, + OpenAPI_list_t *tai_list, + OpenAPI_list_t *tai_range_list, + OpenAPI_list_t* mbs_session_list +) +{ + OpenAPI_mb_smf_info_t *mb_smf_info_local_var = ogs_malloc(sizeof(OpenAPI_mb_smf_info_t)); + ogs_assert(mb_smf_info_local_var); + + mb_smf_info_local_var->s_nssai_info_list = s_nssai_info_list; + mb_smf_info_local_var->tmgi_range_list = tmgi_range_list; + mb_smf_info_local_var->tai_list = tai_list; + mb_smf_info_local_var->tai_range_list = tai_range_list; + mb_smf_info_local_var->mbs_session_list = mbs_session_list; + + return mb_smf_info_local_var; +} + +void OpenAPI_mb_smf_info_free(OpenAPI_mb_smf_info_t *mb_smf_info) +{ + OpenAPI_lnode_t *node = NULL; + + if (NULL == mb_smf_info) { + return; + } + if (mb_smf_info->s_nssai_info_list) { + OpenAPI_list_for_each(mb_smf_info->s_nssai_info_list, node) { + OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*)node->data; + ogs_free(localKeyValue->key); + OpenAPI_snssai_mb_smf_info_item_free(localKeyValue->value); + OpenAPI_map_free(localKeyValue); + } + OpenAPI_list_free(mb_smf_info->s_nssai_info_list); + mb_smf_info->s_nssai_info_list = NULL; + } + if (mb_smf_info->tmgi_range_list) { + OpenAPI_list_for_each(mb_smf_info->tmgi_range_list, node) { + OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*)node->data; + ogs_free(localKeyValue->key); + OpenAPI_tmgi_range_free(localKeyValue->value); + OpenAPI_map_free(localKeyValue); + } + OpenAPI_list_free(mb_smf_info->tmgi_range_list); + mb_smf_info->tmgi_range_list = NULL; + } + if (mb_smf_info->tai_list) { + OpenAPI_list_for_each(mb_smf_info->tai_list, node) { + OpenAPI_tai_free(node->data); + } + OpenAPI_list_free(mb_smf_info->tai_list); + mb_smf_info->tai_list = NULL; + } + if (mb_smf_info->tai_range_list) { + OpenAPI_list_for_each(mb_smf_info->tai_range_list, node) { + OpenAPI_tai_range_free(node->data); + } + OpenAPI_list_free(mb_smf_info->tai_range_list); + mb_smf_info->tai_range_list = NULL; + } + if (mb_smf_info->mbs_session_list) { + OpenAPI_list_for_each(mb_smf_info->mbs_session_list, node) { + OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*)node->data; + ogs_free(localKeyValue->key); + OpenAPI_mbs_session_free(localKeyValue->value); + OpenAPI_map_free(localKeyValue); + } + OpenAPI_list_free(mb_smf_info->mbs_session_list); + mb_smf_info->mbs_session_list = NULL; + } + ogs_free(mb_smf_info); +} + +cJSON *OpenAPI_mb_smf_info_convertToJSON(OpenAPI_mb_smf_info_t *mb_smf_info) +{ + cJSON *item = NULL; + OpenAPI_lnode_t *node = NULL; + + if (mb_smf_info == NULL) { + ogs_error("OpenAPI_mb_smf_info_convertToJSON() failed [MbSmfInfo]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (mb_smf_info->s_nssai_info_list) { + cJSON *s_nssai_info_list = cJSON_AddObjectToObject(item, "sNssaiInfoList"); + if (s_nssai_info_list == NULL) { + ogs_error("OpenAPI_mb_smf_info_convertToJSON() failed [s_nssai_info_list]"); + goto end; + } + cJSON *localMapObject = s_nssai_info_list; + if (mb_smf_info->s_nssai_info_list) { + OpenAPI_list_for_each(mb_smf_info->s_nssai_info_list, node) { + OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*)node->data; + cJSON *itemLocal = localKeyValue->value ? + OpenAPI_snssai_mb_smf_info_item_convertToJSON(localKeyValue->value) : + cJSON_CreateNull(); + if (itemLocal == NULL) { + ogs_error("OpenAPI_mb_smf_info_convertToJSON() failed [inner]"); + goto end; + } + cJSON_AddItemToObject(localMapObject, localKeyValue->key, itemLocal); + } + } + } + + if (mb_smf_info->tmgi_range_list) { + cJSON *tmgi_range_list = cJSON_AddObjectToObject(item, "tmgiRangeList"); + if (tmgi_range_list == NULL) { + ogs_error("OpenAPI_mb_smf_info_convertToJSON() failed [tmgi_range_list]"); + goto end; + } + cJSON *localMapObject = tmgi_range_list; + if (mb_smf_info->tmgi_range_list) { + OpenAPI_list_for_each(mb_smf_info->tmgi_range_list, node) { + OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*)node->data; + cJSON *itemLocal = localKeyValue->value ? + OpenAPI_tmgi_range_convertToJSON(localKeyValue->value) : + cJSON_CreateNull(); + if (itemLocal == NULL) { + ogs_error("OpenAPI_mb_smf_info_convertToJSON() failed [inner]"); + goto end; + } + cJSON_AddItemToObject(localMapObject, localKeyValue->key, itemLocal); + } + } + } + + if (mb_smf_info->tai_list) { + cJSON *tai_listList = cJSON_AddArrayToObject(item, "taiList"); + if (tai_listList == NULL) { + ogs_error("OpenAPI_mb_smf_info_convertToJSON() failed [tai_list]"); + goto end; + } + OpenAPI_list_for_each(mb_smf_info->tai_list, node) { + cJSON *itemLocal = OpenAPI_tai_convertToJSON(node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_mb_smf_info_convertToJSON() failed [tai_list]"); + goto end; + } + cJSON_AddItemToArray(tai_listList, itemLocal); + } + } + + if (mb_smf_info->tai_range_list) { + cJSON *tai_range_listList = cJSON_AddArrayToObject(item, "taiRangeList"); + if (tai_range_listList == NULL) { + ogs_error("OpenAPI_mb_smf_info_convertToJSON() failed [tai_range_list]"); + goto end; + } + OpenAPI_list_for_each(mb_smf_info->tai_range_list, node) { + cJSON *itemLocal = OpenAPI_tai_range_convertToJSON(node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_mb_smf_info_convertToJSON() failed [tai_range_list]"); + goto end; + } + cJSON_AddItemToArray(tai_range_listList, itemLocal); + } + } + + if (mb_smf_info->mbs_session_list) { + cJSON *mbs_session_list = cJSON_AddObjectToObject(item, "mbsSessionList"); + if (mbs_session_list == NULL) { + ogs_error("OpenAPI_mb_smf_info_convertToJSON() failed [mbs_session_list]"); + goto end; + } + cJSON *localMapObject = mbs_session_list; + if (mb_smf_info->mbs_session_list) { + OpenAPI_list_for_each(mb_smf_info->mbs_session_list, node) { + OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*)node->data; + cJSON *itemLocal = localKeyValue->value ? + OpenAPI_mbs_session_convertToJSON(localKeyValue->value) : + cJSON_CreateNull(); + if (itemLocal == NULL) { + ogs_error("OpenAPI_mb_smf_info_convertToJSON() failed [inner]"); + goto end; + } + cJSON_AddItemToObject(localMapObject, localKeyValue->key, itemLocal); + } + } + } + +end: + return item; +} + +OpenAPI_mb_smf_info_t *OpenAPI_mb_smf_info_parseFromJSON(cJSON *mb_smf_infoJSON) +{ + OpenAPI_mb_smf_info_t *mb_smf_info_local_var = NULL; + OpenAPI_lnode_t *node = NULL; + cJSON *s_nssai_info_list = NULL; + OpenAPI_list_t *s_nssai_info_listList = NULL; + cJSON *tmgi_range_list = NULL; + OpenAPI_list_t *tmgi_range_listList = NULL; + cJSON *tai_list = NULL; + OpenAPI_list_t *tai_listList = NULL; + cJSON *tai_range_list = NULL; + OpenAPI_list_t *tai_range_listList = NULL; + cJSON *mbs_session_list = NULL; + OpenAPI_list_t *mbs_session_listList = NULL; + s_nssai_info_list = cJSON_GetObjectItemCaseSensitive(mb_smf_infoJSON, "sNssaiInfoList"); + if (s_nssai_info_list) { + cJSON *s_nssai_info_list_local_map = NULL; + if (!cJSON_IsObject(s_nssai_info_list) && !cJSON_IsNull(s_nssai_info_list)) { + ogs_error("OpenAPI_mb_smf_info_parseFromJSON() failed [s_nssai_info_list]"); + goto end; + } + if (cJSON_IsObject(s_nssai_info_list)) { + s_nssai_info_listList = OpenAPI_list_create(); + OpenAPI_map_t *localMapKeyPair = NULL; + cJSON_ArrayForEach(s_nssai_info_list_local_map, s_nssai_info_list) { + cJSON *localMapObject = s_nssai_info_list_local_map; + if (cJSON_IsObject(localMapObject)) { + localMapKeyPair = OpenAPI_map_create( + ogs_strdup(localMapObject->string), OpenAPI_snssai_mb_smf_info_item_parseFromJSON(localMapObject)); + } else if (cJSON_IsNull(localMapObject)) { + localMapKeyPair = OpenAPI_map_create(ogs_strdup(localMapObject->string), NULL); + } else { + ogs_error("OpenAPI_mb_smf_info_parseFromJSON() failed [inner]"); + goto end; + } + OpenAPI_list_add(s_nssai_info_listList, localMapKeyPair); + } + } + } + + tmgi_range_list = cJSON_GetObjectItemCaseSensitive(mb_smf_infoJSON, "tmgiRangeList"); + if (tmgi_range_list) { + cJSON *tmgi_range_list_local_map = NULL; + if (!cJSON_IsObject(tmgi_range_list) && !cJSON_IsNull(tmgi_range_list)) { + ogs_error("OpenAPI_mb_smf_info_parseFromJSON() failed [tmgi_range_list]"); + goto end; + } + if (cJSON_IsObject(tmgi_range_list)) { + tmgi_range_listList = OpenAPI_list_create(); + OpenAPI_map_t *localMapKeyPair = NULL; + cJSON_ArrayForEach(tmgi_range_list_local_map, tmgi_range_list) { + cJSON *localMapObject = tmgi_range_list_local_map; + if (cJSON_IsObject(localMapObject)) { + localMapKeyPair = OpenAPI_map_create( + ogs_strdup(localMapObject->string), OpenAPI_tmgi_range_parseFromJSON(localMapObject)); + } else if (cJSON_IsNull(localMapObject)) { + localMapKeyPair = OpenAPI_map_create(ogs_strdup(localMapObject->string), NULL); + } else { + ogs_error("OpenAPI_mb_smf_info_parseFromJSON() failed [inner]"); + goto end; + } + OpenAPI_list_add(tmgi_range_listList, localMapKeyPair); + } + } + } + + tai_list = cJSON_GetObjectItemCaseSensitive(mb_smf_infoJSON, "taiList"); + if (tai_list) { + cJSON *tai_list_local = NULL; + if (!cJSON_IsArray(tai_list)) { + ogs_error("OpenAPI_mb_smf_info_parseFromJSON() failed [tai_list]"); + goto end; + } + + tai_listList = OpenAPI_list_create(); + + cJSON_ArrayForEach(tai_list_local, tai_list) { + if (!cJSON_IsObject(tai_list_local)) { + ogs_error("OpenAPI_mb_smf_info_parseFromJSON() failed [tai_list]"); + goto end; + } + OpenAPI_tai_t *tai_listItem = OpenAPI_tai_parseFromJSON(tai_list_local); + if (!tai_listItem) { + ogs_error("No tai_listItem"); + OpenAPI_list_free(tai_listList); + goto end; + } + OpenAPI_list_add(tai_listList, tai_listItem); + } + } + + tai_range_list = cJSON_GetObjectItemCaseSensitive(mb_smf_infoJSON, "taiRangeList"); + if (tai_range_list) { + cJSON *tai_range_list_local = NULL; + if (!cJSON_IsArray(tai_range_list)) { + ogs_error("OpenAPI_mb_smf_info_parseFromJSON() failed [tai_range_list]"); + goto end; + } + + tai_range_listList = OpenAPI_list_create(); + + cJSON_ArrayForEach(tai_range_list_local, tai_range_list) { + if (!cJSON_IsObject(tai_range_list_local)) { + ogs_error("OpenAPI_mb_smf_info_parseFromJSON() failed [tai_range_list]"); + goto end; + } + OpenAPI_tai_range_t *tai_range_listItem = OpenAPI_tai_range_parseFromJSON(tai_range_list_local); + if (!tai_range_listItem) { + ogs_error("No tai_range_listItem"); + OpenAPI_list_free(tai_range_listList); + goto end; + } + OpenAPI_list_add(tai_range_listList, tai_range_listItem); + } + } + + mbs_session_list = cJSON_GetObjectItemCaseSensitive(mb_smf_infoJSON, "mbsSessionList"); + if (mbs_session_list) { + cJSON *mbs_session_list_local_map = NULL; + if (!cJSON_IsObject(mbs_session_list) && !cJSON_IsNull(mbs_session_list)) { + ogs_error("OpenAPI_mb_smf_info_parseFromJSON() failed [mbs_session_list]"); + goto end; + } + if (cJSON_IsObject(mbs_session_list)) { + mbs_session_listList = OpenAPI_list_create(); + OpenAPI_map_t *localMapKeyPair = NULL; + cJSON_ArrayForEach(mbs_session_list_local_map, mbs_session_list) { + cJSON *localMapObject = mbs_session_list_local_map; + if (cJSON_IsObject(localMapObject)) { + localMapKeyPair = OpenAPI_map_create( + ogs_strdup(localMapObject->string), OpenAPI_mbs_session_parseFromJSON(localMapObject)); + } else if (cJSON_IsNull(localMapObject)) { + localMapKeyPair = OpenAPI_map_create(ogs_strdup(localMapObject->string), NULL); + } else { + ogs_error("OpenAPI_mb_smf_info_parseFromJSON() failed [inner]"); + goto end; + } + OpenAPI_list_add(mbs_session_listList, localMapKeyPair); + } + } + } + + mb_smf_info_local_var = OpenAPI_mb_smf_info_create ( + s_nssai_info_list ? s_nssai_info_listList : NULL, + tmgi_range_list ? tmgi_range_listList : NULL, + tai_list ? tai_listList : NULL, + tai_range_list ? tai_range_listList : NULL, + mbs_session_list ? mbs_session_listList : NULL + ); + + return mb_smf_info_local_var; +end: + if (s_nssai_info_listList) { + OpenAPI_list_for_each(s_nssai_info_listList, node) { + OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*) node->data; + ogs_free(localKeyValue->key); + OpenAPI_snssai_mb_smf_info_item_free(localKeyValue->value); + OpenAPI_map_free(localKeyValue); + } + OpenAPI_list_free(s_nssai_info_listList); + s_nssai_info_listList = NULL; + } + if (tmgi_range_listList) { + OpenAPI_list_for_each(tmgi_range_listList, node) { + OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*) node->data; + ogs_free(localKeyValue->key); + OpenAPI_tmgi_range_free(localKeyValue->value); + OpenAPI_map_free(localKeyValue); + } + OpenAPI_list_free(tmgi_range_listList); + tmgi_range_listList = NULL; + } + if (tai_listList) { + OpenAPI_list_for_each(tai_listList, node) { + OpenAPI_tai_free(node->data); + } + OpenAPI_list_free(tai_listList); + tai_listList = NULL; + } + if (tai_range_listList) { + OpenAPI_list_for_each(tai_range_listList, node) { + OpenAPI_tai_range_free(node->data); + } + OpenAPI_list_free(tai_range_listList); + tai_range_listList = NULL; + } + if (mbs_session_listList) { + OpenAPI_list_for_each(mbs_session_listList, node) { + OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*) node->data; + ogs_free(localKeyValue->key); + OpenAPI_mbs_session_free(localKeyValue->value); + OpenAPI_map_free(localKeyValue); + } + OpenAPI_list_free(mbs_session_listList); + mbs_session_listList = NULL; + } + return NULL; +} + +OpenAPI_mb_smf_info_t *OpenAPI_mb_smf_info_copy(OpenAPI_mb_smf_info_t *dst, OpenAPI_mb_smf_info_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_mb_smf_info_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_mb_smf_info_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_mb_smf_info_free(dst); + dst = OpenAPI_mb_smf_info_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/mb_smf_info.h b/lib/sbi/openapi/model/mb_smf_info.h new file mode 100644 index 000000000..5e00f8c5a --- /dev/null +++ b/lib/sbi/openapi/model/mb_smf_info.h @@ -0,0 +1,51 @@ +/* + * mb_smf_info.h + * + * Information of an MB-SMF NF Instance + */ + +#ifndef _OpenAPI_mb_smf_info_H_ +#define _OpenAPI_mb_smf_info_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "mbs_session.h" +#include "snssai_mb_smf_info_item.h" +#include "tai.h" +#include "tai_range.h" +#include "tmgi_range.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_mb_smf_info_s OpenAPI_mb_smf_info_t; +typedef struct OpenAPI_mb_smf_info_s { + OpenAPI_list_t* s_nssai_info_list; + OpenAPI_list_t* tmgi_range_list; + OpenAPI_list_t *tai_list; + OpenAPI_list_t *tai_range_list; + OpenAPI_list_t* mbs_session_list; +} OpenAPI_mb_smf_info_t; + +OpenAPI_mb_smf_info_t *OpenAPI_mb_smf_info_create( + OpenAPI_list_t* s_nssai_info_list, + OpenAPI_list_t* tmgi_range_list, + OpenAPI_list_t *tai_list, + OpenAPI_list_t *tai_range_list, + OpenAPI_list_t* mbs_session_list +); +void OpenAPI_mb_smf_info_free(OpenAPI_mb_smf_info_t *mb_smf_info); +OpenAPI_mb_smf_info_t *OpenAPI_mb_smf_info_parseFromJSON(cJSON *mb_smf_infoJSON); +cJSON *OpenAPI_mb_smf_info_convertToJSON(OpenAPI_mb_smf_info_t *mb_smf_info); +OpenAPI_mb_smf_info_t *OpenAPI_mb_smf_info_copy(OpenAPI_mb_smf_info_t *dst, OpenAPI_mb_smf_info_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_mb_smf_info_H_ */ + diff --git a/lib/sbi/openapi/model/mb_upf_info.c b/lib/sbi/openapi/model/mb_upf_info.c new file mode 100644 index 000000000..60fb27835 --- /dev/null +++ b/lib/sbi/openapi/model/mb_upf_info.c @@ -0,0 +1,430 @@ + +#include +#include +#include +#include "mb_upf_info.h" + +OpenAPI_mb_upf_info_t *OpenAPI_mb_upf_info_create( + OpenAPI_list_t *s_nssai_mb_upf_info_list, + OpenAPI_list_t *mb_smf_serving_area, + OpenAPI_list_t *interface_mb_upf_info_list, + OpenAPI_list_t *tai_list, + OpenAPI_list_t *tai_range_list, + bool is_priority, + int priority, + char *supported_pfcp_features +) +{ + OpenAPI_mb_upf_info_t *mb_upf_info_local_var = ogs_malloc(sizeof(OpenAPI_mb_upf_info_t)); + ogs_assert(mb_upf_info_local_var); + + mb_upf_info_local_var->s_nssai_mb_upf_info_list = s_nssai_mb_upf_info_list; + mb_upf_info_local_var->mb_smf_serving_area = mb_smf_serving_area; + mb_upf_info_local_var->interface_mb_upf_info_list = interface_mb_upf_info_list; + mb_upf_info_local_var->tai_list = tai_list; + mb_upf_info_local_var->tai_range_list = tai_range_list; + mb_upf_info_local_var->is_priority = is_priority; + mb_upf_info_local_var->priority = priority; + mb_upf_info_local_var->supported_pfcp_features = supported_pfcp_features; + + return mb_upf_info_local_var; +} + +void OpenAPI_mb_upf_info_free(OpenAPI_mb_upf_info_t *mb_upf_info) +{ + OpenAPI_lnode_t *node = NULL; + + if (NULL == mb_upf_info) { + return; + } + if (mb_upf_info->s_nssai_mb_upf_info_list) { + OpenAPI_list_for_each(mb_upf_info->s_nssai_mb_upf_info_list, node) { + OpenAPI_snssai_upf_info_item_free(node->data); + } + OpenAPI_list_free(mb_upf_info->s_nssai_mb_upf_info_list); + mb_upf_info->s_nssai_mb_upf_info_list = NULL; + } + if (mb_upf_info->mb_smf_serving_area) { + OpenAPI_list_for_each(mb_upf_info->mb_smf_serving_area, node) { + ogs_free(node->data); + } + OpenAPI_list_free(mb_upf_info->mb_smf_serving_area); + mb_upf_info->mb_smf_serving_area = NULL; + } + if (mb_upf_info->interface_mb_upf_info_list) { + OpenAPI_list_for_each(mb_upf_info->interface_mb_upf_info_list, node) { + OpenAPI_interface_upf_info_item_free(node->data); + } + OpenAPI_list_free(mb_upf_info->interface_mb_upf_info_list); + mb_upf_info->interface_mb_upf_info_list = NULL; + } + if (mb_upf_info->tai_list) { + OpenAPI_list_for_each(mb_upf_info->tai_list, node) { + OpenAPI_tai_free(node->data); + } + OpenAPI_list_free(mb_upf_info->tai_list); + mb_upf_info->tai_list = NULL; + } + if (mb_upf_info->tai_range_list) { + OpenAPI_list_for_each(mb_upf_info->tai_range_list, node) { + OpenAPI_tai_range_free(node->data); + } + OpenAPI_list_free(mb_upf_info->tai_range_list); + mb_upf_info->tai_range_list = NULL; + } + if (mb_upf_info->supported_pfcp_features) { + ogs_free(mb_upf_info->supported_pfcp_features); + mb_upf_info->supported_pfcp_features = NULL; + } + ogs_free(mb_upf_info); +} + +cJSON *OpenAPI_mb_upf_info_convertToJSON(OpenAPI_mb_upf_info_t *mb_upf_info) +{ + cJSON *item = NULL; + OpenAPI_lnode_t *node = NULL; + + if (mb_upf_info == NULL) { + ogs_error("OpenAPI_mb_upf_info_convertToJSON() failed [MbUpfInfo]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (!mb_upf_info->s_nssai_mb_upf_info_list) { + ogs_error("OpenAPI_mb_upf_info_convertToJSON() failed [s_nssai_mb_upf_info_list]"); + return NULL; + } + cJSON *s_nssai_mb_upf_info_listList = cJSON_AddArrayToObject(item, "sNssaiMbUpfInfoList"); + if (s_nssai_mb_upf_info_listList == NULL) { + ogs_error("OpenAPI_mb_upf_info_convertToJSON() failed [s_nssai_mb_upf_info_list]"); + goto end; + } + OpenAPI_list_for_each(mb_upf_info->s_nssai_mb_upf_info_list, node) { + cJSON *itemLocal = OpenAPI_snssai_upf_info_item_convertToJSON(node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_mb_upf_info_convertToJSON() failed [s_nssai_mb_upf_info_list]"); + goto end; + } + cJSON_AddItemToArray(s_nssai_mb_upf_info_listList, itemLocal); + } + + if (mb_upf_info->mb_smf_serving_area) { + cJSON *mb_smf_serving_areaList = cJSON_AddArrayToObject(item, "mbSmfServingArea"); + if (mb_smf_serving_areaList == NULL) { + ogs_error("OpenAPI_mb_upf_info_convertToJSON() failed [mb_smf_serving_area]"); + goto end; + } + OpenAPI_list_for_each(mb_upf_info->mb_smf_serving_area, node) { + if (cJSON_AddStringToObject(mb_smf_serving_areaList, "", (char*)node->data) == NULL) { + ogs_error("OpenAPI_mb_upf_info_convertToJSON() failed [mb_smf_serving_area]"); + goto end; + } + } + } + + if (mb_upf_info->interface_mb_upf_info_list) { + cJSON *interface_mb_upf_info_listList = cJSON_AddArrayToObject(item, "interfaceMbUpfInfoList"); + if (interface_mb_upf_info_listList == NULL) { + ogs_error("OpenAPI_mb_upf_info_convertToJSON() failed [interface_mb_upf_info_list]"); + goto end; + } + OpenAPI_list_for_each(mb_upf_info->interface_mb_upf_info_list, node) { + cJSON *itemLocal = OpenAPI_interface_upf_info_item_convertToJSON(node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_mb_upf_info_convertToJSON() failed [interface_mb_upf_info_list]"); + goto end; + } + cJSON_AddItemToArray(interface_mb_upf_info_listList, itemLocal); + } + } + + if (mb_upf_info->tai_list) { + cJSON *tai_listList = cJSON_AddArrayToObject(item, "taiList"); + if (tai_listList == NULL) { + ogs_error("OpenAPI_mb_upf_info_convertToJSON() failed [tai_list]"); + goto end; + } + OpenAPI_list_for_each(mb_upf_info->tai_list, node) { + cJSON *itemLocal = OpenAPI_tai_convertToJSON(node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_mb_upf_info_convertToJSON() failed [tai_list]"); + goto end; + } + cJSON_AddItemToArray(tai_listList, itemLocal); + } + } + + if (mb_upf_info->tai_range_list) { + cJSON *tai_range_listList = cJSON_AddArrayToObject(item, "taiRangeList"); + if (tai_range_listList == NULL) { + ogs_error("OpenAPI_mb_upf_info_convertToJSON() failed [tai_range_list]"); + goto end; + } + OpenAPI_list_for_each(mb_upf_info->tai_range_list, node) { + cJSON *itemLocal = OpenAPI_tai_range_convertToJSON(node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_mb_upf_info_convertToJSON() failed [tai_range_list]"); + goto end; + } + cJSON_AddItemToArray(tai_range_listList, itemLocal); + } + } + + if (mb_upf_info->is_priority) { + if (cJSON_AddNumberToObject(item, "priority", mb_upf_info->priority) == NULL) { + ogs_error("OpenAPI_mb_upf_info_convertToJSON() failed [priority]"); + goto end; + } + } + + if (mb_upf_info->supported_pfcp_features) { + if (cJSON_AddStringToObject(item, "supportedPfcpFeatures", mb_upf_info->supported_pfcp_features) == NULL) { + ogs_error("OpenAPI_mb_upf_info_convertToJSON() failed [supported_pfcp_features]"); + goto end; + } + } + +end: + return item; +} + +OpenAPI_mb_upf_info_t *OpenAPI_mb_upf_info_parseFromJSON(cJSON *mb_upf_infoJSON) +{ + OpenAPI_mb_upf_info_t *mb_upf_info_local_var = NULL; + OpenAPI_lnode_t *node = NULL; + cJSON *s_nssai_mb_upf_info_list = NULL; + OpenAPI_list_t *s_nssai_mb_upf_info_listList = NULL; + cJSON *mb_smf_serving_area = NULL; + OpenAPI_list_t *mb_smf_serving_areaList = NULL; + cJSON *interface_mb_upf_info_list = NULL; + OpenAPI_list_t *interface_mb_upf_info_listList = NULL; + cJSON *tai_list = NULL; + OpenAPI_list_t *tai_listList = NULL; + cJSON *tai_range_list = NULL; + OpenAPI_list_t *tai_range_listList = NULL; + cJSON *priority = NULL; + cJSON *supported_pfcp_features = NULL; + s_nssai_mb_upf_info_list = cJSON_GetObjectItemCaseSensitive(mb_upf_infoJSON, "sNssaiMbUpfInfoList"); + if (!s_nssai_mb_upf_info_list) { + ogs_error("OpenAPI_mb_upf_info_parseFromJSON() failed [s_nssai_mb_upf_info_list]"); + goto end; + } + cJSON *s_nssai_mb_upf_info_list_local = NULL; + if (!cJSON_IsArray(s_nssai_mb_upf_info_list)) { + ogs_error("OpenAPI_mb_upf_info_parseFromJSON() failed [s_nssai_mb_upf_info_list]"); + goto end; + } + + s_nssai_mb_upf_info_listList = OpenAPI_list_create(); + + cJSON_ArrayForEach(s_nssai_mb_upf_info_list_local, s_nssai_mb_upf_info_list) { + if (!cJSON_IsObject(s_nssai_mb_upf_info_list_local)) { + ogs_error("OpenAPI_mb_upf_info_parseFromJSON() failed [s_nssai_mb_upf_info_list]"); + goto end; + } + OpenAPI_snssai_upf_info_item_t *s_nssai_mb_upf_info_listItem = OpenAPI_snssai_upf_info_item_parseFromJSON(s_nssai_mb_upf_info_list_local); + if (!s_nssai_mb_upf_info_listItem) { + ogs_error("No s_nssai_mb_upf_info_listItem"); + OpenAPI_list_free(s_nssai_mb_upf_info_listList); + goto end; + } + OpenAPI_list_add(s_nssai_mb_upf_info_listList, s_nssai_mb_upf_info_listItem); + } + + mb_smf_serving_area = cJSON_GetObjectItemCaseSensitive(mb_upf_infoJSON, "mbSmfServingArea"); + if (mb_smf_serving_area) { + cJSON *mb_smf_serving_area_local = NULL; + if (!cJSON_IsArray(mb_smf_serving_area)) { + ogs_error("OpenAPI_mb_upf_info_parseFromJSON() failed [mb_smf_serving_area]"); + goto end; + } + + mb_smf_serving_areaList = OpenAPI_list_create(); + + cJSON_ArrayForEach(mb_smf_serving_area_local, mb_smf_serving_area) { + double *localDouble = NULL; + int *localInt = NULL; + if (!cJSON_IsString(mb_smf_serving_area_local)) { + ogs_error("OpenAPI_mb_upf_info_parseFromJSON() failed [mb_smf_serving_area]"); + goto end; + } + OpenAPI_list_add(mb_smf_serving_areaList, ogs_strdup(mb_smf_serving_area_local->valuestring)); + } + } + + interface_mb_upf_info_list = cJSON_GetObjectItemCaseSensitive(mb_upf_infoJSON, "interfaceMbUpfInfoList"); + if (interface_mb_upf_info_list) { + cJSON *interface_mb_upf_info_list_local = NULL; + if (!cJSON_IsArray(interface_mb_upf_info_list)) { + ogs_error("OpenAPI_mb_upf_info_parseFromJSON() failed [interface_mb_upf_info_list]"); + goto end; + } + + interface_mb_upf_info_listList = OpenAPI_list_create(); + + cJSON_ArrayForEach(interface_mb_upf_info_list_local, interface_mb_upf_info_list) { + if (!cJSON_IsObject(interface_mb_upf_info_list_local)) { + ogs_error("OpenAPI_mb_upf_info_parseFromJSON() failed [interface_mb_upf_info_list]"); + goto end; + } + OpenAPI_interface_upf_info_item_t *interface_mb_upf_info_listItem = OpenAPI_interface_upf_info_item_parseFromJSON(interface_mb_upf_info_list_local); + if (!interface_mb_upf_info_listItem) { + ogs_error("No interface_mb_upf_info_listItem"); + OpenAPI_list_free(interface_mb_upf_info_listList); + goto end; + } + OpenAPI_list_add(interface_mb_upf_info_listList, interface_mb_upf_info_listItem); + } + } + + tai_list = cJSON_GetObjectItemCaseSensitive(mb_upf_infoJSON, "taiList"); + if (tai_list) { + cJSON *tai_list_local = NULL; + if (!cJSON_IsArray(tai_list)) { + ogs_error("OpenAPI_mb_upf_info_parseFromJSON() failed [tai_list]"); + goto end; + } + + tai_listList = OpenAPI_list_create(); + + cJSON_ArrayForEach(tai_list_local, tai_list) { + if (!cJSON_IsObject(tai_list_local)) { + ogs_error("OpenAPI_mb_upf_info_parseFromJSON() failed [tai_list]"); + goto end; + } + OpenAPI_tai_t *tai_listItem = OpenAPI_tai_parseFromJSON(tai_list_local); + if (!tai_listItem) { + ogs_error("No tai_listItem"); + OpenAPI_list_free(tai_listList); + goto end; + } + OpenAPI_list_add(tai_listList, tai_listItem); + } + } + + tai_range_list = cJSON_GetObjectItemCaseSensitive(mb_upf_infoJSON, "taiRangeList"); + if (tai_range_list) { + cJSON *tai_range_list_local = NULL; + if (!cJSON_IsArray(tai_range_list)) { + ogs_error("OpenAPI_mb_upf_info_parseFromJSON() failed [tai_range_list]"); + goto end; + } + + tai_range_listList = OpenAPI_list_create(); + + cJSON_ArrayForEach(tai_range_list_local, tai_range_list) { + if (!cJSON_IsObject(tai_range_list_local)) { + ogs_error("OpenAPI_mb_upf_info_parseFromJSON() failed [tai_range_list]"); + goto end; + } + OpenAPI_tai_range_t *tai_range_listItem = OpenAPI_tai_range_parseFromJSON(tai_range_list_local); + if (!tai_range_listItem) { + ogs_error("No tai_range_listItem"); + OpenAPI_list_free(tai_range_listList); + goto end; + } + OpenAPI_list_add(tai_range_listList, tai_range_listItem); + } + } + + priority = cJSON_GetObjectItemCaseSensitive(mb_upf_infoJSON, "priority"); + if (priority) { + if (!cJSON_IsNumber(priority)) { + ogs_error("OpenAPI_mb_upf_info_parseFromJSON() failed [priority]"); + goto end; + } + } + + supported_pfcp_features = cJSON_GetObjectItemCaseSensitive(mb_upf_infoJSON, "supportedPfcpFeatures"); + if (supported_pfcp_features) { + if (!cJSON_IsString(supported_pfcp_features) && !cJSON_IsNull(supported_pfcp_features)) { + ogs_error("OpenAPI_mb_upf_info_parseFromJSON() failed [supported_pfcp_features]"); + goto end; + } + } + + mb_upf_info_local_var = OpenAPI_mb_upf_info_create ( + s_nssai_mb_upf_info_listList, + mb_smf_serving_area ? mb_smf_serving_areaList : NULL, + interface_mb_upf_info_list ? interface_mb_upf_info_listList : NULL, + tai_list ? tai_listList : NULL, + tai_range_list ? tai_range_listList : NULL, + priority ? true : false, + priority ? priority->valuedouble : 0, + supported_pfcp_features && !cJSON_IsNull(supported_pfcp_features) ? ogs_strdup(supported_pfcp_features->valuestring) : NULL + ); + + return mb_upf_info_local_var; +end: + if (s_nssai_mb_upf_info_listList) { + OpenAPI_list_for_each(s_nssai_mb_upf_info_listList, node) { + OpenAPI_snssai_upf_info_item_free(node->data); + } + OpenAPI_list_free(s_nssai_mb_upf_info_listList); + s_nssai_mb_upf_info_listList = NULL; + } + if (mb_smf_serving_areaList) { + OpenAPI_list_for_each(mb_smf_serving_areaList, node) { + ogs_free(node->data); + } + OpenAPI_list_free(mb_smf_serving_areaList); + mb_smf_serving_areaList = NULL; + } + if (interface_mb_upf_info_listList) { + OpenAPI_list_for_each(interface_mb_upf_info_listList, node) { + OpenAPI_interface_upf_info_item_free(node->data); + } + OpenAPI_list_free(interface_mb_upf_info_listList); + interface_mb_upf_info_listList = NULL; + } + if (tai_listList) { + OpenAPI_list_for_each(tai_listList, node) { + OpenAPI_tai_free(node->data); + } + OpenAPI_list_free(tai_listList); + tai_listList = NULL; + } + if (tai_range_listList) { + OpenAPI_list_for_each(tai_range_listList, node) { + OpenAPI_tai_range_free(node->data); + } + OpenAPI_list_free(tai_range_listList); + tai_range_listList = NULL; + } + return NULL; +} + +OpenAPI_mb_upf_info_t *OpenAPI_mb_upf_info_copy(OpenAPI_mb_upf_info_t *dst, OpenAPI_mb_upf_info_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_mb_upf_info_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_mb_upf_info_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_mb_upf_info_free(dst); + dst = OpenAPI_mb_upf_info_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/mb_upf_info.h b/lib/sbi/openapi/model/mb_upf_info.h new file mode 100644 index 000000000..30ddb472f --- /dev/null +++ b/lib/sbi/openapi/model/mb_upf_info.h @@ -0,0 +1,56 @@ +/* + * mb_upf_info.h + * + * Information of an MB-UPF NF Instance + */ + +#ifndef _OpenAPI_mb_upf_info_H_ +#define _OpenAPI_mb_upf_info_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "interface_upf_info_item.h" +#include "snssai_upf_info_item.h" +#include "tai.h" +#include "tai_range.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_mb_upf_info_s OpenAPI_mb_upf_info_t; +typedef struct OpenAPI_mb_upf_info_s { + OpenAPI_list_t *s_nssai_mb_upf_info_list; + OpenAPI_list_t *mb_smf_serving_area; + OpenAPI_list_t *interface_mb_upf_info_list; + OpenAPI_list_t *tai_list; + OpenAPI_list_t *tai_range_list; + bool is_priority; + int priority; + char *supported_pfcp_features; +} OpenAPI_mb_upf_info_t; + +OpenAPI_mb_upf_info_t *OpenAPI_mb_upf_info_create( + OpenAPI_list_t *s_nssai_mb_upf_info_list, + OpenAPI_list_t *mb_smf_serving_area, + OpenAPI_list_t *interface_mb_upf_info_list, + OpenAPI_list_t *tai_list, + OpenAPI_list_t *tai_range_list, + bool is_priority, + int priority, + char *supported_pfcp_features +); +void OpenAPI_mb_upf_info_free(OpenAPI_mb_upf_info_t *mb_upf_info); +OpenAPI_mb_upf_info_t *OpenAPI_mb_upf_info_parseFromJSON(cJSON *mb_upf_infoJSON); +cJSON *OpenAPI_mb_upf_info_convertToJSON(OpenAPI_mb_upf_info_t *mb_upf_info); +OpenAPI_mb_upf_info_t *OpenAPI_mb_upf_info_copy(OpenAPI_mb_upf_info_t *dst, OpenAPI_mb_upf_info_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_mb_upf_info_H_ */ + diff --git a/lib/sbi/openapi/model/mbs_binding_resp.c b/lib/sbi/openapi/model/mbs_binding_resp.c new file mode 100644 index 000000000..8e753aa42 --- /dev/null +++ b/lib/sbi/openapi/model/mbs_binding_resp.c @@ -0,0 +1,170 @@ + +#include +#include +#include +#include "mbs_binding_resp.h" + +OpenAPI_mbs_binding_resp_t *OpenAPI_mbs_binding_resp_create( + char *pcf_fqdn, + OpenAPI_list_t *pcf_ip_end_points +) +{ + OpenAPI_mbs_binding_resp_t *mbs_binding_resp_local_var = ogs_malloc(sizeof(OpenAPI_mbs_binding_resp_t)); + ogs_assert(mbs_binding_resp_local_var); + + mbs_binding_resp_local_var->pcf_fqdn = pcf_fqdn; + mbs_binding_resp_local_var->pcf_ip_end_points = pcf_ip_end_points; + + return mbs_binding_resp_local_var; +} + +void OpenAPI_mbs_binding_resp_free(OpenAPI_mbs_binding_resp_t *mbs_binding_resp) +{ + OpenAPI_lnode_t *node = NULL; + + if (NULL == mbs_binding_resp) { + return; + } + if (mbs_binding_resp->pcf_fqdn) { + ogs_free(mbs_binding_resp->pcf_fqdn); + mbs_binding_resp->pcf_fqdn = NULL; + } + if (mbs_binding_resp->pcf_ip_end_points) { + OpenAPI_list_for_each(mbs_binding_resp->pcf_ip_end_points, node) { + OpenAPI_ip_end_point_free(node->data); + } + OpenAPI_list_free(mbs_binding_resp->pcf_ip_end_points); + mbs_binding_resp->pcf_ip_end_points = NULL; + } + ogs_free(mbs_binding_resp); +} + +cJSON *OpenAPI_mbs_binding_resp_convertToJSON(OpenAPI_mbs_binding_resp_t *mbs_binding_resp) +{ + cJSON *item = NULL; + OpenAPI_lnode_t *node = NULL; + + if (mbs_binding_resp == NULL) { + ogs_error("OpenAPI_mbs_binding_resp_convertToJSON() failed [MbsBindingResp]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (mbs_binding_resp->pcf_fqdn) { + if (cJSON_AddStringToObject(item, "pcfFqdn", mbs_binding_resp->pcf_fqdn) == NULL) { + ogs_error("OpenAPI_mbs_binding_resp_convertToJSON() failed [pcf_fqdn]"); + goto end; + } + } + + if (mbs_binding_resp->pcf_ip_end_points) { + cJSON *pcf_ip_end_pointsList = cJSON_AddArrayToObject(item, "pcfIpEndPoints"); + if (pcf_ip_end_pointsList == NULL) { + ogs_error("OpenAPI_mbs_binding_resp_convertToJSON() failed [pcf_ip_end_points]"); + goto end; + } + OpenAPI_list_for_each(mbs_binding_resp->pcf_ip_end_points, node) { + cJSON *itemLocal = OpenAPI_ip_end_point_convertToJSON(node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_mbs_binding_resp_convertToJSON() failed [pcf_ip_end_points]"); + goto end; + } + cJSON_AddItemToArray(pcf_ip_end_pointsList, itemLocal); + } + } + +end: + return item; +} + +OpenAPI_mbs_binding_resp_t *OpenAPI_mbs_binding_resp_parseFromJSON(cJSON *mbs_binding_respJSON) +{ + OpenAPI_mbs_binding_resp_t *mbs_binding_resp_local_var = NULL; + OpenAPI_lnode_t *node = NULL; + cJSON *pcf_fqdn = NULL; + cJSON *pcf_ip_end_points = NULL; + OpenAPI_list_t *pcf_ip_end_pointsList = NULL; + pcf_fqdn = cJSON_GetObjectItemCaseSensitive(mbs_binding_respJSON, "pcfFqdn"); + if (pcf_fqdn) { + if (!cJSON_IsString(pcf_fqdn) && !cJSON_IsNull(pcf_fqdn)) { + ogs_error("OpenAPI_mbs_binding_resp_parseFromJSON() failed [pcf_fqdn]"); + goto end; + } + } + + pcf_ip_end_points = cJSON_GetObjectItemCaseSensitive(mbs_binding_respJSON, "pcfIpEndPoints"); + if (pcf_ip_end_points) { + cJSON *pcf_ip_end_points_local = NULL; + if (!cJSON_IsArray(pcf_ip_end_points)) { + ogs_error("OpenAPI_mbs_binding_resp_parseFromJSON() failed [pcf_ip_end_points]"); + 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_mbs_binding_resp_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); + } + } + + mbs_binding_resp_local_var = OpenAPI_mbs_binding_resp_create ( + pcf_fqdn && !cJSON_IsNull(pcf_fqdn) ? ogs_strdup(pcf_fqdn->valuestring) : NULL, + pcf_ip_end_points ? pcf_ip_end_pointsList : NULL + ); + + return mbs_binding_resp_local_var; +end: + 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; + } + return NULL; +} + +OpenAPI_mbs_binding_resp_t *OpenAPI_mbs_binding_resp_copy(OpenAPI_mbs_binding_resp_t *dst, OpenAPI_mbs_binding_resp_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_mbs_binding_resp_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_mbs_binding_resp_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_mbs_binding_resp_free(dst); + dst = OpenAPI_mbs_binding_resp_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/mbs_binding_resp.h b/lib/sbi/openapi/model/mbs_binding_resp.h new file mode 100644 index 000000000..6051529d3 --- /dev/null +++ b/lib/sbi/openapi/model/mbs_binding_resp.h @@ -0,0 +1,41 @@ +/* + * mbs_binding_resp.h + * + * Contains the binding information for a PCF for an MBS Session. + */ + +#ifndef _OpenAPI_mbs_binding_resp_H_ +#define _OpenAPI_mbs_binding_resp_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "ip_end_point.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_mbs_binding_resp_s OpenAPI_mbs_binding_resp_t; +typedef struct OpenAPI_mbs_binding_resp_s { + char *pcf_fqdn; + OpenAPI_list_t *pcf_ip_end_points; +} OpenAPI_mbs_binding_resp_t; + +OpenAPI_mbs_binding_resp_t *OpenAPI_mbs_binding_resp_create( + char *pcf_fqdn, + OpenAPI_list_t *pcf_ip_end_points +); +void OpenAPI_mbs_binding_resp_free(OpenAPI_mbs_binding_resp_t *mbs_binding_resp); +OpenAPI_mbs_binding_resp_t *OpenAPI_mbs_binding_resp_parseFromJSON(cJSON *mbs_binding_respJSON); +cJSON *OpenAPI_mbs_binding_resp_convertToJSON(OpenAPI_mbs_binding_resp_t *mbs_binding_resp); +OpenAPI_mbs_binding_resp_t *OpenAPI_mbs_binding_resp_copy(OpenAPI_mbs_binding_resp_t *dst, OpenAPI_mbs_binding_resp_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_mbs_binding_resp_H_ */ + diff --git a/lib/sbi/openapi/model/mbs_ext_problem_details.c b/lib/sbi/openapi/model/mbs_ext_problem_details.c new file mode 100644 index 000000000..113114d66 --- /dev/null +++ b/lib/sbi/openapi/model/mbs_ext_problem_details.c @@ -0,0 +1,475 @@ + +#include +#include +#include +#include "mbs_ext_problem_details.h" + +OpenAPI_mbs_ext_problem_details_t *OpenAPI_mbs_ext_problem_details_create( + char *type, + char *title, + bool is_status, + int status, + char *detail, + char *instance, + char *cause, + OpenAPI_list_t *invalid_params, + char *supported_features, + OpenAPI_access_token_err_t *access_token_error, + OpenAPI_access_token_req_t *access_token_request, + char *nrf_id, + char *pcf_fqdn, + OpenAPI_list_t *pcf_ip_end_points +) +{ + OpenAPI_mbs_ext_problem_details_t *mbs_ext_problem_details_local_var = ogs_malloc(sizeof(OpenAPI_mbs_ext_problem_details_t)); + ogs_assert(mbs_ext_problem_details_local_var); + + mbs_ext_problem_details_local_var->type = type; + mbs_ext_problem_details_local_var->title = title; + mbs_ext_problem_details_local_var->is_status = is_status; + mbs_ext_problem_details_local_var->status = status; + mbs_ext_problem_details_local_var->detail = detail; + mbs_ext_problem_details_local_var->instance = instance; + mbs_ext_problem_details_local_var->cause = cause; + mbs_ext_problem_details_local_var->invalid_params = invalid_params; + mbs_ext_problem_details_local_var->supported_features = supported_features; + mbs_ext_problem_details_local_var->access_token_error = access_token_error; + mbs_ext_problem_details_local_var->access_token_request = access_token_request; + mbs_ext_problem_details_local_var->nrf_id = nrf_id; + mbs_ext_problem_details_local_var->pcf_fqdn = pcf_fqdn; + mbs_ext_problem_details_local_var->pcf_ip_end_points = pcf_ip_end_points; + + return mbs_ext_problem_details_local_var; +} + +void OpenAPI_mbs_ext_problem_details_free(OpenAPI_mbs_ext_problem_details_t *mbs_ext_problem_details) +{ + OpenAPI_lnode_t *node = NULL; + + if (NULL == mbs_ext_problem_details) { + return; + } + if (mbs_ext_problem_details->type) { + ogs_free(mbs_ext_problem_details->type); + mbs_ext_problem_details->type = NULL; + } + if (mbs_ext_problem_details->title) { + ogs_free(mbs_ext_problem_details->title); + mbs_ext_problem_details->title = NULL; + } + if (mbs_ext_problem_details->detail) { + ogs_free(mbs_ext_problem_details->detail); + mbs_ext_problem_details->detail = NULL; + } + if (mbs_ext_problem_details->instance) { + ogs_free(mbs_ext_problem_details->instance); + mbs_ext_problem_details->instance = NULL; + } + if (mbs_ext_problem_details->cause) { + ogs_free(mbs_ext_problem_details->cause); + mbs_ext_problem_details->cause = NULL; + } + if (mbs_ext_problem_details->invalid_params) { + OpenAPI_list_for_each(mbs_ext_problem_details->invalid_params, node) { + OpenAPI_invalid_param_free(node->data); + } + OpenAPI_list_free(mbs_ext_problem_details->invalid_params); + mbs_ext_problem_details->invalid_params = NULL; + } + if (mbs_ext_problem_details->supported_features) { + ogs_free(mbs_ext_problem_details->supported_features); + mbs_ext_problem_details->supported_features = NULL; + } + if (mbs_ext_problem_details->access_token_error) { + OpenAPI_access_token_err_free(mbs_ext_problem_details->access_token_error); + mbs_ext_problem_details->access_token_error = NULL; + } + if (mbs_ext_problem_details->access_token_request) { + OpenAPI_access_token_req_free(mbs_ext_problem_details->access_token_request); + mbs_ext_problem_details->access_token_request = NULL; + } + if (mbs_ext_problem_details->nrf_id) { + ogs_free(mbs_ext_problem_details->nrf_id); + mbs_ext_problem_details->nrf_id = NULL; + } + if (mbs_ext_problem_details->pcf_fqdn) { + ogs_free(mbs_ext_problem_details->pcf_fqdn); + mbs_ext_problem_details->pcf_fqdn = NULL; + } + if (mbs_ext_problem_details->pcf_ip_end_points) { + OpenAPI_list_for_each(mbs_ext_problem_details->pcf_ip_end_points, node) { + OpenAPI_ip_end_point_free(node->data); + } + OpenAPI_list_free(mbs_ext_problem_details->pcf_ip_end_points); + mbs_ext_problem_details->pcf_ip_end_points = NULL; + } + ogs_free(mbs_ext_problem_details); +} + +cJSON *OpenAPI_mbs_ext_problem_details_convertToJSON(OpenAPI_mbs_ext_problem_details_t *mbs_ext_problem_details) +{ + cJSON *item = NULL; + OpenAPI_lnode_t *node = NULL; + + if (mbs_ext_problem_details == NULL) { + ogs_error("OpenAPI_mbs_ext_problem_details_convertToJSON() failed [MbsExtProblemDetails]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (mbs_ext_problem_details->type) { + if (cJSON_AddStringToObject(item, "type", mbs_ext_problem_details->type) == NULL) { + ogs_error("OpenAPI_mbs_ext_problem_details_convertToJSON() failed [type]"); + goto end; + } + } + + if (mbs_ext_problem_details->title) { + if (cJSON_AddStringToObject(item, "title", mbs_ext_problem_details->title) == NULL) { + ogs_error("OpenAPI_mbs_ext_problem_details_convertToJSON() failed [title]"); + goto end; + } + } + + if (mbs_ext_problem_details->is_status) { + if (cJSON_AddNumberToObject(item, "status", mbs_ext_problem_details->status) == NULL) { + ogs_error("OpenAPI_mbs_ext_problem_details_convertToJSON() failed [status]"); + goto end; + } + } + + if (mbs_ext_problem_details->detail) { + if (cJSON_AddStringToObject(item, "detail", mbs_ext_problem_details->detail) == NULL) { + ogs_error("OpenAPI_mbs_ext_problem_details_convertToJSON() failed [detail]"); + goto end; + } + } + + if (mbs_ext_problem_details->instance) { + if (cJSON_AddStringToObject(item, "instance", mbs_ext_problem_details->instance) == NULL) { + ogs_error("OpenAPI_mbs_ext_problem_details_convertToJSON() failed [instance]"); + goto end; + } + } + + if (mbs_ext_problem_details->cause) { + if (cJSON_AddStringToObject(item, "cause", mbs_ext_problem_details->cause) == NULL) { + ogs_error("OpenAPI_mbs_ext_problem_details_convertToJSON() failed [cause]"); + goto end; + } + } + + if (mbs_ext_problem_details->invalid_params) { + cJSON *invalid_paramsList = cJSON_AddArrayToObject(item, "invalidParams"); + if (invalid_paramsList == NULL) { + ogs_error("OpenAPI_mbs_ext_problem_details_convertToJSON() failed [invalid_params]"); + goto end; + } + OpenAPI_list_for_each(mbs_ext_problem_details->invalid_params, node) { + cJSON *itemLocal = OpenAPI_invalid_param_convertToJSON(node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_mbs_ext_problem_details_convertToJSON() failed [invalid_params]"); + goto end; + } + cJSON_AddItemToArray(invalid_paramsList, itemLocal); + } + } + + if (mbs_ext_problem_details->supported_features) { + if (cJSON_AddStringToObject(item, "supportedFeatures", mbs_ext_problem_details->supported_features) == NULL) { + ogs_error("OpenAPI_mbs_ext_problem_details_convertToJSON() failed [supported_features]"); + goto end; + } + } + + if (mbs_ext_problem_details->access_token_error) { + cJSON *access_token_error_local_JSON = OpenAPI_access_token_err_convertToJSON(mbs_ext_problem_details->access_token_error); + if (access_token_error_local_JSON == NULL) { + ogs_error("OpenAPI_mbs_ext_problem_details_convertToJSON() failed [access_token_error]"); + goto end; + } + cJSON_AddItemToObject(item, "accessTokenError", access_token_error_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_mbs_ext_problem_details_convertToJSON() failed [access_token_error]"); + goto end; + } + } + + if (mbs_ext_problem_details->access_token_request) { + cJSON *access_token_request_local_JSON = OpenAPI_access_token_req_convertToJSON(mbs_ext_problem_details->access_token_request); + if (access_token_request_local_JSON == NULL) { + ogs_error("OpenAPI_mbs_ext_problem_details_convertToJSON() failed [access_token_request]"); + goto end; + } + cJSON_AddItemToObject(item, "accessTokenRequest", access_token_request_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_mbs_ext_problem_details_convertToJSON() failed [access_token_request]"); + goto end; + } + } + + if (mbs_ext_problem_details->nrf_id) { + if (cJSON_AddStringToObject(item, "nrfId", mbs_ext_problem_details->nrf_id) == NULL) { + ogs_error("OpenAPI_mbs_ext_problem_details_convertToJSON() failed [nrf_id]"); + goto end; + } + } + + if (mbs_ext_problem_details->pcf_fqdn) { + if (cJSON_AddStringToObject(item, "pcfFqdn", mbs_ext_problem_details->pcf_fqdn) == NULL) { + ogs_error("OpenAPI_mbs_ext_problem_details_convertToJSON() failed [pcf_fqdn]"); + goto end; + } + } + + if (mbs_ext_problem_details->pcf_ip_end_points) { + cJSON *pcf_ip_end_pointsList = cJSON_AddArrayToObject(item, "pcfIpEndPoints"); + if (pcf_ip_end_pointsList == NULL) { + ogs_error("OpenAPI_mbs_ext_problem_details_convertToJSON() failed [pcf_ip_end_points]"); + goto end; + } + OpenAPI_list_for_each(mbs_ext_problem_details->pcf_ip_end_points, node) { + cJSON *itemLocal = OpenAPI_ip_end_point_convertToJSON(node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_mbs_ext_problem_details_convertToJSON() failed [pcf_ip_end_points]"); + goto end; + } + cJSON_AddItemToArray(pcf_ip_end_pointsList, itemLocal); + } + } + +end: + return item; +} + +OpenAPI_mbs_ext_problem_details_t *OpenAPI_mbs_ext_problem_details_parseFromJSON(cJSON *mbs_ext_problem_detailsJSON) +{ + OpenAPI_mbs_ext_problem_details_t *mbs_ext_problem_details_local_var = NULL; + OpenAPI_lnode_t *node = NULL; + cJSON *type = NULL; + cJSON *title = NULL; + cJSON *status = NULL; + cJSON *detail = NULL; + cJSON *instance = NULL; + cJSON *cause = NULL; + cJSON *invalid_params = NULL; + OpenAPI_list_t *invalid_paramsList = NULL; + cJSON *supported_features = NULL; + cJSON *access_token_error = NULL; + OpenAPI_access_token_err_t *access_token_error_local_nonprim = NULL; + cJSON *access_token_request = NULL; + OpenAPI_access_token_req_t *access_token_request_local_nonprim = NULL; + cJSON *nrf_id = NULL; + cJSON *pcf_fqdn = NULL; + cJSON *pcf_ip_end_points = NULL; + OpenAPI_list_t *pcf_ip_end_pointsList = NULL; + type = cJSON_GetObjectItemCaseSensitive(mbs_ext_problem_detailsJSON, "type"); + if (type) { + if (!cJSON_IsString(type) && !cJSON_IsNull(type)) { + ogs_error("OpenAPI_mbs_ext_problem_details_parseFromJSON() failed [type]"); + goto end; + } + } + + title = cJSON_GetObjectItemCaseSensitive(mbs_ext_problem_detailsJSON, "title"); + if (title) { + if (!cJSON_IsString(title) && !cJSON_IsNull(title)) { + ogs_error("OpenAPI_mbs_ext_problem_details_parseFromJSON() failed [title]"); + goto end; + } + } + + status = cJSON_GetObjectItemCaseSensitive(mbs_ext_problem_detailsJSON, "status"); + if (status) { + if (!cJSON_IsNumber(status)) { + ogs_error("OpenAPI_mbs_ext_problem_details_parseFromJSON() failed [status]"); + goto end; + } + } + + detail = cJSON_GetObjectItemCaseSensitive(mbs_ext_problem_detailsJSON, "detail"); + if (detail) { + if (!cJSON_IsString(detail) && !cJSON_IsNull(detail)) { + ogs_error("OpenAPI_mbs_ext_problem_details_parseFromJSON() failed [detail]"); + goto end; + } + } + + instance = cJSON_GetObjectItemCaseSensitive(mbs_ext_problem_detailsJSON, "instance"); + if (instance) { + if (!cJSON_IsString(instance) && !cJSON_IsNull(instance)) { + ogs_error("OpenAPI_mbs_ext_problem_details_parseFromJSON() failed [instance]"); + goto end; + } + } + + cause = cJSON_GetObjectItemCaseSensitive(mbs_ext_problem_detailsJSON, "cause"); + if (cause) { + if (!cJSON_IsString(cause) && !cJSON_IsNull(cause)) { + ogs_error("OpenAPI_mbs_ext_problem_details_parseFromJSON() failed [cause]"); + goto end; + } + } + + invalid_params = cJSON_GetObjectItemCaseSensitive(mbs_ext_problem_detailsJSON, "invalidParams"); + if (invalid_params) { + cJSON *invalid_params_local = NULL; + if (!cJSON_IsArray(invalid_params)) { + ogs_error("OpenAPI_mbs_ext_problem_details_parseFromJSON() failed [invalid_params]"); + goto end; + } + + invalid_paramsList = OpenAPI_list_create(); + + cJSON_ArrayForEach(invalid_params_local, invalid_params) { + if (!cJSON_IsObject(invalid_params_local)) { + ogs_error("OpenAPI_mbs_ext_problem_details_parseFromJSON() failed [invalid_params]"); + goto end; + } + OpenAPI_invalid_param_t *invalid_paramsItem = OpenAPI_invalid_param_parseFromJSON(invalid_params_local); + if (!invalid_paramsItem) { + ogs_error("No invalid_paramsItem"); + OpenAPI_list_free(invalid_paramsList); + goto end; + } + OpenAPI_list_add(invalid_paramsList, invalid_paramsItem); + } + } + + supported_features = cJSON_GetObjectItemCaseSensitive(mbs_ext_problem_detailsJSON, "supportedFeatures"); + if (supported_features) { + if (!cJSON_IsString(supported_features) && !cJSON_IsNull(supported_features)) { + ogs_error("OpenAPI_mbs_ext_problem_details_parseFromJSON() failed [supported_features]"); + goto end; + } + } + + access_token_error = cJSON_GetObjectItemCaseSensitive(mbs_ext_problem_detailsJSON, "accessTokenError"); + if (access_token_error) { + access_token_error_local_nonprim = OpenAPI_access_token_err_parseFromJSON(access_token_error); + } + + access_token_request = cJSON_GetObjectItemCaseSensitive(mbs_ext_problem_detailsJSON, "accessTokenRequest"); + if (access_token_request) { + access_token_request_local_nonprim = OpenAPI_access_token_req_parseFromJSON(access_token_request); + } + + nrf_id = cJSON_GetObjectItemCaseSensitive(mbs_ext_problem_detailsJSON, "nrfId"); + if (nrf_id) { + if (!cJSON_IsString(nrf_id) && !cJSON_IsNull(nrf_id)) { + ogs_error("OpenAPI_mbs_ext_problem_details_parseFromJSON() failed [nrf_id]"); + goto end; + } + } + + pcf_fqdn = cJSON_GetObjectItemCaseSensitive(mbs_ext_problem_detailsJSON, "pcfFqdn"); + if (pcf_fqdn) { + if (!cJSON_IsString(pcf_fqdn) && !cJSON_IsNull(pcf_fqdn)) { + ogs_error("OpenAPI_mbs_ext_problem_details_parseFromJSON() failed [pcf_fqdn]"); + goto end; + } + } + + pcf_ip_end_points = cJSON_GetObjectItemCaseSensitive(mbs_ext_problem_detailsJSON, "pcfIpEndPoints"); + if (pcf_ip_end_points) { + cJSON *pcf_ip_end_points_local = NULL; + if (!cJSON_IsArray(pcf_ip_end_points)) { + ogs_error("OpenAPI_mbs_ext_problem_details_parseFromJSON() failed [pcf_ip_end_points]"); + 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_mbs_ext_problem_details_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); + } + } + + mbs_ext_problem_details_local_var = OpenAPI_mbs_ext_problem_details_create ( + type && !cJSON_IsNull(type) ? ogs_strdup(type->valuestring) : NULL, + title && !cJSON_IsNull(title) ? ogs_strdup(title->valuestring) : NULL, + status ? true : false, + status ? status->valuedouble : 0, + detail && !cJSON_IsNull(detail) ? ogs_strdup(detail->valuestring) : NULL, + instance && !cJSON_IsNull(instance) ? ogs_strdup(instance->valuestring) : NULL, + cause && !cJSON_IsNull(cause) ? ogs_strdup(cause->valuestring) : NULL, + invalid_params ? invalid_paramsList : NULL, + supported_features && !cJSON_IsNull(supported_features) ? ogs_strdup(supported_features->valuestring) : NULL, + access_token_error ? access_token_error_local_nonprim : NULL, + access_token_request ? access_token_request_local_nonprim : NULL, + nrf_id && !cJSON_IsNull(nrf_id) ? ogs_strdup(nrf_id->valuestring) : NULL, + pcf_fqdn && !cJSON_IsNull(pcf_fqdn) ? ogs_strdup(pcf_fqdn->valuestring) : NULL, + pcf_ip_end_points ? pcf_ip_end_pointsList : NULL + ); + + return mbs_ext_problem_details_local_var; +end: + if (invalid_paramsList) { + OpenAPI_list_for_each(invalid_paramsList, node) { + OpenAPI_invalid_param_free(node->data); + } + OpenAPI_list_free(invalid_paramsList); + invalid_paramsList = NULL; + } + if (access_token_error_local_nonprim) { + OpenAPI_access_token_err_free(access_token_error_local_nonprim); + access_token_error_local_nonprim = NULL; + } + if (access_token_request_local_nonprim) { + OpenAPI_access_token_req_free(access_token_request_local_nonprim); + access_token_request_local_nonprim = 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; + } + return NULL; +} + +OpenAPI_mbs_ext_problem_details_t *OpenAPI_mbs_ext_problem_details_copy(OpenAPI_mbs_ext_problem_details_t *dst, OpenAPI_mbs_ext_problem_details_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_mbs_ext_problem_details_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_mbs_ext_problem_details_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_mbs_ext_problem_details_free(dst); + dst = OpenAPI_mbs_ext_problem_details_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/mbs_ext_problem_details.h b/lib/sbi/openapi/model/mbs_ext_problem_details.h new file mode 100644 index 000000000..eeeeb632e --- /dev/null +++ b/lib/sbi/openapi/model/mbs_ext_problem_details.h @@ -0,0 +1,68 @@ +/* + * mbs_ext_problem_details.h + * + * Contains the FQDN or IP endpoints of the existing PCF and the cause value if there is an existing PCF binding information for the MBS session. + */ + +#ifndef _OpenAPI_mbs_ext_problem_details_H_ +#define _OpenAPI_mbs_ext_problem_details_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "access_token_err.h" +#include "access_token_req.h" +#include "invalid_param.h" +#include "ip_end_point.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_mbs_ext_problem_details_s OpenAPI_mbs_ext_problem_details_t; +typedef struct OpenAPI_mbs_ext_problem_details_s { + char *type; + char *title; + bool is_status; + int status; + char *detail; + char *instance; + char *cause; + OpenAPI_list_t *invalid_params; + char *supported_features; + struct OpenAPI_access_token_err_s *access_token_error; + struct OpenAPI_access_token_req_s *access_token_request; + char *nrf_id; + char *pcf_fqdn; + OpenAPI_list_t *pcf_ip_end_points; +} OpenAPI_mbs_ext_problem_details_t; + +OpenAPI_mbs_ext_problem_details_t *OpenAPI_mbs_ext_problem_details_create( + char *type, + char *title, + bool is_status, + int status, + char *detail, + char *instance, + char *cause, + OpenAPI_list_t *invalid_params, + char *supported_features, + OpenAPI_access_token_err_t *access_token_error, + OpenAPI_access_token_req_t *access_token_request, + char *nrf_id, + char *pcf_fqdn, + OpenAPI_list_t *pcf_ip_end_points +); +void OpenAPI_mbs_ext_problem_details_free(OpenAPI_mbs_ext_problem_details_t *mbs_ext_problem_details); +OpenAPI_mbs_ext_problem_details_t *OpenAPI_mbs_ext_problem_details_parseFromJSON(cJSON *mbs_ext_problem_detailsJSON); +cJSON *OpenAPI_mbs_ext_problem_details_convertToJSON(OpenAPI_mbs_ext_problem_details_t *mbs_ext_problem_details); +OpenAPI_mbs_ext_problem_details_t *OpenAPI_mbs_ext_problem_details_copy(OpenAPI_mbs_ext_problem_details_t *dst, OpenAPI_mbs_ext_problem_details_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_mbs_ext_problem_details_H_ */ + diff --git a/lib/sbi/openapi/model/mbs_service_area.c b/lib/sbi/openapi/model/mbs_service_area.c new file mode 100644 index 000000000..f3afabcd1 --- /dev/null +++ b/lib/sbi/openapi/model/mbs_service_area.c @@ -0,0 +1,207 @@ + +#include +#include +#include +#include "mbs_service_area.h" + +OpenAPI_mbs_service_area_t *OpenAPI_mbs_service_area_create( + OpenAPI_list_t *ncgi_list, + OpenAPI_list_t *tai_list +) +{ + OpenAPI_mbs_service_area_t *mbs_service_area_local_var = ogs_malloc(sizeof(OpenAPI_mbs_service_area_t)); + ogs_assert(mbs_service_area_local_var); + + mbs_service_area_local_var->ncgi_list = ncgi_list; + mbs_service_area_local_var->tai_list = tai_list; + + return mbs_service_area_local_var; +} + +void OpenAPI_mbs_service_area_free(OpenAPI_mbs_service_area_t *mbs_service_area) +{ + OpenAPI_lnode_t *node = NULL; + + if (NULL == mbs_service_area) { + return; + } + if (mbs_service_area->ncgi_list) { + OpenAPI_list_for_each(mbs_service_area->ncgi_list, node) { + OpenAPI_ncgi_tai_free(node->data); + } + OpenAPI_list_free(mbs_service_area->ncgi_list); + mbs_service_area->ncgi_list = NULL; + } + if (mbs_service_area->tai_list) { + OpenAPI_list_for_each(mbs_service_area->tai_list, node) { + OpenAPI_tai_free(node->data); + } + OpenAPI_list_free(mbs_service_area->tai_list); + mbs_service_area->tai_list = NULL; + } + ogs_free(mbs_service_area); +} + +cJSON *OpenAPI_mbs_service_area_convertToJSON(OpenAPI_mbs_service_area_t *mbs_service_area) +{ + cJSON *item = NULL; + OpenAPI_lnode_t *node = NULL; + + if (mbs_service_area == NULL) { + ogs_error("OpenAPI_mbs_service_area_convertToJSON() failed [MbsServiceArea]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (mbs_service_area->ncgi_list) { + cJSON *ncgi_listList = cJSON_AddArrayToObject(item, "ncgiList"); + if (ncgi_listList == NULL) { + ogs_error("OpenAPI_mbs_service_area_convertToJSON() failed [ncgi_list]"); + goto end; + } + OpenAPI_list_for_each(mbs_service_area->ncgi_list, node) { + cJSON *itemLocal = OpenAPI_ncgi_tai_convertToJSON(node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_mbs_service_area_convertToJSON() failed [ncgi_list]"); + goto end; + } + cJSON_AddItemToArray(ncgi_listList, itemLocal); + } + } + + if (mbs_service_area->tai_list) { + cJSON *tai_listList = cJSON_AddArrayToObject(item, "taiList"); + if (tai_listList == NULL) { + ogs_error("OpenAPI_mbs_service_area_convertToJSON() failed [tai_list]"); + goto end; + } + OpenAPI_list_for_each(mbs_service_area->tai_list, node) { + cJSON *itemLocal = OpenAPI_tai_convertToJSON(node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_mbs_service_area_convertToJSON() failed [tai_list]"); + goto end; + } + cJSON_AddItemToArray(tai_listList, itemLocal); + } + } + +end: + return item; +} + +OpenAPI_mbs_service_area_t *OpenAPI_mbs_service_area_parseFromJSON(cJSON *mbs_service_areaJSON) +{ + OpenAPI_mbs_service_area_t *mbs_service_area_local_var = NULL; + OpenAPI_lnode_t *node = NULL; + cJSON *ncgi_list = NULL; + OpenAPI_list_t *ncgi_listList = NULL; + cJSON *tai_list = NULL; + OpenAPI_list_t *tai_listList = NULL; + ncgi_list = cJSON_GetObjectItemCaseSensitive(mbs_service_areaJSON, "ncgiList"); + if (ncgi_list) { + cJSON *ncgi_list_local = NULL; + if (!cJSON_IsArray(ncgi_list)) { + ogs_error("OpenAPI_mbs_service_area_parseFromJSON() failed [ncgi_list]"); + goto end; + } + + ncgi_listList = OpenAPI_list_create(); + + cJSON_ArrayForEach(ncgi_list_local, ncgi_list) { + if (!cJSON_IsObject(ncgi_list_local)) { + ogs_error("OpenAPI_mbs_service_area_parseFromJSON() failed [ncgi_list]"); + goto end; + } + OpenAPI_ncgi_tai_t *ncgi_listItem = OpenAPI_ncgi_tai_parseFromJSON(ncgi_list_local); + if (!ncgi_listItem) { + ogs_error("No ncgi_listItem"); + OpenAPI_list_free(ncgi_listList); + goto end; + } + OpenAPI_list_add(ncgi_listList, ncgi_listItem); + } + } + + tai_list = cJSON_GetObjectItemCaseSensitive(mbs_service_areaJSON, "taiList"); + if (tai_list) { + cJSON *tai_list_local = NULL; + if (!cJSON_IsArray(tai_list)) { + ogs_error("OpenAPI_mbs_service_area_parseFromJSON() failed [tai_list]"); + goto end; + } + + tai_listList = OpenAPI_list_create(); + + cJSON_ArrayForEach(tai_list_local, tai_list) { + if (!cJSON_IsObject(tai_list_local)) { + ogs_error("OpenAPI_mbs_service_area_parseFromJSON() failed [tai_list]"); + goto end; + } + OpenAPI_tai_t *tai_listItem = OpenAPI_tai_parseFromJSON(tai_list_local); + if (!tai_listItem) { + ogs_error("No tai_listItem"); + OpenAPI_list_free(tai_listList); + goto end; + } + OpenAPI_list_add(tai_listList, tai_listItem); + } + } + + mbs_service_area_local_var = OpenAPI_mbs_service_area_create ( + ncgi_list ? ncgi_listList : NULL, + tai_list ? tai_listList : NULL + ); + + return mbs_service_area_local_var; +end: + if (ncgi_listList) { + OpenAPI_list_for_each(ncgi_listList, node) { + OpenAPI_ncgi_tai_free(node->data); + } + OpenAPI_list_free(ncgi_listList); + ncgi_listList = NULL; + } + if (tai_listList) { + OpenAPI_list_for_each(tai_listList, node) { + OpenAPI_tai_free(node->data); + } + OpenAPI_list_free(tai_listList); + tai_listList = NULL; + } + return NULL; +} + +OpenAPI_mbs_service_area_t *OpenAPI_mbs_service_area_copy(OpenAPI_mbs_service_area_t *dst, OpenAPI_mbs_service_area_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_mbs_service_area_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_mbs_service_area_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_mbs_service_area_free(dst); + dst = OpenAPI_mbs_service_area_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/mbs_service_area.h b/lib/sbi/openapi/model/mbs_service_area.h new file mode 100644 index 000000000..10299f54b --- /dev/null +++ b/lib/sbi/openapi/model/mbs_service_area.h @@ -0,0 +1,42 @@ +/* + * mbs_service_area.h + * + * MBS Service Area + */ + +#ifndef _OpenAPI_mbs_service_area_H_ +#define _OpenAPI_mbs_service_area_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "ncgi_tai.h" +#include "tai.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_mbs_service_area_s OpenAPI_mbs_service_area_t; +typedef struct OpenAPI_mbs_service_area_s { + OpenAPI_list_t *ncgi_list; + OpenAPI_list_t *tai_list; +} OpenAPI_mbs_service_area_t; + +OpenAPI_mbs_service_area_t *OpenAPI_mbs_service_area_create( + OpenAPI_list_t *ncgi_list, + OpenAPI_list_t *tai_list +); +void OpenAPI_mbs_service_area_free(OpenAPI_mbs_service_area_t *mbs_service_area); +OpenAPI_mbs_service_area_t *OpenAPI_mbs_service_area_parseFromJSON(cJSON *mbs_service_areaJSON); +cJSON *OpenAPI_mbs_service_area_convertToJSON(OpenAPI_mbs_service_area_t *mbs_service_area); +OpenAPI_mbs_service_area_t *OpenAPI_mbs_service_area_copy(OpenAPI_mbs_service_area_t *dst, OpenAPI_mbs_service_area_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_mbs_service_area_H_ */ + diff --git a/lib/sbi/openapi/model/mbs_service_area_info.c b/lib/sbi/openapi/model/mbs_service_area_info.c new file mode 100644 index 000000000..a9ec36412 --- /dev/null +++ b/lib/sbi/openapi/model/mbs_service_area_info.c @@ -0,0 +1,142 @@ + +#include +#include +#include +#include "mbs_service_area_info.h" + +OpenAPI_mbs_service_area_info_t *OpenAPI_mbs_service_area_info_create( + int area_session_id, + OpenAPI_mbs_service_area_t *mbs_service_area +) +{ + OpenAPI_mbs_service_area_info_t *mbs_service_area_info_local_var = ogs_malloc(sizeof(OpenAPI_mbs_service_area_info_t)); + ogs_assert(mbs_service_area_info_local_var); + + mbs_service_area_info_local_var->area_session_id = area_session_id; + mbs_service_area_info_local_var->mbs_service_area = mbs_service_area; + + return mbs_service_area_info_local_var; +} + +void OpenAPI_mbs_service_area_info_free(OpenAPI_mbs_service_area_info_t *mbs_service_area_info) +{ + OpenAPI_lnode_t *node = NULL; + + if (NULL == mbs_service_area_info) { + return; + } + if (mbs_service_area_info->mbs_service_area) { + OpenAPI_mbs_service_area_free(mbs_service_area_info->mbs_service_area); + mbs_service_area_info->mbs_service_area = NULL; + } + ogs_free(mbs_service_area_info); +} + +cJSON *OpenAPI_mbs_service_area_info_convertToJSON(OpenAPI_mbs_service_area_info_t *mbs_service_area_info) +{ + cJSON *item = NULL; + OpenAPI_lnode_t *node = NULL; + + if (mbs_service_area_info == NULL) { + ogs_error("OpenAPI_mbs_service_area_info_convertToJSON() failed [MbsServiceAreaInfo]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (cJSON_AddNumberToObject(item, "areaSessionId", mbs_service_area_info->area_session_id) == NULL) { + ogs_error("OpenAPI_mbs_service_area_info_convertToJSON() failed [area_session_id]"); + goto end; + } + + if (!mbs_service_area_info->mbs_service_area) { + ogs_error("OpenAPI_mbs_service_area_info_convertToJSON() failed [mbs_service_area]"); + return NULL; + } + cJSON *mbs_service_area_local_JSON = OpenAPI_mbs_service_area_convertToJSON(mbs_service_area_info->mbs_service_area); + if (mbs_service_area_local_JSON == NULL) { + ogs_error("OpenAPI_mbs_service_area_info_convertToJSON() failed [mbs_service_area]"); + goto end; + } + cJSON_AddItemToObject(item, "mbsServiceArea", mbs_service_area_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_mbs_service_area_info_convertToJSON() failed [mbs_service_area]"); + goto end; + } + +end: + return item; +} + +OpenAPI_mbs_service_area_info_t *OpenAPI_mbs_service_area_info_parseFromJSON(cJSON *mbs_service_area_infoJSON) +{ + OpenAPI_mbs_service_area_info_t *mbs_service_area_info_local_var = NULL; + OpenAPI_lnode_t *node = NULL; + cJSON *area_session_id = NULL; + cJSON *mbs_service_area = NULL; + OpenAPI_mbs_service_area_t *mbs_service_area_local_nonprim = NULL; + area_session_id = cJSON_GetObjectItemCaseSensitive(mbs_service_area_infoJSON, "areaSessionId"); + if (!area_session_id) { + ogs_error("OpenAPI_mbs_service_area_info_parseFromJSON() failed [area_session_id]"); + goto end; + } + if (!cJSON_IsNumber(area_session_id)) { + ogs_error("OpenAPI_mbs_service_area_info_parseFromJSON() failed [area_session_id]"); + goto end; + } + + mbs_service_area = cJSON_GetObjectItemCaseSensitive(mbs_service_area_infoJSON, "mbsServiceArea"); + if (!mbs_service_area) { + ogs_error("OpenAPI_mbs_service_area_info_parseFromJSON() failed [mbs_service_area]"); + goto end; + } + mbs_service_area_local_nonprim = OpenAPI_mbs_service_area_parseFromJSON(mbs_service_area); + + mbs_service_area_info_local_var = OpenAPI_mbs_service_area_info_create ( + + area_session_id->valuedouble, + mbs_service_area_local_nonprim + ); + + return mbs_service_area_info_local_var; +end: + if (mbs_service_area_local_nonprim) { + OpenAPI_mbs_service_area_free(mbs_service_area_local_nonprim); + mbs_service_area_local_nonprim = NULL; + } + return NULL; +} + +OpenAPI_mbs_service_area_info_t *OpenAPI_mbs_service_area_info_copy(OpenAPI_mbs_service_area_info_t *dst, OpenAPI_mbs_service_area_info_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_mbs_service_area_info_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_mbs_service_area_info_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_mbs_service_area_info_free(dst); + dst = OpenAPI_mbs_service_area_info_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/mbs_service_area_info.h b/lib/sbi/openapi/model/mbs_service_area_info.h new file mode 100644 index 000000000..0951ae426 --- /dev/null +++ b/lib/sbi/openapi/model/mbs_service_area_info.h @@ -0,0 +1,41 @@ +/* + * mbs_service_area_info.h + * + * MBS Service Area Information for location dependent MBS session + */ + +#ifndef _OpenAPI_mbs_service_area_info_H_ +#define _OpenAPI_mbs_service_area_info_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "mbs_service_area.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_mbs_service_area_info_s OpenAPI_mbs_service_area_info_t; +typedef struct OpenAPI_mbs_service_area_info_s { + int area_session_id; + struct OpenAPI_mbs_service_area_s *mbs_service_area; +} OpenAPI_mbs_service_area_info_t; + +OpenAPI_mbs_service_area_info_t *OpenAPI_mbs_service_area_info_create( + int area_session_id, + OpenAPI_mbs_service_area_t *mbs_service_area +); +void OpenAPI_mbs_service_area_info_free(OpenAPI_mbs_service_area_info_t *mbs_service_area_info); +OpenAPI_mbs_service_area_info_t *OpenAPI_mbs_service_area_info_parseFromJSON(cJSON *mbs_service_area_infoJSON); +cJSON *OpenAPI_mbs_service_area_info_convertToJSON(OpenAPI_mbs_service_area_info_t *mbs_service_area_info); +OpenAPI_mbs_service_area_info_t *OpenAPI_mbs_service_area_info_copy(OpenAPI_mbs_service_area_info_t *dst, OpenAPI_mbs_service_area_info_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_mbs_service_area_info_H_ */ + diff --git a/lib/sbi/openapi/model/mbs_session.c b/lib/sbi/openapi/model/mbs_session.c new file mode 100644 index 000000000..bcf412207 --- /dev/null +++ b/lib/sbi/openapi/model/mbs_session.c @@ -0,0 +1,195 @@ + +#include +#include +#include +#include "mbs_session.h" + +OpenAPI_mbs_session_t *OpenAPI_mbs_session_create( + OpenAPI_mbs_session_id_t *mbs_session_id, + OpenAPI_list_t* mbs_area_sessions +) +{ + OpenAPI_mbs_session_t *mbs_session_local_var = ogs_malloc(sizeof(OpenAPI_mbs_session_t)); + ogs_assert(mbs_session_local_var); + + mbs_session_local_var->mbs_session_id = mbs_session_id; + mbs_session_local_var->mbs_area_sessions = mbs_area_sessions; + + return mbs_session_local_var; +} + +void OpenAPI_mbs_session_free(OpenAPI_mbs_session_t *mbs_session) +{ + OpenAPI_lnode_t *node = NULL; + + if (NULL == mbs_session) { + return; + } + if (mbs_session->mbs_session_id) { + OpenAPI_mbs_session_id_free(mbs_session->mbs_session_id); + mbs_session->mbs_session_id = NULL; + } + if (mbs_session->mbs_area_sessions) { + OpenAPI_list_for_each(mbs_session->mbs_area_sessions, node) { + OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*)node->data; + ogs_free(localKeyValue->key); + OpenAPI_mbs_service_area_info_free(localKeyValue->value); + OpenAPI_map_free(localKeyValue); + } + OpenAPI_list_free(mbs_session->mbs_area_sessions); + mbs_session->mbs_area_sessions = NULL; + } + ogs_free(mbs_session); +} + +cJSON *OpenAPI_mbs_session_convertToJSON(OpenAPI_mbs_session_t *mbs_session) +{ + cJSON *item = NULL; + OpenAPI_lnode_t *node = NULL; + + if (mbs_session == NULL) { + ogs_error("OpenAPI_mbs_session_convertToJSON() failed [MbsSession]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (!mbs_session->mbs_session_id) { + ogs_error("OpenAPI_mbs_session_convertToJSON() failed [mbs_session_id]"); + return NULL; + } + cJSON *mbs_session_id_local_JSON = OpenAPI_mbs_session_id_convertToJSON(mbs_session->mbs_session_id); + if (mbs_session_id_local_JSON == NULL) { + ogs_error("OpenAPI_mbs_session_convertToJSON() failed [mbs_session_id]"); + goto end; + } + cJSON_AddItemToObject(item, "mbsSessionId", mbs_session_id_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_mbs_session_convertToJSON() failed [mbs_session_id]"); + goto end; + } + + if (mbs_session->mbs_area_sessions) { + cJSON *mbs_area_sessions = cJSON_AddObjectToObject(item, "mbsAreaSessions"); + if (mbs_area_sessions == NULL) { + ogs_error("OpenAPI_mbs_session_convertToJSON() failed [mbs_area_sessions]"); + goto end; + } + cJSON *localMapObject = mbs_area_sessions; + if (mbs_session->mbs_area_sessions) { + OpenAPI_list_for_each(mbs_session->mbs_area_sessions, node) { + OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*)node->data; + cJSON *itemLocal = localKeyValue->value ? + OpenAPI_mbs_service_area_info_convertToJSON(localKeyValue->value) : + cJSON_CreateNull(); + if (itemLocal == NULL) { + ogs_error("OpenAPI_mbs_session_convertToJSON() failed [inner]"); + goto end; + } + cJSON_AddItemToObject(localMapObject, localKeyValue->key, itemLocal); + } + } + } + +end: + return item; +} + +OpenAPI_mbs_session_t *OpenAPI_mbs_session_parseFromJSON(cJSON *mbs_sessionJSON) +{ + OpenAPI_mbs_session_t *mbs_session_local_var = NULL; + OpenAPI_lnode_t *node = NULL; + cJSON *mbs_session_id = NULL; + OpenAPI_mbs_session_id_t *mbs_session_id_local_nonprim = NULL; + cJSON *mbs_area_sessions = NULL; + OpenAPI_list_t *mbs_area_sessionsList = NULL; + mbs_session_id = cJSON_GetObjectItemCaseSensitive(mbs_sessionJSON, "mbsSessionId"); + if (!mbs_session_id) { + ogs_error("OpenAPI_mbs_session_parseFromJSON() failed [mbs_session_id]"); + goto end; + } + mbs_session_id_local_nonprim = OpenAPI_mbs_session_id_parseFromJSON(mbs_session_id); + + mbs_area_sessions = cJSON_GetObjectItemCaseSensitive(mbs_sessionJSON, "mbsAreaSessions"); + if (mbs_area_sessions) { + cJSON *mbs_area_sessions_local_map = NULL; + if (!cJSON_IsObject(mbs_area_sessions) && !cJSON_IsNull(mbs_area_sessions)) { + ogs_error("OpenAPI_mbs_session_parseFromJSON() failed [mbs_area_sessions]"); + goto end; + } + if (cJSON_IsObject(mbs_area_sessions)) { + mbs_area_sessionsList = OpenAPI_list_create(); + OpenAPI_map_t *localMapKeyPair = NULL; + cJSON_ArrayForEach(mbs_area_sessions_local_map, mbs_area_sessions) { + cJSON *localMapObject = mbs_area_sessions_local_map; + if (cJSON_IsObject(localMapObject)) { + localMapKeyPair = OpenAPI_map_create( + ogs_strdup(localMapObject->string), OpenAPI_mbs_service_area_info_parseFromJSON(localMapObject)); + } else if (cJSON_IsNull(localMapObject)) { + localMapKeyPair = OpenAPI_map_create(ogs_strdup(localMapObject->string), NULL); + } else { + ogs_error("OpenAPI_mbs_session_parseFromJSON() failed [inner]"); + goto end; + } + OpenAPI_list_add(mbs_area_sessionsList, localMapKeyPair); + } + } + } + + mbs_session_local_var = OpenAPI_mbs_session_create ( + mbs_session_id_local_nonprim, + mbs_area_sessions ? mbs_area_sessionsList : NULL + ); + + return mbs_session_local_var; +end: + if (mbs_session_id_local_nonprim) { + OpenAPI_mbs_session_id_free(mbs_session_id_local_nonprim); + mbs_session_id_local_nonprim = NULL; + } + if (mbs_area_sessionsList) { + OpenAPI_list_for_each(mbs_area_sessionsList, node) { + OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*) node->data; + ogs_free(localKeyValue->key); + OpenAPI_mbs_service_area_info_free(localKeyValue->value); + OpenAPI_map_free(localKeyValue); + } + OpenAPI_list_free(mbs_area_sessionsList); + mbs_area_sessionsList = NULL; + } + return NULL; +} + +OpenAPI_mbs_session_t *OpenAPI_mbs_session_copy(OpenAPI_mbs_session_t *dst, OpenAPI_mbs_session_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_mbs_session_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_mbs_session_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_mbs_session_free(dst); + dst = OpenAPI_mbs_session_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/mbs_session.h b/lib/sbi/openapi/model/mbs_session.h new file mode 100644 index 000000000..ba4a216f7 --- /dev/null +++ b/lib/sbi/openapi/model/mbs_session.h @@ -0,0 +1,42 @@ +/* + * mbs_session.h + * + * MBS Session currently served by an MB-SMF + */ + +#ifndef _OpenAPI_mbs_session_H_ +#define _OpenAPI_mbs_session_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "mbs_service_area_info.h" +#include "mbs_session_id.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_mbs_session_s OpenAPI_mbs_session_t; +typedef struct OpenAPI_mbs_session_s { + struct OpenAPI_mbs_session_id_s *mbs_session_id; + OpenAPI_list_t* mbs_area_sessions; +} OpenAPI_mbs_session_t; + +OpenAPI_mbs_session_t *OpenAPI_mbs_session_create( + OpenAPI_mbs_session_id_t *mbs_session_id, + OpenAPI_list_t* mbs_area_sessions +); +void OpenAPI_mbs_session_free(OpenAPI_mbs_session_t *mbs_session); +OpenAPI_mbs_session_t *OpenAPI_mbs_session_parseFromJSON(cJSON *mbs_sessionJSON); +cJSON *OpenAPI_mbs_session_convertToJSON(OpenAPI_mbs_session_t *mbs_session); +OpenAPI_mbs_session_t *OpenAPI_mbs_session_copy(OpenAPI_mbs_session_t *dst, OpenAPI_mbs_session_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_mbs_session_H_ */ + diff --git a/lib/sbi/openapi/model/mbs_session_id.c b/lib/sbi/openapi/model/mbs_session_id.c new file mode 100644 index 000000000..27e6e14b2 --- /dev/null +++ b/lib/sbi/openapi/model/mbs_session_id.c @@ -0,0 +1,172 @@ + +#include +#include +#include +#include "mbs_session_id.h" + +OpenAPI_mbs_session_id_t *OpenAPI_mbs_session_id_create( + OpenAPI_tmgi_t *tmgi, + OpenAPI_ssm_t *ssm, + char *nid +) +{ + OpenAPI_mbs_session_id_t *mbs_session_id_local_var = ogs_malloc(sizeof(OpenAPI_mbs_session_id_t)); + ogs_assert(mbs_session_id_local_var); + + mbs_session_id_local_var->tmgi = tmgi; + mbs_session_id_local_var->ssm = ssm; + mbs_session_id_local_var->nid = nid; + + return mbs_session_id_local_var; +} + +void OpenAPI_mbs_session_id_free(OpenAPI_mbs_session_id_t *mbs_session_id) +{ + OpenAPI_lnode_t *node = NULL; + + if (NULL == mbs_session_id) { + return; + } + if (mbs_session_id->tmgi) { + OpenAPI_tmgi_free(mbs_session_id->tmgi); + mbs_session_id->tmgi = NULL; + } + if (mbs_session_id->ssm) { + OpenAPI_ssm_free(mbs_session_id->ssm); + mbs_session_id->ssm = NULL; + } + if (mbs_session_id->nid) { + ogs_free(mbs_session_id->nid); + mbs_session_id->nid = NULL; + } + ogs_free(mbs_session_id); +} + +cJSON *OpenAPI_mbs_session_id_convertToJSON(OpenAPI_mbs_session_id_t *mbs_session_id) +{ + cJSON *item = NULL; + OpenAPI_lnode_t *node = NULL; + + if (mbs_session_id == NULL) { + ogs_error("OpenAPI_mbs_session_id_convertToJSON() failed [MbsSessionId]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (mbs_session_id->tmgi) { + cJSON *tmgi_local_JSON = OpenAPI_tmgi_convertToJSON(mbs_session_id->tmgi); + if (tmgi_local_JSON == NULL) { + ogs_error("OpenAPI_mbs_session_id_convertToJSON() failed [tmgi]"); + goto end; + } + cJSON_AddItemToObject(item, "tmgi", tmgi_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_mbs_session_id_convertToJSON() failed [tmgi]"); + goto end; + } + } + + if (mbs_session_id->ssm) { + cJSON *ssm_local_JSON = OpenAPI_ssm_convertToJSON(mbs_session_id->ssm); + if (ssm_local_JSON == NULL) { + ogs_error("OpenAPI_mbs_session_id_convertToJSON() failed [ssm]"); + goto end; + } + cJSON_AddItemToObject(item, "ssm", ssm_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_mbs_session_id_convertToJSON() failed [ssm]"); + goto end; + } + } + + if (mbs_session_id->nid) { + if (cJSON_AddStringToObject(item, "nid", mbs_session_id->nid) == NULL) { + ogs_error("OpenAPI_mbs_session_id_convertToJSON() failed [nid]"); + goto end; + } + } + +end: + return item; +} + +OpenAPI_mbs_session_id_t *OpenAPI_mbs_session_id_parseFromJSON(cJSON *mbs_session_idJSON) +{ + OpenAPI_mbs_session_id_t *mbs_session_id_local_var = NULL; + OpenAPI_lnode_t *node = NULL; + cJSON *tmgi = NULL; + OpenAPI_tmgi_t *tmgi_local_nonprim = NULL; + cJSON *ssm = NULL; + OpenAPI_ssm_t *ssm_local_nonprim = NULL; + cJSON *nid = NULL; + tmgi = cJSON_GetObjectItemCaseSensitive(mbs_session_idJSON, "tmgi"); + if (tmgi) { + tmgi_local_nonprim = OpenAPI_tmgi_parseFromJSON(tmgi); + } + + ssm = cJSON_GetObjectItemCaseSensitive(mbs_session_idJSON, "ssm"); + if (ssm) { + ssm_local_nonprim = OpenAPI_ssm_parseFromJSON(ssm); + } + + nid = cJSON_GetObjectItemCaseSensitive(mbs_session_idJSON, "nid"); + if (nid) { + if (!cJSON_IsString(nid) && !cJSON_IsNull(nid)) { + ogs_error("OpenAPI_mbs_session_id_parseFromJSON() failed [nid]"); + goto end; + } + } + + mbs_session_id_local_var = OpenAPI_mbs_session_id_create ( + tmgi ? tmgi_local_nonprim : NULL, + ssm ? ssm_local_nonprim : NULL, + nid && !cJSON_IsNull(nid) ? ogs_strdup(nid->valuestring) : NULL + ); + + return mbs_session_id_local_var; +end: + if (tmgi_local_nonprim) { + OpenAPI_tmgi_free(tmgi_local_nonprim); + tmgi_local_nonprim = NULL; + } + if (ssm_local_nonprim) { + OpenAPI_ssm_free(ssm_local_nonprim); + ssm_local_nonprim = NULL; + } + return NULL; +} + +OpenAPI_mbs_session_id_t *OpenAPI_mbs_session_id_copy(OpenAPI_mbs_session_id_t *dst, OpenAPI_mbs_session_id_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_mbs_session_id_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_mbs_session_id_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_mbs_session_id_free(dst); + dst = OpenAPI_mbs_session_id_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/mbs_session_id.h b/lib/sbi/openapi/model/mbs_session_id.h new file mode 100644 index 000000000..177d22a77 --- /dev/null +++ b/lib/sbi/openapi/model/mbs_session_id.h @@ -0,0 +1,44 @@ +/* + * mbs_session_id.h + * + * MBS Session Identifier + */ + +#ifndef _OpenAPI_mbs_session_id_H_ +#define _OpenAPI_mbs_session_id_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "ssm.h" +#include "tmgi.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_mbs_session_id_s OpenAPI_mbs_session_id_t; +typedef struct OpenAPI_mbs_session_id_s { + struct OpenAPI_tmgi_s *tmgi; + struct OpenAPI_ssm_s *ssm; + char *nid; +} OpenAPI_mbs_session_id_t; + +OpenAPI_mbs_session_id_t *OpenAPI_mbs_session_id_create( + OpenAPI_tmgi_t *tmgi, + OpenAPI_ssm_t *ssm, + char *nid +); +void OpenAPI_mbs_session_id_free(OpenAPI_mbs_session_id_t *mbs_session_id); +OpenAPI_mbs_session_id_t *OpenAPI_mbs_session_id_parseFromJSON(cJSON *mbs_session_idJSON); +cJSON *OpenAPI_mbs_session_id_convertToJSON(OpenAPI_mbs_session_id_t *mbs_session_id); +OpenAPI_mbs_session_id_t *OpenAPI_mbs_session_id_copy(OpenAPI_mbs_session_id_t *dst, OpenAPI_mbs_session_id_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_mbs_session_id_H_ */ + diff --git a/lib/sbi/openapi/model/mbs_session_id_1.c b/lib/sbi/openapi/model/mbs_session_id_1.c new file mode 100644 index 000000000..7f5c961df --- /dev/null +++ b/lib/sbi/openapi/model/mbs_session_id_1.c @@ -0,0 +1,172 @@ + +#include +#include +#include +#include "mbs_session_id_1.h" + +OpenAPI_mbs_session_id_1_t *OpenAPI_mbs_session_id_1_create( + OpenAPI_tmgi_1_t *tmgi, + OpenAPI_ssm_1_t *ssm, + char *nid +) +{ + OpenAPI_mbs_session_id_1_t *mbs_session_id_1_local_var = ogs_malloc(sizeof(OpenAPI_mbs_session_id_1_t)); + ogs_assert(mbs_session_id_1_local_var); + + mbs_session_id_1_local_var->tmgi = tmgi; + mbs_session_id_1_local_var->ssm = ssm; + mbs_session_id_1_local_var->nid = nid; + + return mbs_session_id_1_local_var; +} + +void OpenAPI_mbs_session_id_1_free(OpenAPI_mbs_session_id_1_t *mbs_session_id_1) +{ + OpenAPI_lnode_t *node = NULL; + + if (NULL == mbs_session_id_1) { + return; + } + if (mbs_session_id_1->tmgi) { + OpenAPI_tmgi_1_free(mbs_session_id_1->tmgi); + mbs_session_id_1->tmgi = NULL; + } + if (mbs_session_id_1->ssm) { + OpenAPI_ssm_1_free(mbs_session_id_1->ssm); + mbs_session_id_1->ssm = NULL; + } + if (mbs_session_id_1->nid) { + ogs_free(mbs_session_id_1->nid); + mbs_session_id_1->nid = NULL; + } + ogs_free(mbs_session_id_1); +} + +cJSON *OpenAPI_mbs_session_id_1_convertToJSON(OpenAPI_mbs_session_id_1_t *mbs_session_id_1) +{ + cJSON *item = NULL; + OpenAPI_lnode_t *node = NULL; + + if (mbs_session_id_1 == NULL) { + ogs_error("OpenAPI_mbs_session_id_1_convertToJSON() failed [MbsSessionId_1]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (mbs_session_id_1->tmgi) { + cJSON *tmgi_local_JSON = OpenAPI_tmgi_1_convertToJSON(mbs_session_id_1->tmgi); + if (tmgi_local_JSON == NULL) { + ogs_error("OpenAPI_mbs_session_id_1_convertToJSON() failed [tmgi]"); + goto end; + } + cJSON_AddItemToObject(item, "tmgi", tmgi_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_mbs_session_id_1_convertToJSON() failed [tmgi]"); + goto end; + } + } + + if (mbs_session_id_1->ssm) { + cJSON *ssm_local_JSON = OpenAPI_ssm_1_convertToJSON(mbs_session_id_1->ssm); + if (ssm_local_JSON == NULL) { + ogs_error("OpenAPI_mbs_session_id_1_convertToJSON() failed [ssm]"); + goto end; + } + cJSON_AddItemToObject(item, "ssm", ssm_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_mbs_session_id_1_convertToJSON() failed [ssm]"); + goto end; + } + } + + if (mbs_session_id_1->nid) { + if (cJSON_AddStringToObject(item, "nid", mbs_session_id_1->nid) == NULL) { + ogs_error("OpenAPI_mbs_session_id_1_convertToJSON() failed [nid]"); + goto end; + } + } + +end: + return item; +} + +OpenAPI_mbs_session_id_1_t *OpenAPI_mbs_session_id_1_parseFromJSON(cJSON *mbs_session_id_1JSON) +{ + OpenAPI_mbs_session_id_1_t *mbs_session_id_1_local_var = NULL; + OpenAPI_lnode_t *node = NULL; + cJSON *tmgi = NULL; + OpenAPI_tmgi_1_t *tmgi_local_nonprim = NULL; + cJSON *ssm = NULL; + OpenAPI_ssm_1_t *ssm_local_nonprim = NULL; + cJSON *nid = NULL; + tmgi = cJSON_GetObjectItemCaseSensitive(mbs_session_id_1JSON, "tmgi"); + if (tmgi) { + tmgi_local_nonprim = OpenAPI_tmgi_1_parseFromJSON(tmgi); + } + + ssm = cJSON_GetObjectItemCaseSensitive(mbs_session_id_1JSON, "ssm"); + if (ssm) { + ssm_local_nonprim = OpenAPI_ssm_1_parseFromJSON(ssm); + } + + nid = cJSON_GetObjectItemCaseSensitive(mbs_session_id_1JSON, "nid"); + if (nid) { + if (!cJSON_IsString(nid) && !cJSON_IsNull(nid)) { + ogs_error("OpenAPI_mbs_session_id_1_parseFromJSON() failed [nid]"); + goto end; + } + } + + mbs_session_id_1_local_var = OpenAPI_mbs_session_id_1_create ( + tmgi ? tmgi_local_nonprim : NULL, + ssm ? ssm_local_nonprim : NULL, + nid && !cJSON_IsNull(nid) ? ogs_strdup(nid->valuestring) : NULL + ); + + return mbs_session_id_1_local_var; +end: + if (tmgi_local_nonprim) { + OpenAPI_tmgi_1_free(tmgi_local_nonprim); + tmgi_local_nonprim = NULL; + } + if (ssm_local_nonprim) { + OpenAPI_ssm_1_free(ssm_local_nonprim); + ssm_local_nonprim = NULL; + } + return NULL; +} + +OpenAPI_mbs_session_id_1_t *OpenAPI_mbs_session_id_1_copy(OpenAPI_mbs_session_id_1_t *dst, OpenAPI_mbs_session_id_1_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_mbs_session_id_1_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_mbs_session_id_1_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_mbs_session_id_1_free(dst); + dst = OpenAPI_mbs_session_id_1_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/mbs_session_id_1.h b/lib/sbi/openapi/model/mbs_session_id_1.h new file mode 100644 index 000000000..6650d8a71 --- /dev/null +++ b/lib/sbi/openapi/model/mbs_session_id_1.h @@ -0,0 +1,44 @@ +/* + * mbs_session_id_1.h + * + * MBS Session Identifier + */ + +#ifndef _OpenAPI_mbs_session_id_1_H_ +#define _OpenAPI_mbs_session_id_1_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "ssm_1.h" +#include "tmgi_1.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_mbs_session_id_1_s OpenAPI_mbs_session_id_1_t; +typedef struct OpenAPI_mbs_session_id_1_s { + struct OpenAPI_tmgi_1_s *tmgi; + struct OpenAPI_ssm_1_s *ssm; + char *nid; +} OpenAPI_mbs_session_id_1_t; + +OpenAPI_mbs_session_id_1_t *OpenAPI_mbs_session_id_1_create( + OpenAPI_tmgi_1_t *tmgi, + OpenAPI_ssm_1_t *ssm, + char *nid +); +void OpenAPI_mbs_session_id_1_free(OpenAPI_mbs_session_id_1_t *mbs_session_id_1); +OpenAPI_mbs_session_id_1_t *OpenAPI_mbs_session_id_1_parseFromJSON(cJSON *mbs_session_id_1JSON); +cJSON *OpenAPI_mbs_session_id_1_convertToJSON(OpenAPI_mbs_session_id_1_t *mbs_session_id_1); +OpenAPI_mbs_session_id_1_t *OpenAPI_mbs_session_id_1_copy(OpenAPI_mbs_session_id_1_t *dst, OpenAPI_mbs_session_id_1_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_mbs_session_id_1_H_ */ + diff --git a/lib/sbi/openapi/model/mbs_subscription_data.c b/lib/sbi/openapi/model/mbs_subscription_data.c new file mode 100644 index 000000000..2894b8b92 --- /dev/null +++ b/lib/sbi/openapi/model/mbs_subscription_data.c @@ -0,0 +1,169 @@ + +#include +#include +#include +#include "mbs_subscription_data.h" + +OpenAPI_mbs_subscription_data_t *OpenAPI_mbs_subscription_data_create( + bool is_mbs_allowed, + int mbs_allowed, + OpenAPI_list_t *mbs_session_id_list +) +{ + OpenAPI_mbs_subscription_data_t *mbs_subscription_data_local_var = ogs_malloc(sizeof(OpenAPI_mbs_subscription_data_t)); + ogs_assert(mbs_subscription_data_local_var); + + mbs_subscription_data_local_var->is_mbs_allowed = is_mbs_allowed; + mbs_subscription_data_local_var->mbs_allowed = mbs_allowed; + mbs_subscription_data_local_var->mbs_session_id_list = mbs_session_id_list; + + return mbs_subscription_data_local_var; +} + +void OpenAPI_mbs_subscription_data_free(OpenAPI_mbs_subscription_data_t *mbs_subscription_data) +{ + OpenAPI_lnode_t *node = NULL; + + if (NULL == mbs_subscription_data) { + return; + } + if (mbs_subscription_data->mbs_session_id_list) { + OpenAPI_list_for_each(mbs_subscription_data->mbs_session_id_list, node) { + OpenAPI_mbs_session_id_free(node->data); + } + OpenAPI_list_free(mbs_subscription_data->mbs_session_id_list); + mbs_subscription_data->mbs_session_id_list = NULL; + } + ogs_free(mbs_subscription_data); +} + +cJSON *OpenAPI_mbs_subscription_data_convertToJSON(OpenAPI_mbs_subscription_data_t *mbs_subscription_data) +{ + cJSON *item = NULL; + OpenAPI_lnode_t *node = NULL; + + if (mbs_subscription_data == NULL) { + ogs_error("OpenAPI_mbs_subscription_data_convertToJSON() failed [MbsSubscriptionData]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (mbs_subscription_data->is_mbs_allowed) { + if (cJSON_AddBoolToObject(item, "mbsAllowed", mbs_subscription_data->mbs_allowed) == NULL) { + ogs_error("OpenAPI_mbs_subscription_data_convertToJSON() failed [mbs_allowed]"); + goto end; + } + } + + if (mbs_subscription_data->mbs_session_id_list) { + cJSON *mbs_session_id_listList = cJSON_AddArrayToObject(item, "mbsSessionIdList"); + if (mbs_session_id_listList == NULL) { + ogs_error("OpenAPI_mbs_subscription_data_convertToJSON() failed [mbs_session_id_list]"); + goto end; + } + OpenAPI_list_for_each(mbs_subscription_data->mbs_session_id_list, node) { + cJSON *itemLocal = OpenAPI_mbs_session_id_convertToJSON(node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_mbs_subscription_data_convertToJSON() failed [mbs_session_id_list]"); + goto end; + } + cJSON_AddItemToArray(mbs_session_id_listList, itemLocal); + } + } + +end: + return item; +} + +OpenAPI_mbs_subscription_data_t *OpenAPI_mbs_subscription_data_parseFromJSON(cJSON *mbs_subscription_dataJSON) +{ + OpenAPI_mbs_subscription_data_t *mbs_subscription_data_local_var = NULL; + OpenAPI_lnode_t *node = NULL; + cJSON *mbs_allowed = NULL; + cJSON *mbs_session_id_list = NULL; + OpenAPI_list_t *mbs_session_id_listList = NULL; + mbs_allowed = cJSON_GetObjectItemCaseSensitive(mbs_subscription_dataJSON, "mbsAllowed"); + if (mbs_allowed) { + if (!cJSON_IsBool(mbs_allowed)) { + ogs_error("OpenAPI_mbs_subscription_data_parseFromJSON() failed [mbs_allowed]"); + goto end; + } + } + + mbs_session_id_list = cJSON_GetObjectItemCaseSensitive(mbs_subscription_dataJSON, "mbsSessionIdList"); + if (mbs_session_id_list) { + cJSON *mbs_session_id_list_local = NULL; + if (!cJSON_IsArray(mbs_session_id_list)) { + ogs_error("OpenAPI_mbs_subscription_data_parseFromJSON() failed [mbs_session_id_list]"); + goto end; + } + + mbs_session_id_listList = OpenAPI_list_create(); + + cJSON_ArrayForEach(mbs_session_id_list_local, mbs_session_id_list) { + if (!cJSON_IsObject(mbs_session_id_list_local)) { + ogs_error("OpenAPI_mbs_subscription_data_parseFromJSON() failed [mbs_session_id_list]"); + goto end; + } + OpenAPI_mbs_session_id_t *mbs_session_id_listItem = OpenAPI_mbs_session_id_parseFromJSON(mbs_session_id_list_local); + if (!mbs_session_id_listItem) { + ogs_error("No mbs_session_id_listItem"); + OpenAPI_list_free(mbs_session_id_listList); + goto end; + } + OpenAPI_list_add(mbs_session_id_listList, mbs_session_id_listItem); + } + } + + mbs_subscription_data_local_var = OpenAPI_mbs_subscription_data_create ( + mbs_allowed ? true : false, + mbs_allowed ? mbs_allowed->valueint : 0, + mbs_session_id_list ? mbs_session_id_listList : NULL + ); + + return mbs_subscription_data_local_var; +end: + if (mbs_session_id_listList) { + OpenAPI_list_for_each(mbs_session_id_listList, node) { + OpenAPI_mbs_session_id_free(node->data); + } + OpenAPI_list_free(mbs_session_id_listList); + mbs_session_id_listList = NULL; + } + return NULL; +} + +OpenAPI_mbs_subscription_data_t *OpenAPI_mbs_subscription_data_copy(OpenAPI_mbs_subscription_data_t *dst, OpenAPI_mbs_subscription_data_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_mbs_subscription_data_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_mbs_subscription_data_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_mbs_subscription_data_free(dst); + dst = OpenAPI_mbs_subscription_data_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/mbs_subscription_data.h b/lib/sbi/openapi/model/mbs_subscription_data.h new file mode 100644 index 000000000..451e50741 --- /dev/null +++ b/lib/sbi/openapi/model/mbs_subscription_data.h @@ -0,0 +1,43 @@ +/* + * mbs_subscription_data.h + * + * Contains the 5MBS Subscription Data. + */ + +#ifndef _OpenAPI_mbs_subscription_data_H_ +#define _OpenAPI_mbs_subscription_data_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "mbs_session_id.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_mbs_subscription_data_s OpenAPI_mbs_subscription_data_t; +typedef struct OpenAPI_mbs_subscription_data_s { + bool is_mbs_allowed; + int mbs_allowed; + OpenAPI_list_t *mbs_session_id_list; +} OpenAPI_mbs_subscription_data_t; + +OpenAPI_mbs_subscription_data_t *OpenAPI_mbs_subscription_data_create( + bool is_mbs_allowed, + int mbs_allowed, + OpenAPI_list_t *mbs_session_id_list +); +void OpenAPI_mbs_subscription_data_free(OpenAPI_mbs_subscription_data_t *mbs_subscription_data); +OpenAPI_mbs_subscription_data_t *OpenAPI_mbs_subscription_data_parseFromJSON(cJSON *mbs_subscription_dataJSON); +cJSON *OpenAPI_mbs_subscription_data_convertToJSON(OpenAPI_mbs_subscription_data_t *mbs_subscription_data); +OpenAPI_mbs_subscription_data_t *OpenAPI_mbs_subscription_data_copy(OpenAPI_mbs_subscription_data_t *dst, OpenAPI_mbs_subscription_data_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_mbs_subscription_data_H_ */ + diff --git a/lib/sbi/openapi/model/mbs_subscription_data_1.c b/lib/sbi/openapi/model/mbs_subscription_data_1.c new file mode 100644 index 000000000..cc11e7c23 --- /dev/null +++ b/lib/sbi/openapi/model/mbs_subscription_data_1.c @@ -0,0 +1,169 @@ + +#include +#include +#include +#include "mbs_subscription_data_1.h" + +OpenAPI_mbs_subscription_data_1_t *OpenAPI_mbs_subscription_data_1_create( + bool is_mbs_allowed, + int mbs_allowed, + OpenAPI_list_t *mbs_session_id_list +) +{ + OpenAPI_mbs_subscription_data_1_t *mbs_subscription_data_1_local_var = ogs_malloc(sizeof(OpenAPI_mbs_subscription_data_1_t)); + ogs_assert(mbs_subscription_data_1_local_var); + + mbs_subscription_data_1_local_var->is_mbs_allowed = is_mbs_allowed; + mbs_subscription_data_1_local_var->mbs_allowed = mbs_allowed; + mbs_subscription_data_1_local_var->mbs_session_id_list = mbs_session_id_list; + + return mbs_subscription_data_1_local_var; +} + +void OpenAPI_mbs_subscription_data_1_free(OpenAPI_mbs_subscription_data_1_t *mbs_subscription_data_1) +{ + OpenAPI_lnode_t *node = NULL; + + if (NULL == mbs_subscription_data_1) { + return; + } + if (mbs_subscription_data_1->mbs_session_id_list) { + OpenAPI_list_for_each(mbs_subscription_data_1->mbs_session_id_list, node) { + OpenAPI_mbs_session_id_1_free(node->data); + } + OpenAPI_list_free(mbs_subscription_data_1->mbs_session_id_list); + mbs_subscription_data_1->mbs_session_id_list = NULL; + } + ogs_free(mbs_subscription_data_1); +} + +cJSON *OpenAPI_mbs_subscription_data_1_convertToJSON(OpenAPI_mbs_subscription_data_1_t *mbs_subscription_data_1) +{ + cJSON *item = NULL; + OpenAPI_lnode_t *node = NULL; + + if (mbs_subscription_data_1 == NULL) { + ogs_error("OpenAPI_mbs_subscription_data_1_convertToJSON() failed [MbsSubscriptionData_1]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (mbs_subscription_data_1->is_mbs_allowed) { + if (cJSON_AddBoolToObject(item, "mbsAllowed", mbs_subscription_data_1->mbs_allowed) == NULL) { + ogs_error("OpenAPI_mbs_subscription_data_1_convertToJSON() failed [mbs_allowed]"); + goto end; + } + } + + if (mbs_subscription_data_1->mbs_session_id_list) { + cJSON *mbs_session_id_listList = cJSON_AddArrayToObject(item, "mbsSessionIdList"); + if (mbs_session_id_listList == NULL) { + ogs_error("OpenAPI_mbs_subscription_data_1_convertToJSON() failed [mbs_session_id_list]"); + goto end; + } + OpenAPI_list_for_each(mbs_subscription_data_1->mbs_session_id_list, node) { + cJSON *itemLocal = OpenAPI_mbs_session_id_1_convertToJSON(node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_mbs_subscription_data_1_convertToJSON() failed [mbs_session_id_list]"); + goto end; + } + cJSON_AddItemToArray(mbs_session_id_listList, itemLocal); + } + } + +end: + return item; +} + +OpenAPI_mbs_subscription_data_1_t *OpenAPI_mbs_subscription_data_1_parseFromJSON(cJSON *mbs_subscription_data_1JSON) +{ + OpenAPI_mbs_subscription_data_1_t *mbs_subscription_data_1_local_var = NULL; + OpenAPI_lnode_t *node = NULL; + cJSON *mbs_allowed = NULL; + cJSON *mbs_session_id_list = NULL; + OpenAPI_list_t *mbs_session_id_listList = NULL; + mbs_allowed = cJSON_GetObjectItemCaseSensitive(mbs_subscription_data_1JSON, "mbsAllowed"); + if (mbs_allowed) { + if (!cJSON_IsBool(mbs_allowed)) { + ogs_error("OpenAPI_mbs_subscription_data_1_parseFromJSON() failed [mbs_allowed]"); + goto end; + } + } + + mbs_session_id_list = cJSON_GetObjectItemCaseSensitive(mbs_subscription_data_1JSON, "mbsSessionIdList"); + if (mbs_session_id_list) { + cJSON *mbs_session_id_list_local = NULL; + if (!cJSON_IsArray(mbs_session_id_list)) { + ogs_error("OpenAPI_mbs_subscription_data_1_parseFromJSON() failed [mbs_session_id_list]"); + goto end; + } + + mbs_session_id_listList = OpenAPI_list_create(); + + cJSON_ArrayForEach(mbs_session_id_list_local, mbs_session_id_list) { + if (!cJSON_IsObject(mbs_session_id_list_local)) { + ogs_error("OpenAPI_mbs_subscription_data_1_parseFromJSON() failed [mbs_session_id_list]"); + goto end; + } + OpenAPI_mbs_session_id_1_t *mbs_session_id_listItem = OpenAPI_mbs_session_id_1_parseFromJSON(mbs_session_id_list_local); + if (!mbs_session_id_listItem) { + ogs_error("No mbs_session_id_listItem"); + OpenAPI_list_free(mbs_session_id_listList); + goto end; + } + OpenAPI_list_add(mbs_session_id_listList, mbs_session_id_listItem); + } + } + + mbs_subscription_data_1_local_var = OpenAPI_mbs_subscription_data_1_create ( + mbs_allowed ? true : false, + mbs_allowed ? mbs_allowed->valueint : 0, + mbs_session_id_list ? mbs_session_id_listList : NULL + ); + + return mbs_subscription_data_1_local_var; +end: + if (mbs_session_id_listList) { + OpenAPI_list_for_each(mbs_session_id_listList, node) { + OpenAPI_mbs_session_id_1_free(node->data); + } + OpenAPI_list_free(mbs_session_id_listList); + mbs_session_id_listList = NULL; + } + return NULL; +} + +OpenAPI_mbs_subscription_data_1_t *OpenAPI_mbs_subscription_data_1_copy(OpenAPI_mbs_subscription_data_1_t *dst, OpenAPI_mbs_subscription_data_1_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_mbs_subscription_data_1_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_mbs_subscription_data_1_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_mbs_subscription_data_1_free(dst); + dst = OpenAPI_mbs_subscription_data_1_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/mbs_subscription_data_1.h b/lib/sbi/openapi/model/mbs_subscription_data_1.h new file mode 100644 index 000000000..54acaffd0 --- /dev/null +++ b/lib/sbi/openapi/model/mbs_subscription_data_1.h @@ -0,0 +1,43 @@ +/* + * mbs_subscription_data_1.h + * + * Contains the 5MBS Subscription Data. + */ + +#ifndef _OpenAPI_mbs_subscription_data_1_H_ +#define _OpenAPI_mbs_subscription_data_1_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "mbs_session_id_1.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_mbs_subscription_data_1_s OpenAPI_mbs_subscription_data_1_t; +typedef struct OpenAPI_mbs_subscription_data_1_s { + bool is_mbs_allowed; + int mbs_allowed; + OpenAPI_list_t *mbs_session_id_list; +} OpenAPI_mbs_subscription_data_1_t; + +OpenAPI_mbs_subscription_data_1_t *OpenAPI_mbs_subscription_data_1_create( + bool is_mbs_allowed, + int mbs_allowed, + OpenAPI_list_t *mbs_session_id_list +); +void OpenAPI_mbs_subscription_data_1_free(OpenAPI_mbs_subscription_data_1_t *mbs_subscription_data_1); +OpenAPI_mbs_subscription_data_1_t *OpenAPI_mbs_subscription_data_1_parseFromJSON(cJSON *mbs_subscription_data_1JSON); +cJSON *OpenAPI_mbs_subscription_data_1_convertToJSON(OpenAPI_mbs_subscription_data_1_t *mbs_subscription_data_1); +OpenAPI_mbs_subscription_data_1_t *OpenAPI_mbs_subscription_data_1_copy(OpenAPI_mbs_subscription_data_1_t *dst, OpenAPI_mbs_subscription_data_1_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_mbs_subscription_data_1_H_ */ + diff --git a/lib/sbi/openapi/model/mbsfn_area.h b/lib/sbi/openapi/model/mbsfn_area.h index 39ef6d1b3..c20bc80a3 100644 --- a/lib/sbi/openapi/model/mbsfn_area.h +++ b/lib/sbi/openapi/model/mbsfn_area.h @@ -1,7 +1,7 @@ /* * mbsfn_area.h * - * + * Contains an MBSFN area information. */ #ifndef _OpenAPI_mbsfn_area_H_ diff --git a/lib/sbi/openapi/model/mdt_configuration.h b/lib/sbi/openapi/model/mdt_configuration.h index 5e5e21e53..f2b47055f 100644 --- a/lib/sbi/openapi/model/mdt_configuration.h +++ b/lib/sbi/openapi/model/mdt_configuration.h @@ -1,7 +1,7 @@ /* * mdt_configuration.h * - * + * contains contain MDT configuration data. */ #ifndef _OpenAPI_mdt_configuration_H_ diff --git a/lib/sbi/openapi/model/mdt_configuration_1.h b/lib/sbi/openapi/model/mdt_configuration_1.h index 2b6680b84..fc7453239 100644 --- a/lib/sbi/openapi/model/mdt_configuration_1.h +++ b/lib/sbi/openapi/model/mdt_configuration_1.h @@ -1,7 +1,7 @@ /* * mdt_configuration_1.h * - * + * contains contain MDT configuration data. */ #ifndef _OpenAPI_mdt_configuration_1_H_ diff --git a/lib/sbi/openapi/model/media_component.c b/lib/sbi/openapi/model/media_component.c index 58cd194be..4d9dd8238 100644 --- a/lib/sbi/openapi/model/media_component.c +++ b/lib/sbi/openapi/model/media_component.c @@ -11,6 +11,7 @@ OpenAPI_media_component_t *OpenAPI_media_component_create( bool is_dis_ue_notif, int dis_ue_notif, OpenAPI_list_t *alt_ser_reqs, + OpenAPI_list_t *alt_ser_reqs_data, bool is_cont_ver, int cont_ver, OpenAPI_list_t *codecs, @@ -47,7 +48,9 @@ OpenAPI_media_component_t *OpenAPI_media_component_create( int sharing_key_ul, OpenAPI_tsn_qos_container_t *tsn_qos, OpenAPI_tscai_input_container_t *tscai_input_dl, - OpenAPI_tscai_input_container_t *tscai_input_ul + OpenAPI_tscai_input_container_t *tscai_input_ul, + bool is_tscai_time_dom, + int tscai_time_dom ) { OpenAPI_media_component_t *media_component_local_var = ogs_malloc(sizeof(OpenAPI_media_component_t)); @@ -59,6 +62,7 @@ OpenAPI_media_component_t *OpenAPI_media_component_create( media_component_local_var->is_dis_ue_notif = is_dis_ue_notif; media_component_local_var->dis_ue_notif = dis_ue_notif; media_component_local_var->alt_ser_reqs = alt_ser_reqs; + media_component_local_var->alt_ser_reqs_data = alt_ser_reqs_data; media_component_local_var->is_cont_ver = is_cont_ver; media_component_local_var->cont_ver = cont_ver; media_component_local_var->codecs = codecs; @@ -96,6 +100,8 @@ OpenAPI_media_component_t *OpenAPI_media_component_create( media_component_local_var->tsn_qos = tsn_qos; media_component_local_var->tscai_input_dl = tscai_input_dl; media_component_local_var->tscai_input_ul = tscai_input_ul; + media_component_local_var->is_tscai_time_dom = is_tscai_time_dom; + media_component_local_var->tscai_time_dom = tscai_time_dom; return media_component_local_var; } @@ -126,6 +132,13 @@ void OpenAPI_media_component_free(OpenAPI_media_component_t *media_component) OpenAPI_list_free(media_component->alt_ser_reqs); media_component->alt_ser_reqs = NULL; } + if (media_component->alt_ser_reqs_data) { + OpenAPI_list_for_each(media_component->alt_ser_reqs_data, node) { + OpenAPI_alternative_service_requirements_data_free(node->data); + } + OpenAPI_list_free(media_component->alt_ser_reqs_data); + media_component->alt_ser_reqs_data = NULL; + } if (media_component->codecs) { OpenAPI_list_for_each(media_component->codecs, node) { ogs_free(node->data); @@ -261,6 +274,22 @@ cJSON *OpenAPI_media_component_convertToJSON(OpenAPI_media_component_t *media_co } } + if (media_component->alt_ser_reqs_data) { + cJSON *alt_ser_reqs_dataList = cJSON_AddArrayToObject(item, "altSerReqsData"); + if (alt_ser_reqs_dataList == NULL) { + ogs_error("OpenAPI_media_component_convertToJSON() failed [alt_ser_reqs_data]"); + goto end; + } + OpenAPI_list_for_each(media_component->alt_ser_reqs_data, node) { + cJSON *itemLocal = OpenAPI_alternative_service_requirements_data_convertToJSON(node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_media_component_convertToJSON() failed [alt_ser_reqs_data]"); + goto end; + } + cJSON_AddItemToArray(alt_ser_reqs_dataList, itemLocal); + } + } + if (media_component->is_cont_ver) { if (cJSON_AddNumberToObject(item, "contVer", media_component->cont_ver) == NULL) { ogs_error("OpenAPI_media_component_convertToJSON() failed [cont_ver]"); @@ -509,6 +538,13 @@ cJSON *OpenAPI_media_component_convertToJSON(OpenAPI_media_component_t *media_co } } + if (media_component->is_tscai_time_dom) { + if (cJSON_AddNumberToObject(item, "tscaiTimeDom", media_component->tscai_time_dom) == NULL) { + ogs_error("OpenAPI_media_component_convertToJSON() failed [tscai_time_dom]"); + goto end; + } + } + end: return item; } @@ -524,6 +560,8 @@ OpenAPI_media_component_t *OpenAPI_media_component_parseFromJSON(cJSON *media_co cJSON *dis_ue_notif = NULL; cJSON *alt_ser_reqs = NULL; OpenAPI_list_t *alt_ser_reqsList = NULL; + cJSON *alt_ser_reqs_data = NULL; + OpenAPI_list_t *alt_ser_reqs_dataList = NULL; cJSON *cont_ver = NULL; cJSON *codecs = NULL; OpenAPI_list_t *codecsList = NULL; @@ -565,6 +603,7 @@ OpenAPI_media_component_t *OpenAPI_media_component_parseFromJSON(cJSON *media_co OpenAPI_tscai_input_container_t *tscai_input_dl_local_nonprim = NULL; cJSON *tscai_input_ul = NULL; OpenAPI_tscai_input_container_t *tscai_input_ul_local_nonprim = NULL; + cJSON *tscai_time_dom = NULL; af_app_id = cJSON_GetObjectItemCaseSensitive(media_componentJSON, "afAppId"); if (af_app_id) { if (!cJSON_IsString(af_app_id) && !cJSON_IsNull(af_app_id)) { @@ -615,6 +654,31 @@ OpenAPI_media_component_t *OpenAPI_media_component_parseFromJSON(cJSON *media_co } } + alt_ser_reqs_data = cJSON_GetObjectItemCaseSensitive(media_componentJSON, "altSerReqsData"); + if (alt_ser_reqs_data) { + cJSON *alt_ser_reqs_data_local = NULL; + if (!cJSON_IsArray(alt_ser_reqs_data)) { + ogs_error("OpenAPI_media_component_parseFromJSON() failed [alt_ser_reqs_data]"); + goto end; + } + + alt_ser_reqs_dataList = OpenAPI_list_create(); + + cJSON_ArrayForEach(alt_ser_reqs_data_local, alt_ser_reqs_data) { + if (!cJSON_IsObject(alt_ser_reqs_data_local)) { + ogs_error("OpenAPI_media_component_parseFromJSON() failed [alt_ser_reqs_data]"); + goto end; + } + OpenAPI_alternative_service_requirements_data_t *alt_ser_reqs_dataItem = OpenAPI_alternative_service_requirements_data_parseFromJSON(alt_ser_reqs_data_local); + if (!alt_ser_reqs_dataItem) { + ogs_error("No alt_ser_reqs_dataItem"); + OpenAPI_list_free(alt_ser_reqs_dataList); + goto end; + } + OpenAPI_list_add(alt_ser_reqs_dataList, alt_ser_reqs_dataItem); + } + } + cont_ver = cJSON_GetObjectItemCaseSensitive(media_componentJSON, "contVer"); if (cont_ver) { if (!cJSON_IsNumber(cont_ver)) { @@ -885,6 +949,14 @@ OpenAPI_media_component_t *OpenAPI_media_component_parseFromJSON(cJSON *media_co tscai_input_ul_local_nonprim = OpenAPI_tscai_input_container_parseFromJSON(tscai_input_ul); } + tscai_time_dom = cJSON_GetObjectItemCaseSensitive(media_componentJSON, "tscaiTimeDom"); + if (tscai_time_dom) { + if (!cJSON_IsNumber(tscai_time_dom)) { + ogs_error("OpenAPI_media_component_parseFromJSON() failed [tscai_time_dom]"); + goto end; + } + } + media_component_local_var = OpenAPI_media_component_create ( af_app_id && !cJSON_IsNull(af_app_id) ? ogs_strdup(af_app_id->valuestring) : NULL, af_rout_req ? af_rout_req_local_nonprim : NULL, @@ -892,6 +964,7 @@ OpenAPI_media_component_t *OpenAPI_media_component_parseFromJSON(cJSON *media_co dis_ue_notif ? true : false, dis_ue_notif ? dis_ue_notif->valueint : 0, alt_ser_reqs ? alt_ser_reqsList : NULL, + alt_ser_reqs_data ? alt_ser_reqs_dataList : NULL, cont_ver ? true : false, cont_ver ? cont_ver->valuedouble : 0, codecs ? codecsList : NULL, @@ -929,7 +1002,9 @@ OpenAPI_media_component_t *OpenAPI_media_component_parseFromJSON(cJSON *media_co sharing_key_ul ? sharing_key_ul->valuedouble : 0, tsn_qos ? tsn_qos_local_nonprim : NULL, tscai_input_dl ? tscai_input_dl_local_nonprim : NULL, - tscai_input_ul ? tscai_input_ul_local_nonprim : NULL + tscai_input_ul ? tscai_input_ul_local_nonprim : NULL, + tscai_time_dom ? true : false, + tscai_time_dom ? tscai_time_dom->valuedouble : 0 ); return media_component_local_var; @@ -945,6 +1020,13 @@ end: OpenAPI_list_free(alt_ser_reqsList); alt_ser_reqsList = NULL; } + if (alt_ser_reqs_dataList) { + OpenAPI_list_for_each(alt_ser_reqs_dataList, node) { + OpenAPI_alternative_service_requirements_data_free(node->data); + } + OpenAPI_list_free(alt_ser_reqs_dataList); + alt_ser_reqs_dataList = NULL; + } if (codecsList) { OpenAPI_list_for_each(codecsList, node) { ogs_free(node->data); diff --git a/lib/sbi/openapi/model/media_component.h b/lib/sbi/openapi/model/media_component.h index 8e0629d9b..0f64a0cdc 100644 --- a/lib/sbi/openapi/model/media_component.h +++ b/lib/sbi/openapi/model/media_component.h @@ -13,6 +13,7 @@ #include "../include/keyValuePair.h" #include "../include/binary.h" #include "af_routing_requirement.h" +#include "alternative_service_requirements_data.h" #include "flow_status.h" #include "media_sub_component.h" #include "media_type.h" @@ -35,6 +36,7 @@ typedef struct OpenAPI_media_component_s { bool is_dis_ue_notif; int dis_ue_notif; OpenAPI_list_t *alt_ser_reqs; + OpenAPI_list_t *alt_ser_reqs_data; bool is_cont_ver; int cont_ver; OpenAPI_list_t *codecs; @@ -72,6 +74,8 @@ typedef struct OpenAPI_media_component_s { struct OpenAPI_tsn_qos_container_s *tsn_qos; struct OpenAPI_tscai_input_container_s *tscai_input_dl; struct OpenAPI_tscai_input_container_s *tscai_input_ul; + bool is_tscai_time_dom; + int tscai_time_dom; } OpenAPI_media_component_t; OpenAPI_media_component_t *OpenAPI_media_component_create( @@ -81,6 +85,7 @@ OpenAPI_media_component_t *OpenAPI_media_component_create( bool is_dis_ue_notif, int dis_ue_notif, OpenAPI_list_t *alt_ser_reqs, + OpenAPI_list_t *alt_ser_reqs_data, bool is_cont_ver, int cont_ver, OpenAPI_list_t *codecs, @@ -117,7 +122,9 @@ OpenAPI_media_component_t *OpenAPI_media_component_create( int sharing_key_ul, OpenAPI_tsn_qos_container_t *tsn_qos, OpenAPI_tscai_input_container_t *tscai_input_dl, - OpenAPI_tscai_input_container_t *tscai_input_ul + OpenAPI_tscai_input_container_t *tscai_input_ul, + bool is_tscai_time_dom, + int tscai_time_dom ); void OpenAPI_media_component_free(OpenAPI_media_component_t *media_component); OpenAPI_media_component_t *OpenAPI_media_component_parseFromJSON(cJSON *media_componentJSON); diff --git a/lib/sbi/openapi/model/media_component_rm.c b/lib/sbi/openapi/model/media_component_rm.c index f19c3d4a9..0195872f1 100644 --- a/lib/sbi/openapi/model/media_component_rm.c +++ b/lib/sbi/openapi/model/media_component_rm.c @@ -9,6 +9,7 @@ OpenAPI_media_component_rm_t *OpenAPI_media_component_rm_create( OpenAPI_af_routing_requirement_rm_t *af_rout_req, char *qos_reference, OpenAPI_list_t *alt_ser_reqs, + OpenAPI_list_t *alt_ser_reqs_data, bool is_dis_ue_notif, int dis_ue_notif, bool is_cont_ver, @@ -47,7 +48,9 @@ OpenAPI_media_component_rm_t *OpenAPI_media_component_rm_create( int sharing_key_ul, OpenAPI_tsn_qos_container_rm_t *tsn_qos, OpenAPI_tscai_input_container_t *tscai_input_dl, - OpenAPI_tscai_input_container_t *tscai_input_ul + OpenAPI_tscai_input_container_t *tscai_input_ul, + bool is_tscai_time_dom, + int tscai_time_dom ) { OpenAPI_media_component_rm_t *media_component_rm_local_var = ogs_malloc(sizeof(OpenAPI_media_component_rm_t)); @@ -57,6 +60,7 @@ OpenAPI_media_component_rm_t *OpenAPI_media_component_rm_create( media_component_rm_local_var->af_rout_req = af_rout_req; media_component_rm_local_var->qos_reference = qos_reference; media_component_rm_local_var->alt_ser_reqs = alt_ser_reqs; + media_component_rm_local_var->alt_ser_reqs_data = alt_ser_reqs_data; media_component_rm_local_var->is_dis_ue_notif = is_dis_ue_notif; media_component_rm_local_var->dis_ue_notif = dis_ue_notif; media_component_rm_local_var->is_cont_ver = is_cont_ver; @@ -96,6 +100,8 @@ OpenAPI_media_component_rm_t *OpenAPI_media_component_rm_create( media_component_rm_local_var->tsn_qos = tsn_qos; media_component_rm_local_var->tscai_input_dl = tscai_input_dl; media_component_rm_local_var->tscai_input_ul = tscai_input_ul; + media_component_rm_local_var->is_tscai_time_dom = is_tscai_time_dom; + media_component_rm_local_var->tscai_time_dom = tscai_time_dom; return media_component_rm_local_var; } @@ -126,6 +132,13 @@ void OpenAPI_media_component_rm_free(OpenAPI_media_component_rm_t *media_compone OpenAPI_list_free(media_component_rm->alt_ser_reqs); media_component_rm->alt_ser_reqs = NULL; } + if (media_component_rm->alt_ser_reqs_data) { + OpenAPI_list_for_each(media_component_rm->alt_ser_reqs_data, node) { + OpenAPI_alternative_service_requirements_data_free(node->data); + } + OpenAPI_list_free(media_component_rm->alt_ser_reqs_data); + media_component_rm->alt_ser_reqs_data = NULL; + } if (media_component_rm->codecs) { OpenAPI_list_for_each(media_component_rm->codecs, node) { ogs_free(node->data); @@ -262,6 +275,22 @@ cJSON *OpenAPI_media_component_rm_convertToJSON(OpenAPI_media_component_rm_t *me } } + if (media_component_rm->alt_ser_reqs_data) { + cJSON *alt_ser_reqs_dataList = cJSON_AddArrayToObject(item, "altSerReqsData"); + if (alt_ser_reqs_dataList == NULL) { + ogs_error("OpenAPI_media_component_rm_convertToJSON() failed [alt_ser_reqs_data]"); + goto end; + } + OpenAPI_list_for_each(media_component_rm->alt_ser_reqs_data, node) { + cJSON *itemLocal = OpenAPI_alternative_service_requirements_data_convertToJSON(node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_media_component_rm_convertToJSON() failed [alt_ser_reqs_data]"); + goto end; + } + cJSON_AddItemToArray(alt_ser_reqs_dataList, itemLocal); + } + } + if (media_component_rm->is_dis_ue_notif) { if (cJSON_AddBoolToObject(item, "disUeNotif", media_component_rm->dis_ue_notif) == NULL) { ogs_error("OpenAPI_media_component_rm_convertToJSON() failed [dis_ue_notif]"); @@ -529,6 +558,13 @@ cJSON *OpenAPI_media_component_rm_convertToJSON(OpenAPI_media_component_rm_t *me } } + if (media_component_rm->is_tscai_time_dom) { + if (cJSON_AddNumberToObject(item, "tscaiTimeDom", media_component_rm->tscai_time_dom) == NULL) { + ogs_error("OpenAPI_media_component_rm_convertToJSON() failed [tscai_time_dom]"); + goto end; + } + } + end: return item; } @@ -543,6 +579,8 @@ OpenAPI_media_component_rm_t *OpenAPI_media_component_rm_parseFromJSON(cJSON *me cJSON *qos_reference = NULL; cJSON *alt_ser_reqs = NULL; OpenAPI_list_t *alt_ser_reqsList = NULL; + cJSON *alt_ser_reqs_data = NULL; + OpenAPI_list_t *alt_ser_reqs_dataList = NULL; cJSON *dis_ue_notif = NULL; cJSON *cont_ver = NULL; cJSON *codecs = NULL; @@ -585,6 +623,7 @@ OpenAPI_media_component_rm_t *OpenAPI_media_component_rm_parseFromJSON(cJSON *me OpenAPI_tscai_input_container_t *tscai_input_dl_local_nonprim = NULL; cJSON *tscai_input_ul = NULL; OpenAPI_tscai_input_container_t *tscai_input_ul_local_nonprim = NULL; + cJSON *tscai_time_dom = NULL; af_app_id = cJSON_GetObjectItemCaseSensitive(media_component_rmJSON, "afAppId"); if (af_app_id) { if (!cJSON_IsString(af_app_id) && !cJSON_IsNull(af_app_id)) { @@ -627,6 +666,31 @@ OpenAPI_media_component_rm_t *OpenAPI_media_component_rm_parseFromJSON(cJSON *me } } + alt_ser_reqs_data = cJSON_GetObjectItemCaseSensitive(media_component_rmJSON, "altSerReqsData"); + if (alt_ser_reqs_data) { + cJSON *alt_ser_reqs_data_local = NULL; + if (!cJSON_IsArray(alt_ser_reqs_data)) { + ogs_error("OpenAPI_media_component_rm_parseFromJSON() failed [alt_ser_reqs_data]"); + goto end; + } + + alt_ser_reqs_dataList = OpenAPI_list_create(); + + cJSON_ArrayForEach(alt_ser_reqs_data_local, alt_ser_reqs_data) { + if (!cJSON_IsObject(alt_ser_reqs_data_local)) { + ogs_error("OpenAPI_media_component_rm_parseFromJSON() failed [alt_ser_reqs_data]"); + goto end; + } + OpenAPI_alternative_service_requirements_data_t *alt_ser_reqs_dataItem = OpenAPI_alternative_service_requirements_data_parseFromJSON(alt_ser_reqs_data_local); + if (!alt_ser_reqs_dataItem) { + ogs_error("No alt_ser_reqs_dataItem"); + OpenAPI_list_free(alt_ser_reqs_dataList); + goto end; + } + OpenAPI_list_add(alt_ser_reqs_dataList, alt_ser_reqs_dataItem); + } + } + dis_ue_notif = cJSON_GetObjectItemCaseSensitive(media_component_rmJSON, "disUeNotif"); if (dis_ue_notif) { if (!cJSON_IsBool(dis_ue_notif)) { @@ -897,11 +961,20 @@ OpenAPI_media_component_rm_t *OpenAPI_media_component_rm_parseFromJSON(cJSON *me tscai_input_ul_local_nonprim = OpenAPI_tscai_input_container_parseFromJSON(tscai_input_ul); } + tscai_time_dom = cJSON_GetObjectItemCaseSensitive(media_component_rmJSON, "tscaiTimeDom"); + if (tscai_time_dom) { + if (!cJSON_IsNumber(tscai_time_dom)) { + ogs_error("OpenAPI_media_component_rm_parseFromJSON() failed [tscai_time_dom]"); + goto end; + } + } + media_component_rm_local_var = OpenAPI_media_component_rm_create ( af_app_id && !cJSON_IsNull(af_app_id) ? ogs_strdup(af_app_id->valuestring) : NULL, af_rout_req ? af_rout_req_local_nonprim : NULL, qos_reference && !cJSON_IsNull(qos_reference) ? ogs_strdup(qos_reference->valuestring) : NULL, alt_ser_reqs ? alt_ser_reqsList : NULL, + alt_ser_reqs_data ? alt_ser_reqs_dataList : NULL, dis_ue_notif ? true : false, dis_ue_notif ? dis_ue_notif->valueint : 0, cont_ver ? true : false, @@ -941,7 +1014,9 @@ OpenAPI_media_component_rm_t *OpenAPI_media_component_rm_parseFromJSON(cJSON *me sharing_key_ul ? sharing_key_ul->valuedouble : 0, tsn_qos ? tsn_qos_local_nonprim : NULL, tscai_input_dl ? tscai_input_dl_local_nonprim : NULL, - tscai_input_ul ? tscai_input_ul_local_nonprim : NULL + tscai_input_ul ? tscai_input_ul_local_nonprim : NULL, + tscai_time_dom ? true : false, + tscai_time_dom ? tscai_time_dom->valuedouble : 0 ); return media_component_rm_local_var; @@ -957,6 +1032,13 @@ end: OpenAPI_list_free(alt_ser_reqsList); alt_ser_reqsList = NULL; } + if (alt_ser_reqs_dataList) { + OpenAPI_list_for_each(alt_ser_reqs_dataList, node) { + OpenAPI_alternative_service_requirements_data_free(node->data); + } + OpenAPI_list_free(alt_ser_reqs_dataList); + alt_ser_reqs_dataList = NULL; + } if (codecsList) { OpenAPI_list_for_each(codecsList, node) { ogs_free(node->data); diff --git a/lib/sbi/openapi/model/media_component_rm.h b/lib/sbi/openapi/model/media_component_rm.h index d11441a65..833f998f2 100644 --- a/lib/sbi/openapi/model/media_component_rm.h +++ b/lib/sbi/openapi/model/media_component_rm.h @@ -1,7 +1,7 @@ /* * media_component_rm.h * - * This data type is defined in the same way as the MediaComponent data type, but with the OpenAPI nullable property set to true + * This data type is defined in the same way as the MediaComponent data type, but with the OpenAPI nullable property set to true. */ #ifndef _OpenAPI_media_component_rm_H_ @@ -13,6 +13,7 @@ #include "../include/keyValuePair.h" #include "../include/binary.h" #include "af_routing_requirement_rm.h" +#include "alternative_service_requirements_data.h" #include "flow_status.h" #include "media_sub_component_rm.h" #include "media_type.h" @@ -33,6 +34,7 @@ typedef struct OpenAPI_media_component_rm_s { struct OpenAPI_af_routing_requirement_rm_s *af_rout_req; char *qos_reference; OpenAPI_list_t *alt_ser_reqs; + OpenAPI_list_t *alt_ser_reqs_data; bool is_dis_ue_notif; int dis_ue_notif; bool is_cont_ver; @@ -72,6 +74,8 @@ typedef struct OpenAPI_media_component_rm_s { struct OpenAPI_tsn_qos_container_rm_s *tsn_qos; struct OpenAPI_tscai_input_container_s *tscai_input_dl; struct OpenAPI_tscai_input_container_s *tscai_input_ul; + bool is_tscai_time_dom; + int tscai_time_dom; } OpenAPI_media_component_rm_t; OpenAPI_media_component_rm_t *OpenAPI_media_component_rm_create( @@ -79,6 +83,7 @@ OpenAPI_media_component_rm_t *OpenAPI_media_component_rm_create( OpenAPI_af_routing_requirement_rm_t *af_rout_req, char *qos_reference, OpenAPI_list_t *alt_ser_reqs, + OpenAPI_list_t *alt_ser_reqs_data, bool is_dis_ue_notif, int dis_ue_notif, bool is_cont_ver, @@ -117,7 +122,9 @@ OpenAPI_media_component_rm_t *OpenAPI_media_component_rm_create( int sharing_key_ul, OpenAPI_tsn_qos_container_rm_t *tsn_qos, OpenAPI_tscai_input_container_t *tscai_input_dl, - OpenAPI_tscai_input_container_t *tscai_input_ul + OpenAPI_tscai_input_container_t *tscai_input_ul, + bool is_tscai_time_dom, + int tscai_time_dom ); void OpenAPI_media_component_rm_free(OpenAPI_media_component_rm_t *media_component_rm); OpenAPI_media_component_rm_t *OpenAPI_media_component_rm_parseFromJSON(cJSON *media_component_rmJSON); diff --git a/lib/sbi/openapi/model/media_sub_component.h b/lib/sbi/openapi/model/media_sub_component.h index 03d63de7f..27fc7cd33 100644 --- a/lib/sbi/openapi/model/media_sub_component.h +++ b/lib/sbi/openapi/model/media_sub_component.h @@ -1,7 +1,7 @@ /* * media_sub_component.h * - * Identifies a media subcomponent + * Identifies a media subcomponent. */ #ifndef _OpenAPI_media_sub_component_H_ diff --git a/lib/sbi/openapi/model/media_sub_component_rm.h b/lib/sbi/openapi/model/media_sub_component_rm.h index a7040322c..3d7c2e7b0 100644 --- a/lib/sbi/openapi/model/media_sub_component_rm.h +++ b/lib/sbi/openapi/model/media_sub_component_rm.h @@ -1,7 +1,7 @@ /* * media_sub_component_rm.h * - * This data type is defined in the same way as the MediaSubComponent data type, but with the OpenAPI nullable property set to true. Removable attributes marBwDl and marBwUl are defined with the corresponding removable data type. + * This data type is defined in the same way as the MediaSubComponent data type, but with the OpenAPI nullable property set to true. Removable attributes marBwDl and marBwUl are defined with the corresponding removable data type. */ #ifndef _OpenAPI_media_sub_component_rm_H_ diff --git a/lib/sbi/openapi/model/message_waiting_data.h b/lib/sbi/openapi/model/message_waiting_data.h index 022684038..4808c27a6 100644 --- a/lib/sbi/openapi/model/message_waiting_data.h +++ b/lib/sbi/openapi/model/message_waiting_data.h @@ -1,7 +1,7 @@ /* * message_waiting_data.h * - * + * Message Waiting Data list. */ #ifndef _OpenAPI_message_waiting_data_H_ diff --git a/lib/sbi/openapi/model/mfaf_info.c b/lib/sbi/openapi/model/mfaf_info.c new file mode 100644 index 000000000..d4856c279 --- /dev/null +++ b/lib/sbi/openapi/model/mfaf_info.c @@ -0,0 +1,307 @@ + +#include +#include +#include +#include "mfaf_info.h" + +OpenAPI_mfaf_info_t *OpenAPI_mfaf_info_create( + OpenAPI_list_t *serving_nf_type_list, + OpenAPI_list_t *serving_nf_set_id_list, + OpenAPI_list_t *tai_list, + OpenAPI_list_t *tai_range_list +) +{ + OpenAPI_mfaf_info_t *mfaf_info_local_var = ogs_malloc(sizeof(OpenAPI_mfaf_info_t)); + ogs_assert(mfaf_info_local_var); + + mfaf_info_local_var->serving_nf_type_list = serving_nf_type_list; + mfaf_info_local_var->serving_nf_set_id_list = serving_nf_set_id_list; + mfaf_info_local_var->tai_list = tai_list; + mfaf_info_local_var->tai_range_list = tai_range_list; + + return mfaf_info_local_var; +} + +void OpenAPI_mfaf_info_free(OpenAPI_mfaf_info_t *mfaf_info) +{ + OpenAPI_lnode_t *node = NULL; + + if (NULL == mfaf_info) { + return; + } + if (mfaf_info->serving_nf_type_list) { + OpenAPI_list_free(mfaf_info->serving_nf_type_list); + mfaf_info->serving_nf_type_list = NULL; + } + if (mfaf_info->serving_nf_set_id_list) { + OpenAPI_list_for_each(mfaf_info->serving_nf_set_id_list, node) { + ogs_free(node->data); + } + OpenAPI_list_free(mfaf_info->serving_nf_set_id_list); + mfaf_info->serving_nf_set_id_list = NULL; + } + if (mfaf_info->tai_list) { + OpenAPI_list_for_each(mfaf_info->tai_list, node) { + OpenAPI_tai_free(node->data); + } + OpenAPI_list_free(mfaf_info->tai_list); + mfaf_info->tai_list = NULL; + } + if (mfaf_info->tai_range_list) { + OpenAPI_list_for_each(mfaf_info->tai_range_list, node) { + OpenAPI_tai_range_free(node->data); + } + OpenAPI_list_free(mfaf_info->tai_range_list); + mfaf_info->tai_range_list = NULL; + } + ogs_free(mfaf_info); +} + +cJSON *OpenAPI_mfaf_info_convertToJSON(OpenAPI_mfaf_info_t *mfaf_info) +{ + cJSON *item = NULL; + OpenAPI_lnode_t *node = NULL; + + if (mfaf_info == NULL) { + ogs_error("OpenAPI_mfaf_info_convertToJSON() failed [MfafInfo]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (mfaf_info->serving_nf_type_list != OpenAPI_nf_type_NULL) { + cJSON *serving_nf_type_listList = cJSON_AddArrayToObject(item, "servingNfTypeList"); + if (serving_nf_type_listList == NULL) { + ogs_error("OpenAPI_mfaf_info_convertToJSON() failed [serving_nf_type_list]"); + goto end; + } + OpenAPI_list_for_each(mfaf_info->serving_nf_type_list, node) { + if (cJSON_AddStringToObject(serving_nf_type_listList, "", OpenAPI_nf_type_ToString((intptr_t)node->data)) == NULL) { + ogs_error("OpenAPI_mfaf_info_convertToJSON() failed [serving_nf_type_list]"); + goto end; + } + } + } + + if (mfaf_info->serving_nf_set_id_list) { + cJSON *serving_nf_set_id_listList = cJSON_AddArrayToObject(item, "servingNfSetIdList"); + if (serving_nf_set_id_listList == NULL) { + ogs_error("OpenAPI_mfaf_info_convertToJSON() failed [serving_nf_set_id_list]"); + goto end; + } + OpenAPI_list_for_each(mfaf_info->serving_nf_set_id_list, node) { + if (cJSON_AddStringToObject(serving_nf_set_id_listList, "", (char*)node->data) == NULL) { + ogs_error("OpenAPI_mfaf_info_convertToJSON() failed [serving_nf_set_id_list]"); + goto end; + } + } + } + + if (mfaf_info->tai_list) { + cJSON *tai_listList = cJSON_AddArrayToObject(item, "taiList"); + if (tai_listList == NULL) { + ogs_error("OpenAPI_mfaf_info_convertToJSON() failed [tai_list]"); + goto end; + } + OpenAPI_list_for_each(mfaf_info->tai_list, node) { + cJSON *itemLocal = OpenAPI_tai_convertToJSON(node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_mfaf_info_convertToJSON() failed [tai_list]"); + goto end; + } + cJSON_AddItemToArray(tai_listList, itemLocal); + } + } + + if (mfaf_info->tai_range_list) { + cJSON *tai_range_listList = cJSON_AddArrayToObject(item, "taiRangeList"); + if (tai_range_listList == NULL) { + ogs_error("OpenAPI_mfaf_info_convertToJSON() failed [tai_range_list]"); + goto end; + } + OpenAPI_list_for_each(mfaf_info->tai_range_list, node) { + cJSON *itemLocal = OpenAPI_tai_range_convertToJSON(node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_mfaf_info_convertToJSON() failed [tai_range_list]"); + goto end; + } + cJSON_AddItemToArray(tai_range_listList, itemLocal); + } + } + +end: + return item; +} + +OpenAPI_mfaf_info_t *OpenAPI_mfaf_info_parseFromJSON(cJSON *mfaf_infoJSON) +{ + OpenAPI_mfaf_info_t *mfaf_info_local_var = NULL; + OpenAPI_lnode_t *node = NULL; + cJSON *serving_nf_type_list = NULL; + OpenAPI_list_t *serving_nf_type_listList = NULL; + cJSON *serving_nf_set_id_list = NULL; + OpenAPI_list_t *serving_nf_set_id_listList = NULL; + cJSON *tai_list = NULL; + OpenAPI_list_t *tai_listList = NULL; + cJSON *tai_range_list = NULL; + OpenAPI_list_t *tai_range_listList = NULL; + serving_nf_type_list = cJSON_GetObjectItemCaseSensitive(mfaf_infoJSON, "servingNfTypeList"); + if (serving_nf_type_list) { + cJSON *serving_nf_type_list_local = NULL; + if (!cJSON_IsArray(serving_nf_type_list)) { + ogs_error("OpenAPI_mfaf_info_parseFromJSON() failed [serving_nf_type_list]"); + goto end; + } + + serving_nf_type_listList = OpenAPI_list_create(); + + cJSON_ArrayForEach(serving_nf_type_list_local, serving_nf_type_list) { + if (!cJSON_IsString(serving_nf_type_list_local)) { + ogs_error("OpenAPI_mfaf_info_parseFromJSON() failed [serving_nf_type_list]"); + goto end; + } + OpenAPI_list_add(serving_nf_type_listList, (void *)OpenAPI_nf_type_FromString(serving_nf_type_list_local->valuestring)); + } + } + + serving_nf_set_id_list = cJSON_GetObjectItemCaseSensitive(mfaf_infoJSON, "servingNfSetIdList"); + if (serving_nf_set_id_list) { + cJSON *serving_nf_set_id_list_local = NULL; + if (!cJSON_IsArray(serving_nf_set_id_list)) { + ogs_error("OpenAPI_mfaf_info_parseFromJSON() failed [serving_nf_set_id_list]"); + goto end; + } + + serving_nf_set_id_listList = OpenAPI_list_create(); + + cJSON_ArrayForEach(serving_nf_set_id_list_local, serving_nf_set_id_list) { + double *localDouble = NULL; + int *localInt = NULL; + if (!cJSON_IsString(serving_nf_set_id_list_local)) { + ogs_error("OpenAPI_mfaf_info_parseFromJSON() failed [serving_nf_set_id_list]"); + goto end; + } + OpenAPI_list_add(serving_nf_set_id_listList, ogs_strdup(serving_nf_set_id_list_local->valuestring)); + } + } + + tai_list = cJSON_GetObjectItemCaseSensitive(mfaf_infoJSON, "taiList"); + if (tai_list) { + cJSON *tai_list_local = NULL; + if (!cJSON_IsArray(tai_list)) { + ogs_error("OpenAPI_mfaf_info_parseFromJSON() failed [tai_list]"); + goto end; + } + + tai_listList = OpenAPI_list_create(); + + cJSON_ArrayForEach(tai_list_local, tai_list) { + if (!cJSON_IsObject(tai_list_local)) { + ogs_error("OpenAPI_mfaf_info_parseFromJSON() failed [tai_list]"); + goto end; + } + OpenAPI_tai_t *tai_listItem = OpenAPI_tai_parseFromJSON(tai_list_local); + if (!tai_listItem) { + ogs_error("No tai_listItem"); + OpenAPI_list_free(tai_listList); + goto end; + } + OpenAPI_list_add(tai_listList, tai_listItem); + } + } + + tai_range_list = cJSON_GetObjectItemCaseSensitive(mfaf_infoJSON, "taiRangeList"); + if (tai_range_list) { + cJSON *tai_range_list_local = NULL; + if (!cJSON_IsArray(tai_range_list)) { + ogs_error("OpenAPI_mfaf_info_parseFromJSON() failed [tai_range_list]"); + goto end; + } + + tai_range_listList = OpenAPI_list_create(); + + cJSON_ArrayForEach(tai_range_list_local, tai_range_list) { + if (!cJSON_IsObject(tai_range_list_local)) { + ogs_error("OpenAPI_mfaf_info_parseFromJSON() failed [tai_range_list]"); + goto end; + } + OpenAPI_tai_range_t *tai_range_listItem = OpenAPI_tai_range_parseFromJSON(tai_range_list_local); + if (!tai_range_listItem) { + ogs_error("No tai_range_listItem"); + OpenAPI_list_free(tai_range_listList); + goto end; + } + OpenAPI_list_add(tai_range_listList, tai_range_listItem); + } + } + + mfaf_info_local_var = OpenAPI_mfaf_info_create ( + serving_nf_type_list ? serving_nf_type_listList : NULL, + serving_nf_set_id_list ? serving_nf_set_id_listList : NULL, + tai_list ? tai_listList : NULL, + tai_range_list ? tai_range_listList : NULL + ); + + return mfaf_info_local_var; +end: + if (serving_nf_type_listList) { + OpenAPI_list_free(serving_nf_type_listList); + serving_nf_type_listList = NULL; + } + if (serving_nf_set_id_listList) { + OpenAPI_list_for_each(serving_nf_set_id_listList, node) { + ogs_free(node->data); + } + OpenAPI_list_free(serving_nf_set_id_listList); + serving_nf_set_id_listList = NULL; + } + if (tai_listList) { + OpenAPI_list_for_each(tai_listList, node) { + OpenAPI_tai_free(node->data); + } + OpenAPI_list_free(tai_listList); + tai_listList = NULL; + } + if (tai_range_listList) { + OpenAPI_list_for_each(tai_range_listList, node) { + OpenAPI_tai_range_free(node->data); + } + OpenAPI_list_free(tai_range_listList); + tai_range_listList = NULL; + } + return NULL; +} + +OpenAPI_mfaf_info_t *OpenAPI_mfaf_info_copy(OpenAPI_mfaf_info_t *dst, OpenAPI_mfaf_info_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_mfaf_info_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_mfaf_info_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_mfaf_info_free(dst); + dst = OpenAPI_mfaf_info_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/mfaf_info.h b/lib/sbi/openapi/model/mfaf_info.h new file mode 100644 index 000000000..385ee8344 --- /dev/null +++ b/lib/sbi/openapi/model/mfaf_info.h @@ -0,0 +1,47 @@ +/* + * mfaf_info.h + * + * Information of a MFAF NF Instance + */ + +#ifndef _OpenAPI_mfaf_info_H_ +#define _OpenAPI_mfaf_info_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "nf_type.h" +#include "tai.h" +#include "tai_range.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_mfaf_info_s OpenAPI_mfaf_info_t; +typedef struct OpenAPI_mfaf_info_s { + OpenAPI_list_t *serving_nf_type_list; + OpenAPI_list_t *serving_nf_set_id_list; + OpenAPI_list_t *tai_list; + OpenAPI_list_t *tai_range_list; +} OpenAPI_mfaf_info_t; + +OpenAPI_mfaf_info_t *OpenAPI_mfaf_info_create( + OpenAPI_list_t *serving_nf_type_list, + OpenAPI_list_t *serving_nf_set_id_list, + OpenAPI_list_t *tai_list, + OpenAPI_list_t *tai_range_list +); +void OpenAPI_mfaf_info_free(OpenAPI_mfaf_info_t *mfaf_info); +OpenAPI_mfaf_info_t *OpenAPI_mfaf_info_parseFromJSON(cJSON *mfaf_infoJSON); +cJSON *OpenAPI_mfaf_info_convertToJSON(OpenAPI_mfaf_info_t *mfaf_info); +OpenAPI_mfaf_info_t *OpenAPI_mfaf_info_copy(OpenAPI_mfaf_info_t *dst, OpenAPI_mfaf_info_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_mfaf_info_H_ */ + diff --git a/lib/sbi/openapi/model/ml_analytics_info.c b/lib/sbi/openapi/model/ml_analytics_info.c new file mode 100644 index 000000000..71c67fa27 --- /dev/null +++ b/lib/sbi/openapi/model/ml_analytics_info.c @@ -0,0 +1,267 @@ + +#include +#include +#include +#include "ml_analytics_info.h" + +OpenAPI_ml_analytics_info_t *OpenAPI_ml_analytics_info_create( + OpenAPI_list_t *ml_analytics_ids, + OpenAPI_list_t *snssai_list, + OpenAPI_list_t *tracking_area_list +) +{ + OpenAPI_ml_analytics_info_t *ml_analytics_info_local_var = ogs_malloc(sizeof(OpenAPI_ml_analytics_info_t)); + ogs_assert(ml_analytics_info_local_var); + + ml_analytics_info_local_var->ml_analytics_ids = ml_analytics_ids; + ml_analytics_info_local_var->snssai_list = snssai_list; + ml_analytics_info_local_var->tracking_area_list = tracking_area_list; + + return ml_analytics_info_local_var; +} + +void OpenAPI_ml_analytics_info_free(OpenAPI_ml_analytics_info_t *ml_analytics_info) +{ + OpenAPI_lnode_t *node = NULL; + + if (NULL == ml_analytics_info) { + return; + } + if (ml_analytics_info->ml_analytics_ids) { + OpenAPI_list_for_each(ml_analytics_info->ml_analytics_ids, node) { + OpenAPI_nwdaf_event_free(node->data); + } + OpenAPI_list_free(ml_analytics_info->ml_analytics_ids); + ml_analytics_info->ml_analytics_ids = NULL; + } + if (ml_analytics_info->snssai_list) { + OpenAPI_list_for_each(ml_analytics_info->snssai_list, node) { + OpenAPI_snssai_free(node->data); + } + OpenAPI_list_free(ml_analytics_info->snssai_list); + ml_analytics_info->snssai_list = NULL; + } + if (ml_analytics_info->tracking_area_list) { + OpenAPI_list_for_each(ml_analytics_info->tracking_area_list, node) { + OpenAPI_tai_free(node->data); + } + OpenAPI_list_free(ml_analytics_info->tracking_area_list); + ml_analytics_info->tracking_area_list = NULL; + } + ogs_free(ml_analytics_info); +} + +cJSON *OpenAPI_ml_analytics_info_convertToJSON(OpenAPI_ml_analytics_info_t *ml_analytics_info) +{ + cJSON *item = NULL; + OpenAPI_lnode_t *node = NULL; + + if (ml_analytics_info == NULL) { + ogs_error("OpenAPI_ml_analytics_info_convertToJSON() failed [MlAnalyticsInfo]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (ml_analytics_info->ml_analytics_ids) { + cJSON *ml_analytics_idsList = cJSON_AddArrayToObject(item, "mlAnalyticsIds"); + if (ml_analytics_idsList == NULL) { + ogs_error("OpenAPI_ml_analytics_info_convertToJSON() failed [ml_analytics_ids]"); + goto end; + } + OpenAPI_list_for_each(ml_analytics_info->ml_analytics_ids, node) { + cJSON *itemLocal = OpenAPI_nwdaf_event_convertToJSON(node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_ml_analytics_info_convertToJSON() failed [ml_analytics_ids]"); + goto end; + } + cJSON_AddItemToArray(ml_analytics_idsList, itemLocal); + } + } + + if (ml_analytics_info->snssai_list) { + cJSON *snssai_listList = cJSON_AddArrayToObject(item, "snssaiList"); + if (snssai_listList == NULL) { + ogs_error("OpenAPI_ml_analytics_info_convertToJSON() failed [snssai_list]"); + goto end; + } + OpenAPI_list_for_each(ml_analytics_info->snssai_list, node) { + cJSON *itemLocal = OpenAPI_snssai_convertToJSON(node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_ml_analytics_info_convertToJSON() failed [snssai_list]"); + goto end; + } + cJSON_AddItemToArray(snssai_listList, itemLocal); + } + } + + if (ml_analytics_info->tracking_area_list) { + cJSON *tracking_area_listList = cJSON_AddArrayToObject(item, "trackingAreaList"); + if (tracking_area_listList == NULL) { + ogs_error("OpenAPI_ml_analytics_info_convertToJSON() failed [tracking_area_list]"); + goto end; + } + OpenAPI_list_for_each(ml_analytics_info->tracking_area_list, node) { + cJSON *itemLocal = OpenAPI_tai_convertToJSON(node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_ml_analytics_info_convertToJSON() failed [tracking_area_list]"); + goto end; + } + cJSON_AddItemToArray(tracking_area_listList, itemLocal); + } + } + +end: + return item; +} + +OpenAPI_ml_analytics_info_t *OpenAPI_ml_analytics_info_parseFromJSON(cJSON *ml_analytics_infoJSON) +{ + OpenAPI_ml_analytics_info_t *ml_analytics_info_local_var = NULL; + OpenAPI_lnode_t *node = NULL; + cJSON *ml_analytics_ids = NULL; + OpenAPI_list_t *ml_analytics_idsList = NULL; + cJSON *snssai_list = NULL; + OpenAPI_list_t *snssai_listList = NULL; + cJSON *tracking_area_list = NULL; + OpenAPI_list_t *tracking_area_listList = NULL; + ml_analytics_ids = cJSON_GetObjectItemCaseSensitive(ml_analytics_infoJSON, "mlAnalyticsIds"); + if (ml_analytics_ids) { + cJSON *ml_analytics_ids_local = NULL; + if (!cJSON_IsArray(ml_analytics_ids)) { + ogs_error("OpenAPI_ml_analytics_info_parseFromJSON() failed [ml_analytics_ids]"); + goto end; + } + + ml_analytics_idsList = OpenAPI_list_create(); + + cJSON_ArrayForEach(ml_analytics_ids_local, ml_analytics_ids) { + if (!cJSON_IsObject(ml_analytics_ids_local)) { + ogs_error("OpenAPI_ml_analytics_info_parseFromJSON() failed [ml_analytics_ids]"); + goto end; + } + OpenAPI_nwdaf_event_t *ml_analytics_idsItem = OpenAPI_nwdaf_event_parseFromJSON(ml_analytics_ids_local); + if (!ml_analytics_idsItem) { + ogs_error("No ml_analytics_idsItem"); + OpenAPI_list_free(ml_analytics_idsList); + goto end; + } + OpenAPI_list_add(ml_analytics_idsList, ml_analytics_idsItem); + } + } + + snssai_list = cJSON_GetObjectItemCaseSensitive(ml_analytics_infoJSON, "snssaiList"); + if (snssai_list) { + cJSON *snssai_list_local = NULL; + if (!cJSON_IsArray(snssai_list)) { + ogs_error("OpenAPI_ml_analytics_info_parseFromJSON() failed [snssai_list]"); + goto end; + } + + snssai_listList = OpenAPI_list_create(); + + cJSON_ArrayForEach(snssai_list_local, snssai_list) { + if (!cJSON_IsObject(snssai_list_local)) { + ogs_error("OpenAPI_ml_analytics_info_parseFromJSON() failed [snssai_list]"); + goto end; + } + OpenAPI_snssai_t *snssai_listItem = OpenAPI_snssai_parseFromJSON(snssai_list_local); + if (!snssai_listItem) { + ogs_error("No snssai_listItem"); + OpenAPI_list_free(snssai_listList); + goto end; + } + OpenAPI_list_add(snssai_listList, snssai_listItem); + } + } + + tracking_area_list = cJSON_GetObjectItemCaseSensitive(ml_analytics_infoJSON, "trackingAreaList"); + if (tracking_area_list) { + cJSON *tracking_area_list_local = NULL; + if (!cJSON_IsArray(tracking_area_list)) { + ogs_error("OpenAPI_ml_analytics_info_parseFromJSON() failed [tracking_area_list]"); + goto end; + } + + tracking_area_listList = OpenAPI_list_create(); + + cJSON_ArrayForEach(tracking_area_list_local, tracking_area_list) { + if (!cJSON_IsObject(tracking_area_list_local)) { + ogs_error("OpenAPI_ml_analytics_info_parseFromJSON() failed [tracking_area_list]"); + goto end; + } + OpenAPI_tai_t *tracking_area_listItem = OpenAPI_tai_parseFromJSON(tracking_area_list_local); + if (!tracking_area_listItem) { + ogs_error("No tracking_area_listItem"); + OpenAPI_list_free(tracking_area_listList); + goto end; + } + OpenAPI_list_add(tracking_area_listList, tracking_area_listItem); + } + } + + ml_analytics_info_local_var = OpenAPI_ml_analytics_info_create ( + ml_analytics_ids ? ml_analytics_idsList : NULL, + snssai_list ? snssai_listList : NULL, + tracking_area_list ? tracking_area_listList : NULL + ); + + return ml_analytics_info_local_var; +end: + if (ml_analytics_idsList) { + OpenAPI_list_for_each(ml_analytics_idsList, node) { + OpenAPI_nwdaf_event_free(node->data); + } + OpenAPI_list_free(ml_analytics_idsList); + ml_analytics_idsList = NULL; + } + if (snssai_listList) { + OpenAPI_list_for_each(snssai_listList, node) { + OpenAPI_snssai_free(node->data); + } + OpenAPI_list_free(snssai_listList); + snssai_listList = NULL; + } + if (tracking_area_listList) { + OpenAPI_list_for_each(tracking_area_listList, node) { + OpenAPI_tai_free(node->data); + } + OpenAPI_list_free(tracking_area_listList); + tracking_area_listList = NULL; + } + return NULL; +} + +OpenAPI_ml_analytics_info_t *OpenAPI_ml_analytics_info_copy(OpenAPI_ml_analytics_info_t *dst, OpenAPI_ml_analytics_info_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_ml_analytics_info_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_ml_analytics_info_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_ml_analytics_info_free(dst); + dst = OpenAPI_ml_analytics_info_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/ml_analytics_info.h b/lib/sbi/openapi/model/ml_analytics_info.h new file mode 100644 index 000000000..c23730681 --- /dev/null +++ b/lib/sbi/openapi/model/ml_analytics_info.h @@ -0,0 +1,45 @@ +/* + * ml_analytics_info.h + * + * ML Analytics Filter information supported by the Nnwdaf_MLModelProvision service + */ + +#ifndef _OpenAPI_ml_analytics_info_H_ +#define _OpenAPI_ml_analytics_info_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "nwdaf_event.h" +#include "snssai.h" +#include "tai.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_ml_analytics_info_s OpenAPI_ml_analytics_info_t; +typedef struct OpenAPI_ml_analytics_info_s { + OpenAPI_list_t *ml_analytics_ids; + OpenAPI_list_t *snssai_list; + OpenAPI_list_t *tracking_area_list; +} OpenAPI_ml_analytics_info_t; + +OpenAPI_ml_analytics_info_t *OpenAPI_ml_analytics_info_create( + OpenAPI_list_t *ml_analytics_ids, + OpenAPI_list_t *snssai_list, + OpenAPI_list_t *tracking_area_list +); +void OpenAPI_ml_analytics_info_free(OpenAPI_ml_analytics_info_t *ml_analytics_info); +OpenAPI_ml_analytics_info_t *OpenAPI_ml_analytics_info_parseFromJSON(cJSON *ml_analytics_infoJSON); +cJSON *OpenAPI_ml_analytics_info_convertToJSON(OpenAPI_ml_analytics_info_t *ml_analytics_info); +OpenAPI_ml_analytics_info_t *OpenAPI_ml_analytics_info_copy(OpenAPI_ml_analytics_info_t *dst, OpenAPI_ml_analytics_info_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_ml_analytics_info_H_ */ + diff --git a/lib/sbi/openapi/model/mm_context.c b/lib/sbi/openapi/model/mm_context.c index e2aa09f27..af669e0d7 100644 --- a/lib/sbi/openapi/model/mm_context.c +++ b/lib/sbi/openapi/model/mm_context.c @@ -29,7 +29,8 @@ OpenAPI_mm_context_t *OpenAPI_mm_context_create( bool is_an_n2_ap_id, int an_n2_ap_id, OpenAPI_list_t *nssaa_status_list, - OpenAPI_list_t *pending_nssai_mapping_list + OpenAPI_list_t *pending_nssai_mapping_list, + OpenAPI_uuaa_mm_status_e uuaa_mm_status ) { OpenAPI_mm_context_t *mm_context_local_var = ogs_malloc(sizeof(OpenAPI_mm_context_t)); @@ -60,6 +61,7 @@ OpenAPI_mm_context_t *OpenAPI_mm_context_create( mm_context_local_var->an_n2_ap_id = an_n2_ap_id; mm_context_local_var->nssaa_status_list = nssaa_status_list; mm_context_local_var->pending_nssai_mapping_list = pending_nssai_mapping_list; + mm_context_local_var->uuaa_mm_status = uuaa_mm_status; return mm_context_local_var; } @@ -425,6 +427,13 @@ cJSON *OpenAPI_mm_context_convertToJSON(OpenAPI_mm_context_t *mm_context) } } + if (mm_context->uuaa_mm_status != OpenAPI_uuaa_mm_status_NULL) { + if (cJSON_AddStringToObject(item, "uuaaMmStatus", OpenAPI_uuaa_mm_status_ToString(mm_context->uuaa_mm_status)) == NULL) { + ogs_error("OpenAPI_mm_context_convertToJSON() failed [uuaa_mm_status]"); + goto end; + } + } + end: return item; } @@ -469,6 +478,8 @@ OpenAPI_mm_context_t *OpenAPI_mm_context_parseFromJSON(cJSON *mm_contextJSON) OpenAPI_list_t *nssaa_status_listList = NULL; cJSON *pending_nssai_mapping_list = NULL; OpenAPI_list_t *pending_nssai_mapping_listList = NULL; + cJSON *uuaa_mm_status = NULL; + OpenAPI_uuaa_mm_status_e uuaa_mm_statusVariable = 0; access_type = cJSON_GetObjectItemCaseSensitive(mm_contextJSON, "accessType"); if (!access_type) { ogs_error("OpenAPI_mm_context_parseFromJSON() failed [access_type]"); @@ -725,6 +736,15 @@ OpenAPI_mm_context_t *OpenAPI_mm_context_parseFromJSON(cJSON *mm_contextJSON) } } + uuaa_mm_status = cJSON_GetObjectItemCaseSensitive(mm_contextJSON, "uuaaMmStatus"); + if (uuaa_mm_status) { + if (!cJSON_IsString(uuaa_mm_status)) { + ogs_error("OpenAPI_mm_context_parseFromJSON() failed [uuaa_mm_status]"); + goto end; + } + uuaa_mm_statusVariable = OpenAPI_uuaa_mm_status_FromString(uuaa_mm_status->valuestring); + } + mm_context_local_var = OpenAPI_mm_context_create ( access_typeVariable, nas_security_mode ? nas_security_mode_local_nonprim : NULL, @@ -750,7 +770,8 @@ OpenAPI_mm_context_t *OpenAPI_mm_context_parseFromJSON(cJSON *mm_contextJSON) an_n2_ap_id ? true : false, an_n2_ap_id ? an_n2_ap_id->valuedouble : 0, nssaa_status_list ? nssaa_status_listList : NULL, - pending_nssai_mapping_list ? pending_nssai_mapping_listList : NULL + pending_nssai_mapping_list ? pending_nssai_mapping_listList : NULL, + uuaa_mm_status ? uuaa_mm_statusVariable : 0 ); return mm_context_local_var; diff --git a/lib/sbi/openapi/model/mm_context.h b/lib/sbi/openapi/model/mm_context.h index 7ccdc8ed0..e8bd89e7b 100644 --- a/lib/sbi/openapi/model/mm_context.h +++ b/lib/sbi/openapi/model/mm_context.h @@ -1,7 +1,7 @@ /* * mm_context.h * - * + * Represents a Mobility Management Context in UE Context */ #ifndef _OpenAPI_mm_context_H_ @@ -21,6 +21,7 @@ #include "nssai_mapping.h" #include "snssai.h" #include "ue_differentiation_info.h" +#include "uuaa_mm_status.h" #ifdef __cplusplus extern "C" { @@ -53,6 +54,7 @@ typedef struct OpenAPI_mm_context_s { int an_n2_ap_id; OpenAPI_list_t *nssaa_status_list; OpenAPI_list_t *pending_nssai_mapping_list; + OpenAPI_uuaa_mm_status_e uuaa_mm_status; } OpenAPI_mm_context_t; OpenAPI_mm_context_t *OpenAPI_mm_context_create( @@ -80,7 +82,8 @@ OpenAPI_mm_context_t *OpenAPI_mm_context_create( bool is_an_n2_ap_id, int an_n2_ap_id, OpenAPI_list_t *nssaa_status_list, - OpenAPI_list_t *pending_nssai_mapping_list + OpenAPI_list_t *pending_nssai_mapping_list, + OpenAPI_uuaa_mm_status_e uuaa_mm_status ); void OpenAPI_mm_context_free(OpenAPI_mm_context_t *mm_context); OpenAPI_mm_context_t *OpenAPI_mm_context_parseFromJSON(cJSON *mm_contextJSON); diff --git a/lib/sbi/openapi/model/mme_capabilities.c b/lib/sbi/openapi/model/mme_capabilities.c index cfd30bbe9..852f11ad7 100644 --- a/lib/sbi/openapi/model/mme_capabilities.c +++ b/lib/sbi/openapi/model/mme_capabilities.c @@ -8,7 +8,9 @@ OpenAPI_mme_capabilities_t *OpenAPI_mme_capabilities_create( bool is_non_ip_supported, int non_ip_supported, bool is_ethernet_supported, - int ethernet_supported + int ethernet_supported, + bool is_upip_supported, + int upip_supported ) { OpenAPI_mme_capabilities_t *mme_capabilities_local_var = ogs_malloc(sizeof(OpenAPI_mme_capabilities_t)); @@ -18,6 +20,8 @@ OpenAPI_mme_capabilities_t *OpenAPI_mme_capabilities_create( mme_capabilities_local_var->non_ip_supported = non_ip_supported; mme_capabilities_local_var->is_ethernet_supported = is_ethernet_supported; mme_capabilities_local_var->ethernet_supported = ethernet_supported; + mme_capabilities_local_var->is_upip_supported = is_upip_supported; + mme_capabilities_local_var->upip_supported = upip_supported; return mme_capabilities_local_var; } @@ -57,6 +61,13 @@ cJSON *OpenAPI_mme_capabilities_convertToJSON(OpenAPI_mme_capabilities_t *mme_ca } } + if (mme_capabilities->is_upip_supported) { + if (cJSON_AddBoolToObject(item, "upipSupported", mme_capabilities->upip_supported) == NULL) { + ogs_error("OpenAPI_mme_capabilities_convertToJSON() failed [upip_supported]"); + goto end; + } + } + end: return item; } @@ -67,6 +78,7 @@ OpenAPI_mme_capabilities_t *OpenAPI_mme_capabilities_parseFromJSON(cJSON *mme_ca OpenAPI_lnode_t *node = NULL; cJSON *non_ip_supported = NULL; cJSON *ethernet_supported = NULL; + cJSON *upip_supported = NULL; non_ip_supported = cJSON_GetObjectItemCaseSensitive(mme_capabilitiesJSON, "nonIpSupported"); if (non_ip_supported) { if (!cJSON_IsBool(non_ip_supported)) { @@ -83,11 +95,21 @@ OpenAPI_mme_capabilities_t *OpenAPI_mme_capabilities_parseFromJSON(cJSON *mme_ca } } + upip_supported = cJSON_GetObjectItemCaseSensitive(mme_capabilitiesJSON, "upipSupported"); + if (upip_supported) { + if (!cJSON_IsBool(upip_supported)) { + ogs_error("OpenAPI_mme_capabilities_parseFromJSON() failed [upip_supported]"); + goto end; + } + } + mme_capabilities_local_var = OpenAPI_mme_capabilities_create ( non_ip_supported ? true : false, non_ip_supported ? non_ip_supported->valueint : 0, ethernet_supported ? true : false, - ethernet_supported ? ethernet_supported->valueint : 0 + ethernet_supported ? ethernet_supported->valueint : 0, + upip_supported ? true : false, + upip_supported ? upip_supported->valueint : 0 ); return mme_capabilities_local_var; diff --git a/lib/sbi/openapi/model/mme_capabilities.h b/lib/sbi/openapi/model/mme_capabilities.h index eeb9c882d..2695db1a5 100644 --- a/lib/sbi/openapi/model/mme_capabilities.h +++ b/lib/sbi/openapi/model/mme_capabilities.h @@ -1,7 +1,7 @@ /* * mme_capabilities.h * - * + * MME capabilities */ #ifndef _OpenAPI_mme_capabilities_H_ @@ -23,13 +23,17 @@ typedef struct OpenAPI_mme_capabilities_s { int non_ip_supported; bool is_ethernet_supported; int ethernet_supported; + bool is_upip_supported; + int upip_supported; } OpenAPI_mme_capabilities_t; OpenAPI_mme_capabilities_t *OpenAPI_mme_capabilities_create( bool is_non_ip_supported, int non_ip_supported, bool is_ethernet_supported, - int ethernet_supported + int ethernet_supported, + bool is_upip_supported, + int upip_supported ); void OpenAPI_mme_capabilities_free(OpenAPI_mme_capabilities_t *mme_capabilities); OpenAPI_mme_capabilities_t *OpenAPI_mme_capabilities_parseFromJSON(cJSON *mme_capabilitiesJSON); diff --git a/lib/sbi/openapi/model/mnpf_info.c b/lib/sbi/openapi/model/mnpf_info.c new file mode 100644 index 000000000..618c6e5ac --- /dev/null +++ b/lib/sbi/openapi/model/mnpf_info.c @@ -0,0 +1,151 @@ + +#include +#include +#include +#include "mnpf_info.h" + +OpenAPI_mnpf_info_t *OpenAPI_mnpf_info_create( + OpenAPI_list_t *msisdn_ranges +) +{ + OpenAPI_mnpf_info_t *mnpf_info_local_var = ogs_malloc(sizeof(OpenAPI_mnpf_info_t)); + ogs_assert(mnpf_info_local_var); + + mnpf_info_local_var->msisdn_ranges = msisdn_ranges; + + return mnpf_info_local_var; +} + +void OpenAPI_mnpf_info_free(OpenAPI_mnpf_info_t *mnpf_info) +{ + OpenAPI_lnode_t *node = NULL; + + if (NULL == mnpf_info) { + return; + } + if (mnpf_info->msisdn_ranges) { + OpenAPI_list_for_each(mnpf_info->msisdn_ranges, node) { + OpenAPI_identity_range_free(node->data); + } + OpenAPI_list_free(mnpf_info->msisdn_ranges); + mnpf_info->msisdn_ranges = NULL; + } + ogs_free(mnpf_info); +} + +cJSON *OpenAPI_mnpf_info_convertToJSON(OpenAPI_mnpf_info_t *mnpf_info) +{ + cJSON *item = NULL; + OpenAPI_lnode_t *node = NULL; + + if (mnpf_info == NULL) { + ogs_error("OpenAPI_mnpf_info_convertToJSON() failed [MnpfInfo]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (!mnpf_info->msisdn_ranges) { + ogs_error("OpenAPI_mnpf_info_convertToJSON() failed [msisdn_ranges]"); + return NULL; + } + cJSON *msisdn_rangesList = cJSON_AddArrayToObject(item, "msisdnRanges"); + if (msisdn_rangesList == NULL) { + ogs_error("OpenAPI_mnpf_info_convertToJSON() failed [msisdn_ranges]"); + goto end; + } + OpenAPI_list_for_each(mnpf_info->msisdn_ranges, node) { + cJSON *itemLocal = OpenAPI_identity_range_convertToJSON(node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_mnpf_info_convertToJSON() failed [msisdn_ranges]"); + goto end; + } + cJSON_AddItemToArray(msisdn_rangesList, itemLocal); + } + +end: + return item; +} + +OpenAPI_mnpf_info_t *OpenAPI_mnpf_info_parseFromJSON(cJSON *mnpf_infoJSON) +{ + OpenAPI_mnpf_info_t *mnpf_info_local_var = NULL; + OpenAPI_lnode_t *node = NULL; + cJSON *msisdn_ranges = NULL; + OpenAPI_list_t *msisdn_rangesList = NULL; + msisdn_ranges = cJSON_GetObjectItemCaseSensitive(mnpf_infoJSON, "msisdnRanges"); + if (!msisdn_ranges) { + ogs_error("OpenAPI_mnpf_info_parseFromJSON() failed [msisdn_ranges]"); + goto end; + } + cJSON *msisdn_ranges_local = NULL; + if (!cJSON_IsArray(msisdn_ranges)) { + ogs_error("OpenAPI_mnpf_info_parseFromJSON() failed [msisdn_ranges]"); + goto end; + } + + msisdn_rangesList = OpenAPI_list_create(); + + cJSON_ArrayForEach(msisdn_ranges_local, msisdn_ranges) { + if (!cJSON_IsObject(msisdn_ranges_local)) { + ogs_error("OpenAPI_mnpf_info_parseFromJSON() failed [msisdn_ranges]"); + goto end; + } + OpenAPI_identity_range_t *msisdn_rangesItem = OpenAPI_identity_range_parseFromJSON(msisdn_ranges_local); + if (!msisdn_rangesItem) { + ogs_error("No msisdn_rangesItem"); + OpenAPI_list_free(msisdn_rangesList); + goto end; + } + OpenAPI_list_add(msisdn_rangesList, msisdn_rangesItem); + } + + mnpf_info_local_var = OpenAPI_mnpf_info_create ( + msisdn_rangesList + ); + + return mnpf_info_local_var; +end: + if (msisdn_rangesList) { + OpenAPI_list_for_each(msisdn_rangesList, node) { + OpenAPI_identity_range_free(node->data); + } + OpenAPI_list_free(msisdn_rangesList); + msisdn_rangesList = NULL; + } + return NULL; +} + +OpenAPI_mnpf_info_t *OpenAPI_mnpf_info_copy(OpenAPI_mnpf_info_t *dst, OpenAPI_mnpf_info_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_mnpf_info_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_mnpf_info_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_mnpf_info_free(dst); + dst = OpenAPI_mnpf_info_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/mnpf_info.h b/lib/sbi/openapi/model/mnpf_info.h new file mode 100644 index 000000000..d7ef700de --- /dev/null +++ b/lib/sbi/openapi/model/mnpf_info.h @@ -0,0 +1,39 @@ +/* + * mnpf_info.h + * + * Information of an MNPF Instance + */ + +#ifndef _OpenAPI_mnpf_info_H_ +#define _OpenAPI_mnpf_info_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "identity_range.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_mnpf_info_s OpenAPI_mnpf_info_t; +typedef struct OpenAPI_mnpf_info_s { + OpenAPI_list_t *msisdn_ranges; +} OpenAPI_mnpf_info_t; + +OpenAPI_mnpf_info_t *OpenAPI_mnpf_info_create( + OpenAPI_list_t *msisdn_ranges +); +void OpenAPI_mnpf_info_free(OpenAPI_mnpf_info_t *mnpf_info); +OpenAPI_mnpf_info_t *OpenAPI_mnpf_info_parseFromJSON(cJSON *mnpf_infoJSON); +cJSON *OpenAPI_mnpf_info_convertToJSON(OpenAPI_mnpf_info_t *mnpf_info); +OpenAPI_mnpf_info_t *OpenAPI_mnpf_info_copy(OpenAPI_mnpf_info_t *dst, OpenAPI_mnpf_info_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_mnpf_info_H_ */ + diff --git a/lib/sbi/openapi/model/mo_exp_data_counter.h b/lib/sbi/openapi/model/mo_exp_data_counter.h index 9f0d4b2ca..b3eb976fd 100644 --- a/lib/sbi/openapi/model/mo_exp_data_counter.h +++ b/lib/sbi/openapi/model/mo_exp_data_counter.h @@ -1,7 +1,7 @@ /* * mo_exp_data_counter.h * - * + * Contain the MO Exception Data Counter. */ #ifndef _OpenAPI_mo_exp_data_counter_H_ diff --git a/lib/sbi/openapi/model/model_3_g_aka_av.c b/lib/sbi/openapi/model/model_3_g_aka_av.c new file mode 100644 index 000000000..2212dafda --- /dev/null +++ b/lib/sbi/openapi/model/model_3_g_aka_av.c @@ -0,0 +1,222 @@ + +#include +#include +#include +#include "model_3_g_aka_av.h" + +OpenAPI_model_3_g_aka_av_t *OpenAPI_model_3_g_aka_av_create( + char *rand, + char *xres, + char *autn, + char *ck, + char *ik +) +{ + OpenAPI_model_3_g_aka_av_t *model_3_g_aka_av_local_var = ogs_malloc(sizeof(OpenAPI_model_3_g_aka_av_t)); + ogs_assert(model_3_g_aka_av_local_var); + + model_3_g_aka_av_local_var->rand = rand; + model_3_g_aka_av_local_var->xres = xres; + model_3_g_aka_av_local_var->autn = autn; + model_3_g_aka_av_local_var->ck = ck; + model_3_g_aka_av_local_var->ik = ik; + + return model_3_g_aka_av_local_var; +} + +void OpenAPI_model_3_g_aka_av_free(OpenAPI_model_3_g_aka_av_t *model_3_g_aka_av) +{ + OpenAPI_lnode_t *node = NULL; + + if (NULL == model_3_g_aka_av) { + return; + } + if (model_3_g_aka_av->rand) { + ogs_free(model_3_g_aka_av->rand); + model_3_g_aka_av->rand = NULL; + } + if (model_3_g_aka_av->xres) { + ogs_free(model_3_g_aka_av->xres); + model_3_g_aka_av->xres = NULL; + } + if (model_3_g_aka_av->autn) { + ogs_free(model_3_g_aka_av->autn); + model_3_g_aka_av->autn = NULL; + } + if (model_3_g_aka_av->ck) { + ogs_free(model_3_g_aka_av->ck); + model_3_g_aka_av->ck = NULL; + } + if (model_3_g_aka_av->ik) { + ogs_free(model_3_g_aka_av->ik); + model_3_g_aka_av->ik = NULL; + } + ogs_free(model_3_g_aka_av); +} + +cJSON *OpenAPI_model_3_g_aka_av_convertToJSON(OpenAPI_model_3_g_aka_av_t *model_3_g_aka_av) +{ + cJSON *item = NULL; + OpenAPI_lnode_t *node = NULL; + + if (model_3_g_aka_av == NULL) { + ogs_error("OpenAPI_model_3_g_aka_av_convertToJSON() failed [3GAkaAv]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (!model_3_g_aka_av->rand) { + ogs_error("OpenAPI_model_3_g_aka_av_convertToJSON() failed [rand]"); + return NULL; + } + if (cJSON_AddStringToObject(item, "rand", model_3_g_aka_av->rand) == NULL) { + ogs_error("OpenAPI_model_3_g_aka_av_convertToJSON() failed [rand]"); + goto end; + } + + if (!model_3_g_aka_av->xres) { + ogs_error("OpenAPI_model_3_g_aka_av_convertToJSON() failed [xres]"); + return NULL; + } + if (cJSON_AddStringToObject(item, "xres", model_3_g_aka_av->xres) == NULL) { + ogs_error("OpenAPI_model_3_g_aka_av_convertToJSON() failed [xres]"); + goto end; + } + + if (!model_3_g_aka_av->autn) { + ogs_error("OpenAPI_model_3_g_aka_av_convertToJSON() failed [autn]"); + return NULL; + } + if (cJSON_AddStringToObject(item, "autn", model_3_g_aka_av->autn) == NULL) { + ogs_error("OpenAPI_model_3_g_aka_av_convertToJSON() failed [autn]"); + goto end; + } + + if (!model_3_g_aka_av->ck) { + ogs_error("OpenAPI_model_3_g_aka_av_convertToJSON() failed [ck]"); + return NULL; + } + if (cJSON_AddStringToObject(item, "ck", model_3_g_aka_av->ck) == NULL) { + ogs_error("OpenAPI_model_3_g_aka_av_convertToJSON() failed [ck]"); + goto end; + } + + if (!model_3_g_aka_av->ik) { + ogs_error("OpenAPI_model_3_g_aka_av_convertToJSON() failed [ik]"); + return NULL; + } + if (cJSON_AddStringToObject(item, "ik", model_3_g_aka_av->ik) == NULL) { + ogs_error("OpenAPI_model_3_g_aka_av_convertToJSON() failed [ik]"); + goto end; + } + +end: + return item; +} + +OpenAPI_model_3_g_aka_av_t *OpenAPI_model_3_g_aka_av_parseFromJSON(cJSON *model_3_g_aka_avJSON) +{ + OpenAPI_model_3_g_aka_av_t *model_3_g_aka_av_local_var = NULL; + OpenAPI_lnode_t *node = NULL; + cJSON *rand = NULL; + cJSON *xres = NULL; + cJSON *autn = NULL; + cJSON *ck = NULL; + cJSON *ik = NULL; + rand = cJSON_GetObjectItemCaseSensitive(model_3_g_aka_avJSON, "rand"); + if (!rand) { + ogs_error("OpenAPI_model_3_g_aka_av_parseFromJSON() failed [rand]"); + goto end; + } + if (!cJSON_IsString(rand)) { + ogs_error("OpenAPI_model_3_g_aka_av_parseFromJSON() failed [rand]"); + goto end; + } + + xres = cJSON_GetObjectItemCaseSensitive(model_3_g_aka_avJSON, "xres"); + if (!xres) { + ogs_error("OpenAPI_model_3_g_aka_av_parseFromJSON() failed [xres]"); + goto end; + } + if (!cJSON_IsString(xres)) { + ogs_error("OpenAPI_model_3_g_aka_av_parseFromJSON() failed [xres]"); + goto end; + } + + autn = cJSON_GetObjectItemCaseSensitive(model_3_g_aka_avJSON, "autn"); + if (!autn) { + ogs_error("OpenAPI_model_3_g_aka_av_parseFromJSON() failed [autn]"); + goto end; + } + if (!cJSON_IsString(autn)) { + ogs_error("OpenAPI_model_3_g_aka_av_parseFromJSON() failed [autn]"); + goto end; + } + + ck = cJSON_GetObjectItemCaseSensitive(model_3_g_aka_avJSON, "ck"); + if (!ck) { + ogs_error("OpenAPI_model_3_g_aka_av_parseFromJSON() failed [ck]"); + goto end; + } + if (!cJSON_IsString(ck)) { + ogs_error("OpenAPI_model_3_g_aka_av_parseFromJSON() failed [ck]"); + goto end; + } + + ik = cJSON_GetObjectItemCaseSensitive(model_3_g_aka_avJSON, "ik"); + if (!ik) { + ogs_error("OpenAPI_model_3_g_aka_av_parseFromJSON() failed [ik]"); + goto end; + } + if (!cJSON_IsString(ik)) { + ogs_error("OpenAPI_model_3_g_aka_av_parseFromJSON() failed [ik]"); + goto end; + } + + model_3_g_aka_av_local_var = OpenAPI_model_3_g_aka_av_create ( + ogs_strdup(rand->valuestring), + ogs_strdup(xres->valuestring), + ogs_strdup(autn->valuestring), + ogs_strdup(ck->valuestring), + ogs_strdup(ik->valuestring) + ); + + return model_3_g_aka_av_local_var; +end: + return NULL; +} + +OpenAPI_model_3_g_aka_av_t *OpenAPI_model_3_g_aka_av_copy(OpenAPI_model_3_g_aka_av_t *dst, OpenAPI_model_3_g_aka_av_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_model_3_g_aka_av_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_model_3_g_aka_av_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_model_3_g_aka_av_free(dst); + dst = OpenAPI_model_3_g_aka_av_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/model_3_g_aka_av.h b/lib/sbi/openapi/model/model_3_g_aka_av.h new file mode 100644 index 000000000..41b384bcb --- /dev/null +++ b/lib/sbi/openapi/model/model_3_g_aka_av.h @@ -0,0 +1,46 @@ +/* + * model_3_g_aka_av.h + * + * Contains RAND, XRES, AUTN, CK, and IK + */ + +#ifndef _OpenAPI_model_3_g_aka_av_H_ +#define _OpenAPI_model_3_g_aka_av_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_model_3_g_aka_av_s OpenAPI_model_3_g_aka_av_t; +typedef struct OpenAPI_model_3_g_aka_av_s { + char *rand; + char *xres; + char *autn; + char *ck; + char *ik; +} OpenAPI_model_3_g_aka_av_t; + +OpenAPI_model_3_g_aka_av_t *OpenAPI_model_3_g_aka_av_create( + char *rand, + char *xres, + char *autn, + char *ck, + char *ik +); +void OpenAPI_model_3_g_aka_av_free(OpenAPI_model_3_g_aka_av_t *model_3_g_aka_av); +OpenAPI_model_3_g_aka_av_t *OpenAPI_model_3_g_aka_av_parseFromJSON(cJSON *model_3_g_aka_avJSON); +cJSON *OpenAPI_model_3_g_aka_av_convertToJSON(OpenAPI_model_3_g_aka_av_t *model_3_g_aka_av); +OpenAPI_model_3_g_aka_av_t *OpenAPI_model_3_g_aka_av_copy(OpenAPI_model_3_g_aka_av_t *dst, OpenAPI_model_3_g_aka_av_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_model_3_g_aka_av_H_ */ + diff --git a/lib/sbi/openapi/model/model_5_g_ddnmf_info.c b/lib/sbi/openapi/model/model_5_g_ddnmf_info.c new file mode 100644 index 000000000..c47d238f1 --- /dev/null +++ b/lib/sbi/openapi/model/model_5_g_ddnmf_info.c @@ -0,0 +1,122 @@ + +#include +#include +#include +#include "model_5_g_ddnmf_info.h" + +OpenAPI_model_5_g_ddnmf_info_t *OpenAPI_model_5_g_ddnmf_info_create( + OpenAPI_plmn_id_t *plmn_id +) +{ + OpenAPI_model_5_g_ddnmf_info_t *model_5_g_ddnmf_info_local_var = ogs_malloc(sizeof(OpenAPI_model_5_g_ddnmf_info_t)); + ogs_assert(model_5_g_ddnmf_info_local_var); + + model_5_g_ddnmf_info_local_var->plmn_id = plmn_id; + + return model_5_g_ddnmf_info_local_var; +} + +void OpenAPI_model_5_g_ddnmf_info_free(OpenAPI_model_5_g_ddnmf_info_t *model_5_g_ddnmf_info) +{ + OpenAPI_lnode_t *node = NULL; + + if (NULL == model_5_g_ddnmf_info) { + return; + } + if (model_5_g_ddnmf_info->plmn_id) { + OpenAPI_plmn_id_free(model_5_g_ddnmf_info->plmn_id); + model_5_g_ddnmf_info->plmn_id = NULL; + } + ogs_free(model_5_g_ddnmf_info); +} + +cJSON *OpenAPI_model_5_g_ddnmf_info_convertToJSON(OpenAPI_model_5_g_ddnmf_info_t *model_5_g_ddnmf_info) +{ + cJSON *item = NULL; + OpenAPI_lnode_t *node = NULL; + + if (model_5_g_ddnmf_info == NULL) { + ogs_error("OpenAPI_model_5_g_ddnmf_info_convertToJSON() failed [5GDdnmfInfo]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (!model_5_g_ddnmf_info->plmn_id) { + ogs_error("OpenAPI_model_5_g_ddnmf_info_convertToJSON() failed [plmn_id]"); + return NULL; + } + cJSON *plmn_id_local_JSON = OpenAPI_plmn_id_convertToJSON(model_5_g_ddnmf_info->plmn_id); + if (plmn_id_local_JSON == NULL) { + ogs_error("OpenAPI_model_5_g_ddnmf_info_convertToJSON() failed [plmn_id]"); + goto end; + } + cJSON_AddItemToObject(item, "plmnId", plmn_id_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_model_5_g_ddnmf_info_convertToJSON() failed [plmn_id]"); + goto end; + } + +end: + return item; +} + +OpenAPI_model_5_g_ddnmf_info_t *OpenAPI_model_5_g_ddnmf_info_parseFromJSON(cJSON *model_5_g_ddnmf_infoJSON) +{ + OpenAPI_model_5_g_ddnmf_info_t *model_5_g_ddnmf_info_local_var = NULL; + OpenAPI_lnode_t *node = NULL; + cJSON *plmn_id = NULL; + OpenAPI_plmn_id_t *plmn_id_local_nonprim = NULL; + plmn_id = cJSON_GetObjectItemCaseSensitive(model_5_g_ddnmf_infoJSON, "plmnId"); + if (!plmn_id) { + ogs_error("OpenAPI_model_5_g_ddnmf_info_parseFromJSON() failed [plmn_id]"); + goto end; + } + plmn_id_local_nonprim = OpenAPI_plmn_id_parseFromJSON(plmn_id); + + model_5_g_ddnmf_info_local_var = OpenAPI_model_5_g_ddnmf_info_create ( + plmn_id_local_nonprim + ); + + return model_5_g_ddnmf_info_local_var; +end: + if (plmn_id_local_nonprim) { + OpenAPI_plmn_id_free(plmn_id_local_nonprim); + plmn_id_local_nonprim = NULL; + } + return NULL; +} + +OpenAPI_model_5_g_ddnmf_info_t *OpenAPI_model_5_g_ddnmf_info_copy(OpenAPI_model_5_g_ddnmf_info_t *dst, OpenAPI_model_5_g_ddnmf_info_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_model_5_g_ddnmf_info_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_model_5_g_ddnmf_info_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_model_5_g_ddnmf_info_free(dst); + dst = OpenAPI_model_5_g_ddnmf_info_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/model_5_g_ddnmf_info.h b/lib/sbi/openapi/model/model_5_g_ddnmf_info.h new file mode 100644 index 000000000..19c00f14f --- /dev/null +++ b/lib/sbi/openapi/model/model_5_g_ddnmf_info.h @@ -0,0 +1,39 @@ +/* + * model_5_g_ddnmf_info.h + * + * Information of an 5G DDNMF NF Instance + */ + +#ifndef _OpenAPI_model_5_g_ddnmf_info_H_ +#define _OpenAPI_model_5_g_ddnmf_info_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "plmn_id.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_model_5_g_ddnmf_info_s OpenAPI_model_5_g_ddnmf_info_t; +typedef struct OpenAPI_model_5_g_ddnmf_info_s { + struct OpenAPI_plmn_id_s *plmn_id; +} OpenAPI_model_5_g_ddnmf_info_t; + +OpenAPI_model_5_g_ddnmf_info_t *OpenAPI_model_5_g_ddnmf_info_create( + OpenAPI_plmn_id_t *plmn_id +); +void OpenAPI_model_5_g_ddnmf_info_free(OpenAPI_model_5_g_ddnmf_info_t *model_5_g_ddnmf_info); +OpenAPI_model_5_g_ddnmf_info_t *OpenAPI_model_5_g_ddnmf_info_parseFromJSON(cJSON *model_5_g_ddnmf_infoJSON); +cJSON *OpenAPI_model_5_g_ddnmf_info_convertToJSON(OpenAPI_model_5_g_ddnmf_info_t *model_5_g_ddnmf_info); +OpenAPI_model_5_g_ddnmf_info_t *OpenAPI_model_5_g_ddnmf_info_copy(OpenAPI_model_5_g_ddnmf_info_t *dst, OpenAPI_model_5_g_ddnmf_info_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_model_5_g_ddnmf_info_H_ */ + diff --git a/lib/sbi/openapi/model/model_5_gvn_group_data.c b/lib/sbi/openapi/model/model_5_gvn_group_data.c index 3d57791d5..bca2c518a 100644 --- a/lib/sbi/openapi/model/model_5_gvn_group_data.c +++ b/lib/sbi/openapi/model/model_5_gvn_group_data.c @@ -11,7 +11,11 @@ OpenAPI_model_5_gvn_group_data_t *OpenAPI_model_5_gvn_group_data_create( OpenAPI_list_t *app_descriptors, bool is_secondary_auth, int secondary_auth, - OpenAPI_ip_address_1_t *dn_aaa_address + bool is_dn_aaa_ip_address_allocation, + int dn_aaa_ip_address_allocation, + OpenAPI_ip_address_1_t *dn_aaa_address, + OpenAPI_list_t *additional_dn_aaa_addresses, + char *dn_aaa_fqdn ) { OpenAPI_model_5_gvn_group_data_t *model_5_gvn_group_data_local_var = ogs_malloc(sizeof(OpenAPI_model_5_gvn_group_data_t)); @@ -23,7 +27,11 @@ OpenAPI_model_5_gvn_group_data_t *OpenAPI_model_5_gvn_group_data_create( model_5_gvn_group_data_local_var->app_descriptors = app_descriptors; model_5_gvn_group_data_local_var->is_secondary_auth = is_secondary_auth; model_5_gvn_group_data_local_var->secondary_auth = secondary_auth; + model_5_gvn_group_data_local_var->is_dn_aaa_ip_address_allocation = is_dn_aaa_ip_address_allocation; + model_5_gvn_group_data_local_var->dn_aaa_ip_address_allocation = dn_aaa_ip_address_allocation; model_5_gvn_group_data_local_var->dn_aaa_address = dn_aaa_address; + model_5_gvn_group_data_local_var->additional_dn_aaa_addresses = additional_dn_aaa_addresses; + model_5_gvn_group_data_local_var->dn_aaa_fqdn = dn_aaa_fqdn; return model_5_gvn_group_data_local_var; } @@ -58,6 +66,17 @@ void OpenAPI_model_5_gvn_group_data_free(OpenAPI_model_5_gvn_group_data_t *model OpenAPI_ip_address_1_free(model_5_gvn_group_data->dn_aaa_address); model_5_gvn_group_data->dn_aaa_address = NULL; } + if (model_5_gvn_group_data->additional_dn_aaa_addresses) { + OpenAPI_list_for_each(model_5_gvn_group_data->additional_dn_aaa_addresses, node) { + OpenAPI_ip_address_1_free(node->data); + } + OpenAPI_list_free(model_5_gvn_group_data->additional_dn_aaa_addresses); + model_5_gvn_group_data->additional_dn_aaa_addresses = NULL; + } + if (model_5_gvn_group_data->dn_aaa_fqdn) { + ogs_free(model_5_gvn_group_data->dn_aaa_fqdn); + model_5_gvn_group_data->dn_aaa_fqdn = NULL; + } ogs_free(model_5_gvn_group_data); } @@ -133,6 +152,13 @@ cJSON *OpenAPI_model_5_gvn_group_data_convertToJSON(OpenAPI_model_5_gvn_group_da } } + if (model_5_gvn_group_data->is_dn_aaa_ip_address_allocation) { + if (cJSON_AddBoolToObject(item, "dnAaaIpAddressAllocation", model_5_gvn_group_data->dn_aaa_ip_address_allocation) == NULL) { + ogs_error("OpenAPI_model_5_gvn_group_data_convertToJSON() failed [dn_aaa_ip_address_allocation]"); + goto end; + } + } + if (model_5_gvn_group_data->dn_aaa_address) { cJSON *dn_aaa_address_local_JSON = OpenAPI_ip_address_1_convertToJSON(model_5_gvn_group_data->dn_aaa_address); if (dn_aaa_address_local_JSON == NULL) { @@ -146,6 +172,29 @@ cJSON *OpenAPI_model_5_gvn_group_data_convertToJSON(OpenAPI_model_5_gvn_group_da } } + if (model_5_gvn_group_data->additional_dn_aaa_addresses) { + cJSON *additional_dn_aaa_addressesList = cJSON_AddArrayToObject(item, "additionalDnAaaAddresses"); + if (additional_dn_aaa_addressesList == NULL) { + ogs_error("OpenAPI_model_5_gvn_group_data_convertToJSON() failed [additional_dn_aaa_addresses]"); + goto end; + } + OpenAPI_list_for_each(model_5_gvn_group_data->additional_dn_aaa_addresses, node) { + cJSON *itemLocal = OpenAPI_ip_address_1_convertToJSON(node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_model_5_gvn_group_data_convertToJSON() failed [additional_dn_aaa_addresses]"); + goto end; + } + cJSON_AddItemToArray(additional_dn_aaa_addressesList, itemLocal); + } + } + + if (model_5_gvn_group_data->dn_aaa_fqdn) { + if (cJSON_AddStringToObject(item, "dnAaaFqdn", model_5_gvn_group_data->dn_aaa_fqdn) == NULL) { + ogs_error("OpenAPI_model_5_gvn_group_data_convertToJSON() failed [dn_aaa_fqdn]"); + goto end; + } + } + end: return item; } @@ -162,8 +211,12 @@ OpenAPI_model_5_gvn_group_data_t *OpenAPI_model_5_gvn_group_data_parseFromJSON(c cJSON *app_descriptors = NULL; OpenAPI_list_t *app_descriptorsList = NULL; cJSON *secondary_auth = NULL; + cJSON *dn_aaa_ip_address_allocation = NULL; cJSON *dn_aaa_address = NULL; OpenAPI_ip_address_1_t *dn_aaa_address_local_nonprim = NULL; + cJSON *additional_dn_aaa_addresses = NULL; + OpenAPI_list_t *additional_dn_aaa_addressesList = NULL; + cJSON *dn_aaa_fqdn = NULL; dnn = cJSON_GetObjectItemCaseSensitive(model_5_gvn_group_dataJSON, "dnn"); if (!dnn) { ogs_error("OpenAPI_model_5_gvn_group_data_parseFromJSON() failed [dnn]"); @@ -233,11 +286,52 @@ OpenAPI_model_5_gvn_group_data_t *OpenAPI_model_5_gvn_group_data_parseFromJSON(c } } + dn_aaa_ip_address_allocation = cJSON_GetObjectItemCaseSensitive(model_5_gvn_group_dataJSON, "dnAaaIpAddressAllocation"); + if (dn_aaa_ip_address_allocation) { + if (!cJSON_IsBool(dn_aaa_ip_address_allocation)) { + ogs_error("OpenAPI_model_5_gvn_group_data_parseFromJSON() failed [dn_aaa_ip_address_allocation]"); + goto end; + } + } + dn_aaa_address = cJSON_GetObjectItemCaseSensitive(model_5_gvn_group_dataJSON, "dnAaaAddress"); if (dn_aaa_address) { dn_aaa_address_local_nonprim = OpenAPI_ip_address_1_parseFromJSON(dn_aaa_address); } + additional_dn_aaa_addresses = cJSON_GetObjectItemCaseSensitive(model_5_gvn_group_dataJSON, "additionalDnAaaAddresses"); + if (additional_dn_aaa_addresses) { + cJSON *additional_dn_aaa_addresses_local = NULL; + if (!cJSON_IsArray(additional_dn_aaa_addresses)) { + ogs_error("OpenAPI_model_5_gvn_group_data_parseFromJSON() failed [additional_dn_aaa_addresses]"); + goto end; + } + + additional_dn_aaa_addressesList = OpenAPI_list_create(); + + cJSON_ArrayForEach(additional_dn_aaa_addresses_local, additional_dn_aaa_addresses) { + if (!cJSON_IsObject(additional_dn_aaa_addresses_local)) { + ogs_error("OpenAPI_model_5_gvn_group_data_parseFromJSON() failed [additional_dn_aaa_addresses]"); + goto end; + } + OpenAPI_ip_address_1_t *additional_dn_aaa_addressesItem = OpenAPI_ip_address_1_parseFromJSON(additional_dn_aaa_addresses_local); + if (!additional_dn_aaa_addressesItem) { + ogs_error("No additional_dn_aaa_addressesItem"); + OpenAPI_list_free(additional_dn_aaa_addressesList); + goto end; + } + OpenAPI_list_add(additional_dn_aaa_addressesList, additional_dn_aaa_addressesItem); + } + } + + dn_aaa_fqdn = cJSON_GetObjectItemCaseSensitive(model_5_gvn_group_dataJSON, "dnAaaFqdn"); + if (dn_aaa_fqdn) { + if (!cJSON_IsString(dn_aaa_fqdn) && !cJSON_IsNull(dn_aaa_fqdn)) { + ogs_error("OpenAPI_model_5_gvn_group_data_parseFromJSON() failed [dn_aaa_fqdn]"); + goto end; + } + } + model_5_gvn_group_data_local_var = OpenAPI_model_5_gvn_group_data_create ( ogs_strdup(dnn->valuestring), s_nssai_local_nonprim, @@ -245,7 +339,11 @@ OpenAPI_model_5_gvn_group_data_t *OpenAPI_model_5_gvn_group_data_parseFromJSON(c app_descriptors ? app_descriptorsList : NULL, secondary_auth ? true : false, secondary_auth ? secondary_auth->valueint : 0, - dn_aaa_address ? dn_aaa_address_local_nonprim : NULL + dn_aaa_ip_address_allocation ? true : false, + dn_aaa_ip_address_allocation ? dn_aaa_ip_address_allocation->valueint : 0, + dn_aaa_address ? dn_aaa_address_local_nonprim : NULL, + additional_dn_aaa_addresses ? additional_dn_aaa_addressesList : NULL, + dn_aaa_fqdn && !cJSON_IsNull(dn_aaa_fqdn) ? ogs_strdup(dn_aaa_fqdn->valuestring) : NULL ); return model_5_gvn_group_data_local_var; @@ -269,6 +367,13 @@ end: OpenAPI_ip_address_1_free(dn_aaa_address_local_nonprim); dn_aaa_address_local_nonprim = NULL; } + if (additional_dn_aaa_addressesList) { + OpenAPI_list_for_each(additional_dn_aaa_addressesList, node) { + OpenAPI_ip_address_1_free(node->data); + } + OpenAPI_list_free(additional_dn_aaa_addressesList); + additional_dn_aaa_addressesList = NULL; + } return NULL; } diff --git a/lib/sbi/openapi/model/model_5_gvn_group_data.h b/lib/sbi/openapi/model/model_5_gvn_group_data.h index aa981f1f7..a475c3869 100644 --- a/lib/sbi/openapi/model/model_5_gvn_group_data.h +++ b/lib/sbi/openapi/model/model_5_gvn_group_data.h @@ -29,7 +29,11 @@ typedef struct OpenAPI_model_5_gvn_group_data_s { OpenAPI_list_t *app_descriptors; bool is_secondary_auth; int secondary_auth; + bool is_dn_aaa_ip_address_allocation; + int dn_aaa_ip_address_allocation; struct OpenAPI_ip_address_1_s *dn_aaa_address; + OpenAPI_list_t *additional_dn_aaa_addresses; + char *dn_aaa_fqdn; } OpenAPI_model_5_gvn_group_data_t; OpenAPI_model_5_gvn_group_data_t *OpenAPI_model_5_gvn_group_data_create( @@ -39,7 +43,11 @@ OpenAPI_model_5_gvn_group_data_t *OpenAPI_model_5_gvn_group_data_create( OpenAPI_list_t *app_descriptors, bool is_secondary_auth, int secondary_auth, - OpenAPI_ip_address_1_t *dn_aaa_address + bool is_dn_aaa_ip_address_allocation, + int dn_aaa_ip_address_allocation, + OpenAPI_ip_address_1_t *dn_aaa_address, + OpenAPI_list_t *additional_dn_aaa_addresses, + char *dn_aaa_fqdn ); void OpenAPI_model_5_gvn_group_data_free(OpenAPI_model_5_gvn_group_data_t *model_5_gvn_group_data); OpenAPI_model_5_gvn_group_data_t *OpenAPI_model_5_gvn_group_data_parseFromJSON(cJSON *model_5_gvn_group_dataJSON); diff --git a/lib/sbi/openapi/model/model_5_mbs_authorization_info.c b/lib/sbi/openapi/model/model_5_mbs_authorization_info.c new file mode 100644 index 000000000..325ad7e64 --- /dev/null +++ b/lib/sbi/openapi/model/model_5_mbs_authorization_info.c @@ -0,0 +1,147 @@ + +#include +#include +#include +#include "model_5_mbs_authorization_info.h" + +OpenAPI_model_5_mbs_authorization_info_t *OpenAPI_model_5_mbs_authorization_info_create( + OpenAPI_list_t *_5mbs_session_ids +) +{ + OpenAPI_model_5_mbs_authorization_info_t *model_5_mbs_authorization_info_local_var = ogs_malloc(sizeof(OpenAPI_model_5_mbs_authorization_info_t)); + ogs_assert(model_5_mbs_authorization_info_local_var); + + model_5_mbs_authorization_info_local_var->_5mbs_session_ids = _5mbs_session_ids; + + return model_5_mbs_authorization_info_local_var; +} + +void OpenAPI_model_5_mbs_authorization_info_free(OpenAPI_model_5_mbs_authorization_info_t *model_5_mbs_authorization_info) +{ + OpenAPI_lnode_t *node = NULL; + + if (NULL == model_5_mbs_authorization_info) { + return; + } + if (model_5_mbs_authorization_info->_5mbs_session_ids) { + OpenAPI_list_for_each(model_5_mbs_authorization_info->_5mbs_session_ids, node) { + OpenAPI_mbs_session_id_free(node->data); + } + OpenAPI_list_free(model_5_mbs_authorization_info->_5mbs_session_ids); + model_5_mbs_authorization_info->_5mbs_session_ids = NULL; + } + ogs_free(model_5_mbs_authorization_info); +} + +cJSON *OpenAPI_model_5_mbs_authorization_info_convertToJSON(OpenAPI_model_5_mbs_authorization_info_t *model_5_mbs_authorization_info) +{ + cJSON *item = NULL; + OpenAPI_lnode_t *node = NULL; + + if (model_5_mbs_authorization_info == NULL) { + ogs_error("OpenAPI_model_5_mbs_authorization_info_convertToJSON() failed [5MbsAuthorizationInfo]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (model_5_mbs_authorization_info->_5mbs_session_ids) { + cJSON *_5mbs_session_idsList = cJSON_AddArrayToObject(item, "5mbsSessionIds"); + if (_5mbs_session_idsList == NULL) { + ogs_error("OpenAPI_model_5_mbs_authorization_info_convertToJSON() failed [_5mbs_session_ids]"); + goto end; + } + OpenAPI_list_for_each(model_5_mbs_authorization_info->_5mbs_session_ids, node) { + cJSON *itemLocal = OpenAPI_mbs_session_id_convertToJSON(node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_model_5_mbs_authorization_info_convertToJSON() failed [_5mbs_session_ids]"); + goto end; + } + cJSON_AddItemToArray(_5mbs_session_idsList, itemLocal); + } + } + +end: + return item; +} + +OpenAPI_model_5_mbs_authorization_info_t *OpenAPI_model_5_mbs_authorization_info_parseFromJSON(cJSON *model_5_mbs_authorization_infoJSON) +{ + OpenAPI_model_5_mbs_authorization_info_t *model_5_mbs_authorization_info_local_var = NULL; + OpenAPI_lnode_t *node = NULL; + cJSON *_5mbs_session_ids = NULL; + OpenAPI_list_t *_5mbs_session_idsList = NULL; + _5mbs_session_ids = cJSON_GetObjectItemCaseSensitive(model_5_mbs_authorization_infoJSON, "5mbsSessionIds"); + if (_5mbs_session_ids) { + cJSON *_5mbs_session_ids_local = NULL; + if (!cJSON_IsArray(_5mbs_session_ids)) { + ogs_error("OpenAPI_model_5_mbs_authorization_info_parseFromJSON() failed [_5mbs_session_ids]"); + goto end; + } + + _5mbs_session_idsList = OpenAPI_list_create(); + + cJSON_ArrayForEach(_5mbs_session_ids_local, _5mbs_session_ids) { + if (!cJSON_IsObject(_5mbs_session_ids_local)) { + ogs_error("OpenAPI_model_5_mbs_authorization_info_parseFromJSON() failed [_5mbs_session_ids]"); + goto end; + } + OpenAPI_mbs_session_id_t *_5mbs_session_idsItem = OpenAPI_mbs_session_id_parseFromJSON(_5mbs_session_ids_local); + if (!_5mbs_session_idsItem) { + ogs_error("No _5mbs_session_idsItem"); + OpenAPI_list_free(_5mbs_session_idsList); + goto end; + } + OpenAPI_list_add(_5mbs_session_idsList, _5mbs_session_idsItem); + } + } + + model_5_mbs_authorization_info_local_var = OpenAPI_model_5_mbs_authorization_info_create ( + _5mbs_session_ids ? _5mbs_session_idsList : NULL + ); + + return model_5_mbs_authorization_info_local_var; +end: + if (_5mbs_session_idsList) { + OpenAPI_list_for_each(_5mbs_session_idsList, node) { + OpenAPI_mbs_session_id_free(node->data); + } + OpenAPI_list_free(_5mbs_session_idsList); + _5mbs_session_idsList = NULL; + } + return NULL; +} + +OpenAPI_model_5_mbs_authorization_info_t *OpenAPI_model_5_mbs_authorization_info_copy(OpenAPI_model_5_mbs_authorization_info_t *dst, OpenAPI_model_5_mbs_authorization_info_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_model_5_mbs_authorization_info_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_model_5_mbs_authorization_info_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_model_5_mbs_authorization_info_free(dst); + dst = OpenAPI_model_5_mbs_authorization_info_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/model_5_mbs_authorization_info.h b/lib/sbi/openapi/model/model_5_mbs_authorization_info.h new file mode 100644 index 000000000..1e2be3fdf --- /dev/null +++ b/lib/sbi/openapi/model/model_5_mbs_authorization_info.h @@ -0,0 +1,39 @@ +/* + * model_5_mbs_authorization_info.h + * + * + */ + +#ifndef _OpenAPI_model_5_mbs_authorization_info_H_ +#define _OpenAPI_model_5_mbs_authorization_info_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "mbs_session_id.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_model_5_mbs_authorization_info_s OpenAPI_model_5_mbs_authorization_info_t; +typedef struct OpenAPI_model_5_mbs_authorization_info_s { + OpenAPI_list_t *_5mbs_session_ids; +} OpenAPI_model_5_mbs_authorization_info_t; + +OpenAPI_model_5_mbs_authorization_info_t *OpenAPI_model_5_mbs_authorization_info_create( + OpenAPI_list_t *_5mbs_session_ids +); +void OpenAPI_model_5_mbs_authorization_info_free(OpenAPI_model_5_mbs_authorization_info_t *model_5_mbs_authorization_info); +OpenAPI_model_5_mbs_authorization_info_t *OpenAPI_model_5_mbs_authorization_info_parseFromJSON(cJSON *model_5_mbs_authorization_infoJSON); +cJSON *OpenAPI_model_5_mbs_authorization_info_convertToJSON(OpenAPI_model_5_mbs_authorization_info_t *model_5_mbs_authorization_info); +OpenAPI_model_5_mbs_authorization_info_t *OpenAPI_model_5_mbs_authorization_info_copy(OpenAPI_model_5_mbs_authorization_info_t *dst, OpenAPI_model_5_mbs_authorization_info_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_model_5_mbs_authorization_info_H_ */ + diff --git a/lib/sbi/openapi/model/modify_200_response.c b/lib/sbi/openapi/model/modify_200_response.c index e25a493b3..dfcdfe813 100644 --- a/lib/sbi/openapi/model/modify_200_response.c +++ b/lib/sbi/openapi/model/modify_200_response.c @@ -20,7 +20,13 @@ OpenAPI_modify_200_response_t *OpenAPI_modify_200_response_create( int immediate_report, OpenAPI_list_t *report, char *supported_features, - OpenAPI_context_info_t *context_info + OpenAPI_context_info_t *context_info, + bool is_nf_change_filter, + int nf_change_filter, + bool is_unique_subscription, + int unique_subscription, + OpenAPI_list_t *reset_ids, + OpenAPI_ue_context_in_smf_data_sub_filter_t *ue_con_smf_data_sub_filter ) { OpenAPI_modify_200_response_t *modify_200_response_local_var = ogs_malloc(sizeof(OpenAPI_modify_200_response_t)); @@ -42,6 +48,12 @@ OpenAPI_modify_200_response_t *OpenAPI_modify_200_response_create( modify_200_response_local_var->report = report; modify_200_response_local_var->supported_features = supported_features; modify_200_response_local_var->context_info = context_info; + modify_200_response_local_var->is_nf_change_filter = is_nf_change_filter; + modify_200_response_local_var->nf_change_filter = nf_change_filter; + modify_200_response_local_var->is_unique_subscription = is_unique_subscription; + modify_200_response_local_var->unique_subscription = unique_subscription; + modify_200_response_local_var->reset_ids = reset_ids; + modify_200_response_local_var->ue_con_smf_data_sub_filter = ue_con_smf_data_sub_filter; return modify_200_response_local_var; } @@ -107,6 +119,17 @@ void OpenAPI_modify_200_response_free(OpenAPI_modify_200_response_t *modify_200_ OpenAPI_context_info_free(modify_200_response->context_info); modify_200_response->context_info = NULL; } + if (modify_200_response->reset_ids) { + OpenAPI_list_for_each(modify_200_response->reset_ids, node) { + ogs_free(node->data); + } + OpenAPI_list_free(modify_200_response->reset_ids); + modify_200_response->reset_ids = NULL; + } + if (modify_200_response->ue_con_smf_data_sub_filter) { + OpenAPI_ue_context_in_smf_data_sub_filter_free(modify_200_response->ue_con_smf_data_sub_filter); + modify_200_response->ue_con_smf_data_sub_filter = NULL; + } ogs_free(modify_200_response); } @@ -261,6 +284,47 @@ cJSON *OpenAPI_modify_200_response_convertToJSON(OpenAPI_modify_200_response_t * } } + if (modify_200_response->is_nf_change_filter) { + if (cJSON_AddBoolToObject(item, "nfChangeFilter", modify_200_response->nf_change_filter) == NULL) { + ogs_error("OpenAPI_modify_200_response_convertToJSON() failed [nf_change_filter]"); + goto end; + } + } + + if (modify_200_response->is_unique_subscription) { + if (cJSON_AddBoolToObject(item, "uniqueSubscription", modify_200_response->unique_subscription) == NULL) { + ogs_error("OpenAPI_modify_200_response_convertToJSON() failed [unique_subscription]"); + goto end; + } + } + + if (modify_200_response->reset_ids) { + cJSON *reset_idsList = cJSON_AddArrayToObject(item, "resetIds"); + if (reset_idsList == NULL) { + ogs_error("OpenAPI_modify_200_response_convertToJSON() failed [reset_ids]"); + goto end; + } + OpenAPI_list_for_each(modify_200_response->reset_ids, node) { + if (cJSON_AddStringToObject(reset_idsList, "", (char*)node->data) == NULL) { + ogs_error("OpenAPI_modify_200_response_convertToJSON() failed [reset_ids]"); + goto end; + } + } + } + + if (modify_200_response->ue_con_smf_data_sub_filter) { + cJSON *ue_con_smf_data_sub_filter_local_JSON = OpenAPI_ue_context_in_smf_data_sub_filter_convertToJSON(modify_200_response->ue_con_smf_data_sub_filter); + if (ue_con_smf_data_sub_filter_local_JSON == NULL) { + ogs_error("OpenAPI_modify_200_response_convertToJSON() failed [ue_con_smf_data_sub_filter]"); + goto end; + } + cJSON_AddItemToObject(item, "ueConSmfDataSubFilter", ue_con_smf_data_sub_filter_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_modify_200_response_convertToJSON() failed [ue_con_smf_data_sub_filter]"); + goto end; + } + } + end: return item; } @@ -288,6 +352,12 @@ OpenAPI_modify_200_response_t *OpenAPI_modify_200_response_parseFromJSON(cJSON * cJSON *supported_features = NULL; cJSON *context_info = NULL; OpenAPI_context_info_t *context_info_local_nonprim = NULL; + cJSON *nf_change_filter = NULL; + cJSON *unique_subscription = NULL; + cJSON *reset_ids = NULL; + OpenAPI_list_t *reset_idsList = NULL; + cJSON *ue_con_smf_data_sub_filter = NULL; + OpenAPI_ue_context_in_smf_data_sub_filter_t *ue_con_smf_data_sub_filter_local_nonprim = NULL; nf_instance_id = cJSON_GetObjectItemCaseSensitive(modify_200_responseJSON, "nfInstanceId"); if (!nf_instance_id) { ogs_error("OpenAPI_modify_200_response_parseFromJSON() failed [nf_instance_id]"); @@ -429,6 +499,48 @@ OpenAPI_modify_200_response_t *OpenAPI_modify_200_response_parseFromJSON(cJSON * context_info_local_nonprim = OpenAPI_context_info_parseFromJSON(context_info); } + nf_change_filter = cJSON_GetObjectItemCaseSensitive(modify_200_responseJSON, "nfChangeFilter"); + if (nf_change_filter) { + if (!cJSON_IsBool(nf_change_filter)) { + ogs_error("OpenAPI_modify_200_response_parseFromJSON() failed [nf_change_filter]"); + goto end; + } + } + + unique_subscription = cJSON_GetObjectItemCaseSensitive(modify_200_responseJSON, "uniqueSubscription"); + if (unique_subscription) { + if (!cJSON_IsBool(unique_subscription)) { + ogs_error("OpenAPI_modify_200_response_parseFromJSON() failed [unique_subscription]"); + goto end; + } + } + + reset_ids = cJSON_GetObjectItemCaseSensitive(modify_200_responseJSON, "resetIds"); + if (reset_ids) { + cJSON *reset_ids_local = NULL; + if (!cJSON_IsArray(reset_ids)) { + ogs_error("OpenAPI_modify_200_response_parseFromJSON() failed [reset_ids]"); + goto end; + } + + reset_idsList = OpenAPI_list_create(); + + cJSON_ArrayForEach(reset_ids_local, reset_ids) { + double *localDouble = NULL; + int *localInt = NULL; + if (!cJSON_IsString(reset_ids_local)) { + ogs_error("OpenAPI_modify_200_response_parseFromJSON() failed [reset_ids]"); + goto end; + } + OpenAPI_list_add(reset_idsList, ogs_strdup(reset_ids_local->valuestring)); + } + } + + ue_con_smf_data_sub_filter = cJSON_GetObjectItemCaseSensitive(modify_200_responseJSON, "ueConSmfDataSubFilter"); + if (ue_con_smf_data_sub_filter) { + ue_con_smf_data_sub_filter_local_nonprim = OpenAPI_ue_context_in_smf_data_sub_filter_parseFromJSON(ue_con_smf_data_sub_filter); + } + modify_200_response_local_var = OpenAPI_modify_200_response_create ( ogs_strdup(nf_instance_id->valuestring), implicit_unsubscribe ? true : false, @@ -445,7 +557,13 @@ OpenAPI_modify_200_response_t *OpenAPI_modify_200_response_parseFromJSON(cJSON * immediate_report ? immediate_report->valueint : 0, reportList, supported_features && !cJSON_IsNull(supported_features) ? ogs_strdup(supported_features->valuestring) : NULL, - context_info ? context_info_local_nonprim : NULL + context_info ? context_info_local_nonprim : NULL, + nf_change_filter ? true : false, + nf_change_filter ? nf_change_filter->valueint : 0, + unique_subscription ? true : false, + unique_subscription ? unique_subscription->valueint : 0, + reset_ids ? reset_idsList : NULL, + ue_con_smf_data_sub_filter ? ue_con_smf_data_sub_filter_local_nonprim : NULL ); return modify_200_response_local_var; @@ -476,6 +594,17 @@ end: OpenAPI_context_info_free(context_info_local_nonprim); context_info_local_nonprim = NULL; } + if (reset_idsList) { + OpenAPI_list_for_each(reset_idsList, node) { + ogs_free(node->data); + } + OpenAPI_list_free(reset_idsList); + reset_idsList = NULL; + } + if (ue_con_smf_data_sub_filter_local_nonprim) { + OpenAPI_ue_context_in_smf_data_sub_filter_free(ue_con_smf_data_sub_filter_local_nonprim); + ue_con_smf_data_sub_filter_local_nonprim = NULL; + } return NULL; } diff --git a/lib/sbi/openapi/model/modify_200_response.h b/lib/sbi/openapi/model/modify_200_response.h index b8e46ac05..860a72b0b 100644 --- a/lib/sbi/openapi/model/modify_200_response.h +++ b/lib/sbi/openapi/model/modify_200_response.h @@ -18,6 +18,7 @@ #include "report_item.h" #include "sdm_subscription.h" #include "snssai.h" +#include "ue_context_in_smf_data_sub_filter.h" #ifdef __cplusplus extern "C" { @@ -41,6 +42,12 @@ typedef struct OpenAPI_modify_200_response_s { OpenAPI_list_t *report; char *supported_features; struct OpenAPI_context_info_s *context_info; + bool is_nf_change_filter; + int nf_change_filter; + bool is_unique_subscription; + int unique_subscription; + OpenAPI_list_t *reset_ids; + struct OpenAPI_ue_context_in_smf_data_sub_filter_s *ue_con_smf_data_sub_filter; } OpenAPI_modify_200_response_t; OpenAPI_modify_200_response_t *OpenAPI_modify_200_response_create( @@ -59,7 +66,13 @@ OpenAPI_modify_200_response_t *OpenAPI_modify_200_response_create( int immediate_report, OpenAPI_list_t *report, char *supported_features, - OpenAPI_context_info_t *context_info + OpenAPI_context_info_t *context_info, + bool is_nf_change_filter, + int nf_change_filter, + bool is_unique_subscription, + int unique_subscription, + OpenAPI_list_t *reset_ids, + OpenAPI_ue_context_in_smf_data_sub_filter_t *ue_con_smf_data_sub_filter ); void OpenAPI_modify_200_response_free(OpenAPI_modify_200_response_t *modify_200_response); OpenAPI_modify_200_response_t *OpenAPI_modify_200_response_parseFromJSON(cJSON *modify_200_responseJSON); diff --git a/lib/sbi/openapi/model/modifysubscription_data_subscription_200_response.c b/lib/sbi/openapi/model/modifysubscription_data_subscription_200_response.c new file mode 100644 index 000000000..eb1d86fee --- /dev/null +++ b/lib/sbi/openapi/model/modifysubscription_data_subscription_200_response.c @@ -0,0 +1,435 @@ + +#include +#include +#include +#include "modifysubscription_data_subscription_200_response.h" + +OpenAPI_modifysubscription_data_subscription_200_response_t *OpenAPI_modifysubscription_data_subscription_200_response_create( + OpenAPI_list_t *report, + char *ue_id, + char *callback_reference, + char *original_callback_reference, + OpenAPI_list_t *monitored_resource_uris, + char *expiry, + OpenAPI_sdm_subscription_1_t *sdm_subscription, + OpenAPI_hss_subscription_info_t *hss_subscription_info, + char *subscription_id, + bool is_unique_subscription, + int unique_subscription, + char *supported_features +) +{ + OpenAPI_modifysubscription_data_subscription_200_response_t *modifysubscription_data_subscription_200_response_local_var = ogs_malloc(sizeof(OpenAPI_modifysubscription_data_subscription_200_response_t)); + ogs_assert(modifysubscription_data_subscription_200_response_local_var); + + modifysubscription_data_subscription_200_response_local_var->report = report; + modifysubscription_data_subscription_200_response_local_var->ue_id = ue_id; + modifysubscription_data_subscription_200_response_local_var->callback_reference = callback_reference; + modifysubscription_data_subscription_200_response_local_var->original_callback_reference = original_callback_reference; + modifysubscription_data_subscription_200_response_local_var->monitored_resource_uris = monitored_resource_uris; + modifysubscription_data_subscription_200_response_local_var->expiry = expiry; + modifysubscription_data_subscription_200_response_local_var->sdm_subscription = sdm_subscription; + modifysubscription_data_subscription_200_response_local_var->hss_subscription_info = hss_subscription_info; + modifysubscription_data_subscription_200_response_local_var->subscription_id = subscription_id; + modifysubscription_data_subscription_200_response_local_var->is_unique_subscription = is_unique_subscription; + modifysubscription_data_subscription_200_response_local_var->unique_subscription = unique_subscription; + modifysubscription_data_subscription_200_response_local_var->supported_features = supported_features; + + return modifysubscription_data_subscription_200_response_local_var; +} + +void OpenAPI_modifysubscription_data_subscription_200_response_free(OpenAPI_modifysubscription_data_subscription_200_response_t *modifysubscription_data_subscription_200_response) +{ + OpenAPI_lnode_t *node = NULL; + + if (NULL == modifysubscription_data_subscription_200_response) { + return; + } + if (modifysubscription_data_subscription_200_response->report) { + OpenAPI_list_for_each(modifysubscription_data_subscription_200_response->report, node) { + OpenAPI_report_item_free(node->data); + } + OpenAPI_list_free(modifysubscription_data_subscription_200_response->report); + modifysubscription_data_subscription_200_response->report = NULL; + } + if (modifysubscription_data_subscription_200_response->ue_id) { + ogs_free(modifysubscription_data_subscription_200_response->ue_id); + modifysubscription_data_subscription_200_response->ue_id = NULL; + } + if (modifysubscription_data_subscription_200_response->callback_reference) { + ogs_free(modifysubscription_data_subscription_200_response->callback_reference); + modifysubscription_data_subscription_200_response->callback_reference = NULL; + } + if (modifysubscription_data_subscription_200_response->original_callback_reference) { + ogs_free(modifysubscription_data_subscription_200_response->original_callback_reference); + modifysubscription_data_subscription_200_response->original_callback_reference = NULL; + } + if (modifysubscription_data_subscription_200_response->monitored_resource_uris) { + OpenAPI_list_for_each(modifysubscription_data_subscription_200_response->monitored_resource_uris, node) { + ogs_free(node->data); + } + OpenAPI_list_free(modifysubscription_data_subscription_200_response->monitored_resource_uris); + modifysubscription_data_subscription_200_response->monitored_resource_uris = NULL; + } + if (modifysubscription_data_subscription_200_response->expiry) { + ogs_free(modifysubscription_data_subscription_200_response->expiry); + modifysubscription_data_subscription_200_response->expiry = NULL; + } + if (modifysubscription_data_subscription_200_response->sdm_subscription) { + OpenAPI_sdm_subscription_1_free(modifysubscription_data_subscription_200_response->sdm_subscription); + modifysubscription_data_subscription_200_response->sdm_subscription = NULL; + } + if (modifysubscription_data_subscription_200_response->hss_subscription_info) { + OpenAPI_hss_subscription_info_free(modifysubscription_data_subscription_200_response->hss_subscription_info); + modifysubscription_data_subscription_200_response->hss_subscription_info = NULL; + } + if (modifysubscription_data_subscription_200_response->subscription_id) { + ogs_free(modifysubscription_data_subscription_200_response->subscription_id); + modifysubscription_data_subscription_200_response->subscription_id = NULL; + } + if (modifysubscription_data_subscription_200_response->supported_features) { + ogs_free(modifysubscription_data_subscription_200_response->supported_features); + modifysubscription_data_subscription_200_response->supported_features = NULL; + } + ogs_free(modifysubscription_data_subscription_200_response); +} + +cJSON *OpenAPI_modifysubscription_data_subscription_200_response_convertToJSON(OpenAPI_modifysubscription_data_subscription_200_response_t *modifysubscription_data_subscription_200_response) +{ + cJSON *item = NULL; + OpenAPI_lnode_t *node = NULL; + + if (modifysubscription_data_subscription_200_response == NULL) { + ogs_error("OpenAPI_modifysubscription_data_subscription_200_response_convertToJSON() failed [ModifysubscriptionDataSubscription_200_response]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (!modifysubscription_data_subscription_200_response->report) { + ogs_error("OpenAPI_modifysubscription_data_subscription_200_response_convertToJSON() failed [report]"); + return NULL; + } + cJSON *reportList = cJSON_AddArrayToObject(item, "report"); + if (reportList == NULL) { + ogs_error("OpenAPI_modifysubscription_data_subscription_200_response_convertToJSON() failed [report]"); + goto end; + } + OpenAPI_list_for_each(modifysubscription_data_subscription_200_response->report, node) { + cJSON *itemLocal = OpenAPI_report_item_convertToJSON(node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_modifysubscription_data_subscription_200_response_convertToJSON() failed [report]"); + goto end; + } + cJSON_AddItemToArray(reportList, itemLocal); + } + + if (modifysubscription_data_subscription_200_response->ue_id) { + if (cJSON_AddStringToObject(item, "ueId", modifysubscription_data_subscription_200_response->ue_id) == NULL) { + ogs_error("OpenAPI_modifysubscription_data_subscription_200_response_convertToJSON() failed [ue_id]"); + goto end; + } + } + + if (!modifysubscription_data_subscription_200_response->callback_reference) { + ogs_error("OpenAPI_modifysubscription_data_subscription_200_response_convertToJSON() failed [callback_reference]"); + return NULL; + } + if (cJSON_AddStringToObject(item, "callbackReference", modifysubscription_data_subscription_200_response->callback_reference) == NULL) { + ogs_error("OpenAPI_modifysubscription_data_subscription_200_response_convertToJSON() failed [callback_reference]"); + goto end; + } + + if (modifysubscription_data_subscription_200_response->original_callback_reference) { + if (cJSON_AddStringToObject(item, "originalCallbackReference", modifysubscription_data_subscription_200_response->original_callback_reference) == NULL) { + ogs_error("OpenAPI_modifysubscription_data_subscription_200_response_convertToJSON() failed [original_callback_reference]"); + goto end; + } + } + + if (!modifysubscription_data_subscription_200_response->monitored_resource_uris) { + ogs_error("OpenAPI_modifysubscription_data_subscription_200_response_convertToJSON() failed [monitored_resource_uris]"); + return NULL; + } + cJSON *monitored_resource_urisList = cJSON_AddArrayToObject(item, "monitoredResourceUris"); + if (monitored_resource_urisList == NULL) { + ogs_error("OpenAPI_modifysubscription_data_subscription_200_response_convertToJSON() failed [monitored_resource_uris]"); + goto end; + } + OpenAPI_list_for_each(modifysubscription_data_subscription_200_response->monitored_resource_uris, node) { + if (cJSON_AddStringToObject(monitored_resource_urisList, "", (char*)node->data) == NULL) { + ogs_error("OpenAPI_modifysubscription_data_subscription_200_response_convertToJSON() failed [monitored_resource_uris]"); + goto end; + } + } + + if (modifysubscription_data_subscription_200_response->expiry) { + if (cJSON_AddStringToObject(item, "expiry", modifysubscription_data_subscription_200_response->expiry) == NULL) { + ogs_error("OpenAPI_modifysubscription_data_subscription_200_response_convertToJSON() failed [expiry]"); + goto end; + } + } + + if (modifysubscription_data_subscription_200_response->sdm_subscription) { + cJSON *sdm_subscription_local_JSON = OpenAPI_sdm_subscription_1_convertToJSON(modifysubscription_data_subscription_200_response->sdm_subscription); + if (sdm_subscription_local_JSON == NULL) { + ogs_error("OpenAPI_modifysubscription_data_subscription_200_response_convertToJSON() failed [sdm_subscription]"); + goto end; + } + cJSON_AddItemToObject(item, "sdmSubscription", sdm_subscription_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_modifysubscription_data_subscription_200_response_convertToJSON() failed [sdm_subscription]"); + goto end; + } + } + + if (modifysubscription_data_subscription_200_response->hss_subscription_info) { + cJSON *hss_subscription_info_local_JSON = OpenAPI_hss_subscription_info_convertToJSON(modifysubscription_data_subscription_200_response->hss_subscription_info); + if (hss_subscription_info_local_JSON == NULL) { + ogs_error("OpenAPI_modifysubscription_data_subscription_200_response_convertToJSON() failed [hss_subscription_info]"); + goto end; + } + cJSON_AddItemToObject(item, "hssSubscriptionInfo", hss_subscription_info_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_modifysubscription_data_subscription_200_response_convertToJSON() failed [hss_subscription_info]"); + goto end; + } + } + + if (modifysubscription_data_subscription_200_response->subscription_id) { + if (cJSON_AddStringToObject(item, "subscriptionId", modifysubscription_data_subscription_200_response->subscription_id) == NULL) { + ogs_error("OpenAPI_modifysubscription_data_subscription_200_response_convertToJSON() failed [subscription_id]"); + goto end; + } + } + + if (modifysubscription_data_subscription_200_response->is_unique_subscription) { + if (cJSON_AddBoolToObject(item, "uniqueSubscription", modifysubscription_data_subscription_200_response->unique_subscription) == NULL) { + ogs_error("OpenAPI_modifysubscription_data_subscription_200_response_convertToJSON() failed [unique_subscription]"); + goto end; + } + } + + if (modifysubscription_data_subscription_200_response->supported_features) { + if (cJSON_AddStringToObject(item, "supportedFeatures", modifysubscription_data_subscription_200_response->supported_features) == NULL) { + ogs_error("OpenAPI_modifysubscription_data_subscription_200_response_convertToJSON() failed [supported_features]"); + goto end; + } + } + +end: + return item; +} + +OpenAPI_modifysubscription_data_subscription_200_response_t *OpenAPI_modifysubscription_data_subscription_200_response_parseFromJSON(cJSON *modifysubscription_data_subscription_200_responseJSON) +{ + OpenAPI_modifysubscription_data_subscription_200_response_t *modifysubscription_data_subscription_200_response_local_var = NULL; + OpenAPI_lnode_t *node = NULL; + cJSON *report = NULL; + OpenAPI_list_t *reportList = NULL; + cJSON *ue_id = NULL; + cJSON *callback_reference = NULL; + cJSON *original_callback_reference = NULL; + cJSON *monitored_resource_uris = NULL; + OpenAPI_list_t *monitored_resource_urisList = NULL; + cJSON *expiry = NULL; + cJSON *sdm_subscription = NULL; + OpenAPI_sdm_subscription_1_t *sdm_subscription_local_nonprim = NULL; + cJSON *hss_subscription_info = NULL; + OpenAPI_hss_subscription_info_t *hss_subscription_info_local_nonprim = NULL; + cJSON *subscription_id = NULL; + cJSON *unique_subscription = NULL; + cJSON *supported_features = NULL; + report = cJSON_GetObjectItemCaseSensitive(modifysubscription_data_subscription_200_responseJSON, "report"); + if (!report) { + ogs_error("OpenAPI_modifysubscription_data_subscription_200_response_parseFromJSON() failed [report]"); + goto end; + } + cJSON *report_local = NULL; + if (!cJSON_IsArray(report)) { + ogs_error("OpenAPI_modifysubscription_data_subscription_200_response_parseFromJSON() failed [report]"); + goto end; + } + + reportList = OpenAPI_list_create(); + + cJSON_ArrayForEach(report_local, report) { + if (!cJSON_IsObject(report_local)) { + ogs_error("OpenAPI_modifysubscription_data_subscription_200_response_parseFromJSON() failed [report]"); + goto end; + } + OpenAPI_report_item_t *reportItem = OpenAPI_report_item_parseFromJSON(report_local); + if (!reportItem) { + ogs_error("No reportItem"); + OpenAPI_list_free(reportList); + goto end; + } + OpenAPI_list_add(reportList, reportItem); + } + + ue_id = cJSON_GetObjectItemCaseSensitive(modifysubscription_data_subscription_200_responseJSON, "ueId"); + if (ue_id) { + if (!cJSON_IsString(ue_id) && !cJSON_IsNull(ue_id)) { + ogs_error("OpenAPI_modifysubscription_data_subscription_200_response_parseFromJSON() failed [ue_id]"); + goto end; + } + } + + callback_reference = cJSON_GetObjectItemCaseSensitive(modifysubscription_data_subscription_200_responseJSON, "callbackReference"); + if (!callback_reference) { + ogs_error("OpenAPI_modifysubscription_data_subscription_200_response_parseFromJSON() failed [callback_reference]"); + goto end; + } + if (!cJSON_IsString(callback_reference)) { + ogs_error("OpenAPI_modifysubscription_data_subscription_200_response_parseFromJSON() failed [callback_reference]"); + goto end; + } + + original_callback_reference = cJSON_GetObjectItemCaseSensitive(modifysubscription_data_subscription_200_responseJSON, "originalCallbackReference"); + if (original_callback_reference) { + if (!cJSON_IsString(original_callback_reference) && !cJSON_IsNull(original_callback_reference)) { + ogs_error("OpenAPI_modifysubscription_data_subscription_200_response_parseFromJSON() failed [original_callback_reference]"); + goto end; + } + } + + monitored_resource_uris = cJSON_GetObjectItemCaseSensitive(modifysubscription_data_subscription_200_responseJSON, "monitoredResourceUris"); + if (!monitored_resource_uris) { + ogs_error("OpenAPI_modifysubscription_data_subscription_200_response_parseFromJSON() failed [monitored_resource_uris]"); + goto end; + } + cJSON *monitored_resource_uris_local = NULL; + if (!cJSON_IsArray(monitored_resource_uris)) { + ogs_error("OpenAPI_modifysubscription_data_subscription_200_response_parseFromJSON() failed [monitored_resource_uris]"); + goto end; + } + + monitored_resource_urisList = OpenAPI_list_create(); + + cJSON_ArrayForEach(monitored_resource_uris_local, monitored_resource_uris) { + double *localDouble = NULL; + int *localInt = NULL; + if (!cJSON_IsString(monitored_resource_uris_local)) { + ogs_error("OpenAPI_modifysubscription_data_subscription_200_response_parseFromJSON() failed [monitored_resource_uris]"); + goto end; + } + OpenAPI_list_add(monitored_resource_urisList, ogs_strdup(monitored_resource_uris_local->valuestring)); + } + + expiry = cJSON_GetObjectItemCaseSensitive(modifysubscription_data_subscription_200_responseJSON, "expiry"); + if (expiry) { + if (!cJSON_IsString(expiry) && !cJSON_IsNull(expiry)) { + ogs_error("OpenAPI_modifysubscription_data_subscription_200_response_parseFromJSON() failed [expiry]"); + goto end; + } + } + + sdm_subscription = cJSON_GetObjectItemCaseSensitive(modifysubscription_data_subscription_200_responseJSON, "sdmSubscription"); + if (sdm_subscription) { + sdm_subscription_local_nonprim = OpenAPI_sdm_subscription_1_parseFromJSON(sdm_subscription); + } + + hss_subscription_info = cJSON_GetObjectItemCaseSensitive(modifysubscription_data_subscription_200_responseJSON, "hssSubscriptionInfo"); + if (hss_subscription_info) { + hss_subscription_info_local_nonprim = OpenAPI_hss_subscription_info_parseFromJSON(hss_subscription_info); + } + + subscription_id = cJSON_GetObjectItemCaseSensitive(modifysubscription_data_subscription_200_responseJSON, "subscriptionId"); + if (subscription_id) { + if (!cJSON_IsString(subscription_id) && !cJSON_IsNull(subscription_id)) { + ogs_error("OpenAPI_modifysubscription_data_subscription_200_response_parseFromJSON() failed [subscription_id]"); + goto end; + } + } + + unique_subscription = cJSON_GetObjectItemCaseSensitive(modifysubscription_data_subscription_200_responseJSON, "uniqueSubscription"); + if (unique_subscription) { + if (!cJSON_IsBool(unique_subscription)) { + ogs_error("OpenAPI_modifysubscription_data_subscription_200_response_parseFromJSON() failed [unique_subscription]"); + goto end; + } + } + + supported_features = cJSON_GetObjectItemCaseSensitive(modifysubscription_data_subscription_200_responseJSON, "supportedFeatures"); + if (supported_features) { + if (!cJSON_IsString(supported_features) && !cJSON_IsNull(supported_features)) { + ogs_error("OpenAPI_modifysubscription_data_subscription_200_response_parseFromJSON() failed [supported_features]"); + goto end; + } + } + + modifysubscription_data_subscription_200_response_local_var = OpenAPI_modifysubscription_data_subscription_200_response_create ( + reportList, + ue_id && !cJSON_IsNull(ue_id) ? ogs_strdup(ue_id->valuestring) : NULL, + ogs_strdup(callback_reference->valuestring), + original_callback_reference && !cJSON_IsNull(original_callback_reference) ? ogs_strdup(original_callback_reference->valuestring) : NULL, + monitored_resource_urisList, + expiry && !cJSON_IsNull(expiry) ? ogs_strdup(expiry->valuestring) : NULL, + sdm_subscription ? sdm_subscription_local_nonprim : NULL, + hss_subscription_info ? hss_subscription_info_local_nonprim : NULL, + subscription_id && !cJSON_IsNull(subscription_id) ? ogs_strdup(subscription_id->valuestring) : NULL, + unique_subscription ? true : false, + unique_subscription ? unique_subscription->valueint : 0, + supported_features && !cJSON_IsNull(supported_features) ? ogs_strdup(supported_features->valuestring) : NULL + ); + + return modifysubscription_data_subscription_200_response_local_var; +end: + if (reportList) { + OpenAPI_list_for_each(reportList, node) { + OpenAPI_report_item_free(node->data); + } + OpenAPI_list_free(reportList); + reportList = NULL; + } + if (monitored_resource_urisList) { + OpenAPI_list_for_each(monitored_resource_urisList, node) { + ogs_free(node->data); + } + OpenAPI_list_free(monitored_resource_urisList); + monitored_resource_urisList = NULL; + } + if (sdm_subscription_local_nonprim) { + OpenAPI_sdm_subscription_1_free(sdm_subscription_local_nonprim); + sdm_subscription_local_nonprim = NULL; + } + if (hss_subscription_info_local_nonprim) { + OpenAPI_hss_subscription_info_free(hss_subscription_info_local_nonprim); + hss_subscription_info_local_nonprim = NULL; + } + return NULL; +} + +OpenAPI_modifysubscription_data_subscription_200_response_t *OpenAPI_modifysubscription_data_subscription_200_response_copy(OpenAPI_modifysubscription_data_subscription_200_response_t *dst, OpenAPI_modifysubscription_data_subscription_200_response_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_modifysubscription_data_subscription_200_response_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_modifysubscription_data_subscription_200_response_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_modifysubscription_data_subscription_200_response_free(dst); + dst = OpenAPI_modifysubscription_data_subscription_200_response_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/modifysubscription_data_subscription_200_response.h b/lib/sbi/openapi/model/modifysubscription_data_subscription_200_response.h new file mode 100644 index 000000000..aed0ff473 --- /dev/null +++ b/lib/sbi/openapi/model/modifysubscription_data_subscription_200_response.h @@ -0,0 +1,65 @@ +/* + * modifysubscription_data_subscription_200_response.h + * + * + */ + +#ifndef _OpenAPI_modifysubscription_data_subscription_200_response_H_ +#define _OpenAPI_modifysubscription_data_subscription_200_response_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "hss_subscription_info.h" +#include "patch_result.h" +#include "report_item.h" +#include "sdm_subscription_1.h" +#include "subscription_data_subscriptions.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_modifysubscription_data_subscription_200_response_s OpenAPI_modifysubscription_data_subscription_200_response_t; +typedef struct OpenAPI_modifysubscription_data_subscription_200_response_s { + OpenAPI_list_t *report; + char *ue_id; + char *callback_reference; + char *original_callback_reference; + OpenAPI_list_t *monitored_resource_uris; + char *expiry; + struct OpenAPI_sdm_subscription_1_s *sdm_subscription; + struct OpenAPI_hss_subscription_info_s *hss_subscription_info; + char *subscription_id; + bool is_unique_subscription; + int unique_subscription; + char *supported_features; +} OpenAPI_modifysubscription_data_subscription_200_response_t; + +OpenAPI_modifysubscription_data_subscription_200_response_t *OpenAPI_modifysubscription_data_subscription_200_response_create( + OpenAPI_list_t *report, + char *ue_id, + char *callback_reference, + char *original_callback_reference, + OpenAPI_list_t *monitored_resource_uris, + char *expiry, + OpenAPI_sdm_subscription_1_t *sdm_subscription, + OpenAPI_hss_subscription_info_t *hss_subscription_info, + char *subscription_id, + bool is_unique_subscription, + int unique_subscription, + char *supported_features +); +void OpenAPI_modifysubscription_data_subscription_200_response_free(OpenAPI_modifysubscription_data_subscription_200_response_t *modifysubscription_data_subscription_200_response); +OpenAPI_modifysubscription_data_subscription_200_response_t *OpenAPI_modifysubscription_data_subscription_200_response_parseFromJSON(cJSON *modifysubscription_data_subscription_200_responseJSON); +cJSON *OpenAPI_modifysubscription_data_subscription_200_response_convertToJSON(OpenAPI_modifysubscription_data_subscription_200_response_t *modifysubscription_data_subscription_200_response); +OpenAPI_modifysubscription_data_subscription_200_response_t *OpenAPI_modifysubscription_data_subscription_200_response_copy(OpenAPI_modifysubscription_data_subscription_200_response_t *dst, OpenAPI_modifysubscription_data_subscription_200_response_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_modifysubscription_data_subscription_200_response_H_ */ + diff --git a/lib/sbi/openapi/model/monitoring_configuration.c b/lib/sbi/openapi/model/monitoring_configuration.c index d955f51bb..39ce0eec9 100644 --- a/lib/sbi/openapi/model/monitoring_configuration.c +++ b/lib/sbi/openapi/model/monitoring_configuration.c @@ -18,10 +18,15 @@ OpenAPI_monitoring_configuration_t *OpenAPI_monitoring_configuration_create( int maximum_response_time, bool is_suggested_packet_num_dl, int suggested_packet_num_dl, + char *dnn, + OpenAPI_snssai_t *single_nssai, OpenAPI_pdu_session_status_cfg_t *pdu_session_status_cfg, OpenAPI_reachability_for_sms_configuration_t *reachability_for_sms_cfg, char *mtc_provider_information, - char *af_id + char *af_id, + OpenAPI_reachability_for_data_configuration_t *reachability_for_data_cfg, + bool is_idle_status_ind, + int idle_status_ind ) { OpenAPI_monitoring_configuration_t *monitoring_configuration_local_var = ogs_malloc(sizeof(OpenAPI_monitoring_configuration_t)); @@ -40,10 +45,15 @@ OpenAPI_monitoring_configuration_t *OpenAPI_monitoring_configuration_create( monitoring_configuration_local_var->maximum_response_time = maximum_response_time; monitoring_configuration_local_var->is_suggested_packet_num_dl = is_suggested_packet_num_dl; monitoring_configuration_local_var->suggested_packet_num_dl = suggested_packet_num_dl; + monitoring_configuration_local_var->dnn = dnn; + monitoring_configuration_local_var->single_nssai = single_nssai; monitoring_configuration_local_var->pdu_session_status_cfg = pdu_session_status_cfg; monitoring_configuration_local_var->reachability_for_sms_cfg = reachability_for_sms_cfg; monitoring_configuration_local_var->mtc_provider_information = mtc_provider_information; monitoring_configuration_local_var->af_id = af_id; + monitoring_configuration_local_var->reachability_for_data_cfg = reachability_for_data_cfg; + monitoring_configuration_local_var->is_idle_status_ind = is_idle_status_ind; + monitoring_configuration_local_var->idle_status_ind = idle_status_ind; return monitoring_configuration_local_var; } @@ -75,6 +85,14 @@ void OpenAPI_monitoring_configuration_free(OpenAPI_monitoring_configuration_t *m OpenAPI_loss_connectivity_cfg_free(monitoring_configuration->loss_connectivity_cfg); monitoring_configuration->loss_connectivity_cfg = NULL; } + if (monitoring_configuration->dnn) { + ogs_free(monitoring_configuration->dnn); + monitoring_configuration->dnn = NULL; + } + if (monitoring_configuration->single_nssai) { + OpenAPI_snssai_free(monitoring_configuration->single_nssai); + monitoring_configuration->single_nssai = NULL; + } if (monitoring_configuration->pdu_session_status_cfg) { OpenAPI_pdu_session_status_cfg_free(monitoring_configuration->pdu_session_status_cfg); monitoring_configuration->pdu_session_status_cfg = NULL; @@ -91,6 +109,10 @@ void OpenAPI_monitoring_configuration_free(OpenAPI_monitoring_configuration_t *m ogs_free(monitoring_configuration->af_id); monitoring_configuration->af_id = NULL; } + if (monitoring_configuration->reachability_for_data_cfg) { + OpenAPI_reachability_for_data_configuration_free(monitoring_configuration->reachability_for_data_cfg); + monitoring_configuration->reachability_for_data_cfg = NULL; + } ogs_free(monitoring_configuration); } @@ -200,6 +222,26 @@ cJSON *OpenAPI_monitoring_configuration_convertToJSON(OpenAPI_monitoring_configu } } + if (monitoring_configuration->dnn) { + if (cJSON_AddStringToObject(item, "dnn", monitoring_configuration->dnn) == NULL) { + ogs_error("OpenAPI_monitoring_configuration_convertToJSON() failed [dnn]"); + goto end; + } + } + + if (monitoring_configuration->single_nssai) { + cJSON *single_nssai_local_JSON = OpenAPI_snssai_convertToJSON(monitoring_configuration->single_nssai); + if (single_nssai_local_JSON == NULL) { + ogs_error("OpenAPI_monitoring_configuration_convertToJSON() failed [single_nssai]"); + goto end; + } + cJSON_AddItemToObject(item, "singleNssai", single_nssai_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_monitoring_configuration_convertToJSON() failed [single_nssai]"); + goto end; + } + } + if (monitoring_configuration->pdu_session_status_cfg) { cJSON *pdu_session_status_cfg_local_JSON = OpenAPI_pdu_session_status_cfg_convertToJSON(monitoring_configuration->pdu_session_status_cfg); if (pdu_session_status_cfg_local_JSON == NULL) { @@ -240,6 +282,26 @@ cJSON *OpenAPI_monitoring_configuration_convertToJSON(OpenAPI_monitoring_configu } } + if (monitoring_configuration->reachability_for_data_cfg) { + cJSON *reachability_for_data_cfg_local_JSON = OpenAPI_reachability_for_data_configuration_convertToJSON(monitoring_configuration->reachability_for_data_cfg); + if (reachability_for_data_cfg_local_JSON == NULL) { + ogs_error("OpenAPI_monitoring_configuration_convertToJSON() failed [reachability_for_data_cfg]"); + goto end; + } + cJSON_AddItemToObject(item, "reachabilityForDataCfg", reachability_for_data_cfg_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_monitoring_configuration_convertToJSON() failed [reachability_for_data_cfg]"); + goto end; + } + } + + if (monitoring_configuration->is_idle_status_ind) { + if (cJSON_AddBoolToObject(item, "idleStatusInd", monitoring_configuration->idle_status_ind) == NULL) { + ogs_error("OpenAPI_monitoring_configuration_convertToJSON() failed [idle_status_ind]"); + goto end; + } + } + end: return item; } @@ -262,12 +324,18 @@ OpenAPI_monitoring_configuration_t *OpenAPI_monitoring_configuration_parseFromJS cJSON *maximum_latency = NULL; cJSON *maximum_response_time = NULL; cJSON *suggested_packet_num_dl = NULL; + cJSON *dnn = NULL; + cJSON *single_nssai = NULL; + OpenAPI_snssai_t *single_nssai_local_nonprim = NULL; cJSON *pdu_session_status_cfg = NULL; OpenAPI_pdu_session_status_cfg_t *pdu_session_status_cfg_local_nonprim = NULL; cJSON *reachability_for_sms_cfg = NULL; OpenAPI_reachability_for_sms_configuration_t *reachability_for_sms_cfg_local_nonprim = NULL; cJSON *mtc_provider_information = NULL; cJSON *af_id = NULL; + cJSON *reachability_for_data_cfg = NULL; + OpenAPI_reachability_for_data_configuration_t *reachability_for_data_cfg_local_nonprim = NULL; + cJSON *idle_status_ind = NULL; event_type = cJSON_GetObjectItemCaseSensitive(monitoring_configurationJSON, "eventType"); if (!event_type) { ogs_error("OpenAPI_monitoring_configuration_parseFromJSON() failed [event_type]"); @@ -327,6 +395,19 @@ OpenAPI_monitoring_configuration_t *OpenAPI_monitoring_configuration_parseFromJS } } + dnn = cJSON_GetObjectItemCaseSensitive(monitoring_configurationJSON, "dnn"); + if (dnn) { + if (!cJSON_IsString(dnn) && !cJSON_IsNull(dnn)) { + ogs_error("OpenAPI_monitoring_configuration_parseFromJSON() failed [dnn]"); + goto end; + } + } + + single_nssai = cJSON_GetObjectItemCaseSensitive(monitoring_configurationJSON, "singleNssai"); + if (single_nssai) { + single_nssai_local_nonprim = OpenAPI_snssai_parseFromJSON(single_nssai); + } + pdu_session_status_cfg = cJSON_GetObjectItemCaseSensitive(monitoring_configurationJSON, "pduSessionStatusCfg"); if (pdu_session_status_cfg) { pdu_session_status_cfg_local_nonprim = OpenAPI_pdu_session_status_cfg_parseFromJSON(pdu_session_status_cfg); @@ -353,6 +434,19 @@ OpenAPI_monitoring_configuration_t *OpenAPI_monitoring_configuration_parseFromJS } } + reachability_for_data_cfg = cJSON_GetObjectItemCaseSensitive(monitoring_configurationJSON, "reachabilityForDataCfg"); + if (reachability_for_data_cfg) { + reachability_for_data_cfg_local_nonprim = OpenAPI_reachability_for_data_configuration_parseFromJSON(reachability_for_data_cfg); + } + + idle_status_ind = cJSON_GetObjectItemCaseSensitive(monitoring_configurationJSON, "idleStatusInd"); + if (idle_status_ind) { + if (!cJSON_IsBool(idle_status_ind)) { + ogs_error("OpenAPI_monitoring_configuration_parseFromJSON() failed [idle_status_ind]"); + goto end; + } + } + monitoring_configuration_local_var = OpenAPI_monitoring_configuration_create ( event_type_local_nonprim, immediate_flag ? true : false, @@ -367,10 +461,15 @@ OpenAPI_monitoring_configuration_t *OpenAPI_monitoring_configuration_parseFromJS maximum_response_time ? maximum_response_time->valuedouble : 0, suggested_packet_num_dl ? true : false, suggested_packet_num_dl ? suggested_packet_num_dl->valuedouble : 0, + dnn && !cJSON_IsNull(dnn) ? ogs_strdup(dnn->valuestring) : NULL, + single_nssai ? single_nssai_local_nonprim : NULL, pdu_session_status_cfg ? pdu_session_status_cfg_local_nonprim : NULL, reachability_for_sms_cfg ? reachability_for_sms_cfg_local_nonprim : NULL, mtc_provider_information && !cJSON_IsNull(mtc_provider_information) ? ogs_strdup(mtc_provider_information->valuestring) : NULL, - af_id && !cJSON_IsNull(af_id) ? ogs_strdup(af_id->valuestring) : NULL + af_id && !cJSON_IsNull(af_id) ? ogs_strdup(af_id->valuestring) : NULL, + reachability_for_data_cfg ? reachability_for_data_cfg_local_nonprim : NULL, + idle_status_ind ? true : false, + idle_status_ind ? idle_status_ind->valueint : 0 ); return monitoring_configuration_local_var; @@ -395,6 +494,10 @@ end: OpenAPI_loss_connectivity_cfg_free(loss_connectivity_cfg_local_nonprim); loss_connectivity_cfg_local_nonprim = NULL; } + if (single_nssai_local_nonprim) { + OpenAPI_snssai_free(single_nssai_local_nonprim); + single_nssai_local_nonprim = NULL; + } if (pdu_session_status_cfg_local_nonprim) { OpenAPI_pdu_session_status_cfg_free(pdu_session_status_cfg_local_nonprim); pdu_session_status_cfg_local_nonprim = NULL; @@ -403,6 +506,10 @@ end: OpenAPI_reachability_for_sms_configuration_free(reachability_for_sms_cfg_local_nonprim); reachability_for_sms_cfg_local_nonprim = NULL; } + if (reachability_for_data_cfg_local_nonprim) { + OpenAPI_reachability_for_data_configuration_free(reachability_for_data_cfg_local_nonprim); + reachability_for_data_cfg_local_nonprim = NULL; + } return NULL; } diff --git a/lib/sbi/openapi/model/monitoring_configuration.h b/lib/sbi/openapi/model/monitoring_configuration.h index 25f1f4837..bf3a6304f 100644 --- a/lib/sbi/openapi/model/monitoring_configuration.h +++ b/lib/sbi/openapi/model/monitoring_configuration.h @@ -18,7 +18,9 @@ #include "location_reporting_configuration.h" #include "loss_connectivity_cfg.h" #include "pdu_session_status_cfg.h" +#include "reachability_for_data_configuration.h" #include "reachability_for_sms_configuration.h" +#include "snssai.h" #ifdef __cplusplus extern "C" { @@ -39,10 +41,15 @@ typedef struct OpenAPI_monitoring_configuration_s { int maximum_response_time; bool is_suggested_packet_num_dl; int suggested_packet_num_dl; + char *dnn; + struct OpenAPI_snssai_s *single_nssai; struct OpenAPI_pdu_session_status_cfg_s *pdu_session_status_cfg; struct OpenAPI_reachability_for_sms_configuration_s *reachability_for_sms_cfg; char *mtc_provider_information; char *af_id; + struct OpenAPI_reachability_for_data_configuration_s *reachability_for_data_cfg; + bool is_idle_status_ind; + int idle_status_ind; } OpenAPI_monitoring_configuration_t; OpenAPI_monitoring_configuration_t *OpenAPI_monitoring_configuration_create( @@ -59,10 +66,15 @@ OpenAPI_monitoring_configuration_t *OpenAPI_monitoring_configuration_create( int maximum_response_time, bool is_suggested_packet_num_dl, int suggested_packet_num_dl, + char *dnn, + OpenAPI_snssai_t *single_nssai, OpenAPI_pdu_session_status_cfg_t *pdu_session_status_cfg, OpenAPI_reachability_for_sms_configuration_t *reachability_for_sms_cfg, char *mtc_provider_information, - char *af_id + char *af_id, + OpenAPI_reachability_for_data_configuration_t *reachability_for_data_cfg, + bool is_idle_status_ind, + int idle_status_ind ); void OpenAPI_monitoring_configuration_free(OpenAPI_monitoring_configuration_t *monitoring_configuration); OpenAPI_monitoring_configuration_t *OpenAPI_monitoring_configuration_parseFromJSON(cJSON *monitoring_configurationJSON); diff --git a/lib/sbi/openapi/model/monitoring_configuration_1.c b/lib/sbi/openapi/model/monitoring_configuration_1.c new file mode 100644 index 000000000..d25b0cab5 --- /dev/null +++ b/lib/sbi/openapi/model/monitoring_configuration_1.c @@ -0,0 +1,549 @@ + +#include +#include +#include +#include "monitoring_configuration_1.h" + +OpenAPI_monitoring_configuration_1_t *OpenAPI_monitoring_configuration_1_create( + OpenAPI_event_type_t *event_type, + bool is_immediate_flag, + int immediate_flag, + OpenAPI_location_reporting_configuration_1_t *location_reporting_configuration, + OpenAPI_association_type_t *association_type, + OpenAPI_datalink_reporting_configuration_1_t *datalink_report_cfg, + OpenAPI_loss_connectivity_cfg_1_t *loss_connectivity_cfg, + bool is_maximum_latency, + int maximum_latency, + bool is_maximum_response_time, + int maximum_response_time, + bool is_suggested_packet_num_dl, + int suggested_packet_num_dl, + char *dnn, + OpenAPI_snssai_t *single_nssai, + OpenAPI_pdu_session_status_cfg_1_t *pdu_session_status_cfg, + OpenAPI_reachability_for_sms_configuration_t *reachability_for_sms_cfg, + char *mtc_provider_information, + char *af_id, + OpenAPI_reachability_for_data_configuration_1_t *reachability_for_data_cfg, + bool is_idle_status_ind, + int idle_status_ind +) +{ + OpenAPI_monitoring_configuration_1_t *monitoring_configuration_1_local_var = ogs_malloc(sizeof(OpenAPI_monitoring_configuration_1_t)); + ogs_assert(monitoring_configuration_1_local_var); + + monitoring_configuration_1_local_var->event_type = event_type; + monitoring_configuration_1_local_var->is_immediate_flag = is_immediate_flag; + monitoring_configuration_1_local_var->immediate_flag = immediate_flag; + monitoring_configuration_1_local_var->location_reporting_configuration = location_reporting_configuration; + monitoring_configuration_1_local_var->association_type = association_type; + monitoring_configuration_1_local_var->datalink_report_cfg = datalink_report_cfg; + monitoring_configuration_1_local_var->loss_connectivity_cfg = loss_connectivity_cfg; + monitoring_configuration_1_local_var->is_maximum_latency = is_maximum_latency; + monitoring_configuration_1_local_var->maximum_latency = maximum_latency; + monitoring_configuration_1_local_var->is_maximum_response_time = is_maximum_response_time; + monitoring_configuration_1_local_var->maximum_response_time = maximum_response_time; + monitoring_configuration_1_local_var->is_suggested_packet_num_dl = is_suggested_packet_num_dl; + monitoring_configuration_1_local_var->suggested_packet_num_dl = suggested_packet_num_dl; + monitoring_configuration_1_local_var->dnn = dnn; + monitoring_configuration_1_local_var->single_nssai = single_nssai; + monitoring_configuration_1_local_var->pdu_session_status_cfg = pdu_session_status_cfg; + monitoring_configuration_1_local_var->reachability_for_sms_cfg = reachability_for_sms_cfg; + monitoring_configuration_1_local_var->mtc_provider_information = mtc_provider_information; + monitoring_configuration_1_local_var->af_id = af_id; + monitoring_configuration_1_local_var->reachability_for_data_cfg = reachability_for_data_cfg; + monitoring_configuration_1_local_var->is_idle_status_ind = is_idle_status_ind; + monitoring_configuration_1_local_var->idle_status_ind = idle_status_ind; + + return monitoring_configuration_1_local_var; +} + +void OpenAPI_monitoring_configuration_1_free(OpenAPI_monitoring_configuration_1_t *monitoring_configuration_1) +{ + OpenAPI_lnode_t *node = NULL; + + if (NULL == monitoring_configuration_1) { + return; + } + if (monitoring_configuration_1->event_type) { + OpenAPI_event_type_free(monitoring_configuration_1->event_type); + monitoring_configuration_1->event_type = NULL; + } + if (monitoring_configuration_1->location_reporting_configuration) { + OpenAPI_location_reporting_configuration_1_free(monitoring_configuration_1->location_reporting_configuration); + monitoring_configuration_1->location_reporting_configuration = NULL; + } + if (monitoring_configuration_1->association_type) { + OpenAPI_association_type_free(monitoring_configuration_1->association_type); + monitoring_configuration_1->association_type = NULL; + } + if (monitoring_configuration_1->datalink_report_cfg) { + OpenAPI_datalink_reporting_configuration_1_free(monitoring_configuration_1->datalink_report_cfg); + monitoring_configuration_1->datalink_report_cfg = NULL; + } + if (monitoring_configuration_1->loss_connectivity_cfg) { + OpenAPI_loss_connectivity_cfg_1_free(monitoring_configuration_1->loss_connectivity_cfg); + monitoring_configuration_1->loss_connectivity_cfg = NULL; + } + if (monitoring_configuration_1->dnn) { + ogs_free(monitoring_configuration_1->dnn); + monitoring_configuration_1->dnn = NULL; + } + if (monitoring_configuration_1->single_nssai) { + OpenAPI_snssai_free(monitoring_configuration_1->single_nssai); + monitoring_configuration_1->single_nssai = NULL; + } + if (monitoring_configuration_1->pdu_session_status_cfg) { + OpenAPI_pdu_session_status_cfg_1_free(monitoring_configuration_1->pdu_session_status_cfg); + monitoring_configuration_1->pdu_session_status_cfg = NULL; + } + if (monitoring_configuration_1->reachability_for_sms_cfg) { + OpenAPI_reachability_for_sms_configuration_free(monitoring_configuration_1->reachability_for_sms_cfg); + monitoring_configuration_1->reachability_for_sms_cfg = NULL; + } + if (monitoring_configuration_1->mtc_provider_information) { + ogs_free(monitoring_configuration_1->mtc_provider_information); + monitoring_configuration_1->mtc_provider_information = NULL; + } + if (monitoring_configuration_1->af_id) { + ogs_free(monitoring_configuration_1->af_id); + monitoring_configuration_1->af_id = NULL; + } + if (monitoring_configuration_1->reachability_for_data_cfg) { + OpenAPI_reachability_for_data_configuration_1_free(monitoring_configuration_1->reachability_for_data_cfg); + monitoring_configuration_1->reachability_for_data_cfg = NULL; + } + ogs_free(monitoring_configuration_1); +} + +cJSON *OpenAPI_monitoring_configuration_1_convertToJSON(OpenAPI_monitoring_configuration_1_t *monitoring_configuration_1) +{ + cJSON *item = NULL; + OpenAPI_lnode_t *node = NULL; + + if (monitoring_configuration_1 == NULL) { + ogs_error("OpenAPI_monitoring_configuration_1_convertToJSON() failed [MonitoringConfiguration_1]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (!monitoring_configuration_1->event_type) { + ogs_error("OpenAPI_monitoring_configuration_1_convertToJSON() failed [event_type]"); + return NULL; + } + cJSON *event_type_local_JSON = OpenAPI_event_type_convertToJSON(monitoring_configuration_1->event_type); + if (event_type_local_JSON == NULL) { + ogs_error("OpenAPI_monitoring_configuration_1_convertToJSON() failed [event_type]"); + goto end; + } + cJSON_AddItemToObject(item, "eventType", event_type_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_monitoring_configuration_1_convertToJSON() failed [event_type]"); + goto end; + } + + if (monitoring_configuration_1->is_immediate_flag) { + if (cJSON_AddBoolToObject(item, "immediateFlag", monitoring_configuration_1->immediate_flag) == NULL) { + ogs_error("OpenAPI_monitoring_configuration_1_convertToJSON() failed [immediate_flag]"); + goto end; + } + } + + if (monitoring_configuration_1->location_reporting_configuration) { + cJSON *location_reporting_configuration_local_JSON = OpenAPI_location_reporting_configuration_1_convertToJSON(monitoring_configuration_1->location_reporting_configuration); + if (location_reporting_configuration_local_JSON == NULL) { + ogs_error("OpenAPI_monitoring_configuration_1_convertToJSON() failed [location_reporting_configuration]"); + goto end; + } + cJSON_AddItemToObject(item, "locationReportingConfiguration", location_reporting_configuration_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_monitoring_configuration_1_convertToJSON() failed [location_reporting_configuration]"); + goto end; + } + } + + if (monitoring_configuration_1->association_type) { + cJSON *association_type_local_JSON = OpenAPI_association_type_convertToJSON(monitoring_configuration_1->association_type); + if (association_type_local_JSON == NULL) { + ogs_error("OpenAPI_monitoring_configuration_1_convertToJSON() failed [association_type]"); + goto end; + } + cJSON_AddItemToObject(item, "associationType", association_type_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_monitoring_configuration_1_convertToJSON() failed [association_type]"); + goto end; + } + } + + if (monitoring_configuration_1->datalink_report_cfg) { + cJSON *datalink_report_cfg_local_JSON = OpenAPI_datalink_reporting_configuration_1_convertToJSON(monitoring_configuration_1->datalink_report_cfg); + if (datalink_report_cfg_local_JSON == NULL) { + ogs_error("OpenAPI_monitoring_configuration_1_convertToJSON() failed [datalink_report_cfg]"); + goto end; + } + cJSON_AddItemToObject(item, "datalinkReportCfg", datalink_report_cfg_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_monitoring_configuration_1_convertToJSON() failed [datalink_report_cfg]"); + goto end; + } + } + + if (monitoring_configuration_1->loss_connectivity_cfg) { + cJSON *loss_connectivity_cfg_local_JSON = OpenAPI_loss_connectivity_cfg_1_convertToJSON(monitoring_configuration_1->loss_connectivity_cfg); + if (loss_connectivity_cfg_local_JSON == NULL) { + ogs_error("OpenAPI_monitoring_configuration_1_convertToJSON() failed [loss_connectivity_cfg]"); + goto end; + } + cJSON_AddItemToObject(item, "lossConnectivityCfg", loss_connectivity_cfg_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_monitoring_configuration_1_convertToJSON() failed [loss_connectivity_cfg]"); + goto end; + } + } + + if (monitoring_configuration_1->is_maximum_latency) { + if (cJSON_AddNumberToObject(item, "maximumLatency", monitoring_configuration_1->maximum_latency) == NULL) { + ogs_error("OpenAPI_monitoring_configuration_1_convertToJSON() failed [maximum_latency]"); + goto end; + } + } + + if (monitoring_configuration_1->is_maximum_response_time) { + if (cJSON_AddNumberToObject(item, "maximumResponseTime", monitoring_configuration_1->maximum_response_time) == NULL) { + ogs_error("OpenAPI_monitoring_configuration_1_convertToJSON() failed [maximum_response_time]"); + goto end; + } + } + + if (monitoring_configuration_1->is_suggested_packet_num_dl) { + if (cJSON_AddNumberToObject(item, "suggestedPacketNumDl", monitoring_configuration_1->suggested_packet_num_dl) == NULL) { + ogs_error("OpenAPI_monitoring_configuration_1_convertToJSON() failed [suggested_packet_num_dl]"); + goto end; + } + } + + if (monitoring_configuration_1->dnn) { + if (cJSON_AddStringToObject(item, "dnn", monitoring_configuration_1->dnn) == NULL) { + ogs_error("OpenAPI_monitoring_configuration_1_convertToJSON() failed [dnn]"); + goto end; + } + } + + if (monitoring_configuration_1->single_nssai) { + cJSON *single_nssai_local_JSON = OpenAPI_snssai_convertToJSON(monitoring_configuration_1->single_nssai); + if (single_nssai_local_JSON == NULL) { + ogs_error("OpenAPI_monitoring_configuration_1_convertToJSON() failed [single_nssai]"); + goto end; + } + cJSON_AddItemToObject(item, "singleNssai", single_nssai_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_monitoring_configuration_1_convertToJSON() failed [single_nssai]"); + goto end; + } + } + + if (monitoring_configuration_1->pdu_session_status_cfg) { + cJSON *pdu_session_status_cfg_local_JSON = OpenAPI_pdu_session_status_cfg_1_convertToJSON(monitoring_configuration_1->pdu_session_status_cfg); + if (pdu_session_status_cfg_local_JSON == NULL) { + ogs_error("OpenAPI_monitoring_configuration_1_convertToJSON() failed [pdu_session_status_cfg]"); + goto end; + } + cJSON_AddItemToObject(item, "pduSessionStatusCfg", pdu_session_status_cfg_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_monitoring_configuration_1_convertToJSON() failed [pdu_session_status_cfg]"); + goto end; + } + } + + if (monitoring_configuration_1->reachability_for_sms_cfg) { + cJSON *reachability_for_sms_cfg_local_JSON = OpenAPI_reachability_for_sms_configuration_convertToJSON(monitoring_configuration_1->reachability_for_sms_cfg); + if (reachability_for_sms_cfg_local_JSON == NULL) { + ogs_error("OpenAPI_monitoring_configuration_1_convertToJSON() failed [reachability_for_sms_cfg]"); + goto end; + } + cJSON_AddItemToObject(item, "reachabilityForSmsCfg", reachability_for_sms_cfg_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_monitoring_configuration_1_convertToJSON() failed [reachability_for_sms_cfg]"); + goto end; + } + } + + if (monitoring_configuration_1->mtc_provider_information) { + if (cJSON_AddStringToObject(item, "mtcProviderInformation", monitoring_configuration_1->mtc_provider_information) == NULL) { + ogs_error("OpenAPI_monitoring_configuration_1_convertToJSON() failed [mtc_provider_information]"); + goto end; + } + } + + if (monitoring_configuration_1->af_id) { + if (cJSON_AddStringToObject(item, "afId", monitoring_configuration_1->af_id) == NULL) { + ogs_error("OpenAPI_monitoring_configuration_1_convertToJSON() failed [af_id]"); + goto end; + } + } + + if (monitoring_configuration_1->reachability_for_data_cfg) { + cJSON *reachability_for_data_cfg_local_JSON = OpenAPI_reachability_for_data_configuration_1_convertToJSON(monitoring_configuration_1->reachability_for_data_cfg); + if (reachability_for_data_cfg_local_JSON == NULL) { + ogs_error("OpenAPI_monitoring_configuration_1_convertToJSON() failed [reachability_for_data_cfg]"); + goto end; + } + cJSON_AddItemToObject(item, "reachabilityForDataCfg", reachability_for_data_cfg_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_monitoring_configuration_1_convertToJSON() failed [reachability_for_data_cfg]"); + goto end; + } + } + + if (monitoring_configuration_1->is_idle_status_ind) { + if (cJSON_AddBoolToObject(item, "idleStatusInd", monitoring_configuration_1->idle_status_ind) == NULL) { + ogs_error("OpenAPI_monitoring_configuration_1_convertToJSON() failed [idle_status_ind]"); + goto end; + } + } + +end: + return item; +} + +OpenAPI_monitoring_configuration_1_t *OpenAPI_monitoring_configuration_1_parseFromJSON(cJSON *monitoring_configuration_1JSON) +{ + OpenAPI_monitoring_configuration_1_t *monitoring_configuration_1_local_var = NULL; + OpenAPI_lnode_t *node = NULL; + cJSON *event_type = NULL; + OpenAPI_event_type_t *event_type_local_nonprim = NULL; + cJSON *immediate_flag = NULL; + cJSON *location_reporting_configuration = NULL; + OpenAPI_location_reporting_configuration_1_t *location_reporting_configuration_local_nonprim = NULL; + cJSON *association_type = NULL; + OpenAPI_association_type_t *association_type_local_nonprim = NULL; + cJSON *datalink_report_cfg = NULL; + OpenAPI_datalink_reporting_configuration_1_t *datalink_report_cfg_local_nonprim = NULL; + cJSON *loss_connectivity_cfg = NULL; + OpenAPI_loss_connectivity_cfg_1_t *loss_connectivity_cfg_local_nonprim = NULL; + cJSON *maximum_latency = NULL; + cJSON *maximum_response_time = NULL; + cJSON *suggested_packet_num_dl = NULL; + cJSON *dnn = NULL; + cJSON *single_nssai = NULL; + OpenAPI_snssai_t *single_nssai_local_nonprim = NULL; + cJSON *pdu_session_status_cfg = NULL; + OpenAPI_pdu_session_status_cfg_1_t *pdu_session_status_cfg_local_nonprim = NULL; + cJSON *reachability_for_sms_cfg = NULL; + OpenAPI_reachability_for_sms_configuration_t *reachability_for_sms_cfg_local_nonprim = NULL; + cJSON *mtc_provider_information = NULL; + cJSON *af_id = NULL; + cJSON *reachability_for_data_cfg = NULL; + OpenAPI_reachability_for_data_configuration_1_t *reachability_for_data_cfg_local_nonprim = NULL; + cJSON *idle_status_ind = NULL; + event_type = cJSON_GetObjectItemCaseSensitive(monitoring_configuration_1JSON, "eventType"); + if (!event_type) { + ogs_error("OpenAPI_monitoring_configuration_1_parseFromJSON() failed [event_type]"); + goto end; + } + event_type_local_nonprim = OpenAPI_event_type_parseFromJSON(event_type); + + immediate_flag = cJSON_GetObjectItemCaseSensitive(monitoring_configuration_1JSON, "immediateFlag"); + if (immediate_flag) { + if (!cJSON_IsBool(immediate_flag)) { + ogs_error("OpenAPI_monitoring_configuration_1_parseFromJSON() failed [immediate_flag]"); + goto end; + } + } + + location_reporting_configuration = cJSON_GetObjectItemCaseSensitive(monitoring_configuration_1JSON, "locationReportingConfiguration"); + if (location_reporting_configuration) { + location_reporting_configuration_local_nonprim = OpenAPI_location_reporting_configuration_1_parseFromJSON(location_reporting_configuration); + } + + association_type = cJSON_GetObjectItemCaseSensitive(monitoring_configuration_1JSON, "associationType"); + if (association_type) { + association_type_local_nonprim = OpenAPI_association_type_parseFromJSON(association_type); + } + + datalink_report_cfg = cJSON_GetObjectItemCaseSensitive(monitoring_configuration_1JSON, "datalinkReportCfg"); + if (datalink_report_cfg) { + datalink_report_cfg_local_nonprim = OpenAPI_datalink_reporting_configuration_1_parseFromJSON(datalink_report_cfg); + } + + loss_connectivity_cfg = cJSON_GetObjectItemCaseSensitive(monitoring_configuration_1JSON, "lossConnectivityCfg"); + if (loss_connectivity_cfg) { + loss_connectivity_cfg_local_nonprim = OpenAPI_loss_connectivity_cfg_1_parseFromJSON(loss_connectivity_cfg); + } + + maximum_latency = cJSON_GetObjectItemCaseSensitive(monitoring_configuration_1JSON, "maximumLatency"); + if (maximum_latency) { + if (!cJSON_IsNumber(maximum_latency)) { + ogs_error("OpenAPI_monitoring_configuration_1_parseFromJSON() failed [maximum_latency]"); + goto end; + } + } + + maximum_response_time = cJSON_GetObjectItemCaseSensitive(monitoring_configuration_1JSON, "maximumResponseTime"); + if (maximum_response_time) { + if (!cJSON_IsNumber(maximum_response_time)) { + ogs_error("OpenAPI_monitoring_configuration_1_parseFromJSON() failed [maximum_response_time]"); + goto end; + } + } + + suggested_packet_num_dl = cJSON_GetObjectItemCaseSensitive(monitoring_configuration_1JSON, "suggestedPacketNumDl"); + if (suggested_packet_num_dl) { + if (!cJSON_IsNumber(suggested_packet_num_dl)) { + ogs_error("OpenAPI_monitoring_configuration_1_parseFromJSON() failed [suggested_packet_num_dl]"); + goto end; + } + } + + dnn = cJSON_GetObjectItemCaseSensitive(monitoring_configuration_1JSON, "dnn"); + if (dnn) { + if (!cJSON_IsString(dnn) && !cJSON_IsNull(dnn)) { + ogs_error("OpenAPI_monitoring_configuration_1_parseFromJSON() failed [dnn]"); + goto end; + } + } + + single_nssai = cJSON_GetObjectItemCaseSensitive(monitoring_configuration_1JSON, "singleNssai"); + if (single_nssai) { + single_nssai_local_nonprim = OpenAPI_snssai_parseFromJSON(single_nssai); + } + + pdu_session_status_cfg = cJSON_GetObjectItemCaseSensitive(monitoring_configuration_1JSON, "pduSessionStatusCfg"); + if (pdu_session_status_cfg) { + pdu_session_status_cfg_local_nonprim = OpenAPI_pdu_session_status_cfg_1_parseFromJSON(pdu_session_status_cfg); + } + + reachability_for_sms_cfg = cJSON_GetObjectItemCaseSensitive(monitoring_configuration_1JSON, "reachabilityForSmsCfg"); + if (reachability_for_sms_cfg) { + reachability_for_sms_cfg_local_nonprim = OpenAPI_reachability_for_sms_configuration_parseFromJSON(reachability_for_sms_cfg); + } + + mtc_provider_information = cJSON_GetObjectItemCaseSensitive(monitoring_configuration_1JSON, "mtcProviderInformation"); + if (mtc_provider_information) { + if (!cJSON_IsString(mtc_provider_information) && !cJSON_IsNull(mtc_provider_information)) { + ogs_error("OpenAPI_monitoring_configuration_1_parseFromJSON() failed [mtc_provider_information]"); + goto end; + } + } + + af_id = cJSON_GetObjectItemCaseSensitive(monitoring_configuration_1JSON, "afId"); + if (af_id) { + if (!cJSON_IsString(af_id) && !cJSON_IsNull(af_id)) { + ogs_error("OpenAPI_monitoring_configuration_1_parseFromJSON() failed [af_id]"); + goto end; + } + } + + reachability_for_data_cfg = cJSON_GetObjectItemCaseSensitive(monitoring_configuration_1JSON, "reachabilityForDataCfg"); + if (reachability_for_data_cfg) { + reachability_for_data_cfg_local_nonprim = OpenAPI_reachability_for_data_configuration_1_parseFromJSON(reachability_for_data_cfg); + } + + idle_status_ind = cJSON_GetObjectItemCaseSensitive(monitoring_configuration_1JSON, "idleStatusInd"); + if (idle_status_ind) { + if (!cJSON_IsBool(idle_status_ind)) { + ogs_error("OpenAPI_monitoring_configuration_1_parseFromJSON() failed [idle_status_ind]"); + goto end; + } + } + + monitoring_configuration_1_local_var = OpenAPI_monitoring_configuration_1_create ( + event_type_local_nonprim, + immediate_flag ? true : false, + immediate_flag ? immediate_flag->valueint : 0, + location_reporting_configuration ? location_reporting_configuration_local_nonprim : NULL, + association_type ? association_type_local_nonprim : NULL, + datalink_report_cfg ? datalink_report_cfg_local_nonprim : NULL, + loss_connectivity_cfg ? loss_connectivity_cfg_local_nonprim : NULL, + maximum_latency ? true : false, + maximum_latency ? maximum_latency->valuedouble : 0, + maximum_response_time ? true : false, + maximum_response_time ? maximum_response_time->valuedouble : 0, + suggested_packet_num_dl ? true : false, + suggested_packet_num_dl ? suggested_packet_num_dl->valuedouble : 0, + dnn && !cJSON_IsNull(dnn) ? ogs_strdup(dnn->valuestring) : NULL, + single_nssai ? single_nssai_local_nonprim : NULL, + pdu_session_status_cfg ? pdu_session_status_cfg_local_nonprim : NULL, + reachability_for_sms_cfg ? reachability_for_sms_cfg_local_nonprim : NULL, + mtc_provider_information && !cJSON_IsNull(mtc_provider_information) ? ogs_strdup(mtc_provider_information->valuestring) : NULL, + af_id && !cJSON_IsNull(af_id) ? ogs_strdup(af_id->valuestring) : NULL, + reachability_for_data_cfg ? reachability_for_data_cfg_local_nonprim : NULL, + idle_status_ind ? true : false, + idle_status_ind ? idle_status_ind->valueint : 0 + ); + + return monitoring_configuration_1_local_var; +end: + if (event_type_local_nonprim) { + OpenAPI_event_type_free(event_type_local_nonprim); + event_type_local_nonprim = NULL; + } + if (location_reporting_configuration_local_nonprim) { + OpenAPI_location_reporting_configuration_1_free(location_reporting_configuration_local_nonprim); + location_reporting_configuration_local_nonprim = NULL; + } + if (association_type_local_nonprim) { + OpenAPI_association_type_free(association_type_local_nonprim); + association_type_local_nonprim = NULL; + } + if (datalink_report_cfg_local_nonprim) { + OpenAPI_datalink_reporting_configuration_1_free(datalink_report_cfg_local_nonprim); + datalink_report_cfg_local_nonprim = NULL; + } + if (loss_connectivity_cfg_local_nonprim) { + OpenAPI_loss_connectivity_cfg_1_free(loss_connectivity_cfg_local_nonprim); + loss_connectivity_cfg_local_nonprim = NULL; + } + if (single_nssai_local_nonprim) { + OpenAPI_snssai_free(single_nssai_local_nonprim); + single_nssai_local_nonprim = NULL; + } + if (pdu_session_status_cfg_local_nonprim) { + OpenAPI_pdu_session_status_cfg_1_free(pdu_session_status_cfg_local_nonprim); + pdu_session_status_cfg_local_nonprim = NULL; + } + if (reachability_for_sms_cfg_local_nonprim) { + OpenAPI_reachability_for_sms_configuration_free(reachability_for_sms_cfg_local_nonprim); + reachability_for_sms_cfg_local_nonprim = NULL; + } + if (reachability_for_data_cfg_local_nonprim) { + OpenAPI_reachability_for_data_configuration_1_free(reachability_for_data_cfg_local_nonprim); + reachability_for_data_cfg_local_nonprim = NULL; + } + return NULL; +} + +OpenAPI_monitoring_configuration_1_t *OpenAPI_monitoring_configuration_1_copy(OpenAPI_monitoring_configuration_1_t *dst, OpenAPI_monitoring_configuration_1_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_monitoring_configuration_1_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_monitoring_configuration_1_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_monitoring_configuration_1_free(dst); + dst = OpenAPI_monitoring_configuration_1_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/monitoring_configuration_1.h b/lib/sbi/openapi/model/monitoring_configuration_1.h new file mode 100644 index 000000000..ec957a871 --- /dev/null +++ b/lib/sbi/openapi/model/monitoring_configuration_1.h @@ -0,0 +1,89 @@ +/* + * monitoring_configuration_1.h + * + * + */ + +#ifndef _OpenAPI_monitoring_configuration_1_H_ +#define _OpenAPI_monitoring_configuration_1_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "association_type.h" +#include "datalink_reporting_configuration_1.h" +#include "event_type.h" +#include "location_reporting_configuration_1.h" +#include "loss_connectivity_cfg_1.h" +#include "pdu_session_status_cfg_1.h" +#include "reachability_for_data_configuration_1.h" +#include "reachability_for_sms_configuration.h" +#include "snssai.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_monitoring_configuration_1_s OpenAPI_monitoring_configuration_1_t; +typedef struct OpenAPI_monitoring_configuration_1_s { + struct OpenAPI_event_type_s *event_type; + bool is_immediate_flag; + int immediate_flag; + struct OpenAPI_location_reporting_configuration_1_s *location_reporting_configuration; + struct OpenAPI_association_type_s *association_type; + struct OpenAPI_datalink_reporting_configuration_1_s *datalink_report_cfg; + struct OpenAPI_loss_connectivity_cfg_1_s *loss_connectivity_cfg; + bool is_maximum_latency; + int maximum_latency; + bool is_maximum_response_time; + int maximum_response_time; + bool is_suggested_packet_num_dl; + int suggested_packet_num_dl; + char *dnn; + struct OpenAPI_snssai_s *single_nssai; + struct OpenAPI_pdu_session_status_cfg_1_s *pdu_session_status_cfg; + struct OpenAPI_reachability_for_sms_configuration_s *reachability_for_sms_cfg; + char *mtc_provider_information; + char *af_id; + struct OpenAPI_reachability_for_data_configuration_1_s *reachability_for_data_cfg; + bool is_idle_status_ind; + int idle_status_ind; +} OpenAPI_monitoring_configuration_1_t; + +OpenAPI_monitoring_configuration_1_t *OpenAPI_monitoring_configuration_1_create( + OpenAPI_event_type_t *event_type, + bool is_immediate_flag, + int immediate_flag, + OpenAPI_location_reporting_configuration_1_t *location_reporting_configuration, + OpenAPI_association_type_t *association_type, + OpenAPI_datalink_reporting_configuration_1_t *datalink_report_cfg, + OpenAPI_loss_connectivity_cfg_1_t *loss_connectivity_cfg, + bool is_maximum_latency, + int maximum_latency, + bool is_maximum_response_time, + int maximum_response_time, + bool is_suggested_packet_num_dl, + int suggested_packet_num_dl, + char *dnn, + OpenAPI_snssai_t *single_nssai, + OpenAPI_pdu_session_status_cfg_1_t *pdu_session_status_cfg, + OpenAPI_reachability_for_sms_configuration_t *reachability_for_sms_cfg, + char *mtc_provider_information, + char *af_id, + OpenAPI_reachability_for_data_configuration_1_t *reachability_for_data_cfg, + bool is_idle_status_ind, + int idle_status_ind +); +void OpenAPI_monitoring_configuration_1_free(OpenAPI_monitoring_configuration_1_t *monitoring_configuration_1); +OpenAPI_monitoring_configuration_1_t *OpenAPI_monitoring_configuration_1_parseFromJSON(cJSON *monitoring_configuration_1JSON); +cJSON *OpenAPI_monitoring_configuration_1_convertToJSON(OpenAPI_monitoring_configuration_1_t *monitoring_configuration_1); +OpenAPI_monitoring_configuration_1_t *OpenAPI_monitoring_configuration_1_copy(OpenAPI_monitoring_configuration_1_t *dst, OpenAPI_monitoring_configuration_1_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_monitoring_configuration_1_H_ */ + diff --git a/lib/sbi/openapi/model/mps_action.c b/lib/sbi/openapi/model/mps_action.c new file mode 100644 index 000000000..59dff90e7 --- /dev/null +++ b/lib/sbi/openapi/model/mps_action.c @@ -0,0 +1,30 @@ + +#include +#include +#include +#include "mps_action.h" + +char* OpenAPI_mps_action_ToString(OpenAPI_mps_action_e mps_action) +{ + const char *mps_actionArray[] = { "NULL", "DISABLE_MPS_FOR_DTS", "ENABLE_MPS_FOR_DTS", "AUTHORIZE_AND_ENABLE_MPS_FOR_DTS" }; + size_t sizeofArray = sizeof(mps_actionArray) / sizeof(mps_actionArray[0]); + if (mps_action < sizeofArray) + return (char *)mps_actionArray[mps_action]; + else + return (char *)"Unknown"; +} + +OpenAPI_mps_action_e OpenAPI_mps_action_FromString(char* mps_action) +{ + int stringToReturn = 0; + const char *mps_actionArray[] = { "NULL", "DISABLE_MPS_FOR_DTS", "ENABLE_MPS_FOR_DTS", "AUTHORIZE_AND_ENABLE_MPS_FOR_DTS" }; + size_t sizeofArray = sizeof(mps_actionArray) / sizeof(mps_actionArray[0]); + while (stringToReturn < sizeofArray) { + if (strcmp(mps_action, mps_actionArray[stringToReturn]) == 0) { + return stringToReturn; + } + stringToReturn++; + } + return 0; +} + diff --git a/lib/sbi/openapi/model/mps_action.h b/lib/sbi/openapi/model/mps_action.h new file mode 100644 index 000000000..3b5f57500 --- /dev/null +++ b/lib/sbi/openapi/model/mps_action.h @@ -0,0 +1,31 @@ +/* + * mps_action.h + * + * + */ + +#ifndef _OpenAPI_mps_action_H_ +#define _OpenAPI_mps_action_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef enum { OpenAPI_mps_action_NULL = 0, OpenAPI_mps_action_DISABLE_MPS_FOR_DTS, OpenAPI_mps_action_ENABLE_MPS_FOR_DTS, OpenAPI_mps_action_AUTHORIZE_AND_ENABLE_MPS_FOR_DTS } OpenAPI_mps_action_e; + +char* OpenAPI_mps_action_ToString(OpenAPI_mps_action_e mps_action); + +OpenAPI_mps_action_e OpenAPI_mps_action_FromString(char* mps_action); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_mps_action_H_ */ + diff --git a/lib/sbi/openapi/model/mtc_provider.h b/lib/sbi/openapi/model/mtc_provider.h index 8be696ab5..c7b8336f0 100644 --- a/lib/sbi/openapi/model/mtc_provider.h +++ b/lib/sbi/openapi/model/mtc_provider.h @@ -1,7 +1,7 @@ /* * mtc_provider.h * - * + * MTC provider information. */ #ifndef _OpenAPI_mtc_provider_H_ diff --git a/lib/sbi/openapi/model/multicast_access_control.c b/lib/sbi/openapi/model/multicast_access_control.c index e48676bc0..6ce7e7290 100644 --- a/lib/sbi/openapi/model/multicast_access_control.c +++ b/lib/sbi/openapi/model/multicast_access_control.c @@ -5,11 +5,21 @@ #include "multicast_access_control.h" OpenAPI_multicast_access_control_t *OpenAPI_multicast_access_control_create( + char *src_ipv4_addr, + char *src_ipv6_addr, + char *multicast_v4_addr, + char *multicast_v6_addr, + OpenAPI_access_right_status_t *acc_status ) { OpenAPI_multicast_access_control_t *multicast_access_control_local_var = ogs_malloc(sizeof(OpenAPI_multicast_access_control_t)); ogs_assert(multicast_access_control_local_var); + multicast_access_control_local_var->src_ipv4_addr = src_ipv4_addr; + multicast_access_control_local_var->src_ipv6_addr = src_ipv6_addr; + multicast_access_control_local_var->multicast_v4_addr = multicast_v4_addr; + multicast_access_control_local_var->multicast_v6_addr = multicast_v6_addr; + multicast_access_control_local_var->acc_status = acc_status; return multicast_access_control_local_var; } @@ -21,6 +31,26 @@ void OpenAPI_multicast_access_control_free(OpenAPI_multicast_access_control_t *m if (NULL == multicast_access_control) { return; } + if (multicast_access_control->src_ipv4_addr) { + ogs_free(multicast_access_control->src_ipv4_addr); + multicast_access_control->src_ipv4_addr = NULL; + } + if (multicast_access_control->src_ipv6_addr) { + ogs_free(multicast_access_control->src_ipv6_addr); + multicast_access_control->src_ipv6_addr = NULL; + } + if (multicast_access_control->multicast_v4_addr) { + ogs_free(multicast_access_control->multicast_v4_addr); + multicast_access_control->multicast_v4_addr = NULL; + } + if (multicast_access_control->multicast_v6_addr) { + ogs_free(multicast_access_control->multicast_v6_addr); + multicast_access_control->multicast_v6_addr = NULL; + } + if (multicast_access_control->acc_status) { + OpenAPI_access_right_status_free(multicast_access_control->acc_status); + multicast_access_control->acc_status = NULL; + } ogs_free(multicast_access_control); } @@ -35,6 +65,49 @@ cJSON *OpenAPI_multicast_access_control_convertToJSON(OpenAPI_multicast_access_c } item = cJSON_CreateObject(); + if (multicast_access_control->src_ipv4_addr) { + if (cJSON_AddStringToObject(item, "srcIpv4Addr", multicast_access_control->src_ipv4_addr) == NULL) { + ogs_error("OpenAPI_multicast_access_control_convertToJSON() failed [src_ipv4_addr]"); + goto end; + } + } + + if (multicast_access_control->src_ipv6_addr) { + if (cJSON_AddStringToObject(item, "srcIpv6Addr", multicast_access_control->src_ipv6_addr) == NULL) { + ogs_error("OpenAPI_multicast_access_control_convertToJSON() failed [src_ipv6_addr]"); + goto end; + } + } + + if (multicast_access_control->multicast_v4_addr) { + if (cJSON_AddStringToObject(item, "multicastV4Addr", multicast_access_control->multicast_v4_addr) == NULL) { + ogs_error("OpenAPI_multicast_access_control_convertToJSON() failed [multicast_v4_addr]"); + goto end; + } + } + + if (multicast_access_control->multicast_v6_addr) { + if (cJSON_AddStringToObject(item, "multicastV6Addr", multicast_access_control->multicast_v6_addr) == NULL) { + ogs_error("OpenAPI_multicast_access_control_convertToJSON() failed [multicast_v6_addr]"); + goto end; + } + } + + if (!multicast_access_control->acc_status) { + ogs_error("OpenAPI_multicast_access_control_convertToJSON() failed [acc_status]"); + return NULL; + } + cJSON *acc_status_local_JSON = OpenAPI_access_right_status_convertToJSON(multicast_access_control->acc_status); + if (acc_status_local_JSON == NULL) { + ogs_error("OpenAPI_multicast_access_control_convertToJSON() failed [acc_status]"); + goto end; + } + cJSON_AddItemToObject(item, "accStatus", acc_status_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_multicast_access_control_convertToJSON() failed [acc_status]"); + goto end; + } + end: return item; } @@ -43,11 +116,65 @@ OpenAPI_multicast_access_control_t *OpenAPI_multicast_access_control_parseFromJS { OpenAPI_multicast_access_control_t *multicast_access_control_local_var = NULL; OpenAPI_lnode_t *node = NULL; + cJSON *src_ipv4_addr = NULL; + cJSON *src_ipv6_addr = NULL; + cJSON *multicast_v4_addr = NULL; + cJSON *multicast_v6_addr = NULL; + cJSON *acc_status = NULL; + OpenAPI_access_right_status_t *acc_status_local_nonprim = NULL; + src_ipv4_addr = cJSON_GetObjectItemCaseSensitive(multicast_access_controlJSON, "srcIpv4Addr"); + if (src_ipv4_addr) { + if (!cJSON_IsString(src_ipv4_addr) && !cJSON_IsNull(src_ipv4_addr)) { + ogs_error("OpenAPI_multicast_access_control_parseFromJSON() failed [src_ipv4_addr]"); + goto end; + } + } + + src_ipv6_addr = cJSON_GetObjectItemCaseSensitive(multicast_access_controlJSON, "srcIpv6Addr"); + if (src_ipv6_addr) { + if (!cJSON_IsString(src_ipv6_addr) && !cJSON_IsNull(src_ipv6_addr)) { + ogs_error("OpenAPI_multicast_access_control_parseFromJSON() failed [src_ipv6_addr]"); + goto end; + } + } + + multicast_v4_addr = cJSON_GetObjectItemCaseSensitive(multicast_access_controlJSON, "multicastV4Addr"); + if (multicast_v4_addr) { + if (!cJSON_IsString(multicast_v4_addr) && !cJSON_IsNull(multicast_v4_addr)) { + ogs_error("OpenAPI_multicast_access_control_parseFromJSON() failed [multicast_v4_addr]"); + goto end; + } + } + + multicast_v6_addr = cJSON_GetObjectItemCaseSensitive(multicast_access_controlJSON, "multicastV6Addr"); + if (multicast_v6_addr) { + if (!cJSON_IsString(multicast_v6_addr) && !cJSON_IsNull(multicast_v6_addr)) { + ogs_error("OpenAPI_multicast_access_control_parseFromJSON() failed [multicast_v6_addr]"); + goto end; + } + } + + acc_status = cJSON_GetObjectItemCaseSensitive(multicast_access_controlJSON, "accStatus"); + if (!acc_status) { + ogs_error("OpenAPI_multicast_access_control_parseFromJSON() failed [acc_status]"); + goto end; + } + acc_status_local_nonprim = OpenAPI_access_right_status_parseFromJSON(acc_status); + multicast_access_control_local_var = OpenAPI_multicast_access_control_create ( + src_ipv4_addr && !cJSON_IsNull(src_ipv4_addr) ? ogs_strdup(src_ipv4_addr->valuestring) : NULL, + src_ipv6_addr && !cJSON_IsNull(src_ipv6_addr) ? ogs_strdup(src_ipv6_addr->valuestring) : NULL, + multicast_v4_addr && !cJSON_IsNull(multicast_v4_addr) ? ogs_strdup(multicast_v4_addr->valuestring) : NULL, + multicast_v6_addr && !cJSON_IsNull(multicast_v6_addr) ? ogs_strdup(multicast_v6_addr->valuestring) : NULL, + acc_status_local_nonprim ); return multicast_access_control_local_var; end: + if (acc_status_local_nonprim) { + OpenAPI_access_right_status_free(acc_status_local_nonprim); + acc_status_local_nonprim = NULL; + } return NULL; } diff --git a/lib/sbi/openapi/model/multicast_access_control.h b/lib/sbi/openapi/model/multicast_access_control.h index 0e62905e5..9c1d66237 100644 --- a/lib/sbi/openapi/model/multicast_access_control.h +++ b/lib/sbi/openapi/model/multicast_access_control.h @@ -1,7 +1,7 @@ /* * multicast_access_control.h * - * + * Represents multicast address access control information. */ #ifndef _OpenAPI_multicast_access_control_H_ @@ -12,7 +12,7 @@ #include "../include/list.h" #include "../include/keyValuePair.h" #include "../include/binary.h" -#include "multicast_access_control_any_of.h" +#include "access_right_status.h" #ifdef __cplusplus extern "C" { @@ -20,9 +20,19 @@ extern "C" { typedef struct OpenAPI_multicast_access_control_s OpenAPI_multicast_access_control_t; typedef struct OpenAPI_multicast_access_control_s { + char *src_ipv4_addr; + char *src_ipv6_addr; + char *multicast_v4_addr; + char *multicast_v6_addr; + struct OpenAPI_access_right_status_s *acc_status; } OpenAPI_multicast_access_control_t; OpenAPI_multicast_access_control_t *OpenAPI_multicast_access_control_create( + char *src_ipv4_addr, + char *src_ipv6_addr, + char *multicast_v4_addr, + char *multicast_v6_addr, + OpenAPI_access_right_status_t *acc_status ); void OpenAPI_multicast_access_control_free(OpenAPI_multicast_access_control_t *multicast_access_control); OpenAPI_multicast_access_control_t *OpenAPI_multicast_access_control_parseFromJSON(cJSON *multicast_access_controlJSON); diff --git a/lib/sbi/openapi/model/multicast_access_control_any_of.c b/lib/sbi/openapi/model/multicast_access_control_any_of.c deleted file mode 100644 index c23a44b48..000000000 --- a/lib/sbi/openapi/model/multicast_access_control_any_of.c +++ /dev/null @@ -1,30 +0,0 @@ - -#include -#include -#include -#include "multicast_access_control_any_of.h" - -char* OpenAPI_multicast_access_control_any_of_ToString(OpenAPI_multicast_access_control_any_of_e multicast_access_control_any_of) -{ - const char *multicast_access_control_any_ofArray[] = { "NULL", "ALLOWED", "NOT_ALLOWED" }; - size_t sizeofArray = sizeof(multicast_access_control_any_ofArray) / sizeof(multicast_access_control_any_ofArray[0]); - if (multicast_access_control_any_of < sizeofArray) - return (char *)multicast_access_control_any_ofArray[multicast_access_control_any_of]; - else - return (char *)"Unknown"; -} - -OpenAPI_multicast_access_control_any_of_e OpenAPI_multicast_access_control_any_of_FromString(char* multicast_access_control_any_of) -{ - int stringToReturn = 0; - const char *multicast_access_control_any_ofArray[] = { "NULL", "ALLOWED", "NOT_ALLOWED" }; - size_t sizeofArray = sizeof(multicast_access_control_any_ofArray) / sizeof(multicast_access_control_any_ofArray[0]); - while (stringToReturn < sizeofArray) { - if (strcmp(multicast_access_control_any_of, multicast_access_control_any_ofArray[stringToReturn]) == 0) { - return stringToReturn; - } - stringToReturn++; - } - return 0; -} - diff --git a/lib/sbi/openapi/model/multicast_access_control_any_of.h b/lib/sbi/openapi/model/multicast_access_control_any_of.h deleted file mode 100644 index a5c68bcc4..000000000 --- a/lib/sbi/openapi/model/multicast_access_control_any_of.h +++ /dev/null @@ -1,31 +0,0 @@ -/* - * multicast_access_control_any_of.h - * - * - */ - -#ifndef _OpenAPI_multicast_access_control_any_of_H_ -#define _OpenAPI_multicast_access_control_any_of_H_ - -#include -#include "../external/cJSON.h" -#include "../include/list.h" -#include "../include/keyValuePair.h" -#include "../include/binary.h" - -#ifdef __cplusplus -extern "C" { -#endif - -typedef enum { OpenAPI_multicast_access_control_any_of_NULL = 0, OpenAPI_multicast_access_control_any_of_ALLOWED, OpenAPI_multicast_access_control_any_of_NOT_ALLOWED } OpenAPI_multicast_access_control_any_of_e; - -char* OpenAPI_multicast_access_control_any_of_ToString(OpenAPI_multicast_access_control_any_of_e multicast_access_control_any_of); - -OpenAPI_multicast_access_control_any_of_e OpenAPI_multicast_access_control_any_of_FromString(char* multicast_access_control_any_of); - -#ifdef __cplusplus -} -#endif - -#endif /* _OpenAPI_multicast_access_control_any_of_H_ */ - diff --git a/lib/sbi/openapi/model/n1_message_container.h b/lib/sbi/openapi/model/n1_message_container.h index f08e46116..f29f7e0a0 100644 --- a/lib/sbi/openapi/model/n1_message_container.h +++ b/lib/sbi/openapi/model/n1_message_container.h @@ -1,7 +1,7 @@ /* * n1_message_container.h * - * + * N1 Message container */ #ifndef _OpenAPI_n1_message_container_H_ diff --git a/lib/sbi/openapi/model/n1_message_notification.h b/lib/sbi/openapi/model/n1_message_notification.h index 23628eead..bacea1228 100644 --- a/lib/sbi/openapi/model/n1_message_notification.h +++ b/lib/sbi/openapi/model/n1_message_notification.h @@ -1,7 +1,7 @@ /* * n1_message_notification.h * - * + * Data within a N1 message notification request */ #ifndef _OpenAPI_n1_message_notification_H_ diff --git a/lib/sbi/openapi/model/n1_n2_message_transfer_cause.c b/lib/sbi/openapi/model/n1_n2_message_transfer_cause.c index 86d46494e..72717c3ec 100644 --- a/lib/sbi/openapi/model/n1_n2_message_transfer_cause.c +++ b/lib/sbi/openapi/model/n1_n2_message_transfer_cause.c @@ -6,7 +6,7 @@ char* OpenAPI_n1_n2_message_transfer_cause_ToString(OpenAPI_n1_n2_message_transfer_cause_e n1_n2_message_transfer_cause) { - const char *n1_n2_message_transfer_causeArray[] = { "NULL", "ATTEMPTING_TO_REACH_UE", "N1_N2_TRANSFER_INITIATED", "WAITING_FOR_ASYNCHRONOUS_TRANSFER", "UE_NOT_RESPONDING", "N1_MSG_NOT_TRANSFERRED", "UE_NOT_REACHABLE_FOR_SESSION", "TEMPORARY_REJECT_REGISTRATION_ONGOING", "TEMPORARY_REJECT_HANDOVER_ONGOING" }; + const char *n1_n2_message_transfer_causeArray[] = { "NULL", "ATTEMPTING_TO_REACH_UE", "N1_N2_TRANSFER_INITIATED", "WAITING_FOR_ASYNCHRONOUS_TRANSFER", "UE_NOT_RESPONDING", "N1_MSG_NOT_TRANSFERRED", "N2_MSG_NOT_TRANSFERRED", "UE_NOT_REACHABLE_FOR_SESSION", "TEMPORARY_REJECT_REGISTRATION_ONGOING", "TEMPORARY_REJECT_HANDOVER_ONGOING", "REJECTION_DUE_TO_PAGING_RESTRICTION", "AN_NOT_RESPONDING", "FAILURE_CAUSE_UNSPECIFIED" }; size_t sizeofArray = sizeof(n1_n2_message_transfer_causeArray) / sizeof(n1_n2_message_transfer_causeArray[0]); if (n1_n2_message_transfer_cause < sizeofArray) return (char *)n1_n2_message_transfer_causeArray[n1_n2_message_transfer_cause]; @@ -17,7 +17,7 @@ char* OpenAPI_n1_n2_message_transfer_cause_ToString(OpenAPI_n1_n2_message_transf OpenAPI_n1_n2_message_transfer_cause_e OpenAPI_n1_n2_message_transfer_cause_FromString(char* n1_n2_message_transfer_cause) { int stringToReturn = 0; - const char *n1_n2_message_transfer_causeArray[] = { "NULL", "ATTEMPTING_TO_REACH_UE", "N1_N2_TRANSFER_INITIATED", "WAITING_FOR_ASYNCHRONOUS_TRANSFER", "UE_NOT_RESPONDING", "N1_MSG_NOT_TRANSFERRED", "UE_NOT_REACHABLE_FOR_SESSION", "TEMPORARY_REJECT_REGISTRATION_ONGOING", "TEMPORARY_REJECT_HANDOVER_ONGOING" }; + const char *n1_n2_message_transfer_causeArray[] = { "NULL", "ATTEMPTING_TO_REACH_UE", "N1_N2_TRANSFER_INITIATED", "WAITING_FOR_ASYNCHRONOUS_TRANSFER", "UE_NOT_RESPONDING", "N1_MSG_NOT_TRANSFERRED", "N2_MSG_NOT_TRANSFERRED", "UE_NOT_REACHABLE_FOR_SESSION", "TEMPORARY_REJECT_REGISTRATION_ONGOING", "TEMPORARY_REJECT_HANDOVER_ONGOING", "REJECTION_DUE_TO_PAGING_RESTRICTION", "AN_NOT_RESPONDING", "FAILURE_CAUSE_UNSPECIFIED" }; size_t sizeofArray = sizeof(n1_n2_message_transfer_causeArray) / sizeof(n1_n2_message_transfer_causeArray[0]); while (stringToReturn < sizeofArray) { if (strcmp(n1_n2_message_transfer_cause, n1_n2_message_transfer_causeArray[stringToReturn]) == 0) { diff --git a/lib/sbi/openapi/model/n1_n2_message_transfer_cause.h b/lib/sbi/openapi/model/n1_n2_message_transfer_cause.h index 18ba86727..371b8459b 100644 --- a/lib/sbi/openapi/model/n1_n2_message_transfer_cause.h +++ b/lib/sbi/openapi/model/n1_n2_message_transfer_cause.h @@ -17,7 +17,7 @@ extern "C" { #endif -typedef enum { OpenAPI_n1_n2_message_transfer_cause_NULL = 0, OpenAPI_n1_n2_message_transfer_cause_ATTEMPTING_TO_REACH_UE, OpenAPI_n1_n2_message_transfer_cause_N1_N2_TRANSFER_INITIATED, OpenAPI_n1_n2_message_transfer_cause_WAITING_FOR_ASYNCHRONOUS_TRANSFER, OpenAPI_n1_n2_message_transfer_cause_UE_NOT_RESPONDING, OpenAPI_n1_n2_message_transfer_cause_N1_MSG_NOT_TRANSFERRED, OpenAPI_n1_n2_message_transfer_cause_UE_NOT_REACHABLE_FOR_SESSION, OpenAPI_n1_n2_message_transfer_cause_TEMPORARY_REJECT_REGISTRATION_ONGOING, OpenAPI_n1_n2_message_transfer_cause_TEMPORARY_REJECT_HANDOVER_ONGOING } OpenAPI_n1_n2_message_transfer_cause_e; +typedef enum { OpenAPI_n1_n2_message_transfer_cause_NULL = 0, OpenAPI_n1_n2_message_transfer_cause_ATTEMPTING_TO_REACH_UE, OpenAPI_n1_n2_message_transfer_cause_N1_N2_TRANSFER_INITIATED, OpenAPI_n1_n2_message_transfer_cause_WAITING_FOR_ASYNCHRONOUS_TRANSFER, OpenAPI_n1_n2_message_transfer_cause_UE_NOT_RESPONDING, OpenAPI_n1_n2_message_transfer_cause_N1_MSG_NOT_TRANSFERRED, OpenAPI_n1_n2_message_transfer_cause_N2_MSG_NOT_TRANSFERRED, OpenAPI_n1_n2_message_transfer_cause_UE_NOT_REACHABLE_FOR_SESSION, OpenAPI_n1_n2_message_transfer_cause_TEMPORARY_REJECT_REGISTRATION_ONGOING, OpenAPI_n1_n2_message_transfer_cause_TEMPORARY_REJECT_HANDOVER_ONGOING, OpenAPI_n1_n2_message_transfer_cause_REJECTION_DUE_TO_PAGING_RESTRICTION, OpenAPI_n1_n2_message_transfer_cause_AN_NOT_RESPONDING, OpenAPI_n1_n2_message_transfer_cause_FAILURE_CAUSE_UNSPECIFIED } OpenAPI_n1_n2_message_transfer_cause_e; char* OpenAPI_n1_n2_message_transfer_cause_ToString(OpenAPI_n1_n2_message_transfer_cause_e n1_n2_message_transfer_cause); diff --git a/lib/sbi/openapi/model/n1_n2_message_transfer_error.h b/lib/sbi/openapi/model/n1_n2_message_transfer_error.h index 12a8b62c6..39b26c81f 100644 --- a/lib/sbi/openapi/model/n1_n2_message_transfer_error.h +++ b/lib/sbi/openapi/model/n1_n2_message_transfer_error.h @@ -1,7 +1,7 @@ /* * n1_n2_message_transfer_error.h * - * + * Data within a N1/N2 Message Transfer Error response */ #ifndef _OpenAPI_n1_n2_message_transfer_error_H_ diff --git a/lib/sbi/openapi/model/n1_n2_message_transfer_req_data.c b/lib/sbi/openapi/model/n1_n2_message_transfer_req_data.c index b94b59acf..291af587f 100644 --- a/lib/sbi/openapi/model/n1_n2_message_transfer_req_data.c +++ b/lib/sbi/openapi/model/n1_n2_message_transfer_req_data.c @@ -30,7 +30,8 @@ OpenAPI_n1_n2_message_transfer_req_data_t *OpenAPI_n1_n2_message_transfer_req_da int ma_accepted_ind, bool is_ext_buf_support, int ext_buf_support, - OpenAPI_access_type_e target_access + OpenAPI_access_type_e target_access, + char *nf_id ) { OpenAPI_n1_n2_message_transfer_req_data_t *n1_n2_message_transfer_req_data_local_var = ogs_malloc(sizeof(OpenAPI_n1_n2_message_transfer_req_data_t)); @@ -62,6 +63,7 @@ OpenAPI_n1_n2_message_transfer_req_data_t *OpenAPI_n1_n2_message_transfer_req_da n1_n2_message_transfer_req_data_local_var->is_ext_buf_support = is_ext_buf_support; n1_n2_message_transfer_req_data_local_var->ext_buf_support = ext_buf_support; n1_n2_message_transfer_req_data_local_var->target_access = target_access; + n1_n2_message_transfer_req_data_local_var->nf_id = nf_id; return n1_n2_message_transfer_req_data_local_var; } @@ -109,6 +111,10 @@ void OpenAPI_n1_n2_message_transfer_req_data_free(OpenAPI_n1_n2_message_transfer OpenAPI_guami_free(n1_n2_message_transfer_req_data->old_guami); n1_n2_message_transfer_req_data->old_guami = NULL; } + if (n1_n2_message_transfer_req_data->nf_id) { + ogs_free(n1_n2_message_transfer_req_data->nf_id); + n1_n2_message_transfer_req_data->nf_id = NULL; + } ogs_free(n1_n2_message_transfer_req_data); } @@ -285,6 +291,13 @@ cJSON *OpenAPI_n1_n2_message_transfer_req_data_convertToJSON(OpenAPI_n1_n2_messa } } + if (n1_n2_message_transfer_req_data->nf_id) { + if (cJSON_AddStringToObject(item, "nfId", n1_n2_message_transfer_req_data->nf_id) == NULL) { + ogs_error("OpenAPI_n1_n2_message_transfer_req_data_convertToJSON() failed [nf_id]"); + goto end; + } + } + end: return item; } @@ -318,6 +331,7 @@ OpenAPI_n1_n2_message_transfer_req_data_t *OpenAPI_n1_n2_message_transfer_req_da cJSON *ext_buf_support = NULL; cJSON *target_access = NULL; OpenAPI_access_type_e target_accessVariable = 0; + cJSON *nf_id = NULL; n1_message_container = cJSON_GetObjectItemCaseSensitive(n1_n2_message_transfer_req_dataJSON, "n1MessageContainer"); if (n1_message_container) { n1_message_container_local_nonprim = OpenAPI_n1_message_container_parseFromJSON(n1_message_container); @@ -445,6 +459,14 @@ OpenAPI_n1_n2_message_transfer_req_data_t *OpenAPI_n1_n2_message_transfer_req_da target_accessVariable = OpenAPI_access_type_FromString(target_access->valuestring); } + nf_id = cJSON_GetObjectItemCaseSensitive(n1_n2_message_transfer_req_dataJSON, "nfId"); + if (nf_id) { + if (!cJSON_IsString(nf_id) && !cJSON_IsNull(nf_id)) { + ogs_error("OpenAPI_n1_n2_message_transfer_req_data_parseFromJSON() failed [nf_id]"); + goto end; + } + } + n1_n2_message_transfer_req_data_local_var = OpenAPI_n1_n2_message_transfer_req_data_create ( n1_message_container ? n1_message_container_local_nonprim : NULL, n2_info_container ? n2_info_container_local_nonprim : NULL, @@ -471,7 +493,8 @@ OpenAPI_n1_n2_message_transfer_req_data_t *OpenAPI_n1_n2_message_transfer_req_da ma_accepted_ind ? ma_accepted_ind->valueint : 0, ext_buf_support ? true : false, ext_buf_support ? ext_buf_support->valueint : 0, - target_access ? target_accessVariable : 0 + target_access ? target_accessVariable : 0, + nf_id && !cJSON_IsNull(nf_id) ? ogs_strdup(nf_id->valuestring) : NULL ); return n1_n2_message_transfer_req_data_local_var; diff --git a/lib/sbi/openapi/model/n1_n2_message_transfer_req_data.h b/lib/sbi/openapi/model/n1_n2_message_transfer_req_data.h index 29e5fe479..451312def 100644 --- a/lib/sbi/openapi/model/n1_n2_message_transfer_req_data.h +++ b/lib/sbi/openapi/model/n1_n2_message_transfer_req_data.h @@ -1,7 +1,7 @@ /* * n1_n2_message_transfer_req_data.h * - * + * Data within a N1/N2 message transfer request */ #ifndef _OpenAPI_n1_n2_message_transfer_req_data_H_ @@ -52,6 +52,7 @@ typedef struct OpenAPI_n1_n2_message_transfer_req_data_s { bool is_ext_buf_support; int ext_buf_support; OpenAPI_access_type_e target_access; + char *nf_id; } OpenAPI_n1_n2_message_transfer_req_data_t; OpenAPI_n1_n2_message_transfer_req_data_t *OpenAPI_n1_n2_message_transfer_req_data_create( @@ -80,7 +81,8 @@ OpenAPI_n1_n2_message_transfer_req_data_t *OpenAPI_n1_n2_message_transfer_req_da int ma_accepted_ind, bool is_ext_buf_support, int ext_buf_support, - OpenAPI_access_type_e target_access + OpenAPI_access_type_e target_access, + char *nf_id ); void OpenAPI_n1_n2_message_transfer_req_data_free(OpenAPI_n1_n2_message_transfer_req_data_t *n1_n2_message_transfer_req_data); OpenAPI_n1_n2_message_transfer_req_data_t *OpenAPI_n1_n2_message_transfer_req_data_parseFromJSON(cJSON *n1_n2_message_transfer_req_dataJSON); diff --git a/lib/sbi/openapi/model/n1_n2_message_transfer_rsp_data.h b/lib/sbi/openapi/model/n1_n2_message_transfer_rsp_data.h index ed7a7ac90..bfd532090 100644 --- a/lib/sbi/openapi/model/n1_n2_message_transfer_rsp_data.h +++ b/lib/sbi/openapi/model/n1_n2_message_transfer_rsp_data.h @@ -1,7 +1,7 @@ /* * n1_n2_message_transfer_rsp_data.h * - * + * Data within a N1/N2 message transfer response */ #ifndef _OpenAPI_n1_n2_message_transfer_rsp_data_H_ diff --git a/lib/sbi/openapi/model/n1_n2_msg_txfr_err_detail.h b/lib/sbi/openapi/model/n1_n2_msg_txfr_err_detail.h index 3b84c1792..dbe1ba312 100644 --- a/lib/sbi/openapi/model/n1_n2_msg_txfr_err_detail.h +++ b/lib/sbi/openapi/model/n1_n2_msg_txfr_err_detail.h @@ -1,7 +1,7 @@ /* * n1_n2_msg_txfr_err_detail.h * - * + * N1/N2 Message Transfer Error Details */ #ifndef _OpenAPI_n1_n2_msg_txfr_err_detail_H_ diff --git a/lib/sbi/openapi/model/n1_n2_msg_txfr_failure_notification.h b/lib/sbi/openapi/model/n1_n2_msg_txfr_failure_notification.h index fe925cc9f..cf71b0f32 100644 --- a/lib/sbi/openapi/model/n1_n2_msg_txfr_failure_notification.h +++ b/lib/sbi/openapi/model/n1_n2_msg_txfr_failure_notification.h @@ -1,7 +1,7 @@ /* * n1_n2_msg_txfr_failure_notification.h * - * + * Data within a N1/N2 Message Transfer Failure Notification request */ #ifndef _OpenAPI_n1_n2_msg_txfr_failure_notification_H_ diff --git a/lib/sbi/openapi/model/n2_info_container.c b/lib/sbi/openapi/model/n2_info_container.c index 46d568f1d..d293a22bf 100644 --- a/lib/sbi/openapi/model/n2_info_container.c +++ b/lib/sbi/openapi/model/n2_info_container.c @@ -10,7 +10,8 @@ OpenAPI_n2_info_container_t *OpenAPI_n2_info_container_create( OpenAPI_n2_ran_information_t *ran_info, OpenAPI_nrppa_information_t *nrppa_info, OpenAPI_pws_information_t *pws_info, - OpenAPI_v2x_information_t *v2x_info + OpenAPI_v2x_information_t *v2x_info, + OpenAPI_pro_se_information_t *prose_info ) { OpenAPI_n2_info_container_t *n2_info_container_local_var = ogs_malloc(sizeof(OpenAPI_n2_info_container_t)); @@ -22,6 +23,7 @@ OpenAPI_n2_info_container_t *OpenAPI_n2_info_container_create( n2_info_container_local_var->nrppa_info = nrppa_info; n2_info_container_local_var->pws_info = pws_info; n2_info_container_local_var->v2x_info = v2x_info; + n2_info_container_local_var->prose_info = prose_info; return n2_info_container_local_var; } @@ -53,6 +55,10 @@ void OpenAPI_n2_info_container_free(OpenAPI_n2_info_container_t *n2_info_contain OpenAPI_v2x_information_free(n2_info_container->v2x_info); n2_info_container->v2x_info = NULL; } + if (n2_info_container->prose_info) { + OpenAPI_pro_se_information_free(n2_info_container->prose_info); + n2_info_container->prose_info = NULL; + } ogs_free(n2_info_container); } @@ -141,6 +147,19 @@ cJSON *OpenAPI_n2_info_container_convertToJSON(OpenAPI_n2_info_container_t *n2_i } } + if (n2_info_container->prose_info) { + cJSON *prose_info_local_JSON = OpenAPI_pro_se_information_convertToJSON(n2_info_container->prose_info); + if (prose_info_local_JSON == NULL) { + ogs_error("OpenAPI_n2_info_container_convertToJSON() failed [prose_info]"); + goto end; + } + cJSON_AddItemToObject(item, "proseInfo", prose_info_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_n2_info_container_convertToJSON() failed [prose_info]"); + goto end; + } + } + end: return item; } @@ -161,6 +180,8 @@ OpenAPI_n2_info_container_t *OpenAPI_n2_info_container_parseFromJSON(cJSON *n2_i OpenAPI_pws_information_t *pws_info_local_nonprim = NULL; cJSON *v2x_info = NULL; OpenAPI_v2x_information_t *v2x_info_local_nonprim = NULL; + cJSON *prose_info = NULL; + OpenAPI_pro_se_information_t *prose_info_local_nonprim = NULL; n2_information_class = cJSON_GetObjectItemCaseSensitive(n2_info_containerJSON, "n2InformationClass"); if (!n2_information_class) { ogs_error("OpenAPI_n2_info_container_parseFromJSON() failed [n2_information_class]"); @@ -197,13 +218,19 @@ OpenAPI_n2_info_container_t *OpenAPI_n2_info_container_parseFromJSON(cJSON *n2_i v2x_info_local_nonprim = OpenAPI_v2x_information_parseFromJSON(v2x_info); } + prose_info = cJSON_GetObjectItemCaseSensitive(n2_info_containerJSON, "proseInfo"); + if (prose_info) { + prose_info_local_nonprim = OpenAPI_pro_se_information_parseFromJSON(prose_info); + } + n2_info_container_local_var = OpenAPI_n2_info_container_create ( n2_information_classVariable, sm_info ? sm_info_local_nonprim : NULL, ran_info ? ran_info_local_nonprim : NULL, nrppa_info ? nrppa_info_local_nonprim : NULL, pws_info ? pws_info_local_nonprim : NULL, - v2x_info ? v2x_info_local_nonprim : NULL + v2x_info ? v2x_info_local_nonprim : NULL, + prose_info ? prose_info_local_nonprim : NULL ); return n2_info_container_local_var; @@ -228,6 +255,10 @@ end: OpenAPI_v2x_information_free(v2x_info_local_nonprim); v2x_info_local_nonprim = NULL; } + if (prose_info_local_nonprim) { + OpenAPI_pro_se_information_free(prose_info_local_nonprim); + prose_info_local_nonprim = NULL; + } return NULL; } diff --git a/lib/sbi/openapi/model/n2_info_container.h b/lib/sbi/openapi/model/n2_info_container.h index 1c54fc282..10b96e023 100644 --- a/lib/sbi/openapi/model/n2_info_container.h +++ b/lib/sbi/openapi/model/n2_info_container.h @@ -1,7 +1,7 @@ /* * n2_info_container.h * - * + * N2 information container */ #ifndef _OpenAPI_n2_info_container_H_ @@ -16,6 +16,7 @@ #include "n2_ran_information.h" #include "n2_sm_information.h" #include "nrppa_information.h" +#include "pro_se_information.h" #include "pws_information.h" #include "v2x_information.h" @@ -31,6 +32,7 @@ typedef struct OpenAPI_n2_info_container_s { struct OpenAPI_nrppa_information_s *nrppa_info; struct OpenAPI_pws_information_s *pws_info; struct OpenAPI_v2x_information_s *v2x_info; + struct OpenAPI_pro_se_information_s *prose_info; } OpenAPI_n2_info_container_t; OpenAPI_n2_info_container_t *OpenAPI_n2_info_container_create( @@ -39,7 +41,8 @@ OpenAPI_n2_info_container_t *OpenAPI_n2_info_container_create( OpenAPI_n2_ran_information_t *ran_info, OpenAPI_nrppa_information_t *nrppa_info, OpenAPI_pws_information_t *pws_info, - OpenAPI_v2x_information_t *v2x_info + OpenAPI_v2x_information_t *v2x_info, + OpenAPI_pro_se_information_t *prose_info ); void OpenAPI_n2_info_container_free(OpenAPI_n2_info_container_t *n2_info_container); OpenAPI_n2_info_container_t *OpenAPI_n2_info_container_parseFromJSON(cJSON *n2_info_containerJSON); diff --git a/lib/sbi/openapi/model/n2_info_content.h b/lib/sbi/openapi/model/n2_info_content.h index 45fc97d99..7347b3755 100644 --- a/lib/sbi/openapi/model/n2_info_content.h +++ b/lib/sbi/openapi/model/n2_info_content.h @@ -1,7 +1,7 @@ /* * n2_info_content.h * - * + * Represents a transparent N2 information content to be relayed by AMF */ #ifndef _OpenAPI_n2_info_content_H_ diff --git a/lib/sbi/openapi/model/n2_info_notification_rsp_data.c b/lib/sbi/openapi/model/n2_info_notification_rsp_data.c index 4db0673c4..130f47df9 100644 --- a/lib/sbi/openapi/model/n2_info_notification_rsp_data.c +++ b/lib/sbi/openapi/model/n2_info_notification_rsp_data.c @@ -5,13 +5,13 @@ #include "n2_info_notification_rsp_data.h" OpenAPI_n2_info_notification_rsp_data_t *OpenAPI_n2_info_notification_rsp_data_create( - OpenAPI_n2_info_content_t *n2_info_content + OpenAPI_list_t *sec_rat_data_usage_list ) { OpenAPI_n2_info_notification_rsp_data_t *n2_info_notification_rsp_data_local_var = ogs_malloc(sizeof(OpenAPI_n2_info_notification_rsp_data_t)); ogs_assert(n2_info_notification_rsp_data_local_var); - n2_info_notification_rsp_data_local_var->n2_info_content = n2_info_content; + n2_info_notification_rsp_data_local_var->sec_rat_data_usage_list = sec_rat_data_usage_list; return n2_info_notification_rsp_data_local_var; } @@ -23,9 +23,12 @@ void OpenAPI_n2_info_notification_rsp_data_free(OpenAPI_n2_info_notification_rsp if (NULL == n2_info_notification_rsp_data) { return; } - if (n2_info_notification_rsp_data->n2_info_content) { - OpenAPI_n2_info_content_free(n2_info_notification_rsp_data->n2_info_content); - n2_info_notification_rsp_data->n2_info_content = NULL; + if (n2_info_notification_rsp_data->sec_rat_data_usage_list) { + OpenAPI_list_for_each(n2_info_notification_rsp_data->sec_rat_data_usage_list, node) { + OpenAPI_n2_sm_information_free(node->data); + } + OpenAPI_list_free(n2_info_notification_rsp_data->sec_rat_data_usage_list); + n2_info_notification_rsp_data->sec_rat_data_usage_list = NULL; } ogs_free(n2_info_notification_rsp_data); } @@ -41,16 +44,19 @@ cJSON *OpenAPI_n2_info_notification_rsp_data_convertToJSON(OpenAPI_n2_info_notif } item = cJSON_CreateObject(); - if (n2_info_notification_rsp_data->n2_info_content) { - cJSON *n2_info_content_local_JSON = OpenAPI_n2_info_content_convertToJSON(n2_info_notification_rsp_data->n2_info_content); - if (n2_info_content_local_JSON == NULL) { - ogs_error("OpenAPI_n2_info_notification_rsp_data_convertToJSON() failed [n2_info_content]"); + if (n2_info_notification_rsp_data->sec_rat_data_usage_list) { + cJSON *sec_rat_data_usage_listList = cJSON_AddArrayToObject(item, "secRatDataUsageList"); + if (sec_rat_data_usage_listList == NULL) { + ogs_error("OpenAPI_n2_info_notification_rsp_data_convertToJSON() failed [sec_rat_data_usage_list]"); goto end; } - cJSON_AddItemToObject(item, "n2InfoContent", n2_info_content_local_JSON); - if (item->child == NULL) { - ogs_error("OpenAPI_n2_info_notification_rsp_data_convertToJSON() failed [n2_info_content]"); - goto end; + OpenAPI_list_for_each(n2_info_notification_rsp_data->sec_rat_data_usage_list, node) { + cJSON *itemLocal = OpenAPI_n2_sm_information_convertToJSON(node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_n2_info_notification_rsp_data_convertToJSON() failed [sec_rat_data_usage_list]"); + goto end; + } + cJSON_AddItemToArray(sec_rat_data_usage_listList, itemLocal); } } @@ -62,22 +68,45 @@ OpenAPI_n2_info_notification_rsp_data_t *OpenAPI_n2_info_notification_rsp_data_p { OpenAPI_n2_info_notification_rsp_data_t *n2_info_notification_rsp_data_local_var = NULL; OpenAPI_lnode_t *node = NULL; - cJSON *n2_info_content = NULL; - OpenAPI_n2_info_content_t *n2_info_content_local_nonprim = NULL; - n2_info_content = cJSON_GetObjectItemCaseSensitive(n2_info_notification_rsp_dataJSON, "n2InfoContent"); - if (n2_info_content) { - n2_info_content_local_nonprim = OpenAPI_n2_info_content_parseFromJSON(n2_info_content); + cJSON *sec_rat_data_usage_list = NULL; + OpenAPI_list_t *sec_rat_data_usage_listList = NULL; + sec_rat_data_usage_list = cJSON_GetObjectItemCaseSensitive(n2_info_notification_rsp_dataJSON, "secRatDataUsageList"); + if (sec_rat_data_usage_list) { + cJSON *sec_rat_data_usage_list_local = NULL; + if (!cJSON_IsArray(sec_rat_data_usage_list)) { + ogs_error("OpenAPI_n2_info_notification_rsp_data_parseFromJSON() failed [sec_rat_data_usage_list]"); + goto end; + } + + sec_rat_data_usage_listList = OpenAPI_list_create(); + + cJSON_ArrayForEach(sec_rat_data_usage_list_local, sec_rat_data_usage_list) { + if (!cJSON_IsObject(sec_rat_data_usage_list_local)) { + ogs_error("OpenAPI_n2_info_notification_rsp_data_parseFromJSON() failed [sec_rat_data_usage_list]"); + goto end; + } + OpenAPI_n2_sm_information_t *sec_rat_data_usage_listItem = OpenAPI_n2_sm_information_parseFromJSON(sec_rat_data_usage_list_local); + if (!sec_rat_data_usage_listItem) { + ogs_error("No sec_rat_data_usage_listItem"); + OpenAPI_list_free(sec_rat_data_usage_listList); + goto end; + } + OpenAPI_list_add(sec_rat_data_usage_listList, sec_rat_data_usage_listItem); + } } n2_info_notification_rsp_data_local_var = OpenAPI_n2_info_notification_rsp_data_create ( - n2_info_content ? n2_info_content_local_nonprim : NULL + sec_rat_data_usage_list ? sec_rat_data_usage_listList : NULL ); return n2_info_notification_rsp_data_local_var; end: - if (n2_info_content_local_nonprim) { - OpenAPI_n2_info_content_free(n2_info_content_local_nonprim); - n2_info_content_local_nonprim = NULL; + if (sec_rat_data_usage_listList) { + OpenAPI_list_for_each(sec_rat_data_usage_listList, node) { + OpenAPI_n2_sm_information_free(node->data); + } + OpenAPI_list_free(sec_rat_data_usage_listList); + sec_rat_data_usage_listList = NULL; } return NULL; } diff --git a/lib/sbi/openapi/model/n2_info_notification_rsp_data.h b/lib/sbi/openapi/model/n2_info_notification_rsp_data.h index 74c0d3652..d26510edf 100644 --- a/lib/sbi/openapi/model/n2_info_notification_rsp_data.h +++ b/lib/sbi/openapi/model/n2_info_notification_rsp_data.h @@ -1,7 +1,7 @@ /* * n2_info_notification_rsp_data.h * - * + * Data within a N2 information notification response */ #ifndef _OpenAPI_n2_info_notification_rsp_data_H_ @@ -12,7 +12,7 @@ #include "../include/list.h" #include "../include/keyValuePair.h" #include "../include/binary.h" -#include "n2_info_content.h" +#include "n2_sm_information.h" #ifdef __cplusplus extern "C" { @@ -20,11 +20,11 @@ extern "C" { typedef struct OpenAPI_n2_info_notification_rsp_data_s OpenAPI_n2_info_notification_rsp_data_t; typedef struct OpenAPI_n2_info_notification_rsp_data_s { - struct OpenAPI_n2_info_content_s *n2_info_content; + OpenAPI_list_t *sec_rat_data_usage_list; } OpenAPI_n2_info_notification_rsp_data_t; OpenAPI_n2_info_notification_rsp_data_t *OpenAPI_n2_info_notification_rsp_data_create( - OpenAPI_n2_info_content_t *n2_info_content + OpenAPI_list_t *sec_rat_data_usage_list ); void OpenAPI_n2_info_notification_rsp_data_free(OpenAPI_n2_info_notification_rsp_data_t *n2_info_notification_rsp_data); OpenAPI_n2_info_notification_rsp_data_t *OpenAPI_n2_info_notification_rsp_data_parseFromJSON(cJSON *n2_info_notification_rsp_dataJSON); diff --git a/lib/sbi/openapi/model/n2_info_notify_handover_complete_200_response.c b/lib/sbi/openapi/model/n2_info_notify_handover_complete_200_response.c index 7882cc87d..9bfe23018 100644 --- a/lib/sbi/openapi/model/n2_info_notify_handover_complete_200_response.c +++ b/lib/sbi/openapi/model/n2_info_notify_handover_complete_200_response.c @@ -6,14 +6,44 @@ OpenAPI_n2_info_notify_handover_complete_200_response_t *OpenAPI_n2_info_notify_handover_complete_200_response_create( OpenAPI_n2_info_notification_rsp_data_t *json_data, - OpenAPI_binary_t* binary_data_n2_information + OpenAPI_binary_t* binary_data_n2_information_ext1, + OpenAPI_binary_t* binary_data_n2_information_ext2, + OpenAPI_binary_t* binary_data_n2_information_ext3, + OpenAPI_binary_t* binary_data_n2_information_ext4, + OpenAPI_binary_t* binary_data_n2_information_ext5, + OpenAPI_binary_t* binary_data_n2_information_ext6, + OpenAPI_binary_t* binary_data_n2_information_ext7, + OpenAPI_binary_t* binary_data_n2_information_ext8, + OpenAPI_binary_t* binary_data_n2_information_ext9, + OpenAPI_binary_t* binary_data_n2_information_ext10, + OpenAPI_binary_t* binary_data_n2_information_ext11, + OpenAPI_binary_t* binary_data_n2_information_ext12, + OpenAPI_binary_t* binary_data_n2_information_ext13, + OpenAPI_binary_t* binary_data_n2_information_ext14, + OpenAPI_binary_t* binary_data_n2_information_ext15, + OpenAPI_binary_t* binary_data_n2_information_ext16 ) { OpenAPI_n2_info_notify_handover_complete_200_response_t *n2_info_notify_handover_complete_200_response_local_var = ogs_malloc(sizeof(OpenAPI_n2_info_notify_handover_complete_200_response_t)); ogs_assert(n2_info_notify_handover_complete_200_response_local_var); n2_info_notify_handover_complete_200_response_local_var->json_data = json_data; - n2_info_notify_handover_complete_200_response_local_var->binary_data_n2_information = binary_data_n2_information; + n2_info_notify_handover_complete_200_response_local_var->binary_data_n2_information_ext1 = binary_data_n2_information_ext1; + n2_info_notify_handover_complete_200_response_local_var->binary_data_n2_information_ext2 = binary_data_n2_information_ext2; + n2_info_notify_handover_complete_200_response_local_var->binary_data_n2_information_ext3 = binary_data_n2_information_ext3; + n2_info_notify_handover_complete_200_response_local_var->binary_data_n2_information_ext4 = binary_data_n2_information_ext4; + n2_info_notify_handover_complete_200_response_local_var->binary_data_n2_information_ext5 = binary_data_n2_information_ext5; + n2_info_notify_handover_complete_200_response_local_var->binary_data_n2_information_ext6 = binary_data_n2_information_ext6; + n2_info_notify_handover_complete_200_response_local_var->binary_data_n2_information_ext7 = binary_data_n2_information_ext7; + n2_info_notify_handover_complete_200_response_local_var->binary_data_n2_information_ext8 = binary_data_n2_information_ext8; + n2_info_notify_handover_complete_200_response_local_var->binary_data_n2_information_ext9 = binary_data_n2_information_ext9; + n2_info_notify_handover_complete_200_response_local_var->binary_data_n2_information_ext10 = binary_data_n2_information_ext10; + n2_info_notify_handover_complete_200_response_local_var->binary_data_n2_information_ext11 = binary_data_n2_information_ext11; + n2_info_notify_handover_complete_200_response_local_var->binary_data_n2_information_ext12 = binary_data_n2_information_ext12; + n2_info_notify_handover_complete_200_response_local_var->binary_data_n2_information_ext13 = binary_data_n2_information_ext13; + n2_info_notify_handover_complete_200_response_local_var->binary_data_n2_information_ext14 = binary_data_n2_information_ext14; + n2_info_notify_handover_complete_200_response_local_var->binary_data_n2_information_ext15 = binary_data_n2_information_ext15; + n2_info_notify_handover_complete_200_response_local_var->binary_data_n2_information_ext16 = binary_data_n2_information_ext16; return n2_info_notify_handover_complete_200_response_local_var; } @@ -29,9 +59,69 @@ void OpenAPI_n2_info_notify_handover_complete_200_response_free(OpenAPI_n2_info_ OpenAPI_n2_info_notification_rsp_data_free(n2_info_notify_handover_complete_200_response->json_data); n2_info_notify_handover_complete_200_response->json_data = NULL; } - if (n2_info_notify_handover_complete_200_response->binary_data_n2_information) { - ogs_free(n2_info_notify_handover_complete_200_response->binary_data_n2_information->data); - n2_info_notify_handover_complete_200_response->binary_data_n2_information = NULL; + if (n2_info_notify_handover_complete_200_response->binary_data_n2_information_ext1) { + ogs_free(n2_info_notify_handover_complete_200_response->binary_data_n2_information_ext1->data); + n2_info_notify_handover_complete_200_response->binary_data_n2_information_ext1 = NULL; + } + if (n2_info_notify_handover_complete_200_response->binary_data_n2_information_ext2) { + ogs_free(n2_info_notify_handover_complete_200_response->binary_data_n2_information_ext2->data); + n2_info_notify_handover_complete_200_response->binary_data_n2_information_ext2 = NULL; + } + if (n2_info_notify_handover_complete_200_response->binary_data_n2_information_ext3) { + ogs_free(n2_info_notify_handover_complete_200_response->binary_data_n2_information_ext3->data); + n2_info_notify_handover_complete_200_response->binary_data_n2_information_ext3 = NULL; + } + if (n2_info_notify_handover_complete_200_response->binary_data_n2_information_ext4) { + ogs_free(n2_info_notify_handover_complete_200_response->binary_data_n2_information_ext4->data); + n2_info_notify_handover_complete_200_response->binary_data_n2_information_ext4 = NULL; + } + if (n2_info_notify_handover_complete_200_response->binary_data_n2_information_ext5) { + ogs_free(n2_info_notify_handover_complete_200_response->binary_data_n2_information_ext5->data); + n2_info_notify_handover_complete_200_response->binary_data_n2_information_ext5 = NULL; + } + if (n2_info_notify_handover_complete_200_response->binary_data_n2_information_ext6) { + ogs_free(n2_info_notify_handover_complete_200_response->binary_data_n2_information_ext6->data); + n2_info_notify_handover_complete_200_response->binary_data_n2_information_ext6 = NULL; + } + if (n2_info_notify_handover_complete_200_response->binary_data_n2_information_ext7) { + ogs_free(n2_info_notify_handover_complete_200_response->binary_data_n2_information_ext7->data); + n2_info_notify_handover_complete_200_response->binary_data_n2_information_ext7 = NULL; + } + if (n2_info_notify_handover_complete_200_response->binary_data_n2_information_ext8) { + ogs_free(n2_info_notify_handover_complete_200_response->binary_data_n2_information_ext8->data); + n2_info_notify_handover_complete_200_response->binary_data_n2_information_ext8 = NULL; + } + if (n2_info_notify_handover_complete_200_response->binary_data_n2_information_ext9) { + ogs_free(n2_info_notify_handover_complete_200_response->binary_data_n2_information_ext9->data); + n2_info_notify_handover_complete_200_response->binary_data_n2_information_ext9 = NULL; + } + if (n2_info_notify_handover_complete_200_response->binary_data_n2_information_ext10) { + ogs_free(n2_info_notify_handover_complete_200_response->binary_data_n2_information_ext10->data); + n2_info_notify_handover_complete_200_response->binary_data_n2_information_ext10 = NULL; + } + if (n2_info_notify_handover_complete_200_response->binary_data_n2_information_ext11) { + ogs_free(n2_info_notify_handover_complete_200_response->binary_data_n2_information_ext11->data); + n2_info_notify_handover_complete_200_response->binary_data_n2_information_ext11 = NULL; + } + if (n2_info_notify_handover_complete_200_response->binary_data_n2_information_ext12) { + ogs_free(n2_info_notify_handover_complete_200_response->binary_data_n2_information_ext12->data); + n2_info_notify_handover_complete_200_response->binary_data_n2_information_ext12 = NULL; + } + if (n2_info_notify_handover_complete_200_response->binary_data_n2_information_ext13) { + ogs_free(n2_info_notify_handover_complete_200_response->binary_data_n2_information_ext13->data); + n2_info_notify_handover_complete_200_response->binary_data_n2_information_ext13 = NULL; + } + if (n2_info_notify_handover_complete_200_response->binary_data_n2_information_ext14) { + ogs_free(n2_info_notify_handover_complete_200_response->binary_data_n2_information_ext14->data); + n2_info_notify_handover_complete_200_response->binary_data_n2_information_ext14 = NULL; + } + if (n2_info_notify_handover_complete_200_response->binary_data_n2_information_ext15) { + ogs_free(n2_info_notify_handover_complete_200_response->binary_data_n2_information_ext15->data); + n2_info_notify_handover_complete_200_response->binary_data_n2_information_ext15 = NULL; + } + if (n2_info_notify_handover_complete_200_response->binary_data_n2_information_ext16) { + ogs_free(n2_info_notify_handover_complete_200_response->binary_data_n2_information_ext16->data); + n2_info_notify_handover_complete_200_response->binary_data_n2_information_ext16 = NULL; } ogs_free(n2_info_notify_handover_complete_200_response); } @@ -60,13 +150,148 @@ cJSON *OpenAPI_n2_info_notify_handover_complete_200_response_convertToJSON(OpenA } } - if (n2_info_notify_handover_complete_200_response->binary_data_n2_information) { - char* encoded_str_binary_data_n2_information = OpenAPI_base64encode(n2_info_notify_handover_complete_200_response->binary_data_n2_information->data,n2_info_notify_handover_complete_200_response->binary_data_n2_information->len); - if (cJSON_AddStringToObject(item, "binaryDataN2Information", encoded_str_binary_data_n2_information) == NULL) { - ogs_error("OpenAPI_n2_info_notify_handover_complete_200_response_convertToJSON() failed [binary_data_n2_information]"); + if (n2_info_notify_handover_complete_200_response->binary_data_n2_information_ext1) { + char* encoded_str_binary_data_n2_information_ext1 = OpenAPI_base64encode(n2_info_notify_handover_complete_200_response->binary_data_n2_information_ext1->data,n2_info_notify_handover_complete_200_response->binary_data_n2_information_ext1->len); + if (cJSON_AddStringToObject(item, "binaryDataN2InformationExt1", encoded_str_binary_data_n2_information_ext1) == NULL) { + ogs_error("OpenAPI_n2_info_notify_handover_complete_200_response_convertToJSON() failed [binary_data_n2_information_ext1]"); goto end; } - ogs_free(encoded_str_binary_data_n2_information); + ogs_free(encoded_str_binary_data_n2_information_ext1); + } + + if (n2_info_notify_handover_complete_200_response->binary_data_n2_information_ext2) { + char* encoded_str_binary_data_n2_information_ext2 = OpenAPI_base64encode(n2_info_notify_handover_complete_200_response->binary_data_n2_information_ext2->data,n2_info_notify_handover_complete_200_response->binary_data_n2_information_ext2->len); + if (cJSON_AddStringToObject(item, "binaryDataN2InformationExt2", encoded_str_binary_data_n2_information_ext2) == NULL) { + ogs_error("OpenAPI_n2_info_notify_handover_complete_200_response_convertToJSON() failed [binary_data_n2_information_ext2]"); + goto end; + } + ogs_free(encoded_str_binary_data_n2_information_ext2); + } + + if (n2_info_notify_handover_complete_200_response->binary_data_n2_information_ext3) { + char* encoded_str_binary_data_n2_information_ext3 = OpenAPI_base64encode(n2_info_notify_handover_complete_200_response->binary_data_n2_information_ext3->data,n2_info_notify_handover_complete_200_response->binary_data_n2_information_ext3->len); + if (cJSON_AddStringToObject(item, "binaryDataN2InformationExt3", encoded_str_binary_data_n2_information_ext3) == NULL) { + ogs_error("OpenAPI_n2_info_notify_handover_complete_200_response_convertToJSON() failed [binary_data_n2_information_ext3]"); + goto end; + } + ogs_free(encoded_str_binary_data_n2_information_ext3); + } + + if (n2_info_notify_handover_complete_200_response->binary_data_n2_information_ext4) { + char* encoded_str_binary_data_n2_information_ext4 = OpenAPI_base64encode(n2_info_notify_handover_complete_200_response->binary_data_n2_information_ext4->data,n2_info_notify_handover_complete_200_response->binary_data_n2_information_ext4->len); + if (cJSON_AddStringToObject(item, "binaryDataN2InformationExt4", encoded_str_binary_data_n2_information_ext4) == NULL) { + ogs_error("OpenAPI_n2_info_notify_handover_complete_200_response_convertToJSON() failed [binary_data_n2_information_ext4]"); + goto end; + } + ogs_free(encoded_str_binary_data_n2_information_ext4); + } + + if (n2_info_notify_handover_complete_200_response->binary_data_n2_information_ext5) { + char* encoded_str_binary_data_n2_information_ext5 = OpenAPI_base64encode(n2_info_notify_handover_complete_200_response->binary_data_n2_information_ext5->data,n2_info_notify_handover_complete_200_response->binary_data_n2_information_ext5->len); + if (cJSON_AddStringToObject(item, "binaryDataN2InformationExt5", encoded_str_binary_data_n2_information_ext5) == NULL) { + ogs_error("OpenAPI_n2_info_notify_handover_complete_200_response_convertToJSON() failed [binary_data_n2_information_ext5]"); + goto end; + } + ogs_free(encoded_str_binary_data_n2_information_ext5); + } + + if (n2_info_notify_handover_complete_200_response->binary_data_n2_information_ext6) { + char* encoded_str_binary_data_n2_information_ext6 = OpenAPI_base64encode(n2_info_notify_handover_complete_200_response->binary_data_n2_information_ext6->data,n2_info_notify_handover_complete_200_response->binary_data_n2_information_ext6->len); + if (cJSON_AddStringToObject(item, "binaryDataN2InformationExt6", encoded_str_binary_data_n2_information_ext6) == NULL) { + ogs_error("OpenAPI_n2_info_notify_handover_complete_200_response_convertToJSON() failed [binary_data_n2_information_ext6]"); + goto end; + } + ogs_free(encoded_str_binary_data_n2_information_ext6); + } + + if (n2_info_notify_handover_complete_200_response->binary_data_n2_information_ext7) { + char* encoded_str_binary_data_n2_information_ext7 = OpenAPI_base64encode(n2_info_notify_handover_complete_200_response->binary_data_n2_information_ext7->data,n2_info_notify_handover_complete_200_response->binary_data_n2_information_ext7->len); + if (cJSON_AddStringToObject(item, "binaryDataN2InformationExt7", encoded_str_binary_data_n2_information_ext7) == NULL) { + ogs_error("OpenAPI_n2_info_notify_handover_complete_200_response_convertToJSON() failed [binary_data_n2_information_ext7]"); + goto end; + } + ogs_free(encoded_str_binary_data_n2_information_ext7); + } + + if (n2_info_notify_handover_complete_200_response->binary_data_n2_information_ext8) { + char* encoded_str_binary_data_n2_information_ext8 = OpenAPI_base64encode(n2_info_notify_handover_complete_200_response->binary_data_n2_information_ext8->data,n2_info_notify_handover_complete_200_response->binary_data_n2_information_ext8->len); + if (cJSON_AddStringToObject(item, "binaryDataN2InformationExt8", encoded_str_binary_data_n2_information_ext8) == NULL) { + ogs_error("OpenAPI_n2_info_notify_handover_complete_200_response_convertToJSON() failed [binary_data_n2_information_ext8]"); + goto end; + } + ogs_free(encoded_str_binary_data_n2_information_ext8); + } + + if (n2_info_notify_handover_complete_200_response->binary_data_n2_information_ext9) { + char* encoded_str_binary_data_n2_information_ext9 = OpenAPI_base64encode(n2_info_notify_handover_complete_200_response->binary_data_n2_information_ext9->data,n2_info_notify_handover_complete_200_response->binary_data_n2_information_ext9->len); + if (cJSON_AddStringToObject(item, "binaryDataN2InformationExt9", encoded_str_binary_data_n2_information_ext9) == NULL) { + ogs_error("OpenAPI_n2_info_notify_handover_complete_200_response_convertToJSON() failed [binary_data_n2_information_ext9]"); + goto end; + } + ogs_free(encoded_str_binary_data_n2_information_ext9); + } + + if (n2_info_notify_handover_complete_200_response->binary_data_n2_information_ext10) { + char* encoded_str_binary_data_n2_information_ext10 = OpenAPI_base64encode(n2_info_notify_handover_complete_200_response->binary_data_n2_information_ext10->data,n2_info_notify_handover_complete_200_response->binary_data_n2_information_ext10->len); + if (cJSON_AddStringToObject(item, "binaryDataN2InformationExt10", encoded_str_binary_data_n2_information_ext10) == NULL) { + ogs_error("OpenAPI_n2_info_notify_handover_complete_200_response_convertToJSON() failed [binary_data_n2_information_ext10]"); + goto end; + } + ogs_free(encoded_str_binary_data_n2_information_ext10); + } + + if (n2_info_notify_handover_complete_200_response->binary_data_n2_information_ext11) { + char* encoded_str_binary_data_n2_information_ext11 = OpenAPI_base64encode(n2_info_notify_handover_complete_200_response->binary_data_n2_information_ext11->data,n2_info_notify_handover_complete_200_response->binary_data_n2_information_ext11->len); + if (cJSON_AddStringToObject(item, "binaryDataN2InformationExt11", encoded_str_binary_data_n2_information_ext11) == NULL) { + ogs_error("OpenAPI_n2_info_notify_handover_complete_200_response_convertToJSON() failed [binary_data_n2_information_ext11]"); + goto end; + } + ogs_free(encoded_str_binary_data_n2_information_ext11); + } + + if (n2_info_notify_handover_complete_200_response->binary_data_n2_information_ext12) { + char* encoded_str_binary_data_n2_information_ext12 = OpenAPI_base64encode(n2_info_notify_handover_complete_200_response->binary_data_n2_information_ext12->data,n2_info_notify_handover_complete_200_response->binary_data_n2_information_ext12->len); + if (cJSON_AddStringToObject(item, "binaryDataN2InformationExt12", encoded_str_binary_data_n2_information_ext12) == NULL) { + ogs_error("OpenAPI_n2_info_notify_handover_complete_200_response_convertToJSON() failed [binary_data_n2_information_ext12]"); + goto end; + } + ogs_free(encoded_str_binary_data_n2_information_ext12); + } + + if (n2_info_notify_handover_complete_200_response->binary_data_n2_information_ext13) { + char* encoded_str_binary_data_n2_information_ext13 = OpenAPI_base64encode(n2_info_notify_handover_complete_200_response->binary_data_n2_information_ext13->data,n2_info_notify_handover_complete_200_response->binary_data_n2_information_ext13->len); + if (cJSON_AddStringToObject(item, "binaryDataN2InformationExt13", encoded_str_binary_data_n2_information_ext13) == NULL) { + ogs_error("OpenAPI_n2_info_notify_handover_complete_200_response_convertToJSON() failed [binary_data_n2_information_ext13]"); + goto end; + } + ogs_free(encoded_str_binary_data_n2_information_ext13); + } + + if (n2_info_notify_handover_complete_200_response->binary_data_n2_information_ext14) { + char* encoded_str_binary_data_n2_information_ext14 = OpenAPI_base64encode(n2_info_notify_handover_complete_200_response->binary_data_n2_information_ext14->data,n2_info_notify_handover_complete_200_response->binary_data_n2_information_ext14->len); + if (cJSON_AddStringToObject(item, "binaryDataN2InformationExt14", encoded_str_binary_data_n2_information_ext14) == NULL) { + ogs_error("OpenAPI_n2_info_notify_handover_complete_200_response_convertToJSON() failed [binary_data_n2_information_ext14]"); + goto end; + } + ogs_free(encoded_str_binary_data_n2_information_ext14); + } + + if (n2_info_notify_handover_complete_200_response->binary_data_n2_information_ext15) { + char* encoded_str_binary_data_n2_information_ext15 = OpenAPI_base64encode(n2_info_notify_handover_complete_200_response->binary_data_n2_information_ext15->data,n2_info_notify_handover_complete_200_response->binary_data_n2_information_ext15->len); + if (cJSON_AddStringToObject(item, "binaryDataN2InformationExt15", encoded_str_binary_data_n2_information_ext15) == NULL) { + ogs_error("OpenAPI_n2_info_notify_handover_complete_200_response_convertToJSON() failed [binary_data_n2_information_ext15]"); + goto end; + } + ogs_free(encoded_str_binary_data_n2_information_ext15); + } + + if (n2_info_notify_handover_complete_200_response->binary_data_n2_information_ext16) { + char* encoded_str_binary_data_n2_information_ext16 = OpenAPI_base64encode(n2_info_notify_handover_complete_200_response->binary_data_n2_information_ext16->data,n2_info_notify_handover_complete_200_response->binary_data_n2_information_ext16->len); + if (cJSON_AddStringToObject(item, "binaryDataN2InformationExt16", encoded_str_binary_data_n2_information_ext16) == NULL) { + ogs_error("OpenAPI_n2_info_notify_handover_complete_200_response_convertToJSON() failed [binary_data_n2_information_ext16]"); + goto end; + } + ogs_free(encoded_str_binary_data_n2_information_ext16); } end: @@ -79,31 +304,301 @@ OpenAPI_n2_info_notify_handover_complete_200_response_t *OpenAPI_n2_info_notify_ OpenAPI_lnode_t *node = NULL; cJSON *json_data = NULL; OpenAPI_n2_info_notification_rsp_data_t *json_data_local_nonprim = NULL; - cJSON *binary_data_n2_information = NULL; - OpenAPI_binary_t *decoded_str_binary_data_n2_information = NULL; + cJSON *binary_data_n2_information_ext1 = NULL; + OpenAPI_binary_t *decoded_str_binary_data_n2_information_ext1 = NULL; + cJSON *binary_data_n2_information_ext2 = NULL; + OpenAPI_binary_t *decoded_str_binary_data_n2_information_ext2 = NULL; + cJSON *binary_data_n2_information_ext3 = NULL; + OpenAPI_binary_t *decoded_str_binary_data_n2_information_ext3 = NULL; + cJSON *binary_data_n2_information_ext4 = NULL; + OpenAPI_binary_t *decoded_str_binary_data_n2_information_ext4 = NULL; + cJSON *binary_data_n2_information_ext5 = NULL; + OpenAPI_binary_t *decoded_str_binary_data_n2_information_ext5 = NULL; + cJSON *binary_data_n2_information_ext6 = NULL; + OpenAPI_binary_t *decoded_str_binary_data_n2_information_ext6 = NULL; + cJSON *binary_data_n2_information_ext7 = NULL; + OpenAPI_binary_t *decoded_str_binary_data_n2_information_ext7 = NULL; + cJSON *binary_data_n2_information_ext8 = NULL; + OpenAPI_binary_t *decoded_str_binary_data_n2_information_ext8 = NULL; + cJSON *binary_data_n2_information_ext9 = NULL; + OpenAPI_binary_t *decoded_str_binary_data_n2_information_ext9 = NULL; + cJSON *binary_data_n2_information_ext10 = NULL; + OpenAPI_binary_t *decoded_str_binary_data_n2_information_ext10 = NULL; + cJSON *binary_data_n2_information_ext11 = NULL; + OpenAPI_binary_t *decoded_str_binary_data_n2_information_ext11 = NULL; + cJSON *binary_data_n2_information_ext12 = NULL; + OpenAPI_binary_t *decoded_str_binary_data_n2_information_ext12 = NULL; + cJSON *binary_data_n2_information_ext13 = NULL; + OpenAPI_binary_t *decoded_str_binary_data_n2_information_ext13 = NULL; + cJSON *binary_data_n2_information_ext14 = NULL; + OpenAPI_binary_t *decoded_str_binary_data_n2_information_ext14 = NULL; + cJSON *binary_data_n2_information_ext15 = NULL; + OpenAPI_binary_t *decoded_str_binary_data_n2_information_ext15 = NULL; + cJSON *binary_data_n2_information_ext16 = NULL; + OpenAPI_binary_t *decoded_str_binary_data_n2_information_ext16 = NULL; json_data = cJSON_GetObjectItemCaseSensitive(n2_info_notify_handover_complete_200_responseJSON, "jsonData"); if (json_data) { json_data_local_nonprim = OpenAPI_n2_info_notification_rsp_data_parseFromJSON(json_data); } - binary_data_n2_information = cJSON_GetObjectItemCaseSensitive(n2_info_notify_handover_complete_200_responseJSON, "binaryDataN2Information"); - if (binary_data_n2_information) { - decoded_str_binary_data_n2_information = ogs_malloc(sizeof(OpenAPI_binary_t)); - ogs_assert(decoded_str_binary_data_n2_information); - if (!cJSON_IsString(binary_data_n2_information)) { - ogs_error("OpenAPI_n2_info_notify_handover_complete_200_response_parseFromJSON() failed [binary_data_n2_information]"); + binary_data_n2_information_ext1 = cJSON_GetObjectItemCaseSensitive(n2_info_notify_handover_complete_200_responseJSON, "binaryDataN2InformationExt1"); + if (binary_data_n2_information_ext1) { + decoded_str_binary_data_n2_information_ext1 = ogs_malloc(sizeof(OpenAPI_binary_t)); + ogs_assert(decoded_str_binary_data_n2_information_ext1); + if (!cJSON_IsString(binary_data_n2_information_ext1)) { + ogs_error("OpenAPI_n2_info_notify_handover_complete_200_response_parseFromJSON() failed [binary_data_n2_information_ext1]"); goto end; } - decoded_str_binary_data_n2_information->data = OpenAPI_base64decode(binary_data_n2_information->valuestring, strlen(binary_data_n2_information->valuestring), &decoded_str_binary_data_n2_information->len); - if (!decoded_str_binary_data_n2_information->data) { - ogs_error("OpenAPI_n2_info_notify_handover_complete_200_response_parseFromJSON() failed [binary_data_n2_information]"); + decoded_str_binary_data_n2_information_ext1->data = OpenAPI_base64decode(binary_data_n2_information_ext1->valuestring, strlen(binary_data_n2_information_ext1->valuestring), &decoded_str_binary_data_n2_information_ext1->len); + if (!decoded_str_binary_data_n2_information_ext1->data) { + ogs_error("OpenAPI_n2_info_notify_handover_complete_200_response_parseFromJSON() failed [binary_data_n2_information_ext1]"); + goto end; + } + } + + binary_data_n2_information_ext2 = cJSON_GetObjectItemCaseSensitive(n2_info_notify_handover_complete_200_responseJSON, "binaryDataN2InformationExt2"); + if (binary_data_n2_information_ext2) { + decoded_str_binary_data_n2_information_ext2 = ogs_malloc(sizeof(OpenAPI_binary_t)); + ogs_assert(decoded_str_binary_data_n2_information_ext2); + if (!cJSON_IsString(binary_data_n2_information_ext2)) { + ogs_error("OpenAPI_n2_info_notify_handover_complete_200_response_parseFromJSON() failed [binary_data_n2_information_ext2]"); + goto end; + } + decoded_str_binary_data_n2_information_ext2->data = OpenAPI_base64decode(binary_data_n2_information_ext2->valuestring, strlen(binary_data_n2_information_ext2->valuestring), &decoded_str_binary_data_n2_information_ext2->len); + if (!decoded_str_binary_data_n2_information_ext2->data) { + ogs_error("OpenAPI_n2_info_notify_handover_complete_200_response_parseFromJSON() failed [binary_data_n2_information_ext2]"); + goto end; + } + } + + binary_data_n2_information_ext3 = cJSON_GetObjectItemCaseSensitive(n2_info_notify_handover_complete_200_responseJSON, "binaryDataN2InformationExt3"); + if (binary_data_n2_information_ext3) { + decoded_str_binary_data_n2_information_ext3 = ogs_malloc(sizeof(OpenAPI_binary_t)); + ogs_assert(decoded_str_binary_data_n2_information_ext3); + if (!cJSON_IsString(binary_data_n2_information_ext3)) { + ogs_error("OpenAPI_n2_info_notify_handover_complete_200_response_parseFromJSON() failed [binary_data_n2_information_ext3]"); + goto end; + } + decoded_str_binary_data_n2_information_ext3->data = OpenAPI_base64decode(binary_data_n2_information_ext3->valuestring, strlen(binary_data_n2_information_ext3->valuestring), &decoded_str_binary_data_n2_information_ext3->len); + if (!decoded_str_binary_data_n2_information_ext3->data) { + ogs_error("OpenAPI_n2_info_notify_handover_complete_200_response_parseFromJSON() failed [binary_data_n2_information_ext3]"); + goto end; + } + } + + binary_data_n2_information_ext4 = cJSON_GetObjectItemCaseSensitive(n2_info_notify_handover_complete_200_responseJSON, "binaryDataN2InformationExt4"); + if (binary_data_n2_information_ext4) { + decoded_str_binary_data_n2_information_ext4 = ogs_malloc(sizeof(OpenAPI_binary_t)); + ogs_assert(decoded_str_binary_data_n2_information_ext4); + if (!cJSON_IsString(binary_data_n2_information_ext4)) { + ogs_error("OpenAPI_n2_info_notify_handover_complete_200_response_parseFromJSON() failed [binary_data_n2_information_ext4]"); + goto end; + } + decoded_str_binary_data_n2_information_ext4->data = OpenAPI_base64decode(binary_data_n2_information_ext4->valuestring, strlen(binary_data_n2_information_ext4->valuestring), &decoded_str_binary_data_n2_information_ext4->len); + if (!decoded_str_binary_data_n2_information_ext4->data) { + ogs_error("OpenAPI_n2_info_notify_handover_complete_200_response_parseFromJSON() failed [binary_data_n2_information_ext4]"); + goto end; + } + } + + binary_data_n2_information_ext5 = cJSON_GetObjectItemCaseSensitive(n2_info_notify_handover_complete_200_responseJSON, "binaryDataN2InformationExt5"); + if (binary_data_n2_information_ext5) { + decoded_str_binary_data_n2_information_ext5 = ogs_malloc(sizeof(OpenAPI_binary_t)); + ogs_assert(decoded_str_binary_data_n2_information_ext5); + if (!cJSON_IsString(binary_data_n2_information_ext5)) { + ogs_error("OpenAPI_n2_info_notify_handover_complete_200_response_parseFromJSON() failed [binary_data_n2_information_ext5]"); + goto end; + } + decoded_str_binary_data_n2_information_ext5->data = OpenAPI_base64decode(binary_data_n2_information_ext5->valuestring, strlen(binary_data_n2_information_ext5->valuestring), &decoded_str_binary_data_n2_information_ext5->len); + if (!decoded_str_binary_data_n2_information_ext5->data) { + ogs_error("OpenAPI_n2_info_notify_handover_complete_200_response_parseFromJSON() failed [binary_data_n2_information_ext5]"); + goto end; + } + } + + binary_data_n2_information_ext6 = cJSON_GetObjectItemCaseSensitive(n2_info_notify_handover_complete_200_responseJSON, "binaryDataN2InformationExt6"); + if (binary_data_n2_information_ext6) { + decoded_str_binary_data_n2_information_ext6 = ogs_malloc(sizeof(OpenAPI_binary_t)); + ogs_assert(decoded_str_binary_data_n2_information_ext6); + if (!cJSON_IsString(binary_data_n2_information_ext6)) { + ogs_error("OpenAPI_n2_info_notify_handover_complete_200_response_parseFromJSON() failed [binary_data_n2_information_ext6]"); + goto end; + } + decoded_str_binary_data_n2_information_ext6->data = OpenAPI_base64decode(binary_data_n2_information_ext6->valuestring, strlen(binary_data_n2_information_ext6->valuestring), &decoded_str_binary_data_n2_information_ext6->len); + if (!decoded_str_binary_data_n2_information_ext6->data) { + ogs_error("OpenAPI_n2_info_notify_handover_complete_200_response_parseFromJSON() failed [binary_data_n2_information_ext6]"); + goto end; + } + } + + binary_data_n2_information_ext7 = cJSON_GetObjectItemCaseSensitive(n2_info_notify_handover_complete_200_responseJSON, "binaryDataN2InformationExt7"); + if (binary_data_n2_information_ext7) { + decoded_str_binary_data_n2_information_ext7 = ogs_malloc(sizeof(OpenAPI_binary_t)); + ogs_assert(decoded_str_binary_data_n2_information_ext7); + if (!cJSON_IsString(binary_data_n2_information_ext7)) { + ogs_error("OpenAPI_n2_info_notify_handover_complete_200_response_parseFromJSON() failed [binary_data_n2_information_ext7]"); + goto end; + } + decoded_str_binary_data_n2_information_ext7->data = OpenAPI_base64decode(binary_data_n2_information_ext7->valuestring, strlen(binary_data_n2_information_ext7->valuestring), &decoded_str_binary_data_n2_information_ext7->len); + if (!decoded_str_binary_data_n2_information_ext7->data) { + ogs_error("OpenAPI_n2_info_notify_handover_complete_200_response_parseFromJSON() failed [binary_data_n2_information_ext7]"); + goto end; + } + } + + binary_data_n2_information_ext8 = cJSON_GetObjectItemCaseSensitive(n2_info_notify_handover_complete_200_responseJSON, "binaryDataN2InformationExt8"); + if (binary_data_n2_information_ext8) { + decoded_str_binary_data_n2_information_ext8 = ogs_malloc(sizeof(OpenAPI_binary_t)); + ogs_assert(decoded_str_binary_data_n2_information_ext8); + if (!cJSON_IsString(binary_data_n2_information_ext8)) { + ogs_error("OpenAPI_n2_info_notify_handover_complete_200_response_parseFromJSON() failed [binary_data_n2_information_ext8]"); + goto end; + } + decoded_str_binary_data_n2_information_ext8->data = OpenAPI_base64decode(binary_data_n2_information_ext8->valuestring, strlen(binary_data_n2_information_ext8->valuestring), &decoded_str_binary_data_n2_information_ext8->len); + if (!decoded_str_binary_data_n2_information_ext8->data) { + ogs_error("OpenAPI_n2_info_notify_handover_complete_200_response_parseFromJSON() failed [binary_data_n2_information_ext8]"); + goto end; + } + } + + binary_data_n2_information_ext9 = cJSON_GetObjectItemCaseSensitive(n2_info_notify_handover_complete_200_responseJSON, "binaryDataN2InformationExt9"); + if (binary_data_n2_information_ext9) { + decoded_str_binary_data_n2_information_ext9 = ogs_malloc(sizeof(OpenAPI_binary_t)); + ogs_assert(decoded_str_binary_data_n2_information_ext9); + if (!cJSON_IsString(binary_data_n2_information_ext9)) { + ogs_error("OpenAPI_n2_info_notify_handover_complete_200_response_parseFromJSON() failed [binary_data_n2_information_ext9]"); + goto end; + } + decoded_str_binary_data_n2_information_ext9->data = OpenAPI_base64decode(binary_data_n2_information_ext9->valuestring, strlen(binary_data_n2_information_ext9->valuestring), &decoded_str_binary_data_n2_information_ext9->len); + if (!decoded_str_binary_data_n2_information_ext9->data) { + ogs_error("OpenAPI_n2_info_notify_handover_complete_200_response_parseFromJSON() failed [binary_data_n2_information_ext9]"); + goto end; + } + } + + binary_data_n2_information_ext10 = cJSON_GetObjectItemCaseSensitive(n2_info_notify_handover_complete_200_responseJSON, "binaryDataN2InformationExt10"); + if (binary_data_n2_information_ext10) { + decoded_str_binary_data_n2_information_ext10 = ogs_malloc(sizeof(OpenAPI_binary_t)); + ogs_assert(decoded_str_binary_data_n2_information_ext10); + if (!cJSON_IsString(binary_data_n2_information_ext10)) { + ogs_error("OpenAPI_n2_info_notify_handover_complete_200_response_parseFromJSON() failed [binary_data_n2_information_ext10]"); + goto end; + } + decoded_str_binary_data_n2_information_ext10->data = OpenAPI_base64decode(binary_data_n2_information_ext10->valuestring, strlen(binary_data_n2_information_ext10->valuestring), &decoded_str_binary_data_n2_information_ext10->len); + if (!decoded_str_binary_data_n2_information_ext10->data) { + ogs_error("OpenAPI_n2_info_notify_handover_complete_200_response_parseFromJSON() failed [binary_data_n2_information_ext10]"); + goto end; + } + } + + binary_data_n2_information_ext11 = cJSON_GetObjectItemCaseSensitive(n2_info_notify_handover_complete_200_responseJSON, "binaryDataN2InformationExt11"); + if (binary_data_n2_information_ext11) { + decoded_str_binary_data_n2_information_ext11 = ogs_malloc(sizeof(OpenAPI_binary_t)); + ogs_assert(decoded_str_binary_data_n2_information_ext11); + if (!cJSON_IsString(binary_data_n2_information_ext11)) { + ogs_error("OpenAPI_n2_info_notify_handover_complete_200_response_parseFromJSON() failed [binary_data_n2_information_ext11]"); + goto end; + } + decoded_str_binary_data_n2_information_ext11->data = OpenAPI_base64decode(binary_data_n2_information_ext11->valuestring, strlen(binary_data_n2_information_ext11->valuestring), &decoded_str_binary_data_n2_information_ext11->len); + if (!decoded_str_binary_data_n2_information_ext11->data) { + ogs_error("OpenAPI_n2_info_notify_handover_complete_200_response_parseFromJSON() failed [binary_data_n2_information_ext11]"); + goto end; + } + } + + binary_data_n2_information_ext12 = cJSON_GetObjectItemCaseSensitive(n2_info_notify_handover_complete_200_responseJSON, "binaryDataN2InformationExt12"); + if (binary_data_n2_information_ext12) { + decoded_str_binary_data_n2_information_ext12 = ogs_malloc(sizeof(OpenAPI_binary_t)); + ogs_assert(decoded_str_binary_data_n2_information_ext12); + if (!cJSON_IsString(binary_data_n2_information_ext12)) { + ogs_error("OpenAPI_n2_info_notify_handover_complete_200_response_parseFromJSON() failed [binary_data_n2_information_ext12]"); + goto end; + } + decoded_str_binary_data_n2_information_ext12->data = OpenAPI_base64decode(binary_data_n2_information_ext12->valuestring, strlen(binary_data_n2_information_ext12->valuestring), &decoded_str_binary_data_n2_information_ext12->len); + if (!decoded_str_binary_data_n2_information_ext12->data) { + ogs_error("OpenAPI_n2_info_notify_handover_complete_200_response_parseFromJSON() failed [binary_data_n2_information_ext12]"); + goto end; + } + } + + binary_data_n2_information_ext13 = cJSON_GetObjectItemCaseSensitive(n2_info_notify_handover_complete_200_responseJSON, "binaryDataN2InformationExt13"); + if (binary_data_n2_information_ext13) { + decoded_str_binary_data_n2_information_ext13 = ogs_malloc(sizeof(OpenAPI_binary_t)); + ogs_assert(decoded_str_binary_data_n2_information_ext13); + if (!cJSON_IsString(binary_data_n2_information_ext13)) { + ogs_error("OpenAPI_n2_info_notify_handover_complete_200_response_parseFromJSON() failed [binary_data_n2_information_ext13]"); + goto end; + } + decoded_str_binary_data_n2_information_ext13->data = OpenAPI_base64decode(binary_data_n2_information_ext13->valuestring, strlen(binary_data_n2_information_ext13->valuestring), &decoded_str_binary_data_n2_information_ext13->len); + if (!decoded_str_binary_data_n2_information_ext13->data) { + ogs_error("OpenAPI_n2_info_notify_handover_complete_200_response_parseFromJSON() failed [binary_data_n2_information_ext13]"); + goto end; + } + } + + binary_data_n2_information_ext14 = cJSON_GetObjectItemCaseSensitive(n2_info_notify_handover_complete_200_responseJSON, "binaryDataN2InformationExt14"); + if (binary_data_n2_information_ext14) { + decoded_str_binary_data_n2_information_ext14 = ogs_malloc(sizeof(OpenAPI_binary_t)); + ogs_assert(decoded_str_binary_data_n2_information_ext14); + if (!cJSON_IsString(binary_data_n2_information_ext14)) { + ogs_error("OpenAPI_n2_info_notify_handover_complete_200_response_parseFromJSON() failed [binary_data_n2_information_ext14]"); + goto end; + } + decoded_str_binary_data_n2_information_ext14->data = OpenAPI_base64decode(binary_data_n2_information_ext14->valuestring, strlen(binary_data_n2_information_ext14->valuestring), &decoded_str_binary_data_n2_information_ext14->len); + if (!decoded_str_binary_data_n2_information_ext14->data) { + ogs_error("OpenAPI_n2_info_notify_handover_complete_200_response_parseFromJSON() failed [binary_data_n2_information_ext14]"); + goto end; + } + } + + binary_data_n2_information_ext15 = cJSON_GetObjectItemCaseSensitive(n2_info_notify_handover_complete_200_responseJSON, "binaryDataN2InformationExt15"); + if (binary_data_n2_information_ext15) { + decoded_str_binary_data_n2_information_ext15 = ogs_malloc(sizeof(OpenAPI_binary_t)); + ogs_assert(decoded_str_binary_data_n2_information_ext15); + if (!cJSON_IsString(binary_data_n2_information_ext15)) { + ogs_error("OpenAPI_n2_info_notify_handover_complete_200_response_parseFromJSON() failed [binary_data_n2_information_ext15]"); + goto end; + } + decoded_str_binary_data_n2_information_ext15->data = OpenAPI_base64decode(binary_data_n2_information_ext15->valuestring, strlen(binary_data_n2_information_ext15->valuestring), &decoded_str_binary_data_n2_information_ext15->len); + if (!decoded_str_binary_data_n2_information_ext15->data) { + ogs_error("OpenAPI_n2_info_notify_handover_complete_200_response_parseFromJSON() failed [binary_data_n2_information_ext15]"); + goto end; + } + } + + binary_data_n2_information_ext16 = cJSON_GetObjectItemCaseSensitive(n2_info_notify_handover_complete_200_responseJSON, "binaryDataN2InformationExt16"); + if (binary_data_n2_information_ext16) { + decoded_str_binary_data_n2_information_ext16 = ogs_malloc(sizeof(OpenAPI_binary_t)); + ogs_assert(decoded_str_binary_data_n2_information_ext16); + if (!cJSON_IsString(binary_data_n2_information_ext16)) { + ogs_error("OpenAPI_n2_info_notify_handover_complete_200_response_parseFromJSON() failed [binary_data_n2_information_ext16]"); + goto end; + } + decoded_str_binary_data_n2_information_ext16->data = OpenAPI_base64decode(binary_data_n2_information_ext16->valuestring, strlen(binary_data_n2_information_ext16->valuestring), &decoded_str_binary_data_n2_information_ext16->len); + if (!decoded_str_binary_data_n2_information_ext16->data) { + ogs_error("OpenAPI_n2_info_notify_handover_complete_200_response_parseFromJSON() failed [binary_data_n2_information_ext16]"); goto end; } } n2_info_notify_handover_complete_200_response_local_var = OpenAPI_n2_info_notify_handover_complete_200_response_create ( json_data ? json_data_local_nonprim : NULL, - binary_data_n2_information ? decoded_str_binary_data_n2_information : NULL + binary_data_n2_information_ext1 ? decoded_str_binary_data_n2_information_ext1 : NULL, + binary_data_n2_information_ext2 ? decoded_str_binary_data_n2_information_ext2 : NULL, + binary_data_n2_information_ext3 ? decoded_str_binary_data_n2_information_ext3 : NULL, + binary_data_n2_information_ext4 ? decoded_str_binary_data_n2_information_ext4 : NULL, + binary_data_n2_information_ext5 ? decoded_str_binary_data_n2_information_ext5 : NULL, + binary_data_n2_information_ext6 ? decoded_str_binary_data_n2_information_ext6 : NULL, + binary_data_n2_information_ext7 ? decoded_str_binary_data_n2_information_ext7 : NULL, + binary_data_n2_information_ext8 ? decoded_str_binary_data_n2_information_ext8 : NULL, + binary_data_n2_information_ext9 ? decoded_str_binary_data_n2_information_ext9 : NULL, + binary_data_n2_information_ext10 ? decoded_str_binary_data_n2_information_ext10 : NULL, + binary_data_n2_information_ext11 ? decoded_str_binary_data_n2_information_ext11 : NULL, + binary_data_n2_information_ext12 ? decoded_str_binary_data_n2_information_ext12 : NULL, + binary_data_n2_information_ext13 ? decoded_str_binary_data_n2_information_ext13 : NULL, + binary_data_n2_information_ext14 ? decoded_str_binary_data_n2_information_ext14 : NULL, + binary_data_n2_information_ext15 ? decoded_str_binary_data_n2_information_ext15 : NULL, + binary_data_n2_information_ext16 ? decoded_str_binary_data_n2_information_ext16 : NULL ); return n2_info_notify_handover_complete_200_response_local_var; diff --git a/lib/sbi/openapi/model/n2_info_notify_handover_complete_200_response.h b/lib/sbi/openapi/model/n2_info_notify_handover_complete_200_response.h index 01b3b2fa9..1b360ba26 100644 --- a/lib/sbi/openapi/model/n2_info_notify_handover_complete_200_response.h +++ b/lib/sbi/openapi/model/n2_info_notify_handover_complete_200_response.h @@ -21,12 +21,42 @@ extern "C" { typedef struct OpenAPI_n2_info_notify_handover_complete_200_response_s OpenAPI_n2_info_notify_handover_complete_200_response_t; typedef struct OpenAPI_n2_info_notify_handover_complete_200_response_s { struct OpenAPI_n2_info_notification_rsp_data_s *json_data; - OpenAPI_binary_t* binary_data_n2_information; + OpenAPI_binary_t* binary_data_n2_information_ext1; + OpenAPI_binary_t* binary_data_n2_information_ext2; + OpenAPI_binary_t* binary_data_n2_information_ext3; + OpenAPI_binary_t* binary_data_n2_information_ext4; + OpenAPI_binary_t* binary_data_n2_information_ext5; + OpenAPI_binary_t* binary_data_n2_information_ext6; + OpenAPI_binary_t* binary_data_n2_information_ext7; + OpenAPI_binary_t* binary_data_n2_information_ext8; + OpenAPI_binary_t* binary_data_n2_information_ext9; + OpenAPI_binary_t* binary_data_n2_information_ext10; + OpenAPI_binary_t* binary_data_n2_information_ext11; + OpenAPI_binary_t* binary_data_n2_information_ext12; + OpenAPI_binary_t* binary_data_n2_information_ext13; + OpenAPI_binary_t* binary_data_n2_information_ext14; + OpenAPI_binary_t* binary_data_n2_information_ext15; + OpenAPI_binary_t* binary_data_n2_information_ext16; } OpenAPI_n2_info_notify_handover_complete_200_response_t; OpenAPI_n2_info_notify_handover_complete_200_response_t *OpenAPI_n2_info_notify_handover_complete_200_response_create( OpenAPI_n2_info_notification_rsp_data_t *json_data, - OpenAPI_binary_t* binary_data_n2_information + OpenAPI_binary_t* binary_data_n2_information_ext1, + OpenAPI_binary_t* binary_data_n2_information_ext2, + OpenAPI_binary_t* binary_data_n2_information_ext3, + OpenAPI_binary_t* binary_data_n2_information_ext4, + OpenAPI_binary_t* binary_data_n2_information_ext5, + OpenAPI_binary_t* binary_data_n2_information_ext6, + OpenAPI_binary_t* binary_data_n2_information_ext7, + OpenAPI_binary_t* binary_data_n2_information_ext8, + OpenAPI_binary_t* binary_data_n2_information_ext9, + OpenAPI_binary_t* binary_data_n2_information_ext10, + OpenAPI_binary_t* binary_data_n2_information_ext11, + OpenAPI_binary_t* binary_data_n2_information_ext12, + OpenAPI_binary_t* binary_data_n2_information_ext13, + OpenAPI_binary_t* binary_data_n2_information_ext14, + OpenAPI_binary_t* binary_data_n2_information_ext15, + OpenAPI_binary_t* binary_data_n2_information_ext16 ); void OpenAPI_n2_info_notify_handover_complete_200_response_free(OpenAPI_n2_info_notify_handover_complete_200_response_t *n2_info_notify_handover_complete_200_response); OpenAPI_n2_info_notify_handover_complete_200_response_t *OpenAPI_n2_info_notify_handover_complete_200_response_parseFromJSON(cJSON *n2_info_notify_handover_complete_200_responseJSON); diff --git a/lib/sbi/openapi/model/n2_info_notify_request.c b/lib/sbi/openapi/model/n2_info_notify_request.c new file mode 100644 index 000000000..c73d48bf5 --- /dev/null +++ b/lib/sbi/openapi/model/n2_info_notify_request.c @@ -0,0 +1,184 @@ + +#include +#include +#include +#include "n2_info_notify_request.h" + +OpenAPI_n2_info_notify_request_t *OpenAPI_n2_info_notify_request_create( + OpenAPI_n2_information_notification_t *json_data, + OpenAPI_binary_t* binary_data_n1_message, + OpenAPI_binary_t* binary_data_n2_information +) +{ + OpenAPI_n2_info_notify_request_t *n2_info_notify_request_local_var = ogs_malloc(sizeof(OpenAPI_n2_info_notify_request_t)); + ogs_assert(n2_info_notify_request_local_var); + + n2_info_notify_request_local_var->json_data = json_data; + n2_info_notify_request_local_var->binary_data_n1_message = binary_data_n1_message; + n2_info_notify_request_local_var->binary_data_n2_information = binary_data_n2_information; + + return n2_info_notify_request_local_var; +} + +void OpenAPI_n2_info_notify_request_free(OpenAPI_n2_info_notify_request_t *n2_info_notify_request) +{ + OpenAPI_lnode_t *node = NULL; + + if (NULL == n2_info_notify_request) { + return; + } + if (n2_info_notify_request->json_data) { + OpenAPI_n2_information_notification_free(n2_info_notify_request->json_data); + n2_info_notify_request->json_data = NULL; + } + if (n2_info_notify_request->binary_data_n1_message) { + ogs_free(n2_info_notify_request->binary_data_n1_message->data); + n2_info_notify_request->binary_data_n1_message = NULL; + } + if (n2_info_notify_request->binary_data_n2_information) { + ogs_free(n2_info_notify_request->binary_data_n2_information->data); + n2_info_notify_request->binary_data_n2_information = NULL; + } + ogs_free(n2_info_notify_request); +} + +cJSON *OpenAPI_n2_info_notify_request_convertToJSON(OpenAPI_n2_info_notify_request_t *n2_info_notify_request) +{ + cJSON *item = NULL; + OpenAPI_lnode_t *node = NULL; + + if (n2_info_notify_request == NULL) { + ogs_error("OpenAPI_n2_info_notify_request_convertToJSON() failed [N2InfoNotify_request]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (n2_info_notify_request->json_data) { + cJSON *json_data_local_JSON = OpenAPI_n2_information_notification_convertToJSON(n2_info_notify_request->json_data); + if (json_data_local_JSON == NULL) { + ogs_error("OpenAPI_n2_info_notify_request_convertToJSON() failed [json_data]"); + goto end; + } + cJSON_AddItemToObject(item, "jsonData", json_data_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_n2_info_notify_request_convertToJSON() failed [json_data]"); + goto end; + } + } + + if (n2_info_notify_request->binary_data_n1_message) { + char* encoded_str_binary_data_n1_message = OpenAPI_base64encode(n2_info_notify_request->binary_data_n1_message->data,n2_info_notify_request->binary_data_n1_message->len); + if (cJSON_AddStringToObject(item, "binaryDataN1Message", encoded_str_binary_data_n1_message) == NULL) { + ogs_error("OpenAPI_n2_info_notify_request_convertToJSON() failed [binary_data_n1_message]"); + goto end; + } + ogs_free(encoded_str_binary_data_n1_message); + } + + if (n2_info_notify_request->binary_data_n2_information) { + char* encoded_str_binary_data_n2_information = OpenAPI_base64encode(n2_info_notify_request->binary_data_n2_information->data,n2_info_notify_request->binary_data_n2_information->len); + if (cJSON_AddStringToObject(item, "binaryDataN2Information", encoded_str_binary_data_n2_information) == NULL) { + ogs_error("OpenAPI_n2_info_notify_request_convertToJSON() failed [binary_data_n2_information]"); + goto end; + } + ogs_free(encoded_str_binary_data_n2_information); + } + +end: + return item; +} + +OpenAPI_n2_info_notify_request_t *OpenAPI_n2_info_notify_request_parseFromJSON(cJSON *n2_info_notify_requestJSON) +{ + OpenAPI_n2_info_notify_request_t *n2_info_notify_request_local_var = NULL; + OpenAPI_lnode_t *node = NULL; + cJSON *json_data = NULL; + OpenAPI_n2_information_notification_t *json_data_local_nonprim = NULL; + cJSON *binary_data_n1_message = NULL; + OpenAPI_binary_t *decoded_str_binary_data_n1_message = NULL; + cJSON *binary_data_n2_information = NULL; + OpenAPI_binary_t *decoded_str_binary_data_n2_information = NULL; + json_data = cJSON_GetObjectItemCaseSensitive(n2_info_notify_requestJSON, "jsonData"); + if (json_data) { + json_data_local_nonprim = OpenAPI_n2_information_notification_parseFromJSON(json_data); + } + + binary_data_n1_message = cJSON_GetObjectItemCaseSensitive(n2_info_notify_requestJSON, "binaryDataN1Message"); + if (binary_data_n1_message) { + decoded_str_binary_data_n1_message = ogs_malloc(sizeof(OpenAPI_binary_t)); + ogs_assert(decoded_str_binary_data_n1_message); + if (!cJSON_IsString(binary_data_n1_message)) { + ogs_error("OpenAPI_n2_info_notify_request_parseFromJSON() failed [binary_data_n1_message]"); + goto end; + } + decoded_str_binary_data_n1_message->data = OpenAPI_base64decode(binary_data_n1_message->valuestring, strlen(binary_data_n1_message->valuestring), &decoded_str_binary_data_n1_message->len); + if (!decoded_str_binary_data_n1_message->data) { + ogs_error("OpenAPI_n2_info_notify_request_parseFromJSON() failed [binary_data_n1_message]"); + goto end; + } + } + + binary_data_n2_information = cJSON_GetObjectItemCaseSensitive(n2_info_notify_requestJSON, "binaryDataN2Information"); + if (binary_data_n2_information) { + decoded_str_binary_data_n2_information = ogs_malloc(sizeof(OpenAPI_binary_t)); + ogs_assert(decoded_str_binary_data_n2_information); + if (!cJSON_IsString(binary_data_n2_information)) { + ogs_error("OpenAPI_n2_info_notify_request_parseFromJSON() failed [binary_data_n2_information]"); + goto end; + } + decoded_str_binary_data_n2_information->data = OpenAPI_base64decode(binary_data_n2_information->valuestring, strlen(binary_data_n2_information->valuestring), &decoded_str_binary_data_n2_information->len); + if (!decoded_str_binary_data_n2_information->data) { + ogs_error("OpenAPI_n2_info_notify_request_parseFromJSON() failed [binary_data_n2_information]"); + goto end; + } + } + + n2_info_notify_request_local_var = OpenAPI_n2_info_notify_request_create ( + json_data ? json_data_local_nonprim : NULL, + binary_data_n1_message ? decoded_str_binary_data_n1_message : NULL, + binary_data_n2_information ? decoded_str_binary_data_n2_information : NULL + ); + + return n2_info_notify_request_local_var; +end: + if (json_data_local_nonprim) { + OpenAPI_n2_information_notification_free(json_data_local_nonprim); + json_data_local_nonprim = NULL; + } + return NULL; +} + +OpenAPI_n2_info_notify_request_t *OpenAPI_n2_info_notify_request_copy(OpenAPI_n2_info_notify_request_t *dst, OpenAPI_n2_info_notify_request_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_n2_info_notify_request_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_n2_info_notify_request_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_n2_info_notify_request_free(dst); + dst = OpenAPI_n2_info_notify_request_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/n2_info_notify_request.h b/lib/sbi/openapi/model/n2_info_notify_request.h new file mode 100644 index 000000000..95a394d4c --- /dev/null +++ b/lib/sbi/openapi/model/n2_info_notify_request.h @@ -0,0 +1,43 @@ +/* + * n2_info_notify_request.h + * + * + */ + +#ifndef _OpenAPI_n2_info_notify_request_H_ +#define _OpenAPI_n2_info_notify_request_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "n2_information_notification.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_n2_info_notify_request_s OpenAPI_n2_info_notify_request_t; +typedef struct OpenAPI_n2_info_notify_request_s { + struct OpenAPI_n2_information_notification_s *json_data; + OpenAPI_binary_t* binary_data_n1_message; + OpenAPI_binary_t* binary_data_n2_information; +} OpenAPI_n2_info_notify_request_t; + +OpenAPI_n2_info_notify_request_t *OpenAPI_n2_info_notify_request_create( + OpenAPI_n2_information_notification_t *json_data, + OpenAPI_binary_t* binary_data_n1_message, + OpenAPI_binary_t* binary_data_n2_information +); +void OpenAPI_n2_info_notify_request_free(OpenAPI_n2_info_notify_request_t *n2_info_notify_request); +OpenAPI_n2_info_notify_request_t *OpenAPI_n2_info_notify_request_parseFromJSON(cJSON *n2_info_notify_requestJSON); +cJSON *OpenAPI_n2_info_notify_request_convertToJSON(OpenAPI_n2_info_notify_request_t *n2_info_notify_request); +OpenAPI_n2_info_notify_request_t *OpenAPI_n2_info_notify_request_copy(OpenAPI_n2_info_notify_request_t *dst, OpenAPI_n2_info_notify_request_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_n2_info_notify_request_H_ */ + diff --git a/lib/sbi/openapi/model/n2_information_class.c b/lib/sbi/openapi/model/n2_information_class.c index bff2df613..e0d3a84e4 100644 --- a/lib/sbi/openapi/model/n2_information_class.c +++ b/lib/sbi/openapi/model/n2_information_class.c @@ -6,7 +6,7 @@ char* OpenAPI_n2_information_class_ToString(OpenAPI_n2_information_class_e n2_information_class) { - const char *n2_information_classArray[] = { "NULL", "SM", "NRPPa", "PWS", "PWS-BCAL", "PWS-RF", "RAN", "V2X" }; + const char *n2_information_classArray[] = { "NULL", "SM", "NRPPa", "PWS", "PWS-BCAL", "PWS-RF", "RAN", "V2X", "PROSE" }; size_t sizeofArray = sizeof(n2_information_classArray) / sizeof(n2_information_classArray[0]); if (n2_information_class < sizeofArray) return (char *)n2_information_classArray[n2_information_class]; @@ -17,7 +17,7 @@ char* OpenAPI_n2_information_class_ToString(OpenAPI_n2_information_class_e n2_in OpenAPI_n2_information_class_e OpenAPI_n2_information_class_FromString(char* n2_information_class) { int stringToReturn = 0; - const char *n2_information_classArray[] = { "NULL", "SM", "NRPPa", "PWS", "PWS-BCAL", "PWS-RF", "RAN", "V2X" }; + const char *n2_information_classArray[] = { "NULL", "SM", "NRPPa", "PWS", "PWS-BCAL", "PWS-RF", "RAN", "V2X", "PROSE" }; size_t sizeofArray = sizeof(n2_information_classArray) / sizeof(n2_information_classArray[0]); while (stringToReturn < sizeofArray) { if (strcmp(n2_information_class, n2_information_classArray[stringToReturn]) == 0) { diff --git a/lib/sbi/openapi/model/n2_information_class.h b/lib/sbi/openapi/model/n2_information_class.h index 933bd1c79..99e41e2ac 100644 --- a/lib/sbi/openapi/model/n2_information_class.h +++ b/lib/sbi/openapi/model/n2_information_class.h @@ -17,7 +17,7 @@ extern "C" { #endif -typedef enum { OpenAPI_n2_information_class_NULL = 0, OpenAPI_n2_information_class_SM, OpenAPI_n2_information_class_NRPPa, OpenAPI_n2_information_class_PWS, OpenAPI_n2_information_class_PWS_BCAL, OpenAPI_n2_information_class_PWS_RF, OpenAPI_n2_information_class_RAN, OpenAPI_n2_information_class_V2X } OpenAPI_n2_information_class_e; +typedef enum { OpenAPI_n2_information_class_NULL = 0, OpenAPI_n2_information_class_SM, OpenAPI_n2_information_class_NRPPa, OpenAPI_n2_information_class_PWS, OpenAPI_n2_information_class_PWS_BCAL, OpenAPI_n2_information_class_PWS_RF, OpenAPI_n2_information_class_RAN, OpenAPI_n2_information_class_V2X, OpenAPI_n2_information_class_PROSE } OpenAPI_n2_information_class_e; char* OpenAPI_n2_information_class_ToString(OpenAPI_n2_information_class_e n2_information_class); diff --git a/lib/sbi/openapi/model/n2_information_notification.h b/lib/sbi/openapi/model/n2_information_notification.h index 39fd7a409..696716b25 100644 --- a/lib/sbi/openapi/model/n2_information_notification.h +++ b/lib/sbi/openapi/model/n2_information_notification.h @@ -1,7 +1,7 @@ /* * n2_information_notification.h * - * + * Data within a N2 information notification request */ #ifndef _OpenAPI_n2_information_notification_H_ diff --git a/lib/sbi/openapi/model/n2_information_transfer_error.h b/lib/sbi/openapi/model/n2_information_transfer_error.h index 5cd80a1a7..6cc38188a 100644 --- a/lib/sbi/openapi/model/n2_information_transfer_error.h +++ b/lib/sbi/openapi/model/n2_information_transfer_error.h @@ -1,7 +1,7 @@ /* * n2_information_transfer_error.h * - * + * Data within a failure response for a non-UE related N2 Information Transfer */ #ifndef _OpenAPI_n2_information_transfer_error_H_ diff --git a/lib/sbi/openapi/model/n2_information_transfer_req_data.h b/lib/sbi/openapi/model/n2_information_transfer_req_data.h index 1ee9365fe..40a854a44 100644 --- a/lib/sbi/openapi/model/n2_information_transfer_req_data.h +++ b/lib/sbi/openapi/model/n2_information_transfer_req_data.h @@ -1,7 +1,7 @@ /* * n2_information_transfer_req_data.h * - * + * Data within a N2 Information Transfer request containing the N2 information requested to be transferred to 5G AN */ #ifndef _OpenAPI_n2_information_transfer_req_data_H_ diff --git a/lib/sbi/openapi/model/n2_information_transfer_rsp_data.h b/lib/sbi/openapi/model/n2_information_transfer_rsp_data.h index c104c5a4f..304511bd5 100644 --- a/lib/sbi/openapi/model/n2_information_transfer_rsp_data.h +++ b/lib/sbi/openapi/model/n2_information_transfer_rsp_data.h @@ -1,7 +1,7 @@ /* * n2_information_transfer_rsp_data.h * - * + * Data within a successful response to the N2 Information Transfer request to transfer N2 Information to the AN */ #ifndef _OpenAPI_n2_information_transfer_rsp_data_H_ diff --git a/lib/sbi/openapi/model/n2_ran_information.h b/lib/sbi/openapi/model/n2_ran_information.h index 46dc44b41..b6333a062 100644 --- a/lib/sbi/openapi/model/n2_ran_information.h +++ b/lib/sbi/openapi/model/n2_ran_information.h @@ -1,7 +1,7 @@ /* * n2_ran_information.h * - * + * Represents the RAN related N2 information data part */ #ifndef _OpenAPI_n2_ran_information_H_ diff --git a/lib/sbi/openapi/model/n2_sm_info_type.c b/lib/sbi/openapi/model/n2_sm_info_type.c index 96d6f42bb..892d9ce8a 100644 --- a/lib/sbi/openapi/model/n2_sm_info_type.c +++ b/lib/sbi/openapi/model/n2_sm_info_type.c @@ -6,7 +6,7 @@ char* OpenAPI_n2_sm_info_type_ToString(OpenAPI_n2_sm_info_type_e n2_sm_info_type) { - const char *n2_sm_info_typeArray[] = { "NULL", "PDU_RES_SETUP_REQ", "PDU_RES_SETUP_RSP", "PDU_RES_SETUP_FAIL", "PDU_RES_REL_CMD", "PDU_RES_REL_RSP", "PDU_RES_MOD_REQ", "PDU_RES_MOD_RSP", "PDU_RES_MOD_FAIL", "PDU_RES_NTY", "PDU_RES_NTY_REL", "PDU_RES_MOD_IND", "PDU_RES_MOD_CFM", "PATH_SWITCH_REQ", "PATH_SWITCH_SETUP_FAIL", "PATH_SWITCH_REQ_ACK", "PATH_SWITCH_REQ_FAIL", "HANDOVER_REQUIRED", "HANDOVER_CMD", "HANDOVER_PREP_FAIL", "HANDOVER_REQ_ACK", "HANDOVER_RES_ALLOC_FAIL", "SECONDARY_RAT_USAGE", "PDU_RES_MOD_IND_FAIL" }; + const char *n2_sm_info_typeArray[] = { "NULL", "PDU_RES_SETUP_REQ", "PDU_RES_SETUP_RSP", "PDU_RES_SETUP_FAIL", "PDU_RES_REL_CMD", "PDU_RES_REL_RSP", "PDU_RES_MOD_REQ", "PDU_RES_MOD_RSP", "PDU_RES_MOD_FAIL", "PDU_RES_NTY", "PDU_RES_NTY_REL", "PDU_RES_MOD_IND", "PDU_RES_MOD_CFM", "PATH_SWITCH_REQ", "PATH_SWITCH_SETUP_FAIL", "PATH_SWITCH_REQ_ACK", "PATH_SWITCH_REQ_FAIL", "HANDOVER_REQUIRED", "HANDOVER_CMD", "HANDOVER_PREP_FAIL", "HANDOVER_REQ_ACK", "HANDOVER_RES_ALLOC_FAIL", "SECONDARY_RAT_USAGE", "PDU_RES_MOD_IND_FAIL", "UE_CONTEXT_RESUME_REQ", "UE_CONTEXT_RESUME_RSP", "UE_CONTEXT_SUSPEND_REQ" }; size_t sizeofArray = sizeof(n2_sm_info_typeArray) / sizeof(n2_sm_info_typeArray[0]); if (n2_sm_info_type < sizeofArray) return (char *)n2_sm_info_typeArray[n2_sm_info_type]; @@ -17,7 +17,7 @@ char* OpenAPI_n2_sm_info_type_ToString(OpenAPI_n2_sm_info_type_e n2_sm_info_type OpenAPI_n2_sm_info_type_e OpenAPI_n2_sm_info_type_FromString(char* n2_sm_info_type) { int stringToReturn = 0; - const char *n2_sm_info_typeArray[] = { "NULL", "PDU_RES_SETUP_REQ", "PDU_RES_SETUP_RSP", "PDU_RES_SETUP_FAIL", "PDU_RES_REL_CMD", "PDU_RES_REL_RSP", "PDU_RES_MOD_REQ", "PDU_RES_MOD_RSP", "PDU_RES_MOD_FAIL", "PDU_RES_NTY", "PDU_RES_NTY_REL", "PDU_RES_MOD_IND", "PDU_RES_MOD_CFM", "PATH_SWITCH_REQ", "PATH_SWITCH_SETUP_FAIL", "PATH_SWITCH_REQ_ACK", "PATH_SWITCH_REQ_FAIL", "HANDOVER_REQUIRED", "HANDOVER_CMD", "HANDOVER_PREP_FAIL", "HANDOVER_REQ_ACK", "HANDOVER_RES_ALLOC_FAIL", "SECONDARY_RAT_USAGE", "PDU_RES_MOD_IND_FAIL" }; + const char *n2_sm_info_typeArray[] = { "NULL", "PDU_RES_SETUP_REQ", "PDU_RES_SETUP_RSP", "PDU_RES_SETUP_FAIL", "PDU_RES_REL_CMD", "PDU_RES_REL_RSP", "PDU_RES_MOD_REQ", "PDU_RES_MOD_RSP", "PDU_RES_MOD_FAIL", "PDU_RES_NTY", "PDU_RES_NTY_REL", "PDU_RES_MOD_IND", "PDU_RES_MOD_CFM", "PATH_SWITCH_REQ", "PATH_SWITCH_SETUP_FAIL", "PATH_SWITCH_REQ_ACK", "PATH_SWITCH_REQ_FAIL", "HANDOVER_REQUIRED", "HANDOVER_CMD", "HANDOVER_PREP_FAIL", "HANDOVER_REQ_ACK", "HANDOVER_RES_ALLOC_FAIL", "SECONDARY_RAT_USAGE", "PDU_RES_MOD_IND_FAIL", "UE_CONTEXT_RESUME_REQ", "UE_CONTEXT_RESUME_RSP", "UE_CONTEXT_SUSPEND_REQ" }; size_t sizeofArray = sizeof(n2_sm_info_typeArray) / sizeof(n2_sm_info_typeArray[0]); while (stringToReturn < sizeofArray) { if (strcmp(n2_sm_info_type, n2_sm_info_typeArray[stringToReturn]) == 0) { diff --git a/lib/sbi/openapi/model/n2_sm_info_type.h b/lib/sbi/openapi/model/n2_sm_info_type.h index 33b25dd5d..96d017f5c 100644 --- a/lib/sbi/openapi/model/n2_sm_info_type.h +++ b/lib/sbi/openapi/model/n2_sm_info_type.h @@ -17,7 +17,7 @@ extern "C" { #endif -typedef enum { OpenAPI_n2_sm_info_type_NULL = 0, OpenAPI_n2_sm_info_type_PDU_RES_SETUP_REQ, OpenAPI_n2_sm_info_type_PDU_RES_SETUP_RSP, OpenAPI_n2_sm_info_type_PDU_RES_SETUP_FAIL, OpenAPI_n2_sm_info_type_PDU_RES_REL_CMD, OpenAPI_n2_sm_info_type_PDU_RES_REL_RSP, OpenAPI_n2_sm_info_type_PDU_RES_MOD_REQ, OpenAPI_n2_sm_info_type_PDU_RES_MOD_RSP, OpenAPI_n2_sm_info_type_PDU_RES_MOD_FAIL, OpenAPI_n2_sm_info_type_PDU_RES_NTY, OpenAPI_n2_sm_info_type_PDU_RES_NTY_REL, OpenAPI_n2_sm_info_type_PDU_RES_MOD_IND, OpenAPI_n2_sm_info_type_PDU_RES_MOD_CFM, OpenAPI_n2_sm_info_type_PATH_SWITCH_REQ, OpenAPI_n2_sm_info_type_PATH_SWITCH_SETUP_FAIL, OpenAPI_n2_sm_info_type_PATH_SWITCH_REQ_ACK, OpenAPI_n2_sm_info_type_PATH_SWITCH_REQ_FAIL, OpenAPI_n2_sm_info_type_HANDOVER_REQUIRED, OpenAPI_n2_sm_info_type_HANDOVER_CMD, OpenAPI_n2_sm_info_type_HANDOVER_PREP_FAIL, OpenAPI_n2_sm_info_type_HANDOVER_REQ_ACK, OpenAPI_n2_sm_info_type_HANDOVER_RES_ALLOC_FAIL, OpenAPI_n2_sm_info_type_SECONDARY_RAT_USAGE, OpenAPI_n2_sm_info_type_PDU_RES_MOD_IND_FAIL } OpenAPI_n2_sm_info_type_e; +typedef enum { OpenAPI_n2_sm_info_type_NULL = 0, OpenAPI_n2_sm_info_type_PDU_RES_SETUP_REQ, OpenAPI_n2_sm_info_type_PDU_RES_SETUP_RSP, OpenAPI_n2_sm_info_type_PDU_RES_SETUP_FAIL, OpenAPI_n2_sm_info_type_PDU_RES_REL_CMD, OpenAPI_n2_sm_info_type_PDU_RES_REL_RSP, OpenAPI_n2_sm_info_type_PDU_RES_MOD_REQ, OpenAPI_n2_sm_info_type_PDU_RES_MOD_RSP, OpenAPI_n2_sm_info_type_PDU_RES_MOD_FAIL, OpenAPI_n2_sm_info_type_PDU_RES_NTY, OpenAPI_n2_sm_info_type_PDU_RES_NTY_REL, OpenAPI_n2_sm_info_type_PDU_RES_MOD_IND, OpenAPI_n2_sm_info_type_PDU_RES_MOD_CFM, OpenAPI_n2_sm_info_type_PATH_SWITCH_REQ, OpenAPI_n2_sm_info_type_PATH_SWITCH_SETUP_FAIL, OpenAPI_n2_sm_info_type_PATH_SWITCH_REQ_ACK, OpenAPI_n2_sm_info_type_PATH_SWITCH_REQ_FAIL, OpenAPI_n2_sm_info_type_HANDOVER_REQUIRED, OpenAPI_n2_sm_info_type_HANDOVER_CMD, OpenAPI_n2_sm_info_type_HANDOVER_PREP_FAIL, OpenAPI_n2_sm_info_type_HANDOVER_REQ_ACK, OpenAPI_n2_sm_info_type_HANDOVER_RES_ALLOC_FAIL, OpenAPI_n2_sm_info_type_SECONDARY_RAT_USAGE, OpenAPI_n2_sm_info_type_PDU_RES_MOD_IND_FAIL, OpenAPI_n2_sm_info_type_UE_CONTEXT_RESUME_REQ, OpenAPI_n2_sm_info_type_UE_CONTEXT_RESUME_RSP, OpenAPI_n2_sm_info_type_UE_CONTEXT_SUSPEND_REQ } OpenAPI_n2_sm_info_type_e; char* OpenAPI_n2_sm_info_type_ToString(OpenAPI_n2_sm_info_type_e n2_sm_info_type); diff --git a/lib/sbi/openapi/model/n2_sm_information.h b/lib/sbi/openapi/model/n2_sm_information.h index abd8d4bbe..d36b5e399 100644 --- a/lib/sbi/openapi/model/n2_sm_information.h +++ b/lib/sbi/openapi/model/n2_sm_information.h @@ -1,7 +1,7 @@ /* * n2_sm_information.h * - * + * Represents the session management SMF related N2 information data part */ #ifndef _OpenAPI_n2_sm_information_H_ diff --git a/lib/sbi/openapi/model/n3ga_location.c b/lib/sbi/openapi/model/n3ga_location.c index ad79fe725..eef20371e 100644 --- a/lib/sbi/openapi/model/n3ga_location.c +++ b/lib/sbi/openapi/model/n3ga_location.c @@ -11,6 +11,7 @@ OpenAPI_n3ga_location_t *OpenAPI_n3ga_location_create( char *ue_ipv6_addr, bool is_port_number, int port_number, + OpenAPI_transport_protocol_e protocol, OpenAPI_tnap_id_t *tnap_id, OpenAPI_twap_id_t *twap_id, OpenAPI_hfc_node_id_t *hfc_node_id, @@ -28,6 +29,7 @@ OpenAPI_n3ga_location_t *OpenAPI_n3ga_location_create( n3ga_location_local_var->ue_ipv6_addr = ue_ipv6_addr; n3ga_location_local_var->is_port_number = is_port_number; n3ga_location_local_var->port_number = port_number; + n3ga_location_local_var->protocol = protocol; n3ga_location_local_var->tnap_id = tnap_id; n3ga_location_local_var->twap_id = twap_id; n3ga_location_local_var->hfc_node_id = hfc_node_id; @@ -136,6 +138,13 @@ cJSON *OpenAPI_n3ga_location_convertToJSON(OpenAPI_n3ga_location_t *n3ga_locatio } } + if (n3ga_location->protocol != OpenAPI_transport_protocol_NULL) { + if (cJSON_AddStringToObject(item, "protocol", OpenAPI_transport_protocol_ToString(n3ga_location->protocol)) == NULL) { + ogs_error("OpenAPI_n3ga_location_convertToJSON() failed [protocol]"); + goto end; + } + } + if (n3ga_location->tnap_id) { cJSON *tnap_id_local_JSON = OpenAPI_tnap_id_convertToJSON(n3ga_location->tnap_id); if (tnap_id_local_JSON == NULL) { @@ -210,6 +219,8 @@ OpenAPI_n3ga_location_t *OpenAPI_n3ga_location_parseFromJSON(cJSON *n3ga_locatio cJSON *ue_ipv4_addr = NULL; cJSON *ue_ipv6_addr = NULL; cJSON *port_number = NULL; + cJSON *protocol = NULL; + OpenAPI_transport_protocol_e protocolVariable = 0; cJSON *tnap_id = NULL; OpenAPI_tnap_id_t *tnap_id_local_nonprim = NULL; cJSON *twap_id = NULL; @@ -257,6 +268,15 @@ OpenAPI_n3ga_location_t *OpenAPI_n3ga_location_parseFromJSON(cJSON *n3ga_locatio } } + protocol = cJSON_GetObjectItemCaseSensitive(n3ga_locationJSON, "protocol"); + if (protocol) { + if (!cJSON_IsString(protocol)) { + ogs_error("OpenAPI_n3ga_location_parseFromJSON() failed [protocol]"); + goto end; + } + protocolVariable = OpenAPI_transport_protocol_FromString(protocol->valuestring); + } + tnap_id = cJSON_GetObjectItemCaseSensitive(n3ga_locationJSON, "tnapId"); if (tnap_id) { tnap_id_local_nonprim = OpenAPI_tnap_id_parseFromJSON(tnap_id); @@ -304,6 +324,7 @@ OpenAPI_n3ga_location_t *OpenAPI_n3ga_location_parseFromJSON(cJSON *n3ga_locatio ue_ipv6_addr && !cJSON_IsNull(ue_ipv6_addr) ? ogs_strdup(ue_ipv6_addr->valuestring) : NULL, port_number ? true : false, port_number ? port_number->valuedouble : 0, + protocol ? protocolVariable : 0, tnap_id ? tnap_id_local_nonprim : NULL, twap_id ? twap_id_local_nonprim : NULL, hfc_node_id ? hfc_node_id_local_nonprim : NULL, diff --git a/lib/sbi/openapi/model/n3ga_location.h b/lib/sbi/openapi/model/n3ga_location.h index 6db048cbb..b9470af5f 100644 --- a/lib/sbi/openapi/model/n3ga_location.h +++ b/lib/sbi/openapi/model/n3ga_location.h @@ -1,7 +1,7 @@ /* * n3ga_location.h * - * + * Contains the Non-3GPP access user location. */ #ifndef _OpenAPI_n3ga_location_H_ @@ -16,6 +16,7 @@ #include "line_type.h" #include "tai.h" #include "tnap_id.h" +#include "transport_protocol.h" #include "twap_id.h" #ifdef __cplusplus @@ -30,6 +31,7 @@ typedef struct OpenAPI_n3ga_location_s { char *ue_ipv6_addr; bool is_port_number; int port_number; + OpenAPI_transport_protocol_e protocol; struct OpenAPI_tnap_id_s *tnap_id; struct OpenAPI_twap_id_s *twap_id; struct OpenAPI_hfc_node_id_s *hfc_node_id; @@ -45,6 +47,7 @@ OpenAPI_n3ga_location_t *OpenAPI_n3ga_location_create( char *ue_ipv6_addr, bool is_port_number, int port_number, + OpenAPI_transport_protocol_e protocol, OpenAPI_tnap_id_t *tnap_id, OpenAPI_twap_id_t *twap_id, OpenAPI_hfc_node_id_t *hfc_node_id, diff --git a/lib/sbi/openapi/model/n4_information.c b/lib/sbi/openapi/model/n4_information.c index 999c3273f..8c6f41c7c 100644 --- a/lib/sbi/openapi/model/n4_information.c +++ b/lib/sbi/openapi/model/n4_information.c @@ -7,7 +7,10 @@ OpenAPI_n4_information_t *OpenAPI_n4_information_create( OpenAPI_n4_message_type_e n4_message_type, OpenAPI_ref_to_binary_data_t *n4_message_payload, - OpenAPI_dnai_information_t *n4_dnai_info + OpenAPI_dnai_information_t *n4_dnai_info, + char *psa_upf_id, + char *ul_cl_bp_id, + OpenAPI_list_t *n9_ul_pdr_id_list ) { OpenAPI_n4_information_t *n4_information_local_var = ogs_malloc(sizeof(OpenAPI_n4_information_t)); @@ -16,6 +19,9 @@ OpenAPI_n4_information_t *OpenAPI_n4_information_create( n4_information_local_var->n4_message_type = n4_message_type; n4_information_local_var->n4_message_payload = n4_message_payload; n4_information_local_var->n4_dnai_info = n4_dnai_info; + n4_information_local_var->psa_upf_id = psa_upf_id; + n4_information_local_var->ul_cl_bp_id = ul_cl_bp_id; + n4_information_local_var->n9_ul_pdr_id_list = n9_ul_pdr_id_list; return n4_information_local_var; } @@ -35,6 +41,21 @@ void OpenAPI_n4_information_free(OpenAPI_n4_information_t *n4_information) OpenAPI_dnai_information_free(n4_information->n4_dnai_info); n4_information->n4_dnai_info = NULL; } + if (n4_information->psa_upf_id) { + ogs_free(n4_information->psa_upf_id); + n4_information->psa_upf_id = NULL; + } + if (n4_information->ul_cl_bp_id) { + ogs_free(n4_information->ul_cl_bp_id); + n4_information->ul_cl_bp_id = NULL; + } + if (n4_information->n9_ul_pdr_id_list) { + OpenAPI_list_for_each(n4_information->n9_ul_pdr_id_list, node) { + ogs_free(node->data); + } + OpenAPI_list_free(n4_information->n9_ul_pdr_id_list); + n4_information->n9_ul_pdr_id_list = NULL; + } ogs_free(n4_information); } @@ -86,6 +107,34 @@ cJSON *OpenAPI_n4_information_convertToJSON(OpenAPI_n4_information_t *n4_informa } } + if (n4_information->psa_upf_id) { + if (cJSON_AddStringToObject(item, "psaUpfId", n4_information->psa_upf_id) == NULL) { + ogs_error("OpenAPI_n4_information_convertToJSON() failed [psa_upf_id]"); + goto end; + } + } + + if (n4_information->ul_cl_bp_id) { + if (cJSON_AddStringToObject(item, "ulClBpId", n4_information->ul_cl_bp_id) == NULL) { + ogs_error("OpenAPI_n4_information_convertToJSON() failed [ul_cl_bp_id]"); + goto end; + } + } + + if (n4_information->n9_ul_pdr_id_list) { + cJSON *n9_ul_pdr_id_listList = cJSON_AddArrayToObject(item, "n9UlPdrIdList"); + if (n9_ul_pdr_id_listList == NULL) { + ogs_error("OpenAPI_n4_information_convertToJSON() failed [n9_ul_pdr_id_list]"); + goto end; + } + OpenAPI_list_for_each(n4_information->n9_ul_pdr_id_list, node) { + if (cJSON_AddNumberToObject(n9_ul_pdr_id_listList, "", (uintptr_t)node->data) == NULL) { + ogs_error("OpenAPI_n4_information_convertToJSON() failed [n9_ul_pdr_id_list]"); + goto end; + } + } + } + end: return item; } @@ -100,6 +149,10 @@ OpenAPI_n4_information_t *OpenAPI_n4_information_parseFromJSON(cJSON *n4_informa OpenAPI_ref_to_binary_data_t *n4_message_payload_local_nonprim = NULL; cJSON *n4_dnai_info = NULL; OpenAPI_dnai_information_t *n4_dnai_info_local_nonprim = NULL; + cJSON *psa_upf_id = NULL; + cJSON *ul_cl_bp_id = NULL; + cJSON *n9_ul_pdr_id_list = NULL; + OpenAPI_list_t *n9_ul_pdr_id_listList = NULL; n4_message_type = cJSON_GetObjectItemCaseSensitive(n4_informationJSON, "n4MessageType"); if (!n4_message_type) { ogs_error("OpenAPI_n4_information_parseFromJSON() failed [n4_message_type]"); @@ -123,10 +176,56 @@ OpenAPI_n4_information_t *OpenAPI_n4_information_parseFromJSON(cJSON *n4_informa n4_dnai_info_local_nonprim = OpenAPI_dnai_information_parseFromJSON(n4_dnai_info); } + psa_upf_id = cJSON_GetObjectItemCaseSensitive(n4_informationJSON, "psaUpfId"); + if (psa_upf_id) { + if (!cJSON_IsString(psa_upf_id) && !cJSON_IsNull(psa_upf_id)) { + ogs_error("OpenAPI_n4_information_parseFromJSON() failed [psa_upf_id]"); + goto end; + } + } + + ul_cl_bp_id = cJSON_GetObjectItemCaseSensitive(n4_informationJSON, "ulClBpId"); + if (ul_cl_bp_id) { + if (!cJSON_IsString(ul_cl_bp_id) && !cJSON_IsNull(ul_cl_bp_id)) { + ogs_error("OpenAPI_n4_information_parseFromJSON() failed [ul_cl_bp_id]"); + goto end; + } + } + + n9_ul_pdr_id_list = cJSON_GetObjectItemCaseSensitive(n4_informationJSON, "n9UlPdrIdList"); + if (n9_ul_pdr_id_list) { + cJSON *n9_ul_pdr_id_list_local = NULL; + if (!cJSON_IsArray(n9_ul_pdr_id_list)) { + ogs_error("OpenAPI_n4_information_parseFromJSON() failed [n9_ul_pdr_id_list]"); + goto end; + } + + n9_ul_pdr_id_listList = OpenAPI_list_create(); + + cJSON_ArrayForEach(n9_ul_pdr_id_list_local, n9_ul_pdr_id_list) { + double *localDouble = NULL; + int *localInt = NULL; + if (!cJSON_IsNumber(n9_ul_pdr_id_list_local)) { + ogs_error("OpenAPI_n4_information_parseFromJSON() failed [n9_ul_pdr_id_list]"); + goto end; + } + localDouble = (double *)ogs_calloc(1, sizeof(double)); + if (!localDouble) { + ogs_error("OpenAPI_n4_information_parseFromJSON() failed [n9_ul_pdr_id_list]"); + goto end; + } + *localDouble = n9_ul_pdr_id_list_local->valuedouble; + OpenAPI_list_add(n9_ul_pdr_id_listList, localDouble); + } + } + n4_information_local_var = OpenAPI_n4_information_create ( n4_message_typeVariable, n4_message_payload_local_nonprim, - n4_dnai_info ? n4_dnai_info_local_nonprim : NULL + n4_dnai_info ? n4_dnai_info_local_nonprim : NULL, + psa_upf_id && !cJSON_IsNull(psa_upf_id) ? ogs_strdup(psa_upf_id->valuestring) : NULL, + ul_cl_bp_id && !cJSON_IsNull(ul_cl_bp_id) ? ogs_strdup(ul_cl_bp_id->valuestring) : NULL, + n9_ul_pdr_id_list ? n9_ul_pdr_id_listList : NULL ); return n4_information_local_var; @@ -139,6 +238,13 @@ end: OpenAPI_dnai_information_free(n4_dnai_info_local_nonprim); n4_dnai_info_local_nonprim = NULL; } + if (n9_ul_pdr_id_listList) { + OpenAPI_list_for_each(n9_ul_pdr_id_listList, node) { + ogs_free(node->data); + } + OpenAPI_list_free(n9_ul_pdr_id_listList); + n9_ul_pdr_id_listList = NULL; + } return NULL; } diff --git a/lib/sbi/openapi/model/n4_information.h b/lib/sbi/openapi/model/n4_information.h index c297bce8b..7a2b5d7c8 100644 --- a/lib/sbi/openapi/model/n4_information.h +++ b/lib/sbi/openapi/model/n4_information.h @@ -1,7 +1,7 @@ /* * n4_information.h * - * + * N4 Information */ #ifndef _OpenAPI_n4_information_H_ @@ -25,12 +25,18 @@ typedef struct OpenAPI_n4_information_s { OpenAPI_n4_message_type_e n4_message_type; struct OpenAPI_ref_to_binary_data_s *n4_message_payload; struct OpenAPI_dnai_information_s *n4_dnai_info; + char *psa_upf_id; + char *ul_cl_bp_id; + OpenAPI_list_t *n9_ul_pdr_id_list; } OpenAPI_n4_information_t; OpenAPI_n4_information_t *OpenAPI_n4_information_create( OpenAPI_n4_message_type_e n4_message_type, OpenAPI_ref_to_binary_data_t *n4_message_payload, - OpenAPI_dnai_information_t *n4_dnai_info + OpenAPI_dnai_information_t *n4_dnai_info, + char *psa_upf_id, + char *ul_cl_bp_id, + OpenAPI_list_t *n9_ul_pdr_id_list ); void OpenAPI_n4_information_free(OpenAPI_n4_information_t *n4_information); OpenAPI_n4_information_t *OpenAPI_n4_information_parseFromJSON(cJSON *n4_informationJSON); diff --git a/lib/sbi/openapi/model/namf_subscription_data.c b/lib/sbi/openapi/model/namf_subscription_data.c new file mode 100644 index 000000000..91599f0d4 --- /dev/null +++ b/lib/sbi/openapi/model/namf_subscription_data.c @@ -0,0 +1,174 @@ + +#include +#include +#include +#include "namf_subscription_data.h" + +OpenAPI_namf_subscription_data_t *OpenAPI_namf_subscription_data_create( + char *amf_status_uri, + OpenAPI_list_t *guami_list +) +{ + OpenAPI_namf_subscription_data_t *namf_subscription_data_local_var = ogs_malloc(sizeof(OpenAPI_namf_subscription_data_t)); + ogs_assert(namf_subscription_data_local_var); + + namf_subscription_data_local_var->amf_status_uri = amf_status_uri; + namf_subscription_data_local_var->guami_list = guami_list; + + return namf_subscription_data_local_var; +} + +void OpenAPI_namf_subscription_data_free(OpenAPI_namf_subscription_data_t *namf_subscription_data) +{ + OpenAPI_lnode_t *node = NULL; + + if (NULL == namf_subscription_data) { + return; + } + if (namf_subscription_data->amf_status_uri) { + ogs_free(namf_subscription_data->amf_status_uri); + namf_subscription_data->amf_status_uri = NULL; + } + if (namf_subscription_data->guami_list) { + OpenAPI_list_for_each(namf_subscription_data->guami_list, node) { + OpenAPI_guami_free(node->data); + } + OpenAPI_list_free(namf_subscription_data->guami_list); + namf_subscription_data->guami_list = NULL; + } + ogs_free(namf_subscription_data); +} + +cJSON *OpenAPI_namf_subscription_data_convertToJSON(OpenAPI_namf_subscription_data_t *namf_subscription_data) +{ + cJSON *item = NULL; + OpenAPI_lnode_t *node = NULL; + + if (namf_subscription_data == NULL) { + ogs_error("OpenAPI_namf_subscription_data_convertToJSON() failed [NamfSubscriptionData]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (!namf_subscription_data->amf_status_uri) { + ogs_error("OpenAPI_namf_subscription_data_convertToJSON() failed [amf_status_uri]"); + return NULL; + } + if (cJSON_AddStringToObject(item, "amfStatusUri", namf_subscription_data->amf_status_uri) == NULL) { + ogs_error("OpenAPI_namf_subscription_data_convertToJSON() failed [amf_status_uri]"); + goto end; + } + + if (namf_subscription_data->guami_list) { + cJSON *guami_listList = cJSON_AddArrayToObject(item, "guamiList"); + if (guami_listList == NULL) { + ogs_error("OpenAPI_namf_subscription_data_convertToJSON() failed [guami_list]"); + goto end; + } + OpenAPI_list_for_each(namf_subscription_data->guami_list, node) { + cJSON *itemLocal = OpenAPI_guami_convertToJSON(node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_namf_subscription_data_convertToJSON() failed [guami_list]"); + goto end; + } + cJSON_AddItemToArray(guami_listList, itemLocal); + } + } + +end: + return item; +} + +OpenAPI_namf_subscription_data_t *OpenAPI_namf_subscription_data_parseFromJSON(cJSON *namf_subscription_dataJSON) +{ + OpenAPI_namf_subscription_data_t *namf_subscription_data_local_var = NULL; + OpenAPI_lnode_t *node = NULL; + cJSON *amf_status_uri = NULL; + cJSON *guami_list = NULL; + OpenAPI_list_t *guami_listList = NULL; + amf_status_uri = cJSON_GetObjectItemCaseSensitive(namf_subscription_dataJSON, "amfStatusUri"); + if (!amf_status_uri) { + ogs_error("OpenAPI_namf_subscription_data_parseFromJSON() failed [amf_status_uri]"); + goto end; + } + if (!cJSON_IsString(amf_status_uri)) { + ogs_error("OpenAPI_namf_subscription_data_parseFromJSON() failed [amf_status_uri]"); + goto end; + } + + guami_list = cJSON_GetObjectItemCaseSensitive(namf_subscription_dataJSON, "guamiList"); + if (guami_list) { + cJSON *guami_list_local = NULL; + if (!cJSON_IsArray(guami_list)) { + ogs_error("OpenAPI_namf_subscription_data_parseFromJSON() failed [guami_list]"); + goto end; + } + + guami_listList = OpenAPI_list_create(); + + cJSON_ArrayForEach(guami_list_local, guami_list) { + if (!cJSON_IsObject(guami_list_local)) { + ogs_error("OpenAPI_namf_subscription_data_parseFromJSON() failed [guami_list]"); + goto end; + } + OpenAPI_guami_t *guami_listItem = OpenAPI_guami_parseFromJSON(guami_list_local); + if (!guami_listItem) { + ogs_error("No guami_listItem"); + OpenAPI_list_free(guami_listList); + goto end; + } + OpenAPI_list_add(guami_listList, guami_listItem); + } + } + + namf_subscription_data_local_var = OpenAPI_namf_subscription_data_create ( + ogs_strdup(amf_status_uri->valuestring), + guami_list ? guami_listList : NULL + ); + + return namf_subscription_data_local_var; +end: + if (guami_listList) { + OpenAPI_list_for_each(guami_listList, node) { + OpenAPI_guami_free(node->data); + } + OpenAPI_list_free(guami_listList); + guami_listList = NULL; + } + return NULL; +} + +OpenAPI_namf_subscription_data_t *OpenAPI_namf_subscription_data_copy(OpenAPI_namf_subscription_data_t *dst, OpenAPI_namf_subscription_data_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_namf_subscription_data_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_namf_subscription_data_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_namf_subscription_data_free(dst); + dst = OpenAPI_namf_subscription_data_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/namf_subscription_data.h b/lib/sbi/openapi/model/namf_subscription_data.h new file mode 100644 index 000000000..e4cddf86f --- /dev/null +++ b/lib/sbi/openapi/model/namf_subscription_data.h @@ -0,0 +1,41 @@ +/* + * namf_subscription_data.h + * + * Data within an AMF Status Change Subscription request and response + */ + +#ifndef _OpenAPI_namf_subscription_data_H_ +#define _OpenAPI_namf_subscription_data_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "guami.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_namf_subscription_data_s OpenAPI_namf_subscription_data_t; +typedef struct OpenAPI_namf_subscription_data_s { + char *amf_status_uri; + OpenAPI_list_t *guami_list; +} OpenAPI_namf_subscription_data_t; + +OpenAPI_namf_subscription_data_t *OpenAPI_namf_subscription_data_create( + char *amf_status_uri, + OpenAPI_list_t *guami_list +); +void OpenAPI_namf_subscription_data_free(OpenAPI_namf_subscription_data_t *namf_subscription_data); +OpenAPI_namf_subscription_data_t *OpenAPI_namf_subscription_data_parseFromJSON(cJSON *namf_subscription_dataJSON); +cJSON *OpenAPI_namf_subscription_data_convertToJSON(OpenAPI_namf_subscription_data_t *namf_subscription_data); +OpenAPI_namf_subscription_data_t *OpenAPI_namf_subscription_data_copy(OpenAPI_namf_subscription_data_t *dst, OpenAPI_namf_subscription_data_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_namf_subscription_data_H_ */ + diff --git a/lib/sbi/openapi/model/nas_security_mode.h b/lib/sbi/openapi/model/nas_security_mode.h index 44b608e3f..ae91285f8 100644 --- a/lib/sbi/openapi/model/nas_security_mode.h +++ b/lib/sbi/openapi/model/nas_security_mode.h @@ -1,7 +1,7 @@ /* * nas_security_mode.h * - * + * Indicates the NAS Security Mode */ #ifndef _OpenAPI_nas_security_mode_H_ diff --git a/lib/sbi/openapi/model/ncgi.h b/lib/sbi/openapi/model/ncgi.h index 0bd6d477a..e30761920 100644 --- a/lib/sbi/openapi/model/ncgi.h +++ b/lib/sbi/openapi/model/ncgi.h @@ -1,7 +1,7 @@ /* * ncgi.h * - * + * Contains the NCGI (NR Cell Global Identity), as described in 3GPP 23.003 */ #ifndef _OpenAPI_ncgi_H_ diff --git a/lib/sbi/openapi/model/ncgi_1.h b/lib/sbi/openapi/model/ncgi_1.h index 225a172ba..d80218b2d 100644 --- a/lib/sbi/openapi/model/ncgi_1.h +++ b/lib/sbi/openapi/model/ncgi_1.h @@ -1,7 +1,7 @@ /* * ncgi_1.h * - * + * Contains the NCGI (NR Cell Global Identity), as described in 3GPP 23.003 */ #ifndef _OpenAPI_ncgi_1_H_ diff --git a/lib/sbi/openapi/model/ncgi_tai.c b/lib/sbi/openapi/model/ncgi_tai.c new file mode 100644 index 000000000..706654b9a --- /dev/null +++ b/lib/sbi/openapi/model/ncgi_tai.c @@ -0,0 +1,186 @@ + +#include +#include +#include +#include "ncgi_tai.h" + +OpenAPI_ncgi_tai_t *OpenAPI_ncgi_tai_create( + OpenAPI_tai_t *tai, + OpenAPI_list_t *cell_list +) +{ + OpenAPI_ncgi_tai_t *ncgi_tai_local_var = ogs_malloc(sizeof(OpenAPI_ncgi_tai_t)); + ogs_assert(ncgi_tai_local_var); + + ncgi_tai_local_var->tai = tai; + ncgi_tai_local_var->cell_list = cell_list; + + return ncgi_tai_local_var; +} + +void OpenAPI_ncgi_tai_free(OpenAPI_ncgi_tai_t *ncgi_tai) +{ + OpenAPI_lnode_t *node = NULL; + + if (NULL == ncgi_tai) { + return; + } + if (ncgi_tai->tai) { + OpenAPI_tai_free(ncgi_tai->tai); + ncgi_tai->tai = NULL; + } + if (ncgi_tai->cell_list) { + OpenAPI_list_for_each(ncgi_tai->cell_list, node) { + OpenAPI_ncgi_free(node->data); + } + OpenAPI_list_free(ncgi_tai->cell_list); + ncgi_tai->cell_list = NULL; + } + ogs_free(ncgi_tai); +} + +cJSON *OpenAPI_ncgi_tai_convertToJSON(OpenAPI_ncgi_tai_t *ncgi_tai) +{ + cJSON *item = NULL; + OpenAPI_lnode_t *node = NULL; + + if (ncgi_tai == NULL) { + ogs_error("OpenAPI_ncgi_tai_convertToJSON() failed [NcgiTai]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (!ncgi_tai->tai) { + ogs_error("OpenAPI_ncgi_tai_convertToJSON() failed [tai]"); + return NULL; + } + cJSON *tai_local_JSON = OpenAPI_tai_convertToJSON(ncgi_tai->tai); + if (tai_local_JSON == NULL) { + ogs_error("OpenAPI_ncgi_tai_convertToJSON() failed [tai]"); + goto end; + } + cJSON_AddItemToObject(item, "tai", tai_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_ncgi_tai_convertToJSON() failed [tai]"); + goto end; + } + + if (!ncgi_tai->cell_list) { + ogs_error("OpenAPI_ncgi_tai_convertToJSON() failed [cell_list]"); + return NULL; + } + cJSON *cell_listList = cJSON_AddArrayToObject(item, "cellList"); + if (cell_listList == NULL) { + ogs_error("OpenAPI_ncgi_tai_convertToJSON() failed [cell_list]"); + goto end; + } + OpenAPI_list_for_each(ncgi_tai->cell_list, node) { + cJSON *itemLocal = OpenAPI_ncgi_convertToJSON(node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_ncgi_tai_convertToJSON() failed [cell_list]"); + goto end; + } + cJSON_AddItemToArray(cell_listList, itemLocal); + } + +end: + return item; +} + +OpenAPI_ncgi_tai_t *OpenAPI_ncgi_tai_parseFromJSON(cJSON *ncgi_taiJSON) +{ + OpenAPI_ncgi_tai_t *ncgi_tai_local_var = NULL; + OpenAPI_lnode_t *node = NULL; + cJSON *tai = NULL; + OpenAPI_tai_t *tai_local_nonprim = NULL; + cJSON *cell_list = NULL; + OpenAPI_list_t *cell_listList = NULL; + tai = cJSON_GetObjectItemCaseSensitive(ncgi_taiJSON, "tai"); + if (!tai) { + ogs_error("OpenAPI_ncgi_tai_parseFromJSON() failed [tai]"); + goto end; + } + tai_local_nonprim = OpenAPI_tai_parseFromJSON(tai); + + cell_list = cJSON_GetObjectItemCaseSensitive(ncgi_taiJSON, "cellList"); + if (!cell_list) { + ogs_error("OpenAPI_ncgi_tai_parseFromJSON() failed [cell_list]"); + goto end; + } + cJSON *cell_list_local = NULL; + if (!cJSON_IsArray(cell_list)) { + ogs_error("OpenAPI_ncgi_tai_parseFromJSON() failed [cell_list]"); + goto end; + } + + cell_listList = OpenAPI_list_create(); + + cJSON_ArrayForEach(cell_list_local, cell_list) { + if (!cJSON_IsObject(cell_list_local)) { + ogs_error("OpenAPI_ncgi_tai_parseFromJSON() failed [cell_list]"); + goto end; + } + OpenAPI_ncgi_t *cell_listItem = OpenAPI_ncgi_parseFromJSON(cell_list_local); + if (!cell_listItem) { + ogs_error("No cell_listItem"); + OpenAPI_list_free(cell_listList); + goto end; + } + OpenAPI_list_add(cell_listList, cell_listItem); + } + + ncgi_tai_local_var = OpenAPI_ncgi_tai_create ( + tai_local_nonprim, + cell_listList + ); + + return ncgi_tai_local_var; +end: + if (tai_local_nonprim) { + OpenAPI_tai_free(tai_local_nonprim); + tai_local_nonprim = NULL; + } + if (cell_listList) { + OpenAPI_list_for_each(cell_listList, node) { + OpenAPI_ncgi_free(node->data); + } + OpenAPI_list_free(cell_listList); + cell_listList = NULL; + } + return NULL; +} + +OpenAPI_ncgi_tai_t *OpenAPI_ncgi_tai_copy(OpenAPI_ncgi_tai_t *dst, OpenAPI_ncgi_tai_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_ncgi_tai_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_ncgi_tai_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_ncgi_tai_free(dst); + dst = OpenAPI_ncgi_tai_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/ncgi_tai.h b/lib/sbi/openapi/model/ncgi_tai.h new file mode 100644 index 000000000..5d97a3f63 --- /dev/null +++ b/lib/sbi/openapi/model/ncgi_tai.h @@ -0,0 +1,42 @@ +/* + * ncgi_tai.h + * + * List of NR cell ids, with their pertaining TAIs + */ + +#ifndef _OpenAPI_ncgi_tai_H_ +#define _OpenAPI_ncgi_tai_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "ncgi.h" +#include "tai.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_ncgi_tai_s OpenAPI_ncgi_tai_t; +typedef struct OpenAPI_ncgi_tai_s { + struct OpenAPI_tai_s *tai; + OpenAPI_list_t *cell_list; +} OpenAPI_ncgi_tai_t; + +OpenAPI_ncgi_tai_t *OpenAPI_ncgi_tai_create( + OpenAPI_tai_t *tai, + OpenAPI_list_t *cell_list +); +void OpenAPI_ncgi_tai_free(OpenAPI_ncgi_tai_t *ncgi_tai); +OpenAPI_ncgi_tai_t *OpenAPI_ncgi_tai_parseFromJSON(cJSON *ncgi_taiJSON); +cJSON *OpenAPI_ncgi_tai_convertToJSON(OpenAPI_ncgi_tai_t *ncgi_tai); +OpenAPI_ncgi_tai_t *OpenAPI_ncgi_tai_copy(OpenAPI_ncgi_tai_t *dst, OpenAPI_ncgi_tai_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_ncgi_tai_H_ */ + diff --git a/lib/sbi/openapi/model/nef_cond.h b/lib/sbi/openapi/model/nef_cond.h index b45338069..ab223067d 100644 --- a/lib/sbi/openapi/model/nef_cond.h +++ b/lib/sbi/openapi/model/nef_cond.h @@ -1,7 +1,7 @@ /* * nef_cond.h * - * Subscription to a set of NF Instances (NEFs), identified by Event ID(s) provided by AF, S-NSSAI(s), AF Instance ID, Application Identifier, External Identifier, External Group Identifier, or domain name. + * Subscription to a set of NF Instances (NEFs), identified by Event ID(s) provided by AF, S-NSSAI(s), AF Instance ID, Application Identifier, External Identifier, External Group Identifier, or domain name. */ #ifndef _OpenAPI_nef_cond_H_ diff --git a/lib/sbi/openapi/model/nef_info.c b/lib/sbi/openapi/model/nef_info.c index 1a1297890..66ef3df88 100644 --- a/lib/sbi/openapi/model/nef_info.c +++ b/lib/sbi/openapi/model/nef_info.c @@ -10,7 +10,13 @@ OpenAPI_nef_info_t *OpenAPI_nef_info_create( OpenAPI_af_event_exposure_data_t *af_ee_data, OpenAPI_list_t *gpsi_ranges, OpenAPI_list_t *external_group_identifiers_ranges, - OpenAPI_list_t *served_fqdn_list + OpenAPI_list_t *served_fqdn_list, + OpenAPI_list_t *tai_list, + OpenAPI_list_t *tai_range_list, + OpenAPI_list_t *dnai_list, + OpenAPI_list_t *un_trust_af_info_list, + bool is_uas_nf_functionality_ind, + int uas_nf_functionality_ind ) { OpenAPI_nef_info_t *nef_info_local_var = ogs_malloc(sizeof(OpenAPI_nef_info_t)); @@ -22,6 +28,12 @@ OpenAPI_nef_info_t *OpenAPI_nef_info_create( nef_info_local_var->gpsi_ranges = gpsi_ranges; nef_info_local_var->external_group_identifiers_ranges = external_group_identifiers_ranges; nef_info_local_var->served_fqdn_list = served_fqdn_list; + nef_info_local_var->tai_list = tai_list; + nef_info_local_var->tai_range_list = tai_range_list; + nef_info_local_var->dnai_list = dnai_list; + nef_info_local_var->un_trust_af_info_list = un_trust_af_info_list; + nef_info_local_var->is_uas_nf_functionality_ind = is_uas_nf_functionality_ind; + nef_info_local_var->uas_nf_functionality_ind = uas_nf_functionality_ind; return nef_info_local_var; } @@ -66,6 +78,34 @@ void OpenAPI_nef_info_free(OpenAPI_nef_info_t *nef_info) OpenAPI_list_free(nef_info->served_fqdn_list); nef_info->served_fqdn_list = NULL; } + if (nef_info->tai_list) { + OpenAPI_list_for_each(nef_info->tai_list, node) { + OpenAPI_tai_free(node->data); + } + OpenAPI_list_free(nef_info->tai_list); + nef_info->tai_list = NULL; + } + if (nef_info->tai_range_list) { + OpenAPI_list_for_each(nef_info->tai_range_list, node) { + OpenAPI_tai_range_free(node->data); + } + OpenAPI_list_free(nef_info->tai_range_list); + nef_info->tai_range_list = NULL; + } + if (nef_info->dnai_list) { + OpenAPI_list_for_each(nef_info->dnai_list, node) { + ogs_free(node->data); + } + OpenAPI_list_free(nef_info->dnai_list); + nef_info->dnai_list = NULL; + } + if (nef_info->un_trust_af_info_list) { + OpenAPI_list_for_each(nef_info->un_trust_af_info_list, node) { + OpenAPI_un_trust_af_info_free(node->data); + } + OpenAPI_list_free(nef_info->un_trust_af_info_list); + nef_info->un_trust_af_info_list = NULL; + } ogs_free(nef_info); } @@ -159,6 +199,75 @@ cJSON *OpenAPI_nef_info_convertToJSON(OpenAPI_nef_info_t *nef_info) } } + if (nef_info->tai_list) { + cJSON *tai_listList = cJSON_AddArrayToObject(item, "taiList"); + if (tai_listList == NULL) { + ogs_error("OpenAPI_nef_info_convertToJSON() failed [tai_list]"); + goto end; + } + OpenAPI_list_for_each(nef_info->tai_list, node) { + cJSON *itemLocal = OpenAPI_tai_convertToJSON(node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_nef_info_convertToJSON() failed [tai_list]"); + goto end; + } + cJSON_AddItemToArray(tai_listList, itemLocal); + } + } + + if (nef_info->tai_range_list) { + cJSON *tai_range_listList = cJSON_AddArrayToObject(item, "taiRangeList"); + if (tai_range_listList == NULL) { + ogs_error("OpenAPI_nef_info_convertToJSON() failed [tai_range_list]"); + goto end; + } + OpenAPI_list_for_each(nef_info->tai_range_list, node) { + cJSON *itemLocal = OpenAPI_tai_range_convertToJSON(node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_nef_info_convertToJSON() failed [tai_range_list]"); + goto end; + } + cJSON_AddItemToArray(tai_range_listList, itemLocal); + } + } + + if (nef_info->dnai_list) { + cJSON *dnai_listList = cJSON_AddArrayToObject(item, "dnaiList"); + if (dnai_listList == NULL) { + ogs_error("OpenAPI_nef_info_convertToJSON() failed [dnai_list]"); + goto end; + } + OpenAPI_list_for_each(nef_info->dnai_list, node) { + if (cJSON_AddStringToObject(dnai_listList, "", (char*)node->data) == NULL) { + ogs_error("OpenAPI_nef_info_convertToJSON() failed [dnai_list]"); + goto end; + } + } + } + + if (nef_info->un_trust_af_info_list) { + cJSON *un_trust_af_info_listList = cJSON_AddArrayToObject(item, "unTrustAfInfoList"); + if (un_trust_af_info_listList == NULL) { + ogs_error("OpenAPI_nef_info_convertToJSON() failed [un_trust_af_info_list]"); + goto end; + } + OpenAPI_list_for_each(nef_info->un_trust_af_info_list, node) { + cJSON *itemLocal = OpenAPI_un_trust_af_info_convertToJSON(node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_nef_info_convertToJSON() failed [un_trust_af_info_list]"); + goto end; + } + cJSON_AddItemToArray(un_trust_af_info_listList, itemLocal); + } + } + + if (nef_info->is_uas_nf_functionality_ind) { + if (cJSON_AddBoolToObject(item, "uasNfFunctionalityInd", nef_info->uas_nf_functionality_ind) == NULL) { + ogs_error("OpenAPI_nef_info_convertToJSON() failed [uas_nf_functionality_ind]"); + goto end; + } + } + end: return item; } @@ -178,6 +287,15 @@ OpenAPI_nef_info_t *OpenAPI_nef_info_parseFromJSON(cJSON *nef_infoJSON) OpenAPI_list_t *external_group_identifiers_rangesList = NULL; cJSON *served_fqdn_list = NULL; OpenAPI_list_t *served_fqdn_listList = NULL; + cJSON *tai_list = NULL; + OpenAPI_list_t *tai_listList = NULL; + cJSON *tai_range_list = NULL; + OpenAPI_list_t *tai_range_listList = NULL; + cJSON *dnai_list = NULL; + OpenAPI_list_t *dnai_listList = NULL; + cJSON *un_trust_af_info_list = NULL; + OpenAPI_list_t *un_trust_af_info_listList = NULL; + cJSON *uas_nf_functionality_ind = NULL; nef_id = cJSON_GetObjectItemCaseSensitive(nef_infoJSON, "nefId"); if (nef_id) { if (!cJSON_IsString(nef_id) && !cJSON_IsNull(nef_id)) { @@ -267,13 +385,123 @@ OpenAPI_nef_info_t *OpenAPI_nef_info_parseFromJSON(cJSON *nef_infoJSON) } } + tai_list = cJSON_GetObjectItemCaseSensitive(nef_infoJSON, "taiList"); + if (tai_list) { + cJSON *tai_list_local = NULL; + if (!cJSON_IsArray(tai_list)) { + ogs_error("OpenAPI_nef_info_parseFromJSON() failed [tai_list]"); + goto end; + } + + tai_listList = OpenAPI_list_create(); + + cJSON_ArrayForEach(tai_list_local, tai_list) { + if (!cJSON_IsObject(tai_list_local)) { + ogs_error("OpenAPI_nef_info_parseFromJSON() failed [tai_list]"); + goto end; + } + OpenAPI_tai_t *tai_listItem = OpenAPI_tai_parseFromJSON(tai_list_local); + if (!tai_listItem) { + ogs_error("No tai_listItem"); + OpenAPI_list_free(tai_listList); + goto end; + } + OpenAPI_list_add(tai_listList, tai_listItem); + } + } + + tai_range_list = cJSON_GetObjectItemCaseSensitive(nef_infoJSON, "taiRangeList"); + if (tai_range_list) { + cJSON *tai_range_list_local = NULL; + if (!cJSON_IsArray(tai_range_list)) { + ogs_error("OpenAPI_nef_info_parseFromJSON() failed [tai_range_list]"); + goto end; + } + + tai_range_listList = OpenAPI_list_create(); + + cJSON_ArrayForEach(tai_range_list_local, tai_range_list) { + if (!cJSON_IsObject(tai_range_list_local)) { + ogs_error("OpenAPI_nef_info_parseFromJSON() failed [tai_range_list]"); + goto end; + } + OpenAPI_tai_range_t *tai_range_listItem = OpenAPI_tai_range_parseFromJSON(tai_range_list_local); + if (!tai_range_listItem) { + ogs_error("No tai_range_listItem"); + OpenAPI_list_free(tai_range_listList); + goto end; + } + OpenAPI_list_add(tai_range_listList, tai_range_listItem); + } + } + + dnai_list = cJSON_GetObjectItemCaseSensitive(nef_infoJSON, "dnaiList"); + if (dnai_list) { + cJSON *dnai_list_local = NULL; + if (!cJSON_IsArray(dnai_list)) { + ogs_error("OpenAPI_nef_info_parseFromJSON() failed [dnai_list]"); + goto end; + } + + dnai_listList = OpenAPI_list_create(); + + cJSON_ArrayForEach(dnai_list_local, dnai_list) { + double *localDouble = NULL; + int *localInt = NULL; + if (!cJSON_IsString(dnai_list_local)) { + ogs_error("OpenAPI_nef_info_parseFromJSON() failed [dnai_list]"); + goto end; + } + OpenAPI_list_add(dnai_listList, ogs_strdup(dnai_list_local->valuestring)); + } + } + + un_trust_af_info_list = cJSON_GetObjectItemCaseSensitive(nef_infoJSON, "unTrustAfInfoList"); + if (un_trust_af_info_list) { + cJSON *un_trust_af_info_list_local = NULL; + if (!cJSON_IsArray(un_trust_af_info_list)) { + ogs_error("OpenAPI_nef_info_parseFromJSON() failed [un_trust_af_info_list]"); + goto end; + } + + un_trust_af_info_listList = OpenAPI_list_create(); + + cJSON_ArrayForEach(un_trust_af_info_list_local, un_trust_af_info_list) { + if (!cJSON_IsObject(un_trust_af_info_list_local)) { + ogs_error("OpenAPI_nef_info_parseFromJSON() failed [un_trust_af_info_list]"); + goto end; + } + OpenAPI_un_trust_af_info_t *un_trust_af_info_listItem = OpenAPI_un_trust_af_info_parseFromJSON(un_trust_af_info_list_local); + if (!un_trust_af_info_listItem) { + ogs_error("No un_trust_af_info_listItem"); + OpenAPI_list_free(un_trust_af_info_listList); + goto end; + } + OpenAPI_list_add(un_trust_af_info_listList, un_trust_af_info_listItem); + } + } + + uas_nf_functionality_ind = cJSON_GetObjectItemCaseSensitive(nef_infoJSON, "uasNfFunctionalityInd"); + if (uas_nf_functionality_ind) { + if (!cJSON_IsBool(uas_nf_functionality_ind)) { + ogs_error("OpenAPI_nef_info_parseFromJSON() failed [uas_nf_functionality_ind]"); + goto end; + } + } + nef_info_local_var = OpenAPI_nef_info_create ( nef_id && !cJSON_IsNull(nef_id) ? ogs_strdup(nef_id->valuestring) : NULL, pfd_data ? pfd_data_local_nonprim : NULL, af_ee_data ? af_ee_data_local_nonprim : NULL, gpsi_ranges ? gpsi_rangesList : NULL, external_group_identifiers_ranges ? external_group_identifiers_rangesList : NULL, - served_fqdn_list ? served_fqdn_listList : NULL + served_fqdn_list ? served_fqdn_listList : NULL, + tai_list ? tai_listList : NULL, + tai_range_list ? tai_range_listList : NULL, + dnai_list ? dnai_listList : NULL, + un_trust_af_info_list ? un_trust_af_info_listList : NULL, + uas_nf_functionality_ind ? true : false, + uas_nf_functionality_ind ? uas_nf_functionality_ind->valueint : 0 ); return nef_info_local_var; @@ -307,6 +535,34 @@ end: OpenAPI_list_free(served_fqdn_listList); served_fqdn_listList = NULL; } + if (tai_listList) { + OpenAPI_list_for_each(tai_listList, node) { + OpenAPI_tai_free(node->data); + } + OpenAPI_list_free(tai_listList); + tai_listList = NULL; + } + if (tai_range_listList) { + OpenAPI_list_for_each(tai_range_listList, node) { + OpenAPI_tai_range_free(node->data); + } + OpenAPI_list_free(tai_range_listList); + tai_range_listList = NULL; + } + if (dnai_listList) { + OpenAPI_list_for_each(dnai_listList, node) { + ogs_free(node->data); + } + OpenAPI_list_free(dnai_listList); + dnai_listList = NULL; + } + if (un_trust_af_info_listList) { + OpenAPI_list_for_each(un_trust_af_info_listList, node) { + OpenAPI_un_trust_af_info_free(node->data); + } + OpenAPI_list_free(un_trust_af_info_listList); + un_trust_af_info_listList = NULL; + } return NULL; } diff --git a/lib/sbi/openapi/model/nef_info.h b/lib/sbi/openapi/model/nef_info.h index bbc509228..8b7a7c550 100644 --- a/lib/sbi/openapi/model/nef_info.h +++ b/lib/sbi/openapi/model/nef_info.h @@ -15,6 +15,9 @@ #include "af_event_exposure_data.h" #include "identity_range.h" #include "pfd_data.h" +#include "tai.h" +#include "tai_range.h" +#include "un_trust_af_info.h" #ifdef __cplusplus extern "C" { @@ -28,6 +31,12 @@ typedef struct OpenAPI_nef_info_s { OpenAPI_list_t *gpsi_ranges; OpenAPI_list_t *external_group_identifiers_ranges; OpenAPI_list_t *served_fqdn_list; + OpenAPI_list_t *tai_list; + OpenAPI_list_t *tai_range_list; + OpenAPI_list_t *dnai_list; + OpenAPI_list_t *un_trust_af_info_list; + bool is_uas_nf_functionality_ind; + int uas_nf_functionality_ind; } OpenAPI_nef_info_t; OpenAPI_nef_info_t *OpenAPI_nef_info_create( @@ -36,7 +45,13 @@ OpenAPI_nef_info_t *OpenAPI_nef_info_create( OpenAPI_af_event_exposure_data_t *af_ee_data, OpenAPI_list_t *gpsi_ranges, OpenAPI_list_t *external_group_identifiers_ranges, - OpenAPI_list_t *served_fqdn_list + OpenAPI_list_t *served_fqdn_list, + OpenAPI_list_t *tai_list, + OpenAPI_list_t *tai_range_list, + OpenAPI_list_t *dnai_list, + OpenAPI_list_t *un_trust_af_info_list, + bool is_uas_nf_functionality_ind, + int uas_nf_functionality_ind ); void OpenAPI_nef_info_free(OpenAPI_nef_info_t *nef_info); OpenAPI_nef_info_t *OpenAPI_nef_info_parseFromJSON(cJSON *nef_infoJSON); diff --git a/lib/sbi/openapi/model/network_area_info.h b/lib/sbi/openapi/model/network_area_info.h index 87c2a5043..b24b51be0 100644 --- a/lib/sbi/openapi/model/network_area_info.h +++ b/lib/sbi/openapi/model/network_area_info.h @@ -1,7 +1,7 @@ /* * network_area_info.h * - * Describes a network area information in which the NF service consumer requests the number of UEs. + * Describes a network area information in which the NF service consumer requests the number of UEs. */ #ifndef _OpenAPI_network_area_info_H_ diff --git a/lib/sbi/openapi/model/network_area_info_1.c b/lib/sbi/openapi/model/network_area_info_1.c index 015ada69a..f4cbd3604 100644 --- a/lib/sbi/openapi/model/network_area_info_1.c +++ b/lib/sbi/openapi/model/network_area_info_1.c @@ -31,28 +31,28 @@ void OpenAPI_network_area_info_1_free(OpenAPI_network_area_info_1_t *network_are } if (network_area_info_1->ecgis) { OpenAPI_list_for_each(network_area_info_1->ecgis, node) { - OpenAPI_ecgi_1_free(node->data); + OpenAPI_ecgi_free(node->data); } OpenAPI_list_free(network_area_info_1->ecgis); network_area_info_1->ecgis = NULL; } if (network_area_info_1->ncgis) { OpenAPI_list_for_each(network_area_info_1->ncgis, node) { - OpenAPI_ncgi_1_free(node->data); + OpenAPI_ncgi_free(node->data); } OpenAPI_list_free(network_area_info_1->ncgis); network_area_info_1->ncgis = NULL; } if (network_area_info_1->g_ran_node_ids) { OpenAPI_list_for_each(network_area_info_1->g_ran_node_ids, node) { - OpenAPI_global_ran_node_id_1_free(node->data); + OpenAPI_global_ran_node_id_free(node->data); } OpenAPI_list_free(network_area_info_1->g_ran_node_ids); network_area_info_1->g_ran_node_ids = NULL; } if (network_area_info_1->tais) { OpenAPI_list_for_each(network_area_info_1->tais, node) { - OpenAPI_tai_1_free(node->data); + OpenAPI_tai_free(node->data); } OpenAPI_list_free(network_area_info_1->tais); network_area_info_1->tais = NULL; @@ -78,7 +78,7 @@ cJSON *OpenAPI_network_area_info_1_convertToJSON(OpenAPI_network_area_info_1_t * goto end; } OpenAPI_list_for_each(network_area_info_1->ecgis, node) { - cJSON *itemLocal = OpenAPI_ecgi_1_convertToJSON(node->data); + cJSON *itemLocal = OpenAPI_ecgi_convertToJSON(node->data); if (itemLocal == NULL) { ogs_error("OpenAPI_network_area_info_1_convertToJSON() failed [ecgis]"); goto end; @@ -94,7 +94,7 @@ cJSON *OpenAPI_network_area_info_1_convertToJSON(OpenAPI_network_area_info_1_t * goto end; } OpenAPI_list_for_each(network_area_info_1->ncgis, node) { - cJSON *itemLocal = OpenAPI_ncgi_1_convertToJSON(node->data); + cJSON *itemLocal = OpenAPI_ncgi_convertToJSON(node->data); if (itemLocal == NULL) { ogs_error("OpenAPI_network_area_info_1_convertToJSON() failed [ncgis]"); goto end; @@ -110,7 +110,7 @@ cJSON *OpenAPI_network_area_info_1_convertToJSON(OpenAPI_network_area_info_1_t * goto end; } OpenAPI_list_for_each(network_area_info_1->g_ran_node_ids, node) { - cJSON *itemLocal = OpenAPI_global_ran_node_id_1_convertToJSON(node->data); + cJSON *itemLocal = OpenAPI_global_ran_node_id_convertToJSON(node->data); if (itemLocal == NULL) { ogs_error("OpenAPI_network_area_info_1_convertToJSON() failed [g_ran_node_ids]"); goto end; @@ -126,7 +126,7 @@ cJSON *OpenAPI_network_area_info_1_convertToJSON(OpenAPI_network_area_info_1_t * goto end; } OpenAPI_list_for_each(network_area_info_1->tais, node) { - cJSON *itemLocal = OpenAPI_tai_1_convertToJSON(node->data); + cJSON *itemLocal = OpenAPI_tai_convertToJSON(node->data); if (itemLocal == NULL) { ogs_error("OpenAPI_network_area_info_1_convertToJSON() failed [tais]"); goto end; @@ -166,7 +166,7 @@ OpenAPI_network_area_info_1_t *OpenAPI_network_area_info_1_parseFromJSON(cJSON * ogs_error("OpenAPI_network_area_info_1_parseFromJSON() failed [ecgis]"); goto end; } - OpenAPI_ecgi_1_t *ecgisItem = OpenAPI_ecgi_1_parseFromJSON(ecgis_local); + OpenAPI_ecgi_t *ecgisItem = OpenAPI_ecgi_parseFromJSON(ecgis_local); if (!ecgisItem) { ogs_error("No ecgisItem"); OpenAPI_list_free(ecgisList); @@ -191,7 +191,7 @@ OpenAPI_network_area_info_1_t *OpenAPI_network_area_info_1_parseFromJSON(cJSON * ogs_error("OpenAPI_network_area_info_1_parseFromJSON() failed [ncgis]"); goto end; } - OpenAPI_ncgi_1_t *ncgisItem = OpenAPI_ncgi_1_parseFromJSON(ncgis_local); + OpenAPI_ncgi_t *ncgisItem = OpenAPI_ncgi_parseFromJSON(ncgis_local); if (!ncgisItem) { ogs_error("No ncgisItem"); OpenAPI_list_free(ncgisList); @@ -216,7 +216,7 @@ OpenAPI_network_area_info_1_t *OpenAPI_network_area_info_1_parseFromJSON(cJSON * ogs_error("OpenAPI_network_area_info_1_parseFromJSON() failed [g_ran_node_ids]"); goto end; } - OpenAPI_global_ran_node_id_1_t *g_ran_node_idsItem = OpenAPI_global_ran_node_id_1_parseFromJSON(g_ran_node_ids_local); + OpenAPI_global_ran_node_id_t *g_ran_node_idsItem = OpenAPI_global_ran_node_id_parseFromJSON(g_ran_node_ids_local); if (!g_ran_node_idsItem) { ogs_error("No g_ran_node_idsItem"); OpenAPI_list_free(g_ran_node_idsList); @@ -241,7 +241,7 @@ OpenAPI_network_area_info_1_t *OpenAPI_network_area_info_1_parseFromJSON(cJSON * ogs_error("OpenAPI_network_area_info_1_parseFromJSON() failed [tais]"); goto end; } - OpenAPI_tai_1_t *taisItem = OpenAPI_tai_1_parseFromJSON(tais_local); + OpenAPI_tai_t *taisItem = OpenAPI_tai_parseFromJSON(tais_local); if (!taisItem) { ogs_error("No taisItem"); OpenAPI_list_free(taisList); @@ -262,28 +262,28 @@ OpenAPI_network_area_info_1_t *OpenAPI_network_area_info_1_parseFromJSON(cJSON * end: if (ecgisList) { OpenAPI_list_for_each(ecgisList, node) { - OpenAPI_ecgi_1_free(node->data); + OpenAPI_ecgi_free(node->data); } OpenAPI_list_free(ecgisList); ecgisList = NULL; } if (ncgisList) { OpenAPI_list_for_each(ncgisList, node) { - OpenAPI_ncgi_1_free(node->data); + OpenAPI_ncgi_free(node->data); } OpenAPI_list_free(ncgisList); ncgisList = NULL; } if (g_ran_node_idsList) { OpenAPI_list_for_each(g_ran_node_idsList, node) { - OpenAPI_global_ran_node_id_1_free(node->data); + OpenAPI_global_ran_node_id_free(node->data); } OpenAPI_list_free(g_ran_node_idsList); g_ran_node_idsList = NULL; } if (taisList) { OpenAPI_list_for_each(taisList, node) { - OpenAPI_tai_1_free(node->data); + OpenAPI_tai_free(node->data); } OpenAPI_list_free(taisList); taisList = NULL; diff --git a/lib/sbi/openapi/model/network_area_info_1.h b/lib/sbi/openapi/model/network_area_info_1.h index 13def8b3b..fc8c0e42a 100644 --- a/lib/sbi/openapi/model/network_area_info_1.h +++ b/lib/sbi/openapi/model/network_area_info_1.h @@ -12,10 +12,10 @@ #include "../include/list.h" #include "../include/keyValuePair.h" #include "../include/binary.h" -#include "ecgi_1.h" -#include "global_ran_node_id_1.h" -#include "ncgi_1.h" -#include "tai_1.h" +#include "ecgi.h" +#include "global_ran_node_id.h" +#include "ncgi.h" +#include "tai.h" #ifdef __cplusplus extern "C" { diff --git a/lib/sbi/openapi/model/network_area_info_2.c b/lib/sbi/openapi/model/network_area_info_2.c new file mode 100644 index 000000000..9f09c2945 --- /dev/null +++ b/lib/sbi/openapi/model/network_area_info_2.c @@ -0,0 +1,327 @@ + +#include +#include +#include +#include "network_area_info_2.h" + +OpenAPI_network_area_info_2_t *OpenAPI_network_area_info_2_create( + OpenAPI_list_t *ecgis, + OpenAPI_list_t *ncgis, + OpenAPI_list_t *g_ran_node_ids, + OpenAPI_list_t *tais +) +{ + OpenAPI_network_area_info_2_t *network_area_info_2_local_var = ogs_malloc(sizeof(OpenAPI_network_area_info_2_t)); + ogs_assert(network_area_info_2_local_var); + + network_area_info_2_local_var->ecgis = ecgis; + network_area_info_2_local_var->ncgis = ncgis; + network_area_info_2_local_var->g_ran_node_ids = g_ran_node_ids; + network_area_info_2_local_var->tais = tais; + + return network_area_info_2_local_var; +} + +void OpenAPI_network_area_info_2_free(OpenAPI_network_area_info_2_t *network_area_info_2) +{ + OpenAPI_lnode_t *node = NULL; + + if (NULL == network_area_info_2) { + return; + } + if (network_area_info_2->ecgis) { + OpenAPI_list_for_each(network_area_info_2->ecgis, node) { + OpenAPI_ecgi_1_free(node->data); + } + OpenAPI_list_free(network_area_info_2->ecgis); + network_area_info_2->ecgis = NULL; + } + if (network_area_info_2->ncgis) { + OpenAPI_list_for_each(network_area_info_2->ncgis, node) { + OpenAPI_ncgi_1_free(node->data); + } + OpenAPI_list_free(network_area_info_2->ncgis); + network_area_info_2->ncgis = NULL; + } + if (network_area_info_2->g_ran_node_ids) { + OpenAPI_list_for_each(network_area_info_2->g_ran_node_ids, node) { + OpenAPI_global_ran_node_id_1_free(node->data); + } + OpenAPI_list_free(network_area_info_2->g_ran_node_ids); + network_area_info_2->g_ran_node_ids = NULL; + } + if (network_area_info_2->tais) { + OpenAPI_list_for_each(network_area_info_2->tais, node) { + OpenAPI_tai_1_free(node->data); + } + OpenAPI_list_free(network_area_info_2->tais); + network_area_info_2->tais = NULL; + } + ogs_free(network_area_info_2); +} + +cJSON *OpenAPI_network_area_info_2_convertToJSON(OpenAPI_network_area_info_2_t *network_area_info_2) +{ + cJSON *item = NULL; + OpenAPI_lnode_t *node = NULL; + + if (network_area_info_2 == NULL) { + ogs_error("OpenAPI_network_area_info_2_convertToJSON() failed [NetworkAreaInfo_2]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (network_area_info_2->ecgis) { + cJSON *ecgisList = cJSON_AddArrayToObject(item, "ecgis"); + if (ecgisList == NULL) { + ogs_error("OpenAPI_network_area_info_2_convertToJSON() failed [ecgis]"); + goto end; + } + OpenAPI_list_for_each(network_area_info_2->ecgis, node) { + cJSON *itemLocal = OpenAPI_ecgi_1_convertToJSON(node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_network_area_info_2_convertToJSON() failed [ecgis]"); + goto end; + } + cJSON_AddItemToArray(ecgisList, itemLocal); + } + } + + if (network_area_info_2->ncgis) { + cJSON *ncgisList = cJSON_AddArrayToObject(item, "ncgis"); + if (ncgisList == NULL) { + ogs_error("OpenAPI_network_area_info_2_convertToJSON() failed [ncgis]"); + goto end; + } + OpenAPI_list_for_each(network_area_info_2->ncgis, node) { + cJSON *itemLocal = OpenAPI_ncgi_1_convertToJSON(node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_network_area_info_2_convertToJSON() failed [ncgis]"); + goto end; + } + cJSON_AddItemToArray(ncgisList, itemLocal); + } + } + + if (network_area_info_2->g_ran_node_ids) { + cJSON *g_ran_node_idsList = cJSON_AddArrayToObject(item, "gRanNodeIds"); + if (g_ran_node_idsList == NULL) { + ogs_error("OpenAPI_network_area_info_2_convertToJSON() failed [g_ran_node_ids]"); + goto end; + } + OpenAPI_list_for_each(network_area_info_2->g_ran_node_ids, node) { + cJSON *itemLocal = OpenAPI_global_ran_node_id_1_convertToJSON(node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_network_area_info_2_convertToJSON() failed [g_ran_node_ids]"); + goto end; + } + cJSON_AddItemToArray(g_ran_node_idsList, itemLocal); + } + } + + if (network_area_info_2->tais) { + cJSON *taisList = cJSON_AddArrayToObject(item, "tais"); + if (taisList == NULL) { + ogs_error("OpenAPI_network_area_info_2_convertToJSON() failed [tais]"); + goto end; + } + OpenAPI_list_for_each(network_area_info_2->tais, node) { + cJSON *itemLocal = OpenAPI_tai_1_convertToJSON(node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_network_area_info_2_convertToJSON() failed [tais]"); + goto end; + } + cJSON_AddItemToArray(taisList, itemLocal); + } + } + +end: + return item; +} + +OpenAPI_network_area_info_2_t *OpenAPI_network_area_info_2_parseFromJSON(cJSON *network_area_info_2JSON) +{ + OpenAPI_network_area_info_2_t *network_area_info_2_local_var = NULL; + OpenAPI_lnode_t *node = NULL; + cJSON *ecgis = NULL; + OpenAPI_list_t *ecgisList = NULL; + cJSON *ncgis = NULL; + OpenAPI_list_t *ncgisList = NULL; + cJSON *g_ran_node_ids = NULL; + OpenAPI_list_t *g_ran_node_idsList = NULL; + cJSON *tais = NULL; + OpenAPI_list_t *taisList = NULL; + ecgis = cJSON_GetObjectItemCaseSensitive(network_area_info_2JSON, "ecgis"); + if (ecgis) { + cJSON *ecgis_local = NULL; + if (!cJSON_IsArray(ecgis)) { + ogs_error("OpenAPI_network_area_info_2_parseFromJSON() failed [ecgis]"); + goto end; + } + + ecgisList = OpenAPI_list_create(); + + cJSON_ArrayForEach(ecgis_local, ecgis) { + if (!cJSON_IsObject(ecgis_local)) { + ogs_error("OpenAPI_network_area_info_2_parseFromJSON() failed [ecgis]"); + goto end; + } + OpenAPI_ecgi_1_t *ecgisItem = OpenAPI_ecgi_1_parseFromJSON(ecgis_local); + if (!ecgisItem) { + ogs_error("No ecgisItem"); + OpenAPI_list_free(ecgisList); + goto end; + } + OpenAPI_list_add(ecgisList, ecgisItem); + } + } + + ncgis = cJSON_GetObjectItemCaseSensitive(network_area_info_2JSON, "ncgis"); + if (ncgis) { + cJSON *ncgis_local = NULL; + if (!cJSON_IsArray(ncgis)) { + ogs_error("OpenAPI_network_area_info_2_parseFromJSON() failed [ncgis]"); + goto end; + } + + ncgisList = OpenAPI_list_create(); + + cJSON_ArrayForEach(ncgis_local, ncgis) { + if (!cJSON_IsObject(ncgis_local)) { + ogs_error("OpenAPI_network_area_info_2_parseFromJSON() failed [ncgis]"); + goto end; + } + OpenAPI_ncgi_1_t *ncgisItem = OpenAPI_ncgi_1_parseFromJSON(ncgis_local); + if (!ncgisItem) { + ogs_error("No ncgisItem"); + OpenAPI_list_free(ncgisList); + goto end; + } + OpenAPI_list_add(ncgisList, ncgisItem); + } + } + + g_ran_node_ids = cJSON_GetObjectItemCaseSensitive(network_area_info_2JSON, "gRanNodeIds"); + if (g_ran_node_ids) { + cJSON *g_ran_node_ids_local = NULL; + if (!cJSON_IsArray(g_ran_node_ids)) { + ogs_error("OpenAPI_network_area_info_2_parseFromJSON() failed [g_ran_node_ids]"); + goto end; + } + + g_ran_node_idsList = OpenAPI_list_create(); + + cJSON_ArrayForEach(g_ran_node_ids_local, g_ran_node_ids) { + if (!cJSON_IsObject(g_ran_node_ids_local)) { + ogs_error("OpenAPI_network_area_info_2_parseFromJSON() failed [g_ran_node_ids]"); + goto end; + } + OpenAPI_global_ran_node_id_1_t *g_ran_node_idsItem = OpenAPI_global_ran_node_id_1_parseFromJSON(g_ran_node_ids_local); + if (!g_ran_node_idsItem) { + ogs_error("No g_ran_node_idsItem"); + OpenAPI_list_free(g_ran_node_idsList); + goto end; + } + OpenAPI_list_add(g_ran_node_idsList, g_ran_node_idsItem); + } + } + + tais = cJSON_GetObjectItemCaseSensitive(network_area_info_2JSON, "tais"); + if (tais) { + cJSON *tais_local = NULL; + if (!cJSON_IsArray(tais)) { + ogs_error("OpenAPI_network_area_info_2_parseFromJSON() failed [tais]"); + goto end; + } + + taisList = OpenAPI_list_create(); + + cJSON_ArrayForEach(tais_local, tais) { + if (!cJSON_IsObject(tais_local)) { + ogs_error("OpenAPI_network_area_info_2_parseFromJSON() failed [tais]"); + goto end; + } + OpenAPI_tai_1_t *taisItem = OpenAPI_tai_1_parseFromJSON(tais_local); + if (!taisItem) { + ogs_error("No taisItem"); + OpenAPI_list_free(taisList); + goto end; + } + OpenAPI_list_add(taisList, taisItem); + } + } + + network_area_info_2_local_var = OpenAPI_network_area_info_2_create ( + ecgis ? ecgisList : NULL, + ncgis ? ncgisList : NULL, + g_ran_node_ids ? g_ran_node_idsList : NULL, + tais ? taisList : NULL + ); + + return network_area_info_2_local_var; +end: + if (ecgisList) { + OpenAPI_list_for_each(ecgisList, node) { + OpenAPI_ecgi_1_free(node->data); + } + OpenAPI_list_free(ecgisList); + ecgisList = NULL; + } + if (ncgisList) { + OpenAPI_list_for_each(ncgisList, node) { + OpenAPI_ncgi_1_free(node->data); + } + OpenAPI_list_free(ncgisList); + ncgisList = NULL; + } + if (g_ran_node_idsList) { + OpenAPI_list_for_each(g_ran_node_idsList, node) { + OpenAPI_global_ran_node_id_1_free(node->data); + } + OpenAPI_list_free(g_ran_node_idsList); + g_ran_node_idsList = NULL; + } + if (taisList) { + OpenAPI_list_for_each(taisList, node) { + OpenAPI_tai_1_free(node->data); + } + OpenAPI_list_free(taisList); + taisList = NULL; + } + return NULL; +} + +OpenAPI_network_area_info_2_t *OpenAPI_network_area_info_2_copy(OpenAPI_network_area_info_2_t *dst, OpenAPI_network_area_info_2_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_network_area_info_2_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_network_area_info_2_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_network_area_info_2_free(dst); + dst = OpenAPI_network_area_info_2_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/network_area_info_2.h b/lib/sbi/openapi/model/network_area_info_2.h new file mode 100644 index 000000000..3c8b681d9 --- /dev/null +++ b/lib/sbi/openapi/model/network_area_info_2.h @@ -0,0 +1,48 @@ +/* + * network_area_info_2.h + * + * Describes a network area information in which the NF service consumer requests the number of UEs. + */ + +#ifndef _OpenAPI_network_area_info_2_H_ +#define _OpenAPI_network_area_info_2_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "ecgi_1.h" +#include "global_ran_node_id_1.h" +#include "ncgi_1.h" +#include "tai_1.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_network_area_info_2_s OpenAPI_network_area_info_2_t; +typedef struct OpenAPI_network_area_info_2_s { + OpenAPI_list_t *ecgis; + OpenAPI_list_t *ncgis; + OpenAPI_list_t *g_ran_node_ids; + OpenAPI_list_t *tais; +} OpenAPI_network_area_info_2_t; + +OpenAPI_network_area_info_2_t *OpenAPI_network_area_info_2_create( + OpenAPI_list_t *ecgis, + OpenAPI_list_t *ncgis, + OpenAPI_list_t *g_ran_node_ids, + OpenAPI_list_t *tais +); +void OpenAPI_network_area_info_2_free(OpenAPI_network_area_info_2_t *network_area_info_2); +OpenAPI_network_area_info_2_t *OpenAPI_network_area_info_2_parseFromJSON(cJSON *network_area_info_2JSON); +cJSON *OpenAPI_network_area_info_2_convertToJSON(OpenAPI_network_area_info_2_t *network_area_info_2); +OpenAPI_network_area_info_2_t *OpenAPI_network_area_info_2_copy(OpenAPI_network_area_info_2_t *dst, OpenAPI_network_area_info_2_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_network_area_info_2_H_ */ + diff --git a/lib/sbi/openapi/model/network_perf_info.c b/lib/sbi/openapi/model/network_perf_info.c new file mode 100644 index 000000000..3c29b402e --- /dev/null +++ b/lib/sbi/openapi/model/network_perf_info.c @@ -0,0 +1,215 @@ + +#include +#include +#include +#include "network_perf_info.h" + +OpenAPI_network_perf_info_t *OpenAPI_network_perf_info_create( + OpenAPI_network_area_info_t *network_area, + OpenAPI_network_perf_type_t *nw_perf_type, + bool is_relative_ratio, + int relative_ratio, + bool is_absolute_num, + int absolute_num, + bool is_confidence, + int confidence +) +{ + OpenAPI_network_perf_info_t *network_perf_info_local_var = ogs_malloc(sizeof(OpenAPI_network_perf_info_t)); + ogs_assert(network_perf_info_local_var); + + network_perf_info_local_var->network_area = network_area; + network_perf_info_local_var->nw_perf_type = nw_perf_type; + network_perf_info_local_var->is_relative_ratio = is_relative_ratio; + network_perf_info_local_var->relative_ratio = relative_ratio; + network_perf_info_local_var->is_absolute_num = is_absolute_num; + network_perf_info_local_var->absolute_num = absolute_num; + network_perf_info_local_var->is_confidence = is_confidence; + network_perf_info_local_var->confidence = confidence; + + return network_perf_info_local_var; +} + +void OpenAPI_network_perf_info_free(OpenAPI_network_perf_info_t *network_perf_info) +{ + OpenAPI_lnode_t *node = NULL; + + if (NULL == network_perf_info) { + return; + } + if (network_perf_info->network_area) { + OpenAPI_network_area_info_free(network_perf_info->network_area); + network_perf_info->network_area = NULL; + } + if (network_perf_info->nw_perf_type) { + OpenAPI_network_perf_type_free(network_perf_info->nw_perf_type); + network_perf_info->nw_perf_type = NULL; + } + ogs_free(network_perf_info); +} + +cJSON *OpenAPI_network_perf_info_convertToJSON(OpenAPI_network_perf_info_t *network_perf_info) +{ + cJSON *item = NULL; + OpenAPI_lnode_t *node = NULL; + + if (network_perf_info == NULL) { + ogs_error("OpenAPI_network_perf_info_convertToJSON() failed [NetworkPerfInfo]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (network_perf_info->network_area) { + cJSON *network_area_local_JSON = OpenAPI_network_area_info_convertToJSON(network_perf_info->network_area); + if (network_area_local_JSON == NULL) { + ogs_error("OpenAPI_network_perf_info_convertToJSON() failed [network_area]"); + goto end; + } + cJSON_AddItemToObject(item, "networkArea", network_area_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_network_perf_info_convertToJSON() failed [network_area]"); + goto end; + } + } + + if (network_perf_info->nw_perf_type) { + cJSON *nw_perf_type_local_JSON = OpenAPI_network_perf_type_convertToJSON(network_perf_info->nw_perf_type); + if (nw_perf_type_local_JSON == NULL) { + ogs_error("OpenAPI_network_perf_info_convertToJSON() failed [nw_perf_type]"); + goto end; + } + cJSON_AddItemToObject(item, "nwPerfType", nw_perf_type_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_network_perf_info_convertToJSON() failed [nw_perf_type]"); + goto end; + } + } + + if (network_perf_info->is_relative_ratio) { + if (cJSON_AddNumberToObject(item, "relativeRatio", network_perf_info->relative_ratio) == NULL) { + ogs_error("OpenAPI_network_perf_info_convertToJSON() failed [relative_ratio]"); + goto end; + } + } + + if (network_perf_info->is_absolute_num) { + if (cJSON_AddNumberToObject(item, "absoluteNum", network_perf_info->absolute_num) == NULL) { + ogs_error("OpenAPI_network_perf_info_convertToJSON() failed [absolute_num]"); + goto end; + } + } + + if (network_perf_info->is_confidence) { + if (cJSON_AddNumberToObject(item, "confidence", network_perf_info->confidence) == NULL) { + ogs_error("OpenAPI_network_perf_info_convertToJSON() failed [confidence]"); + goto end; + } + } + +end: + return item; +} + +OpenAPI_network_perf_info_t *OpenAPI_network_perf_info_parseFromJSON(cJSON *network_perf_infoJSON) +{ + OpenAPI_network_perf_info_t *network_perf_info_local_var = NULL; + OpenAPI_lnode_t *node = NULL; + cJSON *network_area = NULL; + OpenAPI_network_area_info_t *network_area_local_nonprim = NULL; + cJSON *nw_perf_type = NULL; + OpenAPI_network_perf_type_t *nw_perf_type_local_nonprim = NULL; + cJSON *relative_ratio = NULL; + cJSON *absolute_num = NULL; + cJSON *confidence = NULL; + network_area = cJSON_GetObjectItemCaseSensitive(network_perf_infoJSON, "networkArea"); + if (network_area) { + network_area_local_nonprim = OpenAPI_network_area_info_parseFromJSON(network_area); + } + + nw_perf_type = cJSON_GetObjectItemCaseSensitive(network_perf_infoJSON, "nwPerfType"); + if (nw_perf_type) { + nw_perf_type_local_nonprim = OpenAPI_network_perf_type_parseFromJSON(nw_perf_type); + } + + relative_ratio = cJSON_GetObjectItemCaseSensitive(network_perf_infoJSON, "relativeRatio"); + if (relative_ratio) { + if (!cJSON_IsNumber(relative_ratio)) { + ogs_error("OpenAPI_network_perf_info_parseFromJSON() failed [relative_ratio]"); + goto end; + } + } + + absolute_num = cJSON_GetObjectItemCaseSensitive(network_perf_infoJSON, "absoluteNum"); + if (absolute_num) { + if (!cJSON_IsNumber(absolute_num)) { + ogs_error("OpenAPI_network_perf_info_parseFromJSON() failed [absolute_num]"); + goto end; + } + } + + confidence = cJSON_GetObjectItemCaseSensitive(network_perf_infoJSON, "confidence"); + if (confidence) { + if (!cJSON_IsNumber(confidence)) { + ogs_error("OpenAPI_network_perf_info_parseFromJSON() failed [confidence]"); + goto end; + } + } + + network_perf_info_local_var = OpenAPI_network_perf_info_create ( + network_area ? network_area_local_nonprim : NULL, + nw_perf_type ? nw_perf_type_local_nonprim : NULL, + relative_ratio ? true : false, + relative_ratio ? relative_ratio->valuedouble : 0, + absolute_num ? true : false, + absolute_num ? absolute_num->valuedouble : 0, + confidence ? true : false, + confidence ? confidence->valuedouble : 0 + ); + + return network_perf_info_local_var; +end: + if (network_area_local_nonprim) { + OpenAPI_network_area_info_free(network_area_local_nonprim); + network_area_local_nonprim = NULL; + } + if (nw_perf_type_local_nonprim) { + OpenAPI_network_perf_type_free(nw_perf_type_local_nonprim); + nw_perf_type_local_nonprim = NULL; + } + return NULL; +} + +OpenAPI_network_perf_info_t *OpenAPI_network_perf_info_copy(OpenAPI_network_perf_info_t *dst, OpenAPI_network_perf_info_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_network_perf_info_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_network_perf_info_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_network_perf_info_free(dst); + dst = OpenAPI_network_perf_info_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/network_perf_info.h b/lib/sbi/openapi/model/network_perf_info.h new file mode 100644 index 000000000..c0b34b04c --- /dev/null +++ b/lib/sbi/openapi/model/network_perf_info.h @@ -0,0 +1,54 @@ +/* + * network_perf_info.h + * + * Represents the network performance information. + */ + +#ifndef _OpenAPI_network_perf_info_H_ +#define _OpenAPI_network_perf_info_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "network_area_info.h" +#include "network_perf_type.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_network_perf_info_s OpenAPI_network_perf_info_t; +typedef struct OpenAPI_network_perf_info_s { + struct OpenAPI_network_area_info_s *network_area; + struct OpenAPI_network_perf_type_s *nw_perf_type; + bool is_relative_ratio; + int relative_ratio; + bool is_absolute_num; + int absolute_num; + bool is_confidence; + int confidence; +} OpenAPI_network_perf_info_t; + +OpenAPI_network_perf_info_t *OpenAPI_network_perf_info_create( + OpenAPI_network_area_info_t *network_area, + OpenAPI_network_perf_type_t *nw_perf_type, + bool is_relative_ratio, + int relative_ratio, + bool is_absolute_num, + int absolute_num, + bool is_confidence, + int confidence +); +void OpenAPI_network_perf_info_free(OpenAPI_network_perf_info_t *network_perf_info); +OpenAPI_network_perf_info_t *OpenAPI_network_perf_info_parseFromJSON(cJSON *network_perf_infoJSON); +cJSON *OpenAPI_network_perf_info_convertToJSON(OpenAPI_network_perf_info_t *network_perf_info); +OpenAPI_network_perf_info_t *OpenAPI_network_perf_info_copy(OpenAPI_network_perf_info_t *dst, OpenAPI_network_perf_info_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_network_perf_info_H_ */ + diff --git a/lib/sbi/openapi/model/network_perf_requirement.c b/lib/sbi/openapi/model/network_perf_requirement.c new file mode 100644 index 000000000..374685d9b --- /dev/null +++ b/lib/sbi/openapi/model/network_perf_requirement.c @@ -0,0 +1,166 @@ + +#include +#include +#include +#include "network_perf_requirement.h" + +OpenAPI_network_perf_requirement_t *OpenAPI_network_perf_requirement_create( + OpenAPI_network_perf_type_t *nw_perf_type, + bool is_relative_ratio, + int relative_ratio, + bool is_absolute_num, + int absolute_num +) +{ + OpenAPI_network_perf_requirement_t *network_perf_requirement_local_var = ogs_malloc(sizeof(OpenAPI_network_perf_requirement_t)); + ogs_assert(network_perf_requirement_local_var); + + network_perf_requirement_local_var->nw_perf_type = nw_perf_type; + network_perf_requirement_local_var->is_relative_ratio = is_relative_ratio; + network_perf_requirement_local_var->relative_ratio = relative_ratio; + network_perf_requirement_local_var->is_absolute_num = is_absolute_num; + network_perf_requirement_local_var->absolute_num = absolute_num; + + return network_perf_requirement_local_var; +} + +void OpenAPI_network_perf_requirement_free(OpenAPI_network_perf_requirement_t *network_perf_requirement) +{ + OpenAPI_lnode_t *node = NULL; + + if (NULL == network_perf_requirement) { + return; + } + if (network_perf_requirement->nw_perf_type) { + OpenAPI_network_perf_type_free(network_perf_requirement->nw_perf_type); + network_perf_requirement->nw_perf_type = NULL; + } + ogs_free(network_perf_requirement); +} + +cJSON *OpenAPI_network_perf_requirement_convertToJSON(OpenAPI_network_perf_requirement_t *network_perf_requirement) +{ + cJSON *item = NULL; + OpenAPI_lnode_t *node = NULL; + + if (network_perf_requirement == NULL) { + ogs_error("OpenAPI_network_perf_requirement_convertToJSON() failed [NetworkPerfRequirement]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (!network_perf_requirement->nw_perf_type) { + ogs_error("OpenAPI_network_perf_requirement_convertToJSON() failed [nw_perf_type]"); + return NULL; + } + cJSON *nw_perf_type_local_JSON = OpenAPI_network_perf_type_convertToJSON(network_perf_requirement->nw_perf_type); + if (nw_perf_type_local_JSON == NULL) { + ogs_error("OpenAPI_network_perf_requirement_convertToJSON() failed [nw_perf_type]"); + goto end; + } + cJSON_AddItemToObject(item, "nwPerfType", nw_perf_type_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_network_perf_requirement_convertToJSON() failed [nw_perf_type]"); + goto end; + } + + if (network_perf_requirement->is_relative_ratio) { + if (cJSON_AddNumberToObject(item, "relativeRatio", network_perf_requirement->relative_ratio) == NULL) { + ogs_error("OpenAPI_network_perf_requirement_convertToJSON() failed [relative_ratio]"); + goto end; + } + } + + if (network_perf_requirement->is_absolute_num) { + if (cJSON_AddNumberToObject(item, "absoluteNum", network_perf_requirement->absolute_num) == NULL) { + ogs_error("OpenAPI_network_perf_requirement_convertToJSON() failed [absolute_num]"); + goto end; + } + } + +end: + return item; +} + +OpenAPI_network_perf_requirement_t *OpenAPI_network_perf_requirement_parseFromJSON(cJSON *network_perf_requirementJSON) +{ + OpenAPI_network_perf_requirement_t *network_perf_requirement_local_var = NULL; + OpenAPI_lnode_t *node = NULL; + cJSON *nw_perf_type = NULL; + OpenAPI_network_perf_type_t *nw_perf_type_local_nonprim = NULL; + cJSON *relative_ratio = NULL; + cJSON *absolute_num = NULL; + nw_perf_type = cJSON_GetObjectItemCaseSensitive(network_perf_requirementJSON, "nwPerfType"); + if (!nw_perf_type) { + ogs_error("OpenAPI_network_perf_requirement_parseFromJSON() failed [nw_perf_type]"); + goto end; + } + nw_perf_type_local_nonprim = OpenAPI_network_perf_type_parseFromJSON(nw_perf_type); + + relative_ratio = cJSON_GetObjectItemCaseSensitive(network_perf_requirementJSON, "relativeRatio"); + if (relative_ratio) { + if (!cJSON_IsNumber(relative_ratio)) { + ogs_error("OpenAPI_network_perf_requirement_parseFromJSON() failed [relative_ratio]"); + goto end; + } + } + + absolute_num = cJSON_GetObjectItemCaseSensitive(network_perf_requirementJSON, "absoluteNum"); + if (absolute_num) { + if (!cJSON_IsNumber(absolute_num)) { + ogs_error("OpenAPI_network_perf_requirement_parseFromJSON() failed [absolute_num]"); + goto end; + } + } + + network_perf_requirement_local_var = OpenAPI_network_perf_requirement_create ( + nw_perf_type_local_nonprim, + relative_ratio ? true : false, + relative_ratio ? relative_ratio->valuedouble : 0, + absolute_num ? true : false, + absolute_num ? absolute_num->valuedouble : 0 + ); + + return network_perf_requirement_local_var; +end: + if (nw_perf_type_local_nonprim) { + OpenAPI_network_perf_type_free(nw_perf_type_local_nonprim); + nw_perf_type_local_nonprim = NULL; + } + return NULL; +} + +OpenAPI_network_perf_requirement_t *OpenAPI_network_perf_requirement_copy(OpenAPI_network_perf_requirement_t *dst, OpenAPI_network_perf_requirement_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_network_perf_requirement_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_network_perf_requirement_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_network_perf_requirement_free(dst); + dst = OpenAPI_network_perf_requirement_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/network_perf_requirement.h b/lib/sbi/openapi/model/network_perf_requirement.h new file mode 100644 index 000000000..462ab0ae8 --- /dev/null +++ b/lib/sbi/openapi/model/network_perf_requirement.h @@ -0,0 +1,47 @@ +/* + * network_perf_requirement.h + * + * Represents a network performance requirement. + */ + +#ifndef _OpenAPI_network_perf_requirement_H_ +#define _OpenAPI_network_perf_requirement_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "network_perf_type.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_network_perf_requirement_s OpenAPI_network_perf_requirement_t; +typedef struct OpenAPI_network_perf_requirement_s { + struct OpenAPI_network_perf_type_s *nw_perf_type; + bool is_relative_ratio; + int relative_ratio; + bool is_absolute_num; + int absolute_num; +} OpenAPI_network_perf_requirement_t; + +OpenAPI_network_perf_requirement_t *OpenAPI_network_perf_requirement_create( + OpenAPI_network_perf_type_t *nw_perf_type, + bool is_relative_ratio, + int relative_ratio, + bool is_absolute_num, + int absolute_num +); +void OpenAPI_network_perf_requirement_free(OpenAPI_network_perf_requirement_t *network_perf_requirement); +OpenAPI_network_perf_requirement_t *OpenAPI_network_perf_requirement_parseFromJSON(cJSON *network_perf_requirementJSON); +cJSON *OpenAPI_network_perf_requirement_convertToJSON(OpenAPI_network_perf_requirement_t *network_perf_requirement); +OpenAPI_network_perf_requirement_t *OpenAPI_network_perf_requirement_copy(OpenAPI_network_perf_requirement_t *dst, OpenAPI_network_perf_requirement_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_network_perf_requirement_H_ */ + diff --git a/lib/sbi/openapi/model/network_perf_type.c b/lib/sbi/openapi/model/network_perf_type.c new file mode 100644 index 000000000..86218b434 --- /dev/null +++ b/lib/sbi/openapi/model/network_perf_type.c @@ -0,0 +1,87 @@ + +#include +#include +#include +#include "network_perf_type.h" + +OpenAPI_network_perf_type_t *OpenAPI_network_perf_type_create( +) +{ + OpenAPI_network_perf_type_t *network_perf_type_local_var = ogs_malloc(sizeof(OpenAPI_network_perf_type_t)); + ogs_assert(network_perf_type_local_var); + + + return network_perf_type_local_var; +} + +void OpenAPI_network_perf_type_free(OpenAPI_network_perf_type_t *network_perf_type) +{ + OpenAPI_lnode_t *node = NULL; + + if (NULL == network_perf_type) { + return; + } + ogs_free(network_perf_type); +} + +cJSON *OpenAPI_network_perf_type_convertToJSON(OpenAPI_network_perf_type_t *network_perf_type) +{ + cJSON *item = NULL; + OpenAPI_lnode_t *node = NULL; + + if (network_perf_type == NULL) { + ogs_error("OpenAPI_network_perf_type_convertToJSON() failed [NetworkPerfType]"); + return NULL; + } + + item = cJSON_CreateObject(); +end: + return item; +} + +OpenAPI_network_perf_type_t *OpenAPI_network_perf_type_parseFromJSON(cJSON *network_perf_typeJSON) +{ + OpenAPI_network_perf_type_t *network_perf_type_local_var = NULL; + OpenAPI_lnode_t *node = NULL; + network_perf_type_local_var = OpenAPI_network_perf_type_create ( + ); + + return network_perf_type_local_var; +end: + return NULL; +} + +OpenAPI_network_perf_type_t *OpenAPI_network_perf_type_copy(OpenAPI_network_perf_type_t *dst, OpenAPI_network_perf_type_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_network_perf_type_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_network_perf_type_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_network_perf_type_free(dst); + dst = OpenAPI_network_perf_type_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/network_perf_type.h b/lib/sbi/openapi/model/network_perf_type.h new file mode 100644 index 000000000..c8dfd0069 --- /dev/null +++ b/lib/sbi/openapi/model/network_perf_type.h @@ -0,0 +1,37 @@ +/* + * network_perf_type.h + * + * Possible values are: - GNB_ACTIVE_RATIO: Indicates that the network performance requirement is gNodeB active (i.e. up and running) rate. Indicates the ratio of gNB active (i.e. up and running) number to the total number of gNB - GNB_COMPUTING_USAGE: Indicates gNodeB computing resource usage. - GNB_MEMORY_USAGE: Indicates gNodeB memory usage. - GNB_DISK_USAGE: Indicates gNodeB disk usage. - NUM_OF_UE: Indicates number of UEs. - SESS_SUCC_RATIO: Indicates ratio of successful setup of PDU sessions to total PDU session setup attempts. - HO_SUCC_RATIO: Indicates Ratio of successful handovers to the total handover attempts. + */ + +#ifndef _OpenAPI_network_perf_type_H_ +#define _OpenAPI_network_perf_type_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "network_perf_type_any_of.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_network_perf_type_s OpenAPI_network_perf_type_t; +typedef struct OpenAPI_network_perf_type_s { +} OpenAPI_network_perf_type_t; + +OpenAPI_network_perf_type_t *OpenAPI_network_perf_type_create( +); +void OpenAPI_network_perf_type_free(OpenAPI_network_perf_type_t *network_perf_type); +OpenAPI_network_perf_type_t *OpenAPI_network_perf_type_parseFromJSON(cJSON *network_perf_typeJSON); +cJSON *OpenAPI_network_perf_type_convertToJSON(OpenAPI_network_perf_type_t *network_perf_type); +OpenAPI_network_perf_type_t *OpenAPI_network_perf_type_copy(OpenAPI_network_perf_type_t *dst, OpenAPI_network_perf_type_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_network_perf_type_H_ */ + diff --git a/lib/sbi/openapi/model/network_perf_type_any_of.c b/lib/sbi/openapi/model/network_perf_type_any_of.c new file mode 100644 index 000000000..a0ad39230 --- /dev/null +++ b/lib/sbi/openapi/model/network_perf_type_any_of.c @@ -0,0 +1,30 @@ + +#include +#include +#include +#include "network_perf_type_any_of.h" + +char* OpenAPI_network_perf_type_any_of_ToString(OpenAPI_network_perf_type_any_of_e network_perf_type_any_of) +{ + const char *network_perf_type_any_ofArray[] = { "NULL", "GNB_ACTIVE_RATIO", "GNB_COMPUTING_USAGE", "GNB_MEMORY_USAGE", "GNB_DISK_USAGE", "NUM_OF_UE", "SESS_SUCC_RATIO", "HO_SUCC_RATIO" }; + size_t sizeofArray = sizeof(network_perf_type_any_ofArray) / sizeof(network_perf_type_any_ofArray[0]); + if (network_perf_type_any_of < sizeofArray) + return (char *)network_perf_type_any_ofArray[network_perf_type_any_of]; + else + return (char *)"Unknown"; +} + +OpenAPI_network_perf_type_any_of_e OpenAPI_network_perf_type_any_of_FromString(char* network_perf_type_any_of) +{ + int stringToReturn = 0; + const char *network_perf_type_any_ofArray[] = { "NULL", "GNB_ACTIVE_RATIO", "GNB_COMPUTING_USAGE", "GNB_MEMORY_USAGE", "GNB_DISK_USAGE", "NUM_OF_UE", "SESS_SUCC_RATIO", "HO_SUCC_RATIO" }; + size_t sizeofArray = sizeof(network_perf_type_any_ofArray) / sizeof(network_perf_type_any_ofArray[0]); + while (stringToReturn < sizeofArray) { + if (strcmp(network_perf_type_any_of, network_perf_type_any_ofArray[stringToReturn]) == 0) { + return stringToReturn; + } + stringToReturn++; + } + return 0; +} + diff --git a/lib/sbi/openapi/model/network_perf_type_any_of.h b/lib/sbi/openapi/model/network_perf_type_any_of.h new file mode 100644 index 000000000..25e6cea6e --- /dev/null +++ b/lib/sbi/openapi/model/network_perf_type_any_of.h @@ -0,0 +1,31 @@ +/* + * network_perf_type_any_of.h + * + * + */ + +#ifndef _OpenAPI_network_perf_type_any_of_H_ +#define _OpenAPI_network_perf_type_any_of_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef enum { OpenAPI_network_perf_type_any_of_NULL = 0, OpenAPI_network_perf_type_any_of_GNB_ACTIVE_RATIO, OpenAPI_network_perf_type_any_of_GNB_COMPUTING_USAGE, OpenAPI_network_perf_type_any_of_GNB_MEMORY_USAGE, OpenAPI_network_perf_type_any_of_GNB_DISK_USAGE, OpenAPI_network_perf_type_any_of_NUM_OF_UE, OpenAPI_network_perf_type_any_of_SESS_SUCC_RATIO, OpenAPI_network_perf_type_any_of_HO_SUCC_RATIO } OpenAPI_network_perf_type_any_of_e; + +char* OpenAPI_network_perf_type_any_of_ToString(OpenAPI_network_perf_type_any_of_e network_perf_type_any_of); + +OpenAPI_network_perf_type_any_of_e OpenAPI_network_perf_type_any_of_FromString(char* network_perf_type_any_of); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_network_perf_type_any_of_H_ */ + diff --git a/lib/sbi/openapi/model/nf_group_cond.c b/lib/sbi/openapi/model/nf_group_cond.c index 82246ffa9..d0bc7d6fb 100644 --- a/lib/sbi/openapi/model/nf_group_cond.c +++ b/lib/sbi/openapi/model/nf_group_cond.c @@ -6,7 +6,7 @@ char *OpenAPI_nf_typenf_group_cond_ToString(OpenAPI_nf_group_cond_nf_type_e nf_type) { - const char *nf_typeArray[] = { "NULL", "UDM", "AUSF", "UDR", "PCF", "CHF" }; + const char *nf_typeArray[] = { "NULL", "UDM", "AUSF", "UDR", "PCF", "CHF", "HSS" }; size_t sizeofArray = sizeof(nf_typeArray) / sizeof(nf_typeArray[0]); if (nf_type < sizeofArray) return (char *)nf_typeArray[nf_type]; @@ -17,7 +17,7 @@ char *OpenAPI_nf_typenf_group_cond_ToString(OpenAPI_nf_group_cond_nf_type_e nf_t OpenAPI_nf_group_cond_nf_type_e OpenAPI_nf_typenf_group_cond_FromString(char* nf_type) { int stringToReturn = 0; - const char *nf_typeArray[] = { "NULL", "UDM", "AUSF", "UDR", "PCF", "CHF" }; + const char *nf_typeArray[] = { "NULL", "UDM", "AUSF", "UDR", "PCF", "CHF", "HSS" }; size_t sizeofArray = sizeof(nf_typeArray) / sizeof(nf_typeArray[0]); while (stringToReturn < sizeofArray) { if (strcmp(nf_type, nf_typeArray[stringToReturn]) == 0) { diff --git a/lib/sbi/openapi/model/nf_group_cond.h b/lib/sbi/openapi/model/nf_group_cond.h index f0f54e369..e2eb1c006 100644 --- a/lib/sbi/openapi/model/nf_group_cond.h +++ b/lib/sbi/openapi/model/nf_group_cond.h @@ -18,7 +18,7 @@ extern "C" { #endif typedef struct OpenAPI_nf_group_cond_s OpenAPI_nf_group_cond_t; -typedef enum { OpenAPI_nf_group_cond_NFTYPE_NULL = 0, OpenAPI_nf_group_cond_NFTYPE_UDM, OpenAPI_nf_group_cond_NFTYPE_AUSF, OpenAPI_nf_group_cond_NFTYPE_UDR, OpenAPI_nf_group_cond_NFTYPE_PCF, OpenAPI_nf_group_cond_NFTYPE_CHF } OpenAPI_nf_group_cond_nf_type_e; +typedef enum { OpenAPI_nf_group_cond_NFTYPE_NULL = 0, OpenAPI_nf_group_cond_NFTYPE_UDM, OpenAPI_nf_group_cond_NFTYPE_AUSF, OpenAPI_nf_group_cond_NFTYPE_UDR, OpenAPI_nf_group_cond_NFTYPE_PCF, OpenAPI_nf_group_cond_NFTYPE_CHF, OpenAPI_nf_group_cond_NFTYPE_HSS } OpenAPI_nf_group_cond_nf_type_e; char* OpenAPI_nf_group_cond_nf_type_ToString(OpenAPI_nf_group_cond_nf_type_e nf_type); diff --git a/lib/sbi/openapi/model/nf_group_list_cond.c b/lib/sbi/openapi/model/nf_group_list_cond.c new file mode 100644 index 000000000..6c1518389 --- /dev/null +++ b/lib/sbi/openapi/model/nf_group_list_cond.c @@ -0,0 +1,241 @@ + +#include +#include +#include +#include "nf_group_list_cond.h" + +char *OpenAPI_condition_typenf_group_list_cond_ToString(OpenAPI_nf_group_list_cond_condition_type_e condition_type) +{ + const char *condition_typeArray[] = { "NULL", "NF_GROUP_LIST_COND" }; + size_t sizeofArray = sizeof(condition_typeArray) / sizeof(condition_typeArray[0]); + if (condition_type < sizeofArray) + return (char *)condition_typeArray[condition_type]; + else + return (char *)"Unknown"; +} + +OpenAPI_nf_group_list_cond_condition_type_e OpenAPI_condition_typenf_group_list_cond_FromString(char* condition_type) +{ + int stringToReturn = 0; + const char *condition_typeArray[] = { "NULL", "NF_GROUP_LIST_COND" }; + size_t sizeofArray = sizeof(condition_typeArray) / sizeof(condition_typeArray[0]); + while (stringToReturn < sizeofArray) { + if (strcmp(condition_type, condition_typeArray[stringToReturn]) == 0) { + return stringToReturn; + } + stringToReturn++; + } + return 0; +} +char *OpenAPI_nf_typenf_group_list_cond_ToString(OpenAPI_nf_group_list_cond_nf_type_e nf_type) +{ + const char *nf_typeArray[] = { "NULL", "UDM", "AUSF", "UDR", "PCF", "CHF", "HSS" }; + size_t sizeofArray = sizeof(nf_typeArray) / sizeof(nf_typeArray[0]); + if (nf_type < sizeofArray) + return (char *)nf_typeArray[nf_type]; + else + return (char *)"Unknown"; +} + +OpenAPI_nf_group_list_cond_nf_type_e OpenAPI_nf_typenf_group_list_cond_FromString(char* nf_type) +{ + int stringToReturn = 0; + const char *nf_typeArray[] = { "NULL", "UDM", "AUSF", "UDR", "PCF", "CHF", "HSS" }; + size_t sizeofArray = sizeof(nf_typeArray) / sizeof(nf_typeArray[0]); + while (stringToReturn < sizeofArray) { + if (strcmp(nf_type, nf_typeArray[stringToReturn]) == 0) { + return stringToReturn; + } + stringToReturn++; + } + return 0; +} +OpenAPI_nf_group_list_cond_t *OpenAPI_nf_group_list_cond_create( + OpenAPI_nf_group_list_cond_condition_type_e condition_type, + OpenAPI_nf_group_list_cond_nf_type_e nf_type, + OpenAPI_list_t *nf_group_id_list +) +{ + OpenAPI_nf_group_list_cond_t *nf_group_list_cond_local_var = ogs_malloc(sizeof(OpenAPI_nf_group_list_cond_t)); + ogs_assert(nf_group_list_cond_local_var); + + nf_group_list_cond_local_var->condition_type = condition_type; + nf_group_list_cond_local_var->nf_type = nf_type; + nf_group_list_cond_local_var->nf_group_id_list = nf_group_id_list; + + return nf_group_list_cond_local_var; +} + +void OpenAPI_nf_group_list_cond_free(OpenAPI_nf_group_list_cond_t *nf_group_list_cond) +{ + OpenAPI_lnode_t *node = NULL; + + if (NULL == nf_group_list_cond) { + return; + } + if (nf_group_list_cond->nf_group_id_list) { + OpenAPI_list_for_each(nf_group_list_cond->nf_group_id_list, node) { + ogs_free(node->data); + } + OpenAPI_list_free(nf_group_list_cond->nf_group_id_list); + nf_group_list_cond->nf_group_id_list = NULL; + } + ogs_free(nf_group_list_cond); +} + +cJSON *OpenAPI_nf_group_list_cond_convertToJSON(OpenAPI_nf_group_list_cond_t *nf_group_list_cond) +{ + cJSON *item = NULL; + OpenAPI_lnode_t *node = NULL; + + if (nf_group_list_cond == NULL) { + ogs_error("OpenAPI_nf_group_list_cond_convertToJSON() failed [NfGroupListCond]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (nf_group_list_cond->condition_type == OpenAPI_nf_group_list_cond_CONDITIONTYPE_NULL) { + ogs_error("OpenAPI_nf_group_list_cond_convertToJSON() failed [condition_type]"); + return NULL; + } + if (cJSON_AddStringToObject(item, "conditionType", OpenAPI_condition_typenf_group_list_cond_ToString(nf_group_list_cond->condition_type)) == NULL) { + ogs_error("OpenAPI_nf_group_list_cond_convertToJSON() failed [condition_type]"); + goto end; + } + + if (nf_group_list_cond->nf_type == OpenAPI_nf_group_list_cond_NFTYPE_NULL) { + ogs_error("OpenAPI_nf_group_list_cond_convertToJSON() failed [nf_type]"); + return NULL; + } + if (cJSON_AddStringToObject(item, "nfType", OpenAPI_nf_typenf_group_list_cond_ToString(nf_group_list_cond->nf_type)) == NULL) { + ogs_error("OpenAPI_nf_group_list_cond_convertToJSON() failed [nf_type]"); + goto end; + } + + if (!nf_group_list_cond->nf_group_id_list) { + ogs_error("OpenAPI_nf_group_list_cond_convertToJSON() failed [nf_group_id_list]"); + return NULL; + } + cJSON *nf_group_id_listList = cJSON_AddArrayToObject(item, "nfGroupIdList"); + if (nf_group_id_listList == NULL) { + ogs_error("OpenAPI_nf_group_list_cond_convertToJSON() failed [nf_group_id_list]"); + goto end; + } + OpenAPI_list_for_each(nf_group_list_cond->nf_group_id_list, node) { + if (cJSON_AddStringToObject(nf_group_id_listList, "", (char*)node->data) == NULL) { + ogs_error("OpenAPI_nf_group_list_cond_convertToJSON() failed [nf_group_id_list]"); + goto end; + } + } + +end: + return item; +} + +OpenAPI_nf_group_list_cond_t *OpenAPI_nf_group_list_cond_parseFromJSON(cJSON *nf_group_list_condJSON) +{ + OpenAPI_nf_group_list_cond_t *nf_group_list_cond_local_var = NULL; + OpenAPI_lnode_t *node = NULL; + cJSON *condition_type = NULL; + OpenAPI_nf_group_list_cond_condition_type_e condition_typeVariable = 0; + cJSON *nf_type = NULL; + OpenAPI_nf_group_list_cond_nf_type_e nf_typeVariable = 0; + cJSON *nf_group_id_list = NULL; + OpenAPI_list_t *nf_group_id_listList = NULL; + condition_type = cJSON_GetObjectItemCaseSensitive(nf_group_list_condJSON, "conditionType"); + if (!condition_type) { + ogs_error("OpenAPI_nf_group_list_cond_parseFromJSON() failed [condition_type]"); + goto end; + } + if (!cJSON_IsString(condition_type)) { + ogs_error("OpenAPI_nf_group_list_cond_parseFromJSON() failed [condition_type]"); + goto end; + } + condition_typeVariable = OpenAPI_condition_typenf_group_list_cond_FromString(condition_type->valuestring); + + nf_type = cJSON_GetObjectItemCaseSensitive(nf_group_list_condJSON, "nfType"); + if (!nf_type) { + ogs_error("OpenAPI_nf_group_list_cond_parseFromJSON() failed [nf_type]"); + goto end; + } + if (!cJSON_IsString(nf_type)) { + ogs_error("OpenAPI_nf_group_list_cond_parseFromJSON() failed [nf_type]"); + goto end; + } + nf_typeVariable = OpenAPI_nf_typenf_group_list_cond_FromString(nf_type->valuestring); + + nf_group_id_list = cJSON_GetObjectItemCaseSensitive(nf_group_list_condJSON, "nfGroupIdList"); + if (!nf_group_id_list) { + ogs_error("OpenAPI_nf_group_list_cond_parseFromJSON() failed [nf_group_id_list]"); + goto end; + } + cJSON *nf_group_id_list_local = NULL; + if (!cJSON_IsArray(nf_group_id_list)) { + ogs_error("OpenAPI_nf_group_list_cond_parseFromJSON() failed [nf_group_id_list]"); + goto end; + } + + nf_group_id_listList = OpenAPI_list_create(); + + cJSON_ArrayForEach(nf_group_id_list_local, nf_group_id_list) { + double *localDouble = NULL; + int *localInt = NULL; + if (!cJSON_IsString(nf_group_id_list_local)) { + ogs_error("OpenAPI_nf_group_list_cond_parseFromJSON() failed [nf_group_id_list]"); + goto end; + } + OpenAPI_list_add(nf_group_id_listList, ogs_strdup(nf_group_id_list_local->valuestring)); + } + + nf_group_list_cond_local_var = OpenAPI_nf_group_list_cond_create ( + condition_typeVariable, + nf_typeVariable, + nf_group_id_listList + ); + + return nf_group_list_cond_local_var; +end: + if (nf_group_id_listList) { + OpenAPI_list_for_each(nf_group_id_listList, node) { + ogs_free(node->data); + } + OpenAPI_list_free(nf_group_id_listList); + nf_group_id_listList = NULL; + } + return NULL; +} + +OpenAPI_nf_group_list_cond_t *OpenAPI_nf_group_list_cond_copy(OpenAPI_nf_group_list_cond_t *dst, OpenAPI_nf_group_list_cond_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_nf_group_list_cond_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_nf_group_list_cond_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_nf_group_list_cond_free(dst); + dst = OpenAPI_nf_group_list_cond_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/nf_group_list_cond.h b/lib/sbi/openapi/model/nf_group_list_cond.h new file mode 100644 index 000000000..1a12f21e7 --- /dev/null +++ b/lib/sbi/openapi/model/nf_group_list_cond.h @@ -0,0 +1,52 @@ +/* + * nf_group_list_cond.h + * + * Subscription to a set of NFs based on their Group Ids + */ + +#ifndef _OpenAPI_nf_group_list_cond_H_ +#define _OpenAPI_nf_group_list_cond_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_nf_group_list_cond_s OpenAPI_nf_group_list_cond_t; +typedef enum { OpenAPI_nf_group_list_cond_CONDITIONTYPE_NULL = 0, OpenAPI_nf_group_list_cond_CONDITIONTYPE_NF_GROUP_LIST_COND } OpenAPI_nf_group_list_cond_condition_type_e; + +char* OpenAPI_nf_group_list_cond_condition_type_ToString(OpenAPI_nf_group_list_cond_condition_type_e condition_type); + +OpenAPI_nf_group_list_cond_condition_type_e OpenAPI_nf_group_list_cond_condition_type_FromString(char* condition_type); +typedef enum { OpenAPI_nf_group_list_cond_NFTYPE_NULL = 0, OpenAPI_nf_group_list_cond_NFTYPE_UDM, OpenAPI_nf_group_list_cond_NFTYPE_AUSF, OpenAPI_nf_group_list_cond_NFTYPE_UDR, OpenAPI_nf_group_list_cond_NFTYPE_PCF, OpenAPI_nf_group_list_cond_NFTYPE_CHF, OpenAPI_nf_group_list_cond_NFTYPE_HSS } OpenAPI_nf_group_list_cond_nf_type_e; + +char* OpenAPI_nf_group_list_cond_nf_type_ToString(OpenAPI_nf_group_list_cond_nf_type_e nf_type); + +OpenAPI_nf_group_list_cond_nf_type_e OpenAPI_nf_group_list_cond_nf_type_FromString(char* nf_type); +typedef struct OpenAPI_nf_group_list_cond_s { + OpenAPI_nf_group_list_cond_condition_type_e condition_type; + OpenAPI_nf_group_list_cond_nf_type_e nf_type; + OpenAPI_list_t *nf_group_id_list; +} OpenAPI_nf_group_list_cond_t; + +OpenAPI_nf_group_list_cond_t *OpenAPI_nf_group_list_cond_create( + OpenAPI_nf_group_list_cond_condition_type_e condition_type, + OpenAPI_nf_group_list_cond_nf_type_e nf_type, + OpenAPI_list_t *nf_group_id_list +); +void OpenAPI_nf_group_list_cond_free(OpenAPI_nf_group_list_cond_t *nf_group_list_cond); +OpenAPI_nf_group_list_cond_t *OpenAPI_nf_group_list_cond_parseFromJSON(cJSON *nf_group_list_condJSON); +cJSON *OpenAPI_nf_group_list_cond_convertToJSON(OpenAPI_nf_group_list_cond_t *nf_group_list_cond); +OpenAPI_nf_group_list_cond_t *OpenAPI_nf_group_list_cond_copy(OpenAPI_nf_group_list_cond_t *dst, OpenAPI_nf_group_list_cond_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_nf_group_list_cond_H_ */ + diff --git a/lib/sbi/openapi/model/nf_identifier.c b/lib/sbi/openapi/model/nf_identifier.c new file mode 100644 index 000000000..045a3710c --- /dev/null +++ b/lib/sbi/openapi/model/nf_identifier.c @@ -0,0 +1,135 @@ + +#include +#include +#include +#include "nf_identifier.h" + +OpenAPI_nf_identifier_t *OpenAPI_nf_identifier_create( + OpenAPI_nf_type_e nf_type, + char *nf_instance_id +) +{ + OpenAPI_nf_identifier_t *nf_identifier_local_var = ogs_malloc(sizeof(OpenAPI_nf_identifier_t)); + ogs_assert(nf_identifier_local_var); + + nf_identifier_local_var->nf_type = nf_type; + nf_identifier_local_var->nf_instance_id = nf_instance_id; + + return nf_identifier_local_var; +} + +void OpenAPI_nf_identifier_free(OpenAPI_nf_identifier_t *nf_identifier) +{ + OpenAPI_lnode_t *node = NULL; + + if (NULL == nf_identifier) { + return; + } + if (nf_identifier->nf_instance_id) { + ogs_free(nf_identifier->nf_instance_id); + nf_identifier->nf_instance_id = NULL; + } + ogs_free(nf_identifier); +} + +cJSON *OpenAPI_nf_identifier_convertToJSON(OpenAPI_nf_identifier_t *nf_identifier) +{ + cJSON *item = NULL; + OpenAPI_lnode_t *node = NULL; + + if (nf_identifier == NULL) { + ogs_error("OpenAPI_nf_identifier_convertToJSON() failed [NfIdentifier]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (nf_identifier->nf_type == OpenAPI_nf_type_NULL) { + ogs_error("OpenAPI_nf_identifier_convertToJSON() failed [nf_type]"); + return NULL; + } + if (cJSON_AddStringToObject(item, "nfType", OpenAPI_nf_type_ToString(nf_identifier->nf_type)) == NULL) { + ogs_error("OpenAPI_nf_identifier_convertToJSON() failed [nf_type]"); + goto end; + } + + if (nf_identifier->nf_instance_id) { + if (cJSON_AddStringToObject(item, "nfInstanceId", nf_identifier->nf_instance_id) == NULL) { + ogs_error("OpenAPI_nf_identifier_convertToJSON() failed [nf_instance_id]"); + goto end; + } + } + +end: + return item; +} + +OpenAPI_nf_identifier_t *OpenAPI_nf_identifier_parseFromJSON(cJSON *nf_identifierJSON) +{ + OpenAPI_nf_identifier_t *nf_identifier_local_var = NULL; + OpenAPI_lnode_t *node = NULL; + cJSON *nf_type = NULL; + OpenAPI_nf_type_e nf_typeVariable = 0; + cJSON *nf_instance_id = NULL; + nf_type = cJSON_GetObjectItemCaseSensitive(nf_identifierJSON, "nfType"); + if (!nf_type) { + ogs_error("OpenAPI_nf_identifier_parseFromJSON() failed [nf_type]"); + goto end; + } + if (!cJSON_IsString(nf_type)) { + ogs_error("OpenAPI_nf_identifier_parseFromJSON() failed [nf_type]"); + goto end; + } + nf_typeVariable = OpenAPI_nf_type_FromString(nf_type->valuestring); + + nf_instance_id = cJSON_GetObjectItemCaseSensitive(nf_identifierJSON, "nfInstanceId"); + if (nf_instance_id) { + if (!cJSON_IsString(nf_instance_id) && !cJSON_IsNull(nf_instance_id)) { + ogs_error("OpenAPI_nf_identifier_parseFromJSON() failed [nf_instance_id]"); + goto end; + } + } + + nf_identifier_local_var = OpenAPI_nf_identifier_create ( + nf_typeVariable, + nf_instance_id && !cJSON_IsNull(nf_instance_id) ? ogs_strdup(nf_instance_id->valuestring) : NULL + ); + + return nf_identifier_local_var; +end: + return NULL; +} + +OpenAPI_nf_identifier_t *OpenAPI_nf_identifier_copy(OpenAPI_nf_identifier_t *dst, OpenAPI_nf_identifier_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_nf_identifier_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_nf_identifier_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_nf_identifier_free(dst); + dst = OpenAPI_nf_identifier_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/nf_identifier.h b/lib/sbi/openapi/model/nf_identifier.h new file mode 100644 index 000000000..438d429e2 --- /dev/null +++ b/lib/sbi/openapi/model/nf_identifier.h @@ -0,0 +1,41 @@ +/* + * nf_identifier.h + * + * + */ + +#ifndef _OpenAPI_nf_identifier_H_ +#define _OpenAPI_nf_identifier_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "nf_type.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_nf_identifier_s OpenAPI_nf_identifier_t; +typedef struct OpenAPI_nf_identifier_s { + OpenAPI_nf_type_e nf_type; + char *nf_instance_id; +} OpenAPI_nf_identifier_t; + +OpenAPI_nf_identifier_t *OpenAPI_nf_identifier_create( + OpenAPI_nf_type_e nf_type, + char *nf_instance_id +); +void OpenAPI_nf_identifier_free(OpenAPI_nf_identifier_t *nf_identifier); +OpenAPI_nf_identifier_t *OpenAPI_nf_identifier_parseFromJSON(cJSON *nf_identifierJSON); +cJSON *OpenAPI_nf_identifier_convertToJSON(OpenAPI_nf_identifier_t *nf_identifier); +OpenAPI_nf_identifier_t *OpenAPI_nf_identifier_copy(OpenAPI_nf_identifier_t *dst, OpenAPI_nf_identifier_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_nf_identifier_H_ */ + diff --git a/lib/sbi/openapi/model/nf_instance_info.c b/lib/sbi/openapi/model/nf_instance_info.c new file mode 100644 index 000000000..7dc829799 --- /dev/null +++ b/lib/sbi/openapi/model/nf_instance_info.c @@ -0,0 +1,214 @@ + +#include +#include +#include +#include "nf_instance_info.h" + +OpenAPI_nf_instance_info_t *OpenAPI_nf_instance_info_create( + char *nrf_disc_api_uri, + OpenAPI_preferred_search_t *preferred_search, + OpenAPI_list_t* nrf_altered_priorities +) +{ + OpenAPI_nf_instance_info_t *nf_instance_info_local_var = ogs_malloc(sizeof(OpenAPI_nf_instance_info_t)); + ogs_assert(nf_instance_info_local_var); + + nf_instance_info_local_var->nrf_disc_api_uri = nrf_disc_api_uri; + nf_instance_info_local_var->preferred_search = preferred_search; + nf_instance_info_local_var->nrf_altered_priorities = nrf_altered_priorities; + + return nf_instance_info_local_var; +} + +void OpenAPI_nf_instance_info_free(OpenAPI_nf_instance_info_t *nf_instance_info) +{ + OpenAPI_lnode_t *node = NULL; + + if (NULL == nf_instance_info) { + return; + } + if (nf_instance_info->nrf_disc_api_uri) { + ogs_free(nf_instance_info->nrf_disc_api_uri); + nf_instance_info->nrf_disc_api_uri = NULL; + } + if (nf_instance_info->preferred_search) { + OpenAPI_preferred_search_free(nf_instance_info->preferred_search); + nf_instance_info->preferred_search = NULL; + } + if (nf_instance_info->nrf_altered_priorities) { + OpenAPI_list_for_each(nf_instance_info->nrf_altered_priorities, node) { + OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*)node->data; + ogs_free(localKeyValue->key); + ogs_free(localKeyValue->value); + OpenAPI_map_free(localKeyValue); + } + OpenAPI_list_free(nf_instance_info->nrf_altered_priorities); + nf_instance_info->nrf_altered_priorities = NULL; + } + ogs_free(nf_instance_info); +} + +cJSON *OpenAPI_nf_instance_info_convertToJSON(OpenAPI_nf_instance_info_t *nf_instance_info) +{ + cJSON *item = NULL; + OpenAPI_lnode_t *node = NULL; + + if (nf_instance_info == NULL) { + ogs_error("OpenAPI_nf_instance_info_convertToJSON() failed [NfInstanceInfo]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (nf_instance_info->nrf_disc_api_uri) { + if (cJSON_AddStringToObject(item, "nrfDiscApiUri", nf_instance_info->nrf_disc_api_uri) == NULL) { + ogs_error("OpenAPI_nf_instance_info_convertToJSON() failed [nrf_disc_api_uri]"); + goto end; + } + } + + if (nf_instance_info->preferred_search) { + cJSON *preferred_search_local_JSON = OpenAPI_preferred_search_convertToJSON(nf_instance_info->preferred_search); + if (preferred_search_local_JSON == NULL) { + ogs_error("OpenAPI_nf_instance_info_convertToJSON() failed [preferred_search]"); + goto end; + } + cJSON_AddItemToObject(item, "preferredSearch", preferred_search_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_nf_instance_info_convertToJSON() failed [preferred_search]"); + goto end; + } + } + + if (nf_instance_info->nrf_altered_priorities) { + cJSON *nrf_altered_priorities = cJSON_AddObjectToObject(item, "nrfAlteredPriorities"); + if (nrf_altered_priorities == NULL) { + ogs_error("OpenAPI_nf_instance_info_convertToJSON() failed [nrf_altered_priorities]"); + goto end; + } + cJSON *localMapObject = nrf_altered_priorities; + if (nf_instance_info->nrf_altered_priorities) { + OpenAPI_list_for_each(nf_instance_info->nrf_altered_priorities, node) { + OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*)node->data; + if (cJSON_AddNumberToObject(localMapObject, localKeyValue->key, (uintptr_t)localKeyValue->value) == NULL) { + ogs_error("OpenAPI_nf_instance_info_convertToJSON() failed [inner]"); + goto end; + } + } + } + } + +end: + return item; +} + +OpenAPI_nf_instance_info_t *OpenAPI_nf_instance_info_parseFromJSON(cJSON *nf_instance_infoJSON) +{ + OpenAPI_nf_instance_info_t *nf_instance_info_local_var = NULL; + OpenAPI_lnode_t *node = NULL; + cJSON *nrf_disc_api_uri = NULL; + cJSON *preferred_search = NULL; + OpenAPI_preferred_search_t *preferred_search_local_nonprim = NULL; + cJSON *nrf_altered_priorities = NULL; + OpenAPI_list_t *nrf_altered_prioritiesList = NULL; + nrf_disc_api_uri = cJSON_GetObjectItemCaseSensitive(nf_instance_infoJSON, "nrfDiscApiUri"); + if (nrf_disc_api_uri) { + if (!cJSON_IsString(nrf_disc_api_uri) && !cJSON_IsNull(nrf_disc_api_uri)) { + ogs_error("OpenAPI_nf_instance_info_parseFromJSON() failed [nrf_disc_api_uri]"); + goto end; + } + } + + preferred_search = cJSON_GetObjectItemCaseSensitive(nf_instance_infoJSON, "preferredSearch"); + if (preferred_search) { + preferred_search_local_nonprim = OpenAPI_preferred_search_parseFromJSON(preferred_search); + } + + nrf_altered_priorities = cJSON_GetObjectItemCaseSensitive(nf_instance_infoJSON, "nrfAlteredPriorities"); + if (nrf_altered_priorities) { + cJSON *nrf_altered_priorities_local_map = NULL; + if (!cJSON_IsObject(nrf_altered_priorities) && !cJSON_IsNull(nrf_altered_priorities)) { + ogs_error("OpenAPI_nf_instance_info_parseFromJSON() failed [nrf_altered_priorities]"); + goto end; + } + if (cJSON_IsObject(nrf_altered_priorities)) { + nrf_altered_prioritiesList = OpenAPI_list_create(); + OpenAPI_map_t *localMapKeyPair = NULL; + cJSON_ArrayForEach(nrf_altered_priorities_local_map, nrf_altered_priorities) { + cJSON *localMapObject = nrf_altered_priorities_local_map; + double *localDouble = NULL; + int *localInt = NULL; + if (!cJSON_IsNumber(localMapObject)) { + ogs_error("OpenAPI_nf_instance_info_parseFromJSON() failed [inner]"); + goto end; + } + localDouble = (double *)ogs_calloc(1, sizeof(double)); + if (!localDouble) { + ogs_error("OpenAPI_nf_instance_info_parseFromJSON() failed [inner]"); + goto end; + } + *localDouble = localMapObject->valuedouble; + localMapKeyPair = OpenAPI_map_create(ogs_strdup(localMapObject->string), localDouble); + OpenAPI_list_add(nrf_altered_prioritiesList, localMapKeyPair); + } + } + } + + nf_instance_info_local_var = OpenAPI_nf_instance_info_create ( + nrf_disc_api_uri && !cJSON_IsNull(nrf_disc_api_uri) ? ogs_strdup(nrf_disc_api_uri->valuestring) : NULL, + preferred_search ? preferred_search_local_nonprim : NULL, + nrf_altered_priorities ? nrf_altered_prioritiesList : NULL + ); + + return nf_instance_info_local_var; +end: + if (preferred_search_local_nonprim) { + OpenAPI_preferred_search_free(preferred_search_local_nonprim); + preferred_search_local_nonprim = NULL; + } + if (nrf_altered_prioritiesList) { + OpenAPI_list_for_each(nrf_altered_prioritiesList, node) { + OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*) node->data; + ogs_free(localKeyValue->key); + ogs_free(localKeyValue->value); + OpenAPI_map_free(localKeyValue); + } + OpenAPI_list_free(nrf_altered_prioritiesList); + nrf_altered_prioritiesList = NULL; + } + return NULL; +} + +OpenAPI_nf_instance_info_t *OpenAPI_nf_instance_info_copy(OpenAPI_nf_instance_info_t *dst, OpenAPI_nf_instance_info_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_nf_instance_info_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_nf_instance_info_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_nf_instance_info_free(dst); + dst = OpenAPI_nf_instance_info_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/nf_instance_info.h b/lib/sbi/openapi/model/nf_instance_info.h new file mode 100644 index 000000000..9e99dcb60 --- /dev/null +++ b/lib/sbi/openapi/model/nf_instance_info.h @@ -0,0 +1,43 @@ +/* + * nf_instance_info.h + * + * Contains information on an NF profile matching a discovery request + */ + +#ifndef _OpenAPI_nf_instance_info_H_ +#define _OpenAPI_nf_instance_info_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "preferred_search.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_nf_instance_info_s OpenAPI_nf_instance_info_t; +typedef struct OpenAPI_nf_instance_info_s { + char *nrf_disc_api_uri; + struct OpenAPI_preferred_search_s *preferred_search; + OpenAPI_list_t* nrf_altered_priorities; +} OpenAPI_nf_instance_info_t; + +OpenAPI_nf_instance_info_t *OpenAPI_nf_instance_info_create( + char *nrf_disc_api_uri, + OpenAPI_preferred_search_t *preferred_search, + OpenAPI_list_t* nrf_altered_priorities +); +void OpenAPI_nf_instance_info_free(OpenAPI_nf_instance_info_t *nf_instance_info); +OpenAPI_nf_instance_info_t *OpenAPI_nf_instance_info_parseFromJSON(cJSON *nf_instance_infoJSON); +cJSON *OpenAPI_nf_instance_info_convertToJSON(OpenAPI_nf_instance_info_t *nf_instance_info); +OpenAPI_nf_instance_info_t *OpenAPI_nf_instance_info_copy(OpenAPI_nf_instance_info_t *dst, OpenAPI_nf_instance_info_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_nf_instance_info_H_ */ + diff --git a/lib/sbi/openapi/model/nf_load_level_information.c b/lib/sbi/openapi/model/nf_load_level_information.c new file mode 100644 index 000000000..04b9b1510 --- /dev/null +++ b/lib/sbi/openapi/model/nf_load_level_information.c @@ -0,0 +1,370 @@ + +#include +#include +#include +#include "nf_load_level_information.h" + +OpenAPI_nf_load_level_information_t *OpenAPI_nf_load_level_information_create( + OpenAPI_nf_type_e nf_type, + char *nf_instance_id, + char *nf_set_id, + OpenAPI_nnwdaf_nf_status_t *nf_status, + bool is_nf_cpu_usage, + int nf_cpu_usage, + bool is_nf_memory_usage, + int nf_memory_usage, + bool is_nf_storage_usage, + int nf_storage_usage, + bool is_nf_load_level_average, + int nf_load_level_average, + bool is_nf_load_levelpeak, + int nf_load_levelpeak, + bool is_nf_load_avg_in_aoi, + int nf_load_avg_in_aoi, + OpenAPI_snssai_t *snssai, + bool is_confidence, + int confidence +) +{ + OpenAPI_nf_load_level_information_t *nf_load_level_information_local_var = ogs_malloc(sizeof(OpenAPI_nf_load_level_information_t)); + ogs_assert(nf_load_level_information_local_var); + + nf_load_level_information_local_var->nf_type = nf_type; + nf_load_level_information_local_var->nf_instance_id = nf_instance_id; + nf_load_level_information_local_var->nf_set_id = nf_set_id; + nf_load_level_information_local_var->nf_status = nf_status; + nf_load_level_information_local_var->is_nf_cpu_usage = is_nf_cpu_usage; + nf_load_level_information_local_var->nf_cpu_usage = nf_cpu_usage; + nf_load_level_information_local_var->is_nf_memory_usage = is_nf_memory_usage; + nf_load_level_information_local_var->nf_memory_usage = nf_memory_usage; + nf_load_level_information_local_var->is_nf_storage_usage = is_nf_storage_usage; + nf_load_level_information_local_var->nf_storage_usage = nf_storage_usage; + nf_load_level_information_local_var->is_nf_load_level_average = is_nf_load_level_average; + nf_load_level_information_local_var->nf_load_level_average = nf_load_level_average; + nf_load_level_information_local_var->is_nf_load_levelpeak = is_nf_load_levelpeak; + nf_load_level_information_local_var->nf_load_levelpeak = nf_load_levelpeak; + nf_load_level_information_local_var->is_nf_load_avg_in_aoi = is_nf_load_avg_in_aoi; + nf_load_level_information_local_var->nf_load_avg_in_aoi = nf_load_avg_in_aoi; + nf_load_level_information_local_var->snssai = snssai; + nf_load_level_information_local_var->is_confidence = is_confidence; + nf_load_level_information_local_var->confidence = confidence; + + return nf_load_level_information_local_var; +} + +void OpenAPI_nf_load_level_information_free(OpenAPI_nf_load_level_information_t *nf_load_level_information) +{ + OpenAPI_lnode_t *node = NULL; + + if (NULL == nf_load_level_information) { + return; + } + if (nf_load_level_information->nf_instance_id) { + ogs_free(nf_load_level_information->nf_instance_id); + nf_load_level_information->nf_instance_id = NULL; + } + if (nf_load_level_information->nf_set_id) { + ogs_free(nf_load_level_information->nf_set_id); + nf_load_level_information->nf_set_id = NULL; + } + if (nf_load_level_information->nf_status) { + OpenAPI_nnwdaf_nf_status_free(nf_load_level_information->nf_status); + nf_load_level_information->nf_status = NULL; + } + if (nf_load_level_information->snssai) { + OpenAPI_snssai_free(nf_load_level_information->snssai); + nf_load_level_information->snssai = NULL; + } + ogs_free(nf_load_level_information); +} + +cJSON *OpenAPI_nf_load_level_information_convertToJSON(OpenAPI_nf_load_level_information_t *nf_load_level_information) +{ + cJSON *item = NULL; + OpenAPI_lnode_t *node = NULL; + + if (nf_load_level_information == NULL) { + ogs_error("OpenAPI_nf_load_level_information_convertToJSON() failed [NfLoadLevelInformation]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (nf_load_level_information->nf_type != OpenAPI_nf_type_NULL) { + if (cJSON_AddStringToObject(item, "nfType", OpenAPI_nf_type_ToString(nf_load_level_information->nf_type)) == NULL) { + ogs_error("OpenAPI_nf_load_level_information_convertToJSON() failed [nf_type]"); + goto end; + } + } + + if (nf_load_level_information->nf_instance_id) { + if (cJSON_AddStringToObject(item, "nfInstanceId", nf_load_level_information->nf_instance_id) == NULL) { + ogs_error("OpenAPI_nf_load_level_information_convertToJSON() failed [nf_instance_id]"); + goto end; + } + } + + if (nf_load_level_information->nf_set_id) { + if (cJSON_AddStringToObject(item, "nfSetId", nf_load_level_information->nf_set_id) == NULL) { + ogs_error("OpenAPI_nf_load_level_information_convertToJSON() failed [nf_set_id]"); + goto end; + } + } + + if (nf_load_level_information->nf_status) { + cJSON *nf_status_local_JSON = OpenAPI_nnwdaf_nf_status_convertToJSON(nf_load_level_information->nf_status); + if (nf_status_local_JSON == NULL) { + ogs_error("OpenAPI_nf_load_level_information_convertToJSON() failed [nf_status]"); + goto end; + } + cJSON_AddItemToObject(item, "nfStatus", nf_status_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_nf_load_level_information_convertToJSON() failed [nf_status]"); + goto end; + } + } + + if (nf_load_level_information->is_nf_cpu_usage) { + if (cJSON_AddNumberToObject(item, "nfCpuUsage", nf_load_level_information->nf_cpu_usage) == NULL) { + ogs_error("OpenAPI_nf_load_level_information_convertToJSON() failed [nf_cpu_usage]"); + goto end; + } + } + + if (nf_load_level_information->is_nf_memory_usage) { + if (cJSON_AddNumberToObject(item, "nfMemoryUsage", nf_load_level_information->nf_memory_usage) == NULL) { + ogs_error("OpenAPI_nf_load_level_information_convertToJSON() failed [nf_memory_usage]"); + goto end; + } + } + + if (nf_load_level_information->is_nf_storage_usage) { + if (cJSON_AddNumberToObject(item, "nfStorageUsage", nf_load_level_information->nf_storage_usage) == NULL) { + ogs_error("OpenAPI_nf_load_level_information_convertToJSON() failed [nf_storage_usage]"); + goto end; + } + } + + if (nf_load_level_information->is_nf_load_level_average) { + if (cJSON_AddNumberToObject(item, "nfLoadLevelAverage", nf_load_level_information->nf_load_level_average) == NULL) { + ogs_error("OpenAPI_nf_load_level_information_convertToJSON() failed [nf_load_level_average]"); + goto end; + } + } + + if (nf_load_level_information->is_nf_load_levelpeak) { + if (cJSON_AddNumberToObject(item, "nfLoadLevelpeak", nf_load_level_information->nf_load_levelpeak) == NULL) { + ogs_error("OpenAPI_nf_load_level_information_convertToJSON() failed [nf_load_levelpeak]"); + goto end; + } + } + + if (nf_load_level_information->is_nf_load_avg_in_aoi) { + if (cJSON_AddNumberToObject(item, "nfLoadAvgInAoi", nf_load_level_information->nf_load_avg_in_aoi) == NULL) { + ogs_error("OpenAPI_nf_load_level_information_convertToJSON() failed [nf_load_avg_in_aoi]"); + goto end; + } + } + + if (nf_load_level_information->snssai) { + cJSON *snssai_local_JSON = OpenAPI_snssai_convertToJSON(nf_load_level_information->snssai); + if (snssai_local_JSON == NULL) { + ogs_error("OpenAPI_nf_load_level_information_convertToJSON() failed [snssai]"); + goto end; + } + cJSON_AddItemToObject(item, "snssai", snssai_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_nf_load_level_information_convertToJSON() failed [snssai]"); + goto end; + } + } + + if (nf_load_level_information->is_confidence) { + if (cJSON_AddNumberToObject(item, "confidence", nf_load_level_information->confidence) == NULL) { + ogs_error("OpenAPI_nf_load_level_information_convertToJSON() failed [confidence]"); + goto end; + } + } + +end: + return item; +} + +OpenAPI_nf_load_level_information_t *OpenAPI_nf_load_level_information_parseFromJSON(cJSON *nf_load_level_informationJSON) +{ + OpenAPI_nf_load_level_information_t *nf_load_level_information_local_var = NULL; + OpenAPI_lnode_t *node = NULL; + cJSON *nf_type = NULL; + OpenAPI_nf_type_e nf_typeVariable = 0; + cJSON *nf_instance_id = NULL; + cJSON *nf_set_id = NULL; + cJSON *nf_status = NULL; + OpenAPI_nnwdaf_nf_status_t *nf_status_local_nonprim = NULL; + cJSON *nf_cpu_usage = NULL; + cJSON *nf_memory_usage = NULL; + cJSON *nf_storage_usage = NULL; + cJSON *nf_load_level_average = NULL; + cJSON *nf_load_levelpeak = NULL; + cJSON *nf_load_avg_in_aoi = NULL; + cJSON *snssai = NULL; + OpenAPI_snssai_t *snssai_local_nonprim = NULL; + cJSON *confidence = NULL; + nf_type = cJSON_GetObjectItemCaseSensitive(nf_load_level_informationJSON, "nfType"); + if (nf_type) { + if (!cJSON_IsString(nf_type)) { + ogs_error("OpenAPI_nf_load_level_information_parseFromJSON() failed [nf_type]"); + goto end; + } + nf_typeVariable = OpenAPI_nf_type_FromString(nf_type->valuestring); + } + + nf_instance_id = cJSON_GetObjectItemCaseSensitive(nf_load_level_informationJSON, "nfInstanceId"); + if (nf_instance_id) { + if (!cJSON_IsString(nf_instance_id) && !cJSON_IsNull(nf_instance_id)) { + ogs_error("OpenAPI_nf_load_level_information_parseFromJSON() failed [nf_instance_id]"); + goto end; + } + } + + nf_set_id = cJSON_GetObjectItemCaseSensitive(nf_load_level_informationJSON, "nfSetId"); + if (nf_set_id) { + if (!cJSON_IsString(nf_set_id) && !cJSON_IsNull(nf_set_id)) { + ogs_error("OpenAPI_nf_load_level_information_parseFromJSON() failed [nf_set_id]"); + goto end; + } + } + + nf_status = cJSON_GetObjectItemCaseSensitive(nf_load_level_informationJSON, "nfStatus"); + if (nf_status) { + nf_status_local_nonprim = OpenAPI_nnwdaf_nf_status_parseFromJSON(nf_status); + } + + nf_cpu_usage = cJSON_GetObjectItemCaseSensitive(nf_load_level_informationJSON, "nfCpuUsage"); + if (nf_cpu_usage) { + if (!cJSON_IsNumber(nf_cpu_usage)) { + ogs_error("OpenAPI_nf_load_level_information_parseFromJSON() failed [nf_cpu_usage]"); + goto end; + } + } + + nf_memory_usage = cJSON_GetObjectItemCaseSensitive(nf_load_level_informationJSON, "nfMemoryUsage"); + if (nf_memory_usage) { + if (!cJSON_IsNumber(nf_memory_usage)) { + ogs_error("OpenAPI_nf_load_level_information_parseFromJSON() failed [nf_memory_usage]"); + goto end; + } + } + + nf_storage_usage = cJSON_GetObjectItemCaseSensitive(nf_load_level_informationJSON, "nfStorageUsage"); + if (nf_storage_usage) { + if (!cJSON_IsNumber(nf_storage_usage)) { + ogs_error("OpenAPI_nf_load_level_information_parseFromJSON() failed [nf_storage_usage]"); + goto end; + } + } + + nf_load_level_average = cJSON_GetObjectItemCaseSensitive(nf_load_level_informationJSON, "nfLoadLevelAverage"); + if (nf_load_level_average) { + if (!cJSON_IsNumber(nf_load_level_average)) { + ogs_error("OpenAPI_nf_load_level_information_parseFromJSON() failed [nf_load_level_average]"); + goto end; + } + } + + nf_load_levelpeak = cJSON_GetObjectItemCaseSensitive(nf_load_level_informationJSON, "nfLoadLevelpeak"); + if (nf_load_levelpeak) { + if (!cJSON_IsNumber(nf_load_levelpeak)) { + ogs_error("OpenAPI_nf_load_level_information_parseFromJSON() failed [nf_load_levelpeak]"); + goto end; + } + } + + nf_load_avg_in_aoi = cJSON_GetObjectItemCaseSensitive(nf_load_level_informationJSON, "nfLoadAvgInAoi"); + if (nf_load_avg_in_aoi) { + if (!cJSON_IsNumber(nf_load_avg_in_aoi)) { + ogs_error("OpenAPI_nf_load_level_information_parseFromJSON() failed [nf_load_avg_in_aoi]"); + goto end; + } + } + + snssai = cJSON_GetObjectItemCaseSensitive(nf_load_level_informationJSON, "snssai"); + if (snssai) { + snssai_local_nonprim = OpenAPI_snssai_parseFromJSON(snssai); + } + + confidence = cJSON_GetObjectItemCaseSensitive(nf_load_level_informationJSON, "confidence"); + if (confidence) { + if (!cJSON_IsNumber(confidence)) { + ogs_error("OpenAPI_nf_load_level_information_parseFromJSON() failed [confidence]"); + goto end; + } + } + + nf_load_level_information_local_var = OpenAPI_nf_load_level_information_create ( + nf_type ? nf_typeVariable : 0, + nf_instance_id && !cJSON_IsNull(nf_instance_id) ? ogs_strdup(nf_instance_id->valuestring) : NULL, + nf_set_id && !cJSON_IsNull(nf_set_id) ? ogs_strdup(nf_set_id->valuestring) : NULL, + nf_status ? nf_status_local_nonprim : NULL, + nf_cpu_usage ? true : false, + nf_cpu_usage ? nf_cpu_usage->valuedouble : 0, + nf_memory_usage ? true : false, + nf_memory_usage ? nf_memory_usage->valuedouble : 0, + nf_storage_usage ? true : false, + nf_storage_usage ? nf_storage_usage->valuedouble : 0, + nf_load_level_average ? true : false, + nf_load_level_average ? nf_load_level_average->valuedouble : 0, + nf_load_levelpeak ? true : false, + nf_load_levelpeak ? nf_load_levelpeak->valuedouble : 0, + nf_load_avg_in_aoi ? true : false, + nf_load_avg_in_aoi ? nf_load_avg_in_aoi->valuedouble : 0, + snssai ? snssai_local_nonprim : NULL, + confidence ? true : false, + confidence ? confidence->valuedouble : 0 + ); + + return nf_load_level_information_local_var; +end: + if (nf_status_local_nonprim) { + OpenAPI_nnwdaf_nf_status_free(nf_status_local_nonprim); + nf_status_local_nonprim = NULL; + } + if (snssai_local_nonprim) { + OpenAPI_snssai_free(snssai_local_nonprim); + snssai_local_nonprim = NULL; + } + return NULL; +} + +OpenAPI_nf_load_level_information_t *OpenAPI_nf_load_level_information_copy(OpenAPI_nf_load_level_information_t *dst, OpenAPI_nf_load_level_information_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_nf_load_level_information_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_nf_load_level_information_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_nf_load_level_information_free(dst); + dst = OpenAPI_nf_load_level_information_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/nf_load_level_information.h b/lib/sbi/openapi/model/nf_load_level_information.h new file mode 100644 index 000000000..a9f3e4d5e --- /dev/null +++ b/lib/sbi/openapi/model/nf_load_level_information.h @@ -0,0 +1,77 @@ +/* + * nf_load_level_information.h + * + * Represents load level information of a given NF instance. + */ + +#ifndef _OpenAPI_nf_load_level_information_H_ +#define _OpenAPI_nf_load_level_information_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "nf_type.h" +#include "nnwdaf_nf_status.h" +#include "snssai.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_nf_load_level_information_s OpenAPI_nf_load_level_information_t; +typedef struct OpenAPI_nf_load_level_information_s { + OpenAPI_nf_type_e nf_type; + char *nf_instance_id; + char *nf_set_id; + struct OpenAPI_nnwdaf_nf_status_s *nf_status; + bool is_nf_cpu_usage; + int nf_cpu_usage; + bool is_nf_memory_usage; + int nf_memory_usage; + bool is_nf_storage_usage; + int nf_storage_usage; + bool is_nf_load_level_average; + int nf_load_level_average; + bool is_nf_load_levelpeak; + int nf_load_levelpeak; + bool is_nf_load_avg_in_aoi; + int nf_load_avg_in_aoi; + struct OpenAPI_snssai_s *snssai; + bool is_confidence; + int confidence; +} OpenAPI_nf_load_level_information_t; + +OpenAPI_nf_load_level_information_t *OpenAPI_nf_load_level_information_create( + OpenAPI_nf_type_e nf_type, + char *nf_instance_id, + char *nf_set_id, + OpenAPI_nnwdaf_nf_status_t *nf_status, + bool is_nf_cpu_usage, + int nf_cpu_usage, + bool is_nf_memory_usage, + int nf_memory_usage, + bool is_nf_storage_usage, + int nf_storage_usage, + bool is_nf_load_level_average, + int nf_load_level_average, + bool is_nf_load_levelpeak, + int nf_load_levelpeak, + bool is_nf_load_avg_in_aoi, + int nf_load_avg_in_aoi, + OpenAPI_snssai_t *snssai, + bool is_confidence, + int confidence +); +void OpenAPI_nf_load_level_information_free(OpenAPI_nf_load_level_information_t *nf_load_level_information); +OpenAPI_nf_load_level_information_t *OpenAPI_nf_load_level_information_parseFromJSON(cJSON *nf_load_level_informationJSON); +cJSON *OpenAPI_nf_load_level_information_convertToJSON(OpenAPI_nf_load_level_information_t *nf_load_level_information); +OpenAPI_nf_load_level_information_t *OpenAPI_nf_load_level_information_copy(OpenAPI_nf_load_level_information_t *dst, OpenAPI_nf_load_level_information_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_nf_load_level_information_H_ */ + diff --git a/lib/sbi/openapi/model/nf_profile.c b/lib/sbi/openapi/model/nf_profile.c index 67e877acc..74e5639e7 100644 --- a/lib/sbi/openapi/model/nf_profile.c +++ b/lib/sbi/openapi/model/nf_profile.c @@ -9,6 +9,7 @@ OpenAPI_nf_profile_t *OpenAPI_nf_profile_create( char *nf_instance_name, OpenAPI_nf_type_e nf_type, OpenAPI_nf_status_e nf_status, + OpenAPI_list_t *collocated_nf_instances, bool is_heart_beat_timer, int heart_beat_timer, OpenAPI_list_t *plmn_list, @@ -56,6 +57,7 @@ OpenAPI_nf_profile_t *OpenAPI_nf_profile_create( OpenAPI_udsf_info_t *udsf_info, OpenAPI_list_t* udsf_info_list, OpenAPI_nwdaf_info_t *nwdaf_info, + OpenAPI_list_t* nwdaf_info_list, OpenAPI_list_t* pcscf_info_list, OpenAPI_list_t* hss_info_list, OpenAPI_object_t *custom_info, @@ -80,7 +82,24 @@ OpenAPI_nf_profile_t *OpenAPI_nf_profile_create( OpenAPI_list_t* nf_set_recovery_time_list, OpenAPI_list_t* service_set_recovery_time_list, OpenAPI_list_t *scp_domains, - OpenAPI_scp_info_t *scp_info + OpenAPI_scp_info_t *scp_info, + OpenAPI_sepp_info_t *sepp_info, + char *vendor_id, + OpenAPI_list_t* supported_vendor_specific_features, + OpenAPI_list_t* aanf_info_list, + OpenAPI_model_5_g_ddnmf_info_t *_5g_ddnmf_info, + OpenAPI_mfaf_info_t *mfaf_info, + OpenAPI_list_t* easdf_info_list, + OpenAPI_dccf_info_t *dccf_info, + OpenAPI_list_t* nsacf_info_list, + OpenAPI_list_t* mb_smf_info_list, + OpenAPI_list_t* tsctsf_info_list, + OpenAPI_list_t* mb_upf_info_list, + OpenAPI_trust_af_info_t *trust_af_info, + OpenAPI_nssaaf_info_t *nssaaf_info, + OpenAPI_list_t *hni_list, + OpenAPI_iwmsc_info_t *iwmsc_info, + OpenAPI_mnpf_info_t *mnpf_info ) { OpenAPI_nf_profile_t *nf_profile_local_var = ogs_malloc(sizeof(OpenAPI_nf_profile_t)); @@ -90,6 +109,7 @@ OpenAPI_nf_profile_t *OpenAPI_nf_profile_create( nf_profile_local_var->nf_instance_name = nf_instance_name; nf_profile_local_var->nf_type = nf_type; nf_profile_local_var->nf_status = nf_status; + nf_profile_local_var->collocated_nf_instances = collocated_nf_instances; nf_profile_local_var->is_heart_beat_timer = is_heart_beat_timer; nf_profile_local_var->heart_beat_timer = heart_beat_timer; nf_profile_local_var->plmn_list = plmn_list; @@ -137,6 +157,7 @@ OpenAPI_nf_profile_t *OpenAPI_nf_profile_create( nf_profile_local_var->udsf_info = udsf_info; nf_profile_local_var->udsf_info_list = udsf_info_list; nf_profile_local_var->nwdaf_info = nwdaf_info; + nf_profile_local_var->nwdaf_info_list = nwdaf_info_list; nf_profile_local_var->pcscf_info_list = pcscf_info_list; nf_profile_local_var->hss_info_list = hss_info_list; nf_profile_local_var->custom_info = custom_info; @@ -162,6 +183,23 @@ OpenAPI_nf_profile_t *OpenAPI_nf_profile_create( nf_profile_local_var->service_set_recovery_time_list = service_set_recovery_time_list; nf_profile_local_var->scp_domains = scp_domains; nf_profile_local_var->scp_info = scp_info; + nf_profile_local_var->sepp_info = sepp_info; + nf_profile_local_var->vendor_id = vendor_id; + nf_profile_local_var->supported_vendor_specific_features = supported_vendor_specific_features; + nf_profile_local_var->aanf_info_list = aanf_info_list; + nf_profile_local_var->_5g_ddnmf_info = _5g_ddnmf_info; + nf_profile_local_var->mfaf_info = mfaf_info; + nf_profile_local_var->easdf_info_list = easdf_info_list; + nf_profile_local_var->dccf_info = dccf_info; + nf_profile_local_var->nsacf_info_list = nsacf_info_list; + nf_profile_local_var->mb_smf_info_list = mb_smf_info_list; + nf_profile_local_var->tsctsf_info_list = tsctsf_info_list; + nf_profile_local_var->mb_upf_info_list = mb_upf_info_list; + nf_profile_local_var->trust_af_info = trust_af_info; + nf_profile_local_var->nssaaf_info = nssaaf_info; + nf_profile_local_var->hni_list = hni_list; + nf_profile_local_var->iwmsc_info = iwmsc_info; + nf_profile_local_var->mnpf_info = mnpf_info; return nf_profile_local_var; } @@ -181,6 +219,13 @@ void OpenAPI_nf_profile_free(OpenAPI_nf_profile_t *nf_profile) ogs_free(nf_profile->nf_instance_name); nf_profile->nf_instance_name = NULL; } + if (nf_profile->collocated_nf_instances) { + OpenAPI_list_for_each(nf_profile->collocated_nf_instances, node) { + OpenAPI_collocated_nf_instance_free(node->data); + } + OpenAPI_list_free(nf_profile->collocated_nf_instances); + nf_profile->collocated_nf_instances = NULL; + } if (nf_profile->plmn_list) { OpenAPI_list_for_each(nf_profile->plmn_list, node) { OpenAPI_plmn_id_free(node->data); @@ -430,6 +475,16 @@ void OpenAPI_nf_profile_free(OpenAPI_nf_profile_t *nf_profile) OpenAPI_nwdaf_info_free(nf_profile->nwdaf_info); nf_profile->nwdaf_info = NULL; } + if (nf_profile->nwdaf_info_list) { + OpenAPI_list_for_each(nf_profile->nwdaf_info_list, node) { + OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*)node->data; + ogs_free(localKeyValue->key); + OpenAPI_nwdaf_info_free(localKeyValue->value); + OpenAPI_map_free(localKeyValue); + } + OpenAPI_list_free(nf_profile->nwdaf_info_list); + nf_profile->nwdaf_info_list = NULL; + } if (nf_profile->pcscf_info_list) { OpenAPI_list_for_each(nf_profile->pcscf_info_list, node) { OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*)node->data; @@ -535,6 +590,119 @@ void OpenAPI_nf_profile_free(OpenAPI_nf_profile_t *nf_profile) OpenAPI_scp_info_free(nf_profile->scp_info); nf_profile->scp_info = NULL; } + if (nf_profile->sepp_info) { + OpenAPI_sepp_info_free(nf_profile->sepp_info); + nf_profile->sepp_info = NULL; + } + if (nf_profile->vendor_id) { + ogs_free(nf_profile->vendor_id); + nf_profile->vendor_id = NULL; + } + if (nf_profile->supported_vendor_specific_features) { + OpenAPI_list_for_each(nf_profile->supported_vendor_specific_features, node) { + OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*)node->data; + ogs_free(localKeyValue->key); + ogs_free(localKeyValue->value); + OpenAPI_map_free(localKeyValue); + } + OpenAPI_list_free(nf_profile->supported_vendor_specific_features); + nf_profile->supported_vendor_specific_features = NULL; + } + if (nf_profile->aanf_info_list) { + OpenAPI_list_for_each(nf_profile->aanf_info_list, node) { + OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*)node->data; + ogs_free(localKeyValue->key); + OpenAPI_aanf_info_free(localKeyValue->value); + OpenAPI_map_free(localKeyValue); + } + OpenAPI_list_free(nf_profile->aanf_info_list); + nf_profile->aanf_info_list = NULL; + } + if (nf_profile->_5g_ddnmf_info) { + OpenAPI_model_5_g_ddnmf_info_free(nf_profile->_5g_ddnmf_info); + nf_profile->_5g_ddnmf_info = NULL; + } + if (nf_profile->mfaf_info) { + OpenAPI_mfaf_info_free(nf_profile->mfaf_info); + nf_profile->mfaf_info = NULL; + } + if (nf_profile->easdf_info_list) { + OpenAPI_list_for_each(nf_profile->easdf_info_list, node) { + OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*)node->data; + ogs_free(localKeyValue->key); + OpenAPI_easdf_info_free(localKeyValue->value); + OpenAPI_map_free(localKeyValue); + } + OpenAPI_list_free(nf_profile->easdf_info_list); + nf_profile->easdf_info_list = NULL; + } + if (nf_profile->dccf_info) { + OpenAPI_dccf_info_free(nf_profile->dccf_info); + nf_profile->dccf_info = NULL; + } + if (nf_profile->nsacf_info_list) { + OpenAPI_list_for_each(nf_profile->nsacf_info_list, node) { + OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*)node->data; + ogs_free(localKeyValue->key); + OpenAPI_nsacf_info_free(localKeyValue->value); + OpenAPI_map_free(localKeyValue); + } + OpenAPI_list_free(nf_profile->nsacf_info_list); + nf_profile->nsacf_info_list = NULL; + } + if (nf_profile->mb_smf_info_list) { + OpenAPI_list_for_each(nf_profile->mb_smf_info_list, node) { + OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*)node->data; + ogs_free(localKeyValue->key); + OpenAPI_mb_smf_info_free(localKeyValue->value); + OpenAPI_map_free(localKeyValue); + } + OpenAPI_list_free(nf_profile->mb_smf_info_list); + nf_profile->mb_smf_info_list = NULL; + } + if (nf_profile->tsctsf_info_list) { + OpenAPI_list_for_each(nf_profile->tsctsf_info_list, node) { + OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*)node->data; + ogs_free(localKeyValue->key); + OpenAPI_tsctsf_info_free(localKeyValue->value); + OpenAPI_map_free(localKeyValue); + } + OpenAPI_list_free(nf_profile->tsctsf_info_list); + nf_profile->tsctsf_info_list = NULL; + } + if (nf_profile->mb_upf_info_list) { + OpenAPI_list_for_each(nf_profile->mb_upf_info_list, node) { + OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*)node->data; + ogs_free(localKeyValue->key); + OpenAPI_mb_upf_info_free(localKeyValue->value); + OpenAPI_map_free(localKeyValue); + } + OpenAPI_list_free(nf_profile->mb_upf_info_list); + nf_profile->mb_upf_info_list = NULL; + } + if (nf_profile->trust_af_info) { + OpenAPI_trust_af_info_free(nf_profile->trust_af_info); + nf_profile->trust_af_info = NULL; + } + if (nf_profile->nssaaf_info) { + OpenAPI_nssaaf_info_free(nf_profile->nssaaf_info); + nf_profile->nssaaf_info = NULL; + } + if (nf_profile->hni_list) { + OpenAPI_list_for_each(nf_profile->hni_list, node) { + ogs_free(node->data); + } + OpenAPI_list_free(nf_profile->hni_list); + nf_profile->hni_list = NULL; + } + if (nf_profile->iwmsc_info) { + OpenAPI_iwmsc_info_free(nf_profile->iwmsc_info); + nf_profile->iwmsc_info = NULL; + } + if (nf_profile->mnpf_info) { + OpenAPI_mnpf_info_free(nf_profile->mnpf_info); + nf_profile->mnpf_info = NULL; + } ogs_free(nf_profile); } @@ -583,6 +751,22 @@ cJSON *OpenAPI_nf_profile_convertToJSON(OpenAPI_nf_profile_t *nf_profile) goto end; } + if (nf_profile->collocated_nf_instances) { + cJSON *collocated_nf_instancesList = cJSON_AddArrayToObject(item, "collocatedNfInstances"); + if (collocated_nf_instancesList == NULL) { + ogs_error("OpenAPI_nf_profile_convertToJSON() failed [collocated_nf_instances]"); + goto end; + } + OpenAPI_list_for_each(nf_profile->collocated_nf_instances, node) { + cJSON *itemLocal = OpenAPI_collocated_nf_instance_convertToJSON(node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_nf_profile_convertToJSON() failed [collocated_nf_instances]"); + goto end; + } + cJSON_AddItemToArray(collocated_nf_instancesList, itemLocal); + } + } + if (nf_profile->is_heart_beat_timer) { if (cJSON_AddNumberToObject(item, "heartBeatTimer", nf_profile->heart_beat_timer) == NULL) { ogs_error("OpenAPI_nf_profile_convertToJSON() failed [heart_beat_timer]"); @@ -1210,6 +1394,28 @@ cJSON *OpenAPI_nf_profile_convertToJSON(OpenAPI_nf_profile_t *nf_profile) } } + if (nf_profile->nwdaf_info_list) { + cJSON *nwdaf_info_list = cJSON_AddObjectToObject(item, "nwdafInfoList"); + if (nwdaf_info_list == NULL) { + ogs_error("OpenAPI_nf_profile_convertToJSON() failed [nwdaf_info_list]"); + goto end; + } + cJSON *localMapObject = nwdaf_info_list; + if (nf_profile->nwdaf_info_list) { + OpenAPI_list_for_each(nf_profile->nwdaf_info_list, node) { + OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*)node->data; + cJSON *itemLocal = localKeyValue->value ? + OpenAPI_nwdaf_info_convertToJSON(localKeyValue->value) : + cJSON_CreateNull(); + if (itemLocal == NULL) { + ogs_error("OpenAPI_nf_profile_convertToJSON() failed [inner]"); + goto end; + } + cJSON_AddItemToObject(localMapObject, localKeyValue->key, itemLocal); + } + } + } + if (nf_profile->pcscf_info_list) { cJSON *pcscf_info_list = cJSON_AddObjectToObject(item, "pcscfInfoList"); if (pcscf_info_list == NULL) { @@ -1472,6 +1678,285 @@ cJSON *OpenAPI_nf_profile_convertToJSON(OpenAPI_nf_profile_t *nf_profile) } } + if (nf_profile->sepp_info) { + cJSON *sepp_info_local_JSON = OpenAPI_sepp_info_convertToJSON(nf_profile->sepp_info); + if (sepp_info_local_JSON == NULL) { + ogs_error("OpenAPI_nf_profile_convertToJSON() failed [sepp_info]"); + goto end; + } + cJSON_AddItemToObject(item, "seppInfo", sepp_info_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_nf_profile_convertToJSON() failed [sepp_info]"); + goto end; + } + } + + if (nf_profile->vendor_id) { + if (cJSON_AddStringToObject(item, "vendorId", nf_profile->vendor_id) == NULL) { + ogs_error("OpenAPI_nf_profile_convertToJSON() failed [vendor_id]"); + goto end; + } + } + + if (nf_profile->supported_vendor_specific_features) { + cJSON *supported_vendor_specific_features = cJSON_AddObjectToObject(item, "supportedVendorSpecificFeatures"); + if (supported_vendor_specific_features == NULL) { + ogs_error("OpenAPI_nf_profile_convertToJSON() failed [supported_vendor_specific_features]"); + goto end; + } + cJSON *localMapObject = supported_vendor_specific_features; + if (nf_profile->supported_vendor_specific_features) { + OpenAPI_list_for_each(nf_profile->supported_vendor_specific_features, node) { + OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*)node->data; + cJSON *itemLocal = localKeyValue->value ? + OpenAPI_vendor_specific_feature_convertToJSON(localKeyValue->value) : + cJSON_CreateNull(); + if (itemLocal == NULL) { + ogs_error("OpenAPI_nf_profile_convertToJSON() failed [inner]"); + goto end; + } + cJSON_AddItemToObject(localMapObject, localKeyValue->key, itemLocal); + } + } + } + + if (nf_profile->aanf_info_list) { + cJSON *aanf_info_list = cJSON_AddObjectToObject(item, "aanfInfoList"); + if (aanf_info_list == NULL) { + ogs_error("OpenAPI_nf_profile_convertToJSON() failed [aanf_info_list]"); + goto end; + } + cJSON *localMapObject = aanf_info_list; + if (nf_profile->aanf_info_list) { + OpenAPI_list_for_each(nf_profile->aanf_info_list, node) { + OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*)node->data; + cJSON *itemLocal = localKeyValue->value ? + OpenAPI_aanf_info_convertToJSON(localKeyValue->value) : + cJSON_CreateNull(); + if (itemLocal == NULL) { + ogs_error("OpenAPI_nf_profile_convertToJSON() failed [inner]"); + goto end; + } + cJSON_AddItemToObject(localMapObject, localKeyValue->key, itemLocal); + } + } + } + + if (nf_profile->_5g_ddnmf_info) { + cJSON *_5g_ddnmf_info_local_JSON = OpenAPI_model_5_g_ddnmf_info_convertToJSON(nf_profile->_5g_ddnmf_info); + if (_5g_ddnmf_info_local_JSON == NULL) { + ogs_error("OpenAPI_nf_profile_convertToJSON() failed [_5g_ddnmf_info]"); + goto end; + } + cJSON_AddItemToObject(item, "5gDdnmfInfo", _5g_ddnmf_info_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_nf_profile_convertToJSON() failed [_5g_ddnmf_info]"); + goto end; + } + } + + if (nf_profile->mfaf_info) { + cJSON *mfaf_info_local_JSON = OpenAPI_mfaf_info_convertToJSON(nf_profile->mfaf_info); + if (mfaf_info_local_JSON == NULL) { + ogs_error("OpenAPI_nf_profile_convertToJSON() failed [mfaf_info]"); + goto end; + } + cJSON_AddItemToObject(item, "mfafInfo", mfaf_info_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_nf_profile_convertToJSON() failed [mfaf_info]"); + goto end; + } + } + + if (nf_profile->easdf_info_list) { + cJSON *easdf_info_list = cJSON_AddObjectToObject(item, "easdfInfoList"); + if (easdf_info_list == NULL) { + ogs_error("OpenAPI_nf_profile_convertToJSON() failed [easdf_info_list]"); + goto end; + } + cJSON *localMapObject = easdf_info_list; + if (nf_profile->easdf_info_list) { + OpenAPI_list_for_each(nf_profile->easdf_info_list, node) { + OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*)node->data; + cJSON *itemLocal = localKeyValue->value ? + OpenAPI_easdf_info_convertToJSON(localKeyValue->value) : + cJSON_CreateNull(); + if (itemLocal == NULL) { + ogs_error("OpenAPI_nf_profile_convertToJSON() failed [inner]"); + goto end; + } + cJSON_AddItemToObject(localMapObject, localKeyValue->key, itemLocal); + } + } + } + + if (nf_profile->dccf_info) { + cJSON *dccf_info_local_JSON = OpenAPI_dccf_info_convertToJSON(nf_profile->dccf_info); + if (dccf_info_local_JSON == NULL) { + ogs_error("OpenAPI_nf_profile_convertToJSON() failed [dccf_info]"); + goto end; + } + cJSON_AddItemToObject(item, "dccfInfo", dccf_info_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_nf_profile_convertToJSON() failed [dccf_info]"); + goto end; + } + } + + if (nf_profile->nsacf_info_list) { + cJSON *nsacf_info_list = cJSON_AddObjectToObject(item, "nsacfInfoList"); + if (nsacf_info_list == NULL) { + ogs_error("OpenAPI_nf_profile_convertToJSON() failed [nsacf_info_list]"); + goto end; + } + cJSON *localMapObject = nsacf_info_list; + if (nf_profile->nsacf_info_list) { + OpenAPI_list_for_each(nf_profile->nsacf_info_list, node) { + OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*)node->data; + cJSON *itemLocal = localKeyValue->value ? + OpenAPI_nsacf_info_convertToJSON(localKeyValue->value) : + cJSON_CreateNull(); + if (itemLocal == NULL) { + ogs_error("OpenAPI_nf_profile_convertToJSON() failed [inner]"); + goto end; + } + cJSON_AddItemToObject(localMapObject, localKeyValue->key, itemLocal); + } + } + } + + if (nf_profile->mb_smf_info_list) { + cJSON *mb_smf_info_list = cJSON_AddObjectToObject(item, "mbSmfInfoList"); + if (mb_smf_info_list == NULL) { + ogs_error("OpenAPI_nf_profile_convertToJSON() failed [mb_smf_info_list]"); + goto end; + } + cJSON *localMapObject = mb_smf_info_list; + if (nf_profile->mb_smf_info_list) { + OpenAPI_list_for_each(nf_profile->mb_smf_info_list, node) { + OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*)node->data; + cJSON *itemLocal = localKeyValue->value ? + OpenAPI_mb_smf_info_convertToJSON(localKeyValue->value) : + cJSON_CreateNull(); + if (itemLocal == NULL) { + ogs_error("OpenAPI_nf_profile_convertToJSON() failed [inner]"); + goto end; + } + cJSON_AddItemToObject(localMapObject, localKeyValue->key, itemLocal); + } + } + } + + if (nf_profile->tsctsf_info_list) { + cJSON *tsctsf_info_list = cJSON_AddObjectToObject(item, "tsctsfInfoList"); + if (tsctsf_info_list == NULL) { + ogs_error("OpenAPI_nf_profile_convertToJSON() failed [tsctsf_info_list]"); + goto end; + } + cJSON *localMapObject = tsctsf_info_list; + if (nf_profile->tsctsf_info_list) { + OpenAPI_list_for_each(nf_profile->tsctsf_info_list, node) { + OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*)node->data; + cJSON *itemLocal = localKeyValue->value ? + OpenAPI_tsctsf_info_convertToJSON(localKeyValue->value) : + cJSON_CreateNull(); + if (itemLocal == NULL) { + ogs_error("OpenAPI_nf_profile_convertToJSON() failed [inner]"); + goto end; + } + cJSON_AddItemToObject(localMapObject, localKeyValue->key, itemLocal); + } + } + } + + if (nf_profile->mb_upf_info_list) { + cJSON *mb_upf_info_list = cJSON_AddObjectToObject(item, "mbUpfInfoList"); + if (mb_upf_info_list == NULL) { + ogs_error("OpenAPI_nf_profile_convertToJSON() failed [mb_upf_info_list]"); + goto end; + } + cJSON *localMapObject = mb_upf_info_list; + if (nf_profile->mb_upf_info_list) { + OpenAPI_list_for_each(nf_profile->mb_upf_info_list, node) { + OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*)node->data; + cJSON *itemLocal = localKeyValue->value ? + OpenAPI_mb_upf_info_convertToJSON(localKeyValue->value) : + cJSON_CreateNull(); + if (itemLocal == NULL) { + ogs_error("OpenAPI_nf_profile_convertToJSON() failed [inner]"); + goto end; + } + cJSON_AddItemToObject(localMapObject, localKeyValue->key, itemLocal); + } + } + } + + if (nf_profile->trust_af_info) { + cJSON *trust_af_info_local_JSON = OpenAPI_trust_af_info_convertToJSON(nf_profile->trust_af_info); + if (trust_af_info_local_JSON == NULL) { + ogs_error("OpenAPI_nf_profile_convertToJSON() failed [trust_af_info]"); + goto end; + } + cJSON_AddItemToObject(item, "trustAfInfo", trust_af_info_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_nf_profile_convertToJSON() failed [trust_af_info]"); + goto end; + } + } + + if (nf_profile->nssaaf_info) { + cJSON *nssaaf_info_local_JSON = OpenAPI_nssaaf_info_convertToJSON(nf_profile->nssaaf_info); + if (nssaaf_info_local_JSON == NULL) { + ogs_error("OpenAPI_nf_profile_convertToJSON() failed [nssaaf_info]"); + goto end; + } + cJSON_AddItemToObject(item, "nssaafInfo", nssaaf_info_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_nf_profile_convertToJSON() failed [nssaaf_info]"); + goto end; + } + } + + if (nf_profile->hni_list) { + cJSON *hni_listList = cJSON_AddArrayToObject(item, "hniList"); + if (hni_listList == NULL) { + ogs_error("OpenAPI_nf_profile_convertToJSON() failed [hni_list]"); + goto end; + } + OpenAPI_list_for_each(nf_profile->hni_list, node) { + if (cJSON_AddStringToObject(hni_listList, "", (char*)node->data) == NULL) { + ogs_error("OpenAPI_nf_profile_convertToJSON() failed [hni_list]"); + goto end; + } + } + } + + if (nf_profile->iwmsc_info) { + cJSON *iwmsc_info_local_JSON = OpenAPI_iwmsc_info_convertToJSON(nf_profile->iwmsc_info); + if (iwmsc_info_local_JSON == NULL) { + ogs_error("OpenAPI_nf_profile_convertToJSON() failed [iwmsc_info]"); + goto end; + } + cJSON_AddItemToObject(item, "iwmscInfo", iwmsc_info_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_nf_profile_convertToJSON() failed [iwmsc_info]"); + goto end; + } + } + + if (nf_profile->mnpf_info) { + cJSON *mnpf_info_local_JSON = OpenAPI_mnpf_info_convertToJSON(nf_profile->mnpf_info); + if (mnpf_info_local_JSON == NULL) { + ogs_error("OpenAPI_nf_profile_convertToJSON() failed [mnpf_info]"); + goto end; + } + cJSON_AddItemToObject(item, "mnpfInfo", mnpf_info_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_nf_profile_convertToJSON() failed [mnpf_info]"); + goto end; + } + } + end: return item; } @@ -1486,6 +1971,8 @@ OpenAPI_nf_profile_t *OpenAPI_nf_profile_parseFromJSON(cJSON *nf_profileJSON) OpenAPI_nf_type_e nf_typeVariable = 0; cJSON *nf_status = NULL; OpenAPI_nf_status_e nf_statusVariable = 0; + cJSON *collocated_nf_instances = NULL; + OpenAPI_list_t *collocated_nf_instancesList = NULL; cJSON *heart_beat_timer = NULL; cJSON *plmn_list = NULL; OpenAPI_list_t *plmn_listList = NULL; @@ -1564,6 +2051,8 @@ OpenAPI_nf_profile_t *OpenAPI_nf_profile_parseFromJSON(cJSON *nf_profileJSON) OpenAPI_list_t *udsf_info_listList = NULL; cJSON *nwdaf_info = NULL; OpenAPI_nwdaf_info_t *nwdaf_info_local_nonprim = NULL; + cJSON *nwdaf_info_list = NULL; + OpenAPI_list_t *nwdaf_info_listList = NULL; cJSON *pcscf_info_list = NULL; OpenAPI_list_t *pcscf_info_listList = NULL; cJSON *hss_info_list = NULL; @@ -1598,6 +2087,39 @@ OpenAPI_nf_profile_t *OpenAPI_nf_profile_parseFromJSON(cJSON *nf_profileJSON) OpenAPI_list_t *scp_domainsList = NULL; cJSON *scp_info = NULL; OpenAPI_scp_info_t *scp_info_local_nonprim = NULL; + cJSON *sepp_info = NULL; + OpenAPI_sepp_info_t *sepp_info_local_nonprim = NULL; + cJSON *vendor_id = NULL; + cJSON *supported_vendor_specific_features = NULL; + OpenAPI_list_t *supported_vendor_specific_featuresList = NULL; + cJSON *aanf_info_list = NULL; + OpenAPI_list_t *aanf_info_listList = NULL; + cJSON *_5g_ddnmf_info = NULL; + OpenAPI_model_5_g_ddnmf_info_t *_5g_ddnmf_info_local_nonprim = NULL; + cJSON *mfaf_info = NULL; + OpenAPI_mfaf_info_t *mfaf_info_local_nonprim = NULL; + cJSON *easdf_info_list = NULL; + OpenAPI_list_t *easdf_info_listList = NULL; + cJSON *dccf_info = NULL; + OpenAPI_dccf_info_t *dccf_info_local_nonprim = NULL; + cJSON *nsacf_info_list = NULL; + OpenAPI_list_t *nsacf_info_listList = NULL; + cJSON *mb_smf_info_list = NULL; + OpenAPI_list_t *mb_smf_info_listList = NULL; + cJSON *tsctsf_info_list = NULL; + OpenAPI_list_t *tsctsf_info_listList = NULL; + cJSON *mb_upf_info_list = NULL; + OpenAPI_list_t *mb_upf_info_listList = NULL; + cJSON *trust_af_info = NULL; + OpenAPI_trust_af_info_t *trust_af_info_local_nonprim = NULL; + cJSON *nssaaf_info = NULL; + OpenAPI_nssaaf_info_t *nssaaf_info_local_nonprim = NULL; + cJSON *hni_list = NULL; + OpenAPI_list_t *hni_listList = NULL; + cJSON *iwmsc_info = NULL; + OpenAPI_iwmsc_info_t *iwmsc_info_local_nonprim = NULL; + cJSON *mnpf_info = NULL; + OpenAPI_mnpf_info_t *mnpf_info_local_nonprim = NULL; nf_instance_id = cJSON_GetObjectItemCaseSensitive(nf_profileJSON, "nfInstanceId"); if (!nf_instance_id) { ogs_error("OpenAPI_nf_profile_parseFromJSON() failed [nf_instance_id]"); @@ -1638,6 +2160,31 @@ OpenAPI_nf_profile_t *OpenAPI_nf_profile_parseFromJSON(cJSON *nf_profileJSON) } nf_statusVariable = OpenAPI_nf_status_FromString(nf_status->valuestring); + collocated_nf_instances = cJSON_GetObjectItemCaseSensitive(nf_profileJSON, "collocatedNfInstances"); + if (collocated_nf_instances) { + cJSON *collocated_nf_instances_local = NULL; + if (!cJSON_IsArray(collocated_nf_instances)) { + ogs_error("OpenAPI_nf_profile_parseFromJSON() failed [collocated_nf_instances]"); + goto end; + } + + collocated_nf_instancesList = OpenAPI_list_create(); + + cJSON_ArrayForEach(collocated_nf_instances_local, collocated_nf_instances) { + if (!cJSON_IsObject(collocated_nf_instances_local)) { + ogs_error("OpenAPI_nf_profile_parseFromJSON() failed [collocated_nf_instances]"); + goto end; + } + OpenAPI_collocated_nf_instance_t *collocated_nf_instancesItem = OpenAPI_collocated_nf_instance_parseFromJSON(collocated_nf_instances_local); + if (!collocated_nf_instancesItem) { + ogs_error("No collocated_nf_instancesItem"); + OpenAPI_list_free(collocated_nf_instancesList); + goto end; + } + OpenAPI_list_add(collocated_nf_instancesList, collocated_nf_instancesItem); + } + } + heart_beat_timer = cJSON_GetObjectItemCaseSensitive(nf_profileJSON, "heartBeatTimer"); if (heart_beat_timer) { if (!cJSON_IsNumber(heart_beat_timer)) { @@ -2305,6 +2852,32 @@ OpenAPI_nf_profile_t *OpenAPI_nf_profile_parseFromJSON(cJSON *nf_profileJSON) nwdaf_info_local_nonprim = OpenAPI_nwdaf_info_parseFromJSON(nwdaf_info); } + nwdaf_info_list = cJSON_GetObjectItemCaseSensitive(nf_profileJSON, "nwdafInfoList"); + if (nwdaf_info_list) { + cJSON *nwdaf_info_list_local_map = NULL; + if (!cJSON_IsObject(nwdaf_info_list) && !cJSON_IsNull(nwdaf_info_list)) { + ogs_error("OpenAPI_nf_profile_parseFromJSON() failed [nwdaf_info_list]"); + goto end; + } + if (cJSON_IsObject(nwdaf_info_list)) { + nwdaf_info_listList = OpenAPI_list_create(); + OpenAPI_map_t *localMapKeyPair = NULL; + cJSON_ArrayForEach(nwdaf_info_list_local_map, nwdaf_info_list) { + cJSON *localMapObject = nwdaf_info_list_local_map; + if (cJSON_IsObject(localMapObject)) { + localMapKeyPair = OpenAPI_map_create( + ogs_strdup(localMapObject->string), OpenAPI_nwdaf_info_parseFromJSON(localMapObject)); + } else if (cJSON_IsNull(localMapObject)) { + localMapKeyPair = OpenAPI_map_create(ogs_strdup(localMapObject->string), NULL); + } else { + ogs_error("OpenAPI_nf_profile_parseFromJSON() failed [inner]"); + goto end; + } + OpenAPI_list_add(nwdaf_info_listList, localMapKeyPair); + } + } + } + pcscf_info_list = cJSON_GetObjectItemCaseSensitive(nf_profileJSON, "pcscfInfoList"); if (pcscf_info_list) { cJSON *pcscf_info_list_local_map = NULL; @@ -2606,11 +3179,265 @@ OpenAPI_nf_profile_t *OpenAPI_nf_profile_parseFromJSON(cJSON *nf_profileJSON) scp_info_local_nonprim = OpenAPI_scp_info_parseFromJSON(scp_info); } + sepp_info = cJSON_GetObjectItemCaseSensitive(nf_profileJSON, "seppInfo"); + if (sepp_info) { + sepp_info_local_nonprim = OpenAPI_sepp_info_parseFromJSON(sepp_info); + } + + vendor_id = cJSON_GetObjectItemCaseSensitive(nf_profileJSON, "vendorId"); + if (vendor_id) { + if (!cJSON_IsString(vendor_id) && !cJSON_IsNull(vendor_id)) { + ogs_error("OpenAPI_nf_profile_parseFromJSON() failed [vendor_id]"); + goto end; + } + } + + supported_vendor_specific_features = cJSON_GetObjectItemCaseSensitive(nf_profileJSON, "supportedVendorSpecificFeatures"); + if (supported_vendor_specific_features) { + cJSON *supported_vendor_specific_features_local_map = NULL; + if (!cJSON_IsObject(supported_vendor_specific_features) && !cJSON_IsNull(supported_vendor_specific_features)) { + ogs_error("OpenAPI_nf_profile_parseFromJSON() failed [supported_vendor_specific_features]"); + goto end; + } + if (cJSON_IsObject(supported_vendor_specific_features)) { + supported_vendor_specific_featuresList = OpenAPI_list_create(); + OpenAPI_map_t *localMapKeyPair = NULL; + cJSON_ArrayForEach(supported_vendor_specific_features_local_map, supported_vendor_specific_features) { + cJSON *localMapObject = supported_vendor_specific_features_local_map; + double *localDouble = NULL; + int *localInt = NULL; + if (cJSON_IsObject(localMapObject)) { + localMapKeyPair = OpenAPI_map_create( + ogs_strdup(localMapObject->string), OpenAPI_vendor_specific_feature_parseFromJSON(localMapObject)); + } else if (cJSON_IsNull(localMapObject)) { + localMapKeyPair = OpenAPI_map_create(ogs_strdup(localMapObject->string), NULL); + } else { + ogs_error("OpenAPI_nf_profile_parseFromJSON() failed [inner]"); + goto end; + } + OpenAPI_list_add(supported_vendor_specific_featuresList, localMapKeyPair); + } + } + } + + aanf_info_list = cJSON_GetObjectItemCaseSensitive(nf_profileJSON, "aanfInfoList"); + if (aanf_info_list) { + cJSON *aanf_info_list_local_map = NULL; + if (!cJSON_IsObject(aanf_info_list) && !cJSON_IsNull(aanf_info_list)) { + ogs_error("OpenAPI_nf_profile_parseFromJSON() failed [aanf_info_list]"); + goto end; + } + if (cJSON_IsObject(aanf_info_list)) { + aanf_info_listList = OpenAPI_list_create(); + OpenAPI_map_t *localMapKeyPair = NULL; + cJSON_ArrayForEach(aanf_info_list_local_map, aanf_info_list) { + cJSON *localMapObject = aanf_info_list_local_map; + if (cJSON_IsObject(localMapObject)) { + localMapKeyPair = OpenAPI_map_create( + ogs_strdup(localMapObject->string), OpenAPI_aanf_info_parseFromJSON(localMapObject)); + } else if (cJSON_IsNull(localMapObject)) { + localMapKeyPair = OpenAPI_map_create(ogs_strdup(localMapObject->string), NULL); + } else { + ogs_error("OpenAPI_nf_profile_parseFromJSON() failed [inner]"); + goto end; + } + OpenAPI_list_add(aanf_info_listList, localMapKeyPair); + } + } + } + + _5g_ddnmf_info = cJSON_GetObjectItemCaseSensitive(nf_profileJSON, "5gDdnmfInfo"); + if (_5g_ddnmf_info) { + _5g_ddnmf_info_local_nonprim = OpenAPI_model_5_g_ddnmf_info_parseFromJSON(_5g_ddnmf_info); + } + + mfaf_info = cJSON_GetObjectItemCaseSensitive(nf_profileJSON, "mfafInfo"); + if (mfaf_info) { + mfaf_info_local_nonprim = OpenAPI_mfaf_info_parseFromJSON(mfaf_info); + } + + easdf_info_list = cJSON_GetObjectItemCaseSensitive(nf_profileJSON, "easdfInfoList"); + if (easdf_info_list) { + cJSON *easdf_info_list_local_map = NULL; + if (!cJSON_IsObject(easdf_info_list) && !cJSON_IsNull(easdf_info_list)) { + ogs_error("OpenAPI_nf_profile_parseFromJSON() failed [easdf_info_list]"); + goto end; + } + if (cJSON_IsObject(easdf_info_list)) { + easdf_info_listList = OpenAPI_list_create(); + OpenAPI_map_t *localMapKeyPair = NULL; + cJSON_ArrayForEach(easdf_info_list_local_map, easdf_info_list) { + cJSON *localMapObject = easdf_info_list_local_map; + if (cJSON_IsObject(localMapObject)) { + localMapKeyPair = OpenAPI_map_create( + ogs_strdup(localMapObject->string), OpenAPI_easdf_info_parseFromJSON(localMapObject)); + } else if (cJSON_IsNull(localMapObject)) { + localMapKeyPair = OpenAPI_map_create(ogs_strdup(localMapObject->string), NULL); + } else { + ogs_error("OpenAPI_nf_profile_parseFromJSON() failed [inner]"); + goto end; + } + OpenAPI_list_add(easdf_info_listList, localMapKeyPair); + } + } + } + + dccf_info = cJSON_GetObjectItemCaseSensitive(nf_profileJSON, "dccfInfo"); + if (dccf_info) { + dccf_info_local_nonprim = OpenAPI_dccf_info_parseFromJSON(dccf_info); + } + + nsacf_info_list = cJSON_GetObjectItemCaseSensitive(nf_profileJSON, "nsacfInfoList"); + if (nsacf_info_list) { + cJSON *nsacf_info_list_local_map = NULL; + if (!cJSON_IsObject(nsacf_info_list) && !cJSON_IsNull(nsacf_info_list)) { + ogs_error("OpenAPI_nf_profile_parseFromJSON() failed [nsacf_info_list]"); + goto end; + } + if (cJSON_IsObject(nsacf_info_list)) { + nsacf_info_listList = OpenAPI_list_create(); + OpenAPI_map_t *localMapKeyPair = NULL; + cJSON_ArrayForEach(nsacf_info_list_local_map, nsacf_info_list) { + cJSON *localMapObject = nsacf_info_list_local_map; + if (cJSON_IsObject(localMapObject)) { + localMapKeyPair = OpenAPI_map_create( + ogs_strdup(localMapObject->string), OpenAPI_nsacf_info_parseFromJSON(localMapObject)); + } else if (cJSON_IsNull(localMapObject)) { + localMapKeyPair = OpenAPI_map_create(ogs_strdup(localMapObject->string), NULL); + } else { + ogs_error("OpenAPI_nf_profile_parseFromJSON() failed [inner]"); + goto end; + } + OpenAPI_list_add(nsacf_info_listList, localMapKeyPair); + } + } + } + + mb_smf_info_list = cJSON_GetObjectItemCaseSensitive(nf_profileJSON, "mbSmfInfoList"); + if (mb_smf_info_list) { + cJSON *mb_smf_info_list_local_map = NULL; + if (!cJSON_IsObject(mb_smf_info_list) && !cJSON_IsNull(mb_smf_info_list)) { + ogs_error("OpenAPI_nf_profile_parseFromJSON() failed [mb_smf_info_list]"); + goto end; + } + if (cJSON_IsObject(mb_smf_info_list)) { + mb_smf_info_listList = OpenAPI_list_create(); + OpenAPI_map_t *localMapKeyPair = NULL; + cJSON_ArrayForEach(mb_smf_info_list_local_map, mb_smf_info_list) { + cJSON *localMapObject = mb_smf_info_list_local_map; + if (cJSON_IsObject(localMapObject)) { + localMapKeyPair = OpenAPI_map_create( + ogs_strdup(localMapObject->string), OpenAPI_mb_smf_info_parseFromJSON(localMapObject)); + } else if (cJSON_IsNull(localMapObject)) { + localMapKeyPair = OpenAPI_map_create(ogs_strdup(localMapObject->string), NULL); + } else { + ogs_error("OpenAPI_nf_profile_parseFromJSON() failed [inner]"); + goto end; + } + OpenAPI_list_add(mb_smf_info_listList, localMapKeyPair); + } + } + } + + tsctsf_info_list = cJSON_GetObjectItemCaseSensitive(nf_profileJSON, "tsctsfInfoList"); + if (tsctsf_info_list) { + cJSON *tsctsf_info_list_local_map = NULL; + if (!cJSON_IsObject(tsctsf_info_list) && !cJSON_IsNull(tsctsf_info_list)) { + ogs_error("OpenAPI_nf_profile_parseFromJSON() failed [tsctsf_info_list]"); + goto end; + } + if (cJSON_IsObject(tsctsf_info_list)) { + tsctsf_info_listList = OpenAPI_list_create(); + OpenAPI_map_t *localMapKeyPair = NULL; + cJSON_ArrayForEach(tsctsf_info_list_local_map, tsctsf_info_list) { + cJSON *localMapObject = tsctsf_info_list_local_map; + if (cJSON_IsObject(localMapObject)) { + localMapKeyPair = OpenAPI_map_create( + ogs_strdup(localMapObject->string), OpenAPI_tsctsf_info_parseFromJSON(localMapObject)); + } else if (cJSON_IsNull(localMapObject)) { + localMapKeyPair = OpenAPI_map_create(ogs_strdup(localMapObject->string), NULL); + } else { + ogs_error("OpenAPI_nf_profile_parseFromJSON() failed [inner]"); + goto end; + } + OpenAPI_list_add(tsctsf_info_listList, localMapKeyPair); + } + } + } + + mb_upf_info_list = cJSON_GetObjectItemCaseSensitive(nf_profileJSON, "mbUpfInfoList"); + if (mb_upf_info_list) { + cJSON *mb_upf_info_list_local_map = NULL; + if (!cJSON_IsObject(mb_upf_info_list) && !cJSON_IsNull(mb_upf_info_list)) { + ogs_error("OpenAPI_nf_profile_parseFromJSON() failed [mb_upf_info_list]"); + goto end; + } + if (cJSON_IsObject(mb_upf_info_list)) { + mb_upf_info_listList = OpenAPI_list_create(); + OpenAPI_map_t *localMapKeyPair = NULL; + cJSON_ArrayForEach(mb_upf_info_list_local_map, mb_upf_info_list) { + cJSON *localMapObject = mb_upf_info_list_local_map; + if (cJSON_IsObject(localMapObject)) { + localMapKeyPair = OpenAPI_map_create( + ogs_strdup(localMapObject->string), OpenAPI_mb_upf_info_parseFromJSON(localMapObject)); + } else if (cJSON_IsNull(localMapObject)) { + localMapKeyPair = OpenAPI_map_create(ogs_strdup(localMapObject->string), NULL); + } else { + ogs_error("OpenAPI_nf_profile_parseFromJSON() failed [inner]"); + goto end; + } + OpenAPI_list_add(mb_upf_info_listList, localMapKeyPair); + } + } + } + + trust_af_info = cJSON_GetObjectItemCaseSensitive(nf_profileJSON, "trustAfInfo"); + if (trust_af_info) { + trust_af_info_local_nonprim = OpenAPI_trust_af_info_parseFromJSON(trust_af_info); + } + + nssaaf_info = cJSON_GetObjectItemCaseSensitive(nf_profileJSON, "nssaafInfo"); + if (nssaaf_info) { + nssaaf_info_local_nonprim = OpenAPI_nssaaf_info_parseFromJSON(nssaaf_info); + } + + hni_list = cJSON_GetObjectItemCaseSensitive(nf_profileJSON, "hniList"); + if (hni_list) { + cJSON *hni_list_local = NULL; + if (!cJSON_IsArray(hni_list)) { + ogs_error("OpenAPI_nf_profile_parseFromJSON() failed [hni_list]"); + goto end; + } + + hni_listList = OpenAPI_list_create(); + + cJSON_ArrayForEach(hni_list_local, hni_list) { + double *localDouble = NULL; + int *localInt = NULL; + if (!cJSON_IsString(hni_list_local)) { + ogs_error("OpenAPI_nf_profile_parseFromJSON() failed [hni_list]"); + goto end; + } + OpenAPI_list_add(hni_listList, ogs_strdup(hni_list_local->valuestring)); + } + } + + iwmsc_info = cJSON_GetObjectItemCaseSensitive(nf_profileJSON, "iwmscInfo"); + if (iwmsc_info) { + iwmsc_info_local_nonprim = OpenAPI_iwmsc_info_parseFromJSON(iwmsc_info); + } + + mnpf_info = cJSON_GetObjectItemCaseSensitive(nf_profileJSON, "mnpfInfo"); + if (mnpf_info) { + mnpf_info_local_nonprim = OpenAPI_mnpf_info_parseFromJSON(mnpf_info); + } + nf_profile_local_var = OpenAPI_nf_profile_create ( ogs_strdup(nf_instance_id->valuestring), nf_instance_name && !cJSON_IsNull(nf_instance_name) ? ogs_strdup(nf_instance_name->valuestring) : NULL, nf_typeVariable, nf_statusVariable, + collocated_nf_instances ? collocated_nf_instancesList : NULL, heart_beat_timer ? true : false, heart_beat_timer ? heart_beat_timer->valuedouble : 0, plmn_list ? plmn_listList : NULL, @@ -2658,6 +3485,7 @@ OpenAPI_nf_profile_t *OpenAPI_nf_profile_parseFromJSON(cJSON *nf_profileJSON) udsf_info ? udsf_info_local_nonprim : NULL, udsf_info_list ? udsf_info_listList : NULL, nwdaf_info ? nwdaf_info_local_nonprim : NULL, + nwdaf_info_list ? nwdaf_info_listList : NULL, pcscf_info_list ? pcscf_info_listList : NULL, hss_info_list ? hss_info_listList : NULL, custom_info ? custom_info_local_object : NULL, @@ -2682,11 +3510,35 @@ OpenAPI_nf_profile_t *OpenAPI_nf_profile_parseFromJSON(cJSON *nf_profileJSON) nf_set_recovery_time_list ? nf_set_recovery_time_listList : NULL, service_set_recovery_time_list ? service_set_recovery_time_listList : NULL, scp_domains ? scp_domainsList : NULL, - scp_info ? scp_info_local_nonprim : NULL + scp_info ? scp_info_local_nonprim : NULL, + sepp_info ? sepp_info_local_nonprim : NULL, + vendor_id && !cJSON_IsNull(vendor_id) ? ogs_strdup(vendor_id->valuestring) : NULL, + supported_vendor_specific_features ? supported_vendor_specific_featuresList : NULL, + aanf_info_list ? aanf_info_listList : NULL, + _5g_ddnmf_info ? _5g_ddnmf_info_local_nonprim : NULL, + mfaf_info ? mfaf_info_local_nonprim : NULL, + easdf_info_list ? easdf_info_listList : NULL, + dccf_info ? dccf_info_local_nonprim : NULL, + nsacf_info_list ? nsacf_info_listList : NULL, + mb_smf_info_list ? mb_smf_info_listList : NULL, + tsctsf_info_list ? tsctsf_info_listList : NULL, + mb_upf_info_list ? mb_upf_info_listList : NULL, + trust_af_info ? trust_af_info_local_nonprim : NULL, + nssaaf_info ? nssaaf_info_local_nonprim : NULL, + hni_list ? hni_listList : NULL, + iwmsc_info ? iwmsc_info_local_nonprim : NULL, + mnpf_info ? mnpf_info_local_nonprim : NULL ); return nf_profile_local_var; end: + if (collocated_nf_instancesList) { + OpenAPI_list_for_each(collocated_nf_instancesList, node) { + OpenAPI_collocated_nf_instance_free(node->data); + } + OpenAPI_list_free(collocated_nf_instancesList); + collocated_nf_instancesList = NULL; + } if (plmn_listList) { OpenAPI_list_for_each(plmn_listList, node) { OpenAPI_plmn_id_free(node->data); @@ -2920,6 +3772,16 @@ end: OpenAPI_nwdaf_info_free(nwdaf_info_local_nonprim); nwdaf_info_local_nonprim = NULL; } + if (nwdaf_info_listList) { + OpenAPI_list_for_each(nwdaf_info_listList, node) { + OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*) node->data; + ogs_free(localKeyValue->key); + OpenAPI_nwdaf_info_free(localKeyValue->value); + OpenAPI_map_free(localKeyValue); + } + OpenAPI_list_free(nwdaf_info_listList); + nwdaf_info_listList = NULL; + } if (pcscf_info_listList) { OpenAPI_list_for_each(pcscf_info_listList, node) { OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*) node->data; @@ -3021,6 +3883,115 @@ end: OpenAPI_scp_info_free(scp_info_local_nonprim); scp_info_local_nonprim = NULL; } + if (sepp_info_local_nonprim) { + OpenAPI_sepp_info_free(sepp_info_local_nonprim); + sepp_info_local_nonprim = NULL; + } + if (supported_vendor_specific_featuresList) { + OpenAPI_list_for_each(supported_vendor_specific_featuresList, node) { + OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*) node->data; + ogs_free(localKeyValue->key); + ogs_free(localKeyValue->value); + OpenAPI_map_free(localKeyValue); + } + OpenAPI_list_free(supported_vendor_specific_featuresList); + supported_vendor_specific_featuresList = NULL; + } + if (aanf_info_listList) { + OpenAPI_list_for_each(aanf_info_listList, node) { + OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*) node->data; + ogs_free(localKeyValue->key); + OpenAPI_aanf_info_free(localKeyValue->value); + OpenAPI_map_free(localKeyValue); + } + OpenAPI_list_free(aanf_info_listList); + aanf_info_listList = NULL; + } + if (_5g_ddnmf_info_local_nonprim) { + OpenAPI_model_5_g_ddnmf_info_free(_5g_ddnmf_info_local_nonprim); + _5g_ddnmf_info_local_nonprim = NULL; + } + if (mfaf_info_local_nonprim) { + OpenAPI_mfaf_info_free(mfaf_info_local_nonprim); + mfaf_info_local_nonprim = NULL; + } + if (easdf_info_listList) { + OpenAPI_list_for_each(easdf_info_listList, node) { + OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*) node->data; + ogs_free(localKeyValue->key); + OpenAPI_easdf_info_free(localKeyValue->value); + OpenAPI_map_free(localKeyValue); + } + OpenAPI_list_free(easdf_info_listList); + easdf_info_listList = NULL; + } + if (dccf_info_local_nonprim) { + OpenAPI_dccf_info_free(dccf_info_local_nonprim); + dccf_info_local_nonprim = NULL; + } + if (nsacf_info_listList) { + OpenAPI_list_for_each(nsacf_info_listList, node) { + OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*) node->data; + ogs_free(localKeyValue->key); + OpenAPI_nsacf_info_free(localKeyValue->value); + OpenAPI_map_free(localKeyValue); + } + OpenAPI_list_free(nsacf_info_listList); + nsacf_info_listList = NULL; + } + if (mb_smf_info_listList) { + OpenAPI_list_for_each(mb_smf_info_listList, node) { + OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*) node->data; + ogs_free(localKeyValue->key); + OpenAPI_mb_smf_info_free(localKeyValue->value); + OpenAPI_map_free(localKeyValue); + } + OpenAPI_list_free(mb_smf_info_listList); + mb_smf_info_listList = NULL; + } + if (tsctsf_info_listList) { + OpenAPI_list_for_each(tsctsf_info_listList, node) { + OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*) node->data; + ogs_free(localKeyValue->key); + OpenAPI_tsctsf_info_free(localKeyValue->value); + OpenAPI_map_free(localKeyValue); + } + OpenAPI_list_free(tsctsf_info_listList); + tsctsf_info_listList = NULL; + } + if (mb_upf_info_listList) { + OpenAPI_list_for_each(mb_upf_info_listList, node) { + OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*) node->data; + ogs_free(localKeyValue->key); + OpenAPI_mb_upf_info_free(localKeyValue->value); + OpenAPI_map_free(localKeyValue); + } + OpenAPI_list_free(mb_upf_info_listList); + mb_upf_info_listList = NULL; + } + if (trust_af_info_local_nonprim) { + OpenAPI_trust_af_info_free(trust_af_info_local_nonprim); + trust_af_info_local_nonprim = NULL; + } + if (nssaaf_info_local_nonprim) { + OpenAPI_nssaaf_info_free(nssaaf_info_local_nonprim); + nssaaf_info_local_nonprim = NULL; + } + if (hni_listList) { + OpenAPI_list_for_each(hni_listList, node) { + ogs_free(node->data); + } + OpenAPI_list_free(hni_listList); + hni_listList = NULL; + } + if (iwmsc_info_local_nonprim) { + OpenAPI_iwmsc_info_free(iwmsc_info_local_nonprim); + iwmsc_info_local_nonprim = NULL; + } + if (mnpf_info_local_nonprim) { + OpenAPI_mnpf_info_free(mnpf_info_local_nonprim); + mnpf_info_local_nonprim = NULL; + } return NULL; } diff --git a/lib/sbi/openapi/model/nf_profile.h b/lib/sbi/openapi/model/nf_profile.h index a9c5bd55f..951b1e214 100644 --- a/lib/sbi/openapi/model/nf_profile.h +++ b/lib/sbi/openapi/model/nf_profile.h @@ -12,20 +12,32 @@ #include "../include/list.h" #include "../include/keyValuePair.h" #include "../include/binary.h" +#include "aanf_info.h" #include "amf_info.h" #include "ausf_info.h" #include "bsf_info.h" #include "chf_info.h" +#include "collocated_nf_instance.h" +#include "dccf_info.h" #include "default_notification_subscription.h" +#include "easdf_info.h" #include "ext_snssai.h" #include "gmlc_info.h" #include "hss_info.h" +#include "iwmsc_info.h" #include "lmf_info.h" +#include "mb_smf_info.h" +#include "mb_upf_info.h" +#include "mfaf_info.h" +#include "mnpf_info.h" +#include "model_5_g_ddnmf_info.h" #include "nef_info.h" #include "nf_service.h" #include "nf_status.h" #include "nf_type.h" #include "nrf_info.h" +#include "nsacf_info.h" +#include "nssaaf_info.h" #include "nwdaf_info.h" #include "object.h" #include "pcf_info.h" @@ -34,11 +46,15 @@ #include "plmn_id_nid.h" #include "plmn_snssai.h" #include "scp_info.h" +#include "sepp_info.h" #include "smf_info.h" +#include "trust_af_info.h" +#include "tsctsf_info.h" #include "udm_info.h" #include "udr_info.h" #include "udsf_info.h" #include "upf_info.h" +#include "vendor_specific_feature.h" #ifdef __cplusplus extern "C" { @@ -50,6 +66,7 @@ typedef struct OpenAPI_nf_profile_s { char *nf_instance_name; OpenAPI_nf_type_e nf_type; OpenAPI_nf_status_e nf_status; + OpenAPI_list_t *collocated_nf_instances; bool is_heart_beat_timer; int heart_beat_timer; OpenAPI_list_t *plmn_list; @@ -97,6 +114,7 @@ typedef struct OpenAPI_nf_profile_s { struct OpenAPI_udsf_info_s *udsf_info; OpenAPI_list_t* udsf_info_list; struct OpenAPI_nwdaf_info_s *nwdaf_info; + OpenAPI_list_t* nwdaf_info_list; OpenAPI_list_t* pcscf_info_list; OpenAPI_list_t* hss_info_list; OpenAPI_object_t *custom_info; @@ -122,6 +140,23 @@ typedef struct OpenAPI_nf_profile_s { OpenAPI_list_t* service_set_recovery_time_list; OpenAPI_list_t *scp_domains; struct OpenAPI_scp_info_s *scp_info; + struct OpenAPI_sepp_info_s *sepp_info; + char *vendor_id; + OpenAPI_list_t* supported_vendor_specific_features; + OpenAPI_list_t* aanf_info_list; + struct OpenAPI_model_5_g_ddnmf_info_s *_5g_ddnmf_info; + struct OpenAPI_mfaf_info_s *mfaf_info; + OpenAPI_list_t* easdf_info_list; + struct OpenAPI_dccf_info_s *dccf_info; + OpenAPI_list_t* nsacf_info_list; + OpenAPI_list_t* mb_smf_info_list; + OpenAPI_list_t* tsctsf_info_list; + OpenAPI_list_t* mb_upf_info_list; + struct OpenAPI_trust_af_info_s *trust_af_info; + struct OpenAPI_nssaaf_info_s *nssaaf_info; + OpenAPI_list_t *hni_list; + struct OpenAPI_iwmsc_info_s *iwmsc_info; + struct OpenAPI_mnpf_info_s *mnpf_info; } OpenAPI_nf_profile_t; OpenAPI_nf_profile_t *OpenAPI_nf_profile_create( @@ -129,6 +164,7 @@ OpenAPI_nf_profile_t *OpenAPI_nf_profile_create( char *nf_instance_name, OpenAPI_nf_type_e nf_type, OpenAPI_nf_status_e nf_status, + OpenAPI_list_t *collocated_nf_instances, bool is_heart_beat_timer, int heart_beat_timer, OpenAPI_list_t *plmn_list, @@ -176,6 +212,7 @@ OpenAPI_nf_profile_t *OpenAPI_nf_profile_create( OpenAPI_udsf_info_t *udsf_info, OpenAPI_list_t* udsf_info_list, OpenAPI_nwdaf_info_t *nwdaf_info, + OpenAPI_list_t* nwdaf_info_list, OpenAPI_list_t* pcscf_info_list, OpenAPI_list_t* hss_info_list, OpenAPI_object_t *custom_info, @@ -200,7 +237,24 @@ OpenAPI_nf_profile_t *OpenAPI_nf_profile_create( OpenAPI_list_t* nf_set_recovery_time_list, OpenAPI_list_t* service_set_recovery_time_list, OpenAPI_list_t *scp_domains, - OpenAPI_scp_info_t *scp_info + OpenAPI_scp_info_t *scp_info, + OpenAPI_sepp_info_t *sepp_info, + char *vendor_id, + OpenAPI_list_t* supported_vendor_specific_features, + OpenAPI_list_t* aanf_info_list, + OpenAPI_model_5_g_ddnmf_info_t *_5g_ddnmf_info, + OpenAPI_mfaf_info_t *mfaf_info, + OpenAPI_list_t* easdf_info_list, + OpenAPI_dccf_info_t *dccf_info, + OpenAPI_list_t* nsacf_info_list, + OpenAPI_list_t* mb_smf_info_list, + OpenAPI_list_t* tsctsf_info_list, + OpenAPI_list_t* mb_upf_info_list, + OpenAPI_trust_af_info_t *trust_af_info, + OpenAPI_nssaaf_info_t *nssaaf_info, + OpenAPI_list_t *hni_list, + OpenAPI_iwmsc_info_t *iwmsc_info, + OpenAPI_mnpf_info_t *mnpf_info ); void OpenAPI_nf_profile_free(OpenAPI_nf_profile_t *nf_profile); OpenAPI_nf_profile_t *OpenAPI_nf_profile_parseFromJSON(cJSON *nf_profileJSON); diff --git a/lib/sbi/openapi/model/nf_service.c b/lib/sbi/openapi/model/nf_service.c index cf55599f6..1ddf3c1e1 100644 --- a/lib/sbi/openapi/model/nf_service.c +++ b/lib/sbi/openapi/model/nf_service.c @@ -37,7 +37,8 @@ OpenAPI_nf_service_t *OpenAPI_nf_service_create( char *vendor_id, OpenAPI_list_t* supported_vendor_specific_features, bool is_oauth2_required, - int oauth2_required + int oauth2_required, + OpenAPI_plmn_oauth2_t *per_plmn_oauth2_req_list ) { OpenAPI_nf_service_t *nf_service_local_var = ogs_malloc(sizeof(OpenAPI_nf_service_t)); @@ -76,6 +77,7 @@ OpenAPI_nf_service_t *OpenAPI_nf_service_create( nf_service_local_var->supported_vendor_specific_features = supported_vendor_specific_features; nf_service_local_var->is_oauth2_required = is_oauth2_required; nf_service_local_var->oauth2_required = oauth2_required; + nf_service_local_var->per_plmn_oauth2_req_list = per_plmn_oauth2_req_list; return nf_service_local_var; } @@ -227,6 +229,10 @@ void OpenAPI_nf_service_free(OpenAPI_nf_service_t *nf_service) OpenAPI_list_free(nf_service->supported_vendor_specific_features); nf_service->supported_vendor_specific_features = NULL; } + if (nf_service->per_plmn_oauth2_req_list) { + OpenAPI_plmn_oauth2_free(nf_service->per_plmn_oauth2_req_list); + nf_service->per_plmn_oauth2_req_list = NULL; + } ogs_free(nf_service); } @@ -576,6 +582,19 @@ cJSON *OpenAPI_nf_service_convertToJSON(OpenAPI_nf_service_t *nf_service) } } + if (nf_service->per_plmn_oauth2_req_list) { + cJSON *per_plmn_oauth2_req_list_local_JSON = OpenAPI_plmn_oauth2_convertToJSON(nf_service->per_plmn_oauth2_req_list); + if (per_plmn_oauth2_req_list_local_JSON == NULL) { + ogs_error("OpenAPI_nf_service_convertToJSON() failed [per_plmn_oauth2_req_list]"); + goto end; + } + cJSON_AddItemToObject(item, "perPlmnOauth2ReqList", per_plmn_oauth2_req_list_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_nf_service_convertToJSON() failed [per_plmn_oauth2_req_list]"); + goto end; + } + } + end: return item; } @@ -629,6 +648,8 @@ OpenAPI_nf_service_t *OpenAPI_nf_service_parseFromJSON(cJSON *nf_serviceJSON) cJSON *supported_vendor_specific_features = NULL; OpenAPI_list_t *supported_vendor_specific_featuresList = NULL; cJSON *oauth2_required = NULL; + cJSON *per_plmn_oauth2_req_list = NULL; + OpenAPI_plmn_oauth2_t *per_plmn_oauth2_req_list_local_nonprim = NULL; service_instance_id = cJSON_GetObjectItemCaseSensitive(nf_serviceJSON, "serviceInstanceId"); if (!service_instance_id) { ogs_error("OpenAPI_nf_service_parseFromJSON() failed [service_instance_id]"); @@ -1088,6 +1109,11 @@ OpenAPI_nf_service_t *OpenAPI_nf_service_parseFromJSON(cJSON *nf_serviceJSON) } } + per_plmn_oauth2_req_list = cJSON_GetObjectItemCaseSensitive(nf_serviceJSON, "perPlmnOauth2ReqList"); + if (per_plmn_oauth2_req_list) { + per_plmn_oauth2_req_list_local_nonprim = OpenAPI_plmn_oauth2_parseFromJSON(per_plmn_oauth2_req_list); + } + nf_service_local_var = OpenAPI_nf_service_create ( ogs_strdup(service_instance_id->valuestring), ogs_strdup(service_name->valuestring), @@ -1121,7 +1147,8 @@ OpenAPI_nf_service_t *OpenAPI_nf_service_parseFromJSON(cJSON *nf_serviceJSON) vendor_id && !cJSON_IsNull(vendor_id) ? ogs_strdup(vendor_id->valuestring) : NULL, supported_vendor_specific_features ? supported_vendor_specific_featuresList : NULL, oauth2_required ? true : false, - oauth2_required ? oauth2_required->valueint : 0 + oauth2_required ? oauth2_required->valueint : 0, + per_plmn_oauth2_req_list ? per_plmn_oauth2_req_list_local_nonprim : NULL ); return nf_service_local_var; @@ -1230,6 +1257,10 @@ end: OpenAPI_list_free(supported_vendor_specific_featuresList); supported_vendor_specific_featuresList = NULL; } + if (per_plmn_oauth2_req_list_local_nonprim) { + OpenAPI_plmn_oauth2_free(per_plmn_oauth2_req_list_local_nonprim); + per_plmn_oauth2_req_list_local_nonprim = NULL; + } return NULL; } diff --git a/lib/sbi/openapi/model/nf_service.h b/lib/sbi/openapi/model/nf_service.h index 5afdebed2..56b39ecd9 100644 --- a/lib/sbi/openapi/model/nf_service.h +++ b/lib/sbi/openapi/model/nf_service.h @@ -1,7 +1,7 @@ /* * nf_service.h * - * Information of a given NF Service Instance; it is part of the NFProfile of an NF Instance + * Information of a given NF Service Instance; it is part of the NFProfile of an NF Instance */ #ifndef _OpenAPI_nf_service_H_ @@ -20,6 +20,7 @@ #include "nf_type.h" #include "plmn_id.h" #include "plmn_id_nid.h" +#include "plmn_oauth2.h" #include "plmn_snssai.h" #include "uri_scheme.h" #include "vendor_specific_feature.h" @@ -63,6 +64,7 @@ typedef struct OpenAPI_nf_service_s { OpenAPI_list_t* supported_vendor_specific_features; bool is_oauth2_required; int oauth2_required; + struct OpenAPI_plmn_oauth2_s *per_plmn_oauth2_req_list; } OpenAPI_nf_service_t; OpenAPI_nf_service_t *OpenAPI_nf_service_create( @@ -98,7 +100,8 @@ OpenAPI_nf_service_t *OpenAPI_nf_service_create( char *vendor_id, OpenAPI_list_t* supported_vendor_specific_features, bool is_oauth2_required, - int oauth2_required + int oauth2_required, + OpenAPI_plmn_oauth2_t *per_plmn_oauth2_req_list ); void OpenAPI_nf_service_free(OpenAPI_nf_service_t *nf_service); OpenAPI_nf_service_t *OpenAPI_nf_service_parseFromJSON(cJSON *nf_serviceJSON); diff --git a/lib/sbi/openapi/model/nf_service_instance.c b/lib/sbi/openapi/model/nf_service_instance.c new file mode 100644 index 000000000..9808cf39e --- /dev/null +++ b/lib/sbi/openapi/model/nf_service_instance.c @@ -0,0 +1,156 @@ + +#include +#include +#include +#include "nf_service_instance.h" + +OpenAPI_nf_service_instance_t *OpenAPI_nf_service_instance_create( + char *service_instance_id, + char *nf_instance_id, + char *nf_service_set_id +) +{ + OpenAPI_nf_service_instance_t *nf_service_instance_local_var = ogs_malloc(sizeof(OpenAPI_nf_service_instance_t)); + ogs_assert(nf_service_instance_local_var); + + nf_service_instance_local_var->service_instance_id = service_instance_id; + nf_service_instance_local_var->nf_instance_id = nf_instance_id; + nf_service_instance_local_var->nf_service_set_id = nf_service_set_id; + + return nf_service_instance_local_var; +} + +void OpenAPI_nf_service_instance_free(OpenAPI_nf_service_instance_t *nf_service_instance) +{ + OpenAPI_lnode_t *node = NULL; + + if (NULL == nf_service_instance) { + return; + } + if (nf_service_instance->service_instance_id) { + ogs_free(nf_service_instance->service_instance_id); + nf_service_instance->service_instance_id = NULL; + } + if (nf_service_instance->nf_instance_id) { + ogs_free(nf_service_instance->nf_instance_id); + nf_service_instance->nf_instance_id = NULL; + } + if (nf_service_instance->nf_service_set_id) { + ogs_free(nf_service_instance->nf_service_set_id); + nf_service_instance->nf_service_set_id = NULL; + } + ogs_free(nf_service_instance); +} + +cJSON *OpenAPI_nf_service_instance_convertToJSON(OpenAPI_nf_service_instance_t *nf_service_instance) +{ + cJSON *item = NULL; + OpenAPI_lnode_t *node = NULL; + + if (nf_service_instance == NULL) { + ogs_error("OpenAPI_nf_service_instance_convertToJSON() failed [NfServiceInstance]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (nf_service_instance->service_instance_id) { + if (cJSON_AddStringToObject(item, "serviceInstanceId", nf_service_instance->service_instance_id) == NULL) { + ogs_error("OpenAPI_nf_service_instance_convertToJSON() failed [service_instance_id]"); + goto end; + } + } + + if (nf_service_instance->nf_instance_id) { + if (cJSON_AddStringToObject(item, "nfInstanceId", nf_service_instance->nf_instance_id) == NULL) { + ogs_error("OpenAPI_nf_service_instance_convertToJSON() failed [nf_instance_id]"); + goto end; + } + } + + if (nf_service_instance->nf_service_set_id) { + if (cJSON_AddStringToObject(item, "nfServiceSetId", nf_service_instance->nf_service_set_id) == NULL) { + ogs_error("OpenAPI_nf_service_instance_convertToJSON() failed [nf_service_set_id]"); + goto end; + } + } + +end: + return item; +} + +OpenAPI_nf_service_instance_t *OpenAPI_nf_service_instance_parseFromJSON(cJSON *nf_service_instanceJSON) +{ + OpenAPI_nf_service_instance_t *nf_service_instance_local_var = NULL; + OpenAPI_lnode_t *node = NULL; + cJSON *service_instance_id = NULL; + cJSON *nf_instance_id = NULL; + cJSON *nf_service_set_id = NULL; + service_instance_id = cJSON_GetObjectItemCaseSensitive(nf_service_instanceJSON, "serviceInstanceId"); + if (service_instance_id) { + if (!cJSON_IsString(service_instance_id) && !cJSON_IsNull(service_instance_id)) { + ogs_error("OpenAPI_nf_service_instance_parseFromJSON() failed [service_instance_id]"); + goto end; + } + } + + nf_instance_id = cJSON_GetObjectItemCaseSensitive(nf_service_instanceJSON, "nfInstanceId"); + if (nf_instance_id) { + if (!cJSON_IsString(nf_instance_id) && !cJSON_IsNull(nf_instance_id)) { + ogs_error("OpenAPI_nf_service_instance_parseFromJSON() failed [nf_instance_id]"); + goto end; + } + } + + nf_service_set_id = cJSON_GetObjectItemCaseSensitive(nf_service_instanceJSON, "nfServiceSetId"); + if (nf_service_set_id) { + if (!cJSON_IsString(nf_service_set_id) && !cJSON_IsNull(nf_service_set_id)) { + ogs_error("OpenAPI_nf_service_instance_parseFromJSON() failed [nf_service_set_id]"); + goto end; + } + } + + nf_service_instance_local_var = OpenAPI_nf_service_instance_create ( + service_instance_id && !cJSON_IsNull(service_instance_id) ? ogs_strdup(service_instance_id->valuestring) : NULL, + nf_instance_id && !cJSON_IsNull(nf_instance_id) ? ogs_strdup(nf_instance_id->valuestring) : NULL, + nf_service_set_id && !cJSON_IsNull(nf_service_set_id) ? ogs_strdup(nf_service_set_id->valuestring) : NULL + ); + + return nf_service_instance_local_var; +end: + return NULL; +} + +OpenAPI_nf_service_instance_t *OpenAPI_nf_service_instance_copy(OpenAPI_nf_service_instance_t *dst, OpenAPI_nf_service_instance_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_nf_service_instance_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_nf_service_instance_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_nf_service_instance_free(dst); + dst = OpenAPI_nf_service_instance_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/nf_service_instance.h b/lib/sbi/openapi/model/nf_service_instance.h new file mode 100644 index 000000000..7221af997 --- /dev/null +++ b/lib/sbi/openapi/model/nf_service_instance.h @@ -0,0 +1,42 @@ +/* + * nf_service_instance.h + * + * NF service instance + */ + +#ifndef _OpenAPI_nf_service_instance_H_ +#define _OpenAPI_nf_service_instance_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_nf_service_instance_s OpenAPI_nf_service_instance_t; +typedef struct OpenAPI_nf_service_instance_s { + char *service_instance_id; + char *nf_instance_id; + char *nf_service_set_id; +} OpenAPI_nf_service_instance_t; + +OpenAPI_nf_service_instance_t *OpenAPI_nf_service_instance_create( + char *service_instance_id, + char *nf_instance_id, + char *nf_service_set_id +); +void OpenAPI_nf_service_instance_free(OpenAPI_nf_service_instance_t *nf_service_instance); +OpenAPI_nf_service_instance_t *OpenAPI_nf_service_instance_parseFromJSON(cJSON *nf_service_instanceJSON); +cJSON *OpenAPI_nf_service_instance_convertToJSON(OpenAPI_nf_service_instance_t *nf_service_instance); +OpenAPI_nf_service_instance_t *OpenAPI_nf_service_instance_copy(OpenAPI_nf_service_instance_t *dst, OpenAPI_nf_service_instance_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_nf_service_instance_H_ */ + diff --git a/lib/sbi/openapi/model/nf_service_set_cond.c b/lib/sbi/openapi/model/nf_service_set_cond.c index da223db9b..b24c626c9 100644 --- a/lib/sbi/openapi/model/nf_service_set_cond.c +++ b/lib/sbi/openapi/model/nf_service_set_cond.c @@ -5,13 +5,15 @@ #include "nf_service_set_cond.h" OpenAPI_nf_service_set_cond_t *OpenAPI_nf_service_set_cond_create( - char *nf_service_set_id + char *nf_service_set_id, + char *nf_set_id ) { OpenAPI_nf_service_set_cond_t *nf_service_set_cond_local_var = ogs_malloc(sizeof(OpenAPI_nf_service_set_cond_t)); ogs_assert(nf_service_set_cond_local_var); nf_service_set_cond_local_var->nf_service_set_id = nf_service_set_id; + nf_service_set_cond_local_var->nf_set_id = nf_set_id; return nf_service_set_cond_local_var; } @@ -27,6 +29,10 @@ void OpenAPI_nf_service_set_cond_free(OpenAPI_nf_service_set_cond_t *nf_service_ ogs_free(nf_service_set_cond->nf_service_set_id); nf_service_set_cond->nf_service_set_id = NULL; } + if (nf_service_set_cond->nf_set_id) { + ogs_free(nf_service_set_cond->nf_set_id); + nf_service_set_cond->nf_set_id = NULL; + } ogs_free(nf_service_set_cond); } @@ -50,6 +56,13 @@ cJSON *OpenAPI_nf_service_set_cond_convertToJSON(OpenAPI_nf_service_set_cond_t * goto end; } + if (nf_service_set_cond->nf_set_id) { + if (cJSON_AddStringToObject(item, "nfSetId", nf_service_set_cond->nf_set_id) == NULL) { + ogs_error("OpenAPI_nf_service_set_cond_convertToJSON() failed [nf_set_id]"); + goto end; + } + } + end: return item; } @@ -59,6 +72,7 @@ OpenAPI_nf_service_set_cond_t *OpenAPI_nf_service_set_cond_parseFromJSON(cJSON * OpenAPI_nf_service_set_cond_t *nf_service_set_cond_local_var = NULL; OpenAPI_lnode_t *node = NULL; cJSON *nf_service_set_id = NULL; + cJSON *nf_set_id = NULL; nf_service_set_id = cJSON_GetObjectItemCaseSensitive(nf_service_set_condJSON, "nfServiceSetId"); if (!nf_service_set_id) { ogs_error("OpenAPI_nf_service_set_cond_parseFromJSON() failed [nf_service_set_id]"); @@ -69,8 +83,17 @@ OpenAPI_nf_service_set_cond_t *OpenAPI_nf_service_set_cond_parseFromJSON(cJSON * goto end; } + nf_set_id = cJSON_GetObjectItemCaseSensitive(nf_service_set_condJSON, "nfSetId"); + if (nf_set_id) { + if (!cJSON_IsString(nf_set_id) && !cJSON_IsNull(nf_set_id)) { + ogs_error("OpenAPI_nf_service_set_cond_parseFromJSON() failed [nf_set_id]"); + goto end; + } + } + nf_service_set_cond_local_var = OpenAPI_nf_service_set_cond_create ( - ogs_strdup(nf_service_set_id->valuestring) + ogs_strdup(nf_service_set_id->valuestring), + nf_set_id && !cJSON_IsNull(nf_set_id) ? ogs_strdup(nf_set_id->valuestring) : NULL ); return nf_service_set_cond_local_var; diff --git a/lib/sbi/openapi/model/nf_service_set_cond.h b/lib/sbi/openapi/model/nf_service_set_cond.h index e11328a75..7f5e6a83e 100644 --- a/lib/sbi/openapi/model/nf_service_set_cond.h +++ b/lib/sbi/openapi/model/nf_service_set_cond.h @@ -20,10 +20,12 @@ extern "C" { typedef struct OpenAPI_nf_service_set_cond_s OpenAPI_nf_service_set_cond_t; typedef struct OpenAPI_nf_service_set_cond_s { char *nf_service_set_id; + char *nf_set_id; } OpenAPI_nf_service_set_cond_t; OpenAPI_nf_service_set_cond_t *OpenAPI_nf_service_set_cond_create( - char *nf_service_set_id + char *nf_service_set_id, + char *nf_set_id ); void OpenAPI_nf_service_set_cond_free(OpenAPI_nf_service_set_cond_t *nf_service_set_cond); OpenAPI_nf_service_set_cond_t *OpenAPI_nf_service_set_cond_parseFromJSON(cJSON *nf_service_set_condJSON); diff --git a/lib/sbi/openapi/model/nf_type.c b/lib/sbi/openapi/model/nf_type.c index 0a9518fb8..46992d1fa 100644 --- a/lib/sbi/openapi/model/nf_type.c +++ b/lib/sbi/openapi/model/nf_type.c @@ -6,7 +6,7 @@ char* OpenAPI_nf_type_ToString(OpenAPI_nf_type_e nf_type) { - const char *nf_typeArray[] = { "NULL", "NRF", "UDM", "AMF", "SMF", "AUSF", "NEF", "PCF", "SMSF", "NSSF", "UDR", "LMF", "GMLC", "5G_EIR", "SEPP", "UPF", "N3IWF", "AF", "UDSF", "BSF", "CHF", "NWDAF", "PCSCF", "CBCF", "HSS", "UCMF", "SOR_AF", "SPAF", "MME", "SCSAS", "SCEF", "SCP", "NSSAAF", "ICSCF", "SCSCF", "DRA" }; + const char *nf_typeArray[] = { "NULL", "NRF", "UDM", "AMF", "SMF", "AUSF", "NEF", "PCF", "SMSF", "NSSF", "UDR", "LMF", "GMLC", "5G_EIR", "SEPP", "UPF", "N3IWF", "AF", "UDSF", "BSF", "CHF", "NWDAF", "PCSCF", "CBCF", "HSS", "UCMF", "SOR_AF", "SPAF", "MME", "SCSAS", "SCEF", "SCP", "NSSAAF", "ICSCF", "SCSCF", "DRA", "IMS_AS", "AANF", "5G_DDNMF", "NSACF", "MFAF", "EASDF", "DCCF", "MB_SMF", "TSCTSF", "ADRF", "GBA_BSF", "CEF", "MB_UPF", "NSWOF", "PKMF", "MNPF", "SMS_GMSC", "SMS_IWMSC", "MBSF", "MBSTF", "PANF" }; size_t sizeofArray = sizeof(nf_typeArray) / sizeof(nf_typeArray[0]); if (nf_type < sizeofArray) return (char *)nf_typeArray[nf_type]; @@ -17,7 +17,7 @@ char* OpenAPI_nf_type_ToString(OpenAPI_nf_type_e nf_type) OpenAPI_nf_type_e OpenAPI_nf_type_FromString(char* nf_type) { int stringToReturn = 0; - const char *nf_typeArray[] = { "NULL", "NRF", "UDM", "AMF", "SMF", "AUSF", "NEF", "PCF", "SMSF", "NSSF", "UDR", "LMF", "GMLC", "5G_EIR", "SEPP", "UPF", "N3IWF", "AF", "UDSF", "BSF", "CHF", "NWDAF", "PCSCF", "CBCF", "HSS", "UCMF", "SOR_AF", "SPAF", "MME", "SCSAS", "SCEF", "SCP", "NSSAAF", "ICSCF", "SCSCF", "DRA" }; + const char *nf_typeArray[] = { "NULL", "NRF", "UDM", "AMF", "SMF", "AUSF", "NEF", "PCF", "SMSF", "NSSF", "UDR", "LMF", "GMLC", "5G_EIR", "SEPP", "UPF", "N3IWF", "AF", "UDSF", "BSF", "CHF", "NWDAF", "PCSCF", "CBCF", "HSS", "UCMF", "SOR_AF", "SPAF", "MME", "SCSAS", "SCEF", "SCP", "NSSAAF", "ICSCF", "SCSCF", "DRA", "IMS_AS", "AANF", "5G_DDNMF", "NSACF", "MFAF", "EASDF", "DCCF", "MB_SMF", "TSCTSF", "ADRF", "GBA_BSF", "CEF", "MB_UPF", "NSWOF", "PKMF", "MNPF", "SMS_GMSC", "SMS_IWMSC", "MBSF", "MBSTF", "PANF" }; size_t sizeofArray = sizeof(nf_typeArray) / sizeof(nf_typeArray[0]); while (stringToReturn < sizeofArray) { if (strcmp(nf_type, nf_typeArray[stringToReturn]) == 0) { diff --git a/lib/sbi/openapi/model/nf_type.h b/lib/sbi/openapi/model/nf_type.h index c96fd96d4..29e4297ae 100644 --- a/lib/sbi/openapi/model/nf_type.h +++ b/lib/sbi/openapi/model/nf_type.h @@ -17,7 +17,7 @@ extern "C" { #endif -typedef enum { OpenAPI_nf_type_NULL = 0, OpenAPI_nf_type_NRF, OpenAPI_nf_type_UDM, OpenAPI_nf_type_AMF, OpenAPI_nf_type_SMF, OpenAPI_nf_type_AUSF, OpenAPI_nf_type_NEF, OpenAPI_nf_type_PCF, OpenAPI_nf_type_SMSF, OpenAPI_nf_type_NSSF, OpenAPI_nf_type_UDR, OpenAPI_nf_type_LMF, OpenAPI_nf_type_GMLC, OpenAPI_nf_type_5G_EIR, OpenAPI_nf_type_SEPP, OpenAPI_nf_type_UPF, OpenAPI_nf_type_N3IWF, OpenAPI_nf_type_AF, OpenAPI_nf_type_UDSF, OpenAPI_nf_type_BSF, OpenAPI_nf_type_CHF, OpenAPI_nf_type_NWDAF, OpenAPI_nf_type_PCSCF, OpenAPI_nf_type_CBCF, OpenAPI_nf_type_HSS, OpenAPI_nf_type_UCMF, OpenAPI_nf_type_SOR_AF, OpenAPI_nf_type_SPAF, OpenAPI_nf_type_MME, OpenAPI_nf_type_SCSAS, OpenAPI_nf_type_SCEF, OpenAPI_nf_type_SCP, OpenAPI_nf_type_NSSAAF, OpenAPI_nf_type_ICSCF, OpenAPI_nf_type_SCSCF, OpenAPI_nf_type_DRA } OpenAPI_nf_type_e; +typedef enum { OpenAPI_nf_type_NULL = 0, OpenAPI_nf_type_NRF, OpenAPI_nf_type_UDM, OpenAPI_nf_type_AMF, OpenAPI_nf_type_SMF, OpenAPI_nf_type_AUSF, OpenAPI_nf_type_NEF, OpenAPI_nf_type_PCF, OpenAPI_nf_type_SMSF, OpenAPI_nf_type_NSSF, OpenAPI_nf_type_UDR, OpenAPI_nf_type_LMF, OpenAPI_nf_type_GMLC, OpenAPI_nf_type_5G_EIR, OpenAPI_nf_type_SEPP, OpenAPI_nf_type_UPF, OpenAPI_nf_type_N3IWF, OpenAPI_nf_type_AF, OpenAPI_nf_type_UDSF, OpenAPI_nf_type_BSF, OpenAPI_nf_type_CHF, OpenAPI_nf_type_NWDAF, OpenAPI_nf_type_PCSCF, OpenAPI_nf_type_CBCF, OpenAPI_nf_type_HSS, OpenAPI_nf_type_UCMF, OpenAPI_nf_type_SOR_AF, OpenAPI_nf_type_SPAF, OpenAPI_nf_type_MME, OpenAPI_nf_type_SCSAS, OpenAPI_nf_type_SCEF, OpenAPI_nf_type_SCP, OpenAPI_nf_type_NSSAAF, OpenAPI_nf_type_ICSCF, OpenAPI_nf_type_SCSCF, OpenAPI_nf_type_DRA, OpenAPI_nf_type_IMS_AS, OpenAPI_nf_type_AANF, OpenAPI_nf_type__5G_DDNMF, OpenAPI_nf_type_NSACF, OpenAPI_nf_type_MFAF, OpenAPI_nf_type_EASDF, OpenAPI_nf_type_DCCF, OpenAPI_nf_type_MB_SMF, OpenAPI_nf_type_TSCTSF, OpenAPI_nf_type_ADRF, OpenAPI_nf_type_GBA_BSF, OpenAPI_nf_type_CEF, OpenAPI_nf_type_MB_UPF, OpenAPI_nf_type_NSWOF, OpenAPI_nf_type_PKMF, OpenAPI_nf_type_MNPF, OpenAPI_nf_type_SMS_GMSC, OpenAPI_nf_type_SMS_IWMSC, OpenAPI_nf_type_MBSF, OpenAPI_nf_type_MBSTF, OpenAPI_nf_type_PANF } OpenAPI_nf_type_e; char* OpenAPI_nf_type_ToString(OpenAPI_nf_type_e nf_type); diff --git a/lib/sbi/openapi/model/ng_ap_cause.h b/lib/sbi/openapi/model/ng_ap_cause.h index 8ab3bef0a..4de86fd1d 100644 --- a/lib/sbi/openapi/model/ng_ap_cause.h +++ b/lib/sbi/openapi/model/ng_ap_cause.h @@ -1,7 +1,7 @@ /* * ng_ap_cause.h * - * + * Represents the NGAP cause. */ #ifndef _OpenAPI_ng_ap_cause_H_ diff --git a/lib/sbi/openapi/model/ng_ksi.h b/lib/sbi/openapi/model/ng_ksi.h index f4eedf5c9..9dd1bed97 100644 --- a/lib/sbi/openapi/model/ng_ksi.h +++ b/lib/sbi/openapi/model/ng_ksi.h @@ -1,7 +1,7 @@ /* * ng_ksi.h * - * + * Represents the ngKSI */ #ifndef _OpenAPI_ng_ksi_H_ diff --git a/lib/sbi/openapi/model/ng_ran_target_id.h b/lib/sbi/openapi/model/ng_ran_target_id.h index fd3579e2a..9363db4a1 100644 --- a/lib/sbi/openapi/model/ng_ran_target_id.h +++ b/lib/sbi/openapi/model/ng_ran_target_id.h @@ -1,7 +1,7 @@ /* * ng_ran_target_id.h * - * + * Indicates a NG RAN as target of the handover */ #ifndef _OpenAPI_ng_ran_target_id_H_ diff --git a/lib/sbi/openapi/model/ngap_ie_type.c b/lib/sbi/openapi/model/ngap_ie_type.c index cc23ff81f..5d2314d6e 100644 --- a/lib/sbi/openapi/model/ngap_ie_type.c +++ b/lib/sbi/openapi/model/ngap_ie_type.c @@ -6,7 +6,7 @@ char* OpenAPI_ngap_ie_type_ToString(OpenAPI_ngap_ie_type_e ngap_ie_type) { - const char *ngap_ie_typeArray[] = { "NULL", "PDU_RES_SETUP_REQ", "PDU_RES_REL_CMD", "PDU_RES_MOD_REQ", "HANDOVER_CMD", "HANDOVER_REQUIRED", "HANDOVER_PREP_FAIL", "SRC_TO_TAR_CONTAINER", "TAR_TO_SRC_CONTAINER", "TAR_TO_SRC_FAIL_CONTAINER", "RAN_STATUS_TRANS_CONTAINER", "SON_CONFIG_TRANSFER", "NRPPA_PDU", "UE_RADIO_CAPABILITY", "RIM_INFO_TRANSFER", "SECONDARY_RAT_USAGE", "PC5_QOS_PARA", "EARLY_STATUS_TRANS_CONTAINER" }; + const char *ngap_ie_typeArray[] = { "NULL", "PDU_RES_SETUP_REQ", "PDU_RES_REL_CMD", "PDU_RES_MOD_REQ", "HANDOVER_CMD", "HANDOVER_REQUIRED", "HANDOVER_PREP_FAIL", "SRC_TO_TAR_CONTAINER", "TAR_TO_SRC_CONTAINER", "TAR_TO_SRC_FAIL_CONTAINER", "RAN_STATUS_TRANS_CONTAINER", "SON_CONFIG_TRANSFER", "NRPPA_PDU", "UE_RADIO_CAPABILITY", "RIM_INFO_TRANSFER", "SECONDARY_RAT_USAGE", "PC5_QOS_PARA", "EARLY_STATUS_TRANS_CONTAINER", "UE_RADIO_CAPABILITY_FOR_PAGING" }; size_t sizeofArray = sizeof(ngap_ie_typeArray) / sizeof(ngap_ie_typeArray[0]); if (ngap_ie_type < sizeofArray) return (char *)ngap_ie_typeArray[ngap_ie_type]; @@ -17,7 +17,7 @@ char* OpenAPI_ngap_ie_type_ToString(OpenAPI_ngap_ie_type_e ngap_ie_type) OpenAPI_ngap_ie_type_e OpenAPI_ngap_ie_type_FromString(char* ngap_ie_type) { int stringToReturn = 0; - const char *ngap_ie_typeArray[] = { "NULL", "PDU_RES_SETUP_REQ", "PDU_RES_REL_CMD", "PDU_RES_MOD_REQ", "HANDOVER_CMD", "HANDOVER_REQUIRED", "HANDOVER_PREP_FAIL", "SRC_TO_TAR_CONTAINER", "TAR_TO_SRC_CONTAINER", "TAR_TO_SRC_FAIL_CONTAINER", "RAN_STATUS_TRANS_CONTAINER", "SON_CONFIG_TRANSFER", "NRPPA_PDU", "UE_RADIO_CAPABILITY", "RIM_INFO_TRANSFER", "SECONDARY_RAT_USAGE", "PC5_QOS_PARA", "EARLY_STATUS_TRANS_CONTAINER" }; + const char *ngap_ie_typeArray[] = { "NULL", "PDU_RES_SETUP_REQ", "PDU_RES_REL_CMD", "PDU_RES_MOD_REQ", "HANDOVER_CMD", "HANDOVER_REQUIRED", "HANDOVER_PREP_FAIL", "SRC_TO_TAR_CONTAINER", "TAR_TO_SRC_CONTAINER", "TAR_TO_SRC_FAIL_CONTAINER", "RAN_STATUS_TRANS_CONTAINER", "SON_CONFIG_TRANSFER", "NRPPA_PDU", "UE_RADIO_CAPABILITY", "RIM_INFO_TRANSFER", "SECONDARY_RAT_USAGE", "PC5_QOS_PARA", "EARLY_STATUS_TRANS_CONTAINER", "UE_RADIO_CAPABILITY_FOR_PAGING" }; size_t sizeofArray = sizeof(ngap_ie_typeArray) / sizeof(ngap_ie_typeArray[0]); while (stringToReturn < sizeofArray) { if (strcmp(ngap_ie_type, ngap_ie_typeArray[stringToReturn]) == 0) { diff --git a/lib/sbi/openapi/model/ngap_ie_type.h b/lib/sbi/openapi/model/ngap_ie_type.h index 62c469c05..72f4a630c 100644 --- a/lib/sbi/openapi/model/ngap_ie_type.h +++ b/lib/sbi/openapi/model/ngap_ie_type.h @@ -17,7 +17,7 @@ extern "C" { #endif -typedef enum { OpenAPI_ngap_ie_type_NULL = 0, OpenAPI_ngap_ie_type_PDU_RES_SETUP_REQ, OpenAPI_ngap_ie_type_PDU_RES_REL_CMD, OpenAPI_ngap_ie_type_PDU_RES_MOD_REQ, OpenAPI_ngap_ie_type_HANDOVER_CMD, OpenAPI_ngap_ie_type_HANDOVER_REQUIRED, OpenAPI_ngap_ie_type_HANDOVER_PREP_FAIL, OpenAPI_ngap_ie_type_SRC_TO_TAR_CONTAINER, OpenAPI_ngap_ie_type_TAR_TO_SRC_CONTAINER, OpenAPI_ngap_ie_type_TAR_TO_SRC_FAIL_CONTAINER, OpenAPI_ngap_ie_type_RAN_STATUS_TRANS_CONTAINER, OpenAPI_ngap_ie_type_SON_CONFIG_TRANSFER, OpenAPI_ngap_ie_type_NRPPA_PDU, OpenAPI_ngap_ie_type_UE_RADIO_CAPABILITY, OpenAPI_ngap_ie_type_RIM_INFO_TRANSFER, OpenAPI_ngap_ie_type_SECONDARY_RAT_USAGE, OpenAPI_ngap_ie_type_PC5_QOS_PARA, OpenAPI_ngap_ie_type_EARLY_STATUS_TRANS_CONTAINER } OpenAPI_ngap_ie_type_e; +typedef enum { OpenAPI_ngap_ie_type_NULL = 0, OpenAPI_ngap_ie_type_PDU_RES_SETUP_REQ, OpenAPI_ngap_ie_type_PDU_RES_REL_CMD, OpenAPI_ngap_ie_type_PDU_RES_MOD_REQ, OpenAPI_ngap_ie_type_HANDOVER_CMD, OpenAPI_ngap_ie_type_HANDOVER_REQUIRED, OpenAPI_ngap_ie_type_HANDOVER_PREP_FAIL, OpenAPI_ngap_ie_type_SRC_TO_TAR_CONTAINER, OpenAPI_ngap_ie_type_TAR_TO_SRC_CONTAINER, OpenAPI_ngap_ie_type_TAR_TO_SRC_FAIL_CONTAINER, OpenAPI_ngap_ie_type_RAN_STATUS_TRANS_CONTAINER, OpenAPI_ngap_ie_type_SON_CONFIG_TRANSFER, OpenAPI_ngap_ie_type_NRPPA_PDU, OpenAPI_ngap_ie_type_UE_RADIO_CAPABILITY, OpenAPI_ngap_ie_type_RIM_INFO_TRANSFER, OpenAPI_ngap_ie_type_SECONDARY_RAT_USAGE, OpenAPI_ngap_ie_type_PC5_QOS_PARA, OpenAPI_ngap_ie_type_EARLY_STATUS_TRANS_CONTAINER, OpenAPI_ngap_ie_type_UE_RADIO_CAPABILITY_FOR_PAGING } OpenAPI_ngap_ie_type_e; char* OpenAPI_ngap_ie_type_ToString(OpenAPI_ngap_ie_type_e ngap_ie_type); diff --git a/lib/sbi/openapi/model/nidd_authorization_info.c b/lib/sbi/openapi/model/nidd_authorization_info.c new file mode 100644 index 000000000..dd4bdaa13 --- /dev/null +++ b/lib/sbi/openapi/model/nidd_authorization_info.c @@ -0,0 +1,151 @@ + +#include +#include +#include +#include "nidd_authorization_info.h" + +OpenAPI_nidd_authorization_info_t *OpenAPI_nidd_authorization_info_create( + OpenAPI_list_t *nidd_authorization_list +) +{ + OpenAPI_nidd_authorization_info_t *nidd_authorization_info_local_var = ogs_malloc(sizeof(OpenAPI_nidd_authorization_info_t)); + ogs_assert(nidd_authorization_info_local_var); + + nidd_authorization_info_local_var->nidd_authorization_list = nidd_authorization_list; + + return nidd_authorization_info_local_var; +} + +void OpenAPI_nidd_authorization_info_free(OpenAPI_nidd_authorization_info_t *nidd_authorization_info) +{ + OpenAPI_lnode_t *node = NULL; + + if (NULL == nidd_authorization_info) { + return; + } + if (nidd_authorization_info->nidd_authorization_list) { + OpenAPI_list_for_each(nidd_authorization_info->nidd_authorization_list, node) { + OpenAPI_authorization_info_free(node->data); + } + OpenAPI_list_free(nidd_authorization_info->nidd_authorization_list); + nidd_authorization_info->nidd_authorization_list = NULL; + } + ogs_free(nidd_authorization_info); +} + +cJSON *OpenAPI_nidd_authorization_info_convertToJSON(OpenAPI_nidd_authorization_info_t *nidd_authorization_info) +{ + cJSON *item = NULL; + OpenAPI_lnode_t *node = NULL; + + if (nidd_authorization_info == NULL) { + ogs_error("OpenAPI_nidd_authorization_info_convertToJSON() failed [NiddAuthorizationInfo]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (!nidd_authorization_info->nidd_authorization_list) { + ogs_error("OpenAPI_nidd_authorization_info_convertToJSON() failed [nidd_authorization_list]"); + return NULL; + } + cJSON *nidd_authorization_listList = cJSON_AddArrayToObject(item, "niddAuthorizationList"); + if (nidd_authorization_listList == NULL) { + ogs_error("OpenAPI_nidd_authorization_info_convertToJSON() failed [nidd_authorization_list]"); + goto end; + } + OpenAPI_list_for_each(nidd_authorization_info->nidd_authorization_list, node) { + cJSON *itemLocal = OpenAPI_authorization_info_convertToJSON(node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_nidd_authorization_info_convertToJSON() failed [nidd_authorization_list]"); + goto end; + } + cJSON_AddItemToArray(nidd_authorization_listList, itemLocal); + } + +end: + return item; +} + +OpenAPI_nidd_authorization_info_t *OpenAPI_nidd_authorization_info_parseFromJSON(cJSON *nidd_authorization_infoJSON) +{ + OpenAPI_nidd_authorization_info_t *nidd_authorization_info_local_var = NULL; + OpenAPI_lnode_t *node = NULL; + cJSON *nidd_authorization_list = NULL; + OpenAPI_list_t *nidd_authorization_listList = NULL; + nidd_authorization_list = cJSON_GetObjectItemCaseSensitive(nidd_authorization_infoJSON, "niddAuthorizationList"); + if (!nidd_authorization_list) { + ogs_error("OpenAPI_nidd_authorization_info_parseFromJSON() failed [nidd_authorization_list]"); + goto end; + } + cJSON *nidd_authorization_list_local = NULL; + if (!cJSON_IsArray(nidd_authorization_list)) { + ogs_error("OpenAPI_nidd_authorization_info_parseFromJSON() failed [nidd_authorization_list]"); + goto end; + } + + nidd_authorization_listList = OpenAPI_list_create(); + + cJSON_ArrayForEach(nidd_authorization_list_local, nidd_authorization_list) { + if (!cJSON_IsObject(nidd_authorization_list_local)) { + ogs_error("OpenAPI_nidd_authorization_info_parseFromJSON() failed [nidd_authorization_list]"); + goto end; + } + OpenAPI_authorization_info_t *nidd_authorization_listItem = OpenAPI_authorization_info_parseFromJSON(nidd_authorization_list_local); + if (!nidd_authorization_listItem) { + ogs_error("No nidd_authorization_listItem"); + OpenAPI_list_free(nidd_authorization_listList); + goto end; + } + OpenAPI_list_add(nidd_authorization_listList, nidd_authorization_listItem); + } + + nidd_authorization_info_local_var = OpenAPI_nidd_authorization_info_create ( + nidd_authorization_listList + ); + + return nidd_authorization_info_local_var; +end: + if (nidd_authorization_listList) { + OpenAPI_list_for_each(nidd_authorization_listList, node) { + OpenAPI_authorization_info_free(node->data); + } + OpenAPI_list_free(nidd_authorization_listList); + nidd_authorization_listList = NULL; + } + return NULL; +} + +OpenAPI_nidd_authorization_info_t *OpenAPI_nidd_authorization_info_copy(OpenAPI_nidd_authorization_info_t *dst, OpenAPI_nidd_authorization_info_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_nidd_authorization_info_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_nidd_authorization_info_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_nidd_authorization_info_free(dst); + dst = OpenAPI_nidd_authorization_info_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/nidd_authorization_info.h b/lib/sbi/openapi/model/nidd_authorization_info.h new file mode 100644 index 000000000..4bb97c0fd --- /dev/null +++ b/lib/sbi/openapi/model/nidd_authorization_info.h @@ -0,0 +1,39 @@ +/* + * nidd_authorization_info.h + * + * Information related to active NIDD Authorizations + */ + +#ifndef _OpenAPI_nidd_authorization_info_H_ +#define _OpenAPI_nidd_authorization_info_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "authorization_info.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_nidd_authorization_info_s OpenAPI_nidd_authorization_info_t; +typedef struct OpenAPI_nidd_authorization_info_s { + OpenAPI_list_t *nidd_authorization_list; +} OpenAPI_nidd_authorization_info_t; + +OpenAPI_nidd_authorization_info_t *OpenAPI_nidd_authorization_info_create( + OpenAPI_list_t *nidd_authorization_list +); +void OpenAPI_nidd_authorization_info_free(OpenAPI_nidd_authorization_info_t *nidd_authorization_info); +OpenAPI_nidd_authorization_info_t *OpenAPI_nidd_authorization_info_parseFromJSON(cJSON *nidd_authorization_infoJSON); +cJSON *OpenAPI_nidd_authorization_info_convertToJSON(OpenAPI_nidd_authorization_info_t *nidd_authorization_info); +OpenAPI_nidd_authorization_info_t *OpenAPI_nidd_authorization_info_copy(OpenAPI_nidd_authorization_info_t *dst, OpenAPI_nidd_authorization_info_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_nidd_authorization_info_H_ */ + diff --git a/lib/sbi/openapi/model/nnwdaf_events_subscription.c b/lib/sbi/openapi/model/nnwdaf_events_subscription.c new file mode 100644 index 000000000..a235a13b2 --- /dev/null +++ b/lib/sbi/openapi/model/nnwdaf_events_subscription.c @@ -0,0 +1,433 @@ + +#include +#include +#include +#include "nnwdaf_events_subscription.h" + +OpenAPI_nnwdaf_events_subscription_t *OpenAPI_nnwdaf_events_subscription_create( + OpenAPI_list_t *event_subscriptions, + OpenAPI_reporting_information_t *evt_req, + char *notification_uri, + char *notif_corr_id, + char *supported_features, + OpenAPI_list_t *event_notifications, + OpenAPI_list_t *fail_event_reports, + OpenAPI_prev_sub_info_t *prev_sub, + OpenAPI_consumer_nf_information_t *cons_nf_info +) +{ + OpenAPI_nnwdaf_events_subscription_t *nnwdaf_events_subscription_local_var = ogs_malloc(sizeof(OpenAPI_nnwdaf_events_subscription_t)); + ogs_assert(nnwdaf_events_subscription_local_var); + + nnwdaf_events_subscription_local_var->event_subscriptions = event_subscriptions; + nnwdaf_events_subscription_local_var->evt_req = evt_req; + nnwdaf_events_subscription_local_var->notification_uri = notification_uri; + nnwdaf_events_subscription_local_var->notif_corr_id = notif_corr_id; + nnwdaf_events_subscription_local_var->supported_features = supported_features; + nnwdaf_events_subscription_local_var->event_notifications = event_notifications; + nnwdaf_events_subscription_local_var->fail_event_reports = fail_event_reports; + nnwdaf_events_subscription_local_var->prev_sub = prev_sub; + nnwdaf_events_subscription_local_var->cons_nf_info = cons_nf_info; + + return nnwdaf_events_subscription_local_var; +} + +void OpenAPI_nnwdaf_events_subscription_free(OpenAPI_nnwdaf_events_subscription_t *nnwdaf_events_subscription) +{ + OpenAPI_lnode_t *node = NULL; + + if (NULL == nnwdaf_events_subscription) { + return; + } + if (nnwdaf_events_subscription->event_subscriptions) { + OpenAPI_list_for_each(nnwdaf_events_subscription->event_subscriptions, node) { + OpenAPI_event_subscription_free(node->data); + } + OpenAPI_list_free(nnwdaf_events_subscription->event_subscriptions); + nnwdaf_events_subscription->event_subscriptions = NULL; + } + if (nnwdaf_events_subscription->evt_req) { + OpenAPI_reporting_information_free(nnwdaf_events_subscription->evt_req); + nnwdaf_events_subscription->evt_req = NULL; + } + if (nnwdaf_events_subscription->notification_uri) { + ogs_free(nnwdaf_events_subscription->notification_uri); + nnwdaf_events_subscription->notification_uri = NULL; + } + if (nnwdaf_events_subscription->notif_corr_id) { + ogs_free(nnwdaf_events_subscription->notif_corr_id); + nnwdaf_events_subscription->notif_corr_id = NULL; + } + if (nnwdaf_events_subscription->supported_features) { + ogs_free(nnwdaf_events_subscription->supported_features); + nnwdaf_events_subscription->supported_features = NULL; + } + if (nnwdaf_events_subscription->event_notifications) { + OpenAPI_list_for_each(nnwdaf_events_subscription->event_notifications, node) { + OpenAPI_event_notification_free(node->data); + } + OpenAPI_list_free(nnwdaf_events_subscription->event_notifications); + nnwdaf_events_subscription->event_notifications = NULL; + } + if (nnwdaf_events_subscription->fail_event_reports) { + OpenAPI_list_for_each(nnwdaf_events_subscription->fail_event_reports, node) { + OpenAPI_failure_event_info_free(node->data); + } + OpenAPI_list_free(nnwdaf_events_subscription->fail_event_reports); + nnwdaf_events_subscription->fail_event_reports = NULL; + } + if (nnwdaf_events_subscription->prev_sub) { + OpenAPI_prev_sub_info_free(nnwdaf_events_subscription->prev_sub); + nnwdaf_events_subscription->prev_sub = NULL; + } + if (nnwdaf_events_subscription->cons_nf_info) { + OpenAPI_consumer_nf_information_free(nnwdaf_events_subscription->cons_nf_info); + nnwdaf_events_subscription->cons_nf_info = NULL; + } + ogs_free(nnwdaf_events_subscription); +} + +cJSON *OpenAPI_nnwdaf_events_subscription_convertToJSON(OpenAPI_nnwdaf_events_subscription_t *nnwdaf_events_subscription) +{ + cJSON *item = NULL; + OpenAPI_lnode_t *node = NULL; + + if (nnwdaf_events_subscription == NULL) { + ogs_error("OpenAPI_nnwdaf_events_subscription_convertToJSON() failed [NnwdafEventsSubscription]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (!nnwdaf_events_subscription->event_subscriptions) { + ogs_error("OpenAPI_nnwdaf_events_subscription_convertToJSON() failed [event_subscriptions]"); + return NULL; + } + cJSON *event_subscriptionsList = cJSON_AddArrayToObject(item, "eventSubscriptions"); + if (event_subscriptionsList == NULL) { + ogs_error("OpenAPI_nnwdaf_events_subscription_convertToJSON() failed [event_subscriptions]"); + goto end; + } + OpenAPI_list_for_each(nnwdaf_events_subscription->event_subscriptions, node) { + cJSON *itemLocal = OpenAPI_event_subscription_convertToJSON(node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_nnwdaf_events_subscription_convertToJSON() failed [event_subscriptions]"); + goto end; + } + cJSON_AddItemToArray(event_subscriptionsList, itemLocal); + } + + if (nnwdaf_events_subscription->evt_req) { + cJSON *evt_req_local_JSON = OpenAPI_reporting_information_convertToJSON(nnwdaf_events_subscription->evt_req); + if (evt_req_local_JSON == NULL) { + ogs_error("OpenAPI_nnwdaf_events_subscription_convertToJSON() failed [evt_req]"); + goto end; + } + cJSON_AddItemToObject(item, "evtReq", evt_req_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_nnwdaf_events_subscription_convertToJSON() failed [evt_req]"); + goto end; + } + } + + if (nnwdaf_events_subscription->notification_uri) { + if (cJSON_AddStringToObject(item, "notificationURI", nnwdaf_events_subscription->notification_uri) == NULL) { + ogs_error("OpenAPI_nnwdaf_events_subscription_convertToJSON() failed [notification_uri]"); + goto end; + } + } + + if (nnwdaf_events_subscription->notif_corr_id) { + if (cJSON_AddStringToObject(item, "notifCorrId", nnwdaf_events_subscription->notif_corr_id) == NULL) { + ogs_error("OpenAPI_nnwdaf_events_subscription_convertToJSON() failed [notif_corr_id]"); + goto end; + } + } + + if (nnwdaf_events_subscription->supported_features) { + if (cJSON_AddStringToObject(item, "supportedFeatures", nnwdaf_events_subscription->supported_features) == NULL) { + ogs_error("OpenAPI_nnwdaf_events_subscription_convertToJSON() failed [supported_features]"); + goto end; + } + } + + if (nnwdaf_events_subscription->event_notifications) { + cJSON *event_notificationsList = cJSON_AddArrayToObject(item, "eventNotifications"); + if (event_notificationsList == NULL) { + ogs_error("OpenAPI_nnwdaf_events_subscription_convertToJSON() failed [event_notifications]"); + goto end; + } + OpenAPI_list_for_each(nnwdaf_events_subscription->event_notifications, node) { + cJSON *itemLocal = OpenAPI_event_notification_convertToJSON(node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_nnwdaf_events_subscription_convertToJSON() failed [event_notifications]"); + goto end; + } + cJSON_AddItemToArray(event_notificationsList, itemLocal); + } + } + + if (nnwdaf_events_subscription->fail_event_reports) { + cJSON *fail_event_reportsList = cJSON_AddArrayToObject(item, "failEventReports"); + if (fail_event_reportsList == NULL) { + ogs_error("OpenAPI_nnwdaf_events_subscription_convertToJSON() failed [fail_event_reports]"); + goto end; + } + OpenAPI_list_for_each(nnwdaf_events_subscription->fail_event_reports, node) { + cJSON *itemLocal = OpenAPI_failure_event_info_convertToJSON(node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_nnwdaf_events_subscription_convertToJSON() failed [fail_event_reports]"); + goto end; + } + cJSON_AddItemToArray(fail_event_reportsList, itemLocal); + } + } + + if (nnwdaf_events_subscription->prev_sub) { + cJSON *prev_sub_local_JSON = OpenAPI_prev_sub_info_convertToJSON(nnwdaf_events_subscription->prev_sub); + if (prev_sub_local_JSON == NULL) { + ogs_error("OpenAPI_nnwdaf_events_subscription_convertToJSON() failed [prev_sub]"); + goto end; + } + cJSON_AddItemToObject(item, "prevSub", prev_sub_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_nnwdaf_events_subscription_convertToJSON() failed [prev_sub]"); + goto end; + } + } + + if (nnwdaf_events_subscription->cons_nf_info) { + cJSON *cons_nf_info_local_JSON = OpenAPI_consumer_nf_information_convertToJSON(nnwdaf_events_subscription->cons_nf_info); + if (cons_nf_info_local_JSON == NULL) { + ogs_error("OpenAPI_nnwdaf_events_subscription_convertToJSON() failed [cons_nf_info]"); + goto end; + } + cJSON_AddItemToObject(item, "consNfInfo", cons_nf_info_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_nnwdaf_events_subscription_convertToJSON() failed [cons_nf_info]"); + goto end; + } + } + +end: + return item; +} + +OpenAPI_nnwdaf_events_subscription_t *OpenAPI_nnwdaf_events_subscription_parseFromJSON(cJSON *nnwdaf_events_subscriptionJSON) +{ + OpenAPI_nnwdaf_events_subscription_t *nnwdaf_events_subscription_local_var = NULL; + OpenAPI_lnode_t *node = NULL; + cJSON *event_subscriptions = NULL; + OpenAPI_list_t *event_subscriptionsList = NULL; + cJSON *evt_req = NULL; + OpenAPI_reporting_information_t *evt_req_local_nonprim = NULL; + cJSON *notification_uri = NULL; + cJSON *notif_corr_id = NULL; + cJSON *supported_features = NULL; + cJSON *event_notifications = NULL; + OpenAPI_list_t *event_notificationsList = NULL; + cJSON *fail_event_reports = NULL; + OpenAPI_list_t *fail_event_reportsList = NULL; + cJSON *prev_sub = NULL; + OpenAPI_prev_sub_info_t *prev_sub_local_nonprim = NULL; + cJSON *cons_nf_info = NULL; + OpenAPI_consumer_nf_information_t *cons_nf_info_local_nonprim = NULL; + event_subscriptions = cJSON_GetObjectItemCaseSensitive(nnwdaf_events_subscriptionJSON, "eventSubscriptions"); + if (!event_subscriptions) { + ogs_error("OpenAPI_nnwdaf_events_subscription_parseFromJSON() failed [event_subscriptions]"); + goto end; + } + cJSON *event_subscriptions_local = NULL; + if (!cJSON_IsArray(event_subscriptions)) { + ogs_error("OpenAPI_nnwdaf_events_subscription_parseFromJSON() failed [event_subscriptions]"); + goto end; + } + + event_subscriptionsList = OpenAPI_list_create(); + + cJSON_ArrayForEach(event_subscriptions_local, event_subscriptions) { + if (!cJSON_IsObject(event_subscriptions_local)) { + ogs_error("OpenAPI_nnwdaf_events_subscription_parseFromJSON() failed [event_subscriptions]"); + goto end; + } + OpenAPI_event_subscription_t *event_subscriptionsItem = OpenAPI_event_subscription_parseFromJSON(event_subscriptions_local); + if (!event_subscriptionsItem) { + ogs_error("No event_subscriptionsItem"); + OpenAPI_list_free(event_subscriptionsList); + goto end; + } + OpenAPI_list_add(event_subscriptionsList, event_subscriptionsItem); + } + + evt_req = cJSON_GetObjectItemCaseSensitive(nnwdaf_events_subscriptionJSON, "evtReq"); + if (evt_req) { + evt_req_local_nonprim = OpenAPI_reporting_information_parseFromJSON(evt_req); + } + + notification_uri = cJSON_GetObjectItemCaseSensitive(nnwdaf_events_subscriptionJSON, "notificationURI"); + if (notification_uri) { + if (!cJSON_IsString(notification_uri) && !cJSON_IsNull(notification_uri)) { + ogs_error("OpenAPI_nnwdaf_events_subscription_parseFromJSON() failed [notification_uri]"); + goto end; + } + } + + notif_corr_id = cJSON_GetObjectItemCaseSensitive(nnwdaf_events_subscriptionJSON, "notifCorrId"); + if (notif_corr_id) { + if (!cJSON_IsString(notif_corr_id) && !cJSON_IsNull(notif_corr_id)) { + ogs_error("OpenAPI_nnwdaf_events_subscription_parseFromJSON() failed [notif_corr_id]"); + goto end; + } + } + + supported_features = cJSON_GetObjectItemCaseSensitive(nnwdaf_events_subscriptionJSON, "supportedFeatures"); + if (supported_features) { + if (!cJSON_IsString(supported_features) && !cJSON_IsNull(supported_features)) { + ogs_error("OpenAPI_nnwdaf_events_subscription_parseFromJSON() failed [supported_features]"); + goto end; + } + } + + event_notifications = cJSON_GetObjectItemCaseSensitive(nnwdaf_events_subscriptionJSON, "eventNotifications"); + if (event_notifications) { + cJSON *event_notifications_local = NULL; + if (!cJSON_IsArray(event_notifications)) { + ogs_error("OpenAPI_nnwdaf_events_subscription_parseFromJSON() failed [event_notifications]"); + goto end; + } + + event_notificationsList = OpenAPI_list_create(); + + cJSON_ArrayForEach(event_notifications_local, event_notifications) { + if (!cJSON_IsObject(event_notifications_local)) { + ogs_error("OpenAPI_nnwdaf_events_subscription_parseFromJSON() failed [event_notifications]"); + goto end; + } + OpenAPI_event_notification_t *event_notificationsItem = OpenAPI_event_notification_parseFromJSON(event_notifications_local); + if (!event_notificationsItem) { + ogs_error("No event_notificationsItem"); + OpenAPI_list_free(event_notificationsList); + goto end; + } + OpenAPI_list_add(event_notificationsList, event_notificationsItem); + } + } + + fail_event_reports = cJSON_GetObjectItemCaseSensitive(nnwdaf_events_subscriptionJSON, "failEventReports"); + if (fail_event_reports) { + cJSON *fail_event_reports_local = NULL; + if (!cJSON_IsArray(fail_event_reports)) { + ogs_error("OpenAPI_nnwdaf_events_subscription_parseFromJSON() failed [fail_event_reports]"); + goto end; + } + + fail_event_reportsList = OpenAPI_list_create(); + + cJSON_ArrayForEach(fail_event_reports_local, fail_event_reports) { + if (!cJSON_IsObject(fail_event_reports_local)) { + ogs_error("OpenAPI_nnwdaf_events_subscription_parseFromJSON() failed [fail_event_reports]"); + goto end; + } + OpenAPI_failure_event_info_t *fail_event_reportsItem = OpenAPI_failure_event_info_parseFromJSON(fail_event_reports_local); + if (!fail_event_reportsItem) { + ogs_error("No fail_event_reportsItem"); + OpenAPI_list_free(fail_event_reportsList); + goto end; + } + OpenAPI_list_add(fail_event_reportsList, fail_event_reportsItem); + } + } + + prev_sub = cJSON_GetObjectItemCaseSensitive(nnwdaf_events_subscriptionJSON, "prevSub"); + if (prev_sub) { + prev_sub_local_nonprim = OpenAPI_prev_sub_info_parseFromJSON(prev_sub); + } + + cons_nf_info = cJSON_GetObjectItemCaseSensitive(nnwdaf_events_subscriptionJSON, "consNfInfo"); + if (cons_nf_info) { + cons_nf_info_local_nonprim = OpenAPI_consumer_nf_information_parseFromJSON(cons_nf_info); + } + + nnwdaf_events_subscription_local_var = OpenAPI_nnwdaf_events_subscription_create ( + event_subscriptionsList, + evt_req ? evt_req_local_nonprim : NULL, + notification_uri && !cJSON_IsNull(notification_uri) ? ogs_strdup(notification_uri->valuestring) : NULL, + notif_corr_id && !cJSON_IsNull(notif_corr_id) ? ogs_strdup(notif_corr_id->valuestring) : NULL, + supported_features && !cJSON_IsNull(supported_features) ? ogs_strdup(supported_features->valuestring) : NULL, + event_notifications ? event_notificationsList : NULL, + fail_event_reports ? fail_event_reportsList : NULL, + prev_sub ? prev_sub_local_nonprim : NULL, + cons_nf_info ? cons_nf_info_local_nonprim : NULL + ); + + return nnwdaf_events_subscription_local_var; +end: + if (event_subscriptionsList) { + OpenAPI_list_for_each(event_subscriptionsList, node) { + OpenAPI_event_subscription_free(node->data); + } + OpenAPI_list_free(event_subscriptionsList); + event_subscriptionsList = NULL; + } + if (evt_req_local_nonprim) { + OpenAPI_reporting_information_free(evt_req_local_nonprim); + evt_req_local_nonprim = NULL; + } + if (event_notificationsList) { + OpenAPI_list_for_each(event_notificationsList, node) { + OpenAPI_event_notification_free(node->data); + } + OpenAPI_list_free(event_notificationsList); + event_notificationsList = NULL; + } + if (fail_event_reportsList) { + OpenAPI_list_for_each(fail_event_reportsList, node) { + OpenAPI_failure_event_info_free(node->data); + } + OpenAPI_list_free(fail_event_reportsList); + fail_event_reportsList = NULL; + } + if (prev_sub_local_nonprim) { + OpenAPI_prev_sub_info_free(prev_sub_local_nonprim); + prev_sub_local_nonprim = NULL; + } + if (cons_nf_info_local_nonprim) { + OpenAPI_consumer_nf_information_free(cons_nf_info_local_nonprim); + cons_nf_info_local_nonprim = NULL; + } + return NULL; +} + +OpenAPI_nnwdaf_events_subscription_t *OpenAPI_nnwdaf_events_subscription_copy(OpenAPI_nnwdaf_events_subscription_t *dst, OpenAPI_nnwdaf_events_subscription_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_nnwdaf_events_subscription_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_nnwdaf_events_subscription_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_nnwdaf_events_subscription_free(dst); + dst = OpenAPI_nnwdaf_events_subscription_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/nnwdaf_events_subscription.h b/lib/sbi/openapi/model/nnwdaf_events_subscription.h new file mode 100644 index 000000000..fa317950d --- /dev/null +++ b/lib/sbi/openapi/model/nnwdaf_events_subscription.h @@ -0,0 +1,60 @@ +/* + * nnwdaf_events_subscription.h + * + * Represents an Individual NWDAF Event Subscription resource. + */ + +#ifndef _OpenAPI_nnwdaf_events_subscription_H_ +#define _OpenAPI_nnwdaf_events_subscription_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "consumer_nf_information.h" +#include "event_notification.h" +#include "event_subscription.h" +#include "failure_event_info.h" +#include "prev_sub_info.h" +#include "reporting_information.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_nnwdaf_events_subscription_s OpenAPI_nnwdaf_events_subscription_t; +typedef struct OpenAPI_nnwdaf_events_subscription_s { + OpenAPI_list_t *event_subscriptions; + struct OpenAPI_reporting_information_s *evt_req; + char *notification_uri; + char *notif_corr_id; + char *supported_features; + OpenAPI_list_t *event_notifications; + OpenAPI_list_t *fail_event_reports; + struct OpenAPI_prev_sub_info_s *prev_sub; + struct OpenAPI_consumer_nf_information_s *cons_nf_info; +} OpenAPI_nnwdaf_events_subscription_t; + +OpenAPI_nnwdaf_events_subscription_t *OpenAPI_nnwdaf_events_subscription_create( + OpenAPI_list_t *event_subscriptions, + OpenAPI_reporting_information_t *evt_req, + char *notification_uri, + char *notif_corr_id, + char *supported_features, + OpenAPI_list_t *event_notifications, + OpenAPI_list_t *fail_event_reports, + OpenAPI_prev_sub_info_t *prev_sub, + OpenAPI_consumer_nf_information_t *cons_nf_info +); +void OpenAPI_nnwdaf_events_subscription_free(OpenAPI_nnwdaf_events_subscription_t *nnwdaf_events_subscription); +OpenAPI_nnwdaf_events_subscription_t *OpenAPI_nnwdaf_events_subscription_parseFromJSON(cJSON *nnwdaf_events_subscriptionJSON); +cJSON *OpenAPI_nnwdaf_events_subscription_convertToJSON(OpenAPI_nnwdaf_events_subscription_t *nnwdaf_events_subscription); +OpenAPI_nnwdaf_events_subscription_t *OpenAPI_nnwdaf_events_subscription_copy(OpenAPI_nnwdaf_events_subscription_t *dst, OpenAPI_nnwdaf_events_subscription_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_nnwdaf_events_subscription_H_ */ + diff --git a/lib/sbi/openapi/model/nnwdaf_nf_status.c b/lib/sbi/openapi/model/nnwdaf_nf_status.c new file mode 100644 index 000000000..276a737e7 --- /dev/null +++ b/lib/sbi/openapi/model/nnwdaf_nf_status.c @@ -0,0 +1,153 @@ + +#include +#include +#include +#include "nnwdaf_nf_status.h" + +OpenAPI_nnwdaf_nf_status_t *OpenAPI_nnwdaf_nf_status_create( + bool is_status_registered, + int status_registered, + bool is_status_unregistered, + int status_unregistered, + bool is_status_undiscoverable, + int status_undiscoverable +) +{ + OpenAPI_nnwdaf_nf_status_t *nnwdaf_nf_status_local_var = ogs_malloc(sizeof(OpenAPI_nnwdaf_nf_status_t)); + ogs_assert(nnwdaf_nf_status_local_var); + + nnwdaf_nf_status_local_var->is_status_registered = is_status_registered; + nnwdaf_nf_status_local_var->status_registered = status_registered; + nnwdaf_nf_status_local_var->is_status_unregistered = is_status_unregistered; + nnwdaf_nf_status_local_var->status_unregistered = status_unregistered; + nnwdaf_nf_status_local_var->is_status_undiscoverable = is_status_undiscoverable; + nnwdaf_nf_status_local_var->status_undiscoverable = status_undiscoverable; + + return nnwdaf_nf_status_local_var; +} + +void OpenAPI_nnwdaf_nf_status_free(OpenAPI_nnwdaf_nf_status_t *nnwdaf_nf_status) +{ + OpenAPI_lnode_t *node = NULL; + + if (NULL == nnwdaf_nf_status) { + return; + } + ogs_free(nnwdaf_nf_status); +} + +cJSON *OpenAPI_nnwdaf_nf_status_convertToJSON(OpenAPI_nnwdaf_nf_status_t *nnwdaf_nf_status) +{ + cJSON *item = NULL; + OpenAPI_lnode_t *node = NULL; + + if (nnwdaf_nf_status == NULL) { + ogs_error("OpenAPI_nnwdaf_nf_status_convertToJSON() failed [NnwdafNfStatus]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (nnwdaf_nf_status->is_status_registered) { + if (cJSON_AddNumberToObject(item, "statusRegistered", nnwdaf_nf_status->status_registered) == NULL) { + ogs_error("OpenAPI_nnwdaf_nf_status_convertToJSON() failed [status_registered]"); + goto end; + } + } + + if (nnwdaf_nf_status->is_status_unregistered) { + if (cJSON_AddNumberToObject(item, "statusUnregistered", nnwdaf_nf_status->status_unregistered) == NULL) { + ogs_error("OpenAPI_nnwdaf_nf_status_convertToJSON() failed [status_unregistered]"); + goto end; + } + } + + if (nnwdaf_nf_status->is_status_undiscoverable) { + if (cJSON_AddNumberToObject(item, "statusUndiscoverable", nnwdaf_nf_status->status_undiscoverable) == NULL) { + ogs_error("OpenAPI_nnwdaf_nf_status_convertToJSON() failed [status_undiscoverable]"); + goto end; + } + } + +end: + return item; +} + +OpenAPI_nnwdaf_nf_status_t *OpenAPI_nnwdaf_nf_status_parseFromJSON(cJSON *nnwdaf_nf_statusJSON) +{ + OpenAPI_nnwdaf_nf_status_t *nnwdaf_nf_status_local_var = NULL; + OpenAPI_lnode_t *node = NULL; + cJSON *status_registered = NULL; + cJSON *status_unregistered = NULL; + cJSON *status_undiscoverable = NULL; + status_registered = cJSON_GetObjectItemCaseSensitive(nnwdaf_nf_statusJSON, "statusRegistered"); + if (status_registered) { + if (!cJSON_IsNumber(status_registered)) { + ogs_error("OpenAPI_nnwdaf_nf_status_parseFromJSON() failed [status_registered]"); + goto end; + } + } + + status_unregistered = cJSON_GetObjectItemCaseSensitive(nnwdaf_nf_statusJSON, "statusUnregistered"); + if (status_unregistered) { + if (!cJSON_IsNumber(status_unregistered)) { + ogs_error("OpenAPI_nnwdaf_nf_status_parseFromJSON() failed [status_unregistered]"); + goto end; + } + } + + status_undiscoverable = cJSON_GetObjectItemCaseSensitive(nnwdaf_nf_statusJSON, "statusUndiscoverable"); + if (status_undiscoverable) { + if (!cJSON_IsNumber(status_undiscoverable)) { + ogs_error("OpenAPI_nnwdaf_nf_status_parseFromJSON() failed [status_undiscoverable]"); + goto end; + } + } + + nnwdaf_nf_status_local_var = OpenAPI_nnwdaf_nf_status_create ( + status_registered ? true : false, + status_registered ? status_registered->valuedouble : 0, + status_unregistered ? true : false, + status_unregistered ? status_unregistered->valuedouble : 0, + status_undiscoverable ? true : false, + status_undiscoverable ? status_undiscoverable->valuedouble : 0 + ); + + return nnwdaf_nf_status_local_var; +end: + return NULL; +} + +OpenAPI_nnwdaf_nf_status_t *OpenAPI_nnwdaf_nf_status_copy(OpenAPI_nnwdaf_nf_status_t *dst, OpenAPI_nnwdaf_nf_status_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_nnwdaf_nf_status_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_nnwdaf_nf_status_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_nnwdaf_nf_status_free(dst); + dst = OpenAPI_nnwdaf_nf_status_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/nnwdaf_nf_status.h b/lib/sbi/openapi/model/nnwdaf_nf_status.h new file mode 100644 index 000000000..54652b8b4 --- /dev/null +++ b/lib/sbi/openapi/model/nnwdaf_nf_status.h @@ -0,0 +1,48 @@ +/* + * nnwdaf_nf_status.h + * + * Contains the percentage of time spent on various NF states. + */ + +#ifndef _OpenAPI_nnwdaf_nf_status_H_ +#define _OpenAPI_nnwdaf_nf_status_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_nnwdaf_nf_status_s OpenAPI_nnwdaf_nf_status_t; +typedef struct OpenAPI_nnwdaf_nf_status_s { + bool is_status_registered; + int status_registered; + bool is_status_unregistered; + int status_unregistered; + bool is_status_undiscoverable; + int status_undiscoverable; +} OpenAPI_nnwdaf_nf_status_t; + +OpenAPI_nnwdaf_nf_status_t *OpenAPI_nnwdaf_nf_status_create( + bool is_status_registered, + int status_registered, + bool is_status_unregistered, + int status_unregistered, + bool is_status_undiscoverable, + int status_undiscoverable +); +void OpenAPI_nnwdaf_nf_status_free(OpenAPI_nnwdaf_nf_status_t *nnwdaf_nf_status); +OpenAPI_nnwdaf_nf_status_t *OpenAPI_nnwdaf_nf_status_parseFromJSON(cJSON *nnwdaf_nf_statusJSON); +cJSON *OpenAPI_nnwdaf_nf_status_convertToJSON(OpenAPI_nnwdaf_nf_status_t *nnwdaf_nf_status); +OpenAPI_nnwdaf_nf_status_t *OpenAPI_nnwdaf_nf_status_copy(OpenAPI_nnwdaf_nf_status_t *dst, OpenAPI_nnwdaf_nf_status_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_nnwdaf_nf_status_H_ */ + diff --git a/lib/sbi/openapi/model/no_profile_match_info.c b/lib/sbi/openapi/model/no_profile_match_info.c new file mode 100644 index 000000000..c9c273e25 --- /dev/null +++ b/lib/sbi/openapi/model/no_profile_match_info.c @@ -0,0 +1,182 @@ + +#include +#include +#include +#include "no_profile_match_info.h" + +OpenAPI_no_profile_match_info_t *OpenAPI_no_profile_match_info_create( + OpenAPI_no_profile_match_reason_t *reason, + OpenAPI_list_t *query_param_combination_list +) +{ + OpenAPI_no_profile_match_info_t *no_profile_match_info_local_var = ogs_malloc(sizeof(OpenAPI_no_profile_match_info_t)); + ogs_assert(no_profile_match_info_local_var); + + no_profile_match_info_local_var->reason = reason; + no_profile_match_info_local_var->query_param_combination_list = query_param_combination_list; + + return no_profile_match_info_local_var; +} + +void OpenAPI_no_profile_match_info_free(OpenAPI_no_profile_match_info_t *no_profile_match_info) +{ + OpenAPI_lnode_t *node = NULL; + + if (NULL == no_profile_match_info) { + return; + } + if (no_profile_match_info->reason) { + OpenAPI_no_profile_match_reason_free(no_profile_match_info->reason); + no_profile_match_info->reason = NULL; + } + if (no_profile_match_info->query_param_combination_list) { + OpenAPI_list_for_each(no_profile_match_info->query_param_combination_list, node) { + OpenAPI_query_param_combination_free(node->data); + } + OpenAPI_list_free(no_profile_match_info->query_param_combination_list); + no_profile_match_info->query_param_combination_list = NULL; + } + ogs_free(no_profile_match_info); +} + +cJSON *OpenAPI_no_profile_match_info_convertToJSON(OpenAPI_no_profile_match_info_t *no_profile_match_info) +{ + cJSON *item = NULL; + OpenAPI_lnode_t *node = NULL; + + if (no_profile_match_info == NULL) { + ogs_error("OpenAPI_no_profile_match_info_convertToJSON() failed [NoProfileMatchInfo]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (!no_profile_match_info->reason) { + ogs_error("OpenAPI_no_profile_match_info_convertToJSON() failed [reason]"); + return NULL; + } + cJSON *reason_local_JSON = OpenAPI_no_profile_match_reason_convertToJSON(no_profile_match_info->reason); + if (reason_local_JSON == NULL) { + ogs_error("OpenAPI_no_profile_match_info_convertToJSON() failed [reason]"); + goto end; + } + cJSON_AddItemToObject(item, "reason", reason_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_no_profile_match_info_convertToJSON() failed [reason]"); + goto end; + } + + if (no_profile_match_info->query_param_combination_list) { + cJSON *query_param_combination_listList = cJSON_AddArrayToObject(item, "queryParamCombinationList"); + if (query_param_combination_listList == NULL) { + ogs_error("OpenAPI_no_profile_match_info_convertToJSON() failed [query_param_combination_list]"); + goto end; + } + OpenAPI_list_for_each(no_profile_match_info->query_param_combination_list, node) { + cJSON *itemLocal = OpenAPI_query_param_combination_convertToJSON(node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_no_profile_match_info_convertToJSON() failed [query_param_combination_list]"); + goto end; + } + cJSON_AddItemToArray(query_param_combination_listList, itemLocal); + } + } + +end: + return item; +} + +OpenAPI_no_profile_match_info_t *OpenAPI_no_profile_match_info_parseFromJSON(cJSON *no_profile_match_infoJSON) +{ + OpenAPI_no_profile_match_info_t *no_profile_match_info_local_var = NULL; + OpenAPI_lnode_t *node = NULL; + cJSON *reason = NULL; + OpenAPI_no_profile_match_reason_t *reason_local_nonprim = NULL; + cJSON *query_param_combination_list = NULL; + OpenAPI_list_t *query_param_combination_listList = NULL; + reason = cJSON_GetObjectItemCaseSensitive(no_profile_match_infoJSON, "reason"); + if (!reason) { + ogs_error("OpenAPI_no_profile_match_info_parseFromJSON() failed [reason]"); + goto end; + } + reason_local_nonprim = OpenAPI_no_profile_match_reason_parseFromJSON(reason); + + query_param_combination_list = cJSON_GetObjectItemCaseSensitive(no_profile_match_infoJSON, "queryParamCombinationList"); + if (query_param_combination_list) { + cJSON *query_param_combination_list_local = NULL; + if (!cJSON_IsArray(query_param_combination_list)) { + ogs_error("OpenAPI_no_profile_match_info_parseFromJSON() failed [query_param_combination_list]"); + goto end; + } + + query_param_combination_listList = OpenAPI_list_create(); + + cJSON_ArrayForEach(query_param_combination_list_local, query_param_combination_list) { + if (!cJSON_IsObject(query_param_combination_list_local)) { + ogs_error("OpenAPI_no_profile_match_info_parseFromJSON() failed [query_param_combination_list]"); + goto end; + } + OpenAPI_query_param_combination_t *query_param_combination_listItem = OpenAPI_query_param_combination_parseFromJSON(query_param_combination_list_local); + if (!query_param_combination_listItem) { + ogs_error("No query_param_combination_listItem"); + OpenAPI_list_free(query_param_combination_listList); + goto end; + } + OpenAPI_list_add(query_param_combination_listList, query_param_combination_listItem); + } + } + + no_profile_match_info_local_var = OpenAPI_no_profile_match_info_create ( + reason_local_nonprim, + query_param_combination_list ? query_param_combination_listList : NULL + ); + + return no_profile_match_info_local_var; +end: + if (reason_local_nonprim) { + OpenAPI_no_profile_match_reason_free(reason_local_nonprim); + reason_local_nonprim = NULL; + } + if (query_param_combination_listList) { + OpenAPI_list_for_each(query_param_combination_listList, node) { + OpenAPI_query_param_combination_free(node->data); + } + OpenAPI_list_free(query_param_combination_listList); + query_param_combination_listList = NULL; + } + return NULL; +} + +OpenAPI_no_profile_match_info_t *OpenAPI_no_profile_match_info_copy(OpenAPI_no_profile_match_info_t *dst, OpenAPI_no_profile_match_info_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_no_profile_match_info_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_no_profile_match_info_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_no_profile_match_info_free(dst); + dst = OpenAPI_no_profile_match_info_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/no_profile_match_info.h b/lib/sbi/openapi/model/no_profile_match_info.h new file mode 100644 index 000000000..ef866c7bd --- /dev/null +++ b/lib/sbi/openapi/model/no_profile_match_info.h @@ -0,0 +1,42 @@ +/* + * no_profile_match_info.h + * + * Provides the reason for not finding NF matching the search criteria + */ + +#ifndef _OpenAPI_no_profile_match_info_H_ +#define _OpenAPI_no_profile_match_info_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "no_profile_match_reason.h" +#include "query_param_combination.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_no_profile_match_info_s OpenAPI_no_profile_match_info_t; +typedef struct OpenAPI_no_profile_match_info_s { + struct OpenAPI_no_profile_match_reason_s *reason; + OpenAPI_list_t *query_param_combination_list; +} OpenAPI_no_profile_match_info_t; + +OpenAPI_no_profile_match_info_t *OpenAPI_no_profile_match_info_create( + OpenAPI_no_profile_match_reason_t *reason, + OpenAPI_list_t *query_param_combination_list +); +void OpenAPI_no_profile_match_info_free(OpenAPI_no_profile_match_info_t *no_profile_match_info); +OpenAPI_no_profile_match_info_t *OpenAPI_no_profile_match_info_parseFromJSON(cJSON *no_profile_match_infoJSON); +cJSON *OpenAPI_no_profile_match_info_convertToJSON(OpenAPI_no_profile_match_info_t *no_profile_match_info); +OpenAPI_no_profile_match_info_t *OpenAPI_no_profile_match_info_copy(OpenAPI_no_profile_match_info_t *dst, OpenAPI_no_profile_match_info_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_no_profile_match_info_H_ */ + diff --git a/lib/sbi/openapi/model/no_profile_match_reason.c b/lib/sbi/openapi/model/no_profile_match_reason.c new file mode 100644 index 000000000..a6581886c --- /dev/null +++ b/lib/sbi/openapi/model/no_profile_match_reason.c @@ -0,0 +1,87 @@ + +#include +#include +#include +#include "no_profile_match_reason.h" + +OpenAPI_no_profile_match_reason_t *OpenAPI_no_profile_match_reason_create( +) +{ + OpenAPI_no_profile_match_reason_t *no_profile_match_reason_local_var = ogs_malloc(sizeof(OpenAPI_no_profile_match_reason_t)); + ogs_assert(no_profile_match_reason_local_var); + + + return no_profile_match_reason_local_var; +} + +void OpenAPI_no_profile_match_reason_free(OpenAPI_no_profile_match_reason_t *no_profile_match_reason) +{ + OpenAPI_lnode_t *node = NULL; + + if (NULL == no_profile_match_reason) { + return; + } + ogs_free(no_profile_match_reason); +} + +cJSON *OpenAPI_no_profile_match_reason_convertToJSON(OpenAPI_no_profile_match_reason_t *no_profile_match_reason) +{ + cJSON *item = NULL; + OpenAPI_lnode_t *node = NULL; + + if (no_profile_match_reason == NULL) { + ogs_error("OpenAPI_no_profile_match_reason_convertToJSON() failed [NoProfileMatchReason]"); + return NULL; + } + + item = cJSON_CreateObject(); +end: + return item; +} + +OpenAPI_no_profile_match_reason_t *OpenAPI_no_profile_match_reason_parseFromJSON(cJSON *no_profile_match_reasonJSON) +{ + OpenAPI_no_profile_match_reason_t *no_profile_match_reason_local_var = NULL; + OpenAPI_lnode_t *node = NULL; + no_profile_match_reason_local_var = OpenAPI_no_profile_match_reason_create ( + ); + + return no_profile_match_reason_local_var; +end: + return NULL; +} + +OpenAPI_no_profile_match_reason_t *OpenAPI_no_profile_match_reason_copy(OpenAPI_no_profile_match_reason_t *dst, OpenAPI_no_profile_match_reason_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_no_profile_match_reason_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_no_profile_match_reason_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_no_profile_match_reason_free(dst); + dst = OpenAPI_no_profile_match_reason_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/no_profile_match_reason.h b/lib/sbi/openapi/model/no_profile_match_reason.h new file mode 100644 index 000000000..213777df5 --- /dev/null +++ b/lib/sbi/openapi/model/no_profile_match_reason.h @@ -0,0 +1,37 @@ +/* + * no_profile_match_reason.h + * + * No Profile Match Reason + */ + +#ifndef _OpenAPI_no_profile_match_reason_H_ +#define _OpenAPI_no_profile_match_reason_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "no_profile_match_reason_any_of.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_no_profile_match_reason_s OpenAPI_no_profile_match_reason_t; +typedef struct OpenAPI_no_profile_match_reason_s { +} OpenAPI_no_profile_match_reason_t; + +OpenAPI_no_profile_match_reason_t *OpenAPI_no_profile_match_reason_create( +); +void OpenAPI_no_profile_match_reason_free(OpenAPI_no_profile_match_reason_t *no_profile_match_reason); +OpenAPI_no_profile_match_reason_t *OpenAPI_no_profile_match_reason_parseFromJSON(cJSON *no_profile_match_reasonJSON); +cJSON *OpenAPI_no_profile_match_reason_convertToJSON(OpenAPI_no_profile_match_reason_t *no_profile_match_reason); +OpenAPI_no_profile_match_reason_t *OpenAPI_no_profile_match_reason_copy(OpenAPI_no_profile_match_reason_t *dst, OpenAPI_no_profile_match_reason_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_no_profile_match_reason_H_ */ + diff --git a/lib/sbi/openapi/model/no_profile_match_reason_any_of.c b/lib/sbi/openapi/model/no_profile_match_reason_any_of.c new file mode 100644 index 000000000..9d59348bc --- /dev/null +++ b/lib/sbi/openapi/model/no_profile_match_reason_any_of.c @@ -0,0 +1,30 @@ + +#include +#include +#include +#include "no_profile_match_reason_any_of.h" + +char* OpenAPI_no_profile_match_reason_any_of_ToString(OpenAPI_no_profile_match_reason_any_of_e no_profile_match_reason_any_of) +{ + const char *no_profile_match_reason_any_ofArray[] = { "NULL", "REQUESTER_PLMN_NOT_ALLOWED", "TARGET_NF_SUSPENDED", "TARGET_NF_UNDISCOVERABLE", "QUERY_PARAMS_COMBINATION_NO_MATCH", "UNSPECIFIED" }; + size_t sizeofArray = sizeof(no_profile_match_reason_any_ofArray) / sizeof(no_profile_match_reason_any_ofArray[0]); + if (no_profile_match_reason_any_of < sizeofArray) + return (char *)no_profile_match_reason_any_ofArray[no_profile_match_reason_any_of]; + else + return (char *)"Unknown"; +} + +OpenAPI_no_profile_match_reason_any_of_e OpenAPI_no_profile_match_reason_any_of_FromString(char* no_profile_match_reason_any_of) +{ + int stringToReturn = 0; + const char *no_profile_match_reason_any_ofArray[] = { "NULL", "REQUESTER_PLMN_NOT_ALLOWED", "TARGET_NF_SUSPENDED", "TARGET_NF_UNDISCOVERABLE", "QUERY_PARAMS_COMBINATION_NO_MATCH", "UNSPECIFIED" }; + size_t sizeofArray = sizeof(no_profile_match_reason_any_ofArray) / sizeof(no_profile_match_reason_any_ofArray[0]); + while (stringToReturn < sizeofArray) { + if (strcmp(no_profile_match_reason_any_of, no_profile_match_reason_any_ofArray[stringToReturn]) == 0) { + return stringToReturn; + } + stringToReturn++; + } + return 0; +} + diff --git a/lib/sbi/openapi/model/no_profile_match_reason_any_of.h b/lib/sbi/openapi/model/no_profile_match_reason_any_of.h new file mode 100644 index 000000000..3cdbd1dc2 --- /dev/null +++ b/lib/sbi/openapi/model/no_profile_match_reason_any_of.h @@ -0,0 +1,31 @@ +/* + * no_profile_match_reason_any_of.h + * + * + */ + +#ifndef _OpenAPI_no_profile_match_reason_any_of_H_ +#define _OpenAPI_no_profile_match_reason_any_of_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef enum { OpenAPI_no_profile_match_reason_any_of_NULL = 0, OpenAPI_no_profile_match_reason_any_of_REQUESTER_PLMN_NOT_ALLOWED, OpenAPI_no_profile_match_reason_any_of_TARGET_NF_SUSPENDED, OpenAPI_no_profile_match_reason_any_of_TARGET_NF_UNDISCOVERABLE, OpenAPI_no_profile_match_reason_any_of_QUERY_PARAMS_COMBINATION_NO_MATCH, OpenAPI_no_profile_match_reason_any_of_UNSPECIFIED } OpenAPI_no_profile_match_reason_any_of_e; + +char* OpenAPI_no_profile_match_reason_any_of_ToString(OpenAPI_no_profile_match_reason_any_of_e no_profile_match_reason_any_of); + +OpenAPI_no_profile_match_reason_any_of_e OpenAPI_no_profile_match_reason_any_of_FromString(char* no_profile_match_reason_any_of); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_no_profile_match_reason_any_of_H_ */ + diff --git a/lib/sbi/openapi/model/non_dynamic5_qi.h b/lib/sbi/openapi/model/non_dynamic5_qi.h index 773b47993..ae6957b20 100644 --- a/lib/sbi/openapi/model/non_dynamic5_qi.h +++ b/lib/sbi/openapi/model/non_dynamic5_qi.h @@ -1,7 +1,7 @@ /* * non_dynamic5_qi.h * - * + * It indicates the QoS Characteristics for a standardized or pre-configured 5QI for downlink and uplink. */ #ifndef _OpenAPI_non_dynamic5_qi_H_ diff --git a/lib/sbi/openapi/model/non_ue_n2_info_subscription_create_data.h b/lib/sbi/openapi/model/non_ue_n2_info_subscription_create_data.h index e57b57639..24306b671 100644 --- a/lib/sbi/openapi/model/non_ue_n2_info_subscription_create_data.h +++ b/lib/sbi/openapi/model/non_ue_n2_info_subscription_create_data.h @@ -1,7 +1,7 @@ /* * non_ue_n2_info_subscription_create_data.h * - * + * Data within a create subscription request for non-UE specific N2 information notification */ #ifndef _OpenAPI_non_ue_n2_info_subscription_create_data_H_ diff --git a/lib/sbi/openapi/model/non_ue_n2_info_subscription_created_data.h b/lib/sbi/openapi/model/non_ue_n2_info_subscription_created_data.h index c76af20a9..9f551181c 100644 --- a/lib/sbi/openapi/model/non_ue_n2_info_subscription_created_data.h +++ b/lib/sbi/openapi/model/non_ue_n2_info_subscription_created_data.h @@ -1,7 +1,7 @@ /* * non_ue_n2_info_subscription_created_data.h * - * + * Data for the created subscription for non-UE specific N2 information notification */ #ifndef _OpenAPI_non_ue_n2_info_subscription_created_data_H_ diff --git a/lib/sbi/openapi/model/notif_condition.h b/lib/sbi/openapi/model/notif_condition.h index 472d25968..f3cf842b2 100644 --- a/lib/sbi/openapi/model/notif_condition.h +++ b/lib/sbi/openapi/model/notif_condition.h @@ -1,7 +1,7 @@ /* * notif_condition.h * - * Condition (list of attributes in the NF Profile) to determine whether a notification must be sent by NRF + * Condition (list of attributes in the NF Profile) to determine whether a notification must be sent by NRF */ #ifndef _OpenAPI_notif_condition_H_ diff --git a/lib/sbi/openapi/model/notification_data.c b/lib/sbi/openapi/model/notification_data.c index 0d9d5b5fc..372a1f4e1 100644 --- a/lib/sbi/openapi/model/notification_data.c +++ b/lib/sbi/openapi/model/notification_data.c @@ -9,7 +9,8 @@ OpenAPI_notification_data_t *OpenAPI_notification_data_create( char *nf_instance_uri, OpenAPI_nf_profile_t *nf_profile, OpenAPI_list_t *profile_changes, - OpenAPI_condition_event_type_e condition_event + OpenAPI_condition_event_type_e condition_event, + OpenAPI_subscription_context_t *subscription_context ) { OpenAPI_notification_data_t *notification_data_local_var = ogs_malloc(sizeof(OpenAPI_notification_data_t)); @@ -20,6 +21,7 @@ OpenAPI_notification_data_t *OpenAPI_notification_data_create( notification_data_local_var->nf_profile = nf_profile; notification_data_local_var->profile_changes = profile_changes; notification_data_local_var->condition_event = condition_event; + notification_data_local_var->subscription_context = subscription_context; return notification_data_local_var; } @@ -46,6 +48,10 @@ void OpenAPI_notification_data_free(OpenAPI_notification_data_t *notification_da OpenAPI_list_free(notification_data->profile_changes); notification_data->profile_changes = NULL; } + if (notification_data->subscription_context) { + OpenAPI_subscription_context_free(notification_data->subscription_context); + notification_data->subscription_context = NULL; + } ogs_free(notification_data); } @@ -114,6 +120,19 @@ cJSON *OpenAPI_notification_data_convertToJSON(OpenAPI_notification_data_t *noti } } + if (notification_data->subscription_context) { + cJSON *subscription_context_local_JSON = OpenAPI_subscription_context_convertToJSON(notification_data->subscription_context); + if (subscription_context_local_JSON == NULL) { + ogs_error("OpenAPI_notification_data_convertToJSON() failed [subscription_context]"); + goto end; + } + cJSON_AddItemToObject(item, "subscriptionContext", subscription_context_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_notification_data_convertToJSON() failed [subscription_context]"); + goto end; + } + } + end: return item; } @@ -131,6 +150,8 @@ OpenAPI_notification_data_t *OpenAPI_notification_data_parseFromJSON(cJSON *noti OpenAPI_list_t *profile_changesList = NULL; cJSON *condition_event = NULL; OpenAPI_condition_event_type_e condition_eventVariable = 0; + cJSON *subscription_context = NULL; + OpenAPI_subscription_context_t *subscription_context_local_nonprim = NULL; event = cJSON_GetObjectItemCaseSensitive(notification_dataJSON, "event"); if (!event) { ogs_error("OpenAPI_notification_data_parseFromJSON() failed [event]"); @@ -191,12 +212,18 @@ OpenAPI_notification_data_t *OpenAPI_notification_data_parseFromJSON(cJSON *noti condition_eventVariable = OpenAPI_condition_event_type_FromString(condition_event->valuestring); } + subscription_context = cJSON_GetObjectItemCaseSensitive(notification_dataJSON, "subscriptionContext"); + if (subscription_context) { + subscription_context_local_nonprim = OpenAPI_subscription_context_parseFromJSON(subscription_context); + } + notification_data_local_var = OpenAPI_notification_data_create ( eventVariable, ogs_strdup(nf_instance_uri->valuestring), nf_profile ? nf_profile_local_nonprim : NULL, profile_changes ? profile_changesList : NULL, - condition_event ? condition_eventVariable : 0 + condition_event ? condition_eventVariable : 0, + subscription_context ? subscription_context_local_nonprim : NULL ); return notification_data_local_var; @@ -212,6 +239,10 @@ end: OpenAPI_list_free(profile_changesList); profile_changesList = NULL; } + if (subscription_context_local_nonprim) { + OpenAPI_subscription_context_free(subscription_context_local_nonprim); + subscription_context_local_nonprim = NULL; + } return NULL; } diff --git a/lib/sbi/openapi/model/notification_data.h b/lib/sbi/openapi/model/notification_data.h index 0037ffb0f..f52c3965b 100644 --- a/lib/sbi/openapi/model/notification_data.h +++ b/lib/sbi/openapi/model/notification_data.h @@ -16,6 +16,7 @@ #include "condition_event_type.h" #include "nf_profile.h" #include "notification_event_type.h" +#include "subscription_context.h" #ifdef __cplusplus extern "C" { @@ -28,6 +29,7 @@ typedef struct OpenAPI_notification_data_s { struct OpenAPI_nf_profile_s *nf_profile; OpenAPI_list_t *profile_changes; OpenAPI_condition_event_type_e condition_event; + struct OpenAPI_subscription_context_s *subscription_context; } OpenAPI_notification_data_t; OpenAPI_notification_data_t *OpenAPI_notification_data_create( @@ -35,7 +37,8 @@ OpenAPI_notification_data_t *OpenAPI_notification_data_create( char *nf_instance_uri, OpenAPI_nf_profile_t *nf_profile, OpenAPI_list_t *profile_changes, - OpenAPI_condition_event_type_e condition_event + OpenAPI_condition_event_type_e condition_event, + OpenAPI_subscription_context_t *subscription_context ); void OpenAPI_notification_data_free(OpenAPI_notification_data_t *notification_data); OpenAPI_notification_data_t *OpenAPI_notification_data_parseFromJSON(cJSON *notification_dataJSON); diff --git a/lib/sbi/openapi/model/notification_flag.c b/lib/sbi/openapi/model/notification_flag.c new file mode 100644 index 000000000..23b35e8a8 --- /dev/null +++ b/lib/sbi/openapi/model/notification_flag.c @@ -0,0 +1,30 @@ + +#include +#include +#include +#include "notification_flag.h" + +char* OpenAPI_notification_flag_ToString(OpenAPI_notification_flag_e notification_flag) +{ + const char *notification_flagArray[] = { "NULL", "ACTIVATE", "DEACTIVATE", "RETRIEVAL" }; + size_t sizeofArray = sizeof(notification_flagArray) / sizeof(notification_flagArray[0]); + if (notification_flag < sizeofArray) + return (char *)notification_flagArray[notification_flag]; + else + return (char *)"Unknown"; +} + +OpenAPI_notification_flag_e OpenAPI_notification_flag_FromString(char* notification_flag) +{ + int stringToReturn = 0; + const char *notification_flagArray[] = { "NULL", "ACTIVATE", "DEACTIVATE", "RETRIEVAL" }; + size_t sizeofArray = sizeof(notification_flagArray) / sizeof(notification_flagArray[0]); + while (stringToReturn < sizeofArray) { + if (strcmp(notification_flag, notification_flagArray[stringToReturn]) == 0) { + return stringToReturn; + } + stringToReturn++; + } + return 0; +} + diff --git a/lib/sbi/openapi/model/notification_flag.h b/lib/sbi/openapi/model/notification_flag.h new file mode 100644 index 000000000..d7405d9bc --- /dev/null +++ b/lib/sbi/openapi/model/notification_flag.h @@ -0,0 +1,31 @@ +/* + * notification_flag.h + * + * + */ + +#ifndef _OpenAPI_notification_flag_H_ +#define _OpenAPI_notification_flag_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef enum { OpenAPI_notification_flag_NULL = 0, OpenAPI_notification_flag_ACTIVATE, OpenAPI_notification_flag_DEACTIVATE, OpenAPI_notification_flag_RETRIEVAL } OpenAPI_notification_flag_e; + +char* OpenAPI_notification_flag_ToString(OpenAPI_notification_flag_e notification_flag); + +OpenAPI_notification_flag_e OpenAPI_notification_flag_FromString(char* notification_flag); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_notification_flag_H_ */ + diff --git a/lib/sbi/openapi/model/notification_info.c b/lib/sbi/openapi/model/notification_info.c new file mode 100644 index 000000000..f6871813a --- /dev/null +++ b/lib/sbi/openapi/model/notification_info.c @@ -0,0 +1,163 @@ + +#include +#include +#include +#include "notification_info.h" + +OpenAPI_notification_info_t *OpenAPI_notification_info_create( + char *notif_id, + char *notif_uri, + bool is_up_buffer_ind, + int up_buffer_ind +) +{ + OpenAPI_notification_info_t *notification_info_local_var = ogs_malloc(sizeof(OpenAPI_notification_info_t)); + ogs_assert(notification_info_local_var); + + notification_info_local_var->notif_id = notif_id; + notification_info_local_var->notif_uri = notif_uri; + notification_info_local_var->is_up_buffer_ind = is_up_buffer_ind; + notification_info_local_var->up_buffer_ind = up_buffer_ind; + + return notification_info_local_var; +} + +void OpenAPI_notification_info_free(OpenAPI_notification_info_t *notification_info) +{ + OpenAPI_lnode_t *node = NULL; + + if (NULL == notification_info) { + return; + } + if (notification_info->notif_id) { + ogs_free(notification_info->notif_id); + notification_info->notif_id = NULL; + } + if (notification_info->notif_uri) { + ogs_free(notification_info->notif_uri); + notification_info->notif_uri = NULL; + } + ogs_free(notification_info); +} + +cJSON *OpenAPI_notification_info_convertToJSON(OpenAPI_notification_info_t *notification_info) +{ + cJSON *item = NULL; + OpenAPI_lnode_t *node = NULL; + + if (notification_info == NULL) { + ogs_error("OpenAPI_notification_info_convertToJSON() failed [NotificationInfo]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (!notification_info->notif_id) { + ogs_error("OpenAPI_notification_info_convertToJSON() failed [notif_id]"); + return NULL; + } + if (cJSON_AddStringToObject(item, "notifId", notification_info->notif_id) == NULL) { + ogs_error("OpenAPI_notification_info_convertToJSON() failed [notif_id]"); + goto end; + } + + if (!notification_info->notif_uri) { + ogs_error("OpenAPI_notification_info_convertToJSON() failed [notif_uri]"); + return NULL; + } + if (cJSON_AddStringToObject(item, "notifUri", notification_info->notif_uri) == NULL) { + ogs_error("OpenAPI_notification_info_convertToJSON() failed [notif_uri]"); + goto end; + } + + if (notification_info->is_up_buffer_ind) { + if (cJSON_AddBoolToObject(item, "upBufferInd", notification_info->up_buffer_ind) == NULL) { + ogs_error("OpenAPI_notification_info_convertToJSON() failed [up_buffer_ind]"); + goto end; + } + } + +end: + return item; +} + +OpenAPI_notification_info_t *OpenAPI_notification_info_parseFromJSON(cJSON *notification_infoJSON) +{ + OpenAPI_notification_info_t *notification_info_local_var = NULL; + OpenAPI_lnode_t *node = NULL; + cJSON *notif_id = NULL; + cJSON *notif_uri = NULL; + cJSON *up_buffer_ind = NULL; + notif_id = cJSON_GetObjectItemCaseSensitive(notification_infoJSON, "notifId"); + if (!notif_id) { + ogs_error("OpenAPI_notification_info_parseFromJSON() failed [notif_id]"); + goto end; + } + if (!cJSON_IsString(notif_id)) { + ogs_error("OpenAPI_notification_info_parseFromJSON() failed [notif_id]"); + goto end; + } + + notif_uri = cJSON_GetObjectItemCaseSensitive(notification_infoJSON, "notifUri"); + if (!notif_uri) { + ogs_error("OpenAPI_notification_info_parseFromJSON() failed [notif_uri]"); + goto end; + } + if (!cJSON_IsString(notif_uri)) { + ogs_error("OpenAPI_notification_info_parseFromJSON() failed [notif_uri]"); + goto end; + } + + up_buffer_ind = cJSON_GetObjectItemCaseSensitive(notification_infoJSON, "upBufferInd"); + if (up_buffer_ind) { + if (!cJSON_IsBool(up_buffer_ind)) { + ogs_error("OpenAPI_notification_info_parseFromJSON() failed [up_buffer_ind]"); + goto end; + } + } + + notification_info_local_var = OpenAPI_notification_info_create ( + ogs_strdup(notif_id->valuestring), + ogs_strdup(notif_uri->valuestring), + up_buffer_ind ? true : false, + up_buffer_ind ? up_buffer_ind->valueint : 0 + ); + + return notification_info_local_var; +end: + return NULL; +} + +OpenAPI_notification_info_t *OpenAPI_notification_info_copy(OpenAPI_notification_info_t *dst, OpenAPI_notification_info_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_notification_info_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_notification_info_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_notification_info_free(dst); + dst = OpenAPI_notification_info_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/notification_info.h b/lib/sbi/openapi/model/notification_info.h new file mode 100644 index 000000000..2267d7738 --- /dev/null +++ b/lib/sbi/openapi/model/notification_info.h @@ -0,0 +1,44 @@ +/* + * notification_info.h + * + * Notification Correlation ID and Notification URI provided by the NF service consumer + */ + +#ifndef _OpenAPI_notification_info_H_ +#define _OpenAPI_notification_info_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_notification_info_s OpenAPI_notification_info_t; +typedef struct OpenAPI_notification_info_s { + char *notif_id; + char *notif_uri; + bool is_up_buffer_ind; + int up_buffer_ind; +} OpenAPI_notification_info_t; + +OpenAPI_notification_info_t *OpenAPI_notification_info_create( + char *notif_id, + char *notif_uri, + bool is_up_buffer_ind, + int up_buffer_ind +); +void OpenAPI_notification_info_free(OpenAPI_notification_info_t *notification_info); +OpenAPI_notification_info_t *OpenAPI_notification_info_parseFromJSON(cJSON *notification_infoJSON); +cJSON *OpenAPI_notification_info_convertToJSON(OpenAPI_notification_info_t *notification_info); +OpenAPI_notification_info_t *OpenAPI_notification_info_copy(OpenAPI_notification_info_t *dst, OpenAPI_notification_info_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_notification_info_H_ */ + diff --git a/lib/sbi/openapi/model/notification_item.h b/lib/sbi/openapi/model/notification_item.h index 7f373123b..82a799eb3 100644 --- a/lib/sbi/openapi/model/notification_item.h +++ b/lib/sbi/openapi/model/notification_item.h @@ -1,7 +1,7 @@ /* * notification_item.h * - * Identifies a data change notification when the change occurs in a fragment (subset of resource data) of a given resource. + * Identifies a data change notification when the change occurs in a fragment (subset of resource data) of a given resource. */ #ifndef _OpenAPI_notification_item_H_ diff --git a/lib/sbi/openapi/model/notification_method.c b/lib/sbi/openapi/model/notification_method.c new file mode 100644 index 000000000..f61d665e7 --- /dev/null +++ b/lib/sbi/openapi/model/notification_method.c @@ -0,0 +1,87 @@ + +#include +#include +#include +#include "notification_method.h" + +OpenAPI_notification_method_t *OpenAPI_notification_method_create( +) +{ + OpenAPI_notification_method_t *notification_method_local_var = ogs_malloc(sizeof(OpenAPI_notification_method_t)); + ogs_assert(notification_method_local_var); + + + return notification_method_local_var; +} + +void OpenAPI_notification_method_free(OpenAPI_notification_method_t *notification_method) +{ + OpenAPI_lnode_t *node = NULL; + + if (NULL == notification_method) { + return; + } + ogs_free(notification_method); +} + +cJSON *OpenAPI_notification_method_convertToJSON(OpenAPI_notification_method_t *notification_method) +{ + cJSON *item = NULL; + OpenAPI_lnode_t *node = NULL; + + if (notification_method == NULL) { + ogs_error("OpenAPI_notification_method_convertToJSON() failed [NotificationMethod]"); + return NULL; + } + + item = cJSON_CreateObject(); +end: + return item; +} + +OpenAPI_notification_method_t *OpenAPI_notification_method_parseFromJSON(cJSON *notification_methodJSON) +{ + OpenAPI_notification_method_t *notification_method_local_var = NULL; + OpenAPI_lnode_t *node = NULL; + notification_method_local_var = OpenAPI_notification_method_create ( + ); + + return notification_method_local_var; +end: + return NULL; +} + +OpenAPI_notification_method_t *OpenAPI_notification_method_copy(OpenAPI_notification_method_t *dst, OpenAPI_notification_method_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_notification_method_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_notification_method_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_notification_method_free(dst); + dst = OpenAPI_notification_method_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/notification_method.h b/lib/sbi/openapi/model/notification_method.h new file mode 100644 index 000000000..9778b3f1c --- /dev/null +++ b/lib/sbi/openapi/model/notification_method.h @@ -0,0 +1,37 @@ +/* + * notification_method.h + * + * Possible values are: - PERIODIC: The subscribe of NWDAF Event is periodically. The periodic of the notification is identified by repetitionPeriod defined in clause 5.1.6.2.3. - THRESHOLD: The subscribe of NWDAF Event is upon threshold exceeded. + */ + +#ifndef _OpenAPI_notification_method_H_ +#define _OpenAPI_notification_method_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "notification_method_any_of.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_notification_method_s OpenAPI_notification_method_t; +typedef struct OpenAPI_notification_method_s { +} OpenAPI_notification_method_t; + +OpenAPI_notification_method_t *OpenAPI_notification_method_create( +); +void OpenAPI_notification_method_free(OpenAPI_notification_method_t *notification_method); +OpenAPI_notification_method_t *OpenAPI_notification_method_parseFromJSON(cJSON *notification_methodJSON); +cJSON *OpenAPI_notification_method_convertToJSON(OpenAPI_notification_method_t *notification_method); +OpenAPI_notification_method_t *OpenAPI_notification_method_copy(OpenAPI_notification_method_t *dst, OpenAPI_notification_method_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_notification_method_H_ */ + diff --git a/lib/sbi/openapi/model/notification_method_1.c b/lib/sbi/openapi/model/notification_method_1.c new file mode 100644 index 000000000..8daea723e --- /dev/null +++ b/lib/sbi/openapi/model/notification_method_1.c @@ -0,0 +1,87 @@ + +#include +#include +#include +#include "notification_method_1.h" + +OpenAPI_notification_method_1_t *OpenAPI_notification_method_1_create( +) +{ + OpenAPI_notification_method_1_t *notification_method_1_local_var = ogs_malloc(sizeof(OpenAPI_notification_method_1_t)); + ogs_assert(notification_method_1_local_var); + + + return notification_method_1_local_var; +} + +void OpenAPI_notification_method_1_free(OpenAPI_notification_method_1_t *notification_method_1) +{ + OpenAPI_lnode_t *node = NULL; + + if (NULL == notification_method_1) { + return; + } + ogs_free(notification_method_1); +} + +cJSON *OpenAPI_notification_method_1_convertToJSON(OpenAPI_notification_method_1_t *notification_method_1) +{ + cJSON *item = NULL; + OpenAPI_lnode_t *node = NULL; + + if (notification_method_1 == NULL) { + ogs_error("OpenAPI_notification_method_1_convertToJSON() failed [NotificationMethod_1]"); + return NULL; + } + + item = cJSON_CreateObject(); +end: + return item; +} + +OpenAPI_notification_method_1_t *OpenAPI_notification_method_1_parseFromJSON(cJSON *notification_method_1JSON) +{ + OpenAPI_notification_method_1_t *notification_method_1_local_var = NULL; + OpenAPI_lnode_t *node = NULL; + notification_method_1_local_var = OpenAPI_notification_method_1_create ( + ); + + return notification_method_1_local_var; +end: + return NULL; +} + +OpenAPI_notification_method_1_t *OpenAPI_notification_method_1_copy(OpenAPI_notification_method_1_t *dst, OpenAPI_notification_method_1_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_notification_method_1_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_notification_method_1_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_notification_method_1_free(dst); + dst = OpenAPI_notification_method_1_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/notification_method_1.h b/lib/sbi/openapi/model/notification_method_1.h new file mode 100644 index 000000000..4000e172a --- /dev/null +++ b/lib/sbi/openapi/model/notification_method_1.h @@ -0,0 +1,37 @@ +/* + * notification_method_1.h + * + * Possible values are - PERIODIC - ONE_TIME - ON_EVENT_DETECTION + */ + +#ifndef _OpenAPI_notification_method_1_H_ +#define _OpenAPI_notification_method_1_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "notification_method_1_any_of.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_notification_method_1_s OpenAPI_notification_method_1_t; +typedef struct OpenAPI_notification_method_1_s { +} OpenAPI_notification_method_1_t; + +OpenAPI_notification_method_1_t *OpenAPI_notification_method_1_create( +); +void OpenAPI_notification_method_1_free(OpenAPI_notification_method_1_t *notification_method_1); +OpenAPI_notification_method_1_t *OpenAPI_notification_method_1_parseFromJSON(cJSON *notification_method_1JSON); +cJSON *OpenAPI_notification_method_1_convertToJSON(OpenAPI_notification_method_1_t *notification_method_1); +OpenAPI_notification_method_1_t *OpenAPI_notification_method_1_copy(OpenAPI_notification_method_1_t *dst, OpenAPI_notification_method_1_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_notification_method_1_H_ */ + diff --git a/lib/sbi/openapi/model/notification_method_1_any_of.c b/lib/sbi/openapi/model/notification_method_1_any_of.c new file mode 100644 index 000000000..1cd7ae20b --- /dev/null +++ b/lib/sbi/openapi/model/notification_method_1_any_of.c @@ -0,0 +1,30 @@ + +#include +#include +#include +#include "notification_method_1_any_of.h" + +char* OpenAPI_notification_method_1_any_of_ToString(OpenAPI_notification_method_1_any_of_e notification_method_1_any_of) +{ + const char *notification_method_1_any_ofArray[] = { "NULL", "PERIODIC", "ONE_TIME", "ON_EVENT_DETECTION" }; + size_t sizeofArray = sizeof(notification_method_1_any_ofArray) / sizeof(notification_method_1_any_ofArray[0]); + if (notification_method_1_any_of < sizeofArray) + return (char *)notification_method_1_any_ofArray[notification_method_1_any_of]; + else + return (char *)"Unknown"; +} + +OpenAPI_notification_method_1_any_of_e OpenAPI_notification_method_1_any_of_FromString(char* notification_method_1_any_of) +{ + int stringToReturn = 0; + const char *notification_method_1_any_ofArray[] = { "NULL", "PERIODIC", "ONE_TIME", "ON_EVENT_DETECTION" }; + size_t sizeofArray = sizeof(notification_method_1_any_ofArray) / sizeof(notification_method_1_any_ofArray[0]); + while (stringToReturn < sizeofArray) { + if (strcmp(notification_method_1_any_of, notification_method_1_any_ofArray[stringToReturn]) == 0) { + return stringToReturn; + } + stringToReturn++; + } + return 0; +} + diff --git a/lib/sbi/openapi/model/notification_method_1_any_of.h b/lib/sbi/openapi/model/notification_method_1_any_of.h new file mode 100644 index 000000000..7b25a118b --- /dev/null +++ b/lib/sbi/openapi/model/notification_method_1_any_of.h @@ -0,0 +1,31 @@ +/* + * notification_method_1_any_of.h + * + * + */ + +#ifndef _OpenAPI_notification_method_1_any_of_H_ +#define _OpenAPI_notification_method_1_any_of_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef enum { OpenAPI_notification_method_1_any_of_NULL = 0, OpenAPI_notification_method_1_any_of_PERIODIC, OpenAPI_notification_method_1_any_of_ONE_TIME, OpenAPI_notification_method_1_any_of_ON_EVENT_DETECTION } OpenAPI_notification_method_1_any_of_e; + +char* OpenAPI_notification_method_1_any_of_ToString(OpenAPI_notification_method_1_any_of_e notification_method_1_any_of); + +OpenAPI_notification_method_1_any_of_e OpenAPI_notification_method_1_any_of_FromString(char* notification_method_1_any_of); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_notification_method_1_any_of_H_ */ + diff --git a/lib/sbi/openapi/model/notification_method_any_of.c b/lib/sbi/openapi/model/notification_method_any_of.c new file mode 100644 index 000000000..501471c2d --- /dev/null +++ b/lib/sbi/openapi/model/notification_method_any_of.c @@ -0,0 +1,30 @@ + +#include +#include +#include +#include "notification_method_any_of.h" + +char* OpenAPI_notification_method_any_of_ToString(OpenAPI_notification_method_any_of_e notification_method_any_of) +{ + const char *notification_method_any_ofArray[] = { "NULL", "PERIODIC", "THRESHOLD" }; + size_t sizeofArray = sizeof(notification_method_any_ofArray) / sizeof(notification_method_any_ofArray[0]); + if (notification_method_any_of < sizeofArray) + return (char *)notification_method_any_ofArray[notification_method_any_of]; + else + return (char *)"Unknown"; +} + +OpenAPI_notification_method_any_of_e OpenAPI_notification_method_any_of_FromString(char* notification_method_any_of) +{ + int stringToReturn = 0; + const char *notification_method_any_ofArray[] = { "NULL", "PERIODIC", "THRESHOLD" }; + size_t sizeofArray = sizeof(notification_method_any_ofArray) / sizeof(notification_method_any_ofArray[0]); + while (stringToReturn < sizeofArray) { + if (strcmp(notification_method_any_of, notification_method_any_ofArray[stringToReturn]) == 0) { + return stringToReturn; + } + stringToReturn++; + } + return 0; +} + diff --git a/lib/sbi/openapi/model/notification_method_any_of.h b/lib/sbi/openapi/model/notification_method_any_of.h new file mode 100644 index 000000000..1f9826de2 --- /dev/null +++ b/lib/sbi/openapi/model/notification_method_any_of.h @@ -0,0 +1,31 @@ +/* + * notification_method_any_of.h + * + * + */ + +#ifndef _OpenAPI_notification_method_any_of_H_ +#define _OpenAPI_notification_method_any_of_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef enum { OpenAPI_notification_method_any_of_NULL = 0, OpenAPI_notification_method_any_of_PERIODIC, OpenAPI_notification_method_any_of_THRESHOLD } OpenAPI_notification_method_any_of_e; + +char* OpenAPI_notification_method_any_of_ToString(OpenAPI_notification_method_any_of_e notification_method_any_of); + +OpenAPI_notification_method_any_of_e OpenAPI_notification_method_any_of_FromString(char* notification_method_any_of); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_notification_method_any_of_H_ */ + diff --git a/lib/sbi/openapi/model/notification_type.c b/lib/sbi/openapi/model/notification_type.c index a6a29367d..85c3cbc14 100644 --- a/lib/sbi/openapi/model/notification_type.c +++ b/lib/sbi/openapi/model/notification_type.c @@ -6,7 +6,7 @@ char* OpenAPI_notification_type_ToString(OpenAPI_notification_type_e notification_type) { - const char *notification_typeArray[] = { "NULL", "N1_MESSAGES", "N2_INFORMATION", "LOCATION_NOTIFICATION", "DATA_REMOVAL_NOTIFICATION", "DATA_CHANGE_NOTIFICATION", "LOCATION_UPDATE_NOTIFICATION", "NSSAA_REAUTH_NOTIFICATION", "NSSAA_REVOC_NOTIFICATION" }; + const char *notification_typeArray[] = { "NULL", "N1_MESSAGES", "N2_INFORMATION", "LOCATION_NOTIFICATION", "DATA_REMOVAL_NOTIFICATION", "DATA_CHANGE_NOTIFICATION", "LOCATION_UPDATE_NOTIFICATION", "NSSAA_REAUTH_NOTIFICATION", "NSSAA_REVOC_NOTIFICATION", "MATCH_INFO_NOTIFICATION", "DATA_RESTORATION_NOTIFICATION", "TSCTS_NOTIFICATION", "LCS_KEY_DELIVERY_NOTIFICATION" }; size_t sizeofArray = sizeof(notification_typeArray) / sizeof(notification_typeArray[0]); if (notification_type < sizeofArray) return (char *)notification_typeArray[notification_type]; @@ -17,7 +17,7 @@ char* OpenAPI_notification_type_ToString(OpenAPI_notification_type_e notificatio OpenAPI_notification_type_e OpenAPI_notification_type_FromString(char* notification_type) { int stringToReturn = 0; - const char *notification_typeArray[] = { "NULL", "N1_MESSAGES", "N2_INFORMATION", "LOCATION_NOTIFICATION", "DATA_REMOVAL_NOTIFICATION", "DATA_CHANGE_NOTIFICATION", "LOCATION_UPDATE_NOTIFICATION", "NSSAA_REAUTH_NOTIFICATION", "NSSAA_REVOC_NOTIFICATION" }; + const char *notification_typeArray[] = { "NULL", "N1_MESSAGES", "N2_INFORMATION", "LOCATION_NOTIFICATION", "DATA_REMOVAL_NOTIFICATION", "DATA_CHANGE_NOTIFICATION", "LOCATION_UPDATE_NOTIFICATION", "NSSAA_REAUTH_NOTIFICATION", "NSSAA_REVOC_NOTIFICATION", "MATCH_INFO_NOTIFICATION", "DATA_RESTORATION_NOTIFICATION", "TSCTS_NOTIFICATION", "LCS_KEY_DELIVERY_NOTIFICATION" }; size_t sizeofArray = sizeof(notification_typeArray) / sizeof(notification_typeArray[0]); while (stringToReturn < sizeofArray) { if (strcmp(notification_type, notification_typeArray[stringToReturn]) == 0) { diff --git a/lib/sbi/openapi/model/notification_type.h b/lib/sbi/openapi/model/notification_type.h index 16a04e39f..36e153ea9 100644 --- a/lib/sbi/openapi/model/notification_type.h +++ b/lib/sbi/openapi/model/notification_type.h @@ -17,7 +17,7 @@ extern "C" { #endif -typedef enum { OpenAPI_notification_type_NULL = 0, OpenAPI_notification_type_N1_MESSAGES, OpenAPI_notification_type_N2_INFORMATION, OpenAPI_notification_type_LOCATION_NOTIFICATION, OpenAPI_notification_type_DATA_REMOVAL_NOTIFICATION, OpenAPI_notification_type_DATA_CHANGE_NOTIFICATION, OpenAPI_notification_type_LOCATION_UPDATE_NOTIFICATION, OpenAPI_notification_type_NSSAA_REAUTH_NOTIFICATION, OpenAPI_notification_type_NSSAA_REVOC_NOTIFICATION } OpenAPI_notification_type_e; +typedef enum { OpenAPI_notification_type_NULL = 0, OpenAPI_notification_type_N1_MESSAGES, OpenAPI_notification_type_N2_INFORMATION, OpenAPI_notification_type_LOCATION_NOTIFICATION, OpenAPI_notification_type_DATA_REMOVAL_NOTIFICATION, OpenAPI_notification_type_DATA_CHANGE_NOTIFICATION, OpenAPI_notification_type_LOCATION_UPDATE_NOTIFICATION, OpenAPI_notification_type_NSSAA_REAUTH_NOTIFICATION, OpenAPI_notification_type_NSSAA_REVOC_NOTIFICATION, OpenAPI_notification_type_MATCH_INFO_NOTIFICATION, OpenAPI_notification_type_DATA_RESTORATION_NOTIFICATION, OpenAPI_notification_type_TSCTS_NOTIFICATION, OpenAPI_notification_type_LCS_KEY_DELIVERY_NOTIFICATION } OpenAPI_notification_type_e; char* OpenAPI_notification_type_ToString(OpenAPI_notification_type_e notification_type); diff --git a/lib/sbi/openapi/model/notify_item.h b/lib/sbi/openapi/model/notify_item.h index a180a70f2..17bd0ac50 100644 --- a/lib/sbi/openapi/model/notify_item.h +++ b/lib/sbi/openapi/model/notify_item.h @@ -1,7 +1,7 @@ /* * notify_item.h * - * + * Indicates changes on a resource. */ #ifndef _OpenAPI_notify_item_H_ diff --git a/lib/sbi/openapi/model/npcf_af_event.c b/lib/sbi/openapi/model/npcf_af_event.c index 4c47d48e4..f1f5cd889 100644 --- a/lib/sbi/openapi/model/npcf_af_event.c +++ b/lib/sbi/openapi/model/npcf_af_event.c @@ -6,7 +6,7 @@ char* OpenAPI_npcf_af_event_ToString(OpenAPI_npcf_af_event_e npcf_af_event) { - const char *npcf_af_eventArray[] = { "NULL", "ACCESS_TYPE_CHANGE", "ANI_REPORT", "CHARGING_CORRELATION", "EPS_FALLBACK", "FAILED_RESOURCES_ALLOCATION", "OUT_OF_CREDIT", "PLMN_CHG", "QOS_MONITORING", "QOS_NOTIF", "RAN_NAS_CAUSE", "REALLOCATION_OF_CREDIT", "SUCCESSFUL_RESOURCES_ALLOCATION", "TSN_BRIDGE_INFO", "USAGE_REPORT" }; + const char *npcf_af_eventArray[] = { "NULL", "ACCESS_TYPE_CHANGE", "ANI_REPORT", "APP_DETECTION", "CHARGING_CORRELATION", "EPS_FALLBACK", "FAILED_QOS_UPDATE", "FAILED_RESOURCES_ALLOCATION", "OUT_OF_CREDIT", "PDU_SESSION_STATUS", "PLMN_CHG", "QOS_MONITORING", "QOS_NOTIF", "RAN_NAS_CAUSE", "REALLOCATION_OF_CREDIT", "SAT_CATEGORY_CHG", "SUCCESSFUL_QOS_UPDATE", "SUCCESSFUL_RESOURCES_ALLOCATION", "TSN_BRIDGE_INFO", "UP_PATH_CHG_FAILURE", "USAGE_REPORT" }; size_t sizeofArray = sizeof(npcf_af_eventArray) / sizeof(npcf_af_eventArray[0]); if (npcf_af_event < sizeofArray) return (char *)npcf_af_eventArray[npcf_af_event]; @@ -17,7 +17,7 @@ char* OpenAPI_npcf_af_event_ToString(OpenAPI_npcf_af_event_e npcf_af_event) OpenAPI_npcf_af_event_e OpenAPI_npcf_af_event_FromString(char* npcf_af_event) { int stringToReturn = 0; - const char *npcf_af_eventArray[] = { "NULL", "ACCESS_TYPE_CHANGE", "ANI_REPORT", "CHARGING_CORRELATION", "EPS_FALLBACK", "FAILED_RESOURCES_ALLOCATION", "OUT_OF_CREDIT", "PLMN_CHG", "QOS_MONITORING", "QOS_NOTIF", "RAN_NAS_CAUSE", "REALLOCATION_OF_CREDIT", "SUCCESSFUL_RESOURCES_ALLOCATION", "TSN_BRIDGE_INFO", "USAGE_REPORT" }; + const char *npcf_af_eventArray[] = { "NULL", "ACCESS_TYPE_CHANGE", "ANI_REPORT", "APP_DETECTION", "CHARGING_CORRELATION", "EPS_FALLBACK", "FAILED_QOS_UPDATE", "FAILED_RESOURCES_ALLOCATION", "OUT_OF_CREDIT", "PDU_SESSION_STATUS", "PLMN_CHG", "QOS_MONITORING", "QOS_NOTIF", "RAN_NAS_CAUSE", "REALLOCATION_OF_CREDIT", "SAT_CATEGORY_CHG", "SUCCESSFUL_QOS_UPDATE", "SUCCESSFUL_RESOURCES_ALLOCATION", "TSN_BRIDGE_INFO", "UP_PATH_CHG_FAILURE", "USAGE_REPORT" }; size_t sizeofArray = sizeof(npcf_af_eventArray) / sizeof(npcf_af_eventArray[0]); while (stringToReturn < sizeofArray) { if (strcmp(npcf_af_event, npcf_af_eventArray[stringToReturn]) == 0) { diff --git a/lib/sbi/openapi/model/npcf_af_event.h b/lib/sbi/openapi/model/npcf_af_event.h index eabbcfd3c..5cd6c4b26 100644 --- a/lib/sbi/openapi/model/npcf_af_event.h +++ b/lib/sbi/openapi/model/npcf_af_event.h @@ -17,7 +17,7 @@ extern "C" { #endif -typedef enum { OpenAPI_npcf_af_event_NULL = 0, OpenAPI_npcf_af_event_ACCESS_TYPE_CHANGE, OpenAPI_npcf_af_event_ANI_REPORT, OpenAPI_npcf_af_event_CHARGING_CORRELATION, OpenAPI_npcf_af_event_EPS_FALLBACK, OpenAPI_npcf_af_event_FAILED_RESOURCES_ALLOCATION, OpenAPI_npcf_af_event_OUT_OF_CREDIT, OpenAPI_npcf_af_event_PLMN_CHG, OpenAPI_npcf_af_event_QOS_MONITORING, OpenAPI_npcf_af_event_QOS_NOTIF, OpenAPI_npcf_af_event_RAN_NAS_CAUSE, OpenAPI_npcf_af_event_REALLOCATION_OF_CREDIT, OpenAPI_npcf_af_event_SUCCESSFUL_RESOURCES_ALLOCATION, OpenAPI_npcf_af_event_TSN_BRIDGE_INFO, OpenAPI_npcf_af_event_USAGE_REPORT } OpenAPI_npcf_af_event_e; +typedef enum { OpenAPI_npcf_af_event_NULL = 0, OpenAPI_npcf_af_event_ACCESS_TYPE_CHANGE, OpenAPI_npcf_af_event_ANI_REPORT, OpenAPI_npcf_af_event_APP_DETECTION, OpenAPI_npcf_af_event_CHARGING_CORRELATION, OpenAPI_npcf_af_event_EPS_FALLBACK, OpenAPI_npcf_af_event_FAILED_QOS_UPDATE, OpenAPI_npcf_af_event_FAILED_RESOURCES_ALLOCATION, OpenAPI_npcf_af_event_OUT_OF_CREDIT, OpenAPI_npcf_af_event_PDU_SESSION_STATUS, OpenAPI_npcf_af_event_PLMN_CHG, OpenAPI_npcf_af_event_QOS_MONITORING, OpenAPI_npcf_af_event_QOS_NOTIF, OpenAPI_npcf_af_event_RAN_NAS_CAUSE, OpenAPI_npcf_af_event_REALLOCATION_OF_CREDIT, OpenAPI_npcf_af_event_SAT_CATEGORY_CHG, OpenAPI_npcf_af_event_SUCCESSFUL_QOS_UPDATE, OpenAPI_npcf_af_event_SUCCESSFUL_RESOURCES_ALLOCATION, OpenAPI_npcf_af_event_TSN_BRIDGE_INFO, OpenAPI_npcf_af_event_UP_PATH_CHG_FAILURE, OpenAPI_npcf_af_event_USAGE_REPORT } OpenAPI_npcf_af_event_e; char* OpenAPI_npcf_af_event_ToString(OpenAPI_npcf_af_event_e npcf_af_event); diff --git a/lib/sbi/openapi/model/npcf_atsss_capability.c b/lib/sbi/openapi/model/npcf_atsss_capability.c new file mode 100644 index 000000000..2ad09f56e --- /dev/null +++ b/lib/sbi/openapi/model/npcf_atsss_capability.c @@ -0,0 +1,30 @@ + +#include +#include +#include +#include "npcf_atsss_capability.h" + +char* OpenAPI_npcf_atsss_capability_ToString(OpenAPI_npcf_atsss_capability_e npcf_atsss_capability) +{ + const char *npcf_atsss_capabilityArray[] = { "NULL", "MPTCP_ATSSS_LL_WITH_ASMODE_UL", "MPTCP_ATSSS_LL_WITH_EXSDMODE_DL_ASMODE_UL", "MPTCP_ATSSS_LL_WITH_ASMODE_DLUL", "ATSSS_LL", "MPTCP_ATSSS_LL" }; + size_t sizeofArray = sizeof(npcf_atsss_capabilityArray) / sizeof(npcf_atsss_capabilityArray[0]); + if (npcf_atsss_capability < sizeofArray) + return (char *)npcf_atsss_capabilityArray[npcf_atsss_capability]; + else + return (char *)"Unknown"; +} + +OpenAPI_npcf_atsss_capability_e OpenAPI_npcf_atsss_capability_FromString(char* npcf_atsss_capability) +{ + int stringToReturn = 0; + const char *npcf_atsss_capabilityArray[] = { "NULL", "MPTCP_ATSSS_LL_WITH_ASMODE_UL", "MPTCP_ATSSS_LL_WITH_EXSDMODE_DL_ASMODE_UL", "MPTCP_ATSSS_LL_WITH_ASMODE_DLUL", "ATSSS_LL", "MPTCP_ATSSS_LL" }; + size_t sizeofArray = sizeof(npcf_atsss_capabilityArray) / sizeof(npcf_atsss_capabilityArray[0]); + while (stringToReturn < sizeofArray) { + if (strcmp(npcf_atsss_capability, npcf_atsss_capabilityArray[stringToReturn]) == 0) { + return stringToReturn; + } + stringToReturn++; + } + return 0; +} + diff --git a/lib/sbi/openapi/model/npcf_atsss_capability.h b/lib/sbi/openapi/model/npcf_atsss_capability.h new file mode 100644 index 000000000..5b92b3409 --- /dev/null +++ b/lib/sbi/openapi/model/npcf_atsss_capability.h @@ -0,0 +1,31 @@ +/* + * npcf_atsss_capability.h + * + * + */ + +#ifndef _OpenAPI_npcf_atsss_capability_H_ +#define _OpenAPI_npcf_atsss_capability_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef enum { OpenAPI_npcf_atsss_capability_NULL = 0, OpenAPI_npcf_atsss_capability_MPTCP_ATSSS_LL_WITH_ASMODE_UL, OpenAPI_npcf_atsss_capability_MPTCP_ATSSS_LL_WITH_EXSDMODE_DL_ASMODE_UL, OpenAPI_npcf_atsss_capability_MPTCP_ATSSS_LL_WITH_ASMODE_DLUL, OpenAPI_npcf_atsss_capability_ATSSS_LL, OpenAPI_npcf_atsss_capability_MPTCP_ATSSS_LL } OpenAPI_npcf_atsss_capability_e; + +char* OpenAPI_npcf_atsss_capability_ToString(OpenAPI_npcf_atsss_capability_e npcf_atsss_capability); + +OpenAPI_npcf_atsss_capability_e OpenAPI_npcf_atsss_capability_FromString(char* npcf_atsss_capability); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_npcf_atsss_capability_H_ */ + diff --git a/lib/sbi/openapi/model/npcf_multicast_access_control.c b/lib/sbi/openapi/model/npcf_multicast_access_control.c new file mode 100644 index 000000000..0b83214c7 --- /dev/null +++ b/lib/sbi/openapi/model/npcf_multicast_access_control.c @@ -0,0 +1,30 @@ + +#include +#include +#include +#include "npcf_multicast_access_control.h" + +char* OpenAPI_npcf_multicast_access_control_ToString(OpenAPI_npcf_multicast_access_control_e npcf_multicast_access_control) +{ + const char *npcf_multicast_access_controlArray[] = { "NULL", "ALLOWED", "NOT_ALLOWED" }; + size_t sizeofArray = sizeof(npcf_multicast_access_controlArray) / sizeof(npcf_multicast_access_controlArray[0]); + if (npcf_multicast_access_control < sizeofArray) + return (char *)npcf_multicast_access_controlArray[npcf_multicast_access_control]; + else + return (char *)"Unknown"; +} + +OpenAPI_npcf_multicast_access_control_e OpenAPI_npcf_multicast_access_control_FromString(char* npcf_multicast_access_control) +{ + int stringToReturn = 0; + const char *npcf_multicast_access_controlArray[] = { "NULL", "ALLOWED", "NOT_ALLOWED" }; + size_t sizeofArray = sizeof(npcf_multicast_access_controlArray) / sizeof(npcf_multicast_access_controlArray[0]); + while (stringToReturn < sizeofArray) { + if (strcmp(npcf_multicast_access_control, npcf_multicast_access_controlArray[stringToReturn]) == 0) { + return stringToReturn; + } + stringToReturn++; + } + return 0; +} + diff --git a/lib/sbi/openapi/model/npcf_multicast_access_control.h b/lib/sbi/openapi/model/npcf_multicast_access_control.h new file mode 100644 index 000000000..e1986ad14 --- /dev/null +++ b/lib/sbi/openapi/model/npcf_multicast_access_control.h @@ -0,0 +1,31 @@ +/* + * npcf_multicast_access_control.h + * + * + */ + +#ifndef _OpenAPI_npcf_multicast_access_control_H_ +#define _OpenAPI_npcf_multicast_access_control_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef enum { OpenAPI_npcf_multicast_access_control_NULL = 0, OpenAPI_npcf_multicast_access_control_ALLOWED, OpenAPI_npcf_multicast_access_control_NOT_ALLOWED } OpenAPI_npcf_multicast_access_control_e; + +char* OpenAPI_npcf_multicast_access_control_ToString(OpenAPI_npcf_multicast_access_control_e npcf_multicast_access_control); + +OpenAPI_npcf_multicast_access_control_e OpenAPI_npcf_multicast_access_control_FromString(char* npcf_multicast_access_control); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_npcf_multicast_access_control_H_ */ + diff --git a/lib/sbi/openapi/model/npcf_pdu_session_status.c b/lib/sbi/openapi/model/npcf_pdu_session_status.c new file mode 100644 index 000000000..09f0e7042 --- /dev/null +++ b/lib/sbi/openapi/model/npcf_pdu_session_status.c @@ -0,0 +1,30 @@ + +#include +#include +#include +#include "npcf_pdu_session_status.h" + +char* OpenAPI_npcf_pdu_session_status_ToString(OpenAPI_npcf_pdu_session_status_e npcf_pdu_session_status) +{ + const char *npcf_pdu_session_statusArray[] = { "NULL", "ESTABLISHED", "TERMINATED" }; + size_t sizeofArray = sizeof(npcf_pdu_session_statusArray) / sizeof(npcf_pdu_session_statusArray[0]); + if (npcf_pdu_session_status < sizeofArray) + return (char *)npcf_pdu_session_statusArray[npcf_pdu_session_status]; + else + return (char *)"Unknown"; +} + +OpenAPI_npcf_pdu_session_status_e OpenAPI_npcf_pdu_session_status_FromString(char* npcf_pdu_session_status) +{ + int stringToReturn = 0; + const char *npcf_pdu_session_statusArray[] = { "NULL", "ESTABLISHED", "TERMINATED" }; + size_t sizeofArray = sizeof(npcf_pdu_session_statusArray) / sizeof(npcf_pdu_session_statusArray[0]); + while (stringToReturn < sizeofArray) { + if (strcmp(npcf_pdu_session_status, npcf_pdu_session_statusArray[stringToReturn]) == 0) { + return stringToReturn; + } + stringToReturn++; + } + return 0; +} + diff --git a/lib/sbi/openapi/model/npcf_pdu_session_status.h b/lib/sbi/openapi/model/npcf_pdu_session_status.h new file mode 100644 index 000000000..f66f413c5 --- /dev/null +++ b/lib/sbi/openapi/model/npcf_pdu_session_status.h @@ -0,0 +1,31 @@ +/* + * npcf_pdu_session_status.h + * + * + */ + +#ifndef _OpenAPI_npcf_pdu_session_status_H_ +#define _OpenAPI_npcf_pdu_session_status_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef enum { OpenAPI_npcf_pdu_session_status_NULL = 0, OpenAPI_npcf_pdu_session_status_ESTABLISHED, OpenAPI_npcf_pdu_session_status_TERMINATED } OpenAPI_npcf_pdu_session_status_e; + +char* OpenAPI_npcf_pdu_session_status_ToString(OpenAPI_npcf_pdu_session_status_e npcf_pdu_session_status); + +OpenAPI_npcf_pdu_session_status_e OpenAPI_npcf_pdu_session_status_FromString(char* npcf_pdu_session_status); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_npcf_pdu_session_status_H_ */ + diff --git a/lib/sbi/openapi/model/nr_location.c b/lib/sbi/openapi/model/nr_location.c index d2bb5ca83..6d62bdfd7 100644 --- a/lib/sbi/openapi/model/nr_location.c +++ b/lib/sbi/openapi/model/nr_location.c @@ -7,6 +7,8 @@ OpenAPI_nr_location_t *OpenAPI_nr_location_create( OpenAPI_tai_t *tai, OpenAPI_ncgi_t *ncgi, + bool is_ignore_ncgi, + int ignore_ncgi, bool is_age_of_location_information, int age_of_location_information, char *ue_location_timestamp, @@ -20,6 +22,8 @@ OpenAPI_nr_location_t *OpenAPI_nr_location_create( nr_location_local_var->tai = tai; nr_location_local_var->ncgi = ncgi; + nr_location_local_var->is_ignore_ncgi = is_ignore_ncgi; + nr_location_local_var->ignore_ncgi = ignore_ncgi; nr_location_local_var->is_age_of_location_information = is_age_of_location_information; nr_location_local_var->age_of_location_information = age_of_location_information; nr_location_local_var->ue_location_timestamp = ue_location_timestamp; @@ -105,6 +109,13 @@ cJSON *OpenAPI_nr_location_convertToJSON(OpenAPI_nr_location_t *nr_location) goto end; } + if (nr_location->is_ignore_ncgi) { + if (cJSON_AddBoolToObject(item, "ignoreNcgi", nr_location->ignore_ncgi) == NULL) { + ogs_error("OpenAPI_nr_location_convertToJSON() failed [ignore_ncgi]"); + goto end; + } + } + if (nr_location->is_age_of_location_information) { if (cJSON_AddNumberToObject(item, "ageOfLocationInformation", nr_location->age_of_location_information) == NULL) { ogs_error("OpenAPI_nr_location_convertToJSON() failed [age_of_location_information]"); @@ -158,6 +169,7 @@ OpenAPI_nr_location_t *OpenAPI_nr_location_parseFromJSON(cJSON *nr_locationJSON) OpenAPI_tai_t *tai_local_nonprim = NULL; cJSON *ncgi = NULL; OpenAPI_ncgi_t *ncgi_local_nonprim = NULL; + cJSON *ignore_ncgi = NULL; cJSON *age_of_location_information = NULL; cJSON *ue_location_timestamp = NULL; cJSON *geographical_information = NULL; @@ -178,6 +190,14 @@ OpenAPI_nr_location_t *OpenAPI_nr_location_parseFromJSON(cJSON *nr_locationJSON) } ncgi_local_nonprim = OpenAPI_ncgi_parseFromJSON(ncgi); + ignore_ncgi = cJSON_GetObjectItemCaseSensitive(nr_locationJSON, "ignoreNcgi"); + if (ignore_ncgi) { + if (!cJSON_IsBool(ignore_ncgi)) { + ogs_error("OpenAPI_nr_location_parseFromJSON() failed [ignore_ncgi]"); + goto end; + } + } + age_of_location_information = cJSON_GetObjectItemCaseSensitive(nr_locationJSON, "ageOfLocationInformation"); if (age_of_location_information) { if (!cJSON_IsNumber(age_of_location_information)) { @@ -218,6 +238,8 @@ OpenAPI_nr_location_t *OpenAPI_nr_location_parseFromJSON(cJSON *nr_locationJSON) nr_location_local_var = OpenAPI_nr_location_create ( tai_local_nonprim, ncgi_local_nonprim, + ignore_ncgi ? true : false, + ignore_ncgi ? ignore_ncgi->valueint : 0, age_of_location_information ? true : false, age_of_location_information ? age_of_location_information->valuedouble : 0, ue_location_timestamp && !cJSON_IsNull(ue_location_timestamp) ? ogs_strdup(ue_location_timestamp->valuestring) : NULL, diff --git a/lib/sbi/openapi/model/nr_location.h b/lib/sbi/openapi/model/nr_location.h index 6b0ce8a85..cbb98aaa4 100644 --- a/lib/sbi/openapi/model/nr_location.h +++ b/lib/sbi/openapi/model/nr_location.h @@ -1,7 +1,7 @@ /* * nr_location.h * - * + * Contains the NR user location. */ #ifndef _OpenAPI_nr_location_H_ @@ -24,6 +24,8 @@ typedef struct OpenAPI_nr_location_s OpenAPI_nr_location_t; typedef struct OpenAPI_nr_location_s { struct OpenAPI_tai_s *tai; struct OpenAPI_ncgi_s *ncgi; + bool is_ignore_ncgi; + int ignore_ncgi; bool is_age_of_location_information; int age_of_location_information; char *ue_location_timestamp; @@ -35,6 +37,8 @@ typedef struct OpenAPI_nr_location_s { OpenAPI_nr_location_t *OpenAPI_nr_location_create( OpenAPI_tai_t *tai, OpenAPI_ncgi_t *ncgi, + bool is_ignore_ncgi, + int ignore_ncgi, bool is_age_of_location_information, int age_of_location_information, char *ue_location_timestamp, diff --git a/lib/sbi/openapi/model/nr_v2x_auth.h b/lib/sbi/openapi/model/nr_v2x_auth.h index 8cc1eabc2..317b2829d 100644 --- a/lib/sbi/openapi/model/nr_v2x_auth.h +++ b/lib/sbi/openapi/model/nr_v2x_auth.h @@ -1,7 +1,7 @@ /* * nr_v2x_auth.h * - * + * Contains NR V2X services authorized information. */ #ifndef _OpenAPI_nr_v2x_auth_H_ diff --git a/lib/sbi/openapi/model/nr_v2x_auth_1.c b/lib/sbi/openapi/model/nr_v2x_auth_1.c deleted file mode 100644 index 7ecc4ceb9..000000000 --- a/lib/sbi/openapi/model/nr_v2x_auth_1.c +++ /dev/null @@ -1,129 +0,0 @@ - -#include -#include -#include -#include "nr_v2x_auth_1.h" - -OpenAPI_nr_v2x_auth_1_t *OpenAPI_nr_v2x_auth_1_create( - OpenAPI_ue_auth_e vehicle_ue_auth, - OpenAPI_ue_auth_e pedestrian_ue_auth -) -{ - OpenAPI_nr_v2x_auth_1_t *nr_v2x_auth_1_local_var = ogs_malloc(sizeof(OpenAPI_nr_v2x_auth_1_t)); - ogs_assert(nr_v2x_auth_1_local_var); - - nr_v2x_auth_1_local_var->vehicle_ue_auth = vehicle_ue_auth; - nr_v2x_auth_1_local_var->pedestrian_ue_auth = pedestrian_ue_auth; - - return nr_v2x_auth_1_local_var; -} - -void OpenAPI_nr_v2x_auth_1_free(OpenAPI_nr_v2x_auth_1_t *nr_v2x_auth_1) -{ - OpenAPI_lnode_t *node = NULL; - - if (NULL == nr_v2x_auth_1) { - return; - } - ogs_free(nr_v2x_auth_1); -} - -cJSON *OpenAPI_nr_v2x_auth_1_convertToJSON(OpenAPI_nr_v2x_auth_1_t *nr_v2x_auth_1) -{ - cJSON *item = NULL; - OpenAPI_lnode_t *node = NULL; - - if (nr_v2x_auth_1 == NULL) { - ogs_error("OpenAPI_nr_v2x_auth_1_convertToJSON() failed [NrV2xAuth_1]"); - return NULL; - } - - item = cJSON_CreateObject(); - if (nr_v2x_auth_1->vehicle_ue_auth != OpenAPI_ue_auth_NULL) { - if (cJSON_AddStringToObject(item, "vehicleUeAuth", OpenAPI_ue_auth_ToString(nr_v2x_auth_1->vehicle_ue_auth)) == NULL) { - ogs_error("OpenAPI_nr_v2x_auth_1_convertToJSON() failed [vehicle_ue_auth]"); - goto end; - } - } - - if (nr_v2x_auth_1->pedestrian_ue_auth != OpenAPI_ue_auth_NULL) { - if (cJSON_AddStringToObject(item, "pedestrianUeAuth", OpenAPI_ue_auth_ToString(nr_v2x_auth_1->pedestrian_ue_auth)) == NULL) { - ogs_error("OpenAPI_nr_v2x_auth_1_convertToJSON() failed [pedestrian_ue_auth]"); - goto end; - } - } - -end: - return item; -} - -OpenAPI_nr_v2x_auth_1_t *OpenAPI_nr_v2x_auth_1_parseFromJSON(cJSON *nr_v2x_auth_1JSON) -{ - OpenAPI_nr_v2x_auth_1_t *nr_v2x_auth_1_local_var = NULL; - OpenAPI_lnode_t *node = NULL; - cJSON *vehicle_ue_auth = NULL; - OpenAPI_ue_auth_e vehicle_ue_authVariable = 0; - cJSON *pedestrian_ue_auth = NULL; - OpenAPI_ue_auth_e pedestrian_ue_authVariable = 0; - vehicle_ue_auth = cJSON_GetObjectItemCaseSensitive(nr_v2x_auth_1JSON, "vehicleUeAuth"); - if (vehicle_ue_auth) { - if (!cJSON_IsString(vehicle_ue_auth)) { - ogs_error("OpenAPI_nr_v2x_auth_1_parseFromJSON() failed [vehicle_ue_auth]"); - goto end; - } - vehicle_ue_authVariable = OpenAPI_ue_auth_FromString(vehicle_ue_auth->valuestring); - } - - pedestrian_ue_auth = cJSON_GetObjectItemCaseSensitive(nr_v2x_auth_1JSON, "pedestrianUeAuth"); - if (pedestrian_ue_auth) { - if (!cJSON_IsString(pedestrian_ue_auth)) { - ogs_error("OpenAPI_nr_v2x_auth_1_parseFromJSON() failed [pedestrian_ue_auth]"); - goto end; - } - pedestrian_ue_authVariable = OpenAPI_ue_auth_FromString(pedestrian_ue_auth->valuestring); - } - - nr_v2x_auth_1_local_var = OpenAPI_nr_v2x_auth_1_create ( - vehicle_ue_auth ? vehicle_ue_authVariable : 0, - pedestrian_ue_auth ? pedestrian_ue_authVariable : 0 - ); - - return nr_v2x_auth_1_local_var; -end: - return NULL; -} - -OpenAPI_nr_v2x_auth_1_t *OpenAPI_nr_v2x_auth_1_copy(OpenAPI_nr_v2x_auth_1_t *dst, OpenAPI_nr_v2x_auth_1_t *src) -{ - cJSON *item = NULL; - char *content = NULL; - - ogs_assert(src); - item = OpenAPI_nr_v2x_auth_1_convertToJSON(src); - if (!item) { - ogs_error("OpenAPI_nr_v2x_auth_1_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_nr_v2x_auth_1_free(dst); - dst = OpenAPI_nr_v2x_auth_1_parseFromJSON(item); - cJSON_Delete(item); - - return dst; -} - diff --git a/lib/sbi/openapi/model/nr_v2x_auth_1.h b/lib/sbi/openapi/model/nr_v2x_auth_1.h deleted file mode 100644 index 05e10f21d..000000000 --- a/lib/sbi/openapi/model/nr_v2x_auth_1.h +++ /dev/null @@ -1,41 +0,0 @@ -/* - * nr_v2x_auth_1.h - * - * - */ - -#ifndef _OpenAPI_nr_v2x_auth_1_H_ -#define _OpenAPI_nr_v2x_auth_1_H_ - -#include -#include "../external/cJSON.h" -#include "../include/list.h" -#include "../include/keyValuePair.h" -#include "../include/binary.h" -#include "ue_auth.h" - -#ifdef __cplusplus -extern "C" { -#endif - -typedef struct OpenAPI_nr_v2x_auth_1_s OpenAPI_nr_v2x_auth_1_t; -typedef struct OpenAPI_nr_v2x_auth_1_s { - OpenAPI_ue_auth_e vehicle_ue_auth; - OpenAPI_ue_auth_e pedestrian_ue_auth; -} OpenAPI_nr_v2x_auth_1_t; - -OpenAPI_nr_v2x_auth_1_t *OpenAPI_nr_v2x_auth_1_create( - OpenAPI_ue_auth_e vehicle_ue_auth, - OpenAPI_ue_auth_e pedestrian_ue_auth -); -void OpenAPI_nr_v2x_auth_1_free(OpenAPI_nr_v2x_auth_1_t *nr_v2x_auth_1); -OpenAPI_nr_v2x_auth_1_t *OpenAPI_nr_v2x_auth_1_parseFromJSON(cJSON *nr_v2x_auth_1JSON); -cJSON *OpenAPI_nr_v2x_auth_1_convertToJSON(OpenAPI_nr_v2x_auth_1_t *nr_v2x_auth_1); -OpenAPI_nr_v2x_auth_1_t *OpenAPI_nr_v2x_auth_1_copy(OpenAPI_nr_v2x_auth_1_t *dst, OpenAPI_nr_v2x_auth_1_t *src); - -#ifdef __cplusplus -} -#endif - -#endif /* _OpenAPI_nr_v2x_auth_1_H_ */ - diff --git a/lib/sbi/openapi/model/nrf_info.c b/lib/sbi/openapi/model/nrf_info.c index 4bf9e64ec..6d589e9f8 100644 --- a/lib/sbi/openapi/model/nrf_info.c +++ b/lib/sbi/openapi/model/nrf_info.c @@ -25,6 +25,7 @@ OpenAPI_nrf_info_t *OpenAPI_nrf_info_create( OpenAPI_list_t* served_chf_info_list, OpenAPI_list_t* served_nef_info, OpenAPI_list_t* served_nwdaf_info, + OpenAPI_list_t* served_nwdaf_info_list, OpenAPI_list_t* served_pcscf_info_list, OpenAPI_list_t* served_gmlc_info, OpenAPI_list_t* served_lmf_info, @@ -32,7 +33,18 @@ OpenAPI_nrf_info_t *OpenAPI_nrf_info_create( OpenAPI_list_t* served_hss_info_list, OpenAPI_list_t* served_udsf_info, OpenAPI_list_t* served_udsf_info_list, - OpenAPI_list_t* served_scp_info_list + OpenAPI_list_t* served_scp_info_list, + OpenAPI_list_t* served_sepp_info_list, + OpenAPI_list_t* served_aanf_info_list, + OpenAPI_list_t* served5g_ddnmf_info, + OpenAPI_list_t* served_mfaf_info_list, + OpenAPI_list_t* served_easdf_info_list, + OpenAPI_list_t* served_dccf_info_list, + OpenAPI_list_t* served_mb_smf_info_list, + OpenAPI_list_t* served_tsctsf_info_list, + OpenAPI_list_t* served_mb_upf_info_list, + OpenAPI_list_t* served_trust_af_info, + OpenAPI_list_t* served_nssaaf_info ) { OpenAPI_nrf_info_t *nrf_info_local_var = ogs_malloc(sizeof(OpenAPI_nrf_info_t)); @@ -58,6 +70,7 @@ OpenAPI_nrf_info_t *OpenAPI_nrf_info_create( nrf_info_local_var->served_chf_info_list = served_chf_info_list; nrf_info_local_var->served_nef_info = served_nef_info; nrf_info_local_var->served_nwdaf_info = served_nwdaf_info; + nrf_info_local_var->served_nwdaf_info_list = served_nwdaf_info_list; nrf_info_local_var->served_pcscf_info_list = served_pcscf_info_list; nrf_info_local_var->served_gmlc_info = served_gmlc_info; nrf_info_local_var->served_lmf_info = served_lmf_info; @@ -66,6 +79,17 @@ OpenAPI_nrf_info_t *OpenAPI_nrf_info_create( nrf_info_local_var->served_udsf_info = served_udsf_info; nrf_info_local_var->served_udsf_info_list = served_udsf_info_list; nrf_info_local_var->served_scp_info_list = served_scp_info_list; + nrf_info_local_var->served_sepp_info_list = served_sepp_info_list; + nrf_info_local_var->served_aanf_info_list = served_aanf_info_list; + nrf_info_local_var->served5g_ddnmf_info = served5g_ddnmf_info; + nrf_info_local_var->served_mfaf_info_list = served_mfaf_info_list; + nrf_info_local_var->served_easdf_info_list = served_easdf_info_list; + nrf_info_local_var->served_dccf_info_list = served_dccf_info_list; + nrf_info_local_var->served_mb_smf_info_list = served_mb_smf_info_list; + nrf_info_local_var->served_tsctsf_info_list = served_tsctsf_info_list; + nrf_info_local_var->served_mb_upf_info_list = served_mb_upf_info_list; + nrf_info_local_var->served_trust_af_info = served_trust_af_info; + nrf_info_local_var->served_nssaaf_info = served_nssaaf_info; return nrf_info_local_var; } @@ -81,7 +105,7 @@ void OpenAPI_nrf_info_free(OpenAPI_nrf_info_t *nrf_info) OpenAPI_list_for_each(nrf_info->served_udr_info, node) { OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*)node->data; ogs_free(localKeyValue->key); - OpenAPI_udr_info_free(localKeyValue->value); + OpenAPI_nrf_info_served_udr_info_value_free(localKeyValue->value); OpenAPI_map_free(localKeyValue); } OpenAPI_list_free(nrf_info->served_udr_info); @@ -101,7 +125,7 @@ void OpenAPI_nrf_info_free(OpenAPI_nrf_info_t *nrf_info) OpenAPI_list_for_each(nrf_info->served_udm_info, node) { OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*)node->data; ogs_free(localKeyValue->key); - OpenAPI_udm_info_free(localKeyValue->value); + OpenAPI_nrf_info_served_udm_info_value_free(localKeyValue->value); OpenAPI_map_free(localKeyValue); } OpenAPI_list_free(nrf_info->served_udm_info); @@ -121,7 +145,7 @@ void OpenAPI_nrf_info_free(OpenAPI_nrf_info_t *nrf_info) OpenAPI_list_for_each(nrf_info->served_ausf_info, node) { OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*)node->data; ogs_free(localKeyValue->key); - OpenAPI_ausf_info_free(localKeyValue->value); + OpenAPI_nrf_info_served_ausf_info_value_free(localKeyValue->value); OpenAPI_map_free(localKeyValue); } OpenAPI_list_free(nrf_info->served_ausf_info); @@ -141,7 +165,7 @@ void OpenAPI_nrf_info_free(OpenAPI_nrf_info_t *nrf_info) OpenAPI_list_for_each(nrf_info->served_amf_info, node) { OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*)node->data; ogs_free(localKeyValue->key); - OpenAPI_amf_info_free(localKeyValue->value); + OpenAPI_nrf_info_served_amf_info_value_free(localKeyValue->value); OpenAPI_map_free(localKeyValue); } OpenAPI_list_free(nrf_info->served_amf_info); @@ -161,7 +185,7 @@ void OpenAPI_nrf_info_free(OpenAPI_nrf_info_t *nrf_info) OpenAPI_list_for_each(nrf_info->served_smf_info, node) { OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*)node->data; ogs_free(localKeyValue->key); - OpenAPI_smf_info_free(localKeyValue->value); + OpenAPI_nrf_info_served_smf_info_value_free(localKeyValue->value); OpenAPI_map_free(localKeyValue); } OpenAPI_list_free(nrf_info->served_smf_info); @@ -181,7 +205,7 @@ void OpenAPI_nrf_info_free(OpenAPI_nrf_info_t *nrf_info) OpenAPI_list_for_each(nrf_info->served_upf_info, node) { OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*)node->data; ogs_free(localKeyValue->key); - OpenAPI_upf_info_free(localKeyValue->value); + OpenAPI_nrf_info_served_upf_info_value_free(localKeyValue->value); OpenAPI_map_free(localKeyValue); } OpenAPI_list_free(nrf_info->served_upf_info); @@ -201,7 +225,7 @@ void OpenAPI_nrf_info_free(OpenAPI_nrf_info_t *nrf_info) OpenAPI_list_for_each(nrf_info->served_pcf_info, node) { OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*)node->data; ogs_free(localKeyValue->key); - OpenAPI_pcf_info_free(localKeyValue->value); + OpenAPI_nrf_info_served_pcf_info_value_free(localKeyValue->value); OpenAPI_map_free(localKeyValue); } OpenAPI_list_free(nrf_info->served_pcf_info); @@ -221,7 +245,7 @@ void OpenAPI_nrf_info_free(OpenAPI_nrf_info_t *nrf_info) OpenAPI_list_for_each(nrf_info->served_bsf_info, node) { OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*)node->data; ogs_free(localKeyValue->key); - OpenAPI_bsf_info_free(localKeyValue->value); + OpenAPI_nrf_info_served_bsf_info_value_free(localKeyValue->value); OpenAPI_map_free(localKeyValue); } OpenAPI_list_free(nrf_info->served_bsf_info); @@ -241,7 +265,7 @@ void OpenAPI_nrf_info_free(OpenAPI_nrf_info_t *nrf_info) OpenAPI_list_for_each(nrf_info->served_chf_info, node) { OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*)node->data; ogs_free(localKeyValue->key); - OpenAPI_chf_info_free(localKeyValue->value); + OpenAPI_nrf_info_served_chf_info_value_free(localKeyValue->value); OpenAPI_map_free(localKeyValue); } OpenAPI_list_free(nrf_info->served_chf_info); @@ -261,7 +285,7 @@ void OpenAPI_nrf_info_free(OpenAPI_nrf_info_t *nrf_info) OpenAPI_list_for_each(nrf_info->served_nef_info, node) { OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*)node->data; ogs_free(localKeyValue->key); - OpenAPI_nef_info_free(localKeyValue->value); + OpenAPI_nrf_info_served_nef_info_value_free(localKeyValue->value); OpenAPI_map_free(localKeyValue); } OpenAPI_list_free(nrf_info->served_nef_info); @@ -271,12 +295,22 @@ void OpenAPI_nrf_info_free(OpenAPI_nrf_info_t *nrf_info) OpenAPI_list_for_each(nrf_info->served_nwdaf_info, node) { OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*)node->data; ogs_free(localKeyValue->key); - OpenAPI_nwdaf_info_free(localKeyValue->value); + OpenAPI_nrf_info_served_nwdaf_info_value_free(localKeyValue->value); OpenAPI_map_free(localKeyValue); } OpenAPI_list_free(nrf_info->served_nwdaf_info); nrf_info->served_nwdaf_info = NULL; } + if (nrf_info->served_nwdaf_info_list) { + OpenAPI_list_for_each(nrf_info->served_nwdaf_info_list, node) { + OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*)node->data; + ogs_free(localKeyValue->key); + ogs_free(localKeyValue->value); + OpenAPI_map_free(localKeyValue); + } + OpenAPI_list_free(nrf_info->served_nwdaf_info_list); + nrf_info->served_nwdaf_info_list = NULL; + } if (nrf_info->served_pcscf_info_list) { OpenAPI_list_for_each(nrf_info->served_pcscf_info_list, node) { OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*)node->data; @@ -291,7 +325,7 @@ void OpenAPI_nrf_info_free(OpenAPI_nrf_info_t *nrf_info) OpenAPI_list_for_each(nrf_info->served_gmlc_info, node) { OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*)node->data; ogs_free(localKeyValue->key); - OpenAPI_gmlc_info_free(localKeyValue->value); + OpenAPI_nrf_info_served_gmlc_info_value_free(localKeyValue->value); OpenAPI_map_free(localKeyValue); } OpenAPI_list_free(nrf_info->served_gmlc_info); @@ -301,7 +335,7 @@ void OpenAPI_nrf_info_free(OpenAPI_nrf_info_t *nrf_info) OpenAPI_list_for_each(nrf_info->served_lmf_info, node) { OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*)node->data; ogs_free(localKeyValue->key); - OpenAPI_lmf_info_free(localKeyValue->value); + OpenAPI_nrf_info_served_lmf_info_value_free(localKeyValue->value); OpenAPI_map_free(localKeyValue); } OpenAPI_list_free(nrf_info->served_lmf_info); @@ -331,7 +365,7 @@ void OpenAPI_nrf_info_free(OpenAPI_nrf_info_t *nrf_info) OpenAPI_list_for_each(nrf_info->served_udsf_info, node) { OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*)node->data; ogs_free(localKeyValue->key); - OpenAPI_udsf_info_free(localKeyValue->value); + OpenAPI_nrf_info_served_udsf_info_value_free(localKeyValue->value); OpenAPI_map_free(localKeyValue); } OpenAPI_list_free(nrf_info->served_udsf_info); @@ -351,12 +385,122 @@ void OpenAPI_nrf_info_free(OpenAPI_nrf_info_t *nrf_info) OpenAPI_list_for_each(nrf_info->served_scp_info_list, node) { OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*)node->data; ogs_free(localKeyValue->key); - OpenAPI_scp_info_free(localKeyValue->value); + OpenAPI_nrf_info_served_scp_info_list_value_free(localKeyValue->value); OpenAPI_map_free(localKeyValue); } OpenAPI_list_free(nrf_info->served_scp_info_list); nrf_info->served_scp_info_list = NULL; } + if (nrf_info->served_sepp_info_list) { + OpenAPI_list_for_each(nrf_info->served_sepp_info_list, node) { + OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*)node->data; + ogs_free(localKeyValue->key); + OpenAPI_nrf_info_served_sepp_info_list_value_free(localKeyValue->value); + OpenAPI_map_free(localKeyValue); + } + OpenAPI_list_free(nrf_info->served_sepp_info_list); + nrf_info->served_sepp_info_list = NULL; + } + if (nrf_info->served_aanf_info_list) { + OpenAPI_list_for_each(nrf_info->served_aanf_info_list, node) { + OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*)node->data; + ogs_free(localKeyValue->key); + ogs_free(localKeyValue->value); + OpenAPI_map_free(localKeyValue); + } + OpenAPI_list_free(nrf_info->served_aanf_info_list); + nrf_info->served_aanf_info_list = NULL; + } + if (nrf_info->served5g_ddnmf_info) { + OpenAPI_list_for_each(nrf_info->served5g_ddnmf_info, node) { + OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*)node->data; + ogs_free(localKeyValue->key); + OpenAPI_model_5_g_ddnmf_info_free(localKeyValue->value); + OpenAPI_map_free(localKeyValue); + } + OpenAPI_list_free(nrf_info->served5g_ddnmf_info); + nrf_info->served5g_ddnmf_info = NULL; + } + if (nrf_info->served_mfaf_info_list) { + OpenAPI_list_for_each(nrf_info->served_mfaf_info_list, node) { + OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*)node->data; + ogs_free(localKeyValue->key); + OpenAPI_mfaf_info_free(localKeyValue->value); + OpenAPI_map_free(localKeyValue); + } + OpenAPI_list_free(nrf_info->served_mfaf_info_list); + nrf_info->served_mfaf_info_list = NULL; + } + if (nrf_info->served_easdf_info_list) { + OpenAPI_list_for_each(nrf_info->served_easdf_info_list, node) { + OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*)node->data; + ogs_free(localKeyValue->key); + ogs_free(localKeyValue->value); + OpenAPI_map_free(localKeyValue); + } + OpenAPI_list_free(nrf_info->served_easdf_info_list); + nrf_info->served_easdf_info_list = NULL; + } + if (nrf_info->served_dccf_info_list) { + OpenAPI_list_for_each(nrf_info->served_dccf_info_list, node) { + OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*)node->data; + ogs_free(localKeyValue->key); + OpenAPI_dccf_info_free(localKeyValue->value); + OpenAPI_map_free(localKeyValue); + } + OpenAPI_list_free(nrf_info->served_dccf_info_list); + nrf_info->served_dccf_info_list = NULL; + } + if (nrf_info->served_mb_smf_info_list) { + OpenAPI_list_for_each(nrf_info->served_mb_smf_info_list, node) { + OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*)node->data; + ogs_free(localKeyValue->key); + ogs_free(localKeyValue->value); + OpenAPI_map_free(localKeyValue); + } + OpenAPI_list_free(nrf_info->served_mb_smf_info_list); + nrf_info->served_mb_smf_info_list = NULL; + } + if (nrf_info->served_tsctsf_info_list) { + OpenAPI_list_for_each(nrf_info->served_tsctsf_info_list, node) { + OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*)node->data; + ogs_free(localKeyValue->key); + ogs_free(localKeyValue->value); + OpenAPI_map_free(localKeyValue); + } + OpenAPI_list_free(nrf_info->served_tsctsf_info_list); + nrf_info->served_tsctsf_info_list = NULL; + } + if (nrf_info->served_mb_upf_info_list) { + OpenAPI_list_for_each(nrf_info->served_mb_upf_info_list, node) { + OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*)node->data; + ogs_free(localKeyValue->key); + ogs_free(localKeyValue->value); + OpenAPI_map_free(localKeyValue); + } + OpenAPI_list_free(nrf_info->served_mb_upf_info_list); + nrf_info->served_mb_upf_info_list = NULL; + } + if (nrf_info->served_trust_af_info) { + OpenAPI_list_for_each(nrf_info->served_trust_af_info, node) { + OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*)node->data; + ogs_free(localKeyValue->key); + OpenAPI_trust_af_info_free(localKeyValue->value); + OpenAPI_map_free(localKeyValue); + } + OpenAPI_list_free(nrf_info->served_trust_af_info); + nrf_info->served_trust_af_info = NULL; + } + if (nrf_info->served_nssaaf_info) { + OpenAPI_list_for_each(nrf_info->served_nssaaf_info, node) { + OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*)node->data; + ogs_free(localKeyValue->key); + OpenAPI_nssaaf_info_free(localKeyValue->value); + OpenAPI_map_free(localKeyValue); + } + OpenAPI_list_free(nrf_info->served_nssaaf_info); + nrf_info->served_nssaaf_info = NULL; + } ogs_free(nrf_info); } @@ -382,7 +526,7 @@ cJSON *OpenAPI_nrf_info_convertToJSON(OpenAPI_nrf_info_t *nrf_info) OpenAPI_list_for_each(nrf_info->served_udr_info, node) { OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*)node->data; cJSON *itemLocal = localKeyValue->value ? - OpenAPI_udr_info_convertToJSON(localKeyValue->value) : + OpenAPI_nrf_info_served_udr_info_value_convertToJSON(localKeyValue->value) : cJSON_CreateNull(); if (itemLocal == NULL) { ogs_error("OpenAPI_nrf_info_convertToJSON() failed [inner]"); @@ -404,7 +548,7 @@ cJSON *OpenAPI_nrf_info_convertToJSON(OpenAPI_nrf_info_t *nrf_info) OpenAPI_list_for_each(nrf_info->served_udr_info_list, node) { OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*)node->data; cJSON *itemLocal = localKeyValue->value ? - OpenAPI_udr_info_convertToJSON(localKeyValue->value) : + OpenAPI_nrf_info_served_udr_info_value_convertToJSON(localKeyValue->value) : cJSON_CreateNull(); if (itemLocal == NULL) { ogs_error("OpenAPI_nrf_info_convertToJSON() failed [inner]"); @@ -426,7 +570,7 @@ cJSON *OpenAPI_nrf_info_convertToJSON(OpenAPI_nrf_info_t *nrf_info) OpenAPI_list_for_each(nrf_info->served_udm_info, node) { OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*)node->data; cJSON *itemLocal = localKeyValue->value ? - OpenAPI_udm_info_convertToJSON(localKeyValue->value) : + OpenAPI_nrf_info_served_udm_info_value_convertToJSON(localKeyValue->value) : cJSON_CreateNull(); if (itemLocal == NULL) { ogs_error("OpenAPI_nrf_info_convertToJSON() failed [inner]"); @@ -448,7 +592,7 @@ cJSON *OpenAPI_nrf_info_convertToJSON(OpenAPI_nrf_info_t *nrf_info) OpenAPI_list_for_each(nrf_info->served_udm_info_list, node) { OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*)node->data; cJSON *itemLocal = localKeyValue->value ? - OpenAPI_udm_info_convertToJSON(localKeyValue->value) : + OpenAPI_nrf_info_served_udm_info_value_convertToJSON(localKeyValue->value) : cJSON_CreateNull(); if (itemLocal == NULL) { ogs_error("OpenAPI_nrf_info_convertToJSON() failed [inner]"); @@ -470,7 +614,7 @@ cJSON *OpenAPI_nrf_info_convertToJSON(OpenAPI_nrf_info_t *nrf_info) OpenAPI_list_for_each(nrf_info->served_ausf_info, node) { OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*)node->data; cJSON *itemLocal = localKeyValue->value ? - OpenAPI_ausf_info_convertToJSON(localKeyValue->value) : + OpenAPI_nrf_info_served_ausf_info_value_convertToJSON(localKeyValue->value) : cJSON_CreateNull(); if (itemLocal == NULL) { ogs_error("OpenAPI_nrf_info_convertToJSON() failed [inner]"); @@ -492,7 +636,7 @@ cJSON *OpenAPI_nrf_info_convertToJSON(OpenAPI_nrf_info_t *nrf_info) OpenAPI_list_for_each(nrf_info->served_ausf_info_list, node) { OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*)node->data; cJSON *itemLocal = localKeyValue->value ? - OpenAPI_ausf_info_convertToJSON(localKeyValue->value) : + OpenAPI_nrf_info_served_ausf_info_value_convertToJSON(localKeyValue->value) : cJSON_CreateNull(); if (itemLocal == NULL) { ogs_error("OpenAPI_nrf_info_convertToJSON() failed [inner]"); @@ -514,7 +658,7 @@ cJSON *OpenAPI_nrf_info_convertToJSON(OpenAPI_nrf_info_t *nrf_info) OpenAPI_list_for_each(nrf_info->served_amf_info, node) { OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*)node->data; cJSON *itemLocal = localKeyValue->value ? - OpenAPI_amf_info_convertToJSON(localKeyValue->value) : + OpenAPI_nrf_info_served_amf_info_value_convertToJSON(localKeyValue->value) : cJSON_CreateNull(); if (itemLocal == NULL) { ogs_error("OpenAPI_nrf_info_convertToJSON() failed [inner]"); @@ -536,7 +680,7 @@ cJSON *OpenAPI_nrf_info_convertToJSON(OpenAPI_nrf_info_t *nrf_info) OpenAPI_list_for_each(nrf_info->served_amf_info_list, node) { OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*)node->data; cJSON *itemLocal = localKeyValue->value ? - OpenAPI_amf_info_convertToJSON(localKeyValue->value) : + OpenAPI_nrf_info_served_amf_info_value_convertToJSON(localKeyValue->value) : cJSON_CreateNull(); if (itemLocal == NULL) { ogs_error("OpenAPI_nrf_info_convertToJSON() failed [inner]"); @@ -558,7 +702,7 @@ cJSON *OpenAPI_nrf_info_convertToJSON(OpenAPI_nrf_info_t *nrf_info) OpenAPI_list_for_each(nrf_info->served_smf_info, node) { OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*)node->data; cJSON *itemLocal = localKeyValue->value ? - OpenAPI_smf_info_convertToJSON(localKeyValue->value) : + OpenAPI_nrf_info_served_smf_info_value_convertToJSON(localKeyValue->value) : cJSON_CreateNull(); if (itemLocal == NULL) { ogs_error("OpenAPI_nrf_info_convertToJSON() failed [inner]"); @@ -580,7 +724,7 @@ cJSON *OpenAPI_nrf_info_convertToJSON(OpenAPI_nrf_info_t *nrf_info) OpenAPI_list_for_each(nrf_info->served_smf_info_list, node) { OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*)node->data; cJSON *itemLocal = localKeyValue->value ? - OpenAPI_smf_info_convertToJSON(localKeyValue->value) : + OpenAPI_nrf_info_served_smf_info_value_convertToJSON(localKeyValue->value) : cJSON_CreateNull(); if (itemLocal == NULL) { ogs_error("OpenAPI_nrf_info_convertToJSON() failed [inner]"); @@ -602,7 +746,7 @@ cJSON *OpenAPI_nrf_info_convertToJSON(OpenAPI_nrf_info_t *nrf_info) OpenAPI_list_for_each(nrf_info->served_upf_info, node) { OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*)node->data; cJSON *itemLocal = localKeyValue->value ? - OpenAPI_upf_info_convertToJSON(localKeyValue->value) : + OpenAPI_nrf_info_served_upf_info_value_convertToJSON(localKeyValue->value) : cJSON_CreateNull(); if (itemLocal == NULL) { ogs_error("OpenAPI_nrf_info_convertToJSON() failed [inner]"); @@ -624,7 +768,7 @@ cJSON *OpenAPI_nrf_info_convertToJSON(OpenAPI_nrf_info_t *nrf_info) OpenAPI_list_for_each(nrf_info->served_upf_info_list, node) { OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*)node->data; cJSON *itemLocal = localKeyValue->value ? - OpenAPI_upf_info_convertToJSON(localKeyValue->value) : + OpenAPI_nrf_info_served_upf_info_value_convertToJSON(localKeyValue->value) : cJSON_CreateNull(); if (itemLocal == NULL) { ogs_error("OpenAPI_nrf_info_convertToJSON() failed [inner]"); @@ -646,7 +790,7 @@ cJSON *OpenAPI_nrf_info_convertToJSON(OpenAPI_nrf_info_t *nrf_info) OpenAPI_list_for_each(nrf_info->served_pcf_info, node) { OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*)node->data; cJSON *itemLocal = localKeyValue->value ? - OpenAPI_pcf_info_convertToJSON(localKeyValue->value) : + OpenAPI_nrf_info_served_pcf_info_value_convertToJSON(localKeyValue->value) : cJSON_CreateNull(); if (itemLocal == NULL) { ogs_error("OpenAPI_nrf_info_convertToJSON() failed [inner]"); @@ -668,7 +812,7 @@ cJSON *OpenAPI_nrf_info_convertToJSON(OpenAPI_nrf_info_t *nrf_info) OpenAPI_list_for_each(nrf_info->served_pcf_info_list, node) { OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*)node->data; cJSON *itemLocal = localKeyValue->value ? - OpenAPI_pcf_info_convertToJSON(localKeyValue->value) : + OpenAPI_nrf_info_served_pcf_info_value_convertToJSON(localKeyValue->value) : cJSON_CreateNull(); if (itemLocal == NULL) { ogs_error("OpenAPI_nrf_info_convertToJSON() failed [inner]"); @@ -690,7 +834,7 @@ cJSON *OpenAPI_nrf_info_convertToJSON(OpenAPI_nrf_info_t *nrf_info) OpenAPI_list_for_each(nrf_info->served_bsf_info, node) { OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*)node->data; cJSON *itemLocal = localKeyValue->value ? - OpenAPI_bsf_info_convertToJSON(localKeyValue->value) : + OpenAPI_nrf_info_served_bsf_info_value_convertToJSON(localKeyValue->value) : cJSON_CreateNull(); if (itemLocal == NULL) { ogs_error("OpenAPI_nrf_info_convertToJSON() failed [inner]"); @@ -712,7 +856,7 @@ cJSON *OpenAPI_nrf_info_convertToJSON(OpenAPI_nrf_info_t *nrf_info) OpenAPI_list_for_each(nrf_info->served_bsf_info_list, node) { OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*)node->data; cJSON *itemLocal = localKeyValue->value ? - OpenAPI_bsf_info_convertToJSON(localKeyValue->value) : + OpenAPI_nrf_info_served_bsf_info_value_convertToJSON(localKeyValue->value) : cJSON_CreateNull(); if (itemLocal == NULL) { ogs_error("OpenAPI_nrf_info_convertToJSON() failed [inner]"); @@ -734,7 +878,7 @@ cJSON *OpenAPI_nrf_info_convertToJSON(OpenAPI_nrf_info_t *nrf_info) OpenAPI_list_for_each(nrf_info->served_chf_info, node) { OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*)node->data; cJSON *itemLocal = localKeyValue->value ? - OpenAPI_chf_info_convertToJSON(localKeyValue->value) : + OpenAPI_nrf_info_served_chf_info_value_convertToJSON(localKeyValue->value) : cJSON_CreateNull(); if (itemLocal == NULL) { ogs_error("OpenAPI_nrf_info_convertToJSON() failed [inner]"); @@ -756,7 +900,7 @@ cJSON *OpenAPI_nrf_info_convertToJSON(OpenAPI_nrf_info_t *nrf_info) OpenAPI_list_for_each(nrf_info->served_chf_info_list, node) { OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*)node->data; cJSON *itemLocal = localKeyValue->value ? - OpenAPI_chf_info_convertToJSON(localKeyValue->value) : + OpenAPI_nrf_info_served_chf_info_value_convertToJSON(localKeyValue->value) : cJSON_CreateNull(); if (itemLocal == NULL) { ogs_error("OpenAPI_nrf_info_convertToJSON() failed [inner]"); @@ -778,7 +922,7 @@ cJSON *OpenAPI_nrf_info_convertToJSON(OpenAPI_nrf_info_t *nrf_info) OpenAPI_list_for_each(nrf_info->served_nef_info, node) { OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*)node->data; cJSON *itemLocal = localKeyValue->value ? - OpenAPI_nef_info_convertToJSON(localKeyValue->value) : + OpenAPI_nrf_info_served_nef_info_value_convertToJSON(localKeyValue->value) : cJSON_CreateNull(); if (itemLocal == NULL) { ogs_error("OpenAPI_nrf_info_convertToJSON() failed [inner]"); @@ -798,6 +942,28 @@ cJSON *OpenAPI_nrf_info_convertToJSON(OpenAPI_nrf_info_t *nrf_info) cJSON *localMapObject = served_nwdaf_info; if (nrf_info->served_nwdaf_info) { OpenAPI_list_for_each(nrf_info->served_nwdaf_info, node) { + OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*)node->data; + cJSON *itemLocal = localKeyValue->value ? + OpenAPI_nrf_info_served_nwdaf_info_value_convertToJSON(localKeyValue->value) : + cJSON_CreateNull(); + if (itemLocal == NULL) { + ogs_error("OpenAPI_nrf_info_convertToJSON() failed [inner]"); + goto end; + } + cJSON_AddItemToObject(localMapObject, localKeyValue->key, itemLocal); + } + } + } + + if (nrf_info->served_nwdaf_info_list) { + cJSON *served_nwdaf_info_list = cJSON_AddObjectToObject(item, "servedNwdafInfoList"); + if (served_nwdaf_info_list == NULL) { + ogs_error("OpenAPI_nrf_info_convertToJSON() failed [served_nwdaf_info_list]"); + goto end; + } + cJSON *localMapObject = served_nwdaf_info_list; + if (nrf_info->served_nwdaf_info_list) { + OpenAPI_list_for_each(nrf_info->served_nwdaf_info_list, node) { OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*)node->data; cJSON *itemLocal = localKeyValue->value ? OpenAPI_nwdaf_info_convertToJSON(localKeyValue->value) : @@ -822,7 +988,7 @@ cJSON *OpenAPI_nrf_info_convertToJSON(OpenAPI_nrf_info_t *nrf_info) OpenAPI_list_for_each(nrf_info->served_pcscf_info_list, node) { OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*)node->data; cJSON *itemLocal = localKeyValue->value ? - OpenAPI_pcscf_info_convertToJSON(localKeyValue->value) : + OpenAPI_nrf_info_served_pcscf_info_list_value_value_convertToJSON(localKeyValue->value) : cJSON_CreateNull(); if (itemLocal == NULL) { ogs_error("OpenAPI_nrf_info_convertToJSON() failed [inner]"); @@ -844,7 +1010,7 @@ cJSON *OpenAPI_nrf_info_convertToJSON(OpenAPI_nrf_info_t *nrf_info) OpenAPI_list_for_each(nrf_info->served_gmlc_info, node) { OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*)node->data; cJSON *itemLocal = localKeyValue->value ? - OpenAPI_gmlc_info_convertToJSON(localKeyValue->value) : + OpenAPI_nrf_info_served_gmlc_info_value_convertToJSON(localKeyValue->value) : cJSON_CreateNull(); if (itemLocal == NULL) { ogs_error("OpenAPI_nrf_info_convertToJSON() failed [inner]"); @@ -866,7 +1032,7 @@ cJSON *OpenAPI_nrf_info_convertToJSON(OpenAPI_nrf_info_t *nrf_info) OpenAPI_list_for_each(nrf_info->served_lmf_info, node) { OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*)node->data; cJSON *itemLocal = localKeyValue->value ? - OpenAPI_lmf_info_convertToJSON(localKeyValue->value) : + OpenAPI_nrf_info_served_lmf_info_value_convertToJSON(localKeyValue->value) : cJSON_CreateNull(); if (itemLocal == NULL) { ogs_error("OpenAPI_nrf_info_convertToJSON() failed [inner]"); @@ -910,7 +1076,7 @@ cJSON *OpenAPI_nrf_info_convertToJSON(OpenAPI_nrf_info_t *nrf_info) OpenAPI_list_for_each(nrf_info->served_hss_info_list, node) { OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*)node->data; cJSON *itemLocal = localKeyValue->value ? - OpenAPI_hss_info_convertToJSON(localKeyValue->value) : + OpenAPI_nrf_info_served_hss_info_list_value_value_convertToJSON(localKeyValue->value) : cJSON_CreateNull(); if (itemLocal == NULL) { ogs_error("OpenAPI_nrf_info_convertToJSON() failed [inner]"); @@ -932,7 +1098,7 @@ cJSON *OpenAPI_nrf_info_convertToJSON(OpenAPI_nrf_info_t *nrf_info) OpenAPI_list_for_each(nrf_info->served_udsf_info, node) { OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*)node->data; cJSON *itemLocal = localKeyValue->value ? - OpenAPI_udsf_info_convertToJSON(localKeyValue->value) : + OpenAPI_nrf_info_served_udsf_info_value_convertToJSON(localKeyValue->value) : cJSON_CreateNull(); if (itemLocal == NULL) { ogs_error("OpenAPI_nrf_info_convertToJSON() failed [inner]"); @@ -954,7 +1120,7 @@ cJSON *OpenAPI_nrf_info_convertToJSON(OpenAPI_nrf_info_t *nrf_info) OpenAPI_list_for_each(nrf_info->served_udsf_info_list, node) { OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*)node->data; cJSON *itemLocal = localKeyValue->value ? - OpenAPI_udsf_info_convertToJSON(localKeyValue->value) : + OpenAPI_nrf_info_served_udsf_info_value_convertToJSON(localKeyValue->value) : cJSON_CreateNull(); if (itemLocal == NULL) { ogs_error("OpenAPI_nrf_info_convertToJSON() failed [inner]"); @@ -976,7 +1142,249 @@ cJSON *OpenAPI_nrf_info_convertToJSON(OpenAPI_nrf_info_t *nrf_info) OpenAPI_list_for_each(nrf_info->served_scp_info_list, node) { OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*)node->data; cJSON *itemLocal = localKeyValue->value ? - OpenAPI_scp_info_convertToJSON(localKeyValue->value) : + OpenAPI_nrf_info_served_scp_info_list_value_convertToJSON(localKeyValue->value) : + cJSON_CreateNull(); + if (itemLocal == NULL) { + ogs_error("OpenAPI_nrf_info_convertToJSON() failed [inner]"); + goto end; + } + cJSON_AddItemToObject(localMapObject, localKeyValue->key, itemLocal); + } + } + } + + if (nrf_info->served_sepp_info_list) { + cJSON *served_sepp_info_list = cJSON_AddObjectToObject(item, "servedSeppInfoList"); + if (served_sepp_info_list == NULL) { + ogs_error("OpenAPI_nrf_info_convertToJSON() failed [served_sepp_info_list]"); + goto end; + } + cJSON *localMapObject = served_sepp_info_list; + if (nrf_info->served_sepp_info_list) { + OpenAPI_list_for_each(nrf_info->served_sepp_info_list, node) { + OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*)node->data; + cJSON *itemLocal = localKeyValue->value ? + OpenAPI_nrf_info_served_sepp_info_list_value_convertToJSON(localKeyValue->value) : + cJSON_CreateNull(); + if (itemLocal == NULL) { + ogs_error("OpenAPI_nrf_info_convertToJSON() failed [inner]"); + goto end; + } + cJSON_AddItemToObject(localMapObject, localKeyValue->key, itemLocal); + } + } + } + + if (nrf_info->served_aanf_info_list) { + cJSON *served_aanf_info_list = cJSON_AddObjectToObject(item, "servedAanfInfoList"); + if (served_aanf_info_list == NULL) { + ogs_error("OpenAPI_nrf_info_convertToJSON() failed [served_aanf_info_list]"); + goto end; + } + cJSON *localMapObject = served_aanf_info_list; + if (nrf_info->served_aanf_info_list) { + OpenAPI_list_for_each(nrf_info->served_aanf_info_list, node) { + OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*)node->data; + cJSON *itemLocal = localKeyValue->value ? + OpenAPI_nrf_info_served_aanf_info_list_value_value_convertToJSON(localKeyValue->value) : + cJSON_CreateNull(); + if (itemLocal == NULL) { + ogs_error("OpenAPI_nrf_info_convertToJSON() failed [inner]"); + goto end; + } + cJSON_AddItemToObject(localMapObject, localKeyValue->key, itemLocal); + } + } + } + + if (nrf_info->served5g_ddnmf_info) { + cJSON *served5g_ddnmf_info = cJSON_AddObjectToObject(item, "served5gDdnmfInfo"); + if (served5g_ddnmf_info == NULL) { + ogs_error("OpenAPI_nrf_info_convertToJSON() failed [served5g_ddnmf_info]"); + goto end; + } + cJSON *localMapObject = served5g_ddnmf_info; + if (nrf_info->served5g_ddnmf_info) { + OpenAPI_list_for_each(nrf_info->served5g_ddnmf_info, node) { + OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*)node->data; + cJSON *itemLocal = localKeyValue->value ? + OpenAPI_model_5_g_ddnmf_info_convertToJSON(localKeyValue->value) : + cJSON_CreateNull(); + if (itemLocal == NULL) { + ogs_error("OpenAPI_nrf_info_convertToJSON() failed [inner]"); + goto end; + } + cJSON_AddItemToObject(localMapObject, localKeyValue->key, itemLocal); + } + } + } + + if (nrf_info->served_mfaf_info_list) { + cJSON *served_mfaf_info_list = cJSON_AddObjectToObject(item, "servedMfafInfoList"); + if (served_mfaf_info_list == NULL) { + ogs_error("OpenAPI_nrf_info_convertToJSON() failed [served_mfaf_info_list]"); + goto end; + } + cJSON *localMapObject = served_mfaf_info_list; + if (nrf_info->served_mfaf_info_list) { + OpenAPI_list_for_each(nrf_info->served_mfaf_info_list, node) { + OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*)node->data; + cJSON *itemLocal = localKeyValue->value ? + OpenAPI_mfaf_info_convertToJSON(localKeyValue->value) : + cJSON_CreateNull(); + if (itemLocal == NULL) { + ogs_error("OpenAPI_nrf_info_convertToJSON() failed [inner]"); + goto end; + } + cJSON_AddItemToObject(localMapObject, localKeyValue->key, itemLocal); + } + } + } + + if (nrf_info->served_easdf_info_list) { + cJSON *served_easdf_info_list = cJSON_AddObjectToObject(item, "servedEasdfInfoList"); + if (served_easdf_info_list == NULL) { + ogs_error("OpenAPI_nrf_info_convertToJSON() failed [served_easdf_info_list]"); + goto end; + } + cJSON *localMapObject = served_easdf_info_list; + if (nrf_info->served_easdf_info_list) { + OpenAPI_list_for_each(nrf_info->served_easdf_info_list, node) { + OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*)node->data; + cJSON *itemLocal = localKeyValue->value ? + OpenAPI_easdf_info_convertToJSON(localKeyValue->value) : + cJSON_CreateNull(); + if (itemLocal == NULL) { + ogs_error("OpenAPI_nrf_info_convertToJSON() failed [inner]"); + goto end; + } + cJSON_AddItemToObject(localMapObject, localKeyValue->key, itemLocal); + } + } + } + + if (nrf_info->served_dccf_info_list) { + cJSON *served_dccf_info_list = cJSON_AddObjectToObject(item, "servedDccfInfoList"); + if (served_dccf_info_list == NULL) { + ogs_error("OpenAPI_nrf_info_convertToJSON() failed [served_dccf_info_list]"); + goto end; + } + cJSON *localMapObject = served_dccf_info_list; + if (nrf_info->served_dccf_info_list) { + OpenAPI_list_for_each(nrf_info->served_dccf_info_list, node) { + OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*)node->data; + cJSON *itemLocal = localKeyValue->value ? + OpenAPI_dccf_info_convertToJSON(localKeyValue->value) : + cJSON_CreateNull(); + if (itemLocal == NULL) { + ogs_error("OpenAPI_nrf_info_convertToJSON() failed [inner]"); + goto end; + } + cJSON_AddItemToObject(localMapObject, localKeyValue->key, itemLocal); + } + } + } + + if (nrf_info->served_mb_smf_info_list) { + cJSON *served_mb_smf_info_list = cJSON_AddObjectToObject(item, "servedMbSmfInfoList"); + if (served_mb_smf_info_list == NULL) { + ogs_error("OpenAPI_nrf_info_convertToJSON() failed [served_mb_smf_info_list]"); + goto end; + } + cJSON *localMapObject = served_mb_smf_info_list; + if (nrf_info->served_mb_smf_info_list) { + OpenAPI_list_for_each(nrf_info->served_mb_smf_info_list, node) { + OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*)node->data; + cJSON *itemLocal = localKeyValue->value ? + OpenAPI_nrf_info_served_mb_smf_info_list_value_value_convertToJSON(localKeyValue->value) : + cJSON_CreateNull(); + if (itemLocal == NULL) { + ogs_error("OpenAPI_nrf_info_convertToJSON() failed [inner]"); + goto end; + } + cJSON_AddItemToObject(localMapObject, localKeyValue->key, itemLocal); + } + } + } + + if (nrf_info->served_tsctsf_info_list) { + cJSON *served_tsctsf_info_list = cJSON_AddObjectToObject(item, "servedTsctsfInfoList"); + if (served_tsctsf_info_list == NULL) { + ogs_error("OpenAPI_nrf_info_convertToJSON() failed [served_tsctsf_info_list]"); + goto end; + } + cJSON *localMapObject = served_tsctsf_info_list; + if (nrf_info->served_tsctsf_info_list) { + OpenAPI_list_for_each(nrf_info->served_tsctsf_info_list, node) { + OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*)node->data; + cJSON *itemLocal = localKeyValue->value ? + OpenAPI_tsctsf_info_convertToJSON(localKeyValue->value) : + cJSON_CreateNull(); + if (itemLocal == NULL) { + ogs_error("OpenAPI_nrf_info_convertToJSON() failed [inner]"); + goto end; + } + cJSON_AddItemToObject(localMapObject, localKeyValue->key, itemLocal); + } + } + } + + if (nrf_info->served_mb_upf_info_list) { + cJSON *served_mb_upf_info_list = cJSON_AddObjectToObject(item, "servedMbUpfInfoList"); + if (served_mb_upf_info_list == NULL) { + ogs_error("OpenAPI_nrf_info_convertToJSON() failed [served_mb_upf_info_list]"); + goto end; + } + cJSON *localMapObject = served_mb_upf_info_list; + if (nrf_info->served_mb_upf_info_list) { + OpenAPI_list_for_each(nrf_info->served_mb_upf_info_list, node) { + OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*)node->data; + cJSON *itemLocal = localKeyValue->value ? + OpenAPI_mb_upf_info_convertToJSON(localKeyValue->value) : + cJSON_CreateNull(); + if (itemLocal == NULL) { + ogs_error("OpenAPI_nrf_info_convertToJSON() failed [inner]"); + goto end; + } + cJSON_AddItemToObject(localMapObject, localKeyValue->key, itemLocal); + } + } + } + + if (nrf_info->served_trust_af_info) { + cJSON *served_trust_af_info = cJSON_AddObjectToObject(item, "servedTrustAfInfo"); + if (served_trust_af_info == NULL) { + ogs_error("OpenAPI_nrf_info_convertToJSON() failed [served_trust_af_info]"); + goto end; + } + cJSON *localMapObject = served_trust_af_info; + if (nrf_info->served_trust_af_info) { + OpenAPI_list_for_each(nrf_info->served_trust_af_info, node) { + OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*)node->data; + cJSON *itemLocal = localKeyValue->value ? + OpenAPI_trust_af_info_convertToJSON(localKeyValue->value) : + cJSON_CreateNull(); + if (itemLocal == NULL) { + ogs_error("OpenAPI_nrf_info_convertToJSON() failed [inner]"); + goto end; + } + cJSON_AddItemToObject(localMapObject, localKeyValue->key, itemLocal); + } + } + } + + if (nrf_info->served_nssaaf_info) { + cJSON *served_nssaaf_info = cJSON_AddObjectToObject(item, "servedNssaafInfo"); + if (served_nssaaf_info == NULL) { + ogs_error("OpenAPI_nrf_info_convertToJSON() failed [served_nssaaf_info]"); + goto end; + } + cJSON *localMapObject = served_nssaaf_info; + if (nrf_info->served_nssaaf_info) { + OpenAPI_list_for_each(nrf_info->served_nssaaf_info, node) { + OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*)node->data; + cJSON *itemLocal = localKeyValue->value ? + OpenAPI_nssaaf_info_convertToJSON(localKeyValue->value) : cJSON_CreateNull(); if (itemLocal == NULL) { ogs_error("OpenAPI_nrf_info_convertToJSON() failed [inner]"); @@ -1035,6 +1443,8 @@ OpenAPI_nrf_info_t *OpenAPI_nrf_info_parseFromJSON(cJSON *nrf_infoJSON) OpenAPI_list_t *served_nef_infoList = NULL; cJSON *served_nwdaf_info = NULL; OpenAPI_list_t *served_nwdaf_infoList = NULL; + cJSON *served_nwdaf_info_list = NULL; + OpenAPI_list_t *served_nwdaf_info_listList = NULL; cJSON *served_pcscf_info_list = NULL; OpenAPI_list_t *served_pcscf_info_listList = NULL; cJSON *served_gmlc_info = NULL; @@ -1051,6 +1461,28 @@ OpenAPI_nrf_info_t *OpenAPI_nrf_info_parseFromJSON(cJSON *nrf_infoJSON) OpenAPI_list_t *served_udsf_info_listList = NULL; cJSON *served_scp_info_list = NULL; OpenAPI_list_t *served_scp_info_listList = NULL; + cJSON *served_sepp_info_list = NULL; + OpenAPI_list_t *served_sepp_info_listList = NULL; + cJSON *served_aanf_info_list = NULL; + OpenAPI_list_t *served_aanf_info_listList = NULL; + cJSON *served5g_ddnmf_info = NULL; + OpenAPI_list_t *served5g_ddnmf_infoList = NULL; + cJSON *served_mfaf_info_list = NULL; + OpenAPI_list_t *served_mfaf_info_listList = NULL; + cJSON *served_easdf_info_list = NULL; + OpenAPI_list_t *served_easdf_info_listList = NULL; + cJSON *served_dccf_info_list = NULL; + OpenAPI_list_t *served_dccf_info_listList = NULL; + cJSON *served_mb_smf_info_list = NULL; + OpenAPI_list_t *served_mb_smf_info_listList = NULL; + cJSON *served_tsctsf_info_list = NULL; + OpenAPI_list_t *served_tsctsf_info_listList = NULL; + cJSON *served_mb_upf_info_list = NULL; + OpenAPI_list_t *served_mb_upf_info_listList = NULL; + cJSON *served_trust_af_info = NULL; + OpenAPI_list_t *served_trust_af_infoList = NULL; + cJSON *served_nssaaf_info = NULL; + OpenAPI_list_t *served_nssaaf_infoList = NULL; served_udr_info = cJSON_GetObjectItemCaseSensitive(nrf_infoJSON, "servedUdrInfo"); if (served_udr_info) { cJSON *served_udr_info_local_map = NULL; @@ -1065,7 +1497,7 @@ OpenAPI_nrf_info_t *OpenAPI_nrf_info_parseFromJSON(cJSON *nrf_infoJSON) cJSON *localMapObject = served_udr_info_local_map; if (cJSON_IsObject(localMapObject)) { localMapKeyPair = OpenAPI_map_create( - ogs_strdup(localMapObject->string), OpenAPI_udr_info_parseFromJSON(localMapObject)); + ogs_strdup(localMapObject->string), OpenAPI_nrf_info_served_udr_info_value_parseFromJSON(localMapObject)); } else if (cJSON_IsNull(localMapObject)) { localMapKeyPair = OpenAPI_map_create(ogs_strdup(localMapObject->string), NULL); } else { @@ -1093,7 +1525,7 @@ OpenAPI_nrf_info_t *OpenAPI_nrf_info_parseFromJSON(cJSON *nrf_infoJSON) int *localInt = NULL; if (cJSON_IsObject(localMapObject)) { localMapKeyPair = OpenAPI_map_create( - ogs_strdup(localMapObject->string), OpenAPI_udr_info_parseFromJSON(localMapObject)); + ogs_strdup(localMapObject->string), OpenAPI_nrf_info_served_udr_info_value_parseFromJSON(localMapObject)); } else if (cJSON_IsNull(localMapObject)) { localMapKeyPair = OpenAPI_map_create(ogs_strdup(localMapObject->string), NULL); } else { @@ -1119,7 +1551,7 @@ OpenAPI_nrf_info_t *OpenAPI_nrf_info_parseFromJSON(cJSON *nrf_infoJSON) cJSON *localMapObject = served_udm_info_local_map; if (cJSON_IsObject(localMapObject)) { localMapKeyPair = OpenAPI_map_create( - ogs_strdup(localMapObject->string), OpenAPI_udm_info_parseFromJSON(localMapObject)); + ogs_strdup(localMapObject->string), OpenAPI_nrf_info_served_udm_info_value_parseFromJSON(localMapObject)); } else if (cJSON_IsNull(localMapObject)) { localMapKeyPair = OpenAPI_map_create(ogs_strdup(localMapObject->string), NULL); } else { @@ -1147,7 +1579,7 @@ OpenAPI_nrf_info_t *OpenAPI_nrf_info_parseFromJSON(cJSON *nrf_infoJSON) int *localInt = NULL; if (cJSON_IsObject(localMapObject)) { localMapKeyPair = OpenAPI_map_create( - ogs_strdup(localMapObject->string), OpenAPI_udm_info_parseFromJSON(localMapObject)); + ogs_strdup(localMapObject->string), OpenAPI_nrf_info_served_udm_info_value_parseFromJSON(localMapObject)); } else if (cJSON_IsNull(localMapObject)) { localMapKeyPair = OpenAPI_map_create(ogs_strdup(localMapObject->string), NULL); } else { @@ -1173,7 +1605,7 @@ OpenAPI_nrf_info_t *OpenAPI_nrf_info_parseFromJSON(cJSON *nrf_infoJSON) cJSON *localMapObject = served_ausf_info_local_map; if (cJSON_IsObject(localMapObject)) { localMapKeyPair = OpenAPI_map_create( - ogs_strdup(localMapObject->string), OpenAPI_ausf_info_parseFromJSON(localMapObject)); + ogs_strdup(localMapObject->string), OpenAPI_nrf_info_served_ausf_info_value_parseFromJSON(localMapObject)); } else if (cJSON_IsNull(localMapObject)) { localMapKeyPair = OpenAPI_map_create(ogs_strdup(localMapObject->string), NULL); } else { @@ -1201,7 +1633,7 @@ OpenAPI_nrf_info_t *OpenAPI_nrf_info_parseFromJSON(cJSON *nrf_infoJSON) int *localInt = NULL; if (cJSON_IsObject(localMapObject)) { localMapKeyPair = OpenAPI_map_create( - ogs_strdup(localMapObject->string), OpenAPI_ausf_info_parseFromJSON(localMapObject)); + ogs_strdup(localMapObject->string), OpenAPI_nrf_info_served_ausf_info_value_parseFromJSON(localMapObject)); } else if (cJSON_IsNull(localMapObject)) { localMapKeyPair = OpenAPI_map_create(ogs_strdup(localMapObject->string), NULL); } else { @@ -1227,7 +1659,7 @@ OpenAPI_nrf_info_t *OpenAPI_nrf_info_parseFromJSON(cJSON *nrf_infoJSON) cJSON *localMapObject = served_amf_info_local_map; if (cJSON_IsObject(localMapObject)) { localMapKeyPair = OpenAPI_map_create( - ogs_strdup(localMapObject->string), OpenAPI_amf_info_parseFromJSON(localMapObject)); + ogs_strdup(localMapObject->string), OpenAPI_nrf_info_served_amf_info_value_parseFromJSON(localMapObject)); } else if (cJSON_IsNull(localMapObject)) { localMapKeyPair = OpenAPI_map_create(ogs_strdup(localMapObject->string), NULL); } else { @@ -1255,7 +1687,7 @@ OpenAPI_nrf_info_t *OpenAPI_nrf_info_parseFromJSON(cJSON *nrf_infoJSON) int *localInt = NULL; if (cJSON_IsObject(localMapObject)) { localMapKeyPair = OpenAPI_map_create( - ogs_strdup(localMapObject->string), OpenAPI_amf_info_parseFromJSON(localMapObject)); + ogs_strdup(localMapObject->string), OpenAPI_nrf_info_served_amf_info_value_parseFromJSON(localMapObject)); } else if (cJSON_IsNull(localMapObject)) { localMapKeyPair = OpenAPI_map_create(ogs_strdup(localMapObject->string), NULL); } else { @@ -1281,7 +1713,7 @@ OpenAPI_nrf_info_t *OpenAPI_nrf_info_parseFromJSON(cJSON *nrf_infoJSON) cJSON *localMapObject = served_smf_info_local_map; if (cJSON_IsObject(localMapObject)) { localMapKeyPair = OpenAPI_map_create( - ogs_strdup(localMapObject->string), OpenAPI_smf_info_parseFromJSON(localMapObject)); + ogs_strdup(localMapObject->string), OpenAPI_nrf_info_served_smf_info_value_parseFromJSON(localMapObject)); } else if (cJSON_IsNull(localMapObject)) { localMapKeyPair = OpenAPI_map_create(ogs_strdup(localMapObject->string), NULL); } else { @@ -1309,7 +1741,7 @@ OpenAPI_nrf_info_t *OpenAPI_nrf_info_parseFromJSON(cJSON *nrf_infoJSON) int *localInt = NULL; if (cJSON_IsObject(localMapObject)) { localMapKeyPair = OpenAPI_map_create( - ogs_strdup(localMapObject->string), OpenAPI_smf_info_parseFromJSON(localMapObject)); + ogs_strdup(localMapObject->string), OpenAPI_nrf_info_served_smf_info_value_parseFromJSON(localMapObject)); } else if (cJSON_IsNull(localMapObject)) { localMapKeyPair = OpenAPI_map_create(ogs_strdup(localMapObject->string), NULL); } else { @@ -1335,7 +1767,7 @@ OpenAPI_nrf_info_t *OpenAPI_nrf_info_parseFromJSON(cJSON *nrf_infoJSON) cJSON *localMapObject = served_upf_info_local_map; if (cJSON_IsObject(localMapObject)) { localMapKeyPair = OpenAPI_map_create( - ogs_strdup(localMapObject->string), OpenAPI_upf_info_parseFromJSON(localMapObject)); + ogs_strdup(localMapObject->string), OpenAPI_nrf_info_served_upf_info_value_parseFromJSON(localMapObject)); } else if (cJSON_IsNull(localMapObject)) { localMapKeyPair = OpenAPI_map_create(ogs_strdup(localMapObject->string), NULL); } else { @@ -1363,7 +1795,7 @@ OpenAPI_nrf_info_t *OpenAPI_nrf_info_parseFromJSON(cJSON *nrf_infoJSON) int *localInt = NULL; if (cJSON_IsObject(localMapObject)) { localMapKeyPair = OpenAPI_map_create( - ogs_strdup(localMapObject->string), OpenAPI_upf_info_parseFromJSON(localMapObject)); + ogs_strdup(localMapObject->string), OpenAPI_nrf_info_served_upf_info_value_parseFromJSON(localMapObject)); } else if (cJSON_IsNull(localMapObject)) { localMapKeyPair = OpenAPI_map_create(ogs_strdup(localMapObject->string), NULL); } else { @@ -1389,7 +1821,7 @@ OpenAPI_nrf_info_t *OpenAPI_nrf_info_parseFromJSON(cJSON *nrf_infoJSON) cJSON *localMapObject = served_pcf_info_local_map; if (cJSON_IsObject(localMapObject)) { localMapKeyPair = OpenAPI_map_create( - ogs_strdup(localMapObject->string), OpenAPI_pcf_info_parseFromJSON(localMapObject)); + ogs_strdup(localMapObject->string), OpenAPI_nrf_info_served_pcf_info_value_parseFromJSON(localMapObject)); } else if (cJSON_IsNull(localMapObject)) { localMapKeyPair = OpenAPI_map_create(ogs_strdup(localMapObject->string), NULL); } else { @@ -1417,7 +1849,7 @@ OpenAPI_nrf_info_t *OpenAPI_nrf_info_parseFromJSON(cJSON *nrf_infoJSON) int *localInt = NULL; if (cJSON_IsObject(localMapObject)) { localMapKeyPair = OpenAPI_map_create( - ogs_strdup(localMapObject->string), OpenAPI_pcf_info_parseFromJSON(localMapObject)); + ogs_strdup(localMapObject->string), OpenAPI_nrf_info_served_pcf_info_value_parseFromJSON(localMapObject)); } else if (cJSON_IsNull(localMapObject)) { localMapKeyPair = OpenAPI_map_create(ogs_strdup(localMapObject->string), NULL); } else { @@ -1443,7 +1875,7 @@ OpenAPI_nrf_info_t *OpenAPI_nrf_info_parseFromJSON(cJSON *nrf_infoJSON) cJSON *localMapObject = served_bsf_info_local_map; if (cJSON_IsObject(localMapObject)) { localMapKeyPair = OpenAPI_map_create( - ogs_strdup(localMapObject->string), OpenAPI_bsf_info_parseFromJSON(localMapObject)); + ogs_strdup(localMapObject->string), OpenAPI_nrf_info_served_bsf_info_value_parseFromJSON(localMapObject)); } else if (cJSON_IsNull(localMapObject)) { localMapKeyPair = OpenAPI_map_create(ogs_strdup(localMapObject->string), NULL); } else { @@ -1471,7 +1903,7 @@ OpenAPI_nrf_info_t *OpenAPI_nrf_info_parseFromJSON(cJSON *nrf_infoJSON) int *localInt = NULL; if (cJSON_IsObject(localMapObject)) { localMapKeyPair = OpenAPI_map_create( - ogs_strdup(localMapObject->string), OpenAPI_bsf_info_parseFromJSON(localMapObject)); + ogs_strdup(localMapObject->string), OpenAPI_nrf_info_served_bsf_info_value_parseFromJSON(localMapObject)); } else if (cJSON_IsNull(localMapObject)) { localMapKeyPair = OpenAPI_map_create(ogs_strdup(localMapObject->string), NULL); } else { @@ -1497,7 +1929,7 @@ OpenAPI_nrf_info_t *OpenAPI_nrf_info_parseFromJSON(cJSON *nrf_infoJSON) cJSON *localMapObject = served_chf_info_local_map; if (cJSON_IsObject(localMapObject)) { localMapKeyPair = OpenAPI_map_create( - ogs_strdup(localMapObject->string), OpenAPI_chf_info_parseFromJSON(localMapObject)); + ogs_strdup(localMapObject->string), OpenAPI_nrf_info_served_chf_info_value_parseFromJSON(localMapObject)); } else if (cJSON_IsNull(localMapObject)) { localMapKeyPair = OpenAPI_map_create(ogs_strdup(localMapObject->string), NULL); } else { @@ -1525,7 +1957,7 @@ OpenAPI_nrf_info_t *OpenAPI_nrf_info_parseFromJSON(cJSON *nrf_infoJSON) int *localInt = NULL; if (cJSON_IsObject(localMapObject)) { localMapKeyPair = OpenAPI_map_create( - ogs_strdup(localMapObject->string), OpenAPI_chf_info_parseFromJSON(localMapObject)); + ogs_strdup(localMapObject->string), OpenAPI_nrf_info_served_chf_info_value_parseFromJSON(localMapObject)); } else if (cJSON_IsNull(localMapObject)) { localMapKeyPair = OpenAPI_map_create(ogs_strdup(localMapObject->string), NULL); } else { @@ -1551,7 +1983,7 @@ OpenAPI_nrf_info_t *OpenAPI_nrf_info_parseFromJSON(cJSON *nrf_infoJSON) cJSON *localMapObject = served_nef_info_local_map; if (cJSON_IsObject(localMapObject)) { localMapKeyPair = OpenAPI_map_create( - ogs_strdup(localMapObject->string), OpenAPI_nef_info_parseFromJSON(localMapObject)); + ogs_strdup(localMapObject->string), OpenAPI_nrf_info_served_nef_info_value_parseFromJSON(localMapObject)); } else if (cJSON_IsNull(localMapObject)) { localMapKeyPair = OpenAPI_map_create(ogs_strdup(localMapObject->string), NULL); } else { @@ -1577,7 +2009,7 @@ OpenAPI_nrf_info_t *OpenAPI_nrf_info_parseFromJSON(cJSON *nrf_infoJSON) cJSON *localMapObject = served_nwdaf_info_local_map; if (cJSON_IsObject(localMapObject)) { localMapKeyPair = OpenAPI_map_create( - ogs_strdup(localMapObject->string), OpenAPI_nwdaf_info_parseFromJSON(localMapObject)); + ogs_strdup(localMapObject->string), OpenAPI_nrf_info_served_nwdaf_info_value_parseFromJSON(localMapObject)); } else if (cJSON_IsNull(localMapObject)) { localMapKeyPair = OpenAPI_map_create(ogs_strdup(localMapObject->string), NULL); } else { @@ -1589,6 +2021,34 @@ OpenAPI_nrf_info_t *OpenAPI_nrf_info_parseFromJSON(cJSON *nrf_infoJSON) } } + served_nwdaf_info_list = cJSON_GetObjectItemCaseSensitive(nrf_infoJSON, "servedNwdafInfoList"); + if (served_nwdaf_info_list) { + cJSON *served_nwdaf_info_list_local_map = NULL; + if (!cJSON_IsObject(served_nwdaf_info_list) && !cJSON_IsNull(served_nwdaf_info_list)) { + ogs_error("OpenAPI_nrf_info_parseFromJSON() failed [served_nwdaf_info_list]"); + goto end; + } + if (cJSON_IsObject(served_nwdaf_info_list)) { + served_nwdaf_info_listList = OpenAPI_list_create(); + OpenAPI_map_t *localMapKeyPair = NULL; + cJSON_ArrayForEach(served_nwdaf_info_list_local_map, served_nwdaf_info_list) { + cJSON *localMapObject = served_nwdaf_info_list_local_map; + double *localDouble = NULL; + int *localInt = NULL; + if (cJSON_IsObject(localMapObject)) { + localMapKeyPair = OpenAPI_map_create( + ogs_strdup(localMapObject->string), OpenAPI_nwdaf_info_parseFromJSON(localMapObject)); + } else if (cJSON_IsNull(localMapObject)) { + localMapKeyPair = OpenAPI_map_create(ogs_strdup(localMapObject->string), NULL); + } else { + ogs_error("OpenAPI_nrf_info_parseFromJSON() failed [inner]"); + goto end; + } + OpenAPI_list_add(served_nwdaf_info_listList, localMapKeyPair); + } + } + } + served_pcscf_info_list = cJSON_GetObjectItemCaseSensitive(nrf_infoJSON, "servedPcscfInfoList"); if (served_pcscf_info_list) { cJSON *served_pcscf_info_list_local_map = NULL; @@ -1605,7 +2065,7 @@ OpenAPI_nrf_info_t *OpenAPI_nrf_info_parseFromJSON(cJSON *nrf_infoJSON) int *localInt = NULL; if (cJSON_IsObject(localMapObject)) { localMapKeyPair = OpenAPI_map_create( - ogs_strdup(localMapObject->string), OpenAPI_pcscf_info_parseFromJSON(localMapObject)); + ogs_strdup(localMapObject->string), OpenAPI_nrf_info_served_pcscf_info_list_value_value_parseFromJSON(localMapObject)); } else if (cJSON_IsNull(localMapObject)) { localMapKeyPair = OpenAPI_map_create(ogs_strdup(localMapObject->string), NULL); } else { @@ -1631,7 +2091,7 @@ OpenAPI_nrf_info_t *OpenAPI_nrf_info_parseFromJSON(cJSON *nrf_infoJSON) cJSON *localMapObject = served_gmlc_info_local_map; if (cJSON_IsObject(localMapObject)) { localMapKeyPair = OpenAPI_map_create( - ogs_strdup(localMapObject->string), OpenAPI_gmlc_info_parseFromJSON(localMapObject)); + ogs_strdup(localMapObject->string), OpenAPI_nrf_info_served_gmlc_info_value_parseFromJSON(localMapObject)); } else if (cJSON_IsNull(localMapObject)) { localMapKeyPair = OpenAPI_map_create(ogs_strdup(localMapObject->string), NULL); } else { @@ -1657,7 +2117,7 @@ OpenAPI_nrf_info_t *OpenAPI_nrf_info_parseFromJSON(cJSON *nrf_infoJSON) cJSON *localMapObject = served_lmf_info_local_map; if (cJSON_IsObject(localMapObject)) { localMapKeyPair = OpenAPI_map_create( - ogs_strdup(localMapObject->string), OpenAPI_lmf_info_parseFromJSON(localMapObject)); + ogs_strdup(localMapObject->string), OpenAPI_nrf_info_served_lmf_info_value_parseFromJSON(localMapObject)); } else if (cJSON_IsNull(localMapObject)) { localMapKeyPair = OpenAPI_map_create(ogs_strdup(localMapObject->string), NULL); } else { @@ -1711,7 +2171,7 @@ OpenAPI_nrf_info_t *OpenAPI_nrf_info_parseFromJSON(cJSON *nrf_infoJSON) int *localInt = NULL; if (cJSON_IsObject(localMapObject)) { localMapKeyPair = OpenAPI_map_create( - ogs_strdup(localMapObject->string), OpenAPI_hss_info_parseFromJSON(localMapObject)); + ogs_strdup(localMapObject->string), OpenAPI_nrf_info_served_hss_info_list_value_value_parseFromJSON(localMapObject)); } else if (cJSON_IsNull(localMapObject)) { localMapKeyPair = OpenAPI_map_create(ogs_strdup(localMapObject->string), NULL); } else { @@ -1737,7 +2197,7 @@ OpenAPI_nrf_info_t *OpenAPI_nrf_info_parseFromJSON(cJSON *nrf_infoJSON) cJSON *localMapObject = served_udsf_info_local_map; if (cJSON_IsObject(localMapObject)) { localMapKeyPair = OpenAPI_map_create( - ogs_strdup(localMapObject->string), OpenAPI_udsf_info_parseFromJSON(localMapObject)); + ogs_strdup(localMapObject->string), OpenAPI_nrf_info_served_udsf_info_value_parseFromJSON(localMapObject)); } else if (cJSON_IsNull(localMapObject)) { localMapKeyPair = OpenAPI_map_create(ogs_strdup(localMapObject->string), NULL); } else { @@ -1765,7 +2225,7 @@ OpenAPI_nrf_info_t *OpenAPI_nrf_info_parseFromJSON(cJSON *nrf_infoJSON) int *localInt = NULL; if (cJSON_IsObject(localMapObject)) { localMapKeyPair = OpenAPI_map_create( - ogs_strdup(localMapObject->string), OpenAPI_udsf_info_parseFromJSON(localMapObject)); + ogs_strdup(localMapObject->string), OpenAPI_nrf_info_served_udsf_info_value_parseFromJSON(localMapObject)); } else if (cJSON_IsNull(localMapObject)) { localMapKeyPair = OpenAPI_map_create(ogs_strdup(localMapObject->string), NULL); } else { @@ -1791,7 +2251,7 @@ OpenAPI_nrf_info_t *OpenAPI_nrf_info_parseFromJSON(cJSON *nrf_infoJSON) cJSON *localMapObject = served_scp_info_list_local_map; if (cJSON_IsObject(localMapObject)) { localMapKeyPair = OpenAPI_map_create( - ogs_strdup(localMapObject->string), OpenAPI_scp_info_parseFromJSON(localMapObject)); + ogs_strdup(localMapObject->string), OpenAPI_nrf_info_served_scp_info_list_value_parseFromJSON(localMapObject)); } else if (cJSON_IsNull(localMapObject)) { localMapKeyPair = OpenAPI_map_create(ogs_strdup(localMapObject->string), NULL); } else { @@ -1803,6 +2263,302 @@ OpenAPI_nrf_info_t *OpenAPI_nrf_info_parseFromJSON(cJSON *nrf_infoJSON) } } + served_sepp_info_list = cJSON_GetObjectItemCaseSensitive(nrf_infoJSON, "servedSeppInfoList"); + if (served_sepp_info_list) { + cJSON *served_sepp_info_list_local_map = NULL; + if (!cJSON_IsObject(served_sepp_info_list) && !cJSON_IsNull(served_sepp_info_list)) { + ogs_error("OpenAPI_nrf_info_parseFromJSON() failed [served_sepp_info_list]"); + goto end; + } + if (cJSON_IsObject(served_sepp_info_list)) { + served_sepp_info_listList = OpenAPI_list_create(); + OpenAPI_map_t *localMapKeyPair = NULL; + cJSON_ArrayForEach(served_sepp_info_list_local_map, served_sepp_info_list) { + cJSON *localMapObject = served_sepp_info_list_local_map; + if (cJSON_IsObject(localMapObject)) { + localMapKeyPair = OpenAPI_map_create( + ogs_strdup(localMapObject->string), OpenAPI_nrf_info_served_sepp_info_list_value_parseFromJSON(localMapObject)); + } else if (cJSON_IsNull(localMapObject)) { + localMapKeyPair = OpenAPI_map_create(ogs_strdup(localMapObject->string), NULL); + } else { + ogs_error("OpenAPI_nrf_info_parseFromJSON() failed [inner]"); + goto end; + } + OpenAPI_list_add(served_sepp_info_listList, localMapKeyPair); + } + } + } + + served_aanf_info_list = cJSON_GetObjectItemCaseSensitive(nrf_infoJSON, "servedAanfInfoList"); + if (served_aanf_info_list) { + cJSON *served_aanf_info_list_local_map = NULL; + if (!cJSON_IsObject(served_aanf_info_list) && !cJSON_IsNull(served_aanf_info_list)) { + ogs_error("OpenAPI_nrf_info_parseFromJSON() failed [served_aanf_info_list]"); + goto end; + } + if (cJSON_IsObject(served_aanf_info_list)) { + served_aanf_info_listList = OpenAPI_list_create(); + OpenAPI_map_t *localMapKeyPair = NULL; + cJSON_ArrayForEach(served_aanf_info_list_local_map, served_aanf_info_list) { + cJSON *localMapObject = served_aanf_info_list_local_map; + double *localDouble = NULL; + int *localInt = NULL; + if (cJSON_IsObject(localMapObject)) { + localMapKeyPair = OpenAPI_map_create( + ogs_strdup(localMapObject->string), OpenAPI_nrf_info_served_aanf_info_list_value_value_parseFromJSON(localMapObject)); + } else if (cJSON_IsNull(localMapObject)) { + localMapKeyPair = OpenAPI_map_create(ogs_strdup(localMapObject->string), NULL); + } else { + ogs_error("OpenAPI_nrf_info_parseFromJSON() failed [inner]"); + goto end; + } + OpenAPI_list_add(served_aanf_info_listList, localMapKeyPair); + } + } + } + + served5g_ddnmf_info = cJSON_GetObjectItemCaseSensitive(nrf_infoJSON, "served5gDdnmfInfo"); + if (served5g_ddnmf_info) { + cJSON *served5g_ddnmf_info_local_map = NULL; + if (!cJSON_IsObject(served5g_ddnmf_info) && !cJSON_IsNull(served5g_ddnmf_info)) { + ogs_error("OpenAPI_nrf_info_parseFromJSON() failed [served5g_ddnmf_info]"); + goto end; + } + if (cJSON_IsObject(served5g_ddnmf_info)) { + served5g_ddnmf_infoList = OpenAPI_list_create(); + OpenAPI_map_t *localMapKeyPair = NULL; + cJSON_ArrayForEach(served5g_ddnmf_info_local_map, served5g_ddnmf_info) { + cJSON *localMapObject = served5g_ddnmf_info_local_map; + if (cJSON_IsObject(localMapObject)) { + localMapKeyPair = OpenAPI_map_create( + ogs_strdup(localMapObject->string), OpenAPI_model_5_g_ddnmf_info_parseFromJSON(localMapObject)); + } else if (cJSON_IsNull(localMapObject)) { + localMapKeyPair = OpenAPI_map_create(ogs_strdup(localMapObject->string), NULL); + } else { + ogs_error("OpenAPI_nrf_info_parseFromJSON() failed [inner]"); + goto end; + } + OpenAPI_list_add(served5g_ddnmf_infoList, localMapKeyPair); + } + } + } + + served_mfaf_info_list = cJSON_GetObjectItemCaseSensitive(nrf_infoJSON, "servedMfafInfoList"); + if (served_mfaf_info_list) { + cJSON *served_mfaf_info_list_local_map = NULL; + if (!cJSON_IsObject(served_mfaf_info_list) && !cJSON_IsNull(served_mfaf_info_list)) { + ogs_error("OpenAPI_nrf_info_parseFromJSON() failed [served_mfaf_info_list]"); + goto end; + } + if (cJSON_IsObject(served_mfaf_info_list)) { + served_mfaf_info_listList = OpenAPI_list_create(); + OpenAPI_map_t *localMapKeyPair = NULL; + cJSON_ArrayForEach(served_mfaf_info_list_local_map, served_mfaf_info_list) { + cJSON *localMapObject = served_mfaf_info_list_local_map; + if (cJSON_IsObject(localMapObject)) { + localMapKeyPair = OpenAPI_map_create( + ogs_strdup(localMapObject->string), OpenAPI_mfaf_info_parseFromJSON(localMapObject)); + } else if (cJSON_IsNull(localMapObject)) { + localMapKeyPair = OpenAPI_map_create(ogs_strdup(localMapObject->string), NULL); + } else { + ogs_error("OpenAPI_nrf_info_parseFromJSON() failed [inner]"); + goto end; + } + OpenAPI_list_add(served_mfaf_info_listList, localMapKeyPair); + } + } + } + + served_easdf_info_list = cJSON_GetObjectItemCaseSensitive(nrf_infoJSON, "servedEasdfInfoList"); + if (served_easdf_info_list) { + cJSON *served_easdf_info_list_local_map = NULL; + if (!cJSON_IsObject(served_easdf_info_list) && !cJSON_IsNull(served_easdf_info_list)) { + ogs_error("OpenAPI_nrf_info_parseFromJSON() failed [served_easdf_info_list]"); + goto end; + } + if (cJSON_IsObject(served_easdf_info_list)) { + served_easdf_info_listList = OpenAPI_list_create(); + OpenAPI_map_t *localMapKeyPair = NULL; + cJSON_ArrayForEach(served_easdf_info_list_local_map, served_easdf_info_list) { + cJSON *localMapObject = served_easdf_info_list_local_map; + double *localDouble = NULL; + int *localInt = NULL; + if (cJSON_IsObject(localMapObject)) { + localMapKeyPair = OpenAPI_map_create( + ogs_strdup(localMapObject->string), OpenAPI_easdf_info_parseFromJSON(localMapObject)); + } else if (cJSON_IsNull(localMapObject)) { + localMapKeyPair = OpenAPI_map_create(ogs_strdup(localMapObject->string), NULL); + } else { + ogs_error("OpenAPI_nrf_info_parseFromJSON() failed [inner]"); + goto end; + } + OpenAPI_list_add(served_easdf_info_listList, localMapKeyPair); + } + } + } + + served_dccf_info_list = cJSON_GetObjectItemCaseSensitive(nrf_infoJSON, "servedDccfInfoList"); + if (served_dccf_info_list) { + cJSON *served_dccf_info_list_local_map = NULL; + if (!cJSON_IsObject(served_dccf_info_list) && !cJSON_IsNull(served_dccf_info_list)) { + ogs_error("OpenAPI_nrf_info_parseFromJSON() failed [served_dccf_info_list]"); + goto end; + } + if (cJSON_IsObject(served_dccf_info_list)) { + served_dccf_info_listList = OpenAPI_list_create(); + OpenAPI_map_t *localMapKeyPair = NULL; + cJSON_ArrayForEach(served_dccf_info_list_local_map, served_dccf_info_list) { + cJSON *localMapObject = served_dccf_info_list_local_map; + if (cJSON_IsObject(localMapObject)) { + localMapKeyPair = OpenAPI_map_create( + ogs_strdup(localMapObject->string), OpenAPI_dccf_info_parseFromJSON(localMapObject)); + } else if (cJSON_IsNull(localMapObject)) { + localMapKeyPair = OpenAPI_map_create(ogs_strdup(localMapObject->string), NULL); + } else { + ogs_error("OpenAPI_nrf_info_parseFromJSON() failed [inner]"); + goto end; + } + OpenAPI_list_add(served_dccf_info_listList, localMapKeyPair); + } + } + } + + served_mb_smf_info_list = cJSON_GetObjectItemCaseSensitive(nrf_infoJSON, "servedMbSmfInfoList"); + if (served_mb_smf_info_list) { + cJSON *served_mb_smf_info_list_local_map = NULL; + if (!cJSON_IsObject(served_mb_smf_info_list) && !cJSON_IsNull(served_mb_smf_info_list)) { + ogs_error("OpenAPI_nrf_info_parseFromJSON() failed [served_mb_smf_info_list]"); + goto end; + } + if (cJSON_IsObject(served_mb_smf_info_list)) { + served_mb_smf_info_listList = OpenAPI_list_create(); + OpenAPI_map_t *localMapKeyPair = NULL; + cJSON_ArrayForEach(served_mb_smf_info_list_local_map, served_mb_smf_info_list) { + cJSON *localMapObject = served_mb_smf_info_list_local_map; + double *localDouble = NULL; + int *localInt = NULL; + if (cJSON_IsObject(localMapObject)) { + localMapKeyPair = OpenAPI_map_create( + ogs_strdup(localMapObject->string), OpenAPI_nrf_info_served_mb_smf_info_list_value_value_parseFromJSON(localMapObject)); + } else if (cJSON_IsNull(localMapObject)) { + localMapKeyPair = OpenAPI_map_create(ogs_strdup(localMapObject->string), NULL); + } else { + ogs_error("OpenAPI_nrf_info_parseFromJSON() failed [inner]"); + goto end; + } + OpenAPI_list_add(served_mb_smf_info_listList, localMapKeyPair); + } + } + } + + served_tsctsf_info_list = cJSON_GetObjectItemCaseSensitive(nrf_infoJSON, "servedTsctsfInfoList"); + if (served_tsctsf_info_list) { + cJSON *served_tsctsf_info_list_local_map = NULL; + if (!cJSON_IsObject(served_tsctsf_info_list) && !cJSON_IsNull(served_tsctsf_info_list)) { + ogs_error("OpenAPI_nrf_info_parseFromJSON() failed [served_tsctsf_info_list]"); + goto end; + } + if (cJSON_IsObject(served_tsctsf_info_list)) { + served_tsctsf_info_listList = OpenAPI_list_create(); + OpenAPI_map_t *localMapKeyPair = NULL; + cJSON_ArrayForEach(served_tsctsf_info_list_local_map, served_tsctsf_info_list) { + cJSON *localMapObject = served_tsctsf_info_list_local_map; + double *localDouble = NULL; + int *localInt = NULL; + if (cJSON_IsObject(localMapObject)) { + localMapKeyPair = OpenAPI_map_create( + ogs_strdup(localMapObject->string), OpenAPI_tsctsf_info_parseFromJSON(localMapObject)); + } else if (cJSON_IsNull(localMapObject)) { + localMapKeyPair = OpenAPI_map_create(ogs_strdup(localMapObject->string), NULL); + } else { + ogs_error("OpenAPI_nrf_info_parseFromJSON() failed [inner]"); + goto end; + } + OpenAPI_list_add(served_tsctsf_info_listList, localMapKeyPair); + } + } + } + + served_mb_upf_info_list = cJSON_GetObjectItemCaseSensitive(nrf_infoJSON, "servedMbUpfInfoList"); + if (served_mb_upf_info_list) { + cJSON *served_mb_upf_info_list_local_map = NULL; + if (!cJSON_IsObject(served_mb_upf_info_list) && !cJSON_IsNull(served_mb_upf_info_list)) { + ogs_error("OpenAPI_nrf_info_parseFromJSON() failed [served_mb_upf_info_list]"); + goto end; + } + if (cJSON_IsObject(served_mb_upf_info_list)) { + served_mb_upf_info_listList = OpenAPI_list_create(); + OpenAPI_map_t *localMapKeyPair = NULL; + cJSON_ArrayForEach(served_mb_upf_info_list_local_map, served_mb_upf_info_list) { + cJSON *localMapObject = served_mb_upf_info_list_local_map; + double *localDouble = NULL; + int *localInt = NULL; + if (cJSON_IsObject(localMapObject)) { + localMapKeyPair = OpenAPI_map_create( + ogs_strdup(localMapObject->string), OpenAPI_mb_upf_info_parseFromJSON(localMapObject)); + } else if (cJSON_IsNull(localMapObject)) { + localMapKeyPair = OpenAPI_map_create(ogs_strdup(localMapObject->string), NULL); + } else { + ogs_error("OpenAPI_nrf_info_parseFromJSON() failed [inner]"); + goto end; + } + OpenAPI_list_add(served_mb_upf_info_listList, localMapKeyPair); + } + } + } + + served_trust_af_info = cJSON_GetObjectItemCaseSensitive(nrf_infoJSON, "servedTrustAfInfo"); + if (served_trust_af_info) { + cJSON *served_trust_af_info_local_map = NULL; + if (!cJSON_IsObject(served_trust_af_info) && !cJSON_IsNull(served_trust_af_info)) { + ogs_error("OpenAPI_nrf_info_parseFromJSON() failed [served_trust_af_info]"); + goto end; + } + if (cJSON_IsObject(served_trust_af_info)) { + served_trust_af_infoList = OpenAPI_list_create(); + OpenAPI_map_t *localMapKeyPair = NULL; + cJSON_ArrayForEach(served_trust_af_info_local_map, served_trust_af_info) { + cJSON *localMapObject = served_trust_af_info_local_map; + if (cJSON_IsObject(localMapObject)) { + localMapKeyPair = OpenAPI_map_create( + ogs_strdup(localMapObject->string), OpenAPI_trust_af_info_parseFromJSON(localMapObject)); + } else if (cJSON_IsNull(localMapObject)) { + localMapKeyPair = OpenAPI_map_create(ogs_strdup(localMapObject->string), NULL); + } else { + ogs_error("OpenAPI_nrf_info_parseFromJSON() failed [inner]"); + goto end; + } + OpenAPI_list_add(served_trust_af_infoList, localMapKeyPair); + } + } + } + + served_nssaaf_info = cJSON_GetObjectItemCaseSensitive(nrf_infoJSON, "servedNssaafInfo"); + if (served_nssaaf_info) { + cJSON *served_nssaaf_info_local_map = NULL; + if (!cJSON_IsObject(served_nssaaf_info) && !cJSON_IsNull(served_nssaaf_info)) { + ogs_error("OpenAPI_nrf_info_parseFromJSON() failed [served_nssaaf_info]"); + goto end; + } + if (cJSON_IsObject(served_nssaaf_info)) { + served_nssaaf_infoList = OpenAPI_list_create(); + OpenAPI_map_t *localMapKeyPair = NULL; + cJSON_ArrayForEach(served_nssaaf_info_local_map, served_nssaaf_info) { + cJSON *localMapObject = served_nssaaf_info_local_map; + if (cJSON_IsObject(localMapObject)) { + localMapKeyPair = OpenAPI_map_create( + ogs_strdup(localMapObject->string), OpenAPI_nssaaf_info_parseFromJSON(localMapObject)); + } else if (cJSON_IsNull(localMapObject)) { + localMapKeyPair = OpenAPI_map_create(ogs_strdup(localMapObject->string), NULL); + } else { + ogs_error("OpenAPI_nrf_info_parseFromJSON() failed [inner]"); + goto end; + } + OpenAPI_list_add(served_nssaaf_infoList, localMapKeyPair); + } + } + } + nrf_info_local_var = OpenAPI_nrf_info_create ( served_udr_info ? served_udr_infoList : NULL, served_udr_info_list ? served_udr_info_listList : NULL, @@ -1824,6 +2580,7 @@ OpenAPI_nrf_info_t *OpenAPI_nrf_info_parseFromJSON(cJSON *nrf_infoJSON) served_chf_info_list ? served_chf_info_listList : NULL, served_nef_info ? served_nef_infoList : NULL, served_nwdaf_info ? served_nwdaf_infoList : NULL, + served_nwdaf_info_list ? served_nwdaf_info_listList : NULL, served_pcscf_info_list ? served_pcscf_info_listList : NULL, served_gmlc_info ? served_gmlc_infoList : NULL, served_lmf_info ? served_lmf_infoList : NULL, @@ -1831,7 +2588,18 @@ OpenAPI_nrf_info_t *OpenAPI_nrf_info_parseFromJSON(cJSON *nrf_infoJSON) served_hss_info_list ? served_hss_info_listList : NULL, served_udsf_info ? served_udsf_infoList : NULL, served_udsf_info_list ? served_udsf_info_listList : NULL, - served_scp_info_list ? served_scp_info_listList : NULL + served_scp_info_list ? served_scp_info_listList : NULL, + served_sepp_info_list ? served_sepp_info_listList : NULL, + served_aanf_info_list ? served_aanf_info_listList : NULL, + served5g_ddnmf_info ? served5g_ddnmf_infoList : NULL, + served_mfaf_info_list ? served_mfaf_info_listList : NULL, + served_easdf_info_list ? served_easdf_info_listList : NULL, + served_dccf_info_list ? served_dccf_info_listList : NULL, + served_mb_smf_info_list ? served_mb_smf_info_listList : NULL, + served_tsctsf_info_list ? served_tsctsf_info_listList : NULL, + served_mb_upf_info_list ? served_mb_upf_info_listList : NULL, + served_trust_af_info ? served_trust_af_infoList : NULL, + served_nssaaf_info ? served_nssaaf_infoList : NULL ); return nrf_info_local_var; @@ -1840,7 +2608,7 @@ end: OpenAPI_list_for_each(served_udr_infoList, node) { OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*) node->data; ogs_free(localKeyValue->key); - OpenAPI_udr_info_free(localKeyValue->value); + OpenAPI_nrf_info_served_udr_info_value_free(localKeyValue->value); OpenAPI_map_free(localKeyValue); } OpenAPI_list_free(served_udr_infoList); @@ -1860,7 +2628,7 @@ end: OpenAPI_list_for_each(served_udm_infoList, node) { OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*) node->data; ogs_free(localKeyValue->key); - OpenAPI_udm_info_free(localKeyValue->value); + OpenAPI_nrf_info_served_udm_info_value_free(localKeyValue->value); OpenAPI_map_free(localKeyValue); } OpenAPI_list_free(served_udm_infoList); @@ -1880,7 +2648,7 @@ end: OpenAPI_list_for_each(served_ausf_infoList, node) { OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*) node->data; ogs_free(localKeyValue->key); - OpenAPI_ausf_info_free(localKeyValue->value); + OpenAPI_nrf_info_served_ausf_info_value_free(localKeyValue->value); OpenAPI_map_free(localKeyValue); } OpenAPI_list_free(served_ausf_infoList); @@ -1900,7 +2668,7 @@ end: OpenAPI_list_for_each(served_amf_infoList, node) { OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*) node->data; ogs_free(localKeyValue->key); - OpenAPI_amf_info_free(localKeyValue->value); + OpenAPI_nrf_info_served_amf_info_value_free(localKeyValue->value); OpenAPI_map_free(localKeyValue); } OpenAPI_list_free(served_amf_infoList); @@ -1920,7 +2688,7 @@ end: OpenAPI_list_for_each(served_smf_infoList, node) { OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*) node->data; ogs_free(localKeyValue->key); - OpenAPI_smf_info_free(localKeyValue->value); + OpenAPI_nrf_info_served_smf_info_value_free(localKeyValue->value); OpenAPI_map_free(localKeyValue); } OpenAPI_list_free(served_smf_infoList); @@ -1940,7 +2708,7 @@ end: OpenAPI_list_for_each(served_upf_infoList, node) { OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*) node->data; ogs_free(localKeyValue->key); - OpenAPI_upf_info_free(localKeyValue->value); + OpenAPI_nrf_info_served_upf_info_value_free(localKeyValue->value); OpenAPI_map_free(localKeyValue); } OpenAPI_list_free(served_upf_infoList); @@ -1960,7 +2728,7 @@ end: OpenAPI_list_for_each(served_pcf_infoList, node) { OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*) node->data; ogs_free(localKeyValue->key); - OpenAPI_pcf_info_free(localKeyValue->value); + OpenAPI_nrf_info_served_pcf_info_value_free(localKeyValue->value); OpenAPI_map_free(localKeyValue); } OpenAPI_list_free(served_pcf_infoList); @@ -1980,7 +2748,7 @@ end: OpenAPI_list_for_each(served_bsf_infoList, node) { OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*) node->data; ogs_free(localKeyValue->key); - OpenAPI_bsf_info_free(localKeyValue->value); + OpenAPI_nrf_info_served_bsf_info_value_free(localKeyValue->value); OpenAPI_map_free(localKeyValue); } OpenAPI_list_free(served_bsf_infoList); @@ -2000,7 +2768,7 @@ end: OpenAPI_list_for_each(served_chf_infoList, node) { OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*) node->data; ogs_free(localKeyValue->key); - OpenAPI_chf_info_free(localKeyValue->value); + OpenAPI_nrf_info_served_chf_info_value_free(localKeyValue->value); OpenAPI_map_free(localKeyValue); } OpenAPI_list_free(served_chf_infoList); @@ -2020,7 +2788,7 @@ end: OpenAPI_list_for_each(served_nef_infoList, node) { OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*) node->data; ogs_free(localKeyValue->key); - OpenAPI_nef_info_free(localKeyValue->value); + OpenAPI_nrf_info_served_nef_info_value_free(localKeyValue->value); OpenAPI_map_free(localKeyValue); } OpenAPI_list_free(served_nef_infoList); @@ -2030,12 +2798,22 @@ end: OpenAPI_list_for_each(served_nwdaf_infoList, node) { OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*) node->data; ogs_free(localKeyValue->key); - OpenAPI_nwdaf_info_free(localKeyValue->value); + OpenAPI_nrf_info_served_nwdaf_info_value_free(localKeyValue->value); OpenAPI_map_free(localKeyValue); } OpenAPI_list_free(served_nwdaf_infoList); served_nwdaf_infoList = NULL; } + if (served_nwdaf_info_listList) { + OpenAPI_list_for_each(served_nwdaf_info_listList, node) { + OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*) node->data; + ogs_free(localKeyValue->key); + ogs_free(localKeyValue->value); + OpenAPI_map_free(localKeyValue); + } + OpenAPI_list_free(served_nwdaf_info_listList); + served_nwdaf_info_listList = NULL; + } if (served_pcscf_info_listList) { OpenAPI_list_for_each(served_pcscf_info_listList, node) { OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*) node->data; @@ -2050,7 +2828,7 @@ end: OpenAPI_list_for_each(served_gmlc_infoList, node) { OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*) node->data; ogs_free(localKeyValue->key); - OpenAPI_gmlc_info_free(localKeyValue->value); + OpenAPI_nrf_info_served_gmlc_info_value_free(localKeyValue->value); OpenAPI_map_free(localKeyValue); } OpenAPI_list_free(served_gmlc_infoList); @@ -2060,7 +2838,7 @@ end: OpenAPI_list_for_each(served_lmf_infoList, node) { OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*) node->data; ogs_free(localKeyValue->key); - OpenAPI_lmf_info_free(localKeyValue->value); + OpenAPI_nrf_info_served_lmf_info_value_free(localKeyValue->value); OpenAPI_map_free(localKeyValue); } OpenAPI_list_free(served_lmf_infoList); @@ -2090,7 +2868,7 @@ end: OpenAPI_list_for_each(served_udsf_infoList, node) { OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*) node->data; ogs_free(localKeyValue->key); - OpenAPI_udsf_info_free(localKeyValue->value); + OpenAPI_nrf_info_served_udsf_info_value_free(localKeyValue->value); OpenAPI_map_free(localKeyValue); } OpenAPI_list_free(served_udsf_infoList); @@ -2110,12 +2888,122 @@ end: OpenAPI_list_for_each(served_scp_info_listList, node) { OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*) node->data; ogs_free(localKeyValue->key); - OpenAPI_scp_info_free(localKeyValue->value); + OpenAPI_nrf_info_served_scp_info_list_value_free(localKeyValue->value); OpenAPI_map_free(localKeyValue); } OpenAPI_list_free(served_scp_info_listList); served_scp_info_listList = NULL; } + if (served_sepp_info_listList) { + OpenAPI_list_for_each(served_sepp_info_listList, node) { + OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*) node->data; + ogs_free(localKeyValue->key); + OpenAPI_nrf_info_served_sepp_info_list_value_free(localKeyValue->value); + OpenAPI_map_free(localKeyValue); + } + OpenAPI_list_free(served_sepp_info_listList); + served_sepp_info_listList = NULL; + } + if (served_aanf_info_listList) { + OpenAPI_list_for_each(served_aanf_info_listList, node) { + OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*) node->data; + ogs_free(localKeyValue->key); + ogs_free(localKeyValue->value); + OpenAPI_map_free(localKeyValue); + } + OpenAPI_list_free(served_aanf_info_listList); + served_aanf_info_listList = NULL; + } + if (served5g_ddnmf_infoList) { + OpenAPI_list_for_each(served5g_ddnmf_infoList, node) { + OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*) node->data; + ogs_free(localKeyValue->key); + OpenAPI_model_5_g_ddnmf_info_free(localKeyValue->value); + OpenAPI_map_free(localKeyValue); + } + OpenAPI_list_free(served5g_ddnmf_infoList); + served5g_ddnmf_infoList = NULL; + } + if (served_mfaf_info_listList) { + OpenAPI_list_for_each(served_mfaf_info_listList, node) { + OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*) node->data; + ogs_free(localKeyValue->key); + OpenAPI_mfaf_info_free(localKeyValue->value); + OpenAPI_map_free(localKeyValue); + } + OpenAPI_list_free(served_mfaf_info_listList); + served_mfaf_info_listList = NULL; + } + if (served_easdf_info_listList) { + OpenAPI_list_for_each(served_easdf_info_listList, node) { + OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*) node->data; + ogs_free(localKeyValue->key); + ogs_free(localKeyValue->value); + OpenAPI_map_free(localKeyValue); + } + OpenAPI_list_free(served_easdf_info_listList); + served_easdf_info_listList = NULL; + } + if (served_dccf_info_listList) { + OpenAPI_list_for_each(served_dccf_info_listList, node) { + OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*) node->data; + ogs_free(localKeyValue->key); + OpenAPI_dccf_info_free(localKeyValue->value); + OpenAPI_map_free(localKeyValue); + } + OpenAPI_list_free(served_dccf_info_listList); + served_dccf_info_listList = NULL; + } + if (served_mb_smf_info_listList) { + OpenAPI_list_for_each(served_mb_smf_info_listList, node) { + OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*) node->data; + ogs_free(localKeyValue->key); + ogs_free(localKeyValue->value); + OpenAPI_map_free(localKeyValue); + } + OpenAPI_list_free(served_mb_smf_info_listList); + served_mb_smf_info_listList = NULL; + } + if (served_tsctsf_info_listList) { + OpenAPI_list_for_each(served_tsctsf_info_listList, node) { + OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*) node->data; + ogs_free(localKeyValue->key); + ogs_free(localKeyValue->value); + OpenAPI_map_free(localKeyValue); + } + OpenAPI_list_free(served_tsctsf_info_listList); + served_tsctsf_info_listList = NULL; + } + if (served_mb_upf_info_listList) { + OpenAPI_list_for_each(served_mb_upf_info_listList, node) { + OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*) node->data; + ogs_free(localKeyValue->key); + ogs_free(localKeyValue->value); + OpenAPI_map_free(localKeyValue); + } + OpenAPI_list_free(served_mb_upf_info_listList); + served_mb_upf_info_listList = NULL; + } + if (served_trust_af_infoList) { + OpenAPI_list_for_each(served_trust_af_infoList, node) { + OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*) node->data; + ogs_free(localKeyValue->key); + OpenAPI_trust_af_info_free(localKeyValue->value); + OpenAPI_map_free(localKeyValue); + } + OpenAPI_list_free(served_trust_af_infoList); + served_trust_af_infoList = NULL; + } + if (served_nssaaf_infoList) { + OpenAPI_list_for_each(served_nssaaf_infoList, node) { + OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*) node->data; + ogs_free(localKeyValue->key); + OpenAPI_nssaaf_info_free(localKeyValue->value); + OpenAPI_map_free(localKeyValue); + } + OpenAPI_list_free(served_nssaaf_infoList); + served_nssaaf_infoList = NULL; + } return NULL; } diff --git a/lib/sbi/openapi/model/nrf_info.h b/lib/sbi/openapi/model/nrf_info.h index 61203890c..cf969fc38 100644 --- a/lib/sbi/openapi/model/nrf_info.h +++ b/lib/sbi/openapi/model/nrf_info.h @@ -12,24 +12,36 @@ #include "../include/list.h" #include "../include/keyValuePair.h" #include "../include/binary.h" -#include "amf_info.h" -#include "ausf_info.h" -#include "bsf_info.h" -#include "chf_info.h" -#include "gmlc_info.h" -#include "hss_info.h" -#include "lmf_info.h" -#include "nef_info.h" +#include "dccf_info.h" +#include "easdf_info.h" +#include "mb_upf_info.h" +#include "mfaf_info.h" +#include "model_5_g_ddnmf_info.h" #include "nf_info.h" +#include "nrf_info_served_aanf_info_list_value_value.h" +#include "nrf_info_served_amf_info_value.h" +#include "nrf_info_served_ausf_info_value.h" +#include "nrf_info_served_bsf_info_value.h" +#include "nrf_info_served_chf_info_value.h" +#include "nrf_info_served_gmlc_info_value.h" +#include "nrf_info_served_hss_info_list_value_value.h" +#include "nrf_info_served_lmf_info_value.h" +#include "nrf_info_served_mb_smf_info_list_value_value.h" +#include "nrf_info_served_nef_info_value.h" +#include "nrf_info_served_nwdaf_info_value.h" +#include "nrf_info_served_pcf_info_value.h" +#include "nrf_info_served_pcscf_info_list_value_value.h" +#include "nrf_info_served_scp_info_list_value.h" +#include "nrf_info_served_sepp_info_list_value.h" +#include "nrf_info_served_smf_info_value.h" +#include "nrf_info_served_udm_info_value.h" +#include "nrf_info_served_udr_info_value.h" +#include "nrf_info_served_udsf_info_value.h" +#include "nrf_info_served_upf_info_value.h" +#include "nssaaf_info.h" #include "nwdaf_info.h" -#include "pcf_info.h" -#include "pcscf_info.h" -#include "scp_info.h" -#include "smf_info.h" -#include "udm_info.h" -#include "udr_info.h" -#include "udsf_info.h" -#include "upf_info.h" +#include "trust_af_info.h" +#include "tsctsf_info.h" #ifdef __cplusplus extern "C" { @@ -57,6 +69,7 @@ typedef struct OpenAPI_nrf_info_s { OpenAPI_list_t* served_chf_info_list; OpenAPI_list_t* served_nef_info; OpenAPI_list_t* served_nwdaf_info; + OpenAPI_list_t* served_nwdaf_info_list; OpenAPI_list_t* served_pcscf_info_list; OpenAPI_list_t* served_gmlc_info; OpenAPI_list_t* served_lmf_info; @@ -65,6 +78,17 @@ typedef struct OpenAPI_nrf_info_s { OpenAPI_list_t* served_udsf_info; OpenAPI_list_t* served_udsf_info_list; OpenAPI_list_t* served_scp_info_list; + OpenAPI_list_t* served_sepp_info_list; + OpenAPI_list_t* served_aanf_info_list; + OpenAPI_list_t* served5g_ddnmf_info; + OpenAPI_list_t* served_mfaf_info_list; + OpenAPI_list_t* served_easdf_info_list; + OpenAPI_list_t* served_dccf_info_list; + OpenAPI_list_t* served_mb_smf_info_list; + OpenAPI_list_t* served_tsctsf_info_list; + OpenAPI_list_t* served_mb_upf_info_list; + OpenAPI_list_t* served_trust_af_info; + OpenAPI_list_t* served_nssaaf_info; } OpenAPI_nrf_info_t; OpenAPI_nrf_info_t *OpenAPI_nrf_info_create( @@ -88,6 +112,7 @@ OpenAPI_nrf_info_t *OpenAPI_nrf_info_create( OpenAPI_list_t* served_chf_info_list, OpenAPI_list_t* served_nef_info, OpenAPI_list_t* served_nwdaf_info, + OpenAPI_list_t* served_nwdaf_info_list, OpenAPI_list_t* served_pcscf_info_list, OpenAPI_list_t* served_gmlc_info, OpenAPI_list_t* served_lmf_info, @@ -95,7 +120,18 @@ OpenAPI_nrf_info_t *OpenAPI_nrf_info_create( OpenAPI_list_t* served_hss_info_list, OpenAPI_list_t* served_udsf_info, OpenAPI_list_t* served_udsf_info_list, - OpenAPI_list_t* served_scp_info_list + OpenAPI_list_t* served_scp_info_list, + OpenAPI_list_t* served_sepp_info_list, + OpenAPI_list_t* served_aanf_info_list, + OpenAPI_list_t* served5g_ddnmf_info, + OpenAPI_list_t* served_mfaf_info_list, + OpenAPI_list_t* served_easdf_info_list, + OpenAPI_list_t* served_dccf_info_list, + OpenAPI_list_t* served_mb_smf_info_list, + OpenAPI_list_t* served_tsctsf_info_list, + OpenAPI_list_t* served_mb_upf_info_list, + OpenAPI_list_t* served_trust_af_info, + OpenAPI_list_t* served_nssaaf_info ); void OpenAPI_nrf_info_free(OpenAPI_nrf_info_t *nrf_info); OpenAPI_nrf_info_t *OpenAPI_nrf_info_parseFromJSON(cJSON *nrf_infoJSON); diff --git a/lib/sbi/openapi/model/nrf_info_served_aanf_info_list_value_value.c b/lib/sbi/openapi/model/nrf_info_served_aanf_info_list_value_value.c new file mode 100644 index 000000000..b7b2b7f9a --- /dev/null +++ b/lib/sbi/openapi/model/nrf_info_served_aanf_info_list_value_value.c @@ -0,0 +1,141 @@ + +#include +#include +#include +#include "nrf_info_served_aanf_info_list_value_value.h" + +OpenAPI_nrf_info_served_aanf_info_list_value_value_t *OpenAPI_nrf_info_served_aanf_info_list_value_value_create( + OpenAPI_list_t *routing_indicators +) +{ + OpenAPI_nrf_info_served_aanf_info_list_value_value_t *nrf_info_served_aanf_info_list_value_value_local_var = ogs_malloc(sizeof(OpenAPI_nrf_info_served_aanf_info_list_value_value_t)); + ogs_assert(nrf_info_served_aanf_info_list_value_value_local_var); + + nrf_info_served_aanf_info_list_value_value_local_var->routing_indicators = routing_indicators; + + return nrf_info_served_aanf_info_list_value_value_local_var; +} + +void OpenAPI_nrf_info_served_aanf_info_list_value_value_free(OpenAPI_nrf_info_served_aanf_info_list_value_value_t *nrf_info_served_aanf_info_list_value_value) +{ + OpenAPI_lnode_t *node = NULL; + + if (NULL == nrf_info_served_aanf_info_list_value_value) { + return; + } + if (nrf_info_served_aanf_info_list_value_value->routing_indicators) { + OpenAPI_list_for_each(nrf_info_served_aanf_info_list_value_value->routing_indicators, node) { + ogs_free(node->data); + } + OpenAPI_list_free(nrf_info_served_aanf_info_list_value_value->routing_indicators); + nrf_info_served_aanf_info_list_value_value->routing_indicators = NULL; + } + ogs_free(nrf_info_served_aanf_info_list_value_value); +} + +cJSON *OpenAPI_nrf_info_served_aanf_info_list_value_value_convertToJSON(OpenAPI_nrf_info_served_aanf_info_list_value_value_t *nrf_info_served_aanf_info_list_value_value) +{ + cJSON *item = NULL; + OpenAPI_lnode_t *node = NULL; + + if (nrf_info_served_aanf_info_list_value_value == NULL) { + ogs_error("OpenAPI_nrf_info_served_aanf_info_list_value_value_convertToJSON() failed [NrfInfo_servedAanfInfoList_value_value]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (nrf_info_served_aanf_info_list_value_value->routing_indicators) { + cJSON *routing_indicatorsList = cJSON_AddArrayToObject(item, "routingIndicators"); + if (routing_indicatorsList == NULL) { + ogs_error("OpenAPI_nrf_info_served_aanf_info_list_value_value_convertToJSON() failed [routing_indicators]"); + goto end; + } + OpenAPI_list_for_each(nrf_info_served_aanf_info_list_value_value->routing_indicators, node) { + if (cJSON_AddStringToObject(routing_indicatorsList, "", (char*)node->data) == NULL) { + ogs_error("OpenAPI_nrf_info_served_aanf_info_list_value_value_convertToJSON() failed [routing_indicators]"); + goto end; + } + } + } + +end: + return item; +} + +OpenAPI_nrf_info_served_aanf_info_list_value_value_t *OpenAPI_nrf_info_served_aanf_info_list_value_value_parseFromJSON(cJSON *nrf_info_served_aanf_info_list_value_valueJSON) +{ + OpenAPI_nrf_info_served_aanf_info_list_value_value_t *nrf_info_served_aanf_info_list_value_value_local_var = NULL; + OpenAPI_lnode_t *node = NULL; + cJSON *routing_indicators = NULL; + OpenAPI_list_t *routing_indicatorsList = NULL; + routing_indicators = cJSON_GetObjectItemCaseSensitive(nrf_info_served_aanf_info_list_value_valueJSON, "routingIndicators"); + if (routing_indicators) { + cJSON *routing_indicators_local = NULL; + if (!cJSON_IsArray(routing_indicators)) { + ogs_error("OpenAPI_nrf_info_served_aanf_info_list_value_value_parseFromJSON() failed [routing_indicators]"); + goto end; + } + + routing_indicatorsList = OpenAPI_list_create(); + + cJSON_ArrayForEach(routing_indicators_local, routing_indicators) { + double *localDouble = NULL; + int *localInt = NULL; + if (!cJSON_IsString(routing_indicators_local)) { + ogs_error("OpenAPI_nrf_info_served_aanf_info_list_value_value_parseFromJSON() failed [routing_indicators]"); + goto end; + } + OpenAPI_list_add(routing_indicatorsList, ogs_strdup(routing_indicators_local->valuestring)); + } + } + + nrf_info_served_aanf_info_list_value_value_local_var = OpenAPI_nrf_info_served_aanf_info_list_value_value_create ( + routing_indicators ? routing_indicatorsList : NULL + ); + + return nrf_info_served_aanf_info_list_value_value_local_var; +end: + if (routing_indicatorsList) { + OpenAPI_list_for_each(routing_indicatorsList, node) { + ogs_free(node->data); + } + OpenAPI_list_free(routing_indicatorsList); + routing_indicatorsList = NULL; + } + return NULL; +} + +OpenAPI_nrf_info_served_aanf_info_list_value_value_t *OpenAPI_nrf_info_served_aanf_info_list_value_value_copy(OpenAPI_nrf_info_served_aanf_info_list_value_value_t *dst, OpenAPI_nrf_info_served_aanf_info_list_value_value_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_nrf_info_served_aanf_info_list_value_value_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_nrf_info_served_aanf_info_list_value_value_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_nrf_info_served_aanf_info_list_value_value_free(dst); + dst = OpenAPI_nrf_info_served_aanf_info_list_value_value_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/nrf_info_served_aanf_info_list_value_value.h b/lib/sbi/openapi/model/nrf_info_served_aanf_info_list_value_value.h new file mode 100644 index 000000000..2d7467d93 --- /dev/null +++ b/lib/sbi/openapi/model/nrf_info_served_aanf_info_list_value_value.h @@ -0,0 +1,39 @@ +/* + * nrf_info_served_aanf_info_list_value_value.h + * + * + */ + +#ifndef _OpenAPI_nrf_info_served_aanf_info_list_value_value_H_ +#define _OpenAPI_nrf_info_served_aanf_info_list_value_value_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "aanf_info.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_nrf_info_served_aanf_info_list_value_value_s OpenAPI_nrf_info_served_aanf_info_list_value_value_t; +typedef struct OpenAPI_nrf_info_served_aanf_info_list_value_value_s { + OpenAPI_list_t *routing_indicators; +} OpenAPI_nrf_info_served_aanf_info_list_value_value_t; + +OpenAPI_nrf_info_served_aanf_info_list_value_value_t *OpenAPI_nrf_info_served_aanf_info_list_value_value_create( + OpenAPI_list_t *routing_indicators +); +void OpenAPI_nrf_info_served_aanf_info_list_value_value_free(OpenAPI_nrf_info_served_aanf_info_list_value_value_t *nrf_info_served_aanf_info_list_value_value); +OpenAPI_nrf_info_served_aanf_info_list_value_value_t *OpenAPI_nrf_info_served_aanf_info_list_value_value_parseFromJSON(cJSON *nrf_info_served_aanf_info_list_value_valueJSON); +cJSON *OpenAPI_nrf_info_served_aanf_info_list_value_value_convertToJSON(OpenAPI_nrf_info_served_aanf_info_list_value_value_t *nrf_info_served_aanf_info_list_value_value); +OpenAPI_nrf_info_served_aanf_info_list_value_value_t *OpenAPI_nrf_info_served_aanf_info_list_value_value_copy(OpenAPI_nrf_info_served_aanf_info_list_value_value_t *dst, OpenAPI_nrf_info_served_aanf_info_list_value_value_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_nrf_info_served_aanf_info_list_value_value_H_ */ + diff --git a/lib/sbi/openapi/model/nrf_info_served_amf_info_value.c b/lib/sbi/openapi/model/nrf_info_served_amf_info_value.c new file mode 100644 index 000000000..b1a03489f --- /dev/null +++ b/lib/sbi/openapi/model/nrf_info_served_amf_info_value.c @@ -0,0 +1,498 @@ + +#include +#include +#include +#include "nrf_info_served_amf_info_value.h" + +OpenAPI_nrf_info_served_amf_info_value_t *OpenAPI_nrf_info_served_amf_info_value_create( + char *amf_set_id, + char *amf_region_id, + OpenAPI_list_t *guami_list, + OpenAPI_list_t *tai_list, + OpenAPI_list_t *tai_range_list, + OpenAPI_list_t *backup_info_amf_failure, + OpenAPI_list_t *backup_info_amf_removal, + OpenAPI_n2_interface_amf_info_t *n2_interface_amf_info, + bool is_amf_onboarding_capability, + int amf_onboarding_capability +) +{ + OpenAPI_nrf_info_served_amf_info_value_t *nrf_info_served_amf_info_value_local_var = ogs_malloc(sizeof(OpenAPI_nrf_info_served_amf_info_value_t)); + ogs_assert(nrf_info_served_amf_info_value_local_var); + + nrf_info_served_amf_info_value_local_var->amf_set_id = amf_set_id; + nrf_info_served_amf_info_value_local_var->amf_region_id = amf_region_id; + nrf_info_served_amf_info_value_local_var->guami_list = guami_list; + nrf_info_served_amf_info_value_local_var->tai_list = tai_list; + nrf_info_served_amf_info_value_local_var->tai_range_list = tai_range_list; + nrf_info_served_amf_info_value_local_var->backup_info_amf_failure = backup_info_amf_failure; + nrf_info_served_amf_info_value_local_var->backup_info_amf_removal = backup_info_amf_removal; + nrf_info_served_amf_info_value_local_var->n2_interface_amf_info = n2_interface_amf_info; + nrf_info_served_amf_info_value_local_var->is_amf_onboarding_capability = is_amf_onboarding_capability; + nrf_info_served_amf_info_value_local_var->amf_onboarding_capability = amf_onboarding_capability; + + return nrf_info_served_amf_info_value_local_var; +} + +void OpenAPI_nrf_info_served_amf_info_value_free(OpenAPI_nrf_info_served_amf_info_value_t *nrf_info_served_amf_info_value) +{ + OpenAPI_lnode_t *node = NULL; + + if (NULL == nrf_info_served_amf_info_value) { + return; + } + if (nrf_info_served_amf_info_value->amf_set_id) { + ogs_free(nrf_info_served_amf_info_value->amf_set_id); + nrf_info_served_amf_info_value->amf_set_id = NULL; + } + if (nrf_info_served_amf_info_value->amf_region_id) { + ogs_free(nrf_info_served_amf_info_value->amf_region_id); + nrf_info_served_amf_info_value->amf_region_id = NULL; + } + if (nrf_info_served_amf_info_value->guami_list) { + OpenAPI_list_for_each(nrf_info_served_amf_info_value->guami_list, node) { + OpenAPI_guami_free(node->data); + } + OpenAPI_list_free(nrf_info_served_amf_info_value->guami_list); + nrf_info_served_amf_info_value->guami_list = NULL; + } + if (nrf_info_served_amf_info_value->tai_list) { + OpenAPI_list_for_each(nrf_info_served_amf_info_value->tai_list, node) { + OpenAPI_tai_free(node->data); + } + OpenAPI_list_free(nrf_info_served_amf_info_value->tai_list); + nrf_info_served_amf_info_value->tai_list = NULL; + } + if (nrf_info_served_amf_info_value->tai_range_list) { + OpenAPI_list_for_each(nrf_info_served_amf_info_value->tai_range_list, node) { + OpenAPI_tai_range_free(node->data); + } + OpenAPI_list_free(nrf_info_served_amf_info_value->tai_range_list); + nrf_info_served_amf_info_value->tai_range_list = NULL; + } + if (nrf_info_served_amf_info_value->backup_info_amf_failure) { + OpenAPI_list_for_each(nrf_info_served_amf_info_value->backup_info_amf_failure, node) { + OpenAPI_guami_free(node->data); + } + OpenAPI_list_free(nrf_info_served_amf_info_value->backup_info_amf_failure); + nrf_info_served_amf_info_value->backup_info_amf_failure = NULL; + } + if (nrf_info_served_amf_info_value->backup_info_amf_removal) { + OpenAPI_list_for_each(nrf_info_served_amf_info_value->backup_info_amf_removal, node) { + OpenAPI_guami_free(node->data); + } + OpenAPI_list_free(nrf_info_served_amf_info_value->backup_info_amf_removal); + nrf_info_served_amf_info_value->backup_info_amf_removal = NULL; + } + if (nrf_info_served_amf_info_value->n2_interface_amf_info) { + OpenAPI_n2_interface_amf_info_free(nrf_info_served_amf_info_value->n2_interface_amf_info); + nrf_info_served_amf_info_value->n2_interface_amf_info = NULL; + } + ogs_free(nrf_info_served_amf_info_value); +} + +cJSON *OpenAPI_nrf_info_served_amf_info_value_convertToJSON(OpenAPI_nrf_info_served_amf_info_value_t *nrf_info_served_amf_info_value) +{ + cJSON *item = NULL; + OpenAPI_lnode_t *node = NULL; + + if (nrf_info_served_amf_info_value == NULL) { + ogs_error("OpenAPI_nrf_info_served_amf_info_value_convertToJSON() failed [NrfInfo_servedAmfInfo_value]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (!nrf_info_served_amf_info_value->amf_set_id) { + ogs_error("OpenAPI_nrf_info_served_amf_info_value_convertToJSON() failed [amf_set_id]"); + return NULL; + } + if (cJSON_AddStringToObject(item, "amfSetId", nrf_info_served_amf_info_value->amf_set_id) == NULL) { + ogs_error("OpenAPI_nrf_info_served_amf_info_value_convertToJSON() failed [amf_set_id]"); + goto end; + } + + if (!nrf_info_served_amf_info_value->amf_region_id) { + ogs_error("OpenAPI_nrf_info_served_amf_info_value_convertToJSON() failed [amf_region_id]"); + return NULL; + } + if (cJSON_AddStringToObject(item, "amfRegionId", nrf_info_served_amf_info_value->amf_region_id) == NULL) { + ogs_error("OpenAPI_nrf_info_served_amf_info_value_convertToJSON() failed [amf_region_id]"); + goto end; + } + + if (!nrf_info_served_amf_info_value->guami_list) { + ogs_error("OpenAPI_nrf_info_served_amf_info_value_convertToJSON() failed [guami_list]"); + return NULL; + } + cJSON *guami_listList = cJSON_AddArrayToObject(item, "guamiList"); + if (guami_listList == NULL) { + ogs_error("OpenAPI_nrf_info_served_amf_info_value_convertToJSON() failed [guami_list]"); + goto end; + } + OpenAPI_list_for_each(nrf_info_served_amf_info_value->guami_list, node) { + cJSON *itemLocal = OpenAPI_guami_convertToJSON(node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_nrf_info_served_amf_info_value_convertToJSON() failed [guami_list]"); + goto end; + } + cJSON_AddItemToArray(guami_listList, itemLocal); + } + + if (nrf_info_served_amf_info_value->tai_list) { + cJSON *tai_listList = cJSON_AddArrayToObject(item, "taiList"); + if (tai_listList == NULL) { + ogs_error("OpenAPI_nrf_info_served_amf_info_value_convertToJSON() failed [tai_list]"); + goto end; + } + OpenAPI_list_for_each(nrf_info_served_amf_info_value->tai_list, node) { + cJSON *itemLocal = OpenAPI_tai_convertToJSON(node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_nrf_info_served_amf_info_value_convertToJSON() failed [tai_list]"); + goto end; + } + cJSON_AddItemToArray(tai_listList, itemLocal); + } + } + + if (nrf_info_served_amf_info_value->tai_range_list) { + cJSON *tai_range_listList = cJSON_AddArrayToObject(item, "taiRangeList"); + if (tai_range_listList == NULL) { + ogs_error("OpenAPI_nrf_info_served_amf_info_value_convertToJSON() failed [tai_range_list]"); + goto end; + } + OpenAPI_list_for_each(nrf_info_served_amf_info_value->tai_range_list, node) { + cJSON *itemLocal = OpenAPI_tai_range_convertToJSON(node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_nrf_info_served_amf_info_value_convertToJSON() failed [tai_range_list]"); + goto end; + } + cJSON_AddItemToArray(tai_range_listList, itemLocal); + } + } + + if (nrf_info_served_amf_info_value->backup_info_amf_failure) { + cJSON *backup_info_amf_failureList = cJSON_AddArrayToObject(item, "backupInfoAmfFailure"); + if (backup_info_amf_failureList == NULL) { + ogs_error("OpenAPI_nrf_info_served_amf_info_value_convertToJSON() failed [backup_info_amf_failure]"); + goto end; + } + OpenAPI_list_for_each(nrf_info_served_amf_info_value->backup_info_amf_failure, node) { + cJSON *itemLocal = OpenAPI_guami_convertToJSON(node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_nrf_info_served_amf_info_value_convertToJSON() failed [backup_info_amf_failure]"); + goto end; + } + cJSON_AddItemToArray(backup_info_amf_failureList, itemLocal); + } + } + + if (nrf_info_served_amf_info_value->backup_info_amf_removal) { + cJSON *backup_info_amf_removalList = cJSON_AddArrayToObject(item, "backupInfoAmfRemoval"); + if (backup_info_amf_removalList == NULL) { + ogs_error("OpenAPI_nrf_info_served_amf_info_value_convertToJSON() failed [backup_info_amf_removal]"); + goto end; + } + OpenAPI_list_for_each(nrf_info_served_amf_info_value->backup_info_amf_removal, node) { + cJSON *itemLocal = OpenAPI_guami_convertToJSON(node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_nrf_info_served_amf_info_value_convertToJSON() failed [backup_info_amf_removal]"); + goto end; + } + cJSON_AddItemToArray(backup_info_amf_removalList, itemLocal); + } + } + + if (nrf_info_served_amf_info_value->n2_interface_amf_info) { + cJSON *n2_interface_amf_info_local_JSON = OpenAPI_n2_interface_amf_info_convertToJSON(nrf_info_served_amf_info_value->n2_interface_amf_info); + if (n2_interface_amf_info_local_JSON == NULL) { + ogs_error("OpenAPI_nrf_info_served_amf_info_value_convertToJSON() failed [n2_interface_amf_info]"); + goto end; + } + cJSON_AddItemToObject(item, "n2InterfaceAmfInfo", n2_interface_amf_info_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_nrf_info_served_amf_info_value_convertToJSON() failed [n2_interface_amf_info]"); + goto end; + } + } + + if (nrf_info_served_amf_info_value->is_amf_onboarding_capability) { + if (cJSON_AddBoolToObject(item, "amfOnboardingCapability", nrf_info_served_amf_info_value->amf_onboarding_capability) == NULL) { + ogs_error("OpenAPI_nrf_info_served_amf_info_value_convertToJSON() failed [amf_onboarding_capability]"); + goto end; + } + } + +end: + return item; +} + +OpenAPI_nrf_info_served_amf_info_value_t *OpenAPI_nrf_info_served_amf_info_value_parseFromJSON(cJSON *nrf_info_served_amf_info_valueJSON) +{ + OpenAPI_nrf_info_served_amf_info_value_t *nrf_info_served_amf_info_value_local_var = NULL; + OpenAPI_lnode_t *node = NULL; + cJSON *amf_set_id = NULL; + cJSON *amf_region_id = NULL; + cJSON *guami_list = NULL; + OpenAPI_list_t *guami_listList = NULL; + cJSON *tai_list = NULL; + OpenAPI_list_t *tai_listList = NULL; + cJSON *tai_range_list = NULL; + OpenAPI_list_t *tai_range_listList = NULL; + cJSON *backup_info_amf_failure = NULL; + OpenAPI_list_t *backup_info_amf_failureList = NULL; + cJSON *backup_info_amf_removal = NULL; + OpenAPI_list_t *backup_info_amf_removalList = NULL; + cJSON *n2_interface_amf_info = NULL; + OpenAPI_n2_interface_amf_info_t *n2_interface_amf_info_local_nonprim = NULL; + cJSON *amf_onboarding_capability = NULL; + amf_set_id = cJSON_GetObjectItemCaseSensitive(nrf_info_served_amf_info_valueJSON, "amfSetId"); + if (!amf_set_id) { + ogs_error("OpenAPI_nrf_info_served_amf_info_value_parseFromJSON() failed [amf_set_id]"); + goto end; + } + if (!cJSON_IsString(amf_set_id)) { + ogs_error("OpenAPI_nrf_info_served_amf_info_value_parseFromJSON() failed [amf_set_id]"); + goto end; + } + + amf_region_id = cJSON_GetObjectItemCaseSensitive(nrf_info_served_amf_info_valueJSON, "amfRegionId"); + if (!amf_region_id) { + ogs_error("OpenAPI_nrf_info_served_amf_info_value_parseFromJSON() failed [amf_region_id]"); + goto end; + } + if (!cJSON_IsString(amf_region_id)) { + ogs_error("OpenAPI_nrf_info_served_amf_info_value_parseFromJSON() failed [amf_region_id]"); + goto end; + } + + guami_list = cJSON_GetObjectItemCaseSensitive(nrf_info_served_amf_info_valueJSON, "guamiList"); + if (!guami_list) { + ogs_error("OpenAPI_nrf_info_served_amf_info_value_parseFromJSON() failed [guami_list]"); + goto end; + } + cJSON *guami_list_local = NULL; + if (!cJSON_IsArray(guami_list)) { + ogs_error("OpenAPI_nrf_info_served_amf_info_value_parseFromJSON() failed [guami_list]"); + goto end; + } + + guami_listList = OpenAPI_list_create(); + + cJSON_ArrayForEach(guami_list_local, guami_list) { + if (!cJSON_IsObject(guami_list_local)) { + ogs_error("OpenAPI_nrf_info_served_amf_info_value_parseFromJSON() failed [guami_list]"); + goto end; + } + OpenAPI_guami_t *guami_listItem = OpenAPI_guami_parseFromJSON(guami_list_local); + if (!guami_listItem) { + ogs_error("No guami_listItem"); + OpenAPI_list_free(guami_listList); + goto end; + } + OpenAPI_list_add(guami_listList, guami_listItem); + } + + tai_list = cJSON_GetObjectItemCaseSensitive(nrf_info_served_amf_info_valueJSON, "taiList"); + if (tai_list) { + cJSON *tai_list_local = NULL; + if (!cJSON_IsArray(tai_list)) { + ogs_error("OpenAPI_nrf_info_served_amf_info_value_parseFromJSON() failed [tai_list]"); + goto end; + } + + tai_listList = OpenAPI_list_create(); + + cJSON_ArrayForEach(tai_list_local, tai_list) { + if (!cJSON_IsObject(tai_list_local)) { + ogs_error("OpenAPI_nrf_info_served_amf_info_value_parseFromJSON() failed [tai_list]"); + goto end; + } + OpenAPI_tai_t *tai_listItem = OpenAPI_tai_parseFromJSON(tai_list_local); + if (!tai_listItem) { + ogs_error("No tai_listItem"); + OpenAPI_list_free(tai_listList); + goto end; + } + OpenAPI_list_add(tai_listList, tai_listItem); + } + } + + tai_range_list = cJSON_GetObjectItemCaseSensitive(nrf_info_served_amf_info_valueJSON, "taiRangeList"); + if (tai_range_list) { + cJSON *tai_range_list_local = NULL; + if (!cJSON_IsArray(tai_range_list)) { + ogs_error("OpenAPI_nrf_info_served_amf_info_value_parseFromJSON() failed [tai_range_list]"); + goto end; + } + + tai_range_listList = OpenAPI_list_create(); + + cJSON_ArrayForEach(tai_range_list_local, tai_range_list) { + if (!cJSON_IsObject(tai_range_list_local)) { + ogs_error("OpenAPI_nrf_info_served_amf_info_value_parseFromJSON() failed [tai_range_list]"); + goto end; + } + OpenAPI_tai_range_t *tai_range_listItem = OpenAPI_tai_range_parseFromJSON(tai_range_list_local); + if (!tai_range_listItem) { + ogs_error("No tai_range_listItem"); + OpenAPI_list_free(tai_range_listList); + goto end; + } + OpenAPI_list_add(tai_range_listList, tai_range_listItem); + } + } + + backup_info_amf_failure = cJSON_GetObjectItemCaseSensitive(nrf_info_served_amf_info_valueJSON, "backupInfoAmfFailure"); + if (backup_info_amf_failure) { + cJSON *backup_info_amf_failure_local = NULL; + if (!cJSON_IsArray(backup_info_amf_failure)) { + ogs_error("OpenAPI_nrf_info_served_amf_info_value_parseFromJSON() failed [backup_info_amf_failure]"); + goto end; + } + + backup_info_amf_failureList = OpenAPI_list_create(); + + cJSON_ArrayForEach(backup_info_amf_failure_local, backup_info_amf_failure) { + if (!cJSON_IsObject(backup_info_amf_failure_local)) { + ogs_error("OpenAPI_nrf_info_served_amf_info_value_parseFromJSON() failed [backup_info_amf_failure]"); + goto end; + } + OpenAPI_guami_t *backup_info_amf_failureItem = OpenAPI_guami_parseFromJSON(backup_info_amf_failure_local); + if (!backup_info_amf_failureItem) { + ogs_error("No backup_info_amf_failureItem"); + OpenAPI_list_free(backup_info_amf_failureList); + goto end; + } + OpenAPI_list_add(backup_info_amf_failureList, backup_info_amf_failureItem); + } + } + + backup_info_amf_removal = cJSON_GetObjectItemCaseSensitive(nrf_info_served_amf_info_valueJSON, "backupInfoAmfRemoval"); + if (backup_info_amf_removal) { + cJSON *backup_info_amf_removal_local = NULL; + if (!cJSON_IsArray(backup_info_amf_removal)) { + ogs_error("OpenAPI_nrf_info_served_amf_info_value_parseFromJSON() failed [backup_info_amf_removal]"); + goto end; + } + + backup_info_amf_removalList = OpenAPI_list_create(); + + cJSON_ArrayForEach(backup_info_amf_removal_local, backup_info_amf_removal) { + if (!cJSON_IsObject(backup_info_amf_removal_local)) { + ogs_error("OpenAPI_nrf_info_served_amf_info_value_parseFromJSON() failed [backup_info_amf_removal]"); + goto end; + } + OpenAPI_guami_t *backup_info_amf_removalItem = OpenAPI_guami_parseFromJSON(backup_info_amf_removal_local); + if (!backup_info_amf_removalItem) { + ogs_error("No backup_info_amf_removalItem"); + OpenAPI_list_free(backup_info_amf_removalList); + goto end; + } + OpenAPI_list_add(backup_info_amf_removalList, backup_info_amf_removalItem); + } + } + + n2_interface_amf_info = cJSON_GetObjectItemCaseSensitive(nrf_info_served_amf_info_valueJSON, "n2InterfaceAmfInfo"); + if (n2_interface_amf_info) { + n2_interface_amf_info_local_nonprim = OpenAPI_n2_interface_amf_info_parseFromJSON(n2_interface_amf_info); + } + + amf_onboarding_capability = cJSON_GetObjectItemCaseSensitive(nrf_info_served_amf_info_valueJSON, "amfOnboardingCapability"); + if (amf_onboarding_capability) { + if (!cJSON_IsBool(amf_onboarding_capability)) { + ogs_error("OpenAPI_nrf_info_served_amf_info_value_parseFromJSON() failed [amf_onboarding_capability]"); + goto end; + } + } + + nrf_info_served_amf_info_value_local_var = OpenAPI_nrf_info_served_amf_info_value_create ( + ogs_strdup(amf_set_id->valuestring), + ogs_strdup(amf_region_id->valuestring), + guami_listList, + tai_list ? tai_listList : NULL, + tai_range_list ? tai_range_listList : NULL, + backup_info_amf_failure ? backup_info_amf_failureList : NULL, + backup_info_amf_removal ? backup_info_amf_removalList : NULL, + n2_interface_amf_info ? n2_interface_amf_info_local_nonprim : NULL, + amf_onboarding_capability ? true : false, + amf_onboarding_capability ? amf_onboarding_capability->valueint : 0 + ); + + return nrf_info_served_amf_info_value_local_var; +end: + if (guami_listList) { + OpenAPI_list_for_each(guami_listList, node) { + OpenAPI_guami_free(node->data); + } + OpenAPI_list_free(guami_listList); + guami_listList = NULL; + } + if (tai_listList) { + OpenAPI_list_for_each(tai_listList, node) { + OpenAPI_tai_free(node->data); + } + OpenAPI_list_free(tai_listList); + tai_listList = NULL; + } + if (tai_range_listList) { + OpenAPI_list_for_each(tai_range_listList, node) { + OpenAPI_tai_range_free(node->data); + } + OpenAPI_list_free(tai_range_listList); + tai_range_listList = NULL; + } + if (backup_info_amf_failureList) { + OpenAPI_list_for_each(backup_info_amf_failureList, node) { + OpenAPI_guami_free(node->data); + } + OpenAPI_list_free(backup_info_amf_failureList); + backup_info_amf_failureList = NULL; + } + if (backup_info_amf_removalList) { + OpenAPI_list_for_each(backup_info_amf_removalList, node) { + OpenAPI_guami_free(node->data); + } + OpenAPI_list_free(backup_info_amf_removalList); + backup_info_amf_removalList = NULL; + } + if (n2_interface_amf_info_local_nonprim) { + OpenAPI_n2_interface_amf_info_free(n2_interface_amf_info_local_nonprim); + n2_interface_amf_info_local_nonprim = NULL; + } + return NULL; +} + +OpenAPI_nrf_info_served_amf_info_value_t *OpenAPI_nrf_info_served_amf_info_value_copy(OpenAPI_nrf_info_served_amf_info_value_t *dst, OpenAPI_nrf_info_served_amf_info_value_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_nrf_info_served_amf_info_value_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_nrf_info_served_amf_info_value_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_nrf_info_served_amf_info_value_free(dst); + dst = OpenAPI_nrf_info_served_amf_info_value_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/nrf_info_served_amf_info_value.h b/lib/sbi/openapi/model/nrf_info_served_amf_info_value.h new file mode 100644 index 000000000..3a4b74c6f --- /dev/null +++ b/lib/sbi/openapi/model/nrf_info_served_amf_info_value.h @@ -0,0 +1,61 @@ +/* + * nrf_info_served_amf_info_value.h + * + * + */ + +#ifndef _OpenAPI_nrf_info_served_amf_info_value_H_ +#define _OpenAPI_nrf_info_served_amf_info_value_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "amf_info.h" +#include "guami.h" +#include "n2_interface_amf_info.h" +#include "tai.h" +#include "tai_range.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_nrf_info_served_amf_info_value_s OpenAPI_nrf_info_served_amf_info_value_t; +typedef struct OpenAPI_nrf_info_served_amf_info_value_s { + char *amf_set_id; + char *amf_region_id; + OpenAPI_list_t *guami_list; + OpenAPI_list_t *tai_list; + OpenAPI_list_t *tai_range_list; + OpenAPI_list_t *backup_info_amf_failure; + OpenAPI_list_t *backup_info_amf_removal; + struct OpenAPI_n2_interface_amf_info_s *n2_interface_amf_info; + bool is_amf_onboarding_capability; + int amf_onboarding_capability; +} OpenAPI_nrf_info_served_amf_info_value_t; + +OpenAPI_nrf_info_served_amf_info_value_t *OpenAPI_nrf_info_served_amf_info_value_create( + char *amf_set_id, + char *amf_region_id, + OpenAPI_list_t *guami_list, + OpenAPI_list_t *tai_list, + OpenAPI_list_t *tai_range_list, + OpenAPI_list_t *backup_info_amf_failure, + OpenAPI_list_t *backup_info_amf_removal, + OpenAPI_n2_interface_amf_info_t *n2_interface_amf_info, + bool is_amf_onboarding_capability, + int amf_onboarding_capability +); +void OpenAPI_nrf_info_served_amf_info_value_free(OpenAPI_nrf_info_served_amf_info_value_t *nrf_info_served_amf_info_value); +OpenAPI_nrf_info_served_amf_info_value_t *OpenAPI_nrf_info_served_amf_info_value_parseFromJSON(cJSON *nrf_info_served_amf_info_valueJSON); +cJSON *OpenAPI_nrf_info_served_amf_info_value_convertToJSON(OpenAPI_nrf_info_served_amf_info_value_t *nrf_info_served_amf_info_value); +OpenAPI_nrf_info_served_amf_info_value_t *OpenAPI_nrf_info_served_amf_info_value_copy(OpenAPI_nrf_info_served_amf_info_value_t *dst, OpenAPI_nrf_info_served_amf_info_value_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_nrf_info_served_amf_info_value_H_ */ + diff --git a/lib/sbi/openapi/model/nrf_info_served_ausf_info_value.c b/lib/sbi/openapi/model/nrf_info_served_ausf_info_value.c new file mode 100644 index 000000000..67401920f --- /dev/null +++ b/lib/sbi/openapi/model/nrf_info_served_ausf_info_value.c @@ -0,0 +1,284 @@ + +#include +#include +#include +#include "nrf_info_served_ausf_info_value.h" + +OpenAPI_nrf_info_served_ausf_info_value_t *OpenAPI_nrf_info_served_ausf_info_value_create( + char *group_id, + OpenAPI_list_t *supi_ranges, + OpenAPI_list_t *routing_indicators, + OpenAPI_list_t *suci_infos +) +{ + OpenAPI_nrf_info_served_ausf_info_value_t *nrf_info_served_ausf_info_value_local_var = ogs_malloc(sizeof(OpenAPI_nrf_info_served_ausf_info_value_t)); + ogs_assert(nrf_info_served_ausf_info_value_local_var); + + nrf_info_served_ausf_info_value_local_var->group_id = group_id; + nrf_info_served_ausf_info_value_local_var->supi_ranges = supi_ranges; + nrf_info_served_ausf_info_value_local_var->routing_indicators = routing_indicators; + nrf_info_served_ausf_info_value_local_var->suci_infos = suci_infos; + + return nrf_info_served_ausf_info_value_local_var; +} + +void OpenAPI_nrf_info_served_ausf_info_value_free(OpenAPI_nrf_info_served_ausf_info_value_t *nrf_info_served_ausf_info_value) +{ + OpenAPI_lnode_t *node = NULL; + + if (NULL == nrf_info_served_ausf_info_value) { + return; + } + if (nrf_info_served_ausf_info_value->group_id) { + ogs_free(nrf_info_served_ausf_info_value->group_id); + nrf_info_served_ausf_info_value->group_id = NULL; + } + if (nrf_info_served_ausf_info_value->supi_ranges) { + OpenAPI_list_for_each(nrf_info_served_ausf_info_value->supi_ranges, node) { + OpenAPI_supi_range_free(node->data); + } + OpenAPI_list_free(nrf_info_served_ausf_info_value->supi_ranges); + nrf_info_served_ausf_info_value->supi_ranges = NULL; + } + if (nrf_info_served_ausf_info_value->routing_indicators) { + OpenAPI_list_for_each(nrf_info_served_ausf_info_value->routing_indicators, node) { + ogs_free(node->data); + } + OpenAPI_list_free(nrf_info_served_ausf_info_value->routing_indicators); + nrf_info_served_ausf_info_value->routing_indicators = NULL; + } + if (nrf_info_served_ausf_info_value->suci_infos) { + OpenAPI_list_for_each(nrf_info_served_ausf_info_value->suci_infos, node) { + OpenAPI_suci_info_free(node->data); + } + OpenAPI_list_free(nrf_info_served_ausf_info_value->suci_infos); + nrf_info_served_ausf_info_value->suci_infos = NULL; + } + ogs_free(nrf_info_served_ausf_info_value); +} + +cJSON *OpenAPI_nrf_info_served_ausf_info_value_convertToJSON(OpenAPI_nrf_info_served_ausf_info_value_t *nrf_info_served_ausf_info_value) +{ + cJSON *item = NULL; + OpenAPI_lnode_t *node = NULL; + + if (nrf_info_served_ausf_info_value == NULL) { + ogs_error("OpenAPI_nrf_info_served_ausf_info_value_convertToJSON() failed [NrfInfo_servedAusfInfo_value]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (nrf_info_served_ausf_info_value->group_id) { + if (cJSON_AddStringToObject(item, "groupId", nrf_info_served_ausf_info_value->group_id) == NULL) { + ogs_error("OpenAPI_nrf_info_served_ausf_info_value_convertToJSON() failed [group_id]"); + goto end; + } + } + + if (nrf_info_served_ausf_info_value->supi_ranges) { + cJSON *supi_rangesList = cJSON_AddArrayToObject(item, "supiRanges"); + if (supi_rangesList == NULL) { + ogs_error("OpenAPI_nrf_info_served_ausf_info_value_convertToJSON() failed [supi_ranges]"); + goto end; + } + OpenAPI_list_for_each(nrf_info_served_ausf_info_value->supi_ranges, node) { + cJSON *itemLocal = OpenAPI_supi_range_convertToJSON(node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_nrf_info_served_ausf_info_value_convertToJSON() failed [supi_ranges]"); + goto end; + } + cJSON_AddItemToArray(supi_rangesList, itemLocal); + } + } + + if (nrf_info_served_ausf_info_value->routing_indicators) { + cJSON *routing_indicatorsList = cJSON_AddArrayToObject(item, "routingIndicators"); + if (routing_indicatorsList == NULL) { + ogs_error("OpenAPI_nrf_info_served_ausf_info_value_convertToJSON() failed [routing_indicators]"); + goto end; + } + OpenAPI_list_for_each(nrf_info_served_ausf_info_value->routing_indicators, node) { + if (cJSON_AddStringToObject(routing_indicatorsList, "", (char*)node->data) == NULL) { + ogs_error("OpenAPI_nrf_info_served_ausf_info_value_convertToJSON() failed [routing_indicators]"); + goto end; + } + } + } + + if (nrf_info_served_ausf_info_value->suci_infos) { + cJSON *suci_infosList = cJSON_AddArrayToObject(item, "suciInfos"); + if (suci_infosList == NULL) { + ogs_error("OpenAPI_nrf_info_served_ausf_info_value_convertToJSON() failed [suci_infos]"); + goto end; + } + OpenAPI_list_for_each(nrf_info_served_ausf_info_value->suci_infos, node) { + cJSON *itemLocal = OpenAPI_suci_info_convertToJSON(node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_nrf_info_served_ausf_info_value_convertToJSON() failed [suci_infos]"); + goto end; + } + cJSON_AddItemToArray(suci_infosList, itemLocal); + } + } + +end: + return item; +} + +OpenAPI_nrf_info_served_ausf_info_value_t *OpenAPI_nrf_info_served_ausf_info_value_parseFromJSON(cJSON *nrf_info_served_ausf_info_valueJSON) +{ + OpenAPI_nrf_info_served_ausf_info_value_t *nrf_info_served_ausf_info_value_local_var = NULL; + OpenAPI_lnode_t *node = NULL; + cJSON *group_id = NULL; + cJSON *supi_ranges = NULL; + OpenAPI_list_t *supi_rangesList = NULL; + cJSON *routing_indicators = NULL; + OpenAPI_list_t *routing_indicatorsList = NULL; + cJSON *suci_infos = NULL; + OpenAPI_list_t *suci_infosList = NULL; + group_id = cJSON_GetObjectItemCaseSensitive(nrf_info_served_ausf_info_valueJSON, "groupId"); + if (group_id) { + if (!cJSON_IsString(group_id) && !cJSON_IsNull(group_id)) { + ogs_error("OpenAPI_nrf_info_served_ausf_info_value_parseFromJSON() failed [group_id]"); + goto end; + } + } + + supi_ranges = cJSON_GetObjectItemCaseSensitive(nrf_info_served_ausf_info_valueJSON, "supiRanges"); + if (supi_ranges) { + cJSON *supi_ranges_local = NULL; + if (!cJSON_IsArray(supi_ranges)) { + ogs_error("OpenAPI_nrf_info_served_ausf_info_value_parseFromJSON() failed [supi_ranges]"); + goto end; + } + + supi_rangesList = OpenAPI_list_create(); + + cJSON_ArrayForEach(supi_ranges_local, supi_ranges) { + if (!cJSON_IsObject(supi_ranges_local)) { + ogs_error("OpenAPI_nrf_info_served_ausf_info_value_parseFromJSON() failed [supi_ranges]"); + goto end; + } + OpenAPI_supi_range_t *supi_rangesItem = OpenAPI_supi_range_parseFromJSON(supi_ranges_local); + if (!supi_rangesItem) { + ogs_error("No supi_rangesItem"); + OpenAPI_list_free(supi_rangesList); + goto end; + } + OpenAPI_list_add(supi_rangesList, supi_rangesItem); + } + } + + routing_indicators = cJSON_GetObjectItemCaseSensitive(nrf_info_served_ausf_info_valueJSON, "routingIndicators"); + if (routing_indicators) { + cJSON *routing_indicators_local = NULL; + if (!cJSON_IsArray(routing_indicators)) { + ogs_error("OpenAPI_nrf_info_served_ausf_info_value_parseFromJSON() failed [routing_indicators]"); + goto end; + } + + routing_indicatorsList = OpenAPI_list_create(); + + cJSON_ArrayForEach(routing_indicators_local, routing_indicators) { + double *localDouble = NULL; + int *localInt = NULL; + if (!cJSON_IsString(routing_indicators_local)) { + ogs_error("OpenAPI_nrf_info_served_ausf_info_value_parseFromJSON() failed [routing_indicators]"); + goto end; + } + OpenAPI_list_add(routing_indicatorsList, ogs_strdup(routing_indicators_local->valuestring)); + } + } + + suci_infos = cJSON_GetObjectItemCaseSensitive(nrf_info_served_ausf_info_valueJSON, "suciInfos"); + if (suci_infos) { + cJSON *suci_infos_local = NULL; + if (!cJSON_IsArray(suci_infos)) { + ogs_error("OpenAPI_nrf_info_served_ausf_info_value_parseFromJSON() failed [suci_infos]"); + goto end; + } + + suci_infosList = OpenAPI_list_create(); + + cJSON_ArrayForEach(suci_infos_local, suci_infos) { + if (!cJSON_IsObject(suci_infos_local)) { + ogs_error("OpenAPI_nrf_info_served_ausf_info_value_parseFromJSON() failed [suci_infos]"); + goto end; + } + OpenAPI_suci_info_t *suci_infosItem = OpenAPI_suci_info_parseFromJSON(suci_infos_local); + if (!suci_infosItem) { + ogs_error("No suci_infosItem"); + OpenAPI_list_free(suci_infosList); + goto end; + } + OpenAPI_list_add(suci_infosList, suci_infosItem); + } + } + + nrf_info_served_ausf_info_value_local_var = OpenAPI_nrf_info_served_ausf_info_value_create ( + group_id && !cJSON_IsNull(group_id) ? ogs_strdup(group_id->valuestring) : NULL, + supi_ranges ? supi_rangesList : NULL, + routing_indicators ? routing_indicatorsList : NULL, + suci_infos ? suci_infosList : NULL + ); + + return nrf_info_served_ausf_info_value_local_var; +end: + if (supi_rangesList) { + OpenAPI_list_for_each(supi_rangesList, node) { + OpenAPI_supi_range_free(node->data); + } + OpenAPI_list_free(supi_rangesList); + supi_rangesList = NULL; + } + if (routing_indicatorsList) { + OpenAPI_list_for_each(routing_indicatorsList, node) { + ogs_free(node->data); + } + OpenAPI_list_free(routing_indicatorsList); + routing_indicatorsList = NULL; + } + if (suci_infosList) { + OpenAPI_list_for_each(suci_infosList, node) { + OpenAPI_suci_info_free(node->data); + } + OpenAPI_list_free(suci_infosList); + suci_infosList = NULL; + } + return NULL; +} + +OpenAPI_nrf_info_served_ausf_info_value_t *OpenAPI_nrf_info_served_ausf_info_value_copy(OpenAPI_nrf_info_served_ausf_info_value_t *dst, OpenAPI_nrf_info_served_ausf_info_value_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_nrf_info_served_ausf_info_value_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_nrf_info_served_ausf_info_value_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_nrf_info_served_ausf_info_value_free(dst); + dst = OpenAPI_nrf_info_served_ausf_info_value_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/nrf_info_served_ausf_info_value.h b/lib/sbi/openapi/model/nrf_info_served_ausf_info_value.h new file mode 100644 index 000000000..e2a72e49b --- /dev/null +++ b/lib/sbi/openapi/model/nrf_info_served_ausf_info_value.h @@ -0,0 +1,47 @@ +/* + * nrf_info_served_ausf_info_value.h + * + * + */ + +#ifndef _OpenAPI_nrf_info_served_ausf_info_value_H_ +#define _OpenAPI_nrf_info_served_ausf_info_value_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "ausf_info.h" +#include "suci_info.h" +#include "supi_range.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_nrf_info_served_ausf_info_value_s OpenAPI_nrf_info_served_ausf_info_value_t; +typedef struct OpenAPI_nrf_info_served_ausf_info_value_s { + char *group_id; + OpenAPI_list_t *supi_ranges; + OpenAPI_list_t *routing_indicators; + OpenAPI_list_t *suci_infos; +} OpenAPI_nrf_info_served_ausf_info_value_t; + +OpenAPI_nrf_info_served_ausf_info_value_t *OpenAPI_nrf_info_served_ausf_info_value_create( + char *group_id, + OpenAPI_list_t *supi_ranges, + OpenAPI_list_t *routing_indicators, + OpenAPI_list_t *suci_infos +); +void OpenAPI_nrf_info_served_ausf_info_value_free(OpenAPI_nrf_info_served_ausf_info_value_t *nrf_info_served_ausf_info_value); +OpenAPI_nrf_info_served_ausf_info_value_t *OpenAPI_nrf_info_served_ausf_info_value_parseFromJSON(cJSON *nrf_info_served_ausf_info_valueJSON); +cJSON *OpenAPI_nrf_info_served_ausf_info_value_convertToJSON(OpenAPI_nrf_info_served_ausf_info_value_t *nrf_info_served_ausf_info_value); +OpenAPI_nrf_info_served_ausf_info_value_t *OpenAPI_nrf_info_served_ausf_info_value_copy(OpenAPI_nrf_info_served_ausf_info_value_t *dst, OpenAPI_nrf_info_served_ausf_info_value_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_nrf_info_served_ausf_info_value_H_ */ + diff --git a/lib/sbi/openapi/model/nrf_info_served_bsf_info_value.c b/lib/sbi/openapi/model/nrf_info_served_bsf_info_value.c new file mode 100644 index 000000000..00ebfd567 --- /dev/null +++ b/lib/sbi/openapi/model/nrf_info_served_bsf_info_value.c @@ -0,0 +1,504 @@ + +#include +#include +#include +#include "nrf_info_served_bsf_info_value.h" + +OpenAPI_nrf_info_served_bsf_info_value_t *OpenAPI_nrf_info_served_bsf_info_value_create( + OpenAPI_list_t *dnn_list, + OpenAPI_list_t *ip_domain_list, + OpenAPI_list_t *ipv4_address_ranges, + OpenAPI_list_t *ipv6_prefix_ranges, + char *rx_diam_host, + char *rx_diam_realm, + char *group_id, + OpenAPI_list_t *supi_ranges, + OpenAPI_list_t *gpsi_ranges +) +{ + OpenAPI_nrf_info_served_bsf_info_value_t *nrf_info_served_bsf_info_value_local_var = ogs_malloc(sizeof(OpenAPI_nrf_info_served_bsf_info_value_t)); + ogs_assert(nrf_info_served_bsf_info_value_local_var); + + nrf_info_served_bsf_info_value_local_var->dnn_list = dnn_list; + nrf_info_served_bsf_info_value_local_var->ip_domain_list = ip_domain_list; + nrf_info_served_bsf_info_value_local_var->ipv4_address_ranges = ipv4_address_ranges; + nrf_info_served_bsf_info_value_local_var->ipv6_prefix_ranges = ipv6_prefix_ranges; + nrf_info_served_bsf_info_value_local_var->rx_diam_host = rx_diam_host; + nrf_info_served_bsf_info_value_local_var->rx_diam_realm = rx_diam_realm; + nrf_info_served_bsf_info_value_local_var->group_id = group_id; + nrf_info_served_bsf_info_value_local_var->supi_ranges = supi_ranges; + nrf_info_served_bsf_info_value_local_var->gpsi_ranges = gpsi_ranges; + + return nrf_info_served_bsf_info_value_local_var; +} + +void OpenAPI_nrf_info_served_bsf_info_value_free(OpenAPI_nrf_info_served_bsf_info_value_t *nrf_info_served_bsf_info_value) +{ + OpenAPI_lnode_t *node = NULL; + + if (NULL == nrf_info_served_bsf_info_value) { + return; + } + if (nrf_info_served_bsf_info_value->dnn_list) { + OpenAPI_list_for_each(nrf_info_served_bsf_info_value->dnn_list, node) { + ogs_free(node->data); + } + OpenAPI_list_free(nrf_info_served_bsf_info_value->dnn_list); + nrf_info_served_bsf_info_value->dnn_list = NULL; + } + if (nrf_info_served_bsf_info_value->ip_domain_list) { + OpenAPI_list_for_each(nrf_info_served_bsf_info_value->ip_domain_list, node) { + ogs_free(node->data); + } + OpenAPI_list_free(nrf_info_served_bsf_info_value->ip_domain_list); + nrf_info_served_bsf_info_value->ip_domain_list = NULL; + } + if (nrf_info_served_bsf_info_value->ipv4_address_ranges) { + OpenAPI_list_for_each(nrf_info_served_bsf_info_value->ipv4_address_ranges, node) { + OpenAPI_ipv4_address_range_free(node->data); + } + OpenAPI_list_free(nrf_info_served_bsf_info_value->ipv4_address_ranges); + nrf_info_served_bsf_info_value->ipv4_address_ranges = NULL; + } + if (nrf_info_served_bsf_info_value->ipv6_prefix_ranges) { + OpenAPI_list_for_each(nrf_info_served_bsf_info_value->ipv6_prefix_ranges, node) { + OpenAPI_ipv6_prefix_range_free(node->data); + } + OpenAPI_list_free(nrf_info_served_bsf_info_value->ipv6_prefix_ranges); + nrf_info_served_bsf_info_value->ipv6_prefix_ranges = NULL; + } + if (nrf_info_served_bsf_info_value->rx_diam_host) { + ogs_free(nrf_info_served_bsf_info_value->rx_diam_host); + nrf_info_served_bsf_info_value->rx_diam_host = NULL; + } + if (nrf_info_served_bsf_info_value->rx_diam_realm) { + ogs_free(nrf_info_served_bsf_info_value->rx_diam_realm); + nrf_info_served_bsf_info_value->rx_diam_realm = NULL; + } + if (nrf_info_served_bsf_info_value->group_id) { + ogs_free(nrf_info_served_bsf_info_value->group_id); + nrf_info_served_bsf_info_value->group_id = NULL; + } + if (nrf_info_served_bsf_info_value->supi_ranges) { + OpenAPI_list_for_each(nrf_info_served_bsf_info_value->supi_ranges, node) { + OpenAPI_supi_range_free(node->data); + } + OpenAPI_list_free(nrf_info_served_bsf_info_value->supi_ranges); + nrf_info_served_bsf_info_value->supi_ranges = NULL; + } + if (nrf_info_served_bsf_info_value->gpsi_ranges) { + OpenAPI_list_for_each(nrf_info_served_bsf_info_value->gpsi_ranges, node) { + OpenAPI_identity_range_free(node->data); + } + OpenAPI_list_free(nrf_info_served_bsf_info_value->gpsi_ranges); + nrf_info_served_bsf_info_value->gpsi_ranges = NULL; + } + ogs_free(nrf_info_served_bsf_info_value); +} + +cJSON *OpenAPI_nrf_info_served_bsf_info_value_convertToJSON(OpenAPI_nrf_info_served_bsf_info_value_t *nrf_info_served_bsf_info_value) +{ + cJSON *item = NULL; + OpenAPI_lnode_t *node = NULL; + + if (nrf_info_served_bsf_info_value == NULL) { + ogs_error("OpenAPI_nrf_info_served_bsf_info_value_convertToJSON() failed [NrfInfo_servedBsfInfo_value]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (nrf_info_served_bsf_info_value->dnn_list) { + cJSON *dnn_listList = cJSON_AddArrayToObject(item, "dnnList"); + if (dnn_listList == NULL) { + ogs_error("OpenAPI_nrf_info_served_bsf_info_value_convertToJSON() failed [dnn_list]"); + goto end; + } + OpenAPI_list_for_each(nrf_info_served_bsf_info_value->dnn_list, node) { + if (cJSON_AddStringToObject(dnn_listList, "", (char*)node->data) == NULL) { + ogs_error("OpenAPI_nrf_info_served_bsf_info_value_convertToJSON() failed [dnn_list]"); + goto end; + } + } + } + + if (nrf_info_served_bsf_info_value->ip_domain_list) { + cJSON *ip_domain_listList = cJSON_AddArrayToObject(item, "ipDomainList"); + if (ip_domain_listList == NULL) { + ogs_error("OpenAPI_nrf_info_served_bsf_info_value_convertToJSON() failed [ip_domain_list]"); + goto end; + } + OpenAPI_list_for_each(nrf_info_served_bsf_info_value->ip_domain_list, node) { + if (cJSON_AddStringToObject(ip_domain_listList, "", (char*)node->data) == NULL) { + ogs_error("OpenAPI_nrf_info_served_bsf_info_value_convertToJSON() failed [ip_domain_list]"); + goto end; + } + } + } + + if (nrf_info_served_bsf_info_value->ipv4_address_ranges) { + cJSON *ipv4_address_rangesList = cJSON_AddArrayToObject(item, "ipv4AddressRanges"); + if (ipv4_address_rangesList == NULL) { + ogs_error("OpenAPI_nrf_info_served_bsf_info_value_convertToJSON() failed [ipv4_address_ranges]"); + goto end; + } + OpenAPI_list_for_each(nrf_info_served_bsf_info_value->ipv4_address_ranges, node) { + cJSON *itemLocal = OpenAPI_ipv4_address_range_convertToJSON(node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_nrf_info_served_bsf_info_value_convertToJSON() failed [ipv4_address_ranges]"); + goto end; + } + cJSON_AddItemToArray(ipv4_address_rangesList, itemLocal); + } + } + + if (nrf_info_served_bsf_info_value->ipv6_prefix_ranges) { + cJSON *ipv6_prefix_rangesList = cJSON_AddArrayToObject(item, "ipv6PrefixRanges"); + if (ipv6_prefix_rangesList == NULL) { + ogs_error("OpenAPI_nrf_info_served_bsf_info_value_convertToJSON() failed [ipv6_prefix_ranges]"); + goto end; + } + OpenAPI_list_for_each(nrf_info_served_bsf_info_value->ipv6_prefix_ranges, node) { + cJSON *itemLocal = OpenAPI_ipv6_prefix_range_convertToJSON(node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_nrf_info_served_bsf_info_value_convertToJSON() failed [ipv6_prefix_ranges]"); + goto end; + } + cJSON_AddItemToArray(ipv6_prefix_rangesList, itemLocal); + } + } + + if (nrf_info_served_bsf_info_value->rx_diam_host) { + if (cJSON_AddStringToObject(item, "rxDiamHost", nrf_info_served_bsf_info_value->rx_diam_host) == NULL) { + ogs_error("OpenAPI_nrf_info_served_bsf_info_value_convertToJSON() failed [rx_diam_host]"); + goto end; + } + } + + if (nrf_info_served_bsf_info_value->rx_diam_realm) { + if (cJSON_AddStringToObject(item, "rxDiamRealm", nrf_info_served_bsf_info_value->rx_diam_realm) == NULL) { + ogs_error("OpenAPI_nrf_info_served_bsf_info_value_convertToJSON() failed [rx_diam_realm]"); + goto end; + } + } + + if (nrf_info_served_bsf_info_value->group_id) { + if (cJSON_AddStringToObject(item, "groupId", nrf_info_served_bsf_info_value->group_id) == NULL) { + ogs_error("OpenAPI_nrf_info_served_bsf_info_value_convertToJSON() failed [group_id]"); + goto end; + } + } + + if (nrf_info_served_bsf_info_value->supi_ranges) { + cJSON *supi_rangesList = cJSON_AddArrayToObject(item, "supiRanges"); + if (supi_rangesList == NULL) { + ogs_error("OpenAPI_nrf_info_served_bsf_info_value_convertToJSON() failed [supi_ranges]"); + goto end; + } + OpenAPI_list_for_each(nrf_info_served_bsf_info_value->supi_ranges, node) { + cJSON *itemLocal = OpenAPI_supi_range_convertToJSON(node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_nrf_info_served_bsf_info_value_convertToJSON() failed [supi_ranges]"); + goto end; + } + cJSON_AddItemToArray(supi_rangesList, itemLocal); + } + } + + if (nrf_info_served_bsf_info_value->gpsi_ranges) { + cJSON *gpsi_rangesList = cJSON_AddArrayToObject(item, "gpsiRanges"); + if (gpsi_rangesList == NULL) { + ogs_error("OpenAPI_nrf_info_served_bsf_info_value_convertToJSON() failed [gpsi_ranges]"); + goto end; + } + OpenAPI_list_for_each(nrf_info_served_bsf_info_value->gpsi_ranges, node) { + cJSON *itemLocal = OpenAPI_identity_range_convertToJSON(node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_nrf_info_served_bsf_info_value_convertToJSON() failed [gpsi_ranges]"); + goto end; + } + cJSON_AddItemToArray(gpsi_rangesList, itemLocal); + } + } + +end: + return item; +} + +OpenAPI_nrf_info_served_bsf_info_value_t *OpenAPI_nrf_info_served_bsf_info_value_parseFromJSON(cJSON *nrf_info_served_bsf_info_valueJSON) +{ + OpenAPI_nrf_info_served_bsf_info_value_t *nrf_info_served_bsf_info_value_local_var = NULL; + OpenAPI_lnode_t *node = NULL; + cJSON *dnn_list = NULL; + OpenAPI_list_t *dnn_listList = NULL; + cJSON *ip_domain_list = NULL; + OpenAPI_list_t *ip_domain_listList = NULL; + cJSON *ipv4_address_ranges = NULL; + OpenAPI_list_t *ipv4_address_rangesList = NULL; + cJSON *ipv6_prefix_ranges = NULL; + OpenAPI_list_t *ipv6_prefix_rangesList = NULL; + cJSON *rx_diam_host = NULL; + cJSON *rx_diam_realm = NULL; + cJSON *group_id = NULL; + cJSON *supi_ranges = NULL; + OpenAPI_list_t *supi_rangesList = NULL; + cJSON *gpsi_ranges = NULL; + OpenAPI_list_t *gpsi_rangesList = NULL; + dnn_list = cJSON_GetObjectItemCaseSensitive(nrf_info_served_bsf_info_valueJSON, "dnnList"); + if (dnn_list) { + cJSON *dnn_list_local = NULL; + if (!cJSON_IsArray(dnn_list)) { + ogs_error("OpenAPI_nrf_info_served_bsf_info_value_parseFromJSON() failed [dnn_list]"); + goto end; + } + + dnn_listList = OpenAPI_list_create(); + + cJSON_ArrayForEach(dnn_list_local, dnn_list) { + double *localDouble = NULL; + int *localInt = NULL; + if (!cJSON_IsString(dnn_list_local)) { + ogs_error("OpenAPI_nrf_info_served_bsf_info_value_parseFromJSON() failed [dnn_list]"); + goto end; + } + OpenAPI_list_add(dnn_listList, ogs_strdup(dnn_list_local->valuestring)); + } + } + + ip_domain_list = cJSON_GetObjectItemCaseSensitive(nrf_info_served_bsf_info_valueJSON, "ipDomainList"); + if (ip_domain_list) { + cJSON *ip_domain_list_local = NULL; + if (!cJSON_IsArray(ip_domain_list)) { + ogs_error("OpenAPI_nrf_info_served_bsf_info_value_parseFromJSON() failed [ip_domain_list]"); + goto end; + } + + ip_domain_listList = OpenAPI_list_create(); + + cJSON_ArrayForEach(ip_domain_list_local, ip_domain_list) { + double *localDouble = NULL; + int *localInt = NULL; + if (!cJSON_IsString(ip_domain_list_local)) { + ogs_error("OpenAPI_nrf_info_served_bsf_info_value_parseFromJSON() failed [ip_domain_list]"); + goto end; + } + OpenAPI_list_add(ip_domain_listList, ogs_strdup(ip_domain_list_local->valuestring)); + } + } + + ipv4_address_ranges = cJSON_GetObjectItemCaseSensitive(nrf_info_served_bsf_info_valueJSON, "ipv4AddressRanges"); + if (ipv4_address_ranges) { + cJSON *ipv4_address_ranges_local = NULL; + if (!cJSON_IsArray(ipv4_address_ranges)) { + ogs_error("OpenAPI_nrf_info_served_bsf_info_value_parseFromJSON() failed [ipv4_address_ranges]"); + goto end; + } + + ipv4_address_rangesList = OpenAPI_list_create(); + + cJSON_ArrayForEach(ipv4_address_ranges_local, ipv4_address_ranges) { + if (!cJSON_IsObject(ipv4_address_ranges_local)) { + ogs_error("OpenAPI_nrf_info_served_bsf_info_value_parseFromJSON() failed [ipv4_address_ranges]"); + goto end; + } + OpenAPI_ipv4_address_range_t *ipv4_address_rangesItem = OpenAPI_ipv4_address_range_parseFromJSON(ipv4_address_ranges_local); + if (!ipv4_address_rangesItem) { + ogs_error("No ipv4_address_rangesItem"); + OpenAPI_list_free(ipv4_address_rangesList); + goto end; + } + OpenAPI_list_add(ipv4_address_rangesList, ipv4_address_rangesItem); + } + } + + ipv6_prefix_ranges = cJSON_GetObjectItemCaseSensitive(nrf_info_served_bsf_info_valueJSON, "ipv6PrefixRanges"); + if (ipv6_prefix_ranges) { + cJSON *ipv6_prefix_ranges_local = NULL; + if (!cJSON_IsArray(ipv6_prefix_ranges)) { + ogs_error("OpenAPI_nrf_info_served_bsf_info_value_parseFromJSON() failed [ipv6_prefix_ranges]"); + goto end; + } + + ipv6_prefix_rangesList = OpenAPI_list_create(); + + cJSON_ArrayForEach(ipv6_prefix_ranges_local, ipv6_prefix_ranges) { + if (!cJSON_IsObject(ipv6_prefix_ranges_local)) { + ogs_error("OpenAPI_nrf_info_served_bsf_info_value_parseFromJSON() failed [ipv6_prefix_ranges]"); + goto end; + } + OpenAPI_ipv6_prefix_range_t *ipv6_prefix_rangesItem = OpenAPI_ipv6_prefix_range_parseFromJSON(ipv6_prefix_ranges_local); + if (!ipv6_prefix_rangesItem) { + ogs_error("No ipv6_prefix_rangesItem"); + OpenAPI_list_free(ipv6_prefix_rangesList); + goto end; + } + OpenAPI_list_add(ipv6_prefix_rangesList, ipv6_prefix_rangesItem); + } + } + + rx_diam_host = cJSON_GetObjectItemCaseSensitive(nrf_info_served_bsf_info_valueJSON, "rxDiamHost"); + if (rx_diam_host) { + if (!cJSON_IsString(rx_diam_host) && !cJSON_IsNull(rx_diam_host)) { + ogs_error("OpenAPI_nrf_info_served_bsf_info_value_parseFromJSON() failed [rx_diam_host]"); + goto end; + } + } + + rx_diam_realm = cJSON_GetObjectItemCaseSensitive(nrf_info_served_bsf_info_valueJSON, "rxDiamRealm"); + if (rx_diam_realm) { + if (!cJSON_IsString(rx_diam_realm) && !cJSON_IsNull(rx_diam_realm)) { + ogs_error("OpenAPI_nrf_info_served_bsf_info_value_parseFromJSON() failed [rx_diam_realm]"); + goto end; + } + } + + group_id = cJSON_GetObjectItemCaseSensitive(nrf_info_served_bsf_info_valueJSON, "groupId"); + if (group_id) { + if (!cJSON_IsString(group_id) && !cJSON_IsNull(group_id)) { + ogs_error("OpenAPI_nrf_info_served_bsf_info_value_parseFromJSON() failed [group_id]"); + goto end; + } + } + + supi_ranges = cJSON_GetObjectItemCaseSensitive(nrf_info_served_bsf_info_valueJSON, "supiRanges"); + if (supi_ranges) { + cJSON *supi_ranges_local = NULL; + if (!cJSON_IsArray(supi_ranges)) { + ogs_error("OpenAPI_nrf_info_served_bsf_info_value_parseFromJSON() failed [supi_ranges]"); + goto end; + } + + supi_rangesList = OpenAPI_list_create(); + + cJSON_ArrayForEach(supi_ranges_local, supi_ranges) { + if (!cJSON_IsObject(supi_ranges_local)) { + ogs_error("OpenAPI_nrf_info_served_bsf_info_value_parseFromJSON() failed [supi_ranges]"); + goto end; + } + OpenAPI_supi_range_t *supi_rangesItem = OpenAPI_supi_range_parseFromJSON(supi_ranges_local); + if (!supi_rangesItem) { + ogs_error("No supi_rangesItem"); + OpenAPI_list_free(supi_rangesList); + goto end; + } + OpenAPI_list_add(supi_rangesList, supi_rangesItem); + } + } + + gpsi_ranges = cJSON_GetObjectItemCaseSensitive(nrf_info_served_bsf_info_valueJSON, "gpsiRanges"); + if (gpsi_ranges) { + cJSON *gpsi_ranges_local = NULL; + if (!cJSON_IsArray(gpsi_ranges)) { + ogs_error("OpenAPI_nrf_info_served_bsf_info_value_parseFromJSON() failed [gpsi_ranges]"); + goto end; + } + + gpsi_rangesList = OpenAPI_list_create(); + + cJSON_ArrayForEach(gpsi_ranges_local, gpsi_ranges) { + if (!cJSON_IsObject(gpsi_ranges_local)) { + ogs_error("OpenAPI_nrf_info_served_bsf_info_value_parseFromJSON() failed [gpsi_ranges]"); + goto end; + } + OpenAPI_identity_range_t *gpsi_rangesItem = OpenAPI_identity_range_parseFromJSON(gpsi_ranges_local); + if (!gpsi_rangesItem) { + ogs_error("No gpsi_rangesItem"); + OpenAPI_list_free(gpsi_rangesList); + goto end; + } + OpenAPI_list_add(gpsi_rangesList, gpsi_rangesItem); + } + } + + nrf_info_served_bsf_info_value_local_var = OpenAPI_nrf_info_served_bsf_info_value_create ( + dnn_list ? dnn_listList : NULL, + ip_domain_list ? ip_domain_listList : NULL, + ipv4_address_ranges ? ipv4_address_rangesList : NULL, + ipv6_prefix_ranges ? ipv6_prefix_rangesList : NULL, + rx_diam_host && !cJSON_IsNull(rx_diam_host) ? ogs_strdup(rx_diam_host->valuestring) : NULL, + rx_diam_realm && !cJSON_IsNull(rx_diam_realm) ? ogs_strdup(rx_diam_realm->valuestring) : NULL, + group_id && !cJSON_IsNull(group_id) ? ogs_strdup(group_id->valuestring) : NULL, + supi_ranges ? supi_rangesList : NULL, + gpsi_ranges ? gpsi_rangesList : NULL + ); + + return nrf_info_served_bsf_info_value_local_var; +end: + if (dnn_listList) { + OpenAPI_list_for_each(dnn_listList, node) { + ogs_free(node->data); + } + OpenAPI_list_free(dnn_listList); + dnn_listList = NULL; + } + if (ip_domain_listList) { + OpenAPI_list_for_each(ip_domain_listList, node) { + ogs_free(node->data); + } + OpenAPI_list_free(ip_domain_listList); + ip_domain_listList = NULL; + } + if (ipv4_address_rangesList) { + OpenAPI_list_for_each(ipv4_address_rangesList, node) { + OpenAPI_ipv4_address_range_free(node->data); + } + OpenAPI_list_free(ipv4_address_rangesList); + ipv4_address_rangesList = NULL; + } + if (ipv6_prefix_rangesList) { + OpenAPI_list_for_each(ipv6_prefix_rangesList, node) { + OpenAPI_ipv6_prefix_range_free(node->data); + } + OpenAPI_list_free(ipv6_prefix_rangesList); + ipv6_prefix_rangesList = NULL; + } + if (supi_rangesList) { + OpenAPI_list_for_each(supi_rangesList, node) { + OpenAPI_supi_range_free(node->data); + } + OpenAPI_list_free(supi_rangesList); + supi_rangesList = NULL; + } + if (gpsi_rangesList) { + OpenAPI_list_for_each(gpsi_rangesList, node) { + OpenAPI_identity_range_free(node->data); + } + OpenAPI_list_free(gpsi_rangesList); + gpsi_rangesList = NULL; + } + return NULL; +} + +OpenAPI_nrf_info_served_bsf_info_value_t *OpenAPI_nrf_info_served_bsf_info_value_copy(OpenAPI_nrf_info_served_bsf_info_value_t *dst, OpenAPI_nrf_info_served_bsf_info_value_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_nrf_info_served_bsf_info_value_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_nrf_info_served_bsf_info_value_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_nrf_info_served_bsf_info_value_free(dst); + dst = OpenAPI_nrf_info_served_bsf_info_value_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/nrf_info_served_bsf_info_value.h b/lib/sbi/openapi/model/nrf_info_served_bsf_info_value.h new file mode 100644 index 000000000..b2ef9dcb2 --- /dev/null +++ b/lib/sbi/openapi/model/nrf_info_served_bsf_info_value.h @@ -0,0 +1,59 @@ +/* + * nrf_info_served_bsf_info_value.h + * + * + */ + +#ifndef _OpenAPI_nrf_info_served_bsf_info_value_H_ +#define _OpenAPI_nrf_info_served_bsf_info_value_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "bsf_info.h" +#include "identity_range.h" +#include "ipv4_address_range.h" +#include "ipv6_prefix_range.h" +#include "supi_range.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_nrf_info_served_bsf_info_value_s OpenAPI_nrf_info_served_bsf_info_value_t; +typedef struct OpenAPI_nrf_info_served_bsf_info_value_s { + OpenAPI_list_t *dnn_list; + OpenAPI_list_t *ip_domain_list; + OpenAPI_list_t *ipv4_address_ranges; + OpenAPI_list_t *ipv6_prefix_ranges; + char *rx_diam_host; + char *rx_diam_realm; + char *group_id; + OpenAPI_list_t *supi_ranges; + OpenAPI_list_t *gpsi_ranges; +} OpenAPI_nrf_info_served_bsf_info_value_t; + +OpenAPI_nrf_info_served_bsf_info_value_t *OpenAPI_nrf_info_served_bsf_info_value_create( + OpenAPI_list_t *dnn_list, + OpenAPI_list_t *ip_domain_list, + OpenAPI_list_t *ipv4_address_ranges, + OpenAPI_list_t *ipv6_prefix_ranges, + char *rx_diam_host, + char *rx_diam_realm, + char *group_id, + OpenAPI_list_t *supi_ranges, + OpenAPI_list_t *gpsi_ranges +); +void OpenAPI_nrf_info_served_bsf_info_value_free(OpenAPI_nrf_info_served_bsf_info_value_t *nrf_info_served_bsf_info_value); +OpenAPI_nrf_info_served_bsf_info_value_t *OpenAPI_nrf_info_served_bsf_info_value_parseFromJSON(cJSON *nrf_info_served_bsf_info_valueJSON); +cJSON *OpenAPI_nrf_info_served_bsf_info_value_convertToJSON(OpenAPI_nrf_info_served_bsf_info_value_t *nrf_info_served_bsf_info_value); +OpenAPI_nrf_info_served_bsf_info_value_t *OpenAPI_nrf_info_served_bsf_info_value_copy(OpenAPI_nrf_info_served_bsf_info_value_t *dst, OpenAPI_nrf_info_served_bsf_info_value_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_nrf_info_served_bsf_info_value_H_ */ + diff --git a/lib/sbi/openapi/model/nrf_info_served_chf_info_value.c b/lib/sbi/openapi/model/nrf_info_served_chf_info_value.c new file mode 100644 index 000000000..e1600752f --- /dev/null +++ b/lib/sbi/openapi/model/nrf_info_served_chf_info_value.c @@ -0,0 +1,336 @@ + +#include +#include +#include +#include "nrf_info_served_chf_info_value.h" + +OpenAPI_nrf_info_served_chf_info_value_t *OpenAPI_nrf_info_served_chf_info_value_create( + OpenAPI_list_t *supi_range_list, + OpenAPI_list_t *gpsi_range_list, + OpenAPI_list_t *plmn_range_list, + char *group_id, + char *primary_chf_instance, + char *secondary_chf_instance +) +{ + OpenAPI_nrf_info_served_chf_info_value_t *nrf_info_served_chf_info_value_local_var = ogs_malloc(sizeof(OpenAPI_nrf_info_served_chf_info_value_t)); + ogs_assert(nrf_info_served_chf_info_value_local_var); + + nrf_info_served_chf_info_value_local_var->supi_range_list = supi_range_list; + nrf_info_served_chf_info_value_local_var->gpsi_range_list = gpsi_range_list; + nrf_info_served_chf_info_value_local_var->plmn_range_list = plmn_range_list; + nrf_info_served_chf_info_value_local_var->group_id = group_id; + nrf_info_served_chf_info_value_local_var->primary_chf_instance = primary_chf_instance; + nrf_info_served_chf_info_value_local_var->secondary_chf_instance = secondary_chf_instance; + + return nrf_info_served_chf_info_value_local_var; +} + +void OpenAPI_nrf_info_served_chf_info_value_free(OpenAPI_nrf_info_served_chf_info_value_t *nrf_info_served_chf_info_value) +{ + OpenAPI_lnode_t *node = NULL; + + if (NULL == nrf_info_served_chf_info_value) { + return; + } + if (nrf_info_served_chf_info_value->supi_range_list) { + OpenAPI_list_for_each(nrf_info_served_chf_info_value->supi_range_list, node) { + OpenAPI_supi_range_free(node->data); + } + OpenAPI_list_free(nrf_info_served_chf_info_value->supi_range_list); + nrf_info_served_chf_info_value->supi_range_list = NULL; + } + if (nrf_info_served_chf_info_value->gpsi_range_list) { + OpenAPI_list_for_each(nrf_info_served_chf_info_value->gpsi_range_list, node) { + OpenAPI_identity_range_free(node->data); + } + OpenAPI_list_free(nrf_info_served_chf_info_value->gpsi_range_list); + nrf_info_served_chf_info_value->gpsi_range_list = NULL; + } + if (nrf_info_served_chf_info_value->plmn_range_list) { + OpenAPI_list_for_each(nrf_info_served_chf_info_value->plmn_range_list, node) { + OpenAPI_plmn_range_free(node->data); + } + OpenAPI_list_free(nrf_info_served_chf_info_value->plmn_range_list); + nrf_info_served_chf_info_value->plmn_range_list = NULL; + } + if (nrf_info_served_chf_info_value->group_id) { + ogs_free(nrf_info_served_chf_info_value->group_id); + nrf_info_served_chf_info_value->group_id = NULL; + } + if (nrf_info_served_chf_info_value->primary_chf_instance) { + ogs_free(nrf_info_served_chf_info_value->primary_chf_instance); + nrf_info_served_chf_info_value->primary_chf_instance = NULL; + } + if (nrf_info_served_chf_info_value->secondary_chf_instance) { + ogs_free(nrf_info_served_chf_info_value->secondary_chf_instance); + nrf_info_served_chf_info_value->secondary_chf_instance = NULL; + } + ogs_free(nrf_info_served_chf_info_value); +} + +cJSON *OpenAPI_nrf_info_served_chf_info_value_convertToJSON(OpenAPI_nrf_info_served_chf_info_value_t *nrf_info_served_chf_info_value) +{ + cJSON *item = NULL; + OpenAPI_lnode_t *node = NULL; + + if (nrf_info_served_chf_info_value == NULL) { + ogs_error("OpenAPI_nrf_info_served_chf_info_value_convertToJSON() failed [NrfInfo_servedChfInfo_value]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (nrf_info_served_chf_info_value->supi_range_list) { + cJSON *supi_range_listList = cJSON_AddArrayToObject(item, "supiRangeList"); + if (supi_range_listList == NULL) { + ogs_error("OpenAPI_nrf_info_served_chf_info_value_convertToJSON() failed [supi_range_list]"); + goto end; + } + OpenAPI_list_for_each(nrf_info_served_chf_info_value->supi_range_list, node) { + cJSON *itemLocal = OpenAPI_supi_range_convertToJSON(node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_nrf_info_served_chf_info_value_convertToJSON() failed [supi_range_list]"); + goto end; + } + cJSON_AddItemToArray(supi_range_listList, itemLocal); + } + } + + if (nrf_info_served_chf_info_value->gpsi_range_list) { + cJSON *gpsi_range_listList = cJSON_AddArrayToObject(item, "gpsiRangeList"); + if (gpsi_range_listList == NULL) { + ogs_error("OpenAPI_nrf_info_served_chf_info_value_convertToJSON() failed [gpsi_range_list]"); + goto end; + } + OpenAPI_list_for_each(nrf_info_served_chf_info_value->gpsi_range_list, node) { + cJSON *itemLocal = OpenAPI_identity_range_convertToJSON(node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_nrf_info_served_chf_info_value_convertToJSON() failed [gpsi_range_list]"); + goto end; + } + cJSON_AddItemToArray(gpsi_range_listList, itemLocal); + } + } + + if (nrf_info_served_chf_info_value->plmn_range_list) { + cJSON *plmn_range_listList = cJSON_AddArrayToObject(item, "plmnRangeList"); + if (plmn_range_listList == NULL) { + ogs_error("OpenAPI_nrf_info_served_chf_info_value_convertToJSON() failed [plmn_range_list]"); + goto end; + } + OpenAPI_list_for_each(nrf_info_served_chf_info_value->plmn_range_list, node) { + cJSON *itemLocal = OpenAPI_plmn_range_convertToJSON(node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_nrf_info_served_chf_info_value_convertToJSON() failed [plmn_range_list]"); + goto end; + } + cJSON_AddItemToArray(plmn_range_listList, itemLocal); + } + } + + if (nrf_info_served_chf_info_value->group_id) { + if (cJSON_AddStringToObject(item, "groupId", nrf_info_served_chf_info_value->group_id) == NULL) { + ogs_error("OpenAPI_nrf_info_served_chf_info_value_convertToJSON() failed [group_id]"); + goto end; + } + } + + if (nrf_info_served_chf_info_value->primary_chf_instance) { + if (cJSON_AddStringToObject(item, "primaryChfInstance", nrf_info_served_chf_info_value->primary_chf_instance) == NULL) { + ogs_error("OpenAPI_nrf_info_served_chf_info_value_convertToJSON() failed [primary_chf_instance]"); + goto end; + } + } + + if (nrf_info_served_chf_info_value->secondary_chf_instance) { + if (cJSON_AddStringToObject(item, "secondaryChfInstance", nrf_info_served_chf_info_value->secondary_chf_instance) == NULL) { + ogs_error("OpenAPI_nrf_info_served_chf_info_value_convertToJSON() failed [secondary_chf_instance]"); + goto end; + } + } + +end: + return item; +} + +OpenAPI_nrf_info_served_chf_info_value_t *OpenAPI_nrf_info_served_chf_info_value_parseFromJSON(cJSON *nrf_info_served_chf_info_valueJSON) +{ + OpenAPI_nrf_info_served_chf_info_value_t *nrf_info_served_chf_info_value_local_var = NULL; + OpenAPI_lnode_t *node = NULL; + cJSON *supi_range_list = NULL; + OpenAPI_list_t *supi_range_listList = NULL; + cJSON *gpsi_range_list = NULL; + OpenAPI_list_t *gpsi_range_listList = NULL; + cJSON *plmn_range_list = NULL; + OpenAPI_list_t *plmn_range_listList = NULL; + cJSON *group_id = NULL; + cJSON *primary_chf_instance = NULL; + cJSON *secondary_chf_instance = NULL; + supi_range_list = cJSON_GetObjectItemCaseSensitive(nrf_info_served_chf_info_valueJSON, "supiRangeList"); + if (supi_range_list) { + cJSON *supi_range_list_local = NULL; + if (!cJSON_IsArray(supi_range_list)) { + ogs_error("OpenAPI_nrf_info_served_chf_info_value_parseFromJSON() failed [supi_range_list]"); + goto end; + } + + supi_range_listList = OpenAPI_list_create(); + + cJSON_ArrayForEach(supi_range_list_local, supi_range_list) { + if (!cJSON_IsObject(supi_range_list_local)) { + ogs_error("OpenAPI_nrf_info_served_chf_info_value_parseFromJSON() failed [supi_range_list]"); + goto end; + } + OpenAPI_supi_range_t *supi_range_listItem = OpenAPI_supi_range_parseFromJSON(supi_range_list_local); + if (!supi_range_listItem) { + ogs_error("No supi_range_listItem"); + OpenAPI_list_free(supi_range_listList); + goto end; + } + OpenAPI_list_add(supi_range_listList, supi_range_listItem); + } + } + + gpsi_range_list = cJSON_GetObjectItemCaseSensitive(nrf_info_served_chf_info_valueJSON, "gpsiRangeList"); + if (gpsi_range_list) { + cJSON *gpsi_range_list_local = NULL; + if (!cJSON_IsArray(gpsi_range_list)) { + ogs_error("OpenAPI_nrf_info_served_chf_info_value_parseFromJSON() failed [gpsi_range_list]"); + goto end; + } + + gpsi_range_listList = OpenAPI_list_create(); + + cJSON_ArrayForEach(gpsi_range_list_local, gpsi_range_list) { + if (!cJSON_IsObject(gpsi_range_list_local)) { + ogs_error("OpenAPI_nrf_info_served_chf_info_value_parseFromJSON() failed [gpsi_range_list]"); + goto end; + } + OpenAPI_identity_range_t *gpsi_range_listItem = OpenAPI_identity_range_parseFromJSON(gpsi_range_list_local); + if (!gpsi_range_listItem) { + ogs_error("No gpsi_range_listItem"); + OpenAPI_list_free(gpsi_range_listList); + goto end; + } + OpenAPI_list_add(gpsi_range_listList, gpsi_range_listItem); + } + } + + plmn_range_list = cJSON_GetObjectItemCaseSensitive(nrf_info_served_chf_info_valueJSON, "plmnRangeList"); + if (plmn_range_list) { + cJSON *plmn_range_list_local = NULL; + if (!cJSON_IsArray(plmn_range_list)) { + ogs_error("OpenAPI_nrf_info_served_chf_info_value_parseFromJSON() failed [plmn_range_list]"); + goto end; + } + + plmn_range_listList = OpenAPI_list_create(); + + cJSON_ArrayForEach(plmn_range_list_local, plmn_range_list) { + if (!cJSON_IsObject(plmn_range_list_local)) { + ogs_error("OpenAPI_nrf_info_served_chf_info_value_parseFromJSON() failed [plmn_range_list]"); + goto end; + } + OpenAPI_plmn_range_t *plmn_range_listItem = OpenAPI_plmn_range_parseFromJSON(plmn_range_list_local); + if (!plmn_range_listItem) { + ogs_error("No plmn_range_listItem"); + OpenAPI_list_free(plmn_range_listList); + goto end; + } + OpenAPI_list_add(plmn_range_listList, plmn_range_listItem); + } + } + + group_id = cJSON_GetObjectItemCaseSensitive(nrf_info_served_chf_info_valueJSON, "groupId"); + if (group_id) { + if (!cJSON_IsString(group_id) && !cJSON_IsNull(group_id)) { + ogs_error("OpenAPI_nrf_info_served_chf_info_value_parseFromJSON() failed [group_id]"); + goto end; + } + } + + primary_chf_instance = cJSON_GetObjectItemCaseSensitive(nrf_info_served_chf_info_valueJSON, "primaryChfInstance"); + if (primary_chf_instance) { + if (!cJSON_IsString(primary_chf_instance) && !cJSON_IsNull(primary_chf_instance)) { + ogs_error("OpenAPI_nrf_info_served_chf_info_value_parseFromJSON() failed [primary_chf_instance]"); + goto end; + } + } + + secondary_chf_instance = cJSON_GetObjectItemCaseSensitive(nrf_info_served_chf_info_valueJSON, "secondaryChfInstance"); + if (secondary_chf_instance) { + if (!cJSON_IsString(secondary_chf_instance) && !cJSON_IsNull(secondary_chf_instance)) { + ogs_error("OpenAPI_nrf_info_served_chf_info_value_parseFromJSON() failed [secondary_chf_instance]"); + goto end; + } + } + + nrf_info_served_chf_info_value_local_var = OpenAPI_nrf_info_served_chf_info_value_create ( + supi_range_list ? supi_range_listList : NULL, + gpsi_range_list ? gpsi_range_listList : NULL, + plmn_range_list ? plmn_range_listList : NULL, + group_id && !cJSON_IsNull(group_id) ? ogs_strdup(group_id->valuestring) : NULL, + primary_chf_instance && !cJSON_IsNull(primary_chf_instance) ? ogs_strdup(primary_chf_instance->valuestring) : NULL, + secondary_chf_instance && !cJSON_IsNull(secondary_chf_instance) ? ogs_strdup(secondary_chf_instance->valuestring) : NULL + ); + + return nrf_info_served_chf_info_value_local_var; +end: + if (supi_range_listList) { + OpenAPI_list_for_each(supi_range_listList, node) { + OpenAPI_supi_range_free(node->data); + } + OpenAPI_list_free(supi_range_listList); + supi_range_listList = NULL; + } + if (gpsi_range_listList) { + OpenAPI_list_for_each(gpsi_range_listList, node) { + OpenAPI_identity_range_free(node->data); + } + OpenAPI_list_free(gpsi_range_listList); + gpsi_range_listList = NULL; + } + if (plmn_range_listList) { + OpenAPI_list_for_each(plmn_range_listList, node) { + OpenAPI_plmn_range_free(node->data); + } + OpenAPI_list_free(plmn_range_listList); + plmn_range_listList = NULL; + } + return NULL; +} + +OpenAPI_nrf_info_served_chf_info_value_t *OpenAPI_nrf_info_served_chf_info_value_copy(OpenAPI_nrf_info_served_chf_info_value_t *dst, OpenAPI_nrf_info_served_chf_info_value_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_nrf_info_served_chf_info_value_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_nrf_info_served_chf_info_value_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_nrf_info_served_chf_info_value_free(dst); + dst = OpenAPI_nrf_info_served_chf_info_value_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/nrf_info_served_chf_info_value.h b/lib/sbi/openapi/model/nrf_info_served_chf_info_value.h new file mode 100644 index 000000000..617dda4e4 --- /dev/null +++ b/lib/sbi/openapi/model/nrf_info_served_chf_info_value.h @@ -0,0 +1,52 @@ +/* + * nrf_info_served_chf_info_value.h + * + * + */ + +#ifndef _OpenAPI_nrf_info_served_chf_info_value_H_ +#define _OpenAPI_nrf_info_served_chf_info_value_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "chf_info.h" +#include "identity_range.h" +#include "plmn_range.h" +#include "supi_range.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_nrf_info_served_chf_info_value_s OpenAPI_nrf_info_served_chf_info_value_t; +typedef struct OpenAPI_nrf_info_served_chf_info_value_s { + OpenAPI_list_t *supi_range_list; + OpenAPI_list_t *gpsi_range_list; + OpenAPI_list_t *plmn_range_list; + char *group_id; + char *primary_chf_instance; + char *secondary_chf_instance; +} OpenAPI_nrf_info_served_chf_info_value_t; + +OpenAPI_nrf_info_served_chf_info_value_t *OpenAPI_nrf_info_served_chf_info_value_create( + OpenAPI_list_t *supi_range_list, + OpenAPI_list_t *gpsi_range_list, + OpenAPI_list_t *plmn_range_list, + char *group_id, + char *primary_chf_instance, + char *secondary_chf_instance +); +void OpenAPI_nrf_info_served_chf_info_value_free(OpenAPI_nrf_info_served_chf_info_value_t *nrf_info_served_chf_info_value); +OpenAPI_nrf_info_served_chf_info_value_t *OpenAPI_nrf_info_served_chf_info_value_parseFromJSON(cJSON *nrf_info_served_chf_info_valueJSON); +cJSON *OpenAPI_nrf_info_served_chf_info_value_convertToJSON(OpenAPI_nrf_info_served_chf_info_value_t *nrf_info_served_chf_info_value); +OpenAPI_nrf_info_served_chf_info_value_t *OpenAPI_nrf_info_served_chf_info_value_copy(OpenAPI_nrf_info_served_chf_info_value_t *dst, OpenAPI_nrf_info_served_chf_info_value_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_nrf_info_served_chf_info_value_H_ */ + diff --git a/lib/sbi/openapi/model/nrf_info_served_gmlc_info_value.c b/lib/sbi/openapi/model/nrf_info_served_gmlc_info_value.c new file mode 100644 index 000000000..323f38ab7 --- /dev/null +++ b/lib/sbi/openapi/model/nrf_info_served_gmlc_info_value.c @@ -0,0 +1,201 @@ + +#include +#include +#include +#include "nrf_info_served_gmlc_info_value.h" + +OpenAPI_nrf_info_served_gmlc_info_value_t *OpenAPI_nrf_info_served_gmlc_info_value_create( + OpenAPI_list_t *serving_client_types, + OpenAPI_list_t *gmlc_numbers +) +{ + OpenAPI_nrf_info_served_gmlc_info_value_t *nrf_info_served_gmlc_info_value_local_var = ogs_malloc(sizeof(OpenAPI_nrf_info_served_gmlc_info_value_t)); + ogs_assert(nrf_info_served_gmlc_info_value_local_var); + + nrf_info_served_gmlc_info_value_local_var->serving_client_types = serving_client_types; + nrf_info_served_gmlc_info_value_local_var->gmlc_numbers = gmlc_numbers; + + return nrf_info_served_gmlc_info_value_local_var; +} + +void OpenAPI_nrf_info_served_gmlc_info_value_free(OpenAPI_nrf_info_served_gmlc_info_value_t *nrf_info_served_gmlc_info_value) +{ + OpenAPI_lnode_t *node = NULL; + + if (NULL == nrf_info_served_gmlc_info_value) { + return; + } + if (nrf_info_served_gmlc_info_value->serving_client_types) { + OpenAPI_list_for_each(nrf_info_served_gmlc_info_value->serving_client_types, node) { + OpenAPI_external_client_type_free(node->data); + } + OpenAPI_list_free(nrf_info_served_gmlc_info_value->serving_client_types); + nrf_info_served_gmlc_info_value->serving_client_types = NULL; + } + if (nrf_info_served_gmlc_info_value->gmlc_numbers) { + OpenAPI_list_for_each(nrf_info_served_gmlc_info_value->gmlc_numbers, node) { + ogs_free(node->data); + } + OpenAPI_list_free(nrf_info_served_gmlc_info_value->gmlc_numbers); + nrf_info_served_gmlc_info_value->gmlc_numbers = NULL; + } + ogs_free(nrf_info_served_gmlc_info_value); +} + +cJSON *OpenAPI_nrf_info_served_gmlc_info_value_convertToJSON(OpenAPI_nrf_info_served_gmlc_info_value_t *nrf_info_served_gmlc_info_value) +{ + cJSON *item = NULL; + OpenAPI_lnode_t *node = NULL; + + if (nrf_info_served_gmlc_info_value == NULL) { + ogs_error("OpenAPI_nrf_info_served_gmlc_info_value_convertToJSON() failed [NrfInfo_servedGmlcInfo_value]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (nrf_info_served_gmlc_info_value->serving_client_types) { + cJSON *serving_client_typesList = cJSON_AddArrayToObject(item, "servingClientTypes"); + if (serving_client_typesList == NULL) { + ogs_error("OpenAPI_nrf_info_served_gmlc_info_value_convertToJSON() failed [serving_client_types]"); + goto end; + } + OpenAPI_list_for_each(nrf_info_served_gmlc_info_value->serving_client_types, node) { + cJSON *itemLocal = OpenAPI_external_client_type_convertToJSON(node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_nrf_info_served_gmlc_info_value_convertToJSON() failed [serving_client_types]"); + goto end; + } + cJSON_AddItemToArray(serving_client_typesList, itemLocal); + } + } + + if (nrf_info_served_gmlc_info_value->gmlc_numbers) { + cJSON *gmlc_numbersList = cJSON_AddArrayToObject(item, "gmlcNumbers"); + if (gmlc_numbersList == NULL) { + ogs_error("OpenAPI_nrf_info_served_gmlc_info_value_convertToJSON() failed [gmlc_numbers]"); + goto end; + } + OpenAPI_list_for_each(nrf_info_served_gmlc_info_value->gmlc_numbers, node) { + if (cJSON_AddStringToObject(gmlc_numbersList, "", (char*)node->data) == NULL) { + ogs_error("OpenAPI_nrf_info_served_gmlc_info_value_convertToJSON() failed [gmlc_numbers]"); + goto end; + } + } + } + +end: + return item; +} + +OpenAPI_nrf_info_served_gmlc_info_value_t *OpenAPI_nrf_info_served_gmlc_info_value_parseFromJSON(cJSON *nrf_info_served_gmlc_info_valueJSON) +{ + OpenAPI_nrf_info_served_gmlc_info_value_t *nrf_info_served_gmlc_info_value_local_var = NULL; + OpenAPI_lnode_t *node = NULL; + cJSON *serving_client_types = NULL; + OpenAPI_list_t *serving_client_typesList = NULL; + cJSON *gmlc_numbers = NULL; + OpenAPI_list_t *gmlc_numbersList = NULL; + serving_client_types = cJSON_GetObjectItemCaseSensitive(nrf_info_served_gmlc_info_valueJSON, "servingClientTypes"); + if (serving_client_types) { + cJSON *serving_client_types_local = NULL; + if (!cJSON_IsArray(serving_client_types)) { + ogs_error("OpenAPI_nrf_info_served_gmlc_info_value_parseFromJSON() failed [serving_client_types]"); + goto end; + } + + serving_client_typesList = OpenAPI_list_create(); + + cJSON_ArrayForEach(serving_client_types_local, serving_client_types) { + if (!cJSON_IsObject(serving_client_types_local)) { + ogs_error("OpenAPI_nrf_info_served_gmlc_info_value_parseFromJSON() failed [serving_client_types]"); + goto end; + } + OpenAPI_external_client_type_t *serving_client_typesItem = OpenAPI_external_client_type_parseFromJSON(serving_client_types_local); + if (!serving_client_typesItem) { + ogs_error("No serving_client_typesItem"); + OpenAPI_list_free(serving_client_typesList); + goto end; + } + OpenAPI_list_add(serving_client_typesList, serving_client_typesItem); + } + } + + gmlc_numbers = cJSON_GetObjectItemCaseSensitive(nrf_info_served_gmlc_info_valueJSON, "gmlcNumbers"); + if (gmlc_numbers) { + cJSON *gmlc_numbers_local = NULL; + if (!cJSON_IsArray(gmlc_numbers)) { + ogs_error("OpenAPI_nrf_info_served_gmlc_info_value_parseFromJSON() failed [gmlc_numbers]"); + goto end; + } + + gmlc_numbersList = OpenAPI_list_create(); + + cJSON_ArrayForEach(gmlc_numbers_local, gmlc_numbers) { + double *localDouble = NULL; + int *localInt = NULL; + if (!cJSON_IsString(gmlc_numbers_local)) { + ogs_error("OpenAPI_nrf_info_served_gmlc_info_value_parseFromJSON() failed [gmlc_numbers]"); + goto end; + } + OpenAPI_list_add(gmlc_numbersList, ogs_strdup(gmlc_numbers_local->valuestring)); + } + } + + nrf_info_served_gmlc_info_value_local_var = OpenAPI_nrf_info_served_gmlc_info_value_create ( + serving_client_types ? serving_client_typesList : NULL, + gmlc_numbers ? gmlc_numbersList : NULL + ); + + return nrf_info_served_gmlc_info_value_local_var; +end: + if (serving_client_typesList) { + OpenAPI_list_for_each(serving_client_typesList, node) { + OpenAPI_external_client_type_free(node->data); + } + OpenAPI_list_free(serving_client_typesList); + serving_client_typesList = NULL; + } + if (gmlc_numbersList) { + OpenAPI_list_for_each(gmlc_numbersList, node) { + ogs_free(node->data); + } + OpenAPI_list_free(gmlc_numbersList); + gmlc_numbersList = NULL; + } + return NULL; +} + +OpenAPI_nrf_info_served_gmlc_info_value_t *OpenAPI_nrf_info_served_gmlc_info_value_copy(OpenAPI_nrf_info_served_gmlc_info_value_t *dst, OpenAPI_nrf_info_served_gmlc_info_value_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_nrf_info_served_gmlc_info_value_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_nrf_info_served_gmlc_info_value_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_nrf_info_served_gmlc_info_value_free(dst); + dst = OpenAPI_nrf_info_served_gmlc_info_value_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/nrf_info_served_gmlc_info_value.h b/lib/sbi/openapi/model/nrf_info_served_gmlc_info_value.h new file mode 100644 index 000000000..0595932f1 --- /dev/null +++ b/lib/sbi/openapi/model/nrf_info_served_gmlc_info_value.h @@ -0,0 +1,42 @@ +/* + * nrf_info_served_gmlc_info_value.h + * + * + */ + +#ifndef _OpenAPI_nrf_info_served_gmlc_info_value_H_ +#define _OpenAPI_nrf_info_served_gmlc_info_value_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "external_client_type.h" +#include "gmlc_info.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_nrf_info_served_gmlc_info_value_s OpenAPI_nrf_info_served_gmlc_info_value_t; +typedef struct OpenAPI_nrf_info_served_gmlc_info_value_s { + OpenAPI_list_t *serving_client_types; + OpenAPI_list_t *gmlc_numbers; +} OpenAPI_nrf_info_served_gmlc_info_value_t; + +OpenAPI_nrf_info_served_gmlc_info_value_t *OpenAPI_nrf_info_served_gmlc_info_value_create( + OpenAPI_list_t *serving_client_types, + OpenAPI_list_t *gmlc_numbers +); +void OpenAPI_nrf_info_served_gmlc_info_value_free(OpenAPI_nrf_info_served_gmlc_info_value_t *nrf_info_served_gmlc_info_value); +OpenAPI_nrf_info_served_gmlc_info_value_t *OpenAPI_nrf_info_served_gmlc_info_value_parseFromJSON(cJSON *nrf_info_served_gmlc_info_valueJSON); +cJSON *OpenAPI_nrf_info_served_gmlc_info_value_convertToJSON(OpenAPI_nrf_info_served_gmlc_info_value_t *nrf_info_served_gmlc_info_value); +OpenAPI_nrf_info_served_gmlc_info_value_t *OpenAPI_nrf_info_served_gmlc_info_value_copy(OpenAPI_nrf_info_served_gmlc_info_value_t *dst, OpenAPI_nrf_info_served_gmlc_info_value_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_nrf_info_served_gmlc_info_value_H_ */ + diff --git a/lib/sbi/openapi/model/nrf_info_served_hss_info_list_value_value.c b/lib/sbi/openapi/model/nrf_info_served_hss_info_list_value_value.c new file mode 100644 index 000000000..841957ee7 --- /dev/null +++ b/lib/sbi/openapi/model/nrf_info_served_hss_info_list_value_value.c @@ -0,0 +1,441 @@ + +#include +#include +#include +#include "nrf_info_served_hss_info_list_value_value.h" + +OpenAPI_nrf_info_served_hss_info_list_value_value_t *OpenAPI_nrf_info_served_hss_info_list_value_value_create( + char *group_id, + OpenAPI_list_t *imsi_ranges, + OpenAPI_list_t *ims_private_identity_ranges, + OpenAPI_list_t *ims_public_identity_ranges, + OpenAPI_list_t *msisdn_ranges, + OpenAPI_list_t *external_group_identifiers_ranges, + OpenAPI_network_node_diameter_address_t *hss_diameter_address +) +{ + OpenAPI_nrf_info_served_hss_info_list_value_value_t *nrf_info_served_hss_info_list_value_value_local_var = ogs_malloc(sizeof(OpenAPI_nrf_info_served_hss_info_list_value_value_t)); + ogs_assert(nrf_info_served_hss_info_list_value_value_local_var); + + nrf_info_served_hss_info_list_value_value_local_var->group_id = group_id; + nrf_info_served_hss_info_list_value_value_local_var->imsi_ranges = imsi_ranges; + nrf_info_served_hss_info_list_value_value_local_var->ims_private_identity_ranges = ims_private_identity_ranges; + nrf_info_served_hss_info_list_value_value_local_var->ims_public_identity_ranges = ims_public_identity_ranges; + nrf_info_served_hss_info_list_value_value_local_var->msisdn_ranges = msisdn_ranges; + nrf_info_served_hss_info_list_value_value_local_var->external_group_identifiers_ranges = external_group_identifiers_ranges; + nrf_info_served_hss_info_list_value_value_local_var->hss_diameter_address = hss_diameter_address; + + return nrf_info_served_hss_info_list_value_value_local_var; +} + +void OpenAPI_nrf_info_served_hss_info_list_value_value_free(OpenAPI_nrf_info_served_hss_info_list_value_value_t *nrf_info_served_hss_info_list_value_value) +{ + OpenAPI_lnode_t *node = NULL; + + if (NULL == nrf_info_served_hss_info_list_value_value) { + return; + } + if (nrf_info_served_hss_info_list_value_value->group_id) { + ogs_free(nrf_info_served_hss_info_list_value_value->group_id); + nrf_info_served_hss_info_list_value_value->group_id = NULL; + } + if (nrf_info_served_hss_info_list_value_value->imsi_ranges) { + OpenAPI_list_for_each(nrf_info_served_hss_info_list_value_value->imsi_ranges, node) { + OpenAPI_imsi_range_free(node->data); + } + OpenAPI_list_free(nrf_info_served_hss_info_list_value_value->imsi_ranges); + nrf_info_served_hss_info_list_value_value->imsi_ranges = NULL; + } + if (nrf_info_served_hss_info_list_value_value->ims_private_identity_ranges) { + OpenAPI_list_for_each(nrf_info_served_hss_info_list_value_value->ims_private_identity_ranges, node) { + OpenAPI_identity_range_free(node->data); + } + OpenAPI_list_free(nrf_info_served_hss_info_list_value_value->ims_private_identity_ranges); + nrf_info_served_hss_info_list_value_value->ims_private_identity_ranges = NULL; + } + if (nrf_info_served_hss_info_list_value_value->ims_public_identity_ranges) { + OpenAPI_list_for_each(nrf_info_served_hss_info_list_value_value->ims_public_identity_ranges, node) { + OpenAPI_identity_range_free(node->data); + } + OpenAPI_list_free(nrf_info_served_hss_info_list_value_value->ims_public_identity_ranges); + nrf_info_served_hss_info_list_value_value->ims_public_identity_ranges = NULL; + } + if (nrf_info_served_hss_info_list_value_value->msisdn_ranges) { + OpenAPI_list_for_each(nrf_info_served_hss_info_list_value_value->msisdn_ranges, node) { + OpenAPI_identity_range_free(node->data); + } + OpenAPI_list_free(nrf_info_served_hss_info_list_value_value->msisdn_ranges); + nrf_info_served_hss_info_list_value_value->msisdn_ranges = NULL; + } + if (nrf_info_served_hss_info_list_value_value->external_group_identifiers_ranges) { + OpenAPI_list_for_each(nrf_info_served_hss_info_list_value_value->external_group_identifiers_ranges, node) { + OpenAPI_identity_range_free(node->data); + } + OpenAPI_list_free(nrf_info_served_hss_info_list_value_value->external_group_identifiers_ranges); + nrf_info_served_hss_info_list_value_value->external_group_identifiers_ranges = NULL; + } + if (nrf_info_served_hss_info_list_value_value->hss_diameter_address) { + OpenAPI_network_node_diameter_address_free(nrf_info_served_hss_info_list_value_value->hss_diameter_address); + nrf_info_served_hss_info_list_value_value->hss_diameter_address = NULL; + } + ogs_free(nrf_info_served_hss_info_list_value_value); +} + +cJSON *OpenAPI_nrf_info_served_hss_info_list_value_value_convertToJSON(OpenAPI_nrf_info_served_hss_info_list_value_value_t *nrf_info_served_hss_info_list_value_value) +{ + cJSON *item = NULL; + OpenAPI_lnode_t *node = NULL; + + if (nrf_info_served_hss_info_list_value_value == NULL) { + ogs_error("OpenAPI_nrf_info_served_hss_info_list_value_value_convertToJSON() failed [NrfInfo_servedHssInfoList_value_value]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (nrf_info_served_hss_info_list_value_value->group_id) { + if (cJSON_AddStringToObject(item, "groupId", nrf_info_served_hss_info_list_value_value->group_id) == NULL) { + ogs_error("OpenAPI_nrf_info_served_hss_info_list_value_value_convertToJSON() failed [group_id]"); + goto end; + } + } + + if (nrf_info_served_hss_info_list_value_value->imsi_ranges) { + cJSON *imsi_rangesList = cJSON_AddArrayToObject(item, "imsiRanges"); + if (imsi_rangesList == NULL) { + ogs_error("OpenAPI_nrf_info_served_hss_info_list_value_value_convertToJSON() failed [imsi_ranges]"); + goto end; + } + OpenAPI_list_for_each(nrf_info_served_hss_info_list_value_value->imsi_ranges, node) { + cJSON *itemLocal = OpenAPI_imsi_range_convertToJSON(node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_nrf_info_served_hss_info_list_value_value_convertToJSON() failed [imsi_ranges]"); + goto end; + } + cJSON_AddItemToArray(imsi_rangesList, itemLocal); + } + } + + if (nrf_info_served_hss_info_list_value_value->ims_private_identity_ranges) { + cJSON *ims_private_identity_rangesList = cJSON_AddArrayToObject(item, "imsPrivateIdentityRanges"); + if (ims_private_identity_rangesList == NULL) { + ogs_error("OpenAPI_nrf_info_served_hss_info_list_value_value_convertToJSON() failed [ims_private_identity_ranges]"); + goto end; + } + OpenAPI_list_for_each(nrf_info_served_hss_info_list_value_value->ims_private_identity_ranges, node) { + cJSON *itemLocal = OpenAPI_identity_range_convertToJSON(node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_nrf_info_served_hss_info_list_value_value_convertToJSON() failed [ims_private_identity_ranges]"); + goto end; + } + cJSON_AddItemToArray(ims_private_identity_rangesList, itemLocal); + } + } + + if (nrf_info_served_hss_info_list_value_value->ims_public_identity_ranges) { + cJSON *ims_public_identity_rangesList = cJSON_AddArrayToObject(item, "imsPublicIdentityRanges"); + if (ims_public_identity_rangesList == NULL) { + ogs_error("OpenAPI_nrf_info_served_hss_info_list_value_value_convertToJSON() failed [ims_public_identity_ranges]"); + goto end; + } + OpenAPI_list_for_each(nrf_info_served_hss_info_list_value_value->ims_public_identity_ranges, node) { + cJSON *itemLocal = OpenAPI_identity_range_convertToJSON(node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_nrf_info_served_hss_info_list_value_value_convertToJSON() failed [ims_public_identity_ranges]"); + goto end; + } + cJSON_AddItemToArray(ims_public_identity_rangesList, itemLocal); + } + } + + if (nrf_info_served_hss_info_list_value_value->msisdn_ranges) { + cJSON *msisdn_rangesList = cJSON_AddArrayToObject(item, "msisdnRanges"); + if (msisdn_rangesList == NULL) { + ogs_error("OpenAPI_nrf_info_served_hss_info_list_value_value_convertToJSON() failed [msisdn_ranges]"); + goto end; + } + OpenAPI_list_for_each(nrf_info_served_hss_info_list_value_value->msisdn_ranges, node) { + cJSON *itemLocal = OpenAPI_identity_range_convertToJSON(node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_nrf_info_served_hss_info_list_value_value_convertToJSON() failed [msisdn_ranges]"); + goto end; + } + cJSON_AddItemToArray(msisdn_rangesList, itemLocal); + } + } + + if (nrf_info_served_hss_info_list_value_value->external_group_identifiers_ranges) { + cJSON *external_group_identifiers_rangesList = cJSON_AddArrayToObject(item, "externalGroupIdentifiersRanges"); + if (external_group_identifiers_rangesList == NULL) { + ogs_error("OpenAPI_nrf_info_served_hss_info_list_value_value_convertToJSON() failed [external_group_identifiers_ranges]"); + goto end; + } + OpenAPI_list_for_each(nrf_info_served_hss_info_list_value_value->external_group_identifiers_ranges, node) { + cJSON *itemLocal = OpenAPI_identity_range_convertToJSON(node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_nrf_info_served_hss_info_list_value_value_convertToJSON() failed [external_group_identifiers_ranges]"); + goto end; + } + cJSON_AddItemToArray(external_group_identifiers_rangesList, itemLocal); + } + } + + if (nrf_info_served_hss_info_list_value_value->hss_diameter_address) { + cJSON *hss_diameter_address_local_JSON = OpenAPI_network_node_diameter_address_convertToJSON(nrf_info_served_hss_info_list_value_value->hss_diameter_address); + if (hss_diameter_address_local_JSON == NULL) { + ogs_error("OpenAPI_nrf_info_served_hss_info_list_value_value_convertToJSON() failed [hss_diameter_address]"); + goto end; + } + cJSON_AddItemToObject(item, "hssDiameterAddress", hss_diameter_address_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_nrf_info_served_hss_info_list_value_value_convertToJSON() failed [hss_diameter_address]"); + goto end; + } + } + +end: + return item; +} + +OpenAPI_nrf_info_served_hss_info_list_value_value_t *OpenAPI_nrf_info_served_hss_info_list_value_value_parseFromJSON(cJSON *nrf_info_served_hss_info_list_value_valueJSON) +{ + OpenAPI_nrf_info_served_hss_info_list_value_value_t *nrf_info_served_hss_info_list_value_value_local_var = NULL; + OpenAPI_lnode_t *node = NULL; + cJSON *group_id = NULL; + cJSON *imsi_ranges = NULL; + OpenAPI_list_t *imsi_rangesList = NULL; + cJSON *ims_private_identity_ranges = NULL; + OpenAPI_list_t *ims_private_identity_rangesList = NULL; + cJSON *ims_public_identity_ranges = NULL; + OpenAPI_list_t *ims_public_identity_rangesList = NULL; + cJSON *msisdn_ranges = NULL; + OpenAPI_list_t *msisdn_rangesList = NULL; + cJSON *external_group_identifiers_ranges = NULL; + OpenAPI_list_t *external_group_identifiers_rangesList = NULL; + cJSON *hss_diameter_address = NULL; + OpenAPI_network_node_diameter_address_t *hss_diameter_address_local_nonprim = NULL; + group_id = cJSON_GetObjectItemCaseSensitive(nrf_info_served_hss_info_list_value_valueJSON, "groupId"); + if (group_id) { + if (!cJSON_IsString(group_id) && !cJSON_IsNull(group_id)) { + ogs_error("OpenAPI_nrf_info_served_hss_info_list_value_value_parseFromJSON() failed [group_id]"); + goto end; + } + } + + imsi_ranges = cJSON_GetObjectItemCaseSensitive(nrf_info_served_hss_info_list_value_valueJSON, "imsiRanges"); + if (imsi_ranges) { + cJSON *imsi_ranges_local = NULL; + if (!cJSON_IsArray(imsi_ranges)) { + ogs_error("OpenAPI_nrf_info_served_hss_info_list_value_value_parseFromJSON() failed [imsi_ranges]"); + goto end; + } + + imsi_rangesList = OpenAPI_list_create(); + + cJSON_ArrayForEach(imsi_ranges_local, imsi_ranges) { + if (!cJSON_IsObject(imsi_ranges_local)) { + ogs_error("OpenAPI_nrf_info_served_hss_info_list_value_value_parseFromJSON() failed [imsi_ranges]"); + goto end; + } + OpenAPI_imsi_range_t *imsi_rangesItem = OpenAPI_imsi_range_parseFromJSON(imsi_ranges_local); + if (!imsi_rangesItem) { + ogs_error("No imsi_rangesItem"); + OpenAPI_list_free(imsi_rangesList); + goto end; + } + OpenAPI_list_add(imsi_rangesList, imsi_rangesItem); + } + } + + ims_private_identity_ranges = cJSON_GetObjectItemCaseSensitive(nrf_info_served_hss_info_list_value_valueJSON, "imsPrivateIdentityRanges"); + if (ims_private_identity_ranges) { + cJSON *ims_private_identity_ranges_local = NULL; + if (!cJSON_IsArray(ims_private_identity_ranges)) { + ogs_error("OpenAPI_nrf_info_served_hss_info_list_value_value_parseFromJSON() failed [ims_private_identity_ranges]"); + goto end; + } + + ims_private_identity_rangesList = OpenAPI_list_create(); + + cJSON_ArrayForEach(ims_private_identity_ranges_local, ims_private_identity_ranges) { + if (!cJSON_IsObject(ims_private_identity_ranges_local)) { + ogs_error("OpenAPI_nrf_info_served_hss_info_list_value_value_parseFromJSON() failed [ims_private_identity_ranges]"); + goto end; + } + OpenAPI_identity_range_t *ims_private_identity_rangesItem = OpenAPI_identity_range_parseFromJSON(ims_private_identity_ranges_local); + if (!ims_private_identity_rangesItem) { + ogs_error("No ims_private_identity_rangesItem"); + OpenAPI_list_free(ims_private_identity_rangesList); + goto end; + } + OpenAPI_list_add(ims_private_identity_rangesList, ims_private_identity_rangesItem); + } + } + + ims_public_identity_ranges = cJSON_GetObjectItemCaseSensitive(nrf_info_served_hss_info_list_value_valueJSON, "imsPublicIdentityRanges"); + if (ims_public_identity_ranges) { + cJSON *ims_public_identity_ranges_local = NULL; + if (!cJSON_IsArray(ims_public_identity_ranges)) { + ogs_error("OpenAPI_nrf_info_served_hss_info_list_value_value_parseFromJSON() failed [ims_public_identity_ranges]"); + goto end; + } + + ims_public_identity_rangesList = OpenAPI_list_create(); + + cJSON_ArrayForEach(ims_public_identity_ranges_local, ims_public_identity_ranges) { + if (!cJSON_IsObject(ims_public_identity_ranges_local)) { + ogs_error("OpenAPI_nrf_info_served_hss_info_list_value_value_parseFromJSON() failed [ims_public_identity_ranges]"); + goto end; + } + OpenAPI_identity_range_t *ims_public_identity_rangesItem = OpenAPI_identity_range_parseFromJSON(ims_public_identity_ranges_local); + if (!ims_public_identity_rangesItem) { + ogs_error("No ims_public_identity_rangesItem"); + OpenAPI_list_free(ims_public_identity_rangesList); + goto end; + } + OpenAPI_list_add(ims_public_identity_rangesList, ims_public_identity_rangesItem); + } + } + + msisdn_ranges = cJSON_GetObjectItemCaseSensitive(nrf_info_served_hss_info_list_value_valueJSON, "msisdnRanges"); + if (msisdn_ranges) { + cJSON *msisdn_ranges_local = NULL; + if (!cJSON_IsArray(msisdn_ranges)) { + ogs_error("OpenAPI_nrf_info_served_hss_info_list_value_value_parseFromJSON() failed [msisdn_ranges]"); + goto end; + } + + msisdn_rangesList = OpenAPI_list_create(); + + cJSON_ArrayForEach(msisdn_ranges_local, msisdn_ranges) { + if (!cJSON_IsObject(msisdn_ranges_local)) { + ogs_error("OpenAPI_nrf_info_served_hss_info_list_value_value_parseFromJSON() failed [msisdn_ranges]"); + goto end; + } + OpenAPI_identity_range_t *msisdn_rangesItem = OpenAPI_identity_range_parseFromJSON(msisdn_ranges_local); + if (!msisdn_rangesItem) { + ogs_error("No msisdn_rangesItem"); + OpenAPI_list_free(msisdn_rangesList); + goto end; + } + OpenAPI_list_add(msisdn_rangesList, msisdn_rangesItem); + } + } + + external_group_identifiers_ranges = cJSON_GetObjectItemCaseSensitive(nrf_info_served_hss_info_list_value_valueJSON, "externalGroupIdentifiersRanges"); + if (external_group_identifiers_ranges) { + cJSON *external_group_identifiers_ranges_local = NULL; + if (!cJSON_IsArray(external_group_identifiers_ranges)) { + ogs_error("OpenAPI_nrf_info_served_hss_info_list_value_value_parseFromJSON() failed [external_group_identifiers_ranges]"); + goto end; + } + + external_group_identifiers_rangesList = OpenAPI_list_create(); + + cJSON_ArrayForEach(external_group_identifiers_ranges_local, external_group_identifiers_ranges) { + if (!cJSON_IsObject(external_group_identifiers_ranges_local)) { + ogs_error("OpenAPI_nrf_info_served_hss_info_list_value_value_parseFromJSON() failed [external_group_identifiers_ranges]"); + goto end; + } + OpenAPI_identity_range_t *external_group_identifiers_rangesItem = OpenAPI_identity_range_parseFromJSON(external_group_identifiers_ranges_local); + if (!external_group_identifiers_rangesItem) { + ogs_error("No external_group_identifiers_rangesItem"); + OpenAPI_list_free(external_group_identifiers_rangesList); + goto end; + } + OpenAPI_list_add(external_group_identifiers_rangesList, external_group_identifiers_rangesItem); + } + } + + hss_diameter_address = cJSON_GetObjectItemCaseSensitive(nrf_info_served_hss_info_list_value_valueJSON, "hssDiameterAddress"); + if (hss_diameter_address) { + hss_diameter_address_local_nonprim = OpenAPI_network_node_diameter_address_parseFromJSON(hss_diameter_address); + } + + nrf_info_served_hss_info_list_value_value_local_var = OpenAPI_nrf_info_served_hss_info_list_value_value_create ( + group_id && !cJSON_IsNull(group_id) ? ogs_strdup(group_id->valuestring) : NULL, + imsi_ranges ? imsi_rangesList : NULL, + ims_private_identity_ranges ? ims_private_identity_rangesList : NULL, + ims_public_identity_ranges ? ims_public_identity_rangesList : NULL, + msisdn_ranges ? msisdn_rangesList : NULL, + external_group_identifiers_ranges ? external_group_identifiers_rangesList : NULL, + hss_diameter_address ? hss_diameter_address_local_nonprim : NULL + ); + + return nrf_info_served_hss_info_list_value_value_local_var; +end: + if (imsi_rangesList) { + OpenAPI_list_for_each(imsi_rangesList, node) { + OpenAPI_imsi_range_free(node->data); + } + OpenAPI_list_free(imsi_rangesList); + imsi_rangesList = NULL; + } + if (ims_private_identity_rangesList) { + OpenAPI_list_for_each(ims_private_identity_rangesList, node) { + OpenAPI_identity_range_free(node->data); + } + OpenAPI_list_free(ims_private_identity_rangesList); + ims_private_identity_rangesList = NULL; + } + if (ims_public_identity_rangesList) { + OpenAPI_list_for_each(ims_public_identity_rangesList, node) { + OpenAPI_identity_range_free(node->data); + } + OpenAPI_list_free(ims_public_identity_rangesList); + ims_public_identity_rangesList = NULL; + } + if (msisdn_rangesList) { + OpenAPI_list_for_each(msisdn_rangesList, node) { + OpenAPI_identity_range_free(node->data); + } + OpenAPI_list_free(msisdn_rangesList); + msisdn_rangesList = NULL; + } + if (external_group_identifiers_rangesList) { + OpenAPI_list_for_each(external_group_identifiers_rangesList, node) { + OpenAPI_identity_range_free(node->data); + } + OpenAPI_list_free(external_group_identifiers_rangesList); + external_group_identifiers_rangesList = NULL; + } + if (hss_diameter_address_local_nonprim) { + OpenAPI_network_node_diameter_address_free(hss_diameter_address_local_nonprim); + hss_diameter_address_local_nonprim = NULL; + } + return NULL; +} + +OpenAPI_nrf_info_served_hss_info_list_value_value_t *OpenAPI_nrf_info_served_hss_info_list_value_value_copy(OpenAPI_nrf_info_served_hss_info_list_value_value_t *dst, OpenAPI_nrf_info_served_hss_info_list_value_value_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_nrf_info_served_hss_info_list_value_value_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_nrf_info_served_hss_info_list_value_value_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_nrf_info_served_hss_info_list_value_value_free(dst); + dst = OpenAPI_nrf_info_served_hss_info_list_value_value_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/nrf_info_served_hss_info_list_value_value.h b/lib/sbi/openapi/model/nrf_info_served_hss_info_list_value_value.h new file mode 100644 index 000000000..462c97224 --- /dev/null +++ b/lib/sbi/openapi/model/nrf_info_served_hss_info_list_value_value.h @@ -0,0 +1,54 @@ +/* + * nrf_info_served_hss_info_list_value_value.h + * + * + */ + +#ifndef _OpenAPI_nrf_info_served_hss_info_list_value_value_H_ +#define _OpenAPI_nrf_info_served_hss_info_list_value_value_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "hss_info.h" +#include "identity_range.h" +#include "imsi_range.h" +#include "network_node_diameter_address.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_nrf_info_served_hss_info_list_value_value_s OpenAPI_nrf_info_served_hss_info_list_value_value_t; +typedef struct OpenAPI_nrf_info_served_hss_info_list_value_value_s { + char *group_id; + OpenAPI_list_t *imsi_ranges; + OpenAPI_list_t *ims_private_identity_ranges; + OpenAPI_list_t *ims_public_identity_ranges; + OpenAPI_list_t *msisdn_ranges; + OpenAPI_list_t *external_group_identifiers_ranges; + struct OpenAPI_network_node_diameter_address_s *hss_diameter_address; +} OpenAPI_nrf_info_served_hss_info_list_value_value_t; + +OpenAPI_nrf_info_served_hss_info_list_value_value_t *OpenAPI_nrf_info_served_hss_info_list_value_value_create( + char *group_id, + OpenAPI_list_t *imsi_ranges, + OpenAPI_list_t *ims_private_identity_ranges, + OpenAPI_list_t *ims_public_identity_ranges, + OpenAPI_list_t *msisdn_ranges, + OpenAPI_list_t *external_group_identifiers_ranges, + OpenAPI_network_node_diameter_address_t *hss_diameter_address +); +void OpenAPI_nrf_info_served_hss_info_list_value_value_free(OpenAPI_nrf_info_served_hss_info_list_value_value_t *nrf_info_served_hss_info_list_value_value); +OpenAPI_nrf_info_served_hss_info_list_value_value_t *OpenAPI_nrf_info_served_hss_info_list_value_value_parseFromJSON(cJSON *nrf_info_served_hss_info_list_value_valueJSON); +cJSON *OpenAPI_nrf_info_served_hss_info_list_value_value_convertToJSON(OpenAPI_nrf_info_served_hss_info_list_value_value_t *nrf_info_served_hss_info_list_value_value); +OpenAPI_nrf_info_served_hss_info_list_value_value_t *OpenAPI_nrf_info_served_hss_info_list_value_value_copy(OpenAPI_nrf_info_served_hss_info_list_value_value_t *dst, OpenAPI_nrf_info_served_hss_info_list_value_value_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_nrf_info_served_hss_info_list_value_value_H_ */ + diff --git a/lib/sbi/openapi/model/nrf_info_served_lmf_info_value.c b/lib/sbi/openapi/model/nrf_info_served_lmf_info_value.c new file mode 100644 index 000000000..4e0512944 --- /dev/null +++ b/lib/sbi/openapi/model/nrf_info_served_lmf_info_value.c @@ -0,0 +1,488 @@ + +#include +#include +#include +#include "nrf_info_served_lmf_info_value.h" + +OpenAPI_nrf_info_served_lmf_info_value_t *OpenAPI_nrf_info_served_lmf_info_value_create( + OpenAPI_list_t *serving_client_types, + char *lmf_id, + OpenAPI_list_t *serving_access_types, + OpenAPI_list_t *serving_an_node_types, + OpenAPI_list_t *serving_rat_types, + OpenAPI_list_t *tai_list, + OpenAPI_list_t *tai_range_list, + OpenAPI_list_t *supported_gad_shapes +) +{ + OpenAPI_nrf_info_served_lmf_info_value_t *nrf_info_served_lmf_info_value_local_var = ogs_malloc(sizeof(OpenAPI_nrf_info_served_lmf_info_value_t)); + ogs_assert(nrf_info_served_lmf_info_value_local_var); + + nrf_info_served_lmf_info_value_local_var->serving_client_types = serving_client_types; + nrf_info_served_lmf_info_value_local_var->lmf_id = lmf_id; + nrf_info_served_lmf_info_value_local_var->serving_access_types = serving_access_types; + nrf_info_served_lmf_info_value_local_var->serving_an_node_types = serving_an_node_types; + nrf_info_served_lmf_info_value_local_var->serving_rat_types = serving_rat_types; + nrf_info_served_lmf_info_value_local_var->tai_list = tai_list; + nrf_info_served_lmf_info_value_local_var->tai_range_list = tai_range_list; + nrf_info_served_lmf_info_value_local_var->supported_gad_shapes = supported_gad_shapes; + + return nrf_info_served_lmf_info_value_local_var; +} + +void OpenAPI_nrf_info_served_lmf_info_value_free(OpenAPI_nrf_info_served_lmf_info_value_t *nrf_info_served_lmf_info_value) +{ + OpenAPI_lnode_t *node = NULL; + + if (NULL == nrf_info_served_lmf_info_value) { + return; + } + if (nrf_info_served_lmf_info_value->serving_client_types) { + OpenAPI_list_for_each(nrf_info_served_lmf_info_value->serving_client_types, node) { + OpenAPI_external_client_type_free(node->data); + } + OpenAPI_list_free(nrf_info_served_lmf_info_value->serving_client_types); + nrf_info_served_lmf_info_value->serving_client_types = NULL; + } + if (nrf_info_served_lmf_info_value->lmf_id) { + ogs_free(nrf_info_served_lmf_info_value->lmf_id); + nrf_info_served_lmf_info_value->lmf_id = NULL; + } + if (nrf_info_served_lmf_info_value->serving_access_types) { + OpenAPI_list_free(nrf_info_served_lmf_info_value->serving_access_types); + nrf_info_served_lmf_info_value->serving_access_types = NULL; + } + if (nrf_info_served_lmf_info_value->serving_an_node_types) { + OpenAPI_list_free(nrf_info_served_lmf_info_value->serving_an_node_types); + nrf_info_served_lmf_info_value->serving_an_node_types = NULL; + } + if (nrf_info_served_lmf_info_value->serving_rat_types) { + OpenAPI_list_free(nrf_info_served_lmf_info_value->serving_rat_types); + nrf_info_served_lmf_info_value->serving_rat_types = NULL; + } + if (nrf_info_served_lmf_info_value->tai_list) { + OpenAPI_list_for_each(nrf_info_served_lmf_info_value->tai_list, node) { + OpenAPI_tai_free(node->data); + } + OpenAPI_list_free(nrf_info_served_lmf_info_value->tai_list); + nrf_info_served_lmf_info_value->tai_list = NULL; + } + if (nrf_info_served_lmf_info_value->tai_range_list) { + OpenAPI_list_for_each(nrf_info_served_lmf_info_value->tai_range_list, node) { + OpenAPI_tai_range_free(node->data); + } + OpenAPI_list_free(nrf_info_served_lmf_info_value->tai_range_list); + nrf_info_served_lmf_info_value->tai_range_list = NULL; + } + if (nrf_info_served_lmf_info_value->supported_gad_shapes) { + OpenAPI_list_for_each(nrf_info_served_lmf_info_value->supported_gad_shapes, node) { + OpenAPI_supported_gad_shapes_free(node->data); + } + OpenAPI_list_free(nrf_info_served_lmf_info_value->supported_gad_shapes); + nrf_info_served_lmf_info_value->supported_gad_shapes = NULL; + } + ogs_free(nrf_info_served_lmf_info_value); +} + +cJSON *OpenAPI_nrf_info_served_lmf_info_value_convertToJSON(OpenAPI_nrf_info_served_lmf_info_value_t *nrf_info_served_lmf_info_value) +{ + cJSON *item = NULL; + OpenAPI_lnode_t *node = NULL; + + if (nrf_info_served_lmf_info_value == NULL) { + ogs_error("OpenAPI_nrf_info_served_lmf_info_value_convertToJSON() failed [NrfInfo_servedLmfInfo_value]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (nrf_info_served_lmf_info_value->serving_client_types) { + cJSON *serving_client_typesList = cJSON_AddArrayToObject(item, "servingClientTypes"); + if (serving_client_typesList == NULL) { + ogs_error("OpenAPI_nrf_info_served_lmf_info_value_convertToJSON() failed [serving_client_types]"); + goto end; + } + OpenAPI_list_for_each(nrf_info_served_lmf_info_value->serving_client_types, node) { + cJSON *itemLocal = OpenAPI_external_client_type_convertToJSON(node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_nrf_info_served_lmf_info_value_convertToJSON() failed [serving_client_types]"); + goto end; + } + cJSON_AddItemToArray(serving_client_typesList, itemLocal); + } + } + + if (nrf_info_served_lmf_info_value->lmf_id) { + if (cJSON_AddStringToObject(item, "lmfId", nrf_info_served_lmf_info_value->lmf_id) == NULL) { + ogs_error("OpenAPI_nrf_info_served_lmf_info_value_convertToJSON() failed [lmf_id]"); + goto end; + } + } + + if (nrf_info_served_lmf_info_value->serving_access_types != OpenAPI_access_type_NULL) { + cJSON *serving_access_typesList = cJSON_AddArrayToObject(item, "servingAccessTypes"); + if (serving_access_typesList == NULL) { + ogs_error("OpenAPI_nrf_info_served_lmf_info_value_convertToJSON() failed [serving_access_types]"); + goto end; + } + OpenAPI_list_for_each(nrf_info_served_lmf_info_value->serving_access_types, node) { + if (cJSON_AddStringToObject(serving_access_typesList, "", OpenAPI_access_type_ToString((intptr_t)node->data)) == NULL) { + ogs_error("OpenAPI_nrf_info_served_lmf_info_value_convertToJSON() failed [serving_access_types]"); + goto end; + } + } + } + + if (nrf_info_served_lmf_info_value->serving_an_node_types != OpenAPI_an_node_type_NULL) { + cJSON *serving_an_node_typesList = cJSON_AddArrayToObject(item, "servingAnNodeTypes"); + if (serving_an_node_typesList == NULL) { + ogs_error("OpenAPI_nrf_info_served_lmf_info_value_convertToJSON() failed [serving_an_node_types]"); + goto end; + } + OpenAPI_list_for_each(nrf_info_served_lmf_info_value->serving_an_node_types, node) { + if (cJSON_AddStringToObject(serving_an_node_typesList, "", OpenAPI_an_node_type_ToString((intptr_t)node->data)) == NULL) { + ogs_error("OpenAPI_nrf_info_served_lmf_info_value_convertToJSON() failed [serving_an_node_types]"); + goto end; + } + } + } + + if (nrf_info_served_lmf_info_value->serving_rat_types != OpenAPI_rat_type_NULL) { + cJSON *serving_rat_typesList = cJSON_AddArrayToObject(item, "servingRatTypes"); + if (serving_rat_typesList == NULL) { + ogs_error("OpenAPI_nrf_info_served_lmf_info_value_convertToJSON() failed [serving_rat_types]"); + goto end; + } + OpenAPI_list_for_each(nrf_info_served_lmf_info_value->serving_rat_types, node) { + if (cJSON_AddStringToObject(serving_rat_typesList, "", OpenAPI_rat_type_ToString((intptr_t)node->data)) == NULL) { + ogs_error("OpenAPI_nrf_info_served_lmf_info_value_convertToJSON() failed [serving_rat_types]"); + goto end; + } + } + } + + if (nrf_info_served_lmf_info_value->tai_list) { + cJSON *tai_listList = cJSON_AddArrayToObject(item, "taiList"); + if (tai_listList == NULL) { + ogs_error("OpenAPI_nrf_info_served_lmf_info_value_convertToJSON() failed [tai_list]"); + goto end; + } + OpenAPI_list_for_each(nrf_info_served_lmf_info_value->tai_list, node) { + cJSON *itemLocal = OpenAPI_tai_convertToJSON(node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_nrf_info_served_lmf_info_value_convertToJSON() failed [tai_list]"); + goto end; + } + cJSON_AddItemToArray(tai_listList, itemLocal); + } + } + + if (nrf_info_served_lmf_info_value->tai_range_list) { + cJSON *tai_range_listList = cJSON_AddArrayToObject(item, "taiRangeList"); + if (tai_range_listList == NULL) { + ogs_error("OpenAPI_nrf_info_served_lmf_info_value_convertToJSON() failed [tai_range_list]"); + goto end; + } + OpenAPI_list_for_each(nrf_info_served_lmf_info_value->tai_range_list, node) { + cJSON *itemLocal = OpenAPI_tai_range_convertToJSON(node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_nrf_info_served_lmf_info_value_convertToJSON() failed [tai_range_list]"); + goto end; + } + cJSON_AddItemToArray(tai_range_listList, itemLocal); + } + } + + if (nrf_info_served_lmf_info_value->supported_gad_shapes) { + cJSON *supported_gad_shapesList = cJSON_AddArrayToObject(item, "supportedGADShapes"); + if (supported_gad_shapesList == NULL) { + ogs_error("OpenAPI_nrf_info_served_lmf_info_value_convertToJSON() failed [supported_gad_shapes]"); + goto end; + } + OpenAPI_list_for_each(nrf_info_served_lmf_info_value->supported_gad_shapes, node) { + cJSON *itemLocal = OpenAPI_supported_gad_shapes_convertToJSON(node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_nrf_info_served_lmf_info_value_convertToJSON() failed [supported_gad_shapes]"); + goto end; + } + cJSON_AddItemToArray(supported_gad_shapesList, itemLocal); + } + } + +end: + return item; +} + +OpenAPI_nrf_info_served_lmf_info_value_t *OpenAPI_nrf_info_served_lmf_info_value_parseFromJSON(cJSON *nrf_info_served_lmf_info_valueJSON) +{ + OpenAPI_nrf_info_served_lmf_info_value_t *nrf_info_served_lmf_info_value_local_var = NULL; + OpenAPI_lnode_t *node = NULL; + cJSON *serving_client_types = NULL; + OpenAPI_list_t *serving_client_typesList = NULL; + cJSON *lmf_id = NULL; + cJSON *serving_access_types = NULL; + OpenAPI_list_t *serving_access_typesList = NULL; + cJSON *serving_an_node_types = NULL; + OpenAPI_list_t *serving_an_node_typesList = NULL; + cJSON *serving_rat_types = NULL; + OpenAPI_list_t *serving_rat_typesList = NULL; + cJSON *tai_list = NULL; + OpenAPI_list_t *tai_listList = NULL; + cJSON *tai_range_list = NULL; + OpenAPI_list_t *tai_range_listList = NULL; + cJSON *supported_gad_shapes = NULL; + OpenAPI_list_t *supported_gad_shapesList = NULL; + serving_client_types = cJSON_GetObjectItemCaseSensitive(nrf_info_served_lmf_info_valueJSON, "servingClientTypes"); + if (serving_client_types) { + cJSON *serving_client_types_local = NULL; + if (!cJSON_IsArray(serving_client_types)) { + ogs_error("OpenAPI_nrf_info_served_lmf_info_value_parseFromJSON() failed [serving_client_types]"); + goto end; + } + + serving_client_typesList = OpenAPI_list_create(); + + cJSON_ArrayForEach(serving_client_types_local, serving_client_types) { + if (!cJSON_IsObject(serving_client_types_local)) { + ogs_error("OpenAPI_nrf_info_served_lmf_info_value_parseFromJSON() failed [serving_client_types]"); + goto end; + } + OpenAPI_external_client_type_t *serving_client_typesItem = OpenAPI_external_client_type_parseFromJSON(serving_client_types_local); + if (!serving_client_typesItem) { + ogs_error("No serving_client_typesItem"); + OpenAPI_list_free(serving_client_typesList); + goto end; + } + OpenAPI_list_add(serving_client_typesList, serving_client_typesItem); + } + } + + lmf_id = cJSON_GetObjectItemCaseSensitive(nrf_info_served_lmf_info_valueJSON, "lmfId"); + if (lmf_id) { + if (!cJSON_IsString(lmf_id) && !cJSON_IsNull(lmf_id)) { + ogs_error("OpenAPI_nrf_info_served_lmf_info_value_parseFromJSON() failed [lmf_id]"); + goto end; + } + } + + serving_access_types = cJSON_GetObjectItemCaseSensitive(nrf_info_served_lmf_info_valueJSON, "servingAccessTypes"); + if (serving_access_types) { + cJSON *serving_access_types_local = NULL; + if (!cJSON_IsArray(serving_access_types)) { + ogs_error("OpenAPI_nrf_info_served_lmf_info_value_parseFromJSON() failed [serving_access_types]"); + goto end; + } + + serving_access_typesList = OpenAPI_list_create(); + + cJSON_ArrayForEach(serving_access_types_local, serving_access_types) { + if (!cJSON_IsString(serving_access_types_local)) { + ogs_error("OpenAPI_nrf_info_served_lmf_info_value_parseFromJSON() failed [serving_access_types]"); + goto end; + } + OpenAPI_list_add(serving_access_typesList, (void *)OpenAPI_access_type_FromString(serving_access_types_local->valuestring)); + } + } + + serving_an_node_types = cJSON_GetObjectItemCaseSensitive(nrf_info_served_lmf_info_valueJSON, "servingAnNodeTypes"); + if (serving_an_node_types) { + cJSON *serving_an_node_types_local = NULL; + if (!cJSON_IsArray(serving_an_node_types)) { + ogs_error("OpenAPI_nrf_info_served_lmf_info_value_parseFromJSON() failed [serving_an_node_types]"); + goto end; + } + + serving_an_node_typesList = OpenAPI_list_create(); + + cJSON_ArrayForEach(serving_an_node_types_local, serving_an_node_types) { + if (!cJSON_IsString(serving_an_node_types_local)) { + ogs_error("OpenAPI_nrf_info_served_lmf_info_value_parseFromJSON() failed [serving_an_node_types]"); + goto end; + } + OpenAPI_list_add(serving_an_node_typesList, (void *)OpenAPI_an_node_type_FromString(serving_an_node_types_local->valuestring)); + } + } + + serving_rat_types = cJSON_GetObjectItemCaseSensitive(nrf_info_served_lmf_info_valueJSON, "servingRatTypes"); + if (serving_rat_types) { + cJSON *serving_rat_types_local = NULL; + if (!cJSON_IsArray(serving_rat_types)) { + ogs_error("OpenAPI_nrf_info_served_lmf_info_value_parseFromJSON() failed [serving_rat_types]"); + goto end; + } + + serving_rat_typesList = OpenAPI_list_create(); + + cJSON_ArrayForEach(serving_rat_types_local, serving_rat_types) { + if (!cJSON_IsString(serving_rat_types_local)) { + ogs_error("OpenAPI_nrf_info_served_lmf_info_value_parseFromJSON() failed [serving_rat_types]"); + goto end; + } + OpenAPI_list_add(serving_rat_typesList, (void *)OpenAPI_rat_type_FromString(serving_rat_types_local->valuestring)); + } + } + + tai_list = cJSON_GetObjectItemCaseSensitive(nrf_info_served_lmf_info_valueJSON, "taiList"); + if (tai_list) { + cJSON *tai_list_local = NULL; + if (!cJSON_IsArray(tai_list)) { + ogs_error("OpenAPI_nrf_info_served_lmf_info_value_parseFromJSON() failed [tai_list]"); + goto end; + } + + tai_listList = OpenAPI_list_create(); + + cJSON_ArrayForEach(tai_list_local, tai_list) { + if (!cJSON_IsObject(tai_list_local)) { + ogs_error("OpenAPI_nrf_info_served_lmf_info_value_parseFromJSON() failed [tai_list]"); + goto end; + } + OpenAPI_tai_t *tai_listItem = OpenAPI_tai_parseFromJSON(tai_list_local); + if (!tai_listItem) { + ogs_error("No tai_listItem"); + OpenAPI_list_free(tai_listList); + goto end; + } + OpenAPI_list_add(tai_listList, tai_listItem); + } + } + + tai_range_list = cJSON_GetObjectItemCaseSensitive(nrf_info_served_lmf_info_valueJSON, "taiRangeList"); + if (tai_range_list) { + cJSON *tai_range_list_local = NULL; + if (!cJSON_IsArray(tai_range_list)) { + ogs_error("OpenAPI_nrf_info_served_lmf_info_value_parseFromJSON() failed [tai_range_list]"); + goto end; + } + + tai_range_listList = OpenAPI_list_create(); + + cJSON_ArrayForEach(tai_range_list_local, tai_range_list) { + if (!cJSON_IsObject(tai_range_list_local)) { + ogs_error("OpenAPI_nrf_info_served_lmf_info_value_parseFromJSON() failed [tai_range_list]"); + goto end; + } + OpenAPI_tai_range_t *tai_range_listItem = OpenAPI_tai_range_parseFromJSON(tai_range_list_local); + if (!tai_range_listItem) { + ogs_error("No tai_range_listItem"); + OpenAPI_list_free(tai_range_listList); + goto end; + } + OpenAPI_list_add(tai_range_listList, tai_range_listItem); + } + } + + supported_gad_shapes = cJSON_GetObjectItemCaseSensitive(nrf_info_served_lmf_info_valueJSON, "supportedGADShapes"); + if (supported_gad_shapes) { + cJSON *supported_gad_shapes_local = NULL; + if (!cJSON_IsArray(supported_gad_shapes)) { + ogs_error("OpenAPI_nrf_info_served_lmf_info_value_parseFromJSON() failed [supported_gad_shapes]"); + goto end; + } + + supported_gad_shapesList = OpenAPI_list_create(); + + cJSON_ArrayForEach(supported_gad_shapes_local, supported_gad_shapes) { + if (!cJSON_IsObject(supported_gad_shapes_local)) { + ogs_error("OpenAPI_nrf_info_served_lmf_info_value_parseFromJSON() failed [supported_gad_shapes]"); + goto end; + } + OpenAPI_supported_gad_shapes_t *supported_gad_shapesItem = OpenAPI_supported_gad_shapes_parseFromJSON(supported_gad_shapes_local); + if (!supported_gad_shapesItem) { + ogs_error("No supported_gad_shapesItem"); + OpenAPI_list_free(supported_gad_shapesList); + goto end; + } + OpenAPI_list_add(supported_gad_shapesList, supported_gad_shapesItem); + } + } + + nrf_info_served_lmf_info_value_local_var = OpenAPI_nrf_info_served_lmf_info_value_create ( + serving_client_types ? serving_client_typesList : NULL, + lmf_id && !cJSON_IsNull(lmf_id) ? ogs_strdup(lmf_id->valuestring) : NULL, + serving_access_types ? serving_access_typesList : NULL, + serving_an_node_types ? serving_an_node_typesList : NULL, + serving_rat_types ? serving_rat_typesList : NULL, + tai_list ? tai_listList : NULL, + tai_range_list ? tai_range_listList : NULL, + supported_gad_shapes ? supported_gad_shapesList : NULL + ); + + return nrf_info_served_lmf_info_value_local_var; +end: + if (serving_client_typesList) { + OpenAPI_list_for_each(serving_client_typesList, node) { + OpenAPI_external_client_type_free(node->data); + } + OpenAPI_list_free(serving_client_typesList); + serving_client_typesList = NULL; + } + if (serving_access_typesList) { + OpenAPI_list_free(serving_access_typesList); + serving_access_typesList = NULL; + } + if (serving_an_node_typesList) { + OpenAPI_list_free(serving_an_node_typesList); + serving_an_node_typesList = NULL; + } + if (serving_rat_typesList) { + OpenAPI_list_free(serving_rat_typesList); + serving_rat_typesList = NULL; + } + if (tai_listList) { + OpenAPI_list_for_each(tai_listList, node) { + OpenAPI_tai_free(node->data); + } + OpenAPI_list_free(tai_listList); + tai_listList = NULL; + } + if (tai_range_listList) { + OpenAPI_list_for_each(tai_range_listList, node) { + OpenAPI_tai_range_free(node->data); + } + OpenAPI_list_free(tai_range_listList); + tai_range_listList = NULL; + } + if (supported_gad_shapesList) { + OpenAPI_list_for_each(supported_gad_shapesList, node) { + OpenAPI_supported_gad_shapes_free(node->data); + } + OpenAPI_list_free(supported_gad_shapesList); + supported_gad_shapesList = NULL; + } + return NULL; +} + +OpenAPI_nrf_info_served_lmf_info_value_t *OpenAPI_nrf_info_served_lmf_info_value_copy(OpenAPI_nrf_info_served_lmf_info_value_t *dst, OpenAPI_nrf_info_served_lmf_info_value_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_nrf_info_served_lmf_info_value_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_nrf_info_served_lmf_info_value_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_nrf_info_served_lmf_info_value_free(dst); + dst = OpenAPI_nrf_info_served_lmf_info_value_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/nrf_info_served_lmf_info_value.h b/lib/sbi/openapi/model/nrf_info_served_lmf_info_value.h new file mode 100644 index 000000000..b7ef2b17f --- /dev/null +++ b/lib/sbi/openapi/model/nrf_info_served_lmf_info_value.h @@ -0,0 +1,60 @@ +/* + * nrf_info_served_lmf_info_value.h + * + * + */ + +#ifndef _OpenAPI_nrf_info_served_lmf_info_value_H_ +#define _OpenAPI_nrf_info_served_lmf_info_value_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "access_type.h" +#include "an_node_type.h" +#include "external_client_type.h" +#include "lmf_info.h" +#include "rat_type.h" +#include "supported_gad_shapes.h" +#include "tai.h" +#include "tai_range.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_nrf_info_served_lmf_info_value_s OpenAPI_nrf_info_served_lmf_info_value_t; +typedef struct OpenAPI_nrf_info_served_lmf_info_value_s { + OpenAPI_list_t *serving_client_types; + char *lmf_id; + OpenAPI_list_t *serving_access_types; + OpenAPI_list_t *serving_an_node_types; + OpenAPI_list_t *serving_rat_types; + OpenAPI_list_t *tai_list; + OpenAPI_list_t *tai_range_list; + OpenAPI_list_t *supported_gad_shapes; +} OpenAPI_nrf_info_served_lmf_info_value_t; + +OpenAPI_nrf_info_served_lmf_info_value_t *OpenAPI_nrf_info_served_lmf_info_value_create( + OpenAPI_list_t *serving_client_types, + char *lmf_id, + OpenAPI_list_t *serving_access_types, + OpenAPI_list_t *serving_an_node_types, + OpenAPI_list_t *serving_rat_types, + OpenAPI_list_t *tai_list, + OpenAPI_list_t *tai_range_list, + OpenAPI_list_t *supported_gad_shapes +); +void OpenAPI_nrf_info_served_lmf_info_value_free(OpenAPI_nrf_info_served_lmf_info_value_t *nrf_info_served_lmf_info_value); +OpenAPI_nrf_info_served_lmf_info_value_t *OpenAPI_nrf_info_served_lmf_info_value_parseFromJSON(cJSON *nrf_info_served_lmf_info_valueJSON); +cJSON *OpenAPI_nrf_info_served_lmf_info_value_convertToJSON(OpenAPI_nrf_info_served_lmf_info_value_t *nrf_info_served_lmf_info_value); +OpenAPI_nrf_info_served_lmf_info_value_t *OpenAPI_nrf_info_served_lmf_info_value_copy(OpenAPI_nrf_info_served_lmf_info_value_t *dst, OpenAPI_nrf_info_served_lmf_info_value_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_nrf_info_served_lmf_info_value_H_ */ + diff --git a/lib/sbi/openapi/model/nrf_info_served_mb_smf_info_list_value_value.c b/lib/sbi/openapi/model/nrf_info_served_mb_smf_info_list_value_value.c new file mode 100644 index 000000000..b18e9c43c --- /dev/null +++ b/lib/sbi/openapi/model/nrf_info_served_mb_smf_info_list_value_value.c @@ -0,0 +1,426 @@ + +#include +#include +#include +#include "nrf_info_served_mb_smf_info_list_value_value.h" + +OpenAPI_nrf_info_served_mb_smf_info_list_value_value_t *OpenAPI_nrf_info_served_mb_smf_info_list_value_value_create( + OpenAPI_list_t* s_nssai_info_list, + OpenAPI_list_t* tmgi_range_list, + OpenAPI_list_t *tai_list, + OpenAPI_list_t *tai_range_list, + OpenAPI_list_t* mbs_session_list +) +{ + OpenAPI_nrf_info_served_mb_smf_info_list_value_value_t *nrf_info_served_mb_smf_info_list_value_value_local_var = ogs_malloc(sizeof(OpenAPI_nrf_info_served_mb_smf_info_list_value_value_t)); + ogs_assert(nrf_info_served_mb_smf_info_list_value_value_local_var); + + nrf_info_served_mb_smf_info_list_value_value_local_var->s_nssai_info_list = s_nssai_info_list; + nrf_info_served_mb_smf_info_list_value_value_local_var->tmgi_range_list = tmgi_range_list; + nrf_info_served_mb_smf_info_list_value_value_local_var->tai_list = tai_list; + nrf_info_served_mb_smf_info_list_value_value_local_var->tai_range_list = tai_range_list; + nrf_info_served_mb_smf_info_list_value_value_local_var->mbs_session_list = mbs_session_list; + + return nrf_info_served_mb_smf_info_list_value_value_local_var; +} + +void OpenAPI_nrf_info_served_mb_smf_info_list_value_value_free(OpenAPI_nrf_info_served_mb_smf_info_list_value_value_t *nrf_info_served_mb_smf_info_list_value_value) +{ + OpenAPI_lnode_t *node = NULL; + + if (NULL == nrf_info_served_mb_smf_info_list_value_value) { + return; + } + if (nrf_info_served_mb_smf_info_list_value_value->s_nssai_info_list) { + OpenAPI_list_for_each(nrf_info_served_mb_smf_info_list_value_value->s_nssai_info_list, node) { + OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*)node->data; + ogs_free(localKeyValue->key); + OpenAPI_snssai_mb_smf_info_item_free(localKeyValue->value); + OpenAPI_map_free(localKeyValue); + } + OpenAPI_list_free(nrf_info_served_mb_smf_info_list_value_value->s_nssai_info_list); + nrf_info_served_mb_smf_info_list_value_value->s_nssai_info_list = NULL; + } + if (nrf_info_served_mb_smf_info_list_value_value->tmgi_range_list) { + OpenAPI_list_for_each(nrf_info_served_mb_smf_info_list_value_value->tmgi_range_list, node) { + OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*)node->data; + ogs_free(localKeyValue->key); + OpenAPI_tmgi_range_free(localKeyValue->value); + OpenAPI_map_free(localKeyValue); + } + OpenAPI_list_free(nrf_info_served_mb_smf_info_list_value_value->tmgi_range_list); + nrf_info_served_mb_smf_info_list_value_value->tmgi_range_list = NULL; + } + if (nrf_info_served_mb_smf_info_list_value_value->tai_list) { + OpenAPI_list_for_each(nrf_info_served_mb_smf_info_list_value_value->tai_list, node) { + OpenAPI_tai_free(node->data); + } + OpenAPI_list_free(nrf_info_served_mb_smf_info_list_value_value->tai_list); + nrf_info_served_mb_smf_info_list_value_value->tai_list = NULL; + } + if (nrf_info_served_mb_smf_info_list_value_value->tai_range_list) { + OpenAPI_list_for_each(nrf_info_served_mb_smf_info_list_value_value->tai_range_list, node) { + OpenAPI_tai_range_free(node->data); + } + OpenAPI_list_free(nrf_info_served_mb_smf_info_list_value_value->tai_range_list); + nrf_info_served_mb_smf_info_list_value_value->tai_range_list = NULL; + } + if (nrf_info_served_mb_smf_info_list_value_value->mbs_session_list) { + OpenAPI_list_for_each(nrf_info_served_mb_smf_info_list_value_value->mbs_session_list, node) { + OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*)node->data; + ogs_free(localKeyValue->key); + OpenAPI_mbs_session_free(localKeyValue->value); + OpenAPI_map_free(localKeyValue); + } + OpenAPI_list_free(nrf_info_served_mb_smf_info_list_value_value->mbs_session_list); + nrf_info_served_mb_smf_info_list_value_value->mbs_session_list = NULL; + } + ogs_free(nrf_info_served_mb_smf_info_list_value_value); +} + +cJSON *OpenAPI_nrf_info_served_mb_smf_info_list_value_value_convertToJSON(OpenAPI_nrf_info_served_mb_smf_info_list_value_value_t *nrf_info_served_mb_smf_info_list_value_value) +{ + cJSON *item = NULL; + OpenAPI_lnode_t *node = NULL; + + if (nrf_info_served_mb_smf_info_list_value_value == NULL) { + ogs_error("OpenAPI_nrf_info_served_mb_smf_info_list_value_value_convertToJSON() failed [NrfInfo_servedMbSmfInfoList_value_value]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (nrf_info_served_mb_smf_info_list_value_value->s_nssai_info_list) { + cJSON *s_nssai_info_list = cJSON_AddObjectToObject(item, "sNssaiInfoList"); + if (s_nssai_info_list == NULL) { + ogs_error("OpenAPI_nrf_info_served_mb_smf_info_list_value_value_convertToJSON() failed [s_nssai_info_list]"); + goto end; + } + cJSON *localMapObject = s_nssai_info_list; + if (nrf_info_served_mb_smf_info_list_value_value->s_nssai_info_list) { + OpenAPI_list_for_each(nrf_info_served_mb_smf_info_list_value_value->s_nssai_info_list, node) { + OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*)node->data; + cJSON *itemLocal = localKeyValue->value ? + OpenAPI_snssai_mb_smf_info_item_convertToJSON(localKeyValue->value) : + cJSON_CreateNull(); + if (itemLocal == NULL) { + ogs_error("OpenAPI_nrf_info_served_mb_smf_info_list_value_value_convertToJSON() failed [inner]"); + goto end; + } + cJSON_AddItemToObject(localMapObject, localKeyValue->key, itemLocal); + } + } + } + + if (nrf_info_served_mb_smf_info_list_value_value->tmgi_range_list) { + cJSON *tmgi_range_list = cJSON_AddObjectToObject(item, "tmgiRangeList"); + if (tmgi_range_list == NULL) { + ogs_error("OpenAPI_nrf_info_served_mb_smf_info_list_value_value_convertToJSON() failed [tmgi_range_list]"); + goto end; + } + cJSON *localMapObject = tmgi_range_list; + if (nrf_info_served_mb_smf_info_list_value_value->tmgi_range_list) { + OpenAPI_list_for_each(nrf_info_served_mb_smf_info_list_value_value->tmgi_range_list, node) { + OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*)node->data; + cJSON *itemLocal = localKeyValue->value ? + OpenAPI_tmgi_range_convertToJSON(localKeyValue->value) : + cJSON_CreateNull(); + if (itemLocal == NULL) { + ogs_error("OpenAPI_nrf_info_served_mb_smf_info_list_value_value_convertToJSON() failed [inner]"); + goto end; + } + cJSON_AddItemToObject(localMapObject, localKeyValue->key, itemLocal); + } + } + } + + if (nrf_info_served_mb_smf_info_list_value_value->tai_list) { + cJSON *tai_listList = cJSON_AddArrayToObject(item, "taiList"); + if (tai_listList == NULL) { + ogs_error("OpenAPI_nrf_info_served_mb_smf_info_list_value_value_convertToJSON() failed [tai_list]"); + goto end; + } + OpenAPI_list_for_each(nrf_info_served_mb_smf_info_list_value_value->tai_list, node) { + cJSON *itemLocal = OpenAPI_tai_convertToJSON(node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_nrf_info_served_mb_smf_info_list_value_value_convertToJSON() failed [tai_list]"); + goto end; + } + cJSON_AddItemToArray(tai_listList, itemLocal); + } + } + + if (nrf_info_served_mb_smf_info_list_value_value->tai_range_list) { + cJSON *tai_range_listList = cJSON_AddArrayToObject(item, "taiRangeList"); + if (tai_range_listList == NULL) { + ogs_error("OpenAPI_nrf_info_served_mb_smf_info_list_value_value_convertToJSON() failed [tai_range_list]"); + goto end; + } + OpenAPI_list_for_each(nrf_info_served_mb_smf_info_list_value_value->tai_range_list, node) { + cJSON *itemLocal = OpenAPI_tai_range_convertToJSON(node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_nrf_info_served_mb_smf_info_list_value_value_convertToJSON() failed [tai_range_list]"); + goto end; + } + cJSON_AddItemToArray(tai_range_listList, itemLocal); + } + } + + if (nrf_info_served_mb_smf_info_list_value_value->mbs_session_list) { + cJSON *mbs_session_list = cJSON_AddObjectToObject(item, "mbsSessionList"); + if (mbs_session_list == NULL) { + ogs_error("OpenAPI_nrf_info_served_mb_smf_info_list_value_value_convertToJSON() failed [mbs_session_list]"); + goto end; + } + cJSON *localMapObject = mbs_session_list; + if (nrf_info_served_mb_smf_info_list_value_value->mbs_session_list) { + OpenAPI_list_for_each(nrf_info_served_mb_smf_info_list_value_value->mbs_session_list, node) { + OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*)node->data; + cJSON *itemLocal = localKeyValue->value ? + OpenAPI_mbs_session_convertToJSON(localKeyValue->value) : + cJSON_CreateNull(); + if (itemLocal == NULL) { + ogs_error("OpenAPI_nrf_info_served_mb_smf_info_list_value_value_convertToJSON() failed [inner]"); + goto end; + } + cJSON_AddItemToObject(localMapObject, localKeyValue->key, itemLocal); + } + } + } + +end: + return item; +} + +OpenAPI_nrf_info_served_mb_smf_info_list_value_value_t *OpenAPI_nrf_info_served_mb_smf_info_list_value_value_parseFromJSON(cJSON *nrf_info_served_mb_smf_info_list_value_valueJSON) +{ + OpenAPI_nrf_info_served_mb_smf_info_list_value_value_t *nrf_info_served_mb_smf_info_list_value_value_local_var = NULL; + OpenAPI_lnode_t *node = NULL; + cJSON *s_nssai_info_list = NULL; + OpenAPI_list_t *s_nssai_info_listList = NULL; + cJSON *tmgi_range_list = NULL; + OpenAPI_list_t *tmgi_range_listList = NULL; + cJSON *tai_list = NULL; + OpenAPI_list_t *tai_listList = NULL; + cJSON *tai_range_list = NULL; + OpenAPI_list_t *tai_range_listList = NULL; + cJSON *mbs_session_list = NULL; + OpenAPI_list_t *mbs_session_listList = NULL; + s_nssai_info_list = cJSON_GetObjectItemCaseSensitive(nrf_info_served_mb_smf_info_list_value_valueJSON, "sNssaiInfoList"); + if (s_nssai_info_list) { + cJSON *s_nssai_info_list_local_map = NULL; + if (!cJSON_IsObject(s_nssai_info_list) && !cJSON_IsNull(s_nssai_info_list)) { + ogs_error("OpenAPI_nrf_info_served_mb_smf_info_list_value_value_parseFromJSON() failed [s_nssai_info_list]"); + goto end; + } + if (cJSON_IsObject(s_nssai_info_list)) { + s_nssai_info_listList = OpenAPI_list_create(); + OpenAPI_map_t *localMapKeyPair = NULL; + cJSON_ArrayForEach(s_nssai_info_list_local_map, s_nssai_info_list) { + cJSON *localMapObject = s_nssai_info_list_local_map; + if (cJSON_IsObject(localMapObject)) { + localMapKeyPair = OpenAPI_map_create( + ogs_strdup(localMapObject->string), OpenAPI_snssai_mb_smf_info_item_parseFromJSON(localMapObject)); + } else if (cJSON_IsNull(localMapObject)) { + localMapKeyPair = OpenAPI_map_create(ogs_strdup(localMapObject->string), NULL); + } else { + ogs_error("OpenAPI_nrf_info_served_mb_smf_info_list_value_value_parseFromJSON() failed [inner]"); + goto end; + } + OpenAPI_list_add(s_nssai_info_listList, localMapKeyPair); + } + } + } + + tmgi_range_list = cJSON_GetObjectItemCaseSensitive(nrf_info_served_mb_smf_info_list_value_valueJSON, "tmgiRangeList"); + if (tmgi_range_list) { + cJSON *tmgi_range_list_local_map = NULL; + if (!cJSON_IsObject(tmgi_range_list) && !cJSON_IsNull(tmgi_range_list)) { + ogs_error("OpenAPI_nrf_info_served_mb_smf_info_list_value_value_parseFromJSON() failed [tmgi_range_list]"); + goto end; + } + if (cJSON_IsObject(tmgi_range_list)) { + tmgi_range_listList = OpenAPI_list_create(); + OpenAPI_map_t *localMapKeyPair = NULL; + cJSON_ArrayForEach(tmgi_range_list_local_map, tmgi_range_list) { + cJSON *localMapObject = tmgi_range_list_local_map; + if (cJSON_IsObject(localMapObject)) { + localMapKeyPair = OpenAPI_map_create( + ogs_strdup(localMapObject->string), OpenAPI_tmgi_range_parseFromJSON(localMapObject)); + } else if (cJSON_IsNull(localMapObject)) { + localMapKeyPair = OpenAPI_map_create(ogs_strdup(localMapObject->string), NULL); + } else { + ogs_error("OpenAPI_nrf_info_served_mb_smf_info_list_value_value_parseFromJSON() failed [inner]"); + goto end; + } + OpenAPI_list_add(tmgi_range_listList, localMapKeyPair); + } + } + } + + tai_list = cJSON_GetObjectItemCaseSensitive(nrf_info_served_mb_smf_info_list_value_valueJSON, "taiList"); + if (tai_list) { + cJSON *tai_list_local = NULL; + if (!cJSON_IsArray(tai_list)) { + ogs_error("OpenAPI_nrf_info_served_mb_smf_info_list_value_value_parseFromJSON() failed [tai_list]"); + goto end; + } + + tai_listList = OpenAPI_list_create(); + + cJSON_ArrayForEach(tai_list_local, tai_list) { + if (!cJSON_IsObject(tai_list_local)) { + ogs_error("OpenAPI_nrf_info_served_mb_smf_info_list_value_value_parseFromJSON() failed [tai_list]"); + goto end; + } + OpenAPI_tai_t *tai_listItem = OpenAPI_tai_parseFromJSON(tai_list_local); + if (!tai_listItem) { + ogs_error("No tai_listItem"); + OpenAPI_list_free(tai_listList); + goto end; + } + OpenAPI_list_add(tai_listList, tai_listItem); + } + } + + tai_range_list = cJSON_GetObjectItemCaseSensitive(nrf_info_served_mb_smf_info_list_value_valueJSON, "taiRangeList"); + if (tai_range_list) { + cJSON *tai_range_list_local = NULL; + if (!cJSON_IsArray(tai_range_list)) { + ogs_error("OpenAPI_nrf_info_served_mb_smf_info_list_value_value_parseFromJSON() failed [tai_range_list]"); + goto end; + } + + tai_range_listList = OpenAPI_list_create(); + + cJSON_ArrayForEach(tai_range_list_local, tai_range_list) { + if (!cJSON_IsObject(tai_range_list_local)) { + ogs_error("OpenAPI_nrf_info_served_mb_smf_info_list_value_value_parseFromJSON() failed [tai_range_list]"); + goto end; + } + OpenAPI_tai_range_t *tai_range_listItem = OpenAPI_tai_range_parseFromJSON(tai_range_list_local); + if (!tai_range_listItem) { + ogs_error("No tai_range_listItem"); + OpenAPI_list_free(tai_range_listList); + goto end; + } + OpenAPI_list_add(tai_range_listList, tai_range_listItem); + } + } + + mbs_session_list = cJSON_GetObjectItemCaseSensitive(nrf_info_served_mb_smf_info_list_value_valueJSON, "mbsSessionList"); + if (mbs_session_list) { + cJSON *mbs_session_list_local_map = NULL; + if (!cJSON_IsObject(mbs_session_list) && !cJSON_IsNull(mbs_session_list)) { + ogs_error("OpenAPI_nrf_info_served_mb_smf_info_list_value_value_parseFromJSON() failed [mbs_session_list]"); + goto end; + } + if (cJSON_IsObject(mbs_session_list)) { + mbs_session_listList = OpenAPI_list_create(); + OpenAPI_map_t *localMapKeyPair = NULL; + cJSON_ArrayForEach(mbs_session_list_local_map, mbs_session_list) { + cJSON *localMapObject = mbs_session_list_local_map; + if (cJSON_IsObject(localMapObject)) { + localMapKeyPair = OpenAPI_map_create( + ogs_strdup(localMapObject->string), OpenAPI_mbs_session_parseFromJSON(localMapObject)); + } else if (cJSON_IsNull(localMapObject)) { + localMapKeyPair = OpenAPI_map_create(ogs_strdup(localMapObject->string), NULL); + } else { + ogs_error("OpenAPI_nrf_info_served_mb_smf_info_list_value_value_parseFromJSON() failed [inner]"); + goto end; + } + OpenAPI_list_add(mbs_session_listList, localMapKeyPair); + } + } + } + + nrf_info_served_mb_smf_info_list_value_value_local_var = OpenAPI_nrf_info_served_mb_smf_info_list_value_value_create ( + s_nssai_info_list ? s_nssai_info_listList : NULL, + tmgi_range_list ? tmgi_range_listList : NULL, + tai_list ? tai_listList : NULL, + tai_range_list ? tai_range_listList : NULL, + mbs_session_list ? mbs_session_listList : NULL + ); + + return nrf_info_served_mb_smf_info_list_value_value_local_var; +end: + if (s_nssai_info_listList) { + OpenAPI_list_for_each(s_nssai_info_listList, node) { + OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*) node->data; + ogs_free(localKeyValue->key); + OpenAPI_snssai_mb_smf_info_item_free(localKeyValue->value); + OpenAPI_map_free(localKeyValue); + } + OpenAPI_list_free(s_nssai_info_listList); + s_nssai_info_listList = NULL; + } + if (tmgi_range_listList) { + OpenAPI_list_for_each(tmgi_range_listList, node) { + OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*) node->data; + ogs_free(localKeyValue->key); + OpenAPI_tmgi_range_free(localKeyValue->value); + OpenAPI_map_free(localKeyValue); + } + OpenAPI_list_free(tmgi_range_listList); + tmgi_range_listList = NULL; + } + if (tai_listList) { + OpenAPI_list_for_each(tai_listList, node) { + OpenAPI_tai_free(node->data); + } + OpenAPI_list_free(tai_listList); + tai_listList = NULL; + } + if (tai_range_listList) { + OpenAPI_list_for_each(tai_range_listList, node) { + OpenAPI_tai_range_free(node->data); + } + OpenAPI_list_free(tai_range_listList); + tai_range_listList = NULL; + } + if (mbs_session_listList) { + OpenAPI_list_for_each(mbs_session_listList, node) { + OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*) node->data; + ogs_free(localKeyValue->key); + OpenAPI_mbs_session_free(localKeyValue->value); + OpenAPI_map_free(localKeyValue); + } + OpenAPI_list_free(mbs_session_listList); + mbs_session_listList = NULL; + } + return NULL; +} + +OpenAPI_nrf_info_served_mb_smf_info_list_value_value_t *OpenAPI_nrf_info_served_mb_smf_info_list_value_value_copy(OpenAPI_nrf_info_served_mb_smf_info_list_value_value_t *dst, OpenAPI_nrf_info_served_mb_smf_info_list_value_value_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_nrf_info_served_mb_smf_info_list_value_value_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_nrf_info_served_mb_smf_info_list_value_value_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_nrf_info_served_mb_smf_info_list_value_value_free(dst); + dst = OpenAPI_nrf_info_served_mb_smf_info_list_value_value_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/nrf_info_served_mb_smf_info_list_value_value.h b/lib/sbi/openapi/model/nrf_info_served_mb_smf_info_list_value_value.h new file mode 100644 index 000000000..b6a885c62 --- /dev/null +++ b/lib/sbi/openapi/model/nrf_info_served_mb_smf_info_list_value_value.h @@ -0,0 +1,52 @@ +/* + * nrf_info_served_mb_smf_info_list_value_value.h + * + * + */ + +#ifndef _OpenAPI_nrf_info_served_mb_smf_info_list_value_value_H_ +#define _OpenAPI_nrf_info_served_mb_smf_info_list_value_value_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "mb_smf_info.h" +#include "mbs_session.h" +#include "snssai_mb_smf_info_item.h" +#include "tai.h" +#include "tai_range.h" +#include "tmgi_range.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_nrf_info_served_mb_smf_info_list_value_value_s OpenAPI_nrf_info_served_mb_smf_info_list_value_value_t; +typedef struct OpenAPI_nrf_info_served_mb_smf_info_list_value_value_s { + OpenAPI_list_t* s_nssai_info_list; + OpenAPI_list_t* tmgi_range_list; + OpenAPI_list_t *tai_list; + OpenAPI_list_t *tai_range_list; + OpenAPI_list_t* mbs_session_list; +} OpenAPI_nrf_info_served_mb_smf_info_list_value_value_t; + +OpenAPI_nrf_info_served_mb_smf_info_list_value_value_t *OpenAPI_nrf_info_served_mb_smf_info_list_value_value_create( + OpenAPI_list_t* s_nssai_info_list, + OpenAPI_list_t* tmgi_range_list, + OpenAPI_list_t *tai_list, + OpenAPI_list_t *tai_range_list, + OpenAPI_list_t* mbs_session_list +); +void OpenAPI_nrf_info_served_mb_smf_info_list_value_value_free(OpenAPI_nrf_info_served_mb_smf_info_list_value_value_t *nrf_info_served_mb_smf_info_list_value_value); +OpenAPI_nrf_info_served_mb_smf_info_list_value_value_t *OpenAPI_nrf_info_served_mb_smf_info_list_value_value_parseFromJSON(cJSON *nrf_info_served_mb_smf_info_list_value_valueJSON); +cJSON *OpenAPI_nrf_info_served_mb_smf_info_list_value_value_convertToJSON(OpenAPI_nrf_info_served_mb_smf_info_list_value_value_t *nrf_info_served_mb_smf_info_list_value_value); +OpenAPI_nrf_info_served_mb_smf_info_list_value_value_t *OpenAPI_nrf_info_served_mb_smf_info_list_value_value_copy(OpenAPI_nrf_info_served_mb_smf_info_list_value_value_t *dst, OpenAPI_nrf_info_served_mb_smf_info_list_value_value_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_nrf_info_served_mb_smf_info_list_value_value_H_ */ + diff --git a/lib/sbi/openapi/model/nrf_info_served_nef_info_value.c b/lib/sbi/openapi/model/nrf_info_served_nef_info_value.c new file mode 100644 index 000000000..499194a0a --- /dev/null +++ b/lib/sbi/openapi/model/nrf_info_served_nef_info_value.c @@ -0,0 +1,602 @@ + +#include +#include +#include +#include "nrf_info_served_nef_info_value.h" + +OpenAPI_nrf_info_served_nef_info_value_t *OpenAPI_nrf_info_served_nef_info_value_create( + char *nef_id, + OpenAPI_pfd_data_t *pfd_data, + OpenAPI_af_event_exposure_data_t *af_ee_data, + OpenAPI_list_t *gpsi_ranges, + OpenAPI_list_t *external_group_identifiers_ranges, + OpenAPI_list_t *served_fqdn_list, + OpenAPI_list_t *tai_list, + OpenAPI_list_t *tai_range_list, + OpenAPI_list_t *dnai_list, + OpenAPI_list_t *un_trust_af_info_list, + bool is_uas_nf_functionality_ind, + int uas_nf_functionality_ind +) +{ + OpenAPI_nrf_info_served_nef_info_value_t *nrf_info_served_nef_info_value_local_var = ogs_malloc(sizeof(OpenAPI_nrf_info_served_nef_info_value_t)); + ogs_assert(nrf_info_served_nef_info_value_local_var); + + nrf_info_served_nef_info_value_local_var->nef_id = nef_id; + nrf_info_served_nef_info_value_local_var->pfd_data = pfd_data; + nrf_info_served_nef_info_value_local_var->af_ee_data = af_ee_data; + nrf_info_served_nef_info_value_local_var->gpsi_ranges = gpsi_ranges; + nrf_info_served_nef_info_value_local_var->external_group_identifiers_ranges = external_group_identifiers_ranges; + nrf_info_served_nef_info_value_local_var->served_fqdn_list = served_fqdn_list; + nrf_info_served_nef_info_value_local_var->tai_list = tai_list; + nrf_info_served_nef_info_value_local_var->tai_range_list = tai_range_list; + nrf_info_served_nef_info_value_local_var->dnai_list = dnai_list; + nrf_info_served_nef_info_value_local_var->un_trust_af_info_list = un_trust_af_info_list; + nrf_info_served_nef_info_value_local_var->is_uas_nf_functionality_ind = is_uas_nf_functionality_ind; + nrf_info_served_nef_info_value_local_var->uas_nf_functionality_ind = uas_nf_functionality_ind; + + return nrf_info_served_nef_info_value_local_var; +} + +void OpenAPI_nrf_info_served_nef_info_value_free(OpenAPI_nrf_info_served_nef_info_value_t *nrf_info_served_nef_info_value) +{ + OpenAPI_lnode_t *node = NULL; + + if (NULL == nrf_info_served_nef_info_value) { + return; + } + if (nrf_info_served_nef_info_value->nef_id) { + ogs_free(nrf_info_served_nef_info_value->nef_id); + nrf_info_served_nef_info_value->nef_id = NULL; + } + if (nrf_info_served_nef_info_value->pfd_data) { + OpenAPI_pfd_data_free(nrf_info_served_nef_info_value->pfd_data); + nrf_info_served_nef_info_value->pfd_data = NULL; + } + if (nrf_info_served_nef_info_value->af_ee_data) { + OpenAPI_af_event_exposure_data_free(nrf_info_served_nef_info_value->af_ee_data); + nrf_info_served_nef_info_value->af_ee_data = NULL; + } + if (nrf_info_served_nef_info_value->gpsi_ranges) { + OpenAPI_list_for_each(nrf_info_served_nef_info_value->gpsi_ranges, node) { + OpenAPI_identity_range_free(node->data); + } + OpenAPI_list_free(nrf_info_served_nef_info_value->gpsi_ranges); + nrf_info_served_nef_info_value->gpsi_ranges = NULL; + } + if (nrf_info_served_nef_info_value->external_group_identifiers_ranges) { + OpenAPI_list_for_each(nrf_info_served_nef_info_value->external_group_identifiers_ranges, node) { + OpenAPI_identity_range_free(node->data); + } + OpenAPI_list_free(nrf_info_served_nef_info_value->external_group_identifiers_ranges); + nrf_info_served_nef_info_value->external_group_identifiers_ranges = NULL; + } + if (nrf_info_served_nef_info_value->served_fqdn_list) { + OpenAPI_list_for_each(nrf_info_served_nef_info_value->served_fqdn_list, node) { + ogs_free(node->data); + } + OpenAPI_list_free(nrf_info_served_nef_info_value->served_fqdn_list); + nrf_info_served_nef_info_value->served_fqdn_list = NULL; + } + if (nrf_info_served_nef_info_value->tai_list) { + OpenAPI_list_for_each(nrf_info_served_nef_info_value->tai_list, node) { + OpenAPI_tai_free(node->data); + } + OpenAPI_list_free(nrf_info_served_nef_info_value->tai_list); + nrf_info_served_nef_info_value->tai_list = NULL; + } + if (nrf_info_served_nef_info_value->tai_range_list) { + OpenAPI_list_for_each(nrf_info_served_nef_info_value->tai_range_list, node) { + OpenAPI_tai_range_free(node->data); + } + OpenAPI_list_free(nrf_info_served_nef_info_value->tai_range_list); + nrf_info_served_nef_info_value->tai_range_list = NULL; + } + if (nrf_info_served_nef_info_value->dnai_list) { + OpenAPI_list_for_each(nrf_info_served_nef_info_value->dnai_list, node) { + ogs_free(node->data); + } + OpenAPI_list_free(nrf_info_served_nef_info_value->dnai_list); + nrf_info_served_nef_info_value->dnai_list = NULL; + } + if (nrf_info_served_nef_info_value->un_trust_af_info_list) { + OpenAPI_list_for_each(nrf_info_served_nef_info_value->un_trust_af_info_list, node) { + OpenAPI_un_trust_af_info_free(node->data); + } + OpenAPI_list_free(nrf_info_served_nef_info_value->un_trust_af_info_list); + nrf_info_served_nef_info_value->un_trust_af_info_list = NULL; + } + ogs_free(nrf_info_served_nef_info_value); +} + +cJSON *OpenAPI_nrf_info_served_nef_info_value_convertToJSON(OpenAPI_nrf_info_served_nef_info_value_t *nrf_info_served_nef_info_value) +{ + cJSON *item = NULL; + OpenAPI_lnode_t *node = NULL; + + if (nrf_info_served_nef_info_value == NULL) { + ogs_error("OpenAPI_nrf_info_served_nef_info_value_convertToJSON() failed [NrfInfo_servedNefInfo_value]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (nrf_info_served_nef_info_value->nef_id) { + if (cJSON_AddStringToObject(item, "nefId", nrf_info_served_nef_info_value->nef_id) == NULL) { + ogs_error("OpenAPI_nrf_info_served_nef_info_value_convertToJSON() failed [nef_id]"); + goto end; + } + } + + if (nrf_info_served_nef_info_value->pfd_data) { + cJSON *pfd_data_local_JSON = OpenAPI_pfd_data_convertToJSON(nrf_info_served_nef_info_value->pfd_data); + if (pfd_data_local_JSON == NULL) { + ogs_error("OpenAPI_nrf_info_served_nef_info_value_convertToJSON() failed [pfd_data]"); + goto end; + } + cJSON_AddItemToObject(item, "pfdData", pfd_data_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_nrf_info_served_nef_info_value_convertToJSON() failed [pfd_data]"); + goto end; + } + } + + if (nrf_info_served_nef_info_value->af_ee_data) { + cJSON *af_ee_data_local_JSON = OpenAPI_af_event_exposure_data_convertToJSON(nrf_info_served_nef_info_value->af_ee_data); + if (af_ee_data_local_JSON == NULL) { + ogs_error("OpenAPI_nrf_info_served_nef_info_value_convertToJSON() failed [af_ee_data]"); + goto end; + } + cJSON_AddItemToObject(item, "afEeData", af_ee_data_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_nrf_info_served_nef_info_value_convertToJSON() failed [af_ee_data]"); + goto end; + } + } + + if (nrf_info_served_nef_info_value->gpsi_ranges) { + cJSON *gpsi_rangesList = cJSON_AddArrayToObject(item, "gpsiRanges"); + if (gpsi_rangesList == NULL) { + ogs_error("OpenAPI_nrf_info_served_nef_info_value_convertToJSON() failed [gpsi_ranges]"); + goto end; + } + OpenAPI_list_for_each(nrf_info_served_nef_info_value->gpsi_ranges, node) { + cJSON *itemLocal = OpenAPI_identity_range_convertToJSON(node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_nrf_info_served_nef_info_value_convertToJSON() failed [gpsi_ranges]"); + goto end; + } + cJSON_AddItemToArray(gpsi_rangesList, itemLocal); + } + } + + if (nrf_info_served_nef_info_value->external_group_identifiers_ranges) { + cJSON *external_group_identifiers_rangesList = cJSON_AddArrayToObject(item, "externalGroupIdentifiersRanges"); + if (external_group_identifiers_rangesList == NULL) { + ogs_error("OpenAPI_nrf_info_served_nef_info_value_convertToJSON() failed [external_group_identifiers_ranges]"); + goto end; + } + OpenAPI_list_for_each(nrf_info_served_nef_info_value->external_group_identifiers_ranges, node) { + cJSON *itemLocal = OpenAPI_identity_range_convertToJSON(node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_nrf_info_served_nef_info_value_convertToJSON() failed [external_group_identifiers_ranges]"); + goto end; + } + cJSON_AddItemToArray(external_group_identifiers_rangesList, itemLocal); + } + } + + if (nrf_info_served_nef_info_value->served_fqdn_list) { + cJSON *served_fqdn_listList = cJSON_AddArrayToObject(item, "servedFqdnList"); + if (served_fqdn_listList == NULL) { + ogs_error("OpenAPI_nrf_info_served_nef_info_value_convertToJSON() failed [served_fqdn_list]"); + goto end; + } + OpenAPI_list_for_each(nrf_info_served_nef_info_value->served_fqdn_list, node) { + if (cJSON_AddStringToObject(served_fqdn_listList, "", (char*)node->data) == NULL) { + ogs_error("OpenAPI_nrf_info_served_nef_info_value_convertToJSON() failed [served_fqdn_list]"); + goto end; + } + } + } + + if (nrf_info_served_nef_info_value->tai_list) { + cJSON *tai_listList = cJSON_AddArrayToObject(item, "taiList"); + if (tai_listList == NULL) { + ogs_error("OpenAPI_nrf_info_served_nef_info_value_convertToJSON() failed [tai_list]"); + goto end; + } + OpenAPI_list_for_each(nrf_info_served_nef_info_value->tai_list, node) { + cJSON *itemLocal = OpenAPI_tai_convertToJSON(node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_nrf_info_served_nef_info_value_convertToJSON() failed [tai_list]"); + goto end; + } + cJSON_AddItemToArray(tai_listList, itemLocal); + } + } + + if (nrf_info_served_nef_info_value->tai_range_list) { + cJSON *tai_range_listList = cJSON_AddArrayToObject(item, "taiRangeList"); + if (tai_range_listList == NULL) { + ogs_error("OpenAPI_nrf_info_served_nef_info_value_convertToJSON() failed [tai_range_list]"); + goto end; + } + OpenAPI_list_for_each(nrf_info_served_nef_info_value->tai_range_list, node) { + cJSON *itemLocal = OpenAPI_tai_range_convertToJSON(node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_nrf_info_served_nef_info_value_convertToJSON() failed [tai_range_list]"); + goto end; + } + cJSON_AddItemToArray(tai_range_listList, itemLocal); + } + } + + if (nrf_info_served_nef_info_value->dnai_list) { + cJSON *dnai_listList = cJSON_AddArrayToObject(item, "dnaiList"); + if (dnai_listList == NULL) { + ogs_error("OpenAPI_nrf_info_served_nef_info_value_convertToJSON() failed [dnai_list]"); + goto end; + } + OpenAPI_list_for_each(nrf_info_served_nef_info_value->dnai_list, node) { + if (cJSON_AddStringToObject(dnai_listList, "", (char*)node->data) == NULL) { + ogs_error("OpenAPI_nrf_info_served_nef_info_value_convertToJSON() failed [dnai_list]"); + goto end; + } + } + } + + if (nrf_info_served_nef_info_value->un_trust_af_info_list) { + cJSON *un_trust_af_info_listList = cJSON_AddArrayToObject(item, "unTrustAfInfoList"); + if (un_trust_af_info_listList == NULL) { + ogs_error("OpenAPI_nrf_info_served_nef_info_value_convertToJSON() failed [un_trust_af_info_list]"); + goto end; + } + OpenAPI_list_for_each(nrf_info_served_nef_info_value->un_trust_af_info_list, node) { + cJSON *itemLocal = OpenAPI_un_trust_af_info_convertToJSON(node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_nrf_info_served_nef_info_value_convertToJSON() failed [un_trust_af_info_list]"); + goto end; + } + cJSON_AddItemToArray(un_trust_af_info_listList, itemLocal); + } + } + + if (nrf_info_served_nef_info_value->is_uas_nf_functionality_ind) { + if (cJSON_AddBoolToObject(item, "uasNfFunctionalityInd", nrf_info_served_nef_info_value->uas_nf_functionality_ind) == NULL) { + ogs_error("OpenAPI_nrf_info_served_nef_info_value_convertToJSON() failed [uas_nf_functionality_ind]"); + goto end; + } + } + +end: + return item; +} + +OpenAPI_nrf_info_served_nef_info_value_t *OpenAPI_nrf_info_served_nef_info_value_parseFromJSON(cJSON *nrf_info_served_nef_info_valueJSON) +{ + OpenAPI_nrf_info_served_nef_info_value_t *nrf_info_served_nef_info_value_local_var = NULL; + OpenAPI_lnode_t *node = NULL; + cJSON *nef_id = NULL; + cJSON *pfd_data = NULL; + OpenAPI_pfd_data_t *pfd_data_local_nonprim = NULL; + cJSON *af_ee_data = NULL; + OpenAPI_af_event_exposure_data_t *af_ee_data_local_nonprim = NULL; + cJSON *gpsi_ranges = NULL; + OpenAPI_list_t *gpsi_rangesList = NULL; + cJSON *external_group_identifiers_ranges = NULL; + OpenAPI_list_t *external_group_identifiers_rangesList = NULL; + cJSON *served_fqdn_list = NULL; + OpenAPI_list_t *served_fqdn_listList = NULL; + cJSON *tai_list = NULL; + OpenAPI_list_t *tai_listList = NULL; + cJSON *tai_range_list = NULL; + OpenAPI_list_t *tai_range_listList = NULL; + cJSON *dnai_list = NULL; + OpenAPI_list_t *dnai_listList = NULL; + cJSON *un_trust_af_info_list = NULL; + OpenAPI_list_t *un_trust_af_info_listList = NULL; + cJSON *uas_nf_functionality_ind = NULL; + nef_id = cJSON_GetObjectItemCaseSensitive(nrf_info_served_nef_info_valueJSON, "nefId"); + if (nef_id) { + if (!cJSON_IsString(nef_id) && !cJSON_IsNull(nef_id)) { + ogs_error("OpenAPI_nrf_info_served_nef_info_value_parseFromJSON() failed [nef_id]"); + goto end; + } + } + + pfd_data = cJSON_GetObjectItemCaseSensitive(nrf_info_served_nef_info_valueJSON, "pfdData"); + if (pfd_data) { + pfd_data_local_nonprim = OpenAPI_pfd_data_parseFromJSON(pfd_data); + } + + af_ee_data = cJSON_GetObjectItemCaseSensitive(nrf_info_served_nef_info_valueJSON, "afEeData"); + if (af_ee_data) { + af_ee_data_local_nonprim = OpenAPI_af_event_exposure_data_parseFromJSON(af_ee_data); + } + + gpsi_ranges = cJSON_GetObjectItemCaseSensitive(nrf_info_served_nef_info_valueJSON, "gpsiRanges"); + if (gpsi_ranges) { + cJSON *gpsi_ranges_local = NULL; + if (!cJSON_IsArray(gpsi_ranges)) { + ogs_error("OpenAPI_nrf_info_served_nef_info_value_parseFromJSON() failed [gpsi_ranges]"); + goto end; + } + + gpsi_rangesList = OpenAPI_list_create(); + + cJSON_ArrayForEach(gpsi_ranges_local, gpsi_ranges) { + if (!cJSON_IsObject(gpsi_ranges_local)) { + ogs_error("OpenAPI_nrf_info_served_nef_info_value_parseFromJSON() failed [gpsi_ranges]"); + goto end; + } + OpenAPI_identity_range_t *gpsi_rangesItem = OpenAPI_identity_range_parseFromJSON(gpsi_ranges_local); + if (!gpsi_rangesItem) { + ogs_error("No gpsi_rangesItem"); + OpenAPI_list_free(gpsi_rangesList); + goto end; + } + OpenAPI_list_add(gpsi_rangesList, gpsi_rangesItem); + } + } + + external_group_identifiers_ranges = cJSON_GetObjectItemCaseSensitive(nrf_info_served_nef_info_valueJSON, "externalGroupIdentifiersRanges"); + if (external_group_identifiers_ranges) { + cJSON *external_group_identifiers_ranges_local = NULL; + if (!cJSON_IsArray(external_group_identifiers_ranges)) { + ogs_error("OpenAPI_nrf_info_served_nef_info_value_parseFromJSON() failed [external_group_identifiers_ranges]"); + goto end; + } + + external_group_identifiers_rangesList = OpenAPI_list_create(); + + cJSON_ArrayForEach(external_group_identifiers_ranges_local, external_group_identifiers_ranges) { + if (!cJSON_IsObject(external_group_identifiers_ranges_local)) { + ogs_error("OpenAPI_nrf_info_served_nef_info_value_parseFromJSON() failed [external_group_identifiers_ranges]"); + goto end; + } + OpenAPI_identity_range_t *external_group_identifiers_rangesItem = OpenAPI_identity_range_parseFromJSON(external_group_identifiers_ranges_local); + if (!external_group_identifiers_rangesItem) { + ogs_error("No external_group_identifiers_rangesItem"); + OpenAPI_list_free(external_group_identifiers_rangesList); + goto end; + } + OpenAPI_list_add(external_group_identifiers_rangesList, external_group_identifiers_rangesItem); + } + } + + served_fqdn_list = cJSON_GetObjectItemCaseSensitive(nrf_info_served_nef_info_valueJSON, "servedFqdnList"); + if (served_fqdn_list) { + cJSON *served_fqdn_list_local = NULL; + if (!cJSON_IsArray(served_fqdn_list)) { + ogs_error("OpenAPI_nrf_info_served_nef_info_value_parseFromJSON() failed [served_fqdn_list]"); + goto end; + } + + served_fqdn_listList = OpenAPI_list_create(); + + cJSON_ArrayForEach(served_fqdn_list_local, served_fqdn_list) { + double *localDouble = NULL; + int *localInt = NULL; + if (!cJSON_IsString(served_fqdn_list_local)) { + ogs_error("OpenAPI_nrf_info_served_nef_info_value_parseFromJSON() failed [served_fqdn_list]"); + goto end; + } + OpenAPI_list_add(served_fqdn_listList, ogs_strdup(served_fqdn_list_local->valuestring)); + } + } + + tai_list = cJSON_GetObjectItemCaseSensitive(nrf_info_served_nef_info_valueJSON, "taiList"); + if (tai_list) { + cJSON *tai_list_local = NULL; + if (!cJSON_IsArray(tai_list)) { + ogs_error("OpenAPI_nrf_info_served_nef_info_value_parseFromJSON() failed [tai_list]"); + goto end; + } + + tai_listList = OpenAPI_list_create(); + + cJSON_ArrayForEach(tai_list_local, tai_list) { + if (!cJSON_IsObject(tai_list_local)) { + ogs_error("OpenAPI_nrf_info_served_nef_info_value_parseFromJSON() failed [tai_list]"); + goto end; + } + OpenAPI_tai_t *tai_listItem = OpenAPI_tai_parseFromJSON(tai_list_local); + if (!tai_listItem) { + ogs_error("No tai_listItem"); + OpenAPI_list_free(tai_listList); + goto end; + } + OpenAPI_list_add(tai_listList, tai_listItem); + } + } + + tai_range_list = cJSON_GetObjectItemCaseSensitive(nrf_info_served_nef_info_valueJSON, "taiRangeList"); + if (tai_range_list) { + cJSON *tai_range_list_local = NULL; + if (!cJSON_IsArray(tai_range_list)) { + ogs_error("OpenAPI_nrf_info_served_nef_info_value_parseFromJSON() failed [tai_range_list]"); + goto end; + } + + tai_range_listList = OpenAPI_list_create(); + + cJSON_ArrayForEach(tai_range_list_local, tai_range_list) { + if (!cJSON_IsObject(tai_range_list_local)) { + ogs_error("OpenAPI_nrf_info_served_nef_info_value_parseFromJSON() failed [tai_range_list]"); + goto end; + } + OpenAPI_tai_range_t *tai_range_listItem = OpenAPI_tai_range_parseFromJSON(tai_range_list_local); + if (!tai_range_listItem) { + ogs_error("No tai_range_listItem"); + OpenAPI_list_free(tai_range_listList); + goto end; + } + OpenAPI_list_add(tai_range_listList, tai_range_listItem); + } + } + + dnai_list = cJSON_GetObjectItemCaseSensitive(nrf_info_served_nef_info_valueJSON, "dnaiList"); + if (dnai_list) { + cJSON *dnai_list_local = NULL; + if (!cJSON_IsArray(dnai_list)) { + ogs_error("OpenAPI_nrf_info_served_nef_info_value_parseFromJSON() failed [dnai_list]"); + goto end; + } + + dnai_listList = OpenAPI_list_create(); + + cJSON_ArrayForEach(dnai_list_local, dnai_list) { + double *localDouble = NULL; + int *localInt = NULL; + if (!cJSON_IsString(dnai_list_local)) { + ogs_error("OpenAPI_nrf_info_served_nef_info_value_parseFromJSON() failed [dnai_list]"); + goto end; + } + OpenAPI_list_add(dnai_listList, ogs_strdup(dnai_list_local->valuestring)); + } + } + + un_trust_af_info_list = cJSON_GetObjectItemCaseSensitive(nrf_info_served_nef_info_valueJSON, "unTrustAfInfoList"); + if (un_trust_af_info_list) { + cJSON *un_trust_af_info_list_local = NULL; + if (!cJSON_IsArray(un_trust_af_info_list)) { + ogs_error("OpenAPI_nrf_info_served_nef_info_value_parseFromJSON() failed [un_trust_af_info_list]"); + goto end; + } + + un_trust_af_info_listList = OpenAPI_list_create(); + + cJSON_ArrayForEach(un_trust_af_info_list_local, un_trust_af_info_list) { + if (!cJSON_IsObject(un_trust_af_info_list_local)) { + ogs_error("OpenAPI_nrf_info_served_nef_info_value_parseFromJSON() failed [un_trust_af_info_list]"); + goto end; + } + OpenAPI_un_trust_af_info_t *un_trust_af_info_listItem = OpenAPI_un_trust_af_info_parseFromJSON(un_trust_af_info_list_local); + if (!un_trust_af_info_listItem) { + ogs_error("No un_trust_af_info_listItem"); + OpenAPI_list_free(un_trust_af_info_listList); + goto end; + } + OpenAPI_list_add(un_trust_af_info_listList, un_trust_af_info_listItem); + } + } + + uas_nf_functionality_ind = cJSON_GetObjectItemCaseSensitive(nrf_info_served_nef_info_valueJSON, "uasNfFunctionalityInd"); + if (uas_nf_functionality_ind) { + if (!cJSON_IsBool(uas_nf_functionality_ind)) { + ogs_error("OpenAPI_nrf_info_served_nef_info_value_parseFromJSON() failed [uas_nf_functionality_ind]"); + goto end; + } + } + + nrf_info_served_nef_info_value_local_var = OpenAPI_nrf_info_served_nef_info_value_create ( + nef_id && !cJSON_IsNull(nef_id) ? ogs_strdup(nef_id->valuestring) : NULL, + pfd_data ? pfd_data_local_nonprim : NULL, + af_ee_data ? af_ee_data_local_nonprim : NULL, + gpsi_ranges ? gpsi_rangesList : NULL, + external_group_identifiers_ranges ? external_group_identifiers_rangesList : NULL, + served_fqdn_list ? served_fqdn_listList : NULL, + tai_list ? tai_listList : NULL, + tai_range_list ? tai_range_listList : NULL, + dnai_list ? dnai_listList : NULL, + un_trust_af_info_list ? un_trust_af_info_listList : NULL, + uas_nf_functionality_ind ? true : false, + uas_nf_functionality_ind ? uas_nf_functionality_ind->valueint : 0 + ); + + return nrf_info_served_nef_info_value_local_var; +end: + if (pfd_data_local_nonprim) { + OpenAPI_pfd_data_free(pfd_data_local_nonprim); + pfd_data_local_nonprim = NULL; + } + if (af_ee_data_local_nonprim) { + OpenAPI_af_event_exposure_data_free(af_ee_data_local_nonprim); + af_ee_data_local_nonprim = NULL; + } + if (gpsi_rangesList) { + OpenAPI_list_for_each(gpsi_rangesList, node) { + OpenAPI_identity_range_free(node->data); + } + OpenAPI_list_free(gpsi_rangesList); + gpsi_rangesList = NULL; + } + if (external_group_identifiers_rangesList) { + OpenAPI_list_for_each(external_group_identifiers_rangesList, node) { + OpenAPI_identity_range_free(node->data); + } + OpenAPI_list_free(external_group_identifiers_rangesList); + external_group_identifiers_rangesList = NULL; + } + if (served_fqdn_listList) { + OpenAPI_list_for_each(served_fqdn_listList, node) { + ogs_free(node->data); + } + OpenAPI_list_free(served_fqdn_listList); + served_fqdn_listList = NULL; + } + if (tai_listList) { + OpenAPI_list_for_each(tai_listList, node) { + OpenAPI_tai_free(node->data); + } + OpenAPI_list_free(tai_listList); + tai_listList = NULL; + } + if (tai_range_listList) { + OpenAPI_list_for_each(tai_range_listList, node) { + OpenAPI_tai_range_free(node->data); + } + OpenAPI_list_free(tai_range_listList); + tai_range_listList = NULL; + } + if (dnai_listList) { + OpenAPI_list_for_each(dnai_listList, node) { + ogs_free(node->data); + } + OpenAPI_list_free(dnai_listList); + dnai_listList = NULL; + } + if (un_trust_af_info_listList) { + OpenAPI_list_for_each(un_trust_af_info_listList, node) { + OpenAPI_un_trust_af_info_free(node->data); + } + OpenAPI_list_free(un_trust_af_info_listList); + un_trust_af_info_listList = NULL; + } + return NULL; +} + +OpenAPI_nrf_info_served_nef_info_value_t *OpenAPI_nrf_info_served_nef_info_value_copy(OpenAPI_nrf_info_served_nef_info_value_t *dst, OpenAPI_nrf_info_served_nef_info_value_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_nrf_info_served_nef_info_value_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_nrf_info_served_nef_info_value_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_nrf_info_served_nef_info_value_free(dst); + dst = OpenAPI_nrf_info_served_nef_info_value_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/nrf_info_served_nef_info_value.h b/lib/sbi/openapi/model/nrf_info_served_nef_info_value.h new file mode 100644 index 000000000..4f917aeec --- /dev/null +++ b/lib/sbi/openapi/model/nrf_info_served_nef_info_value.h @@ -0,0 +1,67 @@ +/* + * nrf_info_served_nef_info_value.h + * + * + */ + +#ifndef _OpenAPI_nrf_info_served_nef_info_value_H_ +#define _OpenAPI_nrf_info_served_nef_info_value_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "af_event_exposure_data.h" +#include "identity_range.h" +#include "nef_info.h" +#include "pfd_data.h" +#include "tai.h" +#include "tai_range.h" +#include "un_trust_af_info.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_nrf_info_served_nef_info_value_s OpenAPI_nrf_info_served_nef_info_value_t; +typedef struct OpenAPI_nrf_info_served_nef_info_value_s { + char *nef_id; + struct OpenAPI_pfd_data_s *pfd_data; + struct OpenAPI_af_event_exposure_data_s *af_ee_data; + OpenAPI_list_t *gpsi_ranges; + OpenAPI_list_t *external_group_identifiers_ranges; + OpenAPI_list_t *served_fqdn_list; + OpenAPI_list_t *tai_list; + OpenAPI_list_t *tai_range_list; + OpenAPI_list_t *dnai_list; + OpenAPI_list_t *un_trust_af_info_list; + bool is_uas_nf_functionality_ind; + int uas_nf_functionality_ind; +} OpenAPI_nrf_info_served_nef_info_value_t; + +OpenAPI_nrf_info_served_nef_info_value_t *OpenAPI_nrf_info_served_nef_info_value_create( + char *nef_id, + OpenAPI_pfd_data_t *pfd_data, + OpenAPI_af_event_exposure_data_t *af_ee_data, + OpenAPI_list_t *gpsi_ranges, + OpenAPI_list_t *external_group_identifiers_ranges, + OpenAPI_list_t *served_fqdn_list, + OpenAPI_list_t *tai_list, + OpenAPI_list_t *tai_range_list, + OpenAPI_list_t *dnai_list, + OpenAPI_list_t *un_trust_af_info_list, + bool is_uas_nf_functionality_ind, + int uas_nf_functionality_ind +); +void OpenAPI_nrf_info_served_nef_info_value_free(OpenAPI_nrf_info_served_nef_info_value_t *nrf_info_served_nef_info_value); +OpenAPI_nrf_info_served_nef_info_value_t *OpenAPI_nrf_info_served_nef_info_value_parseFromJSON(cJSON *nrf_info_served_nef_info_valueJSON); +cJSON *OpenAPI_nrf_info_served_nef_info_value_convertToJSON(OpenAPI_nrf_info_served_nef_info_value_t *nrf_info_served_nef_info_value); +OpenAPI_nrf_info_served_nef_info_value_t *OpenAPI_nrf_info_served_nef_info_value_copy(OpenAPI_nrf_info_served_nef_info_value_t *dst, OpenAPI_nrf_info_served_nef_info_value_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_nrf_info_served_nef_info_value_H_ */ + diff --git a/lib/sbi/openapi/model/nrf_info_served_nwdaf_info_value.c b/lib/sbi/openapi/model/nrf_info_served_nwdaf_info_value.c new file mode 100644 index 000000000..d6299393d --- /dev/null +++ b/lib/sbi/openapi/model/nrf_info_served_nwdaf_info_value.c @@ -0,0 +1,540 @@ + +#include +#include +#include +#include "nrf_info_served_nwdaf_info_value.h" + +OpenAPI_nrf_info_served_nwdaf_info_value_t *OpenAPI_nrf_info_served_nwdaf_info_value_create( + OpenAPI_list_t *event_ids, + OpenAPI_list_t *nwdaf_events, + OpenAPI_list_t *tai_list, + OpenAPI_list_t *tai_range_list, + OpenAPI_nwdaf_capability_t *nwdaf_capability, + bool is_analytics_delay, + int analytics_delay, + OpenAPI_list_t *serving_nf_set_id_list, + OpenAPI_list_t *serving_nf_type_list, + OpenAPI_list_t *ml_analytics_list +) +{ + OpenAPI_nrf_info_served_nwdaf_info_value_t *nrf_info_served_nwdaf_info_value_local_var = ogs_malloc(sizeof(OpenAPI_nrf_info_served_nwdaf_info_value_t)); + ogs_assert(nrf_info_served_nwdaf_info_value_local_var); + + nrf_info_served_nwdaf_info_value_local_var->event_ids = event_ids; + nrf_info_served_nwdaf_info_value_local_var->nwdaf_events = nwdaf_events; + nrf_info_served_nwdaf_info_value_local_var->tai_list = tai_list; + nrf_info_served_nwdaf_info_value_local_var->tai_range_list = tai_range_list; + nrf_info_served_nwdaf_info_value_local_var->nwdaf_capability = nwdaf_capability; + nrf_info_served_nwdaf_info_value_local_var->is_analytics_delay = is_analytics_delay; + nrf_info_served_nwdaf_info_value_local_var->analytics_delay = analytics_delay; + nrf_info_served_nwdaf_info_value_local_var->serving_nf_set_id_list = serving_nf_set_id_list; + nrf_info_served_nwdaf_info_value_local_var->serving_nf_type_list = serving_nf_type_list; + nrf_info_served_nwdaf_info_value_local_var->ml_analytics_list = ml_analytics_list; + + return nrf_info_served_nwdaf_info_value_local_var; +} + +void OpenAPI_nrf_info_served_nwdaf_info_value_free(OpenAPI_nrf_info_served_nwdaf_info_value_t *nrf_info_served_nwdaf_info_value) +{ + OpenAPI_lnode_t *node = NULL; + + if (NULL == nrf_info_served_nwdaf_info_value) { + return; + } + if (nrf_info_served_nwdaf_info_value->event_ids) { + OpenAPI_list_for_each(nrf_info_served_nwdaf_info_value->event_ids, node) { + OpenAPI_event_id_free(node->data); + } + OpenAPI_list_free(nrf_info_served_nwdaf_info_value->event_ids); + nrf_info_served_nwdaf_info_value->event_ids = NULL; + } + if (nrf_info_served_nwdaf_info_value->nwdaf_events) { + OpenAPI_list_for_each(nrf_info_served_nwdaf_info_value->nwdaf_events, node) { + OpenAPI_nwdaf_event_free(node->data); + } + OpenAPI_list_free(nrf_info_served_nwdaf_info_value->nwdaf_events); + nrf_info_served_nwdaf_info_value->nwdaf_events = NULL; + } + if (nrf_info_served_nwdaf_info_value->tai_list) { + OpenAPI_list_for_each(nrf_info_served_nwdaf_info_value->tai_list, node) { + OpenAPI_tai_free(node->data); + } + OpenAPI_list_free(nrf_info_served_nwdaf_info_value->tai_list); + nrf_info_served_nwdaf_info_value->tai_list = NULL; + } + if (nrf_info_served_nwdaf_info_value->tai_range_list) { + OpenAPI_list_for_each(nrf_info_served_nwdaf_info_value->tai_range_list, node) { + OpenAPI_tai_range_free(node->data); + } + OpenAPI_list_free(nrf_info_served_nwdaf_info_value->tai_range_list); + nrf_info_served_nwdaf_info_value->tai_range_list = NULL; + } + if (nrf_info_served_nwdaf_info_value->nwdaf_capability) { + OpenAPI_nwdaf_capability_free(nrf_info_served_nwdaf_info_value->nwdaf_capability); + nrf_info_served_nwdaf_info_value->nwdaf_capability = NULL; + } + if (nrf_info_served_nwdaf_info_value->serving_nf_set_id_list) { + OpenAPI_list_for_each(nrf_info_served_nwdaf_info_value->serving_nf_set_id_list, node) { + ogs_free(node->data); + } + OpenAPI_list_free(nrf_info_served_nwdaf_info_value->serving_nf_set_id_list); + nrf_info_served_nwdaf_info_value->serving_nf_set_id_list = NULL; + } + if (nrf_info_served_nwdaf_info_value->serving_nf_type_list) { + OpenAPI_list_free(nrf_info_served_nwdaf_info_value->serving_nf_type_list); + nrf_info_served_nwdaf_info_value->serving_nf_type_list = NULL; + } + if (nrf_info_served_nwdaf_info_value->ml_analytics_list) { + OpenAPI_list_for_each(nrf_info_served_nwdaf_info_value->ml_analytics_list, node) { + OpenAPI_ml_analytics_info_free(node->data); + } + OpenAPI_list_free(nrf_info_served_nwdaf_info_value->ml_analytics_list); + nrf_info_served_nwdaf_info_value->ml_analytics_list = NULL; + } + ogs_free(nrf_info_served_nwdaf_info_value); +} + +cJSON *OpenAPI_nrf_info_served_nwdaf_info_value_convertToJSON(OpenAPI_nrf_info_served_nwdaf_info_value_t *nrf_info_served_nwdaf_info_value) +{ + cJSON *item = NULL; + OpenAPI_lnode_t *node = NULL; + + if (nrf_info_served_nwdaf_info_value == NULL) { + ogs_error("OpenAPI_nrf_info_served_nwdaf_info_value_convertToJSON() failed [NrfInfo_servedNwdafInfo_value]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (nrf_info_served_nwdaf_info_value->event_ids) { + cJSON *event_idsList = cJSON_AddArrayToObject(item, "eventIds"); + if (event_idsList == NULL) { + ogs_error("OpenAPI_nrf_info_served_nwdaf_info_value_convertToJSON() failed [event_ids]"); + goto end; + } + OpenAPI_list_for_each(nrf_info_served_nwdaf_info_value->event_ids, node) { + cJSON *itemLocal = OpenAPI_event_id_convertToJSON(node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_nrf_info_served_nwdaf_info_value_convertToJSON() failed [event_ids]"); + goto end; + } + cJSON_AddItemToArray(event_idsList, itemLocal); + } + } + + if (nrf_info_served_nwdaf_info_value->nwdaf_events) { + cJSON *nwdaf_eventsList = cJSON_AddArrayToObject(item, "nwdafEvents"); + if (nwdaf_eventsList == NULL) { + ogs_error("OpenAPI_nrf_info_served_nwdaf_info_value_convertToJSON() failed [nwdaf_events]"); + goto end; + } + OpenAPI_list_for_each(nrf_info_served_nwdaf_info_value->nwdaf_events, node) { + cJSON *itemLocal = OpenAPI_nwdaf_event_convertToJSON(node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_nrf_info_served_nwdaf_info_value_convertToJSON() failed [nwdaf_events]"); + goto end; + } + cJSON_AddItemToArray(nwdaf_eventsList, itemLocal); + } + } + + if (nrf_info_served_nwdaf_info_value->tai_list) { + cJSON *tai_listList = cJSON_AddArrayToObject(item, "taiList"); + if (tai_listList == NULL) { + ogs_error("OpenAPI_nrf_info_served_nwdaf_info_value_convertToJSON() failed [tai_list]"); + goto end; + } + OpenAPI_list_for_each(nrf_info_served_nwdaf_info_value->tai_list, node) { + cJSON *itemLocal = OpenAPI_tai_convertToJSON(node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_nrf_info_served_nwdaf_info_value_convertToJSON() failed [tai_list]"); + goto end; + } + cJSON_AddItemToArray(tai_listList, itemLocal); + } + } + + if (nrf_info_served_nwdaf_info_value->tai_range_list) { + cJSON *tai_range_listList = cJSON_AddArrayToObject(item, "taiRangeList"); + if (tai_range_listList == NULL) { + ogs_error("OpenAPI_nrf_info_served_nwdaf_info_value_convertToJSON() failed [tai_range_list]"); + goto end; + } + OpenAPI_list_for_each(nrf_info_served_nwdaf_info_value->tai_range_list, node) { + cJSON *itemLocal = OpenAPI_tai_range_convertToJSON(node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_nrf_info_served_nwdaf_info_value_convertToJSON() failed [tai_range_list]"); + goto end; + } + cJSON_AddItemToArray(tai_range_listList, itemLocal); + } + } + + if (nrf_info_served_nwdaf_info_value->nwdaf_capability) { + cJSON *nwdaf_capability_local_JSON = OpenAPI_nwdaf_capability_convertToJSON(nrf_info_served_nwdaf_info_value->nwdaf_capability); + if (nwdaf_capability_local_JSON == NULL) { + ogs_error("OpenAPI_nrf_info_served_nwdaf_info_value_convertToJSON() failed [nwdaf_capability]"); + goto end; + } + cJSON_AddItemToObject(item, "nwdafCapability", nwdaf_capability_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_nrf_info_served_nwdaf_info_value_convertToJSON() failed [nwdaf_capability]"); + goto end; + } + } + + if (nrf_info_served_nwdaf_info_value->is_analytics_delay) { + if (cJSON_AddNumberToObject(item, "analyticsDelay", nrf_info_served_nwdaf_info_value->analytics_delay) == NULL) { + ogs_error("OpenAPI_nrf_info_served_nwdaf_info_value_convertToJSON() failed [analytics_delay]"); + goto end; + } + } + + if (nrf_info_served_nwdaf_info_value->serving_nf_set_id_list) { + cJSON *serving_nf_set_id_listList = cJSON_AddArrayToObject(item, "servingNfSetIdList"); + if (serving_nf_set_id_listList == NULL) { + ogs_error("OpenAPI_nrf_info_served_nwdaf_info_value_convertToJSON() failed [serving_nf_set_id_list]"); + goto end; + } + OpenAPI_list_for_each(nrf_info_served_nwdaf_info_value->serving_nf_set_id_list, node) { + if (cJSON_AddStringToObject(serving_nf_set_id_listList, "", (char*)node->data) == NULL) { + ogs_error("OpenAPI_nrf_info_served_nwdaf_info_value_convertToJSON() failed [serving_nf_set_id_list]"); + goto end; + } + } + } + + if (nrf_info_served_nwdaf_info_value->serving_nf_type_list != OpenAPI_nf_type_NULL) { + cJSON *serving_nf_type_listList = cJSON_AddArrayToObject(item, "servingNfTypeList"); + if (serving_nf_type_listList == NULL) { + ogs_error("OpenAPI_nrf_info_served_nwdaf_info_value_convertToJSON() failed [serving_nf_type_list]"); + goto end; + } + OpenAPI_list_for_each(nrf_info_served_nwdaf_info_value->serving_nf_type_list, node) { + if (cJSON_AddStringToObject(serving_nf_type_listList, "", OpenAPI_nf_type_ToString((intptr_t)node->data)) == NULL) { + ogs_error("OpenAPI_nrf_info_served_nwdaf_info_value_convertToJSON() failed [serving_nf_type_list]"); + goto end; + } + } + } + + if (nrf_info_served_nwdaf_info_value->ml_analytics_list) { + cJSON *ml_analytics_listList = cJSON_AddArrayToObject(item, "mlAnalyticsList"); + if (ml_analytics_listList == NULL) { + ogs_error("OpenAPI_nrf_info_served_nwdaf_info_value_convertToJSON() failed [ml_analytics_list]"); + goto end; + } + OpenAPI_list_for_each(nrf_info_served_nwdaf_info_value->ml_analytics_list, node) { + cJSON *itemLocal = OpenAPI_ml_analytics_info_convertToJSON(node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_nrf_info_served_nwdaf_info_value_convertToJSON() failed [ml_analytics_list]"); + goto end; + } + cJSON_AddItemToArray(ml_analytics_listList, itemLocal); + } + } + +end: + return item; +} + +OpenAPI_nrf_info_served_nwdaf_info_value_t *OpenAPI_nrf_info_served_nwdaf_info_value_parseFromJSON(cJSON *nrf_info_served_nwdaf_info_valueJSON) +{ + OpenAPI_nrf_info_served_nwdaf_info_value_t *nrf_info_served_nwdaf_info_value_local_var = NULL; + OpenAPI_lnode_t *node = NULL; + cJSON *event_ids = NULL; + OpenAPI_list_t *event_idsList = NULL; + cJSON *nwdaf_events = NULL; + OpenAPI_list_t *nwdaf_eventsList = NULL; + cJSON *tai_list = NULL; + OpenAPI_list_t *tai_listList = NULL; + cJSON *tai_range_list = NULL; + OpenAPI_list_t *tai_range_listList = NULL; + cJSON *nwdaf_capability = NULL; + OpenAPI_nwdaf_capability_t *nwdaf_capability_local_nonprim = NULL; + cJSON *analytics_delay = NULL; + cJSON *serving_nf_set_id_list = NULL; + OpenAPI_list_t *serving_nf_set_id_listList = NULL; + cJSON *serving_nf_type_list = NULL; + OpenAPI_list_t *serving_nf_type_listList = NULL; + cJSON *ml_analytics_list = NULL; + OpenAPI_list_t *ml_analytics_listList = NULL; + event_ids = cJSON_GetObjectItemCaseSensitive(nrf_info_served_nwdaf_info_valueJSON, "eventIds"); + if (event_ids) { + cJSON *event_ids_local = NULL; + if (!cJSON_IsArray(event_ids)) { + ogs_error("OpenAPI_nrf_info_served_nwdaf_info_value_parseFromJSON() failed [event_ids]"); + goto end; + } + + event_idsList = OpenAPI_list_create(); + + cJSON_ArrayForEach(event_ids_local, event_ids) { + if (!cJSON_IsObject(event_ids_local)) { + ogs_error("OpenAPI_nrf_info_served_nwdaf_info_value_parseFromJSON() failed [event_ids]"); + goto end; + } + OpenAPI_event_id_t *event_idsItem = OpenAPI_event_id_parseFromJSON(event_ids_local); + if (!event_idsItem) { + ogs_error("No event_idsItem"); + OpenAPI_list_free(event_idsList); + goto end; + } + OpenAPI_list_add(event_idsList, event_idsItem); + } + } + + nwdaf_events = cJSON_GetObjectItemCaseSensitive(nrf_info_served_nwdaf_info_valueJSON, "nwdafEvents"); + if (nwdaf_events) { + cJSON *nwdaf_events_local = NULL; + if (!cJSON_IsArray(nwdaf_events)) { + ogs_error("OpenAPI_nrf_info_served_nwdaf_info_value_parseFromJSON() failed [nwdaf_events]"); + goto end; + } + + nwdaf_eventsList = OpenAPI_list_create(); + + cJSON_ArrayForEach(nwdaf_events_local, nwdaf_events) { + if (!cJSON_IsObject(nwdaf_events_local)) { + ogs_error("OpenAPI_nrf_info_served_nwdaf_info_value_parseFromJSON() failed [nwdaf_events]"); + goto end; + } + OpenAPI_nwdaf_event_t *nwdaf_eventsItem = OpenAPI_nwdaf_event_parseFromJSON(nwdaf_events_local); + if (!nwdaf_eventsItem) { + ogs_error("No nwdaf_eventsItem"); + OpenAPI_list_free(nwdaf_eventsList); + goto end; + } + OpenAPI_list_add(nwdaf_eventsList, nwdaf_eventsItem); + } + } + + tai_list = cJSON_GetObjectItemCaseSensitive(nrf_info_served_nwdaf_info_valueJSON, "taiList"); + if (tai_list) { + cJSON *tai_list_local = NULL; + if (!cJSON_IsArray(tai_list)) { + ogs_error("OpenAPI_nrf_info_served_nwdaf_info_value_parseFromJSON() failed [tai_list]"); + goto end; + } + + tai_listList = OpenAPI_list_create(); + + cJSON_ArrayForEach(tai_list_local, tai_list) { + if (!cJSON_IsObject(tai_list_local)) { + ogs_error("OpenAPI_nrf_info_served_nwdaf_info_value_parseFromJSON() failed [tai_list]"); + goto end; + } + OpenAPI_tai_t *tai_listItem = OpenAPI_tai_parseFromJSON(tai_list_local); + if (!tai_listItem) { + ogs_error("No tai_listItem"); + OpenAPI_list_free(tai_listList); + goto end; + } + OpenAPI_list_add(tai_listList, tai_listItem); + } + } + + tai_range_list = cJSON_GetObjectItemCaseSensitive(nrf_info_served_nwdaf_info_valueJSON, "taiRangeList"); + if (tai_range_list) { + cJSON *tai_range_list_local = NULL; + if (!cJSON_IsArray(tai_range_list)) { + ogs_error("OpenAPI_nrf_info_served_nwdaf_info_value_parseFromJSON() failed [tai_range_list]"); + goto end; + } + + tai_range_listList = OpenAPI_list_create(); + + cJSON_ArrayForEach(tai_range_list_local, tai_range_list) { + if (!cJSON_IsObject(tai_range_list_local)) { + ogs_error("OpenAPI_nrf_info_served_nwdaf_info_value_parseFromJSON() failed [tai_range_list]"); + goto end; + } + OpenAPI_tai_range_t *tai_range_listItem = OpenAPI_tai_range_parseFromJSON(tai_range_list_local); + if (!tai_range_listItem) { + ogs_error("No tai_range_listItem"); + OpenAPI_list_free(tai_range_listList); + goto end; + } + OpenAPI_list_add(tai_range_listList, tai_range_listItem); + } + } + + nwdaf_capability = cJSON_GetObjectItemCaseSensitive(nrf_info_served_nwdaf_info_valueJSON, "nwdafCapability"); + if (nwdaf_capability) { + nwdaf_capability_local_nonprim = OpenAPI_nwdaf_capability_parseFromJSON(nwdaf_capability); + } + + analytics_delay = cJSON_GetObjectItemCaseSensitive(nrf_info_served_nwdaf_info_valueJSON, "analyticsDelay"); + if (analytics_delay) { + if (!cJSON_IsNumber(analytics_delay)) { + ogs_error("OpenAPI_nrf_info_served_nwdaf_info_value_parseFromJSON() failed [analytics_delay]"); + goto end; + } + } + + serving_nf_set_id_list = cJSON_GetObjectItemCaseSensitive(nrf_info_served_nwdaf_info_valueJSON, "servingNfSetIdList"); + if (serving_nf_set_id_list) { + cJSON *serving_nf_set_id_list_local = NULL; + if (!cJSON_IsArray(serving_nf_set_id_list)) { + ogs_error("OpenAPI_nrf_info_served_nwdaf_info_value_parseFromJSON() failed [serving_nf_set_id_list]"); + goto end; + } + + serving_nf_set_id_listList = OpenAPI_list_create(); + + cJSON_ArrayForEach(serving_nf_set_id_list_local, serving_nf_set_id_list) { + double *localDouble = NULL; + int *localInt = NULL; + if (!cJSON_IsString(serving_nf_set_id_list_local)) { + ogs_error("OpenAPI_nrf_info_served_nwdaf_info_value_parseFromJSON() failed [serving_nf_set_id_list]"); + goto end; + } + OpenAPI_list_add(serving_nf_set_id_listList, ogs_strdup(serving_nf_set_id_list_local->valuestring)); + } + } + + serving_nf_type_list = cJSON_GetObjectItemCaseSensitive(nrf_info_served_nwdaf_info_valueJSON, "servingNfTypeList"); + if (serving_nf_type_list) { + cJSON *serving_nf_type_list_local = NULL; + if (!cJSON_IsArray(serving_nf_type_list)) { + ogs_error("OpenAPI_nrf_info_served_nwdaf_info_value_parseFromJSON() failed [serving_nf_type_list]"); + goto end; + } + + serving_nf_type_listList = OpenAPI_list_create(); + + cJSON_ArrayForEach(serving_nf_type_list_local, serving_nf_type_list) { + if (!cJSON_IsString(serving_nf_type_list_local)) { + ogs_error("OpenAPI_nrf_info_served_nwdaf_info_value_parseFromJSON() failed [serving_nf_type_list]"); + goto end; + } + OpenAPI_list_add(serving_nf_type_listList, (void *)OpenAPI_nf_type_FromString(serving_nf_type_list_local->valuestring)); + } + } + + ml_analytics_list = cJSON_GetObjectItemCaseSensitive(nrf_info_served_nwdaf_info_valueJSON, "mlAnalyticsList"); + if (ml_analytics_list) { + cJSON *ml_analytics_list_local = NULL; + if (!cJSON_IsArray(ml_analytics_list)) { + ogs_error("OpenAPI_nrf_info_served_nwdaf_info_value_parseFromJSON() failed [ml_analytics_list]"); + goto end; + } + + ml_analytics_listList = OpenAPI_list_create(); + + cJSON_ArrayForEach(ml_analytics_list_local, ml_analytics_list) { + if (!cJSON_IsObject(ml_analytics_list_local)) { + ogs_error("OpenAPI_nrf_info_served_nwdaf_info_value_parseFromJSON() failed [ml_analytics_list]"); + goto end; + } + OpenAPI_ml_analytics_info_t *ml_analytics_listItem = OpenAPI_ml_analytics_info_parseFromJSON(ml_analytics_list_local); + if (!ml_analytics_listItem) { + ogs_error("No ml_analytics_listItem"); + OpenAPI_list_free(ml_analytics_listList); + goto end; + } + OpenAPI_list_add(ml_analytics_listList, ml_analytics_listItem); + } + } + + nrf_info_served_nwdaf_info_value_local_var = OpenAPI_nrf_info_served_nwdaf_info_value_create ( + event_ids ? event_idsList : NULL, + nwdaf_events ? nwdaf_eventsList : NULL, + tai_list ? tai_listList : NULL, + tai_range_list ? tai_range_listList : NULL, + nwdaf_capability ? nwdaf_capability_local_nonprim : NULL, + analytics_delay ? true : false, + analytics_delay ? analytics_delay->valuedouble : 0, + serving_nf_set_id_list ? serving_nf_set_id_listList : NULL, + serving_nf_type_list ? serving_nf_type_listList : NULL, + ml_analytics_list ? ml_analytics_listList : NULL + ); + + return nrf_info_served_nwdaf_info_value_local_var; +end: + if (event_idsList) { + OpenAPI_list_for_each(event_idsList, node) { + OpenAPI_event_id_free(node->data); + } + OpenAPI_list_free(event_idsList); + event_idsList = NULL; + } + if (nwdaf_eventsList) { + OpenAPI_list_for_each(nwdaf_eventsList, node) { + OpenAPI_nwdaf_event_free(node->data); + } + OpenAPI_list_free(nwdaf_eventsList); + nwdaf_eventsList = NULL; + } + if (tai_listList) { + OpenAPI_list_for_each(tai_listList, node) { + OpenAPI_tai_free(node->data); + } + OpenAPI_list_free(tai_listList); + tai_listList = NULL; + } + if (tai_range_listList) { + OpenAPI_list_for_each(tai_range_listList, node) { + OpenAPI_tai_range_free(node->data); + } + OpenAPI_list_free(tai_range_listList); + tai_range_listList = NULL; + } + if (nwdaf_capability_local_nonprim) { + OpenAPI_nwdaf_capability_free(nwdaf_capability_local_nonprim); + nwdaf_capability_local_nonprim = NULL; + } + if (serving_nf_set_id_listList) { + OpenAPI_list_for_each(serving_nf_set_id_listList, node) { + ogs_free(node->data); + } + OpenAPI_list_free(serving_nf_set_id_listList); + serving_nf_set_id_listList = NULL; + } + if (serving_nf_type_listList) { + OpenAPI_list_free(serving_nf_type_listList); + serving_nf_type_listList = NULL; + } + if (ml_analytics_listList) { + OpenAPI_list_for_each(ml_analytics_listList, node) { + OpenAPI_ml_analytics_info_free(node->data); + } + OpenAPI_list_free(ml_analytics_listList); + ml_analytics_listList = NULL; + } + return NULL; +} + +OpenAPI_nrf_info_served_nwdaf_info_value_t *OpenAPI_nrf_info_served_nwdaf_info_value_copy(OpenAPI_nrf_info_served_nwdaf_info_value_t *dst, OpenAPI_nrf_info_served_nwdaf_info_value_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_nrf_info_served_nwdaf_info_value_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_nrf_info_served_nwdaf_info_value_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_nrf_info_served_nwdaf_info_value_free(dst); + dst = OpenAPI_nrf_info_served_nwdaf_info_value_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/nrf_info_served_nwdaf_info_value.h b/lib/sbi/openapi/model/nrf_info_served_nwdaf_info_value.h new file mode 100644 index 000000000..4e3ff9afd --- /dev/null +++ b/lib/sbi/openapi/model/nrf_info_served_nwdaf_info_value.h @@ -0,0 +1,64 @@ +/* + * nrf_info_served_nwdaf_info_value.h + * + * + */ + +#ifndef _OpenAPI_nrf_info_served_nwdaf_info_value_H_ +#define _OpenAPI_nrf_info_served_nwdaf_info_value_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "event_id.h" +#include "ml_analytics_info.h" +#include "nf_type.h" +#include "nwdaf_capability.h" +#include "nwdaf_event.h" +#include "nwdaf_info.h" +#include "tai.h" +#include "tai_range.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_nrf_info_served_nwdaf_info_value_s OpenAPI_nrf_info_served_nwdaf_info_value_t; +typedef struct OpenAPI_nrf_info_served_nwdaf_info_value_s { + OpenAPI_list_t *event_ids; + OpenAPI_list_t *nwdaf_events; + OpenAPI_list_t *tai_list; + OpenAPI_list_t *tai_range_list; + struct OpenAPI_nwdaf_capability_s *nwdaf_capability; + bool is_analytics_delay; + int analytics_delay; + OpenAPI_list_t *serving_nf_set_id_list; + OpenAPI_list_t *serving_nf_type_list; + OpenAPI_list_t *ml_analytics_list; +} OpenAPI_nrf_info_served_nwdaf_info_value_t; + +OpenAPI_nrf_info_served_nwdaf_info_value_t *OpenAPI_nrf_info_served_nwdaf_info_value_create( + OpenAPI_list_t *event_ids, + OpenAPI_list_t *nwdaf_events, + OpenAPI_list_t *tai_list, + OpenAPI_list_t *tai_range_list, + OpenAPI_nwdaf_capability_t *nwdaf_capability, + bool is_analytics_delay, + int analytics_delay, + OpenAPI_list_t *serving_nf_set_id_list, + OpenAPI_list_t *serving_nf_type_list, + OpenAPI_list_t *ml_analytics_list +); +void OpenAPI_nrf_info_served_nwdaf_info_value_free(OpenAPI_nrf_info_served_nwdaf_info_value_t *nrf_info_served_nwdaf_info_value); +OpenAPI_nrf_info_served_nwdaf_info_value_t *OpenAPI_nrf_info_served_nwdaf_info_value_parseFromJSON(cJSON *nrf_info_served_nwdaf_info_valueJSON); +cJSON *OpenAPI_nrf_info_served_nwdaf_info_value_convertToJSON(OpenAPI_nrf_info_served_nwdaf_info_value_t *nrf_info_served_nwdaf_info_value); +OpenAPI_nrf_info_served_nwdaf_info_value_t *OpenAPI_nrf_info_served_nwdaf_info_value_copy(OpenAPI_nrf_info_served_nwdaf_info_value_t *dst, OpenAPI_nrf_info_served_nwdaf_info_value_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_nrf_info_served_nwdaf_info_value_H_ */ + diff --git a/lib/sbi/openapi/model/nrf_info_served_pcf_info_value.c b/lib/sbi/openapi/model/nrf_info_served_pcf_info_value.c new file mode 100644 index 000000000..aae2b43c3 --- /dev/null +++ b/lib/sbi/openapi/model/nrf_info_served_pcf_info_value.c @@ -0,0 +1,436 @@ + +#include +#include +#include +#include "nrf_info_served_pcf_info_value.h" + +OpenAPI_nrf_info_served_pcf_info_value_t *OpenAPI_nrf_info_served_pcf_info_value_create( + char *group_id, + OpenAPI_list_t *dnn_list, + OpenAPI_list_t *supi_ranges, + OpenAPI_list_t *gpsi_ranges, + char *rx_diam_host, + char *rx_diam_realm, + bool is_v2x_support_ind, + int v2x_support_ind, + bool is_prose_support_ind, + int prose_support_ind, + OpenAPI_pro_se_capability_t *prose_capability, + OpenAPI_v2x_capability_t *v2x_capability +) +{ + OpenAPI_nrf_info_served_pcf_info_value_t *nrf_info_served_pcf_info_value_local_var = ogs_malloc(sizeof(OpenAPI_nrf_info_served_pcf_info_value_t)); + ogs_assert(nrf_info_served_pcf_info_value_local_var); + + nrf_info_served_pcf_info_value_local_var->group_id = group_id; + nrf_info_served_pcf_info_value_local_var->dnn_list = dnn_list; + nrf_info_served_pcf_info_value_local_var->supi_ranges = supi_ranges; + nrf_info_served_pcf_info_value_local_var->gpsi_ranges = gpsi_ranges; + nrf_info_served_pcf_info_value_local_var->rx_diam_host = rx_diam_host; + nrf_info_served_pcf_info_value_local_var->rx_diam_realm = rx_diam_realm; + nrf_info_served_pcf_info_value_local_var->is_v2x_support_ind = is_v2x_support_ind; + nrf_info_served_pcf_info_value_local_var->v2x_support_ind = v2x_support_ind; + nrf_info_served_pcf_info_value_local_var->is_prose_support_ind = is_prose_support_ind; + nrf_info_served_pcf_info_value_local_var->prose_support_ind = prose_support_ind; + nrf_info_served_pcf_info_value_local_var->prose_capability = prose_capability; + nrf_info_served_pcf_info_value_local_var->v2x_capability = v2x_capability; + + return nrf_info_served_pcf_info_value_local_var; +} + +void OpenAPI_nrf_info_served_pcf_info_value_free(OpenAPI_nrf_info_served_pcf_info_value_t *nrf_info_served_pcf_info_value) +{ + OpenAPI_lnode_t *node = NULL; + + if (NULL == nrf_info_served_pcf_info_value) { + return; + } + if (nrf_info_served_pcf_info_value->group_id) { + ogs_free(nrf_info_served_pcf_info_value->group_id); + nrf_info_served_pcf_info_value->group_id = NULL; + } + if (nrf_info_served_pcf_info_value->dnn_list) { + OpenAPI_list_for_each(nrf_info_served_pcf_info_value->dnn_list, node) { + ogs_free(node->data); + } + OpenAPI_list_free(nrf_info_served_pcf_info_value->dnn_list); + nrf_info_served_pcf_info_value->dnn_list = NULL; + } + if (nrf_info_served_pcf_info_value->supi_ranges) { + OpenAPI_list_for_each(nrf_info_served_pcf_info_value->supi_ranges, node) { + OpenAPI_supi_range_free(node->data); + } + OpenAPI_list_free(nrf_info_served_pcf_info_value->supi_ranges); + nrf_info_served_pcf_info_value->supi_ranges = NULL; + } + if (nrf_info_served_pcf_info_value->gpsi_ranges) { + OpenAPI_list_for_each(nrf_info_served_pcf_info_value->gpsi_ranges, node) { + OpenAPI_identity_range_free(node->data); + } + OpenAPI_list_free(nrf_info_served_pcf_info_value->gpsi_ranges); + nrf_info_served_pcf_info_value->gpsi_ranges = NULL; + } + if (nrf_info_served_pcf_info_value->rx_diam_host) { + ogs_free(nrf_info_served_pcf_info_value->rx_diam_host); + nrf_info_served_pcf_info_value->rx_diam_host = NULL; + } + if (nrf_info_served_pcf_info_value->rx_diam_realm) { + ogs_free(nrf_info_served_pcf_info_value->rx_diam_realm); + nrf_info_served_pcf_info_value->rx_diam_realm = NULL; + } + if (nrf_info_served_pcf_info_value->prose_capability) { + OpenAPI_pro_se_capability_free(nrf_info_served_pcf_info_value->prose_capability); + nrf_info_served_pcf_info_value->prose_capability = NULL; + } + if (nrf_info_served_pcf_info_value->v2x_capability) { + OpenAPI_v2x_capability_free(nrf_info_served_pcf_info_value->v2x_capability); + nrf_info_served_pcf_info_value->v2x_capability = NULL; + } + ogs_free(nrf_info_served_pcf_info_value); +} + +cJSON *OpenAPI_nrf_info_served_pcf_info_value_convertToJSON(OpenAPI_nrf_info_served_pcf_info_value_t *nrf_info_served_pcf_info_value) +{ + cJSON *item = NULL; + OpenAPI_lnode_t *node = NULL; + + if (nrf_info_served_pcf_info_value == NULL) { + ogs_error("OpenAPI_nrf_info_served_pcf_info_value_convertToJSON() failed [NrfInfo_servedPcfInfo_value]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (nrf_info_served_pcf_info_value->group_id) { + if (cJSON_AddStringToObject(item, "groupId", nrf_info_served_pcf_info_value->group_id) == NULL) { + ogs_error("OpenAPI_nrf_info_served_pcf_info_value_convertToJSON() failed [group_id]"); + goto end; + } + } + + if (nrf_info_served_pcf_info_value->dnn_list) { + cJSON *dnn_listList = cJSON_AddArrayToObject(item, "dnnList"); + if (dnn_listList == NULL) { + ogs_error("OpenAPI_nrf_info_served_pcf_info_value_convertToJSON() failed [dnn_list]"); + goto end; + } + OpenAPI_list_for_each(nrf_info_served_pcf_info_value->dnn_list, node) { + if (cJSON_AddStringToObject(dnn_listList, "", (char*)node->data) == NULL) { + ogs_error("OpenAPI_nrf_info_served_pcf_info_value_convertToJSON() failed [dnn_list]"); + goto end; + } + } + } + + if (nrf_info_served_pcf_info_value->supi_ranges) { + cJSON *supi_rangesList = cJSON_AddArrayToObject(item, "supiRanges"); + if (supi_rangesList == NULL) { + ogs_error("OpenAPI_nrf_info_served_pcf_info_value_convertToJSON() failed [supi_ranges]"); + goto end; + } + OpenAPI_list_for_each(nrf_info_served_pcf_info_value->supi_ranges, node) { + cJSON *itemLocal = OpenAPI_supi_range_convertToJSON(node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_nrf_info_served_pcf_info_value_convertToJSON() failed [supi_ranges]"); + goto end; + } + cJSON_AddItemToArray(supi_rangesList, itemLocal); + } + } + + if (nrf_info_served_pcf_info_value->gpsi_ranges) { + cJSON *gpsi_rangesList = cJSON_AddArrayToObject(item, "gpsiRanges"); + if (gpsi_rangesList == NULL) { + ogs_error("OpenAPI_nrf_info_served_pcf_info_value_convertToJSON() failed [gpsi_ranges]"); + goto end; + } + OpenAPI_list_for_each(nrf_info_served_pcf_info_value->gpsi_ranges, node) { + cJSON *itemLocal = OpenAPI_identity_range_convertToJSON(node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_nrf_info_served_pcf_info_value_convertToJSON() failed [gpsi_ranges]"); + goto end; + } + cJSON_AddItemToArray(gpsi_rangesList, itemLocal); + } + } + + if (nrf_info_served_pcf_info_value->rx_diam_host) { + if (cJSON_AddStringToObject(item, "rxDiamHost", nrf_info_served_pcf_info_value->rx_diam_host) == NULL) { + ogs_error("OpenAPI_nrf_info_served_pcf_info_value_convertToJSON() failed [rx_diam_host]"); + goto end; + } + } + + if (nrf_info_served_pcf_info_value->rx_diam_realm) { + if (cJSON_AddStringToObject(item, "rxDiamRealm", nrf_info_served_pcf_info_value->rx_diam_realm) == NULL) { + ogs_error("OpenAPI_nrf_info_served_pcf_info_value_convertToJSON() failed [rx_diam_realm]"); + goto end; + } + } + + if (nrf_info_served_pcf_info_value->is_v2x_support_ind) { + if (cJSON_AddBoolToObject(item, "v2xSupportInd", nrf_info_served_pcf_info_value->v2x_support_ind) == NULL) { + ogs_error("OpenAPI_nrf_info_served_pcf_info_value_convertToJSON() failed [v2x_support_ind]"); + goto end; + } + } + + if (nrf_info_served_pcf_info_value->is_prose_support_ind) { + if (cJSON_AddBoolToObject(item, "proseSupportInd", nrf_info_served_pcf_info_value->prose_support_ind) == NULL) { + ogs_error("OpenAPI_nrf_info_served_pcf_info_value_convertToJSON() failed [prose_support_ind]"); + goto end; + } + } + + if (nrf_info_served_pcf_info_value->prose_capability) { + cJSON *prose_capability_local_JSON = OpenAPI_pro_se_capability_convertToJSON(nrf_info_served_pcf_info_value->prose_capability); + if (prose_capability_local_JSON == NULL) { + ogs_error("OpenAPI_nrf_info_served_pcf_info_value_convertToJSON() failed [prose_capability]"); + goto end; + } + cJSON_AddItemToObject(item, "proseCapability", prose_capability_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_nrf_info_served_pcf_info_value_convertToJSON() failed [prose_capability]"); + goto end; + } + } + + if (nrf_info_served_pcf_info_value->v2x_capability) { + cJSON *v2x_capability_local_JSON = OpenAPI_v2x_capability_convertToJSON(nrf_info_served_pcf_info_value->v2x_capability); + if (v2x_capability_local_JSON == NULL) { + ogs_error("OpenAPI_nrf_info_served_pcf_info_value_convertToJSON() failed [v2x_capability]"); + goto end; + } + cJSON_AddItemToObject(item, "v2xCapability", v2x_capability_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_nrf_info_served_pcf_info_value_convertToJSON() failed [v2x_capability]"); + goto end; + } + } + +end: + return item; +} + +OpenAPI_nrf_info_served_pcf_info_value_t *OpenAPI_nrf_info_served_pcf_info_value_parseFromJSON(cJSON *nrf_info_served_pcf_info_valueJSON) +{ + OpenAPI_nrf_info_served_pcf_info_value_t *nrf_info_served_pcf_info_value_local_var = NULL; + OpenAPI_lnode_t *node = NULL; + cJSON *group_id = NULL; + cJSON *dnn_list = NULL; + OpenAPI_list_t *dnn_listList = NULL; + cJSON *supi_ranges = NULL; + OpenAPI_list_t *supi_rangesList = NULL; + cJSON *gpsi_ranges = NULL; + OpenAPI_list_t *gpsi_rangesList = NULL; + cJSON *rx_diam_host = NULL; + cJSON *rx_diam_realm = NULL; + cJSON *v2x_support_ind = NULL; + cJSON *prose_support_ind = NULL; + cJSON *prose_capability = NULL; + OpenAPI_pro_se_capability_t *prose_capability_local_nonprim = NULL; + cJSON *v2x_capability = NULL; + OpenAPI_v2x_capability_t *v2x_capability_local_nonprim = NULL; + group_id = cJSON_GetObjectItemCaseSensitive(nrf_info_served_pcf_info_valueJSON, "groupId"); + if (group_id) { + if (!cJSON_IsString(group_id) && !cJSON_IsNull(group_id)) { + ogs_error("OpenAPI_nrf_info_served_pcf_info_value_parseFromJSON() failed [group_id]"); + goto end; + } + } + + dnn_list = cJSON_GetObjectItemCaseSensitive(nrf_info_served_pcf_info_valueJSON, "dnnList"); + if (dnn_list) { + cJSON *dnn_list_local = NULL; + if (!cJSON_IsArray(dnn_list)) { + ogs_error("OpenAPI_nrf_info_served_pcf_info_value_parseFromJSON() failed [dnn_list]"); + goto end; + } + + dnn_listList = OpenAPI_list_create(); + + cJSON_ArrayForEach(dnn_list_local, dnn_list) { + double *localDouble = NULL; + int *localInt = NULL; + if (!cJSON_IsString(dnn_list_local)) { + ogs_error("OpenAPI_nrf_info_served_pcf_info_value_parseFromJSON() failed [dnn_list]"); + goto end; + } + OpenAPI_list_add(dnn_listList, ogs_strdup(dnn_list_local->valuestring)); + } + } + + supi_ranges = cJSON_GetObjectItemCaseSensitive(nrf_info_served_pcf_info_valueJSON, "supiRanges"); + if (supi_ranges) { + cJSON *supi_ranges_local = NULL; + if (!cJSON_IsArray(supi_ranges)) { + ogs_error("OpenAPI_nrf_info_served_pcf_info_value_parseFromJSON() failed [supi_ranges]"); + goto end; + } + + supi_rangesList = OpenAPI_list_create(); + + cJSON_ArrayForEach(supi_ranges_local, supi_ranges) { + if (!cJSON_IsObject(supi_ranges_local)) { + ogs_error("OpenAPI_nrf_info_served_pcf_info_value_parseFromJSON() failed [supi_ranges]"); + goto end; + } + OpenAPI_supi_range_t *supi_rangesItem = OpenAPI_supi_range_parseFromJSON(supi_ranges_local); + if (!supi_rangesItem) { + ogs_error("No supi_rangesItem"); + OpenAPI_list_free(supi_rangesList); + goto end; + } + OpenAPI_list_add(supi_rangesList, supi_rangesItem); + } + } + + gpsi_ranges = cJSON_GetObjectItemCaseSensitive(nrf_info_served_pcf_info_valueJSON, "gpsiRanges"); + if (gpsi_ranges) { + cJSON *gpsi_ranges_local = NULL; + if (!cJSON_IsArray(gpsi_ranges)) { + ogs_error("OpenAPI_nrf_info_served_pcf_info_value_parseFromJSON() failed [gpsi_ranges]"); + goto end; + } + + gpsi_rangesList = OpenAPI_list_create(); + + cJSON_ArrayForEach(gpsi_ranges_local, gpsi_ranges) { + if (!cJSON_IsObject(gpsi_ranges_local)) { + ogs_error("OpenAPI_nrf_info_served_pcf_info_value_parseFromJSON() failed [gpsi_ranges]"); + goto end; + } + OpenAPI_identity_range_t *gpsi_rangesItem = OpenAPI_identity_range_parseFromJSON(gpsi_ranges_local); + if (!gpsi_rangesItem) { + ogs_error("No gpsi_rangesItem"); + OpenAPI_list_free(gpsi_rangesList); + goto end; + } + OpenAPI_list_add(gpsi_rangesList, gpsi_rangesItem); + } + } + + rx_diam_host = cJSON_GetObjectItemCaseSensitive(nrf_info_served_pcf_info_valueJSON, "rxDiamHost"); + if (rx_diam_host) { + if (!cJSON_IsString(rx_diam_host) && !cJSON_IsNull(rx_diam_host)) { + ogs_error("OpenAPI_nrf_info_served_pcf_info_value_parseFromJSON() failed [rx_diam_host]"); + goto end; + } + } + + rx_diam_realm = cJSON_GetObjectItemCaseSensitive(nrf_info_served_pcf_info_valueJSON, "rxDiamRealm"); + if (rx_diam_realm) { + if (!cJSON_IsString(rx_diam_realm) && !cJSON_IsNull(rx_diam_realm)) { + ogs_error("OpenAPI_nrf_info_served_pcf_info_value_parseFromJSON() failed [rx_diam_realm]"); + goto end; + } + } + + v2x_support_ind = cJSON_GetObjectItemCaseSensitive(nrf_info_served_pcf_info_valueJSON, "v2xSupportInd"); + if (v2x_support_ind) { + if (!cJSON_IsBool(v2x_support_ind)) { + ogs_error("OpenAPI_nrf_info_served_pcf_info_value_parseFromJSON() failed [v2x_support_ind]"); + goto end; + } + } + + prose_support_ind = cJSON_GetObjectItemCaseSensitive(nrf_info_served_pcf_info_valueJSON, "proseSupportInd"); + if (prose_support_ind) { + if (!cJSON_IsBool(prose_support_ind)) { + ogs_error("OpenAPI_nrf_info_served_pcf_info_value_parseFromJSON() failed [prose_support_ind]"); + goto end; + } + } + + prose_capability = cJSON_GetObjectItemCaseSensitive(nrf_info_served_pcf_info_valueJSON, "proseCapability"); + if (prose_capability) { + prose_capability_local_nonprim = OpenAPI_pro_se_capability_parseFromJSON(prose_capability); + } + + v2x_capability = cJSON_GetObjectItemCaseSensitive(nrf_info_served_pcf_info_valueJSON, "v2xCapability"); + if (v2x_capability) { + v2x_capability_local_nonprim = OpenAPI_v2x_capability_parseFromJSON(v2x_capability); + } + + nrf_info_served_pcf_info_value_local_var = OpenAPI_nrf_info_served_pcf_info_value_create ( + group_id && !cJSON_IsNull(group_id) ? ogs_strdup(group_id->valuestring) : NULL, + dnn_list ? dnn_listList : NULL, + supi_ranges ? supi_rangesList : NULL, + gpsi_ranges ? gpsi_rangesList : NULL, + rx_diam_host && !cJSON_IsNull(rx_diam_host) ? ogs_strdup(rx_diam_host->valuestring) : NULL, + rx_diam_realm && !cJSON_IsNull(rx_diam_realm) ? ogs_strdup(rx_diam_realm->valuestring) : NULL, + v2x_support_ind ? true : false, + v2x_support_ind ? v2x_support_ind->valueint : 0, + prose_support_ind ? true : false, + prose_support_ind ? prose_support_ind->valueint : 0, + prose_capability ? prose_capability_local_nonprim : NULL, + v2x_capability ? v2x_capability_local_nonprim : NULL + ); + + return nrf_info_served_pcf_info_value_local_var; +end: + if (dnn_listList) { + OpenAPI_list_for_each(dnn_listList, node) { + ogs_free(node->data); + } + OpenAPI_list_free(dnn_listList); + dnn_listList = NULL; + } + if (supi_rangesList) { + OpenAPI_list_for_each(supi_rangesList, node) { + OpenAPI_supi_range_free(node->data); + } + OpenAPI_list_free(supi_rangesList); + supi_rangesList = NULL; + } + if (gpsi_rangesList) { + OpenAPI_list_for_each(gpsi_rangesList, node) { + OpenAPI_identity_range_free(node->data); + } + OpenAPI_list_free(gpsi_rangesList); + gpsi_rangesList = NULL; + } + if (prose_capability_local_nonprim) { + OpenAPI_pro_se_capability_free(prose_capability_local_nonprim); + prose_capability_local_nonprim = NULL; + } + if (v2x_capability_local_nonprim) { + OpenAPI_v2x_capability_free(v2x_capability_local_nonprim); + v2x_capability_local_nonprim = NULL; + } + return NULL; +} + +OpenAPI_nrf_info_served_pcf_info_value_t *OpenAPI_nrf_info_served_pcf_info_value_copy(OpenAPI_nrf_info_served_pcf_info_value_t *dst, OpenAPI_nrf_info_served_pcf_info_value_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_nrf_info_served_pcf_info_value_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_nrf_info_served_pcf_info_value_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_nrf_info_served_pcf_info_value_free(dst); + dst = OpenAPI_nrf_info_served_pcf_info_value_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/nrf_info_served_pcf_info_value.h b/lib/sbi/openapi/model/nrf_info_served_pcf_info_value.h new file mode 100644 index 000000000..ad31a7a59 --- /dev/null +++ b/lib/sbi/openapi/model/nrf_info_served_pcf_info_value.h @@ -0,0 +1,65 @@ +/* + * nrf_info_served_pcf_info_value.h + * + * + */ + +#ifndef _OpenAPI_nrf_info_served_pcf_info_value_H_ +#define _OpenAPI_nrf_info_served_pcf_info_value_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "identity_range.h" +#include "pcf_info.h" +#include "pro_se_capability.h" +#include "supi_range.h" +#include "v2x_capability.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_nrf_info_served_pcf_info_value_s OpenAPI_nrf_info_served_pcf_info_value_t; +typedef struct OpenAPI_nrf_info_served_pcf_info_value_s { + char *group_id; + OpenAPI_list_t *dnn_list; + OpenAPI_list_t *supi_ranges; + OpenAPI_list_t *gpsi_ranges; + char *rx_diam_host; + char *rx_diam_realm; + bool is_v2x_support_ind; + int v2x_support_ind; + bool is_prose_support_ind; + int prose_support_ind; + struct OpenAPI_pro_se_capability_s *prose_capability; + struct OpenAPI_v2x_capability_s *v2x_capability; +} OpenAPI_nrf_info_served_pcf_info_value_t; + +OpenAPI_nrf_info_served_pcf_info_value_t *OpenAPI_nrf_info_served_pcf_info_value_create( + char *group_id, + OpenAPI_list_t *dnn_list, + OpenAPI_list_t *supi_ranges, + OpenAPI_list_t *gpsi_ranges, + char *rx_diam_host, + char *rx_diam_realm, + bool is_v2x_support_ind, + int v2x_support_ind, + bool is_prose_support_ind, + int prose_support_ind, + OpenAPI_pro_se_capability_t *prose_capability, + OpenAPI_v2x_capability_t *v2x_capability +); +void OpenAPI_nrf_info_served_pcf_info_value_free(OpenAPI_nrf_info_served_pcf_info_value_t *nrf_info_served_pcf_info_value); +OpenAPI_nrf_info_served_pcf_info_value_t *OpenAPI_nrf_info_served_pcf_info_value_parseFromJSON(cJSON *nrf_info_served_pcf_info_valueJSON); +cJSON *OpenAPI_nrf_info_served_pcf_info_value_convertToJSON(OpenAPI_nrf_info_served_pcf_info_value_t *nrf_info_served_pcf_info_value); +OpenAPI_nrf_info_served_pcf_info_value_t *OpenAPI_nrf_info_served_pcf_info_value_copy(OpenAPI_nrf_info_served_pcf_info_value_t *dst, OpenAPI_nrf_info_served_pcf_info_value_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_nrf_info_served_pcf_info_value_H_ */ + diff --git a/lib/sbi/openapi/model/nrf_info_served_pcscf_info_list_value_value.c b/lib/sbi/openapi/model/nrf_info_served_pcscf_info_list_value_value.c new file mode 100644 index 000000000..35dbad48f --- /dev/null +++ b/lib/sbi/openapi/model/nrf_info_served_pcscf_info_list_value_value.c @@ -0,0 +1,569 @@ + +#include +#include +#include +#include "nrf_info_served_pcscf_info_list_value_value.h" + +OpenAPI_nrf_info_served_pcscf_info_list_value_value_t *OpenAPI_nrf_info_served_pcscf_info_list_value_value_create( + OpenAPI_list_t *access_type, + OpenAPI_list_t *dnn_list, + char *gm_fqdn, + OpenAPI_list_t *gm_ipv4_addresses, + OpenAPI_list_t *gm_ipv6_addresses, + char *mw_fqdn, + OpenAPI_list_t *mw_ipv4_addresses, + OpenAPI_list_t *mw_ipv6_addresses, + OpenAPI_list_t *served_ipv4_address_ranges, + OpenAPI_list_t *served_ipv6_prefix_ranges +) +{ + OpenAPI_nrf_info_served_pcscf_info_list_value_value_t *nrf_info_served_pcscf_info_list_value_value_local_var = ogs_malloc(sizeof(OpenAPI_nrf_info_served_pcscf_info_list_value_value_t)); + ogs_assert(nrf_info_served_pcscf_info_list_value_value_local_var); + + nrf_info_served_pcscf_info_list_value_value_local_var->access_type = access_type; + nrf_info_served_pcscf_info_list_value_value_local_var->dnn_list = dnn_list; + nrf_info_served_pcscf_info_list_value_value_local_var->gm_fqdn = gm_fqdn; + nrf_info_served_pcscf_info_list_value_value_local_var->gm_ipv4_addresses = gm_ipv4_addresses; + nrf_info_served_pcscf_info_list_value_value_local_var->gm_ipv6_addresses = gm_ipv6_addresses; + nrf_info_served_pcscf_info_list_value_value_local_var->mw_fqdn = mw_fqdn; + nrf_info_served_pcscf_info_list_value_value_local_var->mw_ipv4_addresses = mw_ipv4_addresses; + nrf_info_served_pcscf_info_list_value_value_local_var->mw_ipv6_addresses = mw_ipv6_addresses; + nrf_info_served_pcscf_info_list_value_value_local_var->served_ipv4_address_ranges = served_ipv4_address_ranges; + nrf_info_served_pcscf_info_list_value_value_local_var->served_ipv6_prefix_ranges = served_ipv6_prefix_ranges; + + return nrf_info_served_pcscf_info_list_value_value_local_var; +} + +void OpenAPI_nrf_info_served_pcscf_info_list_value_value_free(OpenAPI_nrf_info_served_pcscf_info_list_value_value_t *nrf_info_served_pcscf_info_list_value_value) +{ + OpenAPI_lnode_t *node = NULL; + + if (NULL == nrf_info_served_pcscf_info_list_value_value) { + return; + } + if (nrf_info_served_pcscf_info_list_value_value->access_type) { + OpenAPI_list_free(nrf_info_served_pcscf_info_list_value_value->access_type); + nrf_info_served_pcscf_info_list_value_value->access_type = NULL; + } + if (nrf_info_served_pcscf_info_list_value_value->dnn_list) { + OpenAPI_list_for_each(nrf_info_served_pcscf_info_list_value_value->dnn_list, node) { + ogs_free(node->data); + } + OpenAPI_list_free(nrf_info_served_pcscf_info_list_value_value->dnn_list); + nrf_info_served_pcscf_info_list_value_value->dnn_list = NULL; + } + if (nrf_info_served_pcscf_info_list_value_value->gm_fqdn) { + ogs_free(nrf_info_served_pcscf_info_list_value_value->gm_fqdn); + nrf_info_served_pcscf_info_list_value_value->gm_fqdn = NULL; + } + if (nrf_info_served_pcscf_info_list_value_value->gm_ipv4_addresses) { + OpenAPI_list_for_each(nrf_info_served_pcscf_info_list_value_value->gm_ipv4_addresses, node) { + ogs_free(node->data); + } + OpenAPI_list_free(nrf_info_served_pcscf_info_list_value_value->gm_ipv4_addresses); + nrf_info_served_pcscf_info_list_value_value->gm_ipv4_addresses = NULL; + } + if (nrf_info_served_pcscf_info_list_value_value->gm_ipv6_addresses) { + OpenAPI_list_for_each(nrf_info_served_pcscf_info_list_value_value->gm_ipv6_addresses, node) { + ogs_free(node->data); + } + OpenAPI_list_free(nrf_info_served_pcscf_info_list_value_value->gm_ipv6_addresses); + nrf_info_served_pcscf_info_list_value_value->gm_ipv6_addresses = NULL; + } + if (nrf_info_served_pcscf_info_list_value_value->mw_fqdn) { + ogs_free(nrf_info_served_pcscf_info_list_value_value->mw_fqdn); + nrf_info_served_pcscf_info_list_value_value->mw_fqdn = NULL; + } + if (nrf_info_served_pcscf_info_list_value_value->mw_ipv4_addresses) { + OpenAPI_list_for_each(nrf_info_served_pcscf_info_list_value_value->mw_ipv4_addresses, node) { + ogs_free(node->data); + } + OpenAPI_list_free(nrf_info_served_pcscf_info_list_value_value->mw_ipv4_addresses); + nrf_info_served_pcscf_info_list_value_value->mw_ipv4_addresses = NULL; + } + if (nrf_info_served_pcscf_info_list_value_value->mw_ipv6_addresses) { + OpenAPI_list_for_each(nrf_info_served_pcscf_info_list_value_value->mw_ipv6_addresses, node) { + ogs_free(node->data); + } + OpenAPI_list_free(nrf_info_served_pcscf_info_list_value_value->mw_ipv6_addresses); + nrf_info_served_pcscf_info_list_value_value->mw_ipv6_addresses = NULL; + } + if (nrf_info_served_pcscf_info_list_value_value->served_ipv4_address_ranges) { + OpenAPI_list_for_each(nrf_info_served_pcscf_info_list_value_value->served_ipv4_address_ranges, node) { + OpenAPI_ipv4_address_range_free(node->data); + } + OpenAPI_list_free(nrf_info_served_pcscf_info_list_value_value->served_ipv4_address_ranges); + nrf_info_served_pcscf_info_list_value_value->served_ipv4_address_ranges = NULL; + } + if (nrf_info_served_pcscf_info_list_value_value->served_ipv6_prefix_ranges) { + OpenAPI_list_for_each(nrf_info_served_pcscf_info_list_value_value->served_ipv6_prefix_ranges, node) { + OpenAPI_ipv6_prefix_range_free(node->data); + } + OpenAPI_list_free(nrf_info_served_pcscf_info_list_value_value->served_ipv6_prefix_ranges); + nrf_info_served_pcscf_info_list_value_value->served_ipv6_prefix_ranges = NULL; + } + ogs_free(nrf_info_served_pcscf_info_list_value_value); +} + +cJSON *OpenAPI_nrf_info_served_pcscf_info_list_value_value_convertToJSON(OpenAPI_nrf_info_served_pcscf_info_list_value_value_t *nrf_info_served_pcscf_info_list_value_value) +{ + cJSON *item = NULL; + OpenAPI_lnode_t *node = NULL; + + if (nrf_info_served_pcscf_info_list_value_value == NULL) { + ogs_error("OpenAPI_nrf_info_served_pcscf_info_list_value_value_convertToJSON() failed [NrfInfo_servedPcscfInfoList_value_value]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (nrf_info_served_pcscf_info_list_value_value->access_type != OpenAPI_access_type_NULL) { + cJSON *access_typeList = cJSON_AddArrayToObject(item, "accessType"); + if (access_typeList == NULL) { + ogs_error("OpenAPI_nrf_info_served_pcscf_info_list_value_value_convertToJSON() failed [access_type]"); + goto end; + } + OpenAPI_list_for_each(nrf_info_served_pcscf_info_list_value_value->access_type, node) { + if (cJSON_AddStringToObject(access_typeList, "", OpenAPI_access_type_ToString((intptr_t)node->data)) == NULL) { + ogs_error("OpenAPI_nrf_info_served_pcscf_info_list_value_value_convertToJSON() failed [access_type]"); + goto end; + } + } + } + + if (nrf_info_served_pcscf_info_list_value_value->dnn_list) { + cJSON *dnn_listList = cJSON_AddArrayToObject(item, "dnnList"); + if (dnn_listList == NULL) { + ogs_error("OpenAPI_nrf_info_served_pcscf_info_list_value_value_convertToJSON() failed [dnn_list]"); + goto end; + } + OpenAPI_list_for_each(nrf_info_served_pcscf_info_list_value_value->dnn_list, node) { + if (cJSON_AddStringToObject(dnn_listList, "", (char*)node->data) == NULL) { + ogs_error("OpenAPI_nrf_info_served_pcscf_info_list_value_value_convertToJSON() failed [dnn_list]"); + goto end; + } + } + } + + if (nrf_info_served_pcscf_info_list_value_value->gm_fqdn) { + if (cJSON_AddStringToObject(item, "gmFqdn", nrf_info_served_pcscf_info_list_value_value->gm_fqdn) == NULL) { + ogs_error("OpenAPI_nrf_info_served_pcscf_info_list_value_value_convertToJSON() failed [gm_fqdn]"); + goto end; + } + } + + if (nrf_info_served_pcscf_info_list_value_value->gm_ipv4_addresses) { + cJSON *gm_ipv4_addressesList = cJSON_AddArrayToObject(item, "gmIpv4Addresses"); + if (gm_ipv4_addressesList == NULL) { + ogs_error("OpenAPI_nrf_info_served_pcscf_info_list_value_value_convertToJSON() failed [gm_ipv4_addresses]"); + goto end; + } + OpenAPI_list_for_each(nrf_info_served_pcscf_info_list_value_value->gm_ipv4_addresses, node) { + if (cJSON_AddStringToObject(gm_ipv4_addressesList, "", (char*)node->data) == NULL) { + ogs_error("OpenAPI_nrf_info_served_pcscf_info_list_value_value_convertToJSON() failed [gm_ipv4_addresses]"); + goto end; + } + } + } + + if (nrf_info_served_pcscf_info_list_value_value->gm_ipv6_addresses) { + cJSON *gm_ipv6_addressesList = cJSON_AddArrayToObject(item, "gmIpv6Addresses"); + if (gm_ipv6_addressesList == NULL) { + ogs_error("OpenAPI_nrf_info_served_pcscf_info_list_value_value_convertToJSON() failed [gm_ipv6_addresses]"); + goto end; + } + OpenAPI_list_for_each(nrf_info_served_pcscf_info_list_value_value->gm_ipv6_addresses, node) { + if (cJSON_AddStringToObject(gm_ipv6_addressesList, "", (char*)node->data) == NULL) { + ogs_error("OpenAPI_nrf_info_served_pcscf_info_list_value_value_convertToJSON() failed [gm_ipv6_addresses]"); + goto end; + } + } + } + + if (nrf_info_served_pcscf_info_list_value_value->mw_fqdn) { + if (cJSON_AddStringToObject(item, "mwFqdn", nrf_info_served_pcscf_info_list_value_value->mw_fqdn) == NULL) { + ogs_error("OpenAPI_nrf_info_served_pcscf_info_list_value_value_convertToJSON() failed [mw_fqdn]"); + goto end; + } + } + + if (nrf_info_served_pcscf_info_list_value_value->mw_ipv4_addresses) { + cJSON *mw_ipv4_addressesList = cJSON_AddArrayToObject(item, "mwIpv4Addresses"); + if (mw_ipv4_addressesList == NULL) { + ogs_error("OpenAPI_nrf_info_served_pcscf_info_list_value_value_convertToJSON() failed [mw_ipv4_addresses]"); + goto end; + } + OpenAPI_list_for_each(nrf_info_served_pcscf_info_list_value_value->mw_ipv4_addresses, node) { + if (cJSON_AddStringToObject(mw_ipv4_addressesList, "", (char*)node->data) == NULL) { + ogs_error("OpenAPI_nrf_info_served_pcscf_info_list_value_value_convertToJSON() failed [mw_ipv4_addresses]"); + goto end; + } + } + } + + if (nrf_info_served_pcscf_info_list_value_value->mw_ipv6_addresses) { + cJSON *mw_ipv6_addressesList = cJSON_AddArrayToObject(item, "mwIpv6Addresses"); + if (mw_ipv6_addressesList == NULL) { + ogs_error("OpenAPI_nrf_info_served_pcscf_info_list_value_value_convertToJSON() failed [mw_ipv6_addresses]"); + goto end; + } + OpenAPI_list_for_each(nrf_info_served_pcscf_info_list_value_value->mw_ipv6_addresses, node) { + if (cJSON_AddStringToObject(mw_ipv6_addressesList, "", (char*)node->data) == NULL) { + ogs_error("OpenAPI_nrf_info_served_pcscf_info_list_value_value_convertToJSON() failed [mw_ipv6_addresses]"); + goto end; + } + } + } + + if (nrf_info_served_pcscf_info_list_value_value->served_ipv4_address_ranges) { + cJSON *served_ipv4_address_rangesList = cJSON_AddArrayToObject(item, "servedIpv4AddressRanges"); + if (served_ipv4_address_rangesList == NULL) { + ogs_error("OpenAPI_nrf_info_served_pcscf_info_list_value_value_convertToJSON() failed [served_ipv4_address_ranges]"); + goto end; + } + OpenAPI_list_for_each(nrf_info_served_pcscf_info_list_value_value->served_ipv4_address_ranges, node) { + cJSON *itemLocal = OpenAPI_ipv4_address_range_convertToJSON(node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_nrf_info_served_pcscf_info_list_value_value_convertToJSON() failed [served_ipv4_address_ranges]"); + goto end; + } + cJSON_AddItemToArray(served_ipv4_address_rangesList, itemLocal); + } + } + + if (nrf_info_served_pcscf_info_list_value_value->served_ipv6_prefix_ranges) { + cJSON *served_ipv6_prefix_rangesList = cJSON_AddArrayToObject(item, "servedIpv6PrefixRanges"); + if (served_ipv6_prefix_rangesList == NULL) { + ogs_error("OpenAPI_nrf_info_served_pcscf_info_list_value_value_convertToJSON() failed [served_ipv6_prefix_ranges]"); + goto end; + } + OpenAPI_list_for_each(nrf_info_served_pcscf_info_list_value_value->served_ipv6_prefix_ranges, node) { + cJSON *itemLocal = OpenAPI_ipv6_prefix_range_convertToJSON(node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_nrf_info_served_pcscf_info_list_value_value_convertToJSON() failed [served_ipv6_prefix_ranges]"); + goto end; + } + cJSON_AddItemToArray(served_ipv6_prefix_rangesList, itemLocal); + } + } + +end: + return item; +} + +OpenAPI_nrf_info_served_pcscf_info_list_value_value_t *OpenAPI_nrf_info_served_pcscf_info_list_value_value_parseFromJSON(cJSON *nrf_info_served_pcscf_info_list_value_valueJSON) +{ + OpenAPI_nrf_info_served_pcscf_info_list_value_value_t *nrf_info_served_pcscf_info_list_value_value_local_var = NULL; + OpenAPI_lnode_t *node = NULL; + cJSON *access_type = NULL; + OpenAPI_list_t *access_typeList = NULL; + cJSON *dnn_list = NULL; + OpenAPI_list_t *dnn_listList = NULL; + cJSON *gm_fqdn = NULL; + cJSON *gm_ipv4_addresses = NULL; + OpenAPI_list_t *gm_ipv4_addressesList = NULL; + cJSON *gm_ipv6_addresses = NULL; + OpenAPI_list_t *gm_ipv6_addressesList = NULL; + cJSON *mw_fqdn = NULL; + cJSON *mw_ipv4_addresses = NULL; + OpenAPI_list_t *mw_ipv4_addressesList = NULL; + cJSON *mw_ipv6_addresses = NULL; + OpenAPI_list_t *mw_ipv6_addressesList = NULL; + cJSON *served_ipv4_address_ranges = NULL; + OpenAPI_list_t *served_ipv4_address_rangesList = NULL; + cJSON *served_ipv6_prefix_ranges = NULL; + OpenAPI_list_t *served_ipv6_prefix_rangesList = NULL; + access_type = cJSON_GetObjectItemCaseSensitive(nrf_info_served_pcscf_info_list_value_valueJSON, "accessType"); + if (access_type) { + cJSON *access_type_local = NULL; + if (!cJSON_IsArray(access_type)) { + ogs_error("OpenAPI_nrf_info_served_pcscf_info_list_value_value_parseFromJSON() failed [access_type]"); + goto end; + } + + access_typeList = OpenAPI_list_create(); + + cJSON_ArrayForEach(access_type_local, access_type) { + if (!cJSON_IsString(access_type_local)) { + ogs_error("OpenAPI_nrf_info_served_pcscf_info_list_value_value_parseFromJSON() failed [access_type]"); + goto end; + } + OpenAPI_list_add(access_typeList, (void *)OpenAPI_access_type_FromString(access_type_local->valuestring)); + } + } + + dnn_list = cJSON_GetObjectItemCaseSensitive(nrf_info_served_pcscf_info_list_value_valueJSON, "dnnList"); + if (dnn_list) { + cJSON *dnn_list_local = NULL; + if (!cJSON_IsArray(dnn_list)) { + ogs_error("OpenAPI_nrf_info_served_pcscf_info_list_value_value_parseFromJSON() failed [dnn_list]"); + goto end; + } + + dnn_listList = OpenAPI_list_create(); + + cJSON_ArrayForEach(dnn_list_local, dnn_list) { + double *localDouble = NULL; + int *localInt = NULL; + if (!cJSON_IsString(dnn_list_local)) { + ogs_error("OpenAPI_nrf_info_served_pcscf_info_list_value_value_parseFromJSON() failed [dnn_list]"); + goto end; + } + OpenAPI_list_add(dnn_listList, ogs_strdup(dnn_list_local->valuestring)); + } + } + + gm_fqdn = cJSON_GetObjectItemCaseSensitive(nrf_info_served_pcscf_info_list_value_valueJSON, "gmFqdn"); + if (gm_fqdn) { + if (!cJSON_IsString(gm_fqdn) && !cJSON_IsNull(gm_fqdn)) { + ogs_error("OpenAPI_nrf_info_served_pcscf_info_list_value_value_parseFromJSON() failed [gm_fqdn]"); + goto end; + } + } + + gm_ipv4_addresses = cJSON_GetObjectItemCaseSensitive(nrf_info_served_pcscf_info_list_value_valueJSON, "gmIpv4Addresses"); + if (gm_ipv4_addresses) { + cJSON *gm_ipv4_addresses_local = NULL; + if (!cJSON_IsArray(gm_ipv4_addresses)) { + ogs_error("OpenAPI_nrf_info_served_pcscf_info_list_value_value_parseFromJSON() failed [gm_ipv4_addresses]"); + goto end; + } + + gm_ipv4_addressesList = OpenAPI_list_create(); + + cJSON_ArrayForEach(gm_ipv4_addresses_local, gm_ipv4_addresses) { + double *localDouble = NULL; + int *localInt = NULL; + if (!cJSON_IsString(gm_ipv4_addresses_local)) { + ogs_error("OpenAPI_nrf_info_served_pcscf_info_list_value_value_parseFromJSON() failed [gm_ipv4_addresses]"); + goto end; + } + OpenAPI_list_add(gm_ipv4_addressesList, ogs_strdup(gm_ipv4_addresses_local->valuestring)); + } + } + + gm_ipv6_addresses = cJSON_GetObjectItemCaseSensitive(nrf_info_served_pcscf_info_list_value_valueJSON, "gmIpv6Addresses"); + if (gm_ipv6_addresses) { + cJSON *gm_ipv6_addresses_local = NULL; + if (!cJSON_IsArray(gm_ipv6_addresses)) { + ogs_error("OpenAPI_nrf_info_served_pcscf_info_list_value_value_parseFromJSON() failed [gm_ipv6_addresses]"); + goto end; + } + + gm_ipv6_addressesList = OpenAPI_list_create(); + + cJSON_ArrayForEach(gm_ipv6_addresses_local, gm_ipv6_addresses) { + double *localDouble = NULL; + int *localInt = NULL; + if (!cJSON_IsString(gm_ipv6_addresses_local)) { + ogs_error("OpenAPI_nrf_info_served_pcscf_info_list_value_value_parseFromJSON() failed [gm_ipv6_addresses]"); + goto end; + } + OpenAPI_list_add(gm_ipv6_addressesList, ogs_strdup(gm_ipv6_addresses_local->valuestring)); + } + } + + mw_fqdn = cJSON_GetObjectItemCaseSensitive(nrf_info_served_pcscf_info_list_value_valueJSON, "mwFqdn"); + if (mw_fqdn) { + if (!cJSON_IsString(mw_fqdn) && !cJSON_IsNull(mw_fqdn)) { + ogs_error("OpenAPI_nrf_info_served_pcscf_info_list_value_value_parseFromJSON() failed [mw_fqdn]"); + goto end; + } + } + + mw_ipv4_addresses = cJSON_GetObjectItemCaseSensitive(nrf_info_served_pcscf_info_list_value_valueJSON, "mwIpv4Addresses"); + if (mw_ipv4_addresses) { + cJSON *mw_ipv4_addresses_local = NULL; + if (!cJSON_IsArray(mw_ipv4_addresses)) { + ogs_error("OpenAPI_nrf_info_served_pcscf_info_list_value_value_parseFromJSON() failed [mw_ipv4_addresses]"); + goto end; + } + + mw_ipv4_addressesList = OpenAPI_list_create(); + + cJSON_ArrayForEach(mw_ipv4_addresses_local, mw_ipv4_addresses) { + double *localDouble = NULL; + int *localInt = NULL; + if (!cJSON_IsString(mw_ipv4_addresses_local)) { + ogs_error("OpenAPI_nrf_info_served_pcscf_info_list_value_value_parseFromJSON() failed [mw_ipv4_addresses]"); + goto end; + } + OpenAPI_list_add(mw_ipv4_addressesList, ogs_strdup(mw_ipv4_addresses_local->valuestring)); + } + } + + mw_ipv6_addresses = cJSON_GetObjectItemCaseSensitive(nrf_info_served_pcscf_info_list_value_valueJSON, "mwIpv6Addresses"); + if (mw_ipv6_addresses) { + cJSON *mw_ipv6_addresses_local = NULL; + if (!cJSON_IsArray(mw_ipv6_addresses)) { + ogs_error("OpenAPI_nrf_info_served_pcscf_info_list_value_value_parseFromJSON() failed [mw_ipv6_addresses]"); + goto end; + } + + mw_ipv6_addressesList = OpenAPI_list_create(); + + cJSON_ArrayForEach(mw_ipv6_addresses_local, mw_ipv6_addresses) { + double *localDouble = NULL; + int *localInt = NULL; + if (!cJSON_IsString(mw_ipv6_addresses_local)) { + ogs_error("OpenAPI_nrf_info_served_pcscf_info_list_value_value_parseFromJSON() failed [mw_ipv6_addresses]"); + goto end; + } + OpenAPI_list_add(mw_ipv6_addressesList, ogs_strdup(mw_ipv6_addresses_local->valuestring)); + } + } + + served_ipv4_address_ranges = cJSON_GetObjectItemCaseSensitive(nrf_info_served_pcscf_info_list_value_valueJSON, "servedIpv4AddressRanges"); + if (served_ipv4_address_ranges) { + cJSON *served_ipv4_address_ranges_local = NULL; + if (!cJSON_IsArray(served_ipv4_address_ranges)) { + ogs_error("OpenAPI_nrf_info_served_pcscf_info_list_value_value_parseFromJSON() failed [served_ipv4_address_ranges]"); + goto end; + } + + served_ipv4_address_rangesList = OpenAPI_list_create(); + + cJSON_ArrayForEach(served_ipv4_address_ranges_local, served_ipv4_address_ranges) { + if (!cJSON_IsObject(served_ipv4_address_ranges_local)) { + ogs_error("OpenAPI_nrf_info_served_pcscf_info_list_value_value_parseFromJSON() failed [served_ipv4_address_ranges]"); + goto end; + } + OpenAPI_ipv4_address_range_t *served_ipv4_address_rangesItem = OpenAPI_ipv4_address_range_parseFromJSON(served_ipv4_address_ranges_local); + if (!served_ipv4_address_rangesItem) { + ogs_error("No served_ipv4_address_rangesItem"); + OpenAPI_list_free(served_ipv4_address_rangesList); + goto end; + } + OpenAPI_list_add(served_ipv4_address_rangesList, served_ipv4_address_rangesItem); + } + } + + served_ipv6_prefix_ranges = cJSON_GetObjectItemCaseSensitive(nrf_info_served_pcscf_info_list_value_valueJSON, "servedIpv6PrefixRanges"); + if (served_ipv6_prefix_ranges) { + cJSON *served_ipv6_prefix_ranges_local = NULL; + if (!cJSON_IsArray(served_ipv6_prefix_ranges)) { + ogs_error("OpenAPI_nrf_info_served_pcscf_info_list_value_value_parseFromJSON() failed [served_ipv6_prefix_ranges]"); + goto end; + } + + served_ipv6_prefix_rangesList = OpenAPI_list_create(); + + cJSON_ArrayForEach(served_ipv6_prefix_ranges_local, served_ipv6_prefix_ranges) { + if (!cJSON_IsObject(served_ipv6_prefix_ranges_local)) { + ogs_error("OpenAPI_nrf_info_served_pcscf_info_list_value_value_parseFromJSON() failed [served_ipv6_prefix_ranges]"); + goto end; + } + OpenAPI_ipv6_prefix_range_t *served_ipv6_prefix_rangesItem = OpenAPI_ipv6_prefix_range_parseFromJSON(served_ipv6_prefix_ranges_local); + if (!served_ipv6_prefix_rangesItem) { + ogs_error("No served_ipv6_prefix_rangesItem"); + OpenAPI_list_free(served_ipv6_prefix_rangesList); + goto end; + } + OpenAPI_list_add(served_ipv6_prefix_rangesList, served_ipv6_prefix_rangesItem); + } + } + + nrf_info_served_pcscf_info_list_value_value_local_var = OpenAPI_nrf_info_served_pcscf_info_list_value_value_create ( + access_type ? access_typeList : NULL, + dnn_list ? dnn_listList : NULL, + gm_fqdn && !cJSON_IsNull(gm_fqdn) ? ogs_strdup(gm_fqdn->valuestring) : NULL, + gm_ipv4_addresses ? gm_ipv4_addressesList : NULL, + gm_ipv6_addresses ? gm_ipv6_addressesList : NULL, + mw_fqdn && !cJSON_IsNull(mw_fqdn) ? ogs_strdup(mw_fqdn->valuestring) : NULL, + mw_ipv4_addresses ? mw_ipv4_addressesList : NULL, + mw_ipv6_addresses ? mw_ipv6_addressesList : NULL, + served_ipv4_address_ranges ? served_ipv4_address_rangesList : NULL, + served_ipv6_prefix_ranges ? served_ipv6_prefix_rangesList : NULL + ); + + return nrf_info_served_pcscf_info_list_value_value_local_var; +end: + if (access_typeList) { + OpenAPI_list_free(access_typeList); + access_typeList = NULL; + } + if (dnn_listList) { + OpenAPI_list_for_each(dnn_listList, node) { + ogs_free(node->data); + } + OpenAPI_list_free(dnn_listList); + dnn_listList = NULL; + } + if (gm_ipv4_addressesList) { + OpenAPI_list_for_each(gm_ipv4_addressesList, node) { + ogs_free(node->data); + } + OpenAPI_list_free(gm_ipv4_addressesList); + gm_ipv4_addressesList = NULL; + } + if (gm_ipv6_addressesList) { + OpenAPI_list_for_each(gm_ipv6_addressesList, node) { + ogs_free(node->data); + } + OpenAPI_list_free(gm_ipv6_addressesList); + gm_ipv6_addressesList = NULL; + } + if (mw_ipv4_addressesList) { + OpenAPI_list_for_each(mw_ipv4_addressesList, node) { + ogs_free(node->data); + } + OpenAPI_list_free(mw_ipv4_addressesList); + mw_ipv4_addressesList = NULL; + } + if (mw_ipv6_addressesList) { + OpenAPI_list_for_each(mw_ipv6_addressesList, node) { + ogs_free(node->data); + } + OpenAPI_list_free(mw_ipv6_addressesList); + mw_ipv6_addressesList = NULL; + } + if (served_ipv4_address_rangesList) { + OpenAPI_list_for_each(served_ipv4_address_rangesList, node) { + OpenAPI_ipv4_address_range_free(node->data); + } + OpenAPI_list_free(served_ipv4_address_rangesList); + served_ipv4_address_rangesList = NULL; + } + if (served_ipv6_prefix_rangesList) { + OpenAPI_list_for_each(served_ipv6_prefix_rangesList, node) { + OpenAPI_ipv6_prefix_range_free(node->data); + } + OpenAPI_list_free(served_ipv6_prefix_rangesList); + served_ipv6_prefix_rangesList = NULL; + } + return NULL; +} + +OpenAPI_nrf_info_served_pcscf_info_list_value_value_t *OpenAPI_nrf_info_served_pcscf_info_list_value_value_copy(OpenAPI_nrf_info_served_pcscf_info_list_value_value_t *dst, OpenAPI_nrf_info_served_pcscf_info_list_value_value_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_nrf_info_served_pcscf_info_list_value_value_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_nrf_info_served_pcscf_info_list_value_value_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_nrf_info_served_pcscf_info_list_value_value_free(dst); + dst = OpenAPI_nrf_info_served_pcscf_info_list_value_value_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/nrf_info_served_pcscf_info_list_value_value.h b/lib/sbi/openapi/model/nrf_info_served_pcscf_info_list_value_value.h new file mode 100644 index 000000000..385eb5dc2 --- /dev/null +++ b/lib/sbi/openapi/model/nrf_info_served_pcscf_info_list_value_value.h @@ -0,0 +1,60 @@ +/* + * nrf_info_served_pcscf_info_list_value_value.h + * + * + */ + +#ifndef _OpenAPI_nrf_info_served_pcscf_info_list_value_value_H_ +#define _OpenAPI_nrf_info_served_pcscf_info_list_value_value_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "access_type.h" +#include "ipv4_address_range.h" +#include "ipv6_prefix_range.h" +#include "pcscf_info.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_nrf_info_served_pcscf_info_list_value_value_s OpenAPI_nrf_info_served_pcscf_info_list_value_value_t; +typedef struct OpenAPI_nrf_info_served_pcscf_info_list_value_value_s { + OpenAPI_list_t *access_type; + OpenAPI_list_t *dnn_list; + char *gm_fqdn; + OpenAPI_list_t *gm_ipv4_addresses; + OpenAPI_list_t *gm_ipv6_addresses; + char *mw_fqdn; + OpenAPI_list_t *mw_ipv4_addresses; + OpenAPI_list_t *mw_ipv6_addresses; + OpenAPI_list_t *served_ipv4_address_ranges; + OpenAPI_list_t *served_ipv6_prefix_ranges; +} OpenAPI_nrf_info_served_pcscf_info_list_value_value_t; + +OpenAPI_nrf_info_served_pcscf_info_list_value_value_t *OpenAPI_nrf_info_served_pcscf_info_list_value_value_create( + OpenAPI_list_t *access_type, + OpenAPI_list_t *dnn_list, + char *gm_fqdn, + OpenAPI_list_t *gm_ipv4_addresses, + OpenAPI_list_t *gm_ipv6_addresses, + char *mw_fqdn, + OpenAPI_list_t *mw_ipv4_addresses, + OpenAPI_list_t *mw_ipv6_addresses, + OpenAPI_list_t *served_ipv4_address_ranges, + OpenAPI_list_t *served_ipv6_prefix_ranges +); +void OpenAPI_nrf_info_served_pcscf_info_list_value_value_free(OpenAPI_nrf_info_served_pcscf_info_list_value_value_t *nrf_info_served_pcscf_info_list_value_value); +OpenAPI_nrf_info_served_pcscf_info_list_value_value_t *OpenAPI_nrf_info_served_pcscf_info_list_value_value_parseFromJSON(cJSON *nrf_info_served_pcscf_info_list_value_valueJSON); +cJSON *OpenAPI_nrf_info_served_pcscf_info_list_value_value_convertToJSON(OpenAPI_nrf_info_served_pcscf_info_list_value_value_t *nrf_info_served_pcscf_info_list_value_value); +OpenAPI_nrf_info_served_pcscf_info_list_value_value_t *OpenAPI_nrf_info_served_pcscf_info_list_value_value_copy(OpenAPI_nrf_info_served_pcscf_info_list_value_value_t *dst, OpenAPI_nrf_info_served_pcscf_info_list_value_value_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_nrf_info_served_pcscf_info_list_value_value_H_ */ + diff --git a/lib/sbi/openapi/model/nrf_info_served_scp_info_list_value.c b/lib/sbi/openapi/model/nrf_info_served_scp_info_list_value.c new file mode 100644 index 000000000..72f931616 --- /dev/null +++ b/lib/sbi/openapi/model/nrf_info_served_scp_info_list_value.c @@ -0,0 +1,779 @@ + +#include +#include +#include +#include "nrf_info_served_scp_info_list_value.h" + +OpenAPI_nrf_info_served_scp_info_list_value_t *OpenAPI_nrf_info_served_scp_info_list_value_create( + OpenAPI_list_t* scp_domain_info_list, + char *scp_prefix, + OpenAPI_list_t* scp_ports, + OpenAPI_list_t *address_domains, + OpenAPI_list_t *ipv4_addresses, + OpenAPI_list_t *ipv6_prefixes, + OpenAPI_list_t *ipv4_addr_ranges, + OpenAPI_list_t *ipv6_prefix_ranges, + OpenAPI_list_t *served_nf_set_id_list, + OpenAPI_list_t *remote_plmn_list, + OpenAPI_list_t *remote_snpn_list, + OpenAPI_ip_reachability_e ip_reachability, + OpenAPI_list_t *scp_capabilities +) +{ + OpenAPI_nrf_info_served_scp_info_list_value_t *nrf_info_served_scp_info_list_value_local_var = ogs_malloc(sizeof(OpenAPI_nrf_info_served_scp_info_list_value_t)); + ogs_assert(nrf_info_served_scp_info_list_value_local_var); + + nrf_info_served_scp_info_list_value_local_var->scp_domain_info_list = scp_domain_info_list; + nrf_info_served_scp_info_list_value_local_var->scp_prefix = scp_prefix; + nrf_info_served_scp_info_list_value_local_var->scp_ports = scp_ports; + nrf_info_served_scp_info_list_value_local_var->address_domains = address_domains; + nrf_info_served_scp_info_list_value_local_var->ipv4_addresses = ipv4_addresses; + nrf_info_served_scp_info_list_value_local_var->ipv6_prefixes = ipv6_prefixes; + nrf_info_served_scp_info_list_value_local_var->ipv4_addr_ranges = ipv4_addr_ranges; + nrf_info_served_scp_info_list_value_local_var->ipv6_prefix_ranges = ipv6_prefix_ranges; + nrf_info_served_scp_info_list_value_local_var->served_nf_set_id_list = served_nf_set_id_list; + nrf_info_served_scp_info_list_value_local_var->remote_plmn_list = remote_plmn_list; + nrf_info_served_scp_info_list_value_local_var->remote_snpn_list = remote_snpn_list; + nrf_info_served_scp_info_list_value_local_var->ip_reachability = ip_reachability; + nrf_info_served_scp_info_list_value_local_var->scp_capabilities = scp_capabilities; + + return nrf_info_served_scp_info_list_value_local_var; +} + +void OpenAPI_nrf_info_served_scp_info_list_value_free(OpenAPI_nrf_info_served_scp_info_list_value_t *nrf_info_served_scp_info_list_value) +{ + OpenAPI_lnode_t *node = NULL; + + if (NULL == nrf_info_served_scp_info_list_value) { + return; + } + if (nrf_info_served_scp_info_list_value->scp_domain_info_list) { + OpenAPI_list_for_each(nrf_info_served_scp_info_list_value->scp_domain_info_list, node) { + OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*)node->data; + ogs_free(localKeyValue->key); + OpenAPI_scp_domain_info_free(localKeyValue->value); + OpenAPI_map_free(localKeyValue); + } + OpenAPI_list_free(nrf_info_served_scp_info_list_value->scp_domain_info_list); + nrf_info_served_scp_info_list_value->scp_domain_info_list = NULL; + } + if (nrf_info_served_scp_info_list_value->scp_prefix) { + ogs_free(nrf_info_served_scp_info_list_value->scp_prefix); + nrf_info_served_scp_info_list_value->scp_prefix = NULL; + } + if (nrf_info_served_scp_info_list_value->scp_ports) { + OpenAPI_list_for_each(nrf_info_served_scp_info_list_value->scp_ports, node) { + OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*)node->data; + ogs_free(localKeyValue->key); + ogs_free(localKeyValue->value); + OpenAPI_map_free(localKeyValue); + } + OpenAPI_list_free(nrf_info_served_scp_info_list_value->scp_ports); + nrf_info_served_scp_info_list_value->scp_ports = NULL; + } + if (nrf_info_served_scp_info_list_value->address_domains) { + OpenAPI_list_for_each(nrf_info_served_scp_info_list_value->address_domains, node) { + ogs_free(node->data); + } + OpenAPI_list_free(nrf_info_served_scp_info_list_value->address_domains); + nrf_info_served_scp_info_list_value->address_domains = NULL; + } + if (nrf_info_served_scp_info_list_value->ipv4_addresses) { + OpenAPI_list_for_each(nrf_info_served_scp_info_list_value->ipv4_addresses, node) { + ogs_free(node->data); + } + OpenAPI_list_free(nrf_info_served_scp_info_list_value->ipv4_addresses); + nrf_info_served_scp_info_list_value->ipv4_addresses = NULL; + } + if (nrf_info_served_scp_info_list_value->ipv6_prefixes) { + OpenAPI_list_for_each(nrf_info_served_scp_info_list_value->ipv6_prefixes, node) { + ogs_free(node->data); + } + OpenAPI_list_free(nrf_info_served_scp_info_list_value->ipv6_prefixes); + nrf_info_served_scp_info_list_value->ipv6_prefixes = NULL; + } + if (nrf_info_served_scp_info_list_value->ipv4_addr_ranges) { + OpenAPI_list_for_each(nrf_info_served_scp_info_list_value->ipv4_addr_ranges, node) { + OpenAPI_ipv4_address_range_free(node->data); + } + OpenAPI_list_free(nrf_info_served_scp_info_list_value->ipv4_addr_ranges); + nrf_info_served_scp_info_list_value->ipv4_addr_ranges = NULL; + } + if (nrf_info_served_scp_info_list_value->ipv6_prefix_ranges) { + OpenAPI_list_for_each(nrf_info_served_scp_info_list_value->ipv6_prefix_ranges, node) { + OpenAPI_ipv6_prefix_range_free(node->data); + } + OpenAPI_list_free(nrf_info_served_scp_info_list_value->ipv6_prefix_ranges); + nrf_info_served_scp_info_list_value->ipv6_prefix_ranges = NULL; + } + if (nrf_info_served_scp_info_list_value->served_nf_set_id_list) { + OpenAPI_list_for_each(nrf_info_served_scp_info_list_value->served_nf_set_id_list, node) { + ogs_free(node->data); + } + OpenAPI_list_free(nrf_info_served_scp_info_list_value->served_nf_set_id_list); + nrf_info_served_scp_info_list_value->served_nf_set_id_list = NULL; + } + if (nrf_info_served_scp_info_list_value->remote_plmn_list) { + OpenAPI_list_for_each(nrf_info_served_scp_info_list_value->remote_plmn_list, node) { + OpenAPI_plmn_id_free(node->data); + } + OpenAPI_list_free(nrf_info_served_scp_info_list_value->remote_plmn_list); + nrf_info_served_scp_info_list_value->remote_plmn_list = NULL; + } + if (nrf_info_served_scp_info_list_value->remote_snpn_list) { + OpenAPI_list_for_each(nrf_info_served_scp_info_list_value->remote_snpn_list, node) { + OpenAPI_plmn_id_nid_free(node->data); + } + OpenAPI_list_free(nrf_info_served_scp_info_list_value->remote_snpn_list); + nrf_info_served_scp_info_list_value->remote_snpn_list = NULL; + } + if (nrf_info_served_scp_info_list_value->scp_capabilities) { + OpenAPI_list_free(nrf_info_served_scp_info_list_value->scp_capabilities); + nrf_info_served_scp_info_list_value->scp_capabilities = NULL; + } + ogs_free(nrf_info_served_scp_info_list_value); +} + +cJSON *OpenAPI_nrf_info_served_scp_info_list_value_convertToJSON(OpenAPI_nrf_info_served_scp_info_list_value_t *nrf_info_served_scp_info_list_value) +{ + cJSON *item = NULL; + OpenAPI_lnode_t *node = NULL; + + if (nrf_info_served_scp_info_list_value == NULL) { + ogs_error("OpenAPI_nrf_info_served_scp_info_list_value_convertToJSON() failed [NrfInfo_servedScpInfoList_value]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (nrf_info_served_scp_info_list_value->scp_domain_info_list) { + cJSON *scp_domain_info_list = cJSON_AddObjectToObject(item, "scpDomainInfoList"); + if (scp_domain_info_list == NULL) { + ogs_error("OpenAPI_nrf_info_served_scp_info_list_value_convertToJSON() failed [scp_domain_info_list]"); + goto end; + } + cJSON *localMapObject = scp_domain_info_list; + if (nrf_info_served_scp_info_list_value->scp_domain_info_list) { + OpenAPI_list_for_each(nrf_info_served_scp_info_list_value->scp_domain_info_list, node) { + OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*)node->data; + cJSON *itemLocal = localKeyValue->value ? + OpenAPI_scp_domain_info_convertToJSON(localKeyValue->value) : + cJSON_CreateNull(); + if (itemLocal == NULL) { + ogs_error("OpenAPI_nrf_info_served_scp_info_list_value_convertToJSON() failed [inner]"); + goto end; + } + cJSON_AddItemToObject(localMapObject, localKeyValue->key, itemLocal); + } + } + } + + if (nrf_info_served_scp_info_list_value->scp_prefix) { + if (cJSON_AddStringToObject(item, "scpPrefix", nrf_info_served_scp_info_list_value->scp_prefix) == NULL) { + ogs_error("OpenAPI_nrf_info_served_scp_info_list_value_convertToJSON() failed [scp_prefix]"); + goto end; + } + } + + if (nrf_info_served_scp_info_list_value->scp_ports) { + cJSON *scp_ports = cJSON_AddObjectToObject(item, "scpPorts"); + if (scp_ports == NULL) { + ogs_error("OpenAPI_nrf_info_served_scp_info_list_value_convertToJSON() failed [scp_ports]"); + goto end; + } + cJSON *localMapObject = scp_ports; + if (nrf_info_served_scp_info_list_value->scp_ports) { + OpenAPI_list_for_each(nrf_info_served_scp_info_list_value->scp_ports, node) { + OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*)node->data; + if (cJSON_AddNumberToObject(localMapObject, localKeyValue->key, (uintptr_t)localKeyValue->value) == NULL) { + ogs_error("OpenAPI_nrf_info_served_scp_info_list_value_convertToJSON() failed [inner]"); + goto end; + } + } + } + } + + if (nrf_info_served_scp_info_list_value->address_domains) { + cJSON *address_domainsList = cJSON_AddArrayToObject(item, "addressDomains"); + if (address_domainsList == NULL) { + ogs_error("OpenAPI_nrf_info_served_scp_info_list_value_convertToJSON() failed [address_domains]"); + goto end; + } + OpenAPI_list_for_each(nrf_info_served_scp_info_list_value->address_domains, node) { + if (cJSON_AddStringToObject(address_domainsList, "", (char*)node->data) == NULL) { + ogs_error("OpenAPI_nrf_info_served_scp_info_list_value_convertToJSON() failed [address_domains]"); + goto end; + } + } + } + + if (nrf_info_served_scp_info_list_value->ipv4_addresses) { + cJSON *ipv4_addressesList = cJSON_AddArrayToObject(item, "ipv4Addresses"); + if (ipv4_addressesList == NULL) { + ogs_error("OpenAPI_nrf_info_served_scp_info_list_value_convertToJSON() failed [ipv4_addresses]"); + goto end; + } + OpenAPI_list_for_each(nrf_info_served_scp_info_list_value->ipv4_addresses, node) { + if (cJSON_AddStringToObject(ipv4_addressesList, "", (char*)node->data) == NULL) { + ogs_error("OpenAPI_nrf_info_served_scp_info_list_value_convertToJSON() failed [ipv4_addresses]"); + goto end; + } + } + } + + if (nrf_info_served_scp_info_list_value->ipv6_prefixes) { + cJSON *ipv6_prefixesList = cJSON_AddArrayToObject(item, "ipv6Prefixes"); + if (ipv6_prefixesList == NULL) { + ogs_error("OpenAPI_nrf_info_served_scp_info_list_value_convertToJSON() failed [ipv6_prefixes]"); + goto end; + } + OpenAPI_list_for_each(nrf_info_served_scp_info_list_value->ipv6_prefixes, node) { + if (cJSON_AddStringToObject(ipv6_prefixesList, "", (char*)node->data) == NULL) { + ogs_error("OpenAPI_nrf_info_served_scp_info_list_value_convertToJSON() failed [ipv6_prefixes]"); + goto end; + } + } + } + + if (nrf_info_served_scp_info_list_value->ipv4_addr_ranges) { + cJSON *ipv4_addr_rangesList = cJSON_AddArrayToObject(item, "ipv4AddrRanges"); + if (ipv4_addr_rangesList == NULL) { + ogs_error("OpenAPI_nrf_info_served_scp_info_list_value_convertToJSON() failed [ipv4_addr_ranges]"); + goto end; + } + OpenAPI_list_for_each(nrf_info_served_scp_info_list_value->ipv4_addr_ranges, node) { + cJSON *itemLocal = OpenAPI_ipv4_address_range_convertToJSON(node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_nrf_info_served_scp_info_list_value_convertToJSON() failed [ipv4_addr_ranges]"); + goto end; + } + cJSON_AddItemToArray(ipv4_addr_rangesList, itemLocal); + } + } + + if (nrf_info_served_scp_info_list_value->ipv6_prefix_ranges) { + cJSON *ipv6_prefix_rangesList = cJSON_AddArrayToObject(item, "ipv6PrefixRanges"); + if (ipv6_prefix_rangesList == NULL) { + ogs_error("OpenAPI_nrf_info_served_scp_info_list_value_convertToJSON() failed [ipv6_prefix_ranges]"); + goto end; + } + OpenAPI_list_for_each(nrf_info_served_scp_info_list_value->ipv6_prefix_ranges, node) { + cJSON *itemLocal = OpenAPI_ipv6_prefix_range_convertToJSON(node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_nrf_info_served_scp_info_list_value_convertToJSON() failed [ipv6_prefix_ranges]"); + goto end; + } + cJSON_AddItemToArray(ipv6_prefix_rangesList, itemLocal); + } + } + + if (nrf_info_served_scp_info_list_value->served_nf_set_id_list) { + cJSON *served_nf_set_id_listList = cJSON_AddArrayToObject(item, "servedNfSetIdList"); + if (served_nf_set_id_listList == NULL) { + ogs_error("OpenAPI_nrf_info_served_scp_info_list_value_convertToJSON() failed [served_nf_set_id_list]"); + goto end; + } + OpenAPI_list_for_each(nrf_info_served_scp_info_list_value->served_nf_set_id_list, node) { + if (cJSON_AddStringToObject(served_nf_set_id_listList, "", (char*)node->data) == NULL) { + ogs_error("OpenAPI_nrf_info_served_scp_info_list_value_convertToJSON() failed [served_nf_set_id_list]"); + goto end; + } + } + } + + if (nrf_info_served_scp_info_list_value->remote_plmn_list) { + cJSON *remote_plmn_listList = cJSON_AddArrayToObject(item, "remotePlmnList"); + if (remote_plmn_listList == NULL) { + ogs_error("OpenAPI_nrf_info_served_scp_info_list_value_convertToJSON() failed [remote_plmn_list]"); + goto end; + } + OpenAPI_list_for_each(nrf_info_served_scp_info_list_value->remote_plmn_list, node) { + cJSON *itemLocal = OpenAPI_plmn_id_convertToJSON(node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_nrf_info_served_scp_info_list_value_convertToJSON() failed [remote_plmn_list]"); + goto end; + } + cJSON_AddItemToArray(remote_plmn_listList, itemLocal); + } + } + + if (nrf_info_served_scp_info_list_value->remote_snpn_list) { + cJSON *remote_snpn_listList = cJSON_AddArrayToObject(item, "remoteSnpnList"); + if (remote_snpn_listList == NULL) { + ogs_error("OpenAPI_nrf_info_served_scp_info_list_value_convertToJSON() failed [remote_snpn_list]"); + goto end; + } + OpenAPI_list_for_each(nrf_info_served_scp_info_list_value->remote_snpn_list, node) { + cJSON *itemLocal = OpenAPI_plmn_id_nid_convertToJSON(node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_nrf_info_served_scp_info_list_value_convertToJSON() failed [remote_snpn_list]"); + goto end; + } + cJSON_AddItemToArray(remote_snpn_listList, itemLocal); + } + } + + if (nrf_info_served_scp_info_list_value->ip_reachability != OpenAPI_ip_reachability_NULL) { + if (cJSON_AddStringToObject(item, "ipReachability", OpenAPI_ip_reachability_ToString(nrf_info_served_scp_info_list_value->ip_reachability)) == NULL) { + ogs_error("OpenAPI_nrf_info_served_scp_info_list_value_convertToJSON() failed [ip_reachability]"); + goto end; + } + } + + if (nrf_info_served_scp_info_list_value->scp_capabilities != OpenAPI_scp_capability_NULL) { + cJSON *scp_capabilitiesList = cJSON_AddArrayToObject(item, "scpCapabilities"); + if (scp_capabilitiesList == NULL) { + ogs_error("OpenAPI_nrf_info_served_scp_info_list_value_convertToJSON() failed [scp_capabilities]"); + goto end; + } + OpenAPI_list_for_each(nrf_info_served_scp_info_list_value->scp_capabilities, node) { + if (cJSON_AddStringToObject(scp_capabilitiesList, "", OpenAPI_scp_capability_ToString((intptr_t)node->data)) == NULL) { + ogs_error("OpenAPI_nrf_info_served_scp_info_list_value_convertToJSON() failed [scp_capabilities]"); + goto end; + } + } + } + +end: + return item; +} + +OpenAPI_nrf_info_served_scp_info_list_value_t *OpenAPI_nrf_info_served_scp_info_list_value_parseFromJSON(cJSON *nrf_info_served_scp_info_list_valueJSON) +{ + OpenAPI_nrf_info_served_scp_info_list_value_t *nrf_info_served_scp_info_list_value_local_var = NULL; + OpenAPI_lnode_t *node = NULL; + cJSON *scp_domain_info_list = NULL; + OpenAPI_list_t *scp_domain_info_listList = NULL; + cJSON *scp_prefix = NULL; + cJSON *scp_ports = NULL; + OpenAPI_list_t *scp_portsList = NULL; + cJSON *address_domains = NULL; + OpenAPI_list_t *address_domainsList = NULL; + cJSON *ipv4_addresses = NULL; + OpenAPI_list_t *ipv4_addressesList = NULL; + cJSON *ipv6_prefixes = NULL; + OpenAPI_list_t *ipv6_prefixesList = NULL; + cJSON *ipv4_addr_ranges = NULL; + OpenAPI_list_t *ipv4_addr_rangesList = NULL; + cJSON *ipv6_prefix_ranges = NULL; + OpenAPI_list_t *ipv6_prefix_rangesList = NULL; + cJSON *served_nf_set_id_list = NULL; + OpenAPI_list_t *served_nf_set_id_listList = NULL; + cJSON *remote_plmn_list = NULL; + OpenAPI_list_t *remote_plmn_listList = NULL; + cJSON *remote_snpn_list = NULL; + OpenAPI_list_t *remote_snpn_listList = NULL; + cJSON *ip_reachability = NULL; + OpenAPI_ip_reachability_e ip_reachabilityVariable = 0; + cJSON *scp_capabilities = NULL; + OpenAPI_list_t *scp_capabilitiesList = NULL; + scp_domain_info_list = cJSON_GetObjectItemCaseSensitive(nrf_info_served_scp_info_list_valueJSON, "scpDomainInfoList"); + if (scp_domain_info_list) { + cJSON *scp_domain_info_list_local_map = NULL; + if (!cJSON_IsObject(scp_domain_info_list) && !cJSON_IsNull(scp_domain_info_list)) { + ogs_error("OpenAPI_nrf_info_served_scp_info_list_value_parseFromJSON() failed [scp_domain_info_list]"); + goto end; + } + if (cJSON_IsObject(scp_domain_info_list)) { + scp_domain_info_listList = OpenAPI_list_create(); + OpenAPI_map_t *localMapKeyPair = NULL; + cJSON_ArrayForEach(scp_domain_info_list_local_map, scp_domain_info_list) { + cJSON *localMapObject = scp_domain_info_list_local_map; + if (cJSON_IsObject(localMapObject)) { + localMapKeyPair = OpenAPI_map_create( + ogs_strdup(localMapObject->string), OpenAPI_scp_domain_info_parseFromJSON(localMapObject)); + } else if (cJSON_IsNull(localMapObject)) { + localMapKeyPair = OpenAPI_map_create(ogs_strdup(localMapObject->string), NULL); + } else { + ogs_error("OpenAPI_nrf_info_served_scp_info_list_value_parseFromJSON() failed [inner]"); + goto end; + } + OpenAPI_list_add(scp_domain_info_listList, localMapKeyPair); + } + } + } + + scp_prefix = cJSON_GetObjectItemCaseSensitive(nrf_info_served_scp_info_list_valueJSON, "scpPrefix"); + if (scp_prefix) { + if (!cJSON_IsString(scp_prefix) && !cJSON_IsNull(scp_prefix)) { + ogs_error("OpenAPI_nrf_info_served_scp_info_list_value_parseFromJSON() failed [scp_prefix]"); + goto end; + } + } + + scp_ports = cJSON_GetObjectItemCaseSensitive(nrf_info_served_scp_info_list_valueJSON, "scpPorts"); + if (scp_ports) { + cJSON *scp_ports_local_map = NULL; + if (!cJSON_IsObject(scp_ports) && !cJSON_IsNull(scp_ports)) { + ogs_error("OpenAPI_nrf_info_served_scp_info_list_value_parseFromJSON() failed [scp_ports]"); + goto end; + } + if (cJSON_IsObject(scp_ports)) { + scp_portsList = OpenAPI_list_create(); + OpenAPI_map_t *localMapKeyPair = NULL; + cJSON_ArrayForEach(scp_ports_local_map, scp_ports) { + cJSON *localMapObject = scp_ports_local_map; + double *localDouble = NULL; + int *localInt = NULL; + if (!cJSON_IsNumber(localMapObject)) { + ogs_error("OpenAPI_nrf_info_served_scp_info_list_value_parseFromJSON() failed [inner]"); + goto end; + } + localDouble = (double *)ogs_calloc(1, sizeof(double)); + if (!localDouble) { + ogs_error("OpenAPI_nrf_info_served_scp_info_list_value_parseFromJSON() failed [inner]"); + goto end; + } + *localDouble = localMapObject->valuedouble; + localMapKeyPair = OpenAPI_map_create(ogs_strdup(localMapObject->string), localDouble); + OpenAPI_list_add(scp_portsList, localMapKeyPair); + } + } + } + + address_domains = cJSON_GetObjectItemCaseSensitive(nrf_info_served_scp_info_list_valueJSON, "addressDomains"); + if (address_domains) { + cJSON *address_domains_local = NULL; + if (!cJSON_IsArray(address_domains)) { + ogs_error("OpenAPI_nrf_info_served_scp_info_list_value_parseFromJSON() failed [address_domains]"); + goto end; + } + + address_domainsList = OpenAPI_list_create(); + + cJSON_ArrayForEach(address_domains_local, address_domains) { + double *localDouble = NULL; + int *localInt = NULL; + if (!cJSON_IsString(address_domains_local)) { + ogs_error("OpenAPI_nrf_info_served_scp_info_list_value_parseFromJSON() failed [address_domains]"); + goto end; + } + OpenAPI_list_add(address_domainsList, ogs_strdup(address_domains_local->valuestring)); + } + } + + ipv4_addresses = cJSON_GetObjectItemCaseSensitive(nrf_info_served_scp_info_list_valueJSON, "ipv4Addresses"); + if (ipv4_addresses) { + cJSON *ipv4_addresses_local = NULL; + if (!cJSON_IsArray(ipv4_addresses)) { + ogs_error("OpenAPI_nrf_info_served_scp_info_list_value_parseFromJSON() failed [ipv4_addresses]"); + goto end; + } + + ipv4_addressesList = OpenAPI_list_create(); + + cJSON_ArrayForEach(ipv4_addresses_local, ipv4_addresses) { + double *localDouble = NULL; + int *localInt = NULL; + if (!cJSON_IsString(ipv4_addresses_local)) { + ogs_error("OpenAPI_nrf_info_served_scp_info_list_value_parseFromJSON() failed [ipv4_addresses]"); + goto end; + } + OpenAPI_list_add(ipv4_addressesList, ogs_strdup(ipv4_addresses_local->valuestring)); + } + } + + ipv6_prefixes = cJSON_GetObjectItemCaseSensitive(nrf_info_served_scp_info_list_valueJSON, "ipv6Prefixes"); + if (ipv6_prefixes) { + cJSON *ipv6_prefixes_local = NULL; + if (!cJSON_IsArray(ipv6_prefixes)) { + ogs_error("OpenAPI_nrf_info_served_scp_info_list_value_parseFromJSON() failed [ipv6_prefixes]"); + goto end; + } + + ipv6_prefixesList = OpenAPI_list_create(); + + cJSON_ArrayForEach(ipv6_prefixes_local, ipv6_prefixes) { + double *localDouble = NULL; + int *localInt = NULL; + if (!cJSON_IsString(ipv6_prefixes_local)) { + ogs_error("OpenAPI_nrf_info_served_scp_info_list_value_parseFromJSON() failed [ipv6_prefixes]"); + goto end; + } + OpenAPI_list_add(ipv6_prefixesList, ogs_strdup(ipv6_prefixes_local->valuestring)); + } + } + + ipv4_addr_ranges = cJSON_GetObjectItemCaseSensitive(nrf_info_served_scp_info_list_valueJSON, "ipv4AddrRanges"); + if (ipv4_addr_ranges) { + cJSON *ipv4_addr_ranges_local = NULL; + if (!cJSON_IsArray(ipv4_addr_ranges)) { + ogs_error("OpenAPI_nrf_info_served_scp_info_list_value_parseFromJSON() failed [ipv4_addr_ranges]"); + goto end; + } + + ipv4_addr_rangesList = OpenAPI_list_create(); + + cJSON_ArrayForEach(ipv4_addr_ranges_local, ipv4_addr_ranges) { + if (!cJSON_IsObject(ipv4_addr_ranges_local)) { + ogs_error("OpenAPI_nrf_info_served_scp_info_list_value_parseFromJSON() failed [ipv4_addr_ranges]"); + goto end; + } + OpenAPI_ipv4_address_range_t *ipv4_addr_rangesItem = OpenAPI_ipv4_address_range_parseFromJSON(ipv4_addr_ranges_local); + if (!ipv4_addr_rangesItem) { + ogs_error("No ipv4_addr_rangesItem"); + OpenAPI_list_free(ipv4_addr_rangesList); + goto end; + } + OpenAPI_list_add(ipv4_addr_rangesList, ipv4_addr_rangesItem); + } + } + + ipv6_prefix_ranges = cJSON_GetObjectItemCaseSensitive(nrf_info_served_scp_info_list_valueJSON, "ipv6PrefixRanges"); + if (ipv6_prefix_ranges) { + cJSON *ipv6_prefix_ranges_local = NULL; + if (!cJSON_IsArray(ipv6_prefix_ranges)) { + ogs_error("OpenAPI_nrf_info_served_scp_info_list_value_parseFromJSON() failed [ipv6_prefix_ranges]"); + goto end; + } + + ipv6_prefix_rangesList = OpenAPI_list_create(); + + cJSON_ArrayForEach(ipv6_prefix_ranges_local, ipv6_prefix_ranges) { + if (!cJSON_IsObject(ipv6_prefix_ranges_local)) { + ogs_error("OpenAPI_nrf_info_served_scp_info_list_value_parseFromJSON() failed [ipv6_prefix_ranges]"); + goto end; + } + OpenAPI_ipv6_prefix_range_t *ipv6_prefix_rangesItem = OpenAPI_ipv6_prefix_range_parseFromJSON(ipv6_prefix_ranges_local); + if (!ipv6_prefix_rangesItem) { + ogs_error("No ipv6_prefix_rangesItem"); + OpenAPI_list_free(ipv6_prefix_rangesList); + goto end; + } + OpenAPI_list_add(ipv6_prefix_rangesList, ipv6_prefix_rangesItem); + } + } + + served_nf_set_id_list = cJSON_GetObjectItemCaseSensitive(nrf_info_served_scp_info_list_valueJSON, "servedNfSetIdList"); + if (served_nf_set_id_list) { + cJSON *served_nf_set_id_list_local = NULL; + if (!cJSON_IsArray(served_nf_set_id_list)) { + ogs_error("OpenAPI_nrf_info_served_scp_info_list_value_parseFromJSON() failed [served_nf_set_id_list]"); + goto end; + } + + served_nf_set_id_listList = OpenAPI_list_create(); + + cJSON_ArrayForEach(served_nf_set_id_list_local, served_nf_set_id_list) { + double *localDouble = NULL; + int *localInt = NULL; + if (!cJSON_IsString(served_nf_set_id_list_local)) { + ogs_error("OpenAPI_nrf_info_served_scp_info_list_value_parseFromJSON() failed [served_nf_set_id_list]"); + goto end; + } + OpenAPI_list_add(served_nf_set_id_listList, ogs_strdup(served_nf_set_id_list_local->valuestring)); + } + } + + remote_plmn_list = cJSON_GetObjectItemCaseSensitive(nrf_info_served_scp_info_list_valueJSON, "remotePlmnList"); + if (remote_plmn_list) { + cJSON *remote_plmn_list_local = NULL; + if (!cJSON_IsArray(remote_plmn_list)) { + ogs_error("OpenAPI_nrf_info_served_scp_info_list_value_parseFromJSON() failed [remote_plmn_list]"); + goto end; + } + + remote_plmn_listList = OpenAPI_list_create(); + + cJSON_ArrayForEach(remote_plmn_list_local, remote_plmn_list) { + if (!cJSON_IsObject(remote_plmn_list_local)) { + ogs_error("OpenAPI_nrf_info_served_scp_info_list_value_parseFromJSON() failed [remote_plmn_list]"); + goto end; + } + OpenAPI_plmn_id_t *remote_plmn_listItem = OpenAPI_plmn_id_parseFromJSON(remote_plmn_list_local); + if (!remote_plmn_listItem) { + ogs_error("No remote_plmn_listItem"); + OpenAPI_list_free(remote_plmn_listList); + goto end; + } + OpenAPI_list_add(remote_plmn_listList, remote_plmn_listItem); + } + } + + remote_snpn_list = cJSON_GetObjectItemCaseSensitive(nrf_info_served_scp_info_list_valueJSON, "remoteSnpnList"); + if (remote_snpn_list) { + cJSON *remote_snpn_list_local = NULL; + if (!cJSON_IsArray(remote_snpn_list)) { + ogs_error("OpenAPI_nrf_info_served_scp_info_list_value_parseFromJSON() failed [remote_snpn_list]"); + goto end; + } + + remote_snpn_listList = OpenAPI_list_create(); + + cJSON_ArrayForEach(remote_snpn_list_local, remote_snpn_list) { + if (!cJSON_IsObject(remote_snpn_list_local)) { + ogs_error("OpenAPI_nrf_info_served_scp_info_list_value_parseFromJSON() failed [remote_snpn_list]"); + goto end; + } + OpenAPI_plmn_id_nid_t *remote_snpn_listItem = OpenAPI_plmn_id_nid_parseFromJSON(remote_snpn_list_local); + if (!remote_snpn_listItem) { + ogs_error("No remote_snpn_listItem"); + OpenAPI_list_free(remote_snpn_listList); + goto end; + } + OpenAPI_list_add(remote_snpn_listList, remote_snpn_listItem); + } + } + + ip_reachability = cJSON_GetObjectItemCaseSensitive(nrf_info_served_scp_info_list_valueJSON, "ipReachability"); + if (ip_reachability) { + if (!cJSON_IsString(ip_reachability)) { + ogs_error("OpenAPI_nrf_info_served_scp_info_list_value_parseFromJSON() failed [ip_reachability]"); + goto end; + } + ip_reachabilityVariable = OpenAPI_ip_reachability_FromString(ip_reachability->valuestring); + } + + scp_capabilities = cJSON_GetObjectItemCaseSensitive(nrf_info_served_scp_info_list_valueJSON, "scpCapabilities"); + if (scp_capabilities) { + cJSON *scp_capabilities_local = NULL; + if (!cJSON_IsArray(scp_capabilities)) { + ogs_error("OpenAPI_nrf_info_served_scp_info_list_value_parseFromJSON() failed [scp_capabilities]"); + goto end; + } + + scp_capabilitiesList = OpenAPI_list_create(); + + cJSON_ArrayForEach(scp_capabilities_local, scp_capabilities) { + if (!cJSON_IsString(scp_capabilities_local)) { + ogs_error("OpenAPI_nrf_info_served_scp_info_list_value_parseFromJSON() failed [scp_capabilities]"); + goto end; + } + OpenAPI_list_add(scp_capabilitiesList, (void *)OpenAPI_scp_capability_FromString(scp_capabilities_local->valuestring)); + } + } + + nrf_info_served_scp_info_list_value_local_var = OpenAPI_nrf_info_served_scp_info_list_value_create ( + scp_domain_info_list ? scp_domain_info_listList : NULL, + scp_prefix && !cJSON_IsNull(scp_prefix) ? ogs_strdup(scp_prefix->valuestring) : NULL, + scp_ports ? scp_portsList : NULL, + address_domains ? address_domainsList : NULL, + ipv4_addresses ? ipv4_addressesList : NULL, + ipv6_prefixes ? ipv6_prefixesList : NULL, + ipv4_addr_ranges ? ipv4_addr_rangesList : NULL, + ipv6_prefix_ranges ? ipv6_prefix_rangesList : NULL, + served_nf_set_id_list ? served_nf_set_id_listList : NULL, + remote_plmn_list ? remote_plmn_listList : NULL, + remote_snpn_list ? remote_snpn_listList : NULL, + ip_reachability ? ip_reachabilityVariable : 0, + scp_capabilities ? scp_capabilitiesList : NULL + ); + + return nrf_info_served_scp_info_list_value_local_var; +end: + if (scp_domain_info_listList) { + OpenAPI_list_for_each(scp_domain_info_listList, node) { + OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*) node->data; + ogs_free(localKeyValue->key); + OpenAPI_scp_domain_info_free(localKeyValue->value); + OpenAPI_map_free(localKeyValue); + } + OpenAPI_list_free(scp_domain_info_listList); + scp_domain_info_listList = NULL; + } + if (scp_portsList) { + OpenAPI_list_for_each(scp_portsList, node) { + OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*) node->data; + ogs_free(localKeyValue->key); + ogs_free(localKeyValue->value); + OpenAPI_map_free(localKeyValue); + } + OpenAPI_list_free(scp_portsList); + scp_portsList = NULL; + } + if (address_domainsList) { + OpenAPI_list_for_each(address_domainsList, node) { + ogs_free(node->data); + } + OpenAPI_list_free(address_domainsList); + address_domainsList = NULL; + } + if (ipv4_addressesList) { + OpenAPI_list_for_each(ipv4_addressesList, node) { + ogs_free(node->data); + } + OpenAPI_list_free(ipv4_addressesList); + ipv4_addressesList = NULL; + } + if (ipv6_prefixesList) { + OpenAPI_list_for_each(ipv6_prefixesList, node) { + ogs_free(node->data); + } + OpenAPI_list_free(ipv6_prefixesList); + ipv6_prefixesList = NULL; + } + if (ipv4_addr_rangesList) { + OpenAPI_list_for_each(ipv4_addr_rangesList, node) { + OpenAPI_ipv4_address_range_free(node->data); + } + OpenAPI_list_free(ipv4_addr_rangesList); + ipv4_addr_rangesList = NULL; + } + if (ipv6_prefix_rangesList) { + OpenAPI_list_for_each(ipv6_prefix_rangesList, node) { + OpenAPI_ipv6_prefix_range_free(node->data); + } + OpenAPI_list_free(ipv6_prefix_rangesList); + ipv6_prefix_rangesList = NULL; + } + if (served_nf_set_id_listList) { + OpenAPI_list_for_each(served_nf_set_id_listList, node) { + ogs_free(node->data); + } + OpenAPI_list_free(served_nf_set_id_listList); + served_nf_set_id_listList = NULL; + } + if (remote_plmn_listList) { + OpenAPI_list_for_each(remote_plmn_listList, node) { + OpenAPI_plmn_id_free(node->data); + } + OpenAPI_list_free(remote_plmn_listList); + remote_plmn_listList = NULL; + } + if (remote_snpn_listList) { + OpenAPI_list_for_each(remote_snpn_listList, node) { + OpenAPI_plmn_id_nid_free(node->data); + } + OpenAPI_list_free(remote_snpn_listList); + remote_snpn_listList = NULL; + } + if (scp_capabilitiesList) { + OpenAPI_list_free(scp_capabilitiesList); + scp_capabilitiesList = NULL; + } + return NULL; +} + +OpenAPI_nrf_info_served_scp_info_list_value_t *OpenAPI_nrf_info_served_scp_info_list_value_copy(OpenAPI_nrf_info_served_scp_info_list_value_t *dst, OpenAPI_nrf_info_served_scp_info_list_value_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_nrf_info_served_scp_info_list_value_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_nrf_info_served_scp_info_list_value_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_nrf_info_served_scp_info_list_value_free(dst); + dst = OpenAPI_nrf_info_served_scp_info_list_value_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/nrf_info_served_scp_info_list_value.h b/lib/sbi/openapi/model/nrf_info_served_scp_info_list_value.h new file mode 100644 index 000000000..c04b894e3 --- /dev/null +++ b/lib/sbi/openapi/model/nrf_info_served_scp_info_list_value.h @@ -0,0 +1,70 @@ +/* + * nrf_info_served_scp_info_list_value.h + * + * + */ + +#ifndef _OpenAPI_nrf_info_served_scp_info_list_value_H_ +#define _OpenAPI_nrf_info_served_scp_info_list_value_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "ip_reachability.h" +#include "ipv4_address_range.h" +#include "ipv6_prefix_range.h" +#include "plmn_id.h" +#include "plmn_id_nid.h" +#include "scp_capability.h" +#include "scp_domain_info.h" +#include "scp_info.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_nrf_info_served_scp_info_list_value_s OpenAPI_nrf_info_served_scp_info_list_value_t; +typedef struct OpenAPI_nrf_info_served_scp_info_list_value_s { + OpenAPI_list_t* scp_domain_info_list; + char *scp_prefix; + OpenAPI_list_t* scp_ports; + OpenAPI_list_t *address_domains; + OpenAPI_list_t *ipv4_addresses; + OpenAPI_list_t *ipv6_prefixes; + OpenAPI_list_t *ipv4_addr_ranges; + OpenAPI_list_t *ipv6_prefix_ranges; + OpenAPI_list_t *served_nf_set_id_list; + OpenAPI_list_t *remote_plmn_list; + OpenAPI_list_t *remote_snpn_list; + OpenAPI_ip_reachability_e ip_reachability; + OpenAPI_list_t *scp_capabilities; +} OpenAPI_nrf_info_served_scp_info_list_value_t; + +OpenAPI_nrf_info_served_scp_info_list_value_t *OpenAPI_nrf_info_served_scp_info_list_value_create( + OpenAPI_list_t* scp_domain_info_list, + char *scp_prefix, + OpenAPI_list_t* scp_ports, + OpenAPI_list_t *address_domains, + OpenAPI_list_t *ipv4_addresses, + OpenAPI_list_t *ipv6_prefixes, + OpenAPI_list_t *ipv4_addr_ranges, + OpenAPI_list_t *ipv6_prefix_ranges, + OpenAPI_list_t *served_nf_set_id_list, + OpenAPI_list_t *remote_plmn_list, + OpenAPI_list_t *remote_snpn_list, + OpenAPI_ip_reachability_e ip_reachability, + OpenAPI_list_t *scp_capabilities +); +void OpenAPI_nrf_info_served_scp_info_list_value_free(OpenAPI_nrf_info_served_scp_info_list_value_t *nrf_info_served_scp_info_list_value); +OpenAPI_nrf_info_served_scp_info_list_value_t *OpenAPI_nrf_info_served_scp_info_list_value_parseFromJSON(cJSON *nrf_info_served_scp_info_list_valueJSON); +cJSON *OpenAPI_nrf_info_served_scp_info_list_value_convertToJSON(OpenAPI_nrf_info_served_scp_info_list_value_t *nrf_info_served_scp_info_list_value); +OpenAPI_nrf_info_served_scp_info_list_value_t *OpenAPI_nrf_info_served_scp_info_list_value_copy(OpenAPI_nrf_info_served_scp_info_list_value_t *dst, OpenAPI_nrf_info_served_scp_info_list_value_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_nrf_info_served_scp_info_list_value_H_ */ + diff --git a/lib/sbi/openapi/model/nrf_info_served_sepp_info_list_value.c b/lib/sbi/openapi/model/nrf_info_served_sepp_info_list_value.c new file mode 100644 index 000000000..6fd9f892b --- /dev/null +++ b/lib/sbi/openapi/model/nrf_info_served_sepp_info_list_value.c @@ -0,0 +1,303 @@ + +#include +#include +#include +#include "nrf_info_served_sepp_info_list_value.h" + +OpenAPI_nrf_info_served_sepp_info_list_value_t *OpenAPI_nrf_info_served_sepp_info_list_value_create( + char *sepp_prefix, + OpenAPI_list_t* sepp_ports, + OpenAPI_list_t *remote_plmn_list, + OpenAPI_list_t *remote_snpn_list +) +{ + OpenAPI_nrf_info_served_sepp_info_list_value_t *nrf_info_served_sepp_info_list_value_local_var = ogs_malloc(sizeof(OpenAPI_nrf_info_served_sepp_info_list_value_t)); + ogs_assert(nrf_info_served_sepp_info_list_value_local_var); + + nrf_info_served_sepp_info_list_value_local_var->sepp_prefix = sepp_prefix; + nrf_info_served_sepp_info_list_value_local_var->sepp_ports = sepp_ports; + nrf_info_served_sepp_info_list_value_local_var->remote_plmn_list = remote_plmn_list; + nrf_info_served_sepp_info_list_value_local_var->remote_snpn_list = remote_snpn_list; + + return nrf_info_served_sepp_info_list_value_local_var; +} + +void OpenAPI_nrf_info_served_sepp_info_list_value_free(OpenAPI_nrf_info_served_sepp_info_list_value_t *nrf_info_served_sepp_info_list_value) +{ + OpenAPI_lnode_t *node = NULL; + + if (NULL == nrf_info_served_sepp_info_list_value) { + return; + } + if (nrf_info_served_sepp_info_list_value->sepp_prefix) { + ogs_free(nrf_info_served_sepp_info_list_value->sepp_prefix); + nrf_info_served_sepp_info_list_value->sepp_prefix = NULL; + } + if (nrf_info_served_sepp_info_list_value->sepp_ports) { + OpenAPI_list_for_each(nrf_info_served_sepp_info_list_value->sepp_ports, node) { + OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*)node->data; + ogs_free(localKeyValue->key); + ogs_free(localKeyValue->value); + OpenAPI_map_free(localKeyValue); + } + OpenAPI_list_free(nrf_info_served_sepp_info_list_value->sepp_ports); + nrf_info_served_sepp_info_list_value->sepp_ports = NULL; + } + if (nrf_info_served_sepp_info_list_value->remote_plmn_list) { + OpenAPI_list_for_each(nrf_info_served_sepp_info_list_value->remote_plmn_list, node) { + OpenAPI_plmn_id_free(node->data); + } + OpenAPI_list_free(nrf_info_served_sepp_info_list_value->remote_plmn_list); + nrf_info_served_sepp_info_list_value->remote_plmn_list = NULL; + } + if (nrf_info_served_sepp_info_list_value->remote_snpn_list) { + OpenAPI_list_for_each(nrf_info_served_sepp_info_list_value->remote_snpn_list, node) { + OpenAPI_plmn_id_nid_free(node->data); + } + OpenAPI_list_free(nrf_info_served_sepp_info_list_value->remote_snpn_list); + nrf_info_served_sepp_info_list_value->remote_snpn_list = NULL; + } + ogs_free(nrf_info_served_sepp_info_list_value); +} + +cJSON *OpenAPI_nrf_info_served_sepp_info_list_value_convertToJSON(OpenAPI_nrf_info_served_sepp_info_list_value_t *nrf_info_served_sepp_info_list_value) +{ + cJSON *item = NULL; + OpenAPI_lnode_t *node = NULL; + + if (nrf_info_served_sepp_info_list_value == NULL) { + ogs_error("OpenAPI_nrf_info_served_sepp_info_list_value_convertToJSON() failed [NrfInfo_servedSeppInfoList_value]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (nrf_info_served_sepp_info_list_value->sepp_prefix) { + if (cJSON_AddStringToObject(item, "seppPrefix", nrf_info_served_sepp_info_list_value->sepp_prefix) == NULL) { + ogs_error("OpenAPI_nrf_info_served_sepp_info_list_value_convertToJSON() failed [sepp_prefix]"); + goto end; + } + } + + if (nrf_info_served_sepp_info_list_value->sepp_ports) { + cJSON *sepp_ports = cJSON_AddObjectToObject(item, "seppPorts"); + if (sepp_ports == NULL) { + ogs_error("OpenAPI_nrf_info_served_sepp_info_list_value_convertToJSON() failed [sepp_ports]"); + goto end; + } + cJSON *localMapObject = sepp_ports; + if (nrf_info_served_sepp_info_list_value->sepp_ports) { + OpenAPI_list_for_each(nrf_info_served_sepp_info_list_value->sepp_ports, node) { + OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*)node->data; + if (cJSON_AddNumberToObject(localMapObject, localKeyValue->key, (uintptr_t)localKeyValue->value) == NULL) { + ogs_error("OpenAPI_nrf_info_served_sepp_info_list_value_convertToJSON() failed [inner]"); + goto end; + } + } + } + } + + if (nrf_info_served_sepp_info_list_value->remote_plmn_list) { + cJSON *remote_plmn_listList = cJSON_AddArrayToObject(item, "remotePlmnList"); + if (remote_plmn_listList == NULL) { + ogs_error("OpenAPI_nrf_info_served_sepp_info_list_value_convertToJSON() failed [remote_plmn_list]"); + goto end; + } + OpenAPI_list_for_each(nrf_info_served_sepp_info_list_value->remote_plmn_list, node) { + cJSON *itemLocal = OpenAPI_plmn_id_convertToJSON(node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_nrf_info_served_sepp_info_list_value_convertToJSON() failed [remote_plmn_list]"); + goto end; + } + cJSON_AddItemToArray(remote_plmn_listList, itemLocal); + } + } + + if (nrf_info_served_sepp_info_list_value->remote_snpn_list) { + cJSON *remote_snpn_listList = cJSON_AddArrayToObject(item, "remoteSnpnList"); + if (remote_snpn_listList == NULL) { + ogs_error("OpenAPI_nrf_info_served_sepp_info_list_value_convertToJSON() failed [remote_snpn_list]"); + goto end; + } + OpenAPI_list_for_each(nrf_info_served_sepp_info_list_value->remote_snpn_list, node) { + cJSON *itemLocal = OpenAPI_plmn_id_nid_convertToJSON(node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_nrf_info_served_sepp_info_list_value_convertToJSON() failed [remote_snpn_list]"); + goto end; + } + cJSON_AddItemToArray(remote_snpn_listList, itemLocal); + } + } + +end: + return item; +} + +OpenAPI_nrf_info_served_sepp_info_list_value_t *OpenAPI_nrf_info_served_sepp_info_list_value_parseFromJSON(cJSON *nrf_info_served_sepp_info_list_valueJSON) +{ + OpenAPI_nrf_info_served_sepp_info_list_value_t *nrf_info_served_sepp_info_list_value_local_var = NULL; + OpenAPI_lnode_t *node = NULL; + cJSON *sepp_prefix = NULL; + cJSON *sepp_ports = NULL; + OpenAPI_list_t *sepp_portsList = NULL; + cJSON *remote_plmn_list = NULL; + OpenAPI_list_t *remote_plmn_listList = NULL; + cJSON *remote_snpn_list = NULL; + OpenAPI_list_t *remote_snpn_listList = NULL; + sepp_prefix = cJSON_GetObjectItemCaseSensitive(nrf_info_served_sepp_info_list_valueJSON, "seppPrefix"); + if (sepp_prefix) { + if (!cJSON_IsString(sepp_prefix) && !cJSON_IsNull(sepp_prefix)) { + ogs_error("OpenAPI_nrf_info_served_sepp_info_list_value_parseFromJSON() failed [sepp_prefix]"); + goto end; + } + } + + sepp_ports = cJSON_GetObjectItemCaseSensitive(nrf_info_served_sepp_info_list_valueJSON, "seppPorts"); + if (sepp_ports) { + cJSON *sepp_ports_local_map = NULL; + if (!cJSON_IsObject(sepp_ports) && !cJSON_IsNull(sepp_ports)) { + ogs_error("OpenAPI_nrf_info_served_sepp_info_list_value_parseFromJSON() failed [sepp_ports]"); + goto end; + } + if (cJSON_IsObject(sepp_ports)) { + sepp_portsList = OpenAPI_list_create(); + OpenAPI_map_t *localMapKeyPair = NULL; + cJSON_ArrayForEach(sepp_ports_local_map, sepp_ports) { + cJSON *localMapObject = sepp_ports_local_map; + double *localDouble = NULL; + int *localInt = NULL; + if (!cJSON_IsNumber(localMapObject)) { + ogs_error("OpenAPI_nrf_info_served_sepp_info_list_value_parseFromJSON() failed [inner]"); + goto end; + } + localDouble = (double *)ogs_calloc(1, sizeof(double)); + if (!localDouble) { + ogs_error("OpenAPI_nrf_info_served_sepp_info_list_value_parseFromJSON() failed [inner]"); + goto end; + } + *localDouble = localMapObject->valuedouble; + localMapKeyPair = OpenAPI_map_create(ogs_strdup(localMapObject->string), localDouble); + OpenAPI_list_add(sepp_portsList, localMapKeyPair); + } + } + } + + remote_plmn_list = cJSON_GetObjectItemCaseSensitive(nrf_info_served_sepp_info_list_valueJSON, "remotePlmnList"); + if (remote_plmn_list) { + cJSON *remote_plmn_list_local = NULL; + if (!cJSON_IsArray(remote_plmn_list)) { + ogs_error("OpenAPI_nrf_info_served_sepp_info_list_value_parseFromJSON() failed [remote_plmn_list]"); + goto end; + } + + remote_plmn_listList = OpenAPI_list_create(); + + cJSON_ArrayForEach(remote_plmn_list_local, remote_plmn_list) { + if (!cJSON_IsObject(remote_plmn_list_local)) { + ogs_error("OpenAPI_nrf_info_served_sepp_info_list_value_parseFromJSON() failed [remote_plmn_list]"); + goto end; + } + OpenAPI_plmn_id_t *remote_plmn_listItem = OpenAPI_plmn_id_parseFromJSON(remote_plmn_list_local); + if (!remote_plmn_listItem) { + ogs_error("No remote_plmn_listItem"); + OpenAPI_list_free(remote_plmn_listList); + goto end; + } + OpenAPI_list_add(remote_plmn_listList, remote_plmn_listItem); + } + } + + remote_snpn_list = cJSON_GetObjectItemCaseSensitive(nrf_info_served_sepp_info_list_valueJSON, "remoteSnpnList"); + if (remote_snpn_list) { + cJSON *remote_snpn_list_local = NULL; + if (!cJSON_IsArray(remote_snpn_list)) { + ogs_error("OpenAPI_nrf_info_served_sepp_info_list_value_parseFromJSON() failed [remote_snpn_list]"); + goto end; + } + + remote_snpn_listList = OpenAPI_list_create(); + + cJSON_ArrayForEach(remote_snpn_list_local, remote_snpn_list) { + if (!cJSON_IsObject(remote_snpn_list_local)) { + ogs_error("OpenAPI_nrf_info_served_sepp_info_list_value_parseFromJSON() failed [remote_snpn_list]"); + goto end; + } + OpenAPI_plmn_id_nid_t *remote_snpn_listItem = OpenAPI_plmn_id_nid_parseFromJSON(remote_snpn_list_local); + if (!remote_snpn_listItem) { + ogs_error("No remote_snpn_listItem"); + OpenAPI_list_free(remote_snpn_listList); + goto end; + } + OpenAPI_list_add(remote_snpn_listList, remote_snpn_listItem); + } + } + + nrf_info_served_sepp_info_list_value_local_var = OpenAPI_nrf_info_served_sepp_info_list_value_create ( + sepp_prefix && !cJSON_IsNull(sepp_prefix) ? ogs_strdup(sepp_prefix->valuestring) : NULL, + sepp_ports ? sepp_portsList : NULL, + remote_plmn_list ? remote_plmn_listList : NULL, + remote_snpn_list ? remote_snpn_listList : NULL + ); + + return nrf_info_served_sepp_info_list_value_local_var; +end: + if (sepp_portsList) { + OpenAPI_list_for_each(sepp_portsList, node) { + OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*) node->data; + ogs_free(localKeyValue->key); + ogs_free(localKeyValue->value); + OpenAPI_map_free(localKeyValue); + } + OpenAPI_list_free(sepp_portsList); + sepp_portsList = NULL; + } + if (remote_plmn_listList) { + OpenAPI_list_for_each(remote_plmn_listList, node) { + OpenAPI_plmn_id_free(node->data); + } + OpenAPI_list_free(remote_plmn_listList); + remote_plmn_listList = NULL; + } + if (remote_snpn_listList) { + OpenAPI_list_for_each(remote_snpn_listList, node) { + OpenAPI_plmn_id_nid_free(node->data); + } + OpenAPI_list_free(remote_snpn_listList); + remote_snpn_listList = NULL; + } + return NULL; +} + +OpenAPI_nrf_info_served_sepp_info_list_value_t *OpenAPI_nrf_info_served_sepp_info_list_value_copy(OpenAPI_nrf_info_served_sepp_info_list_value_t *dst, OpenAPI_nrf_info_served_sepp_info_list_value_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_nrf_info_served_sepp_info_list_value_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_nrf_info_served_sepp_info_list_value_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_nrf_info_served_sepp_info_list_value_free(dst); + dst = OpenAPI_nrf_info_served_sepp_info_list_value_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/nrf_info_served_sepp_info_list_value.h b/lib/sbi/openapi/model/nrf_info_served_sepp_info_list_value.h new file mode 100644 index 000000000..d2d77d2e1 --- /dev/null +++ b/lib/sbi/openapi/model/nrf_info_served_sepp_info_list_value.h @@ -0,0 +1,47 @@ +/* + * nrf_info_served_sepp_info_list_value.h + * + * + */ + +#ifndef _OpenAPI_nrf_info_served_sepp_info_list_value_H_ +#define _OpenAPI_nrf_info_served_sepp_info_list_value_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "plmn_id.h" +#include "plmn_id_nid.h" +#include "sepp_info.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_nrf_info_served_sepp_info_list_value_s OpenAPI_nrf_info_served_sepp_info_list_value_t; +typedef struct OpenAPI_nrf_info_served_sepp_info_list_value_s { + char *sepp_prefix; + OpenAPI_list_t* sepp_ports; + OpenAPI_list_t *remote_plmn_list; + OpenAPI_list_t *remote_snpn_list; +} OpenAPI_nrf_info_served_sepp_info_list_value_t; + +OpenAPI_nrf_info_served_sepp_info_list_value_t *OpenAPI_nrf_info_served_sepp_info_list_value_create( + char *sepp_prefix, + OpenAPI_list_t* sepp_ports, + OpenAPI_list_t *remote_plmn_list, + OpenAPI_list_t *remote_snpn_list +); +void OpenAPI_nrf_info_served_sepp_info_list_value_free(OpenAPI_nrf_info_served_sepp_info_list_value_t *nrf_info_served_sepp_info_list_value); +OpenAPI_nrf_info_served_sepp_info_list_value_t *OpenAPI_nrf_info_served_sepp_info_list_value_parseFromJSON(cJSON *nrf_info_served_sepp_info_list_valueJSON); +cJSON *OpenAPI_nrf_info_served_sepp_info_list_value_convertToJSON(OpenAPI_nrf_info_served_sepp_info_list_value_t *nrf_info_served_sepp_info_list_value); +OpenAPI_nrf_info_served_sepp_info_list_value_t *OpenAPI_nrf_info_served_sepp_info_list_value_copy(OpenAPI_nrf_info_served_sepp_info_list_value_t *dst, OpenAPI_nrf_info_served_sepp_info_list_value_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_nrf_info_served_sepp_info_list_value_H_ */ + diff --git a/lib/sbi/openapi/model/nrf_info_served_smf_info_value.c b/lib/sbi/openapi/model/nrf_info_served_smf_info_value.c new file mode 100644 index 000000000..d1acb8792 --- /dev/null +++ b/lib/sbi/openapi/model/nrf_info_served_smf_info_value.c @@ -0,0 +1,564 @@ + +#include +#include +#include +#include "nrf_info_served_smf_info_value.h" + +OpenAPI_nrf_info_served_smf_info_value_t *OpenAPI_nrf_info_served_smf_info_value_create( + OpenAPI_list_t *s_nssai_smf_info_list, + OpenAPI_list_t *tai_list, + OpenAPI_list_t *tai_range_list, + char *pgw_fqdn, + OpenAPI_list_t *pgw_ip_addr_list, + OpenAPI_list_t *access_type, + bool is_priority, + int priority, + bool is_vsmf_support_ind, + int vsmf_support_ind, + OpenAPI_list_t *pgw_fqdn_list, + bool is_smf_onboarding_capability, + int smf_onboarding_capability, + bool is_ismf_support_ind, + int ismf_support_ind, + bool is_smf_uprp_capability, + int smf_uprp_capability +) +{ + OpenAPI_nrf_info_served_smf_info_value_t *nrf_info_served_smf_info_value_local_var = ogs_malloc(sizeof(OpenAPI_nrf_info_served_smf_info_value_t)); + ogs_assert(nrf_info_served_smf_info_value_local_var); + + nrf_info_served_smf_info_value_local_var->s_nssai_smf_info_list = s_nssai_smf_info_list; + nrf_info_served_smf_info_value_local_var->tai_list = tai_list; + nrf_info_served_smf_info_value_local_var->tai_range_list = tai_range_list; + nrf_info_served_smf_info_value_local_var->pgw_fqdn = pgw_fqdn; + nrf_info_served_smf_info_value_local_var->pgw_ip_addr_list = pgw_ip_addr_list; + nrf_info_served_smf_info_value_local_var->access_type = access_type; + nrf_info_served_smf_info_value_local_var->is_priority = is_priority; + nrf_info_served_smf_info_value_local_var->priority = priority; + nrf_info_served_smf_info_value_local_var->is_vsmf_support_ind = is_vsmf_support_ind; + nrf_info_served_smf_info_value_local_var->vsmf_support_ind = vsmf_support_ind; + nrf_info_served_smf_info_value_local_var->pgw_fqdn_list = pgw_fqdn_list; + nrf_info_served_smf_info_value_local_var->is_smf_onboarding_capability = is_smf_onboarding_capability; + nrf_info_served_smf_info_value_local_var->smf_onboarding_capability = smf_onboarding_capability; + nrf_info_served_smf_info_value_local_var->is_ismf_support_ind = is_ismf_support_ind; + nrf_info_served_smf_info_value_local_var->ismf_support_ind = ismf_support_ind; + nrf_info_served_smf_info_value_local_var->is_smf_uprp_capability = is_smf_uprp_capability; + nrf_info_served_smf_info_value_local_var->smf_uprp_capability = smf_uprp_capability; + + return nrf_info_served_smf_info_value_local_var; +} + +void OpenAPI_nrf_info_served_smf_info_value_free(OpenAPI_nrf_info_served_smf_info_value_t *nrf_info_served_smf_info_value) +{ + OpenAPI_lnode_t *node = NULL; + + if (NULL == nrf_info_served_smf_info_value) { + return; + } + if (nrf_info_served_smf_info_value->s_nssai_smf_info_list) { + OpenAPI_list_for_each(nrf_info_served_smf_info_value->s_nssai_smf_info_list, node) { + OpenAPI_snssai_smf_info_item_free(node->data); + } + OpenAPI_list_free(nrf_info_served_smf_info_value->s_nssai_smf_info_list); + nrf_info_served_smf_info_value->s_nssai_smf_info_list = NULL; + } + if (nrf_info_served_smf_info_value->tai_list) { + OpenAPI_list_for_each(nrf_info_served_smf_info_value->tai_list, node) { + OpenAPI_tai_free(node->data); + } + OpenAPI_list_free(nrf_info_served_smf_info_value->tai_list); + nrf_info_served_smf_info_value->tai_list = NULL; + } + if (nrf_info_served_smf_info_value->tai_range_list) { + OpenAPI_list_for_each(nrf_info_served_smf_info_value->tai_range_list, node) { + OpenAPI_tai_range_free(node->data); + } + OpenAPI_list_free(nrf_info_served_smf_info_value->tai_range_list); + nrf_info_served_smf_info_value->tai_range_list = NULL; + } + if (nrf_info_served_smf_info_value->pgw_fqdn) { + ogs_free(nrf_info_served_smf_info_value->pgw_fqdn); + nrf_info_served_smf_info_value->pgw_fqdn = NULL; + } + if (nrf_info_served_smf_info_value->pgw_ip_addr_list) { + OpenAPI_list_for_each(nrf_info_served_smf_info_value->pgw_ip_addr_list, node) { + OpenAPI_ip_addr_free(node->data); + } + OpenAPI_list_free(nrf_info_served_smf_info_value->pgw_ip_addr_list); + nrf_info_served_smf_info_value->pgw_ip_addr_list = NULL; + } + if (nrf_info_served_smf_info_value->access_type) { + OpenAPI_list_free(nrf_info_served_smf_info_value->access_type); + nrf_info_served_smf_info_value->access_type = NULL; + } + if (nrf_info_served_smf_info_value->pgw_fqdn_list) { + OpenAPI_list_for_each(nrf_info_served_smf_info_value->pgw_fqdn_list, node) { + ogs_free(node->data); + } + OpenAPI_list_free(nrf_info_served_smf_info_value->pgw_fqdn_list); + nrf_info_served_smf_info_value->pgw_fqdn_list = NULL; + } + ogs_free(nrf_info_served_smf_info_value); +} + +cJSON *OpenAPI_nrf_info_served_smf_info_value_convertToJSON(OpenAPI_nrf_info_served_smf_info_value_t *nrf_info_served_smf_info_value) +{ + cJSON *item = NULL; + OpenAPI_lnode_t *node = NULL; + + if (nrf_info_served_smf_info_value == NULL) { + ogs_error("OpenAPI_nrf_info_served_smf_info_value_convertToJSON() failed [NrfInfo_servedSmfInfo_value]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (!nrf_info_served_smf_info_value->s_nssai_smf_info_list) { + ogs_error("OpenAPI_nrf_info_served_smf_info_value_convertToJSON() failed [s_nssai_smf_info_list]"); + return NULL; + } + cJSON *s_nssai_smf_info_listList = cJSON_AddArrayToObject(item, "sNssaiSmfInfoList"); + if (s_nssai_smf_info_listList == NULL) { + ogs_error("OpenAPI_nrf_info_served_smf_info_value_convertToJSON() failed [s_nssai_smf_info_list]"); + goto end; + } + OpenAPI_list_for_each(nrf_info_served_smf_info_value->s_nssai_smf_info_list, node) { + cJSON *itemLocal = OpenAPI_snssai_smf_info_item_convertToJSON(node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_nrf_info_served_smf_info_value_convertToJSON() failed [s_nssai_smf_info_list]"); + goto end; + } + cJSON_AddItemToArray(s_nssai_smf_info_listList, itemLocal); + } + + if (nrf_info_served_smf_info_value->tai_list) { + cJSON *tai_listList = cJSON_AddArrayToObject(item, "taiList"); + if (tai_listList == NULL) { + ogs_error("OpenAPI_nrf_info_served_smf_info_value_convertToJSON() failed [tai_list]"); + goto end; + } + OpenAPI_list_for_each(nrf_info_served_smf_info_value->tai_list, node) { + cJSON *itemLocal = OpenAPI_tai_convertToJSON(node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_nrf_info_served_smf_info_value_convertToJSON() failed [tai_list]"); + goto end; + } + cJSON_AddItemToArray(tai_listList, itemLocal); + } + } + + if (nrf_info_served_smf_info_value->tai_range_list) { + cJSON *tai_range_listList = cJSON_AddArrayToObject(item, "taiRangeList"); + if (tai_range_listList == NULL) { + ogs_error("OpenAPI_nrf_info_served_smf_info_value_convertToJSON() failed [tai_range_list]"); + goto end; + } + OpenAPI_list_for_each(nrf_info_served_smf_info_value->tai_range_list, node) { + cJSON *itemLocal = OpenAPI_tai_range_convertToJSON(node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_nrf_info_served_smf_info_value_convertToJSON() failed [tai_range_list]"); + goto end; + } + cJSON_AddItemToArray(tai_range_listList, itemLocal); + } + } + + if (nrf_info_served_smf_info_value->pgw_fqdn) { + if (cJSON_AddStringToObject(item, "pgwFqdn", nrf_info_served_smf_info_value->pgw_fqdn) == NULL) { + ogs_error("OpenAPI_nrf_info_served_smf_info_value_convertToJSON() failed [pgw_fqdn]"); + goto end; + } + } + + if (nrf_info_served_smf_info_value->pgw_ip_addr_list) { + cJSON *pgw_ip_addr_listList = cJSON_AddArrayToObject(item, "pgwIpAddrList"); + if (pgw_ip_addr_listList == NULL) { + ogs_error("OpenAPI_nrf_info_served_smf_info_value_convertToJSON() failed [pgw_ip_addr_list]"); + goto end; + } + OpenAPI_list_for_each(nrf_info_served_smf_info_value->pgw_ip_addr_list, node) { + cJSON *itemLocal = OpenAPI_ip_addr_convertToJSON(node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_nrf_info_served_smf_info_value_convertToJSON() failed [pgw_ip_addr_list]"); + goto end; + } + cJSON_AddItemToArray(pgw_ip_addr_listList, itemLocal); + } + } + + if (nrf_info_served_smf_info_value->access_type != OpenAPI_access_type_NULL) { + cJSON *access_typeList = cJSON_AddArrayToObject(item, "accessType"); + if (access_typeList == NULL) { + ogs_error("OpenAPI_nrf_info_served_smf_info_value_convertToJSON() failed [access_type]"); + goto end; + } + OpenAPI_list_for_each(nrf_info_served_smf_info_value->access_type, node) { + if (cJSON_AddStringToObject(access_typeList, "", OpenAPI_access_type_ToString((intptr_t)node->data)) == NULL) { + ogs_error("OpenAPI_nrf_info_served_smf_info_value_convertToJSON() failed [access_type]"); + goto end; + } + } + } + + if (nrf_info_served_smf_info_value->is_priority) { + if (cJSON_AddNumberToObject(item, "priority", nrf_info_served_smf_info_value->priority) == NULL) { + ogs_error("OpenAPI_nrf_info_served_smf_info_value_convertToJSON() failed [priority]"); + goto end; + } + } + + if (nrf_info_served_smf_info_value->is_vsmf_support_ind) { + if (cJSON_AddBoolToObject(item, "vsmfSupportInd", nrf_info_served_smf_info_value->vsmf_support_ind) == NULL) { + ogs_error("OpenAPI_nrf_info_served_smf_info_value_convertToJSON() failed [vsmf_support_ind]"); + goto end; + } + } + + if (nrf_info_served_smf_info_value->pgw_fqdn_list) { + cJSON *pgw_fqdn_listList = cJSON_AddArrayToObject(item, "pgwFqdnList"); + if (pgw_fqdn_listList == NULL) { + ogs_error("OpenAPI_nrf_info_served_smf_info_value_convertToJSON() failed [pgw_fqdn_list]"); + goto end; + } + OpenAPI_list_for_each(nrf_info_served_smf_info_value->pgw_fqdn_list, node) { + if (cJSON_AddStringToObject(pgw_fqdn_listList, "", (char*)node->data) == NULL) { + ogs_error("OpenAPI_nrf_info_served_smf_info_value_convertToJSON() failed [pgw_fqdn_list]"); + goto end; + } + } + } + + if (nrf_info_served_smf_info_value->is_smf_onboarding_capability) { + if (cJSON_AddBoolToObject(item, "smfOnboardingCapability", nrf_info_served_smf_info_value->smf_onboarding_capability) == NULL) { + ogs_error("OpenAPI_nrf_info_served_smf_info_value_convertToJSON() failed [smf_onboarding_capability]"); + goto end; + } + } + + if (nrf_info_served_smf_info_value->is_ismf_support_ind) { + if (cJSON_AddBoolToObject(item, "ismfSupportInd", nrf_info_served_smf_info_value->ismf_support_ind) == NULL) { + ogs_error("OpenAPI_nrf_info_served_smf_info_value_convertToJSON() failed [ismf_support_ind]"); + goto end; + } + } + + if (nrf_info_served_smf_info_value->is_smf_uprp_capability) { + if (cJSON_AddBoolToObject(item, "smfUPRPCapability", nrf_info_served_smf_info_value->smf_uprp_capability) == NULL) { + ogs_error("OpenAPI_nrf_info_served_smf_info_value_convertToJSON() failed [smf_uprp_capability]"); + goto end; + } + } + +end: + return item; +} + +OpenAPI_nrf_info_served_smf_info_value_t *OpenAPI_nrf_info_served_smf_info_value_parseFromJSON(cJSON *nrf_info_served_smf_info_valueJSON) +{ + OpenAPI_nrf_info_served_smf_info_value_t *nrf_info_served_smf_info_value_local_var = NULL; + OpenAPI_lnode_t *node = NULL; + cJSON *s_nssai_smf_info_list = NULL; + OpenAPI_list_t *s_nssai_smf_info_listList = NULL; + cJSON *tai_list = NULL; + OpenAPI_list_t *tai_listList = NULL; + cJSON *tai_range_list = NULL; + OpenAPI_list_t *tai_range_listList = NULL; + cJSON *pgw_fqdn = NULL; + cJSON *pgw_ip_addr_list = NULL; + OpenAPI_list_t *pgw_ip_addr_listList = NULL; + cJSON *access_type = NULL; + OpenAPI_list_t *access_typeList = NULL; + cJSON *priority = NULL; + cJSON *vsmf_support_ind = NULL; + cJSON *pgw_fqdn_list = NULL; + OpenAPI_list_t *pgw_fqdn_listList = NULL; + cJSON *smf_onboarding_capability = NULL; + cJSON *ismf_support_ind = NULL; + cJSON *smf_uprp_capability = NULL; + s_nssai_smf_info_list = cJSON_GetObjectItemCaseSensitive(nrf_info_served_smf_info_valueJSON, "sNssaiSmfInfoList"); + if (!s_nssai_smf_info_list) { + ogs_error("OpenAPI_nrf_info_served_smf_info_value_parseFromJSON() failed [s_nssai_smf_info_list]"); + goto end; + } + cJSON *s_nssai_smf_info_list_local = NULL; + if (!cJSON_IsArray(s_nssai_smf_info_list)) { + ogs_error("OpenAPI_nrf_info_served_smf_info_value_parseFromJSON() failed [s_nssai_smf_info_list]"); + goto end; + } + + s_nssai_smf_info_listList = OpenAPI_list_create(); + + cJSON_ArrayForEach(s_nssai_smf_info_list_local, s_nssai_smf_info_list) { + if (!cJSON_IsObject(s_nssai_smf_info_list_local)) { + ogs_error("OpenAPI_nrf_info_served_smf_info_value_parseFromJSON() failed [s_nssai_smf_info_list]"); + goto end; + } + OpenAPI_snssai_smf_info_item_t *s_nssai_smf_info_listItem = OpenAPI_snssai_smf_info_item_parseFromJSON(s_nssai_smf_info_list_local); + if (!s_nssai_smf_info_listItem) { + ogs_error("No s_nssai_smf_info_listItem"); + OpenAPI_list_free(s_nssai_smf_info_listList); + goto end; + } + OpenAPI_list_add(s_nssai_smf_info_listList, s_nssai_smf_info_listItem); + } + + tai_list = cJSON_GetObjectItemCaseSensitive(nrf_info_served_smf_info_valueJSON, "taiList"); + if (tai_list) { + cJSON *tai_list_local = NULL; + if (!cJSON_IsArray(tai_list)) { + ogs_error("OpenAPI_nrf_info_served_smf_info_value_parseFromJSON() failed [tai_list]"); + goto end; + } + + tai_listList = OpenAPI_list_create(); + + cJSON_ArrayForEach(tai_list_local, tai_list) { + if (!cJSON_IsObject(tai_list_local)) { + ogs_error("OpenAPI_nrf_info_served_smf_info_value_parseFromJSON() failed [tai_list]"); + goto end; + } + OpenAPI_tai_t *tai_listItem = OpenAPI_tai_parseFromJSON(tai_list_local); + if (!tai_listItem) { + ogs_error("No tai_listItem"); + OpenAPI_list_free(tai_listList); + goto end; + } + OpenAPI_list_add(tai_listList, tai_listItem); + } + } + + tai_range_list = cJSON_GetObjectItemCaseSensitive(nrf_info_served_smf_info_valueJSON, "taiRangeList"); + if (tai_range_list) { + cJSON *tai_range_list_local = NULL; + if (!cJSON_IsArray(tai_range_list)) { + ogs_error("OpenAPI_nrf_info_served_smf_info_value_parseFromJSON() failed [tai_range_list]"); + goto end; + } + + tai_range_listList = OpenAPI_list_create(); + + cJSON_ArrayForEach(tai_range_list_local, tai_range_list) { + if (!cJSON_IsObject(tai_range_list_local)) { + ogs_error("OpenAPI_nrf_info_served_smf_info_value_parseFromJSON() failed [tai_range_list]"); + goto end; + } + OpenAPI_tai_range_t *tai_range_listItem = OpenAPI_tai_range_parseFromJSON(tai_range_list_local); + if (!tai_range_listItem) { + ogs_error("No tai_range_listItem"); + OpenAPI_list_free(tai_range_listList); + goto end; + } + OpenAPI_list_add(tai_range_listList, tai_range_listItem); + } + } + + pgw_fqdn = cJSON_GetObjectItemCaseSensitive(nrf_info_served_smf_info_valueJSON, "pgwFqdn"); + if (pgw_fqdn) { + if (!cJSON_IsString(pgw_fqdn) && !cJSON_IsNull(pgw_fqdn)) { + ogs_error("OpenAPI_nrf_info_served_smf_info_value_parseFromJSON() failed [pgw_fqdn]"); + goto end; + } + } + + pgw_ip_addr_list = cJSON_GetObjectItemCaseSensitive(nrf_info_served_smf_info_valueJSON, "pgwIpAddrList"); + if (pgw_ip_addr_list) { + cJSON *pgw_ip_addr_list_local = NULL; + if (!cJSON_IsArray(pgw_ip_addr_list)) { + ogs_error("OpenAPI_nrf_info_served_smf_info_value_parseFromJSON() failed [pgw_ip_addr_list]"); + goto end; + } + + pgw_ip_addr_listList = OpenAPI_list_create(); + + cJSON_ArrayForEach(pgw_ip_addr_list_local, pgw_ip_addr_list) { + if (!cJSON_IsObject(pgw_ip_addr_list_local)) { + ogs_error("OpenAPI_nrf_info_served_smf_info_value_parseFromJSON() failed [pgw_ip_addr_list]"); + goto end; + } + OpenAPI_ip_addr_t *pgw_ip_addr_listItem = OpenAPI_ip_addr_parseFromJSON(pgw_ip_addr_list_local); + if (!pgw_ip_addr_listItem) { + ogs_error("No pgw_ip_addr_listItem"); + OpenAPI_list_free(pgw_ip_addr_listList); + goto end; + } + OpenAPI_list_add(pgw_ip_addr_listList, pgw_ip_addr_listItem); + } + } + + access_type = cJSON_GetObjectItemCaseSensitive(nrf_info_served_smf_info_valueJSON, "accessType"); + if (access_type) { + cJSON *access_type_local = NULL; + if (!cJSON_IsArray(access_type)) { + ogs_error("OpenAPI_nrf_info_served_smf_info_value_parseFromJSON() failed [access_type]"); + goto end; + } + + access_typeList = OpenAPI_list_create(); + + cJSON_ArrayForEach(access_type_local, access_type) { + if (!cJSON_IsString(access_type_local)) { + ogs_error("OpenAPI_nrf_info_served_smf_info_value_parseFromJSON() failed [access_type]"); + goto end; + } + OpenAPI_list_add(access_typeList, (void *)OpenAPI_access_type_FromString(access_type_local->valuestring)); + } + } + + priority = cJSON_GetObjectItemCaseSensitive(nrf_info_served_smf_info_valueJSON, "priority"); + if (priority) { + if (!cJSON_IsNumber(priority)) { + ogs_error("OpenAPI_nrf_info_served_smf_info_value_parseFromJSON() failed [priority]"); + goto end; + } + } + + vsmf_support_ind = cJSON_GetObjectItemCaseSensitive(nrf_info_served_smf_info_valueJSON, "vsmfSupportInd"); + if (vsmf_support_ind) { + if (!cJSON_IsBool(vsmf_support_ind)) { + ogs_error("OpenAPI_nrf_info_served_smf_info_value_parseFromJSON() failed [vsmf_support_ind]"); + goto end; + } + } + + pgw_fqdn_list = cJSON_GetObjectItemCaseSensitive(nrf_info_served_smf_info_valueJSON, "pgwFqdnList"); + if (pgw_fqdn_list) { + cJSON *pgw_fqdn_list_local = NULL; + if (!cJSON_IsArray(pgw_fqdn_list)) { + ogs_error("OpenAPI_nrf_info_served_smf_info_value_parseFromJSON() failed [pgw_fqdn_list]"); + goto end; + } + + pgw_fqdn_listList = OpenAPI_list_create(); + + cJSON_ArrayForEach(pgw_fqdn_list_local, pgw_fqdn_list) { + double *localDouble = NULL; + int *localInt = NULL; + if (!cJSON_IsString(pgw_fqdn_list_local)) { + ogs_error("OpenAPI_nrf_info_served_smf_info_value_parseFromJSON() failed [pgw_fqdn_list]"); + goto end; + } + OpenAPI_list_add(pgw_fqdn_listList, ogs_strdup(pgw_fqdn_list_local->valuestring)); + } + } + + smf_onboarding_capability = cJSON_GetObjectItemCaseSensitive(nrf_info_served_smf_info_valueJSON, "smfOnboardingCapability"); + if (smf_onboarding_capability) { + if (!cJSON_IsBool(smf_onboarding_capability)) { + ogs_error("OpenAPI_nrf_info_served_smf_info_value_parseFromJSON() failed [smf_onboarding_capability]"); + goto end; + } + } + + ismf_support_ind = cJSON_GetObjectItemCaseSensitive(nrf_info_served_smf_info_valueJSON, "ismfSupportInd"); + if (ismf_support_ind) { + if (!cJSON_IsBool(ismf_support_ind)) { + ogs_error("OpenAPI_nrf_info_served_smf_info_value_parseFromJSON() failed [ismf_support_ind]"); + goto end; + } + } + + smf_uprp_capability = cJSON_GetObjectItemCaseSensitive(nrf_info_served_smf_info_valueJSON, "smfUPRPCapability"); + if (smf_uprp_capability) { + if (!cJSON_IsBool(smf_uprp_capability)) { + ogs_error("OpenAPI_nrf_info_served_smf_info_value_parseFromJSON() failed [smf_uprp_capability]"); + goto end; + } + } + + nrf_info_served_smf_info_value_local_var = OpenAPI_nrf_info_served_smf_info_value_create ( + s_nssai_smf_info_listList, + tai_list ? tai_listList : NULL, + tai_range_list ? tai_range_listList : NULL, + pgw_fqdn && !cJSON_IsNull(pgw_fqdn) ? ogs_strdup(pgw_fqdn->valuestring) : NULL, + pgw_ip_addr_list ? pgw_ip_addr_listList : NULL, + access_type ? access_typeList : NULL, + priority ? true : false, + priority ? priority->valuedouble : 0, + vsmf_support_ind ? true : false, + vsmf_support_ind ? vsmf_support_ind->valueint : 0, + pgw_fqdn_list ? pgw_fqdn_listList : NULL, + smf_onboarding_capability ? true : false, + smf_onboarding_capability ? smf_onboarding_capability->valueint : 0, + ismf_support_ind ? true : false, + ismf_support_ind ? ismf_support_ind->valueint : 0, + smf_uprp_capability ? true : false, + smf_uprp_capability ? smf_uprp_capability->valueint : 0 + ); + + return nrf_info_served_smf_info_value_local_var; +end: + if (s_nssai_smf_info_listList) { + OpenAPI_list_for_each(s_nssai_smf_info_listList, node) { + OpenAPI_snssai_smf_info_item_free(node->data); + } + OpenAPI_list_free(s_nssai_smf_info_listList); + s_nssai_smf_info_listList = NULL; + } + if (tai_listList) { + OpenAPI_list_for_each(tai_listList, node) { + OpenAPI_tai_free(node->data); + } + OpenAPI_list_free(tai_listList); + tai_listList = NULL; + } + if (tai_range_listList) { + OpenAPI_list_for_each(tai_range_listList, node) { + OpenAPI_tai_range_free(node->data); + } + OpenAPI_list_free(tai_range_listList); + tai_range_listList = NULL; + } + if (pgw_ip_addr_listList) { + OpenAPI_list_for_each(pgw_ip_addr_listList, node) { + OpenAPI_ip_addr_free(node->data); + } + OpenAPI_list_free(pgw_ip_addr_listList); + pgw_ip_addr_listList = NULL; + } + if (access_typeList) { + OpenAPI_list_free(access_typeList); + access_typeList = NULL; + } + if (pgw_fqdn_listList) { + OpenAPI_list_for_each(pgw_fqdn_listList, node) { + ogs_free(node->data); + } + OpenAPI_list_free(pgw_fqdn_listList); + pgw_fqdn_listList = NULL; + } + return NULL; +} + +OpenAPI_nrf_info_served_smf_info_value_t *OpenAPI_nrf_info_served_smf_info_value_copy(OpenAPI_nrf_info_served_smf_info_value_t *dst, OpenAPI_nrf_info_served_smf_info_value_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_nrf_info_served_smf_info_value_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_nrf_info_served_smf_info_value_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_nrf_info_served_smf_info_value_free(dst); + dst = OpenAPI_nrf_info_served_smf_info_value_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/nrf_info_served_smf_info_value.h b/lib/sbi/openapi/model/nrf_info_served_smf_info_value.h new file mode 100644 index 000000000..d8d1d0f05 --- /dev/null +++ b/lib/sbi/openapi/model/nrf_info_served_smf_info_value.h @@ -0,0 +1,76 @@ +/* + * nrf_info_served_smf_info_value.h + * + * + */ + +#ifndef _OpenAPI_nrf_info_served_smf_info_value_H_ +#define _OpenAPI_nrf_info_served_smf_info_value_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "access_type.h" +#include "ip_addr.h" +#include "smf_info.h" +#include "snssai_smf_info_item.h" +#include "tai.h" +#include "tai_range.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_nrf_info_served_smf_info_value_s OpenAPI_nrf_info_served_smf_info_value_t; +typedef struct OpenAPI_nrf_info_served_smf_info_value_s { + OpenAPI_list_t *s_nssai_smf_info_list; + OpenAPI_list_t *tai_list; + OpenAPI_list_t *tai_range_list; + char *pgw_fqdn; + OpenAPI_list_t *pgw_ip_addr_list; + OpenAPI_list_t *access_type; + bool is_priority; + int priority; + bool is_vsmf_support_ind; + int vsmf_support_ind; + OpenAPI_list_t *pgw_fqdn_list; + bool is_smf_onboarding_capability; + int smf_onboarding_capability; + bool is_ismf_support_ind; + int ismf_support_ind; + bool is_smf_uprp_capability; + int smf_uprp_capability; +} OpenAPI_nrf_info_served_smf_info_value_t; + +OpenAPI_nrf_info_served_smf_info_value_t *OpenAPI_nrf_info_served_smf_info_value_create( + OpenAPI_list_t *s_nssai_smf_info_list, + OpenAPI_list_t *tai_list, + OpenAPI_list_t *tai_range_list, + char *pgw_fqdn, + OpenAPI_list_t *pgw_ip_addr_list, + OpenAPI_list_t *access_type, + bool is_priority, + int priority, + bool is_vsmf_support_ind, + int vsmf_support_ind, + OpenAPI_list_t *pgw_fqdn_list, + bool is_smf_onboarding_capability, + int smf_onboarding_capability, + bool is_ismf_support_ind, + int ismf_support_ind, + bool is_smf_uprp_capability, + int smf_uprp_capability +); +void OpenAPI_nrf_info_served_smf_info_value_free(OpenAPI_nrf_info_served_smf_info_value_t *nrf_info_served_smf_info_value); +OpenAPI_nrf_info_served_smf_info_value_t *OpenAPI_nrf_info_served_smf_info_value_parseFromJSON(cJSON *nrf_info_served_smf_info_valueJSON); +cJSON *OpenAPI_nrf_info_served_smf_info_value_convertToJSON(OpenAPI_nrf_info_served_smf_info_value_t *nrf_info_served_smf_info_value); +OpenAPI_nrf_info_served_smf_info_value_t *OpenAPI_nrf_info_served_smf_info_value_copy(OpenAPI_nrf_info_served_smf_info_value_t *dst, OpenAPI_nrf_info_served_smf_info_value_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_nrf_info_served_smf_info_value_H_ */ + diff --git a/lib/sbi/openapi/model/nrf_info_served_udm_info_value.c b/lib/sbi/openapi/model/nrf_info_served_udm_info_value.c new file mode 100644 index 000000000..1751acef6 --- /dev/null +++ b/lib/sbi/openapi/model/nrf_info_served_udm_info_value.c @@ -0,0 +1,464 @@ + +#include +#include +#include +#include "nrf_info_served_udm_info_value.h" + +OpenAPI_nrf_info_served_udm_info_value_t *OpenAPI_nrf_info_served_udm_info_value_create( + char *group_id, + OpenAPI_list_t *supi_ranges, + OpenAPI_list_t *gpsi_ranges, + OpenAPI_list_t *external_group_identifiers_ranges, + OpenAPI_list_t *routing_indicators, + OpenAPI_list_t *internal_group_identifiers_ranges, + OpenAPI_list_t *suci_infos +) +{ + OpenAPI_nrf_info_served_udm_info_value_t *nrf_info_served_udm_info_value_local_var = ogs_malloc(sizeof(OpenAPI_nrf_info_served_udm_info_value_t)); + ogs_assert(nrf_info_served_udm_info_value_local_var); + + nrf_info_served_udm_info_value_local_var->group_id = group_id; + nrf_info_served_udm_info_value_local_var->supi_ranges = supi_ranges; + nrf_info_served_udm_info_value_local_var->gpsi_ranges = gpsi_ranges; + nrf_info_served_udm_info_value_local_var->external_group_identifiers_ranges = external_group_identifiers_ranges; + nrf_info_served_udm_info_value_local_var->routing_indicators = routing_indicators; + nrf_info_served_udm_info_value_local_var->internal_group_identifiers_ranges = internal_group_identifiers_ranges; + nrf_info_served_udm_info_value_local_var->suci_infos = suci_infos; + + return nrf_info_served_udm_info_value_local_var; +} + +void OpenAPI_nrf_info_served_udm_info_value_free(OpenAPI_nrf_info_served_udm_info_value_t *nrf_info_served_udm_info_value) +{ + OpenAPI_lnode_t *node = NULL; + + if (NULL == nrf_info_served_udm_info_value) { + return; + } + if (nrf_info_served_udm_info_value->group_id) { + ogs_free(nrf_info_served_udm_info_value->group_id); + nrf_info_served_udm_info_value->group_id = NULL; + } + if (nrf_info_served_udm_info_value->supi_ranges) { + OpenAPI_list_for_each(nrf_info_served_udm_info_value->supi_ranges, node) { + OpenAPI_supi_range_free(node->data); + } + OpenAPI_list_free(nrf_info_served_udm_info_value->supi_ranges); + nrf_info_served_udm_info_value->supi_ranges = NULL; + } + if (nrf_info_served_udm_info_value->gpsi_ranges) { + OpenAPI_list_for_each(nrf_info_served_udm_info_value->gpsi_ranges, node) { + OpenAPI_identity_range_free(node->data); + } + OpenAPI_list_free(nrf_info_served_udm_info_value->gpsi_ranges); + nrf_info_served_udm_info_value->gpsi_ranges = NULL; + } + if (nrf_info_served_udm_info_value->external_group_identifiers_ranges) { + OpenAPI_list_for_each(nrf_info_served_udm_info_value->external_group_identifiers_ranges, node) { + OpenAPI_identity_range_free(node->data); + } + OpenAPI_list_free(nrf_info_served_udm_info_value->external_group_identifiers_ranges); + nrf_info_served_udm_info_value->external_group_identifiers_ranges = NULL; + } + if (nrf_info_served_udm_info_value->routing_indicators) { + OpenAPI_list_for_each(nrf_info_served_udm_info_value->routing_indicators, node) { + ogs_free(node->data); + } + OpenAPI_list_free(nrf_info_served_udm_info_value->routing_indicators); + nrf_info_served_udm_info_value->routing_indicators = NULL; + } + if (nrf_info_served_udm_info_value->internal_group_identifiers_ranges) { + OpenAPI_list_for_each(nrf_info_served_udm_info_value->internal_group_identifiers_ranges, node) { + OpenAPI_internal_group_id_range_free(node->data); + } + OpenAPI_list_free(nrf_info_served_udm_info_value->internal_group_identifiers_ranges); + nrf_info_served_udm_info_value->internal_group_identifiers_ranges = NULL; + } + if (nrf_info_served_udm_info_value->suci_infos) { + OpenAPI_list_for_each(nrf_info_served_udm_info_value->suci_infos, node) { + OpenAPI_suci_info_free(node->data); + } + OpenAPI_list_free(nrf_info_served_udm_info_value->suci_infos); + nrf_info_served_udm_info_value->suci_infos = NULL; + } + ogs_free(nrf_info_served_udm_info_value); +} + +cJSON *OpenAPI_nrf_info_served_udm_info_value_convertToJSON(OpenAPI_nrf_info_served_udm_info_value_t *nrf_info_served_udm_info_value) +{ + cJSON *item = NULL; + OpenAPI_lnode_t *node = NULL; + + if (nrf_info_served_udm_info_value == NULL) { + ogs_error("OpenAPI_nrf_info_served_udm_info_value_convertToJSON() failed [NrfInfo_servedUdmInfo_value]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (nrf_info_served_udm_info_value->group_id) { + if (cJSON_AddStringToObject(item, "groupId", nrf_info_served_udm_info_value->group_id) == NULL) { + ogs_error("OpenAPI_nrf_info_served_udm_info_value_convertToJSON() failed [group_id]"); + goto end; + } + } + + if (nrf_info_served_udm_info_value->supi_ranges) { + cJSON *supi_rangesList = cJSON_AddArrayToObject(item, "supiRanges"); + if (supi_rangesList == NULL) { + ogs_error("OpenAPI_nrf_info_served_udm_info_value_convertToJSON() failed [supi_ranges]"); + goto end; + } + OpenAPI_list_for_each(nrf_info_served_udm_info_value->supi_ranges, node) { + cJSON *itemLocal = OpenAPI_supi_range_convertToJSON(node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_nrf_info_served_udm_info_value_convertToJSON() failed [supi_ranges]"); + goto end; + } + cJSON_AddItemToArray(supi_rangesList, itemLocal); + } + } + + if (nrf_info_served_udm_info_value->gpsi_ranges) { + cJSON *gpsi_rangesList = cJSON_AddArrayToObject(item, "gpsiRanges"); + if (gpsi_rangesList == NULL) { + ogs_error("OpenAPI_nrf_info_served_udm_info_value_convertToJSON() failed [gpsi_ranges]"); + goto end; + } + OpenAPI_list_for_each(nrf_info_served_udm_info_value->gpsi_ranges, node) { + cJSON *itemLocal = OpenAPI_identity_range_convertToJSON(node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_nrf_info_served_udm_info_value_convertToJSON() failed [gpsi_ranges]"); + goto end; + } + cJSON_AddItemToArray(gpsi_rangesList, itemLocal); + } + } + + if (nrf_info_served_udm_info_value->external_group_identifiers_ranges) { + cJSON *external_group_identifiers_rangesList = cJSON_AddArrayToObject(item, "externalGroupIdentifiersRanges"); + if (external_group_identifiers_rangesList == NULL) { + ogs_error("OpenAPI_nrf_info_served_udm_info_value_convertToJSON() failed [external_group_identifiers_ranges]"); + goto end; + } + OpenAPI_list_for_each(nrf_info_served_udm_info_value->external_group_identifiers_ranges, node) { + cJSON *itemLocal = OpenAPI_identity_range_convertToJSON(node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_nrf_info_served_udm_info_value_convertToJSON() failed [external_group_identifiers_ranges]"); + goto end; + } + cJSON_AddItemToArray(external_group_identifiers_rangesList, itemLocal); + } + } + + if (nrf_info_served_udm_info_value->routing_indicators) { + cJSON *routing_indicatorsList = cJSON_AddArrayToObject(item, "routingIndicators"); + if (routing_indicatorsList == NULL) { + ogs_error("OpenAPI_nrf_info_served_udm_info_value_convertToJSON() failed [routing_indicators]"); + goto end; + } + OpenAPI_list_for_each(nrf_info_served_udm_info_value->routing_indicators, node) { + if (cJSON_AddStringToObject(routing_indicatorsList, "", (char*)node->data) == NULL) { + ogs_error("OpenAPI_nrf_info_served_udm_info_value_convertToJSON() failed [routing_indicators]"); + goto end; + } + } + } + + if (nrf_info_served_udm_info_value->internal_group_identifiers_ranges) { + cJSON *internal_group_identifiers_rangesList = cJSON_AddArrayToObject(item, "internalGroupIdentifiersRanges"); + if (internal_group_identifiers_rangesList == NULL) { + ogs_error("OpenAPI_nrf_info_served_udm_info_value_convertToJSON() failed [internal_group_identifiers_ranges]"); + goto end; + } + OpenAPI_list_for_each(nrf_info_served_udm_info_value->internal_group_identifiers_ranges, node) { + cJSON *itemLocal = OpenAPI_internal_group_id_range_convertToJSON(node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_nrf_info_served_udm_info_value_convertToJSON() failed [internal_group_identifiers_ranges]"); + goto end; + } + cJSON_AddItemToArray(internal_group_identifiers_rangesList, itemLocal); + } + } + + if (nrf_info_served_udm_info_value->suci_infos) { + cJSON *suci_infosList = cJSON_AddArrayToObject(item, "suciInfos"); + if (suci_infosList == NULL) { + ogs_error("OpenAPI_nrf_info_served_udm_info_value_convertToJSON() failed [suci_infos]"); + goto end; + } + OpenAPI_list_for_each(nrf_info_served_udm_info_value->suci_infos, node) { + cJSON *itemLocal = OpenAPI_suci_info_convertToJSON(node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_nrf_info_served_udm_info_value_convertToJSON() failed [suci_infos]"); + goto end; + } + cJSON_AddItemToArray(suci_infosList, itemLocal); + } + } + +end: + return item; +} + +OpenAPI_nrf_info_served_udm_info_value_t *OpenAPI_nrf_info_served_udm_info_value_parseFromJSON(cJSON *nrf_info_served_udm_info_valueJSON) +{ + OpenAPI_nrf_info_served_udm_info_value_t *nrf_info_served_udm_info_value_local_var = NULL; + OpenAPI_lnode_t *node = NULL; + cJSON *group_id = NULL; + cJSON *supi_ranges = NULL; + OpenAPI_list_t *supi_rangesList = NULL; + cJSON *gpsi_ranges = NULL; + OpenAPI_list_t *gpsi_rangesList = NULL; + cJSON *external_group_identifiers_ranges = NULL; + OpenAPI_list_t *external_group_identifiers_rangesList = NULL; + cJSON *routing_indicators = NULL; + OpenAPI_list_t *routing_indicatorsList = NULL; + cJSON *internal_group_identifiers_ranges = NULL; + OpenAPI_list_t *internal_group_identifiers_rangesList = NULL; + cJSON *suci_infos = NULL; + OpenAPI_list_t *suci_infosList = NULL; + group_id = cJSON_GetObjectItemCaseSensitive(nrf_info_served_udm_info_valueJSON, "groupId"); + if (group_id) { + if (!cJSON_IsString(group_id) && !cJSON_IsNull(group_id)) { + ogs_error("OpenAPI_nrf_info_served_udm_info_value_parseFromJSON() failed [group_id]"); + goto end; + } + } + + supi_ranges = cJSON_GetObjectItemCaseSensitive(nrf_info_served_udm_info_valueJSON, "supiRanges"); + if (supi_ranges) { + cJSON *supi_ranges_local = NULL; + if (!cJSON_IsArray(supi_ranges)) { + ogs_error("OpenAPI_nrf_info_served_udm_info_value_parseFromJSON() failed [supi_ranges]"); + goto end; + } + + supi_rangesList = OpenAPI_list_create(); + + cJSON_ArrayForEach(supi_ranges_local, supi_ranges) { + if (!cJSON_IsObject(supi_ranges_local)) { + ogs_error("OpenAPI_nrf_info_served_udm_info_value_parseFromJSON() failed [supi_ranges]"); + goto end; + } + OpenAPI_supi_range_t *supi_rangesItem = OpenAPI_supi_range_parseFromJSON(supi_ranges_local); + if (!supi_rangesItem) { + ogs_error("No supi_rangesItem"); + OpenAPI_list_free(supi_rangesList); + goto end; + } + OpenAPI_list_add(supi_rangesList, supi_rangesItem); + } + } + + gpsi_ranges = cJSON_GetObjectItemCaseSensitive(nrf_info_served_udm_info_valueJSON, "gpsiRanges"); + if (gpsi_ranges) { + cJSON *gpsi_ranges_local = NULL; + if (!cJSON_IsArray(gpsi_ranges)) { + ogs_error("OpenAPI_nrf_info_served_udm_info_value_parseFromJSON() failed [gpsi_ranges]"); + goto end; + } + + gpsi_rangesList = OpenAPI_list_create(); + + cJSON_ArrayForEach(gpsi_ranges_local, gpsi_ranges) { + if (!cJSON_IsObject(gpsi_ranges_local)) { + ogs_error("OpenAPI_nrf_info_served_udm_info_value_parseFromJSON() failed [gpsi_ranges]"); + goto end; + } + OpenAPI_identity_range_t *gpsi_rangesItem = OpenAPI_identity_range_parseFromJSON(gpsi_ranges_local); + if (!gpsi_rangesItem) { + ogs_error("No gpsi_rangesItem"); + OpenAPI_list_free(gpsi_rangesList); + goto end; + } + OpenAPI_list_add(gpsi_rangesList, gpsi_rangesItem); + } + } + + external_group_identifiers_ranges = cJSON_GetObjectItemCaseSensitive(nrf_info_served_udm_info_valueJSON, "externalGroupIdentifiersRanges"); + if (external_group_identifiers_ranges) { + cJSON *external_group_identifiers_ranges_local = NULL; + if (!cJSON_IsArray(external_group_identifiers_ranges)) { + ogs_error("OpenAPI_nrf_info_served_udm_info_value_parseFromJSON() failed [external_group_identifiers_ranges]"); + goto end; + } + + external_group_identifiers_rangesList = OpenAPI_list_create(); + + cJSON_ArrayForEach(external_group_identifiers_ranges_local, external_group_identifiers_ranges) { + if (!cJSON_IsObject(external_group_identifiers_ranges_local)) { + ogs_error("OpenAPI_nrf_info_served_udm_info_value_parseFromJSON() failed [external_group_identifiers_ranges]"); + goto end; + } + OpenAPI_identity_range_t *external_group_identifiers_rangesItem = OpenAPI_identity_range_parseFromJSON(external_group_identifiers_ranges_local); + if (!external_group_identifiers_rangesItem) { + ogs_error("No external_group_identifiers_rangesItem"); + OpenAPI_list_free(external_group_identifiers_rangesList); + goto end; + } + OpenAPI_list_add(external_group_identifiers_rangesList, external_group_identifiers_rangesItem); + } + } + + routing_indicators = cJSON_GetObjectItemCaseSensitive(nrf_info_served_udm_info_valueJSON, "routingIndicators"); + if (routing_indicators) { + cJSON *routing_indicators_local = NULL; + if (!cJSON_IsArray(routing_indicators)) { + ogs_error("OpenAPI_nrf_info_served_udm_info_value_parseFromJSON() failed [routing_indicators]"); + goto end; + } + + routing_indicatorsList = OpenAPI_list_create(); + + cJSON_ArrayForEach(routing_indicators_local, routing_indicators) { + double *localDouble = NULL; + int *localInt = NULL; + if (!cJSON_IsString(routing_indicators_local)) { + ogs_error("OpenAPI_nrf_info_served_udm_info_value_parseFromJSON() failed [routing_indicators]"); + goto end; + } + OpenAPI_list_add(routing_indicatorsList, ogs_strdup(routing_indicators_local->valuestring)); + } + } + + internal_group_identifiers_ranges = cJSON_GetObjectItemCaseSensitive(nrf_info_served_udm_info_valueJSON, "internalGroupIdentifiersRanges"); + if (internal_group_identifiers_ranges) { + cJSON *internal_group_identifiers_ranges_local = NULL; + if (!cJSON_IsArray(internal_group_identifiers_ranges)) { + ogs_error("OpenAPI_nrf_info_served_udm_info_value_parseFromJSON() failed [internal_group_identifiers_ranges]"); + goto end; + } + + internal_group_identifiers_rangesList = OpenAPI_list_create(); + + cJSON_ArrayForEach(internal_group_identifiers_ranges_local, internal_group_identifiers_ranges) { + if (!cJSON_IsObject(internal_group_identifiers_ranges_local)) { + ogs_error("OpenAPI_nrf_info_served_udm_info_value_parseFromJSON() failed [internal_group_identifiers_ranges]"); + goto end; + } + OpenAPI_internal_group_id_range_t *internal_group_identifiers_rangesItem = OpenAPI_internal_group_id_range_parseFromJSON(internal_group_identifiers_ranges_local); + if (!internal_group_identifiers_rangesItem) { + ogs_error("No internal_group_identifiers_rangesItem"); + OpenAPI_list_free(internal_group_identifiers_rangesList); + goto end; + } + OpenAPI_list_add(internal_group_identifiers_rangesList, internal_group_identifiers_rangesItem); + } + } + + suci_infos = cJSON_GetObjectItemCaseSensitive(nrf_info_served_udm_info_valueJSON, "suciInfos"); + if (suci_infos) { + cJSON *suci_infos_local = NULL; + if (!cJSON_IsArray(suci_infos)) { + ogs_error("OpenAPI_nrf_info_served_udm_info_value_parseFromJSON() failed [suci_infos]"); + goto end; + } + + suci_infosList = OpenAPI_list_create(); + + cJSON_ArrayForEach(suci_infos_local, suci_infos) { + if (!cJSON_IsObject(suci_infos_local)) { + ogs_error("OpenAPI_nrf_info_served_udm_info_value_parseFromJSON() failed [suci_infos]"); + goto end; + } + OpenAPI_suci_info_t *suci_infosItem = OpenAPI_suci_info_parseFromJSON(suci_infos_local); + if (!suci_infosItem) { + ogs_error("No suci_infosItem"); + OpenAPI_list_free(suci_infosList); + goto end; + } + OpenAPI_list_add(suci_infosList, suci_infosItem); + } + } + + nrf_info_served_udm_info_value_local_var = OpenAPI_nrf_info_served_udm_info_value_create ( + group_id && !cJSON_IsNull(group_id) ? ogs_strdup(group_id->valuestring) : NULL, + supi_ranges ? supi_rangesList : NULL, + gpsi_ranges ? gpsi_rangesList : NULL, + external_group_identifiers_ranges ? external_group_identifiers_rangesList : NULL, + routing_indicators ? routing_indicatorsList : NULL, + internal_group_identifiers_ranges ? internal_group_identifiers_rangesList : NULL, + suci_infos ? suci_infosList : NULL + ); + + return nrf_info_served_udm_info_value_local_var; +end: + if (supi_rangesList) { + OpenAPI_list_for_each(supi_rangesList, node) { + OpenAPI_supi_range_free(node->data); + } + OpenAPI_list_free(supi_rangesList); + supi_rangesList = NULL; + } + if (gpsi_rangesList) { + OpenAPI_list_for_each(gpsi_rangesList, node) { + OpenAPI_identity_range_free(node->data); + } + OpenAPI_list_free(gpsi_rangesList); + gpsi_rangesList = NULL; + } + if (external_group_identifiers_rangesList) { + OpenAPI_list_for_each(external_group_identifiers_rangesList, node) { + OpenAPI_identity_range_free(node->data); + } + OpenAPI_list_free(external_group_identifiers_rangesList); + external_group_identifiers_rangesList = NULL; + } + if (routing_indicatorsList) { + OpenAPI_list_for_each(routing_indicatorsList, node) { + ogs_free(node->data); + } + OpenAPI_list_free(routing_indicatorsList); + routing_indicatorsList = NULL; + } + if (internal_group_identifiers_rangesList) { + OpenAPI_list_for_each(internal_group_identifiers_rangesList, node) { + OpenAPI_internal_group_id_range_free(node->data); + } + OpenAPI_list_free(internal_group_identifiers_rangesList); + internal_group_identifiers_rangesList = NULL; + } + if (suci_infosList) { + OpenAPI_list_for_each(suci_infosList, node) { + OpenAPI_suci_info_free(node->data); + } + OpenAPI_list_free(suci_infosList); + suci_infosList = NULL; + } + return NULL; +} + +OpenAPI_nrf_info_served_udm_info_value_t *OpenAPI_nrf_info_served_udm_info_value_copy(OpenAPI_nrf_info_served_udm_info_value_t *dst, OpenAPI_nrf_info_served_udm_info_value_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_nrf_info_served_udm_info_value_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_nrf_info_served_udm_info_value_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_nrf_info_served_udm_info_value_free(dst); + dst = OpenAPI_nrf_info_served_udm_info_value_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/nrf_info_served_udm_info_value.h b/lib/sbi/openapi/model/nrf_info_served_udm_info_value.h new file mode 100644 index 000000000..f847c7ba2 --- /dev/null +++ b/lib/sbi/openapi/model/nrf_info_served_udm_info_value.h @@ -0,0 +1,55 @@ +/* + * nrf_info_served_udm_info_value.h + * + * + */ + +#ifndef _OpenAPI_nrf_info_served_udm_info_value_H_ +#define _OpenAPI_nrf_info_served_udm_info_value_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "identity_range.h" +#include "internal_group_id_range.h" +#include "suci_info.h" +#include "supi_range.h" +#include "udm_info.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_nrf_info_served_udm_info_value_s OpenAPI_nrf_info_served_udm_info_value_t; +typedef struct OpenAPI_nrf_info_served_udm_info_value_s { + char *group_id; + OpenAPI_list_t *supi_ranges; + OpenAPI_list_t *gpsi_ranges; + OpenAPI_list_t *external_group_identifiers_ranges; + OpenAPI_list_t *routing_indicators; + OpenAPI_list_t *internal_group_identifiers_ranges; + OpenAPI_list_t *suci_infos; +} OpenAPI_nrf_info_served_udm_info_value_t; + +OpenAPI_nrf_info_served_udm_info_value_t *OpenAPI_nrf_info_served_udm_info_value_create( + char *group_id, + OpenAPI_list_t *supi_ranges, + OpenAPI_list_t *gpsi_ranges, + OpenAPI_list_t *external_group_identifiers_ranges, + OpenAPI_list_t *routing_indicators, + OpenAPI_list_t *internal_group_identifiers_ranges, + OpenAPI_list_t *suci_infos +); +void OpenAPI_nrf_info_served_udm_info_value_free(OpenAPI_nrf_info_served_udm_info_value_t *nrf_info_served_udm_info_value); +OpenAPI_nrf_info_served_udm_info_value_t *OpenAPI_nrf_info_served_udm_info_value_parseFromJSON(cJSON *nrf_info_served_udm_info_valueJSON); +cJSON *OpenAPI_nrf_info_served_udm_info_value_convertToJSON(OpenAPI_nrf_info_served_udm_info_value_t *nrf_info_served_udm_info_value); +OpenAPI_nrf_info_served_udm_info_value_t *OpenAPI_nrf_info_served_udm_info_value_copy(OpenAPI_nrf_info_served_udm_info_value_t *dst, OpenAPI_nrf_info_served_udm_info_value_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_nrf_info_served_udm_info_value_H_ */ + diff --git a/lib/sbi/openapi/model/nrf_info_served_udr_info_value.c b/lib/sbi/openapi/model/nrf_info_served_udr_info_value.c new file mode 100644 index 000000000..1a6b63b21 --- /dev/null +++ b/lib/sbi/openapi/model/nrf_info_served_udr_info_value.c @@ -0,0 +1,396 @@ + +#include +#include +#include +#include "nrf_info_served_udr_info_value.h" + +OpenAPI_nrf_info_served_udr_info_value_t *OpenAPI_nrf_info_served_udr_info_value_create( + char *group_id, + OpenAPI_list_t *supi_ranges, + OpenAPI_list_t *gpsi_ranges, + OpenAPI_list_t *external_group_identifiers_ranges, + OpenAPI_list_t *supported_data_sets, + OpenAPI_list_t *shared_data_id_ranges +) +{ + OpenAPI_nrf_info_served_udr_info_value_t *nrf_info_served_udr_info_value_local_var = ogs_malloc(sizeof(OpenAPI_nrf_info_served_udr_info_value_t)); + ogs_assert(nrf_info_served_udr_info_value_local_var); + + nrf_info_served_udr_info_value_local_var->group_id = group_id; + nrf_info_served_udr_info_value_local_var->supi_ranges = supi_ranges; + nrf_info_served_udr_info_value_local_var->gpsi_ranges = gpsi_ranges; + nrf_info_served_udr_info_value_local_var->external_group_identifiers_ranges = external_group_identifiers_ranges; + nrf_info_served_udr_info_value_local_var->supported_data_sets = supported_data_sets; + nrf_info_served_udr_info_value_local_var->shared_data_id_ranges = shared_data_id_ranges; + + return nrf_info_served_udr_info_value_local_var; +} + +void OpenAPI_nrf_info_served_udr_info_value_free(OpenAPI_nrf_info_served_udr_info_value_t *nrf_info_served_udr_info_value) +{ + OpenAPI_lnode_t *node = NULL; + + if (NULL == nrf_info_served_udr_info_value) { + return; + } + if (nrf_info_served_udr_info_value->group_id) { + ogs_free(nrf_info_served_udr_info_value->group_id); + nrf_info_served_udr_info_value->group_id = NULL; + } + if (nrf_info_served_udr_info_value->supi_ranges) { + OpenAPI_list_for_each(nrf_info_served_udr_info_value->supi_ranges, node) { + OpenAPI_supi_range_free(node->data); + } + OpenAPI_list_free(nrf_info_served_udr_info_value->supi_ranges); + nrf_info_served_udr_info_value->supi_ranges = NULL; + } + if (nrf_info_served_udr_info_value->gpsi_ranges) { + OpenAPI_list_for_each(nrf_info_served_udr_info_value->gpsi_ranges, node) { + OpenAPI_identity_range_free(node->data); + } + OpenAPI_list_free(nrf_info_served_udr_info_value->gpsi_ranges); + nrf_info_served_udr_info_value->gpsi_ranges = NULL; + } + if (nrf_info_served_udr_info_value->external_group_identifiers_ranges) { + OpenAPI_list_for_each(nrf_info_served_udr_info_value->external_group_identifiers_ranges, node) { + OpenAPI_identity_range_free(node->data); + } + OpenAPI_list_free(nrf_info_served_udr_info_value->external_group_identifiers_ranges); + nrf_info_served_udr_info_value->external_group_identifiers_ranges = NULL; + } + if (nrf_info_served_udr_info_value->supported_data_sets) { + OpenAPI_list_free(nrf_info_served_udr_info_value->supported_data_sets); + nrf_info_served_udr_info_value->supported_data_sets = NULL; + } + if (nrf_info_served_udr_info_value->shared_data_id_ranges) { + OpenAPI_list_for_each(nrf_info_served_udr_info_value->shared_data_id_ranges, node) { + OpenAPI_shared_data_id_range_free(node->data); + } + OpenAPI_list_free(nrf_info_served_udr_info_value->shared_data_id_ranges); + nrf_info_served_udr_info_value->shared_data_id_ranges = NULL; + } + ogs_free(nrf_info_served_udr_info_value); +} + +cJSON *OpenAPI_nrf_info_served_udr_info_value_convertToJSON(OpenAPI_nrf_info_served_udr_info_value_t *nrf_info_served_udr_info_value) +{ + cJSON *item = NULL; + OpenAPI_lnode_t *node = NULL; + + if (nrf_info_served_udr_info_value == NULL) { + ogs_error("OpenAPI_nrf_info_served_udr_info_value_convertToJSON() failed [NrfInfo_servedUdrInfo_value]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (nrf_info_served_udr_info_value->group_id) { + if (cJSON_AddStringToObject(item, "groupId", nrf_info_served_udr_info_value->group_id) == NULL) { + ogs_error("OpenAPI_nrf_info_served_udr_info_value_convertToJSON() failed [group_id]"); + goto end; + } + } + + if (nrf_info_served_udr_info_value->supi_ranges) { + cJSON *supi_rangesList = cJSON_AddArrayToObject(item, "supiRanges"); + if (supi_rangesList == NULL) { + ogs_error("OpenAPI_nrf_info_served_udr_info_value_convertToJSON() failed [supi_ranges]"); + goto end; + } + OpenAPI_list_for_each(nrf_info_served_udr_info_value->supi_ranges, node) { + cJSON *itemLocal = OpenAPI_supi_range_convertToJSON(node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_nrf_info_served_udr_info_value_convertToJSON() failed [supi_ranges]"); + goto end; + } + cJSON_AddItemToArray(supi_rangesList, itemLocal); + } + } + + if (nrf_info_served_udr_info_value->gpsi_ranges) { + cJSON *gpsi_rangesList = cJSON_AddArrayToObject(item, "gpsiRanges"); + if (gpsi_rangesList == NULL) { + ogs_error("OpenAPI_nrf_info_served_udr_info_value_convertToJSON() failed [gpsi_ranges]"); + goto end; + } + OpenAPI_list_for_each(nrf_info_served_udr_info_value->gpsi_ranges, node) { + cJSON *itemLocal = OpenAPI_identity_range_convertToJSON(node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_nrf_info_served_udr_info_value_convertToJSON() failed [gpsi_ranges]"); + goto end; + } + cJSON_AddItemToArray(gpsi_rangesList, itemLocal); + } + } + + if (nrf_info_served_udr_info_value->external_group_identifiers_ranges) { + cJSON *external_group_identifiers_rangesList = cJSON_AddArrayToObject(item, "externalGroupIdentifiersRanges"); + if (external_group_identifiers_rangesList == NULL) { + ogs_error("OpenAPI_nrf_info_served_udr_info_value_convertToJSON() failed [external_group_identifiers_ranges]"); + goto end; + } + OpenAPI_list_for_each(nrf_info_served_udr_info_value->external_group_identifiers_ranges, node) { + cJSON *itemLocal = OpenAPI_identity_range_convertToJSON(node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_nrf_info_served_udr_info_value_convertToJSON() failed [external_group_identifiers_ranges]"); + goto end; + } + cJSON_AddItemToArray(external_group_identifiers_rangesList, itemLocal); + } + } + + if (nrf_info_served_udr_info_value->supported_data_sets != OpenAPI_data_set_id_NULL) { + cJSON *supported_data_setsList = cJSON_AddArrayToObject(item, "supportedDataSets"); + if (supported_data_setsList == NULL) { + ogs_error("OpenAPI_nrf_info_served_udr_info_value_convertToJSON() failed [supported_data_sets]"); + goto end; + } + OpenAPI_list_for_each(nrf_info_served_udr_info_value->supported_data_sets, node) { + if (cJSON_AddStringToObject(supported_data_setsList, "", OpenAPI_data_set_id_ToString((intptr_t)node->data)) == NULL) { + ogs_error("OpenAPI_nrf_info_served_udr_info_value_convertToJSON() failed [supported_data_sets]"); + goto end; + } + } + } + + if (nrf_info_served_udr_info_value->shared_data_id_ranges) { + cJSON *shared_data_id_rangesList = cJSON_AddArrayToObject(item, "sharedDataIdRanges"); + if (shared_data_id_rangesList == NULL) { + ogs_error("OpenAPI_nrf_info_served_udr_info_value_convertToJSON() failed [shared_data_id_ranges]"); + goto end; + } + OpenAPI_list_for_each(nrf_info_served_udr_info_value->shared_data_id_ranges, node) { + cJSON *itemLocal = OpenAPI_shared_data_id_range_convertToJSON(node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_nrf_info_served_udr_info_value_convertToJSON() failed [shared_data_id_ranges]"); + goto end; + } + cJSON_AddItemToArray(shared_data_id_rangesList, itemLocal); + } + } + +end: + return item; +} + +OpenAPI_nrf_info_served_udr_info_value_t *OpenAPI_nrf_info_served_udr_info_value_parseFromJSON(cJSON *nrf_info_served_udr_info_valueJSON) +{ + OpenAPI_nrf_info_served_udr_info_value_t *nrf_info_served_udr_info_value_local_var = NULL; + OpenAPI_lnode_t *node = NULL; + cJSON *group_id = NULL; + cJSON *supi_ranges = NULL; + OpenAPI_list_t *supi_rangesList = NULL; + cJSON *gpsi_ranges = NULL; + OpenAPI_list_t *gpsi_rangesList = NULL; + cJSON *external_group_identifiers_ranges = NULL; + OpenAPI_list_t *external_group_identifiers_rangesList = NULL; + cJSON *supported_data_sets = NULL; + OpenAPI_list_t *supported_data_setsList = NULL; + cJSON *shared_data_id_ranges = NULL; + OpenAPI_list_t *shared_data_id_rangesList = NULL; + group_id = cJSON_GetObjectItemCaseSensitive(nrf_info_served_udr_info_valueJSON, "groupId"); + if (group_id) { + if (!cJSON_IsString(group_id) && !cJSON_IsNull(group_id)) { + ogs_error("OpenAPI_nrf_info_served_udr_info_value_parseFromJSON() failed [group_id]"); + goto end; + } + } + + supi_ranges = cJSON_GetObjectItemCaseSensitive(nrf_info_served_udr_info_valueJSON, "supiRanges"); + if (supi_ranges) { + cJSON *supi_ranges_local = NULL; + if (!cJSON_IsArray(supi_ranges)) { + ogs_error("OpenAPI_nrf_info_served_udr_info_value_parseFromJSON() failed [supi_ranges]"); + goto end; + } + + supi_rangesList = OpenAPI_list_create(); + + cJSON_ArrayForEach(supi_ranges_local, supi_ranges) { + if (!cJSON_IsObject(supi_ranges_local)) { + ogs_error("OpenAPI_nrf_info_served_udr_info_value_parseFromJSON() failed [supi_ranges]"); + goto end; + } + OpenAPI_supi_range_t *supi_rangesItem = OpenAPI_supi_range_parseFromJSON(supi_ranges_local); + if (!supi_rangesItem) { + ogs_error("No supi_rangesItem"); + OpenAPI_list_free(supi_rangesList); + goto end; + } + OpenAPI_list_add(supi_rangesList, supi_rangesItem); + } + } + + gpsi_ranges = cJSON_GetObjectItemCaseSensitive(nrf_info_served_udr_info_valueJSON, "gpsiRanges"); + if (gpsi_ranges) { + cJSON *gpsi_ranges_local = NULL; + if (!cJSON_IsArray(gpsi_ranges)) { + ogs_error("OpenAPI_nrf_info_served_udr_info_value_parseFromJSON() failed [gpsi_ranges]"); + goto end; + } + + gpsi_rangesList = OpenAPI_list_create(); + + cJSON_ArrayForEach(gpsi_ranges_local, gpsi_ranges) { + if (!cJSON_IsObject(gpsi_ranges_local)) { + ogs_error("OpenAPI_nrf_info_served_udr_info_value_parseFromJSON() failed [gpsi_ranges]"); + goto end; + } + OpenAPI_identity_range_t *gpsi_rangesItem = OpenAPI_identity_range_parseFromJSON(gpsi_ranges_local); + if (!gpsi_rangesItem) { + ogs_error("No gpsi_rangesItem"); + OpenAPI_list_free(gpsi_rangesList); + goto end; + } + OpenAPI_list_add(gpsi_rangesList, gpsi_rangesItem); + } + } + + external_group_identifiers_ranges = cJSON_GetObjectItemCaseSensitive(nrf_info_served_udr_info_valueJSON, "externalGroupIdentifiersRanges"); + if (external_group_identifiers_ranges) { + cJSON *external_group_identifiers_ranges_local = NULL; + if (!cJSON_IsArray(external_group_identifiers_ranges)) { + ogs_error("OpenAPI_nrf_info_served_udr_info_value_parseFromJSON() failed [external_group_identifiers_ranges]"); + goto end; + } + + external_group_identifiers_rangesList = OpenAPI_list_create(); + + cJSON_ArrayForEach(external_group_identifiers_ranges_local, external_group_identifiers_ranges) { + if (!cJSON_IsObject(external_group_identifiers_ranges_local)) { + ogs_error("OpenAPI_nrf_info_served_udr_info_value_parseFromJSON() failed [external_group_identifiers_ranges]"); + goto end; + } + OpenAPI_identity_range_t *external_group_identifiers_rangesItem = OpenAPI_identity_range_parseFromJSON(external_group_identifiers_ranges_local); + if (!external_group_identifiers_rangesItem) { + ogs_error("No external_group_identifiers_rangesItem"); + OpenAPI_list_free(external_group_identifiers_rangesList); + goto end; + } + OpenAPI_list_add(external_group_identifiers_rangesList, external_group_identifiers_rangesItem); + } + } + + supported_data_sets = cJSON_GetObjectItemCaseSensitive(nrf_info_served_udr_info_valueJSON, "supportedDataSets"); + if (supported_data_sets) { + cJSON *supported_data_sets_local = NULL; + if (!cJSON_IsArray(supported_data_sets)) { + ogs_error("OpenAPI_nrf_info_served_udr_info_value_parseFromJSON() failed [supported_data_sets]"); + goto end; + } + + supported_data_setsList = OpenAPI_list_create(); + + cJSON_ArrayForEach(supported_data_sets_local, supported_data_sets) { + if (!cJSON_IsString(supported_data_sets_local)) { + ogs_error("OpenAPI_nrf_info_served_udr_info_value_parseFromJSON() failed [supported_data_sets]"); + goto end; + } + OpenAPI_list_add(supported_data_setsList, (void *)OpenAPI_data_set_id_FromString(supported_data_sets_local->valuestring)); + } + } + + shared_data_id_ranges = cJSON_GetObjectItemCaseSensitive(nrf_info_served_udr_info_valueJSON, "sharedDataIdRanges"); + if (shared_data_id_ranges) { + cJSON *shared_data_id_ranges_local = NULL; + if (!cJSON_IsArray(shared_data_id_ranges)) { + ogs_error("OpenAPI_nrf_info_served_udr_info_value_parseFromJSON() failed [shared_data_id_ranges]"); + goto end; + } + + shared_data_id_rangesList = OpenAPI_list_create(); + + cJSON_ArrayForEach(shared_data_id_ranges_local, shared_data_id_ranges) { + if (!cJSON_IsObject(shared_data_id_ranges_local)) { + ogs_error("OpenAPI_nrf_info_served_udr_info_value_parseFromJSON() failed [shared_data_id_ranges]"); + goto end; + } + OpenAPI_shared_data_id_range_t *shared_data_id_rangesItem = OpenAPI_shared_data_id_range_parseFromJSON(shared_data_id_ranges_local); + if (!shared_data_id_rangesItem) { + ogs_error("No shared_data_id_rangesItem"); + OpenAPI_list_free(shared_data_id_rangesList); + goto end; + } + OpenAPI_list_add(shared_data_id_rangesList, shared_data_id_rangesItem); + } + } + + nrf_info_served_udr_info_value_local_var = OpenAPI_nrf_info_served_udr_info_value_create ( + group_id && !cJSON_IsNull(group_id) ? ogs_strdup(group_id->valuestring) : NULL, + supi_ranges ? supi_rangesList : NULL, + gpsi_ranges ? gpsi_rangesList : NULL, + external_group_identifiers_ranges ? external_group_identifiers_rangesList : NULL, + supported_data_sets ? supported_data_setsList : NULL, + shared_data_id_ranges ? shared_data_id_rangesList : NULL + ); + + return nrf_info_served_udr_info_value_local_var; +end: + if (supi_rangesList) { + OpenAPI_list_for_each(supi_rangesList, node) { + OpenAPI_supi_range_free(node->data); + } + OpenAPI_list_free(supi_rangesList); + supi_rangesList = NULL; + } + if (gpsi_rangesList) { + OpenAPI_list_for_each(gpsi_rangesList, node) { + OpenAPI_identity_range_free(node->data); + } + OpenAPI_list_free(gpsi_rangesList); + gpsi_rangesList = NULL; + } + if (external_group_identifiers_rangesList) { + OpenAPI_list_for_each(external_group_identifiers_rangesList, node) { + OpenAPI_identity_range_free(node->data); + } + OpenAPI_list_free(external_group_identifiers_rangesList); + external_group_identifiers_rangesList = NULL; + } + if (supported_data_setsList) { + OpenAPI_list_free(supported_data_setsList); + supported_data_setsList = NULL; + } + if (shared_data_id_rangesList) { + OpenAPI_list_for_each(shared_data_id_rangesList, node) { + OpenAPI_shared_data_id_range_free(node->data); + } + OpenAPI_list_free(shared_data_id_rangesList); + shared_data_id_rangesList = NULL; + } + return NULL; +} + +OpenAPI_nrf_info_served_udr_info_value_t *OpenAPI_nrf_info_served_udr_info_value_copy(OpenAPI_nrf_info_served_udr_info_value_t *dst, OpenAPI_nrf_info_served_udr_info_value_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_nrf_info_served_udr_info_value_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_nrf_info_served_udr_info_value_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_nrf_info_served_udr_info_value_free(dst); + dst = OpenAPI_nrf_info_served_udr_info_value_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/nrf_info_served_udr_info_value.h b/lib/sbi/openapi/model/nrf_info_served_udr_info_value.h new file mode 100644 index 000000000..6b4ff5d30 --- /dev/null +++ b/lib/sbi/openapi/model/nrf_info_served_udr_info_value.h @@ -0,0 +1,53 @@ +/* + * nrf_info_served_udr_info_value.h + * + * + */ + +#ifndef _OpenAPI_nrf_info_served_udr_info_value_H_ +#define _OpenAPI_nrf_info_served_udr_info_value_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "data_set_id.h" +#include "identity_range.h" +#include "shared_data_id_range.h" +#include "supi_range.h" +#include "udr_info.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_nrf_info_served_udr_info_value_s OpenAPI_nrf_info_served_udr_info_value_t; +typedef struct OpenAPI_nrf_info_served_udr_info_value_s { + char *group_id; + OpenAPI_list_t *supi_ranges; + OpenAPI_list_t *gpsi_ranges; + OpenAPI_list_t *external_group_identifiers_ranges; + OpenAPI_list_t *supported_data_sets; + OpenAPI_list_t *shared_data_id_ranges; +} OpenAPI_nrf_info_served_udr_info_value_t; + +OpenAPI_nrf_info_served_udr_info_value_t *OpenAPI_nrf_info_served_udr_info_value_create( + char *group_id, + OpenAPI_list_t *supi_ranges, + OpenAPI_list_t *gpsi_ranges, + OpenAPI_list_t *external_group_identifiers_ranges, + OpenAPI_list_t *supported_data_sets, + OpenAPI_list_t *shared_data_id_ranges +); +void OpenAPI_nrf_info_served_udr_info_value_free(OpenAPI_nrf_info_served_udr_info_value_t *nrf_info_served_udr_info_value); +OpenAPI_nrf_info_served_udr_info_value_t *OpenAPI_nrf_info_served_udr_info_value_parseFromJSON(cJSON *nrf_info_served_udr_info_valueJSON); +cJSON *OpenAPI_nrf_info_served_udr_info_value_convertToJSON(OpenAPI_nrf_info_served_udr_info_value_t *nrf_info_served_udr_info_value); +OpenAPI_nrf_info_served_udr_info_value_t *OpenAPI_nrf_info_served_udr_info_value_copy(OpenAPI_nrf_info_served_udr_info_value_t *dst, OpenAPI_nrf_info_served_udr_info_value_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_nrf_info_served_udr_info_value_H_ */ + diff --git a/lib/sbi/openapi/model/nrf_info_served_udsf_info_value.c b/lib/sbi/openapi/model/nrf_info_served_udsf_info_value.c new file mode 100644 index 000000000..91cdae8bd --- /dev/null +++ b/lib/sbi/openapi/model/nrf_info_served_udsf_info_value.c @@ -0,0 +1,245 @@ + +#include +#include +#include +#include "nrf_info_served_udsf_info_value.h" + +OpenAPI_nrf_info_served_udsf_info_value_t *OpenAPI_nrf_info_served_udsf_info_value_create( + char *group_id, + OpenAPI_list_t *supi_ranges, + OpenAPI_list_t* storage_id_ranges +) +{ + OpenAPI_nrf_info_served_udsf_info_value_t *nrf_info_served_udsf_info_value_local_var = ogs_malloc(sizeof(OpenAPI_nrf_info_served_udsf_info_value_t)); + ogs_assert(nrf_info_served_udsf_info_value_local_var); + + nrf_info_served_udsf_info_value_local_var->group_id = group_id; + nrf_info_served_udsf_info_value_local_var->supi_ranges = supi_ranges; + nrf_info_served_udsf_info_value_local_var->storage_id_ranges = storage_id_ranges; + + return nrf_info_served_udsf_info_value_local_var; +} + +void OpenAPI_nrf_info_served_udsf_info_value_free(OpenAPI_nrf_info_served_udsf_info_value_t *nrf_info_served_udsf_info_value) +{ + OpenAPI_lnode_t *node = NULL; + + if (NULL == nrf_info_served_udsf_info_value) { + return; + } + if (nrf_info_served_udsf_info_value->group_id) { + ogs_free(nrf_info_served_udsf_info_value->group_id); + nrf_info_served_udsf_info_value->group_id = NULL; + } + if (nrf_info_served_udsf_info_value->supi_ranges) { + OpenAPI_list_for_each(nrf_info_served_udsf_info_value->supi_ranges, node) { + OpenAPI_supi_range_free(node->data); + } + OpenAPI_list_free(nrf_info_served_udsf_info_value->supi_ranges); + nrf_info_served_udsf_info_value->supi_ranges = NULL; + } + if (nrf_info_served_udsf_info_value->storage_id_ranges) { + OpenAPI_list_for_each(nrf_info_served_udsf_info_value->storage_id_ranges, node) { + OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*)node->data; + ogs_free(localKeyValue->key); + ogs_free(localKeyValue->value); + OpenAPI_map_free(localKeyValue); + } + OpenAPI_list_free(nrf_info_served_udsf_info_value->storage_id_ranges); + nrf_info_served_udsf_info_value->storage_id_ranges = NULL; + } + ogs_free(nrf_info_served_udsf_info_value); +} + +cJSON *OpenAPI_nrf_info_served_udsf_info_value_convertToJSON(OpenAPI_nrf_info_served_udsf_info_value_t *nrf_info_served_udsf_info_value) +{ + cJSON *item = NULL; + OpenAPI_lnode_t *node = NULL; + + if (nrf_info_served_udsf_info_value == NULL) { + ogs_error("OpenAPI_nrf_info_served_udsf_info_value_convertToJSON() failed [NrfInfo_servedUdsfInfo_value]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (nrf_info_served_udsf_info_value->group_id) { + if (cJSON_AddStringToObject(item, "groupId", nrf_info_served_udsf_info_value->group_id) == NULL) { + ogs_error("OpenAPI_nrf_info_served_udsf_info_value_convertToJSON() failed [group_id]"); + goto end; + } + } + + if (nrf_info_served_udsf_info_value->supi_ranges) { + cJSON *supi_rangesList = cJSON_AddArrayToObject(item, "supiRanges"); + if (supi_rangesList == NULL) { + ogs_error("OpenAPI_nrf_info_served_udsf_info_value_convertToJSON() failed [supi_ranges]"); + goto end; + } + OpenAPI_list_for_each(nrf_info_served_udsf_info_value->supi_ranges, node) { + cJSON *itemLocal = OpenAPI_supi_range_convertToJSON(node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_nrf_info_served_udsf_info_value_convertToJSON() failed [supi_ranges]"); + goto end; + } + cJSON_AddItemToArray(supi_rangesList, itemLocal); + } + } + + if (nrf_info_served_udsf_info_value->storage_id_ranges) { + cJSON *storage_id_ranges = cJSON_AddObjectToObject(item, "storageIdRanges"); + if (storage_id_ranges == NULL) { + ogs_error("OpenAPI_nrf_info_served_udsf_info_value_convertToJSON() failed [storage_id_ranges]"); + goto end; + } + cJSON *localMapObject = storage_id_ranges; + if (nrf_info_served_udsf_info_value->storage_id_ranges) { + OpenAPI_list_for_each(nrf_info_served_udsf_info_value->storage_id_ranges, node) { + OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*)node->data; + cJSON *itemLocal = localKeyValue->value ? + OpenAPI_identity_range_convertToJSON(localKeyValue->value) : + cJSON_CreateNull(); + if (itemLocal == NULL) { + ogs_error("OpenAPI_nrf_info_served_udsf_info_value_convertToJSON() failed [inner]"); + goto end; + } + cJSON_AddItemToObject(localMapObject, localKeyValue->key, itemLocal); + } + } + } + +end: + return item; +} + +OpenAPI_nrf_info_served_udsf_info_value_t *OpenAPI_nrf_info_served_udsf_info_value_parseFromJSON(cJSON *nrf_info_served_udsf_info_valueJSON) +{ + OpenAPI_nrf_info_served_udsf_info_value_t *nrf_info_served_udsf_info_value_local_var = NULL; + OpenAPI_lnode_t *node = NULL; + cJSON *group_id = NULL; + cJSON *supi_ranges = NULL; + OpenAPI_list_t *supi_rangesList = NULL; + cJSON *storage_id_ranges = NULL; + OpenAPI_list_t *storage_id_rangesList = NULL; + group_id = cJSON_GetObjectItemCaseSensitive(nrf_info_served_udsf_info_valueJSON, "groupId"); + if (group_id) { + if (!cJSON_IsString(group_id) && !cJSON_IsNull(group_id)) { + ogs_error("OpenAPI_nrf_info_served_udsf_info_value_parseFromJSON() failed [group_id]"); + goto end; + } + } + + supi_ranges = cJSON_GetObjectItemCaseSensitive(nrf_info_served_udsf_info_valueJSON, "supiRanges"); + if (supi_ranges) { + cJSON *supi_ranges_local = NULL; + if (!cJSON_IsArray(supi_ranges)) { + ogs_error("OpenAPI_nrf_info_served_udsf_info_value_parseFromJSON() failed [supi_ranges]"); + goto end; + } + + supi_rangesList = OpenAPI_list_create(); + + cJSON_ArrayForEach(supi_ranges_local, supi_ranges) { + if (!cJSON_IsObject(supi_ranges_local)) { + ogs_error("OpenAPI_nrf_info_served_udsf_info_value_parseFromJSON() failed [supi_ranges]"); + goto end; + } + OpenAPI_supi_range_t *supi_rangesItem = OpenAPI_supi_range_parseFromJSON(supi_ranges_local); + if (!supi_rangesItem) { + ogs_error("No supi_rangesItem"); + OpenAPI_list_free(supi_rangesList); + goto end; + } + OpenAPI_list_add(supi_rangesList, supi_rangesItem); + } + } + + storage_id_ranges = cJSON_GetObjectItemCaseSensitive(nrf_info_served_udsf_info_valueJSON, "storageIdRanges"); + if (storage_id_ranges) { + cJSON *storage_id_ranges_local_map = NULL; + if (!cJSON_IsObject(storage_id_ranges) && !cJSON_IsNull(storage_id_ranges)) { + ogs_error("OpenAPI_nrf_info_served_udsf_info_value_parseFromJSON() failed [storage_id_ranges]"); + goto end; + } + if (cJSON_IsObject(storage_id_ranges)) { + storage_id_rangesList = OpenAPI_list_create(); + OpenAPI_map_t *localMapKeyPair = NULL; + cJSON_ArrayForEach(storage_id_ranges_local_map, storage_id_ranges) { + cJSON *localMapObject = storage_id_ranges_local_map; + double *localDouble = NULL; + int *localInt = NULL; + if (cJSON_IsObject(localMapObject)) { + localMapKeyPair = OpenAPI_map_create( + ogs_strdup(localMapObject->string), OpenAPI_identity_range_parseFromJSON(localMapObject)); + } else if (cJSON_IsNull(localMapObject)) { + localMapKeyPair = OpenAPI_map_create(ogs_strdup(localMapObject->string), NULL); + } else { + ogs_error("OpenAPI_nrf_info_served_udsf_info_value_parseFromJSON() failed [inner]"); + goto end; + } + OpenAPI_list_add(storage_id_rangesList, localMapKeyPair); + } + } + } + + nrf_info_served_udsf_info_value_local_var = OpenAPI_nrf_info_served_udsf_info_value_create ( + group_id && !cJSON_IsNull(group_id) ? ogs_strdup(group_id->valuestring) : NULL, + supi_ranges ? supi_rangesList : NULL, + storage_id_ranges ? storage_id_rangesList : NULL + ); + + return nrf_info_served_udsf_info_value_local_var; +end: + if (supi_rangesList) { + OpenAPI_list_for_each(supi_rangesList, node) { + OpenAPI_supi_range_free(node->data); + } + OpenAPI_list_free(supi_rangesList); + supi_rangesList = NULL; + } + if (storage_id_rangesList) { + OpenAPI_list_for_each(storage_id_rangesList, node) { + OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*) node->data; + ogs_free(localKeyValue->key); + ogs_free(localKeyValue->value); + OpenAPI_map_free(localKeyValue); + } + OpenAPI_list_free(storage_id_rangesList); + storage_id_rangesList = NULL; + } + return NULL; +} + +OpenAPI_nrf_info_served_udsf_info_value_t *OpenAPI_nrf_info_served_udsf_info_value_copy(OpenAPI_nrf_info_served_udsf_info_value_t *dst, OpenAPI_nrf_info_served_udsf_info_value_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_nrf_info_served_udsf_info_value_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_nrf_info_served_udsf_info_value_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_nrf_info_served_udsf_info_value_free(dst); + dst = OpenAPI_nrf_info_served_udsf_info_value_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/nrf_info_served_udsf_info_value.h b/lib/sbi/openapi/model/nrf_info_served_udsf_info_value.h new file mode 100644 index 000000000..6cbdfd369 --- /dev/null +++ b/lib/sbi/openapi/model/nrf_info_served_udsf_info_value.h @@ -0,0 +1,45 @@ +/* + * nrf_info_served_udsf_info_value.h + * + * + */ + +#ifndef _OpenAPI_nrf_info_served_udsf_info_value_H_ +#define _OpenAPI_nrf_info_served_udsf_info_value_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "identity_range.h" +#include "supi_range.h" +#include "udsf_info.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_nrf_info_served_udsf_info_value_s OpenAPI_nrf_info_served_udsf_info_value_t; +typedef struct OpenAPI_nrf_info_served_udsf_info_value_s { + char *group_id; + OpenAPI_list_t *supi_ranges; + OpenAPI_list_t* storage_id_ranges; +} OpenAPI_nrf_info_served_udsf_info_value_t; + +OpenAPI_nrf_info_served_udsf_info_value_t *OpenAPI_nrf_info_served_udsf_info_value_create( + char *group_id, + OpenAPI_list_t *supi_ranges, + OpenAPI_list_t* storage_id_ranges +); +void OpenAPI_nrf_info_served_udsf_info_value_free(OpenAPI_nrf_info_served_udsf_info_value_t *nrf_info_served_udsf_info_value); +OpenAPI_nrf_info_served_udsf_info_value_t *OpenAPI_nrf_info_served_udsf_info_value_parseFromJSON(cJSON *nrf_info_served_udsf_info_valueJSON); +cJSON *OpenAPI_nrf_info_served_udsf_info_value_convertToJSON(OpenAPI_nrf_info_served_udsf_info_value_t *nrf_info_served_udsf_info_value); +OpenAPI_nrf_info_served_udsf_info_value_t *OpenAPI_nrf_info_served_udsf_info_value_copy(OpenAPI_nrf_info_served_udsf_info_value_t *dst, OpenAPI_nrf_info_served_udsf_info_value_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_nrf_info_served_udsf_info_value_H_ */ + diff --git a/lib/sbi/openapi/model/nrf_info_served_upf_info_value.c b/lib/sbi/openapi/model/nrf_info_served_upf_info_value.c new file mode 100644 index 000000000..1beb53c70 --- /dev/null +++ b/lib/sbi/openapi/model/nrf_info_served_upf_info_value.c @@ -0,0 +1,710 @@ + +#include +#include +#include +#include "nrf_info_served_upf_info_value.h" + +OpenAPI_nrf_info_served_upf_info_value_t *OpenAPI_nrf_info_served_upf_info_value_create( + OpenAPI_list_t *s_nssai_upf_info_list, + OpenAPI_list_t *smf_serving_area, + OpenAPI_list_t *interface_upf_info_list, + bool is_iwk_eps_ind, + int iwk_eps_ind, + OpenAPI_list_t *pdu_session_types, + OpenAPI_atsss_capability_t *atsss_capability, + bool is_ue_ip_addr_ind, + int ue_ip_addr_ind, + OpenAPI_list_t *tai_list, + OpenAPI_list_t *tai_range_list, + OpenAPI_w_agf_info_t *w_agf_info, + OpenAPI_tngf_info_t *tngf_info, + OpenAPI_twif_info_t *twif_info, + bool is_priority, + int priority, + bool is_redundant_gtpu, + int redundant_gtpu, + bool is_ipups, + int ipups, + bool is_data_forwarding, + int data_forwarding, + char *supported_pfcp_features +) +{ + OpenAPI_nrf_info_served_upf_info_value_t *nrf_info_served_upf_info_value_local_var = ogs_malloc(sizeof(OpenAPI_nrf_info_served_upf_info_value_t)); + ogs_assert(nrf_info_served_upf_info_value_local_var); + + nrf_info_served_upf_info_value_local_var->s_nssai_upf_info_list = s_nssai_upf_info_list; + nrf_info_served_upf_info_value_local_var->smf_serving_area = smf_serving_area; + nrf_info_served_upf_info_value_local_var->interface_upf_info_list = interface_upf_info_list; + nrf_info_served_upf_info_value_local_var->is_iwk_eps_ind = is_iwk_eps_ind; + nrf_info_served_upf_info_value_local_var->iwk_eps_ind = iwk_eps_ind; + nrf_info_served_upf_info_value_local_var->pdu_session_types = pdu_session_types; + nrf_info_served_upf_info_value_local_var->atsss_capability = atsss_capability; + nrf_info_served_upf_info_value_local_var->is_ue_ip_addr_ind = is_ue_ip_addr_ind; + nrf_info_served_upf_info_value_local_var->ue_ip_addr_ind = ue_ip_addr_ind; + nrf_info_served_upf_info_value_local_var->tai_list = tai_list; + nrf_info_served_upf_info_value_local_var->tai_range_list = tai_range_list; + nrf_info_served_upf_info_value_local_var->w_agf_info = w_agf_info; + nrf_info_served_upf_info_value_local_var->tngf_info = tngf_info; + nrf_info_served_upf_info_value_local_var->twif_info = twif_info; + nrf_info_served_upf_info_value_local_var->is_priority = is_priority; + nrf_info_served_upf_info_value_local_var->priority = priority; + nrf_info_served_upf_info_value_local_var->is_redundant_gtpu = is_redundant_gtpu; + nrf_info_served_upf_info_value_local_var->redundant_gtpu = redundant_gtpu; + nrf_info_served_upf_info_value_local_var->is_ipups = is_ipups; + nrf_info_served_upf_info_value_local_var->ipups = ipups; + nrf_info_served_upf_info_value_local_var->is_data_forwarding = is_data_forwarding; + nrf_info_served_upf_info_value_local_var->data_forwarding = data_forwarding; + nrf_info_served_upf_info_value_local_var->supported_pfcp_features = supported_pfcp_features; + + return nrf_info_served_upf_info_value_local_var; +} + +void OpenAPI_nrf_info_served_upf_info_value_free(OpenAPI_nrf_info_served_upf_info_value_t *nrf_info_served_upf_info_value) +{ + OpenAPI_lnode_t *node = NULL; + + if (NULL == nrf_info_served_upf_info_value) { + return; + } + if (nrf_info_served_upf_info_value->s_nssai_upf_info_list) { + OpenAPI_list_for_each(nrf_info_served_upf_info_value->s_nssai_upf_info_list, node) { + OpenAPI_snssai_upf_info_item_free(node->data); + } + OpenAPI_list_free(nrf_info_served_upf_info_value->s_nssai_upf_info_list); + nrf_info_served_upf_info_value->s_nssai_upf_info_list = NULL; + } + if (nrf_info_served_upf_info_value->smf_serving_area) { + OpenAPI_list_for_each(nrf_info_served_upf_info_value->smf_serving_area, node) { + ogs_free(node->data); + } + OpenAPI_list_free(nrf_info_served_upf_info_value->smf_serving_area); + nrf_info_served_upf_info_value->smf_serving_area = NULL; + } + if (nrf_info_served_upf_info_value->interface_upf_info_list) { + OpenAPI_list_for_each(nrf_info_served_upf_info_value->interface_upf_info_list, node) { + OpenAPI_interface_upf_info_item_free(node->data); + } + OpenAPI_list_free(nrf_info_served_upf_info_value->interface_upf_info_list); + nrf_info_served_upf_info_value->interface_upf_info_list = NULL; + } + if (nrf_info_served_upf_info_value->pdu_session_types) { + OpenAPI_list_free(nrf_info_served_upf_info_value->pdu_session_types); + nrf_info_served_upf_info_value->pdu_session_types = NULL; + } + if (nrf_info_served_upf_info_value->atsss_capability) { + OpenAPI_atsss_capability_free(nrf_info_served_upf_info_value->atsss_capability); + nrf_info_served_upf_info_value->atsss_capability = NULL; + } + if (nrf_info_served_upf_info_value->tai_list) { + OpenAPI_list_for_each(nrf_info_served_upf_info_value->tai_list, node) { + OpenAPI_tai_free(node->data); + } + OpenAPI_list_free(nrf_info_served_upf_info_value->tai_list); + nrf_info_served_upf_info_value->tai_list = NULL; + } + if (nrf_info_served_upf_info_value->tai_range_list) { + OpenAPI_list_for_each(nrf_info_served_upf_info_value->tai_range_list, node) { + OpenAPI_tai_range_free(node->data); + } + OpenAPI_list_free(nrf_info_served_upf_info_value->tai_range_list); + nrf_info_served_upf_info_value->tai_range_list = NULL; + } + if (nrf_info_served_upf_info_value->w_agf_info) { + OpenAPI_w_agf_info_free(nrf_info_served_upf_info_value->w_agf_info); + nrf_info_served_upf_info_value->w_agf_info = NULL; + } + if (nrf_info_served_upf_info_value->tngf_info) { + OpenAPI_tngf_info_free(nrf_info_served_upf_info_value->tngf_info); + nrf_info_served_upf_info_value->tngf_info = NULL; + } + if (nrf_info_served_upf_info_value->twif_info) { + OpenAPI_twif_info_free(nrf_info_served_upf_info_value->twif_info); + nrf_info_served_upf_info_value->twif_info = NULL; + } + if (nrf_info_served_upf_info_value->supported_pfcp_features) { + ogs_free(nrf_info_served_upf_info_value->supported_pfcp_features); + nrf_info_served_upf_info_value->supported_pfcp_features = NULL; + } + ogs_free(nrf_info_served_upf_info_value); +} + +cJSON *OpenAPI_nrf_info_served_upf_info_value_convertToJSON(OpenAPI_nrf_info_served_upf_info_value_t *nrf_info_served_upf_info_value) +{ + cJSON *item = NULL; + OpenAPI_lnode_t *node = NULL; + + if (nrf_info_served_upf_info_value == NULL) { + ogs_error("OpenAPI_nrf_info_served_upf_info_value_convertToJSON() failed [NrfInfo_servedUpfInfo_value]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (!nrf_info_served_upf_info_value->s_nssai_upf_info_list) { + ogs_error("OpenAPI_nrf_info_served_upf_info_value_convertToJSON() failed [s_nssai_upf_info_list]"); + return NULL; + } + cJSON *s_nssai_upf_info_listList = cJSON_AddArrayToObject(item, "sNssaiUpfInfoList"); + if (s_nssai_upf_info_listList == NULL) { + ogs_error("OpenAPI_nrf_info_served_upf_info_value_convertToJSON() failed [s_nssai_upf_info_list]"); + goto end; + } + OpenAPI_list_for_each(nrf_info_served_upf_info_value->s_nssai_upf_info_list, node) { + cJSON *itemLocal = OpenAPI_snssai_upf_info_item_convertToJSON(node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_nrf_info_served_upf_info_value_convertToJSON() failed [s_nssai_upf_info_list]"); + goto end; + } + cJSON_AddItemToArray(s_nssai_upf_info_listList, itemLocal); + } + + if (nrf_info_served_upf_info_value->smf_serving_area) { + cJSON *smf_serving_areaList = cJSON_AddArrayToObject(item, "smfServingArea"); + if (smf_serving_areaList == NULL) { + ogs_error("OpenAPI_nrf_info_served_upf_info_value_convertToJSON() failed [smf_serving_area]"); + goto end; + } + OpenAPI_list_for_each(nrf_info_served_upf_info_value->smf_serving_area, node) { + if (cJSON_AddStringToObject(smf_serving_areaList, "", (char*)node->data) == NULL) { + ogs_error("OpenAPI_nrf_info_served_upf_info_value_convertToJSON() failed [smf_serving_area]"); + goto end; + } + } + } + + if (nrf_info_served_upf_info_value->interface_upf_info_list) { + cJSON *interface_upf_info_listList = cJSON_AddArrayToObject(item, "interfaceUpfInfoList"); + if (interface_upf_info_listList == NULL) { + ogs_error("OpenAPI_nrf_info_served_upf_info_value_convertToJSON() failed [interface_upf_info_list]"); + goto end; + } + OpenAPI_list_for_each(nrf_info_served_upf_info_value->interface_upf_info_list, node) { + cJSON *itemLocal = OpenAPI_interface_upf_info_item_convertToJSON(node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_nrf_info_served_upf_info_value_convertToJSON() failed [interface_upf_info_list]"); + goto end; + } + cJSON_AddItemToArray(interface_upf_info_listList, itemLocal); + } + } + + if (nrf_info_served_upf_info_value->is_iwk_eps_ind) { + if (cJSON_AddBoolToObject(item, "iwkEpsInd", nrf_info_served_upf_info_value->iwk_eps_ind) == NULL) { + ogs_error("OpenAPI_nrf_info_served_upf_info_value_convertToJSON() failed [iwk_eps_ind]"); + goto end; + } + } + + if (nrf_info_served_upf_info_value->pdu_session_types != OpenAPI_pdu_session_type_NULL) { + cJSON *pdu_session_typesList = cJSON_AddArrayToObject(item, "pduSessionTypes"); + if (pdu_session_typesList == NULL) { + ogs_error("OpenAPI_nrf_info_served_upf_info_value_convertToJSON() failed [pdu_session_types]"); + goto end; + } + OpenAPI_list_for_each(nrf_info_served_upf_info_value->pdu_session_types, node) { + if (cJSON_AddStringToObject(pdu_session_typesList, "", OpenAPI_pdu_session_type_ToString((intptr_t)node->data)) == NULL) { + ogs_error("OpenAPI_nrf_info_served_upf_info_value_convertToJSON() failed [pdu_session_types]"); + goto end; + } + } + } + + if (nrf_info_served_upf_info_value->atsss_capability) { + cJSON *atsss_capability_local_JSON = OpenAPI_atsss_capability_convertToJSON(nrf_info_served_upf_info_value->atsss_capability); + if (atsss_capability_local_JSON == NULL) { + ogs_error("OpenAPI_nrf_info_served_upf_info_value_convertToJSON() failed [atsss_capability]"); + goto end; + } + cJSON_AddItemToObject(item, "atsssCapability", atsss_capability_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_nrf_info_served_upf_info_value_convertToJSON() failed [atsss_capability]"); + goto end; + } + } + + if (nrf_info_served_upf_info_value->is_ue_ip_addr_ind) { + if (cJSON_AddBoolToObject(item, "ueIpAddrInd", nrf_info_served_upf_info_value->ue_ip_addr_ind) == NULL) { + ogs_error("OpenAPI_nrf_info_served_upf_info_value_convertToJSON() failed [ue_ip_addr_ind]"); + goto end; + } + } + + if (nrf_info_served_upf_info_value->tai_list) { + cJSON *tai_listList = cJSON_AddArrayToObject(item, "taiList"); + if (tai_listList == NULL) { + ogs_error("OpenAPI_nrf_info_served_upf_info_value_convertToJSON() failed [tai_list]"); + goto end; + } + OpenAPI_list_for_each(nrf_info_served_upf_info_value->tai_list, node) { + cJSON *itemLocal = OpenAPI_tai_convertToJSON(node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_nrf_info_served_upf_info_value_convertToJSON() failed [tai_list]"); + goto end; + } + cJSON_AddItemToArray(tai_listList, itemLocal); + } + } + + if (nrf_info_served_upf_info_value->tai_range_list) { + cJSON *tai_range_listList = cJSON_AddArrayToObject(item, "taiRangeList"); + if (tai_range_listList == NULL) { + ogs_error("OpenAPI_nrf_info_served_upf_info_value_convertToJSON() failed [tai_range_list]"); + goto end; + } + OpenAPI_list_for_each(nrf_info_served_upf_info_value->tai_range_list, node) { + cJSON *itemLocal = OpenAPI_tai_range_convertToJSON(node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_nrf_info_served_upf_info_value_convertToJSON() failed [tai_range_list]"); + goto end; + } + cJSON_AddItemToArray(tai_range_listList, itemLocal); + } + } + + if (nrf_info_served_upf_info_value->w_agf_info) { + cJSON *w_agf_info_local_JSON = OpenAPI_w_agf_info_convertToJSON(nrf_info_served_upf_info_value->w_agf_info); + if (w_agf_info_local_JSON == NULL) { + ogs_error("OpenAPI_nrf_info_served_upf_info_value_convertToJSON() failed [w_agf_info]"); + goto end; + } + cJSON_AddItemToObject(item, "wAgfInfo", w_agf_info_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_nrf_info_served_upf_info_value_convertToJSON() failed [w_agf_info]"); + goto end; + } + } + + if (nrf_info_served_upf_info_value->tngf_info) { + cJSON *tngf_info_local_JSON = OpenAPI_tngf_info_convertToJSON(nrf_info_served_upf_info_value->tngf_info); + if (tngf_info_local_JSON == NULL) { + ogs_error("OpenAPI_nrf_info_served_upf_info_value_convertToJSON() failed [tngf_info]"); + goto end; + } + cJSON_AddItemToObject(item, "tngfInfo", tngf_info_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_nrf_info_served_upf_info_value_convertToJSON() failed [tngf_info]"); + goto end; + } + } + + if (nrf_info_served_upf_info_value->twif_info) { + cJSON *twif_info_local_JSON = OpenAPI_twif_info_convertToJSON(nrf_info_served_upf_info_value->twif_info); + if (twif_info_local_JSON == NULL) { + ogs_error("OpenAPI_nrf_info_served_upf_info_value_convertToJSON() failed [twif_info]"); + goto end; + } + cJSON_AddItemToObject(item, "twifInfo", twif_info_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_nrf_info_served_upf_info_value_convertToJSON() failed [twif_info]"); + goto end; + } + } + + if (nrf_info_served_upf_info_value->is_priority) { + if (cJSON_AddNumberToObject(item, "priority", nrf_info_served_upf_info_value->priority) == NULL) { + ogs_error("OpenAPI_nrf_info_served_upf_info_value_convertToJSON() failed [priority]"); + goto end; + } + } + + if (nrf_info_served_upf_info_value->is_redundant_gtpu) { + if (cJSON_AddBoolToObject(item, "redundantGtpu", nrf_info_served_upf_info_value->redundant_gtpu) == NULL) { + ogs_error("OpenAPI_nrf_info_served_upf_info_value_convertToJSON() failed [redundant_gtpu]"); + goto end; + } + } + + if (nrf_info_served_upf_info_value->is_ipups) { + if (cJSON_AddBoolToObject(item, "ipups", nrf_info_served_upf_info_value->ipups) == NULL) { + ogs_error("OpenAPI_nrf_info_served_upf_info_value_convertToJSON() failed [ipups]"); + goto end; + } + } + + if (nrf_info_served_upf_info_value->is_data_forwarding) { + if (cJSON_AddBoolToObject(item, "dataForwarding", nrf_info_served_upf_info_value->data_forwarding) == NULL) { + ogs_error("OpenAPI_nrf_info_served_upf_info_value_convertToJSON() failed [data_forwarding]"); + goto end; + } + } + + if (nrf_info_served_upf_info_value->supported_pfcp_features) { + if (cJSON_AddStringToObject(item, "supportedPfcpFeatures", nrf_info_served_upf_info_value->supported_pfcp_features) == NULL) { + ogs_error("OpenAPI_nrf_info_served_upf_info_value_convertToJSON() failed [supported_pfcp_features]"); + goto end; + } + } + +end: + return item; +} + +OpenAPI_nrf_info_served_upf_info_value_t *OpenAPI_nrf_info_served_upf_info_value_parseFromJSON(cJSON *nrf_info_served_upf_info_valueJSON) +{ + OpenAPI_nrf_info_served_upf_info_value_t *nrf_info_served_upf_info_value_local_var = NULL; + OpenAPI_lnode_t *node = NULL; + cJSON *s_nssai_upf_info_list = NULL; + OpenAPI_list_t *s_nssai_upf_info_listList = NULL; + cJSON *smf_serving_area = NULL; + OpenAPI_list_t *smf_serving_areaList = NULL; + cJSON *interface_upf_info_list = NULL; + OpenAPI_list_t *interface_upf_info_listList = NULL; + cJSON *iwk_eps_ind = NULL; + cJSON *pdu_session_types = NULL; + OpenAPI_list_t *pdu_session_typesList = NULL; + cJSON *atsss_capability = NULL; + OpenAPI_atsss_capability_t *atsss_capability_local_nonprim = NULL; + cJSON *ue_ip_addr_ind = NULL; + cJSON *tai_list = NULL; + OpenAPI_list_t *tai_listList = NULL; + cJSON *tai_range_list = NULL; + OpenAPI_list_t *tai_range_listList = NULL; + cJSON *w_agf_info = NULL; + OpenAPI_w_agf_info_t *w_agf_info_local_nonprim = NULL; + cJSON *tngf_info = NULL; + OpenAPI_tngf_info_t *tngf_info_local_nonprim = NULL; + cJSON *twif_info = NULL; + OpenAPI_twif_info_t *twif_info_local_nonprim = NULL; + cJSON *priority = NULL; + cJSON *redundant_gtpu = NULL; + cJSON *ipups = NULL; + cJSON *data_forwarding = NULL; + cJSON *supported_pfcp_features = NULL; + s_nssai_upf_info_list = cJSON_GetObjectItemCaseSensitive(nrf_info_served_upf_info_valueJSON, "sNssaiUpfInfoList"); + if (!s_nssai_upf_info_list) { + ogs_error("OpenAPI_nrf_info_served_upf_info_value_parseFromJSON() failed [s_nssai_upf_info_list]"); + goto end; + } + cJSON *s_nssai_upf_info_list_local = NULL; + if (!cJSON_IsArray(s_nssai_upf_info_list)) { + ogs_error("OpenAPI_nrf_info_served_upf_info_value_parseFromJSON() failed [s_nssai_upf_info_list]"); + goto end; + } + + s_nssai_upf_info_listList = OpenAPI_list_create(); + + cJSON_ArrayForEach(s_nssai_upf_info_list_local, s_nssai_upf_info_list) { + if (!cJSON_IsObject(s_nssai_upf_info_list_local)) { + ogs_error("OpenAPI_nrf_info_served_upf_info_value_parseFromJSON() failed [s_nssai_upf_info_list]"); + goto end; + } + OpenAPI_snssai_upf_info_item_t *s_nssai_upf_info_listItem = OpenAPI_snssai_upf_info_item_parseFromJSON(s_nssai_upf_info_list_local); + if (!s_nssai_upf_info_listItem) { + ogs_error("No s_nssai_upf_info_listItem"); + OpenAPI_list_free(s_nssai_upf_info_listList); + goto end; + } + OpenAPI_list_add(s_nssai_upf_info_listList, s_nssai_upf_info_listItem); + } + + smf_serving_area = cJSON_GetObjectItemCaseSensitive(nrf_info_served_upf_info_valueJSON, "smfServingArea"); + if (smf_serving_area) { + cJSON *smf_serving_area_local = NULL; + if (!cJSON_IsArray(smf_serving_area)) { + ogs_error("OpenAPI_nrf_info_served_upf_info_value_parseFromJSON() failed [smf_serving_area]"); + goto end; + } + + smf_serving_areaList = OpenAPI_list_create(); + + cJSON_ArrayForEach(smf_serving_area_local, smf_serving_area) { + double *localDouble = NULL; + int *localInt = NULL; + if (!cJSON_IsString(smf_serving_area_local)) { + ogs_error("OpenAPI_nrf_info_served_upf_info_value_parseFromJSON() failed [smf_serving_area]"); + goto end; + } + OpenAPI_list_add(smf_serving_areaList, ogs_strdup(smf_serving_area_local->valuestring)); + } + } + + interface_upf_info_list = cJSON_GetObjectItemCaseSensitive(nrf_info_served_upf_info_valueJSON, "interfaceUpfInfoList"); + if (interface_upf_info_list) { + cJSON *interface_upf_info_list_local = NULL; + if (!cJSON_IsArray(interface_upf_info_list)) { + ogs_error("OpenAPI_nrf_info_served_upf_info_value_parseFromJSON() failed [interface_upf_info_list]"); + goto end; + } + + interface_upf_info_listList = OpenAPI_list_create(); + + cJSON_ArrayForEach(interface_upf_info_list_local, interface_upf_info_list) { + if (!cJSON_IsObject(interface_upf_info_list_local)) { + ogs_error("OpenAPI_nrf_info_served_upf_info_value_parseFromJSON() failed [interface_upf_info_list]"); + goto end; + } + OpenAPI_interface_upf_info_item_t *interface_upf_info_listItem = OpenAPI_interface_upf_info_item_parseFromJSON(interface_upf_info_list_local); + if (!interface_upf_info_listItem) { + ogs_error("No interface_upf_info_listItem"); + OpenAPI_list_free(interface_upf_info_listList); + goto end; + } + OpenAPI_list_add(interface_upf_info_listList, interface_upf_info_listItem); + } + } + + iwk_eps_ind = cJSON_GetObjectItemCaseSensitive(nrf_info_served_upf_info_valueJSON, "iwkEpsInd"); + if (iwk_eps_ind) { + if (!cJSON_IsBool(iwk_eps_ind)) { + ogs_error("OpenAPI_nrf_info_served_upf_info_value_parseFromJSON() failed [iwk_eps_ind]"); + goto end; + } + } + + pdu_session_types = cJSON_GetObjectItemCaseSensitive(nrf_info_served_upf_info_valueJSON, "pduSessionTypes"); + if (pdu_session_types) { + cJSON *pdu_session_types_local = NULL; + if (!cJSON_IsArray(pdu_session_types)) { + ogs_error("OpenAPI_nrf_info_served_upf_info_value_parseFromJSON() failed [pdu_session_types]"); + goto end; + } + + pdu_session_typesList = OpenAPI_list_create(); + + cJSON_ArrayForEach(pdu_session_types_local, pdu_session_types) { + if (!cJSON_IsString(pdu_session_types_local)) { + ogs_error("OpenAPI_nrf_info_served_upf_info_value_parseFromJSON() failed [pdu_session_types]"); + goto end; + } + OpenAPI_list_add(pdu_session_typesList, (void *)OpenAPI_pdu_session_type_FromString(pdu_session_types_local->valuestring)); + } + } + + atsss_capability = cJSON_GetObjectItemCaseSensitive(nrf_info_served_upf_info_valueJSON, "atsssCapability"); + if (atsss_capability) { + atsss_capability_local_nonprim = OpenAPI_atsss_capability_parseFromJSON(atsss_capability); + } + + ue_ip_addr_ind = cJSON_GetObjectItemCaseSensitive(nrf_info_served_upf_info_valueJSON, "ueIpAddrInd"); + if (ue_ip_addr_ind) { + if (!cJSON_IsBool(ue_ip_addr_ind)) { + ogs_error("OpenAPI_nrf_info_served_upf_info_value_parseFromJSON() failed [ue_ip_addr_ind]"); + goto end; + } + } + + tai_list = cJSON_GetObjectItemCaseSensitive(nrf_info_served_upf_info_valueJSON, "taiList"); + if (tai_list) { + cJSON *tai_list_local = NULL; + if (!cJSON_IsArray(tai_list)) { + ogs_error("OpenAPI_nrf_info_served_upf_info_value_parseFromJSON() failed [tai_list]"); + goto end; + } + + tai_listList = OpenAPI_list_create(); + + cJSON_ArrayForEach(tai_list_local, tai_list) { + if (!cJSON_IsObject(tai_list_local)) { + ogs_error("OpenAPI_nrf_info_served_upf_info_value_parseFromJSON() failed [tai_list]"); + goto end; + } + OpenAPI_tai_t *tai_listItem = OpenAPI_tai_parseFromJSON(tai_list_local); + if (!tai_listItem) { + ogs_error("No tai_listItem"); + OpenAPI_list_free(tai_listList); + goto end; + } + OpenAPI_list_add(tai_listList, tai_listItem); + } + } + + tai_range_list = cJSON_GetObjectItemCaseSensitive(nrf_info_served_upf_info_valueJSON, "taiRangeList"); + if (tai_range_list) { + cJSON *tai_range_list_local = NULL; + if (!cJSON_IsArray(tai_range_list)) { + ogs_error("OpenAPI_nrf_info_served_upf_info_value_parseFromJSON() failed [tai_range_list]"); + goto end; + } + + tai_range_listList = OpenAPI_list_create(); + + cJSON_ArrayForEach(tai_range_list_local, tai_range_list) { + if (!cJSON_IsObject(tai_range_list_local)) { + ogs_error("OpenAPI_nrf_info_served_upf_info_value_parseFromJSON() failed [tai_range_list]"); + goto end; + } + OpenAPI_tai_range_t *tai_range_listItem = OpenAPI_tai_range_parseFromJSON(tai_range_list_local); + if (!tai_range_listItem) { + ogs_error("No tai_range_listItem"); + OpenAPI_list_free(tai_range_listList); + goto end; + } + OpenAPI_list_add(tai_range_listList, tai_range_listItem); + } + } + + w_agf_info = cJSON_GetObjectItemCaseSensitive(nrf_info_served_upf_info_valueJSON, "wAgfInfo"); + if (w_agf_info) { + w_agf_info_local_nonprim = OpenAPI_w_agf_info_parseFromJSON(w_agf_info); + } + + tngf_info = cJSON_GetObjectItemCaseSensitive(nrf_info_served_upf_info_valueJSON, "tngfInfo"); + if (tngf_info) { + tngf_info_local_nonprim = OpenAPI_tngf_info_parseFromJSON(tngf_info); + } + + twif_info = cJSON_GetObjectItemCaseSensitive(nrf_info_served_upf_info_valueJSON, "twifInfo"); + if (twif_info) { + twif_info_local_nonprim = OpenAPI_twif_info_parseFromJSON(twif_info); + } + + priority = cJSON_GetObjectItemCaseSensitive(nrf_info_served_upf_info_valueJSON, "priority"); + if (priority) { + if (!cJSON_IsNumber(priority)) { + ogs_error("OpenAPI_nrf_info_served_upf_info_value_parseFromJSON() failed [priority]"); + goto end; + } + } + + redundant_gtpu = cJSON_GetObjectItemCaseSensitive(nrf_info_served_upf_info_valueJSON, "redundantGtpu"); + if (redundant_gtpu) { + if (!cJSON_IsBool(redundant_gtpu)) { + ogs_error("OpenAPI_nrf_info_served_upf_info_value_parseFromJSON() failed [redundant_gtpu]"); + goto end; + } + } + + ipups = cJSON_GetObjectItemCaseSensitive(nrf_info_served_upf_info_valueJSON, "ipups"); + if (ipups) { + if (!cJSON_IsBool(ipups)) { + ogs_error("OpenAPI_nrf_info_served_upf_info_value_parseFromJSON() failed [ipups]"); + goto end; + } + } + + data_forwarding = cJSON_GetObjectItemCaseSensitive(nrf_info_served_upf_info_valueJSON, "dataForwarding"); + if (data_forwarding) { + if (!cJSON_IsBool(data_forwarding)) { + ogs_error("OpenAPI_nrf_info_served_upf_info_value_parseFromJSON() failed [data_forwarding]"); + goto end; + } + } + + supported_pfcp_features = cJSON_GetObjectItemCaseSensitive(nrf_info_served_upf_info_valueJSON, "supportedPfcpFeatures"); + if (supported_pfcp_features) { + if (!cJSON_IsString(supported_pfcp_features) && !cJSON_IsNull(supported_pfcp_features)) { + ogs_error("OpenAPI_nrf_info_served_upf_info_value_parseFromJSON() failed [supported_pfcp_features]"); + goto end; + } + } + + nrf_info_served_upf_info_value_local_var = OpenAPI_nrf_info_served_upf_info_value_create ( + s_nssai_upf_info_listList, + smf_serving_area ? smf_serving_areaList : NULL, + interface_upf_info_list ? interface_upf_info_listList : NULL, + iwk_eps_ind ? true : false, + iwk_eps_ind ? iwk_eps_ind->valueint : 0, + pdu_session_types ? pdu_session_typesList : NULL, + atsss_capability ? atsss_capability_local_nonprim : NULL, + ue_ip_addr_ind ? true : false, + ue_ip_addr_ind ? ue_ip_addr_ind->valueint : 0, + tai_list ? tai_listList : NULL, + tai_range_list ? tai_range_listList : NULL, + w_agf_info ? w_agf_info_local_nonprim : NULL, + tngf_info ? tngf_info_local_nonprim : NULL, + twif_info ? twif_info_local_nonprim : NULL, + priority ? true : false, + priority ? priority->valuedouble : 0, + redundant_gtpu ? true : false, + redundant_gtpu ? redundant_gtpu->valueint : 0, + ipups ? true : false, + ipups ? ipups->valueint : 0, + data_forwarding ? true : false, + data_forwarding ? data_forwarding->valueint : 0, + supported_pfcp_features && !cJSON_IsNull(supported_pfcp_features) ? ogs_strdup(supported_pfcp_features->valuestring) : NULL + ); + + return nrf_info_served_upf_info_value_local_var; +end: + if (s_nssai_upf_info_listList) { + OpenAPI_list_for_each(s_nssai_upf_info_listList, node) { + OpenAPI_snssai_upf_info_item_free(node->data); + } + OpenAPI_list_free(s_nssai_upf_info_listList); + s_nssai_upf_info_listList = NULL; + } + if (smf_serving_areaList) { + OpenAPI_list_for_each(smf_serving_areaList, node) { + ogs_free(node->data); + } + OpenAPI_list_free(smf_serving_areaList); + smf_serving_areaList = NULL; + } + if (interface_upf_info_listList) { + OpenAPI_list_for_each(interface_upf_info_listList, node) { + OpenAPI_interface_upf_info_item_free(node->data); + } + OpenAPI_list_free(interface_upf_info_listList); + interface_upf_info_listList = NULL; + } + if (pdu_session_typesList) { + OpenAPI_list_free(pdu_session_typesList); + pdu_session_typesList = NULL; + } + if (atsss_capability_local_nonprim) { + OpenAPI_atsss_capability_free(atsss_capability_local_nonprim); + atsss_capability_local_nonprim = NULL; + } + if (tai_listList) { + OpenAPI_list_for_each(tai_listList, node) { + OpenAPI_tai_free(node->data); + } + OpenAPI_list_free(tai_listList); + tai_listList = NULL; + } + if (tai_range_listList) { + OpenAPI_list_for_each(tai_range_listList, node) { + OpenAPI_tai_range_free(node->data); + } + OpenAPI_list_free(tai_range_listList); + tai_range_listList = NULL; + } + if (w_agf_info_local_nonprim) { + OpenAPI_w_agf_info_free(w_agf_info_local_nonprim); + w_agf_info_local_nonprim = NULL; + } + if (tngf_info_local_nonprim) { + OpenAPI_tngf_info_free(tngf_info_local_nonprim); + tngf_info_local_nonprim = NULL; + } + if (twif_info_local_nonprim) { + OpenAPI_twif_info_free(twif_info_local_nonprim); + twif_info_local_nonprim = NULL; + } + return NULL; +} + +OpenAPI_nrf_info_served_upf_info_value_t *OpenAPI_nrf_info_served_upf_info_value_copy(OpenAPI_nrf_info_served_upf_info_value_t *dst, OpenAPI_nrf_info_served_upf_info_value_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_nrf_info_served_upf_info_value_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_nrf_info_served_upf_info_value_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_nrf_info_served_upf_info_value_free(dst); + dst = OpenAPI_nrf_info_served_upf_info_value_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/nrf_info_served_upf_info_value.h b/lib/sbi/openapi/model/nrf_info_served_upf_info_value.h new file mode 100644 index 000000000..407fe9e33 --- /dev/null +++ b/lib/sbi/openapi/model/nrf_info_served_upf_info_value.h @@ -0,0 +1,92 @@ +/* + * nrf_info_served_upf_info_value.h + * + * + */ + +#ifndef _OpenAPI_nrf_info_served_upf_info_value_H_ +#define _OpenAPI_nrf_info_served_upf_info_value_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "atsss_capability.h" +#include "interface_upf_info_item.h" +#include "pdu_session_type.h" +#include "snssai_upf_info_item.h" +#include "tai.h" +#include "tai_range.h" +#include "tngf_info.h" +#include "twif_info.h" +#include "upf_info.h" +#include "w_agf_info.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_nrf_info_served_upf_info_value_s OpenAPI_nrf_info_served_upf_info_value_t; +typedef struct OpenAPI_nrf_info_served_upf_info_value_s { + OpenAPI_list_t *s_nssai_upf_info_list; + OpenAPI_list_t *smf_serving_area; + OpenAPI_list_t *interface_upf_info_list; + bool is_iwk_eps_ind; + int iwk_eps_ind; + OpenAPI_list_t *pdu_session_types; + struct OpenAPI_atsss_capability_s *atsss_capability; + bool is_ue_ip_addr_ind; + int ue_ip_addr_ind; + OpenAPI_list_t *tai_list; + OpenAPI_list_t *tai_range_list; + struct OpenAPI_w_agf_info_s *w_agf_info; + struct OpenAPI_tngf_info_s *tngf_info; + struct OpenAPI_twif_info_s *twif_info; + bool is_priority; + int priority; + bool is_redundant_gtpu; + int redundant_gtpu; + bool is_ipups; + int ipups; + bool is_data_forwarding; + int data_forwarding; + char *supported_pfcp_features; +} OpenAPI_nrf_info_served_upf_info_value_t; + +OpenAPI_nrf_info_served_upf_info_value_t *OpenAPI_nrf_info_served_upf_info_value_create( + OpenAPI_list_t *s_nssai_upf_info_list, + OpenAPI_list_t *smf_serving_area, + OpenAPI_list_t *interface_upf_info_list, + bool is_iwk_eps_ind, + int iwk_eps_ind, + OpenAPI_list_t *pdu_session_types, + OpenAPI_atsss_capability_t *atsss_capability, + bool is_ue_ip_addr_ind, + int ue_ip_addr_ind, + OpenAPI_list_t *tai_list, + OpenAPI_list_t *tai_range_list, + OpenAPI_w_agf_info_t *w_agf_info, + OpenAPI_tngf_info_t *tngf_info, + OpenAPI_twif_info_t *twif_info, + bool is_priority, + int priority, + bool is_redundant_gtpu, + int redundant_gtpu, + bool is_ipups, + int ipups, + bool is_data_forwarding, + int data_forwarding, + char *supported_pfcp_features +); +void OpenAPI_nrf_info_served_upf_info_value_free(OpenAPI_nrf_info_served_upf_info_value_t *nrf_info_served_upf_info_value); +OpenAPI_nrf_info_served_upf_info_value_t *OpenAPI_nrf_info_served_upf_info_value_parseFromJSON(cJSON *nrf_info_served_upf_info_valueJSON); +cJSON *OpenAPI_nrf_info_served_upf_info_value_convertToJSON(OpenAPI_nrf_info_served_upf_info_value_t *nrf_info_served_upf_info_value); +OpenAPI_nrf_info_served_upf_info_value_t *OpenAPI_nrf_info_served_upf_info_value_copy(OpenAPI_nrf_info_served_upf_info_value_t *dst, OpenAPI_nrf_info_served_upf_info_value_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_nrf_info_served_upf_info_value_H_ */ + diff --git a/lib/sbi/openapi/model/nrppa_information.h b/lib/sbi/openapi/model/nrppa_information.h index 00cbdf832..f24d274f4 100644 --- a/lib/sbi/openapi/model/nrppa_information.h +++ b/lib/sbi/openapi/model/nrppa_information.h @@ -1,7 +1,7 @@ /* * nrppa_information.h * - * + * Represents a NRPPa related N2 information data part */ #ifndef _OpenAPI_nrppa_information_H_ diff --git a/lib/sbi/openapi/model/nsacf_capability.c b/lib/sbi/openapi/model/nsacf_capability.c new file mode 100644 index 000000000..34061355f --- /dev/null +++ b/lib/sbi/openapi/model/nsacf_capability.c @@ -0,0 +1,131 @@ + +#include +#include +#include +#include "nsacf_capability.h" + +OpenAPI_nsacf_capability_t *OpenAPI_nsacf_capability_create( + bool is_support_ue_sac, + int support_ue_sac, + bool is_support_pdu_sac, + int support_pdu_sac +) +{ + OpenAPI_nsacf_capability_t *nsacf_capability_local_var = ogs_malloc(sizeof(OpenAPI_nsacf_capability_t)); + ogs_assert(nsacf_capability_local_var); + + nsacf_capability_local_var->is_support_ue_sac = is_support_ue_sac; + nsacf_capability_local_var->support_ue_sac = support_ue_sac; + nsacf_capability_local_var->is_support_pdu_sac = is_support_pdu_sac; + nsacf_capability_local_var->support_pdu_sac = support_pdu_sac; + + return nsacf_capability_local_var; +} + +void OpenAPI_nsacf_capability_free(OpenAPI_nsacf_capability_t *nsacf_capability) +{ + OpenAPI_lnode_t *node = NULL; + + if (NULL == nsacf_capability) { + return; + } + ogs_free(nsacf_capability); +} + +cJSON *OpenAPI_nsacf_capability_convertToJSON(OpenAPI_nsacf_capability_t *nsacf_capability) +{ + cJSON *item = NULL; + OpenAPI_lnode_t *node = NULL; + + if (nsacf_capability == NULL) { + ogs_error("OpenAPI_nsacf_capability_convertToJSON() failed [NsacfCapability]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (nsacf_capability->is_support_ue_sac) { + if (cJSON_AddBoolToObject(item, "supportUeSAC", nsacf_capability->support_ue_sac) == NULL) { + ogs_error("OpenAPI_nsacf_capability_convertToJSON() failed [support_ue_sac]"); + goto end; + } + } + + if (nsacf_capability->is_support_pdu_sac) { + if (cJSON_AddBoolToObject(item, "supportPduSAC", nsacf_capability->support_pdu_sac) == NULL) { + ogs_error("OpenAPI_nsacf_capability_convertToJSON() failed [support_pdu_sac]"); + goto end; + } + } + +end: + return item; +} + +OpenAPI_nsacf_capability_t *OpenAPI_nsacf_capability_parseFromJSON(cJSON *nsacf_capabilityJSON) +{ + OpenAPI_nsacf_capability_t *nsacf_capability_local_var = NULL; + OpenAPI_lnode_t *node = NULL; + cJSON *support_ue_sac = NULL; + cJSON *support_pdu_sac = NULL; + support_ue_sac = cJSON_GetObjectItemCaseSensitive(nsacf_capabilityJSON, "supportUeSAC"); + if (support_ue_sac) { + if (!cJSON_IsBool(support_ue_sac)) { + ogs_error("OpenAPI_nsacf_capability_parseFromJSON() failed [support_ue_sac]"); + goto end; + } + } + + support_pdu_sac = cJSON_GetObjectItemCaseSensitive(nsacf_capabilityJSON, "supportPduSAC"); + if (support_pdu_sac) { + if (!cJSON_IsBool(support_pdu_sac)) { + ogs_error("OpenAPI_nsacf_capability_parseFromJSON() failed [support_pdu_sac]"); + goto end; + } + } + + nsacf_capability_local_var = OpenAPI_nsacf_capability_create ( + support_ue_sac ? true : false, + support_ue_sac ? support_ue_sac->valueint : 0, + support_pdu_sac ? true : false, + support_pdu_sac ? support_pdu_sac->valueint : 0 + ); + + return nsacf_capability_local_var; +end: + return NULL; +} + +OpenAPI_nsacf_capability_t *OpenAPI_nsacf_capability_copy(OpenAPI_nsacf_capability_t *dst, OpenAPI_nsacf_capability_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_nsacf_capability_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_nsacf_capability_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_nsacf_capability_free(dst); + dst = OpenAPI_nsacf_capability_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/nsacf_capability.h b/lib/sbi/openapi/model/nsacf_capability.h new file mode 100644 index 000000000..cc6c6f0e4 --- /dev/null +++ b/lib/sbi/openapi/model/nsacf_capability.h @@ -0,0 +1,44 @@ +/* + * nsacf_capability.h + * + * NSACF service capabilities (e.g. to monitor and control the number of registered UEs or established PDU sessions per network slice) + */ + +#ifndef _OpenAPI_nsacf_capability_H_ +#define _OpenAPI_nsacf_capability_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_nsacf_capability_s OpenAPI_nsacf_capability_t; +typedef struct OpenAPI_nsacf_capability_s { + bool is_support_ue_sac; + int support_ue_sac; + bool is_support_pdu_sac; + int support_pdu_sac; +} OpenAPI_nsacf_capability_t; + +OpenAPI_nsacf_capability_t *OpenAPI_nsacf_capability_create( + bool is_support_ue_sac, + int support_ue_sac, + bool is_support_pdu_sac, + int support_pdu_sac +); +void OpenAPI_nsacf_capability_free(OpenAPI_nsacf_capability_t *nsacf_capability); +OpenAPI_nsacf_capability_t *OpenAPI_nsacf_capability_parseFromJSON(cJSON *nsacf_capabilityJSON); +cJSON *OpenAPI_nsacf_capability_convertToJSON(OpenAPI_nsacf_capability_t *nsacf_capability); +OpenAPI_nsacf_capability_t *OpenAPI_nsacf_capability_copy(OpenAPI_nsacf_capability_t *dst, OpenAPI_nsacf_capability_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_nsacf_capability_H_ */ + diff --git a/lib/sbi/openapi/model/nsacf_info.c b/lib/sbi/openapi/model/nsacf_info.c new file mode 100644 index 000000000..51a6897f7 --- /dev/null +++ b/lib/sbi/openapi/model/nsacf_info.c @@ -0,0 +1,242 @@ + +#include +#include +#include +#include "nsacf_info.h" + +OpenAPI_nsacf_info_t *OpenAPI_nsacf_info_create( + OpenAPI_nsacf_capability_t *nsacf_capability, + OpenAPI_list_t *tai_list, + OpenAPI_list_t *tai_range_list +) +{ + OpenAPI_nsacf_info_t *nsacf_info_local_var = ogs_malloc(sizeof(OpenAPI_nsacf_info_t)); + ogs_assert(nsacf_info_local_var); + + nsacf_info_local_var->nsacf_capability = nsacf_capability; + nsacf_info_local_var->tai_list = tai_list; + nsacf_info_local_var->tai_range_list = tai_range_list; + + return nsacf_info_local_var; +} + +void OpenAPI_nsacf_info_free(OpenAPI_nsacf_info_t *nsacf_info) +{ + OpenAPI_lnode_t *node = NULL; + + if (NULL == nsacf_info) { + return; + } + if (nsacf_info->nsacf_capability) { + OpenAPI_nsacf_capability_free(nsacf_info->nsacf_capability); + nsacf_info->nsacf_capability = NULL; + } + if (nsacf_info->tai_list) { + OpenAPI_list_for_each(nsacf_info->tai_list, node) { + OpenAPI_tai_free(node->data); + } + OpenAPI_list_free(nsacf_info->tai_list); + nsacf_info->tai_list = NULL; + } + if (nsacf_info->tai_range_list) { + OpenAPI_list_for_each(nsacf_info->tai_range_list, node) { + OpenAPI_tai_range_free(node->data); + } + OpenAPI_list_free(nsacf_info->tai_range_list); + nsacf_info->tai_range_list = NULL; + } + ogs_free(nsacf_info); +} + +cJSON *OpenAPI_nsacf_info_convertToJSON(OpenAPI_nsacf_info_t *nsacf_info) +{ + cJSON *item = NULL; + OpenAPI_lnode_t *node = NULL; + + if (nsacf_info == NULL) { + ogs_error("OpenAPI_nsacf_info_convertToJSON() failed [NsacfInfo]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (!nsacf_info->nsacf_capability) { + ogs_error("OpenAPI_nsacf_info_convertToJSON() failed [nsacf_capability]"); + return NULL; + } + cJSON *nsacf_capability_local_JSON = OpenAPI_nsacf_capability_convertToJSON(nsacf_info->nsacf_capability); + if (nsacf_capability_local_JSON == NULL) { + ogs_error("OpenAPI_nsacf_info_convertToJSON() failed [nsacf_capability]"); + goto end; + } + cJSON_AddItemToObject(item, "nsacfCapability", nsacf_capability_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_nsacf_info_convertToJSON() failed [nsacf_capability]"); + goto end; + } + + if (nsacf_info->tai_list) { + cJSON *tai_listList = cJSON_AddArrayToObject(item, "taiList"); + if (tai_listList == NULL) { + ogs_error("OpenAPI_nsacf_info_convertToJSON() failed [tai_list]"); + goto end; + } + OpenAPI_list_for_each(nsacf_info->tai_list, node) { + cJSON *itemLocal = OpenAPI_tai_convertToJSON(node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_nsacf_info_convertToJSON() failed [tai_list]"); + goto end; + } + cJSON_AddItemToArray(tai_listList, itemLocal); + } + } + + if (nsacf_info->tai_range_list) { + cJSON *tai_range_listList = cJSON_AddArrayToObject(item, "taiRangeList"); + if (tai_range_listList == NULL) { + ogs_error("OpenAPI_nsacf_info_convertToJSON() failed [tai_range_list]"); + goto end; + } + OpenAPI_list_for_each(nsacf_info->tai_range_list, node) { + cJSON *itemLocal = OpenAPI_tai_range_convertToJSON(node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_nsacf_info_convertToJSON() failed [tai_range_list]"); + goto end; + } + cJSON_AddItemToArray(tai_range_listList, itemLocal); + } + } + +end: + return item; +} + +OpenAPI_nsacf_info_t *OpenAPI_nsacf_info_parseFromJSON(cJSON *nsacf_infoJSON) +{ + OpenAPI_nsacf_info_t *nsacf_info_local_var = NULL; + OpenAPI_lnode_t *node = NULL; + cJSON *nsacf_capability = NULL; + OpenAPI_nsacf_capability_t *nsacf_capability_local_nonprim = NULL; + cJSON *tai_list = NULL; + OpenAPI_list_t *tai_listList = NULL; + cJSON *tai_range_list = NULL; + OpenAPI_list_t *tai_range_listList = NULL; + nsacf_capability = cJSON_GetObjectItemCaseSensitive(nsacf_infoJSON, "nsacfCapability"); + if (!nsacf_capability) { + ogs_error("OpenAPI_nsacf_info_parseFromJSON() failed [nsacf_capability]"); + goto end; + } + nsacf_capability_local_nonprim = OpenAPI_nsacf_capability_parseFromJSON(nsacf_capability); + + tai_list = cJSON_GetObjectItemCaseSensitive(nsacf_infoJSON, "taiList"); + if (tai_list) { + cJSON *tai_list_local = NULL; + if (!cJSON_IsArray(tai_list)) { + ogs_error("OpenAPI_nsacf_info_parseFromJSON() failed [tai_list]"); + goto end; + } + + tai_listList = OpenAPI_list_create(); + + cJSON_ArrayForEach(tai_list_local, tai_list) { + if (!cJSON_IsObject(tai_list_local)) { + ogs_error("OpenAPI_nsacf_info_parseFromJSON() failed [tai_list]"); + goto end; + } + OpenAPI_tai_t *tai_listItem = OpenAPI_tai_parseFromJSON(tai_list_local); + if (!tai_listItem) { + ogs_error("No tai_listItem"); + OpenAPI_list_free(tai_listList); + goto end; + } + OpenAPI_list_add(tai_listList, tai_listItem); + } + } + + tai_range_list = cJSON_GetObjectItemCaseSensitive(nsacf_infoJSON, "taiRangeList"); + if (tai_range_list) { + cJSON *tai_range_list_local = NULL; + if (!cJSON_IsArray(tai_range_list)) { + ogs_error("OpenAPI_nsacf_info_parseFromJSON() failed [tai_range_list]"); + goto end; + } + + tai_range_listList = OpenAPI_list_create(); + + cJSON_ArrayForEach(tai_range_list_local, tai_range_list) { + if (!cJSON_IsObject(tai_range_list_local)) { + ogs_error("OpenAPI_nsacf_info_parseFromJSON() failed [tai_range_list]"); + goto end; + } + OpenAPI_tai_range_t *tai_range_listItem = OpenAPI_tai_range_parseFromJSON(tai_range_list_local); + if (!tai_range_listItem) { + ogs_error("No tai_range_listItem"); + OpenAPI_list_free(tai_range_listList); + goto end; + } + OpenAPI_list_add(tai_range_listList, tai_range_listItem); + } + } + + nsacf_info_local_var = OpenAPI_nsacf_info_create ( + nsacf_capability_local_nonprim, + tai_list ? tai_listList : NULL, + tai_range_list ? tai_range_listList : NULL + ); + + return nsacf_info_local_var; +end: + if (nsacf_capability_local_nonprim) { + OpenAPI_nsacf_capability_free(nsacf_capability_local_nonprim); + nsacf_capability_local_nonprim = NULL; + } + if (tai_listList) { + OpenAPI_list_for_each(tai_listList, node) { + OpenAPI_tai_free(node->data); + } + OpenAPI_list_free(tai_listList); + tai_listList = NULL; + } + if (tai_range_listList) { + OpenAPI_list_for_each(tai_range_listList, node) { + OpenAPI_tai_range_free(node->data); + } + OpenAPI_list_free(tai_range_listList); + tai_range_listList = NULL; + } + return NULL; +} + +OpenAPI_nsacf_info_t *OpenAPI_nsacf_info_copy(OpenAPI_nsacf_info_t *dst, OpenAPI_nsacf_info_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_nsacf_info_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_nsacf_info_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_nsacf_info_free(dst); + dst = OpenAPI_nsacf_info_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/nsacf_info.h b/lib/sbi/openapi/model/nsacf_info.h new file mode 100644 index 000000000..b22a3b874 --- /dev/null +++ b/lib/sbi/openapi/model/nsacf_info.h @@ -0,0 +1,45 @@ +/* + * nsacf_info.h + * + * Information of a NSACF NF Instance + */ + +#ifndef _OpenAPI_nsacf_info_H_ +#define _OpenAPI_nsacf_info_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "nsacf_capability.h" +#include "tai.h" +#include "tai_range.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_nsacf_info_s OpenAPI_nsacf_info_t; +typedef struct OpenAPI_nsacf_info_s { + struct OpenAPI_nsacf_capability_s *nsacf_capability; + OpenAPI_list_t *tai_list; + OpenAPI_list_t *tai_range_list; +} OpenAPI_nsacf_info_t; + +OpenAPI_nsacf_info_t *OpenAPI_nsacf_info_create( + OpenAPI_nsacf_capability_t *nsacf_capability, + OpenAPI_list_t *tai_list, + OpenAPI_list_t *tai_range_list +); +void OpenAPI_nsacf_info_free(OpenAPI_nsacf_info_t *nsacf_info); +OpenAPI_nsacf_info_t *OpenAPI_nsacf_info_parseFromJSON(cJSON *nsacf_infoJSON); +cJSON *OpenAPI_nsacf_info_convertToJSON(OpenAPI_nsacf_info_t *nsacf_info); +OpenAPI_nsacf_info_t *OpenAPI_nsacf_info_copy(OpenAPI_nsacf_info_t *dst, OpenAPI_nsacf_info_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_nsacf_info_H_ */ + diff --git a/lib/sbi/openapi/model/nsag_info.c b/lib/sbi/openapi/model/nsag_info.c new file mode 100644 index 000000000..8c42f3958 --- /dev/null +++ b/lib/sbi/openapi/model/nsag_info.c @@ -0,0 +1,335 @@ + +#include +#include +#include +#include "nsag_info.h" + +OpenAPI_nsag_info_t *OpenAPI_nsag_info_create( + OpenAPI_list_t *nsag_ids, + OpenAPI_list_t *snssai_list, + OpenAPI_list_t *tai_list, + OpenAPI_list_t *tai_range_list +) +{ + OpenAPI_nsag_info_t *nsag_info_local_var = ogs_malloc(sizeof(OpenAPI_nsag_info_t)); + ogs_assert(nsag_info_local_var); + + nsag_info_local_var->nsag_ids = nsag_ids; + nsag_info_local_var->snssai_list = snssai_list; + nsag_info_local_var->tai_list = tai_list; + nsag_info_local_var->tai_range_list = tai_range_list; + + return nsag_info_local_var; +} + +void OpenAPI_nsag_info_free(OpenAPI_nsag_info_t *nsag_info) +{ + OpenAPI_lnode_t *node = NULL; + + if (NULL == nsag_info) { + return; + } + if (nsag_info->nsag_ids) { + OpenAPI_list_for_each(nsag_info->nsag_ids, node) { + ogs_free(node->data); + } + OpenAPI_list_free(nsag_info->nsag_ids); + nsag_info->nsag_ids = NULL; + } + if (nsag_info->snssai_list) { + OpenAPI_list_for_each(nsag_info->snssai_list, node) { + OpenAPI_snssai_free(node->data); + } + OpenAPI_list_free(nsag_info->snssai_list); + nsag_info->snssai_list = NULL; + } + if (nsag_info->tai_list) { + OpenAPI_list_for_each(nsag_info->tai_list, node) { + OpenAPI_tai_free(node->data); + } + OpenAPI_list_free(nsag_info->tai_list); + nsag_info->tai_list = NULL; + } + if (nsag_info->tai_range_list) { + OpenAPI_list_for_each(nsag_info->tai_range_list, node) { + OpenAPI_tai_range_free(node->data); + } + OpenAPI_list_free(nsag_info->tai_range_list); + nsag_info->tai_range_list = NULL; + } + ogs_free(nsag_info); +} + +cJSON *OpenAPI_nsag_info_convertToJSON(OpenAPI_nsag_info_t *nsag_info) +{ + cJSON *item = NULL; + OpenAPI_lnode_t *node = NULL; + + if (nsag_info == NULL) { + ogs_error("OpenAPI_nsag_info_convertToJSON() failed [NsagInfo]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (!nsag_info->nsag_ids) { + ogs_error("OpenAPI_nsag_info_convertToJSON() failed [nsag_ids]"); + return NULL; + } + cJSON *nsag_idsList = cJSON_AddArrayToObject(item, "nsagIds"); + if (nsag_idsList == NULL) { + ogs_error("OpenAPI_nsag_info_convertToJSON() failed [nsag_ids]"); + goto end; + } + OpenAPI_list_for_each(nsag_info->nsag_ids, node) { + if (cJSON_AddNumberToObject(nsag_idsList, "", (uintptr_t)node->data) == NULL) { + ogs_error("OpenAPI_nsag_info_convertToJSON() failed [nsag_ids]"); + goto end; + } + } + + if (!nsag_info->snssai_list) { + ogs_error("OpenAPI_nsag_info_convertToJSON() failed [snssai_list]"); + return NULL; + } + cJSON *snssai_listList = cJSON_AddArrayToObject(item, "snssaiList"); + if (snssai_listList == NULL) { + ogs_error("OpenAPI_nsag_info_convertToJSON() failed [snssai_list]"); + goto end; + } + OpenAPI_list_for_each(nsag_info->snssai_list, node) { + cJSON *itemLocal = OpenAPI_snssai_convertToJSON(node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_nsag_info_convertToJSON() failed [snssai_list]"); + goto end; + } + cJSON_AddItemToArray(snssai_listList, itemLocal); + } + + if (nsag_info->tai_list) { + cJSON *tai_listList = cJSON_AddArrayToObject(item, "taiList"); + if (tai_listList == NULL) { + ogs_error("OpenAPI_nsag_info_convertToJSON() failed [tai_list]"); + goto end; + } + OpenAPI_list_for_each(nsag_info->tai_list, node) { + cJSON *itemLocal = OpenAPI_tai_convertToJSON(node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_nsag_info_convertToJSON() failed [tai_list]"); + goto end; + } + cJSON_AddItemToArray(tai_listList, itemLocal); + } + } + + if (nsag_info->tai_range_list) { + cJSON *tai_range_listList = cJSON_AddArrayToObject(item, "taiRangeList"); + if (tai_range_listList == NULL) { + ogs_error("OpenAPI_nsag_info_convertToJSON() failed [tai_range_list]"); + goto end; + } + OpenAPI_list_for_each(nsag_info->tai_range_list, node) { + cJSON *itemLocal = OpenAPI_tai_range_convertToJSON(node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_nsag_info_convertToJSON() failed [tai_range_list]"); + goto end; + } + cJSON_AddItemToArray(tai_range_listList, itemLocal); + } + } + +end: + return item; +} + +OpenAPI_nsag_info_t *OpenAPI_nsag_info_parseFromJSON(cJSON *nsag_infoJSON) +{ + OpenAPI_nsag_info_t *nsag_info_local_var = NULL; + OpenAPI_lnode_t *node = NULL; + cJSON *nsag_ids = NULL; + OpenAPI_list_t *nsag_idsList = NULL; + cJSON *snssai_list = NULL; + OpenAPI_list_t *snssai_listList = NULL; + cJSON *tai_list = NULL; + OpenAPI_list_t *tai_listList = NULL; + cJSON *tai_range_list = NULL; + OpenAPI_list_t *tai_range_listList = NULL; + nsag_ids = cJSON_GetObjectItemCaseSensitive(nsag_infoJSON, "nsagIds"); + if (!nsag_ids) { + ogs_error("OpenAPI_nsag_info_parseFromJSON() failed [nsag_ids]"); + goto end; + } + cJSON *nsag_ids_local = NULL; + if (!cJSON_IsArray(nsag_ids)) { + ogs_error("OpenAPI_nsag_info_parseFromJSON() failed [nsag_ids]"); + goto end; + } + + nsag_idsList = OpenAPI_list_create(); + + cJSON_ArrayForEach(nsag_ids_local, nsag_ids) { + double *localDouble = NULL; + int *localInt = NULL; + if (!cJSON_IsNumber(nsag_ids_local)) { + ogs_error("OpenAPI_nsag_info_parseFromJSON() failed [nsag_ids]"); + goto end; + } + localDouble = (double *)ogs_calloc(1, sizeof(double)); + if (!localDouble) { + ogs_error("OpenAPI_nsag_info_parseFromJSON() failed [nsag_ids]"); + goto end; + } + *localDouble = nsag_ids_local->valuedouble; + OpenAPI_list_add(nsag_idsList, localDouble); + } + + snssai_list = cJSON_GetObjectItemCaseSensitive(nsag_infoJSON, "snssaiList"); + if (!snssai_list) { + ogs_error("OpenAPI_nsag_info_parseFromJSON() failed [snssai_list]"); + goto end; + } + cJSON *snssai_list_local = NULL; + if (!cJSON_IsArray(snssai_list)) { + ogs_error("OpenAPI_nsag_info_parseFromJSON() failed [snssai_list]"); + goto end; + } + + snssai_listList = OpenAPI_list_create(); + + cJSON_ArrayForEach(snssai_list_local, snssai_list) { + if (!cJSON_IsObject(snssai_list_local)) { + ogs_error("OpenAPI_nsag_info_parseFromJSON() failed [snssai_list]"); + goto end; + } + OpenAPI_snssai_t *snssai_listItem = OpenAPI_snssai_parseFromJSON(snssai_list_local); + if (!snssai_listItem) { + ogs_error("No snssai_listItem"); + OpenAPI_list_free(snssai_listList); + goto end; + } + OpenAPI_list_add(snssai_listList, snssai_listItem); + } + + tai_list = cJSON_GetObjectItemCaseSensitive(nsag_infoJSON, "taiList"); + if (tai_list) { + cJSON *tai_list_local = NULL; + if (!cJSON_IsArray(tai_list)) { + ogs_error("OpenAPI_nsag_info_parseFromJSON() failed [tai_list]"); + goto end; + } + + tai_listList = OpenAPI_list_create(); + + cJSON_ArrayForEach(tai_list_local, tai_list) { + if (!cJSON_IsObject(tai_list_local)) { + ogs_error("OpenAPI_nsag_info_parseFromJSON() failed [tai_list]"); + goto end; + } + OpenAPI_tai_t *tai_listItem = OpenAPI_tai_parseFromJSON(tai_list_local); + if (!tai_listItem) { + ogs_error("No tai_listItem"); + OpenAPI_list_free(tai_listList); + goto end; + } + OpenAPI_list_add(tai_listList, tai_listItem); + } + } + + tai_range_list = cJSON_GetObjectItemCaseSensitive(nsag_infoJSON, "taiRangeList"); + if (tai_range_list) { + cJSON *tai_range_list_local = NULL; + if (!cJSON_IsArray(tai_range_list)) { + ogs_error("OpenAPI_nsag_info_parseFromJSON() failed [tai_range_list]"); + goto end; + } + + tai_range_listList = OpenAPI_list_create(); + + cJSON_ArrayForEach(tai_range_list_local, tai_range_list) { + if (!cJSON_IsObject(tai_range_list_local)) { + ogs_error("OpenAPI_nsag_info_parseFromJSON() failed [tai_range_list]"); + goto end; + } + OpenAPI_tai_range_t *tai_range_listItem = OpenAPI_tai_range_parseFromJSON(tai_range_list_local); + if (!tai_range_listItem) { + ogs_error("No tai_range_listItem"); + OpenAPI_list_free(tai_range_listList); + goto end; + } + OpenAPI_list_add(tai_range_listList, tai_range_listItem); + } + } + + nsag_info_local_var = OpenAPI_nsag_info_create ( + nsag_idsList, + snssai_listList, + tai_list ? tai_listList : NULL, + tai_range_list ? tai_range_listList : NULL + ); + + return nsag_info_local_var; +end: + if (nsag_idsList) { + OpenAPI_list_for_each(nsag_idsList, node) { + ogs_free(node->data); + } + OpenAPI_list_free(nsag_idsList); + nsag_idsList = NULL; + } + if (snssai_listList) { + OpenAPI_list_for_each(snssai_listList, node) { + OpenAPI_snssai_free(node->data); + } + OpenAPI_list_free(snssai_listList); + snssai_listList = NULL; + } + if (tai_listList) { + OpenAPI_list_for_each(tai_listList, node) { + OpenAPI_tai_free(node->data); + } + OpenAPI_list_free(tai_listList); + tai_listList = NULL; + } + if (tai_range_listList) { + OpenAPI_list_for_each(tai_range_listList, node) { + OpenAPI_tai_range_free(node->data); + } + OpenAPI_list_free(tai_range_listList); + tai_range_listList = NULL; + } + return NULL; +} + +OpenAPI_nsag_info_t *OpenAPI_nsag_info_copy(OpenAPI_nsag_info_t *dst, OpenAPI_nsag_info_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_nsag_info_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_nsag_info_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_nsag_info_free(dst); + dst = OpenAPI_nsag_info_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/nsag_info.h b/lib/sbi/openapi/model/nsag_info.h new file mode 100644 index 000000000..92afeb397 --- /dev/null +++ b/lib/sbi/openapi/model/nsag_info.h @@ -0,0 +1,47 @@ +/* + * nsag_info.h + * + * Contains the association of NSAGs and S-NSSAI(s) along with the TA(s) within which the association is valid. + */ + +#ifndef _OpenAPI_nsag_info_H_ +#define _OpenAPI_nsag_info_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "snssai.h" +#include "tai.h" +#include "tai_range.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_nsag_info_s OpenAPI_nsag_info_t; +typedef struct OpenAPI_nsag_info_s { + OpenAPI_list_t *nsag_ids; + OpenAPI_list_t *snssai_list; + OpenAPI_list_t *tai_list; + OpenAPI_list_t *tai_range_list; +} OpenAPI_nsag_info_t; + +OpenAPI_nsag_info_t *OpenAPI_nsag_info_create( + OpenAPI_list_t *nsag_ids, + OpenAPI_list_t *snssai_list, + OpenAPI_list_t *tai_list, + OpenAPI_list_t *tai_range_list +); +void OpenAPI_nsag_info_free(OpenAPI_nsag_info_t *nsag_info); +OpenAPI_nsag_info_t *OpenAPI_nsag_info_parseFromJSON(cJSON *nsag_infoJSON); +cJSON *OpenAPI_nsag_info_convertToJSON(OpenAPI_nsag_info_t *nsag_info); +OpenAPI_nsag_info_t *OpenAPI_nsag_info_copy(OpenAPI_nsag_info_t *dst, OpenAPI_nsag_info_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_nsag_info_H_ */ + diff --git a/lib/sbi/openapi/model/nsi_id_info.c b/lib/sbi/openapi/model/nsi_id_info.c new file mode 100644 index 000000000..9820d27ad --- /dev/null +++ b/lib/sbi/openapi/model/nsi_id_info.c @@ -0,0 +1,176 @@ + +#include +#include +#include +#include "nsi_id_info.h" + +OpenAPI_nsi_id_info_t *OpenAPI_nsi_id_info_create( + OpenAPI_snssai_t *snssai, + OpenAPI_list_t *nsi_ids +) +{ + OpenAPI_nsi_id_info_t *nsi_id_info_local_var = ogs_malloc(sizeof(OpenAPI_nsi_id_info_t)); + ogs_assert(nsi_id_info_local_var); + + nsi_id_info_local_var->snssai = snssai; + nsi_id_info_local_var->nsi_ids = nsi_ids; + + return nsi_id_info_local_var; +} + +void OpenAPI_nsi_id_info_free(OpenAPI_nsi_id_info_t *nsi_id_info) +{ + OpenAPI_lnode_t *node = NULL; + + if (NULL == nsi_id_info) { + return; + } + if (nsi_id_info->snssai) { + OpenAPI_snssai_free(nsi_id_info->snssai); + nsi_id_info->snssai = NULL; + } + if (nsi_id_info->nsi_ids) { + OpenAPI_list_for_each(nsi_id_info->nsi_ids, node) { + ogs_free(node->data); + } + OpenAPI_list_free(nsi_id_info->nsi_ids); + nsi_id_info->nsi_ids = NULL; + } + ogs_free(nsi_id_info); +} + +cJSON *OpenAPI_nsi_id_info_convertToJSON(OpenAPI_nsi_id_info_t *nsi_id_info) +{ + cJSON *item = NULL; + OpenAPI_lnode_t *node = NULL; + + if (nsi_id_info == NULL) { + ogs_error("OpenAPI_nsi_id_info_convertToJSON() failed [NsiIdInfo]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (!nsi_id_info->snssai) { + ogs_error("OpenAPI_nsi_id_info_convertToJSON() failed [snssai]"); + return NULL; + } + cJSON *snssai_local_JSON = OpenAPI_snssai_convertToJSON(nsi_id_info->snssai); + if (snssai_local_JSON == NULL) { + ogs_error("OpenAPI_nsi_id_info_convertToJSON() failed [snssai]"); + goto end; + } + cJSON_AddItemToObject(item, "snssai", snssai_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_nsi_id_info_convertToJSON() failed [snssai]"); + goto end; + } + + if (nsi_id_info->nsi_ids) { + cJSON *nsi_idsList = cJSON_AddArrayToObject(item, "nsiIds"); + if (nsi_idsList == NULL) { + ogs_error("OpenAPI_nsi_id_info_convertToJSON() failed [nsi_ids]"); + goto end; + } + OpenAPI_list_for_each(nsi_id_info->nsi_ids, node) { + if (cJSON_AddStringToObject(nsi_idsList, "", (char*)node->data) == NULL) { + ogs_error("OpenAPI_nsi_id_info_convertToJSON() failed [nsi_ids]"); + goto end; + } + } + } + +end: + return item; +} + +OpenAPI_nsi_id_info_t *OpenAPI_nsi_id_info_parseFromJSON(cJSON *nsi_id_infoJSON) +{ + OpenAPI_nsi_id_info_t *nsi_id_info_local_var = NULL; + OpenAPI_lnode_t *node = NULL; + cJSON *snssai = NULL; + OpenAPI_snssai_t *snssai_local_nonprim = NULL; + cJSON *nsi_ids = NULL; + OpenAPI_list_t *nsi_idsList = NULL; + snssai = cJSON_GetObjectItemCaseSensitive(nsi_id_infoJSON, "snssai"); + if (!snssai) { + ogs_error("OpenAPI_nsi_id_info_parseFromJSON() failed [snssai]"); + goto end; + } + snssai_local_nonprim = OpenAPI_snssai_parseFromJSON(snssai); + + nsi_ids = cJSON_GetObjectItemCaseSensitive(nsi_id_infoJSON, "nsiIds"); + if (nsi_ids) { + cJSON *nsi_ids_local = NULL; + if (!cJSON_IsArray(nsi_ids)) { + ogs_error("OpenAPI_nsi_id_info_parseFromJSON() failed [nsi_ids]"); + goto end; + } + + nsi_idsList = OpenAPI_list_create(); + + cJSON_ArrayForEach(nsi_ids_local, nsi_ids) { + double *localDouble = NULL; + int *localInt = NULL; + if (!cJSON_IsString(nsi_ids_local)) { + ogs_error("OpenAPI_nsi_id_info_parseFromJSON() failed [nsi_ids]"); + goto end; + } + OpenAPI_list_add(nsi_idsList, ogs_strdup(nsi_ids_local->valuestring)); + } + } + + nsi_id_info_local_var = OpenAPI_nsi_id_info_create ( + snssai_local_nonprim, + nsi_ids ? nsi_idsList : NULL + ); + + return nsi_id_info_local_var; +end: + if (snssai_local_nonprim) { + OpenAPI_snssai_free(snssai_local_nonprim); + snssai_local_nonprim = NULL; + } + if (nsi_idsList) { + OpenAPI_list_for_each(nsi_idsList, node) { + ogs_free(node->data); + } + OpenAPI_list_free(nsi_idsList); + nsi_idsList = NULL; + } + return NULL; +} + +OpenAPI_nsi_id_info_t *OpenAPI_nsi_id_info_copy(OpenAPI_nsi_id_info_t *dst, OpenAPI_nsi_id_info_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_nsi_id_info_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_nsi_id_info_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_nsi_id_info_free(dst); + dst = OpenAPI_nsi_id_info_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/nsi_id_info.h b/lib/sbi/openapi/model/nsi_id_info.h new file mode 100644 index 000000000..39bb5b62e --- /dev/null +++ b/lib/sbi/openapi/model/nsi_id_info.h @@ -0,0 +1,41 @@ +/* + * nsi_id_info.h + * + * Represents the S-NSSAI and the optionally associated Network Slice Instance(s). + */ + +#ifndef _OpenAPI_nsi_id_info_H_ +#define _OpenAPI_nsi_id_info_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "snssai.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_nsi_id_info_s OpenAPI_nsi_id_info_t; +typedef struct OpenAPI_nsi_id_info_s { + struct OpenAPI_snssai_s *snssai; + OpenAPI_list_t *nsi_ids; +} OpenAPI_nsi_id_info_t; + +OpenAPI_nsi_id_info_t *OpenAPI_nsi_id_info_create( + OpenAPI_snssai_t *snssai, + OpenAPI_list_t *nsi_ids +); +void OpenAPI_nsi_id_info_free(OpenAPI_nsi_id_info_t *nsi_id_info); +OpenAPI_nsi_id_info_t *OpenAPI_nsi_id_info_parseFromJSON(cJSON *nsi_id_infoJSON); +cJSON *OpenAPI_nsi_id_info_convertToJSON(OpenAPI_nsi_id_info_t *nsi_id_info); +OpenAPI_nsi_id_info_t *OpenAPI_nsi_id_info_copy(OpenAPI_nsi_id_info_t *dst, OpenAPI_nsi_id_info_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_nsi_id_info_H_ */ + diff --git a/lib/sbi/openapi/model/nsi_information.c b/lib/sbi/openapi/model/nsi_information.c index cec0465fc..3db3aa8ed 100644 --- a/lib/sbi/openapi/model/nsi_information.c +++ b/lib/sbi/openapi/model/nsi_information.c @@ -8,7 +8,8 @@ OpenAPI_nsi_information_t *OpenAPI_nsi_information_create( char *nrf_id, char *nsi_id, char *nrf_nf_mgt_uri, - char *nrf_access_token_uri + char *nrf_access_token_uri, + OpenAPI_list_t* nrf_oauth2_required ) { OpenAPI_nsi_information_t *nsi_information_local_var = ogs_malloc(sizeof(OpenAPI_nsi_information_t)); @@ -18,6 +19,7 @@ OpenAPI_nsi_information_t *OpenAPI_nsi_information_create( nsi_information_local_var->nsi_id = nsi_id; nsi_information_local_var->nrf_nf_mgt_uri = nrf_nf_mgt_uri; nsi_information_local_var->nrf_access_token_uri = nrf_access_token_uri; + nsi_information_local_var->nrf_oauth2_required = nrf_oauth2_required; return nsi_information_local_var; } @@ -45,6 +47,16 @@ void OpenAPI_nsi_information_free(OpenAPI_nsi_information_t *nsi_information) ogs_free(nsi_information->nrf_access_token_uri); nsi_information->nrf_access_token_uri = NULL; } + if (nsi_information->nrf_oauth2_required) { + OpenAPI_list_for_each(nsi_information->nrf_oauth2_required, node) { + OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*)node->data; + ogs_free(localKeyValue->key); + ogs_free(localKeyValue->value); + OpenAPI_map_free(localKeyValue); + } + OpenAPI_list_free(nsi_information->nrf_oauth2_required); + nsi_information->nrf_oauth2_required = NULL; + } ogs_free(nsi_information); } @@ -89,6 +101,24 @@ cJSON *OpenAPI_nsi_information_convertToJSON(OpenAPI_nsi_information_t *nsi_info } } + if (nsi_information->nrf_oauth2_required) { + cJSON *nrf_oauth2_required = cJSON_AddObjectToObject(item, "nrfOauth2Required"); + if (nrf_oauth2_required == NULL) { + ogs_error("OpenAPI_nsi_information_convertToJSON() failed [nrf_oauth2_required]"); + goto end; + } + cJSON *localMapObject = nrf_oauth2_required; + if (nsi_information->nrf_oauth2_required) { + OpenAPI_list_for_each(nsi_information->nrf_oauth2_required, node) { + OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*)node->data; + if (cJSON_AddBoolToObject(localMapObject, localKeyValue->key, (uintptr_t)localKeyValue->value) == NULL) { + ogs_error("OpenAPI_nsi_information_convertToJSON() failed [inner]"); + goto end; + } + } + } + } + end: return item; } @@ -101,6 +131,8 @@ OpenAPI_nsi_information_t *OpenAPI_nsi_information_parseFromJSON(cJSON *nsi_info cJSON *nsi_id = NULL; cJSON *nrf_nf_mgt_uri = NULL; cJSON *nrf_access_token_uri = NULL; + cJSON *nrf_oauth2_required = NULL; + OpenAPI_list_t *nrf_oauth2_requiredList = NULL; nrf_id = cJSON_GetObjectItemCaseSensitive(nsi_informationJSON, "nrfId"); if (!nrf_id) { ogs_error("OpenAPI_nsi_information_parseFromJSON() failed [nrf_id]"); @@ -135,15 +167,56 @@ OpenAPI_nsi_information_t *OpenAPI_nsi_information_parseFromJSON(cJSON *nsi_info } } + nrf_oauth2_required = cJSON_GetObjectItemCaseSensitive(nsi_informationJSON, "nrfOauth2Required"); + if (nrf_oauth2_required) { + cJSON *nrf_oauth2_required_local_map = NULL; + if (!cJSON_IsObject(nrf_oauth2_required) && !cJSON_IsNull(nrf_oauth2_required)) { + ogs_error("OpenAPI_nsi_information_parseFromJSON() failed [nrf_oauth2_required]"); + goto end; + } + if (cJSON_IsObject(nrf_oauth2_required)) { + nrf_oauth2_requiredList = OpenAPI_list_create(); + OpenAPI_map_t *localMapKeyPair = NULL; + cJSON_ArrayForEach(nrf_oauth2_required_local_map, nrf_oauth2_required) { + cJSON *localMapObject = nrf_oauth2_required_local_map; + double *localDouble = NULL; + int *localInt = NULL; + if (!cJSON_IsBool(localMapObject)) { + ogs_error("OpenAPI_nsi_information_parseFromJSON() failed [inner]"); + goto end; + } + localInt = (int *)ogs_calloc(1, sizeof(int)); + if (!localInt) { + ogs_error("OpenAPI_nsi_information_parseFromJSON() failed [inner]"); + goto end; + } + *localInt = localMapObject->valueint; + localMapKeyPair = OpenAPI_map_create(ogs_strdup(localMapObject->string), localInt); + OpenAPI_list_add(nrf_oauth2_requiredList, localMapKeyPair); + } + } + } + nsi_information_local_var = OpenAPI_nsi_information_create ( ogs_strdup(nrf_id->valuestring), nsi_id && !cJSON_IsNull(nsi_id) ? ogs_strdup(nsi_id->valuestring) : NULL, nrf_nf_mgt_uri && !cJSON_IsNull(nrf_nf_mgt_uri) ? ogs_strdup(nrf_nf_mgt_uri->valuestring) : NULL, - nrf_access_token_uri && !cJSON_IsNull(nrf_access_token_uri) ? ogs_strdup(nrf_access_token_uri->valuestring) : NULL + nrf_access_token_uri && !cJSON_IsNull(nrf_access_token_uri) ? ogs_strdup(nrf_access_token_uri->valuestring) : NULL, + nrf_oauth2_required ? nrf_oauth2_requiredList : NULL ); return nsi_information_local_var; end: + if (nrf_oauth2_requiredList) { + OpenAPI_list_for_each(nrf_oauth2_requiredList, node) { + OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*) node->data; + ogs_free(localKeyValue->key); + ogs_free(localKeyValue->value); + OpenAPI_map_free(localKeyValue); + } + OpenAPI_list_free(nrf_oauth2_requiredList); + nrf_oauth2_requiredList = NULL; + } return NULL; } diff --git a/lib/sbi/openapi/model/nsi_information.h b/lib/sbi/openapi/model/nsi_information.h index 06bde8b8b..6b2443441 100644 --- a/lib/sbi/openapi/model/nsi_information.h +++ b/lib/sbi/openapi/model/nsi_information.h @@ -1,7 +1,7 @@ /* * nsi_information.h * - * + * Contains the API URIs of NRF services to be used to discover NFs/services, subscribe to NF status changes and/or request access tokens within the selected Network Slice instance and optional the Identifier of the selected Network Slice instance */ #ifndef _OpenAPI_nsi_information_H_ @@ -23,13 +23,15 @@ typedef struct OpenAPI_nsi_information_s { char *nsi_id; char *nrf_nf_mgt_uri; char *nrf_access_token_uri; + OpenAPI_list_t* nrf_oauth2_required; } OpenAPI_nsi_information_t; OpenAPI_nsi_information_t *OpenAPI_nsi_information_create( char *nrf_id, char *nsi_id, char *nrf_nf_mgt_uri, - char *nrf_access_token_uri + char *nrf_access_token_uri, + OpenAPI_list_t* nrf_oauth2_required ); void OpenAPI_nsi_information_free(OpenAPI_nsi_information_t *nsi_information); OpenAPI_nsi_information_t *OpenAPI_nsi_information_parseFromJSON(cJSON *nsi_informationJSON); diff --git a/lib/sbi/openapi/model/nsi_load_level_info.c b/lib/sbi/openapi/model/nsi_load_level_info.c new file mode 100644 index 000000000..934f54dcb --- /dev/null +++ b/lib/sbi/openapi/model/nsi_load_level_info.c @@ -0,0 +1,446 @@ + +#include +#include +#include +#include "nsi_load_level_info.h" + +OpenAPI_nsi_load_level_info_t *OpenAPI_nsi_load_level_info_create( + int load_level_information, + OpenAPI_snssai_t *snssai, + char *nsi_id, + OpenAPI_resource_usage_t *res_usage, + bool is_num_of_exceed_load_level_thr, + int num_of_exceed_load_level_thr, + bool is_exceed_load_level_thr_ind, + int exceed_load_level_thr_ind, + OpenAPI_network_area_info_t *network_area, + OpenAPI_time_window_t *time_period, + OpenAPI_list_t *res_usg_thr_cross_time_period, + OpenAPI_number_average_t *num_of_ues, + OpenAPI_number_average_t *num_of_pdu_sess, + bool is_confidence, + int confidence +) +{ + OpenAPI_nsi_load_level_info_t *nsi_load_level_info_local_var = ogs_malloc(sizeof(OpenAPI_nsi_load_level_info_t)); + ogs_assert(nsi_load_level_info_local_var); + + nsi_load_level_info_local_var->load_level_information = load_level_information; + nsi_load_level_info_local_var->snssai = snssai; + nsi_load_level_info_local_var->nsi_id = nsi_id; + nsi_load_level_info_local_var->res_usage = res_usage; + nsi_load_level_info_local_var->is_num_of_exceed_load_level_thr = is_num_of_exceed_load_level_thr; + nsi_load_level_info_local_var->num_of_exceed_load_level_thr = num_of_exceed_load_level_thr; + nsi_load_level_info_local_var->is_exceed_load_level_thr_ind = is_exceed_load_level_thr_ind; + nsi_load_level_info_local_var->exceed_load_level_thr_ind = exceed_load_level_thr_ind; + nsi_load_level_info_local_var->network_area = network_area; + nsi_load_level_info_local_var->time_period = time_period; + nsi_load_level_info_local_var->res_usg_thr_cross_time_period = res_usg_thr_cross_time_period; + nsi_load_level_info_local_var->num_of_ues = num_of_ues; + nsi_load_level_info_local_var->num_of_pdu_sess = num_of_pdu_sess; + nsi_load_level_info_local_var->is_confidence = is_confidence; + nsi_load_level_info_local_var->confidence = confidence; + + return nsi_load_level_info_local_var; +} + +void OpenAPI_nsi_load_level_info_free(OpenAPI_nsi_load_level_info_t *nsi_load_level_info) +{ + OpenAPI_lnode_t *node = NULL; + + if (NULL == nsi_load_level_info) { + return; + } + if (nsi_load_level_info->snssai) { + OpenAPI_snssai_free(nsi_load_level_info->snssai); + nsi_load_level_info->snssai = NULL; + } + if (nsi_load_level_info->nsi_id) { + ogs_free(nsi_load_level_info->nsi_id); + nsi_load_level_info->nsi_id = NULL; + } + if (nsi_load_level_info->res_usage) { + OpenAPI_resource_usage_free(nsi_load_level_info->res_usage); + nsi_load_level_info->res_usage = NULL; + } + if (nsi_load_level_info->network_area) { + OpenAPI_network_area_info_free(nsi_load_level_info->network_area); + nsi_load_level_info->network_area = NULL; + } + if (nsi_load_level_info->time_period) { + OpenAPI_time_window_free(nsi_load_level_info->time_period); + nsi_load_level_info->time_period = NULL; + } + if (nsi_load_level_info->res_usg_thr_cross_time_period) { + OpenAPI_list_for_each(nsi_load_level_info->res_usg_thr_cross_time_period, node) { + OpenAPI_time_window_free(node->data); + } + OpenAPI_list_free(nsi_load_level_info->res_usg_thr_cross_time_period); + nsi_load_level_info->res_usg_thr_cross_time_period = NULL; + } + if (nsi_load_level_info->num_of_ues) { + OpenAPI_number_average_free(nsi_load_level_info->num_of_ues); + nsi_load_level_info->num_of_ues = NULL; + } + if (nsi_load_level_info->num_of_pdu_sess) { + OpenAPI_number_average_free(nsi_load_level_info->num_of_pdu_sess); + nsi_load_level_info->num_of_pdu_sess = NULL; + } + ogs_free(nsi_load_level_info); +} + +cJSON *OpenAPI_nsi_load_level_info_convertToJSON(OpenAPI_nsi_load_level_info_t *nsi_load_level_info) +{ + cJSON *item = NULL; + OpenAPI_lnode_t *node = NULL; + + if (nsi_load_level_info == NULL) { + ogs_error("OpenAPI_nsi_load_level_info_convertToJSON() failed [NsiLoadLevelInfo]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (cJSON_AddNumberToObject(item, "loadLevelInformation", nsi_load_level_info->load_level_information) == NULL) { + ogs_error("OpenAPI_nsi_load_level_info_convertToJSON() failed [load_level_information]"); + goto end; + } + + if (!nsi_load_level_info->snssai) { + ogs_error("OpenAPI_nsi_load_level_info_convertToJSON() failed [snssai]"); + return NULL; + } + cJSON *snssai_local_JSON = OpenAPI_snssai_convertToJSON(nsi_load_level_info->snssai); + if (snssai_local_JSON == NULL) { + ogs_error("OpenAPI_nsi_load_level_info_convertToJSON() failed [snssai]"); + goto end; + } + cJSON_AddItemToObject(item, "snssai", snssai_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_nsi_load_level_info_convertToJSON() failed [snssai]"); + goto end; + } + + if (nsi_load_level_info->nsi_id) { + if (cJSON_AddStringToObject(item, "nsiId", nsi_load_level_info->nsi_id) == NULL) { + ogs_error("OpenAPI_nsi_load_level_info_convertToJSON() failed [nsi_id]"); + goto end; + } + } + + if (nsi_load_level_info->res_usage) { + cJSON *res_usage_local_JSON = OpenAPI_resource_usage_convertToJSON(nsi_load_level_info->res_usage); + if (res_usage_local_JSON == NULL) { + ogs_error("OpenAPI_nsi_load_level_info_convertToJSON() failed [res_usage]"); + goto end; + } + cJSON_AddItemToObject(item, "resUsage", res_usage_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_nsi_load_level_info_convertToJSON() failed [res_usage]"); + goto end; + } + } + + if (nsi_load_level_info->is_num_of_exceed_load_level_thr) { + if (cJSON_AddNumberToObject(item, "numOfExceedLoadLevelThr", nsi_load_level_info->num_of_exceed_load_level_thr) == NULL) { + ogs_error("OpenAPI_nsi_load_level_info_convertToJSON() failed [num_of_exceed_load_level_thr]"); + goto end; + } + } + + if (nsi_load_level_info->is_exceed_load_level_thr_ind) { + if (cJSON_AddBoolToObject(item, "exceedLoadLevelThrInd", nsi_load_level_info->exceed_load_level_thr_ind) == NULL) { + ogs_error("OpenAPI_nsi_load_level_info_convertToJSON() failed [exceed_load_level_thr_ind]"); + goto end; + } + } + + if (nsi_load_level_info->network_area) { + cJSON *network_area_local_JSON = OpenAPI_network_area_info_convertToJSON(nsi_load_level_info->network_area); + if (network_area_local_JSON == NULL) { + ogs_error("OpenAPI_nsi_load_level_info_convertToJSON() failed [network_area]"); + goto end; + } + cJSON_AddItemToObject(item, "networkArea", network_area_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_nsi_load_level_info_convertToJSON() failed [network_area]"); + goto end; + } + } + + if (nsi_load_level_info->time_period) { + cJSON *time_period_local_JSON = OpenAPI_time_window_convertToJSON(nsi_load_level_info->time_period); + if (time_period_local_JSON == NULL) { + ogs_error("OpenAPI_nsi_load_level_info_convertToJSON() failed [time_period]"); + goto end; + } + cJSON_AddItemToObject(item, "timePeriod", time_period_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_nsi_load_level_info_convertToJSON() failed [time_period]"); + goto end; + } + } + + if (nsi_load_level_info->res_usg_thr_cross_time_period) { + cJSON *res_usg_thr_cross_time_periodList = cJSON_AddArrayToObject(item, "resUsgThrCrossTimePeriod"); + if (res_usg_thr_cross_time_periodList == NULL) { + ogs_error("OpenAPI_nsi_load_level_info_convertToJSON() failed [res_usg_thr_cross_time_period]"); + goto end; + } + OpenAPI_list_for_each(nsi_load_level_info->res_usg_thr_cross_time_period, node) { + cJSON *itemLocal = OpenAPI_time_window_convertToJSON(node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_nsi_load_level_info_convertToJSON() failed [res_usg_thr_cross_time_period]"); + goto end; + } + cJSON_AddItemToArray(res_usg_thr_cross_time_periodList, itemLocal); + } + } + + if (nsi_load_level_info->num_of_ues) { + cJSON *num_of_ues_local_JSON = OpenAPI_number_average_convertToJSON(nsi_load_level_info->num_of_ues); + if (num_of_ues_local_JSON == NULL) { + ogs_error("OpenAPI_nsi_load_level_info_convertToJSON() failed [num_of_ues]"); + goto end; + } + cJSON_AddItemToObject(item, "numOfUes", num_of_ues_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_nsi_load_level_info_convertToJSON() failed [num_of_ues]"); + goto end; + } + } + + if (nsi_load_level_info->num_of_pdu_sess) { + cJSON *num_of_pdu_sess_local_JSON = OpenAPI_number_average_convertToJSON(nsi_load_level_info->num_of_pdu_sess); + if (num_of_pdu_sess_local_JSON == NULL) { + ogs_error("OpenAPI_nsi_load_level_info_convertToJSON() failed [num_of_pdu_sess]"); + goto end; + } + cJSON_AddItemToObject(item, "numOfPduSess", num_of_pdu_sess_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_nsi_load_level_info_convertToJSON() failed [num_of_pdu_sess]"); + goto end; + } + } + + if (nsi_load_level_info->is_confidence) { + if (cJSON_AddNumberToObject(item, "confidence", nsi_load_level_info->confidence) == NULL) { + ogs_error("OpenAPI_nsi_load_level_info_convertToJSON() failed [confidence]"); + goto end; + } + } + +end: + return item; +} + +OpenAPI_nsi_load_level_info_t *OpenAPI_nsi_load_level_info_parseFromJSON(cJSON *nsi_load_level_infoJSON) +{ + OpenAPI_nsi_load_level_info_t *nsi_load_level_info_local_var = NULL; + OpenAPI_lnode_t *node = NULL; + cJSON *load_level_information = NULL; + cJSON *snssai = NULL; + OpenAPI_snssai_t *snssai_local_nonprim = NULL; + cJSON *nsi_id = NULL; + cJSON *res_usage = NULL; + OpenAPI_resource_usage_t *res_usage_local_nonprim = NULL; + cJSON *num_of_exceed_load_level_thr = NULL; + cJSON *exceed_load_level_thr_ind = NULL; + cJSON *network_area = NULL; + OpenAPI_network_area_info_t *network_area_local_nonprim = NULL; + cJSON *time_period = NULL; + OpenAPI_time_window_t *time_period_local_nonprim = NULL; + cJSON *res_usg_thr_cross_time_period = NULL; + OpenAPI_list_t *res_usg_thr_cross_time_periodList = NULL; + cJSON *num_of_ues = NULL; + OpenAPI_number_average_t *num_of_ues_local_nonprim = NULL; + cJSON *num_of_pdu_sess = NULL; + OpenAPI_number_average_t *num_of_pdu_sess_local_nonprim = NULL; + cJSON *confidence = NULL; + load_level_information = cJSON_GetObjectItemCaseSensitive(nsi_load_level_infoJSON, "loadLevelInformation"); + if (!load_level_information) { + ogs_error("OpenAPI_nsi_load_level_info_parseFromJSON() failed [load_level_information]"); + goto end; + } + if (!cJSON_IsNumber(load_level_information)) { + ogs_error("OpenAPI_nsi_load_level_info_parseFromJSON() failed [load_level_information]"); + goto end; + } + + snssai = cJSON_GetObjectItemCaseSensitive(nsi_load_level_infoJSON, "snssai"); + if (!snssai) { + ogs_error("OpenAPI_nsi_load_level_info_parseFromJSON() failed [snssai]"); + goto end; + } + snssai_local_nonprim = OpenAPI_snssai_parseFromJSON(snssai); + + nsi_id = cJSON_GetObjectItemCaseSensitive(nsi_load_level_infoJSON, "nsiId"); + if (nsi_id) { + if (!cJSON_IsString(nsi_id) && !cJSON_IsNull(nsi_id)) { + ogs_error("OpenAPI_nsi_load_level_info_parseFromJSON() failed [nsi_id]"); + goto end; + } + } + + res_usage = cJSON_GetObjectItemCaseSensitive(nsi_load_level_infoJSON, "resUsage"); + if (res_usage) { + res_usage_local_nonprim = OpenAPI_resource_usage_parseFromJSON(res_usage); + } + + num_of_exceed_load_level_thr = cJSON_GetObjectItemCaseSensitive(nsi_load_level_infoJSON, "numOfExceedLoadLevelThr"); + if (num_of_exceed_load_level_thr) { + if (!cJSON_IsNumber(num_of_exceed_load_level_thr)) { + ogs_error("OpenAPI_nsi_load_level_info_parseFromJSON() failed [num_of_exceed_load_level_thr]"); + goto end; + } + } + + exceed_load_level_thr_ind = cJSON_GetObjectItemCaseSensitive(nsi_load_level_infoJSON, "exceedLoadLevelThrInd"); + if (exceed_load_level_thr_ind) { + if (!cJSON_IsBool(exceed_load_level_thr_ind)) { + ogs_error("OpenAPI_nsi_load_level_info_parseFromJSON() failed [exceed_load_level_thr_ind]"); + goto end; + } + } + + network_area = cJSON_GetObjectItemCaseSensitive(nsi_load_level_infoJSON, "networkArea"); + if (network_area) { + network_area_local_nonprim = OpenAPI_network_area_info_parseFromJSON(network_area); + } + + time_period = cJSON_GetObjectItemCaseSensitive(nsi_load_level_infoJSON, "timePeriod"); + if (time_period) { + time_period_local_nonprim = OpenAPI_time_window_parseFromJSON(time_period); + } + + res_usg_thr_cross_time_period = cJSON_GetObjectItemCaseSensitive(nsi_load_level_infoJSON, "resUsgThrCrossTimePeriod"); + if (res_usg_thr_cross_time_period) { + cJSON *res_usg_thr_cross_time_period_local = NULL; + if (!cJSON_IsArray(res_usg_thr_cross_time_period)) { + ogs_error("OpenAPI_nsi_load_level_info_parseFromJSON() failed [res_usg_thr_cross_time_period]"); + goto end; + } + + res_usg_thr_cross_time_periodList = OpenAPI_list_create(); + + cJSON_ArrayForEach(res_usg_thr_cross_time_period_local, res_usg_thr_cross_time_period) { + if (!cJSON_IsObject(res_usg_thr_cross_time_period_local)) { + ogs_error("OpenAPI_nsi_load_level_info_parseFromJSON() failed [res_usg_thr_cross_time_period]"); + goto end; + } + OpenAPI_time_window_t *res_usg_thr_cross_time_periodItem = OpenAPI_time_window_parseFromJSON(res_usg_thr_cross_time_period_local); + if (!res_usg_thr_cross_time_periodItem) { + ogs_error("No res_usg_thr_cross_time_periodItem"); + OpenAPI_list_free(res_usg_thr_cross_time_periodList); + goto end; + } + OpenAPI_list_add(res_usg_thr_cross_time_periodList, res_usg_thr_cross_time_periodItem); + } + } + + num_of_ues = cJSON_GetObjectItemCaseSensitive(nsi_load_level_infoJSON, "numOfUes"); + if (num_of_ues) { + num_of_ues_local_nonprim = OpenAPI_number_average_parseFromJSON(num_of_ues); + } + + num_of_pdu_sess = cJSON_GetObjectItemCaseSensitive(nsi_load_level_infoJSON, "numOfPduSess"); + if (num_of_pdu_sess) { + num_of_pdu_sess_local_nonprim = OpenAPI_number_average_parseFromJSON(num_of_pdu_sess); + } + + confidence = cJSON_GetObjectItemCaseSensitive(nsi_load_level_infoJSON, "confidence"); + if (confidence) { + if (!cJSON_IsNumber(confidence)) { + ogs_error("OpenAPI_nsi_load_level_info_parseFromJSON() failed [confidence]"); + goto end; + } + } + + nsi_load_level_info_local_var = OpenAPI_nsi_load_level_info_create ( + + load_level_information->valuedouble, + snssai_local_nonprim, + nsi_id && !cJSON_IsNull(nsi_id) ? ogs_strdup(nsi_id->valuestring) : NULL, + res_usage ? res_usage_local_nonprim : NULL, + num_of_exceed_load_level_thr ? true : false, + num_of_exceed_load_level_thr ? num_of_exceed_load_level_thr->valuedouble : 0, + exceed_load_level_thr_ind ? true : false, + exceed_load_level_thr_ind ? exceed_load_level_thr_ind->valueint : 0, + network_area ? network_area_local_nonprim : NULL, + time_period ? time_period_local_nonprim : NULL, + res_usg_thr_cross_time_period ? res_usg_thr_cross_time_periodList : NULL, + num_of_ues ? num_of_ues_local_nonprim : NULL, + num_of_pdu_sess ? num_of_pdu_sess_local_nonprim : NULL, + confidence ? true : false, + confidence ? confidence->valuedouble : 0 + ); + + return nsi_load_level_info_local_var; +end: + if (snssai_local_nonprim) { + OpenAPI_snssai_free(snssai_local_nonprim); + snssai_local_nonprim = NULL; + } + if (res_usage_local_nonprim) { + OpenAPI_resource_usage_free(res_usage_local_nonprim); + res_usage_local_nonprim = NULL; + } + if (network_area_local_nonprim) { + OpenAPI_network_area_info_free(network_area_local_nonprim); + network_area_local_nonprim = NULL; + } + if (time_period_local_nonprim) { + OpenAPI_time_window_free(time_period_local_nonprim); + time_period_local_nonprim = NULL; + } + if (res_usg_thr_cross_time_periodList) { + OpenAPI_list_for_each(res_usg_thr_cross_time_periodList, node) { + OpenAPI_time_window_free(node->data); + } + OpenAPI_list_free(res_usg_thr_cross_time_periodList); + res_usg_thr_cross_time_periodList = NULL; + } + if (num_of_ues_local_nonprim) { + OpenAPI_number_average_free(num_of_ues_local_nonprim); + num_of_ues_local_nonprim = NULL; + } + if (num_of_pdu_sess_local_nonprim) { + OpenAPI_number_average_free(num_of_pdu_sess_local_nonprim); + num_of_pdu_sess_local_nonprim = NULL; + } + return NULL; +} + +OpenAPI_nsi_load_level_info_t *OpenAPI_nsi_load_level_info_copy(OpenAPI_nsi_load_level_info_t *dst, OpenAPI_nsi_load_level_info_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_nsi_load_level_info_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_nsi_load_level_info_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_nsi_load_level_info_free(dst); + dst = OpenAPI_nsi_load_level_info_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/nsi_load_level_info.h b/lib/sbi/openapi/model/nsi_load_level_info.h new file mode 100644 index 000000000..b14bb8552 --- /dev/null +++ b/lib/sbi/openapi/model/nsi_load_level_info.h @@ -0,0 +1,71 @@ +/* + * nsi_load_level_info.h + * + * Represents the network slice and optionally the associated network slice instance and the load level information. + */ + +#ifndef _OpenAPI_nsi_load_level_info_H_ +#define _OpenAPI_nsi_load_level_info_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "network_area_info.h" +#include "number_average.h" +#include "resource_usage.h" +#include "snssai.h" +#include "time_window.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_nsi_load_level_info_s OpenAPI_nsi_load_level_info_t; +typedef struct OpenAPI_nsi_load_level_info_s { + int load_level_information; + struct OpenAPI_snssai_s *snssai; + char *nsi_id; + struct OpenAPI_resource_usage_s *res_usage; + bool is_num_of_exceed_load_level_thr; + int num_of_exceed_load_level_thr; + bool is_exceed_load_level_thr_ind; + int exceed_load_level_thr_ind; + struct OpenAPI_network_area_info_s *network_area; + struct OpenAPI_time_window_s *time_period; + OpenAPI_list_t *res_usg_thr_cross_time_period; + struct OpenAPI_number_average_s *num_of_ues; + struct OpenAPI_number_average_s *num_of_pdu_sess; + bool is_confidence; + int confidence; +} OpenAPI_nsi_load_level_info_t; + +OpenAPI_nsi_load_level_info_t *OpenAPI_nsi_load_level_info_create( + int load_level_information, + OpenAPI_snssai_t *snssai, + char *nsi_id, + OpenAPI_resource_usage_t *res_usage, + bool is_num_of_exceed_load_level_thr, + int num_of_exceed_load_level_thr, + bool is_exceed_load_level_thr_ind, + int exceed_load_level_thr_ind, + OpenAPI_network_area_info_t *network_area, + OpenAPI_time_window_t *time_period, + OpenAPI_list_t *res_usg_thr_cross_time_period, + OpenAPI_number_average_t *num_of_ues, + OpenAPI_number_average_t *num_of_pdu_sess, + bool is_confidence, + int confidence +); +void OpenAPI_nsi_load_level_info_free(OpenAPI_nsi_load_level_info_t *nsi_load_level_info); +OpenAPI_nsi_load_level_info_t *OpenAPI_nsi_load_level_info_parseFromJSON(cJSON *nsi_load_level_infoJSON); +cJSON *OpenAPI_nsi_load_level_info_convertToJSON(OpenAPI_nsi_load_level_info_t *nsi_load_level_info); +OpenAPI_nsi_load_level_info_t *OpenAPI_nsi_load_level_info_copy(OpenAPI_nsi_load_level_info_t *dst, OpenAPI_nsi_load_level_info_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_nsi_load_level_info_H_ */ + diff --git a/lib/sbi/openapi/model/nssaa_status.h b/lib/sbi/openapi/model/nssaa_status.h index 73be22504..dda9f74f3 100644 --- a/lib/sbi/openapi/model/nssaa_status.h +++ b/lib/sbi/openapi/model/nssaa_status.h @@ -1,7 +1,7 @@ /* * nssaa_status.h * - * + * contains the Subscribed S-NSSAI subject to NSSAA procedure and the status. */ #ifndef _OpenAPI_nssaa_status_H_ diff --git a/lib/sbi/openapi/model/nssaaf_info.c b/lib/sbi/openapi/model/nssaaf_info.c new file mode 100644 index 000000000..4240a9e8f --- /dev/null +++ b/lib/sbi/openapi/model/nssaaf_info.c @@ -0,0 +1,207 @@ + +#include +#include +#include +#include "nssaaf_info.h" + +OpenAPI_nssaaf_info_t *OpenAPI_nssaaf_info_create( + OpenAPI_list_t *supi_ranges, + OpenAPI_list_t *internal_group_identifiers_ranges +) +{ + OpenAPI_nssaaf_info_t *nssaaf_info_local_var = ogs_malloc(sizeof(OpenAPI_nssaaf_info_t)); + ogs_assert(nssaaf_info_local_var); + + nssaaf_info_local_var->supi_ranges = supi_ranges; + nssaaf_info_local_var->internal_group_identifiers_ranges = internal_group_identifiers_ranges; + + return nssaaf_info_local_var; +} + +void OpenAPI_nssaaf_info_free(OpenAPI_nssaaf_info_t *nssaaf_info) +{ + OpenAPI_lnode_t *node = NULL; + + if (NULL == nssaaf_info) { + return; + } + if (nssaaf_info->supi_ranges) { + OpenAPI_list_for_each(nssaaf_info->supi_ranges, node) { + OpenAPI_supi_range_free(node->data); + } + OpenAPI_list_free(nssaaf_info->supi_ranges); + nssaaf_info->supi_ranges = NULL; + } + if (nssaaf_info->internal_group_identifiers_ranges) { + OpenAPI_list_for_each(nssaaf_info->internal_group_identifiers_ranges, node) { + OpenAPI_internal_group_id_range_free(node->data); + } + OpenAPI_list_free(nssaaf_info->internal_group_identifiers_ranges); + nssaaf_info->internal_group_identifiers_ranges = NULL; + } + ogs_free(nssaaf_info); +} + +cJSON *OpenAPI_nssaaf_info_convertToJSON(OpenAPI_nssaaf_info_t *nssaaf_info) +{ + cJSON *item = NULL; + OpenAPI_lnode_t *node = NULL; + + if (nssaaf_info == NULL) { + ogs_error("OpenAPI_nssaaf_info_convertToJSON() failed [NssaafInfo]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (nssaaf_info->supi_ranges) { + cJSON *supi_rangesList = cJSON_AddArrayToObject(item, "supiRanges"); + if (supi_rangesList == NULL) { + ogs_error("OpenAPI_nssaaf_info_convertToJSON() failed [supi_ranges]"); + goto end; + } + OpenAPI_list_for_each(nssaaf_info->supi_ranges, node) { + cJSON *itemLocal = OpenAPI_supi_range_convertToJSON(node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_nssaaf_info_convertToJSON() failed [supi_ranges]"); + goto end; + } + cJSON_AddItemToArray(supi_rangesList, itemLocal); + } + } + + if (nssaaf_info->internal_group_identifiers_ranges) { + cJSON *internal_group_identifiers_rangesList = cJSON_AddArrayToObject(item, "internalGroupIdentifiersRanges"); + if (internal_group_identifiers_rangesList == NULL) { + ogs_error("OpenAPI_nssaaf_info_convertToJSON() failed [internal_group_identifiers_ranges]"); + goto end; + } + OpenAPI_list_for_each(nssaaf_info->internal_group_identifiers_ranges, node) { + cJSON *itemLocal = OpenAPI_internal_group_id_range_convertToJSON(node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_nssaaf_info_convertToJSON() failed [internal_group_identifiers_ranges]"); + goto end; + } + cJSON_AddItemToArray(internal_group_identifiers_rangesList, itemLocal); + } + } + +end: + return item; +} + +OpenAPI_nssaaf_info_t *OpenAPI_nssaaf_info_parseFromJSON(cJSON *nssaaf_infoJSON) +{ + OpenAPI_nssaaf_info_t *nssaaf_info_local_var = NULL; + OpenAPI_lnode_t *node = NULL; + cJSON *supi_ranges = NULL; + OpenAPI_list_t *supi_rangesList = NULL; + cJSON *internal_group_identifiers_ranges = NULL; + OpenAPI_list_t *internal_group_identifiers_rangesList = NULL; + supi_ranges = cJSON_GetObjectItemCaseSensitive(nssaaf_infoJSON, "supiRanges"); + if (supi_ranges) { + cJSON *supi_ranges_local = NULL; + if (!cJSON_IsArray(supi_ranges)) { + ogs_error("OpenAPI_nssaaf_info_parseFromJSON() failed [supi_ranges]"); + goto end; + } + + supi_rangesList = OpenAPI_list_create(); + + cJSON_ArrayForEach(supi_ranges_local, supi_ranges) { + if (!cJSON_IsObject(supi_ranges_local)) { + ogs_error("OpenAPI_nssaaf_info_parseFromJSON() failed [supi_ranges]"); + goto end; + } + OpenAPI_supi_range_t *supi_rangesItem = OpenAPI_supi_range_parseFromJSON(supi_ranges_local); + if (!supi_rangesItem) { + ogs_error("No supi_rangesItem"); + OpenAPI_list_free(supi_rangesList); + goto end; + } + OpenAPI_list_add(supi_rangesList, supi_rangesItem); + } + } + + internal_group_identifiers_ranges = cJSON_GetObjectItemCaseSensitive(nssaaf_infoJSON, "internalGroupIdentifiersRanges"); + if (internal_group_identifiers_ranges) { + cJSON *internal_group_identifiers_ranges_local = NULL; + if (!cJSON_IsArray(internal_group_identifiers_ranges)) { + ogs_error("OpenAPI_nssaaf_info_parseFromJSON() failed [internal_group_identifiers_ranges]"); + goto end; + } + + internal_group_identifiers_rangesList = OpenAPI_list_create(); + + cJSON_ArrayForEach(internal_group_identifiers_ranges_local, internal_group_identifiers_ranges) { + if (!cJSON_IsObject(internal_group_identifiers_ranges_local)) { + ogs_error("OpenAPI_nssaaf_info_parseFromJSON() failed [internal_group_identifiers_ranges]"); + goto end; + } + OpenAPI_internal_group_id_range_t *internal_group_identifiers_rangesItem = OpenAPI_internal_group_id_range_parseFromJSON(internal_group_identifiers_ranges_local); + if (!internal_group_identifiers_rangesItem) { + ogs_error("No internal_group_identifiers_rangesItem"); + OpenAPI_list_free(internal_group_identifiers_rangesList); + goto end; + } + OpenAPI_list_add(internal_group_identifiers_rangesList, internal_group_identifiers_rangesItem); + } + } + + nssaaf_info_local_var = OpenAPI_nssaaf_info_create ( + supi_ranges ? supi_rangesList : NULL, + internal_group_identifiers_ranges ? internal_group_identifiers_rangesList : NULL + ); + + return nssaaf_info_local_var; +end: + if (supi_rangesList) { + OpenAPI_list_for_each(supi_rangesList, node) { + OpenAPI_supi_range_free(node->data); + } + OpenAPI_list_free(supi_rangesList); + supi_rangesList = NULL; + } + if (internal_group_identifiers_rangesList) { + OpenAPI_list_for_each(internal_group_identifiers_rangesList, node) { + OpenAPI_internal_group_id_range_free(node->data); + } + OpenAPI_list_free(internal_group_identifiers_rangesList); + internal_group_identifiers_rangesList = NULL; + } + return NULL; +} + +OpenAPI_nssaaf_info_t *OpenAPI_nssaaf_info_copy(OpenAPI_nssaaf_info_t *dst, OpenAPI_nssaaf_info_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_nssaaf_info_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_nssaaf_info_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_nssaaf_info_free(dst); + dst = OpenAPI_nssaaf_info_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/nssaaf_info.h b/lib/sbi/openapi/model/nssaaf_info.h new file mode 100644 index 000000000..d0b275940 --- /dev/null +++ b/lib/sbi/openapi/model/nssaaf_info.h @@ -0,0 +1,42 @@ +/* + * nssaaf_info.h + * + * Information of a NSSAAF Instance + */ + +#ifndef _OpenAPI_nssaaf_info_H_ +#define _OpenAPI_nssaaf_info_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "internal_group_id_range.h" +#include "supi_range.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_nssaaf_info_s OpenAPI_nssaaf_info_t; +typedef struct OpenAPI_nssaaf_info_s { + OpenAPI_list_t *supi_ranges; + OpenAPI_list_t *internal_group_identifiers_ranges; +} OpenAPI_nssaaf_info_t; + +OpenAPI_nssaaf_info_t *OpenAPI_nssaaf_info_create( + OpenAPI_list_t *supi_ranges, + OpenAPI_list_t *internal_group_identifiers_ranges +); +void OpenAPI_nssaaf_info_free(OpenAPI_nssaaf_info_t *nssaaf_info); +OpenAPI_nssaaf_info_t *OpenAPI_nssaaf_info_parseFromJSON(cJSON *nssaaf_infoJSON); +cJSON *OpenAPI_nssaaf_info_convertToJSON(OpenAPI_nssaaf_info_t *nssaaf_info); +OpenAPI_nssaaf_info_t *OpenAPI_nssaaf_info_copy(OpenAPI_nssaaf_info_t *dst, OpenAPI_nssaaf_info_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_nssaaf_info_H_ */ + diff --git a/lib/sbi/openapi/model/nssai.c b/lib/sbi/openapi/model/nssai.c index 8d63db51a..185837aa8 100644 --- a/lib/sbi/openapi/model/nssai.c +++ b/lib/sbi/openapi/model/nssai.c @@ -9,7 +9,9 @@ OpenAPI_nssai_t *OpenAPI_nssai_create( OpenAPI_list_t *default_single_nssais, OpenAPI_list_t *single_nssais, char *provisioning_time, - OpenAPI_list_t* additional_snssai_data + OpenAPI_list_t* additional_snssai_data, + bool is_suppress_nssrg_ind, + int suppress_nssrg_ind ) { OpenAPI_nssai_t *nssai_local_var = ogs_malloc(sizeof(OpenAPI_nssai_t)); @@ -20,6 +22,8 @@ OpenAPI_nssai_t *OpenAPI_nssai_create( nssai_local_var->single_nssais = single_nssais; nssai_local_var->provisioning_time = provisioning_time; nssai_local_var->additional_snssai_data = additional_snssai_data; + nssai_local_var->is_suppress_nssrg_ind = is_suppress_nssrg_ind; + nssai_local_var->suppress_nssrg_ind = suppress_nssrg_ind; return nssai_local_var; } @@ -147,6 +151,13 @@ cJSON *OpenAPI_nssai_convertToJSON(OpenAPI_nssai_t *nssai) } } + if (nssai->is_suppress_nssrg_ind) { + if (cJSON_AddBoolToObject(item, "suppressNssrgInd", nssai->suppress_nssrg_ind) == NULL) { + ogs_error("OpenAPI_nssai_convertToJSON() failed [suppress_nssrg_ind]"); + goto end; + } + } + end: return item; } @@ -163,6 +174,7 @@ OpenAPI_nssai_t *OpenAPI_nssai_parseFromJSON(cJSON *nssaiJSON) cJSON *provisioning_time = NULL; cJSON *additional_snssai_data = NULL; OpenAPI_list_t *additional_snssai_dataList = NULL; + cJSON *suppress_nssrg_ind = NULL; supported_features = cJSON_GetObjectItemCaseSensitive(nssaiJSON, "supportedFeatures"); if (supported_features) { if (!cJSON_IsString(supported_features) && !cJSON_IsNull(supported_features)) { @@ -257,12 +269,22 @@ OpenAPI_nssai_t *OpenAPI_nssai_parseFromJSON(cJSON *nssaiJSON) } } + suppress_nssrg_ind = cJSON_GetObjectItemCaseSensitive(nssaiJSON, "suppressNssrgInd"); + if (suppress_nssrg_ind) { + if (!cJSON_IsBool(suppress_nssrg_ind)) { + ogs_error("OpenAPI_nssai_parseFromJSON() failed [suppress_nssrg_ind]"); + goto end; + } + } + nssai_local_var = OpenAPI_nssai_create ( supported_features && !cJSON_IsNull(supported_features) ? ogs_strdup(supported_features->valuestring) : NULL, default_single_nssaisList, single_nssais ? single_nssaisList : NULL, provisioning_time && !cJSON_IsNull(provisioning_time) ? ogs_strdup(provisioning_time->valuestring) : NULL, - additional_snssai_data ? additional_snssai_dataList : NULL + additional_snssai_data ? additional_snssai_dataList : NULL, + suppress_nssrg_ind ? true : false, + suppress_nssrg_ind ? suppress_nssrg_ind->valueint : 0 ); return nssai_local_var; diff --git a/lib/sbi/openapi/model/nssai.h b/lib/sbi/openapi/model/nssai.h index 0a0d557d9..70843a7b4 100644 --- a/lib/sbi/openapi/model/nssai.h +++ b/lib/sbi/openapi/model/nssai.h @@ -26,6 +26,8 @@ typedef struct OpenAPI_nssai_s { OpenAPI_list_t *single_nssais; char *provisioning_time; OpenAPI_list_t* additional_snssai_data; + bool is_suppress_nssrg_ind; + int suppress_nssrg_ind; } OpenAPI_nssai_t; OpenAPI_nssai_t *OpenAPI_nssai_create( @@ -33,7 +35,9 @@ OpenAPI_nssai_t *OpenAPI_nssai_create( OpenAPI_list_t *default_single_nssais, OpenAPI_list_t *single_nssais, char *provisioning_time, - OpenAPI_list_t* additional_snssai_data + OpenAPI_list_t* additional_snssai_data, + bool is_suppress_nssrg_ind, + int suppress_nssrg_ind ); void OpenAPI_nssai_free(OpenAPI_nssai_t *nssai); OpenAPI_nssai_t *OpenAPI_nssai_parseFromJSON(cJSON *nssaiJSON); diff --git a/lib/sbi/openapi/model/nssai_1.c b/lib/sbi/openapi/model/nssai_1.c index dc8805693..82ab982ee 100644 --- a/lib/sbi/openapi/model/nssai_1.c +++ b/lib/sbi/openapi/model/nssai_1.c @@ -9,7 +9,9 @@ OpenAPI_nssai_1_t *OpenAPI_nssai_1_create( OpenAPI_list_t *default_single_nssais, OpenAPI_list_t *single_nssais, char *provisioning_time, - OpenAPI_list_t* additional_snssai_data + OpenAPI_list_t* additional_snssai_data, + bool is_suppress_nssrg_ind, + int suppress_nssrg_ind ) { OpenAPI_nssai_1_t *nssai_1_local_var = ogs_malloc(sizeof(OpenAPI_nssai_1_t)); @@ -20,6 +22,8 @@ OpenAPI_nssai_1_t *OpenAPI_nssai_1_create( nssai_1_local_var->single_nssais = single_nssais; nssai_1_local_var->provisioning_time = provisioning_time; nssai_1_local_var->additional_snssai_data = additional_snssai_data; + nssai_1_local_var->is_suppress_nssrg_ind = is_suppress_nssrg_ind; + nssai_1_local_var->suppress_nssrg_ind = suppress_nssrg_ind; return nssai_1_local_var; } @@ -57,7 +61,7 @@ void OpenAPI_nssai_1_free(OpenAPI_nssai_1_t *nssai_1) OpenAPI_list_for_each(nssai_1->additional_snssai_data, node) { OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*)node->data; ogs_free(localKeyValue->key); - OpenAPI_additional_snssai_data_free(localKeyValue->value); + OpenAPI_additional_snssai_data_1_free(localKeyValue->value); OpenAPI_map_free(localKeyValue); } OpenAPI_list_free(nssai_1->additional_snssai_data); @@ -136,7 +140,7 @@ cJSON *OpenAPI_nssai_1_convertToJSON(OpenAPI_nssai_1_t *nssai_1) OpenAPI_list_for_each(nssai_1->additional_snssai_data, node) { OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*)node->data; cJSON *itemLocal = localKeyValue->value ? - OpenAPI_additional_snssai_data_convertToJSON(localKeyValue->value) : + OpenAPI_additional_snssai_data_1_convertToJSON(localKeyValue->value) : cJSON_CreateNull(); if (itemLocal == NULL) { ogs_error("OpenAPI_nssai_1_convertToJSON() failed [inner]"); @@ -147,6 +151,13 @@ cJSON *OpenAPI_nssai_1_convertToJSON(OpenAPI_nssai_1_t *nssai_1) } } + if (nssai_1->is_suppress_nssrg_ind) { + if (cJSON_AddBoolToObject(item, "suppressNssrgInd", nssai_1->suppress_nssrg_ind) == NULL) { + ogs_error("OpenAPI_nssai_1_convertToJSON() failed [suppress_nssrg_ind]"); + goto end; + } + } + end: return item; } @@ -163,6 +174,7 @@ OpenAPI_nssai_1_t *OpenAPI_nssai_1_parseFromJSON(cJSON *nssai_1JSON) cJSON *provisioning_time = NULL; cJSON *additional_snssai_data = NULL; OpenAPI_list_t *additional_snssai_dataList = NULL; + cJSON *suppress_nssrg_ind = NULL; supported_features = cJSON_GetObjectItemCaseSensitive(nssai_1JSON, "supportedFeatures"); if (supported_features) { if (!cJSON_IsString(supported_features) && !cJSON_IsNull(supported_features)) { @@ -245,7 +257,7 @@ OpenAPI_nssai_1_t *OpenAPI_nssai_1_parseFromJSON(cJSON *nssai_1JSON) cJSON *localMapObject = additional_snssai_data_local_map; if (cJSON_IsObject(localMapObject)) { localMapKeyPair = OpenAPI_map_create( - ogs_strdup(localMapObject->string), OpenAPI_additional_snssai_data_parseFromJSON(localMapObject)); + ogs_strdup(localMapObject->string), OpenAPI_additional_snssai_data_1_parseFromJSON(localMapObject)); } else if (cJSON_IsNull(localMapObject)) { localMapKeyPair = OpenAPI_map_create(ogs_strdup(localMapObject->string), NULL); } else { @@ -257,12 +269,22 @@ OpenAPI_nssai_1_t *OpenAPI_nssai_1_parseFromJSON(cJSON *nssai_1JSON) } } + suppress_nssrg_ind = cJSON_GetObjectItemCaseSensitive(nssai_1JSON, "suppressNssrgInd"); + if (suppress_nssrg_ind) { + if (!cJSON_IsBool(suppress_nssrg_ind)) { + ogs_error("OpenAPI_nssai_1_parseFromJSON() failed [suppress_nssrg_ind]"); + goto end; + } + } + nssai_1_local_var = OpenAPI_nssai_1_create ( supported_features && !cJSON_IsNull(supported_features) ? ogs_strdup(supported_features->valuestring) : NULL, default_single_nssaisList, single_nssais ? single_nssaisList : NULL, provisioning_time && !cJSON_IsNull(provisioning_time) ? ogs_strdup(provisioning_time->valuestring) : NULL, - additional_snssai_data ? additional_snssai_dataList : NULL + additional_snssai_data ? additional_snssai_dataList : NULL, + suppress_nssrg_ind ? true : false, + suppress_nssrg_ind ? suppress_nssrg_ind->valueint : 0 ); return nssai_1_local_var; @@ -285,7 +307,7 @@ end: OpenAPI_list_for_each(additional_snssai_dataList, node) { OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*) node->data; ogs_free(localKeyValue->key); - OpenAPI_additional_snssai_data_free(localKeyValue->value); + OpenAPI_additional_snssai_data_1_free(localKeyValue->value); OpenAPI_map_free(localKeyValue); } OpenAPI_list_free(additional_snssai_dataList); diff --git a/lib/sbi/openapi/model/nssai_1.h b/lib/sbi/openapi/model/nssai_1.h index 621ef3157..058a05396 100644 --- a/lib/sbi/openapi/model/nssai_1.h +++ b/lib/sbi/openapi/model/nssai_1.h @@ -12,7 +12,7 @@ #include "../include/list.h" #include "../include/keyValuePair.h" #include "../include/binary.h" -#include "additional_snssai_data.h" +#include "additional_snssai_data_1.h" #include "snssai.h" #ifdef __cplusplus @@ -26,6 +26,8 @@ typedef struct OpenAPI_nssai_1_s { OpenAPI_list_t *single_nssais; char *provisioning_time; OpenAPI_list_t* additional_snssai_data; + bool is_suppress_nssrg_ind; + int suppress_nssrg_ind; } OpenAPI_nssai_1_t; OpenAPI_nssai_1_t *OpenAPI_nssai_1_create( @@ -33,7 +35,9 @@ OpenAPI_nssai_1_t *OpenAPI_nssai_1_create( OpenAPI_list_t *default_single_nssais, OpenAPI_list_t *single_nssais, char *provisioning_time, - OpenAPI_list_t* additional_snssai_data + OpenAPI_list_t* additional_snssai_data, + bool is_suppress_nssrg_ind, + int suppress_nssrg_ind ); void OpenAPI_nssai_1_free(OpenAPI_nssai_1_t *nssai_1); OpenAPI_nssai_1_t *OpenAPI_nssai_1_parseFromJSON(cJSON *nssai_1JSON); diff --git a/lib/sbi/openapi/model/nssai_ack_data.h b/lib/sbi/openapi/model/nssai_ack_data.h index 5425b2691..fc9744d58 100644 --- a/lib/sbi/openapi/model/nssai_ack_data.h +++ b/lib/sbi/openapi/model/nssai_ack_data.h @@ -1,7 +1,7 @@ /* * nssai_ack_data.h * - * + * Used to store the status of the latest NSSAI data update. */ #ifndef _OpenAPI_nssai_ack_data_H_ diff --git a/lib/sbi/openapi/model/nssai_mapping.h b/lib/sbi/openapi/model/nssai_mapping.h index 19ec0dce0..da8a73f45 100644 --- a/lib/sbi/openapi/model/nssai_mapping.h +++ b/lib/sbi/openapi/model/nssai_mapping.h @@ -1,7 +1,7 @@ /* * nssai_mapping.h * - * + * Represents the mapping between a S-NSSAI in serving PLMN to a S-NSSAI in home PLMN */ #ifndef _OpenAPI_nssai_mapping_H_ diff --git a/lib/sbi/openapi/model/nudm_amf_info.c b/lib/sbi/openapi/model/nudm_amf_info.c new file mode 100644 index 000000000..c065af3a5 --- /dev/null +++ b/lib/sbi/openapi/model/nudm_amf_info.c @@ -0,0 +1,170 @@ + +#include +#include +#include +#include "nudm_amf_info.h" + +OpenAPI_nudm_amf_info_t *OpenAPI_nudm_amf_info_create( + char *amf_instance_id, + OpenAPI_guami_t *guami, + OpenAPI_access_type_e access_type +) +{ + OpenAPI_nudm_amf_info_t *nudm_amf_info_local_var = ogs_malloc(sizeof(OpenAPI_nudm_amf_info_t)); + ogs_assert(nudm_amf_info_local_var); + + nudm_amf_info_local_var->amf_instance_id = amf_instance_id; + nudm_amf_info_local_var->guami = guami; + nudm_amf_info_local_var->access_type = access_type; + + return nudm_amf_info_local_var; +} + +void OpenAPI_nudm_amf_info_free(OpenAPI_nudm_amf_info_t *nudm_amf_info) +{ + OpenAPI_lnode_t *node = NULL; + + if (NULL == nudm_amf_info) { + return; + } + if (nudm_amf_info->amf_instance_id) { + ogs_free(nudm_amf_info->amf_instance_id); + nudm_amf_info->amf_instance_id = NULL; + } + if (nudm_amf_info->guami) { + OpenAPI_guami_free(nudm_amf_info->guami); + nudm_amf_info->guami = NULL; + } + ogs_free(nudm_amf_info); +} + +cJSON *OpenAPI_nudm_amf_info_convertToJSON(OpenAPI_nudm_amf_info_t *nudm_amf_info) +{ + cJSON *item = NULL; + OpenAPI_lnode_t *node = NULL; + + if (nudm_amf_info == NULL) { + ogs_error("OpenAPI_nudm_amf_info_convertToJSON() failed [NudmAmfInfo]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (!nudm_amf_info->amf_instance_id) { + ogs_error("OpenAPI_nudm_amf_info_convertToJSON() failed [amf_instance_id]"); + return NULL; + } + if (cJSON_AddStringToObject(item, "amfInstanceId", nudm_amf_info->amf_instance_id) == NULL) { + ogs_error("OpenAPI_nudm_amf_info_convertToJSON() failed [amf_instance_id]"); + goto end; + } + + if (!nudm_amf_info->guami) { + ogs_error("OpenAPI_nudm_amf_info_convertToJSON() failed [guami]"); + return NULL; + } + cJSON *guami_local_JSON = OpenAPI_guami_convertToJSON(nudm_amf_info->guami); + if (guami_local_JSON == NULL) { + ogs_error("OpenAPI_nudm_amf_info_convertToJSON() failed [guami]"); + goto end; + } + cJSON_AddItemToObject(item, "guami", guami_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_nudm_amf_info_convertToJSON() failed [guami]"); + goto end; + } + + if (nudm_amf_info->access_type != OpenAPI_access_type_NULL) { + if (cJSON_AddStringToObject(item, "accessType", OpenAPI_access_type_ToString(nudm_amf_info->access_type)) == NULL) { + ogs_error("OpenAPI_nudm_amf_info_convertToJSON() failed [access_type]"); + goto end; + } + } + +end: + return item; +} + +OpenAPI_nudm_amf_info_t *OpenAPI_nudm_amf_info_parseFromJSON(cJSON *nudm_amf_infoJSON) +{ + OpenAPI_nudm_amf_info_t *nudm_amf_info_local_var = NULL; + OpenAPI_lnode_t *node = NULL; + cJSON *amf_instance_id = NULL; + cJSON *guami = NULL; + OpenAPI_guami_t *guami_local_nonprim = NULL; + cJSON *access_type = NULL; + OpenAPI_access_type_e access_typeVariable = 0; + amf_instance_id = cJSON_GetObjectItemCaseSensitive(nudm_amf_infoJSON, "amfInstanceId"); + if (!amf_instance_id) { + ogs_error("OpenAPI_nudm_amf_info_parseFromJSON() failed [amf_instance_id]"); + goto end; + } + if (!cJSON_IsString(amf_instance_id)) { + ogs_error("OpenAPI_nudm_amf_info_parseFromJSON() failed [amf_instance_id]"); + goto end; + } + + guami = cJSON_GetObjectItemCaseSensitive(nudm_amf_infoJSON, "guami"); + if (!guami) { + ogs_error("OpenAPI_nudm_amf_info_parseFromJSON() failed [guami]"); + goto end; + } + guami_local_nonprim = OpenAPI_guami_parseFromJSON(guami); + + access_type = cJSON_GetObjectItemCaseSensitive(nudm_amf_infoJSON, "accessType"); + if (access_type) { + if (!cJSON_IsString(access_type)) { + ogs_error("OpenAPI_nudm_amf_info_parseFromJSON() failed [access_type]"); + goto end; + } + access_typeVariable = OpenAPI_access_type_FromString(access_type->valuestring); + } + + nudm_amf_info_local_var = OpenAPI_nudm_amf_info_create ( + ogs_strdup(amf_instance_id->valuestring), + guami_local_nonprim, + access_type ? access_typeVariable : 0 + ); + + return nudm_amf_info_local_var; +end: + if (guami_local_nonprim) { + OpenAPI_guami_free(guami_local_nonprim); + guami_local_nonprim = NULL; + } + return NULL; +} + +OpenAPI_nudm_amf_info_t *OpenAPI_nudm_amf_info_copy(OpenAPI_nudm_amf_info_t *dst, OpenAPI_nudm_amf_info_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_nudm_amf_info_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_nudm_amf_info_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_nudm_amf_info_free(dst); + dst = OpenAPI_nudm_amf_info_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/nudm_amf_info.h b/lib/sbi/openapi/model/nudm_amf_info.h new file mode 100644 index 000000000..4e407c897 --- /dev/null +++ b/lib/sbi/openapi/model/nudm_amf_info.h @@ -0,0 +1,44 @@ +/* + * nudm_amf_info.h + * + * + */ + +#ifndef _OpenAPI_nudm_amf_info_H_ +#define _OpenAPI_nudm_amf_info_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "access_type.h" +#include "guami.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_nudm_amf_info_s OpenAPI_nudm_amf_info_t; +typedef struct OpenAPI_nudm_amf_info_s { + char *amf_instance_id; + struct OpenAPI_guami_s *guami; + OpenAPI_access_type_e access_type; +} OpenAPI_nudm_amf_info_t; + +OpenAPI_nudm_amf_info_t *OpenAPI_nudm_amf_info_create( + char *amf_instance_id, + OpenAPI_guami_t *guami, + OpenAPI_access_type_e access_type +); +void OpenAPI_nudm_amf_info_free(OpenAPI_nudm_amf_info_t *nudm_amf_info); +OpenAPI_nudm_amf_info_t *OpenAPI_nudm_amf_info_parseFromJSON(cJSON *nudm_amf_infoJSON); +cJSON *OpenAPI_nudm_amf_info_convertToJSON(OpenAPI_nudm_amf_info_t *nudm_amf_info); +OpenAPI_nudm_amf_info_t *OpenAPI_nudm_amf_info_copy(OpenAPI_nudm_amf_info_t *dst, OpenAPI_nudm_amf_info_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_nudm_amf_info_H_ */ + diff --git a/lib/sbi/openapi/model/null_value.h b/lib/sbi/openapi/model/null_value.h index 8272123e5..911529eae 100644 --- a/lib/sbi/openapi/model/null_value.h +++ b/lib/sbi/openapi/model/null_value.h @@ -1,7 +1,7 @@ /* * null_value.h * - * + * JSON's null value. */ #ifndef _OpenAPI_null_value_H_ diff --git a/lib/sbi/openapi/model/number_average.c b/lib/sbi/openapi/model/number_average.c new file mode 100644 index 000000000..1b3f7b927 --- /dev/null +++ b/lib/sbi/openapi/model/number_average.c @@ -0,0 +1,149 @@ + +#include +#include +#include +#include "number_average.h" + +OpenAPI_number_average_t *OpenAPI_number_average_create( + float number, + float variance, + bool is_skewness, + float skewness +) +{ + OpenAPI_number_average_t *number_average_local_var = ogs_malloc(sizeof(OpenAPI_number_average_t)); + ogs_assert(number_average_local_var); + + number_average_local_var->number = number; + number_average_local_var->variance = variance; + number_average_local_var->is_skewness = is_skewness; + number_average_local_var->skewness = skewness; + + return number_average_local_var; +} + +void OpenAPI_number_average_free(OpenAPI_number_average_t *number_average) +{ + OpenAPI_lnode_t *node = NULL; + + if (NULL == number_average) { + return; + } + ogs_free(number_average); +} + +cJSON *OpenAPI_number_average_convertToJSON(OpenAPI_number_average_t *number_average) +{ + cJSON *item = NULL; + OpenAPI_lnode_t *node = NULL; + + if (number_average == NULL) { + ogs_error("OpenAPI_number_average_convertToJSON() failed [NumberAverage]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (cJSON_AddNumberToObject(item, "number", number_average->number) == NULL) { + ogs_error("OpenAPI_number_average_convertToJSON() failed [number]"); + goto end; + } + + if (cJSON_AddNumberToObject(item, "variance", number_average->variance) == NULL) { + ogs_error("OpenAPI_number_average_convertToJSON() failed [variance]"); + goto end; + } + + if (number_average->is_skewness) { + if (cJSON_AddNumberToObject(item, "skewness", number_average->skewness) == NULL) { + ogs_error("OpenAPI_number_average_convertToJSON() failed [skewness]"); + goto end; + } + } + +end: + return item; +} + +OpenAPI_number_average_t *OpenAPI_number_average_parseFromJSON(cJSON *number_averageJSON) +{ + OpenAPI_number_average_t *number_average_local_var = NULL; + OpenAPI_lnode_t *node = NULL; + cJSON *number = NULL; + cJSON *variance = NULL; + cJSON *skewness = NULL; + number = cJSON_GetObjectItemCaseSensitive(number_averageJSON, "number"); + if (!number) { + ogs_error("OpenAPI_number_average_parseFromJSON() failed [number]"); + goto end; + } + if (!cJSON_IsNumber(number)) { + ogs_error("OpenAPI_number_average_parseFromJSON() failed [number]"); + goto end; + } + + variance = cJSON_GetObjectItemCaseSensitive(number_averageJSON, "variance"); + if (!variance) { + ogs_error("OpenAPI_number_average_parseFromJSON() failed [variance]"); + goto end; + } + if (!cJSON_IsNumber(variance)) { + ogs_error("OpenAPI_number_average_parseFromJSON() failed [variance]"); + goto end; + } + + skewness = cJSON_GetObjectItemCaseSensitive(number_averageJSON, "skewness"); + if (skewness) { + if (!cJSON_IsNumber(skewness)) { + ogs_error("OpenAPI_number_average_parseFromJSON() failed [skewness]"); + goto end; + } + } + + number_average_local_var = OpenAPI_number_average_create ( + + number->valuedouble, + + variance->valuedouble, + skewness ? true : false, + skewness ? skewness->valuedouble : 0 + ); + + return number_average_local_var; +end: + return NULL; +} + +OpenAPI_number_average_t *OpenAPI_number_average_copy(OpenAPI_number_average_t *dst, OpenAPI_number_average_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_number_average_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_number_average_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_number_average_free(dst); + dst = OpenAPI_number_average_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/number_average.h b/lib/sbi/openapi/model/number_average.h new file mode 100644 index 000000000..ab9b58299 --- /dev/null +++ b/lib/sbi/openapi/model/number_average.h @@ -0,0 +1,44 @@ +/* + * number_average.h + * + * Represents average and variance information. + */ + +#ifndef _OpenAPI_number_average_H_ +#define _OpenAPI_number_average_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_number_average_s OpenAPI_number_average_t; +typedef struct OpenAPI_number_average_s { + float number; + float variance; + bool is_skewness; + float skewness; +} OpenAPI_number_average_t; + +OpenAPI_number_average_t *OpenAPI_number_average_create( + float number, + float variance, + bool is_skewness, + float skewness +); +void OpenAPI_number_average_free(OpenAPI_number_average_t *number_average); +OpenAPI_number_average_t *OpenAPI_number_average_parseFromJSON(cJSON *number_averageJSON); +cJSON *OpenAPI_number_average_convertToJSON(OpenAPI_number_average_t *number_average); +OpenAPI_number_average_t *OpenAPI_number_average_copy(OpenAPI_number_average_t *dst, OpenAPI_number_average_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_number_average_H_ */ + diff --git a/lib/sbi/openapi/model/nwdaf_capability.c b/lib/sbi/openapi/model/nwdaf_capability.c new file mode 100644 index 000000000..afaec4952 --- /dev/null +++ b/lib/sbi/openapi/model/nwdaf_capability.c @@ -0,0 +1,131 @@ + +#include +#include +#include +#include "nwdaf_capability.h" + +OpenAPI_nwdaf_capability_t *OpenAPI_nwdaf_capability_create( + bool is_analytics_aggregation, + int analytics_aggregation, + bool is_analytics_metadata_provisioning, + int analytics_metadata_provisioning +) +{ + OpenAPI_nwdaf_capability_t *nwdaf_capability_local_var = ogs_malloc(sizeof(OpenAPI_nwdaf_capability_t)); + ogs_assert(nwdaf_capability_local_var); + + nwdaf_capability_local_var->is_analytics_aggregation = is_analytics_aggregation; + nwdaf_capability_local_var->analytics_aggregation = analytics_aggregation; + nwdaf_capability_local_var->is_analytics_metadata_provisioning = is_analytics_metadata_provisioning; + nwdaf_capability_local_var->analytics_metadata_provisioning = analytics_metadata_provisioning; + + return nwdaf_capability_local_var; +} + +void OpenAPI_nwdaf_capability_free(OpenAPI_nwdaf_capability_t *nwdaf_capability) +{ + OpenAPI_lnode_t *node = NULL; + + if (NULL == nwdaf_capability) { + return; + } + ogs_free(nwdaf_capability); +} + +cJSON *OpenAPI_nwdaf_capability_convertToJSON(OpenAPI_nwdaf_capability_t *nwdaf_capability) +{ + cJSON *item = NULL; + OpenAPI_lnode_t *node = NULL; + + if (nwdaf_capability == NULL) { + ogs_error("OpenAPI_nwdaf_capability_convertToJSON() failed [NwdafCapability]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (nwdaf_capability->is_analytics_aggregation) { + if (cJSON_AddBoolToObject(item, "analyticsAggregation", nwdaf_capability->analytics_aggregation) == NULL) { + ogs_error("OpenAPI_nwdaf_capability_convertToJSON() failed [analytics_aggregation]"); + goto end; + } + } + + if (nwdaf_capability->is_analytics_metadata_provisioning) { + if (cJSON_AddBoolToObject(item, "analyticsMetadataProvisioning", nwdaf_capability->analytics_metadata_provisioning) == NULL) { + ogs_error("OpenAPI_nwdaf_capability_convertToJSON() failed [analytics_metadata_provisioning]"); + goto end; + } + } + +end: + return item; +} + +OpenAPI_nwdaf_capability_t *OpenAPI_nwdaf_capability_parseFromJSON(cJSON *nwdaf_capabilityJSON) +{ + OpenAPI_nwdaf_capability_t *nwdaf_capability_local_var = NULL; + OpenAPI_lnode_t *node = NULL; + cJSON *analytics_aggregation = NULL; + cJSON *analytics_metadata_provisioning = NULL; + analytics_aggregation = cJSON_GetObjectItemCaseSensitive(nwdaf_capabilityJSON, "analyticsAggregation"); + if (analytics_aggregation) { + if (!cJSON_IsBool(analytics_aggregation)) { + ogs_error("OpenAPI_nwdaf_capability_parseFromJSON() failed [analytics_aggregation]"); + goto end; + } + } + + analytics_metadata_provisioning = cJSON_GetObjectItemCaseSensitive(nwdaf_capabilityJSON, "analyticsMetadataProvisioning"); + if (analytics_metadata_provisioning) { + if (!cJSON_IsBool(analytics_metadata_provisioning)) { + ogs_error("OpenAPI_nwdaf_capability_parseFromJSON() failed [analytics_metadata_provisioning]"); + goto end; + } + } + + nwdaf_capability_local_var = OpenAPI_nwdaf_capability_create ( + analytics_aggregation ? true : false, + analytics_aggregation ? analytics_aggregation->valueint : 0, + analytics_metadata_provisioning ? true : false, + analytics_metadata_provisioning ? analytics_metadata_provisioning->valueint : 0 + ); + + return nwdaf_capability_local_var; +end: + return NULL; +} + +OpenAPI_nwdaf_capability_t *OpenAPI_nwdaf_capability_copy(OpenAPI_nwdaf_capability_t *dst, OpenAPI_nwdaf_capability_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_nwdaf_capability_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_nwdaf_capability_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_nwdaf_capability_free(dst); + dst = OpenAPI_nwdaf_capability_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/nwdaf_capability.h b/lib/sbi/openapi/model/nwdaf_capability.h new file mode 100644 index 000000000..96040915e --- /dev/null +++ b/lib/sbi/openapi/model/nwdaf_capability.h @@ -0,0 +1,44 @@ +/* + * nwdaf_capability.h + * + * Indicates the capability supported by the NWDAF + */ + +#ifndef _OpenAPI_nwdaf_capability_H_ +#define _OpenAPI_nwdaf_capability_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_nwdaf_capability_s OpenAPI_nwdaf_capability_t; +typedef struct OpenAPI_nwdaf_capability_s { + bool is_analytics_aggregation; + int analytics_aggregation; + bool is_analytics_metadata_provisioning; + int analytics_metadata_provisioning; +} OpenAPI_nwdaf_capability_t; + +OpenAPI_nwdaf_capability_t *OpenAPI_nwdaf_capability_create( + bool is_analytics_aggregation, + int analytics_aggregation, + bool is_analytics_metadata_provisioning, + int analytics_metadata_provisioning +); +void OpenAPI_nwdaf_capability_free(OpenAPI_nwdaf_capability_t *nwdaf_capability); +OpenAPI_nwdaf_capability_t *OpenAPI_nwdaf_capability_parseFromJSON(cJSON *nwdaf_capabilityJSON); +cJSON *OpenAPI_nwdaf_capability_convertToJSON(OpenAPI_nwdaf_capability_t *nwdaf_capability); +OpenAPI_nwdaf_capability_t *OpenAPI_nwdaf_capability_copy(OpenAPI_nwdaf_capability_t *dst, OpenAPI_nwdaf_capability_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_nwdaf_capability_H_ */ + diff --git a/lib/sbi/openapi/model/nwdaf_cond.c b/lib/sbi/openapi/model/nwdaf_cond.c index cee7713f9..627ded7f7 100644 --- a/lib/sbi/openapi/model/nwdaf_cond.c +++ b/lib/sbi/openapi/model/nwdaf_cond.c @@ -32,7 +32,10 @@ OpenAPI_nwdaf_cond_t *OpenAPI_nwdaf_cond_create( OpenAPI_list_t *analytics_ids, OpenAPI_list_t *snssai_list, OpenAPI_list_t *tai_list, - OpenAPI_list_t *tai_range_list + OpenAPI_list_t *tai_range_list, + OpenAPI_list_t *serving_nf_type_list, + OpenAPI_list_t *serving_nf_set_id_list, + OpenAPI_list_t *ml_analytics_list ) { OpenAPI_nwdaf_cond_t *nwdaf_cond_local_var = ogs_malloc(sizeof(OpenAPI_nwdaf_cond_t)); @@ -43,6 +46,9 @@ OpenAPI_nwdaf_cond_t *OpenAPI_nwdaf_cond_create( nwdaf_cond_local_var->snssai_list = snssai_list; nwdaf_cond_local_var->tai_list = tai_list; nwdaf_cond_local_var->tai_range_list = tai_range_list; + nwdaf_cond_local_var->serving_nf_type_list = serving_nf_type_list; + nwdaf_cond_local_var->serving_nf_set_id_list = serving_nf_set_id_list; + nwdaf_cond_local_var->ml_analytics_list = ml_analytics_list; return nwdaf_cond_local_var; } @@ -82,6 +88,24 @@ void OpenAPI_nwdaf_cond_free(OpenAPI_nwdaf_cond_t *nwdaf_cond) OpenAPI_list_free(nwdaf_cond->tai_range_list); nwdaf_cond->tai_range_list = NULL; } + if (nwdaf_cond->serving_nf_type_list) { + OpenAPI_list_free(nwdaf_cond->serving_nf_type_list); + nwdaf_cond->serving_nf_type_list = NULL; + } + if (nwdaf_cond->serving_nf_set_id_list) { + OpenAPI_list_for_each(nwdaf_cond->serving_nf_set_id_list, node) { + ogs_free(node->data); + } + OpenAPI_list_free(nwdaf_cond->serving_nf_set_id_list); + nwdaf_cond->serving_nf_set_id_list = NULL; + } + if (nwdaf_cond->ml_analytics_list) { + OpenAPI_list_for_each(nwdaf_cond->ml_analytics_list, node) { + OpenAPI_ml_analytics_info_free(node->data); + } + OpenAPI_list_free(nwdaf_cond->ml_analytics_list); + nwdaf_cond->ml_analytics_list = NULL; + } ogs_free(nwdaf_cond); } @@ -167,6 +191,50 @@ cJSON *OpenAPI_nwdaf_cond_convertToJSON(OpenAPI_nwdaf_cond_t *nwdaf_cond) } } + if (nwdaf_cond->serving_nf_type_list != OpenAPI_nf_type_NULL) { + cJSON *serving_nf_type_listList = cJSON_AddArrayToObject(item, "servingNfTypeList"); + if (serving_nf_type_listList == NULL) { + ogs_error("OpenAPI_nwdaf_cond_convertToJSON() failed [serving_nf_type_list]"); + goto end; + } + OpenAPI_list_for_each(nwdaf_cond->serving_nf_type_list, node) { + if (cJSON_AddStringToObject(serving_nf_type_listList, "", OpenAPI_nf_type_ToString((intptr_t)node->data)) == NULL) { + ogs_error("OpenAPI_nwdaf_cond_convertToJSON() failed [serving_nf_type_list]"); + goto end; + } + } + } + + if (nwdaf_cond->serving_nf_set_id_list) { + cJSON *serving_nf_set_id_listList = cJSON_AddArrayToObject(item, "servingNfSetIdList"); + if (serving_nf_set_id_listList == NULL) { + ogs_error("OpenAPI_nwdaf_cond_convertToJSON() failed [serving_nf_set_id_list]"); + goto end; + } + OpenAPI_list_for_each(nwdaf_cond->serving_nf_set_id_list, node) { + if (cJSON_AddStringToObject(serving_nf_set_id_listList, "", (char*)node->data) == NULL) { + ogs_error("OpenAPI_nwdaf_cond_convertToJSON() failed [serving_nf_set_id_list]"); + goto end; + } + } + } + + if (nwdaf_cond->ml_analytics_list) { + cJSON *ml_analytics_listList = cJSON_AddArrayToObject(item, "mlAnalyticsList"); + if (ml_analytics_listList == NULL) { + ogs_error("OpenAPI_nwdaf_cond_convertToJSON() failed [ml_analytics_list]"); + goto end; + } + OpenAPI_list_for_each(nwdaf_cond->ml_analytics_list, node) { + cJSON *itemLocal = OpenAPI_ml_analytics_info_convertToJSON(node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_nwdaf_cond_convertToJSON() failed [ml_analytics_list]"); + goto end; + } + cJSON_AddItemToArray(ml_analytics_listList, itemLocal); + } + } + end: return item; } @@ -185,6 +253,12 @@ OpenAPI_nwdaf_cond_t *OpenAPI_nwdaf_cond_parseFromJSON(cJSON *nwdaf_condJSON) OpenAPI_list_t *tai_listList = NULL; cJSON *tai_range_list = NULL; OpenAPI_list_t *tai_range_listList = NULL; + cJSON *serving_nf_type_list = NULL; + OpenAPI_list_t *serving_nf_type_listList = NULL; + cJSON *serving_nf_set_id_list = NULL; + OpenAPI_list_t *serving_nf_set_id_listList = NULL; + cJSON *ml_analytics_list = NULL; + OpenAPI_list_t *ml_analytics_listList = NULL; condition_type = cJSON_GetObjectItemCaseSensitive(nwdaf_condJSON, "conditionType"); if (!condition_type) { ogs_error("OpenAPI_nwdaf_cond_parseFromJSON() failed [condition_type]"); @@ -292,12 +366,80 @@ OpenAPI_nwdaf_cond_t *OpenAPI_nwdaf_cond_parseFromJSON(cJSON *nwdaf_condJSON) } } + serving_nf_type_list = cJSON_GetObjectItemCaseSensitive(nwdaf_condJSON, "servingNfTypeList"); + if (serving_nf_type_list) { + cJSON *serving_nf_type_list_local = NULL; + if (!cJSON_IsArray(serving_nf_type_list)) { + ogs_error("OpenAPI_nwdaf_cond_parseFromJSON() failed [serving_nf_type_list]"); + goto end; + } + + serving_nf_type_listList = OpenAPI_list_create(); + + cJSON_ArrayForEach(serving_nf_type_list_local, serving_nf_type_list) { + if (!cJSON_IsString(serving_nf_type_list_local)) { + ogs_error("OpenAPI_nwdaf_cond_parseFromJSON() failed [serving_nf_type_list]"); + goto end; + } + OpenAPI_list_add(serving_nf_type_listList, (void *)OpenAPI_nf_type_FromString(serving_nf_type_list_local->valuestring)); + } + } + + serving_nf_set_id_list = cJSON_GetObjectItemCaseSensitive(nwdaf_condJSON, "servingNfSetIdList"); + if (serving_nf_set_id_list) { + cJSON *serving_nf_set_id_list_local = NULL; + if (!cJSON_IsArray(serving_nf_set_id_list)) { + ogs_error("OpenAPI_nwdaf_cond_parseFromJSON() failed [serving_nf_set_id_list]"); + goto end; + } + + serving_nf_set_id_listList = OpenAPI_list_create(); + + cJSON_ArrayForEach(serving_nf_set_id_list_local, serving_nf_set_id_list) { + double *localDouble = NULL; + int *localInt = NULL; + if (!cJSON_IsString(serving_nf_set_id_list_local)) { + ogs_error("OpenAPI_nwdaf_cond_parseFromJSON() failed [serving_nf_set_id_list]"); + goto end; + } + OpenAPI_list_add(serving_nf_set_id_listList, ogs_strdup(serving_nf_set_id_list_local->valuestring)); + } + } + + ml_analytics_list = cJSON_GetObjectItemCaseSensitive(nwdaf_condJSON, "mlAnalyticsList"); + if (ml_analytics_list) { + cJSON *ml_analytics_list_local = NULL; + if (!cJSON_IsArray(ml_analytics_list)) { + ogs_error("OpenAPI_nwdaf_cond_parseFromJSON() failed [ml_analytics_list]"); + goto end; + } + + ml_analytics_listList = OpenAPI_list_create(); + + cJSON_ArrayForEach(ml_analytics_list_local, ml_analytics_list) { + if (!cJSON_IsObject(ml_analytics_list_local)) { + ogs_error("OpenAPI_nwdaf_cond_parseFromJSON() failed [ml_analytics_list]"); + goto end; + } + OpenAPI_ml_analytics_info_t *ml_analytics_listItem = OpenAPI_ml_analytics_info_parseFromJSON(ml_analytics_list_local); + if (!ml_analytics_listItem) { + ogs_error("No ml_analytics_listItem"); + OpenAPI_list_free(ml_analytics_listList); + goto end; + } + OpenAPI_list_add(ml_analytics_listList, ml_analytics_listItem); + } + } + nwdaf_cond_local_var = OpenAPI_nwdaf_cond_create ( condition_typeVariable, analytics_ids ? analytics_idsList : NULL, snssai_list ? snssai_listList : NULL, tai_list ? tai_listList : NULL, - tai_range_list ? tai_range_listList : NULL + tai_range_list ? tai_range_listList : NULL, + serving_nf_type_list ? serving_nf_type_listList : NULL, + serving_nf_set_id_list ? serving_nf_set_id_listList : NULL, + ml_analytics_list ? ml_analytics_listList : NULL ); return nwdaf_cond_local_var; @@ -330,6 +472,24 @@ end: OpenAPI_list_free(tai_range_listList); tai_range_listList = NULL; } + if (serving_nf_type_listList) { + OpenAPI_list_free(serving_nf_type_listList); + serving_nf_type_listList = NULL; + } + if (serving_nf_set_id_listList) { + OpenAPI_list_for_each(serving_nf_set_id_listList, node) { + ogs_free(node->data); + } + OpenAPI_list_free(serving_nf_set_id_listList); + serving_nf_set_id_listList = NULL; + } + if (ml_analytics_listList) { + OpenAPI_list_for_each(ml_analytics_listList, node) { + OpenAPI_ml_analytics_info_free(node->data); + } + OpenAPI_list_free(ml_analytics_listList); + ml_analytics_listList = NULL; + } return NULL; } diff --git a/lib/sbi/openapi/model/nwdaf_cond.h b/lib/sbi/openapi/model/nwdaf_cond.h index 4628c00c8..d997a182d 100644 --- a/lib/sbi/openapi/model/nwdaf_cond.h +++ b/lib/sbi/openapi/model/nwdaf_cond.h @@ -1,7 +1,7 @@ /* * nwdaf_cond.h * - * Subscription to a set of NF Instances (NWDAFs), identified by Analytics ID(s), S-NSSAI(s) or NWDAF Serving Area information, i.e. list of TAIs for which the NWDAF can provide analytics. + * Subscription to a set of NF Instances (NWDAFs), identified by Analytics ID(s), S-NSSAI(s) or NWDAF Serving Area information, i.e. list of TAIs for which the NWDAF can provide analytics. */ #ifndef _OpenAPI_nwdaf_cond_H_ @@ -12,6 +12,8 @@ #include "../include/list.h" #include "../include/keyValuePair.h" #include "../include/binary.h" +#include "ml_analytics_info.h" +#include "nf_type.h" #include "snssai.h" #include "tai.h" #include "tai_range.h" @@ -32,6 +34,9 @@ typedef struct OpenAPI_nwdaf_cond_s { OpenAPI_list_t *snssai_list; OpenAPI_list_t *tai_list; OpenAPI_list_t *tai_range_list; + OpenAPI_list_t *serving_nf_type_list; + OpenAPI_list_t *serving_nf_set_id_list; + OpenAPI_list_t *ml_analytics_list; } OpenAPI_nwdaf_cond_t; OpenAPI_nwdaf_cond_t *OpenAPI_nwdaf_cond_create( @@ -39,7 +44,10 @@ OpenAPI_nwdaf_cond_t *OpenAPI_nwdaf_cond_create( OpenAPI_list_t *analytics_ids, OpenAPI_list_t *snssai_list, OpenAPI_list_t *tai_list, - OpenAPI_list_t *tai_range_list + OpenAPI_list_t *tai_range_list, + OpenAPI_list_t *serving_nf_type_list, + OpenAPI_list_t *serving_nf_set_id_list, + OpenAPI_list_t *ml_analytics_list ); void OpenAPI_nwdaf_cond_free(OpenAPI_nwdaf_cond_t *nwdaf_cond); OpenAPI_nwdaf_cond_t *OpenAPI_nwdaf_cond_parseFromJSON(cJSON *nwdaf_condJSON); diff --git a/lib/sbi/openapi/model/nwdaf_data.c b/lib/sbi/openapi/model/nwdaf_data.c new file mode 100644 index 000000000..eb21b73fc --- /dev/null +++ b/lib/sbi/openapi/model/nwdaf_data.c @@ -0,0 +1,174 @@ + +#include +#include +#include +#include "nwdaf_data.h" + +OpenAPI_nwdaf_data_t *OpenAPI_nwdaf_data_create( + char *nwdaf_instance_id, + OpenAPI_list_t *nwdaf_events +) +{ + OpenAPI_nwdaf_data_t *nwdaf_data_local_var = ogs_malloc(sizeof(OpenAPI_nwdaf_data_t)); + ogs_assert(nwdaf_data_local_var); + + nwdaf_data_local_var->nwdaf_instance_id = nwdaf_instance_id; + nwdaf_data_local_var->nwdaf_events = nwdaf_events; + + return nwdaf_data_local_var; +} + +void OpenAPI_nwdaf_data_free(OpenAPI_nwdaf_data_t *nwdaf_data) +{ + OpenAPI_lnode_t *node = NULL; + + if (NULL == nwdaf_data) { + return; + } + if (nwdaf_data->nwdaf_instance_id) { + ogs_free(nwdaf_data->nwdaf_instance_id); + nwdaf_data->nwdaf_instance_id = NULL; + } + if (nwdaf_data->nwdaf_events) { + OpenAPI_list_for_each(nwdaf_data->nwdaf_events, node) { + OpenAPI_nwdaf_event_free(node->data); + } + OpenAPI_list_free(nwdaf_data->nwdaf_events); + nwdaf_data->nwdaf_events = NULL; + } + ogs_free(nwdaf_data); +} + +cJSON *OpenAPI_nwdaf_data_convertToJSON(OpenAPI_nwdaf_data_t *nwdaf_data) +{ + cJSON *item = NULL; + OpenAPI_lnode_t *node = NULL; + + if (nwdaf_data == NULL) { + ogs_error("OpenAPI_nwdaf_data_convertToJSON() failed [NwdafData]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (!nwdaf_data->nwdaf_instance_id) { + ogs_error("OpenAPI_nwdaf_data_convertToJSON() failed [nwdaf_instance_id]"); + return NULL; + } + if (cJSON_AddStringToObject(item, "nwdafInstanceId", nwdaf_data->nwdaf_instance_id) == NULL) { + ogs_error("OpenAPI_nwdaf_data_convertToJSON() failed [nwdaf_instance_id]"); + goto end; + } + + if (nwdaf_data->nwdaf_events) { + cJSON *nwdaf_eventsList = cJSON_AddArrayToObject(item, "nwdafEvents"); + if (nwdaf_eventsList == NULL) { + ogs_error("OpenAPI_nwdaf_data_convertToJSON() failed [nwdaf_events]"); + goto end; + } + OpenAPI_list_for_each(nwdaf_data->nwdaf_events, node) { + cJSON *itemLocal = OpenAPI_nwdaf_event_convertToJSON(node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_nwdaf_data_convertToJSON() failed [nwdaf_events]"); + goto end; + } + cJSON_AddItemToArray(nwdaf_eventsList, itemLocal); + } + } + +end: + return item; +} + +OpenAPI_nwdaf_data_t *OpenAPI_nwdaf_data_parseFromJSON(cJSON *nwdaf_dataJSON) +{ + OpenAPI_nwdaf_data_t *nwdaf_data_local_var = NULL; + OpenAPI_lnode_t *node = NULL; + cJSON *nwdaf_instance_id = NULL; + cJSON *nwdaf_events = NULL; + OpenAPI_list_t *nwdaf_eventsList = NULL; + nwdaf_instance_id = cJSON_GetObjectItemCaseSensitive(nwdaf_dataJSON, "nwdafInstanceId"); + if (!nwdaf_instance_id) { + ogs_error("OpenAPI_nwdaf_data_parseFromJSON() failed [nwdaf_instance_id]"); + goto end; + } + if (!cJSON_IsString(nwdaf_instance_id)) { + ogs_error("OpenAPI_nwdaf_data_parseFromJSON() failed [nwdaf_instance_id]"); + goto end; + } + + nwdaf_events = cJSON_GetObjectItemCaseSensitive(nwdaf_dataJSON, "nwdafEvents"); + if (nwdaf_events) { + cJSON *nwdaf_events_local = NULL; + if (!cJSON_IsArray(nwdaf_events)) { + ogs_error("OpenAPI_nwdaf_data_parseFromJSON() failed [nwdaf_events]"); + goto end; + } + + nwdaf_eventsList = OpenAPI_list_create(); + + cJSON_ArrayForEach(nwdaf_events_local, nwdaf_events) { + if (!cJSON_IsObject(nwdaf_events_local)) { + ogs_error("OpenAPI_nwdaf_data_parseFromJSON() failed [nwdaf_events]"); + goto end; + } + OpenAPI_nwdaf_event_t *nwdaf_eventsItem = OpenAPI_nwdaf_event_parseFromJSON(nwdaf_events_local); + if (!nwdaf_eventsItem) { + ogs_error("No nwdaf_eventsItem"); + OpenAPI_list_free(nwdaf_eventsList); + goto end; + } + OpenAPI_list_add(nwdaf_eventsList, nwdaf_eventsItem); + } + } + + nwdaf_data_local_var = OpenAPI_nwdaf_data_create ( + ogs_strdup(nwdaf_instance_id->valuestring), + nwdaf_events ? nwdaf_eventsList : NULL + ); + + return nwdaf_data_local_var; +end: + if (nwdaf_eventsList) { + OpenAPI_list_for_each(nwdaf_eventsList, node) { + OpenAPI_nwdaf_event_free(node->data); + } + OpenAPI_list_free(nwdaf_eventsList); + nwdaf_eventsList = NULL; + } + return NULL; +} + +OpenAPI_nwdaf_data_t *OpenAPI_nwdaf_data_copy(OpenAPI_nwdaf_data_t *dst, OpenAPI_nwdaf_data_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_nwdaf_data_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_nwdaf_data_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_nwdaf_data_free(dst); + dst = OpenAPI_nwdaf_data_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/nwdaf_data.h b/lib/sbi/openapi/model/nwdaf_data.h new file mode 100644 index 000000000..abbecb4ed --- /dev/null +++ b/lib/sbi/openapi/model/nwdaf_data.h @@ -0,0 +1,41 @@ +/* + * nwdaf_data.h + * + * Indicates the list of Analytic ID(s) per NWDAF instance ID used for the PDU Session consumed by the SMF. + */ + +#ifndef _OpenAPI_nwdaf_data_H_ +#define _OpenAPI_nwdaf_data_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "nwdaf_event.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_nwdaf_data_s OpenAPI_nwdaf_data_t; +typedef struct OpenAPI_nwdaf_data_s { + char *nwdaf_instance_id; + OpenAPI_list_t *nwdaf_events; +} OpenAPI_nwdaf_data_t; + +OpenAPI_nwdaf_data_t *OpenAPI_nwdaf_data_create( + char *nwdaf_instance_id, + OpenAPI_list_t *nwdaf_events +); +void OpenAPI_nwdaf_data_free(OpenAPI_nwdaf_data_t *nwdaf_data); +OpenAPI_nwdaf_data_t *OpenAPI_nwdaf_data_parseFromJSON(cJSON *nwdaf_dataJSON); +cJSON *OpenAPI_nwdaf_data_convertToJSON(OpenAPI_nwdaf_data_t *nwdaf_data); +OpenAPI_nwdaf_data_t *OpenAPI_nwdaf_data_copy(OpenAPI_nwdaf_data_t *dst, OpenAPI_nwdaf_data_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_nwdaf_data_H_ */ + diff --git a/lib/sbi/openapi/model/nwdaf_event.h b/lib/sbi/openapi/model/nwdaf_event.h index cd04b72c6..c262a2e72 100644 --- a/lib/sbi/openapi/model/nwdaf_event.h +++ b/lib/sbi/openapi/model/nwdaf_event.h @@ -1,7 +1,7 @@ /* * nwdaf_event.h * - * Possible values are - SLICE_LOAD_LEVEL: Indicates that the event subscribed is load level information of Network Slice - NETWORK_PERFORMANCE: Indicates that the event subscribed is network performance information. - NF_LOAD: Indicates that the event subscribed is load level and status of one or several Network Functions. - SERVICE_EXPERIENCE: Indicates that the event subscribed is service experience. - UE_MOBILITY: Indicates that the event subscribed is UE mobility information. - UE_COMMUNICATION: Indicates that the event subscribed is UE communication information. - QOS_SUSTAINABILITY: Indicates that the event subscribed is QoS sustainability. - ABNORMAL_BEHAVIOUR: Indicates that the event subscribed is abnormal behaviour. - USER_DATA_CONGESTION: Indicates that the event subscribed is user data congestion information. - NSI_LOAD_LEVEL: Indicates that the event subscribed is load level information of Network Slice and the optionally associated Network Slice Instance + * Possible values are: - SLICE_LOAD_LEVEL: Indicates that the event subscribed is load level information of Network Slice - NETWORK_PERFORMANCE: Indicates that the event subscribed is network performance information. - NF_LOAD: Indicates that the event subscribed is load level and status of one or several Network Functions. - SERVICE_EXPERIENCE: Indicates that the event subscribed is service experience. - UE_MOBILITY: Indicates that the event subscribed is UE mobility information. - UE_COMMUNICATION: Indicates that the event subscribed is UE communication information. - QOS_SUSTAINABILITY: Indicates that the event subscribed is QoS sustainability. - ABNORMAL_BEHAVIOUR: Indicates that the event subscribed is abnormal behaviour. - USER_DATA_CONGESTION: Indicates that the event subscribed is user data congestion information. - NSI_LOAD_LEVEL: Indicates that the event subscribed is load level information of Network Slice and the optionally associated Network Slice Instance - DN_PERFORMANCE: Indicates that the event subscribed is DN performance information. - DISPERSION: Indicates that the event subscribed is dispersion information. - RED_TRANS_EXP: Indicates that the event subscribed is redundant transmission experience. - WLAN_PERFORMANCE: Indicates that the event subscribed is WLAN performance. - SM_CONGESTION: Indicates the Session Management Congestion Control Experience information for specific DNN and/or S-NSSAI. */ #ifndef _OpenAPI_nwdaf_event_H_ diff --git a/lib/sbi/openapi/model/nwdaf_event_any_of.c b/lib/sbi/openapi/model/nwdaf_event_any_of.c index 8316bb439..d17018610 100644 --- a/lib/sbi/openapi/model/nwdaf_event_any_of.c +++ b/lib/sbi/openapi/model/nwdaf_event_any_of.c @@ -6,7 +6,7 @@ char* OpenAPI_nwdaf_event_any_of_ToString(OpenAPI_nwdaf_event_any_of_e nwdaf_event_any_of) { - const char *nwdaf_event_any_ofArray[] = { "NULL", "SLICE_LOAD_LEVEL", "NETWORK_PERFORMANCE", "NF_LOAD", "SERVICE_EXPERIENCE", "UE_MOBILITY", "UE_COMMUNICATION", "QOS_SUSTAINABILITY", "ABNORMAL_BEHAVIOUR", "USER_DATA_CONGESTION", "NSI_LOAD_LEVEL" }; + const char *nwdaf_event_any_ofArray[] = { "NULL", "SLICE_LOAD_LEVEL", "NETWORK_PERFORMANCE", "NF_LOAD", "SERVICE_EXPERIENCE", "UE_MOBILITY", "UE_COMMUNICATION", "QOS_SUSTAINABILITY", "ABNORMAL_BEHAVIOUR", "USER_DATA_CONGESTION", "NSI_LOAD_LEVEL", "DN_PERFORMANCE", "DISPERSION", "RED_TRANS_EXP", "WLAN_PERFORMANCE", "SM_CONGESTION" }; size_t sizeofArray = sizeof(nwdaf_event_any_ofArray) / sizeof(nwdaf_event_any_ofArray[0]); if (nwdaf_event_any_of < sizeofArray) return (char *)nwdaf_event_any_ofArray[nwdaf_event_any_of]; @@ -17,7 +17,7 @@ char* OpenAPI_nwdaf_event_any_of_ToString(OpenAPI_nwdaf_event_any_of_e nwdaf_eve OpenAPI_nwdaf_event_any_of_e OpenAPI_nwdaf_event_any_of_FromString(char* nwdaf_event_any_of) { int stringToReturn = 0; - const char *nwdaf_event_any_ofArray[] = { "NULL", "SLICE_LOAD_LEVEL", "NETWORK_PERFORMANCE", "NF_LOAD", "SERVICE_EXPERIENCE", "UE_MOBILITY", "UE_COMMUNICATION", "QOS_SUSTAINABILITY", "ABNORMAL_BEHAVIOUR", "USER_DATA_CONGESTION", "NSI_LOAD_LEVEL" }; + const char *nwdaf_event_any_ofArray[] = { "NULL", "SLICE_LOAD_LEVEL", "NETWORK_PERFORMANCE", "NF_LOAD", "SERVICE_EXPERIENCE", "UE_MOBILITY", "UE_COMMUNICATION", "QOS_SUSTAINABILITY", "ABNORMAL_BEHAVIOUR", "USER_DATA_CONGESTION", "NSI_LOAD_LEVEL", "DN_PERFORMANCE", "DISPERSION", "RED_TRANS_EXP", "WLAN_PERFORMANCE", "SM_CONGESTION" }; size_t sizeofArray = sizeof(nwdaf_event_any_ofArray) / sizeof(nwdaf_event_any_ofArray[0]); while (stringToReturn < sizeofArray) { if (strcmp(nwdaf_event_any_of, nwdaf_event_any_ofArray[stringToReturn]) == 0) { diff --git a/lib/sbi/openapi/model/nwdaf_event_any_of.h b/lib/sbi/openapi/model/nwdaf_event_any_of.h index 52c15aea7..9c9fb4281 100644 --- a/lib/sbi/openapi/model/nwdaf_event_any_of.h +++ b/lib/sbi/openapi/model/nwdaf_event_any_of.h @@ -17,7 +17,7 @@ extern "C" { #endif -typedef enum { OpenAPI_nwdaf_event_any_of_NULL = 0, OpenAPI_nwdaf_event_any_of_SLICE_LOAD_LEVEL, OpenAPI_nwdaf_event_any_of_NETWORK_PERFORMANCE, OpenAPI_nwdaf_event_any_of_NF_LOAD, OpenAPI_nwdaf_event_any_of_SERVICE_EXPERIENCE, OpenAPI_nwdaf_event_any_of_UE_MOBILITY, OpenAPI_nwdaf_event_any_of_UE_COMMUNICATION, OpenAPI_nwdaf_event_any_of_QOS_SUSTAINABILITY, OpenAPI_nwdaf_event_any_of_ABNORMAL_BEHAVIOUR, OpenAPI_nwdaf_event_any_of_USER_DATA_CONGESTION, OpenAPI_nwdaf_event_any_of_NSI_LOAD_LEVEL } OpenAPI_nwdaf_event_any_of_e; +typedef enum { OpenAPI_nwdaf_event_any_of_NULL = 0, OpenAPI_nwdaf_event_any_of_SLICE_LOAD_LEVEL, OpenAPI_nwdaf_event_any_of_NETWORK_PERFORMANCE, OpenAPI_nwdaf_event_any_of_NF_LOAD, OpenAPI_nwdaf_event_any_of_SERVICE_EXPERIENCE, OpenAPI_nwdaf_event_any_of_UE_MOBILITY, OpenAPI_nwdaf_event_any_of_UE_COMMUNICATION, OpenAPI_nwdaf_event_any_of_QOS_SUSTAINABILITY, OpenAPI_nwdaf_event_any_of_ABNORMAL_BEHAVIOUR, OpenAPI_nwdaf_event_any_of_USER_DATA_CONGESTION, OpenAPI_nwdaf_event_any_of_NSI_LOAD_LEVEL, OpenAPI_nwdaf_event_any_of_DN_PERFORMANCE, OpenAPI_nwdaf_event_any_of_DISPERSION, OpenAPI_nwdaf_event_any_of_RED_TRANS_EXP, OpenAPI_nwdaf_event_any_of_WLAN_PERFORMANCE, OpenAPI_nwdaf_event_any_of_SM_CONGESTION } OpenAPI_nwdaf_event_any_of_e; char* OpenAPI_nwdaf_event_any_of_ToString(OpenAPI_nwdaf_event_any_of_e nwdaf_event_any_of); diff --git a/lib/sbi/openapi/model/nwdaf_failure_code.c b/lib/sbi/openapi/model/nwdaf_failure_code.c new file mode 100644 index 000000000..07827fe11 --- /dev/null +++ b/lib/sbi/openapi/model/nwdaf_failure_code.c @@ -0,0 +1,87 @@ + +#include +#include +#include +#include "nwdaf_failure_code.h" + +OpenAPI_nwdaf_failure_code_t *OpenAPI_nwdaf_failure_code_create( +) +{ + OpenAPI_nwdaf_failure_code_t *nwdaf_failure_code_local_var = ogs_malloc(sizeof(OpenAPI_nwdaf_failure_code_t)); + ogs_assert(nwdaf_failure_code_local_var); + + + return nwdaf_failure_code_local_var; +} + +void OpenAPI_nwdaf_failure_code_free(OpenAPI_nwdaf_failure_code_t *nwdaf_failure_code) +{ + OpenAPI_lnode_t *node = NULL; + + if (NULL == nwdaf_failure_code) { + return; + } + ogs_free(nwdaf_failure_code); +} + +cJSON *OpenAPI_nwdaf_failure_code_convertToJSON(OpenAPI_nwdaf_failure_code_t *nwdaf_failure_code) +{ + cJSON *item = NULL; + OpenAPI_lnode_t *node = NULL; + + if (nwdaf_failure_code == NULL) { + ogs_error("OpenAPI_nwdaf_failure_code_convertToJSON() failed [NwdafFailureCode]"); + return NULL; + } + + item = cJSON_CreateObject(); +end: + return item; +} + +OpenAPI_nwdaf_failure_code_t *OpenAPI_nwdaf_failure_code_parseFromJSON(cJSON *nwdaf_failure_codeJSON) +{ + OpenAPI_nwdaf_failure_code_t *nwdaf_failure_code_local_var = NULL; + OpenAPI_lnode_t *node = NULL; + nwdaf_failure_code_local_var = OpenAPI_nwdaf_failure_code_create ( + ); + + return nwdaf_failure_code_local_var; +end: + return NULL; +} + +OpenAPI_nwdaf_failure_code_t *OpenAPI_nwdaf_failure_code_copy(OpenAPI_nwdaf_failure_code_t *dst, OpenAPI_nwdaf_failure_code_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_nwdaf_failure_code_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_nwdaf_failure_code_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_nwdaf_failure_code_free(dst); + dst = OpenAPI_nwdaf_failure_code_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/nwdaf_failure_code.h b/lib/sbi/openapi/model/nwdaf_failure_code.h new file mode 100644 index 000000000..6a2ebc460 --- /dev/null +++ b/lib/sbi/openapi/model/nwdaf_failure_code.h @@ -0,0 +1,37 @@ +/* + * nwdaf_failure_code.h + * + * Possible values are: - UNAVAILABLE_DATA: Indicates the requested statistics information for the event is rejected since necessary data to perform the service is unavailable. - BOTH_STAT_PRED_NOT_ALLOWED: Indicates the requested analysis information for the event is rejected since the start time is in the past and the end time is in the future, which means the NF service consumer requested both statistics and prediction for the analytics. - UNSATISFIED_REQUESTED_ANALYTICS_TIME: Indicates that the requested event is rejected since the analytics information is not ready when the time indicated by the \"timeAnaNeeded\" attribute (as provided during the creation or modification of subscription) is reached. - OTHER: Indicates the requested analysis information for the event is rejected due to other reasons. + */ + +#ifndef _OpenAPI_nwdaf_failure_code_H_ +#define _OpenAPI_nwdaf_failure_code_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "nwdaf_failure_code_any_of.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_nwdaf_failure_code_s OpenAPI_nwdaf_failure_code_t; +typedef struct OpenAPI_nwdaf_failure_code_s { +} OpenAPI_nwdaf_failure_code_t; + +OpenAPI_nwdaf_failure_code_t *OpenAPI_nwdaf_failure_code_create( +); +void OpenAPI_nwdaf_failure_code_free(OpenAPI_nwdaf_failure_code_t *nwdaf_failure_code); +OpenAPI_nwdaf_failure_code_t *OpenAPI_nwdaf_failure_code_parseFromJSON(cJSON *nwdaf_failure_codeJSON); +cJSON *OpenAPI_nwdaf_failure_code_convertToJSON(OpenAPI_nwdaf_failure_code_t *nwdaf_failure_code); +OpenAPI_nwdaf_failure_code_t *OpenAPI_nwdaf_failure_code_copy(OpenAPI_nwdaf_failure_code_t *dst, OpenAPI_nwdaf_failure_code_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_nwdaf_failure_code_H_ */ + diff --git a/lib/sbi/openapi/model/nwdaf_failure_code_any_of.c b/lib/sbi/openapi/model/nwdaf_failure_code_any_of.c new file mode 100644 index 000000000..6a81f6110 --- /dev/null +++ b/lib/sbi/openapi/model/nwdaf_failure_code_any_of.c @@ -0,0 +1,30 @@ + +#include +#include +#include +#include "nwdaf_failure_code_any_of.h" + +char* OpenAPI_nwdaf_failure_code_any_of_ToString(OpenAPI_nwdaf_failure_code_any_of_e nwdaf_failure_code_any_of) +{ + const char *nwdaf_failure_code_any_ofArray[] = { "NULL", "UNAVAILABLE_DATA", "BOTH_STAT_PRED_NOT_ALLOWED", "UNSATISFIED_REQUESTED_ANALYTICS_TIME", "OTHER" }; + size_t sizeofArray = sizeof(nwdaf_failure_code_any_ofArray) / sizeof(nwdaf_failure_code_any_ofArray[0]); + if (nwdaf_failure_code_any_of < sizeofArray) + return (char *)nwdaf_failure_code_any_ofArray[nwdaf_failure_code_any_of]; + else + return (char *)"Unknown"; +} + +OpenAPI_nwdaf_failure_code_any_of_e OpenAPI_nwdaf_failure_code_any_of_FromString(char* nwdaf_failure_code_any_of) +{ + int stringToReturn = 0; + const char *nwdaf_failure_code_any_ofArray[] = { "NULL", "UNAVAILABLE_DATA", "BOTH_STAT_PRED_NOT_ALLOWED", "UNSATISFIED_REQUESTED_ANALYTICS_TIME", "OTHER" }; + size_t sizeofArray = sizeof(nwdaf_failure_code_any_ofArray) / sizeof(nwdaf_failure_code_any_ofArray[0]); + while (stringToReturn < sizeofArray) { + if (strcmp(nwdaf_failure_code_any_of, nwdaf_failure_code_any_ofArray[stringToReturn]) == 0) { + return stringToReturn; + } + stringToReturn++; + } + return 0; +} + diff --git a/lib/sbi/openapi/model/nwdaf_failure_code_any_of.h b/lib/sbi/openapi/model/nwdaf_failure_code_any_of.h new file mode 100644 index 000000000..d2b2c1b4c --- /dev/null +++ b/lib/sbi/openapi/model/nwdaf_failure_code_any_of.h @@ -0,0 +1,31 @@ +/* + * nwdaf_failure_code_any_of.h + * + * + */ + +#ifndef _OpenAPI_nwdaf_failure_code_any_of_H_ +#define _OpenAPI_nwdaf_failure_code_any_of_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef enum { OpenAPI_nwdaf_failure_code_any_of_NULL = 0, OpenAPI_nwdaf_failure_code_any_of_UNAVAILABLE_DATA, OpenAPI_nwdaf_failure_code_any_of_BOTH_STAT_PRED_NOT_ALLOWED, OpenAPI_nwdaf_failure_code_any_of_UNSATISFIED_REQUESTED_ANALYTICS_TIME, OpenAPI_nwdaf_failure_code_any_of_OTHER } OpenAPI_nwdaf_failure_code_any_of_e; + +char* OpenAPI_nwdaf_failure_code_any_of_ToString(OpenAPI_nwdaf_failure_code_any_of_e nwdaf_failure_code_any_of); + +OpenAPI_nwdaf_failure_code_any_of_e OpenAPI_nwdaf_failure_code_any_of_FromString(char* nwdaf_failure_code_any_of); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_nwdaf_failure_code_any_of_H_ */ + diff --git a/lib/sbi/openapi/model/nwdaf_info.c b/lib/sbi/openapi/model/nwdaf_info.c index 1055e6681..a6e2f2a2b 100644 --- a/lib/sbi/openapi/model/nwdaf_info.c +++ b/lib/sbi/openapi/model/nwdaf_info.c @@ -8,7 +8,13 @@ OpenAPI_nwdaf_info_t *OpenAPI_nwdaf_info_create( OpenAPI_list_t *event_ids, OpenAPI_list_t *nwdaf_events, OpenAPI_list_t *tai_list, - OpenAPI_list_t *tai_range_list + OpenAPI_list_t *tai_range_list, + OpenAPI_nwdaf_capability_t *nwdaf_capability, + bool is_analytics_delay, + int analytics_delay, + OpenAPI_list_t *serving_nf_set_id_list, + OpenAPI_list_t *serving_nf_type_list, + OpenAPI_list_t *ml_analytics_list ) { OpenAPI_nwdaf_info_t *nwdaf_info_local_var = ogs_malloc(sizeof(OpenAPI_nwdaf_info_t)); @@ -18,6 +24,12 @@ OpenAPI_nwdaf_info_t *OpenAPI_nwdaf_info_create( nwdaf_info_local_var->nwdaf_events = nwdaf_events; nwdaf_info_local_var->tai_list = tai_list; nwdaf_info_local_var->tai_range_list = tai_range_list; + nwdaf_info_local_var->nwdaf_capability = nwdaf_capability; + nwdaf_info_local_var->is_analytics_delay = is_analytics_delay; + nwdaf_info_local_var->analytics_delay = analytics_delay; + nwdaf_info_local_var->serving_nf_set_id_list = serving_nf_set_id_list; + nwdaf_info_local_var->serving_nf_type_list = serving_nf_type_list; + nwdaf_info_local_var->ml_analytics_list = ml_analytics_list; return nwdaf_info_local_var; } @@ -57,6 +69,28 @@ void OpenAPI_nwdaf_info_free(OpenAPI_nwdaf_info_t *nwdaf_info) OpenAPI_list_free(nwdaf_info->tai_range_list); nwdaf_info->tai_range_list = NULL; } + if (nwdaf_info->nwdaf_capability) { + OpenAPI_nwdaf_capability_free(nwdaf_info->nwdaf_capability); + nwdaf_info->nwdaf_capability = NULL; + } + if (nwdaf_info->serving_nf_set_id_list) { + OpenAPI_list_for_each(nwdaf_info->serving_nf_set_id_list, node) { + ogs_free(node->data); + } + OpenAPI_list_free(nwdaf_info->serving_nf_set_id_list); + nwdaf_info->serving_nf_set_id_list = NULL; + } + if (nwdaf_info->serving_nf_type_list) { + OpenAPI_list_free(nwdaf_info->serving_nf_type_list); + nwdaf_info->serving_nf_type_list = NULL; + } + if (nwdaf_info->ml_analytics_list) { + OpenAPI_list_for_each(nwdaf_info->ml_analytics_list, node) { + OpenAPI_ml_analytics_info_free(node->data); + } + OpenAPI_list_free(nwdaf_info->ml_analytics_list); + nwdaf_info->ml_analytics_list = NULL; + } ogs_free(nwdaf_info); } @@ -135,6 +169,70 @@ cJSON *OpenAPI_nwdaf_info_convertToJSON(OpenAPI_nwdaf_info_t *nwdaf_info) } } + if (nwdaf_info->nwdaf_capability) { + cJSON *nwdaf_capability_local_JSON = OpenAPI_nwdaf_capability_convertToJSON(nwdaf_info->nwdaf_capability); + if (nwdaf_capability_local_JSON == NULL) { + ogs_error("OpenAPI_nwdaf_info_convertToJSON() failed [nwdaf_capability]"); + goto end; + } + cJSON_AddItemToObject(item, "nwdafCapability", nwdaf_capability_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_nwdaf_info_convertToJSON() failed [nwdaf_capability]"); + goto end; + } + } + + if (nwdaf_info->is_analytics_delay) { + if (cJSON_AddNumberToObject(item, "analyticsDelay", nwdaf_info->analytics_delay) == NULL) { + ogs_error("OpenAPI_nwdaf_info_convertToJSON() failed [analytics_delay]"); + goto end; + } + } + + if (nwdaf_info->serving_nf_set_id_list) { + cJSON *serving_nf_set_id_listList = cJSON_AddArrayToObject(item, "servingNfSetIdList"); + if (serving_nf_set_id_listList == NULL) { + ogs_error("OpenAPI_nwdaf_info_convertToJSON() failed [serving_nf_set_id_list]"); + goto end; + } + OpenAPI_list_for_each(nwdaf_info->serving_nf_set_id_list, node) { + if (cJSON_AddStringToObject(serving_nf_set_id_listList, "", (char*)node->data) == NULL) { + ogs_error("OpenAPI_nwdaf_info_convertToJSON() failed [serving_nf_set_id_list]"); + goto end; + } + } + } + + if (nwdaf_info->serving_nf_type_list != OpenAPI_nf_type_NULL) { + cJSON *serving_nf_type_listList = cJSON_AddArrayToObject(item, "servingNfTypeList"); + if (serving_nf_type_listList == NULL) { + ogs_error("OpenAPI_nwdaf_info_convertToJSON() failed [serving_nf_type_list]"); + goto end; + } + OpenAPI_list_for_each(nwdaf_info->serving_nf_type_list, node) { + if (cJSON_AddStringToObject(serving_nf_type_listList, "", OpenAPI_nf_type_ToString((intptr_t)node->data)) == NULL) { + ogs_error("OpenAPI_nwdaf_info_convertToJSON() failed [serving_nf_type_list]"); + goto end; + } + } + } + + if (nwdaf_info->ml_analytics_list) { + cJSON *ml_analytics_listList = cJSON_AddArrayToObject(item, "mlAnalyticsList"); + if (ml_analytics_listList == NULL) { + ogs_error("OpenAPI_nwdaf_info_convertToJSON() failed [ml_analytics_list]"); + goto end; + } + OpenAPI_list_for_each(nwdaf_info->ml_analytics_list, node) { + cJSON *itemLocal = OpenAPI_ml_analytics_info_convertToJSON(node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_nwdaf_info_convertToJSON() failed [ml_analytics_list]"); + goto end; + } + cJSON_AddItemToArray(ml_analytics_listList, itemLocal); + } + } + end: return item; } @@ -151,6 +249,15 @@ OpenAPI_nwdaf_info_t *OpenAPI_nwdaf_info_parseFromJSON(cJSON *nwdaf_infoJSON) OpenAPI_list_t *tai_listList = NULL; cJSON *tai_range_list = NULL; OpenAPI_list_t *tai_range_listList = NULL; + cJSON *nwdaf_capability = NULL; + OpenAPI_nwdaf_capability_t *nwdaf_capability_local_nonprim = NULL; + cJSON *analytics_delay = NULL; + cJSON *serving_nf_set_id_list = NULL; + OpenAPI_list_t *serving_nf_set_id_listList = NULL; + cJSON *serving_nf_type_list = NULL; + OpenAPI_list_t *serving_nf_type_listList = NULL; + cJSON *ml_analytics_list = NULL; + OpenAPI_list_t *ml_analytics_listList = NULL; event_ids = cJSON_GetObjectItemCaseSensitive(nwdaf_infoJSON, "eventIds"); if (event_ids) { cJSON *event_ids_local = NULL; @@ -251,11 +358,95 @@ OpenAPI_nwdaf_info_t *OpenAPI_nwdaf_info_parseFromJSON(cJSON *nwdaf_infoJSON) } } + nwdaf_capability = cJSON_GetObjectItemCaseSensitive(nwdaf_infoJSON, "nwdafCapability"); + if (nwdaf_capability) { + nwdaf_capability_local_nonprim = OpenAPI_nwdaf_capability_parseFromJSON(nwdaf_capability); + } + + analytics_delay = cJSON_GetObjectItemCaseSensitive(nwdaf_infoJSON, "analyticsDelay"); + if (analytics_delay) { + if (!cJSON_IsNumber(analytics_delay)) { + ogs_error("OpenAPI_nwdaf_info_parseFromJSON() failed [analytics_delay]"); + goto end; + } + } + + serving_nf_set_id_list = cJSON_GetObjectItemCaseSensitive(nwdaf_infoJSON, "servingNfSetIdList"); + if (serving_nf_set_id_list) { + cJSON *serving_nf_set_id_list_local = NULL; + if (!cJSON_IsArray(serving_nf_set_id_list)) { + ogs_error("OpenAPI_nwdaf_info_parseFromJSON() failed [serving_nf_set_id_list]"); + goto end; + } + + serving_nf_set_id_listList = OpenAPI_list_create(); + + cJSON_ArrayForEach(serving_nf_set_id_list_local, serving_nf_set_id_list) { + double *localDouble = NULL; + int *localInt = NULL; + if (!cJSON_IsString(serving_nf_set_id_list_local)) { + ogs_error("OpenAPI_nwdaf_info_parseFromJSON() failed [serving_nf_set_id_list]"); + goto end; + } + OpenAPI_list_add(serving_nf_set_id_listList, ogs_strdup(serving_nf_set_id_list_local->valuestring)); + } + } + + serving_nf_type_list = cJSON_GetObjectItemCaseSensitive(nwdaf_infoJSON, "servingNfTypeList"); + if (serving_nf_type_list) { + cJSON *serving_nf_type_list_local = NULL; + if (!cJSON_IsArray(serving_nf_type_list)) { + ogs_error("OpenAPI_nwdaf_info_parseFromJSON() failed [serving_nf_type_list]"); + goto end; + } + + serving_nf_type_listList = OpenAPI_list_create(); + + cJSON_ArrayForEach(serving_nf_type_list_local, serving_nf_type_list) { + if (!cJSON_IsString(serving_nf_type_list_local)) { + ogs_error("OpenAPI_nwdaf_info_parseFromJSON() failed [serving_nf_type_list]"); + goto end; + } + OpenAPI_list_add(serving_nf_type_listList, (void *)OpenAPI_nf_type_FromString(serving_nf_type_list_local->valuestring)); + } + } + + ml_analytics_list = cJSON_GetObjectItemCaseSensitive(nwdaf_infoJSON, "mlAnalyticsList"); + if (ml_analytics_list) { + cJSON *ml_analytics_list_local = NULL; + if (!cJSON_IsArray(ml_analytics_list)) { + ogs_error("OpenAPI_nwdaf_info_parseFromJSON() failed [ml_analytics_list]"); + goto end; + } + + ml_analytics_listList = OpenAPI_list_create(); + + cJSON_ArrayForEach(ml_analytics_list_local, ml_analytics_list) { + if (!cJSON_IsObject(ml_analytics_list_local)) { + ogs_error("OpenAPI_nwdaf_info_parseFromJSON() failed [ml_analytics_list]"); + goto end; + } + OpenAPI_ml_analytics_info_t *ml_analytics_listItem = OpenAPI_ml_analytics_info_parseFromJSON(ml_analytics_list_local); + if (!ml_analytics_listItem) { + ogs_error("No ml_analytics_listItem"); + OpenAPI_list_free(ml_analytics_listList); + goto end; + } + OpenAPI_list_add(ml_analytics_listList, ml_analytics_listItem); + } + } + nwdaf_info_local_var = OpenAPI_nwdaf_info_create ( event_ids ? event_idsList : NULL, nwdaf_events ? nwdaf_eventsList : NULL, tai_list ? tai_listList : NULL, - tai_range_list ? tai_range_listList : NULL + tai_range_list ? tai_range_listList : NULL, + nwdaf_capability ? nwdaf_capability_local_nonprim : NULL, + analytics_delay ? true : false, + analytics_delay ? analytics_delay->valuedouble : 0, + serving_nf_set_id_list ? serving_nf_set_id_listList : NULL, + serving_nf_type_list ? serving_nf_type_listList : NULL, + ml_analytics_list ? ml_analytics_listList : NULL ); return nwdaf_info_local_var; @@ -288,6 +479,28 @@ end: OpenAPI_list_free(tai_range_listList); tai_range_listList = NULL; } + if (nwdaf_capability_local_nonprim) { + OpenAPI_nwdaf_capability_free(nwdaf_capability_local_nonprim); + nwdaf_capability_local_nonprim = NULL; + } + if (serving_nf_set_id_listList) { + OpenAPI_list_for_each(serving_nf_set_id_listList, node) { + ogs_free(node->data); + } + OpenAPI_list_free(serving_nf_set_id_listList); + serving_nf_set_id_listList = NULL; + } + if (serving_nf_type_listList) { + OpenAPI_list_free(serving_nf_type_listList); + serving_nf_type_listList = NULL; + } + if (ml_analytics_listList) { + OpenAPI_list_for_each(ml_analytics_listList, node) { + OpenAPI_ml_analytics_info_free(node->data); + } + OpenAPI_list_free(ml_analytics_listList); + ml_analytics_listList = NULL; + } return NULL; } diff --git a/lib/sbi/openapi/model/nwdaf_info.h b/lib/sbi/openapi/model/nwdaf_info.h index 5fb75280e..f2d4983e2 100644 --- a/lib/sbi/openapi/model/nwdaf_info.h +++ b/lib/sbi/openapi/model/nwdaf_info.h @@ -13,6 +13,9 @@ #include "../include/keyValuePair.h" #include "../include/binary.h" #include "event_id.h" +#include "ml_analytics_info.h" +#include "nf_type.h" +#include "nwdaf_capability.h" #include "nwdaf_event.h" #include "tai.h" #include "tai_range.h" @@ -27,13 +30,25 @@ typedef struct OpenAPI_nwdaf_info_s { OpenAPI_list_t *nwdaf_events; OpenAPI_list_t *tai_list; OpenAPI_list_t *tai_range_list; + struct OpenAPI_nwdaf_capability_s *nwdaf_capability; + bool is_analytics_delay; + int analytics_delay; + OpenAPI_list_t *serving_nf_set_id_list; + OpenAPI_list_t *serving_nf_type_list; + OpenAPI_list_t *ml_analytics_list; } OpenAPI_nwdaf_info_t; OpenAPI_nwdaf_info_t *OpenAPI_nwdaf_info_create( OpenAPI_list_t *event_ids, OpenAPI_list_t *nwdaf_events, OpenAPI_list_t *tai_list, - OpenAPI_list_t *tai_range_list + OpenAPI_list_t *tai_range_list, + OpenAPI_nwdaf_capability_t *nwdaf_capability, + bool is_analytics_delay, + int analytics_delay, + OpenAPI_list_t *serving_nf_set_id_list, + OpenAPI_list_t *serving_nf_type_list, + OpenAPI_list_t *ml_analytics_list ); void OpenAPI_nwdaf_info_free(OpenAPI_nwdaf_info_t *nwdaf_info); OpenAPI_nwdaf_info_t *OpenAPI_nwdaf_info_parseFromJSON(cJSON *nwdaf_infoJSON); diff --git a/lib/sbi/openapi/model/nwdaf_registration.c b/lib/sbi/openapi/model/nwdaf_registration.c new file mode 100644 index 000000000..d4925d62f --- /dev/null +++ b/lib/sbi/openapi/model/nwdaf_registration.c @@ -0,0 +1,332 @@ + +#include +#include +#include +#include "nwdaf_registration.h" + +OpenAPI_nwdaf_registration_t *OpenAPI_nwdaf_registration_create( + char *nwdaf_instance_id, + OpenAPI_list_t *analytics_ids, + char *nwdaf_set_id, + char *registration_time, + OpenAPI_context_info_t *context_info, + char *supported_features, + OpenAPI_list_t *reset_ids +) +{ + OpenAPI_nwdaf_registration_t *nwdaf_registration_local_var = ogs_malloc(sizeof(OpenAPI_nwdaf_registration_t)); + ogs_assert(nwdaf_registration_local_var); + + nwdaf_registration_local_var->nwdaf_instance_id = nwdaf_instance_id; + nwdaf_registration_local_var->analytics_ids = analytics_ids; + nwdaf_registration_local_var->nwdaf_set_id = nwdaf_set_id; + nwdaf_registration_local_var->registration_time = registration_time; + nwdaf_registration_local_var->context_info = context_info; + nwdaf_registration_local_var->supported_features = supported_features; + nwdaf_registration_local_var->reset_ids = reset_ids; + + return nwdaf_registration_local_var; +} + +void OpenAPI_nwdaf_registration_free(OpenAPI_nwdaf_registration_t *nwdaf_registration) +{ + OpenAPI_lnode_t *node = NULL; + + if (NULL == nwdaf_registration) { + return; + } + if (nwdaf_registration->nwdaf_instance_id) { + ogs_free(nwdaf_registration->nwdaf_instance_id); + nwdaf_registration->nwdaf_instance_id = NULL; + } + if (nwdaf_registration->analytics_ids) { + OpenAPI_list_for_each(nwdaf_registration->analytics_ids, node) { + OpenAPI_event_id_free(node->data); + } + OpenAPI_list_free(nwdaf_registration->analytics_ids); + nwdaf_registration->analytics_ids = NULL; + } + if (nwdaf_registration->nwdaf_set_id) { + ogs_free(nwdaf_registration->nwdaf_set_id); + nwdaf_registration->nwdaf_set_id = NULL; + } + if (nwdaf_registration->registration_time) { + ogs_free(nwdaf_registration->registration_time); + nwdaf_registration->registration_time = NULL; + } + if (nwdaf_registration->context_info) { + OpenAPI_context_info_free(nwdaf_registration->context_info); + nwdaf_registration->context_info = NULL; + } + if (nwdaf_registration->supported_features) { + ogs_free(nwdaf_registration->supported_features); + nwdaf_registration->supported_features = NULL; + } + if (nwdaf_registration->reset_ids) { + OpenAPI_list_for_each(nwdaf_registration->reset_ids, node) { + ogs_free(node->data); + } + OpenAPI_list_free(nwdaf_registration->reset_ids); + nwdaf_registration->reset_ids = NULL; + } + ogs_free(nwdaf_registration); +} + +cJSON *OpenAPI_nwdaf_registration_convertToJSON(OpenAPI_nwdaf_registration_t *nwdaf_registration) +{ + cJSON *item = NULL; + OpenAPI_lnode_t *node = NULL; + + if (nwdaf_registration == NULL) { + ogs_error("OpenAPI_nwdaf_registration_convertToJSON() failed [NwdafRegistration]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (!nwdaf_registration->nwdaf_instance_id) { + ogs_error("OpenAPI_nwdaf_registration_convertToJSON() failed [nwdaf_instance_id]"); + return NULL; + } + if (cJSON_AddStringToObject(item, "nwdafInstanceId", nwdaf_registration->nwdaf_instance_id) == NULL) { + ogs_error("OpenAPI_nwdaf_registration_convertToJSON() failed [nwdaf_instance_id]"); + goto end; + } + + if (!nwdaf_registration->analytics_ids) { + ogs_error("OpenAPI_nwdaf_registration_convertToJSON() failed [analytics_ids]"); + return NULL; + } + cJSON *analytics_idsList = cJSON_AddArrayToObject(item, "analyticsIds"); + if (analytics_idsList == NULL) { + ogs_error("OpenAPI_nwdaf_registration_convertToJSON() failed [analytics_ids]"); + goto end; + } + OpenAPI_list_for_each(nwdaf_registration->analytics_ids, node) { + cJSON *itemLocal = OpenAPI_event_id_convertToJSON(node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_nwdaf_registration_convertToJSON() failed [analytics_ids]"); + goto end; + } + cJSON_AddItemToArray(analytics_idsList, itemLocal); + } + + if (nwdaf_registration->nwdaf_set_id) { + if (cJSON_AddStringToObject(item, "nwdafSetId", nwdaf_registration->nwdaf_set_id) == NULL) { + ogs_error("OpenAPI_nwdaf_registration_convertToJSON() failed [nwdaf_set_id]"); + goto end; + } + } + + if (nwdaf_registration->registration_time) { + if (cJSON_AddStringToObject(item, "registrationTime", nwdaf_registration->registration_time) == NULL) { + ogs_error("OpenAPI_nwdaf_registration_convertToJSON() failed [registration_time]"); + goto end; + } + } + + if (nwdaf_registration->context_info) { + cJSON *context_info_local_JSON = OpenAPI_context_info_convertToJSON(nwdaf_registration->context_info); + if (context_info_local_JSON == NULL) { + ogs_error("OpenAPI_nwdaf_registration_convertToJSON() failed [context_info]"); + goto end; + } + cJSON_AddItemToObject(item, "contextInfo", context_info_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_nwdaf_registration_convertToJSON() failed [context_info]"); + goto end; + } + } + + if (nwdaf_registration->supported_features) { + if (cJSON_AddStringToObject(item, "supportedFeatures", nwdaf_registration->supported_features) == NULL) { + ogs_error("OpenAPI_nwdaf_registration_convertToJSON() failed [supported_features]"); + goto end; + } + } + + if (nwdaf_registration->reset_ids) { + cJSON *reset_idsList = cJSON_AddArrayToObject(item, "resetIds"); + if (reset_idsList == NULL) { + ogs_error("OpenAPI_nwdaf_registration_convertToJSON() failed [reset_ids]"); + goto end; + } + OpenAPI_list_for_each(nwdaf_registration->reset_ids, node) { + if (cJSON_AddStringToObject(reset_idsList, "", (char*)node->data) == NULL) { + ogs_error("OpenAPI_nwdaf_registration_convertToJSON() failed [reset_ids]"); + goto end; + } + } + } + +end: + return item; +} + +OpenAPI_nwdaf_registration_t *OpenAPI_nwdaf_registration_parseFromJSON(cJSON *nwdaf_registrationJSON) +{ + OpenAPI_nwdaf_registration_t *nwdaf_registration_local_var = NULL; + OpenAPI_lnode_t *node = NULL; + cJSON *nwdaf_instance_id = NULL; + cJSON *analytics_ids = NULL; + OpenAPI_list_t *analytics_idsList = NULL; + cJSON *nwdaf_set_id = NULL; + cJSON *registration_time = NULL; + cJSON *context_info = NULL; + OpenAPI_context_info_t *context_info_local_nonprim = NULL; + cJSON *supported_features = NULL; + cJSON *reset_ids = NULL; + OpenAPI_list_t *reset_idsList = NULL; + nwdaf_instance_id = cJSON_GetObjectItemCaseSensitive(nwdaf_registrationJSON, "nwdafInstanceId"); + if (!nwdaf_instance_id) { + ogs_error("OpenAPI_nwdaf_registration_parseFromJSON() failed [nwdaf_instance_id]"); + goto end; + } + if (!cJSON_IsString(nwdaf_instance_id)) { + ogs_error("OpenAPI_nwdaf_registration_parseFromJSON() failed [nwdaf_instance_id]"); + goto end; + } + + analytics_ids = cJSON_GetObjectItemCaseSensitive(nwdaf_registrationJSON, "analyticsIds"); + if (!analytics_ids) { + ogs_error("OpenAPI_nwdaf_registration_parseFromJSON() failed [analytics_ids]"); + goto end; + } + cJSON *analytics_ids_local = NULL; + if (!cJSON_IsArray(analytics_ids)) { + ogs_error("OpenAPI_nwdaf_registration_parseFromJSON() failed [analytics_ids]"); + goto end; + } + + analytics_idsList = OpenAPI_list_create(); + + cJSON_ArrayForEach(analytics_ids_local, analytics_ids) { + if (!cJSON_IsObject(analytics_ids_local)) { + ogs_error("OpenAPI_nwdaf_registration_parseFromJSON() failed [analytics_ids]"); + goto end; + } + OpenAPI_event_id_t *analytics_idsItem = OpenAPI_event_id_parseFromJSON(analytics_ids_local); + if (!analytics_idsItem) { + ogs_error("No analytics_idsItem"); + OpenAPI_list_free(analytics_idsList); + goto end; + } + OpenAPI_list_add(analytics_idsList, analytics_idsItem); + } + + nwdaf_set_id = cJSON_GetObjectItemCaseSensitive(nwdaf_registrationJSON, "nwdafSetId"); + if (nwdaf_set_id) { + if (!cJSON_IsString(nwdaf_set_id) && !cJSON_IsNull(nwdaf_set_id)) { + ogs_error("OpenAPI_nwdaf_registration_parseFromJSON() failed [nwdaf_set_id]"); + goto end; + } + } + + registration_time = cJSON_GetObjectItemCaseSensitive(nwdaf_registrationJSON, "registrationTime"); + if (registration_time) { + if (!cJSON_IsString(registration_time) && !cJSON_IsNull(registration_time)) { + ogs_error("OpenAPI_nwdaf_registration_parseFromJSON() failed [registration_time]"); + goto end; + } + } + + context_info = cJSON_GetObjectItemCaseSensitive(nwdaf_registrationJSON, "contextInfo"); + if (context_info) { + context_info_local_nonprim = OpenAPI_context_info_parseFromJSON(context_info); + } + + supported_features = cJSON_GetObjectItemCaseSensitive(nwdaf_registrationJSON, "supportedFeatures"); + if (supported_features) { + if (!cJSON_IsString(supported_features) && !cJSON_IsNull(supported_features)) { + ogs_error("OpenAPI_nwdaf_registration_parseFromJSON() failed [supported_features]"); + goto end; + } + } + + reset_ids = cJSON_GetObjectItemCaseSensitive(nwdaf_registrationJSON, "resetIds"); + if (reset_ids) { + cJSON *reset_ids_local = NULL; + if (!cJSON_IsArray(reset_ids)) { + ogs_error("OpenAPI_nwdaf_registration_parseFromJSON() failed [reset_ids]"); + goto end; + } + + reset_idsList = OpenAPI_list_create(); + + cJSON_ArrayForEach(reset_ids_local, reset_ids) { + double *localDouble = NULL; + int *localInt = NULL; + if (!cJSON_IsString(reset_ids_local)) { + ogs_error("OpenAPI_nwdaf_registration_parseFromJSON() failed [reset_ids]"); + goto end; + } + OpenAPI_list_add(reset_idsList, ogs_strdup(reset_ids_local->valuestring)); + } + } + + nwdaf_registration_local_var = OpenAPI_nwdaf_registration_create ( + ogs_strdup(nwdaf_instance_id->valuestring), + analytics_idsList, + nwdaf_set_id && !cJSON_IsNull(nwdaf_set_id) ? ogs_strdup(nwdaf_set_id->valuestring) : NULL, + registration_time && !cJSON_IsNull(registration_time) ? ogs_strdup(registration_time->valuestring) : NULL, + context_info ? context_info_local_nonprim : NULL, + supported_features && !cJSON_IsNull(supported_features) ? ogs_strdup(supported_features->valuestring) : NULL, + reset_ids ? reset_idsList : NULL + ); + + return nwdaf_registration_local_var; +end: + if (analytics_idsList) { + OpenAPI_list_for_each(analytics_idsList, node) { + OpenAPI_event_id_free(node->data); + } + OpenAPI_list_free(analytics_idsList); + analytics_idsList = NULL; + } + if (context_info_local_nonprim) { + OpenAPI_context_info_free(context_info_local_nonprim); + context_info_local_nonprim = NULL; + } + if (reset_idsList) { + OpenAPI_list_for_each(reset_idsList, node) { + ogs_free(node->data); + } + OpenAPI_list_free(reset_idsList); + reset_idsList = NULL; + } + return NULL; +} + +OpenAPI_nwdaf_registration_t *OpenAPI_nwdaf_registration_copy(OpenAPI_nwdaf_registration_t *dst, OpenAPI_nwdaf_registration_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_nwdaf_registration_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_nwdaf_registration_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_nwdaf_registration_free(dst); + dst = OpenAPI_nwdaf_registration_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/nwdaf_registration.h b/lib/sbi/openapi/model/nwdaf_registration.h new file mode 100644 index 000000000..53e1ef435 --- /dev/null +++ b/lib/sbi/openapi/model/nwdaf_registration.h @@ -0,0 +1,52 @@ +/* + * nwdaf_registration.h + * + * The complete set of information relevant to an NWDAF serving the UE + */ + +#ifndef _OpenAPI_nwdaf_registration_H_ +#define _OpenAPI_nwdaf_registration_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "context_info.h" +#include "event_id.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_nwdaf_registration_s OpenAPI_nwdaf_registration_t; +typedef struct OpenAPI_nwdaf_registration_s { + char *nwdaf_instance_id; + OpenAPI_list_t *analytics_ids; + char *nwdaf_set_id; + char *registration_time; + struct OpenAPI_context_info_s *context_info; + char *supported_features; + OpenAPI_list_t *reset_ids; +} OpenAPI_nwdaf_registration_t; + +OpenAPI_nwdaf_registration_t *OpenAPI_nwdaf_registration_create( + char *nwdaf_instance_id, + OpenAPI_list_t *analytics_ids, + char *nwdaf_set_id, + char *registration_time, + OpenAPI_context_info_t *context_info, + char *supported_features, + OpenAPI_list_t *reset_ids +); +void OpenAPI_nwdaf_registration_free(OpenAPI_nwdaf_registration_t *nwdaf_registration); +OpenAPI_nwdaf_registration_t *OpenAPI_nwdaf_registration_parseFromJSON(cJSON *nwdaf_registrationJSON); +cJSON *OpenAPI_nwdaf_registration_convertToJSON(OpenAPI_nwdaf_registration_t *nwdaf_registration); +OpenAPI_nwdaf_registration_t *OpenAPI_nwdaf_registration_copy(OpenAPI_nwdaf_registration_t *dst, OpenAPI_nwdaf_registration_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_nwdaf_registration_H_ */ + diff --git a/lib/sbi/openapi/model/nwdaf_registration_info.c b/lib/sbi/openapi/model/nwdaf_registration_info.c new file mode 100644 index 000000000..ebb73a62c --- /dev/null +++ b/lib/sbi/openapi/model/nwdaf_registration_info.c @@ -0,0 +1,151 @@ + +#include +#include +#include +#include "nwdaf_registration_info.h" + +OpenAPI_nwdaf_registration_info_t *OpenAPI_nwdaf_registration_info_create( + OpenAPI_list_t *nwdaf_registration_list +) +{ + OpenAPI_nwdaf_registration_info_t *nwdaf_registration_info_local_var = ogs_malloc(sizeof(OpenAPI_nwdaf_registration_info_t)); + ogs_assert(nwdaf_registration_info_local_var); + + nwdaf_registration_info_local_var->nwdaf_registration_list = nwdaf_registration_list; + + return nwdaf_registration_info_local_var; +} + +void OpenAPI_nwdaf_registration_info_free(OpenAPI_nwdaf_registration_info_t *nwdaf_registration_info) +{ + OpenAPI_lnode_t *node = NULL; + + if (NULL == nwdaf_registration_info) { + return; + } + if (nwdaf_registration_info->nwdaf_registration_list) { + OpenAPI_list_for_each(nwdaf_registration_info->nwdaf_registration_list, node) { + OpenAPI_nwdaf_registration_free(node->data); + } + OpenAPI_list_free(nwdaf_registration_info->nwdaf_registration_list); + nwdaf_registration_info->nwdaf_registration_list = NULL; + } + ogs_free(nwdaf_registration_info); +} + +cJSON *OpenAPI_nwdaf_registration_info_convertToJSON(OpenAPI_nwdaf_registration_info_t *nwdaf_registration_info) +{ + cJSON *item = NULL; + OpenAPI_lnode_t *node = NULL; + + if (nwdaf_registration_info == NULL) { + ogs_error("OpenAPI_nwdaf_registration_info_convertToJSON() failed [NwdafRegistrationInfo]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (!nwdaf_registration_info->nwdaf_registration_list) { + ogs_error("OpenAPI_nwdaf_registration_info_convertToJSON() failed [nwdaf_registration_list]"); + return NULL; + } + cJSON *nwdaf_registration_listList = cJSON_AddArrayToObject(item, "nwdafRegistrationList"); + if (nwdaf_registration_listList == NULL) { + ogs_error("OpenAPI_nwdaf_registration_info_convertToJSON() failed [nwdaf_registration_list]"); + goto end; + } + OpenAPI_list_for_each(nwdaf_registration_info->nwdaf_registration_list, node) { + cJSON *itemLocal = OpenAPI_nwdaf_registration_convertToJSON(node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_nwdaf_registration_info_convertToJSON() failed [nwdaf_registration_list]"); + goto end; + } + cJSON_AddItemToArray(nwdaf_registration_listList, itemLocal); + } + +end: + return item; +} + +OpenAPI_nwdaf_registration_info_t *OpenAPI_nwdaf_registration_info_parseFromJSON(cJSON *nwdaf_registration_infoJSON) +{ + OpenAPI_nwdaf_registration_info_t *nwdaf_registration_info_local_var = NULL; + OpenAPI_lnode_t *node = NULL; + cJSON *nwdaf_registration_list = NULL; + OpenAPI_list_t *nwdaf_registration_listList = NULL; + nwdaf_registration_list = cJSON_GetObjectItemCaseSensitive(nwdaf_registration_infoJSON, "nwdafRegistrationList"); + if (!nwdaf_registration_list) { + ogs_error("OpenAPI_nwdaf_registration_info_parseFromJSON() failed [nwdaf_registration_list]"); + goto end; + } + cJSON *nwdaf_registration_list_local = NULL; + if (!cJSON_IsArray(nwdaf_registration_list)) { + ogs_error("OpenAPI_nwdaf_registration_info_parseFromJSON() failed [nwdaf_registration_list]"); + goto end; + } + + nwdaf_registration_listList = OpenAPI_list_create(); + + cJSON_ArrayForEach(nwdaf_registration_list_local, nwdaf_registration_list) { + if (!cJSON_IsObject(nwdaf_registration_list_local)) { + ogs_error("OpenAPI_nwdaf_registration_info_parseFromJSON() failed [nwdaf_registration_list]"); + goto end; + } + OpenAPI_nwdaf_registration_t *nwdaf_registration_listItem = OpenAPI_nwdaf_registration_parseFromJSON(nwdaf_registration_list_local); + if (!nwdaf_registration_listItem) { + ogs_error("No nwdaf_registration_listItem"); + OpenAPI_list_free(nwdaf_registration_listList); + goto end; + } + OpenAPI_list_add(nwdaf_registration_listList, nwdaf_registration_listItem); + } + + nwdaf_registration_info_local_var = OpenAPI_nwdaf_registration_info_create ( + nwdaf_registration_listList + ); + + return nwdaf_registration_info_local_var; +end: + if (nwdaf_registration_listList) { + OpenAPI_list_for_each(nwdaf_registration_listList, node) { + OpenAPI_nwdaf_registration_free(node->data); + } + OpenAPI_list_free(nwdaf_registration_listList); + nwdaf_registration_listList = NULL; + } + return NULL; +} + +OpenAPI_nwdaf_registration_info_t *OpenAPI_nwdaf_registration_info_copy(OpenAPI_nwdaf_registration_info_t *dst, OpenAPI_nwdaf_registration_info_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_nwdaf_registration_info_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_nwdaf_registration_info_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_nwdaf_registration_info_free(dst); + dst = OpenAPI_nwdaf_registration_info_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/nwdaf_registration_info.h b/lib/sbi/openapi/model/nwdaf_registration_info.h new file mode 100644 index 000000000..3d6bd1d0d --- /dev/null +++ b/lib/sbi/openapi/model/nwdaf_registration_info.h @@ -0,0 +1,39 @@ +/* + * nwdaf_registration_info.h + * + * List of NwdafRegistration + */ + +#ifndef _OpenAPI_nwdaf_registration_info_H_ +#define _OpenAPI_nwdaf_registration_info_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "nwdaf_registration.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_nwdaf_registration_info_s OpenAPI_nwdaf_registration_info_t; +typedef struct OpenAPI_nwdaf_registration_info_s { + OpenAPI_list_t *nwdaf_registration_list; +} OpenAPI_nwdaf_registration_info_t; + +OpenAPI_nwdaf_registration_info_t *OpenAPI_nwdaf_registration_info_create( + OpenAPI_list_t *nwdaf_registration_list +); +void OpenAPI_nwdaf_registration_info_free(OpenAPI_nwdaf_registration_info_t *nwdaf_registration_info); +OpenAPI_nwdaf_registration_info_t *OpenAPI_nwdaf_registration_info_parseFromJSON(cJSON *nwdaf_registration_infoJSON); +cJSON *OpenAPI_nwdaf_registration_info_convertToJSON(OpenAPI_nwdaf_registration_info_t *nwdaf_registration_info); +OpenAPI_nwdaf_registration_info_t *OpenAPI_nwdaf_registration_info_copy(OpenAPI_nwdaf_registration_info_t *dst, OpenAPI_nwdaf_registration_info_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_nwdaf_registration_info_H_ */ + diff --git a/lib/sbi/openapi/model/nwdaf_registration_modification.c b/lib/sbi/openapi/model/nwdaf_registration_modification.c new file mode 100644 index 000000000..fcf8c691a --- /dev/null +++ b/lib/sbi/openapi/model/nwdaf_registration_modification.c @@ -0,0 +1,220 @@ + +#include +#include +#include +#include "nwdaf_registration_modification.h" + +OpenAPI_nwdaf_registration_modification_t *OpenAPI_nwdaf_registration_modification_create( + char *nwdaf_instance_id, + char *nwdaf_set_id, + OpenAPI_list_t *analytics_ids, + char *supported_features +) +{ + OpenAPI_nwdaf_registration_modification_t *nwdaf_registration_modification_local_var = ogs_malloc(sizeof(OpenAPI_nwdaf_registration_modification_t)); + ogs_assert(nwdaf_registration_modification_local_var); + + nwdaf_registration_modification_local_var->nwdaf_instance_id = nwdaf_instance_id; + nwdaf_registration_modification_local_var->nwdaf_set_id = nwdaf_set_id; + nwdaf_registration_modification_local_var->analytics_ids = analytics_ids; + nwdaf_registration_modification_local_var->supported_features = supported_features; + + return nwdaf_registration_modification_local_var; +} + +void OpenAPI_nwdaf_registration_modification_free(OpenAPI_nwdaf_registration_modification_t *nwdaf_registration_modification) +{ + OpenAPI_lnode_t *node = NULL; + + if (NULL == nwdaf_registration_modification) { + return; + } + if (nwdaf_registration_modification->nwdaf_instance_id) { + ogs_free(nwdaf_registration_modification->nwdaf_instance_id); + nwdaf_registration_modification->nwdaf_instance_id = NULL; + } + if (nwdaf_registration_modification->nwdaf_set_id) { + ogs_free(nwdaf_registration_modification->nwdaf_set_id); + nwdaf_registration_modification->nwdaf_set_id = NULL; + } + if (nwdaf_registration_modification->analytics_ids) { + OpenAPI_list_for_each(nwdaf_registration_modification->analytics_ids, node) { + OpenAPI_event_id_free(node->data); + } + OpenAPI_list_free(nwdaf_registration_modification->analytics_ids); + nwdaf_registration_modification->analytics_ids = NULL; + } + if (nwdaf_registration_modification->supported_features) { + ogs_free(nwdaf_registration_modification->supported_features); + nwdaf_registration_modification->supported_features = NULL; + } + ogs_free(nwdaf_registration_modification); +} + +cJSON *OpenAPI_nwdaf_registration_modification_convertToJSON(OpenAPI_nwdaf_registration_modification_t *nwdaf_registration_modification) +{ + cJSON *item = NULL; + OpenAPI_lnode_t *node = NULL; + + if (nwdaf_registration_modification == NULL) { + ogs_error("OpenAPI_nwdaf_registration_modification_convertToJSON() failed [NwdafRegistrationModification]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (!nwdaf_registration_modification->nwdaf_instance_id) { + ogs_error("OpenAPI_nwdaf_registration_modification_convertToJSON() failed [nwdaf_instance_id]"); + return NULL; + } + if (cJSON_AddStringToObject(item, "nwdafInstanceId", nwdaf_registration_modification->nwdaf_instance_id) == NULL) { + ogs_error("OpenAPI_nwdaf_registration_modification_convertToJSON() failed [nwdaf_instance_id]"); + goto end; + } + + if (nwdaf_registration_modification->nwdaf_set_id) { + if (cJSON_AddStringToObject(item, "nwdafSetId", nwdaf_registration_modification->nwdaf_set_id) == NULL) { + ogs_error("OpenAPI_nwdaf_registration_modification_convertToJSON() failed [nwdaf_set_id]"); + goto end; + } + } + + if (nwdaf_registration_modification->analytics_ids) { + cJSON *analytics_idsList = cJSON_AddArrayToObject(item, "analyticsIds"); + if (analytics_idsList == NULL) { + ogs_error("OpenAPI_nwdaf_registration_modification_convertToJSON() failed [analytics_ids]"); + goto end; + } + OpenAPI_list_for_each(nwdaf_registration_modification->analytics_ids, node) { + cJSON *itemLocal = OpenAPI_event_id_convertToJSON(node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_nwdaf_registration_modification_convertToJSON() failed [analytics_ids]"); + goto end; + } + cJSON_AddItemToArray(analytics_idsList, itemLocal); + } + } + + if (nwdaf_registration_modification->supported_features) { + if (cJSON_AddStringToObject(item, "supportedFeatures", nwdaf_registration_modification->supported_features) == NULL) { + ogs_error("OpenAPI_nwdaf_registration_modification_convertToJSON() failed [supported_features]"); + goto end; + } + } + +end: + return item; +} + +OpenAPI_nwdaf_registration_modification_t *OpenAPI_nwdaf_registration_modification_parseFromJSON(cJSON *nwdaf_registration_modificationJSON) +{ + OpenAPI_nwdaf_registration_modification_t *nwdaf_registration_modification_local_var = NULL; + OpenAPI_lnode_t *node = NULL; + cJSON *nwdaf_instance_id = NULL; + cJSON *nwdaf_set_id = NULL; + cJSON *analytics_ids = NULL; + OpenAPI_list_t *analytics_idsList = NULL; + cJSON *supported_features = NULL; + nwdaf_instance_id = cJSON_GetObjectItemCaseSensitive(nwdaf_registration_modificationJSON, "nwdafInstanceId"); + if (!nwdaf_instance_id) { + ogs_error("OpenAPI_nwdaf_registration_modification_parseFromJSON() failed [nwdaf_instance_id]"); + goto end; + } + if (!cJSON_IsString(nwdaf_instance_id)) { + ogs_error("OpenAPI_nwdaf_registration_modification_parseFromJSON() failed [nwdaf_instance_id]"); + goto end; + } + + nwdaf_set_id = cJSON_GetObjectItemCaseSensitive(nwdaf_registration_modificationJSON, "nwdafSetId"); + if (nwdaf_set_id) { + if (!cJSON_IsString(nwdaf_set_id) && !cJSON_IsNull(nwdaf_set_id)) { + ogs_error("OpenAPI_nwdaf_registration_modification_parseFromJSON() failed [nwdaf_set_id]"); + goto end; + } + } + + analytics_ids = cJSON_GetObjectItemCaseSensitive(nwdaf_registration_modificationJSON, "analyticsIds"); + if (analytics_ids) { + cJSON *analytics_ids_local = NULL; + if (!cJSON_IsArray(analytics_ids)) { + ogs_error("OpenAPI_nwdaf_registration_modification_parseFromJSON() failed [analytics_ids]"); + goto end; + } + + analytics_idsList = OpenAPI_list_create(); + + cJSON_ArrayForEach(analytics_ids_local, analytics_ids) { + if (!cJSON_IsObject(analytics_ids_local)) { + ogs_error("OpenAPI_nwdaf_registration_modification_parseFromJSON() failed [analytics_ids]"); + goto end; + } + OpenAPI_event_id_t *analytics_idsItem = OpenAPI_event_id_parseFromJSON(analytics_ids_local); + if (!analytics_idsItem) { + ogs_error("No analytics_idsItem"); + OpenAPI_list_free(analytics_idsList); + goto end; + } + OpenAPI_list_add(analytics_idsList, analytics_idsItem); + } + } + + supported_features = cJSON_GetObjectItemCaseSensitive(nwdaf_registration_modificationJSON, "supportedFeatures"); + if (supported_features) { + if (!cJSON_IsString(supported_features) && !cJSON_IsNull(supported_features)) { + ogs_error("OpenAPI_nwdaf_registration_modification_parseFromJSON() failed [supported_features]"); + goto end; + } + } + + nwdaf_registration_modification_local_var = OpenAPI_nwdaf_registration_modification_create ( + ogs_strdup(nwdaf_instance_id->valuestring), + nwdaf_set_id && !cJSON_IsNull(nwdaf_set_id) ? ogs_strdup(nwdaf_set_id->valuestring) : NULL, + analytics_ids ? analytics_idsList : NULL, + supported_features && !cJSON_IsNull(supported_features) ? ogs_strdup(supported_features->valuestring) : NULL + ); + + return nwdaf_registration_modification_local_var; +end: + if (analytics_idsList) { + OpenAPI_list_for_each(analytics_idsList, node) { + OpenAPI_event_id_free(node->data); + } + OpenAPI_list_free(analytics_idsList); + analytics_idsList = NULL; + } + return NULL; +} + +OpenAPI_nwdaf_registration_modification_t *OpenAPI_nwdaf_registration_modification_copy(OpenAPI_nwdaf_registration_modification_t *dst, OpenAPI_nwdaf_registration_modification_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_nwdaf_registration_modification_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_nwdaf_registration_modification_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_nwdaf_registration_modification_free(dst); + dst = OpenAPI_nwdaf_registration_modification_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/nwdaf_registration_modification.h b/lib/sbi/openapi/model/nwdaf_registration_modification.h new file mode 100644 index 000000000..579a1c373 --- /dev/null +++ b/lib/sbi/openapi/model/nwdaf_registration_modification.h @@ -0,0 +1,45 @@ +/* + * nwdaf_registration_modification.h + * + * Contains attributes of NwdafRegistration that can be modified using PATCH + */ + +#ifndef _OpenAPI_nwdaf_registration_modification_H_ +#define _OpenAPI_nwdaf_registration_modification_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "event_id.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_nwdaf_registration_modification_s OpenAPI_nwdaf_registration_modification_t; +typedef struct OpenAPI_nwdaf_registration_modification_s { + char *nwdaf_instance_id; + char *nwdaf_set_id; + OpenAPI_list_t *analytics_ids; + char *supported_features; +} OpenAPI_nwdaf_registration_modification_t; + +OpenAPI_nwdaf_registration_modification_t *OpenAPI_nwdaf_registration_modification_create( + char *nwdaf_instance_id, + char *nwdaf_set_id, + OpenAPI_list_t *analytics_ids, + char *supported_features +); +void OpenAPI_nwdaf_registration_modification_free(OpenAPI_nwdaf_registration_modification_t *nwdaf_registration_modification); +OpenAPI_nwdaf_registration_modification_t *OpenAPI_nwdaf_registration_modification_parseFromJSON(cJSON *nwdaf_registration_modificationJSON); +cJSON *OpenAPI_nwdaf_registration_modification_convertToJSON(OpenAPI_nwdaf_registration_modification_t *nwdaf_registration_modification); +OpenAPI_nwdaf_registration_modification_t *OpenAPI_nwdaf_registration_modification_copy(OpenAPI_nwdaf_registration_modification_t *dst, OpenAPI_nwdaf_registration_modification_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_nwdaf_registration_modification_H_ */ + diff --git a/lib/sbi/openapi/model/nwdaf_subscription.c b/lib/sbi/openapi/model/nwdaf_subscription.c new file mode 100644 index 000000000..afb9cffcc --- /dev/null +++ b/lib/sbi/openapi/model/nwdaf_subscription.c @@ -0,0 +1,149 @@ + +#include +#include +#include +#include "nwdaf_subscription.h" + +OpenAPI_nwdaf_subscription_t *OpenAPI_nwdaf_subscription_create( + char *nwdaf_evt_subs_service_uri, + OpenAPI_nnwdaf_events_subscription_t *nwdaf_events_subscription +) +{ + OpenAPI_nwdaf_subscription_t *nwdaf_subscription_local_var = ogs_malloc(sizeof(OpenAPI_nwdaf_subscription_t)); + ogs_assert(nwdaf_subscription_local_var); + + nwdaf_subscription_local_var->nwdaf_evt_subs_service_uri = nwdaf_evt_subs_service_uri; + nwdaf_subscription_local_var->nwdaf_events_subscription = nwdaf_events_subscription; + + return nwdaf_subscription_local_var; +} + +void OpenAPI_nwdaf_subscription_free(OpenAPI_nwdaf_subscription_t *nwdaf_subscription) +{ + OpenAPI_lnode_t *node = NULL; + + if (NULL == nwdaf_subscription) { + return; + } + if (nwdaf_subscription->nwdaf_evt_subs_service_uri) { + ogs_free(nwdaf_subscription->nwdaf_evt_subs_service_uri); + nwdaf_subscription->nwdaf_evt_subs_service_uri = NULL; + } + if (nwdaf_subscription->nwdaf_events_subscription) { + OpenAPI_nnwdaf_events_subscription_free(nwdaf_subscription->nwdaf_events_subscription); + nwdaf_subscription->nwdaf_events_subscription = NULL; + } + ogs_free(nwdaf_subscription); +} + +cJSON *OpenAPI_nwdaf_subscription_convertToJSON(OpenAPI_nwdaf_subscription_t *nwdaf_subscription) +{ + cJSON *item = NULL; + OpenAPI_lnode_t *node = NULL; + + if (nwdaf_subscription == NULL) { + ogs_error("OpenAPI_nwdaf_subscription_convertToJSON() failed [NwdafSubscription]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (!nwdaf_subscription->nwdaf_evt_subs_service_uri) { + ogs_error("OpenAPI_nwdaf_subscription_convertToJSON() failed [nwdaf_evt_subs_service_uri]"); + return NULL; + } + if (cJSON_AddStringToObject(item, "nwdafEvtSubsServiceUri", nwdaf_subscription->nwdaf_evt_subs_service_uri) == NULL) { + ogs_error("OpenAPI_nwdaf_subscription_convertToJSON() failed [nwdaf_evt_subs_service_uri]"); + goto end; + } + + if (!nwdaf_subscription->nwdaf_events_subscription) { + ogs_error("OpenAPI_nwdaf_subscription_convertToJSON() failed [nwdaf_events_subscription]"); + return NULL; + } + cJSON *nwdaf_events_subscription_local_JSON = OpenAPI_nnwdaf_events_subscription_convertToJSON(nwdaf_subscription->nwdaf_events_subscription); + if (nwdaf_events_subscription_local_JSON == NULL) { + ogs_error("OpenAPI_nwdaf_subscription_convertToJSON() failed [nwdaf_events_subscription]"); + goto end; + } + cJSON_AddItemToObject(item, "nwdafEventsSubscription", nwdaf_events_subscription_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_nwdaf_subscription_convertToJSON() failed [nwdaf_events_subscription]"); + goto end; + } + +end: + return item; +} + +OpenAPI_nwdaf_subscription_t *OpenAPI_nwdaf_subscription_parseFromJSON(cJSON *nwdaf_subscriptionJSON) +{ + OpenAPI_nwdaf_subscription_t *nwdaf_subscription_local_var = NULL; + OpenAPI_lnode_t *node = NULL; + cJSON *nwdaf_evt_subs_service_uri = NULL; + cJSON *nwdaf_events_subscription = NULL; + OpenAPI_nnwdaf_events_subscription_t *nwdaf_events_subscription_local_nonprim = NULL; + nwdaf_evt_subs_service_uri = cJSON_GetObjectItemCaseSensitive(nwdaf_subscriptionJSON, "nwdafEvtSubsServiceUri"); + if (!nwdaf_evt_subs_service_uri) { + ogs_error("OpenAPI_nwdaf_subscription_parseFromJSON() failed [nwdaf_evt_subs_service_uri]"); + goto end; + } + if (!cJSON_IsString(nwdaf_evt_subs_service_uri)) { + ogs_error("OpenAPI_nwdaf_subscription_parseFromJSON() failed [nwdaf_evt_subs_service_uri]"); + goto end; + } + + nwdaf_events_subscription = cJSON_GetObjectItemCaseSensitive(nwdaf_subscriptionJSON, "nwdafEventsSubscription"); + if (!nwdaf_events_subscription) { + ogs_error("OpenAPI_nwdaf_subscription_parseFromJSON() failed [nwdaf_events_subscription]"); + goto end; + } + nwdaf_events_subscription_local_nonprim = OpenAPI_nnwdaf_events_subscription_parseFromJSON(nwdaf_events_subscription); + + nwdaf_subscription_local_var = OpenAPI_nwdaf_subscription_create ( + ogs_strdup(nwdaf_evt_subs_service_uri->valuestring), + nwdaf_events_subscription_local_nonprim + ); + + return nwdaf_subscription_local_var; +end: + if (nwdaf_events_subscription_local_nonprim) { + OpenAPI_nnwdaf_events_subscription_free(nwdaf_events_subscription_local_nonprim); + nwdaf_events_subscription_local_nonprim = NULL; + } + return NULL; +} + +OpenAPI_nwdaf_subscription_t *OpenAPI_nwdaf_subscription_copy(OpenAPI_nwdaf_subscription_t *dst, OpenAPI_nwdaf_subscription_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_nwdaf_subscription_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_nwdaf_subscription_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_nwdaf_subscription_free(dst); + dst = OpenAPI_nwdaf_subscription_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/nwdaf_subscription.h b/lib/sbi/openapi/model/nwdaf_subscription.h new file mode 100644 index 000000000..9fc84d3a1 --- /dev/null +++ b/lib/sbi/openapi/model/nwdaf_subscription.h @@ -0,0 +1,41 @@ +/* + * nwdaf_subscription.h + * + * Individual NWDAF subscription identified by the subscription Id. + */ + +#ifndef _OpenAPI_nwdaf_subscription_H_ +#define _OpenAPI_nwdaf_subscription_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "nnwdaf_events_subscription.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_nwdaf_subscription_s OpenAPI_nwdaf_subscription_t; +typedef struct OpenAPI_nwdaf_subscription_s { + char *nwdaf_evt_subs_service_uri; + struct OpenAPI_nnwdaf_events_subscription_s *nwdaf_events_subscription; +} OpenAPI_nwdaf_subscription_t; + +OpenAPI_nwdaf_subscription_t *OpenAPI_nwdaf_subscription_create( + char *nwdaf_evt_subs_service_uri, + OpenAPI_nnwdaf_events_subscription_t *nwdaf_events_subscription +); +void OpenAPI_nwdaf_subscription_free(OpenAPI_nwdaf_subscription_t *nwdaf_subscription); +OpenAPI_nwdaf_subscription_t *OpenAPI_nwdaf_subscription_parseFromJSON(cJSON *nwdaf_subscriptionJSON); +cJSON *OpenAPI_nwdaf_subscription_convertToJSON(OpenAPI_nwdaf_subscription_t *nwdaf_subscription); +OpenAPI_nwdaf_subscription_t *OpenAPI_nwdaf_subscription_copy(OpenAPI_nwdaf_subscription_t *dst, OpenAPI_nwdaf_subscription_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_nwdaf_subscription_H_ */ + diff --git a/lib/sbi/openapi/model/observed_redundant_trans_exp.c b/lib/sbi/openapi/model/observed_redundant_trans_exp.c new file mode 100644 index 000000000..6cbca73e5 --- /dev/null +++ b/lib/sbi/openapi/model/observed_redundant_trans_exp.c @@ -0,0 +1,263 @@ + +#include +#include +#include +#include "observed_redundant_trans_exp.h" + +OpenAPI_observed_redundant_trans_exp_t *OpenAPI_observed_redundant_trans_exp_create( + bool is_avg_pkt_drop_rate_ul, + int avg_pkt_drop_rate_ul, + bool is_var_pkt_drop_rate_ul, + float var_pkt_drop_rate_ul, + bool is_avg_pkt_drop_rate_dl, + int avg_pkt_drop_rate_dl, + bool is_var_pkt_drop_rate_dl, + float var_pkt_drop_rate_dl, + bool is_avg_pkt_delay_ul, + int avg_pkt_delay_ul, + bool is_var_pkt_delay_ul, + float var_pkt_delay_ul, + bool is_avg_pkt_delay_dl, + int avg_pkt_delay_dl, + bool is_var_pkt_delay_dl, + float var_pkt_delay_dl +) +{ + OpenAPI_observed_redundant_trans_exp_t *observed_redundant_trans_exp_local_var = ogs_malloc(sizeof(OpenAPI_observed_redundant_trans_exp_t)); + ogs_assert(observed_redundant_trans_exp_local_var); + + observed_redundant_trans_exp_local_var->is_avg_pkt_drop_rate_ul = is_avg_pkt_drop_rate_ul; + observed_redundant_trans_exp_local_var->avg_pkt_drop_rate_ul = avg_pkt_drop_rate_ul; + observed_redundant_trans_exp_local_var->is_var_pkt_drop_rate_ul = is_var_pkt_drop_rate_ul; + observed_redundant_trans_exp_local_var->var_pkt_drop_rate_ul = var_pkt_drop_rate_ul; + observed_redundant_trans_exp_local_var->is_avg_pkt_drop_rate_dl = is_avg_pkt_drop_rate_dl; + observed_redundant_trans_exp_local_var->avg_pkt_drop_rate_dl = avg_pkt_drop_rate_dl; + observed_redundant_trans_exp_local_var->is_var_pkt_drop_rate_dl = is_var_pkt_drop_rate_dl; + observed_redundant_trans_exp_local_var->var_pkt_drop_rate_dl = var_pkt_drop_rate_dl; + observed_redundant_trans_exp_local_var->is_avg_pkt_delay_ul = is_avg_pkt_delay_ul; + observed_redundant_trans_exp_local_var->avg_pkt_delay_ul = avg_pkt_delay_ul; + observed_redundant_trans_exp_local_var->is_var_pkt_delay_ul = is_var_pkt_delay_ul; + observed_redundant_trans_exp_local_var->var_pkt_delay_ul = var_pkt_delay_ul; + observed_redundant_trans_exp_local_var->is_avg_pkt_delay_dl = is_avg_pkt_delay_dl; + observed_redundant_trans_exp_local_var->avg_pkt_delay_dl = avg_pkt_delay_dl; + observed_redundant_trans_exp_local_var->is_var_pkt_delay_dl = is_var_pkt_delay_dl; + observed_redundant_trans_exp_local_var->var_pkt_delay_dl = var_pkt_delay_dl; + + return observed_redundant_trans_exp_local_var; +} + +void OpenAPI_observed_redundant_trans_exp_free(OpenAPI_observed_redundant_trans_exp_t *observed_redundant_trans_exp) +{ + OpenAPI_lnode_t *node = NULL; + + if (NULL == observed_redundant_trans_exp) { + return; + } + ogs_free(observed_redundant_trans_exp); +} + +cJSON *OpenAPI_observed_redundant_trans_exp_convertToJSON(OpenAPI_observed_redundant_trans_exp_t *observed_redundant_trans_exp) +{ + cJSON *item = NULL; + OpenAPI_lnode_t *node = NULL; + + if (observed_redundant_trans_exp == NULL) { + ogs_error("OpenAPI_observed_redundant_trans_exp_convertToJSON() failed [ObservedRedundantTransExp]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (observed_redundant_trans_exp->is_avg_pkt_drop_rate_ul) { + if (cJSON_AddNumberToObject(item, "avgPktDropRateUl", observed_redundant_trans_exp->avg_pkt_drop_rate_ul) == NULL) { + ogs_error("OpenAPI_observed_redundant_trans_exp_convertToJSON() failed [avg_pkt_drop_rate_ul]"); + goto end; + } + } + + if (observed_redundant_trans_exp->is_var_pkt_drop_rate_ul) { + if (cJSON_AddNumberToObject(item, "varPktDropRateUl", observed_redundant_trans_exp->var_pkt_drop_rate_ul) == NULL) { + ogs_error("OpenAPI_observed_redundant_trans_exp_convertToJSON() failed [var_pkt_drop_rate_ul]"); + goto end; + } + } + + if (observed_redundant_trans_exp->is_avg_pkt_drop_rate_dl) { + if (cJSON_AddNumberToObject(item, "avgPktDropRateDl", observed_redundant_trans_exp->avg_pkt_drop_rate_dl) == NULL) { + ogs_error("OpenAPI_observed_redundant_trans_exp_convertToJSON() failed [avg_pkt_drop_rate_dl]"); + goto end; + } + } + + if (observed_redundant_trans_exp->is_var_pkt_drop_rate_dl) { + if (cJSON_AddNumberToObject(item, "varPktDropRateDl", observed_redundant_trans_exp->var_pkt_drop_rate_dl) == NULL) { + ogs_error("OpenAPI_observed_redundant_trans_exp_convertToJSON() failed [var_pkt_drop_rate_dl]"); + goto end; + } + } + + if (observed_redundant_trans_exp->is_avg_pkt_delay_ul) { + if (cJSON_AddNumberToObject(item, "avgPktDelayUl", observed_redundant_trans_exp->avg_pkt_delay_ul) == NULL) { + ogs_error("OpenAPI_observed_redundant_trans_exp_convertToJSON() failed [avg_pkt_delay_ul]"); + goto end; + } + } + + if (observed_redundant_trans_exp->is_var_pkt_delay_ul) { + if (cJSON_AddNumberToObject(item, "varPktDelayUl", observed_redundant_trans_exp->var_pkt_delay_ul) == NULL) { + ogs_error("OpenAPI_observed_redundant_trans_exp_convertToJSON() failed [var_pkt_delay_ul]"); + goto end; + } + } + + if (observed_redundant_trans_exp->is_avg_pkt_delay_dl) { + if (cJSON_AddNumberToObject(item, "avgPktDelayDl", observed_redundant_trans_exp->avg_pkt_delay_dl) == NULL) { + ogs_error("OpenAPI_observed_redundant_trans_exp_convertToJSON() failed [avg_pkt_delay_dl]"); + goto end; + } + } + + if (observed_redundant_trans_exp->is_var_pkt_delay_dl) { + if (cJSON_AddNumberToObject(item, "varPktDelayDl", observed_redundant_trans_exp->var_pkt_delay_dl) == NULL) { + ogs_error("OpenAPI_observed_redundant_trans_exp_convertToJSON() failed [var_pkt_delay_dl]"); + goto end; + } + } + +end: + return item; +} + +OpenAPI_observed_redundant_trans_exp_t *OpenAPI_observed_redundant_trans_exp_parseFromJSON(cJSON *observed_redundant_trans_expJSON) +{ + OpenAPI_observed_redundant_trans_exp_t *observed_redundant_trans_exp_local_var = NULL; + OpenAPI_lnode_t *node = NULL; + cJSON *avg_pkt_drop_rate_ul = NULL; + cJSON *var_pkt_drop_rate_ul = NULL; + cJSON *avg_pkt_drop_rate_dl = NULL; + cJSON *var_pkt_drop_rate_dl = NULL; + cJSON *avg_pkt_delay_ul = NULL; + cJSON *var_pkt_delay_ul = NULL; + cJSON *avg_pkt_delay_dl = NULL; + cJSON *var_pkt_delay_dl = NULL; + avg_pkt_drop_rate_ul = cJSON_GetObjectItemCaseSensitive(observed_redundant_trans_expJSON, "avgPktDropRateUl"); + if (avg_pkt_drop_rate_ul) { + if (!cJSON_IsNumber(avg_pkt_drop_rate_ul)) { + ogs_error("OpenAPI_observed_redundant_trans_exp_parseFromJSON() failed [avg_pkt_drop_rate_ul]"); + goto end; + } + } + + var_pkt_drop_rate_ul = cJSON_GetObjectItemCaseSensitive(observed_redundant_trans_expJSON, "varPktDropRateUl"); + if (var_pkt_drop_rate_ul) { + if (!cJSON_IsNumber(var_pkt_drop_rate_ul)) { + ogs_error("OpenAPI_observed_redundant_trans_exp_parseFromJSON() failed [var_pkt_drop_rate_ul]"); + goto end; + } + } + + avg_pkt_drop_rate_dl = cJSON_GetObjectItemCaseSensitive(observed_redundant_trans_expJSON, "avgPktDropRateDl"); + if (avg_pkt_drop_rate_dl) { + if (!cJSON_IsNumber(avg_pkt_drop_rate_dl)) { + ogs_error("OpenAPI_observed_redundant_trans_exp_parseFromJSON() failed [avg_pkt_drop_rate_dl]"); + goto end; + } + } + + var_pkt_drop_rate_dl = cJSON_GetObjectItemCaseSensitive(observed_redundant_trans_expJSON, "varPktDropRateDl"); + if (var_pkt_drop_rate_dl) { + if (!cJSON_IsNumber(var_pkt_drop_rate_dl)) { + ogs_error("OpenAPI_observed_redundant_trans_exp_parseFromJSON() failed [var_pkt_drop_rate_dl]"); + goto end; + } + } + + avg_pkt_delay_ul = cJSON_GetObjectItemCaseSensitive(observed_redundant_trans_expJSON, "avgPktDelayUl"); + if (avg_pkt_delay_ul) { + if (!cJSON_IsNumber(avg_pkt_delay_ul)) { + ogs_error("OpenAPI_observed_redundant_trans_exp_parseFromJSON() failed [avg_pkt_delay_ul]"); + goto end; + } + } + + var_pkt_delay_ul = cJSON_GetObjectItemCaseSensitive(observed_redundant_trans_expJSON, "varPktDelayUl"); + if (var_pkt_delay_ul) { + if (!cJSON_IsNumber(var_pkt_delay_ul)) { + ogs_error("OpenAPI_observed_redundant_trans_exp_parseFromJSON() failed [var_pkt_delay_ul]"); + goto end; + } + } + + avg_pkt_delay_dl = cJSON_GetObjectItemCaseSensitive(observed_redundant_trans_expJSON, "avgPktDelayDl"); + if (avg_pkt_delay_dl) { + if (!cJSON_IsNumber(avg_pkt_delay_dl)) { + ogs_error("OpenAPI_observed_redundant_trans_exp_parseFromJSON() failed [avg_pkt_delay_dl]"); + goto end; + } + } + + var_pkt_delay_dl = cJSON_GetObjectItemCaseSensitive(observed_redundant_trans_expJSON, "varPktDelayDl"); + if (var_pkt_delay_dl) { + if (!cJSON_IsNumber(var_pkt_delay_dl)) { + ogs_error("OpenAPI_observed_redundant_trans_exp_parseFromJSON() failed [var_pkt_delay_dl]"); + goto end; + } + } + + observed_redundant_trans_exp_local_var = OpenAPI_observed_redundant_trans_exp_create ( + avg_pkt_drop_rate_ul ? true : false, + avg_pkt_drop_rate_ul ? avg_pkt_drop_rate_ul->valuedouble : 0, + var_pkt_drop_rate_ul ? true : false, + var_pkt_drop_rate_ul ? var_pkt_drop_rate_ul->valuedouble : 0, + avg_pkt_drop_rate_dl ? true : false, + avg_pkt_drop_rate_dl ? avg_pkt_drop_rate_dl->valuedouble : 0, + var_pkt_drop_rate_dl ? true : false, + var_pkt_drop_rate_dl ? var_pkt_drop_rate_dl->valuedouble : 0, + avg_pkt_delay_ul ? true : false, + avg_pkt_delay_ul ? avg_pkt_delay_ul->valuedouble : 0, + var_pkt_delay_ul ? true : false, + var_pkt_delay_ul ? var_pkt_delay_ul->valuedouble : 0, + avg_pkt_delay_dl ? true : false, + avg_pkt_delay_dl ? avg_pkt_delay_dl->valuedouble : 0, + var_pkt_delay_dl ? true : false, + var_pkt_delay_dl ? var_pkt_delay_dl->valuedouble : 0 + ); + + return observed_redundant_trans_exp_local_var; +end: + return NULL; +} + +OpenAPI_observed_redundant_trans_exp_t *OpenAPI_observed_redundant_trans_exp_copy(OpenAPI_observed_redundant_trans_exp_t *dst, OpenAPI_observed_redundant_trans_exp_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_observed_redundant_trans_exp_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_observed_redundant_trans_exp_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_observed_redundant_trans_exp_free(dst); + dst = OpenAPI_observed_redundant_trans_exp_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/observed_redundant_trans_exp.h b/lib/sbi/openapi/model/observed_redundant_trans_exp.h new file mode 100644 index 000000000..42fda159c --- /dev/null +++ b/lib/sbi/openapi/model/observed_redundant_trans_exp.h @@ -0,0 +1,68 @@ +/* + * observed_redundant_trans_exp.h + * + * Represents the observed redundant transmission experience related information. + */ + +#ifndef _OpenAPI_observed_redundant_trans_exp_H_ +#define _OpenAPI_observed_redundant_trans_exp_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_observed_redundant_trans_exp_s OpenAPI_observed_redundant_trans_exp_t; +typedef struct OpenAPI_observed_redundant_trans_exp_s { + bool is_avg_pkt_drop_rate_ul; + int avg_pkt_drop_rate_ul; + bool is_var_pkt_drop_rate_ul; + float var_pkt_drop_rate_ul; + bool is_avg_pkt_drop_rate_dl; + int avg_pkt_drop_rate_dl; + bool is_var_pkt_drop_rate_dl; + float var_pkt_drop_rate_dl; + bool is_avg_pkt_delay_ul; + int avg_pkt_delay_ul; + bool is_var_pkt_delay_ul; + float var_pkt_delay_ul; + bool is_avg_pkt_delay_dl; + int avg_pkt_delay_dl; + bool is_var_pkt_delay_dl; + float var_pkt_delay_dl; +} OpenAPI_observed_redundant_trans_exp_t; + +OpenAPI_observed_redundant_trans_exp_t *OpenAPI_observed_redundant_trans_exp_create( + bool is_avg_pkt_drop_rate_ul, + int avg_pkt_drop_rate_ul, + bool is_var_pkt_drop_rate_ul, + float var_pkt_drop_rate_ul, + bool is_avg_pkt_drop_rate_dl, + int avg_pkt_drop_rate_dl, + bool is_var_pkt_drop_rate_dl, + float var_pkt_drop_rate_dl, + bool is_avg_pkt_delay_ul, + int avg_pkt_delay_ul, + bool is_var_pkt_delay_ul, + float var_pkt_delay_ul, + bool is_avg_pkt_delay_dl, + int avg_pkt_delay_dl, + bool is_var_pkt_delay_dl, + float var_pkt_delay_dl +); +void OpenAPI_observed_redundant_trans_exp_free(OpenAPI_observed_redundant_trans_exp_t *observed_redundant_trans_exp); +OpenAPI_observed_redundant_trans_exp_t *OpenAPI_observed_redundant_trans_exp_parseFromJSON(cJSON *observed_redundant_trans_expJSON); +cJSON *OpenAPI_observed_redundant_trans_exp_convertToJSON(OpenAPI_observed_redundant_trans_exp_t *observed_redundant_trans_exp); +OpenAPI_observed_redundant_trans_exp_t *OpenAPI_observed_redundant_trans_exp_copy(OpenAPI_observed_redundant_trans_exp_t *dst, OpenAPI_observed_redundant_trans_exp_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_observed_redundant_trans_exp_H_ */ + diff --git a/lib/sbi/openapi/model/odb_data.h b/lib/sbi/openapi/model/odb_data.h index f04581c91..9245bf9ac 100644 --- a/lib/sbi/openapi/model/odb_data.h +++ b/lib/sbi/openapi/model/odb_data.h @@ -1,7 +1,7 @@ /* * odb_data.h * - * + * Contains information regarding operater determined barring. */ #ifndef _OpenAPI_odb_data_H_ diff --git a/lib/sbi/openapi/model/operator_specific_data_container.c b/lib/sbi/openapi/model/operator_specific_data_container.c index f0549a949..188fb78fc 100644 --- a/lib/sbi/openapi/model/operator_specific_data_container.c +++ b/lib/sbi/openapi/model/operator_specific_data_container.c @@ -4,11 +4,35 @@ #include #include "operator_specific_data_container.h" +char *OpenAPI_data_typeoperator_specific_data_container_ToString(OpenAPI_operator_specific_data_container_data_type_e data_type) +{ + const char *data_typeArray[] = { "NULL", "string", "integer", "number", "boolean", "object", "array" }; + size_t sizeofArray = sizeof(data_typeArray) / sizeof(data_typeArray[0]); + if (data_type < sizeofArray) + return (char *)data_typeArray[data_type]; + else + return (char *)"Unknown"; +} + +OpenAPI_operator_specific_data_container_data_type_e OpenAPI_data_typeoperator_specific_data_container_FromString(char* data_type) +{ + int stringToReturn = 0; + const char *data_typeArray[] = { "NULL", "string", "integer", "number", "boolean", "object", "array" }; + size_t sizeofArray = sizeof(data_typeArray) / sizeof(data_typeArray[0]); + while (stringToReturn < sizeofArray) { + if (strcmp(data_type, data_typeArray[stringToReturn]) == 0) { + return stringToReturn; + } + stringToReturn++; + } + return 0; +} OpenAPI_operator_specific_data_container_t *OpenAPI_operator_specific_data_container_create( - char *data_type, + OpenAPI_operator_specific_data_container_data_type_e data_type, char *data_type_definition, - char *value, - char *supported_features + OpenAPI_operator_specific_data_container_value_t *value, + char *supported_features, + OpenAPI_list_t *reset_ids ) { OpenAPI_operator_specific_data_container_t *operator_specific_data_container_local_var = ogs_malloc(sizeof(OpenAPI_operator_specific_data_container_t)); @@ -18,6 +42,7 @@ OpenAPI_operator_specific_data_container_t *OpenAPI_operator_specific_data_conta operator_specific_data_container_local_var->data_type_definition = data_type_definition; operator_specific_data_container_local_var->value = value; operator_specific_data_container_local_var->supported_features = supported_features; + operator_specific_data_container_local_var->reset_ids = reset_ids; return operator_specific_data_container_local_var; } @@ -29,22 +54,25 @@ void OpenAPI_operator_specific_data_container_free(OpenAPI_operator_specific_dat if (NULL == operator_specific_data_container) { return; } - if (operator_specific_data_container->data_type) { - ogs_free(operator_specific_data_container->data_type); - operator_specific_data_container->data_type = NULL; - } if (operator_specific_data_container->data_type_definition) { ogs_free(operator_specific_data_container->data_type_definition); operator_specific_data_container->data_type_definition = NULL; } if (operator_specific_data_container->value) { - ogs_free(operator_specific_data_container->value); + OpenAPI_operator_specific_data_container_value_free(operator_specific_data_container->value); operator_specific_data_container->value = NULL; } if (operator_specific_data_container->supported_features) { ogs_free(operator_specific_data_container->supported_features); operator_specific_data_container->supported_features = NULL; } + if (operator_specific_data_container->reset_ids) { + OpenAPI_list_for_each(operator_specific_data_container->reset_ids, node) { + ogs_free(node->data); + } + OpenAPI_list_free(operator_specific_data_container->reset_ids); + operator_specific_data_container->reset_ids = NULL; + } ogs_free(operator_specific_data_container); } @@ -59,11 +87,11 @@ cJSON *OpenAPI_operator_specific_data_container_convertToJSON(OpenAPI_operator_s } item = cJSON_CreateObject(); - if (!operator_specific_data_container->data_type) { + if (operator_specific_data_container->data_type == OpenAPI_operator_specific_data_container_DATATYPE_NULL) { ogs_error("OpenAPI_operator_specific_data_container_convertToJSON() failed [data_type]"); return NULL; } - if (cJSON_AddStringToObject(item, "dataType", operator_specific_data_container->data_type) == NULL) { + if (cJSON_AddStringToObject(item, "dataType", OpenAPI_data_typeoperator_specific_data_container_ToString(operator_specific_data_container->data_type)) == NULL) { ogs_error("OpenAPI_operator_specific_data_container_convertToJSON() failed [data_type]"); goto end; } @@ -79,7 +107,13 @@ cJSON *OpenAPI_operator_specific_data_container_convertToJSON(OpenAPI_operator_s ogs_error("OpenAPI_operator_specific_data_container_convertToJSON() failed [value]"); return NULL; } - if (cJSON_AddStringToObject(item, "value", operator_specific_data_container->value) == NULL) { + cJSON *value_local_JSON = OpenAPI_operator_specific_data_container_value_convertToJSON(operator_specific_data_container->value); + if (value_local_JSON == NULL) { + ogs_error("OpenAPI_operator_specific_data_container_convertToJSON() failed [value]"); + goto end; + } + cJSON_AddItemToObject(item, "value", value_local_JSON); + if (item->child == NULL) { ogs_error("OpenAPI_operator_specific_data_container_convertToJSON() failed [value]"); goto end; } @@ -91,6 +125,20 @@ cJSON *OpenAPI_operator_specific_data_container_convertToJSON(OpenAPI_operator_s } } + if (operator_specific_data_container->reset_ids) { + cJSON *reset_idsList = cJSON_AddArrayToObject(item, "resetIds"); + if (reset_idsList == NULL) { + ogs_error("OpenAPI_operator_specific_data_container_convertToJSON() failed [reset_ids]"); + goto end; + } + OpenAPI_list_for_each(operator_specific_data_container->reset_ids, node) { + if (cJSON_AddStringToObject(reset_idsList, "", (char*)node->data) == NULL) { + ogs_error("OpenAPI_operator_specific_data_container_convertToJSON() failed [reset_ids]"); + goto end; + } + } + } + end: return item; } @@ -100,9 +148,13 @@ OpenAPI_operator_specific_data_container_t *OpenAPI_operator_specific_data_conta OpenAPI_operator_specific_data_container_t *operator_specific_data_container_local_var = NULL; OpenAPI_lnode_t *node = NULL; cJSON *data_type = NULL; + OpenAPI_operator_specific_data_container_data_type_e data_typeVariable = 0; cJSON *data_type_definition = NULL; cJSON *value = NULL; + OpenAPI_operator_specific_data_container_value_t *value_local_nonprim = NULL; cJSON *supported_features = NULL; + cJSON *reset_ids = NULL; + OpenAPI_list_t *reset_idsList = NULL; data_type = cJSON_GetObjectItemCaseSensitive(operator_specific_data_containerJSON, "dataType"); if (!data_type) { ogs_error("OpenAPI_operator_specific_data_container_parseFromJSON() failed [data_type]"); @@ -112,6 +164,7 @@ OpenAPI_operator_specific_data_container_t *OpenAPI_operator_specific_data_conta ogs_error("OpenAPI_operator_specific_data_container_parseFromJSON() failed [data_type]"); goto end; } + data_typeVariable = OpenAPI_data_typeoperator_specific_data_container_FromString(data_type->valuestring); data_type_definition = cJSON_GetObjectItemCaseSensitive(operator_specific_data_containerJSON, "dataTypeDefinition"); if (data_type_definition) { @@ -126,10 +179,7 @@ OpenAPI_operator_specific_data_container_t *OpenAPI_operator_specific_data_conta ogs_error("OpenAPI_operator_specific_data_container_parseFromJSON() failed [value]"); goto end; } - if (!cJSON_IsString(value)) { - ogs_error("OpenAPI_operator_specific_data_container_parseFromJSON() failed [value]"); - goto end; - } + value_local_nonprim = OpenAPI_operator_specific_data_container_value_parseFromJSON(value); supported_features = cJSON_GetObjectItemCaseSensitive(operator_specific_data_containerJSON, "supportedFeatures"); if (supported_features) { @@ -139,15 +189,48 @@ OpenAPI_operator_specific_data_container_t *OpenAPI_operator_specific_data_conta } } + reset_ids = cJSON_GetObjectItemCaseSensitive(operator_specific_data_containerJSON, "resetIds"); + if (reset_ids) { + cJSON *reset_ids_local = NULL; + if (!cJSON_IsArray(reset_ids)) { + ogs_error("OpenAPI_operator_specific_data_container_parseFromJSON() failed [reset_ids]"); + goto end; + } + + reset_idsList = OpenAPI_list_create(); + + cJSON_ArrayForEach(reset_ids_local, reset_ids) { + double *localDouble = NULL; + int *localInt = NULL; + if (!cJSON_IsString(reset_ids_local)) { + ogs_error("OpenAPI_operator_specific_data_container_parseFromJSON() failed [reset_ids]"); + goto end; + } + OpenAPI_list_add(reset_idsList, ogs_strdup(reset_ids_local->valuestring)); + } + } + operator_specific_data_container_local_var = OpenAPI_operator_specific_data_container_create ( - ogs_strdup(data_type->valuestring), + data_typeVariable, data_type_definition && !cJSON_IsNull(data_type_definition) ? ogs_strdup(data_type_definition->valuestring) : NULL, - ogs_strdup(value->valuestring), - supported_features && !cJSON_IsNull(supported_features) ? ogs_strdup(supported_features->valuestring) : NULL + value_local_nonprim, + supported_features && !cJSON_IsNull(supported_features) ? ogs_strdup(supported_features->valuestring) : NULL, + reset_ids ? reset_idsList : NULL ); return operator_specific_data_container_local_var; end: + if (value_local_nonprim) { + OpenAPI_operator_specific_data_container_value_free(value_local_nonprim); + value_local_nonprim = NULL; + } + if (reset_idsList) { + OpenAPI_list_for_each(reset_idsList, node) { + ogs_free(node->data); + } + OpenAPI_list_free(reset_idsList); + reset_idsList = NULL; + } return NULL; } diff --git a/lib/sbi/openapi/model/operator_specific_data_container.h b/lib/sbi/openapi/model/operator_specific_data_container.h index a9137cf59..1512f0072 100644 --- a/lib/sbi/openapi/model/operator_specific_data_container.h +++ b/lib/sbi/openapi/model/operator_specific_data_container.h @@ -1,7 +1,7 @@ /* * operator_specific_data_container.h * - * + * Container for operator specific data. */ #ifndef _OpenAPI_operator_specific_data_container_H_ @@ -12,24 +12,32 @@ #include "../include/list.h" #include "../include/keyValuePair.h" #include "../include/binary.h" +#include "operator_specific_data_container_value.h" #ifdef __cplusplus extern "C" { #endif typedef struct OpenAPI_operator_specific_data_container_s OpenAPI_operator_specific_data_container_t; +typedef enum { OpenAPI_operator_specific_data_container_DATATYPE_NULL = 0, OpenAPI_operator_specific_data_container_DATATYPE_string, OpenAPI_operator_specific_data_container_DATATYPE_integer, OpenAPI_operator_specific_data_container_DATATYPE_number, OpenAPI_operator_specific_data_container_DATATYPE_boolean, OpenAPI_operator_specific_data_container_DATATYPE_object, OpenAPI_operator_specific_data_container_DATATYPE_array } OpenAPI_operator_specific_data_container_data_type_e; + +char* OpenAPI_operator_specific_data_container_data_type_ToString(OpenAPI_operator_specific_data_container_data_type_e data_type); + +OpenAPI_operator_specific_data_container_data_type_e OpenAPI_operator_specific_data_container_data_type_FromString(char* data_type); typedef struct OpenAPI_operator_specific_data_container_s { - char *data_type; + OpenAPI_operator_specific_data_container_data_type_e data_type; char *data_type_definition; - char *value; + struct OpenAPI_operator_specific_data_container_value_s *value; char *supported_features; + OpenAPI_list_t *reset_ids; } OpenAPI_operator_specific_data_container_t; OpenAPI_operator_specific_data_container_t *OpenAPI_operator_specific_data_container_create( - char *data_type, + OpenAPI_operator_specific_data_container_data_type_e data_type, char *data_type_definition, - char *value, - char *supported_features + OpenAPI_operator_specific_data_container_value_t *value, + char *supported_features, + OpenAPI_list_t *reset_ids ); void OpenAPI_operator_specific_data_container_free(OpenAPI_operator_specific_data_container_t *operator_specific_data_container); OpenAPI_operator_specific_data_container_t *OpenAPI_operator_specific_data_container_parseFromJSON(cJSON *operator_specific_data_containerJSON); diff --git a/lib/sbi/openapi/model/operator_specific_data_container_value.c b/lib/sbi/openapi/model/operator_specific_data_container_value.c new file mode 100644 index 000000000..c6bc71447 --- /dev/null +++ b/lib/sbi/openapi/model/operator_specific_data_container_value.c @@ -0,0 +1,87 @@ + +#include +#include +#include +#include "operator_specific_data_container_value.h" + +OpenAPI_operator_specific_data_container_value_t *OpenAPI_operator_specific_data_container_value_create( +) +{ + OpenAPI_operator_specific_data_container_value_t *operator_specific_data_container_value_local_var = ogs_malloc(sizeof(OpenAPI_operator_specific_data_container_value_t)); + ogs_assert(operator_specific_data_container_value_local_var); + + + return operator_specific_data_container_value_local_var; +} + +void OpenAPI_operator_specific_data_container_value_free(OpenAPI_operator_specific_data_container_value_t *operator_specific_data_container_value) +{ + OpenAPI_lnode_t *node = NULL; + + if (NULL == operator_specific_data_container_value) { + return; + } + ogs_free(operator_specific_data_container_value); +} + +cJSON *OpenAPI_operator_specific_data_container_value_convertToJSON(OpenAPI_operator_specific_data_container_value_t *operator_specific_data_container_value) +{ + cJSON *item = NULL; + OpenAPI_lnode_t *node = NULL; + + if (operator_specific_data_container_value == NULL) { + ogs_error("OpenAPI_operator_specific_data_container_value_convertToJSON() failed [OperatorSpecificDataContainer_value]"); + return NULL; + } + + item = cJSON_CreateObject(); +end: + return item; +} + +OpenAPI_operator_specific_data_container_value_t *OpenAPI_operator_specific_data_container_value_parseFromJSON(cJSON *operator_specific_data_container_valueJSON) +{ + OpenAPI_operator_specific_data_container_value_t *operator_specific_data_container_value_local_var = NULL; + OpenAPI_lnode_t *node = NULL; + operator_specific_data_container_value_local_var = OpenAPI_operator_specific_data_container_value_create ( + ); + + return operator_specific_data_container_value_local_var; +end: + return NULL; +} + +OpenAPI_operator_specific_data_container_value_t *OpenAPI_operator_specific_data_container_value_copy(OpenAPI_operator_specific_data_container_value_t *dst, OpenAPI_operator_specific_data_container_value_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_operator_specific_data_container_value_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_operator_specific_data_container_value_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_operator_specific_data_container_value_free(dst); + dst = OpenAPI_operator_specific_data_container_value_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/operator_specific_data_container_value.h b/lib/sbi/openapi/model/operator_specific_data_container_value.h new file mode 100644 index 000000000..d8d22d45a --- /dev/null +++ b/lib/sbi/openapi/model/operator_specific_data_container_value.h @@ -0,0 +1,36 @@ +/* + * operator_specific_data_container_value.h + * + * + */ + +#ifndef _OpenAPI_operator_specific_data_container_value_H_ +#define _OpenAPI_operator_specific_data_container_value_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_operator_specific_data_container_value_s OpenAPI_operator_specific_data_container_value_t; +typedef struct OpenAPI_operator_specific_data_container_value_s { +} OpenAPI_operator_specific_data_container_value_t; + +OpenAPI_operator_specific_data_container_value_t *OpenAPI_operator_specific_data_container_value_create( +); +void OpenAPI_operator_specific_data_container_value_free(OpenAPI_operator_specific_data_container_value_t *operator_specific_data_container_value); +OpenAPI_operator_specific_data_container_value_t *OpenAPI_operator_specific_data_container_value_parseFromJSON(cJSON *operator_specific_data_container_valueJSON); +cJSON *OpenAPI_operator_specific_data_container_value_convertToJSON(OpenAPI_operator_specific_data_container_value_t *operator_specific_data_container_value); +OpenAPI_operator_specific_data_container_value_t *OpenAPI_operator_specific_data_container_value_copy(OpenAPI_operator_specific_data_container_value_t *dst, OpenAPI_operator_specific_data_container_value_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_operator_specific_data_container_value_H_ */ + diff --git a/lib/sbi/openapi/model/output_strategy.c b/lib/sbi/openapi/model/output_strategy.c new file mode 100644 index 000000000..2c03e453f --- /dev/null +++ b/lib/sbi/openapi/model/output_strategy.c @@ -0,0 +1,87 @@ + +#include +#include +#include +#include "output_strategy.h" + +OpenAPI_output_strategy_t *OpenAPI_output_strategy_create( +) +{ + OpenAPI_output_strategy_t *output_strategy_local_var = ogs_malloc(sizeof(OpenAPI_output_strategy_t)); + ogs_assert(output_strategy_local_var); + + + return output_strategy_local_var; +} + +void OpenAPI_output_strategy_free(OpenAPI_output_strategy_t *output_strategy) +{ + OpenAPI_lnode_t *node = NULL; + + if (NULL == output_strategy) { + return; + } + ogs_free(output_strategy); +} + +cJSON *OpenAPI_output_strategy_convertToJSON(OpenAPI_output_strategy_t *output_strategy) +{ + cJSON *item = NULL; + OpenAPI_lnode_t *node = NULL; + + if (output_strategy == NULL) { + ogs_error("OpenAPI_output_strategy_convertToJSON() failed [OutputStrategy]"); + return NULL; + } + + item = cJSON_CreateObject(); +end: + return item; +} + +OpenAPI_output_strategy_t *OpenAPI_output_strategy_parseFromJSON(cJSON *output_strategyJSON) +{ + OpenAPI_output_strategy_t *output_strategy_local_var = NULL; + OpenAPI_lnode_t *node = NULL; + output_strategy_local_var = OpenAPI_output_strategy_create ( + ); + + return output_strategy_local_var; +end: + return NULL; +} + +OpenAPI_output_strategy_t *OpenAPI_output_strategy_copy(OpenAPI_output_strategy_t *dst, OpenAPI_output_strategy_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_output_strategy_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_output_strategy_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_output_strategy_free(dst); + dst = OpenAPI_output_strategy_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/output_strategy.h b/lib/sbi/openapi/model/output_strategy.h new file mode 100644 index 000000000..0c8460119 --- /dev/null +++ b/lib/sbi/openapi/model/output_strategy.h @@ -0,0 +1,37 @@ +/* + * output_strategy.h + * + * Possible values are: - BINARY: Indicates that the analytics shall only be reported when the requested level of accuracy is reached within a cycle of periodic notification. - GRADIENT: Indicates that the analytics shall be reported according with the periodicity irrespective of whether the requested level of accuracy has been reached or not. + */ + +#ifndef _OpenAPI_output_strategy_H_ +#define _OpenAPI_output_strategy_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "output_strategy_any_of.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_output_strategy_s OpenAPI_output_strategy_t; +typedef struct OpenAPI_output_strategy_s { +} OpenAPI_output_strategy_t; + +OpenAPI_output_strategy_t *OpenAPI_output_strategy_create( +); +void OpenAPI_output_strategy_free(OpenAPI_output_strategy_t *output_strategy); +OpenAPI_output_strategy_t *OpenAPI_output_strategy_parseFromJSON(cJSON *output_strategyJSON); +cJSON *OpenAPI_output_strategy_convertToJSON(OpenAPI_output_strategy_t *output_strategy); +OpenAPI_output_strategy_t *OpenAPI_output_strategy_copy(OpenAPI_output_strategy_t *dst, OpenAPI_output_strategy_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_output_strategy_H_ */ + diff --git a/lib/sbi/openapi/model/output_strategy_any_of.c b/lib/sbi/openapi/model/output_strategy_any_of.c new file mode 100644 index 000000000..d859acd48 --- /dev/null +++ b/lib/sbi/openapi/model/output_strategy_any_of.c @@ -0,0 +1,30 @@ + +#include +#include +#include +#include "output_strategy_any_of.h" + +char* OpenAPI_output_strategy_any_of_ToString(OpenAPI_output_strategy_any_of_e output_strategy_any_of) +{ + const char *output_strategy_any_ofArray[] = { "NULL", "BINARY", "GRADIENT" }; + size_t sizeofArray = sizeof(output_strategy_any_ofArray) / sizeof(output_strategy_any_ofArray[0]); + if (output_strategy_any_of < sizeofArray) + return (char *)output_strategy_any_ofArray[output_strategy_any_of]; + else + return (char *)"Unknown"; +} + +OpenAPI_output_strategy_any_of_e OpenAPI_output_strategy_any_of_FromString(char* output_strategy_any_of) +{ + int stringToReturn = 0; + const char *output_strategy_any_ofArray[] = { "NULL", "BINARY", "GRADIENT" }; + size_t sizeofArray = sizeof(output_strategy_any_ofArray) / sizeof(output_strategy_any_ofArray[0]); + while (stringToReturn < sizeofArray) { + if (strcmp(output_strategy_any_of, output_strategy_any_ofArray[stringToReturn]) == 0) { + return stringToReturn; + } + stringToReturn++; + } + return 0; +} + diff --git a/lib/sbi/openapi/model/output_strategy_any_of.h b/lib/sbi/openapi/model/output_strategy_any_of.h new file mode 100644 index 000000000..f959111e4 --- /dev/null +++ b/lib/sbi/openapi/model/output_strategy_any_of.h @@ -0,0 +1,31 @@ +/* + * output_strategy_any_of.h + * + * + */ + +#ifndef _OpenAPI_output_strategy_any_of_H_ +#define _OpenAPI_output_strategy_any_of_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef enum { OpenAPI_output_strategy_any_of_NULL = 0, OpenAPI_output_strategy_any_of_BINARY, OpenAPI_output_strategy_any_of_GRADIENT } OpenAPI_output_strategy_any_of_e; + +char* OpenAPI_output_strategy_any_of_ToString(OpenAPI_output_strategy_any_of_e output_strategy_any_of); + +OpenAPI_output_strategy_any_of_e OpenAPI_output_strategy_any_of_FromString(char* output_strategy_any_of); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_output_strategy_any_of_H_ */ + diff --git a/lib/sbi/openapi/model/packet_filter_info.h b/lib/sbi/openapi/model/packet_filter_info.h index 4b3821f2c..a05996413 100644 --- a/lib/sbi/openapi/model/packet_filter_info.h +++ b/lib/sbi/openapi/model/packet_filter_info.h @@ -1,7 +1,7 @@ /* * packet_filter_info.h * - * + * Contains the information from a single packet filter sent from the SMF to the PCF. */ #ifndef _OpenAPI_packet_filter_info_H_ diff --git a/lib/sbi/openapi/model/parameter_combination.h b/lib/sbi/openapi/model/parameter_combination.h index 12291d0ce..f5c13f0fb 100644 --- a/lib/sbi/openapi/model/parameter_combination.h +++ b/lib/sbi/openapi/model/parameter_combination.h @@ -1,7 +1,7 @@ /* * parameter_combination.h * - * + * Represents the combination used by the BSF to check whether there is an existing PCF binding information. */ #ifndef _OpenAPI_parameter_combination_H_ diff --git a/lib/sbi/openapi/model/partial_success_report.c b/lib/sbi/openapi/model/partial_success_report.c index 7a5232879..ecd63ea0f 100644 --- a/lib/sbi/openapi/model/partial_success_report.c +++ b/lib/sbi/openapi/model/partial_success_report.c @@ -9,7 +9,8 @@ OpenAPI_partial_success_report_t *OpenAPI_partial_success_report_create( OpenAPI_list_t *rule_reports, OpenAPI_list_t *sess_rule_reports, OpenAPI_ue_camping_rep_t *ue_camping_rep, - OpenAPI_list_t *policy_dec_failure_reports + OpenAPI_list_t *policy_dec_failure_reports, + OpenAPI_list_t *invalid_policy_decs ) { OpenAPI_partial_success_report_t *partial_success_report_local_var = ogs_malloc(sizeof(OpenAPI_partial_success_report_t)); @@ -20,6 +21,7 @@ OpenAPI_partial_success_report_t *OpenAPI_partial_success_report_create( partial_success_report_local_var->sess_rule_reports = sess_rule_reports; partial_success_report_local_var->ue_camping_rep = ue_camping_rep; partial_success_report_local_var->policy_dec_failure_reports = policy_dec_failure_reports; + partial_success_report_local_var->invalid_policy_decs = invalid_policy_decs; return partial_success_report_local_var; } @@ -53,6 +55,13 @@ void OpenAPI_partial_success_report_free(OpenAPI_partial_success_report_t *parti OpenAPI_list_free(partial_success_report->policy_dec_failure_reports); partial_success_report->policy_dec_failure_reports = NULL; } + if (partial_success_report->invalid_policy_decs) { + OpenAPI_list_for_each(partial_success_report->invalid_policy_decs, node) { + OpenAPI_invalid_param_free(node->data); + } + OpenAPI_list_free(partial_success_report->invalid_policy_decs); + partial_success_report->invalid_policy_decs = NULL; + } ogs_free(partial_success_report); } @@ -135,6 +144,22 @@ cJSON *OpenAPI_partial_success_report_convertToJSON(OpenAPI_partial_success_repo } } + if (partial_success_report->invalid_policy_decs) { + cJSON *invalid_policy_decsList = cJSON_AddArrayToObject(item, "invalidPolicyDecs"); + if (invalid_policy_decsList == NULL) { + ogs_error("OpenAPI_partial_success_report_convertToJSON() failed [invalid_policy_decs]"); + goto end; + } + OpenAPI_list_for_each(partial_success_report->invalid_policy_decs, node) { + cJSON *itemLocal = OpenAPI_invalid_param_convertToJSON(node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_partial_success_report_convertToJSON() failed [invalid_policy_decs]"); + goto end; + } + cJSON_AddItemToArray(invalid_policy_decsList, itemLocal); + } + } + end: return item; } @@ -153,6 +178,8 @@ OpenAPI_partial_success_report_t *OpenAPI_partial_success_report_parseFromJSON(c OpenAPI_ue_camping_rep_t *ue_camping_rep_local_nonprim = NULL; cJSON *policy_dec_failure_reports = NULL; OpenAPI_list_t *policy_dec_failure_reportsList = NULL; + cJSON *invalid_policy_decs = NULL; + OpenAPI_list_t *invalid_policy_decsList = NULL; failure_cause = cJSON_GetObjectItemCaseSensitive(partial_success_reportJSON, "failureCause"); if (!failure_cause) { ogs_error("OpenAPI_partial_success_report_parseFromJSON() failed [failure_cause]"); @@ -238,12 +265,38 @@ OpenAPI_partial_success_report_t *OpenAPI_partial_success_report_parseFromJSON(c } } + invalid_policy_decs = cJSON_GetObjectItemCaseSensitive(partial_success_reportJSON, "invalidPolicyDecs"); + if (invalid_policy_decs) { + cJSON *invalid_policy_decs_local = NULL; + if (!cJSON_IsArray(invalid_policy_decs)) { + ogs_error("OpenAPI_partial_success_report_parseFromJSON() failed [invalid_policy_decs]"); + goto end; + } + + invalid_policy_decsList = OpenAPI_list_create(); + + cJSON_ArrayForEach(invalid_policy_decs_local, invalid_policy_decs) { + if (!cJSON_IsObject(invalid_policy_decs_local)) { + ogs_error("OpenAPI_partial_success_report_parseFromJSON() failed [invalid_policy_decs]"); + goto end; + } + OpenAPI_invalid_param_t *invalid_policy_decsItem = OpenAPI_invalid_param_parseFromJSON(invalid_policy_decs_local); + if (!invalid_policy_decsItem) { + ogs_error("No invalid_policy_decsItem"); + OpenAPI_list_free(invalid_policy_decsList); + goto end; + } + OpenAPI_list_add(invalid_policy_decsList, invalid_policy_decsItem); + } + } + partial_success_report_local_var = OpenAPI_partial_success_report_create ( failure_causeVariable, rule_reports ? rule_reportsList : NULL, sess_rule_reports ? sess_rule_reportsList : NULL, ue_camping_rep ? ue_camping_rep_local_nonprim : NULL, - policy_dec_failure_reports ? policy_dec_failure_reportsList : NULL + policy_dec_failure_reports ? policy_dec_failure_reportsList : NULL, + invalid_policy_decs ? invalid_policy_decsList : NULL ); return partial_success_report_local_var; @@ -270,6 +323,13 @@ end: OpenAPI_list_free(policy_dec_failure_reportsList); policy_dec_failure_reportsList = NULL; } + if (invalid_policy_decsList) { + OpenAPI_list_for_each(invalid_policy_decsList, node) { + OpenAPI_invalid_param_free(node->data); + } + OpenAPI_list_free(invalid_policy_decsList); + invalid_policy_decsList = NULL; + } return NULL; } diff --git a/lib/sbi/openapi/model/partial_success_report.h b/lib/sbi/openapi/model/partial_success_report.h index f340ed32a..01b212d54 100644 --- a/lib/sbi/openapi/model/partial_success_report.h +++ b/lib/sbi/openapi/model/partial_success_report.h @@ -1,7 +1,7 @@ /* * partial_success_report.h * - * + * Includes the information reported by the SMF when some of the PCC rules and/or session rules are not successfully installed/activated. */ #ifndef _OpenAPI_partial_success_report_H_ @@ -13,6 +13,7 @@ #include "../include/keyValuePair.h" #include "../include/binary.h" #include "failure_cause.h" +#include "invalid_param.h" #include "policy_decision_failure_code.h" #include "rule_report.h" #include "session_rule_report.h" @@ -29,6 +30,7 @@ typedef struct OpenAPI_partial_success_report_s { OpenAPI_list_t *sess_rule_reports; struct OpenAPI_ue_camping_rep_s *ue_camping_rep; OpenAPI_list_t *policy_dec_failure_reports; + OpenAPI_list_t *invalid_policy_decs; } OpenAPI_partial_success_report_t; OpenAPI_partial_success_report_t *OpenAPI_partial_success_report_create( @@ -36,7 +38,8 @@ OpenAPI_partial_success_report_t *OpenAPI_partial_success_report_create( OpenAPI_list_t *rule_reports, OpenAPI_list_t *sess_rule_reports, OpenAPI_ue_camping_rep_t *ue_camping_rep, - OpenAPI_list_t *policy_dec_failure_reports + OpenAPI_list_t *policy_dec_failure_reports, + OpenAPI_list_t *invalid_policy_decs ); void OpenAPI_partial_success_report_free(OpenAPI_partial_success_report_t *partial_success_report); OpenAPI_partial_success_report_t *OpenAPI_partial_success_report_parseFromJSON(cJSON *partial_success_reportJSON); diff --git a/lib/sbi/openapi/model/partitioning_criteria.c b/lib/sbi/openapi/model/partitioning_criteria.c new file mode 100644 index 000000000..5ece26aa6 --- /dev/null +++ b/lib/sbi/openapi/model/partitioning_criteria.c @@ -0,0 +1,30 @@ + +#include +#include +#include +#include "partitioning_criteria.h" + +char* OpenAPI_partitioning_criteria_ToString(OpenAPI_partitioning_criteria_e partitioning_criteria) +{ + const char *partitioning_criteriaArray[] = { "NULL", "TAC", "SUBPLMN", "GEOAREA", "SNSSAI", "DNN" }; + size_t sizeofArray = sizeof(partitioning_criteriaArray) / sizeof(partitioning_criteriaArray[0]); + if (partitioning_criteria < sizeofArray) + return (char *)partitioning_criteriaArray[partitioning_criteria]; + else + return (char *)"Unknown"; +} + +OpenAPI_partitioning_criteria_e OpenAPI_partitioning_criteria_FromString(char* partitioning_criteria) +{ + int stringToReturn = 0; + const char *partitioning_criteriaArray[] = { "NULL", "TAC", "SUBPLMN", "GEOAREA", "SNSSAI", "DNN" }; + size_t sizeofArray = sizeof(partitioning_criteriaArray) / sizeof(partitioning_criteriaArray[0]); + while (stringToReturn < sizeofArray) { + if (strcmp(partitioning_criteria, partitioning_criteriaArray[stringToReturn]) == 0) { + return stringToReturn; + } + stringToReturn++; + } + return 0; +} + diff --git a/lib/sbi/openapi/model/partitioning_criteria.h b/lib/sbi/openapi/model/partitioning_criteria.h new file mode 100644 index 000000000..4b303808e --- /dev/null +++ b/lib/sbi/openapi/model/partitioning_criteria.h @@ -0,0 +1,31 @@ +/* + * partitioning_criteria.h + * + * + */ + +#ifndef _OpenAPI_partitioning_criteria_H_ +#define _OpenAPI_partitioning_criteria_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef enum { OpenAPI_partitioning_criteria_NULL = 0, OpenAPI_partitioning_criteria_TAC, OpenAPI_partitioning_criteria_SUBPLMN, OpenAPI_partitioning_criteria_GEOAREA, OpenAPI_partitioning_criteria_SNSSAI, OpenAPI_partitioning_criteria_DNN } OpenAPI_partitioning_criteria_e; + +char* OpenAPI_partitioning_criteria_ToString(OpenAPI_partitioning_criteria_e partitioning_criteria); + +OpenAPI_partitioning_criteria_e OpenAPI_partitioning_criteria_FromString(char* partitioning_criteria); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_partitioning_criteria_H_ */ + diff --git a/lib/sbi/openapi/model/patch_item.h b/lib/sbi/openapi/model/patch_item.h index 9d84b748e..2dfc3ecd1 100644 --- a/lib/sbi/openapi/model/patch_item.h +++ b/lib/sbi/openapi/model/patch_item.h @@ -1,7 +1,7 @@ /* * patch_item.h * - * + * it contains information on data to be changed. */ #ifndef _OpenAPI_patch_item_H_ diff --git a/lib/sbi/openapi/model/patch_result.h b/lib/sbi/openapi/model/patch_result.h index f382a8c34..bdfc3fdb9 100644 --- a/lib/sbi/openapi/model/patch_result.h +++ b/lib/sbi/openapi/model/patch_result.h @@ -1,7 +1,7 @@ /* * patch_result.h * - * + * The execution report result on failed modification. */ #ifndef _OpenAPI_patch_result_H_ diff --git a/lib/sbi/openapi/model/pc5_flow_bit_rates.h b/lib/sbi/openapi/model/pc5_flow_bit_rates.h index d18aaf58b..d25d6f581 100644 --- a/lib/sbi/openapi/model/pc5_flow_bit_rates.h +++ b/lib/sbi/openapi/model/pc5_flow_bit_rates.h @@ -1,7 +1,7 @@ /* * pc5_flow_bit_rates.h * - * + * it shall represent the PC5 Flow Bit Rates */ #ifndef _OpenAPI_pc5_flow_bit_rates_H_ diff --git a/lib/sbi/openapi/model/pc5_qo_s_para.h b/lib/sbi/openapi/model/pc5_qo_s_para.h index f41cd3ec6..0ff652565 100644 --- a/lib/sbi/openapi/model/pc5_qo_s_para.h +++ b/lib/sbi/openapi/model/pc5_qo_s_para.h @@ -1,7 +1,7 @@ /* * pc5_qo_s_para.h * - * + * Contains policy data on the PC5 QoS parameters. */ #ifndef _OpenAPI_pc5_qo_s_para_H_ diff --git a/lib/sbi/openapi/model/pc5_qos_flow_item.h b/lib/sbi/openapi/model/pc5_qos_flow_item.h index cb48a5dc0..ff8c5deda 100644 --- a/lib/sbi/openapi/model/pc5_qos_flow_item.h +++ b/lib/sbi/openapi/model/pc5_qos_flow_item.h @@ -1,7 +1,7 @@ /* * pc5_qos_flow_item.h * - * + * Contains a PC5 QOS flow. */ #ifndef _OpenAPI_pc5_qos_flow_item_H_ diff --git a/lib/sbi/openapi/model/pcc_rule.c b/lib/sbi/openapi/model/pcc_rule.c index 004f15d7d..edfd2305d 100644 --- a/lib/sbi/openapi/model/pcc_rule.c +++ b/lib/sbi/openapi/model/pcc_rule.c @@ -16,6 +16,8 @@ OpenAPI_pcc_rule_t *OpenAPI_pcc_rule_create( OpenAPI_af_sig_protocol_e af_sig_protocol, bool is_app_reloc, int app_reloc, + bool is_eas_redis_ind, + int eas_redis_ind, OpenAPI_list_t *ref_qos_data, OpenAPI_list_t *ref_alt_qos_params, OpenAPI_list_t *ref_tc_data, @@ -29,10 +31,14 @@ OpenAPI_pcc_rule_t *OpenAPI_pcc_rule_create( int addr_preser_ind, OpenAPI_tscai_input_container_t *tscai_input_dl, OpenAPI_tscai_input_container_t *tscai_input_ul, + bool is_tscai_time_dom, + int tscai_time_dom, OpenAPI_downlink_data_notification_control_t *dd_notif_ctrl, OpenAPI_downlink_data_notification_control_rm_t *dd_notif_ctrl2, bool is_dis_ue_notif, - int dis_ue_notif + int dis_ue_notif, + bool is_pack_filt_all_prec, + int pack_filt_all_prec ) { OpenAPI_pcc_rule_t *pcc_rule_local_var = ogs_malloc(sizeof(OpenAPI_pcc_rule_t)); @@ -49,6 +55,8 @@ OpenAPI_pcc_rule_t *OpenAPI_pcc_rule_create( pcc_rule_local_var->af_sig_protocol = af_sig_protocol; pcc_rule_local_var->is_app_reloc = is_app_reloc; pcc_rule_local_var->app_reloc = app_reloc; + pcc_rule_local_var->is_eas_redis_ind = is_eas_redis_ind; + pcc_rule_local_var->eas_redis_ind = eas_redis_ind; pcc_rule_local_var->ref_qos_data = ref_qos_data; pcc_rule_local_var->ref_alt_qos_params = ref_alt_qos_params; pcc_rule_local_var->ref_tc_data = ref_tc_data; @@ -62,10 +70,14 @@ OpenAPI_pcc_rule_t *OpenAPI_pcc_rule_create( pcc_rule_local_var->addr_preser_ind = addr_preser_ind; pcc_rule_local_var->tscai_input_dl = tscai_input_dl; pcc_rule_local_var->tscai_input_ul = tscai_input_ul; + pcc_rule_local_var->is_tscai_time_dom = is_tscai_time_dom; + pcc_rule_local_var->tscai_time_dom = tscai_time_dom; pcc_rule_local_var->dd_notif_ctrl = dd_notif_ctrl; pcc_rule_local_var->dd_notif_ctrl2 = dd_notif_ctrl2; pcc_rule_local_var->is_dis_ue_notif = is_dis_ue_notif; pcc_rule_local_var->dis_ue_notif = dis_ue_notif; + pcc_rule_local_var->is_pack_filt_all_prec = is_pack_filt_all_prec; + pcc_rule_local_var->pack_filt_all_prec = pack_filt_all_prec; return pcc_rule_local_var; } @@ -253,6 +265,13 @@ cJSON *OpenAPI_pcc_rule_convertToJSON(OpenAPI_pcc_rule_t *pcc_rule) } } + if (pcc_rule->is_eas_redis_ind) { + if (cJSON_AddBoolToObject(item, "easRedisInd", pcc_rule->eas_redis_ind) == NULL) { + ogs_error("OpenAPI_pcc_rule_convertToJSON() failed [eas_redis_ind]"); + goto end; + } + } + if (pcc_rule->ref_qos_data) { cJSON *ref_qos_dataList = cJSON_AddArrayToObject(item, "refQosData"); if (ref_qos_dataList == NULL) { @@ -405,6 +424,13 @@ cJSON *OpenAPI_pcc_rule_convertToJSON(OpenAPI_pcc_rule_t *pcc_rule) } } + if (pcc_rule->is_tscai_time_dom) { + if (cJSON_AddNumberToObject(item, "tscaiTimeDom", pcc_rule->tscai_time_dom) == NULL) { + ogs_error("OpenAPI_pcc_rule_convertToJSON() failed [tscai_time_dom]"); + goto end; + } + } + if (pcc_rule->dd_notif_ctrl) { cJSON *dd_notif_ctrl_local_JSON = OpenAPI_downlink_data_notification_control_convertToJSON(pcc_rule->dd_notif_ctrl); if (dd_notif_ctrl_local_JSON == NULL) { @@ -438,6 +464,13 @@ cJSON *OpenAPI_pcc_rule_convertToJSON(OpenAPI_pcc_rule_t *pcc_rule) } } + if (pcc_rule->is_pack_filt_all_prec) { + if (cJSON_AddNumberToObject(item, "packFiltAllPrec", pcc_rule->pack_filt_all_prec) == NULL) { + ogs_error("OpenAPI_pcc_rule_convertToJSON() failed [pack_filt_all_prec]"); + goto end; + } + } + end: return item; } @@ -456,6 +489,7 @@ OpenAPI_pcc_rule_t *OpenAPI_pcc_rule_parseFromJSON(cJSON *pcc_ruleJSON) cJSON *af_sig_protocol = NULL; OpenAPI_af_sig_protocol_e af_sig_protocolVariable = 0; cJSON *app_reloc = NULL; + cJSON *eas_redis_ind = NULL; cJSON *ref_qos_data = NULL; OpenAPI_list_t *ref_qos_dataList = NULL; cJSON *ref_alt_qos_params = NULL; @@ -478,11 +512,13 @@ OpenAPI_pcc_rule_t *OpenAPI_pcc_rule_parseFromJSON(cJSON *pcc_ruleJSON) OpenAPI_tscai_input_container_t *tscai_input_dl_local_nonprim = NULL; cJSON *tscai_input_ul = NULL; OpenAPI_tscai_input_container_t *tscai_input_ul_local_nonprim = NULL; + cJSON *tscai_time_dom = NULL; cJSON *dd_notif_ctrl = NULL; OpenAPI_downlink_data_notification_control_t *dd_notif_ctrl_local_nonprim = NULL; cJSON *dd_notif_ctrl2 = NULL; OpenAPI_downlink_data_notification_control_rm_t *dd_notif_ctrl2_local_nonprim = NULL; cJSON *dis_ue_notif = NULL; + cJSON *pack_filt_all_prec = NULL; flow_infos = cJSON_GetObjectItemCaseSensitive(pcc_ruleJSON, "flowInfos"); if (flow_infos) { cJSON *flow_infos_local = NULL; @@ -567,6 +603,14 @@ OpenAPI_pcc_rule_t *OpenAPI_pcc_rule_parseFromJSON(cJSON *pcc_ruleJSON) } } + eas_redis_ind = cJSON_GetObjectItemCaseSensitive(pcc_ruleJSON, "easRedisInd"); + if (eas_redis_ind) { + if (!cJSON_IsBool(eas_redis_ind)) { + ogs_error("OpenAPI_pcc_rule_parseFromJSON() failed [eas_redis_ind]"); + goto end; + } + } + ref_qos_data = cJSON_GetObjectItemCaseSensitive(pcc_ruleJSON, "refQosData"); if (ref_qos_data) { cJSON *ref_qos_data_local = NULL; @@ -761,6 +805,14 @@ OpenAPI_pcc_rule_t *OpenAPI_pcc_rule_parseFromJSON(cJSON *pcc_ruleJSON) tscai_input_ul_local_nonprim = OpenAPI_tscai_input_container_parseFromJSON(tscai_input_ul); } + tscai_time_dom = cJSON_GetObjectItemCaseSensitive(pcc_ruleJSON, "tscaiTimeDom"); + if (tscai_time_dom) { + if (!cJSON_IsNumber(tscai_time_dom)) { + ogs_error("OpenAPI_pcc_rule_parseFromJSON() failed [tscai_time_dom]"); + goto end; + } + } + dd_notif_ctrl = cJSON_GetObjectItemCaseSensitive(pcc_ruleJSON, "ddNotifCtrl"); if (dd_notif_ctrl) { dd_notif_ctrl_local_nonprim = OpenAPI_downlink_data_notification_control_parseFromJSON(dd_notif_ctrl); @@ -779,6 +831,14 @@ OpenAPI_pcc_rule_t *OpenAPI_pcc_rule_parseFromJSON(cJSON *pcc_ruleJSON) } } + pack_filt_all_prec = cJSON_GetObjectItemCaseSensitive(pcc_ruleJSON, "packFiltAllPrec"); + if (pack_filt_all_prec) { + if (!cJSON_IsNumber(pack_filt_all_prec)) { + ogs_error("OpenAPI_pcc_rule_parseFromJSON() failed [pack_filt_all_prec]"); + goto end; + } + } + pcc_rule_local_var = OpenAPI_pcc_rule_create ( flow_infos ? flow_infosList : NULL, app_id && !cJSON_IsNull(app_id) ? ogs_strdup(app_id->valuestring) : NULL, @@ -791,6 +851,8 @@ OpenAPI_pcc_rule_t *OpenAPI_pcc_rule_parseFromJSON(cJSON *pcc_ruleJSON) af_sig_protocol ? af_sig_protocolVariable : 0, app_reloc ? true : false, app_reloc ? app_reloc->valueint : 0, + eas_redis_ind ? true : false, + eas_redis_ind ? eas_redis_ind->valueint : 0, ref_qos_data ? ref_qos_dataList : NULL, ref_alt_qos_params ? ref_alt_qos_paramsList : NULL, ref_tc_data ? ref_tc_dataList : NULL, @@ -804,10 +866,14 @@ OpenAPI_pcc_rule_t *OpenAPI_pcc_rule_parseFromJSON(cJSON *pcc_ruleJSON) addr_preser_ind ? addr_preser_ind->valueint : 0, tscai_input_dl ? tscai_input_dl_local_nonprim : NULL, tscai_input_ul ? tscai_input_ul_local_nonprim : NULL, + tscai_time_dom ? true : false, + tscai_time_dom ? tscai_time_dom->valuedouble : 0, dd_notif_ctrl ? dd_notif_ctrl_local_nonprim : NULL, dd_notif_ctrl2 ? dd_notif_ctrl2_local_nonprim : NULL, dis_ue_notif ? true : false, - dis_ue_notif ? dis_ue_notif->valueint : 0 + dis_ue_notif ? dis_ue_notif->valueint : 0, + pack_filt_all_prec ? true : false, + pack_filt_all_prec ? pack_filt_all_prec->valuedouble : 0 ); return pcc_rule_local_var; diff --git a/lib/sbi/openapi/model/pcc_rule.h b/lib/sbi/openapi/model/pcc_rule.h index 52b0cd389..9d93b0645 100644 --- a/lib/sbi/openapi/model/pcc_rule.h +++ b/lib/sbi/openapi/model/pcc_rule.h @@ -1,7 +1,7 @@ /* * pcc_rule.h * - * + * Contains a PCC rule information. */ #ifndef _OpenAPI_pcc_rule_H_ @@ -35,6 +35,8 @@ typedef struct OpenAPI_pcc_rule_s { OpenAPI_af_sig_protocol_e af_sig_protocol; bool is_app_reloc; int app_reloc; + bool is_eas_redis_ind; + int eas_redis_ind; OpenAPI_list_t *ref_qos_data; OpenAPI_list_t *ref_alt_qos_params; OpenAPI_list_t *ref_tc_data; @@ -48,10 +50,14 @@ typedef struct OpenAPI_pcc_rule_s { int addr_preser_ind; struct OpenAPI_tscai_input_container_s *tscai_input_dl; struct OpenAPI_tscai_input_container_s *tscai_input_ul; + bool is_tscai_time_dom; + int tscai_time_dom; struct OpenAPI_downlink_data_notification_control_s *dd_notif_ctrl; struct OpenAPI_downlink_data_notification_control_rm_s *dd_notif_ctrl2; bool is_dis_ue_notif; int dis_ue_notif; + bool is_pack_filt_all_prec; + int pack_filt_all_prec; } OpenAPI_pcc_rule_t; OpenAPI_pcc_rule_t *OpenAPI_pcc_rule_create( @@ -66,6 +72,8 @@ OpenAPI_pcc_rule_t *OpenAPI_pcc_rule_create( OpenAPI_af_sig_protocol_e af_sig_protocol, bool is_app_reloc, int app_reloc, + bool is_eas_redis_ind, + int eas_redis_ind, OpenAPI_list_t *ref_qos_data, OpenAPI_list_t *ref_alt_qos_params, OpenAPI_list_t *ref_tc_data, @@ -79,10 +87,14 @@ OpenAPI_pcc_rule_t *OpenAPI_pcc_rule_create( int addr_preser_ind, OpenAPI_tscai_input_container_t *tscai_input_dl, OpenAPI_tscai_input_container_t *tscai_input_ul, + bool is_tscai_time_dom, + int tscai_time_dom, OpenAPI_downlink_data_notification_control_t *dd_notif_ctrl, OpenAPI_downlink_data_notification_control_rm_t *dd_notif_ctrl2, bool is_dis_ue_notif, - int dis_ue_notif + int dis_ue_notif, + bool is_pack_filt_all_prec, + int pack_filt_all_prec ); void OpenAPI_pcc_rule_free(OpenAPI_pcc_rule_t *pcc_rule); OpenAPI_pcc_rule_t *OpenAPI_pcc_rule_parseFromJSON(cJSON *pcc_ruleJSON); diff --git a/lib/sbi/openapi/model/pcf_addressing_info.c b/lib/sbi/openapi/model/pcf_addressing_info.c new file mode 100644 index 000000000..df8999d53 --- /dev/null +++ b/lib/sbi/openapi/model/pcf_addressing_info.c @@ -0,0 +1,193 @@ + +#include +#include +#include +#include "pcf_addressing_info.h" + +OpenAPI_pcf_addressing_info_t *OpenAPI_pcf_addressing_info_create( + char *pcf_fqdn, + OpenAPI_list_t *pcf_ip_end_points, + char *binding_info +) +{ + OpenAPI_pcf_addressing_info_t *pcf_addressing_info_local_var = ogs_malloc(sizeof(OpenAPI_pcf_addressing_info_t)); + ogs_assert(pcf_addressing_info_local_var); + + pcf_addressing_info_local_var->pcf_fqdn = pcf_fqdn; + pcf_addressing_info_local_var->pcf_ip_end_points = pcf_ip_end_points; + pcf_addressing_info_local_var->binding_info = binding_info; + + return pcf_addressing_info_local_var; +} + +void OpenAPI_pcf_addressing_info_free(OpenAPI_pcf_addressing_info_t *pcf_addressing_info) +{ + OpenAPI_lnode_t *node = NULL; + + if (NULL == pcf_addressing_info) { + return; + } + if (pcf_addressing_info->pcf_fqdn) { + ogs_free(pcf_addressing_info->pcf_fqdn); + pcf_addressing_info->pcf_fqdn = NULL; + } + if (pcf_addressing_info->pcf_ip_end_points) { + OpenAPI_list_for_each(pcf_addressing_info->pcf_ip_end_points, node) { + OpenAPI_ip_end_point_free(node->data); + } + OpenAPI_list_free(pcf_addressing_info->pcf_ip_end_points); + pcf_addressing_info->pcf_ip_end_points = NULL; + } + if (pcf_addressing_info->binding_info) { + ogs_free(pcf_addressing_info->binding_info); + pcf_addressing_info->binding_info = NULL; + } + ogs_free(pcf_addressing_info); +} + +cJSON *OpenAPI_pcf_addressing_info_convertToJSON(OpenAPI_pcf_addressing_info_t *pcf_addressing_info) +{ + cJSON *item = NULL; + OpenAPI_lnode_t *node = NULL; + + if (pcf_addressing_info == NULL) { + ogs_error("OpenAPI_pcf_addressing_info_convertToJSON() failed [PcfAddressingInfo]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (pcf_addressing_info->pcf_fqdn) { + if (cJSON_AddStringToObject(item, "pcfFqdn", pcf_addressing_info->pcf_fqdn) == NULL) { + ogs_error("OpenAPI_pcf_addressing_info_convertToJSON() failed [pcf_fqdn]"); + goto end; + } + } + + if (pcf_addressing_info->pcf_ip_end_points) { + cJSON *pcf_ip_end_pointsList = cJSON_AddArrayToObject(item, "pcfIpEndPoints"); + if (pcf_ip_end_pointsList == NULL) { + ogs_error("OpenAPI_pcf_addressing_info_convertToJSON() failed [pcf_ip_end_points]"); + goto end; + } + OpenAPI_list_for_each(pcf_addressing_info->pcf_ip_end_points, node) { + cJSON *itemLocal = OpenAPI_ip_end_point_convertToJSON(node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_pcf_addressing_info_convertToJSON() failed [pcf_ip_end_points]"); + goto end; + } + cJSON_AddItemToArray(pcf_ip_end_pointsList, itemLocal); + } + } + + if (pcf_addressing_info->binding_info) { + if (cJSON_AddStringToObject(item, "bindingInfo", pcf_addressing_info->binding_info) == NULL) { + ogs_error("OpenAPI_pcf_addressing_info_convertToJSON() failed [binding_info]"); + goto end; + } + } + +end: + return item; +} + +OpenAPI_pcf_addressing_info_t *OpenAPI_pcf_addressing_info_parseFromJSON(cJSON *pcf_addressing_infoJSON) +{ + OpenAPI_pcf_addressing_info_t *pcf_addressing_info_local_var = NULL; + OpenAPI_lnode_t *node = NULL; + cJSON *pcf_fqdn = NULL; + cJSON *pcf_ip_end_points = NULL; + OpenAPI_list_t *pcf_ip_end_pointsList = NULL; + cJSON *binding_info = NULL; + pcf_fqdn = cJSON_GetObjectItemCaseSensitive(pcf_addressing_infoJSON, "pcfFqdn"); + if (pcf_fqdn) { + if (!cJSON_IsString(pcf_fqdn) && !cJSON_IsNull(pcf_fqdn)) { + ogs_error("OpenAPI_pcf_addressing_info_parseFromJSON() failed [pcf_fqdn]"); + goto end; + } + } + + pcf_ip_end_points = cJSON_GetObjectItemCaseSensitive(pcf_addressing_infoJSON, "pcfIpEndPoints"); + if (pcf_ip_end_points) { + cJSON *pcf_ip_end_points_local = NULL; + if (!cJSON_IsArray(pcf_ip_end_points)) { + ogs_error("OpenAPI_pcf_addressing_info_parseFromJSON() failed [pcf_ip_end_points]"); + 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_addressing_info_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); + } + } + + binding_info = cJSON_GetObjectItemCaseSensitive(pcf_addressing_infoJSON, "bindingInfo"); + if (binding_info) { + if (!cJSON_IsString(binding_info) && !cJSON_IsNull(binding_info)) { + ogs_error("OpenAPI_pcf_addressing_info_parseFromJSON() failed [binding_info]"); + goto end; + } + } + + pcf_addressing_info_local_var = OpenAPI_pcf_addressing_info_create ( + pcf_fqdn && !cJSON_IsNull(pcf_fqdn) ? ogs_strdup(pcf_fqdn->valuestring) : NULL, + pcf_ip_end_points ? pcf_ip_end_pointsList : NULL, + binding_info && !cJSON_IsNull(binding_info) ? ogs_strdup(binding_info->valuestring) : NULL + ); + + return pcf_addressing_info_local_var; +end: + 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; + } + return NULL; +} + +OpenAPI_pcf_addressing_info_t *OpenAPI_pcf_addressing_info_copy(OpenAPI_pcf_addressing_info_t *dst, OpenAPI_pcf_addressing_info_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_pcf_addressing_info_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_pcf_addressing_info_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_pcf_addressing_info_free(dst); + dst = OpenAPI_pcf_addressing_info_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/pcf_addressing_info.h b/lib/sbi/openapi/model/pcf_addressing_info.h new file mode 100644 index 000000000..b87859b4d --- /dev/null +++ b/lib/sbi/openapi/model/pcf_addressing_info.h @@ -0,0 +1,43 @@ +/* + * pcf_addressing_info.h + * + * Contains PCF address information. + */ + +#ifndef _OpenAPI_pcf_addressing_info_H_ +#define _OpenAPI_pcf_addressing_info_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "ip_end_point.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_pcf_addressing_info_s OpenAPI_pcf_addressing_info_t; +typedef struct OpenAPI_pcf_addressing_info_s { + char *pcf_fqdn; + OpenAPI_list_t *pcf_ip_end_points; + char *binding_info; +} OpenAPI_pcf_addressing_info_t; + +OpenAPI_pcf_addressing_info_t *OpenAPI_pcf_addressing_info_create( + char *pcf_fqdn, + OpenAPI_list_t *pcf_ip_end_points, + char *binding_info +); +void OpenAPI_pcf_addressing_info_free(OpenAPI_pcf_addressing_info_t *pcf_addressing_info); +OpenAPI_pcf_addressing_info_t *OpenAPI_pcf_addressing_info_parseFromJSON(cJSON *pcf_addressing_infoJSON); +cJSON *OpenAPI_pcf_addressing_info_convertToJSON(OpenAPI_pcf_addressing_info_t *pcf_addressing_info); +OpenAPI_pcf_addressing_info_t *OpenAPI_pcf_addressing_info_copy(OpenAPI_pcf_addressing_info_t *dst, OpenAPI_pcf_addressing_info_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_pcf_addressing_info_H_ */ + diff --git a/lib/sbi/openapi/model/pcf_binding.h b/lib/sbi/openapi/model/pcf_binding.h index 1431ce6d7..69f53dc2c 100644 --- a/lib/sbi/openapi/model/pcf_binding.h +++ b/lib/sbi/openapi/model/pcf_binding.h @@ -1,7 +1,7 @@ /* * pcf_binding.h * - * + * Identifies an Individual PCF for a PDU Session binding. */ #ifndef _OpenAPI_pcf_binding_H_ diff --git a/lib/sbi/openapi/model/pcf_binding_patch.h b/lib/sbi/openapi/model/pcf_binding_patch.h index 71d9415dd..73f7b40d2 100644 --- a/lib/sbi/openapi/model/pcf_binding_patch.h +++ b/lib/sbi/openapi/model/pcf_binding_patch.h @@ -1,7 +1,7 @@ /* * pcf_binding_patch.h * - * + * Identifies an Individual PCF binding used in an HTTP Patch method. */ #ifndef _OpenAPI_pcf_binding_patch_H_ diff --git a/lib/sbi/openapi/model/pcf_for_pdu_session_info.c b/lib/sbi/openapi/model/pcf_for_pdu_session_info.c new file mode 100644 index 000000000..16f082234 --- /dev/null +++ b/lib/sbi/openapi/model/pcf_for_pdu_session_info.c @@ -0,0 +1,453 @@ + +#include +#include +#include +#include "pcf_for_pdu_session_info.h" + +OpenAPI_pcf_for_pdu_session_info_t *OpenAPI_pcf_for_pdu_session_info_create( + char *dnn, + OpenAPI_snssai_t *snssai, + char *pcf_fqdn, + OpenAPI_list_t *pcf_ip_end_points, + char *ipv4_addr, + char *ip_domain, + OpenAPI_list_t *ipv6_prefixes, + OpenAPI_list_t *mac_addrs, + char *pcf_id, + char *pcf_set_id, + OpenAPI_binding_level_e bind_level +) +{ + OpenAPI_pcf_for_pdu_session_info_t *pcf_for_pdu_session_info_local_var = ogs_malloc(sizeof(OpenAPI_pcf_for_pdu_session_info_t)); + ogs_assert(pcf_for_pdu_session_info_local_var); + + pcf_for_pdu_session_info_local_var->dnn = dnn; + pcf_for_pdu_session_info_local_var->snssai = snssai; + pcf_for_pdu_session_info_local_var->pcf_fqdn = pcf_fqdn; + pcf_for_pdu_session_info_local_var->pcf_ip_end_points = pcf_ip_end_points; + pcf_for_pdu_session_info_local_var->ipv4_addr = ipv4_addr; + pcf_for_pdu_session_info_local_var->ip_domain = ip_domain; + pcf_for_pdu_session_info_local_var->ipv6_prefixes = ipv6_prefixes; + pcf_for_pdu_session_info_local_var->mac_addrs = mac_addrs; + pcf_for_pdu_session_info_local_var->pcf_id = pcf_id; + pcf_for_pdu_session_info_local_var->pcf_set_id = pcf_set_id; + pcf_for_pdu_session_info_local_var->bind_level = bind_level; + + return pcf_for_pdu_session_info_local_var; +} + +void OpenAPI_pcf_for_pdu_session_info_free(OpenAPI_pcf_for_pdu_session_info_t *pcf_for_pdu_session_info) +{ + OpenAPI_lnode_t *node = NULL; + + if (NULL == pcf_for_pdu_session_info) { + return; + } + if (pcf_for_pdu_session_info->dnn) { + ogs_free(pcf_for_pdu_session_info->dnn); + pcf_for_pdu_session_info->dnn = NULL; + } + if (pcf_for_pdu_session_info->snssai) { + OpenAPI_snssai_free(pcf_for_pdu_session_info->snssai); + pcf_for_pdu_session_info->snssai = NULL; + } + if (pcf_for_pdu_session_info->pcf_fqdn) { + ogs_free(pcf_for_pdu_session_info->pcf_fqdn); + pcf_for_pdu_session_info->pcf_fqdn = NULL; + } + if (pcf_for_pdu_session_info->pcf_ip_end_points) { + OpenAPI_list_for_each(pcf_for_pdu_session_info->pcf_ip_end_points, node) { + OpenAPI_ip_end_point_free(node->data); + } + OpenAPI_list_free(pcf_for_pdu_session_info->pcf_ip_end_points); + pcf_for_pdu_session_info->pcf_ip_end_points = NULL; + } + if (pcf_for_pdu_session_info->ipv4_addr) { + ogs_free(pcf_for_pdu_session_info->ipv4_addr); + pcf_for_pdu_session_info->ipv4_addr = NULL; + } + if (pcf_for_pdu_session_info->ip_domain) { + ogs_free(pcf_for_pdu_session_info->ip_domain); + pcf_for_pdu_session_info->ip_domain = NULL; + } + if (pcf_for_pdu_session_info->ipv6_prefixes) { + OpenAPI_list_for_each(pcf_for_pdu_session_info->ipv6_prefixes, node) { + ogs_free(node->data); + } + OpenAPI_list_free(pcf_for_pdu_session_info->ipv6_prefixes); + pcf_for_pdu_session_info->ipv6_prefixes = NULL; + } + if (pcf_for_pdu_session_info->mac_addrs) { + OpenAPI_list_for_each(pcf_for_pdu_session_info->mac_addrs, node) { + ogs_free(node->data); + } + OpenAPI_list_free(pcf_for_pdu_session_info->mac_addrs); + pcf_for_pdu_session_info->mac_addrs = NULL; + } + if (pcf_for_pdu_session_info->pcf_id) { + ogs_free(pcf_for_pdu_session_info->pcf_id); + pcf_for_pdu_session_info->pcf_id = NULL; + } + if (pcf_for_pdu_session_info->pcf_set_id) { + ogs_free(pcf_for_pdu_session_info->pcf_set_id); + pcf_for_pdu_session_info->pcf_set_id = NULL; + } + ogs_free(pcf_for_pdu_session_info); +} + +cJSON *OpenAPI_pcf_for_pdu_session_info_convertToJSON(OpenAPI_pcf_for_pdu_session_info_t *pcf_for_pdu_session_info) +{ + cJSON *item = NULL; + OpenAPI_lnode_t *node = NULL; + + if (pcf_for_pdu_session_info == NULL) { + ogs_error("OpenAPI_pcf_for_pdu_session_info_convertToJSON() failed [PcfForPduSessionInfo]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (!pcf_for_pdu_session_info->dnn) { + ogs_error("OpenAPI_pcf_for_pdu_session_info_convertToJSON() failed [dnn]"); + return NULL; + } + if (cJSON_AddStringToObject(item, "dnn", pcf_for_pdu_session_info->dnn) == NULL) { + ogs_error("OpenAPI_pcf_for_pdu_session_info_convertToJSON() failed [dnn]"); + goto end; + } + + if (!pcf_for_pdu_session_info->snssai) { + ogs_error("OpenAPI_pcf_for_pdu_session_info_convertToJSON() failed [snssai]"); + return NULL; + } + cJSON *snssai_local_JSON = OpenAPI_snssai_convertToJSON(pcf_for_pdu_session_info->snssai); + if (snssai_local_JSON == NULL) { + ogs_error("OpenAPI_pcf_for_pdu_session_info_convertToJSON() failed [snssai]"); + goto end; + } + cJSON_AddItemToObject(item, "snssai", snssai_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_pcf_for_pdu_session_info_convertToJSON() failed [snssai]"); + goto end; + } + + if (pcf_for_pdu_session_info->pcf_fqdn) { + if (cJSON_AddStringToObject(item, "pcfFqdn", pcf_for_pdu_session_info->pcf_fqdn) == NULL) { + ogs_error("OpenAPI_pcf_for_pdu_session_info_convertToJSON() failed [pcf_fqdn]"); + goto end; + } + } + + if (pcf_for_pdu_session_info->pcf_ip_end_points) { + cJSON *pcf_ip_end_pointsList = cJSON_AddArrayToObject(item, "pcfIpEndPoints"); + if (pcf_ip_end_pointsList == NULL) { + ogs_error("OpenAPI_pcf_for_pdu_session_info_convertToJSON() failed [pcf_ip_end_points]"); + goto end; + } + OpenAPI_list_for_each(pcf_for_pdu_session_info->pcf_ip_end_points, node) { + cJSON *itemLocal = OpenAPI_ip_end_point_convertToJSON(node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_pcf_for_pdu_session_info_convertToJSON() failed [pcf_ip_end_points]"); + goto end; + } + cJSON_AddItemToArray(pcf_ip_end_pointsList, itemLocal); + } + } + + if (pcf_for_pdu_session_info->ipv4_addr) { + if (cJSON_AddStringToObject(item, "ipv4Addr", pcf_for_pdu_session_info->ipv4_addr) == NULL) { + ogs_error("OpenAPI_pcf_for_pdu_session_info_convertToJSON() failed [ipv4_addr]"); + goto end; + } + } + + if (pcf_for_pdu_session_info->ip_domain) { + if (cJSON_AddStringToObject(item, "ipDomain", pcf_for_pdu_session_info->ip_domain) == NULL) { + ogs_error("OpenAPI_pcf_for_pdu_session_info_convertToJSON() failed [ip_domain]"); + goto end; + } + } + + if (pcf_for_pdu_session_info->ipv6_prefixes) { + cJSON *ipv6_prefixesList = cJSON_AddArrayToObject(item, "ipv6Prefixes"); + if (ipv6_prefixesList == NULL) { + ogs_error("OpenAPI_pcf_for_pdu_session_info_convertToJSON() failed [ipv6_prefixes]"); + goto end; + } + OpenAPI_list_for_each(pcf_for_pdu_session_info->ipv6_prefixes, node) { + if (cJSON_AddStringToObject(ipv6_prefixesList, "", (char*)node->data) == NULL) { + ogs_error("OpenAPI_pcf_for_pdu_session_info_convertToJSON() failed [ipv6_prefixes]"); + goto end; + } + } + } + + if (pcf_for_pdu_session_info->mac_addrs) { + cJSON *mac_addrsList = cJSON_AddArrayToObject(item, "macAddrs"); + if (mac_addrsList == NULL) { + ogs_error("OpenAPI_pcf_for_pdu_session_info_convertToJSON() failed [mac_addrs]"); + goto end; + } + OpenAPI_list_for_each(pcf_for_pdu_session_info->mac_addrs, node) { + if (cJSON_AddStringToObject(mac_addrsList, "", (char*)node->data) == NULL) { + ogs_error("OpenAPI_pcf_for_pdu_session_info_convertToJSON() failed [mac_addrs]"); + goto end; + } + } + } + + if (pcf_for_pdu_session_info->pcf_id) { + if (cJSON_AddStringToObject(item, "pcfId", pcf_for_pdu_session_info->pcf_id) == NULL) { + ogs_error("OpenAPI_pcf_for_pdu_session_info_convertToJSON() failed [pcf_id]"); + goto end; + } + } + + if (pcf_for_pdu_session_info->pcf_set_id) { + if (cJSON_AddStringToObject(item, "pcfSetId", pcf_for_pdu_session_info->pcf_set_id) == NULL) { + ogs_error("OpenAPI_pcf_for_pdu_session_info_convertToJSON() failed [pcf_set_id]"); + goto end; + } + } + + if (pcf_for_pdu_session_info->bind_level != OpenAPI_binding_level_NULL) { + if (cJSON_AddStringToObject(item, "bindLevel", OpenAPI_binding_level_ToString(pcf_for_pdu_session_info->bind_level)) == NULL) { + ogs_error("OpenAPI_pcf_for_pdu_session_info_convertToJSON() failed [bind_level]"); + goto end; + } + } + +end: + return item; +} + +OpenAPI_pcf_for_pdu_session_info_t *OpenAPI_pcf_for_pdu_session_info_parseFromJSON(cJSON *pcf_for_pdu_session_infoJSON) +{ + OpenAPI_pcf_for_pdu_session_info_t *pcf_for_pdu_session_info_local_var = NULL; + OpenAPI_lnode_t *node = NULL; + cJSON *dnn = NULL; + cJSON *snssai = NULL; + OpenAPI_snssai_t *snssai_local_nonprim = NULL; + cJSON *pcf_fqdn = NULL; + cJSON *pcf_ip_end_points = NULL; + OpenAPI_list_t *pcf_ip_end_pointsList = NULL; + cJSON *ipv4_addr = NULL; + cJSON *ip_domain = NULL; + cJSON *ipv6_prefixes = NULL; + OpenAPI_list_t *ipv6_prefixesList = NULL; + cJSON *mac_addrs = NULL; + OpenAPI_list_t *mac_addrsList = NULL; + cJSON *pcf_id = NULL; + cJSON *pcf_set_id = NULL; + cJSON *bind_level = NULL; + OpenAPI_binding_level_e bind_levelVariable = 0; + dnn = cJSON_GetObjectItemCaseSensitive(pcf_for_pdu_session_infoJSON, "dnn"); + if (!dnn) { + ogs_error("OpenAPI_pcf_for_pdu_session_info_parseFromJSON() failed [dnn]"); + goto end; + } + if (!cJSON_IsString(dnn)) { + ogs_error("OpenAPI_pcf_for_pdu_session_info_parseFromJSON() failed [dnn]"); + goto end; + } + + snssai = cJSON_GetObjectItemCaseSensitive(pcf_for_pdu_session_infoJSON, "snssai"); + if (!snssai) { + ogs_error("OpenAPI_pcf_for_pdu_session_info_parseFromJSON() failed [snssai]"); + goto end; + } + snssai_local_nonprim = OpenAPI_snssai_parseFromJSON(snssai); + + pcf_fqdn = cJSON_GetObjectItemCaseSensitive(pcf_for_pdu_session_infoJSON, "pcfFqdn"); + if (pcf_fqdn) { + if (!cJSON_IsString(pcf_fqdn) && !cJSON_IsNull(pcf_fqdn)) { + ogs_error("OpenAPI_pcf_for_pdu_session_info_parseFromJSON() failed [pcf_fqdn]"); + goto end; + } + } + + pcf_ip_end_points = cJSON_GetObjectItemCaseSensitive(pcf_for_pdu_session_infoJSON, "pcfIpEndPoints"); + if (pcf_ip_end_points) { + cJSON *pcf_ip_end_points_local = NULL; + if (!cJSON_IsArray(pcf_ip_end_points)) { + ogs_error("OpenAPI_pcf_for_pdu_session_info_parseFromJSON() failed [pcf_ip_end_points]"); + 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_for_pdu_session_info_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); + } + } + + ipv4_addr = cJSON_GetObjectItemCaseSensitive(pcf_for_pdu_session_infoJSON, "ipv4Addr"); + if (ipv4_addr) { + if (!cJSON_IsString(ipv4_addr) && !cJSON_IsNull(ipv4_addr)) { + ogs_error("OpenAPI_pcf_for_pdu_session_info_parseFromJSON() failed [ipv4_addr]"); + goto end; + } + } + + ip_domain = cJSON_GetObjectItemCaseSensitive(pcf_for_pdu_session_infoJSON, "ipDomain"); + if (ip_domain) { + if (!cJSON_IsString(ip_domain) && !cJSON_IsNull(ip_domain)) { + ogs_error("OpenAPI_pcf_for_pdu_session_info_parseFromJSON() failed [ip_domain]"); + goto end; + } + } + + ipv6_prefixes = cJSON_GetObjectItemCaseSensitive(pcf_for_pdu_session_infoJSON, "ipv6Prefixes"); + if (ipv6_prefixes) { + cJSON *ipv6_prefixes_local = NULL; + if (!cJSON_IsArray(ipv6_prefixes)) { + ogs_error("OpenAPI_pcf_for_pdu_session_info_parseFromJSON() failed [ipv6_prefixes]"); + goto end; + } + + ipv6_prefixesList = OpenAPI_list_create(); + + cJSON_ArrayForEach(ipv6_prefixes_local, ipv6_prefixes) { + double *localDouble = NULL; + int *localInt = NULL; + if (!cJSON_IsString(ipv6_prefixes_local)) { + ogs_error("OpenAPI_pcf_for_pdu_session_info_parseFromJSON() failed [ipv6_prefixes]"); + goto end; + } + OpenAPI_list_add(ipv6_prefixesList, ogs_strdup(ipv6_prefixes_local->valuestring)); + } + } + + mac_addrs = cJSON_GetObjectItemCaseSensitive(pcf_for_pdu_session_infoJSON, "macAddrs"); + if (mac_addrs) { + cJSON *mac_addrs_local = NULL; + if (!cJSON_IsArray(mac_addrs)) { + ogs_error("OpenAPI_pcf_for_pdu_session_info_parseFromJSON() failed [mac_addrs]"); + goto end; + } + + mac_addrsList = OpenAPI_list_create(); + + cJSON_ArrayForEach(mac_addrs_local, mac_addrs) { + double *localDouble = NULL; + int *localInt = NULL; + if (!cJSON_IsString(mac_addrs_local)) { + ogs_error("OpenAPI_pcf_for_pdu_session_info_parseFromJSON() failed [mac_addrs]"); + goto end; + } + OpenAPI_list_add(mac_addrsList, ogs_strdup(mac_addrs_local->valuestring)); + } + } + + pcf_id = cJSON_GetObjectItemCaseSensitive(pcf_for_pdu_session_infoJSON, "pcfId"); + if (pcf_id) { + if (!cJSON_IsString(pcf_id) && !cJSON_IsNull(pcf_id)) { + ogs_error("OpenAPI_pcf_for_pdu_session_info_parseFromJSON() failed [pcf_id]"); + goto end; + } + } + + pcf_set_id = cJSON_GetObjectItemCaseSensitive(pcf_for_pdu_session_infoJSON, "pcfSetId"); + if (pcf_set_id) { + if (!cJSON_IsString(pcf_set_id) && !cJSON_IsNull(pcf_set_id)) { + ogs_error("OpenAPI_pcf_for_pdu_session_info_parseFromJSON() failed [pcf_set_id]"); + goto end; + } + } + + bind_level = cJSON_GetObjectItemCaseSensitive(pcf_for_pdu_session_infoJSON, "bindLevel"); + if (bind_level) { + if (!cJSON_IsString(bind_level)) { + ogs_error("OpenAPI_pcf_for_pdu_session_info_parseFromJSON() failed [bind_level]"); + goto end; + } + bind_levelVariable = OpenAPI_binding_level_FromString(bind_level->valuestring); + } + + pcf_for_pdu_session_info_local_var = OpenAPI_pcf_for_pdu_session_info_create ( + ogs_strdup(dnn->valuestring), + snssai_local_nonprim, + pcf_fqdn && !cJSON_IsNull(pcf_fqdn) ? ogs_strdup(pcf_fqdn->valuestring) : NULL, + pcf_ip_end_points ? pcf_ip_end_pointsList : NULL, + ipv4_addr && !cJSON_IsNull(ipv4_addr) ? ogs_strdup(ipv4_addr->valuestring) : NULL, + ip_domain && !cJSON_IsNull(ip_domain) ? ogs_strdup(ip_domain->valuestring) : NULL, + ipv6_prefixes ? ipv6_prefixesList : NULL, + mac_addrs ? mac_addrsList : 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, + bind_level ? bind_levelVariable : 0 + ); + + return pcf_for_pdu_session_info_local_var; +end: + if (snssai_local_nonprim) { + OpenAPI_snssai_free(snssai_local_nonprim); + snssai_local_nonprim = 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 (ipv6_prefixesList) { + OpenAPI_list_for_each(ipv6_prefixesList, node) { + ogs_free(node->data); + } + OpenAPI_list_free(ipv6_prefixesList); + ipv6_prefixesList = NULL; + } + if (mac_addrsList) { + OpenAPI_list_for_each(mac_addrsList, node) { + ogs_free(node->data); + } + OpenAPI_list_free(mac_addrsList); + mac_addrsList = NULL; + } + return NULL; +} + +OpenAPI_pcf_for_pdu_session_info_t *OpenAPI_pcf_for_pdu_session_info_copy(OpenAPI_pcf_for_pdu_session_info_t *dst, OpenAPI_pcf_for_pdu_session_info_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_pcf_for_pdu_session_info_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_pcf_for_pdu_session_info_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_pcf_for_pdu_session_info_free(dst); + dst = OpenAPI_pcf_for_pdu_session_info_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/pcf_for_pdu_session_info.h b/lib/sbi/openapi/model/pcf_for_pdu_session_info.h new file mode 100644 index 000000000..4a0dabe60 --- /dev/null +++ b/lib/sbi/openapi/model/pcf_for_pdu_session_info.h @@ -0,0 +1,61 @@ +/* + * pcf_for_pdu_session_info.h + * + * Contains the informaiton of the PCF for a PDU session. + */ + +#ifndef _OpenAPI_pcf_for_pdu_session_info_H_ +#define _OpenAPI_pcf_for_pdu_session_info_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "binding_level.h" +#include "ip_end_point.h" +#include "snssai.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_pcf_for_pdu_session_info_s OpenAPI_pcf_for_pdu_session_info_t; +typedef struct OpenAPI_pcf_for_pdu_session_info_s { + char *dnn; + struct OpenAPI_snssai_s *snssai; + char *pcf_fqdn; + OpenAPI_list_t *pcf_ip_end_points; + char *ipv4_addr; + char *ip_domain; + OpenAPI_list_t *ipv6_prefixes; + OpenAPI_list_t *mac_addrs; + char *pcf_id; + char *pcf_set_id; + OpenAPI_binding_level_e bind_level; +} OpenAPI_pcf_for_pdu_session_info_t; + +OpenAPI_pcf_for_pdu_session_info_t *OpenAPI_pcf_for_pdu_session_info_create( + char *dnn, + OpenAPI_snssai_t *snssai, + char *pcf_fqdn, + OpenAPI_list_t *pcf_ip_end_points, + char *ipv4_addr, + char *ip_domain, + OpenAPI_list_t *ipv6_prefixes, + OpenAPI_list_t *mac_addrs, + char *pcf_id, + char *pcf_set_id, + OpenAPI_binding_level_e bind_level +); +void OpenAPI_pcf_for_pdu_session_info_free(OpenAPI_pcf_for_pdu_session_info_t *pcf_for_pdu_session_info); +OpenAPI_pcf_for_pdu_session_info_t *OpenAPI_pcf_for_pdu_session_info_parseFromJSON(cJSON *pcf_for_pdu_session_infoJSON); +cJSON *OpenAPI_pcf_for_pdu_session_info_convertToJSON(OpenAPI_pcf_for_pdu_session_info_t *pcf_for_pdu_session_info); +OpenAPI_pcf_for_pdu_session_info_t *OpenAPI_pcf_for_pdu_session_info_copy(OpenAPI_pcf_for_pdu_session_info_t *dst, OpenAPI_pcf_for_pdu_session_info_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_pcf_for_pdu_session_info_H_ */ + diff --git a/lib/sbi/openapi/model/pcf_for_ue_binding.c b/lib/sbi/openapi/model/pcf_for_ue_binding.c new file mode 100644 index 000000000..f64d8a9e5 --- /dev/null +++ b/lib/sbi/openapi/model/pcf_for_ue_binding.c @@ -0,0 +1,310 @@ + +#include +#include +#include +#include "pcf_for_ue_binding.h" + +OpenAPI_pcf_for_ue_binding_t *OpenAPI_pcf_for_ue_binding_create( + char *supi, + char *gpsi, + char *pcf_for_ue_fqdn, + OpenAPI_list_t *pcf_for_ue_ip_end_points, + char *pcf_id, + char *pcf_set_id, + OpenAPI_binding_level_e bind_level, + char *supp_feat +) +{ + OpenAPI_pcf_for_ue_binding_t *pcf_for_ue_binding_local_var = ogs_malloc(sizeof(OpenAPI_pcf_for_ue_binding_t)); + ogs_assert(pcf_for_ue_binding_local_var); + + pcf_for_ue_binding_local_var->supi = supi; + pcf_for_ue_binding_local_var->gpsi = gpsi; + pcf_for_ue_binding_local_var->pcf_for_ue_fqdn = pcf_for_ue_fqdn; + pcf_for_ue_binding_local_var->pcf_for_ue_ip_end_points = pcf_for_ue_ip_end_points; + pcf_for_ue_binding_local_var->pcf_id = pcf_id; + pcf_for_ue_binding_local_var->pcf_set_id = pcf_set_id; + pcf_for_ue_binding_local_var->bind_level = bind_level; + pcf_for_ue_binding_local_var->supp_feat = supp_feat; + + return pcf_for_ue_binding_local_var; +} + +void OpenAPI_pcf_for_ue_binding_free(OpenAPI_pcf_for_ue_binding_t *pcf_for_ue_binding) +{ + OpenAPI_lnode_t *node = NULL; + + if (NULL == pcf_for_ue_binding) { + return; + } + if (pcf_for_ue_binding->supi) { + ogs_free(pcf_for_ue_binding->supi); + pcf_for_ue_binding->supi = NULL; + } + if (pcf_for_ue_binding->gpsi) { + ogs_free(pcf_for_ue_binding->gpsi); + pcf_for_ue_binding->gpsi = NULL; + } + if (pcf_for_ue_binding->pcf_for_ue_fqdn) { + ogs_free(pcf_for_ue_binding->pcf_for_ue_fqdn); + pcf_for_ue_binding->pcf_for_ue_fqdn = NULL; + } + if (pcf_for_ue_binding->pcf_for_ue_ip_end_points) { + OpenAPI_list_for_each(pcf_for_ue_binding->pcf_for_ue_ip_end_points, node) { + OpenAPI_ip_end_point_free(node->data); + } + OpenAPI_list_free(pcf_for_ue_binding->pcf_for_ue_ip_end_points); + pcf_for_ue_binding->pcf_for_ue_ip_end_points = NULL; + } + if (pcf_for_ue_binding->pcf_id) { + ogs_free(pcf_for_ue_binding->pcf_id); + pcf_for_ue_binding->pcf_id = NULL; + } + if (pcf_for_ue_binding->pcf_set_id) { + ogs_free(pcf_for_ue_binding->pcf_set_id); + pcf_for_ue_binding->pcf_set_id = NULL; + } + if (pcf_for_ue_binding->supp_feat) { + ogs_free(pcf_for_ue_binding->supp_feat); + pcf_for_ue_binding->supp_feat = NULL; + } + ogs_free(pcf_for_ue_binding); +} + +cJSON *OpenAPI_pcf_for_ue_binding_convertToJSON(OpenAPI_pcf_for_ue_binding_t *pcf_for_ue_binding) +{ + cJSON *item = NULL; + OpenAPI_lnode_t *node = NULL; + + if (pcf_for_ue_binding == NULL) { + ogs_error("OpenAPI_pcf_for_ue_binding_convertToJSON() failed [PcfForUeBinding]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (!pcf_for_ue_binding->supi) { + ogs_error("OpenAPI_pcf_for_ue_binding_convertToJSON() failed [supi]"); + return NULL; + } + if (cJSON_AddStringToObject(item, "supi", pcf_for_ue_binding->supi) == NULL) { + ogs_error("OpenAPI_pcf_for_ue_binding_convertToJSON() failed [supi]"); + goto end; + } + + if (pcf_for_ue_binding->gpsi) { + if (cJSON_AddStringToObject(item, "gpsi", pcf_for_ue_binding->gpsi) == NULL) { + ogs_error("OpenAPI_pcf_for_ue_binding_convertToJSON() failed [gpsi]"); + goto end; + } + } + + if (pcf_for_ue_binding->pcf_for_ue_fqdn) { + if (cJSON_AddStringToObject(item, "pcfForUeFqdn", pcf_for_ue_binding->pcf_for_ue_fqdn) == NULL) { + ogs_error("OpenAPI_pcf_for_ue_binding_convertToJSON() failed [pcf_for_ue_fqdn]"); + goto end; + } + } + + if (pcf_for_ue_binding->pcf_for_ue_ip_end_points) { + cJSON *pcf_for_ue_ip_end_pointsList = cJSON_AddArrayToObject(item, "pcfForUeIpEndPoints"); + if (pcf_for_ue_ip_end_pointsList == NULL) { + ogs_error("OpenAPI_pcf_for_ue_binding_convertToJSON() failed [pcf_for_ue_ip_end_points]"); + goto end; + } + OpenAPI_list_for_each(pcf_for_ue_binding->pcf_for_ue_ip_end_points, node) { + cJSON *itemLocal = OpenAPI_ip_end_point_convertToJSON(node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_pcf_for_ue_binding_convertToJSON() failed [pcf_for_ue_ip_end_points]"); + goto end; + } + cJSON_AddItemToArray(pcf_for_ue_ip_end_pointsList, itemLocal); + } + } + + if (pcf_for_ue_binding->pcf_id) { + if (cJSON_AddStringToObject(item, "pcfId", pcf_for_ue_binding->pcf_id) == NULL) { + ogs_error("OpenAPI_pcf_for_ue_binding_convertToJSON() failed [pcf_id]"); + goto end; + } + } + + if (pcf_for_ue_binding->pcf_set_id) { + if (cJSON_AddStringToObject(item, "pcfSetId", pcf_for_ue_binding->pcf_set_id) == NULL) { + ogs_error("OpenAPI_pcf_for_ue_binding_convertToJSON() failed [pcf_set_id]"); + goto end; + } + } + + if (pcf_for_ue_binding->bind_level != OpenAPI_binding_level_NULL) { + if (cJSON_AddStringToObject(item, "bindLevel", OpenAPI_binding_level_ToString(pcf_for_ue_binding->bind_level)) == NULL) { + ogs_error("OpenAPI_pcf_for_ue_binding_convertToJSON() failed [bind_level]"); + goto end; + } + } + + if (pcf_for_ue_binding->supp_feat) { + if (cJSON_AddStringToObject(item, "suppFeat", pcf_for_ue_binding->supp_feat) == NULL) { + ogs_error("OpenAPI_pcf_for_ue_binding_convertToJSON() failed [supp_feat]"); + goto end; + } + } + +end: + return item; +} + +OpenAPI_pcf_for_ue_binding_t *OpenAPI_pcf_for_ue_binding_parseFromJSON(cJSON *pcf_for_ue_bindingJSON) +{ + OpenAPI_pcf_for_ue_binding_t *pcf_for_ue_binding_local_var = NULL; + OpenAPI_lnode_t *node = NULL; + cJSON *supi = NULL; + cJSON *gpsi = NULL; + cJSON *pcf_for_ue_fqdn = NULL; + cJSON *pcf_for_ue_ip_end_points = NULL; + OpenAPI_list_t *pcf_for_ue_ip_end_pointsList = NULL; + cJSON *pcf_id = NULL; + cJSON *pcf_set_id = NULL; + cJSON *bind_level = NULL; + OpenAPI_binding_level_e bind_levelVariable = 0; + cJSON *supp_feat = NULL; + supi = cJSON_GetObjectItemCaseSensitive(pcf_for_ue_bindingJSON, "supi"); + if (!supi) { + ogs_error("OpenAPI_pcf_for_ue_binding_parseFromJSON() failed [supi]"); + goto end; + } + if (!cJSON_IsString(supi)) { + ogs_error("OpenAPI_pcf_for_ue_binding_parseFromJSON() failed [supi]"); + goto end; + } + + gpsi = cJSON_GetObjectItemCaseSensitive(pcf_for_ue_bindingJSON, "gpsi"); + if (gpsi) { + if (!cJSON_IsString(gpsi) && !cJSON_IsNull(gpsi)) { + ogs_error("OpenAPI_pcf_for_ue_binding_parseFromJSON() failed [gpsi]"); + goto end; + } + } + + pcf_for_ue_fqdn = cJSON_GetObjectItemCaseSensitive(pcf_for_ue_bindingJSON, "pcfForUeFqdn"); + if (pcf_for_ue_fqdn) { + if (!cJSON_IsString(pcf_for_ue_fqdn) && !cJSON_IsNull(pcf_for_ue_fqdn)) { + ogs_error("OpenAPI_pcf_for_ue_binding_parseFromJSON() failed [pcf_for_ue_fqdn]"); + goto end; + } + } + + pcf_for_ue_ip_end_points = cJSON_GetObjectItemCaseSensitive(pcf_for_ue_bindingJSON, "pcfForUeIpEndPoints"); + if (pcf_for_ue_ip_end_points) { + cJSON *pcf_for_ue_ip_end_points_local = NULL; + if (!cJSON_IsArray(pcf_for_ue_ip_end_points)) { + ogs_error("OpenAPI_pcf_for_ue_binding_parseFromJSON() failed [pcf_for_ue_ip_end_points]"); + goto end; + } + + pcf_for_ue_ip_end_pointsList = OpenAPI_list_create(); + + cJSON_ArrayForEach(pcf_for_ue_ip_end_points_local, pcf_for_ue_ip_end_points) { + if (!cJSON_IsObject(pcf_for_ue_ip_end_points_local)) { + ogs_error("OpenAPI_pcf_for_ue_binding_parseFromJSON() failed [pcf_for_ue_ip_end_points]"); + goto end; + } + OpenAPI_ip_end_point_t *pcf_for_ue_ip_end_pointsItem = OpenAPI_ip_end_point_parseFromJSON(pcf_for_ue_ip_end_points_local); + if (!pcf_for_ue_ip_end_pointsItem) { + ogs_error("No pcf_for_ue_ip_end_pointsItem"); + OpenAPI_list_free(pcf_for_ue_ip_end_pointsList); + goto end; + } + OpenAPI_list_add(pcf_for_ue_ip_end_pointsList, pcf_for_ue_ip_end_pointsItem); + } + } + + pcf_id = cJSON_GetObjectItemCaseSensitive(pcf_for_ue_bindingJSON, "pcfId"); + if (pcf_id) { + if (!cJSON_IsString(pcf_id) && !cJSON_IsNull(pcf_id)) { + ogs_error("OpenAPI_pcf_for_ue_binding_parseFromJSON() failed [pcf_id]"); + goto end; + } + } + + pcf_set_id = cJSON_GetObjectItemCaseSensitive(pcf_for_ue_bindingJSON, "pcfSetId"); + if (pcf_set_id) { + if (!cJSON_IsString(pcf_set_id) && !cJSON_IsNull(pcf_set_id)) { + ogs_error("OpenAPI_pcf_for_ue_binding_parseFromJSON() failed [pcf_set_id]"); + goto end; + } + } + + bind_level = cJSON_GetObjectItemCaseSensitive(pcf_for_ue_bindingJSON, "bindLevel"); + if (bind_level) { + if (!cJSON_IsString(bind_level)) { + ogs_error("OpenAPI_pcf_for_ue_binding_parseFromJSON() failed [bind_level]"); + goto end; + } + bind_levelVariable = OpenAPI_binding_level_FromString(bind_level->valuestring); + } + + supp_feat = cJSON_GetObjectItemCaseSensitive(pcf_for_ue_bindingJSON, "suppFeat"); + if (supp_feat) { + if (!cJSON_IsString(supp_feat) && !cJSON_IsNull(supp_feat)) { + ogs_error("OpenAPI_pcf_for_ue_binding_parseFromJSON() failed [supp_feat]"); + goto end; + } + } + + pcf_for_ue_binding_local_var = OpenAPI_pcf_for_ue_binding_create ( + ogs_strdup(supi->valuestring), + gpsi && !cJSON_IsNull(gpsi) ? ogs_strdup(gpsi->valuestring) : NULL, + pcf_for_ue_fqdn && !cJSON_IsNull(pcf_for_ue_fqdn) ? ogs_strdup(pcf_for_ue_fqdn->valuestring) : NULL, + pcf_for_ue_ip_end_points ? pcf_for_ue_ip_end_pointsList : 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, + bind_level ? bind_levelVariable : 0, + supp_feat && !cJSON_IsNull(supp_feat) ? ogs_strdup(supp_feat->valuestring) : NULL + ); + + return pcf_for_ue_binding_local_var; +end: + if (pcf_for_ue_ip_end_pointsList) { + OpenAPI_list_for_each(pcf_for_ue_ip_end_pointsList, node) { + OpenAPI_ip_end_point_free(node->data); + } + OpenAPI_list_free(pcf_for_ue_ip_end_pointsList); + pcf_for_ue_ip_end_pointsList = NULL; + } + return NULL; +} + +OpenAPI_pcf_for_ue_binding_t *OpenAPI_pcf_for_ue_binding_copy(OpenAPI_pcf_for_ue_binding_t *dst, OpenAPI_pcf_for_ue_binding_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_pcf_for_ue_binding_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_pcf_for_ue_binding_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_pcf_for_ue_binding_free(dst); + dst = OpenAPI_pcf_for_ue_binding_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/pcf_for_ue_binding.h b/lib/sbi/openapi/model/pcf_for_ue_binding.h new file mode 100644 index 000000000..ee1655331 --- /dev/null +++ b/lib/sbi/openapi/model/pcf_for_ue_binding.h @@ -0,0 +1,54 @@ +/* + * pcf_for_ue_binding.h + * + * Identifies an Individual PCF for a UE binding. + */ + +#ifndef _OpenAPI_pcf_for_ue_binding_H_ +#define _OpenAPI_pcf_for_ue_binding_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "binding_level.h" +#include "ip_end_point.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_pcf_for_ue_binding_s OpenAPI_pcf_for_ue_binding_t; +typedef struct OpenAPI_pcf_for_ue_binding_s { + char *supi; + char *gpsi; + char *pcf_for_ue_fqdn; + OpenAPI_list_t *pcf_for_ue_ip_end_points; + char *pcf_id; + char *pcf_set_id; + OpenAPI_binding_level_e bind_level; + char *supp_feat; +} OpenAPI_pcf_for_ue_binding_t; + +OpenAPI_pcf_for_ue_binding_t *OpenAPI_pcf_for_ue_binding_create( + char *supi, + char *gpsi, + char *pcf_for_ue_fqdn, + OpenAPI_list_t *pcf_for_ue_ip_end_points, + char *pcf_id, + char *pcf_set_id, + OpenAPI_binding_level_e bind_level, + char *supp_feat +); +void OpenAPI_pcf_for_ue_binding_free(OpenAPI_pcf_for_ue_binding_t *pcf_for_ue_binding); +OpenAPI_pcf_for_ue_binding_t *OpenAPI_pcf_for_ue_binding_parseFromJSON(cJSON *pcf_for_ue_bindingJSON); +cJSON *OpenAPI_pcf_for_ue_binding_convertToJSON(OpenAPI_pcf_for_ue_binding_t *pcf_for_ue_binding); +OpenAPI_pcf_for_ue_binding_t *OpenAPI_pcf_for_ue_binding_copy(OpenAPI_pcf_for_ue_binding_t *dst, OpenAPI_pcf_for_ue_binding_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_pcf_for_ue_binding_H_ */ + diff --git a/lib/sbi/openapi/model/pcf_for_ue_binding_patch.c b/lib/sbi/openapi/model/pcf_for_ue_binding_patch.c new file mode 100644 index 000000000..0f83094b7 --- /dev/null +++ b/lib/sbi/openapi/model/pcf_for_ue_binding_patch.c @@ -0,0 +1,193 @@ + +#include +#include +#include +#include "pcf_for_ue_binding_patch.h" + +OpenAPI_pcf_for_ue_binding_patch_t *OpenAPI_pcf_for_ue_binding_patch_create( + char *pcf_for_ue_fqdn, + OpenAPI_list_t *pcf_for_ue_ip_end_points, + char *pcf_id +) +{ + OpenAPI_pcf_for_ue_binding_patch_t *pcf_for_ue_binding_patch_local_var = ogs_malloc(sizeof(OpenAPI_pcf_for_ue_binding_patch_t)); + ogs_assert(pcf_for_ue_binding_patch_local_var); + + pcf_for_ue_binding_patch_local_var->pcf_for_ue_fqdn = pcf_for_ue_fqdn; + pcf_for_ue_binding_patch_local_var->pcf_for_ue_ip_end_points = pcf_for_ue_ip_end_points; + pcf_for_ue_binding_patch_local_var->pcf_id = pcf_id; + + return pcf_for_ue_binding_patch_local_var; +} + +void OpenAPI_pcf_for_ue_binding_patch_free(OpenAPI_pcf_for_ue_binding_patch_t *pcf_for_ue_binding_patch) +{ + OpenAPI_lnode_t *node = NULL; + + if (NULL == pcf_for_ue_binding_patch) { + return; + } + if (pcf_for_ue_binding_patch->pcf_for_ue_fqdn) { + ogs_free(pcf_for_ue_binding_patch->pcf_for_ue_fqdn); + pcf_for_ue_binding_patch->pcf_for_ue_fqdn = NULL; + } + if (pcf_for_ue_binding_patch->pcf_for_ue_ip_end_points) { + OpenAPI_list_for_each(pcf_for_ue_binding_patch->pcf_for_ue_ip_end_points, node) { + OpenAPI_ip_end_point_free(node->data); + } + OpenAPI_list_free(pcf_for_ue_binding_patch->pcf_for_ue_ip_end_points); + pcf_for_ue_binding_patch->pcf_for_ue_ip_end_points = NULL; + } + if (pcf_for_ue_binding_patch->pcf_id) { + ogs_free(pcf_for_ue_binding_patch->pcf_id); + pcf_for_ue_binding_patch->pcf_id = NULL; + } + ogs_free(pcf_for_ue_binding_patch); +} + +cJSON *OpenAPI_pcf_for_ue_binding_patch_convertToJSON(OpenAPI_pcf_for_ue_binding_patch_t *pcf_for_ue_binding_patch) +{ + cJSON *item = NULL; + OpenAPI_lnode_t *node = NULL; + + if (pcf_for_ue_binding_patch == NULL) { + ogs_error("OpenAPI_pcf_for_ue_binding_patch_convertToJSON() failed [PcfForUeBindingPatch]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (pcf_for_ue_binding_patch->pcf_for_ue_fqdn) { + if (cJSON_AddStringToObject(item, "pcfForUeFqdn", pcf_for_ue_binding_patch->pcf_for_ue_fqdn) == NULL) { + ogs_error("OpenAPI_pcf_for_ue_binding_patch_convertToJSON() failed [pcf_for_ue_fqdn]"); + goto end; + } + } + + if (pcf_for_ue_binding_patch->pcf_for_ue_ip_end_points) { + cJSON *pcf_for_ue_ip_end_pointsList = cJSON_AddArrayToObject(item, "pcfForUeIpEndPoints"); + if (pcf_for_ue_ip_end_pointsList == NULL) { + ogs_error("OpenAPI_pcf_for_ue_binding_patch_convertToJSON() failed [pcf_for_ue_ip_end_points]"); + goto end; + } + OpenAPI_list_for_each(pcf_for_ue_binding_patch->pcf_for_ue_ip_end_points, node) { + cJSON *itemLocal = OpenAPI_ip_end_point_convertToJSON(node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_pcf_for_ue_binding_patch_convertToJSON() failed [pcf_for_ue_ip_end_points]"); + goto end; + } + cJSON_AddItemToArray(pcf_for_ue_ip_end_pointsList, itemLocal); + } + } + + if (pcf_for_ue_binding_patch->pcf_id) { + if (cJSON_AddStringToObject(item, "pcfId", pcf_for_ue_binding_patch->pcf_id) == NULL) { + ogs_error("OpenAPI_pcf_for_ue_binding_patch_convertToJSON() failed [pcf_id]"); + goto end; + } + } + +end: + return item; +} + +OpenAPI_pcf_for_ue_binding_patch_t *OpenAPI_pcf_for_ue_binding_patch_parseFromJSON(cJSON *pcf_for_ue_binding_patchJSON) +{ + OpenAPI_pcf_for_ue_binding_patch_t *pcf_for_ue_binding_patch_local_var = NULL; + OpenAPI_lnode_t *node = NULL; + cJSON *pcf_for_ue_fqdn = NULL; + cJSON *pcf_for_ue_ip_end_points = NULL; + OpenAPI_list_t *pcf_for_ue_ip_end_pointsList = NULL; + cJSON *pcf_id = NULL; + pcf_for_ue_fqdn = cJSON_GetObjectItemCaseSensitive(pcf_for_ue_binding_patchJSON, "pcfForUeFqdn"); + if (pcf_for_ue_fqdn) { + if (!cJSON_IsString(pcf_for_ue_fqdn) && !cJSON_IsNull(pcf_for_ue_fqdn)) { + ogs_error("OpenAPI_pcf_for_ue_binding_patch_parseFromJSON() failed [pcf_for_ue_fqdn]"); + goto end; + } + } + + pcf_for_ue_ip_end_points = cJSON_GetObjectItemCaseSensitive(pcf_for_ue_binding_patchJSON, "pcfForUeIpEndPoints"); + if (pcf_for_ue_ip_end_points) { + cJSON *pcf_for_ue_ip_end_points_local = NULL; + if (!cJSON_IsArray(pcf_for_ue_ip_end_points)) { + ogs_error("OpenAPI_pcf_for_ue_binding_patch_parseFromJSON() failed [pcf_for_ue_ip_end_points]"); + goto end; + } + + pcf_for_ue_ip_end_pointsList = OpenAPI_list_create(); + + cJSON_ArrayForEach(pcf_for_ue_ip_end_points_local, pcf_for_ue_ip_end_points) { + if (!cJSON_IsObject(pcf_for_ue_ip_end_points_local)) { + ogs_error("OpenAPI_pcf_for_ue_binding_patch_parseFromJSON() failed [pcf_for_ue_ip_end_points]"); + goto end; + } + OpenAPI_ip_end_point_t *pcf_for_ue_ip_end_pointsItem = OpenAPI_ip_end_point_parseFromJSON(pcf_for_ue_ip_end_points_local); + if (!pcf_for_ue_ip_end_pointsItem) { + ogs_error("No pcf_for_ue_ip_end_pointsItem"); + OpenAPI_list_free(pcf_for_ue_ip_end_pointsList); + goto end; + } + OpenAPI_list_add(pcf_for_ue_ip_end_pointsList, pcf_for_ue_ip_end_pointsItem); + } + } + + pcf_id = cJSON_GetObjectItemCaseSensitive(pcf_for_ue_binding_patchJSON, "pcfId"); + if (pcf_id) { + if (!cJSON_IsString(pcf_id) && !cJSON_IsNull(pcf_id)) { + ogs_error("OpenAPI_pcf_for_ue_binding_patch_parseFromJSON() failed [pcf_id]"); + goto end; + } + } + + pcf_for_ue_binding_patch_local_var = OpenAPI_pcf_for_ue_binding_patch_create ( + pcf_for_ue_fqdn && !cJSON_IsNull(pcf_for_ue_fqdn) ? ogs_strdup(pcf_for_ue_fqdn->valuestring) : NULL, + pcf_for_ue_ip_end_points ? pcf_for_ue_ip_end_pointsList : NULL, + pcf_id && !cJSON_IsNull(pcf_id) ? ogs_strdup(pcf_id->valuestring) : NULL + ); + + return pcf_for_ue_binding_patch_local_var; +end: + if (pcf_for_ue_ip_end_pointsList) { + OpenAPI_list_for_each(pcf_for_ue_ip_end_pointsList, node) { + OpenAPI_ip_end_point_free(node->data); + } + OpenAPI_list_free(pcf_for_ue_ip_end_pointsList); + pcf_for_ue_ip_end_pointsList = NULL; + } + return NULL; +} + +OpenAPI_pcf_for_ue_binding_patch_t *OpenAPI_pcf_for_ue_binding_patch_copy(OpenAPI_pcf_for_ue_binding_patch_t *dst, OpenAPI_pcf_for_ue_binding_patch_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_pcf_for_ue_binding_patch_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_pcf_for_ue_binding_patch_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_pcf_for_ue_binding_patch_free(dst); + dst = OpenAPI_pcf_for_ue_binding_patch_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/pcf_for_ue_binding_patch.h b/lib/sbi/openapi/model/pcf_for_ue_binding_patch.h new file mode 100644 index 000000000..c720d8638 --- /dev/null +++ b/lib/sbi/openapi/model/pcf_for_ue_binding_patch.h @@ -0,0 +1,43 @@ +/* + * pcf_for_ue_binding_patch.h + * + * Identifies the updates of an Individual PCF for a UE binding. + */ + +#ifndef _OpenAPI_pcf_for_ue_binding_patch_H_ +#define _OpenAPI_pcf_for_ue_binding_patch_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "ip_end_point.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_pcf_for_ue_binding_patch_s OpenAPI_pcf_for_ue_binding_patch_t; +typedef struct OpenAPI_pcf_for_ue_binding_patch_s { + char *pcf_for_ue_fqdn; + OpenAPI_list_t *pcf_for_ue_ip_end_points; + char *pcf_id; +} OpenAPI_pcf_for_ue_binding_patch_t; + +OpenAPI_pcf_for_ue_binding_patch_t *OpenAPI_pcf_for_ue_binding_patch_create( + char *pcf_for_ue_fqdn, + OpenAPI_list_t *pcf_for_ue_ip_end_points, + char *pcf_id +); +void OpenAPI_pcf_for_ue_binding_patch_free(OpenAPI_pcf_for_ue_binding_patch_t *pcf_for_ue_binding_patch); +OpenAPI_pcf_for_ue_binding_patch_t *OpenAPI_pcf_for_ue_binding_patch_parseFromJSON(cJSON *pcf_for_ue_binding_patchJSON); +cJSON *OpenAPI_pcf_for_ue_binding_patch_convertToJSON(OpenAPI_pcf_for_ue_binding_patch_t *pcf_for_ue_binding_patch); +OpenAPI_pcf_for_ue_binding_patch_t *OpenAPI_pcf_for_ue_binding_patch_copy(OpenAPI_pcf_for_ue_binding_patch_t *dst, OpenAPI_pcf_for_ue_binding_patch_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_pcf_for_ue_binding_patch_H_ */ + diff --git a/lib/sbi/openapi/model/pcf_for_ue_info.c b/lib/sbi/openapi/model/pcf_for_ue_info.c new file mode 100644 index 000000000..f5e5c73ca --- /dev/null +++ b/lib/sbi/openapi/model/pcf_for_ue_info.c @@ -0,0 +1,237 @@ + +#include +#include +#include +#include "pcf_for_ue_info.h" + +OpenAPI_pcf_for_ue_info_t *OpenAPI_pcf_for_ue_info_create( + char *pcf_fqdn, + OpenAPI_list_t *pcf_ip_end_points, + char *pcf_id, + char *pcf_set_id, + OpenAPI_binding_level_e bind_level +) +{ + OpenAPI_pcf_for_ue_info_t *pcf_for_ue_info_local_var = ogs_malloc(sizeof(OpenAPI_pcf_for_ue_info_t)); + ogs_assert(pcf_for_ue_info_local_var); + + pcf_for_ue_info_local_var->pcf_fqdn = pcf_fqdn; + pcf_for_ue_info_local_var->pcf_ip_end_points = pcf_ip_end_points; + pcf_for_ue_info_local_var->pcf_id = pcf_id; + pcf_for_ue_info_local_var->pcf_set_id = pcf_set_id; + pcf_for_ue_info_local_var->bind_level = bind_level; + + return pcf_for_ue_info_local_var; +} + +void OpenAPI_pcf_for_ue_info_free(OpenAPI_pcf_for_ue_info_t *pcf_for_ue_info) +{ + OpenAPI_lnode_t *node = NULL; + + if (NULL == pcf_for_ue_info) { + return; + } + if (pcf_for_ue_info->pcf_fqdn) { + ogs_free(pcf_for_ue_info->pcf_fqdn); + pcf_for_ue_info->pcf_fqdn = NULL; + } + if (pcf_for_ue_info->pcf_ip_end_points) { + OpenAPI_list_for_each(pcf_for_ue_info->pcf_ip_end_points, node) { + OpenAPI_ip_end_point_free(node->data); + } + OpenAPI_list_free(pcf_for_ue_info->pcf_ip_end_points); + pcf_for_ue_info->pcf_ip_end_points = NULL; + } + if (pcf_for_ue_info->pcf_id) { + ogs_free(pcf_for_ue_info->pcf_id); + pcf_for_ue_info->pcf_id = NULL; + } + if (pcf_for_ue_info->pcf_set_id) { + ogs_free(pcf_for_ue_info->pcf_set_id); + pcf_for_ue_info->pcf_set_id = NULL; + } + ogs_free(pcf_for_ue_info); +} + +cJSON *OpenAPI_pcf_for_ue_info_convertToJSON(OpenAPI_pcf_for_ue_info_t *pcf_for_ue_info) +{ + cJSON *item = NULL; + OpenAPI_lnode_t *node = NULL; + + if (pcf_for_ue_info == NULL) { + ogs_error("OpenAPI_pcf_for_ue_info_convertToJSON() failed [PcfForUeInfo]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (pcf_for_ue_info->pcf_fqdn) { + if (cJSON_AddStringToObject(item, "pcfFqdn", pcf_for_ue_info->pcf_fqdn) == NULL) { + ogs_error("OpenAPI_pcf_for_ue_info_convertToJSON() failed [pcf_fqdn]"); + goto end; + } + } + + if (pcf_for_ue_info->pcf_ip_end_points) { + cJSON *pcf_ip_end_pointsList = cJSON_AddArrayToObject(item, "pcfIpEndPoints"); + if (pcf_ip_end_pointsList == NULL) { + ogs_error("OpenAPI_pcf_for_ue_info_convertToJSON() failed [pcf_ip_end_points]"); + goto end; + } + OpenAPI_list_for_each(pcf_for_ue_info->pcf_ip_end_points, node) { + cJSON *itemLocal = OpenAPI_ip_end_point_convertToJSON(node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_pcf_for_ue_info_convertToJSON() failed [pcf_ip_end_points]"); + goto end; + } + cJSON_AddItemToArray(pcf_ip_end_pointsList, itemLocal); + } + } + + if (pcf_for_ue_info->pcf_id) { + if (cJSON_AddStringToObject(item, "pcfId", pcf_for_ue_info->pcf_id) == NULL) { + ogs_error("OpenAPI_pcf_for_ue_info_convertToJSON() failed [pcf_id]"); + goto end; + } + } + + if (pcf_for_ue_info->pcf_set_id) { + if (cJSON_AddStringToObject(item, "pcfSetId", pcf_for_ue_info->pcf_set_id) == NULL) { + ogs_error("OpenAPI_pcf_for_ue_info_convertToJSON() failed [pcf_set_id]"); + goto end; + } + } + + if (pcf_for_ue_info->bind_level != OpenAPI_binding_level_NULL) { + if (cJSON_AddStringToObject(item, "bindLevel", OpenAPI_binding_level_ToString(pcf_for_ue_info->bind_level)) == NULL) { + ogs_error("OpenAPI_pcf_for_ue_info_convertToJSON() failed [bind_level]"); + goto end; + } + } + +end: + return item; +} + +OpenAPI_pcf_for_ue_info_t *OpenAPI_pcf_for_ue_info_parseFromJSON(cJSON *pcf_for_ue_infoJSON) +{ + OpenAPI_pcf_for_ue_info_t *pcf_for_ue_info_local_var = NULL; + OpenAPI_lnode_t *node = NULL; + cJSON *pcf_fqdn = NULL; + cJSON *pcf_ip_end_points = NULL; + OpenAPI_list_t *pcf_ip_end_pointsList = NULL; + cJSON *pcf_id = NULL; + cJSON *pcf_set_id = NULL; + cJSON *bind_level = NULL; + OpenAPI_binding_level_e bind_levelVariable = 0; + pcf_fqdn = cJSON_GetObjectItemCaseSensitive(pcf_for_ue_infoJSON, "pcfFqdn"); + if (pcf_fqdn) { + if (!cJSON_IsString(pcf_fqdn) && !cJSON_IsNull(pcf_fqdn)) { + ogs_error("OpenAPI_pcf_for_ue_info_parseFromJSON() failed [pcf_fqdn]"); + goto end; + } + } + + pcf_ip_end_points = cJSON_GetObjectItemCaseSensitive(pcf_for_ue_infoJSON, "pcfIpEndPoints"); + if (pcf_ip_end_points) { + cJSON *pcf_ip_end_points_local = NULL; + if (!cJSON_IsArray(pcf_ip_end_points)) { + ogs_error("OpenAPI_pcf_for_ue_info_parseFromJSON() failed [pcf_ip_end_points]"); + 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_for_ue_info_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); + } + } + + pcf_id = cJSON_GetObjectItemCaseSensitive(pcf_for_ue_infoJSON, "pcfId"); + if (pcf_id) { + if (!cJSON_IsString(pcf_id) && !cJSON_IsNull(pcf_id)) { + ogs_error("OpenAPI_pcf_for_ue_info_parseFromJSON() failed [pcf_id]"); + goto end; + } + } + + pcf_set_id = cJSON_GetObjectItemCaseSensitive(pcf_for_ue_infoJSON, "pcfSetId"); + if (pcf_set_id) { + if (!cJSON_IsString(pcf_set_id) && !cJSON_IsNull(pcf_set_id)) { + ogs_error("OpenAPI_pcf_for_ue_info_parseFromJSON() failed [pcf_set_id]"); + goto end; + } + } + + bind_level = cJSON_GetObjectItemCaseSensitive(pcf_for_ue_infoJSON, "bindLevel"); + if (bind_level) { + if (!cJSON_IsString(bind_level)) { + ogs_error("OpenAPI_pcf_for_ue_info_parseFromJSON() failed [bind_level]"); + goto end; + } + bind_levelVariable = OpenAPI_binding_level_FromString(bind_level->valuestring); + } + + pcf_for_ue_info_local_var = OpenAPI_pcf_for_ue_info_create ( + pcf_fqdn && !cJSON_IsNull(pcf_fqdn) ? ogs_strdup(pcf_fqdn->valuestring) : NULL, + pcf_ip_end_points ? pcf_ip_end_pointsList : 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, + bind_level ? bind_levelVariable : 0 + ); + + return pcf_for_ue_info_local_var; +end: + 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; + } + return NULL; +} + +OpenAPI_pcf_for_ue_info_t *OpenAPI_pcf_for_ue_info_copy(OpenAPI_pcf_for_ue_info_t *dst, OpenAPI_pcf_for_ue_info_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_pcf_for_ue_info_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_pcf_for_ue_info_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_pcf_for_ue_info_free(dst); + dst = OpenAPI_pcf_for_ue_info_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/pcf_for_ue_info.h b/lib/sbi/openapi/model/pcf_for_ue_info.h new file mode 100644 index 000000000..e5006ecf4 --- /dev/null +++ b/lib/sbi/openapi/model/pcf_for_ue_info.h @@ -0,0 +1,48 @@ +/* + * pcf_for_ue_info.h + * + * Contains the information of the PCF for a UE. + */ + +#ifndef _OpenAPI_pcf_for_ue_info_H_ +#define _OpenAPI_pcf_for_ue_info_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "binding_level.h" +#include "ip_end_point.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_pcf_for_ue_info_s OpenAPI_pcf_for_ue_info_t; +typedef struct OpenAPI_pcf_for_ue_info_s { + char *pcf_fqdn; + OpenAPI_list_t *pcf_ip_end_points; + char *pcf_id; + char *pcf_set_id; + OpenAPI_binding_level_e bind_level; +} OpenAPI_pcf_for_ue_info_t; + +OpenAPI_pcf_for_ue_info_t *OpenAPI_pcf_for_ue_info_create( + char *pcf_fqdn, + OpenAPI_list_t *pcf_ip_end_points, + char *pcf_id, + char *pcf_set_id, + OpenAPI_binding_level_e bind_level +); +void OpenAPI_pcf_for_ue_info_free(OpenAPI_pcf_for_ue_info_t *pcf_for_ue_info); +OpenAPI_pcf_for_ue_info_t *OpenAPI_pcf_for_ue_info_parseFromJSON(cJSON *pcf_for_ue_infoJSON); +cJSON *OpenAPI_pcf_for_ue_info_convertToJSON(OpenAPI_pcf_for_ue_info_t *pcf_for_ue_info); +OpenAPI_pcf_for_ue_info_t *OpenAPI_pcf_for_ue_info_copy(OpenAPI_pcf_for_ue_info_t *dst, OpenAPI_pcf_for_ue_info_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_pcf_for_ue_info_H_ */ + diff --git a/lib/sbi/openapi/model/pcf_info.c b/lib/sbi/openapi/model/pcf_info.c index 3982586ba..1133fe909 100644 --- a/lib/sbi/openapi/model/pcf_info.c +++ b/lib/sbi/openapi/model/pcf_info.c @@ -12,7 +12,11 @@ OpenAPI_pcf_info_t *OpenAPI_pcf_info_create( char *rx_diam_host, char *rx_diam_realm, bool is_v2x_support_ind, - int v2x_support_ind + int v2x_support_ind, + bool is_prose_support_ind, + int prose_support_ind, + OpenAPI_pro_se_capability_t *prose_capability, + OpenAPI_v2x_capability_t *v2x_capability ) { OpenAPI_pcf_info_t *pcf_info_local_var = ogs_malloc(sizeof(OpenAPI_pcf_info_t)); @@ -26,6 +30,10 @@ OpenAPI_pcf_info_t *OpenAPI_pcf_info_create( pcf_info_local_var->rx_diam_realm = rx_diam_realm; pcf_info_local_var->is_v2x_support_ind = is_v2x_support_ind; pcf_info_local_var->v2x_support_ind = v2x_support_ind; + pcf_info_local_var->is_prose_support_ind = is_prose_support_ind; + pcf_info_local_var->prose_support_ind = prose_support_ind; + pcf_info_local_var->prose_capability = prose_capability; + pcf_info_local_var->v2x_capability = v2x_capability; return pcf_info_local_var; } @@ -70,6 +78,14 @@ void OpenAPI_pcf_info_free(OpenAPI_pcf_info_t *pcf_info) ogs_free(pcf_info->rx_diam_realm); pcf_info->rx_diam_realm = NULL; } + if (pcf_info->prose_capability) { + OpenAPI_pro_se_capability_free(pcf_info->prose_capability); + pcf_info->prose_capability = NULL; + } + if (pcf_info->v2x_capability) { + OpenAPI_v2x_capability_free(pcf_info->v2x_capability); + pcf_info->v2x_capability = NULL; + } ogs_free(pcf_info); } @@ -158,6 +174,39 @@ cJSON *OpenAPI_pcf_info_convertToJSON(OpenAPI_pcf_info_t *pcf_info) } } + if (pcf_info->is_prose_support_ind) { + if (cJSON_AddBoolToObject(item, "proseSupportInd", pcf_info->prose_support_ind) == NULL) { + ogs_error("OpenAPI_pcf_info_convertToJSON() failed [prose_support_ind]"); + goto end; + } + } + + if (pcf_info->prose_capability) { + cJSON *prose_capability_local_JSON = OpenAPI_pro_se_capability_convertToJSON(pcf_info->prose_capability); + if (prose_capability_local_JSON == NULL) { + ogs_error("OpenAPI_pcf_info_convertToJSON() failed [prose_capability]"); + goto end; + } + cJSON_AddItemToObject(item, "proseCapability", prose_capability_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_pcf_info_convertToJSON() failed [prose_capability]"); + goto end; + } + } + + if (pcf_info->v2x_capability) { + cJSON *v2x_capability_local_JSON = OpenAPI_v2x_capability_convertToJSON(pcf_info->v2x_capability); + if (v2x_capability_local_JSON == NULL) { + ogs_error("OpenAPI_pcf_info_convertToJSON() failed [v2x_capability]"); + goto end; + } + cJSON_AddItemToObject(item, "v2xCapability", v2x_capability_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_pcf_info_convertToJSON() failed [v2x_capability]"); + goto end; + } + } + end: return item; } @@ -176,6 +225,11 @@ OpenAPI_pcf_info_t *OpenAPI_pcf_info_parseFromJSON(cJSON *pcf_infoJSON) cJSON *rx_diam_host = NULL; cJSON *rx_diam_realm = NULL; cJSON *v2x_support_ind = NULL; + cJSON *prose_support_ind = NULL; + cJSON *prose_capability = NULL; + OpenAPI_pro_se_capability_t *prose_capability_local_nonprim = NULL; + cJSON *v2x_capability = NULL; + OpenAPI_v2x_capability_t *v2x_capability_local_nonprim = NULL; group_id = cJSON_GetObjectItemCaseSensitive(pcf_infoJSON, "groupId"); if (group_id) { if (!cJSON_IsString(group_id) && !cJSON_IsNull(group_id)) { @@ -279,6 +333,24 @@ OpenAPI_pcf_info_t *OpenAPI_pcf_info_parseFromJSON(cJSON *pcf_infoJSON) } } + prose_support_ind = cJSON_GetObjectItemCaseSensitive(pcf_infoJSON, "proseSupportInd"); + if (prose_support_ind) { + if (!cJSON_IsBool(prose_support_ind)) { + ogs_error("OpenAPI_pcf_info_parseFromJSON() failed [prose_support_ind]"); + goto end; + } + } + + prose_capability = cJSON_GetObjectItemCaseSensitive(pcf_infoJSON, "proseCapability"); + if (prose_capability) { + prose_capability_local_nonprim = OpenAPI_pro_se_capability_parseFromJSON(prose_capability); + } + + v2x_capability = cJSON_GetObjectItemCaseSensitive(pcf_infoJSON, "v2xCapability"); + if (v2x_capability) { + v2x_capability_local_nonprim = OpenAPI_v2x_capability_parseFromJSON(v2x_capability); + } + pcf_info_local_var = OpenAPI_pcf_info_create ( group_id && !cJSON_IsNull(group_id) ? ogs_strdup(group_id->valuestring) : NULL, dnn_list ? dnn_listList : NULL, @@ -287,7 +359,11 @@ OpenAPI_pcf_info_t *OpenAPI_pcf_info_parseFromJSON(cJSON *pcf_infoJSON) rx_diam_host && !cJSON_IsNull(rx_diam_host) ? ogs_strdup(rx_diam_host->valuestring) : NULL, rx_diam_realm && !cJSON_IsNull(rx_diam_realm) ? ogs_strdup(rx_diam_realm->valuestring) : NULL, v2x_support_ind ? true : false, - v2x_support_ind ? v2x_support_ind->valueint : 0 + v2x_support_ind ? v2x_support_ind->valueint : 0, + prose_support_ind ? true : false, + prose_support_ind ? prose_support_ind->valueint : 0, + prose_capability ? prose_capability_local_nonprim : NULL, + v2x_capability ? v2x_capability_local_nonprim : NULL ); return pcf_info_local_var; @@ -313,6 +389,14 @@ end: OpenAPI_list_free(gpsi_rangesList); gpsi_rangesList = NULL; } + if (prose_capability_local_nonprim) { + OpenAPI_pro_se_capability_free(prose_capability_local_nonprim); + prose_capability_local_nonprim = NULL; + } + if (v2x_capability_local_nonprim) { + OpenAPI_v2x_capability_free(v2x_capability_local_nonprim); + v2x_capability_local_nonprim = NULL; + } return NULL; } diff --git a/lib/sbi/openapi/model/pcf_info.h b/lib/sbi/openapi/model/pcf_info.h index 490af1e69..0fbf04f90 100644 --- a/lib/sbi/openapi/model/pcf_info.h +++ b/lib/sbi/openapi/model/pcf_info.h @@ -13,7 +13,9 @@ #include "../include/keyValuePair.h" #include "../include/binary.h" #include "identity_range.h" +#include "pro_se_capability.h" #include "supi_range.h" +#include "v2x_capability.h" #ifdef __cplusplus extern "C" { @@ -29,6 +31,10 @@ typedef struct OpenAPI_pcf_info_s { char *rx_diam_realm; bool is_v2x_support_ind; int v2x_support_ind; + bool is_prose_support_ind; + int prose_support_ind; + struct OpenAPI_pro_se_capability_s *prose_capability; + struct OpenAPI_v2x_capability_s *v2x_capability; } OpenAPI_pcf_info_t; OpenAPI_pcf_info_t *OpenAPI_pcf_info_create( @@ -39,7 +45,11 @@ OpenAPI_pcf_info_t *OpenAPI_pcf_info_create( char *rx_diam_host, char *rx_diam_realm, bool is_v2x_support_ind, - int v2x_support_ind + int v2x_support_ind, + bool is_prose_support_ind, + int prose_support_ind, + OpenAPI_pro_se_capability_t *prose_capability, + OpenAPI_v2x_capability_t *v2x_capability ); void OpenAPI_pcf_info_free(OpenAPI_pcf_info_t *pcf_info); OpenAPI_pcf_info_t *OpenAPI_pcf_info_parseFromJSON(cJSON *pcf_infoJSON); diff --git a/lib/sbi/openapi/model/pcf_mbs_binding.c b/lib/sbi/openapi/model/pcf_mbs_binding.c new file mode 100644 index 000000000..093a9dd56 --- /dev/null +++ b/lib/sbi/openapi/model/pcf_mbs_binding.c @@ -0,0 +1,318 @@ + +#include +#include +#include +#include "pcf_mbs_binding.h" + +OpenAPI_pcf_mbs_binding_t *OpenAPI_pcf_mbs_binding_create( + OpenAPI_mbs_session_id_t *mbs_session_id, + char *pcf_fqdn, + OpenAPI_list_t *pcf_ip_end_points, + char *pcf_id, + char *pcf_set_id, + OpenAPI_binding_level_e bind_level, + char *recovery_time, + char *supp_feat +) +{ + OpenAPI_pcf_mbs_binding_t *pcf_mbs_binding_local_var = ogs_malloc(sizeof(OpenAPI_pcf_mbs_binding_t)); + ogs_assert(pcf_mbs_binding_local_var); + + pcf_mbs_binding_local_var->mbs_session_id = mbs_session_id; + pcf_mbs_binding_local_var->pcf_fqdn = pcf_fqdn; + pcf_mbs_binding_local_var->pcf_ip_end_points = pcf_ip_end_points; + pcf_mbs_binding_local_var->pcf_id = pcf_id; + pcf_mbs_binding_local_var->pcf_set_id = pcf_set_id; + pcf_mbs_binding_local_var->bind_level = bind_level; + pcf_mbs_binding_local_var->recovery_time = recovery_time; + pcf_mbs_binding_local_var->supp_feat = supp_feat; + + return pcf_mbs_binding_local_var; +} + +void OpenAPI_pcf_mbs_binding_free(OpenAPI_pcf_mbs_binding_t *pcf_mbs_binding) +{ + OpenAPI_lnode_t *node = NULL; + + if (NULL == pcf_mbs_binding) { + return; + } + if (pcf_mbs_binding->mbs_session_id) { + OpenAPI_mbs_session_id_free(pcf_mbs_binding->mbs_session_id); + pcf_mbs_binding->mbs_session_id = NULL; + } + if (pcf_mbs_binding->pcf_fqdn) { + ogs_free(pcf_mbs_binding->pcf_fqdn); + pcf_mbs_binding->pcf_fqdn = NULL; + } + if (pcf_mbs_binding->pcf_ip_end_points) { + OpenAPI_list_for_each(pcf_mbs_binding->pcf_ip_end_points, node) { + OpenAPI_ip_end_point_free(node->data); + } + OpenAPI_list_free(pcf_mbs_binding->pcf_ip_end_points); + pcf_mbs_binding->pcf_ip_end_points = NULL; + } + if (pcf_mbs_binding->pcf_id) { + ogs_free(pcf_mbs_binding->pcf_id); + pcf_mbs_binding->pcf_id = NULL; + } + if (pcf_mbs_binding->pcf_set_id) { + ogs_free(pcf_mbs_binding->pcf_set_id); + pcf_mbs_binding->pcf_set_id = NULL; + } + if (pcf_mbs_binding->recovery_time) { + ogs_free(pcf_mbs_binding->recovery_time); + pcf_mbs_binding->recovery_time = NULL; + } + if (pcf_mbs_binding->supp_feat) { + ogs_free(pcf_mbs_binding->supp_feat); + pcf_mbs_binding->supp_feat = NULL; + } + ogs_free(pcf_mbs_binding); +} + +cJSON *OpenAPI_pcf_mbs_binding_convertToJSON(OpenAPI_pcf_mbs_binding_t *pcf_mbs_binding) +{ + cJSON *item = NULL; + OpenAPI_lnode_t *node = NULL; + + if (pcf_mbs_binding == NULL) { + ogs_error("OpenAPI_pcf_mbs_binding_convertToJSON() failed [PcfMbsBinding]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (!pcf_mbs_binding->mbs_session_id) { + ogs_error("OpenAPI_pcf_mbs_binding_convertToJSON() failed [mbs_session_id]"); + return NULL; + } + cJSON *mbs_session_id_local_JSON = OpenAPI_mbs_session_id_convertToJSON(pcf_mbs_binding->mbs_session_id); + if (mbs_session_id_local_JSON == NULL) { + ogs_error("OpenAPI_pcf_mbs_binding_convertToJSON() failed [mbs_session_id]"); + goto end; + } + cJSON_AddItemToObject(item, "mbsSessionId", mbs_session_id_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_pcf_mbs_binding_convertToJSON() failed [mbs_session_id]"); + goto end; + } + + if (pcf_mbs_binding->pcf_fqdn) { + if (cJSON_AddStringToObject(item, "pcfFqdn", pcf_mbs_binding->pcf_fqdn) == NULL) { + ogs_error("OpenAPI_pcf_mbs_binding_convertToJSON() failed [pcf_fqdn]"); + goto end; + } + } + + if (pcf_mbs_binding->pcf_ip_end_points) { + cJSON *pcf_ip_end_pointsList = cJSON_AddArrayToObject(item, "pcfIpEndPoints"); + if (pcf_ip_end_pointsList == NULL) { + ogs_error("OpenAPI_pcf_mbs_binding_convertToJSON() failed [pcf_ip_end_points]"); + goto end; + } + OpenAPI_list_for_each(pcf_mbs_binding->pcf_ip_end_points, node) { + cJSON *itemLocal = OpenAPI_ip_end_point_convertToJSON(node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_pcf_mbs_binding_convertToJSON() failed [pcf_ip_end_points]"); + goto end; + } + cJSON_AddItemToArray(pcf_ip_end_pointsList, itemLocal); + } + } + + if (pcf_mbs_binding->pcf_id) { + if (cJSON_AddStringToObject(item, "pcfId", pcf_mbs_binding->pcf_id) == NULL) { + ogs_error("OpenAPI_pcf_mbs_binding_convertToJSON() failed [pcf_id]"); + goto end; + } + } + + if (pcf_mbs_binding->pcf_set_id) { + if (cJSON_AddStringToObject(item, "pcfSetId", pcf_mbs_binding->pcf_set_id) == NULL) { + ogs_error("OpenAPI_pcf_mbs_binding_convertToJSON() failed [pcf_set_id]"); + goto end; + } + } + + if (pcf_mbs_binding->bind_level != OpenAPI_binding_level_NULL) { + if (cJSON_AddStringToObject(item, "bindLevel", OpenAPI_binding_level_ToString(pcf_mbs_binding->bind_level)) == NULL) { + ogs_error("OpenAPI_pcf_mbs_binding_convertToJSON() failed [bind_level]"); + goto end; + } + } + + if (pcf_mbs_binding->recovery_time) { + if (cJSON_AddStringToObject(item, "recoveryTime", pcf_mbs_binding->recovery_time) == NULL) { + ogs_error("OpenAPI_pcf_mbs_binding_convertToJSON() failed [recovery_time]"); + goto end; + } + } + + if (pcf_mbs_binding->supp_feat) { + if (cJSON_AddStringToObject(item, "suppFeat", pcf_mbs_binding->supp_feat) == NULL) { + ogs_error("OpenAPI_pcf_mbs_binding_convertToJSON() failed [supp_feat]"); + goto end; + } + } + +end: + return item; +} + +OpenAPI_pcf_mbs_binding_t *OpenAPI_pcf_mbs_binding_parseFromJSON(cJSON *pcf_mbs_bindingJSON) +{ + OpenAPI_pcf_mbs_binding_t *pcf_mbs_binding_local_var = NULL; + OpenAPI_lnode_t *node = NULL; + cJSON *mbs_session_id = NULL; + OpenAPI_mbs_session_id_t *mbs_session_id_local_nonprim = NULL; + cJSON *pcf_fqdn = NULL; + cJSON *pcf_ip_end_points = NULL; + OpenAPI_list_t *pcf_ip_end_pointsList = NULL; + cJSON *pcf_id = NULL; + cJSON *pcf_set_id = NULL; + cJSON *bind_level = NULL; + OpenAPI_binding_level_e bind_levelVariable = 0; + cJSON *recovery_time = NULL; + cJSON *supp_feat = NULL; + mbs_session_id = cJSON_GetObjectItemCaseSensitive(pcf_mbs_bindingJSON, "mbsSessionId"); + if (!mbs_session_id) { + ogs_error("OpenAPI_pcf_mbs_binding_parseFromJSON() failed [mbs_session_id]"); + goto end; + } + mbs_session_id_local_nonprim = OpenAPI_mbs_session_id_parseFromJSON(mbs_session_id); + + pcf_fqdn = cJSON_GetObjectItemCaseSensitive(pcf_mbs_bindingJSON, "pcfFqdn"); + if (pcf_fqdn) { + if (!cJSON_IsString(pcf_fqdn) && !cJSON_IsNull(pcf_fqdn)) { + ogs_error("OpenAPI_pcf_mbs_binding_parseFromJSON() failed [pcf_fqdn]"); + goto end; + } + } + + pcf_ip_end_points = cJSON_GetObjectItemCaseSensitive(pcf_mbs_bindingJSON, "pcfIpEndPoints"); + if (pcf_ip_end_points) { + cJSON *pcf_ip_end_points_local = NULL; + if (!cJSON_IsArray(pcf_ip_end_points)) { + ogs_error("OpenAPI_pcf_mbs_binding_parseFromJSON() failed [pcf_ip_end_points]"); + 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_mbs_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); + } + } + + pcf_id = cJSON_GetObjectItemCaseSensitive(pcf_mbs_bindingJSON, "pcfId"); + if (pcf_id) { + if (!cJSON_IsString(pcf_id) && !cJSON_IsNull(pcf_id)) { + ogs_error("OpenAPI_pcf_mbs_binding_parseFromJSON() failed [pcf_id]"); + goto end; + } + } + + pcf_set_id = cJSON_GetObjectItemCaseSensitive(pcf_mbs_bindingJSON, "pcfSetId"); + if (pcf_set_id) { + if (!cJSON_IsString(pcf_set_id) && !cJSON_IsNull(pcf_set_id)) { + ogs_error("OpenAPI_pcf_mbs_binding_parseFromJSON() failed [pcf_set_id]"); + goto end; + } + } + + bind_level = cJSON_GetObjectItemCaseSensitive(pcf_mbs_bindingJSON, "bindLevel"); + if (bind_level) { + if (!cJSON_IsString(bind_level)) { + ogs_error("OpenAPI_pcf_mbs_binding_parseFromJSON() failed [bind_level]"); + goto end; + } + bind_levelVariable = OpenAPI_binding_level_FromString(bind_level->valuestring); + } + + recovery_time = cJSON_GetObjectItemCaseSensitive(pcf_mbs_bindingJSON, "recoveryTime"); + if (recovery_time) { + if (!cJSON_IsString(recovery_time) && !cJSON_IsNull(recovery_time)) { + ogs_error("OpenAPI_pcf_mbs_binding_parseFromJSON() failed [recovery_time]"); + goto end; + } + } + + supp_feat = cJSON_GetObjectItemCaseSensitive(pcf_mbs_bindingJSON, "suppFeat"); + if (supp_feat) { + if (!cJSON_IsString(supp_feat) && !cJSON_IsNull(supp_feat)) { + ogs_error("OpenAPI_pcf_mbs_binding_parseFromJSON() failed [supp_feat]"); + goto end; + } + } + + pcf_mbs_binding_local_var = OpenAPI_pcf_mbs_binding_create ( + mbs_session_id_local_nonprim, + pcf_fqdn && !cJSON_IsNull(pcf_fqdn) ? ogs_strdup(pcf_fqdn->valuestring) : NULL, + pcf_ip_end_points ? pcf_ip_end_pointsList : 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, + bind_level ? bind_levelVariable : 0, + recovery_time && !cJSON_IsNull(recovery_time) ? ogs_strdup(recovery_time->valuestring) : NULL, + supp_feat && !cJSON_IsNull(supp_feat) ? ogs_strdup(supp_feat->valuestring) : NULL + ); + + return pcf_mbs_binding_local_var; +end: + if (mbs_session_id_local_nonprim) { + OpenAPI_mbs_session_id_free(mbs_session_id_local_nonprim); + mbs_session_id_local_nonprim = 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; + } + return NULL; +} + +OpenAPI_pcf_mbs_binding_t *OpenAPI_pcf_mbs_binding_copy(OpenAPI_pcf_mbs_binding_t *dst, OpenAPI_pcf_mbs_binding_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_pcf_mbs_binding_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_pcf_mbs_binding_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_pcf_mbs_binding_free(dst); + dst = OpenAPI_pcf_mbs_binding_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/pcf_mbs_binding.h b/lib/sbi/openapi/model/pcf_mbs_binding.h new file mode 100644 index 000000000..6c3cd1180 --- /dev/null +++ b/lib/sbi/openapi/model/pcf_mbs_binding.h @@ -0,0 +1,55 @@ +/* + * pcf_mbs_binding.h + * + * Represents an Individual PCF for an MBS Session binding. + */ + +#ifndef _OpenAPI_pcf_mbs_binding_H_ +#define _OpenAPI_pcf_mbs_binding_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "binding_level.h" +#include "ip_end_point.h" +#include "mbs_session_id.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_pcf_mbs_binding_s OpenAPI_pcf_mbs_binding_t; +typedef struct OpenAPI_pcf_mbs_binding_s { + struct OpenAPI_mbs_session_id_s *mbs_session_id; + char *pcf_fqdn; + OpenAPI_list_t *pcf_ip_end_points; + char *pcf_id; + char *pcf_set_id; + OpenAPI_binding_level_e bind_level; + char *recovery_time; + char *supp_feat; +} OpenAPI_pcf_mbs_binding_t; + +OpenAPI_pcf_mbs_binding_t *OpenAPI_pcf_mbs_binding_create( + OpenAPI_mbs_session_id_t *mbs_session_id, + char *pcf_fqdn, + OpenAPI_list_t *pcf_ip_end_points, + char *pcf_id, + char *pcf_set_id, + OpenAPI_binding_level_e bind_level, + char *recovery_time, + char *supp_feat +); +void OpenAPI_pcf_mbs_binding_free(OpenAPI_pcf_mbs_binding_t *pcf_mbs_binding); +OpenAPI_pcf_mbs_binding_t *OpenAPI_pcf_mbs_binding_parseFromJSON(cJSON *pcf_mbs_bindingJSON); +cJSON *OpenAPI_pcf_mbs_binding_convertToJSON(OpenAPI_pcf_mbs_binding_t *pcf_mbs_binding); +OpenAPI_pcf_mbs_binding_t *OpenAPI_pcf_mbs_binding_copy(OpenAPI_pcf_mbs_binding_t *dst, OpenAPI_pcf_mbs_binding_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_pcf_mbs_binding_H_ */ + diff --git a/lib/sbi/openapi/model/pcf_mbs_binding_patch.c b/lib/sbi/openapi/model/pcf_mbs_binding_patch.c new file mode 100644 index 000000000..6d6582037 --- /dev/null +++ b/lib/sbi/openapi/model/pcf_mbs_binding_patch.c @@ -0,0 +1,193 @@ + +#include +#include +#include +#include "pcf_mbs_binding_patch.h" + +OpenAPI_pcf_mbs_binding_patch_t *OpenAPI_pcf_mbs_binding_patch_create( + char *pcf_fqdn, + OpenAPI_list_t *pcf_ip_end_points, + char *pcf_id +) +{ + OpenAPI_pcf_mbs_binding_patch_t *pcf_mbs_binding_patch_local_var = ogs_malloc(sizeof(OpenAPI_pcf_mbs_binding_patch_t)); + ogs_assert(pcf_mbs_binding_patch_local_var); + + pcf_mbs_binding_patch_local_var->pcf_fqdn = pcf_fqdn; + pcf_mbs_binding_patch_local_var->pcf_ip_end_points = pcf_ip_end_points; + pcf_mbs_binding_patch_local_var->pcf_id = pcf_id; + + return pcf_mbs_binding_patch_local_var; +} + +void OpenAPI_pcf_mbs_binding_patch_free(OpenAPI_pcf_mbs_binding_patch_t *pcf_mbs_binding_patch) +{ + OpenAPI_lnode_t *node = NULL; + + if (NULL == pcf_mbs_binding_patch) { + return; + } + if (pcf_mbs_binding_patch->pcf_fqdn) { + ogs_free(pcf_mbs_binding_patch->pcf_fqdn); + pcf_mbs_binding_patch->pcf_fqdn = NULL; + } + if (pcf_mbs_binding_patch->pcf_ip_end_points) { + OpenAPI_list_for_each(pcf_mbs_binding_patch->pcf_ip_end_points, node) { + OpenAPI_ip_end_point_free(node->data); + } + OpenAPI_list_free(pcf_mbs_binding_patch->pcf_ip_end_points); + pcf_mbs_binding_patch->pcf_ip_end_points = NULL; + } + if (pcf_mbs_binding_patch->pcf_id) { + ogs_free(pcf_mbs_binding_patch->pcf_id); + pcf_mbs_binding_patch->pcf_id = NULL; + } + ogs_free(pcf_mbs_binding_patch); +} + +cJSON *OpenAPI_pcf_mbs_binding_patch_convertToJSON(OpenAPI_pcf_mbs_binding_patch_t *pcf_mbs_binding_patch) +{ + cJSON *item = NULL; + OpenAPI_lnode_t *node = NULL; + + if (pcf_mbs_binding_patch == NULL) { + ogs_error("OpenAPI_pcf_mbs_binding_patch_convertToJSON() failed [PcfMbsBindingPatch]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (pcf_mbs_binding_patch->pcf_fqdn) { + if (cJSON_AddStringToObject(item, "pcfFqdn", pcf_mbs_binding_patch->pcf_fqdn) == NULL) { + ogs_error("OpenAPI_pcf_mbs_binding_patch_convertToJSON() failed [pcf_fqdn]"); + goto end; + } + } + + if (pcf_mbs_binding_patch->pcf_ip_end_points) { + cJSON *pcf_ip_end_pointsList = cJSON_AddArrayToObject(item, "pcfIpEndPoints"); + if (pcf_ip_end_pointsList == NULL) { + ogs_error("OpenAPI_pcf_mbs_binding_patch_convertToJSON() failed [pcf_ip_end_points]"); + goto end; + } + OpenAPI_list_for_each(pcf_mbs_binding_patch->pcf_ip_end_points, node) { + cJSON *itemLocal = OpenAPI_ip_end_point_convertToJSON(node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_pcf_mbs_binding_patch_convertToJSON() failed [pcf_ip_end_points]"); + goto end; + } + cJSON_AddItemToArray(pcf_ip_end_pointsList, itemLocal); + } + } + + if (pcf_mbs_binding_patch->pcf_id) { + if (cJSON_AddStringToObject(item, "pcfId", pcf_mbs_binding_patch->pcf_id) == NULL) { + ogs_error("OpenAPI_pcf_mbs_binding_patch_convertToJSON() failed [pcf_id]"); + goto end; + } + } + +end: + return item; +} + +OpenAPI_pcf_mbs_binding_patch_t *OpenAPI_pcf_mbs_binding_patch_parseFromJSON(cJSON *pcf_mbs_binding_patchJSON) +{ + OpenAPI_pcf_mbs_binding_patch_t *pcf_mbs_binding_patch_local_var = NULL; + OpenAPI_lnode_t *node = NULL; + cJSON *pcf_fqdn = NULL; + cJSON *pcf_ip_end_points = NULL; + OpenAPI_list_t *pcf_ip_end_pointsList = NULL; + cJSON *pcf_id = NULL; + pcf_fqdn = cJSON_GetObjectItemCaseSensitive(pcf_mbs_binding_patchJSON, "pcfFqdn"); + if (pcf_fqdn) { + if (!cJSON_IsString(pcf_fqdn) && !cJSON_IsNull(pcf_fqdn)) { + ogs_error("OpenAPI_pcf_mbs_binding_patch_parseFromJSON() failed [pcf_fqdn]"); + goto end; + } + } + + pcf_ip_end_points = cJSON_GetObjectItemCaseSensitive(pcf_mbs_binding_patchJSON, "pcfIpEndPoints"); + if (pcf_ip_end_points) { + cJSON *pcf_ip_end_points_local = NULL; + if (!cJSON_IsArray(pcf_ip_end_points)) { + ogs_error("OpenAPI_pcf_mbs_binding_patch_parseFromJSON() failed [pcf_ip_end_points]"); + 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_mbs_binding_patch_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); + } + } + + pcf_id = cJSON_GetObjectItemCaseSensitive(pcf_mbs_binding_patchJSON, "pcfId"); + if (pcf_id) { + if (!cJSON_IsString(pcf_id) && !cJSON_IsNull(pcf_id)) { + ogs_error("OpenAPI_pcf_mbs_binding_patch_parseFromJSON() failed [pcf_id]"); + goto end; + } + } + + pcf_mbs_binding_patch_local_var = OpenAPI_pcf_mbs_binding_patch_create ( + pcf_fqdn && !cJSON_IsNull(pcf_fqdn) ? ogs_strdup(pcf_fqdn->valuestring) : NULL, + pcf_ip_end_points ? pcf_ip_end_pointsList : NULL, + pcf_id && !cJSON_IsNull(pcf_id) ? ogs_strdup(pcf_id->valuestring) : NULL + ); + + return pcf_mbs_binding_patch_local_var; +end: + 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; + } + return NULL; +} + +OpenAPI_pcf_mbs_binding_patch_t *OpenAPI_pcf_mbs_binding_patch_copy(OpenAPI_pcf_mbs_binding_patch_t *dst, OpenAPI_pcf_mbs_binding_patch_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_pcf_mbs_binding_patch_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_pcf_mbs_binding_patch_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_pcf_mbs_binding_patch_free(dst); + dst = OpenAPI_pcf_mbs_binding_patch_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/pcf_mbs_binding_patch.h b/lib/sbi/openapi/model/pcf_mbs_binding_patch.h new file mode 100644 index 000000000..c5a4919e2 --- /dev/null +++ b/lib/sbi/openapi/model/pcf_mbs_binding_patch.h @@ -0,0 +1,43 @@ +/* + * pcf_mbs_binding_patch.h + * + * Represents the requested modification to an Individual PCF for an MBS Session binding. + */ + +#ifndef _OpenAPI_pcf_mbs_binding_patch_H_ +#define _OpenAPI_pcf_mbs_binding_patch_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "ip_end_point.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_pcf_mbs_binding_patch_s OpenAPI_pcf_mbs_binding_patch_t; +typedef struct OpenAPI_pcf_mbs_binding_patch_s { + char *pcf_fqdn; + OpenAPI_list_t *pcf_ip_end_points; + char *pcf_id; +} OpenAPI_pcf_mbs_binding_patch_t; + +OpenAPI_pcf_mbs_binding_patch_t *OpenAPI_pcf_mbs_binding_patch_create( + char *pcf_fqdn, + OpenAPI_list_t *pcf_ip_end_points, + char *pcf_id +); +void OpenAPI_pcf_mbs_binding_patch_free(OpenAPI_pcf_mbs_binding_patch_t *pcf_mbs_binding_patch); +OpenAPI_pcf_mbs_binding_patch_t *OpenAPI_pcf_mbs_binding_patch_parseFromJSON(cJSON *pcf_mbs_binding_patchJSON); +cJSON *OpenAPI_pcf_mbs_binding_patch_convertToJSON(OpenAPI_pcf_mbs_binding_patch_t *pcf_mbs_binding_patch); +OpenAPI_pcf_mbs_binding_patch_t *OpenAPI_pcf_mbs_binding_patch_copy(OpenAPI_pcf_mbs_binding_patch_t *dst, OpenAPI_pcf_mbs_binding_patch_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_pcf_mbs_binding_patch_H_ */ + diff --git a/lib/sbi/openapi/model/pcf_selection_assistance_info.c b/lib/sbi/openapi/model/pcf_selection_assistance_info.c new file mode 100644 index 000000000..6e921dd9b --- /dev/null +++ b/lib/sbi/openapi/model/pcf_selection_assistance_info.c @@ -0,0 +1,149 @@ + +#include +#include +#include +#include "pcf_selection_assistance_info.h" + +OpenAPI_pcf_selection_assistance_info_t *OpenAPI_pcf_selection_assistance_info_create( + char *dnn, + OpenAPI_snssai_t *single_nssai +) +{ + OpenAPI_pcf_selection_assistance_info_t *pcf_selection_assistance_info_local_var = ogs_malloc(sizeof(OpenAPI_pcf_selection_assistance_info_t)); + ogs_assert(pcf_selection_assistance_info_local_var); + + pcf_selection_assistance_info_local_var->dnn = dnn; + pcf_selection_assistance_info_local_var->single_nssai = single_nssai; + + return pcf_selection_assistance_info_local_var; +} + +void OpenAPI_pcf_selection_assistance_info_free(OpenAPI_pcf_selection_assistance_info_t *pcf_selection_assistance_info) +{ + OpenAPI_lnode_t *node = NULL; + + if (NULL == pcf_selection_assistance_info) { + return; + } + if (pcf_selection_assistance_info->dnn) { + ogs_free(pcf_selection_assistance_info->dnn); + pcf_selection_assistance_info->dnn = NULL; + } + if (pcf_selection_assistance_info->single_nssai) { + OpenAPI_snssai_free(pcf_selection_assistance_info->single_nssai); + pcf_selection_assistance_info->single_nssai = NULL; + } + ogs_free(pcf_selection_assistance_info); +} + +cJSON *OpenAPI_pcf_selection_assistance_info_convertToJSON(OpenAPI_pcf_selection_assistance_info_t *pcf_selection_assistance_info) +{ + cJSON *item = NULL; + OpenAPI_lnode_t *node = NULL; + + if (pcf_selection_assistance_info == NULL) { + ogs_error("OpenAPI_pcf_selection_assistance_info_convertToJSON() failed [PcfSelectionAssistanceInfo]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (!pcf_selection_assistance_info->dnn) { + ogs_error("OpenAPI_pcf_selection_assistance_info_convertToJSON() failed [dnn]"); + return NULL; + } + if (cJSON_AddStringToObject(item, "dnn", pcf_selection_assistance_info->dnn) == NULL) { + ogs_error("OpenAPI_pcf_selection_assistance_info_convertToJSON() failed [dnn]"); + goto end; + } + + if (!pcf_selection_assistance_info->single_nssai) { + ogs_error("OpenAPI_pcf_selection_assistance_info_convertToJSON() failed [single_nssai]"); + return NULL; + } + cJSON *single_nssai_local_JSON = OpenAPI_snssai_convertToJSON(pcf_selection_assistance_info->single_nssai); + if (single_nssai_local_JSON == NULL) { + ogs_error("OpenAPI_pcf_selection_assistance_info_convertToJSON() failed [single_nssai]"); + goto end; + } + cJSON_AddItemToObject(item, "singleNssai", single_nssai_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_pcf_selection_assistance_info_convertToJSON() failed [single_nssai]"); + goto end; + } + +end: + return item; +} + +OpenAPI_pcf_selection_assistance_info_t *OpenAPI_pcf_selection_assistance_info_parseFromJSON(cJSON *pcf_selection_assistance_infoJSON) +{ + OpenAPI_pcf_selection_assistance_info_t *pcf_selection_assistance_info_local_var = NULL; + OpenAPI_lnode_t *node = NULL; + cJSON *dnn = NULL; + cJSON *single_nssai = NULL; + OpenAPI_snssai_t *single_nssai_local_nonprim = NULL; + dnn = cJSON_GetObjectItemCaseSensitive(pcf_selection_assistance_infoJSON, "dnn"); + if (!dnn) { + ogs_error("OpenAPI_pcf_selection_assistance_info_parseFromJSON() failed [dnn]"); + goto end; + } + if (!cJSON_IsString(dnn)) { + ogs_error("OpenAPI_pcf_selection_assistance_info_parseFromJSON() failed [dnn]"); + goto end; + } + + single_nssai = cJSON_GetObjectItemCaseSensitive(pcf_selection_assistance_infoJSON, "singleNssai"); + if (!single_nssai) { + ogs_error("OpenAPI_pcf_selection_assistance_info_parseFromJSON() failed [single_nssai]"); + goto end; + } + single_nssai_local_nonprim = OpenAPI_snssai_parseFromJSON(single_nssai); + + pcf_selection_assistance_info_local_var = OpenAPI_pcf_selection_assistance_info_create ( + ogs_strdup(dnn->valuestring), + single_nssai_local_nonprim + ); + + return pcf_selection_assistance_info_local_var; +end: + if (single_nssai_local_nonprim) { + OpenAPI_snssai_free(single_nssai_local_nonprim); + single_nssai_local_nonprim = NULL; + } + return NULL; +} + +OpenAPI_pcf_selection_assistance_info_t *OpenAPI_pcf_selection_assistance_info_copy(OpenAPI_pcf_selection_assistance_info_t *dst, OpenAPI_pcf_selection_assistance_info_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_pcf_selection_assistance_info_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_pcf_selection_assistance_info_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_pcf_selection_assistance_info_free(dst); + dst = OpenAPI_pcf_selection_assistance_info_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/pcf_selection_assistance_info.h b/lib/sbi/openapi/model/pcf_selection_assistance_info.h new file mode 100644 index 000000000..feda40c42 --- /dev/null +++ b/lib/sbi/openapi/model/pcf_selection_assistance_info.h @@ -0,0 +1,41 @@ +/* + * pcf_selection_assistance_info.h + * + * + */ + +#ifndef _OpenAPI_pcf_selection_assistance_info_H_ +#define _OpenAPI_pcf_selection_assistance_info_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "snssai.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_pcf_selection_assistance_info_s OpenAPI_pcf_selection_assistance_info_t; +typedef struct OpenAPI_pcf_selection_assistance_info_s { + char *dnn; + struct OpenAPI_snssai_s *single_nssai; +} OpenAPI_pcf_selection_assistance_info_t; + +OpenAPI_pcf_selection_assistance_info_t *OpenAPI_pcf_selection_assistance_info_create( + char *dnn, + OpenAPI_snssai_t *single_nssai +); +void OpenAPI_pcf_selection_assistance_info_free(OpenAPI_pcf_selection_assistance_info_t *pcf_selection_assistance_info); +OpenAPI_pcf_selection_assistance_info_t *OpenAPI_pcf_selection_assistance_info_parseFromJSON(cJSON *pcf_selection_assistance_infoJSON); +cJSON *OpenAPI_pcf_selection_assistance_info_convertToJSON(OpenAPI_pcf_selection_assistance_info_t *pcf_selection_assistance_info); +OpenAPI_pcf_selection_assistance_info_t *OpenAPI_pcf_selection_assistance_info_copy(OpenAPI_pcf_selection_assistance_info_t *dst, OpenAPI_pcf_selection_assistance_info_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_pcf_selection_assistance_info_H_ */ + diff --git a/lib/sbi/openapi/model/pcf_selection_assistance_info_1.c b/lib/sbi/openapi/model/pcf_selection_assistance_info_1.c new file mode 100644 index 000000000..33532b9ab --- /dev/null +++ b/lib/sbi/openapi/model/pcf_selection_assistance_info_1.c @@ -0,0 +1,149 @@ + +#include +#include +#include +#include "pcf_selection_assistance_info_1.h" + +OpenAPI_pcf_selection_assistance_info_1_t *OpenAPI_pcf_selection_assistance_info_1_create( + char *dnn, + OpenAPI_snssai_t *single_nssai +) +{ + OpenAPI_pcf_selection_assistance_info_1_t *pcf_selection_assistance_info_1_local_var = ogs_malloc(sizeof(OpenAPI_pcf_selection_assistance_info_1_t)); + ogs_assert(pcf_selection_assistance_info_1_local_var); + + pcf_selection_assistance_info_1_local_var->dnn = dnn; + pcf_selection_assistance_info_1_local_var->single_nssai = single_nssai; + + return pcf_selection_assistance_info_1_local_var; +} + +void OpenAPI_pcf_selection_assistance_info_1_free(OpenAPI_pcf_selection_assistance_info_1_t *pcf_selection_assistance_info_1) +{ + OpenAPI_lnode_t *node = NULL; + + if (NULL == pcf_selection_assistance_info_1) { + return; + } + if (pcf_selection_assistance_info_1->dnn) { + ogs_free(pcf_selection_assistance_info_1->dnn); + pcf_selection_assistance_info_1->dnn = NULL; + } + if (pcf_selection_assistance_info_1->single_nssai) { + OpenAPI_snssai_free(pcf_selection_assistance_info_1->single_nssai); + pcf_selection_assistance_info_1->single_nssai = NULL; + } + ogs_free(pcf_selection_assistance_info_1); +} + +cJSON *OpenAPI_pcf_selection_assistance_info_1_convertToJSON(OpenAPI_pcf_selection_assistance_info_1_t *pcf_selection_assistance_info_1) +{ + cJSON *item = NULL; + OpenAPI_lnode_t *node = NULL; + + if (pcf_selection_assistance_info_1 == NULL) { + ogs_error("OpenAPI_pcf_selection_assistance_info_1_convertToJSON() failed [PcfSelectionAssistanceInfo_1]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (!pcf_selection_assistance_info_1->dnn) { + ogs_error("OpenAPI_pcf_selection_assistance_info_1_convertToJSON() failed [dnn]"); + return NULL; + } + if (cJSON_AddStringToObject(item, "dnn", pcf_selection_assistance_info_1->dnn) == NULL) { + ogs_error("OpenAPI_pcf_selection_assistance_info_1_convertToJSON() failed [dnn]"); + goto end; + } + + if (!pcf_selection_assistance_info_1->single_nssai) { + ogs_error("OpenAPI_pcf_selection_assistance_info_1_convertToJSON() failed [single_nssai]"); + return NULL; + } + cJSON *single_nssai_local_JSON = OpenAPI_snssai_convertToJSON(pcf_selection_assistance_info_1->single_nssai); + if (single_nssai_local_JSON == NULL) { + ogs_error("OpenAPI_pcf_selection_assistance_info_1_convertToJSON() failed [single_nssai]"); + goto end; + } + cJSON_AddItemToObject(item, "singleNssai", single_nssai_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_pcf_selection_assistance_info_1_convertToJSON() failed [single_nssai]"); + goto end; + } + +end: + return item; +} + +OpenAPI_pcf_selection_assistance_info_1_t *OpenAPI_pcf_selection_assistance_info_1_parseFromJSON(cJSON *pcf_selection_assistance_info_1JSON) +{ + OpenAPI_pcf_selection_assistance_info_1_t *pcf_selection_assistance_info_1_local_var = NULL; + OpenAPI_lnode_t *node = NULL; + cJSON *dnn = NULL; + cJSON *single_nssai = NULL; + OpenAPI_snssai_t *single_nssai_local_nonprim = NULL; + dnn = cJSON_GetObjectItemCaseSensitive(pcf_selection_assistance_info_1JSON, "dnn"); + if (!dnn) { + ogs_error("OpenAPI_pcf_selection_assistance_info_1_parseFromJSON() failed [dnn]"); + goto end; + } + if (!cJSON_IsString(dnn)) { + ogs_error("OpenAPI_pcf_selection_assistance_info_1_parseFromJSON() failed [dnn]"); + goto end; + } + + single_nssai = cJSON_GetObjectItemCaseSensitive(pcf_selection_assistance_info_1JSON, "singleNssai"); + if (!single_nssai) { + ogs_error("OpenAPI_pcf_selection_assistance_info_1_parseFromJSON() failed [single_nssai]"); + goto end; + } + single_nssai_local_nonprim = OpenAPI_snssai_parseFromJSON(single_nssai); + + pcf_selection_assistance_info_1_local_var = OpenAPI_pcf_selection_assistance_info_1_create ( + ogs_strdup(dnn->valuestring), + single_nssai_local_nonprim + ); + + return pcf_selection_assistance_info_1_local_var; +end: + if (single_nssai_local_nonprim) { + OpenAPI_snssai_free(single_nssai_local_nonprim); + single_nssai_local_nonprim = NULL; + } + return NULL; +} + +OpenAPI_pcf_selection_assistance_info_1_t *OpenAPI_pcf_selection_assistance_info_1_copy(OpenAPI_pcf_selection_assistance_info_1_t *dst, OpenAPI_pcf_selection_assistance_info_1_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_pcf_selection_assistance_info_1_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_pcf_selection_assistance_info_1_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_pcf_selection_assistance_info_1_free(dst); + dst = OpenAPI_pcf_selection_assistance_info_1_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/pcf_selection_assistance_info_1.h b/lib/sbi/openapi/model/pcf_selection_assistance_info_1.h new file mode 100644 index 000000000..bc2f2b342 --- /dev/null +++ b/lib/sbi/openapi/model/pcf_selection_assistance_info_1.h @@ -0,0 +1,41 @@ +/* + * pcf_selection_assistance_info_1.h + * + * + */ + +#ifndef _OpenAPI_pcf_selection_assistance_info_1_H_ +#define _OpenAPI_pcf_selection_assistance_info_1_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "snssai.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_pcf_selection_assistance_info_1_s OpenAPI_pcf_selection_assistance_info_1_t; +typedef struct OpenAPI_pcf_selection_assistance_info_1_s { + char *dnn; + struct OpenAPI_snssai_s *single_nssai; +} OpenAPI_pcf_selection_assistance_info_1_t; + +OpenAPI_pcf_selection_assistance_info_1_t *OpenAPI_pcf_selection_assistance_info_1_create( + char *dnn, + OpenAPI_snssai_t *single_nssai +); +void OpenAPI_pcf_selection_assistance_info_1_free(OpenAPI_pcf_selection_assistance_info_1_t *pcf_selection_assistance_info_1); +OpenAPI_pcf_selection_assistance_info_1_t *OpenAPI_pcf_selection_assistance_info_1_parseFromJSON(cJSON *pcf_selection_assistance_info_1JSON); +cJSON *OpenAPI_pcf_selection_assistance_info_1_convertToJSON(OpenAPI_pcf_selection_assistance_info_1_t *pcf_selection_assistance_info_1); +OpenAPI_pcf_selection_assistance_info_1_t *OpenAPI_pcf_selection_assistance_info_1_copy(OpenAPI_pcf_selection_assistance_info_1_t *dst, OpenAPI_pcf_selection_assistance_info_1_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_pcf_selection_assistance_info_1_H_ */ + diff --git a/lib/sbi/openapi/model/pcf_ue_callback_info.c b/lib/sbi/openapi/model/pcf_ue_callback_info.c new file mode 100644 index 000000000..0807de840 --- /dev/null +++ b/lib/sbi/openapi/model/pcf_ue_callback_info.c @@ -0,0 +1,137 @@ + +#include +#include +#include +#include "pcf_ue_callback_info.h" + +OpenAPI_pcf_ue_callback_info_t *OpenAPI_pcf_ue_callback_info_create( + char *callback_uri, + char *binding_info +) +{ + OpenAPI_pcf_ue_callback_info_t *pcf_ue_callback_info_local_var = ogs_malloc(sizeof(OpenAPI_pcf_ue_callback_info_t)); + ogs_assert(pcf_ue_callback_info_local_var); + + pcf_ue_callback_info_local_var->callback_uri = callback_uri; + pcf_ue_callback_info_local_var->binding_info = binding_info; + + return pcf_ue_callback_info_local_var; +} + +void OpenAPI_pcf_ue_callback_info_free(OpenAPI_pcf_ue_callback_info_t *pcf_ue_callback_info) +{ + OpenAPI_lnode_t *node = NULL; + + if (NULL == pcf_ue_callback_info) { + return; + } + if (pcf_ue_callback_info->callback_uri) { + ogs_free(pcf_ue_callback_info->callback_uri); + pcf_ue_callback_info->callback_uri = NULL; + } + if (pcf_ue_callback_info->binding_info) { + ogs_free(pcf_ue_callback_info->binding_info); + pcf_ue_callback_info->binding_info = NULL; + } + ogs_free(pcf_ue_callback_info); +} + +cJSON *OpenAPI_pcf_ue_callback_info_convertToJSON(OpenAPI_pcf_ue_callback_info_t *pcf_ue_callback_info) +{ + cJSON *item = NULL; + OpenAPI_lnode_t *node = NULL; + + if (pcf_ue_callback_info == NULL) { + ogs_error("OpenAPI_pcf_ue_callback_info_convertToJSON() failed [PcfUeCallbackInfo]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (!pcf_ue_callback_info->callback_uri) { + ogs_error("OpenAPI_pcf_ue_callback_info_convertToJSON() failed [callback_uri]"); + return NULL; + } + if (cJSON_AddStringToObject(item, "callbackUri", pcf_ue_callback_info->callback_uri) == NULL) { + ogs_error("OpenAPI_pcf_ue_callback_info_convertToJSON() failed [callback_uri]"); + goto end; + } + + if (pcf_ue_callback_info->binding_info) { + if (cJSON_AddStringToObject(item, "bindingInfo", pcf_ue_callback_info->binding_info) == NULL) { + ogs_error("OpenAPI_pcf_ue_callback_info_convertToJSON() failed [binding_info]"); + goto end; + } + } + +end: + return item; +} + +OpenAPI_pcf_ue_callback_info_t *OpenAPI_pcf_ue_callback_info_parseFromJSON(cJSON *pcf_ue_callback_infoJSON) +{ + OpenAPI_pcf_ue_callback_info_t *pcf_ue_callback_info_local_var = NULL; + OpenAPI_lnode_t *node = NULL; + cJSON *callback_uri = NULL; + cJSON *binding_info = NULL; + callback_uri = cJSON_GetObjectItemCaseSensitive(pcf_ue_callback_infoJSON, "callbackUri"); + if (!callback_uri) { + ogs_error("OpenAPI_pcf_ue_callback_info_parseFromJSON() failed [callback_uri]"); + goto end; + } + if (!cJSON_IsString(callback_uri)) { + ogs_error("OpenAPI_pcf_ue_callback_info_parseFromJSON() failed [callback_uri]"); + goto end; + } + + binding_info = cJSON_GetObjectItemCaseSensitive(pcf_ue_callback_infoJSON, "bindingInfo"); + if (binding_info) { + if (!cJSON_IsString(binding_info) && !cJSON_IsNull(binding_info)) { + ogs_error("OpenAPI_pcf_ue_callback_info_parseFromJSON() failed [binding_info]"); + goto end; + } + } + + pcf_ue_callback_info_local_var = OpenAPI_pcf_ue_callback_info_create ( + ogs_strdup(callback_uri->valuestring), + binding_info && !cJSON_IsNull(binding_info) ? ogs_strdup(binding_info->valuestring) : NULL + ); + + return pcf_ue_callback_info_local_var; +end: + return NULL; +} + +OpenAPI_pcf_ue_callback_info_t *OpenAPI_pcf_ue_callback_info_copy(OpenAPI_pcf_ue_callback_info_t *dst, OpenAPI_pcf_ue_callback_info_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_pcf_ue_callback_info_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_pcf_ue_callback_info_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_pcf_ue_callback_info_free(dst); + dst = OpenAPI_pcf_ue_callback_info_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/pcf_ue_callback_info.h b/lib/sbi/openapi/model/pcf_ue_callback_info.h new file mode 100644 index 000000000..a11e1f571 --- /dev/null +++ b/lib/sbi/openapi/model/pcf_ue_callback_info.h @@ -0,0 +1,40 @@ +/* + * pcf_ue_callback_info.h + * + * Contains the PCF for the UE information necessary for the PCF for the PDU session to send SM Policy Association Establishment and Termination events. + */ + +#ifndef _OpenAPI_pcf_ue_callback_info_H_ +#define _OpenAPI_pcf_ue_callback_info_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_pcf_ue_callback_info_s OpenAPI_pcf_ue_callback_info_t; +typedef struct OpenAPI_pcf_ue_callback_info_s { + char *callback_uri; + char *binding_info; +} OpenAPI_pcf_ue_callback_info_t; + +OpenAPI_pcf_ue_callback_info_t *OpenAPI_pcf_ue_callback_info_create( + char *callback_uri, + char *binding_info +); +void OpenAPI_pcf_ue_callback_info_free(OpenAPI_pcf_ue_callback_info_t *pcf_ue_callback_info); +OpenAPI_pcf_ue_callback_info_t *OpenAPI_pcf_ue_callback_info_parseFromJSON(cJSON *pcf_ue_callback_infoJSON); +cJSON *OpenAPI_pcf_ue_callback_info_convertToJSON(OpenAPI_pcf_ue_callback_info_t *pcf_ue_callback_info); +OpenAPI_pcf_ue_callback_info_t *OpenAPI_pcf_ue_callback_info_copy(OpenAPI_pcf_ue_callback_info_t *dst, OpenAPI_pcf_ue_callback_info_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_pcf_ue_callback_info_H_ */ + diff --git a/lib/sbi/openapi/model/pcscf_address.c b/lib/sbi/openapi/model/pcscf_address.c new file mode 100644 index 000000000..d64776afd --- /dev/null +++ b/lib/sbi/openapi/model/pcscf_address.c @@ -0,0 +1,218 @@ + +#include +#include +#include +#include "pcscf_address.h" + +OpenAPI_pcscf_address_t *OpenAPI_pcscf_address_create( + OpenAPI_list_t *ipv4_addrs, + OpenAPI_list_t *ipv6_addrs, + char *fqdn +) +{ + OpenAPI_pcscf_address_t *pcscf_address_local_var = ogs_malloc(sizeof(OpenAPI_pcscf_address_t)); + ogs_assert(pcscf_address_local_var); + + pcscf_address_local_var->ipv4_addrs = ipv4_addrs; + pcscf_address_local_var->ipv6_addrs = ipv6_addrs; + pcscf_address_local_var->fqdn = fqdn; + + return pcscf_address_local_var; +} + +void OpenAPI_pcscf_address_free(OpenAPI_pcscf_address_t *pcscf_address) +{ + OpenAPI_lnode_t *node = NULL; + + if (NULL == pcscf_address) { + return; + } + if (pcscf_address->ipv4_addrs) { + OpenAPI_list_for_each(pcscf_address->ipv4_addrs, node) { + ogs_free(node->data); + } + OpenAPI_list_free(pcscf_address->ipv4_addrs); + pcscf_address->ipv4_addrs = NULL; + } + if (pcscf_address->ipv6_addrs) { + OpenAPI_list_for_each(pcscf_address->ipv6_addrs, node) { + ogs_free(node->data); + } + OpenAPI_list_free(pcscf_address->ipv6_addrs); + pcscf_address->ipv6_addrs = NULL; + } + if (pcscf_address->fqdn) { + ogs_free(pcscf_address->fqdn); + pcscf_address->fqdn = NULL; + } + ogs_free(pcscf_address); +} + +cJSON *OpenAPI_pcscf_address_convertToJSON(OpenAPI_pcscf_address_t *pcscf_address) +{ + cJSON *item = NULL; + OpenAPI_lnode_t *node = NULL; + + if (pcscf_address == NULL) { + ogs_error("OpenAPI_pcscf_address_convertToJSON() failed [PcscfAddress]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (pcscf_address->ipv4_addrs) { + cJSON *ipv4_addrsList = cJSON_AddArrayToObject(item, "ipv4Addrs"); + if (ipv4_addrsList == NULL) { + ogs_error("OpenAPI_pcscf_address_convertToJSON() failed [ipv4_addrs]"); + goto end; + } + OpenAPI_list_for_each(pcscf_address->ipv4_addrs, node) { + if (cJSON_AddStringToObject(ipv4_addrsList, "", (char*)node->data) == NULL) { + ogs_error("OpenAPI_pcscf_address_convertToJSON() failed [ipv4_addrs]"); + goto end; + } + } + } + + if (pcscf_address->ipv6_addrs) { + cJSON *ipv6_addrsList = cJSON_AddArrayToObject(item, "ipv6Addrs"); + if (ipv6_addrsList == NULL) { + ogs_error("OpenAPI_pcscf_address_convertToJSON() failed [ipv6_addrs]"); + goto end; + } + OpenAPI_list_for_each(pcscf_address->ipv6_addrs, node) { + if (cJSON_AddStringToObject(ipv6_addrsList, "", (char*)node->data) == NULL) { + ogs_error("OpenAPI_pcscf_address_convertToJSON() failed [ipv6_addrs]"); + goto end; + } + } + } + + if (pcscf_address->fqdn) { + if (cJSON_AddStringToObject(item, "fqdn", pcscf_address->fqdn) == NULL) { + ogs_error("OpenAPI_pcscf_address_convertToJSON() failed [fqdn]"); + goto end; + } + } + +end: + return item; +} + +OpenAPI_pcscf_address_t *OpenAPI_pcscf_address_parseFromJSON(cJSON *pcscf_addressJSON) +{ + OpenAPI_pcscf_address_t *pcscf_address_local_var = NULL; + OpenAPI_lnode_t *node = NULL; + cJSON *ipv4_addrs = NULL; + OpenAPI_list_t *ipv4_addrsList = NULL; + cJSON *ipv6_addrs = NULL; + OpenAPI_list_t *ipv6_addrsList = NULL; + cJSON *fqdn = NULL; + ipv4_addrs = cJSON_GetObjectItemCaseSensitive(pcscf_addressJSON, "ipv4Addrs"); + if (ipv4_addrs) { + cJSON *ipv4_addrs_local = NULL; + if (!cJSON_IsArray(ipv4_addrs)) { + ogs_error("OpenAPI_pcscf_address_parseFromJSON() failed [ipv4_addrs]"); + goto end; + } + + ipv4_addrsList = OpenAPI_list_create(); + + cJSON_ArrayForEach(ipv4_addrs_local, ipv4_addrs) { + double *localDouble = NULL; + int *localInt = NULL; + if (!cJSON_IsString(ipv4_addrs_local)) { + ogs_error("OpenAPI_pcscf_address_parseFromJSON() failed [ipv4_addrs]"); + goto end; + } + OpenAPI_list_add(ipv4_addrsList, ogs_strdup(ipv4_addrs_local->valuestring)); + } + } + + ipv6_addrs = cJSON_GetObjectItemCaseSensitive(pcscf_addressJSON, "ipv6Addrs"); + if (ipv6_addrs) { + cJSON *ipv6_addrs_local = NULL; + if (!cJSON_IsArray(ipv6_addrs)) { + ogs_error("OpenAPI_pcscf_address_parseFromJSON() failed [ipv6_addrs]"); + goto end; + } + + ipv6_addrsList = OpenAPI_list_create(); + + cJSON_ArrayForEach(ipv6_addrs_local, ipv6_addrs) { + double *localDouble = NULL; + int *localInt = NULL; + if (!cJSON_IsString(ipv6_addrs_local)) { + ogs_error("OpenAPI_pcscf_address_parseFromJSON() failed [ipv6_addrs]"); + goto end; + } + OpenAPI_list_add(ipv6_addrsList, ogs_strdup(ipv6_addrs_local->valuestring)); + } + } + + fqdn = cJSON_GetObjectItemCaseSensitive(pcscf_addressJSON, "fqdn"); + if (fqdn) { + if (!cJSON_IsString(fqdn) && !cJSON_IsNull(fqdn)) { + ogs_error("OpenAPI_pcscf_address_parseFromJSON() failed [fqdn]"); + goto end; + } + } + + pcscf_address_local_var = OpenAPI_pcscf_address_create ( + ipv4_addrs ? ipv4_addrsList : NULL, + ipv6_addrs ? ipv6_addrsList : NULL, + fqdn && !cJSON_IsNull(fqdn) ? ogs_strdup(fqdn->valuestring) : NULL + ); + + return pcscf_address_local_var; +end: + if (ipv4_addrsList) { + OpenAPI_list_for_each(ipv4_addrsList, node) { + ogs_free(node->data); + } + OpenAPI_list_free(ipv4_addrsList); + ipv4_addrsList = NULL; + } + if (ipv6_addrsList) { + OpenAPI_list_for_each(ipv6_addrsList, node) { + ogs_free(node->data); + } + OpenAPI_list_free(ipv6_addrsList); + ipv6_addrsList = NULL; + } + return NULL; +} + +OpenAPI_pcscf_address_t *OpenAPI_pcscf_address_copy(OpenAPI_pcscf_address_t *dst, OpenAPI_pcscf_address_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_pcscf_address_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_pcscf_address_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_pcscf_address_free(dst); + dst = OpenAPI_pcscf_address_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/pcscf_address.h b/lib/sbi/openapi/model/pcscf_address.h new file mode 100644 index 000000000..e8a0ff171 --- /dev/null +++ b/lib/sbi/openapi/model/pcscf_address.h @@ -0,0 +1,42 @@ +/* + * pcscf_address.h + * + * Contains the addressing information (IP addresses and/or FQDN) of the P-CSCF + */ + +#ifndef _OpenAPI_pcscf_address_H_ +#define _OpenAPI_pcscf_address_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_pcscf_address_s OpenAPI_pcscf_address_t; +typedef struct OpenAPI_pcscf_address_s { + OpenAPI_list_t *ipv4_addrs; + OpenAPI_list_t *ipv6_addrs; + char *fqdn; +} OpenAPI_pcscf_address_t; + +OpenAPI_pcscf_address_t *OpenAPI_pcscf_address_create( + OpenAPI_list_t *ipv4_addrs, + OpenAPI_list_t *ipv6_addrs, + char *fqdn +); +void OpenAPI_pcscf_address_free(OpenAPI_pcscf_address_t *pcscf_address); +OpenAPI_pcscf_address_t *OpenAPI_pcscf_address_parseFromJSON(cJSON *pcscf_addressJSON); +cJSON *OpenAPI_pcscf_address_convertToJSON(OpenAPI_pcscf_address_t *pcscf_address); +OpenAPI_pcscf_address_t *OpenAPI_pcscf_address_copy(OpenAPI_pcscf_address_t *dst, OpenAPI_pcscf_address_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_pcscf_address_H_ */ + diff --git a/lib/sbi/openapi/model/pcscf_info.c b/lib/sbi/openapi/model/pcscf_info.c index 9e0564662..22ccfd652 100644 --- a/lib/sbi/openapi/model/pcscf_info.c +++ b/lib/sbi/openapi/model/pcscf_info.c @@ -10,6 +10,9 @@ OpenAPI_pcscf_info_t *OpenAPI_pcscf_info_create( char *gm_fqdn, OpenAPI_list_t *gm_ipv4_addresses, OpenAPI_list_t *gm_ipv6_addresses, + char *mw_fqdn, + OpenAPI_list_t *mw_ipv4_addresses, + OpenAPI_list_t *mw_ipv6_addresses, OpenAPI_list_t *served_ipv4_address_ranges, OpenAPI_list_t *served_ipv6_prefix_ranges ) @@ -22,6 +25,9 @@ OpenAPI_pcscf_info_t *OpenAPI_pcscf_info_create( pcscf_info_local_var->gm_fqdn = gm_fqdn; pcscf_info_local_var->gm_ipv4_addresses = gm_ipv4_addresses; pcscf_info_local_var->gm_ipv6_addresses = gm_ipv6_addresses; + pcscf_info_local_var->mw_fqdn = mw_fqdn; + pcscf_info_local_var->mw_ipv4_addresses = mw_ipv4_addresses; + pcscf_info_local_var->mw_ipv6_addresses = mw_ipv6_addresses; pcscf_info_local_var->served_ipv4_address_ranges = served_ipv4_address_ranges; pcscf_info_local_var->served_ipv6_prefix_ranges = served_ipv6_prefix_ranges; @@ -64,6 +70,24 @@ void OpenAPI_pcscf_info_free(OpenAPI_pcscf_info_t *pcscf_info) OpenAPI_list_free(pcscf_info->gm_ipv6_addresses); pcscf_info->gm_ipv6_addresses = NULL; } + if (pcscf_info->mw_fqdn) { + ogs_free(pcscf_info->mw_fqdn); + pcscf_info->mw_fqdn = NULL; + } + if (pcscf_info->mw_ipv4_addresses) { + OpenAPI_list_for_each(pcscf_info->mw_ipv4_addresses, node) { + ogs_free(node->data); + } + OpenAPI_list_free(pcscf_info->mw_ipv4_addresses); + pcscf_info->mw_ipv4_addresses = NULL; + } + if (pcscf_info->mw_ipv6_addresses) { + OpenAPI_list_for_each(pcscf_info->mw_ipv6_addresses, node) { + ogs_free(node->data); + } + OpenAPI_list_free(pcscf_info->mw_ipv6_addresses); + pcscf_info->mw_ipv6_addresses = NULL; + } if (pcscf_info->served_ipv4_address_ranges) { OpenAPI_list_for_each(pcscf_info->served_ipv4_address_ranges, node) { OpenAPI_ipv4_address_range_free(node->data); @@ -155,6 +179,41 @@ cJSON *OpenAPI_pcscf_info_convertToJSON(OpenAPI_pcscf_info_t *pcscf_info) } } + if (pcscf_info->mw_fqdn) { + if (cJSON_AddStringToObject(item, "mwFqdn", pcscf_info->mw_fqdn) == NULL) { + ogs_error("OpenAPI_pcscf_info_convertToJSON() failed [mw_fqdn]"); + goto end; + } + } + + if (pcscf_info->mw_ipv4_addresses) { + cJSON *mw_ipv4_addressesList = cJSON_AddArrayToObject(item, "mwIpv4Addresses"); + if (mw_ipv4_addressesList == NULL) { + ogs_error("OpenAPI_pcscf_info_convertToJSON() failed [mw_ipv4_addresses]"); + goto end; + } + OpenAPI_list_for_each(pcscf_info->mw_ipv4_addresses, node) { + if (cJSON_AddStringToObject(mw_ipv4_addressesList, "", (char*)node->data) == NULL) { + ogs_error("OpenAPI_pcscf_info_convertToJSON() failed [mw_ipv4_addresses]"); + goto end; + } + } + } + + if (pcscf_info->mw_ipv6_addresses) { + cJSON *mw_ipv6_addressesList = cJSON_AddArrayToObject(item, "mwIpv6Addresses"); + if (mw_ipv6_addressesList == NULL) { + ogs_error("OpenAPI_pcscf_info_convertToJSON() failed [mw_ipv6_addresses]"); + goto end; + } + OpenAPI_list_for_each(pcscf_info->mw_ipv6_addresses, node) { + if (cJSON_AddStringToObject(mw_ipv6_addressesList, "", (char*)node->data) == NULL) { + ogs_error("OpenAPI_pcscf_info_convertToJSON() failed [mw_ipv6_addresses]"); + goto end; + } + } + } + if (pcscf_info->served_ipv4_address_ranges) { cJSON *served_ipv4_address_rangesList = cJSON_AddArrayToObject(item, "servedIpv4AddressRanges"); if (served_ipv4_address_rangesList == NULL) { @@ -204,6 +263,11 @@ OpenAPI_pcscf_info_t *OpenAPI_pcscf_info_parseFromJSON(cJSON *pcscf_infoJSON) OpenAPI_list_t *gm_ipv4_addressesList = NULL; cJSON *gm_ipv6_addresses = NULL; OpenAPI_list_t *gm_ipv6_addressesList = NULL; + cJSON *mw_fqdn = NULL; + cJSON *mw_ipv4_addresses = NULL; + OpenAPI_list_t *mw_ipv4_addressesList = NULL; + cJSON *mw_ipv6_addresses = NULL; + OpenAPI_list_t *mw_ipv6_addressesList = NULL; cJSON *served_ipv4_address_ranges = NULL; OpenAPI_list_t *served_ipv4_address_rangesList = NULL; cJSON *served_ipv6_prefix_ranges = NULL; @@ -298,6 +362,56 @@ OpenAPI_pcscf_info_t *OpenAPI_pcscf_info_parseFromJSON(cJSON *pcscf_infoJSON) } } + mw_fqdn = cJSON_GetObjectItemCaseSensitive(pcscf_infoJSON, "mwFqdn"); + if (mw_fqdn) { + if (!cJSON_IsString(mw_fqdn) && !cJSON_IsNull(mw_fqdn)) { + ogs_error("OpenAPI_pcscf_info_parseFromJSON() failed [mw_fqdn]"); + goto end; + } + } + + mw_ipv4_addresses = cJSON_GetObjectItemCaseSensitive(pcscf_infoJSON, "mwIpv4Addresses"); + if (mw_ipv4_addresses) { + cJSON *mw_ipv4_addresses_local = NULL; + if (!cJSON_IsArray(mw_ipv4_addresses)) { + ogs_error("OpenAPI_pcscf_info_parseFromJSON() failed [mw_ipv4_addresses]"); + goto end; + } + + mw_ipv4_addressesList = OpenAPI_list_create(); + + cJSON_ArrayForEach(mw_ipv4_addresses_local, mw_ipv4_addresses) { + double *localDouble = NULL; + int *localInt = NULL; + if (!cJSON_IsString(mw_ipv4_addresses_local)) { + ogs_error("OpenAPI_pcscf_info_parseFromJSON() failed [mw_ipv4_addresses]"); + goto end; + } + OpenAPI_list_add(mw_ipv4_addressesList, ogs_strdup(mw_ipv4_addresses_local->valuestring)); + } + } + + mw_ipv6_addresses = cJSON_GetObjectItemCaseSensitive(pcscf_infoJSON, "mwIpv6Addresses"); + if (mw_ipv6_addresses) { + cJSON *mw_ipv6_addresses_local = NULL; + if (!cJSON_IsArray(mw_ipv6_addresses)) { + ogs_error("OpenAPI_pcscf_info_parseFromJSON() failed [mw_ipv6_addresses]"); + goto end; + } + + mw_ipv6_addressesList = OpenAPI_list_create(); + + cJSON_ArrayForEach(mw_ipv6_addresses_local, mw_ipv6_addresses) { + double *localDouble = NULL; + int *localInt = NULL; + if (!cJSON_IsString(mw_ipv6_addresses_local)) { + ogs_error("OpenAPI_pcscf_info_parseFromJSON() failed [mw_ipv6_addresses]"); + goto end; + } + OpenAPI_list_add(mw_ipv6_addressesList, ogs_strdup(mw_ipv6_addresses_local->valuestring)); + } + } + served_ipv4_address_ranges = cJSON_GetObjectItemCaseSensitive(pcscf_infoJSON, "servedIpv4AddressRanges"); if (served_ipv4_address_ranges) { cJSON *served_ipv4_address_ranges_local = NULL; @@ -354,6 +468,9 @@ OpenAPI_pcscf_info_t *OpenAPI_pcscf_info_parseFromJSON(cJSON *pcscf_infoJSON) gm_fqdn && !cJSON_IsNull(gm_fqdn) ? ogs_strdup(gm_fqdn->valuestring) : NULL, gm_ipv4_addresses ? gm_ipv4_addressesList : NULL, gm_ipv6_addresses ? gm_ipv6_addressesList : NULL, + mw_fqdn && !cJSON_IsNull(mw_fqdn) ? ogs_strdup(mw_fqdn->valuestring) : NULL, + mw_ipv4_addresses ? mw_ipv4_addressesList : NULL, + mw_ipv6_addresses ? mw_ipv6_addressesList : NULL, served_ipv4_address_ranges ? served_ipv4_address_rangesList : NULL, served_ipv6_prefix_ranges ? served_ipv6_prefix_rangesList : NULL ); @@ -385,6 +502,20 @@ end: OpenAPI_list_free(gm_ipv6_addressesList); gm_ipv6_addressesList = NULL; } + if (mw_ipv4_addressesList) { + OpenAPI_list_for_each(mw_ipv4_addressesList, node) { + ogs_free(node->data); + } + OpenAPI_list_free(mw_ipv4_addressesList); + mw_ipv4_addressesList = NULL; + } + if (mw_ipv6_addressesList) { + OpenAPI_list_for_each(mw_ipv6_addressesList, node) { + ogs_free(node->data); + } + OpenAPI_list_free(mw_ipv6_addressesList); + mw_ipv6_addressesList = NULL; + } if (served_ipv4_address_rangesList) { OpenAPI_list_for_each(served_ipv4_address_rangesList, node) { OpenAPI_ipv4_address_range_free(node->data); diff --git a/lib/sbi/openapi/model/pcscf_info.h b/lib/sbi/openapi/model/pcscf_info.h index 97040b0f8..8bdff3e53 100644 --- a/lib/sbi/openapi/model/pcscf_info.h +++ b/lib/sbi/openapi/model/pcscf_info.h @@ -27,6 +27,9 @@ typedef struct OpenAPI_pcscf_info_s { char *gm_fqdn; OpenAPI_list_t *gm_ipv4_addresses; OpenAPI_list_t *gm_ipv6_addresses; + char *mw_fqdn; + OpenAPI_list_t *mw_ipv4_addresses; + OpenAPI_list_t *mw_ipv6_addresses; OpenAPI_list_t *served_ipv4_address_ranges; OpenAPI_list_t *served_ipv6_prefix_ranges; } OpenAPI_pcscf_info_t; @@ -37,6 +40,9 @@ OpenAPI_pcscf_info_t *OpenAPI_pcscf_info_create( char *gm_fqdn, OpenAPI_list_t *gm_ipv4_addresses, OpenAPI_list_t *gm_ipv6_addresses, + char *mw_fqdn, + OpenAPI_list_t *mw_ipv4_addresses, + OpenAPI_list_t *mw_ipv6_addresses, OpenAPI_list_t *served_ipv4_address_ranges, OpenAPI_list_t *served_ipv6_prefix_ranges ); diff --git a/lib/sbi/openapi/model/pcscf_restoration_notification.c b/lib/sbi/openapi/model/pcscf_restoration_notification.c index c2374908a..057dff942 100644 --- a/lib/sbi/openapi/model/pcscf_restoration_notification.c +++ b/lib/sbi/openapi/model/pcscf_restoration_notification.c @@ -5,13 +5,15 @@ #include "pcscf_restoration_notification.h" OpenAPI_pcscf_restoration_notification_t *OpenAPI_pcscf_restoration_notification_create( - char *supi + char *supi, + OpenAPI_pcscf_address_t *failed_pcscf ) { OpenAPI_pcscf_restoration_notification_t *pcscf_restoration_notification_local_var = ogs_malloc(sizeof(OpenAPI_pcscf_restoration_notification_t)); ogs_assert(pcscf_restoration_notification_local_var); pcscf_restoration_notification_local_var->supi = supi; + pcscf_restoration_notification_local_var->failed_pcscf = failed_pcscf; return pcscf_restoration_notification_local_var; } @@ -27,6 +29,10 @@ void OpenAPI_pcscf_restoration_notification_free(OpenAPI_pcscf_restoration_notif ogs_free(pcscf_restoration_notification->supi); pcscf_restoration_notification->supi = NULL; } + if (pcscf_restoration_notification->failed_pcscf) { + OpenAPI_pcscf_address_free(pcscf_restoration_notification->failed_pcscf); + pcscf_restoration_notification->failed_pcscf = NULL; + } ogs_free(pcscf_restoration_notification); } @@ -50,6 +56,19 @@ cJSON *OpenAPI_pcscf_restoration_notification_convertToJSON(OpenAPI_pcscf_restor goto end; } + if (pcscf_restoration_notification->failed_pcscf) { + cJSON *failed_pcscf_local_JSON = OpenAPI_pcscf_address_convertToJSON(pcscf_restoration_notification->failed_pcscf); + if (failed_pcscf_local_JSON == NULL) { + ogs_error("OpenAPI_pcscf_restoration_notification_convertToJSON() failed [failed_pcscf]"); + goto end; + } + cJSON_AddItemToObject(item, "failedPcscf", failed_pcscf_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_pcscf_restoration_notification_convertToJSON() failed [failed_pcscf]"); + goto end; + } + } + end: return item; } @@ -59,6 +78,8 @@ OpenAPI_pcscf_restoration_notification_t *OpenAPI_pcscf_restoration_notification OpenAPI_pcscf_restoration_notification_t *pcscf_restoration_notification_local_var = NULL; OpenAPI_lnode_t *node = NULL; cJSON *supi = NULL; + cJSON *failed_pcscf = NULL; + OpenAPI_pcscf_address_t *failed_pcscf_local_nonprim = NULL; supi = cJSON_GetObjectItemCaseSensitive(pcscf_restoration_notificationJSON, "supi"); if (!supi) { ogs_error("OpenAPI_pcscf_restoration_notification_parseFromJSON() failed [supi]"); @@ -69,12 +90,22 @@ OpenAPI_pcscf_restoration_notification_t *OpenAPI_pcscf_restoration_notification goto end; } + failed_pcscf = cJSON_GetObjectItemCaseSensitive(pcscf_restoration_notificationJSON, "failedPcscf"); + if (failed_pcscf) { + failed_pcscf_local_nonprim = OpenAPI_pcscf_address_parseFromJSON(failed_pcscf); + } + pcscf_restoration_notification_local_var = OpenAPI_pcscf_restoration_notification_create ( - ogs_strdup(supi->valuestring) + ogs_strdup(supi->valuestring), + failed_pcscf ? failed_pcscf_local_nonprim : NULL ); return pcscf_restoration_notification_local_var; end: + if (failed_pcscf_local_nonprim) { + OpenAPI_pcscf_address_free(failed_pcscf_local_nonprim); + failed_pcscf_local_nonprim = NULL; + } return NULL; } diff --git a/lib/sbi/openapi/model/pcscf_restoration_notification.h b/lib/sbi/openapi/model/pcscf_restoration_notification.h index 993030b74..6e18e2a81 100644 --- a/lib/sbi/openapi/model/pcscf_restoration_notification.h +++ b/lib/sbi/openapi/model/pcscf_restoration_notification.h @@ -12,6 +12,7 @@ #include "../include/list.h" #include "../include/keyValuePair.h" #include "../include/binary.h" +#include "pcscf_address.h" #ifdef __cplusplus extern "C" { @@ -20,10 +21,12 @@ extern "C" { typedef struct OpenAPI_pcscf_restoration_notification_s OpenAPI_pcscf_restoration_notification_t; typedef struct OpenAPI_pcscf_restoration_notification_s { char *supi; + struct OpenAPI_pcscf_address_s *failed_pcscf; } OpenAPI_pcscf_restoration_notification_t; OpenAPI_pcscf_restoration_notification_t *OpenAPI_pcscf_restoration_notification_create( - char *supi + char *supi, + OpenAPI_pcscf_address_t *failed_pcscf ); void OpenAPI_pcscf_restoration_notification_free(OpenAPI_pcscf_restoration_notification_t *pcscf_restoration_notification); OpenAPI_pcscf_restoration_notification_t *OpenAPI_pcscf_restoration_notification_parseFromJSON(cJSON *pcscf_restoration_notificationJSON); diff --git a/lib/sbi/openapi/model/pdu_session_1.c b/lib/sbi/openapi/model/pdu_session_1.c deleted file mode 100644 index c8e529037..000000000 --- a/lib/sbi/openapi/model/pdu_session_1.c +++ /dev/null @@ -1,207 +0,0 @@ - -#include -#include -#include -#include "pdu_session_1.h" - -OpenAPI_pdu_session_1_t *OpenAPI_pdu_session_1_create( - char *dnn, - char *smf_instance_id, - OpenAPI_plmn_id_1_t *plmn_id, - OpenAPI_snssai_t *single_nssai -) -{ - OpenAPI_pdu_session_1_t *pdu_session_1_local_var = ogs_malloc(sizeof(OpenAPI_pdu_session_1_t)); - ogs_assert(pdu_session_1_local_var); - - pdu_session_1_local_var->dnn = dnn; - pdu_session_1_local_var->smf_instance_id = smf_instance_id; - pdu_session_1_local_var->plmn_id = plmn_id; - pdu_session_1_local_var->single_nssai = single_nssai; - - return pdu_session_1_local_var; -} - -void OpenAPI_pdu_session_1_free(OpenAPI_pdu_session_1_t *pdu_session_1) -{ - OpenAPI_lnode_t *node = NULL; - - if (NULL == pdu_session_1) { - return; - } - if (pdu_session_1->dnn) { - ogs_free(pdu_session_1->dnn); - pdu_session_1->dnn = NULL; - } - if (pdu_session_1->smf_instance_id) { - ogs_free(pdu_session_1->smf_instance_id); - pdu_session_1->smf_instance_id = NULL; - } - if (pdu_session_1->plmn_id) { - OpenAPI_plmn_id_1_free(pdu_session_1->plmn_id); - pdu_session_1->plmn_id = NULL; - } - if (pdu_session_1->single_nssai) { - OpenAPI_snssai_free(pdu_session_1->single_nssai); - pdu_session_1->single_nssai = NULL; - } - ogs_free(pdu_session_1); -} - -cJSON *OpenAPI_pdu_session_1_convertToJSON(OpenAPI_pdu_session_1_t *pdu_session_1) -{ - cJSON *item = NULL; - OpenAPI_lnode_t *node = NULL; - - if (pdu_session_1 == NULL) { - ogs_error("OpenAPI_pdu_session_1_convertToJSON() failed [PduSession_1]"); - return NULL; - } - - item = cJSON_CreateObject(); - if (!pdu_session_1->dnn) { - ogs_error("OpenAPI_pdu_session_1_convertToJSON() failed [dnn]"); - return NULL; - } - if (cJSON_AddStringToObject(item, "dnn", pdu_session_1->dnn) == NULL) { - ogs_error("OpenAPI_pdu_session_1_convertToJSON() failed [dnn]"); - goto end; - } - - if (!pdu_session_1->smf_instance_id) { - ogs_error("OpenAPI_pdu_session_1_convertToJSON() failed [smf_instance_id]"); - return NULL; - } - if (cJSON_AddStringToObject(item, "smfInstanceId", pdu_session_1->smf_instance_id) == NULL) { - ogs_error("OpenAPI_pdu_session_1_convertToJSON() failed [smf_instance_id]"); - goto end; - } - - if (!pdu_session_1->plmn_id) { - ogs_error("OpenAPI_pdu_session_1_convertToJSON() failed [plmn_id]"); - return NULL; - } - cJSON *plmn_id_local_JSON = OpenAPI_plmn_id_1_convertToJSON(pdu_session_1->plmn_id); - if (plmn_id_local_JSON == NULL) { - ogs_error("OpenAPI_pdu_session_1_convertToJSON() failed [plmn_id]"); - goto end; - } - cJSON_AddItemToObject(item, "plmnId", plmn_id_local_JSON); - if (item->child == NULL) { - ogs_error("OpenAPI_pdu_session_1_convertToJSON() failed [plmn_id]"); - goto end; - } - - if (pdu_session_1->single_nssai) { - cJSON *single_nssai_local_JSON = OpenAPI_snssai_convertToJSON(pdu_session_1->single_nssai); - if (single_nssai_local_JSON == NULL) { - ogs_error("OpenAPI_pdu_session_1_convertToJSON() failed [single_nssai]"); - goto end; - } - cJSON_AddItemToObject(item, "singleNssai", single_nssai_local_JSON); - if (item->child == NULL) { - ogs_error("OpenAPI_pdu_session_1_convertToJSON() failed [single_nssai]"); - goto end; - } - } - -end: - return item; -} - -OpenAPI_pdu_session_1_t *OpenAPI_pdu_session_1_parseFromJSON(cJSON *pdu_session_1JSON) -{ - OpenAPI_pdu_session_1_t *pdu_session_1_local_var = NULL; - OpenAPI_lnode_t *node = NULL; - cJSON *dnn = NULL; - cJSON *smf_instance_id = NULL; - cJSON *plmn_id = NULL; - OpenAPI_plmn_id_1_t *plmn_id_local_nonprim = NULL; - cJSON *single_nssai = NULL; - OpenAPI_snssai_t *single_nssai_local_nonprim = NULL; - dnn = cJSON_GetObjectItemCaseSensitive(pdu_session_1JSON, "dnn"); - if (!dnn) { - ogs_error("OpenAPI_pdu_session_1_parseFromJSON() failed [dnn]"); - goto end; - } - if (!cJSON_IsString(dnn)) { - ogs_error("OpenAPI_pdu_session_1_parseFromJSON() failed [dnn]"); - goto end; - } - - smf_instance_id = cJSON_GetObjectItemCaseSensitive(pdu_session_1JSON, "smfInstanceId"); - if (!smf_instance_id) { - ogs_error("OpenAPI_pdu_session_1_parseFromJSON() failed [smf_instance_id]"); - goto end; - } - if (!cJSON_IsString(smf_instance_id)) { - ogs_error("OpenAPI_pdu_session_1_parseFromJSON() failed [smf_instance_id]"); - goto end; - } - - plmn_id = cJSON_GetObjectItemCaseSensitive(pdu_session_1JSON, "plmnId"); - if (!plmn_id) { - ogs_error("OpenAPI_pdu_session_1_parseFromJSON() failed [plmn_id]"); - goto end; - } - plmn_id_local_nonprim = OpenAPI_plmn_id_1_parseFromJSON(plmn_id); - - single_nssai = cJSON_GetObjectItemCaseSensitive(pdu_session_1JSON, "singleNssai"); - if (single_nssai) { - single_nssai_local_nonprim = OpenAPI_snssai_parseFromJSON(single_nssai); - } - - pdu_session_1_local_var = OpenAPI_pdu_session_1_create ( - ogs_strdup(dnn->valuestring), - ogs_strdup(smf_instance_id->valuestring), - plmn_id_local_nonprim, - single_nssai ? single_nssai_local_nonprim : NULL - ); - - return pdu_session_1_local_var; -end: - if (plmn_id_local_nonprim) { - OpenAPI_plmn_id_1_free(plmn_id_local_nonprim); - plmn_id_local_nonprim = NULL; - } - if (single_nssai_local_nonprim) { - OpenAPI_snssai_free(single_nssai_local_nonprim); - single_nssai_local_nonprim = NULL; - } - return NULL; -} - -OpenAPI_pdu_session_1_t *OpenAPI_pdu_session_1_copy(OpenAPI_pdu_session_1_t *dst, OpenAPI_pdu_session_1_t *src) -{ - cJSON *item = NULL; - char *content = NULL; - - ogs_assert(src); - item = OpenAPI_pdu_session_1_convertToJSON(src); - if (!item) { - ogs_error("OpenAPI_pdu_session_1_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_pdu_session_1_free(dst); - dst = OpenAPI_pdu_session_1_parseFromJSON(item); - cJSON_Delete(item); - - return dst; -} - diff --git a/lib/sbi/openapi/model/pdu_session_1.h b/lib/sbi/openapi/model/pdu_session_1.h deleted file mode 100644 index 8fe79c699..000000000 --- a/lib/sbi/openapi/model/pdu_session_1.h +++ /dev/null @@ -1,46 +0,0 @@ -/* - * pdu_session_1.h - * - * - */ - -#ifndef _OpenAPI_pdu_session_1_H_ -#define _OpenAPI_pdu_session_1_H_ - -#include -#include "../external/cJSON.h" -#include "../include/list.h" -#include "../include/keyValuePair.h" -#include "../include/binary.h" -#include "plmn_id_1.h" -#include "snssai.h" - -#ifdef __cplusplus -extern "C" { -#endif - -typedef struct OpenAPI_pdu_session_1_s OpenAPI_pdu_session_1_t; -typedef struct OpenAPI_pdu_session_1_s { - char *dnn; - char *smf_instance_id; - struct OpenAPI_plmn_id_1_s *plmn_id; - struct OpenAPI_snssai_s *single_nssai; -} OpenAPI_pdu_session_1_t; - -OpenAPI_pdu_session_1_t *OpenAPI_pdu_session_1_create( - char *dnn, - char *smf_instance_id, - OpenAPI_plmn_id_1_t *plmn_id, - OpenAPI_snssai_t *single_nssai -); -void OpenAPI_pdu_session_1_free(OpenAPI_pdu_session_1_t *pdu_session_1); -OpenAPI_pdu_session_1_t *OpenAPI_pdu_session_1_parseFromJSON(cJSON *pdu_session_1JSON); -cJSON *OpenAPI_pdu_session_1_convertToJSON(OpenAPI_pdu_session_1_t *pdu_session_1); -OpenAPI_pdu_session_1_t *OpenAPI_pdu_session_1_copy(OpenAPI_pdu_session_1_t *dst, OpenAPI_pdu_session_1_t *src); - -#ifdef __cplusplus -} -#endif - -#endif /* _OpenAPI_pdu_session_1_H_ */ - diff --git a/lib/sbi/openapi/model/pdu_session_context.c b/lib/sbi/openapi/model/pdu_session_context.c index 1371034d7..cc36909f2 100644 --- a/lib/sbi/openapi/model/pdu_session_context.c +++ b/lib/sbi/openapi/model/pdu_session_context.c @@ -29,7 +29,21 @@ OpenAPI_pdu_session_context_t *OpenAPI_pdu_session_context_create( char *smf_service_instance_id, bool is_ma_pdu_session, int ma_pdu_session, - OpenAPI_cn_assisted_ran_para_t *cn_assisted_ran_para + OpenAPI_cn_assisted_ran_para_t *cn_assisted_ran_para, + char *nrf_management_uri, + char *nrf_discovery_uri, + char *nrf_access_token_uri, + char *smf_binding_info, + char *vsmf_binding_info, + char *ismf_binding_info, + OpenAPI_snssai_t *additional_snssai, + char *inter_plmn_api_root, + char *pgw_fqdn, + OpenAPI_ip_address_t *pgw_ip_addr, + OpenAPI_plmn_id_t *plmn_id, + char *anchor_smf_supported_features, + bool is_anchor_smf_oauth2_required, + int anchor_smf_oauth2_required ) { OpenAPI_pdu_session_context_t *pdu_session_context_local_var = ogs_malloc(sizeof(OpenAPI_pdu_session_context_t)); @@ -60,6 +74,20 @@ OpenAPI_pdu_session_context_t *OpenAPI_pdu_session_context_create( pdu_session_context_local_var->is_ma_pdu_session = is_ma_pdu_session; pdu_session_context_local_var->ma_pdu_session = ma_pdu_session; pdu_session_context_local_var->cn_assisted_ran_para = cn_assisted_ran_para; + pdu_session_context_local_var->nrf_management_uri = nrf_management_uri; + pdu_session_context_local_var->nrf_discovery_uri = nrf_discovery_uri; + pdu_session_context_local_var->nrf_access_token_uri = nrf_access_token_uri; + pdu_session_context_local_var->smf_binding_info = smf_binding_info; + pdu_session_context_local_var->vsmf_binding_info = vsmf_binding_info; + pdu_session_context_local_var->ismf_binding_info = ismf_binding_info; + pdu_session_context_local_var->additional_snssai = additional_snssai; + pdu_session_context_local_var->inter_plmn_api_root = inter_plmn_api_root; + pdu_session_context_local_var->pgw_fqdn = pgw_fqdn; + pdu_session_context_local_var->pgw_ip_addr = pgw_ip_addr; + pdu_session_context_local_var->plmn_id = plmn_id; + pdu_session_context_local_var->anchor_smf_supported_features = anchor_smf_supported_features; + pdu_session_context_local_var->is_anchor_smf_oauth2_required = is_anchor_smf_oauth2_required; + pdu_session_context_local_var->anchor_smf_oauth2_required = anchor_smf_oauth2_required; return pdu_session_context_local_var; } @@ -142,6 +170,54 @@ void OpenAPI_pdu_session_context_free(OpenAPI_pdu_session_context_t *pdu_session OpenAPI_cn_assisted_ran_para_free(pdu_session_context->cn_assisted_ran_para); pdu_session_context->cn_assisted_ran_para = NULL; } + if (pdu_session_context->nrf_management_uri) { + ogs_free(pdu_session_context->nrf_management_uri); + pdu_session_context->nrf_management_uri = NULL; + } + if (pdu_session_context->nrf_discovery_uri) { + ogs_free(pdu_session_context->nrf_discovery_uri); + pdu_session_context->nrf_discovery_uri = NULL; + } + if (pdu_session_context->nrf_access_token_uri) { + ogs_free(pdu_session_context->nrf_access_token_uri); + pdu_session_context->nrf_access_token_uri = NULL; + } + if (pdu_session_context->smf_binding_info) { + ogs_free(pdu_session_context->smf_binding_info); + pdu_session_context->smf_binding_info = NULL; + } + if (pdu_session_context->vsmf_binding_info) { + ogs_free(pdu_session_context->vsmf_binding_info); + pdu_session_context->vsmf_binding_info = NULL; + } + if (pdu_session_context->ismf_binding_info) { + ogs_free(pdu_session_context->ismf_binding_info); + pdu_session_context->ismf_binding_info = NULL; + } + if (pdu_session_context->additional_snssai) { + OpenAPI_snssai_free(pdu_session_context->additional_snssai); + pdu_session_context->additional_snssai = NULL; + } + if (pdu_session_context->inter_plmn_api_root) { + ogs_free(pdu_session_context->inter_plmn_api_root); + pdu_session_context->inter_plmn_api_root = NULL; + } + if (pdu_session_context->pgw_fqdn) { + ogs_free(pdu_session_context->pgw_fqdn); + pdu_session_context->pgw_fqdn = NULL; + } + if (pdu_session_context->pgw_ip_addr) { + OpenAPI_ip_address_free(pdu_session_context->pgw_ip_addr); + pdu_session_context->pgw_ip_addr = NULL; + } + if (pdu_session_context->plmn_id) { + OpenAPI_plmn_id_free(pdu_session_context->plmn_id); + pdu_session_context->plmn_id = NULL; + } + if (pdu_session_context->anchor_smf_supported_features) { + ogs_free(pdu_session_context->anchor_smf_supported_features); + pdu_session_context->anchor_smf_supported_features = NULL; + } ogs_free(pdu_session_context); } @@ -351,6 +427,115 @@ cJSON *OpenAPI_pdu_session_context_convertToJSON(OpenAPI_pdu_session_context_t * } } + if (pdu_session_context->nrf_management_uri) { + if (cJSON_AddStringToObject(item, "nrfManagementUri", pdu_session_context->nrf_management_uri) == NULL) { + ogs_error("OpenAPI_pdu_session_context_convertToJSON() failed [nrf_management_uri]"); + goto end; + } + } + + if (pdu_session_context->nrf_discovery_uri) { + if (cJSON_AddStringToObject(item, "nrfDiscoveryUri", pdu_session_context->nrf_discovery_uri) == NULL) { + ogs_error("OpenAPI_pdu_session_context_convertToJSON() failed [nrf_discovery_uri]"); + goto end; + } + } + + if (pdu_session_context->nrf_access_token_uri) { + if (cJSON_AddStringToObject(item, "nrfAccessTokenUri", pdu_session_context->nrf_access_token_uri) == NULL) { + ogs_error("OpenAPI_pdu_session_context_convertToJSON() failed [nrf_access_token_uri]"); + goto end; + } + } + + if (pdu_session_context->smf_binding_info) { + if (cJSON_AddStringToObject(item, "smfBindingInfo", pdu_session_context->smf_binding_info) == NULL) { + ogs_error("OpenAPI_pdu_session_context_convertToJSON() failed [smf_binding_info]"); + goto end; + } + } + + if (pdu_session_context->vsmf_binding_info) { + if (cJSON_AddStringToObject(item, "vsmfBindingInfo", pdu_session_context->vsmf_binding_info) == NULL) { + ogs_error("OpenAPI_pdu_session_context_convertToJSON() failed [vsmf_binding_info]"); + goto end; + } + } + + if (pdu_session_context->ismf_binding_info) { + if (cJSON_AddStringToObject(item, "ismfBindingInfo", pdu_session_context->ismf_binding_info) == NULL) { + ogs_error("OpenAPI_pdu_session_context_convertToJSON() failed [ismf_binding_info]"); + goto end; + } + } + + if (pdu_session_context->additional_snssai) { + cJSON *additional_snssai_local_JSON = OpenAPI_snssai_convertToJSON(pdu_session_context->additional_snssai); + if (additional_snssai_local_JSON == NULL) { + ogs_error("OpenAPI_pdu_session_context_convertToJSON() failed [additional_snssai]"); + goto end; + } + cJSON_AddItemToObject(item, "additionalSnssai", additional_snssai_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_pdu_session_context_convertToJSON() failed [additional_snssai]"); + goto end; + } + } + + if (pdu_session_context->inter_plmn_api_root) { + if (cJSON_AddStringToObject(item, "interPlmnApiRoot", pdu_session_context->inter_plmn_api_root) == NULL) { + ogs_error("OpenAPI_pdu_session_context_convertToJSON() failed [inter_plmn_api_root]"); + goto end; + } + } + + if (pdu_session_context->pgw_fqdn) { + if (cJSON_AddStringToObject(item, "pgwFqdn", pdu_session_context->pgw_fqdn) == NULL) { + ogs_error("OpenAPI_pdu_session_context_convertToJSON() failed [pgw_fqdn]"); + goto end; + } + } + + if (pdu_session_context->pgw_ip_addr) { + cJSON *pgw_ip_addr_local_JSON = OpenAPI_ip_address_convertToJSON(pdu_session_context->pgw_ip_addr); + if (pgw_ip_addr_local_JSON == NULL) { + ogs_error("OpenAPI_pdu_session_context_convertToJSON() failed [pgw_ip_addr]"); + goto end; + } + cJSON_AddItemToObject(item, "pgwIpAddr", pgw_ip_addr_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_pdu_session_context_convertToJSON() failed [pgw_ip_addr]"); + goto end; + } + } + + if (pdu_session_context->plmn_id) { + cJSON *plmn_id_local_JSON = OpenAPI_plmn_id_convertToJSON(pdu_session_context->plmn_id); + if (plmn_id_local_JSON == NULL) { + ogs_error("OpenAPI_pdu_session_context_convertToJSON() failed [plmn_id]"); + goto end; + } + cJSON_AddItemToObject(item, "plmnId", plmn_id_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_pdu_session_context_convertToJSON() failed [plmn_id]"); + goto end; + } + } + + if (pdu_session_context->anchor_smf_supported_features) { + if (cJSON_AddStringToObject(item, "anchorSmfSupportedFeatures", pdu_session_context->anchor_smf_supported_features) == NULL) { + ogs_error("OpenAPI_pdu_session_context_convertToJSON() failed [anchor_smf_supported_features]"); + goto end; + } + } + + if (pdu_session_context->is_anchor_smf_oauth2_required) { + if (cJSON_AddBoolToObject(item, "anchorSmfOauth2Required", pdu_session_context->anchor_smf_oauth2_required) == NULL) { + ogs_error("OpenAPI_pdu_session_context_convertToJSON() failed [anchor_smf_oauth2_required]"); + goto end; + } + } + end: return item; } @@ -391,6 +576,22 @@ OpenAPI_pdu_session_context_t *OpenAPI_pdu_session_context_parseFromJSON(cJSON * cJSON *ma_pdu_session = NULL; cJSON *cn_assisted_ran_para = NULL; OpenAPI_cn_assisted_ran_para_t *cn_assisted_ran_para_local_nonprim = NULL; + cJSON *nrf_management_uri = NULL; + cJSON *nrf_discovery_uri = NULL; + cJSON *nrf_access_token_uri = NULL; + cJSON *smf_binding_info = NULL; + cJSON *vsmf_binding_info = NULL; + cJSON *ismf_binding_info = NULL; + cJSON *additional_snssai = NULL; + OpenAPI_snssai_t *additional_snssai_local_nonprim = NULL; + cJSON *inter_plmn_api_root = NULL; + cJSON *pgw_fqdn = NULL; + cJSON *pgw_ip_addr = NULL; + OpenAPI_ip_address_t *pgw_ip_addr_local_nonprim = NULL; + cJSON *plmn_id = NULL; + OpenAPI_plmn_id_t *plmn_id_local_nonprim = NULL; + cJSON *anchor_smf_supported_features = NULL; + cJSON *anchor_smf_oauth2_required = NULL; pdu_session_id = cJSON_GetObjectItemCaseSensitive(pdu_session_contextJSON, "pduSessionId"); if (!pdu_session_id) { ogs_error("OpenAPI_pdu_session_context_parseFromJSON() failed [pdu_session_id]"); @@ -609,6 +810,101 @@ OpenAPI_pdu_session_context_t *OpenAPI_pdu_session_context_parseFromJSON(cJSON * cn_assisted_ran_para_local_nonprim = OpenAPI_cn_assisted_ran_para_parseFromJSON(cn_assisted_ran_para); } + nrf_management_uri = cJSON_GetObjectItemCaseSensitive(pdu_session_contextJSON, "nrfManagementUri"); + if (nrf_management_uri) { + if (!cJSON_IsString(nrf_management_uri) && !cJSON_IsNull(nrf_management_uri)) { + ogs_error("OpenAPI_pdu_session_context_parseFromJSON() failed [nrf_management_uri]"); + goto end; + } + } + + nrf_discovery_uri = cJSON_GetObjectItemCaseSensitive(pdu_session_contextJSON, "nrfDiscoveryUri"); + if (nrf_discovery_uri) { + if (!cJSON_IsString(nrf_discovery_uri) && !cJSON_IsNull(nrf_discovery_uri)) { + ogs_error("OpenAPI_pdu_session_context_parseFromJSON() failed [nrf_discovery_uri]"); + goto end; + } + } + + nrf_access_token_uri = cJSON_GetObjectItemCaseSensitive(pdu_session_contextJSON, "nrfAccessTokenUri"); + if (nrf_access_token_uri) { + if (!cJSON_IsString(nrf_access_token_uri) && !cJSON_IsNull(nrf_access_token_uri)) { + ogs_error("OpenAPI_pdu_session_context_parseFromJSON() failed [nrf_access_token_uri]"); + goto end; + } + } + + smf_binding_info = cJSON_GetObjectItemCaseSensitive(pdu_session_contextJSON, "smfBindingInfo"); + if (smf_binding_info) { + if (!cJSON_IsString(smf_binding_info) && !cJSON_IsNull(smf_binding_info)) { + ogs_error("OpenAPI_pdu_session_context_parseFromJSON() failed [smf_binding_info]"); + goto end; + } + } + + vsmf_binding_info = cJSON_GetObjectItemCaseSensitive(pdu_session_contextJSON, "vsmfBindingInfo"); + if (vsmf_binding_info) { + if (!cJSON_IsString(vsmf_binding_info) && !cJSON_IsNull(vsmf_binding_info)) { + ogs_error("OpenAPI_pdu_session_context_parseFromJSON() failed [vsmf_binding_info]"); + goto end; + } + } + + ismf_binding_info = cJSON_GetObjectItemCaseSensitive(pdu_session_contextJSON, "ismfBindingInfo"); + if (ismf_binding_info) { + if (!cJSON_IsString(ismf_binding_info) && !cJSON_IsNull(ismf_binding_info)) { + ogs_error("OpenAPI_pdu_session_context_parseFromJSON() failed [ismf_binding_info]"); + goto end; + } + } + + additional_snssai = cJSON_GetObjectItemCaseSensitive(pdu_session_contextJSON, "additionalSnssai"); + if (additional_snssai) { + additional_snssai_local_nonprim = OpenAPI_snssai_parseFromJSON(additional_snssai); + } + + inter_plmn_api_root = cJSON_GetObjectItemCaseSensitive(pdu_session_contextJSON, "interPlmnApiRoot"); + if (inter_plmn_api_root) { + if (!cJSON_IsString(inter_plmn_api_root) && !cJSON_IsNull(inter_plmn_api_root)) { + ogs_error("OpenAPI_pdu_session_context_parseFromJSON() failed [inter_plmn_api_root]"); + goto end; + } + } + + pgw_fqdn = cJSON_GetObjectItemCaseSensitive(pdu_session_contextJSON, "pgwFqdn"); + if (pgw_fqdn) { + if (!cJSON_IsString(pgw_fqdn) && !cJSON_IsNull(pgw_fqdn)) { + ogs_error("OpenAPI_pdu_session_context_parseFromJSON() failed [pgw_fqdn]"); + goto end; + } + } + + pgw_ip_addr = cJSON_GetObjectItemCaseSensitive(pdu_session_contextJSON, "pgwIpAddr"); + if (pgw_ip_addr) { + pgw_ip_addr_local_nonprim = OpenAPI_ip_address_parseFromJSON(pgw_ip_addr); + } + + plmn_id = cJSON_GetObjectItemCaseSensitive(pdu_session_contextJSON, "plmnId"); + if (plmn_id) { + plmn_id_local_nonprim = OpenAPI_plmn_id_parseFromJSON(plmn_id); + } + + anchor_smf_supported_features = cJSON_GetObjectItemCaseSensitive(pdu_session_contextJSON, "anchorSmfSupportedFeatures"); + if (anchor_smf_supported_features) { + if (!cJSON_IsString(anchor_smf_supported_features) && !cJSON_IsNull(anchor_smf_supported_features)) { + ogs_error("OpenAPI_pdu_session_context_parseFromJSON() failed [anchor_smf_supported_features]"); + goto end; + } + } + + anchor_smf_oauth2_required = cJSON_GetObjectItemCaseSensitive(pdu_session_contextJSON, "anchorSmfOauth2Required"); + if (anchor_smf_oauth2_required) { + if (!cJSON_IsBool(anchor_smf_oauth2_required)) { + ogs_error("OpenAPI_pdu_session_context_parseFromJSON() failed [anchor_smf_oauth2_required]"); + goto end; + } + } + pdu_session_context_local_var = OpenAPI_pdu_session_context_create ( pdu_session_id->valuedouble, @@ -635,7 +931,21 @@ OpenAPI_pdu_session_context_t *OpenAPI_pdu_session_context_parseFromJSON(cJSON * smf_service_instance_id && !cJSON_IsNull(smf_service_instance_id) ? ogs_strdup(smf_service_instance_id->valuestring) : NULL, ma_pdu_session ? true : false, ma_pdu_session ? ma_pdu_session->valueint : 0, - cn_assisted_ran_para ? cn_assisted_ran_para_local_nonprim : NULL + cn_assisted_ran_para ? cn_assisted_ran_para_local_nonprim : NULL, + nrf_management_uri && !cJSON_IsNull(nrf_management_uri) ? ogs_strdup(nrf_management_uri->valuestring) : NULL, + nrf_discovery_uri && !cJSON_IsNull(nrf_discovery_uri) ? ogs_strdup(nrf_discovery_uri->valuestring) : NULL, + nrf_access_token_uri && !cJSON_IsNull(nrf_access_token_uri) ? ogs_strdup(nrf_access_token_uri->valuestring) : NULL, + smf_binding_info && !cJSON_IsNull(smf_binding_info) ? ogs_strdup(smf_binding_info->valuestring) : NULL, + vsmf_binding_info && !cJSON_IsNull(vsmf_binding_info) ? ogs_strdup(vsmf_binding_info->valuestring) : NULL, + ismf_binding_info && !cJSON_IsNull(ismf_binding_info) ? ogs_strdup(ismf_binding_info->valuestring) : NULL, + additional_snssai ? additional_snssai_local_nonprim : NULL, + inter_plmn_api_root && !cJSON_IsNull(inter_plmn_api_root) ? ogs_strdup(inter_plmn_api_root->valuestring) : NULL, + pgw_fqdn && !cJSON_IsNull(pgw_fqdn) ? ogs_strdup(pgw_fqdn->valuestring) : NULL, + pgw_ip_addr ? pgw_ip_addr_local_nonprim : NULL, + plmn_id ? plmn_id_local_nonprim : NULL, + anchor_smf_supported_features && !cJSON_IsNull(anchor_smf_supported_features) ? ogs_strdup(anchor_smf_supported_features->valuestring) : NULL, + anchor_smf_oauth2_required ? true : false, + anchor_smf_oauth2_required ? anchor_smf_oauth2_required->valueint : 0 ); return pdu_session_context_local_var; @@ -655,6 +965,18 @@ end: OpenAPI_cn_assisted_ran_para_free(cn_assisted_ran_para_local_nonprim); cn_assisted_ran_para_local_nonprim = NULL; } + if (additional_snssai_local_nonprim) { + OpenAPI_snssai_free(additional_snssai_local_nonprim); + additional_snssai_local_nonprim = NULL; + } + if (pgw_ip_addr_local_nonprim) { + OpenAPI_ip_address_free(pgw_ip_addr_local_nonprim); + pgw_ip_addr_local_nonprim = NULL; + } + if (plmn_id_local_nonprim) { + OpenAPI_plmn_id_free(plmn_id_local_nonprim); + plmn_id_local_nonprim = NULL; + } return NULL; } diff --git a/lib/sbi/openapi/model/pdu_session_context.h b/lib/sbi/openapi/model/pdu_session_context.h index 9ce66a6c8..7fc36e938 100644 --- a/lib/sbi/openapi/model/pdu_session_context.h +++ b/lib/sbi/openapi/model/pdu_session_context.h @@ -1,7 +1,7 @@ /* * pdu_session_context.h * - * + * Represents a PDU Session Context in UE Context */ #ifndef _OpenAPI_pdu_session_context_H_ @@ -15,6 +15,8 @@ #include "access_type.h" #include "cn_assisted_ran_para.h" #include "ebi_arp_mapping.h" +#include "ip_address.h" +#include "plmn_id.h" #include "sbi_binding_level.h" #include "snssai.h" @@ -49,6 +51,20 @@ typedef struct OpenAPI_pdu_session_context_s { bool is_ma_pdu_session; int ma_pdu_session; struct OpenAPI_cn_assisted_ran_para_s *cn_assisted_ran_para; + char *nrf_management_uri; + char *nrf_discovery_uri; + char *nrf_access_token_uri; + char *smf_binding_info; + char *vsmf_binding_info; + char *ismf_binding_info; + struct OpenAPI_snssai_s *additional_snssai; + char *inter_plmn_api_root; + char *pgw_fqdn; + struct OpenAPI_ip_address_s *pgw_ip_addr; + struct OpenAPI_plmn_id_s *plmn_id; + char *anchor_smf_supported_features; + bool is_anchor_smf_oauth2_required; + int anchor_smf_oauth2_required; } OpenAPI_pdu_session_context_t; OpenAPI_pdu_session_context_t *OpenAPI_pdu_session_context_create( @@ -76,7 +92,21 @@ OpenAPI_pdu_session_context_t *OpenAPI_pdu_session_context_create( char *smf_service_instance_id, bool is_ma_pdu_session, int ma_pdu_session, - OpenAPI_cn_assisted_ran_para_t *cn_assisted_ran_para + OpenAPI_cn_assisted_ran_para_t *cn_assisted_ran_para, + char *nrf_management_uri, + char *nrf_discovery_uri, + char *nrf_access_token_uri, + char *smf_binding_info, + char *vsmf_binding_info, + char *ismf_binding_info, + OpenAPI_snssai_t *additional_snssai, + char *inter_plmn_api_root, + char *pgw_fqdn, + OpenAPI_ip_address_t *pgw_ip_addr, + OpenAPI_plmn_id_t *plmn_id, + char *anchor_smf_supported_features, + bool is_anchor_smf_oauth2_required, + int anchor_smf_oauth2_required ); void OpenAPI_pdu_session_context_free(OpenAPI_pdu_session_context_t *pdu_session_context); OpenAPI_pdu_session_context_t *OpenAPI_pdu_session_context_parseFromJSON(cJSON *pdu_session_contextJSON); diff --git a/lib/sbi/openapi/model/pdu_session_context_type.c b/lib/sbi/openapi/model/pdu_session_context_type.c new file mode 100644 index 000000000..b79b427ff --- /dev/null +++ b/lib/sbi/openapi/model/pdu_session_context_type.c @@ -0,0 +1,30 @@ + +#include +#include +#include +#include "pdu_session_context_type.h" + +char* OpenAPI_pdu_session_context_type_ToString(OpenAPI_pdu_session_context_type_e pdu_session_context_type) +{ + const char *pdu_session_context_typeArray[] = { "NULL", "AF_COORDINATION_INFO" }; + size_t sizeofArray = sizeof(pdu_session_context_typeArray) / sizeof(pdu_session_context_typeArray[0]); + if (pdu_session_context_type < sizeofArray) + return (char *)pdu_session_context_typeArray[pdu_session_context_type]; + else + return (char *)"Unknown"; +} + +OpenAPI_pdu_session_context_type_e OpenAPI_pdu_session_context_type_FromString(char* pdu_session_context_type) +{ + int stringToReturn = 0; + const char *pdu_session_context_typeArray[] = { "NULL", "AF_COORDINATION_INFO" }; + size_t sizeofArray = sizeof(pdu_session_context_typeArray) / sizeof(pdu_session_context_typeArray[0]); + while (stringToReturn < sizeofArray) { + if (strcmp(pdu_session_context_type, pdu_session_context_typeArray[stringToReturn]) == 0) { + return stringToReturn; + } + stringToReturn++; + } + return 0; +} + diff --git a/lib/sbi/openapi/model/pdu_session_context_type.h b/lib/sbi/openapi/model/pdu_session_context_type.h new file mode 100644 index 000000000..64fabe4b3 --- /dev/null +++ b/lib/sbi/openapi/model/pdu_session_context_type.h @@ -0,0 +1,31 @@ +/* + * pdu_session_context_type.h + * + * + */ + +#ifndef _OpenAPI_pdu_session_context_type_H_ +#define _OpenAPI_pdu_session_context_type_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef enum { OpenAPI_pdu_session_context_type_NULL = 0, OpenAPI_pdu_session_context_type_AF_COORDINATION_INFO } OpenAPI_pdu_session_context_type_e; + +char* OpenAPI_pdu_session_context_type_ToString(OpenAPI_pdu_session_context_type_e pdu_session_context_type); + +OpenAPI_pdu_session_context_type_e OpenAPI_pdu_session_context_type_FromString(char* pdu_session_context_type); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_pdu_session_context_type_H_ */ + diff --git a/lib/sbi/openapi/model/pdu_session_create_data.c b/lib/sbi/openapi/model/pdu_session_create_data.c index 81b9cc91d..b65ceef2f 100644 --- a/lib/sbi/openapi/model/pdu_session_create_data.c +++ b/lib/sbi/openapi/model/pdu_session_create_data.c @@ -14,6 +14,7 @@ OpenAPI_pdu_session_create_data_t *OpenAPI_pdu_session_create_data_create( char *dnn, char *selected_dnn, OpenAPI_snssai_t *s_nssai, + OpenAPI_snssai_t *hplmn_snssai, char *vsmf_id, char *ismf_id, OpenAPI_plmn_id_nid_t *serving_network, @@ -47,6 +48,8 @@ OpenAPI_pdu_session_create_data_t *OpenAPI_pdu_session_create_data_create( int always_on_requested, char *udm_group_id, char *routing_indicator, + bool is_h_nw_pub_key_id, + int h_nw_pub_key_id, OpenAPI_eps_interworking_indication_e eps_interworking_ind, char *v_smf_service_instance_id, char *i_smf_service_instance_id, @@ -78,7 +81,19 @@ OpenAPI_pdu_session_create_data_t *OpenAPI_pdu_session_create_data_create( bool is_dl_serving_plmn_rate_ctl, int dl_serving_plmn_rate_ctl, OpenAPI_up_security_info_t *up_security_info, - OpenAPI_vplmn_qos_t *vplmn_qos + OpenAPI_vplmn_qos_t *vplmn_qos, + char *old_sm_context_ref, + OpenAPI_redundant_pdu_session_information_t *redundant_pdu_session_info, + char *old_pdu_session_ref, + bool is_sm_policy_notify_ind, + int sm_policy_notify_ind, + OpenAPI_pcf_ue_callback_info_t *pcf_ue_callback_info, + OpenAPI_satellite_backhaul_category_e satellite_backhaul_cat, + bool is_upip_supported, + int upip_supported, + OpenAPI_up_cnx_state_e up_cnx_state, + bool is_disaster_roaming_ind, + int disaster_roaming_ind ) { OpenAPI_pdu_session_create_data_t *pdu_session_create_data_local_var = ogs_malloc(sizeof(OpenAPI_pdu_session_create_data_t)); @@ -93,6 +108,7 @@ OpenAPI_pdu_session_create_data_t *OpenAPI_pdu_session_create_data_create( pdu_session_create_data_local_var->dnn = dnn; pdu_session_create_data_local_var->selected_dnn = selected_dnn; pdu_session_create_data_local_var->s_nssai = s_nssai; + pdu_session_create_data_local_var->hplmn_snssai = hplmn_snssai; pdu_session_create_data_local_var->vsmf_id = vsmf_id; pdu_session_create_data_local_var->ismf_id = ismf_id; pdu_session_create_data_local_var->serving_network = serving_network; @@ -126,6 +142,8 @@ OpenAPI_pdu_session_create_data_t *OpenAPI_pdu_session_create_data_create( pdu_session_create_data_local_var->always_on_requested = always_on_requested; pdu_session_create_data_local_var->udm_group_id = udm_group_id; pdu_session_create_data_local_var->routing_indicator = routing_indicator; + pdu_session_create_data_local_var->is_h_nw_pub_key_id = is_h_nw_pub_key_id; + pdu_session_create_data_local_var->h_nw_pub_key_id = h_nw_pub_key_id; pdu_session_create_data_local_var->eps_interworking_ind = eps_interworking_ind; pdu_session_create_data_local_var->v_smf_service_instance_id = v_smf_service_instance_id; pdu_session_create_data_local_var->i_smf_service_instance_id = i_smf_service_instance_id; @@ -158,6 +176,18 @@ OpenAPI_pdu_session_create_data_t *OpenAPI_pdu_session_create_data_create( pdu_session_create_data_local_var->dl_serving_plmn_rate_ctl = dl_serving_plmn_rate_ctl; pdu_session_create_data_local_var->up_security_info = up_security_info; pdu_session_create_data_local_var->vplmn_qos = vplmn_qos; + pdu_session_create_data_local_var->old_sm_context_ref = old_sm_context_ref; + pdu_session_create_data_local_var->redundant_pdu_session_info = redundant_pdu_session_info; + pdu_session_create_data_local_var->old_pdu_session_ref = old_pdu_session_ref; + pdu_session_create_data_local_var->is_sm_policy_notify_ind = is_sm_policy_notify_ind; + pdu_session_create_data_local_var->sm_policy_notify_ind = sm_policy_notify_ind; + pdu_session_create_data_local_var->pcf_ue_callback_info = pcf_ue_callback_info; + pdu_session_create_data_local_var->satellite_backhaul_cat = satellite_backhaul_cat; + pdu_session_create_data_local_var->is_upip_supported = is_upip_supported; + pdu_session_create_data_local_var->upip_supported = upip_supported; + pdu_session_create_data_local_var->up_cnx_state = up_cnx_state; + pdu_session_create_data_local_var->is_disaster_roaming_ind = is_disaster_roaming_ind; + pdu_session_create_data_local_var->disaster_roaming_ind = disaster_roaming_ind; return pdu_session_create_data_local_var; } @@ -189,6 +219,10 @@ void OpenAPI_pdu_session_create_data_free(OpenAPI_pdu_session_create_data_t *pdu OpenAPI_snssai_free(pdu_session_create_data->s_nssai); pdu_session_create_data->s_nssai = NULL; } + if (pdu_session_create_data->hplmn_snssai) { + OpenAPI_snssai_free(pdu_session_create_data->hplmn_snssai); + pdu_session_create_data->hplmn_snssai = NULL; + } if (pdu_session_create_data->vsmf_id) { ogs_free(pdu_session_create_data->vsmf_id); pdu_session_create_data->vsmf_id = NULL; @@ -350,6 +384,22 @@ void OpenAPI_pdu_session_create_data_free(OpenAPI_pdu_session_create_data_t *pdu OpenAPI_vplmn_qos_free(pdu_session_create_data->vplmn_qos); pdu_session_create_data->vplmn_qos = NULL; } + if (pdu_session_create_data->old_sm_context_ref) { + ogs_free(pdu_session_create_data->old_sm_context_ref); + pdu_session_create_data->old_sm_context_ref = NULL; + } + if (pdu_session_create_data->redundant_pdu_session_info) { + OpenAPI_redundant_pdu_session_information_free(pdu_session_create_data->redundant_pdu_session_info); + pdu_session_create_data->redundant_pdu_session_info = NULL; + } + if (pdu_session_create_data->old_pdu_session_ref) { + ogs_free(pdu_session_create_data->old_pdu_session_ref); + pdu_session_create_data->old_pdu_session_ref = NULL; + } + if (pdu_session_create_data->pcf_ue_callback_info) { + OpenAPI_pcf_ue_callback_info_free(pdu_session_create_data->pcf_ue_callback_info); + pdu_session_create_data->pcf_ue_callback_info = NULL; + } ogs_free(pdu_session_create_data); } @@ -421,6 +471,19 @@ cJSON *OpenAPI_pdu_session_create_data_convertToJSON(OpenAPI_pdu_session_create_ } } + if (pdu_session_create_data->hplmn_snssai) { + cJSON *hplmn_snssai_local_JSON = OpenAPI_snssai_convertToJSON(pdu_session_create_data->hplmn_snssai); + if (hplmn_snssai_local_JSON == NULL) { + ogs_error("OpenAPI_pdu_session_create_data_convertToJSON() failed [hplmn_snssai]"); + goto end; + } + cJSON_AddItemToObject(item, "hplmnSnssai", hplmn_snssai_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_pdu_session_create_data_convertToJSON() failed [hplmn_snssai]"); + goto end; + } + } + if (pdu_session_create_data->vsmf_id) { if (cJSON_AddStringToObject(item, "vsmfId", pdu_session_create_data->vsmf_id) == NULL) { ogs_error("OpenAPI_pdu_session_create_data_convertToJSON() failed [vsmf_id]"); @@ -703,6 +766,13 @@ cJSON *OpenAPI_pdu_session_create_data_convertToJSON(OpenAPI_pdu_session_create_ } } + if (pdu_session_create_data->is_h_nw_pub_key_id) { + if (cJSON_AddNumberToObject(item, "hNwPubKeyId", pdu_session_create_data->h_nw_pub_key_id) == NULL) { + ogs_error("OpenAPI_pdu_session_create_data_convertToJSON() failed [h_nw_pub_key_id]"); + goto end; + } + } + if (pdu_session_create_data->eps_interworking_ind != OpenAPI_eps_interworking_indication_NULL) { if (cJSON_AddStringToObject(item, "epsInterworkingInd", OpenAPI_eps_interworking_indication_ToString(pdu_session_create_data->eps_interworking_ind)) == NULL) { ogs_error("OpenAPI_pdu_session_create_data_convertToJSON() failed [eps_interworking_ind]"); @@ -930,6 +1000,81 @@ cJSON *OpenAPI_pdu_session_create_data_convertToJSON(OpenAPI_pdu_session_create_ } } + if (pdu_session_create_data->old_sm_context_ref) { + if (cJSON_AddStringToObject(item, "oldSmContextRef", pdu_session_create_data->old_sm_context_ref) == NULL) { + ogs_error("OpenAPI_pdu_session_create_data_convertToJSON() failed [old_sm_context_ref]"); + goto end; + } + } + + if (pdu_session_create_data->redundant_pdu_session_info) { + cJSON *redundant_pdu_session_info_local_JSON = OpenAPI_redundant_pdu_session_information_convertToJSON(pdu_session_create_data->redundant_pdu_session_info); + if (redundant_pdu_session_info_local_JSON == NULL) { + ogs_error("OpenAPI_pdu_session_create_data_convertToJSON() failed [redundant_pdu_session_info]"); + goto end; + } + cJSON_AddItemToObject(item, "redundantPduSessionInfo", redundant_pdu_session_info_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_pdu_session_create_data_convertToJSON() failed [redundant_pdu_session_info]"); + goto end; + } + } + + if (pdu_session_create_data->old_pdu_session_ref) { + if (cJSON_AddStringToObject(item, "oldPduSessionRef", pdu_session_create_data->old_pdu_session_ref) == NULL) { + ogs_error("OpenAPI_pdu_session_create_data_convertToJSON() failed [old_pdu_session_ref]"); + goto end; + } + } + + if (pdu_session_create_data->is_sm_policy_notify_ind) { + if (cJSON_AddBoolToObject(item, "smPolicyNotifyInd", pdu_session_create_data->sm_policy_notify_ind) == NULL) { + ogs_error("OpenAPI_pdu_session_create_data_convertToJSON() failed [sm_policy_notify_ind]"); + goto end; + } + } + + if (pdu_session_create_data->pcf_ue_callback_info) { + cJSON *pcf_ue_callback_info_local_JSON = OpenAPI_pcf_ue_callback_info_convertToJSON(pdu_session_create_data->pcf_ue_callback_info); + if (pcf_ue_callback_info_local_JSON == NULL) { + ogs_error("OpenAPI_pdu_session_create_data_convertToJSON() failed [pcf_ue_callback_info]"); + goto end; + } + cJSON_AddItemToObject(item, "pcfUeCallbackInfo", pcf_ue_callback_info_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_pdu_session_create_data_convertToJSON() failed [pcf_ue_callback_info]"); + goto end; + } + } + + if (pdu_session_create_data->satellite_backhaul_cat != OpenAPI_satellite_backhaul_category_NULL) { + if (cJSON_AddStringToObject(item, "satelliteBackhaulCat", OpenAPI_satellite_backhaul_category_ToString(pdu_session_create_data->satellite_backhaul_cat)) == NULL) { + ogs_error("OpenAPI_pdu_session_create_data_convertToJSON() failed [satellite_backhaul_cat]"); + goto end; + } + } + + if (pdu_session_create_data->is_upip_supported) { + if (cJSON_AddBoolToObject(item, "upipSupported", pdu_session_create_data->upip_supported) == NULL) { + ogs_error("OpenAPI_pdu_session_create_data_convertToJSON() failed [upip_supported]"); + goto end; + } + } + + if (pdu_session_create_data->up_cnx_state != OpenAPI_up_cnx_state_NULL) { + if (cJSON_AddStringToObject(item, "upCnxState", OpenAPI_up_cnx_state_ToString(pdu_session_create_data->up_cnx_state)) == NULL) { + ogs_error("OpenAPI_pdu_session_create_data_convertToJSON() failed [up_cnx_state]"); + goto end; + } + } + + if (pdu_session_create_data->is_disaster_roaming_ind) { + if (cJSON_AddBoolToObject(item, "disasterRoamingInd", pdu_session_create_data->disaster_roaming_ind) == NULL) { + ogs_error("OpenAPI_pdu_session_create_data_convertToJSON() failed [disaster_roaming_ind]"); + goto end; + } + } + end: return item; } @@ -946,6 +1091,8 @@ OpenAPI_pdu_session_create_data_t *OpenAPI_pdu_session_create_data_parseFromJSON cJSON *selected_dnn = NULL; cJSON *s_nssai = NULL; OpenAPI_snssai_t *s_nssai_local_nonprim = NULL; + cJSON *hplmn_snssai = NULL; + OpenAPI_snssai_t *hplmn_snssai_local_nonprim = NULL; cJSON *vsmf_id = NULL; cJSON *ismf_id = NULL; cJSON *serving_network = NULL; @@ -992,6 +1139,7 @@ OpenAPI_pdu_session_create_data_t *OpenAPI_pdu_session_create_data_parseFromJSON cJSON *always_on_requested = NULL; cJSON *udm_group_id = NULL; cJSON *routing_indicator = NULL; + cJSON *h_nw_pub_key_id = NULL; cJSON *eps_interworking_ind = NULL; OpenAPI_eps_interworking_indication_e eps_interworking_indVariable = 0; cJSON *v_smf_service_instance_id = NULL; @@ -1029,6 +1177,19 @@ OpenAPI_pdu_session_create_data_t *OpenAPI_pdu_session_create_data_parseFromJSON OpenAPI_up_security_info_t *up_security_info_local_nonprim = NULL; cJSON *vplmn_qos = NULL; OpenAPI_vplmn_qos_t *vplmn_qos_local_nonprim = NULL; + cJSON *old_sm_context_ref = NULL; + cJSON *redundant_pdu_session_info = NULL; + OpenAPI_redundant_pdu_session_information_t *redundant_pdu_session_info_local_nonprim = NULL; + cJSON *old_pdu_session_ref = NULL; + cJSON *sm_policy_notify_ind = NULL; + cJSON *pcf_ue_callback_info = NULL; + OpenAPI_pcf_ue_callback_info_t *pcf_ue_callback_info_local_nonprim = NULL; + cJSON *satellite_backhaul_cat = NULL; + OpenAPI_satellite_backhaul_category_e satellite_backhaul_catVariable = 0; + cJSON *upip_supported = NULL; + cJSON *up_cnx_state = NULL; + OpenAPI_up_cnx_state_e up_cnx_stateVariable = 0; + cJSON *disaster_roaming_ind = NULL; supi = cJSON_GetObjectItemCaseSensitive(pdu_session_create_dataJSON, "supi"); if (supi) { if (!cJSON_IsString(supi) && !cJSON_IsNull(supi)) { @@ -1084,6 +1245,11 @@ OpenAPI_pdu_session_create_data_t *OpenAPI_pdu_session_create_data_parseFromJSON s_nssai_local_nonprim = OpenAPI_snssai_parseFromJSON(s_nssai); } + hplmn_snssai = cJSON_GetObjectItemCaseSensitive(pdu_session_create_dataJSON, "hplmnSnssai"); + if (hplmn_snssai) { + hplmn_snssai_local_nonprim = OpenAPI_snssai_parseFromJSON(hplmn_snssai); + } + vsmf_id = cJSON_GetObjectItemCaseSensitive(pdu_session_create_dataJSON, "vsmfId"); if (vsmf_id) { if (!cJSON_IsString(vsmf_id) && !cJSON_IsNull(vsmf_id)) { @@ -1333,6 +1499,14 @@ OpenAPI_pdu_session_create_data_t *OpenAPI_pdu_session_create_data_parseFromJSON } } + h_nw_pub_key_id = cJSON_GetObjectItemCaseSensitive(pdu_session_create_dataJSON, "hNwPubKeyId"); + if (h_nw_pub_key_id) { + if (!cJSON_IsNumber(h_nw_pub_key_id)) { + ogs_error("OpenAPI_pdu_session_create_data_parseFromJSON() failed [h_nw_pub_key_id]"); + goto end; + } + } + eps_interworking_ind = cJSON_GetObjectItemCaseSensitive(pdu_session_create_dataJSON, "epsInterworkingInd"); if (eps_interworking_ind) { if (!cJSON_IsString(eps_interworking_ind)) { @@ -1549,6 +1723,74 @@ OpenAPI_pdu_session_create_data_t *OpenAPI_pdu_session_create_data_parseFromJSON vplmn_qos_local_nonprim = OpenAPI_vplmn_qos_parseFromJSON(vplmn_qos); } + old_sm_context_ref = cJSON_GetObjectItemCaseSensitive(pdu_session_create_dataJSON, "oldSmContextRef"); + if (old_sm_context_ref) { + if (!cJSON_IsString(old_sm_context_ref) && !cJSON_IsNull(old_sm_context_ref)) { + ogs_error("OpenAPI_pdu_session_create_data_parseFromJSON() failed [old_sm_context_ref]"); + goto end; + } + } + + redundant_pdu_session_info = cJSON_GetObjectItemCaseSensitive(pdu_session_create_dataJSON, "redundantPduSessionInfo"); + if (redundant_pdu_session_info) { + redundant_pdu_session_info_local_nonprim = OpenAPI_redundant_pdu_session_information_parseFromJSON(redundant_pdu_session_info); + } + + old_pdu_session_ref = cJSON_GetObjectItemCaseSensitive(pdu_session_create_dataJSON, "oldPduSessionRef"); + if (old_pdu_session_ref) { + if (!cJSON_IsString(old_pdu_session_ref) && !cJSON_IsNull(old_pdu_session_ref)) { + ogs_error("OpenAPI_pdu_session_create_data_parseFromJSON() failed [old_pdu_session_ref]"); + goto end; + } + } + + sm_policy_notify_ind = cJSON_GetObjectItemCaseSensitive(pdu_session_create_dataJSON, "smPolicyNotifyInd"); + if (sm_policy_notify_ind) { + if (!cJSON_IsBool(sm_policy_notify_ind)) { + ogs_error("OpenAPI_pdu_session_create_data_parseFromJSON() failed [sm_policy_notify_ind]"); + goto end; + } + } + + pcf_ue_callback_info = cJSON_GetObjectItemCaseSensitive(pdu_session_create_dataJSON, "pcfUeCallbackInfo"); + if (pcf_ue_callback_info) { + pcf_ue_callback_info_local_nonprim = OpenAPI_pcf_ue_callback_info_parseFromJSON(pcf_ue_callback_info); + } + + satellite_backhaul_cat = cJSON_GetObjectItemCaseSensitive(pdu_session_create_dataJSON, "satelliteBackhaulCat"); + if (satellite_backhaul_cat) { + if (!cJSON_IsString(satellite_backhaul_cat)) { + ogs_error("OpenAPI_pdu_session_create_data_parseFromJSON() failed [satellite_backhaul_cat]"); + goto end; + } + satellite_backhaul_catVariable = OpenAPI_satellite_backhaul_category_FromString(satellite_backhaul_cat->valuestring); + } + + upip_supported = cJSON_GetObjectItemCaseSensitive(pdu_session_create_dataJSON, "upipSupported"); + if (upip_supported) { + if (!cJSON_IsBool(upip_supported)) { + ogs_error("OpenAPI_pdu_session_create_data_parseFromJSON() failed [upip_supported]"); + goto end; + } + } + + up_cnx_state = cJSON_GetObjectItemCaseSensitive(pdu_session_create_dataJSON, "upCnxState"); + if (up_cnx_state) { + if (!cJSON_IsString(up_cnx_state)) { + ogs_error("OpenAPI_pdu_session_create_data_parseFromJSON() failed [up_cnx_state]"); + goto end; + } + up_cnx_stateVariable = OpenAPI_up_cnx_state_FromString(up_cnx_state->valuestring); + } + + disaster_roaming_ind = cJSON_GetObjectItemCaseSensitive(pdu_session_create_dataJSON, "disasterRoamingInd"); + if (disaster_roaming_ind) { + if (!cJSON_IsBool(disaster_roaming_ind)) { + ogs_error("OpenAPI_pdu_session_create_data_parseFromJSON() failed [disaster_roaming_ind]"); + goto end; + } + } + pdu_session_create_data_local_var = OpenAPI_pdu_session_create_data_create ( supi && !cJSON_IsNull(supi) ? ogs_strdup(supi->valuestring) : NULL, unauthenticated_supi ? true : false, @@ -1559,6 +1801,7 @@ OpenAPI_pdu_session_create_data_t *OpenAPI_pdu_session_create_data_parseFromJSON ogs_strdup(dnn->valuestring), selected_dnn && !cJSON_IsNull(selected_dnn) ? ogs_strdup(selected_dnn->valuestring) : NULL, s_nssai ? s_nssai_local_nonprim : NULL, + hplmn_snssai ? hplmn_snssai_local_nonprim : NULL, vsmf_id && !cJSON_IsNull(vsmf_id) ? ogs_strdup(vsmf_id->valuestring) : NULL, ismf_id && !cJSON_IsNull(ismf_id) ? ogs_strdup(ismf_id->valuestring) : NULL, serving_network_local_nonprim, @@ -1592,6 +1835,8 @@ OpenAPI_pdu_session_create_data_t *OpenAPI_pdu_session_create_data_parseFromJSON always_on_requested ? always_on_requested->valueint : 0, udm_group_id && !cJSON_IsNull(udm_group_id) ? ogs_strdup(udm_group_id->valuestring) : NULL, routing_indicator && !cJSON_IsNull(routing_indicator) ? ogs_strdup(routing_indicator->valuestring) : NULL, + h_nw_pub_key_id ? true : false, + h_nw_pub_key_id ? h_nw_pub_key_id->valuedouble : 0, eps_interworking_ind ? eps_interworking_indVariable : 0, v_smf_service_instance_id && !cJSON_IsNull(v_smf_service_instance_id) ? ogs_strdup(v_smf_service_instance_id->valuestring) : NULL, i_smf_service_instance_id && !cJSON_IsNull(i_smf_service_instance_id) ? ogs_strdup(i_smf_service_instance_id->valuestring) : NULL, @@ -1623,7 +1868,19 @@ OpenAPI_pdu_session_create_data_t *OpenAPI_pdu_session_create_data_parseFromJSON dl_serving_plmn_rate_ctl ? true : false, dl_serving_plmn_rate_ctl ? dl_serving_plmn_rate_ctl->valuedouble : 0, up_security_info ? up_security_info_local_nonprim : NULL, - vplmn_qos ? vplmn_qos_local_nonprim : NULL + vplmn_qos ? vplmn_qos_local_nonprim : NULL, + old_sm_context_ref && !cJSON_IsNull(old_sm_context_ref) ? ogs_strdup(old_sm_context_ref->valuestring) : NULL, + redundant_pdu_session_info ? redundant_pdu_session_info_local_nonprim : NULL, + old_pdu_session_ref && !cJSON_IsNull(old_pdu_session_ref) ? ogs_strdup(old_pdu_session_ref->valuestring) : NULL, + sm_policy_notify_ind ? true : false, + sm_policy_notify_ind ? sm_policy_notify_ind->valueint : 0, + pcf_ue_callback_info ? pcf_ue_callback_info_local_nonprim : NULL, + satellite_backhaul_cat ? satellite_backhaul_catVariable : 0, + upip_supported ? true : false, + upip_supported ? upip_supported->valueint : 0, + up_cnx_state ? up_cnx_stateVariable : 0, + disaster_roaming_ind ? true : false, + disaster_roaming_ind ? disaster_roaming_ind->valueint : 0 ); return pdu_session_create_data_local_var; @@ -1632,6 +1889,10 @@ end: OpenAPI_snssai_free(s_nssai_local_nonprim); s_nssai_local_nonprim = NULL; } + if (hplmn_snssai_local_nonprim) { + OpenAPI_snssai_free(hplmn_snssai_local_nonprim); + hplmn_snssai_local_nonprim = NULL; + } if (serving_network_local_nonprim) { OpenAPI_plmn_id_nid_free(serving_network_local_nonprim); serving_network_local_nonprim = NULL; @@ -1713,6 +1974,14 @@ end: OpenAPI_vplmn_qos_free(vplmn_qos_local_nonprim); vplmn_qos_local_nonprim = NULL; } + if (redundant_pdu_session_info_local_nonprim) { + OpenAPI_redundant_pdu_session_information_free(redundant_pdu_session_info_local_nonprim); + redundant_pdu_session_info_local_nonprim = NULL; + } + if (pcf_ue_callback_info_local_nonprim) { + OpenAPI_pcf_ue_callback_info_free(pcf_ue_callback_info_local_nonprim); + pcf_ue_callback_info_local_nonprim = NULL; + } return NULL; } diff --git a/lib/sbi/openapi/model/pdu_session_create_data.h b/lib/sbi/openapi/model/pdu_session_create_data.h index a5d602afc..1b4f3580f 100644 --- a/lib/sbi/openapi/model/pdu_session_create_data.h +++ b/lib/sbi/openapi/model/pdu_session_create_data.h @@ -1,7 +1,7 @@ /* * pdu_session_create_data.h * - * + * Data within Create Request */ #ifndef _OpenAPI_pdu_session_create_data_H_ @@ -18,16 +18,20 @@ #include "eps_interworking_indication.h" #include "guami.h" #include "max_integrity_protected_data_rate.h" +#include "pcf_ue_callback_info.h" #include "plmn_id_nid.h" #include "presence_state.h" #include "rat_type.h" +#include "redundant_pdu_session_information.h" #include "ref_to_binary_data.h" #include "request_type.h" #include "roaming_charging_profile.h" +#include "satellite_backhaul_category.h" #include "secondary_rat_usage_info.h" #include "small_data_rate_status.h" #include "snssai.h" #include "tunnel_info.h" +#include "up_cnx_state.h" #include "up_security_info.h" #include "user_location.h" #include "vplmn_qos.h" @@ -47,6 +51,7 @@ typedef struct OpenAPI_pdu_session_create_data_s { char *dnn; char *selected_dnn; struct OpenAPI_snssai_s *s_nssai; + struct OpenAPI_snssai_s *hplmn_snssai; char *vsmf_id; char *ismf_id; struct OpenAPI_plmn_id_nid_s *serving_network; @@ -80,6 +85,8 @@ typedef struct OpenAPI_pdu_session_create_data_s { int always_on_requested; char *udm_group_id; char *routing_indicator; + bool is_h_nw_pub_key_id; + int h_nw_pub_key_id; OpenAPI_eps_interworking_indication_e eps_interworking_ind; char *v_smf_service_instance_id; char *i_smf_service_instance_id; @@ -112,6 +119,18 @@ typedef struct OpenAPI_pdu_session_create_data_s { int dl_serving_plmn_rate_ctl; struct OpenAPI_up_security_info_s *up_security_info; struct OpenAPI_vplmn_qos_s *vplmn_qos; + char *old_sm_context_ref; + struct OpenAPI_redundant_pdu_session_information_s *redundant_pdu_session_info; + char *old_pdu_session_ref; + bool is_sm_policy_notify_ind; + int sm_policy_notify_ind; + struct OpenAPI_pcf_ue_callback_info_s *pcf_ue_callback_info; + OpenAPI_satellite_backhaul_category_e satellite_backhaul_cat; + bool is_upip_supported; + int upip_supported; + OpenAPI_up_cnx_state_e up_cnx_state; + bool is_disaster_roaming_ind; + int disaster_roaming_ind; } OpenAPI_pdu_session_create_data_t; OpenAPI_pdu_session_create_data_t *OpenAPI_pdu_session_create_data_create( @@ -124,6 +143,7 @@ OpenAPI_pdu_session_create_data_t *OpenAPI_pdu_session_create_data_create( char *dnn, char *selected_dnn, OpenAPI_snssai_t *s_nssai, + OpenAPI_snssai_t *hplmn_snssai, char *vsmf_id, char *ismf_id, OpenAPI_plmn_id_nid_t *serving_network, @@ -157,6 +177,8 @@ OpenAPI_pdu_session_create_data_t *OpenAPI_pdu_session_create_data_create( int always_on_requested, char *udm_group_id, char *routing_indicator, + bool is_h_nw_pub_key_id, + int h_nw_pub_key_id, OpenAPI_eps_interworking_indication_e eps_interworking_ind, char *v_smf_service_instance_id, char *i_smf_service_instance_id, @@ -188,7 +210,19 @@ OpenAPI_pdu_session_create_data_t *OpenAPI_pdu_session_create_data_create( bool is_dl_serving_plmn_rate_ctl, int dl_serving_plmn_rate_ctl, OpenAPI_up_security_info_t *up_security_info, - OpenAPI_vplmn_qos_t *vplmn_qos + OpenAPI_vplmn_qos_t *vplmn_qos, + char *old_sm_context_ref, + OpenAPI_redundant_pdu_session_information_t *redundant_pdu_session_info, + char *old_pdu_session_ref, + bool is_sm_policy_notify_ind, + int sm_policy_notify_ind, + OpenAPI_pcf_ue_callback_info_t *pcf_ue_callback_info, + OpenAPI_satellite_backhaul_category_e satellite_backhaul_cat, + bool is_upip_supported, + int upip_supported, + OpenAPI_up_cnx_state_e up_cnx_state, + bool is_disaster_roaming_ind, + int disaster_roaming_ind ); void OpenAPI_pdu_session_create_data_free(OpenAPI_pdu_session_create_data_t *pdu_session_create_data); OpenAPI_pdu_session_create_data_t *OpenAPI_pdu_session_create_data_parseFromJSON(cJSON *pdu_session_create_dataJSON); diff --git a/lib/sbi/openapi/model/pdu_session_create_error.h b/lib/sbi/openapi/model/pdu_session_create_error.h index 98d0879bd..54170aa69 100644 --- a/lib/sbi/openapi/model/pdu_session_create_error.h +++ b/lib/sbi/openapi/model/pdu_session_create_error.h @@ -1,7 +1,7 @@ /* * pdu_session_create_error.h * - * + * Error within Create Response */ #ifndef _OpenAPI_pdu_session_create_error_H_ diff --git a/lib/sbi/openapi/model/pdu_session_created_data.c b/lib/sbi/openapi/model/pdu_session_created_data.c index d8702fd3e..5fb865289 100644 --- a/lib/sbi/openapi/model/pdu_session_created_data.c +++ b/lib/sbi/openapi/model/pdu_session_created_data.c @@ -49,7 +49,11 @@ OpenAPI_pdu_session_created_data_t *OpenAPI_pdu_session_created_data_create( bool is_ipv6_index, int ipv6_index, OpenAPI_ip_address_t *dn_aaa_address, - OpenAPI_redundant_pdu_session_information_t *redundant_pdu_session_info + OpenAPI_redundant_pdu_session_information_t *redundant_pdu_session_info, + bool is_nspu_support_ind, + int nspu_support_ind, + char *inter_plmn_api_root, + char *intra_plmn_api_root ) { OpenAPI_pdu_session_created_data_t *pdu_session_created_data_local_var = ogs_malloc(sizeof(OpenAPI_pdu_session_created_data_t)); @@ -100,6 +104,10 @@ OpenAPI_pdu_session_created_data_t *OpenAPI_pdu_session_created_data_create( pdu_session_created_data_local_var->ipv6_index = ipv6_index; pdu_session_created_data_local_var->dn_aaa_address = dn_aaa_address; pdu_session_created_data_local_var->redundant_pdu_session_info = redundant_pdu_session_info; + pdu_session_created_data_local_var->is_nspu_support_ind = is_nspu_support_ind; + pdu_session_created_data_local_var->nspu_support_ind = nspu_support_ind; + pdu_session_created_data_local_var->inter_plmn_api_root = inter_plmn_api_root; + pdu_session_created_data_local_var->intra_plmn_api_root = intra_plmn_api_root; return pdu_session_created_data_local_var; } @@ -224,6 +232,14 @@ void OpenAPI_pdu_session_created_data_free(OpenAPI_pdu_session_created_data_t *p OpenAPI_redundant_pdu_session_information_free(pdu_session_created_data->redundant_pdu_session_info); pdu_session_created_data->redundant_pdu_session_info = NULL; } + if (pdu_session_created_data->inter_plmn_api_root) { + ogs_free(pdu_session_created_data->inter_plmn_api_root); + pdu_session_created_data->inter_plmn_api_root = NULL; + } + if (pdu_session_created_data->intra_plmn_api_root) { + ogs_free(pdu_session_created_data->intra_plmn_api_root); + pdu_session_created_data->intra_plmn_api_root = NULL; + } ogs_free(pdu_session_created_data); } @@ -592,6 +608,27 @@ cJSON *OpenAPI_pdu_session_created_data_convertToJSON(OpenAPI_pdu_session_create } } + if (pdu_session_created_data->is_nspu_support_ind) { + if (cJSON_AddBoolToObject(item, "nspuSupportInd", pdu_session_created_data->nspu_support_ind) == NULL) { + ogs_error("OpenAPI_pdu_session_created_data_convertToJSON() failed [nspu_support_ind]"); + goto end; + } + } + + if (pdu_session_created_data->inter_plmn_api_root) { + if (cJSON_AddStringToObject(item, "interPlmnApiRoot", pdu_session_created_data->inter_plmn_api_root) == NULL) { + ogs_error("OpenAPI_pdu_session_created_data_convertToJSON() failed [inter_plmn_api_root]"); + goto end; + } + } + + if (pdu_session_created_data->intra_plmn_api_root) { + if (cJSON_AddStringToObject(item, "intraPlmnApiRoot", pdu_session_created_data->intra_plmn_api_root) == NULL) { + ogs_error("OpenAPI_pdu_session_created_data_convertToJSON() failed [intra_plmn_api_root]"); + goto end; + } + } + end: return item; } @@ -654,6 +691,9 @@ OpenAPI_pdu_session_created_data_t *OpenAPI_pdu_session_created_data_parseFromJS OpenAPI_ip_address_t *dn_aaa_address_local_nonprim = NULL; cJSON *redundant_pdu_session_info = NULL; OpenAPI_redundant_pdu_session_information_t *redundant_pdu_session_info_local_nonprim = NULL; + cJSON *nspu_support_ind = NULL; + cJSON *inter_plmn_api_root = NULL; + cJSON *intra_plmn_api_root = NULL; pdu_session_type = cJSON_GetObjectItemCaseSensitive(pdu_session_created_dataJSON, "pduSessionType"); if (!pdu_session_type) { ogs_error("OpenAPI_pdu_session_created_data_parseFromJSON() failed [pdu_session_type]"); @@ -971,6 +1011,30 @@ OpenAPI_pdu_session_created_data_t *OpenAPI_pdu_session_created_data_parseFromJS redundant_pdu_session_info_local_nonprim = OpenAPI_redundant_pdu_session_information_parseFromJSON(redundant_pdu_session_info); } + nspu_support_ind = cJSON_GetObjectItemCaseSensitive(pdu_session_created_dataJSON, "nspuSupportInd"); + if (nspu_support_ind) { + if (!cJSON_IsBool(nspu_support_ind)) { + ogs_error("OpenAPI_pdu_session_created_data_parseFromJSON() failed [nspu_support_ind]"); + goto end; + } + } + + inter_plmn_api_root = cJSON_GetObjectItemCaseSensitive(pdu_session_created_dataJSON, "interPlmnApiRoot"); + if (inter_plmn_api_root) { + if (!cJSON_IsString(inter_plmn_api_root) && !cJSON_IsNull(inter_plmn_api_root)) { + ogs_error("OpenAPI_pdu_session_created_data_parseFromJSON() failed [inter_plmn_api_root]"); + goto end; + } + } + + intra_plmn_api_root = cJSON_GetObjectItemCaseSensitive(pdu_session_created_dataJSON, "intraPlmnApiRoot"); + if (intra_plmn_api_root) { + if (!cJSON_IsString(intra_plmn_api_root) && !cJSON_IsNull(intra_plmn_api_root)) { + ogs_error("OpenAPI_pdu_session_created_data_parseFromJSON() failed [intra_plmn_api_root]"); + goto end; + } + } + pdu_session_created_data_local_var = OpenAPI_pdu_session_created_data_create ( pdu_session_typeVariable, ogs_strdup(ssc_mode->valuestring), @@ -1016,7 +1080,11 @@ OpenAPI_pdu_session_created_data_t *OpenAPI_pdu_session_created_data_parseFromJS ipv6_index ? true : false, ipv6_index ? ipv6_index->valuedouble : 0, dn_aaa_address ? dn_aaa_address_local_nonprim : NULL, - redundant_pdu_session_info ? redundant_pdu_session_info_local_nonprim : NULL + redundant_pdu_session_info ? redundant_pdu_session_info_local_nonprim : NULL, + nspu_support_ind ? true : false, + nspu_support_ind ? nspu_support_ind->valueint : 0, + inter_plmn_api_root && !cJSON_IsNull(inter_plmn_api_root) ? ogs_strdup(inter_plmn_api_root->valuestring) : NULL, + intra_plmn_api_root && !cJSON_IsNull(intra_plmn_api_root) ? ogs_strdup(intra_plmn_api_root->valuestring) : NULL ); return pdu_session_created_data_local_var; diff --git a/lib/sbi/openapi/model/pdu_session_created_data.h b/lib/sbi/openapi/model/pdu_session_created_data.h index 009c6f9d8..99f85a61f 100644 --- a/lib/sbi/openapi/model/pdu_session_created_data.h +++ b/lib/sbi/openapi/model/pdu_session_created_data.h @@ -1,7 +1,7 @@ /* * pdu_session_created_data.h * - * + * Data within Create Response */ #ifndef _OpenAPI_pdu_session_created_data_H_ @@ -77,6 +77,10 @@ typedef struct OpenAPI_pdu_session_created_data_s { int ipv6_index; struct OpenAPI_ip_address_s *dn_aaa_address; struct OpenAPI_redundant_pdu_session_information_s *redundant_pdu_session_info; + bool is_nspu_support_ind; + int nspu_support_ind; + char *inter_plmn_api_root; + char *intra_plmn_api_root; } OpenAPI_pdu_session_created_data_t; OpenAPI_pdu_session_created_data_t *OpenAPI_pdu_session_created_data_create( @@ -124,7 +128,11 @@ OpenAPI_pdu_session_created_data_t *OpenAPI_pdu_session_created_data_create( bool is_ipv6_index, int ipv6_index, OpenAPI_ip_address_t *dn_aaa_address, - OpenAPI_redundant_pdu_session_information_t *redundant_pdu_session_info + OpenAPI_redundant_pdu_session_information_t *redundant_pdu_session_info, + bool is_nspu_support_ind, + int nspu_support_ind, + char *inter_plmn_api_root, + char *intra_plmn_api_root ); void OpenAPI_pdu_session_created_data_free(OpenAPI_pdu_session_created_data_t *pdu_session_created_data); OpenAPI_pdu_session_created_data_t *OpenAPI_pdu_session_created_data_parseFromJSON(cJSON *pdu_session_created_dataJSON); diff --git a/lib/sbi/openapi/model/pdu_session_event_notification.c b/lib/sbi/openapi/model/pdu_session_event_notification.c new file mode 100644 index 000000000..36a6c6c38 --- /dev/null +++ b/lib/sbi/openapi/model/pdu_session_event_notification.c @@ -0,0 +1,343 @@ + +#include +#include +#include +#include "pdu_session_event_notification.h" + +OpenAPI_pdu_session_event_notification_t *OpenAPI_pdu_session_event_notification_create( + OpenAPI_af_event_notification_t *ev_notif, + char *supi, + char *ue_ipv4, + char *ue_ipv6, + char *ue_mac, + OpenAPI_npcf_pdu_session_status_e status, + OpenAPI_pcf_addressing_info_t *pcf_info, + char *dnn, + OpenAPI_snssai_t *snssai, + char *gpsi +) +{ + OpenAPI_pdu_session_event_notification_t *pdu_session_event_notification_local_var = ogs_malloc(sizeof(OpenAPI_pdu_session_event_notification_t)); + ogs_assert(pdu_session_event_notification_local_var); + + pdu_session_event_notification_local_var->ev_notif = ev_notif; + pdu_session_event_notification_local_var->supi = supi; + pdu_session_event_notification_local_var->ue_ipv4 = ue_ipv4; + pdu_session_event_notification_local_var->ue_ipv6 = ue_ipv6; + pdu_session_event_notification_local_var->ue_mac = ue_mac; + pdu_session_event_notification_local_var->status = status; + pdu_session_event_notification_local_var->pcf_info = pcf_info; + pdu_session_event_notification_local_var->dnn = dnn; + pdu_session_event_notification_local_var->snssai = snssai; + pdu_session_event_notification_local_var->gpsi = gpsi; + + return pdu_session_event_notification_local_var; +} + +void OpenAPI_pdu_session_event_notification_free(OpenAPI_pdu_session_event_notification_t *pdu_session_event_notification) +{ + OpenAPI_lnode_t *node = NULL; + + if (NULL == pdu_session_event_notification) { + return; + } + if (pdu_session_event_notification->ev_notif) { + OpenAPI_af_event_notification_free(pdu_session_event_notification->ev_notif); + pdu_session_event_notification->ev_notif = NULL; + } + if (pdu_session_event_notification->supi) { + ogs_free(pdu_session_event_notification->supi); + pdu_session_event_notification->supi = NULL; + } + if (pdu_session_event_notification->ue_ipv4) { + ogs_free(pdu_session_event_notification->ue_ipv4); + pdu_session_event_notification->ue_ipv4 = NULL; + } + if (pdu_session_event_notification->ue_ipv6) { + ogs_free(pdu_session_event_notification->ue_ipv6); + pdu_session_event_notification->ue_ipv6 = NULL; + } + if (pdu_session_event_notification->ue_mac) { + ogs_free(pdu_session_event_notification->ue_mac); + pdu_session_event_notification->ue_mac = NULL; + } + if (pdu_session_event_notification->pcf_info) { + OpenAPI_pcf_addressing_info_free(pdu_session_event_notification->pcf_info); + pdu_session_event_notification->pcf_info = NULL; + } + if (pdu_session_event_notification->dnn) { + ogs_free(pdu_session_event_notification->dnn); + pdu_session_event_notification->dnn = NULL; + } + if (pdu_session_event_notification->snssai) { + OpenAPI_snssai_free(pdu_session_event_notification->snssai); + pdu_session_event_notification->snssai = NULL; + } + if (pdu_session_event_notification->gpsi) { + ogs_free(pdu_session_event_notification->gpsi); + pdu_session_event_notification->gpsi = NULL; + } + ogs_free(pdu_session_event_notification); +} + +cJSON *OpenAPI_pdu_session_event_notification_convertToJSON(OpenAPI_pdu_session_event_notification_t *pdu_session_event_notification) +{ + cJSON *item = NULL; + OpenAPI_lnode_t *node = NULL; + + if (pdu_session_event_notification == NULL) { + ogs_error("OpenAPI_pdu_session_event_notification_convertToJSON() failed [PduSessionEventNotification]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (!pdu_session_event_notification->ev_notif) { + ogs_error("OpenAPI_pdu_session_event_notification_convertToJSON() failed [ev_notif]"); + return NULL; + } + cJSON *ev_notif_local_JSON = OpenAPI_af_event_notification_convertToJSON(pdu_session_event_notification->ev_notif); + if (ev_notif_local_JSON == NULL) { + ogs_error("OpenAPI_pdu_session_event_notification_convertToJSON() failed [ev_notif]"); + goto end; + } + cJSON_AddItemToObject(item, "evNotif", ev_notif_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_pdu_session_event_notification_convertToJSON() failed [ev_notif]"); + goto end; + } + + if (pdu_session_event_notification->supi) { + if (cJSON_AddStringToObject(item, "supi", pdu_session_event_notification->supi) == NULL) { + ogs_error("OpenAPI_pdu_session_event_notification_convertToJSON() failed [supi]"); + goto end; + } + } + + if (pdu_session_event_notification->ue_ipv4) { + if (cJSON_AddStringToObject(item, "ueIpv4", pdu_session_event_notification->ue_ipv4) == NULL) { + ogs_error("OpenAPI_pdu_session_event_notification_convertToJSON() failed [ue_ipv4]"); + goto end; + } + } + + if (pdu_session_event_notification->ue_ipv6) { + if (cJSON_AddStringToObject(item, "ueIpv6", pdu_session_event_notification->ue_ipv6) == NULL) { + ogs_error("OpenAPI_pdu_session_event_notification_convertToJSON() failed [ue_ipv6]"); + goto end; + } + } + + if (pdu_session_event_notification->ue_mac) { + if (cJSON_AddStringToObject(item, "ueMac", pdu_session_event_notification->ue_mac) == NULL) { + ogs_error("OpenAPI_pdu_session_event_notification_convertToJSON() failed [ue_mac]"); + goto end; + } + } + + if (pdu_session_event_notification->status != OpenAPI_npcf_pdu_session_status_NULL) { + if (cJSON_AddStringToObject(item, "status", OpenAPI_npcf_pdu_session_status_ToString(pdu_session_event_notification->status)) == NULL) { + ogs_error("OpenAPI_pdu_session_event_notification_convertToJSON() failed [status]"); + goto end; + } + } + + if (pdu_session_event_notification->pcf_info) { + cJSON *pcf_info_local_JSON = OpenAPI_pcf_addressing_info_convertToJSON(pdu_session_event_notification->pcf_info); + if (pcf_info_local_JSON == NULL) { + ogs_error("OpenAPI_pdu_session_event_notification_convertToJSON() failed [pcf_info]"); + goto end; + } + cJSON_AddItemToObject(item, "pcfInfo", pcf_info_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_pdu_session_event_notification_convertToJSON() failed [pcf_info]"); + goto end; + } + } + + if (pdu_session_event_notification->dnn) { + if (cJSON_AddStringToObject(item, "dnn", pdu_session_event_notification->dnn) == NULL) { + ogs_error("OpenAPI_pdu_session_event_notification_convertToJSON() failed [dnn]"); + goto end; + } + } + + if (pdu_session_event_notification->snssai) { + cJSON *snssai_local_JSON = OpenAPI_snssai_convertToJSON(pdu_session_event_notification->snssai); + if (snssai_local_JSON == NULL) { + ogs_error("OpenAPI_pdu_session_event_notification_convertToJSON() failed [snssai]"); + goto end; + } + cJSON_AddItemToObject(item, "snssai", snssai_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_pdu_session_event_notification_convertToJSON() failed [snssai]"); + goto end; + } + } + + if (pdu_session_event_notification->gpsi) { + if (cJSON_AddStringToObject(item, "gpsi", pdu_session_event_notification->gpsi) == NULL) { + ogs_error("OpenAPI_pdu_session_event_notification_convertToJSON() failed [gpsi]"); + goto end; + } + } + +end: + return item; +} + +OpenAPI_pdu_session_event_notification_t *OpenAPI_pdu_session_event_notification_parseFromJSON(cJSON *pdu_session_event_notificationJSON) +{ + OpenAPI_pdu_session_event_notification_t *pdu_session_event_notification_local_var = NULL; + OpenAPI_lnode_t *node = NULL; + cJSON *ev_notif = NULL; + OpenAPI_af_event_notification_t *ev_notif_local_nonprim = NULL; + cJSON *supi = NULL; + cJSON *ue_ipv4 = NULL; + cJSON *ue_ipv6 = NULL; + cJSON *ue_mac = NULL; + cJSON *status = NULL; + OpenAPI_npcf_pdu_session_status_e statusVariable = 0; + cJSON *pcf_info = NULL; + OpenAPI_pcf_addressing_info_t *pcf_info_local_nonprim = NULL; + cJSON *dnn = NULL; + cJSON *snssai = NULL; + OpenAPI_snssai_t *snssai_local_nonprim = NULL; + cJSON *gpsi = NULL; + ev_notif = cJSON_GetObjectItemCaseSensitive(pdu_session_event_notificationJSON, "evNotif"); + if (!ev_notif) { + ogs_error("OpenAPI_pdu_session_event_notification_parseFromJSON() failed [ev_notif]"); + goto end; + } + ev_notif_local_nonprim = OpenAPI_af_event_notification_parseFromJSON(ev_notif); + + supi = cJSON_GetObjectItemCaseSensitive(pdu_session_event_notificationJSON, "supi"); + if (supi) { + if (!cJSON_IsString(supi) && !cJSON_IsNull(supi)) { + ogs_error("OpenAPI_pdu_session_event_notification_parseFromJSON() failed [supi]"); + goto end; + } + } + + ue_ipv4 = cJSON_GetObjectItemCaseSensitive(pdu_session_event_notificationJSON, "ueIpv4"); + if (ue_ipv4) { + if (!cJSON_IsString(ue_ipv4) && !cJSON_IsNull(ue_ipv4)) { + ogs_error("OpenAPI_pdu_session_event_notification_parseFromJSON() failed [ue_ipv4]"); + goto end; + } + } + + ue_ipv6 = cJSON_GetObjectItemCaseSensitive(pdu_session_event_notificationJSON, "ueIpv6"); + if (ue_ipv6) { + if (!cJSON_IsString(ue_ipv6) && !cJSON_IsNull(ue_ipv6)) { + ogs_error("OpenAPI_pdu_session_event_notification_parseFromJSON() failed [ue_ipv6]"); + goto end; + } + } + + ue_mac = cJSON_GetObjectItemCaseSensitive(pdu_session_event_notificationJSON, "ueMac"); + if (ue_mac) { + if (!cJSON_IsString(ue_mac) && !cJSON_IsNull(ue_mac)) { + ogs_error("OpenAPI_pdu_session_event_notification_parseFromJSON() failed [ue_mac]"); + goto end; + } + } + + status = cJSON_GetObjectItemCaseSensitive(pdu_session_event_notificationJSON, "status"); + if (status) { + if (!cJSON_IsString(status)) { + ogs_error("OpenAPI_pdu_session_event_notification_parseFromJSON() failed [status]"); + goto end; + } + statusVariable = OpenAPI_npcf_pdu_session_status_FromString(status->valuestring); + } + + pcf_info = cJSON_GetObjectItemCaseSensitive(pdu_session_event_notificationJSON, "pcfInfo"); + if (pcf_info) { + pcf_info_local_nonprim = OpenAPI_pcf_addressing_info_parseFromJSON(pcf_info); + } + + dnn = cJSON_GetObjectItemCaseSensitive(pdu_session_event_notificationJSON, "dnn"); + if (dnn) { + if (!cJSON_IsString(dnn) && !cJSON_IsNull(dnn)) { + ogs_error("OpenAPI_pdu_session_event_notification_parseFromJSON() failed [dnn]"); + goto end; + } + } + + snssai = cJSON_GetObjectItemCaseSensitive(pdu_session_event_notificationJSON, "snssai"); + if (snssai) { + snssai_local_nonprim = OpenAPI_snssai_parseFromJSON(snssai); + } + + gpsi = cJSON_GetObjectItemCaseSensitive(pdu_session_event_notificationJSON, "gpsi"); + if (gpsi) { + if (!cJSON_IsString(gpsi) && !cJSON_IsNull(gpsi)) { + ogs_error("OpenAPI_pdu_session_event_notification_parseFromJSON() failed [gpsi]"); + goto end; + } + } + + pdu_session_event_notification_local_var = OpenAPI_pdu_session_event_notification_create ( + ev_notif_local_nonprim, + supi && !cJSON_IsNull(supi) ? ogs_strdup(supi->valuestring) : NULL, + ue_ipv4 && !cJSON_IsNull(ue_ipv4) ? ogs_strdup(ue_ipv4->valuestring) : NULL, + ue_ipv6 && !cJSON_IsNull(ue_ipv6) ? ogs_strdup(ue_ipv6->valuestring) : NULL, + ue_mac && !cJSON_IsNull(ue_mac) ? ogs_strdup(ue_mac->valuestring) : NULL, + status ? statusVariable : 0, + pcf_info ? pcf_info_local_nonprim : NULL, + dnn && !cJSON_IsNull(dnn) ? ogs_strdup(dnn->valuestring) : NULL, + snssai ? snssai_local_nonprim : NULL, + gpsi && !cJSON_IsNull(gpsi) ? ogs_strdup(gpsi->valuestring) : NULL + ); + + return pdu_session_event_notification_local_var; +end: + if (ev_notif_local_nonprim) { + OpenAPI_af_event_notification_free(ev_notif_local_nonprim); + ev_notif_local_nonprim = NULL; + } + if (pcf_info_local_nonprim) { + OpenAPI_pcf_addressing_info_free(pcf_info_local_nonprim); + pcf_info_local_nonprim = NULL; + } + if (snssai_local_nonprim) { + OpenAPI_snssai_free(snssai_local_nonprim); + snssai_local_nonprim = NULL; + } + return NULL; +} + +OpenAPI_pdu_session_event_notification_t *OpenAPI_pdu_session_event_notification_copy(OpenAPI_pdu_session_event_notification_t *dst, OpenAPI_pdu_session_event_notification_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_pdu_session_event_notification_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_pdu_session_event_notification_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_pdu_session_event_notification_free(dst); + dst = OpenAPI_pdu_session_event_notification_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/pdu_session_event_notification.h b/lib/sbi/openapi/model/pdu_session_event_notification.h new file mode 100644 index 000000000..908682033 --- /dev/null +++ b/lib/sbi/openapi/model/pdu_session_event_notification.h @@ -0,0 +1,60 @@ +/* + * pdu_session_event_notification.h + * + * Indicates PDU session information for the concerned established/terminated PDU session. + */ + +#ifndef _OpenAPI_pdu_session_event_notification_H_ +#define _OpenAPI_pdu_session_event_notification_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "af_event_notification.h" +#include "npcf_pdu_session_status.h" +#include "pcf_addressing_info.h" +#include "snssai.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_pdu_session_event_notification_s OpenAPI_pdu_session_event_notification_t; +typedef struct OpenAPI_pdu_session_event_notification_s { + struct OpenAPI_af_event_notification_s *ev_notif; + char *supi; + char *ue_ipv4; + char *ue_ipv6; + char *ue_mac; + OpenAPI_npcf_pdu_session_status_e status; + struct OpenAPI_pcf_addressing_info_s *pcf_info; + char *dnn; + struct OpenAPI_snssai_s *snssai; + char *gpsi; +} OpenAPI_pdu_session_event_notification_t; + +OpenAPI_pdu_session_event_notification_t *OpenAPI_pdu_session_event_notification_create( + OpenAPI_af_event_notification_t *ev_notif, + char *supi, + char *ue_ipv4, + char *ue_ipv6, + char *ue_mac, + OpenAPI_npcf_pdu_session_status_e status, + OpenAPI_pcf_addressing_info_t *pcf_info, + char *dnn, + OpenAPI_snssai_t *snssai, + char *gpsi +); +void OpenAPI_pdu_session_event_notification_free(OpenAPI_pdu_session_event_notification_t *pdu_session_event_notification); +OpenAPI_pdu_session_event_notification_t *OpenAPI_pdu_session_event_notification_parseFromJSON(cJSON *pdu_session_event_notificationJSON); +cJSON *OpenAPI_pdu_session_event_notification_convertToJSON(OpenAPI_pdu_session_event_notification_t *pdu_session_event_notification); +OpenAPI_pdu_session_event_notification_t *OpenAPI_pdu_session_event_notification_copy(OpenAPI_pdu_session_event_notification_t *dst, OpenAPI_pdu_session_event_notification_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_pdu_session_event_notification_H_ */ + diff --git a/lib/sbi/openapi/model/pdu_session_info.c b/lib/sbi/openapi/model/pdu_session_info.c new file mode 100644 index 000000000..1c48c0bfe --- /dev/null +++ b/lib/sbi/openapi/model/pdu_session_info.c @@ -0,0 +1,149 @@ + +#include +#include +#include +#include "pdu_session_info.h" + +OpenAPI_pdu_session_info_t *OpenAPI_pdu_session_info_create( + OpenAPI_snssai_t *snssai, + char *dnn +) +{ + OpenAPI_pdu_session_info_t *pdu_session_info_local_var = ogs_malloc(sizeof(OpenAPI_pdu_session_info_t)); + ogs_assert(pdu_session_info_local_var); + + pdu_session_info_local_var->snssai = snssai; + pdu_session_info_local_var->dnn = dnn; + + return pdu_session_info_local_var; +} + +void OpenAPI_pdu_session_info_free(OpenAPI_pdu_session_info_t *pdu_session_info) +{ + OpenAPI_lnode_t *node = NULL; + + if (NULL == pdu_session_info) { + return; + } + if (pdu_session_info->snssai) { + OpenAPI_snssai_free(pdu_session_info->snssai); + pdu_session_info->snssai = NULL; + } + if (pdu_session_info->dnn) { + ogs_free(pdu_session_info->dnn); + pdu_session_info->dnn = NULL; + } + ogs_free(pdu_session_info); +} + +cJSON *OpenAPI_pdu_session_info_convertToJSON(OpenAPI_pdu_session_info_t *pdu_session_info) +{ + cJSON *item = NULL; + OpenAPI_lnode_t *node = NULL; + + if (pdu_session_info == NULL) { + ogs_error("OpenAPI_pdu_session_info_convertToJSON() failed [PduSessionInfo]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (!pdu_session_info->snssai) { + ogs_error("OpenAPI_pdu_session_info_convertToJSON() failed [snssai]"); + return NULL; + } + cJSON *snssai_local_JSON = OpenAPI_snssai_convertToJSON(pdu_session_info->snssai); + if (snssai_local_JSON == NULL) { + ogs_error("OpenAPI_pdu_session_info_convertToJSON() failed [snssai]"); + goto end; + } + cJSON_AddItemToObject(item, "snssai", snssai_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_pdu_session_info_convertToJSON() failed [snssai]"); + goto end; + } + + if (!pdu_session_info->dnn) { + ogs_error("OpenAPI_pdu_session_info_convertToJSON() failed [dnn]"); + return NULL; + } + if (cJSON_AddStringToObject(item, "dnn", pdu_session_info->dnn) == NULL) { + ogs_error("OpenAPI_pdu_session_info_convertToJSON() failed [dnn]"); + goto end; + } + +end: + return item; +} + +OpenAPI_pdu_session_info_t *OpenAPI_pdu_session_info_parseFromJSON(cJSON *pdu_session_infoJSON) +{ + OpenAPI_pdu_session_info_t *pdu_session_info_local_var = NULL; + OpenAPI_lnode_t *node = NULL; + cJSON *snssai = NULL; + OpenAPI_snssai_t *snssai_local_nonprim = NULL; + cJSON *dnn = NULL; + snssai = cJSON_GetObjectItemCaseSensitive(pdu_session_infoJSON, "snssai"); + if (!snssai) { + ogs_error("OpenAPI_pdu_session_info_parseFromJSON() failed [snssai]"); + goto end; + } + snssai_local_nonprim = OpenAPI_snssai_parseFromJSON(snssai); + + dnn = cJSON_GetObjectItemCaseSensitive(pdu_session_infoJSON, "dnn"); + if (!dnn) { + ogs_error("OpenAPI_pdu_session_info_parseFromJSON() failed [dnn]"); + goto end; + } + if (!cJSON_IsString(dnn)) { + ogs_error("OpenAPI_pdu_session_info_parseFromJSON() failed [dnn]"); + goto end; + } + + pdu_session_info_local_var = OpenAPI_pdu_session_info_create ( + snssai_local_nonprim, + ogs_strdup(dnn->valuestring) + ); + + return pdu_session_info_local_var; +end: + if (snssai_local_nonprim) { + OpenAPI_snssai_free(snssai_local_nonprim); + snssai_local_nonprim = NULL; + } + return NULL; +} + +OpenAPI_pdu_session_info_t *OpenAPI_pdu_session_info_copy(OpenAPI_pdu_session_info_t *dst, OpenAPI_pdu_session_info_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_pdu_session_info_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_pdu_session_info_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_pdu_session_info_free(dst); + dst = OpenAPI_pdu_session_info_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/pdu_session_info.h b/lib/sbi/openapi/model/pdu_session_info.h new file mode 100644 index 000000000..3d1fefdc6 --- /dev/null +++ b/lib/sbi/openapi/model/pdu_session_info.h @@ -0,0 +1,41 @@ +/* + * pdu_session_info.h + * + * indicates the DNN and S-NSSAI combination of a PDU session. + */ + +#ifndef _OpenAPI_pdu_session_info_H_ +#define _OpenAPI_pdu_session_info_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "snssai.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_pdu_session_info_s OpenAPI_pdu_session_info_t; +typedef struct OpenAPI_pdu_session_info_s { + struct OpenAPI_snssai_s *snssai; + char *dnn; +} OpenAPI_pdu_session_info_t; + +OpenAPI_pdu_session_info_t *OpenAPI_pdu_session_info_create( + OpenAPI_snssai_t *snssai, + char *dnn +); +void OpenAPI_pdu_session_info_free(OpenAPI_pdu_session_info_t *pdu_session_info); +OpenAPI_pdu_session_info_t *OpenAPI_pdu_session_info_parseFromJSON(cJSON *pdu_session_infoJSON); +cJSON *OpenAPI_pdu_session_info_convertToJSON(OpenAPI_pdu_session_info_t *pdu_session_info); +OpenAPI_pdu_session_info_t *OpenAPI_pdu_session_info_copy(OpenAPI_pdu_session_info_t *dst, OpenAPI_pdu_session_info_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_pdu_session_info_H_ */ + diff --git a/lib/sbi/openapi/model/pdu_session_management_data.c b/lib/sbi/openapi/model/pdu_session_management_data.c index a6854eea1..ea6d228d5 100644 --- a/lib/sbi/openapi/model/pdu_session_management_data.c +++ b/lib/sbi/openapi/model/pdu_session_management_data.c @@ -5,7 +5,7 @@ #include "pdu_session_management_data.h" OpenAPI_pdu_session_management_data_t *OpenAPI_pdu_session_management_data_create( - OpenAPI_pdu_session_status_t *pdu_session_status, + OpenAPI_pdu_session_status_e pdu_session_status, char *pdu_session_status_ts, char *dnai, char *dnai_ts, @@ -19,7 +19,8 @@ OpenAPI_pdu_session_management_data_t *OpenAPI_pdu_session_management_data_creat char *dnn, bool is_pdu_session_id, int pdu_session_id, - char *supp_feat + char *supp_feat, + OpenAPI_list_t *reset_ids ) { OpenAPI_pdu_session_management_data_t *pdu_session_management_data_local_var = ogs_malloc(sizeof(OpenAPI_pdu_session_management_data_t)); @@ -40,6 +41,7 @@ OpenAPI_pdu_session_management_data_t *OpenAPI_pdu_session_management_data_creat pdu_session_management_data_local_var->is_pdu_session_id = is_pdu_session_id; pdu_session_management_data_local_var->pdu_session_id = pdu_session_id; pdu_session_management_data_local_var->supp_feat = supp_feat; + pdu_session_management_data_local_var->reset_ids = reset_ids; return pdu_session_management_data_local_var; } @@ -51,10 +53,6 @@ void OpenAPI_pdu_session_management_data_free(OpenAPI_pdu_session_management_dat if (NULL == pdu_session_management_data) { return; } - if (pdu_session_management_data->pdu_session_status) { - OpenAPI_pdu_session_status_free(pdu_session_management_data->pdu_session_status); - pdu_session_management_data->pdu_session_status = NULL; - } if (pdu_session_management_data->pdu_session_status_ts) { ogs_free(pdu_session_management_data->pdu_session_status_ts); pdu_session_management_data->pdu_session_status_ts = NULL; @@ -108,6 +106,13 @@ void OpenAPI_pdu_session_management_data_free(OpenAPI_pdu_session_management_dat ogs_free(pdu_session_management_data->supp_feat); pdu_session_management_data->supp_feat = NULL; } + if (pdu_session_management_data->reset_ids) { + OpenAPI_list_for_each(pdu_session_management_data->reset_ids, node) { + ogs_free(node->data); + } + OpenAPI_list_free(pdu_session_management_data->reset_ids); + pdu_session_management_data->reset_ids = NULL; + } ogs_free(pdu_session_management_data); } @@ -122,14 +127,8 @@ cJSON *OpenAPI_pdu_session_management_data_convertToJSON(OpenAPI_pdu_session_man } item = cJSON_CreateObject(); - if (pdu_session_management_data->pdu_session_status) { - cJSON *pdu_session_status_local_JSON = OpenAPI_pdu_session_status_convertToJSON(pdu_session_management_data->pdu_session_status); - if (pdu_session_status_local_JSON == NULL) { - ogs_error("OpenAPI_pdu_session_management_data_convertToJSON() failed [pdu_session_status]"); - goto end; - } - cJSON_AddItemToObject(item, "pduSessionStatus", pdu_session_status_local_JSON); - if (item->child == NULL) { + if (pdu_session_management_data->pdu_session_status != OpenAPI_pdu_session_status_NULL) { + if (cJSON_AddStringToObject(item, "pduSessionStatus", OpenAPI_pdu_session_status_ToString(pdu_session_management_data->pdu_session_status)) == NULL) { ogs_error("OpenAPI_pdu_session_management_data_convertToJSON() failed [pdu_session_status]"); goto end; } @@ -249,6 +248,20 @@ cJSON *OpenAPI_pdu_session_management_data_convertToJSON(OpenAPI_pdu_session_man } } + if (pdu_session_management_data->reset_ids) { + cJSON *reset_idsList = cJSON_AddArrayToObject(item, "resetIds"); + if (reset_idsList == NULL) { + ogs_error("OpenAPI_pdu_session_management_data_convertToJSON() failed [reset_ids]"); + goto end; + } + OpenAPI_list_for_each(pdu_session_management_data->reset_ids, node) { + if (cJSON_AddStringToObject(reset_idsList, "", (char*)node->data) == NULL) { + ogs_error("OpenAPI_pdu_session_management_data_convertToJSON() failed [reset_ids]"); + goto end; + } + } + } + end: return item; } @@ -258,7 +271,7 @@ OpenAPI_pdu_session_management_data_t *OpenAPI_pdu_session_management_data_parse OpenAPI_pdu_session_management_data_t *pdu_session_management_data_local_var = NULL; OpenAPI_lnode_t *node = NULL; cJSON *pdu_session_status = NULL; - OpenAPI_pdu_session_status_t *pdu_session_status_local_nonprim = NULL; + OpenAPI_pdu_session_status_e pdu_session_statusVariable = 0; cJSON *pdu_session_status_ts = NULL; cJSON *dnai = NULL; cJSON *dnai_ts = NULL; @@ -276,9 +289,15 @@ OpenAPI_pdu_session_management_data_t *OpenAPI_pdu_session_management_data_parse cJSON *dnn = NULL; cJSON *pdu_session_id = NULL; cJSON *supp_feat = NULL; + cJSON *reset_ids = NULL; + OpenAPI_list_t *reset_idsList = NULL; pdu_session_status = cJSON_GetObjectItemCaseSensitive(pdu_session_management_dataJSON, "pduSessionStatus"); if (pdu_session_status) { - pdu_session_status_local_nonprim = OpenAPI_pdu_session_status_parseFromJSON(pdu_session_status); + if (!cJSON_IsString(pdu_session_status)) { + ogs_error("OpenAPI_pdu_session_management_data_parseFromJSON() failed [pdu_session_status]"); + goto end; + } + pdu_session_statusVariable = OpenAPI_pdu_session_status_FromString(pdu_session_status->valuestring); } pdu_session_status_ts = cJSON_GetObjectItemCaseSensitive(pdu_session_management_dataJSON, "pduSessionStatusTs"); @@ -429,8 +448,29 @@ OpenAPI_pdu_session_management_data_t *OpenAPI_pdu_session_management_data_parse } } + reset_ids = cJSON_GetObjectItemCaseSensitive(pdu_session_management_dataJSON, "resetIds"); + if (reset_ids) { + cJSON *reset_ids_local = NULL; + if (!cJSON_IsArray(reset_ids)) { + ogs_error("OpenAPI_pdu_session_management_data_parseFromJSON() failed [reset_ids]"); + goto end; + } + + reset_idsList = OpenAPI_list_create(); + + cJSON_ArrayForEach(reset_ids_local, reset_ids) { + double *localDouble = NULL; + int *localInt = NULL; + if (!cJSON_IsString(reset_ids_local)) { + ogs_error("OpenAPI_pdu_session_management_data_parseFromJSON() failed [reset_ids]"); + goto end; + } + OpenAPI_list_add(reset_idsList, ogs_strdup(reset_ids_local->valuestring)); + } + } + pdu_session_management_data_local_var = OpenAPI_pdu_session_management_data_create ( - pdu_session_status ? pdu_session_status_local_nonprim : NULL, + pdu_session_status ? pdu_session_statusVariable : 0, pdu_session_status_ts && !cJSON_IsNull(pdu_session_status_ts) ? ogs_strdup(pdu_session_status_ts->valuestring) : NULL, dnai && !cJSON_IsNull(dnai) ? ogs_strdup(dnai->valuestring) : NULL, dnai_ts && !cJSON_IsNull(dnai_ts) ? ogs_strdup(dnai_ts->valuestring) : NULL, @@ -444,15 +484,12 @@ OpenAPI_pdu_session_management_data_t *OpenAPI_pdu_session_management_data_parse dnn && !cJSON_IsNull(dnn) ? ogs_strdup(dnn->valuestring) : NULL, pdu_session_id ? true : false, pdu_session_id ? pdu_session_id->valuedouble : 0, - supp_feat && !cJSON_IsNull(supp_feat) ? ogs_strdup(supp_feat->valuestring) : NULL + supp_feat && !cJSON_IsNull(supp_feat) ? ogs_strdup(supp_feat->valuestring) : NULL, + reset_ids ? reset_idsList : NULL ); return pdu_session_management_data_local_var; end: - if (pdu_session_status_local_nonprim) { - OpenAPI_pdu_session_status_free(pdu_session_status_local_nonprim); - pdu_session_status_local_nonprim = NULL; - } if (n6_traffic_routing_infoList) { OpenAPI_list_for_each(n6_traffic_routing_infoList, node) { OpenAPI_route_to_location_free(node->data); @@ -474,6 +511,13 @@ end: OpenAPI_list_free(ipv6_addrsList); ipv6_addrsList = NULL; } + if (reset_idsList) { + OpenAPI_list_for_each(reset_idsList, node) { + ogs_free(node->data); + } + OpenAPI_list_free(reset_idsList); + reset_idsList = NULL; + } return NULL; } diff --git a/lib/sbi/openapi/model/pdu_session_management_data.h b/lib/sbi/openapi/model/pdu_session_management_data.h index 8a86b7d60..3955d970d 100644 --- a/lib/sbi/openapi/model/pdu_session_management_data.h +++ b/lib/sbi/openapi/model/pdu_session_management_data.h @@ -1,7 +1,7 @@ /* * pdu_session_management_data.h * - * + * Represents Session management data for a UE and a PDU session. */ #ifndef _OpenAPI_pdu_session_management_data_H_ @@ -22,7 +22,7 @@ extern "C" { typedef struct OpenAPI_pdu_session_management_data_s OpenAPI_pdu_session_management_data_t; typedef struct OpenAPI_pdu_session_management_data_s { - struct OpenAPI_pdu_session_status_s *pdu_session_status; + OpenAPI_pdu_session_status_e pdu_session_status; char *pdu_session_status_ts; char *dnai; char *dnai_ts; @@ -37,10 +37,11 @@ typedef struct OpenAPI_pdu_session_management_data_s { bool is_pdu_session_id; int pdu_session_id; char *supp_feat; + OpenAPI_list_t *reset_ids; } OpenAPI_pdu_session_management_data_t; OpenAPI_pdu_session_management_data_t *OpenAPI_pdu_session_management_data_create( - OpenAPI_pdu_session_status_t *pdu_session_status, + OpenAPI_pdu_session_status_e pdu_session_status, char *pdu_session_status_ts, char *dnai, char *dnai_ts, @@ -54,7 +55,8 @@ OpenAPI_pdu_session_management_data_t *OpenAPI_pdu_session_management_data_creat char *dnn, bool is_pdu_session_id, int pdu_session_id, - char *supp_feat + char *supp_feat, + OpenAPI_list_t *reset_ids ); void OpenAPI_pdu_session_management_data_free(OpenAPI_pdu_session_management_data_t *pdu_session_management_data); OpenAPI_pdu_session_management_data_t *OpenAPI_pdu_session_management_data_parseFromJSON(cJSON *pdu_session_management_dataJSON); diff --git a/lib/sbi/openapi/model/pdu_session_notify_item.h b/lib/sbi/openapi/model/pdu_session_notify_item.h index b4966a582..055db4c4a 100644 --- a/lib/sbi/openapi/model/pdu_session_notify_item.h +++ b/lib/sbi/openapi/model/pdu_session_notify_item.h @@ -1,7 +1,7 @@ /* * pdu_session_notify_item.h * - * + * Notification related to a PDU session */ #ifndef _OpenAPI_pdu_session_notify_item_H_ diff --git a/lib/sbi/openapi/model/pdu_session_rel_cause.c b/lib/sbi/openapi/model/pdu_session_rel_cause.c index 339ac0c4a..eb691b5ed 100644 --- a/lib/sbi/openapi/model/pdu_session_rel_cause.c +++ b/lib/sbi/openapi/model/pdu_session_rel_cause.c @@ -6,7 +6,7 @@ char* OpenAPI_pdu_session_rel_cause_ToString(OpenAPI_pdu_session_rel_cause_e pdu_session_rel_cause) { - const char *pdu_session_rel_causeArray[] = { "NULL", "PS_TO_CS_HO" }; + const char *pdu_session_rel_causeArray[] = { "NULL", "PS_TO_CS_HO", "RULE_ERROR" }; size_t sizeofArray = sizeof(pdu_session_rel_causeArray) / sizeof(pdu_session_rel_causeArray[0]); if (pdu_session_rel_cause < sizeofArray) return (char *)pdu_session_rel_causeArray[pdu_session_rel_cause]; @@ -17,7 +17,7 @@ char* OpenAPI_pdu_session_rel_cause_ToString(OpenAPI_pdu_session_rel_cause_e pdu OpenAPI_pdu_session_rel_cause_e OpenAPI_pdu_session_rel_cause_FromString(char* pdu_session_rel_cause) { int stringToReturn = 0; - const char *pdu_session_rel_causeArray[] = { "NULL", "PS_TO_CS_HO" }; + const char *pdu_session_rel_causeArray[] = { "NULL", "PS_TO_CS_HO", "RULE_ERROR" }; size_t sizeofArray = sizeof(pdu_session_rel_causeArray) / sizeof(pdu_session_rel_causeArray[0]); while (stringToReturn < sizeofArray) { if (strcmp(pdu_session_rel_cause, pdu_session_rel_causeArray[stringToReturn]) == 0) { diff --git a/lib/sbi/openapi/model/pdu_session_rel_cause.h b/lib/sbi/openapi/model/pdu_session_rel_cause.h index 0d92deb67..0309d0d2c 100644 --- a/lib/sbi/openapi/model/pdu_session_rel_cause.h +++ b/lib/sbi/openapi/model/pdu_session_rel_cause.h @@ -17,7 +17,7 @@ extern "C" { #endif -typedef enum { OpenAPI_pdu_session_rel_cause_NULL = 0, OpenAPI_pdu_session_rel_cause_PS_TO_CS_HO } OpenAPI_pdu_session_rel_cause_e; +typedef enum { OpenAPI_pdu_session_rel_cause_NULL = 0, OpenAPI_pdu_session_rel_cause_PS_TO_CS_HO, OpenAPI_pdu_session_rel_cause_RULE_ERROR } OpenAPI_pdu_session_rel_cause_e; char* OpenAPI_pdu_session_rel_cause_ToString(OpenAPI_pdu_session_rel_cause_e pdu_session_rel_cause); diff --git a/lib/sbi/openapi/model/pdu_session_status.c b/lib/sbi/openapi/model/pdu_session_status.c index 96832270d..e202f4cdc 100644 --- a/lib/sbi/openapi/model/pdu_session_status.c +++ b/lib/sbi/openapi/model/pdu_session_status.c @@ -4,84 +4,27 @@ #include #include "pdu_session_status.h" -OpenAPI_pdu_session_status_t *OpenAPI_pdu_session_status_create( -) +char* OpenAPI_pdu_session_status_ToString(OpenAPI_pdu_session_status_e pdu_session_status) { - OpenAPI_pdu_session_status_t *pdu_session_status_local_var = ogs_malloc(sizeof(OpenAPI_pdu_session_status_t)); - ogs_assert(pdu_session_status_local_var); - - - return pdu_session_status_local_var; + const char *pdu_session_statusArray[] = { "NULL", "ACTIVE", "RELEASED" }; + size_t sizeofArray = sizeof(pdu_session_statusArray) / sizeof(pdu_session_statusArray[0]); + if (pdu_session_status < sizeofArray) + return (char *)pdu_session_statusArray[pdu_session_status]; + else + return (char *)"Unknown"; } -void OpenAPI_pdu_session_status_free(OpenAPI_pdu_session_status_t *pdu_session_status) +OpenAPI_pdu_session_status_e OpenAPI_pdu_session_status_FromString(char* pdu_session_status) { - OpenAPI_lnode_t *node = NULL; - - if (NULL == pdu_session_status) { - return; + int stringToReturn = 0; + const char *pdu_session_statusArray[] = { "NULL", "ACTIVE", "RELEASED" }; + size_t sizeofArray = sizeof(pdu_session_statusArray) / sizeof(pdu_session_statusArray[0]); + while (stringToReturn < sizeofArray) { + if (strcmp(pdu_session_status, pdu_session_statusArray[stringToReturn]) == 0) { + return stringToReturn; + } + stringToReturn++; } - ogs_free(pdu_session_status); -} - -cJSON *OpenAPI_pdu_session_status_convertToJSON(OpenAPI_pdu_session_status_t *pdu_session_status) -{ - cJSON *item = NULL; - OpenAPI_lnode_t *node = NULL; - - if (pdu_session_status == NULL) { - ogs_error("OpenAPI_pdu_session_status_convertToJSON() failed [PduSessionStatus]"); - return NULL; - } - - item = cJSON_CreateObject(); -end: - return item; -} - -OpenAPI_pdu_session_status_t *OpenAPI_pdu_session_status_parseFromJSON(cJSON *pdu_session_statusJSON) -{ - OpenAPI_pdu_session_status_t *pdu_session_status_local_var = NULL; - OpenAPI_lnode_t *node = NULL; - pdu_session_status_local_var = OpenAPI_pdu_session_status_create ( - ); - - return pdu_session_status_local_var; -end: - return NULL; -} - -OpenAPI_pdu_session_status_t *OpenAPI_pdu_session_status_copy(OpenAPI_pdu_session_status_t *dst, OpenAPI_pdu_session_status_t *src) -{ - cJSON *item = NULL; - char *content = NULL; - - ogs_assert(src); - item = OpenAPI_pdu_session_status_convertToJSON(src); - if (!item) { - ogs_error("OpenAPI_pdu_session_status_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_pdu_session_status_free(dst); - dst = OpenAPI_pdu_session_status_parseFromJSON(item); - cJSON_Delete(item); - - return dst; + return 0; } diff --git a/lib/sbi/openapi/model/pdu_session_status.h b/lib/sbi/openapi/model/pdu_session_status.h index a2c387167..bfa97441f 100644 --- a/lib/sbi/openapi/model/pdu_session_status.h +++ b/lib/sbi/openapi/model/pdu_session_status.h @@ -1,7 +1,7 @@ /* * pdu_session_status.h * - * Possible values are - \"ACTIVE\" - \"RELEASED\" + * */ #ifndef _OpenAPI_pdu_session_status_H_ @@ -12,22 +12,16 @@ #include "../include/list.h" #include "../include/keyValuePair.h" #include "../include/binary.h" -#include "pdu_session_status_any_of.h" #ifdef __cplusplus extern "C" { #endif -typedef struct OpenAPI_pdu_session_status_s OpenAPI_pdu_session_status_t; -typedef struct OpenAPI_pdu_session_status_s { -} OpenAPI_pdu_session_status_t; +typedef enum { OpenAPI_pdu_session_status_NULL = 0, OpenAPI_pdu_session_status_ACTIVE, OpenAPI_pdu_session_status_RELEASED } OpenAPI_pdu_session_status_e; -OpenAPI_pdu_session_status_t *OpenAPI_pdu_session_status_create( -); -void OpenAPI_pdu_session_status_free(OpenAPI_pdu_session_status_t *pdu_session_status); -OpenAPI_pdu_session_status_t *OpenAPI_pdu_session_status_parseFromJSON(cJSON *pdu_session_statusJSON); -cJSON *OpenAPI_pdu_session_status_convertToJSON(OpenAPI_pdu_session_status_t *pdu_session_status); -OpenAPI_pdu_session_status_t *OpenAPI_pdu_session_status_copy(OpenAPI_pdu_session_status_t *dst, OpenAPI_pdu_session_status_t *src); +char* OpenAPI_pdu_session_status_ToString(OpenAPI_pdu_session_status_e pdu_session_status); + +OpenAPI_pdu_session_status_e OpenAPI_pdu_session_status_FromString(char* pdu_session_status); #ifdef __cplusplus } diff --git a/lib/sbi/openapi/model/pdu_session_status_any_of.c b/lib/sbi/openapi/model/pdu_session_status_any_of.c deleted file mode 100644 index 1e3ccb336..000000000 --- a/lib/sbi/openapi/model/pdu_session_status_any_of.c +++ /dev/null @@ -1,30 +0,0 @@ - -#include -#include -#include -#include "pdu_session_status_any_of.h" - -char* OpenAPI_pdu_session_status_any_of_ToString(OpenAPI_pdu_session_status_any_of_e pdu_session_status_any_of) -{ - const char *pdu_session_status_any_ofArray[] = { "NULL", "ACTIVE", "RELEASED" }; - size_t sizeofArray = sizeof(pdu_session_status_any_ofArray) / sizeof(pdu_session_status_any_ofArray[0]); - if (pdu_session_status_any_of < sizeofArray) - return (char *)pdu_session_status_any_ofArray[pdu_session_status_any_of]; - else - return (char *)"Unknown"; -} - -OpenAPI_pdu_session_status_any_of_e OpenAPI_pdu_session_status_any_of_FromString(char* pdu_session_status_any_of) -{ - int stringToReturn = 0; - const char *pdu_session_status_any_ofArray[] = { "NULL", "ACTIVE", "RELEASED" }; - size_t sizeofArray = sizeof(pdu_session_status_any_ofArray) / sizeof(pdu_session_status_any_ofArray[0]); - while (stringToReturn < sizeofArray) { - if (strcmp(pdu_session_status_any_of, pdu_session_status_any_ofArray[stringToReturn]) == 0) { - return stringToReturn; - } - stringToReturn++; - } - return 0; -} - diff --git a/lib/sbi/openapi/model/pdu_session_status_any_of.h b/lib/sbi/openapi/model/pdu_session_status_any_of.h deleted file mode 100644 index 2b0df864f..000000000 --- a/lib/sbi/openapi/model/pdu_session_status_any_of.h +++ /dev/null @@ -1,31 +0,0 @@ -/* - * pdu_session_status_any_of.h - * - * - */ - -#ifndef _OpenAPI_pdu_session_status_any_of_H_ -#define _OpenAPI_pdu_session_status_any_of_H_ - -#include -#include "../external/cJSON.h" -#include "../include/list.h" -#include "../include/keyValuePair.h" -#include "../include/binary.h" - -#ifdef __cplusplus -extern "C" { -#endif - -typedef enum { OpenAPI_pdu_session_status_any_of_NULL = 0, OpenAPI_pdu_session_status_any_of_ACTIVE, OpenAPI_pdu_session_status_any_of_RELEASED } OpenAPI_pdu_session_status_any_of_e; - -char* OpenAPI_pdu_session_status_any_of_ToString(OpenAPI_pdu_session_status_any_of_e pdu_session_status_any_of); - -OpenAPI_pdu_session_status_any_of_e OpenAPI_pdu_session_status_any_of_FromString(char* pdu_session_status_any_of); - -#ifdef __cplusplus -} -#endif - -#endif /* _OpenAPI_pdu_session_status_any_of_H_ */ - diff --git a/lib/sbi/openapi/model/pdu_session_status_cfg_1.c b/lib/sbi/openapi/model/pdu_session_status_cfg_1.c new file mode 100644 index 000000000..9980cafe0 --- /dev/null +++ b/lib/sbi/openapi/model/pdu_session_status_cfg_1.c @@ -0,0 +1,110 @@ + +#include +#include +#include +#include "pdu_session_status_cfg_1.h" + +OpenAPI_pdu_session_status_cfg_1_t *OpenAPI_pdu_session_status_cfg_1_create( + char *dnn +) +{ + OpenAPI_pdu_session_status_cfg_1_t *pdu_session_status_cfg_1_local_var = ogs_malloc(sizeof(OpenAPI_pdu_session_status_cfg_1_t)); + ogs_assert(pdu_session_status_cfg_1_local_var); + + pdu_session_status_cfg_1_local_var->dnn = dnn; + + return pdu_session_status_cfg_1_local_var; +} + +void OpenAPI_pdu_session_status_cfg_1_free(OpenAPI_pdu_session_status_cfg_1_t *pdu_session_status_cfg_1) +{ + OpenAPI_lnode_t *node = NULL; + + if (NULL == pdu_session_status_cfg_1) { + return; + } + if (pdu_session_status_cfg_1->dnn) { + ogs_free(pdu_session_status_cfg_1->dnn); + pdu_session_status_cfg_1->dnn = NULL; + } + ogs_free(pdu_session_status_cfg_1); +} + +cJSON *OpenAPI_pdu_session_status_cfg_1_convertToJSON(OpenAPI_pdu_session_status_cfg_1_t *pdu_session_status_cfg_1) +{ + cJSON *item = NULL; + OpenAPI_lnode_t *node = NULL; + + if (pdu_session_status_cfg_1 == NULL) { + ogs_error("OpenAPI_pdu_session_status_cfg_1_convertToJSON() failed [PduSessionStatusCfg_1]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (pdu_session_status_cfg_1->dnn) { + if (cJSON_AddStringToObject(item, "dnn", pdu_session_status_cfg_1->dnn) == NULL) { + ogs_error("OpenAPI_pdu_session_status_cfg_1_convertToJSON() failed [dnn]"); + goto end; + } + } + +end: + return item; +} + +OpenAPI_pdu_session_status_cfg_1_t *OpenAPI_pdu_session_status_cfg_1_parseFromJSON(cJSON *pdu_session_status_cfg_1JSON) +{ + OpenAPI_pdu_session_status_cfg_1_t *pdu_session_status_cfg_1_local_var = NULL; + OpenAPI_lnode_t *node = NULL; + cJSON *dnn = NULL; + dnn = cJSON_GetObjectItemCaseSensitive(pdu_session_status_cfg_1JSON, "dnn"); + if (dnn) { + if (!cJSON_IsString(dnn) && !cJSON_IsNull(dnn)) { + ogs_error("OpenAPI_pdu_session_status_cfg_1_parseFromJSON() failed [dnn]"); + goto end; + } + } + + pdu_session_status_cfg_1_local_var = OpenAPI_pdu_session_status_cfg_1_create ( + dnn && !cJSON_IsNull(dnn) ? ogs_strdup(dnn->valuestring) : NULL + ); + + return pdu_session_status_cfg_1_local_var; +end: + return NULL; +} + +OpenAPI_pdu_session_status_cfg_1_t *OpenAPI_pdu_session_status_cfg_1_copy(OpenAPI_pdu_session_status_cfg_1_t *dst, OpenAPI_pdu_session_status_cfg_1_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_pdu_session_status_cfg_1_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_pdu_session_status_cfg_1_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_pdu_session_status_cfg_1_free(dst); + dst = OpenAPI_pdu_session_status_cfg_1_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/pdu_session_status_cfg_1.h b/lib/sbi/openapi/model/pdu_session_status_cfg_1.h new file mode 100644 index 000000000..136fad0d0 --- /dev/null +++ b/lib/sbi/openapi/model/pdu_session_status_cfg_1.h @@ -0,0 +1,38 @@ +/* + * pdu_session_status_cfg_1.h + * + * + */ + +#ifndef _OpenAPI_pdu_session_status_cfg_1_H_ +#define _OpenAPI_pdu_session_status_cfg_1_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_pdu_session_status_cfg_1_s OpenAPI_pdu_session_status_cfg_1_t; +typedef struct OpenAPI_pdu_session_status_cfg_1_s { + char *dnn; +} OpenAPI_pdu_session_status_cfg_1_t; + +OpenAPI_pdu_session_status_cfg_1_t *OpenAPI_pdu_session_status_cfg_1_create( + char *dnn +); +void OpenAPI_pdu_session_status_cfg_1_free(OpenAPI_pdu_session_status_cfg_1_t *pdu_session_status_cfg_1); +OpenAPI_pdu_session_status_cfg_1_t *OpenAPI_pdu_session_status_cfg_1_parseFromJSON(cJSON *pdu_session_status_cfg_1JSON); +cJSON *OpenAPI_pdu_session_status_cfg_1_convertToJSON(OpenAPI_pdu_session_status_cfg_1_t *pdu_session_status_cfg_1); +OpenAPI_pdu_session_status_cfg_1_t *OpenAPI_pdu_session_status_cfg_1_copy(OpenAPI_pdu_session_status_cfg_1_t *dst, OpenAPI_pdu_session_status_cfg_1_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_pdu_session_status_cfg_1_H_ */ + diff --git a/lib/sbi/openapi/model/pdu_session_tsn_bridge.c b/lib/sbi/openapi/model/pdu_session_tsn_bridge.c index 637050bc4..72d44f48b 100644 --- a/lib/sbi/openapi/model/pdu_session_tsn_bridge.c +++ b/lib/sbi/openapi/model/pdu_session_tsn_bridge.c @@ -8,7 +8,12 @@ OpenAPI_pdu_session_tsn_bridge_t *OpenAPI_pdu_session_tsn_bridge_create( OpenAPI_tsn_bridge_info_t *tsn_bridge_info, OpenAPI_bridge_management_container_t *tsn_bridge_man_cont, OpenAPI_port_management_container_t *tsn_port_man_cont_dstt, - OpenAPI_list_t *tsn_port_man_cont_nwtts + OpenAPI_list_t *tsn_port_man_cont_nwtts, + char *ue_ipv4_addr, + char *dnn, + OpenAPI_snssai_t *snssai, + char *ip_domain, + char *ue_ipv6_addr_prefix ) { OpenAPI_pdu_session_tsn_bridge_t *pdu_session_tsn_bridge_local_var = ogs_malloc(sizeof(OpenAPI_pdu_session_tsn_bridge_t)); @@ -18,6 +23,11 @@ OpenAPI_pdu_session_tsn_bridge_t *OpenAPI_pdu_session_tsn_bridge_create( pdu_session_tsn_bridge_local_var->tsn_bridge_man_cont = tsn_bridge_man_cont; pdu_session_tsn_bridge_local_var->tsn_port_man_cont_dstt = tsn_port_man_cont_dstt; pdu_session_tsn_bridge_local_var->tsn_port_man_cont_nwtts = tsn_port_man_cont_nwtts; + pdu_session_tsn_bridge_local_var->ue_ipv4_addr = ue_ipv4_addr; + pdu_session_tsn_bridge_local_var->dnn = dnn; + pdu_session_tsn_bridge_local_var->snssai = snssai; + pdu_session_tsn_bridge_local_var->ip_domain = ip_domain; + pdu_session_tsn_bridge_local_var->ue_ipv6_addr_prefix = ue_ipv6_addr_prefix; return pdu_session_tsn_bridge_local_var; } @@ -48,6 +58,26 @@ void OpenAPI_pdu_session_tsn_bridge_free(OpenAPI_pdu_session_tsn_bridge_t *pdu_s OpenAPI_list_free(pdu_session_tsn_bridge->tsn_port_man_cont_nwtts); pdu_session_tsn_bridge->tsn_port_man_cont_nwtts = NULL; } + if (pdu_session_tsn_bridge->ue_ipv4_addr) { + ogs_free(pdu_session_tsn_bridge->ue_ipv4_addr); + pdu_session_tsn_bridge->ue_ipv4_addr = NULL; + } + if (pdu_session_tsn_bridge->dnn) { + ogs_free(pdu_session_tsn_bridge->dnn); + pdu_session_tsn_bridge->dnn = NULL; + } + if (pdu_session_tsn_bridge->snssai) { + OpenAPI_snssai_free(pdu_session_tsn_bridge->snssai); + pdu_session_tsn_bridge->snssai = NULL; + } + if (pdu_session_tsn_bridge->ip_domain) { + ogs_free(pdu_session_tsn_bridge->ip_domain); + pdu_session_tsn_bridge->ip_domain = NULL; + } + if (pdu_session_tsn_bridge->ue_ipv6_addr_prefix) { + ogs_free(pdu_session_tsn_bridge->ue_ipv6_addr_prefix); + pdu_session_tsn_bridge->ue_ipv6_addr_prefix = NULL; + } ogs_free(pdu_session_tsn_bridge); } @@ -119,6 +149,47 @@ cJSON *OpenAPI_pdu_session_tsn_bridge_convertToJSON(OpenAPI_pdu_session_tsn_brid } } + if (pdu_session_tsn_bridge->ue_ipv4_addr) { + if (cJSON_AddStringToObject(item, "ueIpv4Addr", pdu_session_tsn_bridge->ue_ipv4_addr) == NULL) { + ogs_error("OpenAPI_pdu_session_tsn_bridge_convertToJSON() failed [ue_ipv4_addr]"); + goto end; + } + } + + if (pdu_session_tsn_bridge->dnn) { + if (cJSON_AddStringToObject(item, "dnn", pdu_session_tsn_bridge->dnn) == NULL) { + ogs_error("OpenAPI_pdu_session_tsn_bridge_convertToJSON() failed [dnn]"); + goto end; + } + } + + if (pdu_session_tsn_bridge->snssai) { + cJSON *snssai_local_JSON = OpenAPI_snssai_convertToJSON(pdu_session_tsn_bridge->snssai); + if (snssai_local_JSON == NULL) { + ogs_error("OpenAPI_pdu_session_tsn_bridge_convertToJSON() failed [snssai]"); + goto end; + } + cJSON_AddItemToObject(item, "snssai", snssai_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_pdu_session_tsn_bridge_convertToJSON() failed [snssai]"); + goto end; + } + } + + if (pdu_session_tsn_bridge->ip_domain) { + if (cJSON_AddStringToObject(item, "ipDomain", pdu_session_tsn_bridge->ip_domain) == NULL) { + ogs_error("OpenAPI_pdu_session_tsn_bridge_convertToJSON() failed [ip_domain]"); + goto end; + } + } + + if (pdu_session_tsn_bridge->ue_ipv6_addr_prefix) { + if (cJSON_AddStringToObject(item, "ueIpv6AddrPrefix", pdu_session_tsn_bridge->ue_ipv6_addr_prefix) == NULL) { + ogs_error("OpenAPI_pdu_session_tsn_bridge_convertToJSON() failed [ue_ipv6_addr_prefix]"); + goto end; + } + } + end: return item; } @@ -135,6 +206,12 @@ OpenAPI_pdu_session_tsn_bridge_t *OpenAPI_pdu_session_tsn_bridge_parseFromJSON(c 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 *ue_ipv4_addr = NULL; + cJSON *dnn = NULL; + cJSON *snssai = NULL; + OpenAPI_snssai_t *snssai_local_nonprim = NULL; + cJSON *ip_domain = NULL; + cJSON *ue_ipv6_addr_prefix = NULL; tsn_bridge_info = cJSON_GetObjectItemCaseSensitive(pdu_session_tsn_bridgeJSON, "tsnBridgeInfo"); if (!tsn_bridge_info) { ogs_error("OpenAPI_pdu_session_tsn_bridge_parseFromJSON() failed [tsn_bridge_info]"); @@ -177,11 +254,53 @@ OpenAPI_pdu_session_tsn_bridge_t *OpenAPI_pdu_session_tsn_bridge_parseFromJSON(c } } + ue_ipv4_addr = cJSON_GetObjectItemCaseSensitive(pdu_session_tsn_bridgeJSON, "ueIpv4Addr"); + if (ue_ipv4_addr) { + if (!cJSON_IsString(ue_ipv4_addr) && !cJSON_IsNull(ue_ipv4_addr)) { + ogs_error("OpenAPI_pdu_session_tsn_bridge_parseFromJSON() failed [ue_ipv4_addr]"); + goto end; + } + } + + dnn = cJSON_GetObjectItemCaseSensitive(pdu_session_tsn_bridgeJSON, "dnn"); + if (dnn) { + if (!cJSON_IsString(dnn) && !cJSON_IsNull(dnn)) { + ogs_error("OpenAPI_pdu_session_tsn_bridge_parseFromJSON() failed [dnn]"); + goto end; + } + } + + snssai = cJSON_GetObjectItemCaseSensitive(pdu_session_tsn_bridgeJSON, "snssai"); + if (snssai) { + snssai_local_nonprim = OpenAPI_snssai_parseFromJSON(snssai); + } + + ip_domain = cJSON_GetObjectItemCaseSensitive(pdu_session_tsn_bridgeJSON, "ipDomain"); + if (ip_domain) { + if (!cJSON_IsString(ip_domain) && !cJSON_IsNull(ip_domain)) { + ogs_error("OpenAPI_pdu_session_tsn_bridge_parseFromJSON() failed [ip_domain]"); + goto end; + } + } + + ue_ipv6_addr_prefix = cJSON_GetObjectItemCaseSensitive(pdu_session_tsn_bridgeJSON, "ueIpv6AddrPrefix"); + if (ue_ipv6_addr_prefix) { + if (!cJSON_IsString(ue_ipv6_addr_prefix) && !cJSON_IsNull(ue_ipv6_addr_prefix)) { + ogs_error("OpenAPI_pdu_session_tsn_bridge_parseFromJSON() failed [ue_ipv6_addr_prefix]"); + goto end; + } + } + pdu_session_tsn_bridge_local_var = OpenAPI_pdu_session_tsn_bridge_create ( tsn_bridge_info_local_nonprim, tsn_bridge_man_cont ? tsn_bridge_man_cont_local_nonprim : NULL, tsn_port_man_cont_dstt ? tsn_port_man_cont_dstt_local_nonprim : NULL, - tsn_port_man_cont_nwtts ? tsn_port_man_cont_nwttsList : NULL + tsn_port_man_cont_nwtts ? tsn_port_man_cont_nwttsList : NULL, + ue_ipv4_addr && !cJSON_IsNull(ue_ipv4_addr) ? ogs_strdup(ue_ipv4_addr->valuestring) : NULL, + dnn && !cJSON_IsNull(dnn) ? ogs_strdup(dnn->valuestring) : NULL, + snssai ? snssai_local_nonprim : NULL, + ip_domain && !cJSON_IsNull(ip_domain) ? ogs_strdup(ip_domain->valuestring) : NULL, + ue_ipv6_addr_prefix && !cJSON_IsNull(ue_ipv6_addr_prefix) ? ogs_strdup(ue_ipv6_addr_prefix->valuestring) : NULL ); return pdu_session_tsn_bridge_local_var; @@ -205,6 +324,10 @@ end: OpenAPI_list_free(tsn_port_man_cont_nwttsList); tsn_port_man_cont_nwttsList = NULL; } + if (snssai_local_nonprim) { + OpenAPI_snssai_free(snssai_local_nonprim); + snssai_local_nonprim = NULL; + } return NULL; } diff --git a/lib/sbi/openapi/model/pdu_session_tsn_bridge.h b/lib/sbi/openapi/model/pdu_session_tsn_bridge.h index 146e95e01..251cd34e8 100644 --- a/lib/sbi/openapi/model/pdu_session_tsn_bridge.h +++ b/lib/sbi/openapi/model/pdu_session_tsn_bridge.h @@ -1,7 +1,7 @@ /* * pdu_session_tsn_bridge.h * - * Contains the new 5GS Bridge information and may contain the DS-TT port and/or NW-TT port management information. + * Contains the new TSC user plane node information and may contain the DS-TT port and/or NW-TT port management information. */ #ifndef _OpenAPI_pdu_session_tsn_bridge_H_ @@ -14,6 +14,7 @@ #include "../include/binary.h" #include "bridge_management_container.h" #include "port_management_container.h" +#include "snssai.h" #include "tsn_bridge_info.h" #ifdef __cplusplus @@ -26,13 +27,23 @@ typedef struct OpenAPI_pdu_session_tsn_bridge_s { struct OpenAPI_bridge_management_container_s *tsn_bridge_man_cont; struct OpenAPI_port_management_container_s *tsn_port_man_cont_dstt; OpenAPI_list_t *tsn_port_man_cont_nwtts; + char *ue_ipv4_addr; + char *dnn; + struct OpenAPI_snssai_s *snssai; + char *ip_domain; + char *ue_ipv6_addr_prefix; } OpenAPI_pdu_session_tsn_bridge_t; OpenAPI_pdu_session_tsn_bridge_t *OpenAPI_pdu_session_tsn_bridge_create( OpenAPI_tsn_bridge_info_t *tsn_bridge_info, OpenAPI_bridge_management_container_t *tsn_bridge_man_cont, OpenAPI_port_management_container_t *tsn_port_man_cont_dstt, - OpenAPI_list_t *tsn_port_man_cont_nwtts + OpenAPI_list_t *tsn_port_man_cont_nwtts, + char *ue_ipv4_addr, + char *dnn, + OpenAPI_snssai_t *snssai, + char *ip_domain, + char *ue_ipv6_addr_prefix ); void OpenAPI_pdu_session_tsn_bridge_free(OpenAPI_pdu_session_tsn_bridge_t *pdu_session_tsn_bridge); OpenAPI_pdu_session_tsn_bridge_t *OpenAPI_pdu_session_tsn_bridge_parseFromJSON(cJSON *pdu_session_tsn_bridgeJSON); diff --git a/lib/sbi/openapi/model/pdu_session_types.c b/lib/sbi/openapi/model/pdu_session_types.c index 3fc80d6cc..0ee69e786 100644 --- a/lib/sbi/openapi/model/pdu_session_types.c +++ b/lib/sbi/openapi/model/pdu_session_types.c @@ -43,14 +43,12 @@ cJSON *OpenAPI_pdu_session_types_convertToJSON(OpenAPI_pdu_session_types_t *pdu_ } item = cJSON_CreateObject(); - if (pdu_session_types->default_session_type == OpenAPI_pdu_session_type_NULL) { - ogs_error("OpenAPI_pdu_session_types_convertToJSON() failed [default_session_type]"); - return NULL; - } + if (pdu_session_types->default_session_type != OpenAPI_pdu_session_type_NULL) { if (cJSON_AddStringToObject(item, "defaultSessionType", OpenAPI_pdu_session_type_ToString(pdu_session_types->default_session_type)) == NULL) { ogs_error("OpenAPI_pdu_session_types_convertToJSON() failed [default_session_type]"); goto end; } + } if (pdu_session_types->allowed_session_types != OpenAPI_pdu_session_type_NULL) { cJSON *allowed_session_typesList = cJSON_AddArrayToObject(item, "allowedSessionTypes"); @@ -79,15 +77,13 @@ OpenAPI_pdu_session_types_t *OpenAPI_pdu_session_types_parseFromJSON(cJSON *pdu_ cJSON *allowed_session_types = NULL; OpenAPI_list_t *allowed_session_typesList = NULL; default_session_type = cJSON_GetObjectItemCaseSensitive(pdu_session_typesJSON, "defaultSessionType"); - if (!default_session_type) { - ogs_error("OpenAPI_pdu_session_types_parseFromJSON() failed [default_session_type]"); - goto end; - } + if (default_session_type) { if (!cJSON_IsString(default_session_type)) { ogs_error("OpenAPI_pdu_session_types_parseFromJSON() failed [default_session_type]"); goto end; } default_session_typeVariable = OpenAPI_pdu_session_type_FromString(default_session_type->valuestring); + } allowed_session_types = cJSON_GetObjectItemCaseSensitive(pdu_session_typesJSON, "allowedSessionTypes"); if (allowed_session_types) { @@ -109,7 +105,7 @@ OpenAPI_pdu_session_types_t *OpenAPI_pdu_session_types_parseFromJSON(cJSON *pdu_ } pdu_session_types_local_var = OpenAPI_pdu_session_types_create ( - default_session_typeVariable, + default_session_type ? default_session_typeVariable : 0, allowed_session_types ? allowed_session_typesList : NULL ); diff --git a/lib/sbi/openapi/model/pdu_session_types_1.c b/lib/sbi/openapi/model/pdu_session_types_1.c index 0658aa721..70531a287 100644 --- a/lib/sbi/openapi/model/pdu_session_types_1.c +++ b/lib/sbi/openapi/model/pdu_session_types_1.c @@ -43,14 +43,12 @@ cJSON *OpenAPI_pdu_session_types_1_convertToJSON(OpenAPI_pdu_session_types_1_t * } item = cJSON_CreateObject(); - if (pdu_session_types_1->default_session_type == OpenAPI_pdu_session_type_NULL) { - ogs_error("OpenAPI_pdu_session_types_1_convertToJSON() failed [default_session_type]"); - return NULL; - } + if (pdu_session_types_1->default_session_type != OpenAPI_pdu_session_type_NULL) { if (cJSON_AddStringToObject(item, "defaultSessionType", OpenAPI_pdu_session_type_ToString(pdu_session_types_1->default_session_type)) == NULL) { ogs_error("OpenAPI_pdu_session_types_1_convertToJSON() failed [default_session_type]"); goto end; } + } if (pdu_session_types_1->allowed_session_types != OpenAPI_pdu_session_type_NULL) { cJSON *allowed_session_typesList = cJSON_AddArrayToObject(item, "allowedSessionTypes"); @@ -79,15 +77,13 @@ OpenAPI_pdu_session_types_1_t *OpenAPI_pdu_session_types_1_parseFromJSON(cJSON * cJSON *allowed_session_types = NULL; OpenAPI_list_t *allowed_session_typesList = NULL; default_session_type = cJSON_GetObjectItemCaseSensitive(pdu_session_types_1JSON, "defaultSessionType"); - if (!default_session_type) { - ogs_error("OpenAPI_pdu_session_types_1_parseFromJSON() failed [default_session_type]"); - goto end; - } + if (default_session_type) { if (!cJSON_IsString(default_session_type)) { ogs_error("OpenAPI_pdu_session_types_1_parseFromJSON() failed [default_session_type]"); goto end; } default_session_typeVariable = OpenAPI_pdu_session_type_FromString(default_session_type->valuestring); + } allowed_session_types = cJSON_GetObjectItemCaseSensitive(pdu_session_types_1JSON, "allowedSessionTypes"); if (allowed_session_types) { @@ -109,7 +105,7 @@ OpenAPI_pdu_session_types_1_t *OpenAPI_pdu_session_types_1_parseFromJSON(cJSON * } pdu_session_types_1_local_var = OpenAPI_pdu_session_types_1_create ( - default_session_typeVariable, + default_session_type ? default_session_typeVariable : 0, allowed_session_types ? allowed_session_typesList : NULL ); diff --git a/lib/sbi/openapi/model/perf_data.c b/lib/sbi/openapi/model/perf_data.c new file mode 100644 index 000000000..5c0d3ac65 --- /dev/null +++ b/lib/sbi/openapi/model/perf_data.c @@ -0,0 +1,199 @@ + +#include +#include +#include +#include "perf_data.h" + +OpenAPI_perf_data_t *OpenAPI_perf_data_create( + char *avg_traffic_rate, + char *max_traffic_rate, + bool is_ave_packet_delay, + int ave_packet_delay, + bool is_max_packet_delay, + int max_packet_delay, + bool is_avg_packet_loss_rate, + int avg_packet_loss_rate +) +{ + OpenAPI_perf_data_t *perf_data_local_var = ogs_malloc(sizeof(OpenAPI_perf_data_t)); + ogs_assert(perf_data_local_var); + + perf_data_local_var->avg_traffic_rate = avg_traffic_rate; + perf_data_local_var->max_traffic_rate = max_traffic_rate; + perf_data_local_var->is_ave_packet_delay = is_ave_packet_delay; + perf_data_local_var->ave_packet_delay = ave_packet_delay; + perf_data_local_var->is_max_packet_delay = is_max_packet_delay; + perf_data_local_var->max_packet_delay = max_packet_delay; + perf_data_local_var->is_avg_packet_loss_rate = is_avg_packet_loss_rate; + perf_data_local_var->avg_packet_loss_rate = avg_packet_loss_rate; + + return perf_data_local_var; +} + +void OpenAPI_perf_data_free(OpenAPI_perf_data_t *perf_data) +{ + OpenAPI_lnode_t *node = NULL; + + if (NULL == perf_data) { + return; + } + if (perf_data->avg_traffic_rate) { + ogs_free(perf_data->avg_traffic_rate); + perf_data->avg_traffic_rate = NULL; + } + if (perf_data->max_traffic_rate) { + ogs_free(perf_data->max_traffic_rate); + perf_data->max_traffic_rate = NULL; + } + ogs_free(perf_data); +} + +cJSON *OpenAPI_perf_data_convertToJSON(OpenAPI_perf_data_t *perf_data) +{ + cJSON *item = NULL; + OpenAPI_lnode_t *node = NULL; + + if (perf_data == NULL) { + ogs_error("OpenAPI_perf_data_convertToJSON() failed [PerfData]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (perf_data->avg_traffic_rate) { + if (cJSON_AddStringToObject(item, "avgTrafficRate", perf_data->avg_traffic_rate) == NULL) { + ogs_error("OpenAPI_perf_data_convertToJSON() failed [avg_traffic_rate]"); + goto end; + } + } + + if (perf_data->max_traffic_rate) { + if (cJSON_AddStringToObject(item, "maxTrafficRate", perf_data->max_traffic_rate) == NULL) { + ogs_error("OpenAPI_perf_data_convertToJSON() failed [max_traffic_rate]"); + goto end; + } + } + + if (perf_data->is_ave_packet_delay) { + if (cJSON_AddNumberToObject(item, "avePacketDelay", perf_data->ave_packet_delay) == NULL) { + ogs_error("OpenAPI_perf_data_convertToJSON() failed [ave_packet_delay]"); + goto end; + } + } + + if (perf_data->is_max_packet_delay) { + if (cJSON_AddNumberToObject(item, "maxPacketDelay", perf_data->max_packet_delay) == NULL) { + ogs_error("OpenAPI_perf_data_convertToJSON() failed [max_packet_delay]"); + goto end; + } + } + + if (perf_data->is_avg_packet_loss_rate) { + if (cJSON_AddNumberToObject(item, "avgPacketLossRate", perf_data->avg_packet_loss_rate) == NULL) { + ogs_error("OpenAPI_perf_data_convertToJSON() failed [avg_packet_loss_rate]"); + goto end; + } + } + +end: + return item; +} + +OpenAPI_perf_data_t *OpenAPI_perf_data_parseFromJSON(cJSON *perf_dataJSON) +{ + OpenAPI_perf_data_t *perf_data_local_var = NULL; + OpenAPI_lnode_t *node = NULL; + cJSON *avg_traffic_rate = NULL; + cJSON *max_traffic_rate = NULL; + cJSON *ave_packet_delay = NULL; + cJSON *max_packet_delay = NULL; + cJSON *avg_packet_loss_rate = NULL; + avg_traffic_rate = cJSON_GetObjectItemCaseSensitive(perf_dataJSON, "avgTrafficRate"); + if (avg_traffic_rate) { + if (!cJSON_IsString(avg_traffic_rate) && !cJSON_IsNull(avg_traffic_rate)) { + ogs_error("OpenAPI_perf_data_parseFromJSON() failed [avg_traffic_rate]"); + goto end; + } + } + + max_traffic_rate = cJSON_GetObjectItemCaseSensitive(perf_dataJSON, "maxTrafficRate"); + if (max_traffic_rate) { + if (!cJSON_IsString(max_traffic_rate) && !cJSON_IsNull(max_traffic_rate)) { + ogs_error("OpenAPI_perf_data_parseFromJSON() failed [max_traffic_rate]"); + goto end; + } + } + + ave_packet_delay = cJSON_GetObjectItemCaseSensitive(perf_dataJSON, "avePacketDelay"); + if (ave_packet_delay) { + if (!cJSON_IsNumber(ave_packet_delay)) { + ogs_error("OpenAPI_perf_data_parseFromJSON() failed [ave_packet_delay]"); + goto end; + } + } + + max_packet_delay = cJSON_GetObjectItemCaseSensitive(perf_dataJSON, "maxPacketDelay"); + if (max_packet_delay) { + if (!cJSON_IsNumber(max_packet_delay)) { + ogs_error("OpenAPI_perf_data_parseFromJSON() failed [max_packet_delay]"); + goto end; + } + } + + avg_packet_loss_rate = cJSON_GetObjectItemCaseSensitive(perf_dataJSON, "avgPacketLossRate"); + if (avg_packet_loss_rate) { + if (!cJSON_IsNumber(avg_packet_loss_rate)) { + ogs_error("OpenAPI_perf_data_parseFromJSON() failed [avg_packet_loss_rate]"); + goto end; + } + } + + perf_data_local_var = OpenAPI_perf_data_create ( + avg_traffic_rate && !cJSON_IsNull(avg_traffic_rate) ? ogs_strdup(avg_traffic_rate->valuestring) : NULL, + max_traffic_rate && !cJSON_IsNull(max_traffic_rate) ? ogs_strdup(max_traffic_rate->valuestring) : NULL, + ave_packet_delay ? true : false, + ave_packet_delay ? ave_packet_delay->valuedouble : 0, + max_packet_delay ? true : false, + max_packet_delay ? max_packet_delay->valuedouble : 0, + avg_packet_loss_rate ? true : false, + avg_packet_loss_rate ? avg_packet_loss_rate->valuedouble : 0 + ); + + return perf_data_local_var; +end: + return NULL; +} + +OpenAPI_perf_data_t *OpenAPI_perf_data_copy(OpenAPI_perf_data_t *dst, OpenAPI_perf_data_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_perf_data_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_perf_data_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_perf_data_free(dst); + dst = OpenAPI_perf_data_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/perf_data.h b/lib/sbi/openapi/model/perf_data.h new file mode 100644 index 000000000..d0157e48c --- /dev/null +++ b/lib/sbi/openapi/model/perf_data.h @@ -0,0 +1,52 @@ +/* + * perf_data.h + * + * Represents DN performance data. + */ + +#ifndef _OpenAPI_perf_data_H_ +#define _OpenAPI_perf_data_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_perf_data_s OpenAPI_perf_data_t; +typedef struct OpenAPI_perf_data_s { + char *avg_traffic_rate; + char *max_traffic_rate; + bool is_ave_packet_delay; + int ave_packet_delay; + bool is_max_packet_delay; + int max_packet_delay; + bool is_avg_packet_loss_rate; + int avg_packet_loss_rate; +} OpenAPI_perf_data_t; + +OpenAPI_perf_data_t *OpenAPI_perf_data_create( + char *avg_traffic_rate, + char *max_traffic_rate, + bool is_ave_packet_delay, + int ave_packet_delay, + bool is_max_packet_delay, + int max_packet_delay, + bool is_avg_packet_loss_rate, + int avg_packet_loss_rate +); +void OpenAPI_perf_data_free(OpenAPI_perf_data_t *perf_data); +OpenAPI_perf_data_t *OpenAPI_perf_data_parseFromJSON(cJSON *perf_dataJSON); +cJSON *OpenAPI_perf_data_convertToJSON(OpenAPI_perf_data_t *perf_data); +OpenAPI_perf_data_t *OpenAPI_perf_data_copy(OpenAPI_perf_data_t *dst, OpenAPI_perf_data_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_perf_data_H_ */ + diff --git a/lib/sbi/openapi/model/periodicity.h b/lib/sbi/openapi/model/periodicity.h index 14971e3fe..99115102c 100644 --- a/lib/sbi/openapi/model/periodicity.h +++ b/lib/sbi/openapi/model/periodicity.h @@ -1,7 +1,7 @@ /* * periodicity.h * - * + * Represents the time period. */ #ifndef _OpenAPI_periodicity_H_ diff --git a/lib/sbi/openapi/model/pfd_change_notification.h b/lib/sbi/openapi/model/pfd_change_notification.h index 4b75ec325..56c4d2421 100644 --- a/lib/sbi/openapi/model/pfd_change_notification.h +++ b/lib/sbi/openapi/model/pfd_change_notification.h @@ -1,7 +1,7 @@ /* * pfd_change_notification.h * - * + * Represents information related to a notification of PFD change. */ #ifndef _OpenAPI_pfd_change_notification_H_ diff --git a/lib/sbi/openapi/model/pfd_content.h b/lib/sbi/openapi/model/pfd_content.h index 1f506b547..7d5855032 100644 --- a/lib/sbi/openapi/model/pfd_content.h +++ b/lib/sbi/openapi/model/pfd_content.h @@ -1,7 +1,7 @@ /* * pfd_content.h * - * + * Represents the content of a PFD for an application identifier. */ #ifndef _OpenAPI_pfd_content_H_ diff --git a/lib/sbi/openapi/model/pfd_data_for_app.c b/lib/sbi/openapi/model/pfd_data_for_app.c deleted file mode 100644 index c3f32b2cc..000000000 --- a/lib/sbi/openapi/model/pfd_data_for_app.c +++ /dev/null @@ -1,201 +0,0 @@ - -#include -#include -#include -#include "pfd_data_for_app.h" - -OpenAPI_pfd_data_for_app_t *OpenAPI_pfd_data_for_app_create( - char *application_id, - OpenAPI_list_t *pfds, - char *caching_time -) -{ - OpenAPI_pfd_data_for_app_t *pfd_data_for_app_local_var = ogs_malloc(sizeof(OpenAPI_pfd_data_for_app_t)); - ogs_assert(pfd_data_for_app_local_var); - - pfd_data_for_app_local_var->application_id = application_id; - pfd_data_for_app_local_var->pfds = pfds; - pfd_data_for_app_local_var->caching_time = caching_time; - - return pfd_data_for_app_local_var; -} - -void OpenAPI_pfd_data_for_app_free(OpenAPI_pfd_data_for_app_t *pfd_data_for_app) -{ - OpenAPI_lnode_t *node = NULL; - - if (NULL == pfd_data_for_app) { - return; - } - if (pfd_data_for_app->application_id) { - ogs_free(pfd_data_for_app->application_id); - pfd_data_for_app->application_id = NULL; - } - if (pfd_data_for_app->pfds) { - OpenAPI_list_for_each(pfd_data_for_app->pfds, node) { - OpenAPI_pfd_content_free(node->data); - } - OpenAPI_list_free(pfd_data_for_app->pfds); - pfd_data_for_app->pfds = NULL; - } - if (pfd_data_for_app->caching_time) { - ogs_free(pfd_data_for_app->caching_time); - pfd_data_for_app->caching_time = NULL; - } - ogs_free(pfd_data_for_app); -} - -cJSON *OpenAPI_pfd_data_for_app_convertToJSON(OpenAPI_pfd_data_for_app_t *pfd_data_for_app) -{ - cJSON *item = NULL; - OpenAPI_lnode_t *node = NULL; - - if (pfd_data_for_app == NULL) { - ogs_error("OpenAPI_pfd_data_for_app_convertToJSON() failed [PfdDataForApp]"); - return NULL; - } - - item = cJSON_CreateObject(); - if (!pfd_data_for_app->application_id) { - ogs_error("OpenAPI_pfd_data_for_app_convertToJSON() failed [application_id]"); - return NULL; - } - if (cJSON_AddStringToObject(item, "applicationId", pfd_data_for_app->application_id) == NULL) { - ogs_error("OpenAPI_pfd_data_for_app_convertToJSON() failed [application_id]"); - goto end; - } - - if (!pfd_data_for_app->pfds) { - ogs_error("OpenAPI_pfd_data_for_app_convertToJSON() failed [pfds]"); - return NULL; - } - cJSON *pfdsList = cJSON_AddArrayToObject(item, "pfds"); - if (pfdsList == NULL) { - ogs_error("OpenAPI_pfd_data_for_app_convertToJSON() failed [pfds]"); - goto end; - } - OpenAPI_list_for_each(pfd_data_for_app->pfds, node) { - cJSON *itemLocal = OpenAPI_pfd_content_convertToJSON(node->data); - if (itemLocal == NULL) { - ogs_error("OpenAPI_pfd_data_for_app_convertToJSON() failed [pfds]"); - goto end; - } - cJSON_AddItemToArray(pfdsList, itemLocal); - } - - if (pfd_data_for_app->caching_time) { - if (cJSON_AddStringToObject(item, "cachingTime", pfd_data_for_app->caching_time) == NULL) { - ogs_error("OpenAPI_pfd_data_for_app_convertToJSON() failed [caching_time]"); - goto end; - } - } - -end: - return item; -} - -OpenAPI_pfd_data_for_app_t *OpenAPI_pfd_data_for_app_parseFromJSON(cJSON *pfd_data_for_appJSON) -{ - OpenAPI_pfd_data_for_app_t *pfd_data_for_app_local_var = NULL; - OpenAPI_lnode_t *node = NULL; - cJSON *application_id = NULL; - cJSON *pfds = NULL; - OpenAPI_list_t *pfdsList = NULL; - cJSON *caching_time = NULL; - application_id = cJSON_GetObjectItemCaseSensitive(pfd_data_for_appJSON, "applicationId"); - if (!application_id) { - ogs_error("OpenAPI_pfd_data_for_app_parseFromJSON() failed [application_id]"); - goto end; - } - if (!cJSON_IsString(application_id)) { - ogs_error("OpenAPI_pfd_data_for_app_parseFromJSON() failed [application_id]"); - goto end; - } - - pfds = cJSON_GetObjectItemCaseSensitive(pfd_data_for_appJSON, "pfds"); - if (!pfds) { - ogs_error("OpenAPI_pfd_data_for_app_parseFromJSON() failed [pfds]"); - goto end; - } - cJSON *pfds_local = NULL; - if (!cJSON_IsArray(pfds)) { - ogs_error("OpenAPI_pfd_data_for_app_parseFromJSON() failed [pfds]"); - goto end; - } - - pfdsList = OpenAPI_list_create(); - - cJSON_ArrayForEach(pfds_local, pfds) { - if (!cJSON_IsObject(pfds_local)) { - ogs_error("OpenAPI_pfd_data_for_app_parseFromJSON() failed [pfds]"); - goto end; - } - OpenAPI_pfd_content_t *pfdsItem = OpenAPI_pfd_content_parseFromJSON(pfds_local); - if (!pfdsItem) { - ogs_error("No pfdsItem"); - OpenAPI_list_free(pfdsList); - goto end; - } - OpenAPI_list_add(pfdsList, pfdsItem); - } - - caching_time = cJSON_GetObjectItemCaseSensitive(pfd_data_for_appJSON, "cachingTime"); - if (caching_time) { - if (!cJSON_IsString(caching_time) && !cJSON_IsNull(caching_time)) { - ogs_error("OpenAPI_pfd_data_for_app_parseFromJSON() failed [caching_time]"); - goto end; - } - } - - pfd_data_for_app_local_var = OpenAPI_pfd_data_for_app_create ( - ogs_strdup(application_id->valuestring), - pfdsList, - caching_time && !cJSON_IsNull(caching_time) ? ogs_strdup(caching_time->valuestring) : NULL - ); - - return pfd_data_for_app_local_var; -end: - if (pfdsList) { - OpenAPI_list_for_each(pfdsList, node) { - OpenAPI_pfd_content_free(node->data); - } - OpenAPI_list_free(pfdsList); - pfdsList = NULL; - } - return NULL; -} - -OpenAPI_pfd_data_for_app_t *OpenAPI_pfd_data_for_app_copy(OpenAPI_pfd_data_for_app_t *dst, OpenAPI_pfd_data_for_app_t *src) -{ - cJSON *item = NULL; - char *content = NULL; - - ogs_assert(src); - item = OpenAPI_pfd_data_for_app_convertToJSON(src); - if (!item) { - ogs_error("OpenAPI_pfd_data_for_app_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_pfd_data_for_app_free(dst); - dst = OpenAPI_pfd_data_for_app_parseFromJSON(item); - cJSON_Delete(item); - - return dst; -} - diff --git a/lib/sbi/openapi/model/pfd_data_for_app.h b/lib/sbi/openapi/model/pfd_data_for_app.h deleted file mode 100644 index 2a8c5d21a..000000000 --- a/lib/sbi/openapi/model/pfd_data_for_app.h +++ /dev/null @@ -1,43 +0,0 @@ -/* - * pfd_data_for_app.h - * - * - */ - -#ifndef _OpenAPI_pfd_data_for_app_H_ -#define _OpenAPI_pfd_data_for_app_H_ - -#include -#include "../external/cJSON.h" -#include "../include/list.h" -#include "../include/keyValuePair.h" -#include "../include/binary.h" -#include "pfd_content.h" - -#ifdef __cplusplus -extern "C" { -#endif - -typedef struct OpenAPI_pfd_data_for_app_s OpenAPI_pfd_data_for_app_t; -typedef struct OpenAPI_pfd_data_for_app_s { - char *application_id; - OpenAPI_list_t *pfds; - char *caching_time; -} OpenAPI_pfd_data_for_app_t; - -OpenAPI_pfd_data_for_app_t *OpenAPI_pfd_data_for_app_create( - char *application_id, - OpenAPI_list_t *pfds, - char *caching_time -); -void OpenAPI_pfd_data_for_app_free(OpenAPI_pfd_data_for_app_t *pfd_data_for_app); -OpenAPI_pfd_data_for_app_t *OpenAPI_pfd_data_for_app_parseFromJSON(cJSON *pfd_data_for_appJSON); -cJSON *OpenAPI_pfd_data_for_app_convertToJSON(OpenAPI_pfd_data_for_app_t *pfd_data_for_app); -OpenAPI_pfd_data_for_app_t *OpenAPI_pfd_data_for_app_copy(OpenAPI_pfd_data_for_app_t *dst, OpenAPI_pfd_data_for_app_t *src); - -#ifdef __cplusplus -} -#endif - -#endif /* _OpenAPI_pfd_data_for_app_H_ */ - diff --git a/lib/sbi/openapi/model/pfd_data_for_app_ext.c b/lib/sbi/openapi/model/pfd_data_for_app_ext.c index 2f36fc4a9..b94485a96 100644 --- a/lib/sbi/openapi/model/pfd_data_for_app_ext.c +++ b/lib/sbi/openapi/model/pfd_data_for_app_ext.c @@ -8,7 +8,10 @@ OpenAPI_pfd_data_for_app_ext_t *OpenAPI_pfd_data_for_app_ext_create( char *application_id, OpenAPI_list_t *pfds, char *caching_time, - char *supp_feat + char *supp_feat, + OpenAPI_list_t *reset_ids, + bool is_allowed_delay, + int allowed_delay ) { OpenAPI_pfd_data_for_app_ext_t *pfd_data_for_app_ext_local_var = ogs_malloc(sizeof(OpenAPI_pfd_data_for_app_ext_t)); @@ -18,6 +21,9 @@ OpenAPI_pfd_data_for_app_ext_t *OpenAPI_pfd_data_for_app_ext_create( pfd_data_for_app_ext_local_var->pfds = pfds; pfd_data_for_app_ext_local_var->caching_time = caching_time; pfd_data_for_app_ext_local_var->supp_feat = supp_feat; + pfd_data_for_app_ext_local_var->reset_ids = reset_ids; + pfd_data_for_app_ext_local_var->is_allowed_delay = is_allowed_delay; + pfd_data_for_app_ext_local_var->allowed_delay = allowed_delay; return pfd_data_for_app_ext_local_var; } @@ -48,6 +54,13 @@ void OpenAPI_pfd_data_for_app_ext_free(OpenAPI_pfd_data_for_app_ext_t *pfd_data_ ogs_free(pfd_data_for_app_ext->supp_feat); pfd_data_for_app_ext->supp_feat = NULL; } + if (pfd_data_for_app_ext->reset_ids) { + OpenAPI_list_for_each(pfd_data_for_app_ext->reset_ids, node) { + ogs_free(node->data); + } + OpenAPI_list_free(pfd_data_for_app_ext->reset_ids); + pfd_data_for_app_ext->reset_ids = NULL; + } ogs_free(pfd_data_for_app_ext); } @@ -103,6 +116,27 @@ cJSON *OpenAPI_pfd_data_for_app_ext_convertToJSON(OpenAPI_pfd_data_for_app_ext_t } } + if (pfd_data_for_app_ext->reset_ids) { + cJSON *reset_idsList = cJSON_AddArrayToObject(item, "resetIds"); + if (reset_idsList == NULL) { + ogs_error("OpenAPI_pfd_data_for_app_ext_convertToJSON() failed [reset_ids]"); + goto end; + } + OpenAPI_list_for_each(pfd_data_for_app_ext->reset_ids, node) { + if (cJSON_AddStringToObject(reset_idsList, "", (char*)node->data) == NULL) { + ogs_error("OpenAPI_pfd_data_for_app_ext_convertToJSON() failed [reset_ids]"); + goto end; + } + } + } + + if (pfd_data_for_app_ext->is_allowed_delay) { + if (cJSON_AddNumberToObject(item, "allowedDelay", pfd_data_for_app_ext->allowed_delay) == NULL) { + ogs_error("OpenAPI_pfd_data_for_app_ext_convertToJSON() failed [allowed_delay]"); + goto end; + } + } + end: return item; } @@ -116,6 +150,9 @@ OpenAPI_pfd_data_for_app_ext_t *OpenAPI_pfd_data_for_app_ext_parseFromJSON(cJSON OpenAPI_list_t *pfdsList = NULL; cJSON *caching_time = NULL; cJSON *supp_feat = NULL; + cJSON *reset_ids = NULL; + OpenAPI_list_t *reset_idsList = NULL; + cJSON *allowed_delay = NULL; application_id = cJSON_GetObjectItemCaseSensitive(pfd_data_for_app_extJSON, "applicationId"); if (!application_id) { ogs_error("OpenAPI_pfd_data_for_app_ext_parseFromJSON() failed [application_id]"); @@ -169,11 +206,43 @@ OpenAPI_pfd_data_for_app_ext_t *OpenAPI_pfd_data_for_app_ext_parseFromJSON(cJSON } } + reset_ids = cJSON_GetObjectItemCaseSensitive(pfd_data_for_app_extJSON, "resetIds"); + if (reset_ids) { + cJSON *reset_ids_local = NULL; + if (!cJSON_IsArray(reset_ids)) { + ogs_error("OpenAPI_pfd_data_for_app_ext_parseFromJSON() failed [reset_ids]"); + goto end; + } + + reset_idsList = OpenAPI_list_create(); + + cJSON_ArrayForEach(reset_ids_local, reset_ids) { + double *localDouble = NULL; + int *localInt = NULL; + if (!cJSON_IsString(reset_ids_local)) { + ogs_error("OpenAPI_pfd_data_for_app_ext_parseFromJSON() failed [reset_ids]"); + goto end; + } + OpenAPI_list_add(reset_idsList, ogs_strdup(reset_ids_local->valuestring)); + } + } + + allowed_delay = cJSON_GetObjectItemCaseSensitive(pfd_data_for_app_extJSON, "allowedDelay"); + if (allowed_delay) { + if (!cJSON_IsNumber(allowed_delay)) { + ogs_error("OpenAPI_pfd_data_for_app_ext_parseFromJSON() failed [allowed_delay]"); + goto end; + } + } + pfd_data_for_app_ext_local_var = OpenAPI_pfd_data_for_app_ext_create ( ogs_strdup(application_id->valuestring), pfdsList, caching_time && !cJSON_IsNull(caching_time) ? ogs_strdup(caching_time->valuestring) : NULL, - supp_feat && !cJSON_IsNull(supp_feat) ? ogs_strdup(supp_feat->valuestring) : NULL + supp_feat && !cJSON_IsNull(supp_feat) ? ogs_strdup(supp_feat->valuestring) : NULL, + reset_ids ? reset_idsList : NULL, + allowed_delay ? true : false, + allowed_delay ? allowed_delay->valuedouble : 0 ); return pfd_data_for_app_ext_local_var; @@ -185,6 +254,13 @@ end: OpenAPI_list_free(pfdsList); pfdsList = NULL; } + if (reset_idsList) { + OpenAPI_list_for_each(reset_idsList, node) { + ogs_free(node->data); + } + OpenAPI_list_free(reset_idsList); + reset_idsList = NULL; + } return NULL; } diff --git a/lib/sbi/openapi/model/pfd_data_for_app_ext.h b/lib/sbi/openapi/model/pfd_data_for_app_ext.h index 2ec0ea71a..6260c4545 100644 --- a/lib/sbi/openapi/model/pfd_data_for_app_ext.h +++ b/lib/sbi/openapi/model/pfd_data_for_app_ext.h @@ -1,7 +1,7 @@ /* * pfd_data_for_app_ext.h * - * + * Represents the PFDs and related data for the application. */ #ifndef _OpenAPI_pfd_data_for_app_ext_H_ @@ -24,13 +24,19 @@ typedef struct OpenAPI_pfd_data_for_app_ext_s { OpenAPI_list_t *pfds; char *caching_time; char *supp_feat; + OpenAPI_list_t *reset_ids; + bool is_allowed_delay; + int allowed_delay; } OpenAPI_pfd_data_for_app_ext_t; OpenAPI_pfd_data_for_app_ext_t *OpenAPI_pfd_data_for_app_ext_create( char *application_id, OpenAPI_list_t *pfds, char *caching_time, - char *supp_feat + char *supp_feat, + OpenAPI_list_t *reset_ids, + bool is_allowed_delay, + int allowed_delay ); void OpenAPI_pfd_data_for_app_ext_free(OpenAPI_pfd_data_for_app_ext_t *pfd_data_for_app_ext); OpenAPI_pfd_data_for_app_ext_t *OpenAPI_pfd_data_for_app_ext_parseFromJSON(cJSON *pfd_data_for_app_extJSON); diff --git a/lib/sbi/openapi/model/pfd_data_for_app_ext_all_of.c b/lib/sbi/openapi/model/pfd_data_for_app_ext_all_of.c deleted file mode 100644 index 142d45631..000000000 --- a/lib/sbi/openapi/model/pfd_data_for_app_ext_all_of.c +++ /dev/null @@ -1,110 +0,0 @@ - -#include -#include -#include -#include "pfd_data_for_app_ext_all_of.h" - -OpenAPI_pfd_data_for_app_ext_all_of_t *OpenAPI_pfd_data_for_app_ext_all_of_create( - char *supp_feat -) -{ - OpenAPI_pfd_data_for_app_ext_all_of_t *pfd_data_for_app_ext_all_of_local_var = ogs_malloc(sizeof(OpenAPI_pfd_data_for_app_ext_all_of_t)); - ogs_assert(pfd_data_for_app_ext_all_of_local_var); - - pfd_data_for_app_ext_all_of_local_var->supp_feat = supp_feat; - - return pfd_data_for_app_ext_all_of_local_var; -} - -void OpenAPI_pfd_data_for_app_ext_all_of_free(OpenAPI_pfd_data_for_app_ext_all_of_t *pfd_data_for_app_ext_all_of) -{ - OpenAPI_lnode_t *node = NULL; - - if (NULL == pfd_data_for_app_ext_all_of) { - return; - } - if (pfd_data_for_app_ext_all_of->supp_feat) { - ogs_free(pfd_data_for_app_ext_all_of->supp_feat); - pfd_data_for_app_ext_all_of->supp_feat = NULL; - } - ogs_free(pfd_data_for_app_ext_all_of); -} - -cJSON *OpenAPI_pfd_data_for_app_ext_all_of_convertToJSON(OpenAPI_pfd_data_for_app_ext_all_of_t *pfd_data_for_app_ext_all_of) -{ - cJSON *item = NULL; - OpenAPI_lnode_t *node = NULL; - - if (pfd_data_for_app_ext_all_of == NULL) { - ogs_error("OpenAPI_pfd_data_for_app_ext_all_of_convertToJSON() failed [PfdDataForAppExt_allOf]"); - return NULL; - } - - item = cJSON_CreateObject(); - if (pfd_data_for_app_ext_all_of->supp_feat) { - if (cJSON_AddStringToObject(item, "suppFeat", pfd_data_for_app_ext_all_of->supp_feat) == NULL) { - ogs_error("OpenAPI_pfd_data_for_app_ext_all_of_convertToJSON() failed [supp_feat]"); - goto end; - } - } - -end: - return item; -} - -OpenAPI_pfd_data_for_app_ext_all_of_t *OpenAPI_pfd_data_for_app_ext_all_of_parseFromJSON(cJSON *pfd_data_for_app_ext_all_ofJSON) -{ - OpenAPI_pfd_data_for_app_ext_all_of_t *pfd_data_for_app_ext_all_of_local_var = NULL; - OpenAPI_lnode_t *node = NULL; - cJSON *supp_feat = NULL; - supp_feat = cJSON_GetObjectItemCaseSensitive(pfd_data_for_app_ext_all_ofJSON, "suppFeat"); - if (supp_feat) { - if (!cJSON_IsString(supp_feat) && !cJSON_IsNull(supp_feat)) { - ogs_error("OpenAPI_pfd_data_for_app_ext_all_of_parseFromJSON() failed [supp_feat]"); - goto end; - } - } - - pfd_data_for_app_ext_all_of_local_var = OpenAPI_pfd_data_for_app_ext_all_of_create ( - supp_feat && !cJSON_IsNull(supp_feat) ? ogs_strdup(supp_feat->valuestring) : NULL - ); - - return pfd_data_for_app_ext_all_of_local_var; -end: - return NULL; -} - -OpenAPI_pfd_data_for_app_ext_all_of_t *OpenAPI_pfd_data_for_app_ext_all_of_copy(OpenAPI_pfd_data_for_app_ext_all_of_t *dst, OpenAPI_pfd_data_for_app_ext_all_of_t *src) -{ - cJSON *item = NULL; - char *content = NULL; - - ogs_assert(src); - item = OpenAPI_pfd_data_for_app_ext_all_of_convertToJSON(src); - if (!item) { - ogs_error("OpenAPI_pfd_data_for_app_ext_all_of_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_pfd_data_for_app_ext_all_of_free(dst); - dst = OpenAPI_pfd_data_for_app_ext_all_of_parseFromJSON(item); - cJSON_Delete(item); - - return dst; -} - diff --git a/lib/sbi/openapi/model/pfd_data_for_app_ext_all_of.h b/lib/sbi/openapi/model/pfd_data_for_app_ext_all_of.h deleted file mode 100644 index af85e19f0..000000000 --- a/lib/sbi/openapi/model/pfd_data_for_app_ext_all_of.h +++ /dev/null @@ -1,38 +0,0 @@ -/* - * pfd_data_for_app_ext_all_of.h - * - * - */ - -#ifndef _OpenAPI_pfd_data_for_app_ext_all_of_H_ -#define _OpenAPI_pfd_data_for_app_ext_all_of_H_ - -#include -#include "../external/cJSON.h" -#include "../include/list.h" -#include "../include/keyValuePair.h" -#include "../include/binary.h" - -#ifdef __cplusplus -extern "C" { -#endif - -typedef struct OpenAPI_pfd_data_for_app_ext_all_of_s OpenAPI_pfd_data_for_app_ext_all_of_t; -typedef struct OpenAPI_pfd_data_for_app_ext_all_of_s { - char *supp_feat; -} OpenAPI_pfd_data_for_app_ext_all_of_t; - -OpenAPI_pfd_data_for_app_ext_all_of_t *OpenAPI_pfd_data_for_app_ext_all_of_create( - char *supp_feat -); -void OpenAPI_pfd_data_for_app_ext_all_of_free(OpenAPI_pfd_data_for_app_ext_all_of_t *pfd_data_for_app_ext_all_of); -OpenAPI_pfd_data_for_app_ext_all_of_t *OpenAPI_pfd_data_for_app_ext_all_of_parseFromJSON(cJSON *pfd_data_for_app_ext_all_ofJSON); -cJSON *OpenAPI_pfd_data_for_app_ext_all_of_convertToJSON(OpenAPI_pfd_data_for_app_ext_all_of_t *pfd_data_for_app_ext_all_of); -OpenAPI_pfd_data_for_app_ext_all_of_t *OpenAPI_pfd_data_for_app_ext_all_of_copy(OpenAPI_pfd_data_for_app_ext_all_of_t *dst, OpenAPI_pfd_data_for_app_ext_all_of_t *src); - -#ifdef __cplusplus -} -#endif - -#endif /* _OpenAPI_pfd_data_for_app_ext_all_of_H_ */ - diff --git a/lib/sbi/openapi/model/pgw_info.c b/lib/sbi/openapi/model/pgw_info.c index 5145aa0d7..de720df46 100644 --- a/lib/sbi/openapi/model/pgw_info.c +++ b/lib/sbi/openapi/model/pgw_info.c @@ -7,9 +7,12 @@ OpenAPI_pgw_info_t *OpenAPI_pgw_info_create( char *dnn, char *pgw_fqdn, + OpenAPI_ip_address_t *pgw_ip_addr, OpenAPI_plmn_id_t *plmn_id, bool is_epdg_ind, - int epdg_ind + int epdg_ind, + char *pcf_id, + char *registration_time ) { OpenAPI_pgw_info_t *pgw_info_local_var = ogs_malloc(sizeof(OpenAPI_pgw_info_t)); @@ -17,9 +20,12 @@ OpenAPI_pgw_info_t *OpenAPI_pgw_info_create( pgw_info_local_var->dnn = dnn; pgw_info_local_var->pgw_fqdn = pgw_fqdn; + pgw_info_local_var->pgw_ip_addr = pgw_ip_addr; pgw_info_local_var->plmn_id = plmn_id; pgw_info_local_var->is_epdg_ind = is_epdg_ind; pgw_info_local_var->epdg_ind = epdg_ind; + pgw_info_local_var->pcf_id = pcf_id; + pgw_info_local_var->registration_time = registration_time; return pgw_info_local_var; } @@ -39,10 +45,22 @@ void OpenAPI_pgw_info_free(OpenAPI_pgw_info_t *pgw_info) ogs_free(pgw_info->pgw_fqdn); pgw_info->pgw_fqdn = NULL; } + if (pgw_info->pgw_ip_addr) { + OpenAPI_ip_address_free(pgw_info->pgw_ip_addr); + pgw_info->pgw_ip_addr = NULL; + } if (pgw_info->plmn_id) { OpenAPI_plmn_id_free(pgw_info->plmn_id); pgw_info->plmn_id = NULL; } + if (pgw_info->pcf_id) { + ogs_free(pgw_info->pcf_id); + pgw_info->pcf_id = NULL; + } + if (pgw_info->registration_time) { + ogs_free(pgw_info->registration_time); + pgw_info->registration_time = NULL; + } ogs_free(pgw_info); } @@ -75,6 +93,19 @@ cJSON *OpenAPI_pgw_info_convertToJSON(OpenAPI_pgw_info_t *pgw_info) goto end; } + if (pgw_info->pgw_ip_addr) { + cJSON *pgw_ip_addr_local_JSON = OpenAPI_ip_address_convertToJSON(pgw_info->pgw_ip_addr); + if (pgw_ip_addr_local_JSON == NULL) { + ogs_error("OpenAPI_pgw_info_convertToJSON() failed [pgw_ip_addr]"); + goto end; + } + cJSON_AddItemToObject(item, "pgwIpAddr", pgw_ip_addr_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_pgw_info_convertToJSON() failed [pgw_ip_addr]"); + goto end; + } + } + if (pgw_info->plmn_id) { cJSON *plmn_id_local_JSON = OpenAPI_plmn_id_convertToJSON(pgw_info->plmn_id); if (plmn_id_local_JSON == NULL) { @@ -95,6 +126,20 @@ cJSON *OpenAPI_pgw_info_convertToJSON(OpenAPI_pgw_info_t *pgw_info) } } + if (pgw_info->pcf_id) { + if (cJSON_AddStringToObject(item, "pcfId", pgw_info->pcf_id) == NULL) { + ogs_error("OpenAPI_pgw_info_convertToJSON() failed [pcf_id]"); + goto end; + } + } + + if (pgw_info->registration_time) { + if (cJSON_AddStringToObject(item, "registrationTime", pgw_info->registration_time) == NULL) { + ogs_error("OpenAPI_pgw_info_convertToJSON() failed [registration_time]"); + goto end; + } + } + end: return item; } @@ -105,9 +150,13 @@ OpenAPI_pgw_info_t *OpenAPI_pgw_info_parseFromJSON(cJSON *pgw_infoJSON) OpenAPI_lnode_t *node = NULL; cJSON *dnn = NULL; cJSON *pgw_fqdn = NULL; + cJSON *pgw_ip_addr = NULL; + OpenAPI_ip_address_t *pgw_ip_addr_local_nonprim = NULL; cJSON *plmn_id = NULL; OpenAPI_plmn_id_t *plmn_id_local_nonprim = NULL; cJSON *epdg_ind = NULL; + cJSON *pcf_id = NULL; + cJSON *registration_time = NULL; dnn = cJSON_GetObjectItemCaseSensitive(pgw_infoJSON, "dnn"); if (!dnn) { ogs_error("OpenAPI_pgw_info_parseFromJSON() failed [dnn]"); @@ -128,6 +177,11 @@ OpenAPI_pgw_info_t *OpenAPI_pgw_info_parseFromJSON(cJSON *pgw_infoJSON) goto end; } + pgw_ip_addr = cJSON_GetObjectItemCaseSensitive(pgw_infoJSON, "pgwIpAddr"); + if (pgw_ip_addr) { + pgw_ip_addr_local_nonprim = OpenAPI_ip_address_parseFromJSON(pgw_ip_addr); + } + plmn_id = cJSON_GetObjectItemCaseSensitive(pgw_infoJSON, "plmnId"); if (plmn_id) { plmn_id_local_nonprim = OpenAPI_plmn_id_parseFromJSON(plmn_id); @@ -141,16 +195,39 @@ OpenAPI_pgw_info_t *OpenAPI_pgw_info_parseFromJSON(cJSON *pgw_infoJSON) } } + pcf_id = cJSON_GetObjectItemCaseSensitive(pgw_infoJSON, "pcfId"); + if (pcf_id) { + if (!cJSON_IsString(pcf_id) && !cJSON_IsNull(pcf_id)) { + ogs_error("OpenAPI_pgw_info_parseFromJSON() failed [pcf_id]"); + goto end; + } + } + + registration_time = cJSON_GetObjectItemCaseSensitive(pgw_infoJSON, "registrationTime"); + if (registration_time) { + if (!cJSON_IsString(registration_time) && !cJSON_IsNull(registration_time)) { + ogs_error("OpenAPI_pgw_info_parseFromJSON() failed [registration_time]"); + goto end; + } + } + pgw_info_local_var = OpenAPI_pgw_info_create ( ogs_strdup(dnn->valuestring), ogs_strdup(pgw_fqdn->valuestring), + pgw_ip_addr ? pgw_ip_addr_local_nonprim : NULL, plmn_id ? plmn_id_local_nonprim : NULL, epdg_ind ? true : false, - epdg_ind ? epdg_ind->valueint : 0 + epdg_ind ? epdg_ind->valueint : 0, + pcf_id && !cJSON_IsNull(pcf_id) ? ogs_strdup(pcf_id->valuestring) : NULL, + registration_time && !cJSON_IsNull(registration_time) ? ogs_strdup(registration_time->valuestring) : NULL ); return pgw_info_local_var; end: + if (pgw_ip_addr_local_nonprim) { + OpenAPI_ip_address_free(pgw_ip_addr_local_nonprim); + pgw_ip_addr_local_nonprim = NULL; + } if (plmn_id_local_nonprim) { OpenAPI_plmn_id_free(plmn_id_local_nonprim); plmn_id_local_nonprim = NULL; diff --git a/lib/sbi/openapi/model/pgw_info.h b/lib/sbi/openapi/model/pgw_info.h index 86381b6cf..d16323e0d 100644 --- a/lib/sbi/openapi/model/pgw_info.h +++ b/lib/sbi/openapi/model/pgw_info.h @@ -12,6 +12,7 @@ #include "../include/list.h" #include "../include/keyValuePair.h" #include "../include/binary.h" +#include "ip_address.h" #include "plmn_id.h" #ifdef __cplusplus @@ -22,17 +23,23 @@ typedef struct OpenAPI_pgw_info_s OpenAPI_pgw_info_t; typedef struct OpenAPI_pgw_info_s { char *dnn; char *pgw_fqdn; + struct OpenAPI_ip_address_s *pgw_ip_addr; struct OpenAPI_plmn_id_s *plmn_id; bool is_epdg_ind; int epdg_ind; + char *pcf_id; + char *registration_time; } OpenAPI_pgw_info_t; OpenAPI_pgw_info_t *OpenAPI_pgw_info_create( char *dnn, char *pgw_fqdn, + OpenAPI_ip_address_t *pgw_ip_addr, OpenAPI_plmn_id_t *plmn_id, bool is_epdg_ind, - int epdg_ind + int epdg_ind, + char *pcf_id, + char *registration_time ); void OpenAPI_pgw_info_free(OpenAPI_pgw_info_t *pgw_info); OpenAPI_pgw_info_t *OpenAPI_pgw_info_parseFromJSON(cJSON *pgw_infoJSON); diff --git a/lib/sbi/openapi/model/pgw_info_1.c b/lib/sbi/openapi/model/pgw_info_1.c deleted file mode 100644 index ac2fac36e..000000000 --- a/lib/sbi/openapi/model/pgw_info_1.c +++ /dev/null @@ -1,194 +0,0 @@ - -#include -#include -#include -#include "pgw_info_1.h" - -OpenAPI_pgw_info_1_t *OpenAPI_pgw_info_1_create( - char *dnn, - char *pgw_fqdn, - OpenAPI_plmn_id_1_t *plmn_id, - bool is_epdg_ind, - int epdg_ind -) -{ - OpenAPI_pgw_info_1_t *pgw_info_1_local_var = ogs_malloc(sizeof(OpenAPI_pgw_info_1_t)); - ogs_assert(pgw_info_1_local_var); - - pgw_info_1_local_var->dnn = dnn; - pgw_info_1_local_var->pgw_fqdn = pgw_fqdn; - pgw_info_1_local_var->plmn_id = plmn_id; - pgw_info_1_local_var->is_epdg_ind = is_epdg_ind; - pgw_info_1_local_var->epdg_ind = epdg_ind; - - return pgw_info_1_local_var; -} - -void OpenAPI_pgw_info_1_free(OpenAPI_pgw_info_1_t *pgw_info_1) -{ - OpenAPI_lnode_t *node = NULL; - - if (NULL == pgw_info_1) { - return; - } - if (pgw_info_1->dnn) { - ogs_free(pgw_info_1->dnn); - pgw_info_1->dnn = NULL; - } - if (pgw_info_1->pgw_fqdn) { - ogs_free(pgw_info_1->pgw_fqdn); - pgw_info_1->pgw_fqdn = NULL; - } - if (pgw_info_1->plmn_id) { - OpenAPI_plmn_id_1_free(pgw_info_1->plmn_id); - pgw_info_1->plmn_id = NULL; - } - ogs_free(pgw_info_1); -} - -cJSON *OpenAPI_pgw_info_1_convertToJSON(OpenAPI_pgw_info_1_t *pgw_info_1) -{ - cJSON *item = NULL; - OpenAPI_lnode_t *node = NULL; - - if (pgw_info_1 == NULL) { - ogs_error("OpenAPI_pgw_info_1_convertToJSON() failed [PgwInfo_1]"); - return NULL; - } - - item = cJSON_CreateObject(); - if (!pgw_info_1->dnn) { - ogs_error("OpenAPI_pgw_info_1_convertToJSON() failed [dnn]"); - return NULL; - } - if (cJSON_AddStringToObject(item, "dnn", pgw_info_1->dnn) == NULL) { - ogs_error("OpenAPI_pgw_info_1_convertToJSON() failed [dnn]"); - goto end; - } - - if (!pgw_info_1->pgw_fqdn) { - ogs_error("OpenAPI_pgw_info_1_convertToJSON() failed [pgw_fqdn]"); - return NULL; - } - if (cJSON_AddStringToObject(item, "pgwFqdn", pgw_info_1->pgw_fqdn) == NULL) { - ogs_error("OpenAPI_pgw_info_1_convertToJSON() failed [pgw_fqdn]"); - goto end; - } - - if (pgw_info_1->plmn_id) { - cJSON *plmn_id_local_JSON = OpenAPI_plmn_id_1_convertToJSON(pgw_info_1->plmn_id); - if (plmn_id_local_JSON == NULL) { - ogs_error("OpenAPI_pgw_info_1_convertToJSON() failed [plmn_id]"); - goto end; - } - cJSON_AddItemToObject(item, "plmnId", plmn_id_local_JSON); - if (item->child == NULL) { - ogs_error("OpenAPI_pgw_info_1_convertToJSON() failed [plmn_id]"); - goto end; - } - } - - if (pgw_info_1->is_epdg_ind) { - if (cJSON_AddBoolToObject(item, "epdgInd", pgw_info_1->epdg_ind) == NULL) { - ogs_error("OpenAPI_pgw_info_1_convertToJSON() failed [epdg_ind]"); - goto end; - } - } - -end: - return item; -} - -OpenAPI_pgw_info_1_t *OpenAPI_pgw_info_1_parseFromJSON(cJSON *pgw_info_1JSON) -{ - OpenAPI_pgw_info_1_t *pgw_info_1_local_var = NULL; - OpenAPI_lnode_t *node = NULL; - cJSON *dnn = NULL; - cJSON *pgw_fqdn = NULL; - cJSON *plmn_id = NULL; - OpenAPI_plmn_id_1_t *plmn_id_local_nonprim = NULL; - cJSON *epdg_ind = NULL; - dnn = cJSON_GetObjectItemCaseSensitive(pgw_info_1JSON, "dnn"); - if (!dnn) { - ogs_error("OpenAPI_pgw_info_1_parseFromJSON() failed [dnn]"); - goto end; - } - if (!cJSON_IsString(dnn)) { - ogs_error("OpenAPI_pgw_info_1_parseFromJSON() failed [dnn]"); - goto end; - } - - pgw_fqdn = cJSON_GetObjectItemCaseSensitive(pgw_info_1JSON, "pgwFqdn"); - if (!pgw_fqdn) { - ogs_error("OpenAPI_pgw_info_1_parseFromJSON() failed [pgw_fqdn]"); - goto end; - } - if (!cJSON_IsString(pgw_fqdn)) { - ogs_error("OpenAPI_pgw_info_1_parseFromJSON() failed [pgw_fqdn]"); - goto end; - } - - plmn_id = cJSON_GetObjectItemCaseSensitive(pgw_info_1JSON, "plmnId"); - if (plmn_id) { - plmn_id_local_nonprim = OpenAPI_plmn_id_1_parseFromJSON(plmn_id); - } - - epdg_ind = cJSON_GetObjectItemCaseSensitive(pgw_info_1JSON, "epdgInd"); - if (epdg_ind) { - if (!cJSON_IsBool(epdg_ind)) { - ogs_error("OpenAPI_pgw_info_1_parseFromJSON() failed [epdg_ind]"); - goto end; - } - } - - pgw_info_1_local_var = OpenAPI_pgw_info_1_create ( - ogs_strdup(dnn->valuestring), - ogs_strdup(pgw_fqdn->valuestring), - plmn_id ? plmn_id_local_nonprim : NULL, - epdg_ind ? true : false, - epdg_ind ? epdg_ind->valueint : 0 - ); - - return pgw_info_1_local_var; -end: - if (plmn_id_local_nonprim) { - OpenAPI_plmn_id_1_free(plmn_id_local_nonprim); - plmn_id_local_nonprim = NULL; - } - return NULL; -} - -OpenAPI_pgw_info_1_t *OpenAPI_pgw_info_1_copy(OpenAPI_pgw_info_1_t *dst, OpenAPI_pgw_info_1_t *src) -{ - cJSON *item = NULL; - char *content = NULL; - - ogs_assert(src); - item = OpenAPI_pgw_info_1_convertToJSON(src); - if (!item) { - ogs_error("OpenAPI_pgw_info_1_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_pgw_info_1_free(dst); - dst = OpenAPI_pgw_info_1_parseFromJSON(item); - cJSON_Delete(item); - - return dst; -} - diff --git a/lib/sbi/openapi/model/pgw_info_1.h b/lib/sbi/openapi/model/pgw_info_1.h deleted file mode 100644 index 5f91a5c23..000000000 --- a/lib/sbi/openapi/model/pgw_info_1.h +++ /dev/null @@ -1,47 +0,0 @@ -/* - * pgw_info_1.h - * - * - */ - -#ifndef _OpenAPI_pgw_info_1_H_ -#define _OpenAPI_pgw_info_1_H_ - -#include -#include "../external/cJSON.h" -#include "../include/list.h" -#include "../include/keyValuePair.h" -#include "../include/binary.h" -#include "plmn_id_1.h" - -#ifdef __cplusplus -extern "C" { -#endif - -typedef struct OpenAPI_pgw_info_1_s OpenAPI_pgw_info_1_t; -typedef struct OpenAPI_pgw_info_1_s { - char *dnn; - char *pgw_fqdn; - struct OpenAPI_plmn_id_1_s *plmn_id; - bool is_epdg_ind; - int epdg_ind; -} OpenAPI_pgw_info_1_t; - -OpenAPI_pgw_info_1_t *OpenAPI_pgw_info_1_create( - char *dnn, - char *pgw_fqdn, - OpenAPI_plmn_id_1_t *plmn_id, - bool is_epdg_ind, - int epdg_ind -); -void OpenAPI_pgw_info_1_free(OpenAPI_pgw_info_1_t *pgw_info_1); -OpenAPI_pgw_info_1_t *OpenAPI_pgw_info_1_parseFromJSON(cJSON *pgw_info_1JSON); -cJSON *OpenAPI_pgw_info_1_convertToJSON(OpenAPI_pgw_info_1_t *pgw_info_1); -OpenAPI_pgw_info_1_t *OpenAPI_pgw_info_1_copy(OpenAPI_pgw_info_1_t *dst, OpenAPI_pgw_info_1_t *src); - -#ifdef __cplusplus -} -#endif - -#endif /* _OpenAPI_pgw_info_1_H_ */ - diff --git a/lib/sbi/openapi/model/plmn_ec_info_1.c b/lib/sbi/openapi/model/plmn_ec_info_1.c new file mode 100644 index 000000000..e8920ddd6 --- /dev/null +++ b/lib/sbi/openapi/model/plmn_ec_info_1.c @@ -0,0 +1,175 @@ + +#include +#include +#include +#include "plmn_ec_info_1.h" + +OpenAPI_plmn_ec_info_1_t *OpenAPI_plmn_ec_info_1_create( + OpenAPI_plmn_id_1_t *plmn_id, + OpenAPI_ec_restriction_data_wb_t *ec_restriction_data_wb, + bool is_ec_restriction_data_nb, + int ec_restriction_data_nb +) +{ + OpenAPI_plmn_ec_info_1_t *plmn_ec_info_1_local_var = ogs_malloc(sizeof(OpenAPI_plmn_ec_info_1_t)); + ogs_assert(plmn_ec_info_1_local_var); + + plmn_ec_info_1_local_var->plmn_id = plmn_id; + plmn_ec_info_1_local_var->ec_restriction_data_wb = ec_restriction_data_wb; + plmn_ec_info_1_local_var->is_ec_restriction_data_nb = is_ec_restriction_data_nb; + plmn_ec_info_1_local_var->ec_restriction_data_nb = ec_restriction_data_nb; + + return plmn_ec_info_1_local_var; +} + +void OpenAPI_plmn_ec_info_1_free(OpenAPI_plmn_ec_info_1_t *plmn_ec_info_1) +{ + OpenAPI_lnode_t *node = NULL; + + if (NULL == plmn_ec_info_1) { + return; + } + if (plmn_ec_info_1->plmn_id) { + OpenAPI_plmn_id_1_free(plmn_ec_info_1->plmn_id); + plmn_ec_info_1->plmn_id = NULL; + } + if (plmn_ec_info_1->ec_restriction_data_wb) { + OpenAPI_ec_restriction_data_wb_free(plmn_ec_info_1->ec_restriction_data_wb); + plmn_ec_info_1->ec_restriction_data_wb = NULL; + } + ogs_free(plmn_ec_info_1); +} + +cJSON *OpenAPI_plmn_ec_info_1_convertToJSON(OpenAPI_plmn_ec_info_1_t *plmn_ec_info_1) +{ + cJSON *item = NULL; + OpenAPI_lnode_t *node = NULL; + + if (plmn_ec_info_1 == NULL) { + ogs_error("OpenAPI_plmn_ec_info_1_convertToJSON() failed [PlmnEcInfo_1]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (!plmn_ec_info_1->plmn_id) { + ogs_error("OpenAPI_plmn_ec_info_1_convertToJSON() failed [plmn_id]"); + return NULL; + } + cJSON *plmn_id_local_JSON = OpenAPI_plmn_id_1_convertToJSON(plmn_ec_info_1->plmn_id); + if (plmn_id_local_JSON == NULL) { + ogs_error("OpenAPI_plmn_ec_info_1_convertToJSON() failed [plmn_id]"); + goto end; + } + cJSON_AddItemToObject(item, "plmnId", plmn_id_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_plmn_ec_info_1_convertToJSON() failed [plmn_id]"); + goto end; + } + + if (plmn_ec_info_1->ec_restriction_data_wb) { + cJSON *ec_restriction_data_wb_local_JSON = OpenAPI_ec_restriction_data_wb_convertToJSON(plmn_ec_info_1->ec_restriction_data_wb); + if (ec_restriction_data_wb_local_JSON == NULL) { + ogs_error("OpenAPI_plmn_ec_info_1_convertToJSON() failed [ec_restriction_data_wb]"); + goto end; + } + cJSON_AddItemToObject(item, "ecRestrictionDataWb", ec_restriction_data_wb_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_plmn_ec_info_1_convertToJSON() failed [ec_restriction_data_wb]"); + goto end; + } + } + + if (plmn_ec_info_1->is_ec_restriction_data_nb) { + if (cJSON_AddBoolToObject(item, "ecRestrictionDataNb", plmn_ec_info_1->ec_restriction_data_nb) == NULL) { + ogs_error("OpenAPI_plmn_ec_info_1_convertToJSON() failed [ec_restriction_data_nb]"); + goto end; + } + } + +end: + return item; +} + +OpenAPI_plmn_ec_info_1_t *OpenAPI_plmn_ec_info_1_parseFromJSON(cJSON *plmn_ec_info_1JSON) +{ + OpenAPI_plmn_ec_info_1_t *plmn_ec_info_1_local_var = NULL; + OpenAPI_lnode_t *node = NULL; + cJSON *plmn_id = NULL; + OpenAPI_plmn_id_1_t *plmn_id_local_nonprim = NULL; + cJSON *ec_restriction_data_wb = NULL; + OpenAPI_ec_restriction_data_wb_t *ec_restriction_data_wb_local_nonprim = NULL; + cJSON *ec_restriction_data_nb = NULL; + plmn_id = cJSON_GetObjectItemCaseSensitive(plmn_ec_info_1JSON, "plmnId"); + if (!plmn_id) { + ogs_error("OpenAPI_plmn_ec_info_1_parseFromJSON() failed [plmn_id]"); + goto end; + } + plmn_id_local_nonprim = OpenAPI_plmn_id_1_parseFromJSON(plmn_id); + + ec_restriction_data_wb = cJSON_GetObjectItemCaseSensitive(plmn_ec_info_1JSON, "ecRestrictionDataWb"); + if (ec_restriction_data_wb) { + ec_restriction_data_wb_local_nonprim = OpenAPI_ec_restriction_data_wb_parseFromJSON(ec_restriction_data_wb); + } + + ec_restriction_data_nb = cJSON_GetObjectItemCaseSensitive(plmn_ec_info_1JSON, "ecRestrictionDataNb"); + if (ec_restriction_data_nb) { + if (!cJSON_IsBool(ec_restriction_data_nb)) { + ogs_error("OpenAPI_plmn_ec_info_1_parseFromJSON() failed [ec_restriction_data_nb]"); + goto end; + } + } + + plmn_ec_info_1_local_var = OpenAPI_plmn_ec_info_1_create ( + plmn_id_local_nonprim, + ec_restriction_data_wb ? ec_restriction_data_wb_local_nonprim : NULL, + ec_restriction_data_nb ? true : false, + ec_restriction_data_nb ? ec_restriction_data_nb->valueint : 0 + ); + + return plmn_ec_info_1_local_var; +end: + if (plmn_id_local_nonprim) { + OpenAPI_plmn_id_1_free(plmn_id_local_nonprim); + plmn_id_local_nonprim = NULL; + } + if (ec_restriction_data_wb_local_nonprim) { + OpenAPI_ec_restriction_data_wb_free(ec_restriction_data_wb_local_nonprim); + ec_restriction_data_wb_local_nonprim = NULL; + } + return NULL; +} + +OpenAPI_plmn_ec_info_1_t *OpenAPI_plmn_ec_info_1_copy(OpenAPI_plmn_ec_info_1_t *dst, OpenAPI_plmn_ec_info_1_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_plmn_ec_info_1_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_plmn_ec_info_1_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_plmn_ec_info_1_free(dst); + dst = OpenAPI_plmn_ec_info_1_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/plmn_ec_info_1.h b/lib/sbi/openapi/model/plmn_ec_info_1.h new file mode 100644 index 000000000..112b7771b --- /dev/null +++ b/lib/sbi/openapi/model/plmn_ec_info_1.h @@ -0,0 +1,46 @@ +/* + * plmn_ec_info_1.h + * + * + */ + +#ifndef _OpenAPI_plmn_ec_info_1_H_ +#define _OpenAPI_plmn_ec_info_1_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "ec_restriction_data_wb.h" +#include "plmn_id_1.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_plmn_ec_info_1_s OpenAPI_plmn_ec_info_1_t; +typedef struct OpenAPI_plmn_ec_info_1_s { + struct OpenAPI_plmn_id_1_s *plmn_id; + struct OpenAPI_ec_restriction_data_wb_s *ec_restriction_data_wb; + bool is_ec_restriction_data_nb; + int ec_restriction_data_nb; +} OpenAPI_plmn_ec_info_1_t; + +OpenAPI_plmn_ec_info_1_t *OpenAPI_plmn_ec_info_1_create( + OpenAPI_plmn_id_1_t *plmn_id, + OpenAPI_ec_restriction_data_wb_t *ec_restriction_data_wb, + bool is_ec_restriction_data_nb, + int ec_restriction_data_nb +); +void OpenAPI_plmn_ec_info_1_free(OpenAPI_plmn_ec_info_1_t *plmn_ec_info_1); +OpenAPI_plmn_ec_info_1_t *OpenAPI_plmn_ec_info_1_parseFromJSON(cJSON *plmn_ec_info_1JSON); +cJSON *OpenAPI_plmn_ec_info_1_convertToJSON(OpenAPI_plmn_ec_info_1_t *plmn_ec_info_1); +OpenAPI_plmn_ec_info_1_t *OpenAPI_plmn_ec_info_1_copy(OpenAPI_plmn_ec_info_1_t *dst, OpenAPI_plmn_ec_info_1_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_plmn_ec_info_1_H_ */ + diff --git a/lib/sbi/openapi/model/plmn_id.h b/lib/sbi/openapi/model/plmn_id.h index b0b4a21b3..c43a184cb 100644 --- a/lib/sbi/openapi/model/plmn_id.h +++ b/lib/sbi/openapi/model/plmn_id.h @@ -1,7 +1,7 @@ /* * plmn_id.h * - * + * When PlmnId needs to be converted to string (e.g. when used in maps as key), the string shall be composed of three digits \"mcc\" followed by \"-\" and two or three digits \"mnc\". */ #ifndef _OpenAPI_plmn_id_H_ diff --git a/lib/sbi/openapi/model/plmn_id_1.h b/lib/sbi/openapi/model/plmn_id_1.h index 70ed4f2a4..aa42fb1ce 100644 --- a/lib/sbi/openapi/model/plmn_id_1.h +++ b/lib/sbi/openapi/model/plmn_id_1.h @@ -1,7 +1,7 @@ /* * plmn_id_1.h * - * + * When PlmnId needs to be converted to string (e.g. when used in maps as key), the string shall be composed of three digits \"mcc\" followed by \"-\" and two or three digits \"mnc\". */ #ifndef _OpenAPI_plmn_id_1_H_ diff --git a/lib/sbi/openapi/model/plmn_id_nid.h b/lib/sbi/openapi/model/plmn_id_nid.h index 0721033ac..63ac5e820 100644 --- a/lib/sbi/openapi/model/plmn_id_nid.h +++ b/lib/sbi/openapi/model/plmn_id_nid.h @@ -1,7 +1,7 @@ /* * plmn_id_nid.h * - * + * Contains the serving core network operator PLMN ID and, for an SNPN, the NID that together with the PLMN ID identifies the SNPN. */ #ifndef _OpenAPI_plmn_id_nid_H_ diff --git a/lib/sbi/openapi/model/plmn_id_nid_1.h b/lib/sbi/openapi/model/plmn_id_nid_1.h index 6ee6bf377..25affd20b 100644 --- a/lib/sbi/openapi/model/plmn_id_nid_1.h +++ b/lib/sbi/openapi/model/plmn_id_nid_1.h @@ -1,7 +1,7 @@ /* * plmn_id_nid_1.h * - * + * Contains the serving core network operator PLMN ID and, for an SNPN, the NID that together with the PLMN ID identifies the SNPN. */ #ifndef _OpenAPI_plmn_id_nid_1_H_ diff --git a/lib/sbi/openapi/model/plmn_oauth2.c b/lib/sbi/openapi/model/plmn_oauth2.c new file mode 100644 index 000000000..cb41bf9a7 --- /dev/null +++ b/lib/sbi/openapi/model/plmn_oauth2.c @@ -0,0 +1,207 @@ + +#include +#include +#include +#include "plmn_oauth2.h" + +OpenAPI_plmn_oauth2_t *OpenAPI_plmn_oauth2_create( + OpenAPI_list_t *oauth2_required_plmn_id_list, + OpenAPI_list_t *oauth2_not_required_plmn_id_list +) +{ + OpenAPI_plmn_oauth2_t *plmn_oauth2_local_var = ogs_malloc(sizeof(OpenAPI_plmn_oauth2_t)); + ogs_assert(plmn_oauth2_local_var); + + plmn_oauth2_local_var->oauth2_required_plmn_id_list = oauth2_required_plmn_id_list; + plmn_oauth2_local_var->oauth2_not_required_plmn_id_list = oauth2_not_required_plmn_id_list; + + return plmn_oauth2_local_var; +} + +void OpenAPI_plmn_oauth2_free(OpenAPI_plmn_oauth2_t *plmn_oauth2) +{ + OpenAPI_lnode_t *node = NULL; + + if (NULL == plmn_oauth2) { + return; + } + if (plmn_oauth2->oauth2_required_plmn_id_list) { + OpenAPI_list_for_each(plmn_oauth2->oauth2_required_plmn_id_list, node) { + OpenAPI_plmn_id_free(node->data); + } + OpenAPI_list_free(plmn_oauth2->oauth2_required_plmn_id_list); + plmn_oauth2->oauth2_required_plmn_id_list = NULL; + } + if (plmn_oauth2->oauth2_not_required_plmn_id_list) { + OpenAPI_list_for_each(plmn_oauth2->oauth2_not_required_plmn_id_list, node) { + OpenAPI_plmn_id_free(node->data); + } + OpenAPI_list_free(plmn_oauth2->oauth2_not_required_plmn_id_list); + plmn_oauth2->oauth2_not_required_plmn_id_list = NULL; + } + ogs_free(plmn_oauth2); +} + +cJSON *OpenAPI_plmn_oauth2_convertToJSON(OpenAPI_plmn_oauth2_t *plmn_oauth2) +{ + cJSON *item = NULL; + OpenAPI_lnode_t *node = NULL; + + if (plmn_oauth2 == NULL) { + ogs_error("OpenAPI_plmn_oauth2_convertToJSON() failed [PlmnOauth2]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (plmn_oauth2->oauth2_required_plmn_id_list) { + cJSON *oauth2_required_plmn_id_listList = cJSON_AddArrayToObject(item, "oauth2RequiredPlmnIdList"); + if (oauth2_required_plmn_id_listList == NULL) { + ogs_error("OpenAPI_plmn_oauth2_convertToJSON() failed [oauth2_required_plmn_id_list]"); + goto end; + } + OpenAPI_list_for_each(plmn_oauth2->oauth2_required_plmn_id_list, node) { + cJSON *itemLocal = OpenAPI_plmn_id_convertToJSON(node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_plmn_oauth2_convertToJSON() failed [oauth2_required_plmn_id_list]"); + goto end; + } + cJSON_AddItemToArray(oauth2_required_plmn_id_listList, itemLocal); + } + } + + if (plmn_oauth2->oauth2_not_required_plmn_id_list) { + cJSON *oauth2_not_required_plmn_id_listList = cJSON_AddArrayToObject(item, "oauth2NotRequiredPlmnIdList"); + if (oauth2_not_required_plmn_id_listList == NULL) { + ogs_error("OpenAPI_plmn_oauth2_convertToJSON() failed [oauth2_not_required_plmn_id_list]"); + goto end; + } + OpenAPI_list_for_each(plmn_oauth2->oauth2_not_required_plmn_id_list, node) { + cJSON *itemLocal = OpenAPI_plmn_id_convertToJSON(node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_plmn_oauth2_convertToJSON() failed [oauth2_not_required_plmn_id_list]"); + goto end; + } + cJSON_AddItemToArray(oauth2_not_required_plmn_id_listList, itemLocal); + } + } + +end: + return item; +} + +OpenAPI_plmn_oauth2_t *OpenAPI_plmn_oauth2_parseFromJSON(cJSON *plmn_oauth2JSON) +{ + OpenAPI_plmn_oauth2_t *plmn_oauth2_local_var = NULL; + OpenAPI_lnode_t *node = NULL; + cJSON *oauth2_required_plmn_id_list = NULL; + OpenAPI_list_t *oauth2_required_plmn_id_listList = NULL; + cJSON *oauth2_not_required_plmn_id_list = NULL; + OpenAPI_list_t *oauth2_not_required_plmn_id_listList = NULL; + oauth2_required_plmn_id_list = cJSON_GetObjectItemCaseSensitive(plmn_oauth2JSON, "oauth2RequiredPlmnIdList"); + if (oauth2_required_plmn_id_list) { + cJSON *oauth2_required_plmn_id_list_local = NULL; + if (!cJSON_IsArray(oauth2_required_plmn_id_list)) { + ogs_error("OpenAPI_plmn_oauth2_parseFromJSON() failed [oauth2_required_plmn_id_list]"); + goto end; + } + + oauth2_required_plmn_id_listList = OpenAPI_list_create(); + + cJSON_ArrayForEach(oauth2_required_plmn_id_list_local, oauth2_required_plmn_id_list) { + if (!cJSON_IsObject(oauth2_required_plmn_id_list_local)) { + ogs_error("OpenAPI_plmn_oauth2_parseFromJSON() failed [oauth2_required_plmn_id_list]"); + goto end; + } + OpenAPI_plmn_id_t *oauth2_required_plmn_id_listItem = OpenAPI_plmn_id_parseFromJSON(oauth2_required_plmn_id_list_local); + if (!oauth2_required_plmn_id_listItem) { + ogs_error("No oauth2_required_plmn_id_listItem"); + OpenAPI_list_free(oauth2_required_plmn_id_listList); + goto end; + } + OpenAPI_list_add(oauth2_required_plmn_id_listList, oauth2_required_plmn_id_listItem); + } + } + + oauth2_not_required_plmn_id_list = cJSON_GetObjectItemCaseSensitive(plmn_oauth2JSON, "oauth2NotRequiredPlmnIdList"); + if (oauth2_not_required_plmn_id_list) { + cJSON *oauth2_not_required_plmn_id_list_local = NULL; + if (!cJSON_IsArray(oauth2_not_required_plmn_id_list)) { + ogs_error("OpenAPI_plmn_oauth2_parseFromJSON() failed [oauth2_not_required_plmn_id_list]"); + goto end; + } + + oauth2_not_required_plmn_id_listList = OpenAPI_list_create(); + + cJSON_ArrayForEach(oauth2_not_required_plmn_id_list_local, oauth2_not_required_plmn_id_list) { + if (!cJSON_IsObject(oauth2_not_required_plmn_id_list_local)) { + ogs_error("OpenAPI_plmn_oauth2_parseFromJSON() failed [oauth2_not_required_plmn_id_list]"); + goto end; + } + OpenAPI_plmn_id_t *oauth2_not_required_plmn_id_listItem = OpenAPI_plmn_id_parseFromJSON(oauth2_not_required_plmn_id_list_local); + if (!oauth2_not_required_plmn_id_listItem) { + ogs_error("No oauth2_not_required_plmn_id_listItem"); + OpenAPI_list_free(oauth2_not_required_plmn_id_listList); + goto end; + } + OpenAPI_list_add(oauth2_not_required_plmn_id_listList, oauth2_not_required_plmn_id_listItem); + } + } + + plmn_oauth2_local_var = OpenAPI_plmn_oauth2_create ( + oauth2_required_plmn_id_list ? oauth2_required_plmn_id_listList : NULL, + oauth2_not_required_plmn_id_list ? oauth2_not_required_plmn_id_listList : NULL + ); + + return plmn_oauth2_local_var; +end: + if (oauth2_required_plmn_id_listList) { + OpenAPI_list_for_each(oauth2_required_plmn_id_listList, node) { + OpenAPI_plmn_id_free(node->data); + } + OpenAPI_list_free(oauth2_required_plmn_id_listList); + oauth2_required_plmn_id_listList = NULL; + } + if (oauth2_not_required_plmn_id_listList) { + OpenAPI_list_for_each(oauth2_not_required_plmn_id_listList, node) { + OpenAPI_plmn_id_free(node->data); + } + OpenAPI_list_free(oauth2_not_required_plmn_id_listList); + oauth2_not_required_plmn_id_listList = NULL; + } + return NULL; +} + +OpenAPI_plmn_oauth2_t *OpenAPI_plmn_oauth2_copy(OpenAPI_plmn_oauth2_t *dst, OpenAPI_plmn_oauth2_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_plmn_oauth2_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_plmn_oauth2_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_plmn_oauth2_free(dst); + dst = OpenAPI_plmn_oauth2_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/plmn_oauth2.h b/lib/sbi/openapi/model/plmn_oauth2.h new file mode 100644 index 000000000..ff2f3b0c6 --- /dev/null +++ b/lib/sbi/openapi/model/plmn_oauth2.h @@ -0,0 +1,41 @@ +/* + * plmn_oauth2.h + * + * Oauth2.0 required indication for a given PLMN ID + */ + +#ifndef _OpenAPI_plmn_oauth2_H_ +#define _OpenAPI_plmn_oauth2_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "plmn_id.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_plmn_oauth2_s OpenAPI_plmn_oauth2_t; +typedef struct OpenAPI_plmn_oauth2_s { + OpenAPI_list_t *oauth2_required_plmn_id_list; + OpenAPI_list_t *oauth2_not_required_plmn_id_list; +} OpenAPI_plmn_oauth2_t; + +OpenAPI_plmn_oauth2_t *OpenAPI_plmn_oauth2_create( + OpenAPI_list_t *oauth2_required_plmn_id_list, + OpenAPI_list_t *oauth2_not_required_plmn_id_list +); +void OpenAPI_plmn_oauth2_free(OpenAPI_plmn_oauth2_t *plmn_oauth2); +OpenAPI_plmn_oauth2_t *OpenAPI_plmn_oauth2_parseFromJSON(cJSON *plmn_oauth2JSON); +cJSON *OpenAPI_plmn_oauth2_convertToJSON(OpenAPI_plmn_oauth2_t *plmn_oauth2); +OpenAPI_plmn_oauth2_t *OpenAPI_plmn_oauth2_copy(OpenAPI_plmn_oauth2_t *dst, OpenAPI_plmn_oauth2_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_plmn_oauth2_H_ */ + diff --git a/lib/sbi/openapi/model/plmn_operator_class_1.c b/lib/sbi/openapi/model/plmn_operator_class_1.c deleted file mode 100644 index e52e99fe2..000000000 --- a/lib/sbi/openapi/model/plmn_operator_class_1.c +++ /dev/null @@ -1,170 +0,0 @@ - -#include -#include -#include -#include "plmn_operator_class_1.h" - -OpenAPI_plmn_operator_class_1_t *OpenAPI_plmn_operator_class_1_create( - OpenAPI_lcs_client_class_e lcs_client_class, - OpenAPI_list_t *lcs_client_ids -) -{ - OpenAPI_plmn_operator_class_1_t *plmn_operator_class_1_local_var = ogs_malloc(sizeof(OpenAPI_plmn_operator_class_1_t)); - ogs_assert(plmn_operator_class_1_local_var); - - plmn_operator_class_1_local_var->lcs_client_class = lcs_client_class; - plmn_operator_class_1_local_var->lcs_client_ids = lcs_client_ids; - - return plmn_operator_class_1_local_var; -} - -void OpenAPI_plmn_operator_class_1_free(OpenAPI_plmn_operator_class_1_t *plmn_operator_class_1) -{ - OpenAPI_lnode_t *node = NULL; - - if (NULL == plmn_operator_class_1) { - return; - } - if (plmn_operator_class_1->lcs_client_ids) { - OpenAPI_list_for_each(plmn_operator_class_1->lcs_client_ids, node) { - ogs_free(node->data); - } - OpenAPI_list_free(plmn_operator_class_1->lcs_client_ids); - plmn_operator_class_1->lcs_client_ids = NULL; - } - ogs_free(plmn_operator_class_1); -} - -cJSON *OpenAPI_plmn_operator_class_1_convertToJSON(OpenAPI_plmn_operator_class_1_t *plmn_operator_class_1) -{ - cJSON *item = NULL; - OpenAPI_lnode_t *node = NULL; - - if (plmn_operator_class_1 == NULL) { - ogs_error("OpenAPI_plmn_operator_class_1_convertToJSON() failed [PlmnOperatorClass_1]"); - return NULL; - } - - item = cJSON_CreateObject(); - if (plmn_operator_class_1->lcs_client_class == OpenAPI_lcs_client_class_NULL) { - ogs_error("OpenAPI_plmn_operator_class_1_convertToJSON() failed [lcs_client_class]"); - return NULL; - } - if (cJSON_AddStringToObject(item, "lcsClientClass", OpenAPI_lcs_client_class_ToString(plmn_operator_class_1->lcs_client_class)) == NULL) { - ogs_error("OpenAPI_plmn_operator_class_1_convertToJSON() failed [lcs_client_class]"); - goto end; - } - - if (!plmn_operator_class_1->lcs_client_ids) { - ogs_error("OpenAPI_plmn_operator_class_1_convertToJSON() failed [lcs_client_ids]"); - return NULL; - } - cJSON *lcs_client_idsList = cJSON_AddArrayToObject(item, "lcsClientIds"); - if (lcs_client_idsList == NULL) { - ogs_error("OpenAPI_plmn_operator_class_1_convertToJSON() failed [lcs_client_ids]"); - goto end; - } - OpenAPI_list_for_each(plmn_operator_class_1->lcs_client_ids, node) { - if (cJSON_AddStringToObject(lcs_client_idsList, "", (char*)node->data) == NULL) { - ogs_error("OpenAPI_plmn_operator_class_1_convertToJSON() failed [lcs_client_ids]"); - goto end; - } - } - -end: - return item; -} - -OpenAPI_plmn_operator_class_1_t *OpenAPI_plmn_operator_class_1_parseFromJSON(cJSON *plmn_operator_class_1JSON) -{ - OpenAPI_plmn_operator_class_1_t *plmn_operator_class_1_local_var = NULL; - OpenAPI_lnode_t *node = NULL; - cJSON *lcs_client_class = NULL; - OpenAPI_lcs_client_class_e lcs_client_classVariable = 0; - cJSON *lcs_client_ids = NULL; - OpenAPI_list_t *lcs_client_idsList = NULL; - lcs_client_class = cJSON_GetObjectItemCaseSensitive(plmn_operator_class_1JSON, "lcsClientClass"); - if (!lcs_client_class) { - ogs_error("OpenAPI_plmn_operator_class_1_parseFromJSON() failed [lcs_client_class]"); - goto end; - } - if (!cJSON_IsString(lcs_client_class)) { - ogs_error("OpenAPI_plmn_operator_class_1_parseFromJSON() failed [lcs_client_class]"); - goto end; - } - lcs_client_classVariable = OpenAPI_lcs_client_class_FromString(lcs_client_class->valuestring); - - lcs_client_ids = cJSON_GetObjectItemCaseSensitive(plmn_operator_class_1JSON, "lcsClientIds"); - if (!lcs_client_ids) { - ogs_error("OpenAPI_plmn_operator_class_1_parseFromJSON() failed [lcs_client_ids]"); - goto end; - } - cJSON *lcs_client_ids_local = NULL; - if (!cJSON_IsArray(lcs_client_ids)) { - ogs_error("OpenAPI_plmn_operator_class_1_parseFromJSON() failed [lcs_client_ids]"); - goto end; - } - - lcs_client_idsList = OpenAPI_list_create(); - - cJSON_ArrayForEach(lcs_client_ids_local, lcs_client_ids) { - double *localDouble = NULL; - int *localInt = NULL; - if (!cJSON_IsString(lcs_client_ids_local)) { - ogs_error("OpenAPI_plmn_operator_class_1_parseFromJSON() failed [lcs_client_ids]"); - goto end; - } - OpenAPI_list_add(lcs_client_idsList, ogs_strdup(lcs_client_ids_local->valuestring)); - } - - plmn_operator_class_1_local_var = OpenAPI_plmn_operator_class_1_create ( - lcs_client_classVariable, - lcs_client_idsList - ); - - return plmn_operator_class_1_local_var; -end: - if (lcs_client_idsList) { - OpenAPI_list_for_each(lcs_client_idsList, node) { - ogs_free(node->data); - } - OpenAPI_list_free(lcs_client_idsList); - lcs_client_idsList = NULL; - } - return NULL; -} - -OpenAPI_plmn_operator_class_1_t *OpenAPI_plmn_operator_class_1_copy(OpenAPI_plmn_operator_class_1_t *dst, OpenAPI_plmn_operator_class_1_t *src) -{ - cJSON *item = NULL; - char *content = NULL; - - ogs_assert(src); - item = OpenAPI_plmn_operator_class_1_convertToJSON(src); - if (!item) { - ogs_error("OpenAPI_plmn_operator_class_1_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_plmn_operator_class_1_free(dst); - dst = OpenAPI_plmn_operator_class_1_parseFromJSON(item); - cJSON_Delete(item); - - return dst; -} - diff --git a/lib/sbi/openapi/model/plmn_operator_class_1.h b/lib/sbi/openapi/model/plmn_operator_class_1.h deleted file mode 100644 index aee4ae04f..000000000 --- a/lib/sbi/openapi/model/plmn_operator_class_1.h +++ /dev/null @@ -1,41 +0,0 @@ -/* - * plmn_operator_class_1.h - * - * - */ - -#ifndef _OpenAPI_plmn_operator_class_1_H_ -#define _OpenAPI_plmn_operator_class_1_H_ - -#include -#include "../external/cJSON.h" -#include "../include/list.h" -#include "../include/keyValuePair.h" -#include "../include/binary.h" -#include "lcs_client_class.h" - -#ifdef __cplusplus -extern "C" { -#endif - -typedef struct OpenAPI_plmn_operator_class_1_s OpenAPI_plmn_operator_class_1_t; -typedef struct OpenAPI_plmn_operator_class_1_s { - OpenAPI_lcs_client_class_e lcs_client_class; - OpenAPI_list_t *lcs_client_ids; -} OpenAPI_plmn_operator_class_1_t; - -OpenAPI_plmn_operator_class_1_t *OpenAPI_plmn_operator_class_1_create( - OpenAPI_lcs_client_class_e lcs_client_class, - OpenAPI_list_t *lcs_client_ids -); -void OpenAPI_plmn_operator_class_1_free(OpenAPI_plmn_operator_class_1_t *plmn_operator_class_1); -OpenAPI_plmn_operator_class_1_t *OpenAPI_plmn_operator_class_1_parseFromJSON(cJSON *plmn_operator_class_1JSON); -cJSON *OpenAPI_plmn_operator_class_1_convertToJSON(OpenAPI_plmn_operator_class_1_t *plmn_operator_class_1); -OpenAPI_plmn_operator_class_1_t *OpenAPI_plmn_operator_class_1_copy(OpenAPI_plmn_operator_class_1_t *dst, OpenAPI_plmn_operator_class_1_t *src); - -#ifdef __cplusplus -} -#endif - -#endif /* _OpenAPI_plmn_operator_class_1_H_ */ - diff --git a/lib/sbi/openapi/model/plmn_restriction.c b/lib/sbi/openapi/model/plmn_restriction.c new file mode 100644 index 000000000..323a22ec3 --- /dev/null +++ b/lib/sbi/openapi/model/plmn_restriction.c @@ -0,0 +1,362 @@ + +#include +#include +#include +#include "plmn_restriction.h" + +OpenAPI_plmn_restriction_t *OpenAPI_plmn_restriction_create( + OpenAPI_set_t *rat_restrictions, + OpenAPI_list_t *forbidden_areas, + OpenAPI_service_area_restriction_t *service_area_restriction, + OpenAPI_list_t *core_network_type_restrictions, + OpenAPI_set_t *primary_rat_restrictions, + OpenAPI_set_t *secondary_rat_restrictions +) +{ + OpenAPI_plmn_restriction_t *plmn_restriction_local_var = ogs_malloc(sizeof(OpenAPI_plmn_restriction_t)); + ogs_assert(plmn_restriction_local_var); + + plmn_restriction_local_var->rat_restrictions = rat_restrictions; + plmn_restriction_local_var->forbidden_areas = forbidden_areas; + plmn_restriction_local_var->service_area_restriction = service_area_restriction; + plmn_restriction_local_var->core_network_type_restrictions = core_network_type_restrictions; + plmn_restriction_local_var->primary_rat_restrictions = primary_rat_restrictions; + plmn_restriction_local_var->secondary_rat_restrictions = secondary_rat_restrictions; + + return plmn_restriction_local_var; +} + +void OpenAPI_plmn_restriction_free(OpenAPI_plmn_restriction_t *plmn_restriction) +{ + OpenAPI_lnode_t *node = NULL; + + if (NULL == plmn_restriction) { + return; + } + if (plmn_restriction->rat_restrictions) { + OpenAPI_list_free(plmn_restriction->rat_restrictions); + plmn_restriction->rat_restrictions = NULL; + } + if (plmn_restriction->forbidden_areas) { + OpenAPI_list_for_each(plmn_restriction->forbidden_areas, node) { + OpenAPI_area_free(node->data); + } + OpenAPI_list_free(plmn_restriction->forbidden_areas); + plmn_restriction->forbidden_areas = NULL; + } + if (plmn_restriction->service_area_restriction) { + OpenAPI_service_area_restriction_free(plmn_restriction->service_area_restriction); + plmn_restriction->service_area_restriction = NULL; + } + if (plmn_restriction->core_network_type_restrictions) { + OpenAPI_list_free(plmn_restriction->core_network_type_restrictions); + plmn_restriction->core_network_type_restrictions = NULL; + } + if (plmn_restriction->primary_rat_restrictions) { + OpenAPI_list_free(plmn_restriction->primary_rat_restrictions); + plmn_restriction->primary_rat_restrictions = NULL; + } + if (plmn_restriction->secondary_rat_restrictions) { + OpenAPI_list_free(plmn_restriction->secondary_rat_restrictions); + plmn_restriction->secondary_rat_restrictions = NULL; + } + ogs_free(plmn_restriction); +} + +cJSON *OpenAPI_plmn_restriction_convertToJSON(OpenAPI_plmn_restriction_t *plmn_restriction) +{ + cJSON *item = NULL; + OpenAPI_lnode_t *node = NULL; + + if (plmn_restriction == NULL) { + ogs_error("OpenAPI_plmn_restriction_convertToJSON() failed [PlmnRestriction]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (plmn_restriction->rat_restrictions != OpenAPI_rat_type_NULL) { + cJSON *rat_restrictionsList = cJSON_AddArrayToObject(item, "ratRestrictions"); + if (rat_restrictionsList == NULL) { + ogs_error("OpenAPI_plmn_restriction_convertToJSON() failed [rat_restrictions]"); + goto end; + } + OpenAPI_list_for_each(plmn_restriction->rat_restrictions, node) { + if (cJSON_AddStringToObject(rat_restrictionsList, "", OpenAPI_rat_type_ToString((intptr_t)node->data)) == NULL) { + ogs_error("OpenAPI_plmn_restriction_convertToJSON() failed [rat_restrictions]"); + goto end; + } + } + } + + if (plmn_restriction->forbidden_areas) { + cJSON *forbidden_areasList = cJSON_AddArrayToObject(item, "forbiddenAreas"); + if (forbidden_areasList == NULL) { + ogs_error("OpenAPI_plmn_restriction_convertToJSON() failed [forbidden_areas]"); + goto end; + } + OpenAPI_list_for_each(plmn_restriction->forbidden_areas, node) { + cJSON *itemLocal = OpenAPI_area_convertToJSON(node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_plmn_restriction_convertToJSON() failed [forbidden_areas]"); + goto end; + } + cJSON_AddItemToArray(forbidden_areasList, itemLocal); + } + } + + if (plmn_restriction->service_area_restriction) { + cJSON *service_area_restriction_local_JSON = OpenAPI_service_area_restriction_convertToJSON(plmn_restriction->service_area_restriction); + if (service_area_restriction_local_JSON == NULL) { + ogs_error("OpenAPI_plmn_restriction_convertToJSON() failed [service_area_restriction]"); + goto end; + } + cJSON_AddItemToObject(item, "serviceAreaRestriction", service_area_restriction_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_plmn_restriction_convertToJSON() failed [service_area_restriction]"); + goto end; + } + } + + if (plmn_restriction->core_network_type_restrictions != OpenAPI_core_network_type_NULL) { + cJSON *core_network_type_restrictionsList = cJSON_AddArrayToObject(item, "coreNetworkTypeRestrictions"); + if (core_network_type_restrictionsList == NULL) { + ogs_error("OpenAPI_plmn_restriction_convertToJSON() failed [core_network_type_restrictions]"); + goto end; + } + OpenAPI_list_for_each(plmn_restriction->core_network_type_restrictions, node) { + if (cJSON_AddStringToObject(core_network_type_restrictionsList, "", OpenAPI_core_network_type_ToString((intptr_t)node->data)) == NULL) { + ogs_error("OpenAPI_plmn_restriction_convertToJSON() failed [core_network_type_restrictions]"); + goto end; + } + } + } + + if (plmn_restriction->primary_rat_restrictions != OpenAPI_rat_type_NULL) { + cJSON *primary_rat_restrictionsList = cJSON_AddArrayToObject(item, "primaryRatRestrictions"); + if (primary_rat_restrictionsList == NULL) { + ogs_error("OpenAPI_plmn_restriction_convertToJSON() failed [primary_rat_restrictions]"); + goto end; + } + OpenAPI_list_for_each(plmn_restriction->primary_rat_restrictions, node) { + if (cJSON_AddStringToObject(primary_rat_restrictionsList, "", OpenAPI_rat_type_ToString((intptr_t)node->data)) == NULL) { + ogs_error("OpenAPI_plmn_restriction_convertToJSON() failed [primary_rat_restrictions]"); + goto end; + } + } + } + + if (plmn_restriction->secondary_rat_restrictions != OpenAPI_rat_type_NULL) { + cJSON *secondary_rat_restrictionsList = cJSON_AddArrayToObject(item, "secondaryRatRestrictions"); + if (secondary_rat_restrictionsList == NULL) { + ogs_error("OpenAPI_plmn_restriction_convertToJSON() failed [secondary_rat_restrictions]"); + goto end; + } + OpenAPI_list_for_each(plmn_restriction->secondary_rat_restrictions, node) { + if (cJSON_AddStringToObject(secondary_rat_restrictionsList, "", OpenAPI_rat_type_ToString((intptr_t)node->data)) == NULL) { + ogs_error("OpenAPI_plmn_restriction_convertToJSON() failed [secondary_rat_restrictions]"); + goto end; + } + } + } + +end: + return item; +} + +OpenAPI_plmn_restriction_t *OpenAPI_plmn_restriction_parseFromJSON(cJSON *plmn_restrictionJSON) +{ + OpenAPI_plmn_restriction_t *plmn_restriction_local_var = NULL; + OpenAPI_lnode_t *node = NULL; + cJSON *rat_restrictions = NULL; + OpenAPI_list_t *rat_restrictionsList = NULL; + cJSON *forbidden_areas = NULL; + OpenAPI_list_t *forbidden_areasList = NULL; + cJSON *service_area_restriction = NULL; + OpenAPI_service_area_restriction_t *service_area_restriction_local_nonprim = NULL; + cJSON *core_network_type_restrictions = NULL; + OpenAPI_list_t *core_network_type_restrictionsList = NULL; + cJSON *primary_rat_restrictions = NULL; + OpenAPI_list_t *primary_rat_restrictionsList = NULL; + cJSON *secondary_rat_restrictions = NULL; + OpenAPI_list_t *secondary_rat_restrictionsList = NULL; + rat_restrictions = cJSON_GetObjectItemCaseSensitive(plmn_restrictionJSON, "ratRestrictions"); + if (rat_restrictions) { + cJSON *rat_restrictions_local = NULL; + if (!cJSON_IsArray(rat_restrictions)) { + ogs_error("OpenAPI_plmn_restriction_parseFromJSON() failed [rat_restrictions]"); + goto end; + } + + rat_restrictionsList = OpenAPI_list_create(); + + cJSON_ArrayForEach(rat_restrictions_local, rat_restrictions) { + if (!cJSON_IsString(rat_restrictions_local)) { + ogs_error("OpenAPI_plmn_restriction_parseFromJSON() failed [rat_restrictions]"); + goto end; + } + OpenAPI_list_add(rat_restrictionsList, (void *)OpenAPI_rat_type_FromString(rat_restrictions_local->valuestring)); + } + } + + forbidden_areas = cJSON_GetObjectItemCaseSensitive(plmn_restrictionJSON, "forbiddenAreas"); + if (forbidden_areas) { + cJSON *forbidden_areas_local = NULL; + if (!cJSON_IsArray(forbidden_areas)) { + ogs_error("OpenAPI_plmn_restriction_parseFromJSON() failed [forbidden_areas]"); + goto end; + } + + forbidden_areasList = OpenAPI_list_create(); + + cJSON_ArrayForEach(forbidden_areas_local, forbidden_areas) { + if (!cJSON_IsObject(forbidden_areas_local)) { + ogs_error("OpenAPI_plmn_restriction_parseFromJSON() failed [forbidden_areas]"); + goto end; + } + OpenAPI_area_t *forbidden_areasItem = OpenAPI_area_parseFromJSON(forbidden_areas_local); + if (!forbidden_areasItem) { + ogs_error("No forbidden_areasItem"); + OpenAPI_list_free(forbidden_areasList); + goto end; + } + OpenAPI_list_add(forbidden_areasList, forbidden_areasItem); + } + } + + service_area_restriction = cJSON_GetObjectItemCaseSensitive(plmn_restrictionJSON, "serviceAreaRestriction"); + if (service_area_restriction) { + service_area_restriction_local_nonprim = OpenAPI_service_area_restriction_parseFromJSON(service_area_restriction); + } + + core_network_type_restrictions = cJSON_GetObjectItemCaseSensitive(plmn_restrictionJSON, "coreNetworkTypeRestrictions"); + if (core_network_type_restrictions) { + cJSON *core_network_type_restrictions_local = NULL; + if (!cJSON_IsArray(core_network_type_restrictions)) { + ogs_error("OpenAPI_plmn_restriction_parseFromJSON() failed [core_network_type_restrictions]"); + goto end; + } + + core_network_type_restrictionsList = OpenAPI_list_create(); + + cJSON_ArrayForEach(core_network_type_restrictions_local, core_network_type_restrictions) { + if (!cJSON_IsString(core_network_type_restrictions_local)) { + ogs_error("OpenAPI_plmn_restriction_parseFromJSON() failed [core_network_type_restrictions]"); + goto end; + } + OpenAPI_list_add(core_network_type_restrictionsList, (void *)OpenAPI_core_network_type_FromString(core_network_type_restrictions_local->valuestring)); + } + } + + primary_rat_restrictions = cJSON_GetObjectItemCaseSensitive(plmn_restrictionJSON, "primaryRatRestrictions"); + if (primary_rat_restrictions) { + cJSON *primary_rat_restrictions_local = NULL; + if (!cJSON_IsArray(primary_rat_restrictions)) { + ogs_error("OpenAPI_plmn_restriction_parseFromJSON() failed [primary_rat_restrictions]"); + goto end; + } + + primary_rat_restrictionsList = OpenAPI_list_create(); + + cJSON_ArrayForEach(primary_rat_restrictions_local, primary_rat_restrictions) { + if (!cJSON_IsString(primary_rat_restrictions_local)) { + ogs_error("OpenAPI_plmn_restriction_parseFromJSON() failed [primary_rat_restrictions]"); + goto end; + } + OpenAPI_list_add(primary_rat_restrictionsList, (void *)OpenAPI_rat_type_FromString(primary_rat_restrictions_local->valuestring)); + } + } + + secondary_rat_restrictions = cJSON_GetObjectItemCaseSensitive(plmn_restrictionJSON, "secondaryRatRestrictions"); + if (secondary_rat_restrictions) { + cJSON *secondary_rat_restrictions_local = NULL; + if (!cJSON_IsArray(secondary_rat_restrictions)) { + ogs_error("OpenAPI_plmn_restriction_parseFromJSON() failed [secondary_rat_restrictions]"); + goto end; + } + + secondary_rat_restrictionsList = OpenAPI_list_create(); + + cJSON_ArrayForEach(secondary_rat_restrictions_local, secondary_rat_restrictions) { + if (!cJSON_IsString(secondary_rat_restrictions_local)) { + ogs_error("OpenAPI_plmn_restriction_parseFromJSON() failed [secondary_rat_restrictions]"); + goto end; + } + OpenAPI_list_add(secondary_rat_restrictionsList, (void *)OpenAPI_rat_type_FromString(secondary_rat_restrictions_local->valuestring)); + } + } + + plmn_restriction_local_var = OpenAPI_plmn_restriction_create ( + rat_restrictions ? rat_restrictionsList : NULL, + forbidden_areas ? forbidden_areasList : NULL, + service_area_restriction ? service_area_restriction_local_nonprim : NULL, + core_network_type_restrictions ? core_network_type_restrictionsList : NULL, + primary_rat_restrictions ? primary_rat_restrictionsList : NULL, + secondary_rat_restrictions ? secondary_rat_restrictionsList : NULL + ); + + return plmn_restriction_local_var; +end: + if (rat_restrictionsList) { + OpenAPI_list_free(rat_restrictionsList); + rat_restrictionsList = NULL; + } + if (forbidden_areasList) { + OpenAPI_list_for_each(forbidden_areasList, node) { + OpenAPI_area_free(node->data); + } + OpenAPI_list_free(forbidden_areasList); + forbidden_areasList = NULL; + } + if (service_area_restriction_local_nonprim) { + OpenAPI_service_area_restriction_free(service_area_restriction_local_nonprim); + service_area_restriction_local_nonprim = NULL; + } + if (core_network_type_restrictionsList) { + OpenAPI_list_free(core_network_type_restrictionsList); + core_network_type_restrictionsList = NULL; + } + if (primary_rat_restrictionsList) { + OpenAPI_list_free(primary_rat_restrictionsList); + primary_rat_restrictionsList = NULL; + } + if (secondary_rat_restrictionsList) { + OpenAPI_list_free(secondary_rat_restrictionsList); + secondary_rat_restrictionsList = NULL; + } + return NULL; +} + +OpenAPI_plmn_restriction_t *OpenAPI_plmn_restriction_copy(OpenAPI_plmn_restriction_t *dst, OpenAPI_plmn_restriction_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_plmn_restriction_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_plmn_restriction_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_plmn_restriction_free(dst); + dst = OpenAPI_plmn_restriction_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/plmn_restriction.h b/lib/sbi/openapi/model/plmn_restriction.h new file mode 100644 index 000000000..77d4cd887 --- /dev/null +++ b/lib/sbi/openapi/model/plmn_restriction.h @@ -0,0 +1,53 @@ +/* + * plmn_restriction.h + * + * + */ + +#ifndef _OpenAPI_plmn_restriction_H_ +#define _OpenAPI_plmn_restriction_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "area.h" +#include "core_network_type.h" +#include "rat_type.h" +#include "service_area_restriction.h" +#include "set.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_plmn_restriction_s OpenAPI_plmn_restriction_t; +typedef struct OpenAPI_plmn_restriction_s { + OpenAPI_set_t *rat_restrictions; + OpenAPI_list_t *forbidden_areas; + struct OpenAPI_service_area_restriction_s *service_area_restriction; + OpenAPI_list_t *core_network_type_restrictions; + OpenAPI_set_t *primary_rat_restrictions; + OpenAPI_set_t *secondary_rat_restrictions; +} OpenAPI_plmn_restriction_t; + +OpenAPI_plmn_restriction_t *OpenAPI_plmn_restriction_create( + OpenAPI_set_t *rat_restrictions, + OpenAPI_list_t *forbidden_areas, + OpenAPI_service_area_restriction_t *service_area_restriction, + OpenAPI_list_t *core_network_type_restrictions, + OpenAPI_set_t *primary_rat_restrictions, + OpenAPI_set_t *secondary_rat_restrictions +); +void OpenAPI_plmn_restriction_free(OpenAPI_plmn_restriction_t *plmn_restriction); +OpenAPI_plmn_restriction_t *OpenAPI_plmn_restriction_parseFromJSON(cJSON *plmn_restrictionJSON); +cJSON *OpenAPI_plmn_restriction_convertToJSON(OpenAPI_plmn_restriction_t *plmn_restriction); +OpenAPI_plmn_restriction_t *OpenAPI_plmn_restriction_copy(OpenAPI_plmn_restriction_t *dst, OpenAPI_plmn_restriction_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_plmn_restriction_H_ */ + diff --git a/lib/sbi/openapi/model/plmn_restriction_1.c b/lib/sbi/openapi/model/plmn_restriction_1.c new file mode 100644 index 000000000..4ef5c8391 --- /dev/null +++ b/lib/sbi/openapi/model/plmn_restriction_1.c @@ -0,0 +1,362 @@ + +#include +#include +#include +#include "plmn_restriction_1.h" + +OpenAPI_plmn_restriction_1_t *OpenAPI_plmn_restriction_1_create( + OpenAPI_set_t *rat_restrictions, + OpenAPI_list_t *forbidden_areas, + OpenAPI_service_area_restriction_1_t *service_area_restriction, + OpenAPI_list_t *core_network_type_restrictions, + OpenAPI_set_t *primary_rat_restrictions, + OpenAPI_set_t *secondary_rat_restrictions +) +{ + OpenAPI_plmn_restriction_1_t *plmn_restriction_1_local_var = ogs_malloc(sizeof(OpenAPI_plmn_restriction_1_t)); + ogs_assert(plmn_restriction_1_local_var); + + plmn_restriction_1_local_var->rat_restrictions = rat_restrictions; + plmn_restriction_1_local_var->forbidden_areas = forbidden_areas; + plmn_restriction_1_local_var->service_area_restriction = service_area_restriction; + plmn_restriction_1_local_var->core_network_type_restrictions = core_network_type_restrictions; + plmn_restriction_1_local_var->primary_rat_restrictions = primary_rat_restrictions; + plmn_restriction_1_local_var->secondary_rat_restrictions = secondary_rat_restrictions; + + return plmn_restriction_1_local_var; +} + +void OpenAPI_plmn_restriction_1_free(OpenAPI_plmn_restriction_1_t *plmn_restriction_1) +{ + OpenAPI_lnode_t *node = NULL; + + if (NULL == plmn_restriction_1) { + return; + } + if (plmn_restriction_1->rat_restrictions) { + OpenAPI_list_free(plmn_restriction_1->rat_restrictions); + plmn_restriction_1->rat_restrictions = NULL; + } + if (plmn_restriction_1->forbidden_areas) { + OpenAPI_list_for_each(plmn_restriction_1->forbidden_areas, node) { + OpenAPI_area_1_free(node->data); + } + OpenAPI_list_free(plmn_restriction_1->forbidden_areas); + plmn_restriction_1->forbidden_areas = NULL; + } + if (plmn_restriction_1->service_area_restriction) { + OpenAPI_service_area_restriction_1_free(plmn_restriction_1->service_area_restriction); + plmn_restriction_1->service_area_restriction = NULL; + } + if (plmn_restriction_1->core_network_type_restrictions) { + OpenAPI_list_free(plmn_restriction_1->core_network_type_restrictions); + plmn_restriction_1->core_network_type_restrictions = NULL; + } + if (plmn_restriction_1->primary_rat_restrictions) { + OpenAPI_list_free(plmn_restriction_1->primary_rat_restrictions); + plmn_restriction_1->primary_rat_restrictions = NULL; + } + if (plmn_restriction_1->secondary_rat_restrictions) { + OpenAPI_list_free(plmn_restriction_1->secondary_rat_restrictions); + plmn_restriction_1->secondary_rat_restrictions = NULL; + } + ogs_free(plmn_restriction_1); +} + +cJSON *OpenAPI_plmn_restriction_1_convertToJSON(OpenAPI_plmn_restriction_1_t *plmn_restriction_1) +{ + cJSON *item = NULL; + OpenAPI_lnode_t *node = NULL; + + if (plmn_restriction_1 == NULL) { + ogs_error("OpenAPI_plmn_restriction_1_convertToJSON() failed [PlmnRestriction_1]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (plmn_restriction_1->rat_restrictions != OpenAPI_rat_type_NULL) { + cJSON *rat_restrictionsList = cJSON_AddArrayToObject(item, "ratRestrictions"); + if (rat_restrictionsList == NULL) { + ogs_error("OpenAPI_plmn_restriction_1_convertToJSON() failed [rat_restrictions]"); + goto end; + } + OpenAPI_list_for_each(plmn_restriction_1->rat_restrictions, node) { + if (cJSON_AddStringToObject(rat_restrictionsList, "", OpenAPI_rat_type_ToString((intptr_t)node->data)) == NULL) { + ogs_error("OpenAPI_plmn_restriction_1_convertToJSON() failed [rat_restrictions]"); + goto end; + } + } + } + + if (plmn_restriction_1->forbidden_areas) { + cJSON *forbidden_areasList = cJSON_AddArrayToObject(item, "forbiddenAreas"); + if (forbidden_areasList == NULL) { + ogs_error("OpenAPI_plmn_restriction_1_convertToJSON() failed [forbidden_areas]"); + goto end; + } + OpenAPI_list_for_each(plmn_restriction_1->forbidden_areas, node) { + cJSON *itemLocal = OpenAPI_area_1_convertToJSON(node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_plmn_restriction_1_convertToJSON() failed [forbidden_areas]"); + goto end; + } + cJSON_AddItemToArray(forbidden_areasList, itemLocal); + } + } + + if (plmn_restriction_1->service_area_restriction) { + cJSON *service_area_restriction_local_JSON = OpenAPI_service_area_restriction_1_convertToJSON(plmn_restriction_1->service_area_restriction); + if (service_area_restriction_local_JSON == NULL) { + ogs_error("OpenAPI_plmn_restriction_1_convertToJSON() failed [service_area_restriction]"); + goto end; + } + cJSON_AddItemToObject(item, "serviceAreaRestriction", service_area_restriction_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_plmn_restriction_1_convertToJSON() failed [service_area_restriction]"); + goto end; + } + } + + if (plmn_restriction_1->core_network_type_restrictions != OpenAPI_core_network_type_NULL) { + cJSON *core_network_type_restrictionsList = cJSON_AddArrayToObject(item, "coreNetworkTypeRestrictions"); + if (core_network_type_restrictionsList == NULL) { + ogs_error("OpenAPI_plmn_restriction_1_convertToJSON() failed [core_network_type_restrictions]"); + goto end; + } + OpenAPI_list_for_each(plmn_restriction_1->core_network_type_restrictions, node) { + if (cJSON_AddStringToObject(core_network_type_restrictionsList, "", OpenAPI_core_network_type_ToString((intptr_t)node->data)) == NULL) { + ogs_error("OpenAPI_plmn_restriction_1_convertToJSON() failed [core_network_type_restrictions]"); + goto end; + } + } + } + + if (plmn_restriction_1->primary_rat_restrictions != OpenAPI_rat_type_NULL) { + cJSON *primary_rat_restrictionsList = cJSON_AddArrayToObject(item, "primaryRatRestrictions"); + if (primary_rat_restrictionsList == NULL) { + ogs_error("OpenAPI_plmn_restriction_1_convertToJSON() failed [primary_rat_restrictions]"); + goto end; + } + OpenAPI_list_for_each(plmn_restriction_1->primary_rat_restrictions, node) { + if (cJSON_AddStringToObject(primary_rat_restrictionsList, "", OpenAPI_rat_type_ToString((intptr_t)node->data)) == NULL) { + ogs_error("OpenAPI_plmn_restriction_1_convertToJSON() failed [primary_rat_restrictions]"); + goto end; + } + } + } + + if (plmn_restriction_1->secondary_rat_restrictions != OpenAPI_rat_type_NULL) { + cJSON *secondary_rat_restrictionsList = cJSON_AddArrayToObject(item, "secondaryRatRestrictions"); + if (secondary_rat_restrictionsList == NULL) { + ogs_error("OpenAPI_plmn_restriction_1_convertToJSON() failed [secondary_rat_restrictions]"); + goto end; + } + OpenAPI_list_for_each(plmn_restriction_1->secondary_rat_restrictions, node) { + if (cJSON_AddStringToObject(secondary_rat_restrictionsList, "", OpenAPI_rat_type_ToString((intptr_t)node->data)) == NULL) { + ogs_error("OpenAPI_plmn_restriction_1_convertToJSON() failed [secondary_rat_restrictions]"); + goto end; + } + } + } + +end: + return item; +} + +OpenAPI_plmn_restriction_1_t *OpenAPI_plmn_restriction_1_parseFromJSON(cJSON *plmn_restriction_1JSON) +{ + OpenAPI_plmn_restriction_1_t *plmn_restriction_1_local_var = NULL; + OpenAPI_lnode_t *node = NULL; + cJSON *rat_restrictions = NULL; + OpenAPI_list_t *rat_restrictionsList = NULL; + cJSON *forbidden_areas = NULL; + OpenAPI_list_t *forbidden_areasList = NULL; + cJSON *service_area_restriction = NULL; + OpenAPI_service_area_restriction_1_t *service_area_restriction_local_nonprim = NULL; + cJSON *core_network_type_restrictions = NULL; + OpenAPI_list_t *core_network_type_restrictionsList = NULL; + cJSON *primary_rat_restrictions = NULL; + OpenAPI_list_t *primary_rat_restrictionsList = NULL; + cJSON *secondary_rat_restrictions = NULL; + OpenAPI_list_t *secondary_rat_restrictionsList = NULL; + rat_restrictions = cJSON_GetObjectItemCaseSensitive(plmn_restriction_1JSON, "ratRestrictions"); + if (rat_restrictions) { + cJSON *rat_restrictions_local = NULL; + if (!cJSON_IsArray(rat_restrictions)) { + ogs_error("OpenAPI_plmn_restriction_1_parseFromJSON() failed [rat_restrictions]"); + goto end; + } + + rat_restrictionsList = OpenAPI_list_create(); + + cJSON_ArrayForEach(rat_restrictions_local, rat_restrictions) { + if (!cJSON_IsString(rat_restrictions_local)) { + ogs_error("OpenAPI_plmn_restriction_1_parseFromJSON() failed [rat_restrictions]"); + goto end; + } + OpenAPI_list_add(rat_restrictionsList, (void *)OpenAPI_rat_type_FromString(rat_restrictions_local->valuestring)); + } + } + + forbidden_areas = cJSON_GetObjectItemCaseSensitive(plmn_restriction_1JSON, "forbiddenAreas"); + if (forbidden_areas) { + cJSON *forbidden_areas_local = NULL; + if (!cJSON_IsArray(forbidden_areas)) { + ogs_error("OpenAPI_plmn_restriction_1_parseFromJSON() failed [forbidden_areas]"); + goto end; + } + + forbidden_areasList = OpenAPI_list_create(); + + cJSON_ArrayForEach(forbidden_areas_local, forbidden_areas) { + if (!cJSON_IsObject(forbidden_areas_local)) { + ogs_error("OpenAPI_plmn_restriction_1_parseFromJSON() failed [forbidden_areas]"); + goto end; + } + OpenAPI_area_1_t *forbidden_areasItem = OpenAPI_area_1_parseFromJSON(forbidden_areas_local); + if (!forbidden_areasItem) { + ogs_error("No forbidden_areasItem"); + OpenAPI_list_free(forbidden_areasList); + goto end; + } + OpenAPI_list_add(forbidden_areasList, forbidden_areasItem); + } + } + + service_area_restriction = cJSON_GetObjectItemCaseSensitive(plmn_restriction_1JSON, "serviceAreaRestriction"); + if (service_area_restriction) { + service_area_restriction_local_nonprim = OpenAPI_service_area_restriction_1_parseFromJSON(service_area_restriction); + } + + core_network_type_restrictions = cJSON_GetObjectItemCaseSensitive(plmn_restriction_1JSON, "coreNetworkTypeRestrictions"); + if (core_network_type_restrictions) { + cJSON *core_network_type_restrictions_local = NULL; + if (!cJSON_IsArray(core_network_type_restrictions)) { + ogs_error("OpenAPI_plmn_restriction_1_parseFromJSON() failed [core_network_type_restrictions]"); + goto end; + } + + core_network_type_restrictionsList = OpenAPI_list_create(); + + cJSON_ArrayForEach(core_network_type_restrictions_local, core_network_type_restrictions) { + if (!cJSON_IsString(core_network_type_restrictions_local)) { + ogs_error("OpenAPI_plmn_restriction_1_parseFromJSON() failed [core_network_type_restrictions]"); + goto end; + } + OpenAPI_list_add(core_network_type_restrictionsList, (void *)OpenAPI_core_network_type_FromString(core_network_type_restrictions_local->valuestring)); + } + } + + primary_rat_restrictions = cJSON_GetObjectItemCaseSensitive(plmn_restriction_1JSON, "primaryRatRestrictions"); + if (primary_rat_restrictions) { + cJSON *primary_rat_restrictions_local = NULL; + if (!cJSON_IsArray(primary_rat_restrictions)) { + ogs_error("OpenAPI_plmn_restriction_1_parseFromJSON() failed [primary_rat_restrictions]"); + goto end; + } + + primary_rat_restrictionsList = OpenAPI_list_create(); + + cJSON_ArrayForEach(primary_rat_restrictions_local, primary_rat_restrictions) { + if (!cJSON_IsString(primary_rat_restrictions_local)) { + ogs_error("OpenAPI_plmn_restriction_1_parseFromJSON() failed [primary_rat_restrictions]"); + goto end; + } + OpenAPI_list_add(primary_rat_restrictionsList, (void *)OpenAPI_rat_type_FromString(primary_rat_restrictions_local->valuestring)); + } + } + + secondary_rat_restrictions = cJSON_GetObjectItemCaseSensitive(plmn_restriction_1JSON, "secondaryRatRestrictions"); + if (secondary_rat_restrictions) { + cJSON *secondary_rat_restrictions_local = NULL; + if (!cJSON_IsArray(secondary_rat_restrictions)) { + ogs_error("OpenAPI_plmn_restriction_1_parseFromJSON() failed [secondary_rat_restrictions]"); + goto end; + } + + secondary_rat_restrictionsList = OpenAPI_list_create(); + + cJSON_ArrayForEach(secondary_rat_restrictions_local, secondary_rat_restrictions) { + if (!cJSON_IsString(secondary_rat_restrictions_local)) { + ogs_error("OpenAPI_plmn_restriction_1_parseFromJSON() failed [secondary_rat_restrictions]"); + goto end; + } + OpenAPI_list_add(secondary_rat_restrictionsList, (void *)OpenAPI_rat_type_FromString(secondary_rat_restrictions_local->valuestring)); + } + } + + plmn_restriction_1_local_var = OpenAPI_plmn_restriction_1_create ( + rat_restrictions ? rat_restrictionsList : NULL, + forbidden_areas ? forbidden_areasList : NULL, + service_area_restriction ? service_area_restriction_local_nonprim : NULL, + core_network_type_restrictions ? core_network_type_restrictionsList : NULL, + primary_rat_restrictions ? primary_rat_restrictionsList : NULL, + secondary_rat_restrictions ? secondary_rat_restrictionsList : NULL + ); + + return plmn_restriction_1_local_var; +end: + if (rat_restrictionsList) { + OpenAPI_list_free(rat_restrictionsList); + rat_restrictionsList = NULL; + } + if (forbidden_areasList) { + OpenAPI_list_for_each(forbidden_areasList, node) { + OpenAPI_area_1_free(node->data); + } + OpenAPI_list_free(forbidden_areasList); + forbidden_areasList = NULL; + } + if (service_area_restriction_local_nonprim) { + OpenAPI_service_area_restriction_1_free(service_area_restriction_local_nonprim); + service_area_restriction_local_nonprim = NULL; + } + if (core_network_type_restrictionsList) { + OpenAPI_list_free(core_network_type_restrictionsList); + core_network_type_restrictionsList = NULL; + } + if (primary_rat_restrictionsList) { + OpenAPI_list_free(primary_rat_restrictionsList); + primary_rat_restrictionsList = NULL; + } + if (secondary_rat_restrictionsList) { + OpenAPI_list_free(secondary_rat_restrictionsList); + secondary_rat_restrictionsList = NULL; + } + return NULL; +} + +OpenAPI_plmn_restriction_1_t *OpenAPI_plmn_restriction_1_copy(OpenAPI_plmn_restriction_1_t *dst, OpenAPI_plmn_restriction_1_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_plmn_restriction_1_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_plmn_restriction_1_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_plmn_restriction_1_free(dst); + dst = OpenAPI_plmn_restriction_1_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/plmn_restriction_1.h b/lib/sbi/openapi/model/plmn_restriction_1.h new file mode 100644 index 000000000..9710f8421 --- /dev/null +++ b/lib/sbi/openapi/model/plmn_restriction_1.h @@ -0,0 +1,53 @@ +/* + * plmn_restriction_1.h + * + * + */ + +#ifndef _OpenAPI_plmn_restriction_1_H_ +#define _OpenAPI_plmn_restriction_1_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "area_1.h" +#include "core_network_type.h" +#include "rat_type.h" +#include "service_area_restriction_1.h" +#include "set.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_plmn_restriction_1_s OpenAPI_plmn_restriction_1_t; +typedef struct OpenAPI_plmn_restriction_1_s { + OpenAPI_set_t *rat_restrictions; + OpenAPI_list_t *forbidden_areas; + struct OpenAPI_service_area_restriction_1_s *service_area_restriction; + OpenAPI_list_t *core_network_type_restrictions; + OpenAPI_set_t *primary_rat_restrictions; + OpenAPI_set_t *secondary_rat_restrictions; +} OpenAPI_plmn_restriction_1_t; + +OpenAPI_plmn_restriction_1_t *OpenAPI_plmn_restriction_1_create( + OpenAPI_set_t *rat_restrictions, + OpenAPI_list_t *forbidden_areas, + OpenAPI_service_area_restriction_1_t *service_area_restriction, + OpenAPI_list_t *core_network_type_restrictions, + OpenAPI_set_t *primary_rat_restrictions, + OpenAPI_set_t *secondary_rat_restrictions +); +void OpenAPI_plmn_restriction_1_free(OpenAPI_plmn_restriction_1_t *plmn_restriction_1); +OpenAPI_plmn_restriction_1_t *OpenAPI_plmn_restriction_1_parseFromJSON(cJSON *plmn_restriction_1JSON); +cJSON *OpenAPI_plmn_restriction_1_convertToJSON(OpenAPI_plmn_restriction_1_t *plmn_restriction_1); +OpenAPI_plmn_restriction_1_t *OpenAPI_plmn_restriction_1_copy(OpenAPI_plmn_restriction_1_t *dst, OpenAPI_plmn_restriction_1_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_plmn_restriction_1_H_ */ + diff --git a/lib/sbi/openapi/model/plmn_route_selection_descriptor.h b/lib/sbi/openapi/model/plmn_route_selection_descriptor.h index e43fa8771..224a85b89 100644 --- a/lib/sbi/openapi/model/plmn_route_selection_descriptor.h +++ b/lib/sbi/openapi/model/plmn_route_selection_descriptor.h @@ -1,7 +1,7 @@ /* * plmn_route_selection_descriptor.h * - * Contains the route selection descriptors (combinations of SNSSAI, DNNs, PDU session types, SSC modes and ATSSS information) allowed by subscription to the UE for a serving PLMN + * Contains the route selection descriptors (combinations of SNSSAI, DNNs, PDU session types, SSC modes and ATSSS information) allowed by subscription to the UE for a serving PLMN */ #ifndef _OpenAPI_plmn_route_selection_descriptor_H_ diff --git a/lib/sbi/openapi/model/point.h b/lib/sbi/openapi/model/point.h index 93acc3932..1ad7f25fb 100644 --- a/lib/sbi/openapi/model/point.h +++ b/lib/sbi/openapi/model/point.h @@ -1,7 +1,7 @@ /* * point.h * - * + * Ellipsoid Point. */ #ifndef _OpenAPI_point_H_ diff --git a/lib/sbi/openapi/model/point_altitude.h b/lib/sbi/openapi/model/point_altitude.h index e28acc458..8a7844fcd 100644 --- a/lib/sbi/openapi/model/point_altitude.h +++ b/lib/sbi/openapi/model/point_altitude.h @@ -1,7 +1,7 @@ /* * point_altitude.h * - * + * Ellipsoid point with altitude. */ #ifndef _OpenAPI_point_altitude_H_ diff --git a/lib/sbi/openapi/model/point_altitude_uncertainty.h b/lib/sbi/openapi/model/point_altitude_uncertainty.h index 16414d176..da6210962 100644 --- a/lib/sbi/openapi/model/point_altitude_uncertainty.h +++ b/lib/sbi/openapi/model/point_altitude_uncertainty.h @@ -1,7 +1,7 @@ /* * point_altitude_uncertainty.h * - * + * Ellipsoid point with altitude and uncertainty ellipsoid. */ #ifndef _OpenAPI_point_altitude_uncertainty_H_ diff --git a/lib/sbi/openapi/model/point_uncertainty_circle.h b/lib/sbi/openapi/model/point_uncertainty_circle.h index 945bc02b4..83240f8fe 100644 --- a/lib/sbi/openapi/model/point_uncertainty_circle.h +++ b/lib/sbi/openapi/model/point_uncertainty_circle.h @@ -1,7 +1,7 @@ /* * point_uncertainty_circle.h * - * + * Ellipsoid point with uncertainty circle. */ #ifndef _OpenAPI_point_uncertainty_circle_H_ diff --git a/lib/sbi/openapi/model/point_uncertainty_ellipse.h b/lib/sbi/openapi/model/point_uncertainty_ellipse.h index 20801cd5a..baf173a10 100644 --- a/lib/sbi/openapi/model/point_uncertainty_ellipse.h +++ b/lib/sbi/openapi/model/point_uncertainty_ellipse.h @@ -1,7 +1,7 @@ /* * point_uncertainty_ellipse.h * - * + * Ellipsoid point with uncertainty ellipse. */ #ifndef _OpenAPI_point_uncertainty_ellipse_H_ diff --git a/lib/sbi/openapi/model/policy_association.c b/lib/sbi/openapi/model/policy_association.c index 591635c53..e2b7a9c91 100644 --- a/lib/sbi/openapi/model/policy_association.c +++ b/lib/sbi/openapi/model/policy_association.c @@ -11,10 +11,16 @@ OpenAPI_policy_association_t *OpenAPI_policy_association_create( OpenAPI_wireline_service_area_restriction_t *wl_serv_area_res, bool is_rfsp, int rfsp, + bool is_target_rfsp, + int target_rfsp, OpenAPI_smf_selection_data_t *smf_sel_info, OpenAPI_ambr_t *ue_ambr, + OpenAPI_list_t *ue_slice_mbrs, OpenAPI_list_t* pras, - char *supp_feat + char *supp_feat, + OpenAPI_pcf_ue_callback_info_t *pcf_ue_info, + OpenAPI_list_t *match_pdus, + OpenAPI_as_time_distribution_param_t *as_time_dis_param ) { OpenAPI_policy_association_t *policy_association_local_var = ogs_malloc(sizeof(OpenAPI_policy_association_t)); @@ -26,10 +32,16 @@ OpenAPI_policy_association_t *OpenAPI_policy_association_create( policy_association_local_var->wl_serv_area_res = wl_serv_area_res; policy_association_local_var->is_rfsp = is_rfsp; policy_association_local_var->rfsp = rfsp; + policy_association_local_var->is_target_rfsp = is_target_rfsp; + policy_association_local_var->target_rfsp = target_rfsp; policy_association_local_var->smf_sel_info = smf_sel_info; policy_association_local_var->ue_ambr = ue_ambr; + policy_association_local_var->ue_slice_mbrs = ue_slice_mbrs; policy_association_local_var->pras = pras; policy_association_local_var->supp_feat = supp_feat; + policy_association_local_var->pcf_ue_info = pcf_ue_info; + policy_association_local_var->match_pdus = match_pdus; + policy_association_local_var->as_time_dis_param = as_time_dis_param; return policy_association_local_var; } @@ -65,6 +77,13 @@ void OpenAPI_policy_association_free(OpenAPI_policy_association_t *policy_associ OpenAPI_ambr_free(policy_association->ue_ambr); policy_association->ue_ambr = NULL; } + if (policy_association->ue_slice_mbrs) { + OpenAPI_list_for_each(policy_association->ue_slice_mbrs, node) { + OpenAPI_ue_slice_mbr_free(node->data); + } + OpenAPI_list_free(policy_association->ue_slice_mbrs); + policy_association->ue_slice_mbrs = NULL; + } if (policy_association->pras) { OpenAPI_list_for_each(policy_association->pras, node) { OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*)node->data; @@ -79,6 +98,21 @@ void OpenAPI_policy_association_free(OpenAPI_policy_association_t *policy_associ ogs_free(policy_association->supp_feat); policy_association->supp_feat = NULL; } + if (policy_association->pcf_ue_info) { + OpenAPI_pcf_ue_callback_info_free(policy_association->pcf_ue_info); + policy_association->pcf_ue_info = NULL; + } + if (policy_association->match_pdus) { + OpenAPI_list_for_each(policy_association->match_pdus, node) { + OpenAPI_pdu_session_info_free(node->data); + } + OpenAPI_list_free(policy_association->match_pdus); + policy_association->match_pdus = NULL; + } + if (policy_association->as_time_dis_param) { + OpenAPI_as_time_distribution_param_free(policy_association->as_time_dis_param); + policy_association->as_time_dis_param = NULL; + } ogs_free(policy_association); } @@ -153,6 +187,13 @@ cJSON *OpenAPI_policy_association_convertToJSON(OpenAPI_policy_association_t *po } } + if (policy_association->is_target_rfsp) { + if (cJSON_AddNumberToObject(item, "targetRfsp", policy_association->target_rfsp) == NULL) { + ogs_error("OpenAPI_policy_association_convertToJSON() failed [target_rfsp]"); + goto end; + } + } + if (policy_association->smf_sel_info) { cJSON *smf_sel_info_local_JSON = OpenAPI_smf_selection_data_convertToJSON(policy_association->smf_sel_info); if (smf_sel_info_local_JSON == NULL) { @@ -179,6 +220,22 @@ cJSON *OpenAPI_policy_association_convertToJSON(OpenAPI_policy_association_t *po } } + if (policy_association->ue_slice_mbrs) { + cJSON *ue_slice_mbrsList = cJSON_AddArrayToObject(item, "ueSliceMbrs"); + if (ue_slice_mbrsList == NULL) { + ogs_error("OpenAPI_policy_association_convertToJSON() failed [ue_slice_mbrs]"); + goto end; + } + OpenAPI_list_for_each(policy_association->ue_slice_mbrs, node) { + cJSON *itemLocal = OpenAPI_ue_slice_mbr_convertToJSON(node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_policy_association_convertToJSON() failed [ue_slice_mbrs]"); + goto end; + } + cJSON_AddItemToArray(ue_slice_mbrsList, itemLocal); + } + } + if (policy_association->pras) { cJSON *pras = cJSON_AddObjectToObject(item, "pras"); if (pras == NULL) { @@ -210,6 +267,48 @@ cJSON *OpenAPI_policy_association_convertToJSON(OpenAPI_policy_association_t *po goto end; } + if (policy_association->pcf_ue_info) { + cJSON *pcf_ue_info_local_JSON = OpenAPI_pcf_ue_callback_info_convertToJSON(policy_association->pcf_ue_info); + if (pcf_ue_info_local_JSON == NULL) { + ogs_error("OpenAPI_policy_association_convertToJSON() failed [pcf_ue_info]"); + goto end; + } + cJSON_AddItemToObject(item, "pcfUeInfo", pcf_ue_info_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_policy_association_convertToJSON() failed [pcf_ue_info]"); + goto end; + } + } + + if (policy_association->match_pdus) { + cJSON *match_pdusList = cJSON_AddArrayToObject(item, "matchPdus"); + if (match_pdusList == NULL) { + ogs_error("OpenAPI_policy_association_convertToJSON() failed [match_pdus]"); + goto end; + } + OpenAPI_list_for_each(policy_association->match_pdus, node) { + cJSON *itemLocal = OpenAPI_pdu_session_info_convertToJSON(node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_policy_association_convertToJSON() failed [match_pdus]"); + goto end; + } + cJSON_AddItemToArray(match_pdusList, itemLocal); + } + } + + if (policy_association->as_time_dis_param) { + cJSON *as_time_dis_param_local_JSON = OpenAPI_as_time_distribution_param_convertToJSON(policy_association->as_time_dis_param); + if (as_time_dis_param_local_JSON == NULL) { + ogs_error("OpenAPI_policy_association_convertToJSON() failed [as_time_dis_param]"); + goto end; + } + cJSON_AddItemToObject(item, "asTimeDisParam", as_time_dis_param_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_policy_association_convertToJSON() failed [as_time_dis_param]"); + goto end; + } + } + end: return item; } @@ -227,13 +326,22 @@ OpenAPI_policy_association_t *OpenAPI_policy_association_parseFromJSON(cJSON *po cJSON *wl_serv_area_res = NULL; OpenAPI_wireline_service_area_restriction_t *wl_serv_area_res_local_nonprim = NULL; cJSON *rfsp = NULL; + cJSON *target_rfsp = NULL; cJSON *smf_sel_info = NULL; OpenAPI_smf_selection_data_t *smf_sel_info_local_nonprim = NULL; cJSON *ue_ambr = NULL; OpenAPI_ambr_t *ue_ambr_local_nonprim = NULL; + cJSON *ue_slice_mbrs = NULL; + OpenAPI_list_t *ue_slice_mbrsList = NULL; cJSON *pras = NULL; OpenAPI_list_t *prasList = NULL; cJSON *supp_feat = NULL; + cJSON *pcf_ue_info = NULL; + OpenAPI_pcf_ue_callback_info_t *pcf_ue_info_local_nonprim = NULL; + cJSON *match_pdus = NULL; + OpenAPI_list_t *match_pdusList = NULL; + cJSON *as_time_dis_param = NULL; + OpenAPI_as_time_distribution_param_t *as_time_dis_param_local_nonprim = NULL; request = cJSON_GetObjectItemCaseSensitive(policy_associationJSON, "request"); if (request) { request_local_nonprim = OpenAPI_policy_association_request_parseFromJSON(request); @@ -276,6 +384,14 @@ OpenAPI_policy_association_t *OpenAPI_policy_association_parseFromJSON(cJSON *po } } + target_rfsp = cJSON_GetObjectItemCaseSensitive(policy_associationJSON, "targetRfsp"); + if (target_rfsp) { + if (!cJSON_IsNumber(target_rfsp)) { + ogs_error("OpenAPI_policy_association_parseFromJSON() failed [target_rfsp]"); + goto end; + } + } + smf_sel_info = cJSON_GetObjectItemCaseSensitive(policy_associationJSON, "smfSelInfo"); if (smf_sel_info) { smf_sel_info_local_nonprim = OpenAPI_smf_selection_data_parseFromJSON(smf_sel_info); @@ -286,6 +402,31 @@ OpenAPI_policy_association_t *OpenAPI_policy_association_parseFromJSON(cJSON *po ue_ambr_local_nonprim = OpenAPI_ambr_parseFromJSON(ue_ambr); } + ue_slice_mbrs = cJSON_GetObjectItemCaseSensitive(policy_associationJSON, "ueSliceMbrs"); + if (ue_slice_mbrs) { + cJSON *ue_slice_mbrs_local = NULL; + if (!cJSON_IsArray(ue_slice_mbrs)) { + ogs_error("OpenAPI_policy_association_parseFromJSON() failed [ue_slice_mbrs]"); + goto end; + } + + ue_slice_mbrsList = OpenAPI_list_create(); + + cJSON_ArrayForEach(ue_slice_mbrs_local, ue_slice_mbrs) { + if (!cJSON_IsObject(ue_slice_mbrs_local)) { + ogs_error("OpenAPI_policy_association_parseFromJSON() failed [ue_slice_mbrs]"); + goto end; + } + OpenAPI_ue_slice_mbr_t *ue_slice_mbrsItem = OpenAPI_ue_slice_mbr_parseFromJSON(ue_slice_mbrs_local); + if (!ue_slice_mbrsItem) { + ogs_error("No ue_slice_mbrsItem"); + OpenAPI_list_free(ue_slice_mbrsList); + goto end; + } + OpenAPI_list_add(ue_slice_mbrsList, ue_slice_mbrsItem); + } + } + pras = cJSON_GetObjectItemCaseSensitive(policy_associationJSON, "pras"); if (pras) { cJSON *pras_local_map = NULL; @@ -322,6 +463,41 @@ OpenAPI_policy_association_t *OpenAPI_policy_association_parseFromJSON(cJSON *po goto end; } + pcf_ue_info = cJSON_GetObjectItemCaseSensitive(policy_associationJSON, "pcfUeInfo"); + if (pcf_ue_info) { + pcf_ue_info_local_nonprim = OpenAPI_pcf_ue_callback_info_parseFromJSON(pcf_ue_info); + } + + match_pdus = cJSON_GetObjectItemCaseSensitive(policy_associationJSON, "matchPdus"); + if (match_pdus) { + cJSON *match_pdus_local = NULL; + if (!cJSON_IsArray(match_pdus)) { + ogs_error("OpenAPI_policy_association_parseFromJSON() failed [match_pdus]"); + goto end; + } + + match_pdusList = OpenAPI_list_create(); + + cJSON_ArrayForEach(match_pdus_local, match_pdus) { + if (!cJSON_IsObject(match_pdus_local)) { + ogs_error("OpenAPI_policy_association_parseFromJSON() failed [match_pdus]"); + goto end; + } + OpenAPI_pdu_session_info_t *match_pdusItem = OpenAPI_pdu_session_info_parseFromJSON(match_pdus_local); + if (!match_pdusItem) { + ogs_error("No match_pdusItem"); + OpenAPI_list_free(match_pdusList); + goto end; + } + OpenAPI_list_add(match_pdusList, match_pdusItem); + } + } + + as_time_dis_param = cJSON_GetObjectItemCaseSensitive(policy_associationJSON, "asTimeDisParam"); + if (as_time_dis_param) { + as_time_dis_param_local_nonprim = OpenAPI_as_time_distribution_param_parseFromJSON(as_time_dis_param); + } + policy_association_local_var = OpenAPI_policy_association_create ( request ? request_local_nonprim : NULL, triggers ? triggersList : NULL, @@ -329,10 +505,16 @@ OpenAPI_policy_association_t *OpenAPI_policy_association_parseFromJSON(cJSON *po wl_serv_area_res ? wl_serv_area_res_local_nonprim : NULL, rfsp ? true : false, rfsp ? rfsp->valuedouble : 0, + target_rfsp ? true : false, + target_rfsp ? target_rfsp->valuedouble : 0, smf_sel_info ? smf_sel_info_local_nonprim : NULL, ue_ambr ? ue_ambr_local_nonprim : NULL, + ue_slice_mbrs ? ue_slice_mbrsList : NULL, pras ? prasList : NULL, - ogs_strdup(supp_feat->valuestring) + ogs_strdup(supp_feat->valuestring), + pcf_ue_info ? pcf_ue_info_local_nonprim : NULL, + match_pdus ? match_pdusList : NULL, + as_time_dis_param ? as_time_dis_param_local_nonprim : NULL ); return policy_association_local_var; @@ -361,6 +543,13 @@ end: OpenAPI_ambr_free(ue_ambr_local_nonprim); ue_ambr_local_nonprim = NULL; } + if (ue_slice_mbrsList) { + OpenAPI_list_for_each(ue_slice_mbrsList, node) { + OpenAPI_ue_slice_mbr_free(node->data); + } + OpenAPI_list_free(ue_slice_mbrsList); + ue_slice_mbrsList = NULL; + } if (prasList) { OpenAPI_list_for_each(prasList, node) { OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*) node->data; @@ -371,6 +560,21 @@ end: OpenAPI_list_free(prasList); prasList = NULL; } + if (pcf_ue_info_local_nonprim) { + OpenAPI_pcf_ue_callback_info_free(pcf_ue_info_local_nonprim); + pcf_ue_info_local_nonprim = NULL; + } + if (match_pdusList) { + OpenAPI_list_for_each(match_pdusList, node) { + OpenAPI_pdu_session_info_free(node->data); + } + OpenAPI_list_free(match_pdusList); + match_pdusList = NULL; + } + if (as_time_dis_param_local_nonprim) { + OpenAPI_as_time_distribution_param_free(as_time_dis_param_local_nonprim); + as_time_dis_param_local_nonprim = NULL; + } return NULL; } diff --git a/lib/sbi/openapi/model/policy_association.h b/lib/sbi/openapi/model/policy_association.h index 4eddc3b49..8d33970e1 100644 --- a/lib/sbi/openapi/model/policy_association.h +++ b/lib/sbi/openapi/model/policy_association.h @@ -1,7 +1,7 @@ /* * policy_association.h * - * + * Represents an individual AM Policy Association resource. */ #ifndef _OpenAPI_policy_association_H_ @@ -13,11 +13,15 @@ #include "../include/keyValuePair.h" #include "../include/binary.h" #include "ambr.h" +#include "as_time_distribution_param.h" +#include "pcf_ue_callback_info.h" +#include "pdu_session_info.h" #include "policy_association_request.h" #include "presence_info.h" #include "request_trigger.h" #include "service_area_restriction.h" #include "smf_selection_data.h" +#include "ue_slice_mbr.h" #include "wireline_service_area_restriction.h" #ifdef __cplusplus @@ -32,10 +36,16 @@ typedef struct OpenAPI_policy_association_s { struct OpenAPI_wireline_service_area_restriction_s *wl_serv_area_res; bool is_rfsp; int rfsp; + bool is_target_rfsp; + int target_rfsp; struct OpenAPI_smf_selection_data_s *smf_sel_info; struct OpenAPI_ambr_s *ue_ambr; + OpenAPI_list_t *ue_slice_mbrs; OpenAPI_list_t* pras; char *supp_feat; + struct OpenAPI_pcf_ue_callback_info_s *pcf_ue_info; + OpenAPI_list_t *match_pdus; + struct OpenAPI_as_time_distribution_param_s *as_time_dis_param; } OpenAPI_policy_association_t; OpenAPI_policy_association_t *OpenAPI_policy_association_create( @@ -45,10 +55,16 @@ OpenAPI_policy_association_t *OpenAPI_policy_association_create( OpenAPI_wireline_service_area_restriction_t *wl_serv_area_res, bool is_rfsp, int rfsp, + bool is_target_rfsp, + int target_rfsp, OpenAPI_smf_selection_data_t *smf_sel_info, OpenAPI_ambr_t *ue_ambr, + OpenAPI_list_t *ue_slice_mbrs, OpenAPI_list_t* pras, - char *supp_feat + char *supp_feat, + OpenAPI_pcf_ue_callback_info_t *pcf_ue_info, + OpenAPI_list_t *match_pdus, + OpenAPI_as_time_distribution_param_t *as_time_dis_param ); void OpenAPI_policy_association_free(OpenAPI_policy_association_t *policy_association); OpenAPI_policy_association_t *OpenAPI_policy_association_parseFromJSON(cJSON *policy_associationJSON); diff --git a/lib/sbi/openapi/model/policy_association_request.c b/lib/sbi/openapi/model/policy_association_request.c index 4eec4af6d..588408d81 100644 --- a/lib/sbi/openapi/model/policy_association_request.c +++ b/lib/sbi/openapi/model/policy_association_request.c @@ -25,12 +25,15 @@ OpenAPI_policy_association_request_t *OpenAPI_policy_association_request_create( bool is_rfsp, int rfsp, OpenAPI_ambr_t *ue_ambr, + OpenAPI_list_t *ue_slice_mbrs, OpenAPI_list_t *allowed_snssais, + OpenAPI_list_t *target_snssais, OpenAPI_list_t *mapping_snssais, OpenAPI_list_t *n3g_allowed_snssais, OpenAPI_guami_t *guami, char *service_name, OpenAPI_trace_data_t *trace_req, + OpenAPI_list_t *nwdaf_datas, char *supp_feat ) { @@ -57,12 +60,15 @@ OpenAPI_policy_association_request_t *OpenAPI_policy_association_request_create( policy_association_request_local_var->is_rfsp = is_rfsp; policy_association_request_local_var->rfsp = rfsp; policy_association_request_local_var->ue_ambr = ue_ambr; + policy_association_request_local_var->ue_slice_mbrs = ue_slice_mbrs; policy_association_request_local_var->allowed_snssais = allowed_snssais; + policy_association_request_local_var->target_snssais = target_snssais; policy_association_request_local_var->mapping_snssais = mapping_snssais; policy_association_request_local_var->n3g_allowed_snssais = n3g_allowed_snssais; policy_association_request_local_var->guami = guami; policy_association_request_local_var->service_name = service_name; policy_association_request_local_var->trace_req = trace_req; + policy_association_request_local_var->nwdaf_datas = nwdaf_datas; policy_association_request_local_var->supp_feat = supp_feat; return policy_association_request_local_var; @@ -151,6 +157,13 @@ void OpenAPI_policy_association_request_free(OpenAPI_policy_association_request_ OpenAPI_ambr_free(policy_association_request->ue_ambr); policy_association_request->ue_ambr = NULL; } + if (policy_association_request->ue_slice_mbrs) { + OpenAPI_list_for_each(policy_association_request->ue_slice_mbrs, node) { + OpenAPI_ue_slice_mbr_free(node->data); + } + OpenAPI_list_free(policy_association_request->ue_slice_mbrs); + policy_association_request->ue_slice_mbrs = NULL; + } if (policy_association_request->allowed_snssais) { OpenAPI_list_for_each(policy_association_request->allowed_snssais, node) { OpenAPI_snssai_free(node->data); @@ -158,6 +171,13 @@ void OpenAPI_policy_association_request_free(OpenAPI_policy_association_request_ OpenAPI_list_free(policy_association_request->allowed_snssais); policy_association_request->allowed_snssais = NULL; } + if (policy_association_request->target_snssais) { + OpenAPI_list_for_each(policy_association_request->target_snssais, node) { + OpenAPI_snssai_free(node->data); + } + OpenAPI_list_free(policy_association_request->target_snssais); + policy_association_request->target_snssais = NULL; + } if (policy_association_request->mapping_snssais) { OpenAPI_list_for_each(policy_association_request->mapping_snssais, node) { OpenAPI_mapping_of_snssai_free(node->data); @@ -184,6 +204,13 @@ void OpenAPI_policy_association_request_free(OpenAPI_policy_association_request_ OpenAPI_trace_data_free(policy_association_request->trace_req); policy_association_request->trace_req = NULL; } + if (policy_association_request->nwdaf_datas) { + OpenAPI_list_for_each(policy_association_request->nwdaf_datas, node) { + OpenAPI_nwdaf_data_free(node->data); + } + OpenAPI_list_free(policy_association_request->nwdaf_datas); + policy_association_request->nwdaf_datas = NULL; + } if (policy_association_request->supp_feat) { ogs_free(policy_association_request->supp_feat); policy_association_request->supp_feat = NULL; @@ -411,6 +438,22 @@ cJSON *OpenAPI_policy_association_request_convertToJSON(OpenAPI_policy_associati } } + if (policy_association_request->ue_slice_mbrs) { + cJSON *ue_slice_mbrsList = cJSON_AddArrayToObject(item, "ueSliceMbrs"); + if (ue_slice_mbrsList == NULL) { + ogs_error("OpenAPI_policy_association_request_convertToJSON() failed [ue_slice_mbrs]"); + goto end; + } + OpenAPI_list_for_each(policy_association_request->ue_slice_mbrs, node) { + cJSON *itemLocal = OpenAPI_ue_slice_mbr_convertToJSON(node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_policy_association_request_convertToJSON() failed [ue_slice_mbrs]"); + goto end; + } + cJSON_AddItemToArray(ue_slice_mbrsList, itemLocal); + } + } + if (policy_association_request->allowed_snssais) { cJSON *allowed_snssaisList = cJSON_AddArrayToObject(item, "allowedSnssais"); if (allowed_snssaisList == NULL) { @@ -427,6 +470,22 @@ cJSON *OpenAPI_policy_association_request_convertToJSON(OpenAPI_policy_associati } } + if (policy_association_request->target_snssais) { + cJSON *target_snssaisList = cJSON_AddArrayToObject(item, "targetSnssais"); + if (target_snssaisList == NULL) { + ogs_error("OpenAPI_policy_association_request_convertToJSON() failed [target_snssais]"); + goto end; + } + OpenAPI_list_for_each(policy_association_request->target_snssais, node) { + cJSON *itemLocal = OpenAPI_snssai_convertToJSON(node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_policy_association_request_convertToJSON() failed [target_snssais]"); + goto end; + } + cJSON_AddItemToArray(target_snssaisList, itemLocal); + } + } + if (policy_association_request->mapping_snssais) { cJSON *mapping_snssaisList = cJSON_AddArrayToObject(item, "mappingSnssais"); if (mapping_snssaisList == NULL) { @@ -492,6 +551,22 @@ cJSON *OpenAPI_policy_association_request_convertToJSON(OpenAPI_policy_associati } } + if (policy_association_request->nwdaf_datas) { + cJSON *nwdaf_datasList = cJSON_AddArrayToObject(item, "nwdafDatas"); + if (nwdaf_datasList == NULL) { + ogs_error("OpenAPI_policy_association_request_convertToJSON() failed [nwdaf_datas]"); + goto end; + } + OpenAPI_list_for_each(policy_association_request->nwdaf_datas, node) { + cJSON *itemLocal = OpenAPI_nwdaf_data_convertToJSON(node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_policy_association_request_convertToJSON() failed [nwdaf_datas]"); + goto end; + } + cJSON_AddItemToArray(nwdaf_datasList, itemLocal); + } + } + if (!policy_association_request->supp_feat) { ogs_error("OpenAPI_policy_association_request_convertToJSON() failed [supp_feat]"); return NULL; @@ -541,8 +616,12 @@ OpenAPI_policy_association_request_t *OpenAPI_policy_association_request_parseFr cJSON *rfsp = NULL; cJSON *ue_ambr = NULL; OpenAPI_ambr_t *ue_ambr_local_nonprim = NULL; + cJSON *ue_slice_mbrs = NULL; + OpenAPI_list_t *ue_slice_mbrsList = NULL; cJSON *allowed_snssais = NULL; OpenAPI_list_t *allowed_snssaisList = NULL; + cJSON *target_snssais = NULL; + OpenAPI_list_t *target_snssaisList = NULL; cJSON *mapping_snssais = NULL; OpenAPI_list_t *mapping_snssaisList = NULL; cJSON *n3g_allowed_snssais = NULL; @@ -552,6 +631,8 @@ OpenAPI_policy_association_request_t *OpenAPI_policy_association_request_parseFr cJSON *service_name = NULL; cJSON *trace_req = NULL; OpenAPI_trace_data_t *trace_req_local_nonprim = NULL; + cJSON *nwdaf_datas = NULL; + OpenAPI_list_t *nwdaf_datasList = NULL; cJSON *supp_feat = NULL; notification_uri = cJSON_GetObjectItemCaseSensitive(policy_association_requestJSON, "notificationUri"); if (!notification_uri) { @@ -770,6 +851,31 @@ OpenAPI_policy_association_request_t *OpenAPI_policy_association_request_parseFr ue_ambr_local_nonprim = OpenAPI_ambr_parseFromJSON(ue_ambr); } + ue_slice_mbrs = cJSON_GetObjectItemCaseSensitive(policy_association_requestJSON, "ueSliceMbrs"); + if (ue_slice_mbrs) { + cJSON *ue_slice_mbrs_local = NULL; + if (!cJSON_IsArray(ue_slice_mbrs)) { + ogs_error("OpenAPI_policy_association_request_parseFromJSON() failed [ue_slice_mbrs]"); + goto end; + } + + ue_slice_mbrsList = OpenAPI_list_create(); + + cJSON_ArrayForEach(ue_slice_mbrs_local, ue_slice_mbrs) { + if (!cJSON_IsObject(ue_slice_mbrs_local)) { + ogs_error("OpenAPI_policy_association_request_parseFromJSON() failed [ue_slice_mbrs]"); + goto end; + } + OpenAPI_ue_slice_mbr_t *ue_slice_mbrsItem = OpenAPI_ue_slice_mbr_parseFromJSON(ue_slice_mbrs_local); + if (!ue_slice_mbrsItem) { + ogs_error("No ue_slice_mbrsItem"); + OpenAPI_list_free(ue_slice_mbrsList); + goto end; + } + OpenAPI_list_add(ue_slice_mbrsList, ue_slice_mbrsItem); + } + } + allowed_snssais = cJSON_GetObjectItemCaseSensitive(policy_association_requestJSON, "allowedSnssais"); if (allowed_snssais) { cJSON *allowed_snssais_local = NULL; @@ -795,6 +901,31 @@ OpenAPI_policy_association_request_t *OpenAPI_policy_association_request_parseFr } } + target_snssais = cJSON_GetObjectItemCaseSensitive(policy_association_requestJSON, "targetSnssais"); + if (target_snssais) { + cJSON *target_snssais_local = NULL; + if (!cJSON_IsArray(target_snssais)) { + ogs_error("OpenAPI_policy_association_request_parseFromJSON() failed [target_snssais]"); + goto end; + } + + target_snssaisList = OpenAPI_list_create(); + + cJSON_ArrayForEach(target_snssais_local, target_snssais) { + if (!cJSON_IsObject(target_snssais_local)) { + ogs_error("OpenAPI_policy_association_request_parseFromJSON() failed [target_snssais]"); + goto end; + } + OpenAPI_snssai_t *target_snssaisItem = OpenAPI_snssai_parseFromJSON(target_snssais_local); + if (!target_snssaisItem) { + ogs_error("No target_snssaisItem"); + OpenAPI_list_free(target_snssaisList); + goto end; + } + OpenAPI_list_add(target_snssaisList, target_snssaisItem); + } + } + mapping_snssais = cJSON_GetObjectItemCaseSensitive(policy_association_requestJSON, "mappingSnssais"); if (mapping_snssais) { cJSON *mapping_snssais_local = NULL; @@ -863,6 +994,31 @@ OpenAPI_policy_association_request_t *OpenAPI_policy_association_request_parseFr trace_req_local_nonprim = OpenAPI_trace_data_parseFromJSON(trace_req); } + nwdaf_datas = cJSON_GetObjectItemCaseSensitive(policy_association_requestJSON, "nwdafDatas"); + if (nwdaf_datas) { + cJSON *nwdaf_datas_local = NULL; + if (!cJSON_IsArray(nwdaf_datas)) { + ogs_error("OpenAPI_policy_association_request_parseFromJSON() failed [nwdaf_datas]"); + goto end; + } + + nwdaf_datasList = OpenAPI_list_create(); + + cJSON_ArrayForEach(nwdaf_datas_local, nwdaf_datas) { + if (!cJSON_IsObject(nwdaf_datas_local)) { + ogs_error("OpenAPI_policy_association_request_parseFromJSON() failed [nwdaf_datas]"); + goto end; + } + OpenAPI_nwdaf_data_t *nwdaf_datasItem = OpenAPI_nwdaf_data_parseFromJSON(nwdaf_datas_local); + if (!nwdaf_datasItem) { + ogs_error("No nwdaf_datasItem"); + OpenAPI_list_free(nwdaf_datasList); + goto end; + } + OpenAPI_list_add(nwdaf_datasList, nwdaf_datasItem); + } + } + supp_feat = cJSON_GetObjectItemCaseSensitive(policy_association_requestJSON, "suppFeat"); if (!supp_feat) { ogs_error("OpenAPI_policy_association_request_parseFromJSON() failed [supp_feat]"); @@ -894,12 +1050,15 @@ OpenAPI_policy_association_request_t *OpenAPI_policy_association_request_parseFr rfsp ? true : false, rfsp ? rfsp->valuedouble : 0, ue_ambr ? ue_ambr_local_nonprim : NULL, + ue_slice_mbrs ? ue_slice_mbrsList : NULL, allowed_snssais ? allowed_snssaisList : NULL, + target_snssais ? target_snssaisList : NULL, mapping_snssais ? mapping_snssaisList : NULL, n3g_allowed_snssais ? n3g_allowed_snssaisList : NULL, guami ? guami_local_nonprim : NULL, service_name && !cJSON_IsNull(service_name) ? ogs_strdup(service_name->valuestring) : NULL, trace_req ? trace_req_local_nonprim : NULL, + nwdaf_datas ? nwdaf_datasList : NULL, ogs_strdup(supp_feat->valuestring) ); @@ -961,6 +1120,13 @@ end: OpenAPI_ambr_free(ue_ambr_local_nonprim); ue_ambr_local_nonprim = NULL; } + if (ue_slice_mbrsList) { + OpenAPI_list_for_each(ue_slice_mbrsList, node) { + OpenAPI_ue_slice_mbr_free(node->data); + } + OpenAPI_list_free(ue_slice_mbrsList); + ue_slice_mbrsList = NULL; + } if (allowed_snssaisList) { OpenAPI_list_for_each(allowed_snssaisList, node) { OpenAPI_snssai_free(node->data); @@ -968,6 +1134,13 @@ end: OpenAPI_list_free(allowed_snssaisList); allowed_snssaisList = NULL; } + if (target_snssaisList) { + OpenAPI_list_for_each(target_snssaisList, node) { + OpenAPI_snssai_free(node->data); + } + OpenAPI_list_free(target_snssaisList); + target_snssaisList = NULL; + } if (mapping_snssaisList) { OpenAPI_list_for_each(mapping_snssaisList, node) { OpenAPI_mapping_of_snssai_free(node->data); @@ -990,6 +1163,13 @@ end: OpenAPI_trace_data_free(trace_req_local_nonprim); trace_req_local_nonprim = NULL; } + if (nwdaf_datasList) { + OpenAPI_list_for_each(nwdaf_datasList, node) { + OpenAPI_nwdaf_data_free(node->data); + } + OpenAPI_list_free(nwdaf_datasList); + nwdaf_datasList = NULL; + } return NULL; } diff --git a/lib/sbi/openapi/model/policy_association_request.h b/lib/sbi/openapi/model/policy_association_request.h index ed812e314..a331e4f12 100644 --- a/lib/sbi/openapi/model/policy_association_request.h +++ b/lib/sbi/openapi/model/policy_association_request.h @@ -1,7 +1,7 @@ /* * policy_association_request.h * - * Information which the NF service consumer provides when requesting the creation of a policy association. The serviveName property corresponds to the serviceName in the main body of the specification. + * Information which the NF service consumer provides when requesting the creation of a policy association. The serviveName property corresponds to the serviceName in the main body of the specification. */ #ifndef _OpenAPI_policy_association_request_H_ @@ -16,11 +16,13 @@ #include "ambr.h" #include "guami.h" #include "mapping_of_snssai.h" +#include "nwdaf_data.h" #include "plmn_id_nid.h" #include "rat_type.h" #include "service_area_restriction.h" #include "snssai.h" #include "trace_data.h" +#include "ue_slice_mbr.h" #include "user_location.h" #include "wireline_service_area_restriction.h" @@ -50,12 +52,15 @@ typedef struct OpenAPI_policy_association_request_s { bool is_rfsp; int rfsp; struct OpenAPI_ambr_s *ue_ambr; + OpenAPI_list_t *ue_slice_mbrs; OpenAPI_list_t *allowed_snssais; + OpenAPI_list_t *target_snssais; OpenAPI_list_t *mapping_snssais; OpenAPI_list_t *n3g_allowed_snssais; struct OpenAPI_guami_s *guami; char *service_name; struct OpenAPI_trace_data_s *trace_req; + OpenAPI_list_t *nwdaf_datas; char *supp_feat; } OpenAPI_policy_association_request_t; @@ -80,12 +85,15 @@ OpenAPI_policy_association_request_t *OpenAPI_policy_association_request_create( bool is_rfsp, int rfsp, OpenAPI_ambr_t *ue_ambr, + OpenAPI_list_t *ue_slice_mbrs, OpenAPI_list_t *allowed_snssais, + OpenAPI_list_t *target_snssais, OpenAPI_list_t *mapping_snssais, OpenAPI_list_t *n3g_allowed_snssais, OpenAPI_guami_t *guami, char *service_name, OpenAPI_trace_data_t *trace_req, + OpenAPI_list_t *nwdaf_datas, char *supp_feat ); void OpenAPI_policy_association_request_free(OpenAPI_policy_association_request_t *policy_association_request); diff --git a/lib/sbi/openapi/model/policy_association_update_request.c b/lib/sbi/openapi/model/policy_association_update_request.c index f3ff789c4..19ae9cde0 100644 --- a/lib/sbi/openapi/model/policy_association_update_request.c +++ b/lib/sbi/openapi/model/policy_association_update_request.c @@ -16,15 +16,18 @@ OpenAPI_policy_association_update_request_t *OpenAPI_policy_association_update_r int rfsp, OpenAPI_smf_selection_data_t *smf_sel_info, OpenAPI_ambr_t *ue_ambr, + OpenAPI_list_t *ue_slice_mbrs, OpenAPI_list_t* pra_statuses, OpenAPI_user_location_t *user_loc, OpenAPI_list_t *allowed_snssais, + OpenAPI_list_t *target_snssais, OpenAPI_list_t *mapping_snssais, OpenAPI_list_t *access_types, OpenAPI_list_t *rat_types, OpenAPI_list_t *n3g_allowed_snssais, OpenAPI_trace_data_t *trace_req, - OpenAPI_guami_t *guami + OpenAPI_guami_t *guami, + OpenAPI_list_t *nwdaf_datas ) { OpenAPI_policy_association_update_request_t *policy_association_update_request_local_var = ogs_malloc(sizeof(OpenAPI_policy_association_update_request_t)); @@ -41,15 +44,18 @@ OpenAPI_policy_association_update_request_t *OpenAPI_policy_association_update_r policy_association_update_request_local_var->rfsp = rfsp; policy_association_update_request_local_var->smf_sel_info = smf_sel_info; policy_association_update_request_local_var->ue_ambr = ue_ambr; + policy_association_update_request_local_var->ue_slice_mbrs = ue_slice_mbrs; policy_association_update_request_local_var->pra_statuses = pra_statuses; policy_association_update_request_local_var->user_loc = user_loc; policy_association_update_request_local_var->allowed_snssais = allowed_snssais; + policy_association_update_request_local_var->target_snssais = target_snssais; policy_association_update_request_local_var->mapping_snssais = mapping_snssais; policy_association_update_request_local_var->access_types = access_types; policy_association_update_request_local_var->rat_types = rat_types; policy_association_update_request_local_var->n3g_allowed_snssais = n3g_allowed_snssais; policy_association_update_request_local_var->trace_req = trace_req; policy_association_update_request_local_var->guami = guami; + policy_association_update_request_local_var->nwdaf_datas = nwdaf_datas; return policy_association_update_request_local_var; } @@ -106,6 +112,13 @@ void OpenAPI_policy_association_update_request_free(OpenAPI_policy_association_u OpenAPI_ambr_free(policy_association_update_request->ue_ambr); policy_association_update_request->ue_ambr = NULL; } + if (policy_association_update_request->ue_slice_mbrs) { + OpenAPI_list_for_each(policy_association_update_request->ue_slice_mbrs, node) { + OpenAPI_ue_slice_mbr_free(node->data); + } + OpenAPI_list_free(policy_association_update_request->ue_slice_mbrs); + policy_association_update_request->ue_slice_mbrs = NULL; + } if (policy_association_update_request->pra_statuses) { OpenAPI_list_for_each(policy_association_update_request->pra_statuses, node) { OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*)node->data; @@ -127,6 +140,13 @@ void OpenAPI_policy_association_update_request_free(OpenAPI_policy_association_u OpenAPI_list_free(policy_association_update_request->allowed_snssais); policy_association_update_request->allowed_snssais = NULL; } + if (policy_association_update_request->target_snssais) { + OpenAPI_list_for_each(policy_association_update_request->target_snssais, node) { + OpenAPI_snssai_free(node->data); + } + OpenAPI_list_free(policy_association_update_request->target_snssais); + policy_association_update_request->target_snssais = NULL; + } if (policy_association_update_request->mapping_snssais) { OpenAPI_list_for_each(policy_association_update_request->mapping_snssais, node) { OpenAPI_mapping_of_snssai_free(node->data); @@ -157,6 +177,13 @@ void OpenAPI_policy_association_update_request_free(OpenAPI_policy_association_u OpenAPI_guami_free(policy_association_update_request->guami); policy_association_update_request->guami = NULL; } + if (policy_association_update_request->nwdaf_datas) { + OpenAPI_list_for_each(policy_association_update_request->nwdaf_datas, node) { + OpenAPI_nwdaf_data_free(node->data); + } + OpenAPI_list_free(policy_association_update_request->nwdaf_datas); + policy_association_update_request->nwdaf_datas = NULL; + } ogs_free(policy_association_update_request); } @@ -293,6 +320,22 @@ cJSON *OpenAPI_policy_association_update_request_convertToJSON(OpenAPI_policy_as } } + if (policy_association_update_request->ue_slice_mbrs) { + cJSON *ue_slice_mbrsList = cJSON_AddArrayToObject(item, "ueSliceMbrs"); + if (ue_slice_mbrsList == NULL) { + ogs_error("OpenAPI_policy_association_update_request_convertToJSON() failed [ue_slice_mbrs]"); + goto end; + } + OpenAPI_list_for_each(policy_association_update_request->ue_slice_mbrs, node) { + cJSON *itemLocal = OpenAPI_ue_slice_mbr_convertToJSON(node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_policy_association_update_request_convertToJSON() failed [ue_slice_mbrs]"); + goto end; + } + cJSON_AddItemToArray(ue_slice_mbrsList, itemLocal); + } + } + if (policy_association_update_request->pra_statuses) { cJSON *pra_statuses = cJSON_AddObjectToObject(item, "praStatuses"); if (pra_statuses == NULL) { @@ -344,6 +387,22 @@ cJSON *OpenAPI_policy_association_update_request_convertToJSON(OpenAPI_policy_as } } + if (policy_association_update_request->target_snssais) { + cJSON *target_snssaisList = cJSON_AddArrayToObject(item, "targetSnssais"); + if (target_snssaisList == NULL) { + ogs_error("OpenAPI_policy_association_update_request_convertToJSON() failed [target_snssais]"); + goto end; + } + OpenAPI_list_for_each(policy_association_update_request->target_snssais, node) { + cJSON *itemLocal = OpenAPI_snssai_convertToJSON(node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_policy_association_update_request_convertToJSON() failed [target_snssais]"); + goto end; + } + cJSON_AddItemToArray(target_snssaisList, itemLocal); + } + } + if (policy_association_update_request->mapping_snssais) { cJSON *mapping_snssaisList = cJSON_AddArrayToObject(item, "mappingSnssais"); if (mapping_snssaisList == NULL) { @@ -430,6 +489,22 @@ cJSON *OpenAPI_policy_association_update_request_convertToJSON(OpenAPI_policy_as } } + if (policy_association_update_request->nwdaf_datas) { + cJSON *nwdaf_datasList = cJSON_AddArrayToObject(item, "nwdafDatas"); + if (nwdaf_datasList == NULL) { + ogs_error("OpenAPI_policy_association_update_request_convertToJSON() failed [nwdaf_datas]"); + goto end; + } + OpenAPI_list_for_each(policy_association_update_request->nwdaf_datas, node) { + cJSON *itemLocal = OpenAPI_nwdaf_data_convertToJSON(node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_policy_association_update_request_convertToJSON() failed [nwdaf_datas]"); + goto end; + } + cJSON_AddItemToArray(nwdaf_datasList, itemLocal); + } + } + end: return item; } @@ -456,12 +531,16 @@ OpenAPI_policy_association_update_request_t *OpenAPI_policy_association_update_r OpenAPI_smf_selection_data_t *smf_sel_info_local_nonprim = NULL; cJSON *ue_ambr = NULL; OpenAPI_ambr_t *ue_ambr_local_nonprim = NULL; + cJSON *ue_slice_mbrs = NULL; + OpenAPI_list_t *ue_slice_mbrsList = NULL; cJSON *pra_statuses = NULL; OpenAPI_list_t *pra_statusesList = NULL; cJSON *user_loc = NULL; OpenAPI_user_location_t *user_loc_local_nonprim = NULL; cJSON *allowed_snssais = NULL; OpenAPI_list_t *allowed_snssaisList = NULL; + cJSON *target_snssais = NULL; + OpenAPI_list_t *target_snssaisList = NULL; cJSON *mapping_snssais = NULL; OpenAPI_list_t *mapping_snssaisList = NULL; cJSON *access_types = NULL; @@ -474,6 +553,8 @@ OpenAPI_policy_association_update_request_t *OpenAPI_policy_association_update_r OpenAPI_trace_data_t *trace_req_local_nonprim = NULL; cJSON *guami = NULL; OpenAPI_guami_t *guami_local_nonprim = NULL; + cJSON *nwdaf_datas = NULL; + OpenAPI_list_t *nwdaf_datasList = NULL; notification_uri = cJSON_GetObjectItemCaseSensitive(policy_association_update_requestJSON, "notificationUri"); if (notification_uri) { if (!cJSON_IsString(notification_uri) && !cJSON_IsNull(notification_uri)) { @@ -592,6 +673,31 @@ OpenAPI_policy_association_update_request_t *OpenAPI_policy_association_update_r ue_ambr_local_nonprim = OpenAPI_ambr_parseFromJSON(ue_ambr); } + ue_slice_mbrs = cJSON_GetObjectItemCaseSensitive(policy_association_update_requestJSON, "ueSliceMbrs"); + if (ue_slice_mbrs) { + cJSON *ue_slice_mbrs_local = NULL; + if (!cJSON_IsArray(ue_slice_mbrs)) { + ogs_error("OpenAPI_policy_association_update_request_parseFromJSON() failed [ue_slice_mbrs]"); + goto end; + } + + ue_slice_mbrsList = OpenAPI_list_create(); + + cJSON_ArrayForEach(ue_slice_mbrs_local, ue_slice_mbrs) { + if (!cJSON_IsObject(ue_slice_mbrs_local)) { + ogs_error("OpenAPI_policy_association_update_request_parseFromJSON() failed [ue_slice_mbrs]"); + goto end; + } + OpenAPI_ue_slice_mbr_t *ue_slice_mbrsItem = OpenAPI_ue_slice_mbr_parseFromJSON(ue_slice_mbrs_local); + if (!ue_slice_mbrsItem) { + ogs_error("No ue_slice_mbrsItem"); + OpenAPI_list_free(ue_slice_mbrsList); + goto end; + } + OpenAPI_list_add(ue_slice_mbrsList, ue_slice_mbrsItem); + } + } + pra_statuses = cJSON_GetObjectItemCaseSensitive(policy_association_update_requestJSON, "praStatuses"); if (pra_statuses) { cJSON *pra_statuses_local_map = NULL; @@ -648,6 +754,31 @@ OpenAPI_policy_association_update_request_t *OpenAPI_policy_association_update_r } } + target_snssais = cJSON_GetObjectItemCaseSensitive(policy_association_update_requestJSON, "targetSnssais"); + if (target_snssais) { + cJSON *target_snssais_local = NULL; + if (!cJSON_IsArray(target_snssais)) { + ogs_error("OpenAPI_policy_association_update_request_parseFromJSON() failed [target_snssais]"); + goto end; + } + + target_snssaisList = OpenAPI_list_create(); + + cJSON_ArrayForEach(target_snssais_local, target_snssais) { + if (!cJSON_IsObject(target_snssais_local)) { + ogs_error("OpenAPI_policy_association_update_request_parseFromJSON() failed [target_snssais]"); + goto end; + } + OpenAPI_snssai_t *target_snssaisItem = OpenAPI_snssai_parseFromJSON(target_snssais_local); + if (!target_snssaisItem) { + ogs_error("No target_snssaisItem"); + OpenAPI_list_free(target_snssaisList); + goto end; + } + OpenAPI_list_add(target_snssaisList, target_snssaisItem); + } + } + mapping_snssais = cJSON_GetObjectItemCaseSensitive(policy_association_update_requestJSON, "mappingSnssais"); if (mapping_snssais) { cJSON *mapping_snssais_local = NULL; @@ -746,6 +877,31 @@ OpenAPI_policy_association_update_request_t *OpenAPI_policy_association_update_r guami_local_nonprim = OpenAPI_guami_parseFromJSON(guami); } + nwdaf_datas = cJSON_GetObjectItemCaseSensitive(policy_association_update_requestJSON, "nwdafDatas"); + if (nwdaf_datas) { + cJSON *nwdaf_datas_local = NULL; + if (!cJSON_IsArray(nwdaf_datas)) { + ogs_error("OpenAPI_policy_association_update_request_parseFromJSON() failed [nwdaf_datas]"); + goto end; + } + + nwdaf_datasList = OpenAPI_list_create(); + + cJSON_ArrayForEach(nwdaf_datas_local, nwdaf_datas) { + if (!cJSON_IsObject(nwdaf_datas_local)) { + ogs_error("OpenAPI_policy_association_update_request_parseFromJSON() failed [nwdaf_datas]"); + goto end; + } + OpenAPI_nwdaf_data_t *nwdaf_datasItem = OpenAPI_nwdaf_data_parseFromJSON(nwdaf_datas_local); + if (!nwdaf_datasItem) { + ogs_error("No nwdaf_datasItem"); + OpenAPI_list_free(nwdaf_datasList); + goto end; + } + OpenAPI_list_add(nwdaf_datasList, nwdaf_datasItem); + } + } + policy_association_update_request_local_var = OpenAPI_policy_association_update_request_create ( notification_uri && !cJSON_IsNull(notification_uri) ? ogs_strdup(notification_uri->valuestring) : NULL, alt_notif_ipv4_addrs ? alt_notif_ipv4_addrsList : NULL, @@ -758,15 +914,18 @@ OpenAPI_policy_association_update_request_t *OpenAPI_policy_association_update_r rfsp ? rfsp->valuedouble : 0, smf_sel_info ? smf_sel_info_local_nonprim : NULL, ue_ambr ? ue_ambr_local_nonprim : NULL, + ue_slice_mbrs ? ue_slice_mbrsList : NULL, pra_statuses ? pra_statusesList : NULL, user_loc ? user_loc_local_nonprim : NULL, allowed_snssais ? allowed_snssaisList : NULL, + target_snssais ? target_snssaisList : NULL, mapping_snssais ? mapping_snssaisList : NULL, access_types ? access_typesList : NULL, rat_types ? rat_typesList : NULL, n3g_allowed_snssais ? n3g_allowed_snssaisList : NULL, trace_req ? trace_req_local_nonprim : NULL, - guami ? guami_local_nonprim : NULL + guami ? guami_local_nonprim : NULL, + nwdaf_datas ? nwdaf_datasList : NULL ); return policy_association_update_request_local_var; @@ -812,6 +971,13 @@ end: OpenAPI_ambr_free(ue_ambr_local_nonprim); ue_ambr_local_nonprim = NULL; } + if (ue_slice_mbrsList) { + OpenAPI_list_for_each(ue_slice_mbrsList, node) { + OpenAPI_ue_slice_mbr_free(node->data); + } + OpenAPI_list_free(ue_slice_mbrsList); + ue_slice_mbrsList = NULL; + } if (pra_statusesList) { OpenAPI_list_for_each(pra_statusesList, node) { OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*) node->data; @@ -833,6 +999,13 @@ end: OpenAPI_list_free(allowed_snssaisList); allowed_snssaisList = NULL; } + if (target_snssaisList) { + OpenAPI_list_for_each(target_snssaisList, node) { + OpenAPI_snssai_free(node->data); + } + OpenAPI_list_free(target_snssaisList); + target_snssaisList = NULL; + } if (mapping_snssaisList) { OpenAPI_list_for_each(mapping_snssaisList, node) { OpenAPI_mapping_of_snssai_free(node->data); @@ -863,6 +1036,13 @@ end: OpenAPI_guami_free(guami_local_nonprim); guami_local_nonprim = NULL; } + if (nwdaf_datasList) { + OpenAPI_list_for_each(nwdaf_datasList, node) { + OpenAPI_nwdaf_data_free(node->data); + } + OpenAPI_list_free(nwdaf_datasList); + nwdaf_datasList = NULL; + } return NULL; } diff --git a/lib/sbi/openapi/model/policy_association_update_request.h b/lib/sbi/openapi/model/policy_association_update_request.h index 6398cdf3d..0e5b71305 100644 --- a/lib/sbi/openapi/model/policy_association_update_request.h +++ b/lib/sbi/openapi/model/policy_association_update_request.h @@ -1,7 +1,7 @@ /* * policy_association_update_request.h * - * + * Represents information that the NF service consumer provides when requesting the update of a policy association. */ #ifndef _OpenAPI_policy_association_update_request_H_ @@ -16,6 +16,7 @@ #include "ambr.h" #include "guami.h" #include "mapping_of_snssai.h" +#include "nwdaf_data.h" #include "presence_info.h" #include "rat_type.h" #include "request_trigger.h" @@ -23,6 +24,7 @@ #include "smf_selection_data.h" #include "snssai.h" #include "trace_data.h" +#include "ue_slice_mbr.h" #include "user_location.h" #include "wireline_service_area_restriction.h" @@ -43,15 +45,18 @@ typedef struct OpenAPI_policy_association_update_request_s { int rfsp; struct OpenAPI_smf_selection_data_s *smf_sel_info; struct OpenAPI_ambr_s *ue_ambr; + OpenAPI_list_t *ue_slice_mbrs; OpenAPI_list_t* pra_statuses; struct OpenAPI_user_location_s *user_loc; OpenAPI_list_t *allowed_snssais; + OpenAPI_list_t *target_snssais; OpenAPI_list_t *mapping_snssais; OpenAPI_list_t *access_types; OpenAPI_list_t *rat_types; OpenAPI_list_t *n3g_allowed_snssais; struct OpenAPI_trace_data_s *trace_req; struct OpenAPI_guami_s *guami; + OpenAPI_list_t *nwdaf_datas; } OpenAPI_policy_association_update_request_t; OpenAPI_policy_association_update_request_t *OpenAPI_policy_association_update_request_create( @@ -66,15 +71,18 @@ OpenAPI_policy_association_update_request_t *OpenAPI_policy_association_update_r int rfsp, OpenAPI_smf_selection_data_t *smf_sel_info, OpenAPI_ambr_t *ue_ambr, + OpenAPI_list_t *ue_slice_mbrs, OpenAPI_list_t* pra_statuses, OpenAPI_user_location_t *user_loc, OpenAPI_list_t *allowed_snssais, + OpenAPI_list_t *target_snssais, OpenAPI_list_t *mapping_snssais, OpenAPI_list_t *access_types, OpenAPI_list_t *rat_types, OpenAPI_list_t *n3g_allowed_snssais, OpenAPI_trace_data_t *trace_req, - OpenAPI_guami_t *guami + OpenAPI_guami_t *guami, + OpenAPI_list_t *nwdaf_datas ); void OpenAPI_policy_association_update_request_free(OpenAPI_policy_association_update_request_t *policy_association_update_request); OpenAPI_policy_association_update_request_t *OpenAPI_policy_association_update_request_parseFromJSON(cJSON *policy_association_update_requestJSON); diff --git a/lib/sbi/openapi/model/policy_control_request_trigger.c b/lib/sbi/openapi/model/policy_control_request_trigger.c index 179be1a09..2cd196697 100644 --- a/lib/sbi/openapi/model/policy_control_request_trigger.c +++ b/lib/sbi/openapi/model/policy_control_request_trigger.c @@ -6,7 +6,7 @@ char* OpenAPI_policy_control_request_trigger_ToString(OpenAPI_policy_control_request_trigger_e policy_control_request_trigger) { - const char *policy_control_request_triggerArray[] = { "NULL", "PLMN_CH", "RES_MO_RE", "AC_TY_CH", "UE_IP_CH", "UE_MAC_CH", "AN_CH_COR", "US_RE", "APP_STA", "APP_STO", "AN_INFO", "CM_SES_FAIL", "PS_DA_OFF", "DEF_QOS_CH", "SE_AMBR_CH", "QOS_NOTIF", "NO_CREDIT", "REALLO_OF_CREDIT", "PRA_CH", "SAREA_CH", "SCNN_CH", "RE_TIMEOUT", "RES_RELEASE", "SUCC_RES_ALLO", "RAT_TY_CH", "REF_QOS_IND_CH", "NUM_OF_PACKET_FILTER", "UE_STATUS_RESUME", "UE_TZ_CH", "AUTH_PROF_CH", "QOS_MONITORING", "SCELL_CH", "EPS_FALLBACK", "MA_PDU", "TSN_BRIDGE_INFO", "5G_RG_JOIN", "5G_RG_LEAVE", "DDN_FAILURE", "DDN_DELIVERY_STATUS", "GROUP_ID_LIST_CHG", "DDN_FAILURE_CANCELLATION", "DDN_DELIVERY_STATUS_CANCELLATION", "VPLMN_QOS_CH" }; + const char *policy_control_request_triggerArray[] = { "NULL", "PLMN_CH", "RES_MO_RE", "AC_TY_CH", "UE_IP_CH", "UE_MAC_CH", "AN_CH_COR", "US_RE", "APP_STA", "APP_STO", "AN_INFO", "CM_SES_FAIL", "PS_DA_OFF", "DEF_QOS_CH", "SE_AMBR_CH", "QOS_NOTIF", "NO_CREDIT", "REALLO_OF_CREDIT", "PRA_CH", "SAREA_CH", "SCNN_CH", "RE_TIMEOUT", "RES_RELEASE", "SUCC_RES_ALLO", "RAI_CH", "RAT_TY_CH", "REF_QOS_IND_CH", "NUM_OF_PACKET_FILTER", "UE_STATUS_RESUME", "UE_TZ_CH", "AUTH_PROF_CH", "QOS_MONITORING", "SCELL_CH", "USER_LOCATION_CH", "EPS_FALLBACK", "MA_PDU", "TSN_BRIDGE_INFO", "5G_RG_JOIN", "5G_RG_LEAVE", "DDN_FAILURE", "DDN_DELIVERY_STATUS", "GROUP_ID_LIST_CHG", "DDN_FAILURE_CANCELLATION", "DDN_DELIVERY_STATUS_CANCELLATION", "VPLMN_QOS_CH", "SUCC_QOS_UPDATE", "SAT_CATEGORY_CHG", "PCF_UE_NOTIF_IND", "NWDAF_DATA_CHG" }; size_t sizeofArray = sizeof(policy_control_request_triggerArray) / sizeof(policy_control_request_triggerArray[0]); if (policy_control_request_trigger < sizeofArray) return (char *)policy_control_request_triggerArray[policy_control_request_trigger]; @@ -17,7 +17,7 @@ char* OpenAPI_policy_control_request_trigger_ToString(OpenAPI_policy_control_req OpenAPI_policy_control_request_trigger_e OpenAPI_policy_control_request_trigger_FromString(char* policy_control_request_trigger) { int stringToReturn = 0; - const char *policy_control_request_triggerArray[] = { "NULL", "PLMN_CH", "RES_MO_RE", "AC_TY_CH", "UE_IP_CH", "UE_MAC_CH", "AN_CH_COR", "US_RE", "APP_STA", "APP_STO", "AN_INFO", "CM_SES_FAIL", "PS_DA_OFF", "DEF_QOS_CH", "SE_AMBR_CH", "QOS_NOTIF", "NO_CREDIT", "REALLO_OF_CREDIT", "PRA_CH", "SAREA_CH", "SCNN_CH", "RE_TIMEOUT", "RES_RELEASE", "SUCC_RES_ALLO", "RAT_TY_CH", "REF_QOS_IND_CH", "NUM_OF_PACKET_FILTER", "UE_STATUS_RESUME", "UE_TZ_CH", "AUTH_PROF_CH", "QOS_MONITORING", "SCELL_CH", "EPS_FALLBACK", "MA_PDU", "TSN_BRIDGE_INFO", "5G_RG_JOIN", "5G_RG_LEAVE", "DDN_FAILURE", "DDN_DELIVERY_STATUS", "GROUP_ID_LIST_CHG", "DDN_FAILURE_CANCELLATION", "DDN_DELIVERY_STATUS_CANCELLATION", "VPLMN_QOS_CH" }; + const char *policy_control_request_triggerArray[] = { "NULL", "PLMN_CH", "RES_MO_RE", "AC_TY_CH", "UE_IP_CH", "UE_MAC_CH", "AN_CH_COR", "US_RE", "APP_STA", "APP_STO", "AN_INFO", "CM_SES_FAIL", "PS_DA_OFF", "DEF_QOS_CH", "SE_AMBR_CH", "QOS_NOTIF", "NO_CREDIT", "REALLO_OF_CREDIT", "PRA_CH", "SAREA_CH", "SCNN_CH", "RE_TIMEOUT", "RES_RELEASE", "SUCC_RES_ALLO", "RAI_CH", "RAT_TY_CH", "REF_QOS_IND_CH", "NUM_OF_PACKET_FILTER", "UE_STATUS_RESUME", "UE_TZ_CH", "AUTH_PROF_CH", "QOS_MONITORING", "SCELL_CH", "USER_LOCATION_CH", "EPS_FALLBACK", "MA_PDU", "TSN_BRIDGE_INFO", "5G_RG_JOIN", "5G_RG_LEAVE", "DDN_FAILURE", "DDN_DELIVERY_STATUS", "GROUP_ID_LIST_CHG", "DDN_FAILURE_CANCELLATION", "DDN_DELIVERY_STATUS_CANCELLATION", "VPLMN_QOS_CH", "SUCC_QOS_UPDATE", "SAT_CATEGORY_CHG", "PCF_UE_NOTIF_IND", "NWDAF_DATA_CHG" }; size_t sizeofArray = sizeof(policy_control_request_triggerArray) / sizeof(policy_control_request_triggerArray[0]); while (stringToReturn < sizeofArray) { if (strcmp(policy_control_request_trigger, policy_control_request_triggerArray[stringToReturn]) == 0) { diff --git a/lib/sbi/openapi/model/policy_control_request_trigger.h b/lib/sbi/openapi/model/policy_control_request_trigger.h index 607c9548e..108f60398 100644 --- a/lib/sbi/openapi/model/policy_control_request_trigger.h +++ b/lib/sbi/openapi/model/policy_control_request_trigger.h @@ -17,7 +17,7 @@ extern "C" { #endif -typedef enum { OpenAPI_policy_control_request_trigger_NULL = 0, OpenAPI_policy_control_request_trigger_PLMN_CH, OpenAPI_policy_control_request_trigger_RES_MO_RE, OpenAPI_policy_control_request_trigger_AC_TY_CH, OpenAPI_policy_control_request_trigger_UE_IP_CH, OpenAPI_policy_control_request_trigger_UE_MAC_CH, OpenAPI_policy_control_request_trigger_AN_CH_COR, OpenAPI_policy_control_request_trigger_US_RE, OpenAPI_policy_control_request_trigger_APP_STA, OpenAPI_policy_control_request_trigger_APP_STO, OpenAPI_policy_control_request_trigger_AN_INFO, OpenAPI_policy_control_request_trigger_CM_SES_FAIL, OpenAPI_policy_control_request_trigger_PS_DA_OFF, OpenAPI_policy_control_request_trigger_DEF_QOS_CH, OpenAPI_policy_control_request_trigger_SE_AMBR_CH, OpenAPI_policy_control_request_trigger_QOS_NOTIF, OpenAPI_policy_control_request_trigger_NO_CREDIT, OpenAPI_policy_control_request_trigger_REALLO_OF_CREDIT, OpenAPI_policy_control_request_trigger_PRA_CH, OpenAPI_policy_control_request_trigger_SAREA_CH, OpenAPI_policy_control_request_trigger_SCNN_CH, OpenAPI_policy_control_request_trigger_RE_TIMEOUT, OpenAPI_policy_control_request_trigger_RES_RELEASE, OpenAPI_policy_control_request_trigger_SUCC_RES_ALLO, OpenAPI_policy_control_request_trigger_RAT_TY_CH, OpenAPI_policy_control_request_trigger_REF_QOS_IND_CH, OpenAPI_policy_control_request_trigger_NUM_OF_PACKET_FILTER, OpenAPI_policy_control_request_trigger_UE_STATUS_RESUME, OpenAPI_policy_control_request_trigger_UE_TZ_CH, OpenAPI_policy_control_request_trigger_AUTH_PROF_CH, OpenAPI_policy_control_request_trigger_QOS_MONITORING, OpenAPI_policy_control_request_trigger_SCELL_CH, OpenAPI_policy_control_request_trigger_EPS_FALLBACK, OpenAPI_policy_control_request_trigger_MA_PDU, OpenAPI_policy_control_request_trigger_TSN_BRIDGE_INFO, OpenAPI_policy_control_request_trigger__5G_RG_JOIN, OpenAPI_policy_control_request_trigger__5G_RG_LEAVE, OpenAPI_policy_control_request_trigger_DDN_FAILURE, OpenAPI_policy_control_request_trigger_DDN_DELIVERY_STATUS, OpenAPI_policy_control_request_trigger_GROUP_ID_LIST_CHG, OpenAPI_policy_control_request_trigger_DDN_FAILURE_CANCELLATION, OpenAPI_policy_control_request_trigger_DDN_DELIVERY_STATUS_CANCELLATION, OpenAPI_policy_control_request_trigger_VPLMN_QOS_CH } OpenAPI_policy_control_request_trigger_e; +typedef enum { OpenAPI_policy_control_request_trigger_NULL = 0, OpenAPI_policy_control_request_trigger_PLMN_CH, OpenAPI_policy_control_request_trigger_RES_MO_RE, OpenAPI_policy_control_request_trigger_AC_TY_CH, OpenAPI_policy_control_request_trigger_UE_IP_CH, OpenAPI_policy_control_request_trigger_UE_MAC_CH, OpenAPI_policy_control_request_trigger_AN_CH_COR, OpenAPI_policy_control_request_trigger_US_RE, OpenAPI_policy_control_request_trigger_APP_STA, OpenAPI_policy_control_request_trigger_APP_STO, OpenAPI_policy_control_request_trigger_AN_INFO, OpenAPI_policy_control_request_trigger_CM_SES_FAIL, OpenAPI_policy_control_request_trigger_PS_DA_OFF, OpenAPI_policy_control_request_trigger_DEF_QOS_CH, OpenAPI_policy_control_request_trigger_SE_AMBR_CH, OpenAPI_policy_control_request_trigger_QOS_NOTIF, OpenAPI_policy_control_request_trigger_NO_CREDIT, OpenAPI_policy_control_request_trigger_REALLO_OF_CREDIT, OpenAPI_policy_control_request_trigger_PRA_CH, OpenAPI_policy_control_request_trigger_SAREA_CH, OpenAPI_policy_control_request_trigger_SCNN_CH, OpenAPI_policy_control_request_trigger_RE_TIMEOUT, OpenAPI_policy_control_request_trigger_RES_RELEASE, OpenAPI_policy_control_request_trigger_SUCC_RES_ALLO, OpenAPI_policy_control_request_trigger_RAI_CH, OpenAPI_policy_control_request_trigger_RAT_TY_CH, OpenAPI_policy_control_request_trigger_REF_QOS_IND_CH, OpenAPI_policy_control_request_trigger_NUM_OF_PACKET_FILTER, OpenAPI_policy_control_request_trigger_UE_STATUS_RESUME, OpenAPI_policy_control_request_trigger_UE_TZ_CH, OpenAPI_policy_control_request_trigger_AUTH_PROF_CH, OpenAPI_policy_control_request_trigger_QOS_MONITORING, OpenAPI_policy_control_request_trigger_SCELL_CH, OpenAPI_policy_control_request_trigger_USER_LOCATION_CH, OpenAPI_policy_control_request_trigger_EPS_FALLBACK, OpenAPI_policy_control_request_trigger_MA_PDU, OpenAPI_policy_control_request_trigger_TSN_BRIDGE_INFO, OpenAPI_policy_control_request_trigger__5G_RG_JOIN, OpenAPI_policy_control_request_trigger__5G_RG_LEAVE, OpenAPI_policy_control_request_trigger_DDN_FAILURE, OpenAPI_policy_control_request_trigger_DDN_DELIVERY_STATUS, OpenAPI_policy_control_request_trigger_GROUP_ID_LIST_CHG, OpenAPI_policy_control_request_trigger_DDN_FAILURE_CANCELLATION, OpenAPI_policy_control_request_trigger_DDN_DELIVERY_STATUS_CANCELLATION, OpenAPI_policy_control_request_trigger_VPLMN_QOS_CH, OpenAPI_policy_control_request_trigger_SUCC_QOS_UPDATE, OpenAPI_policy_control_request_trigger_SAT_CATEGORY_CHG, OpenAPI_policy_control_request_trigger_PCF_UE_NOTIF_IND, OpenAPI_policy_control_request_trigger_NWDAF_DATA_CHG } OpenAPI_policy_control_request_trigger_e; char* OpenAPI_policy_control_request_trigger_ToString(OpenAPI_policy_control_request_trigger_e policy_control_request_trigger); diff --git a/lib/sbi/openapi/model/policy_data_change_notification.c b/lib/sbi/openapi/model/policy_data_change_notification.c index 2949c75f0..d60ecdc8a 100644 --- a/lib/sbi/openapi/model/policy_data_change_notification.c +++ b/lib/sbi/openapi/model/policy_data_change_notification.c @@ -21,7 +21,9 @@ OpenAPI_policy_data_change_notification_t *OpenAPI_policy_data_change_notificati OpenAPI_plmn_id_1_t *plmn_id, OpenAPI_list_t *del_resources, char *notif_id, - OpenAPI_list_t *reported_fragments + OpenAPI_list_t *reported_fragments, + OpenAPI_slice_policy_data_t *slice_policy_data, + OpenAPI_snssai_t *snssai ) { OpenAPI_policy_data_change_notification_t *policy_data_change_notification_local_var = ogs_malloc(sizeof(OpenAPI_policy_data_change_notification_t)); @@ -44,6 +46,8 @@ OpenAPI_policy_data_change_notification_t *OpenAPI_policy_data_change_notificati policy_data_change_notification_local_var->del_resources = del_resources; policy_data_change_notification_local_var->notif_id = notif_id; policy_data_change_notification_local_var->reported_fragments = reported_fragments; + policy_data_change_notification_local_var->slice_policy_data = slice_policy_data; + policy_data_change_notification_local_var->snssai = snssai; return policy_data_change_notification_local_var; } @@ -135,6 +139,14 @@ void OpenAPI_policy_data_change_notification_free(OpenAPI_policy_data_change_not OpenAPI_list_free(policy_data_change_notification->reported_fragments); policy_data_change_notification->reported_fragments = NULL; } + if (policy_data_change_notification->slice_policy_data) { + OpenAPI_slice_policy_data_free(policy_data_change_notification->slice_policy_data); + policy_data_change_notification->slice_policy_data = NULL; + } + if (policy_data_change_notification->snssai) { + OpenAPI_snssai_free(policy_data_change_notification->snssai); + policy_data_change_notification->snssai = NULL; + } ogs_free(policy_data_change_notification); } @@ -353,6 +365,32 @@ cJSON *OpenAPI_policy_data_change_notification_convertToJSON(OpenAPI_policy_data } } + if (policy_data_change_notification->slice_policy_data) { + cJSON *slice_policy_data_local_JSON = OpenAPI_slice_policy_data_convertToJSON(policy_data_change_notification->slice_policy_data); + if (slice_policy_data_local_JSON == NULL) { + ogs_error("OpenAPI_policy_data_change_notification_convertToJSON() failed [slice_policy_data]"); + goto end; + } + cJSON_AddItemToObject(item, "slicePolicyData", slice_policy_data_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_policy_data_change_notification_convertToJSON() failed [slice_policy_data]"); + goto end; + } + } + + if (policy_data_change_notification->snssai) { + cJSON *snssai_local_JSON = OpenAPI_snssai_convertToJSON(policy_data_change_notification->snssai); + if (snssai_local_JSON == NULL) { + ogs_error("OpenAPI_policy_data_change_notification_convertToJSON() failed [snssai]"); + goto end; + } + cJSON_AddItemToObject(item, "snssai", snssai_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_policy_data_change_notification_convertToJSON() failed [snssai]"); + goto end; + } + } + end: return item; } @@ -390,6 +428,10 @@ OpenAPI_policy_data_change_notification_t *OpenAPI_policy_data_change_notificati cJSON *notif_id = NULL; cJSON *reported_fragments = NULL; OpenAPI_list_t *reported_fragmentsList = NULL; + cJSON *slice_policy_data = NULL; + OpenAPI_slice_policy_data_t *slice_policy_data_local_nonprim = NULL; + cJSON *snssai = NULL; + OpenAPI_snssai_t *snssai_local_nonprim = NULL; am_policy_data = cJSON_GetObjectItemCaseSensitive(policy_data_change_notificationJSON, "amPolicyData"); if (am_policy_data) { am_policy_data_local_nonprim = OpenAPI_am_policy_data_parseFromJSON(am_policy_data); @@ -547,6 +589,16 @@ OpenAPI_policy_data_change_notification_t *OpenAPI_policy_data_change_notificati } } + slice_policy_data = cJSON_GetObjectItemCaseSensitive(policy_data_change_notificationJSON, "slicePolicyData"); + if (slice_policy_data) { + slice_policy_data_local_nonprim = OpenAPI_slice_policy_data_parseFromJSON(slice_policy_data); + } + + snssai = cJSON_GetObjectItemCaseSensitive(policy_data_change_notificationJSON, "snssai"); + if (snssai) { + snssai_local_nonprim = OpenAPI_snssai_parseFromJSON(snssai); + } + policy_data_change_notification_local_var = OpenAPI_policy_data_change_notification_create ( am_policy_data ? am_policy_data_local_nonprim : NULL, ue_policy_set ? ue_policy_set_local_nonprim : NULL, @@ -564,7 +616,9 @@ OpenAPI_policy_data_change_notification_t *OpenAPI_policy_data_change_notificati plmn_id ? plmn_id_local_nonprim : NULL, del_resources ? del_resourcesList : NULL, notif_id && !cJSON_IsNull(notif_id) ? ogs_strdup(notif_id->valuestring) : NULL, - reported_fragments ? reported_fragmentsList : NULL + reported_fragments ? reported_fragmentsList : NULL, + slice_policy_data ? slice_policy_data_local_nonprim : NULL, + snssai ? snssai_local_nonprim : NULL ); return policy_data_change_notification_local_var; @@ -629,6 +683,14 @@ end: OpenAPI_list_free(reported_fragmentsList); reported_fragmentsList = NULL; } + if (slice_policy_data_local_nonprim) { + OpenAPI_slice_policy_data_free(slice_policy_data_local_nonprim); + slice_policy_data_local_nonprim = NULL; + } + if (snssai_local_nonprim) { + OpenAPI_snssai_free(snssai_local_nonprim); + snssai_local_nonprim = NULL; + } return NULL; } diff --git a/lib/sbi/openapi/model/policy_data_change_notification.h b/lib/sbi/openapi/model/policy_data_change_notification.h index 8aa900aaf..4090e201a 100644 --- a/lib/sbi/openapi/model/policy_data_change_notification.h +++ b/lib/sbi/openapi/model/policy_data_change_notification.h @@ -17,7 +17,9 @@ #include "notification_item.h" #include "operator_specific_data_container.h" #include "plmn_id_1.h" +#include "slice_policy_data.h" #include "sm_policy_data.h" +#include "snssai.h" #include "sponsor_connectivity_data.h" #include "ue_policy_set.h" #include "usage_mon_data.h" @@ -45,6 +47,8 @@ typedef struct OpenAPI_policy_data_change_notification_s { OpenAPI_list_t *del_resources; char *notif_id; OpenAPI_list_t *reported_fragments; + struct OpenAPI_slice_policy_data_s *slice_policy_data; + struct OpenAPI_snssai_s *snssai; } OpenAPI_policy_data_change_notification_t; OpenAPI_policy_data_change_notification_t *OpenAPI_policy_data_change_notification_create( @@ -64,7 +68,9 @@ OpenAPI_policy_data_change_notification_t *OpenAPI_policy_data_change_notificati OpenAPI_plmn_id_1_t *plmn_id, OpenAPI_list_t *del_resources, char *notif_id, - OpenAPI_list_t *reported_fragments + OpenAPI_list_t *reported_fragments, + OpenAPI_slice_policy_data_t *slice_policy_data, + OpenAPI_snssai_t *snssai ); void OpenAPI_policy_data_change_notification_free(OpenAPI_policy_data_change_notification_t *policy_data_change_notification); OpenAPI_policy_data_change_notification_t *OpenAPI_policy_data_change_notification_parseFromJSON(cJSON *policy_data_change_notificationJSON); diff --git a/lib/sbi/openapi/model/policy_data_for_individual_ue.c b/lib/sbi/openapi/model/policy_data_for_individual_ue.c new file mode 100644 index 000000000..30b977bde --- /dev/null +++ b/lib/sbi/openapi/model/policy_data_for_individual_ue.c @@ -0,0 +1,326 @@ + +#include +#include +#include +#include "policy_data_for_individual_ue.h" + +OpenAPI_policy_data_for_individual_ue_t *OpenAPI_policy_data_for_individual_ue_create( + OpenAPI_ue_policy_set_t *ue_policy_data_set, + OpenAPI_sm_policy_data_t *sm_policy_data_set, + OpenAPI_am_policy_data_t *am_policy_data_set, + OpenAPI_list_t* um_data, + OpenAPI_list_t* operator_specific_data_set +) +{ + OpenAPI_policy_data_for_individual_ue_t *policy_data_for_individual_ue_local_var = ogs_malloc(sizeof(OpenAPI_policy_data_for_individual_ue_t)); + ogs_assert(policy_data_for_individual_ue_local_var); + + policy_data_for_individual_ue_local_var->ue_policy_data_set = ue_policy_data_set; + policy_data_for_individual_ue_local_var->sm_policy_data_set = sm_policy_data_set; + policy_data_for_individual_ue_local_var->am_policy_data_set = am_policy_data_set; + policy_data_for_individual_ue_local_var->um_data = um_data; + policy_data_for_individual_ue_local_var->operator_specific_data_set = operator_specific_data_set; + + return policy_data_for_individual_ue_local_var; +} + +void OpenAPI_policy_data_for_individual_ue_free(OpenAPI_policy_data_for_individual_ue_t *policy_data_for_individual_ue) +{ + OpenAPI_lnode_t *node = NULL; + + if (NULL == policy_data_for_individual_ue) { + return; + } + if (policy_data_for_individual_ue->ue_policy_data_set) { + OpenAPI_ue_policy_set_free(policy_data_for_individual_ue->ue_policy_data_set); + policy_data_for_individual_ue->ue_policy_data_set = NULL; + } + if (policy_data_for_individual_ue->sm_policy_data_set) { + OpenAPI_sm_policy_data_free(policy_data_for_individual_ue->sm_policy_data_set); + policy_data_for_individual_ue->sm_policy_data_set = NULL; + } + if (policy_data_for_individual_ue->am_policy_data_set) { + OpenAPI_am_policy_data_free(policy_data_for_individual_ue->am_policy_data_set); + policy_data_for_individual_ue->am_policy_data_set = NULL; + } + if (policy_data_for_individual_ue->um_data) { + OpenAPI_list_for_each(policy_data_for_individual_ue->um_data, node) { + OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*)node->data; + ogs_free(localKeyValue->key); + OpenAPI_usage_mon_data_free(localKeyValue->value); + OpenAPI_map_free(localKeyValue); + } + OpenAPI_list_free(policy_data_for_individual_ue->um_data); + policy_data_for_individual_ue->um_data = NULL; + } + if (policy_data_for_individual_ue->operator_specific_data_set) { + OpenAPI_list_for_each(policy_data_for_individual_ue->operator_specific_data_set, node) { + OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*)node->data; + ogs_free(localKeyValue->key); + OpenAPI_operator_specific_data_container_free(localKeyValue->value); + OpenAPI_map_free(localKeyValue); + } + OpenAPI_list_free(policy_data_for_individual_ue->operator_specific_data_set); + policy_data_for_individual_ue->operator_specific_data_set = NULL; + } + ogs_free(policy_data_for_individual_ue); +} + +cJSON *OpenAPI_policy_data_for_individual_ue_convertToJSON(OpenAPI_policy_data_for_individual_ue_t *policy_data_for_individual_ue) +{ + cJSON *item = NULL; + OpenAPI_lnode_t *node = NULL; + + if (policy_data_for_individual_ue == NULL) { + ogs_error("OpenAPI_policy_data_for_individual_ue_convertToJSON() failed [PolicyDataForIndividualUe]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (policy_data_for_individual_ue->ue_policy_data_set) { + cJSON *ue_policy_data_set_local_JSON = OpenAPI_ue_policy_set_convertToJSON(policy_data_for_individual_ue->ue_policy_data_set); + if (ue_policy_data_set_local_JSON == NULL) { + ogs_error("OpenAPI_policy_data_for_individual_ue_convertToJSON() failed [ue_policy_data_set]"); + goto end; + } + cJSON_AddItemToObject(item, "uePolicyDataSet", ue_policy_data_set_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_policy_data_for_individual_ue_convertToJSON() failed [ue_policy_data_set]"); + goto end; + } + } + + if (policy_data_for_individual_ue->sm_policy_data_set) { + cJSON *sm_policy_data_set_local_JSON = OpenAPI_sm_policy_data_convertToJSON(policy_data_for_individual_ue->sm_policy_data_set); + if (sm_policy_data_set_local_JSON == NULL) { + ogs_error("OpenAPI_policy_data_for_individual_ue_convertToJSON() failed [sm_policy_data_set]"); + goto end; + } + cJSON_AddItemToObject(item, "smPolicyDataSet", sm_policy_data_set_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_policy_data_for_individual_ue_convertToJSON() failed [sm_policy_data_set]"); + goto end; + } + } + + if (policy_data_for_individual_ue->am_policy_data_set) { + cJSON *am_policy_data_set_local_JSON = OpenAPI_am_policy_data_convertToJSON(policy_data_for_individual_ue->am_policy_data_set); + if (am_policy_data_set_local_JSON == NULL) { + ogs_error("OpenAPI_policy_data_for_individual_ue_convertToJSON() failed [am_policy_data_set]"); + goto end; + } + cJSON_AddItemToObject(item, "amPolicyDataSet", am_policy_data_set_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_policy_data_for_individual_ue_convertToJSON() failed [am_policy_data_set]"); + goto end; + } + } + + if (policy_data_for_individual_ue->um_data) { + cJSON *um_data = cJSON_AddObjectToObject(item, "umData"); + if (um_data == NULL) { + ogs_error("OpenAPI_policy_data_for_individual_ue_convertToJSON() failed [um_data]"); + goto end; + } + cJSON *localMapObject = um_data; + if (policy_data_for_individual_ue->um_data) { + OpenAPI_list_for_each(policy_data_for_individual_ue->um_data, node) { + OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*)node->data; + cJSON *itemLocal = localKeyValue->value ? + OpenAPI_usage_mon_data_convertToJSON(localKeyValue->value) : + cJSON_CreateNull(); + if (itemLocal == NULL) { + ogs_error("OpenAPI_policy_data_for_individual_ue_convertToJSON() failed [inner]"); + goto end; + } + cJSON_AddItemToObject(localMapObject, localKeyValue->key, itemLocal); + } + } + } + + if (policy_data_for_individual_ue->operator_specific_data_set) { + cJSON *operator_specific_data_set = cJSON_AddObjectToObject(item, "operatorSpecificDataSet"); + if (operator_specific_data_set == NULL) { + ogs_error("OpenAPI_policy_data_for_individual_ue_convertToJSON() failed [operator_specific_data_set]"); + goto end; + } + cJSON *localMapObject = operator_specific_data_set; + if (policy_data_for_individual_ue->operator_specific_data_set) { + OpenAPI_list_for_each(policy_data_for_individual_ue->operator_specific_data_set, node) { + OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*)node->data; + cJSON *itemLocal = localKeyValue->value ? + OpenAPI_operator_specific_data_container_convertToJSON(localKeyValue->value) : + cJSON_CreateNull(); + if (itemLocal == NULL) { + ogs_error("OpenAPI_policy_data_for_individual_ue_convertToJSON() failed [inner]"); + goto end; + } + cJSON_AddItemToObject(localMapObject, localKeyValue->key, itemLocal); + } + } + } + +end: + return item; +} + +OpenAPI_policy_data_for_individual_ue_t *OpenAPI_policy_data_for_individual_ue_parseFromJSON(cJSON *policy_data_for_individual_ueJSON) +{ + OpenAPI_policy_data_for_individual_ue_t *policy_data_for_individual_ue_local_var = NULL; + OpenAPI_lnode_t *node = NULL; + cJSON *ue_policy_data_set = NULL; + OpenAPI_ue_policy_set_t *ue_policy_data_set_local_nonprim = NULL; + cJSON *sm_policy_data_set = NULL; + OpenAPI_sm_policy_data_t *sm_policy_data_set_local_nonprim = NULL; + cJSON *am_policy_data_set = NULL; + OpenAPI_am_policy_data_t *am_policy_data_set_local_nonprim = NULL; + cJSON *um_data = NULL; + OpenAPI_list_t *um_dataList = NULL; + cJSON *operator_specific_data_set = NULL; + OpenAPI_list_t *operator_specific_data_setList = NULL; + ue_policy_data_set = cJSON_GetObjectItemCaseSensitive(policy_data_for_individual_ueJSON, "uePolicyDataSet"); + if (ue_policy_data_set) { + ue_policy_data_set_local_nonprim = OpenAPI_ue_policy_set_parseFromJSON(ue_policy_data_set); + } + + sm_policy_data_set = cJSON_GetObjectItemCaseSensitive(policy_data_for_individual_ueJSON, "smPolicyDataSet"); + if (sm_policy_data_set) { + sm_policy_data_set_local_nonprim = OpenAPI_sm_policy_data_parseFromJSON(sm_policy_data_set); + } + + am_policy_data_set = cJSON_GetObjectItemCaseSensitive(policy_data_for_individual_ueJSON, "amPolicyDataSet"); + if (am_policy_data_set) { + am_policy_data_set_local_nonprim = OpenAPI_am_policy_data_parseFromJSON(am_policy_data_set); + } + + um_data = cJSON_GetObjectItemCaseSensitive(policy_data_for_individual_ueJSON, "umData"); + if (um_data) { + cJSON *um_data_local_map = NULL; + if (!cJSON_IsObject(um_data) && !cJSON_IsNull(um_data)) { + ogs_error("OpenAPI_policy_data_for_individual_ue_parseFromJSON() failed [um_data]"); + goto end; + } + if (cJSON_IsObject(um_data)) { + um_dataList = OpenAPI_list_create(); + OpenAPI_map_t *localMapKeyPair = NULL; + cJSON_ArrayForEach(um_data_local_map, um_data) { + cJSON *localMapObject = um_data_local_map; + if (cJSON_IsObject(localMapObject)) { + localMapKeyPair = OpenAPI_map_create( + ogs_strdup(localMapObject->string), OpenAPI_usage_mon_data_parseFromJSON(localMapObject)); + } else if (cJSON_IsNull(localMapObject)) { + localMapKeyPair = OpenAPI_map_create(ogs_strdup(localMapObject->string), NULL); + } else { + ogs_error("OpenAPI_policy_data_for_individual_ue_parseFromJSON() failed [inner]"); + goto end; + } + OpenAPI_list_add(um_dataList, localMapKeyPair); + } + } + } + + operator_specific_data_set = cJSON_GetObjectItemCaseSensitive(policy_data_for_individual_ueJSON, "operatorSpecificDataSet"); + if (operator_specific_data_set) { + cJSON *operator_specific_data_set_local_map = NULL; + if (!cJSON_IsObject(operator_specific_data_set) && !cJSON_IsNull(operator_specific_data_set)) { + ogs_error("OpenAPI_policy_data_for_individual_ue_parseFromJSON() failed [operator_specific_data_set]"); + goto end; + } + if (cJSON_IsObject(operator_specific_data_set)) { + operator_specific_data_setList = OpenAPI_list_create(); + OpenAPI_map_t *localMapKeyPair = NULL; + cJSON_ArrayForEach(operator_specific_data_set_local_map, operator_specific_data_set) { + cJSON *localMapObject = operator_specific_data_set_local_map; + if (cJSON_IsObject(localMapObject)) { + localMapKeyPair = OpenAPI_map_create( + ogs_strdup(localMapObject->string), OpenAPI_operator_specific_data_container_parseFromJSON(localMapObject)); + } else if (cJSON_IsNull(localMapObject)) { + localMapKeyPair = OpenAPI_map_create(ogs_strdup(localMapObject->string), NULL); + } else { + ogs_error("OpenAPI_policy_data_for_individual_ue_parseFromJSON() failed [inner]"); + goto end; + } + OpenAPI_list_add(operator_specific_data_setList, localMapKeyPair); + } + } + } + + policy_data_for_individual_ue_local_var = OpenAPI_policy_data_for_individual_ue_create ( + ue_policy_data_set ? ue_policy_data_set_local_nonprim : NULL, + sm_policy_data_set ? sm_policy_data_set_local_nonprim : NULL, + am_policy_data_set ? am_policy_data_set_local_nonprim : NULL, + um_data ? um_dataList : NULL, + operator_specific_data_set ? operator_specific_data_setList : NULL + ); + + return policy_data_for_individual_ue_local_var; +end: + if (ue_policy_data_set_local_nonprim) { + OpenAPI_ue_policy_set_free(ue_policy_data_set_local_nonprim); + ue_policy_data_set_local_nonprim = NULL; + } + if (sm_policy_data_set_local_nonprim) { + OpenAPI_sm_policy_data_free(sm_policy_data_set_local_nonprim); + sm_policy_data_set_local_nonprim = NULL; + } + if (am_policy_data_set_local_nonprim) { + OpenAPI_am_policy_data_free(am_policy_data_set_local_nonprim); + am_policy_data_set_local_nonprim = NULL; + } + if (um_dataList) { + OpenAPI_list_for_each(um_dataList, node) { + OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*) node->data; + ogs_free(localKeyValue->key); + OpenAPI_usage_mon_data_free(localKeyValue->value); + OpenAPI_map_free(localKeyValue); + } + OpenAPI_list_free(um_dataList); + um_dataList = NULL; + } + if (operator_specific_data_setList) { + OpenAPI_list_for_each(operator_specific_data_setList, node) { + OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*) node->data; + ogs_free(localKeyValue->key); + OpenAPI_operator_specific_data_container_free(localKeyValue->value); + OpenAPI_map_free(localKeyValue); + } + OpenAPI_list_free(operator_specific_data_setList); + operator_specific_data_setList = NULL; + } + return NULL; +} + +OpenAPI_policy_data_for_individual_ue_t *OpenAPI_policy_data_for_individual_ue_copy(OpenAPI_policy_data_for_individual_ue_t *dst, OpenAPI_policy_data_for_individual_ue_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_policy_data_for_individual_ue_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_policy_data_for_individual_ue_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_policy_data_for_individual_ue_free(dst); + dst = OpenAPI_policy_data_for_individual_ue_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/policy_data_for_individual_ue.h b/lib/sbi/openapi/model/policy_data_for_individual_ue.h new file mode 100644 index 000000000..7ac6b4e8b --- /dev/null +++ b/lib/sbi/openapi/model/policy_data_for_individual_ue.h @@ -0,0 +1,51 @@ +/* + * policy_data_for_individual_ue.h + * + * Contains policy data for a given subscriber. + */ + +#ifndef _OpenAPI_policy_data_for_individual_ue_H_ +#define _OpenAPI_policy_data_for_individual_ue_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "am_policy_data.h" +#include "operator_specific_data_container.h" +#include "sm_policy_data.h" +#include "ue_policy_set.h" +#include "usage_mon_data.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_policy_data_for_individual_ue_s OpenAPI_policy_data_for_individual_ue_t; +typedef struct OpenAPI_policy_data_for_individual_ue_s { + struct OpenAPI_ue_policy_set_s *ue_policy_data_set; + struct OpenAPI_sm_policy_data_s *sm_policy_data_set; + struct OpenAPI_am_policy_data_s *am_policy_data_set; + OpenAPI_list_t* um_data; + OpenAPI_list_t* operator_specific_data_set; +} OpenAPI_policy_data_for_individual_ue_t; + +OpenAPI_policy_data_for_individual_ue_t *OpenAPI_policy_data_for_individual_ue_create( + OpenAPI_ue_policy_set_t *ue_policy_data_set, + OpenAPI_sm_policy_data_t *sm_policy_data_set, + OpenAPI_am_policy_data_t *am_policy_data_set, + OpenAPI_list_t* um_data, + OpenAPI_list_t* operator_specific_data_set +); +void OpenAPI_policy_data_for_individual_ue_free(OpenAPI_policy_data_for_individual_ue_t *policy_data_for_individual_ue); +OpenAPI_policy_data_for_individual_ue_t *OpenAPI_policy_data_for_individual_ue_parseFromJSON(cJSON *policy_data_for_individual_ueJSON); +cJSON *OpenAPI_policy_data_for_individual_ue_convertToJSON(OpenAPI_policy_data_for_individual_ue_t *policy_data_for_individual_ue); +OpenAPI_policy_data_for_individual_ue_t *OpenAPI_policy_data_for_individual_ue_copy(OpenAPI_policy_data_for_individual_ue_t *dst, OpenAPI_policy_data_for_individual_ue_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_policy_data_for_individual_ue_H_ */ + diff --git a/lib/sbi/openapi/model/policy_data_subscription.c b/lib/sbi/openapi/model/policy_data_subscription.c index 5675c9c91..c7812baab 100644 --- a/lib/sbi/openapi/model/policy_data_subscription.c +++ b/lib/sbi/openapi/model/policy_data_subscription.c @@ -9,8 +9,10 @@ OpenAPI_policy_data_subscription_t *OpenAPI_policy_data_subscription_create( char *notif_id, OpenAPI_list_t *monitored_resource_uris, OpenAPI_list_t *mon_res_items, + OpenAPI_list_t *excluded_res_items, char *expiry, - char *supported_features + char *supported_features, + OpenAPI_list_t *reset_ids ) { OpenAPI_policy_data_subscription_t *policy_data_subscription_local_var = ogs_malloc(sizeof(OpenAPI_policy_data_subscription_t)); @@ -20,8 +22,10 @@ OpenAPI_policy_data_subscription_t *OpenAPI_policy_data_subscription_create( policy_data_subscription_local_var->notif_id = notif_id; policy_data_subscription_local_var->monitored_resource_uris = monitored_resource_uris; policy_data_subscription_local_var->mon_res_items = mon_res_items; + policy_data_subscription_local_var->excluded_res_items = excluded_res_items; policy_data_subscription_local_var->expiry = expiry; policy_data_subscription_local_var->supported_features = supported_features; + policy_data_subscription_local_var->reset_ids = reset_ids; return policy_data_subscription_local_var; } @@ -55,6 +59,13 @@ void OpenAPI_policy_data_subscription_free(OpenAPI_policy_data_subscription_t *p OpenAPI_list_free(policy_data_subscription->mon_res_items); policy_data_subscription->mon_res_items = NULL; } + if (policy_data_subscription->excluded_res_items) { + OpenAPI_list_for_each(policy_data_subscription->excluded_res_items, node) { + OpenAPI_resource_item_free(node->data); + } + OpenAPI_list_free(policy_data_subscription->excluded_res_items); + policy_data_subscription->excluded_res_items = NULL; + } if (policy_data_subscription->expiry) { ogs_free(policy_data_subscription->expiry); policy_data_subscription->expiry = NULL; @@ -63,6 +74,13 @@ void OpenAPI_policy_data_subscription_free(OpenAPI_policy_data_subscription_t *p ogs_free(policy_data_subscription->supported_features); policy_data_subscription->supported_features = NULL; } + if (policy_data_subscription->reset_ids) { + OpenAPI_list_for_each(policy_data_subscription->reset_ids, node) { + ogs_free(node->data); + } + OpenAPI_list_free(policy_data_subscription->reset_ids); + policy_data_subscription->reset_ids = NULL; + } ogs_free(policy_data_subscription); } @@ -125,6 +143,22 @@ cJSON *OpenAPI_policy_data_subscription_convertToJSON(OpenAPI_policy_data_subscr } } + if (policy_data_subscription->excluded_res_items) { + cJSON *excluded_res_itemsList = cJSON_AddArrayToObject(item, "excludedResItems"); + if (excluded_res_itemsList == NULL) { + ogs_error("OpenAPI_policy_data_subscription_convertToJSON() failed [excluded_res_items]"); + goto end; + } + OpenAPI_list_for_each(policy_data_subscription->excluded_res_items, node) { + cJSON *itemLocal = OpenAPI_resource_item_convertToJSON(node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_policy_data_subscription_convertToJSON() failed [excluded_res_items]"); + goto end; + } + cJSON_AddItemToArray(excluded_res_itemsList, itemLocal); + } + } + if (policy_data_subscription->expiry) { if (cJSON_AddStringToObject(item, "expiry", policy_data_subscription->expiry) == NULL) { ogs_error("OpenAPI_policy_data_subscription_convertToJSON() failed [expiry]"); @@ -139,6 +173,20 @@ cJSON *OpenAPI_policy_data_subscription_convertToJSON(OpenAPI_policy_data_subscr } } + if (policy_data_subscription->reset_ids) { + cJSON *reset_idsList = cJSON_AddArrayToObject(item, "resetIds"); + if (reset_idsList == NULL) { + ogs_error("OpenAPI_policy_data_subscription_convertToJSON() failed [reset_ids]"); + goto end; + } + OpenAPI_list_for_each(policy_data_subscription->reset_ids, node) { + if (cJSON_AddStringToObject(reset_idsList, "", (char*)node->data) == NULL) { + ogs_error("OpenAPI_policy_data_subscription_convertToJSON() failed [reset_ids]"); + goto end; + } + } + } + end: return item; } @@ -153,8 +201,12 @@ OpenAPI_policy_data_subscription_t *OpenAPI_policy_data_subscription_parseFromJS OpenAPI_list_t *monitored_resource_urisList = NULL; cJSON *mon_res_items = NULL; OpenAPI_list_t *mon_res_itemsList = NULL; + cJSON *excluded_res_items = NULL; + OpenAPI_list_t *excluded_res_itemsList = NULL; cJSON *expiry = NULL; cJSON *supported_features = NULL; + cJSON *reset_ids = NULL; + OpenAPI_list_t *reset_idsList = NULL; notification_uri = cJSON_GetObjectItemCaseSensitive(policy_data_subscriptionJSON, "notificationUri"); if (!notification_uri) { ogs_error("OpenAPI_policy_data_subscription_parseFromJSON() failed [notification_uri]"); @@ -221,6 +273,31 @@ OpenAPI_policy_data_subscription_t *OpenAPI_policy_data_subscription_parseFromJS } } + excluded_res_items = cJSON_GetObjectItemCaseSensitive(policy_data_subscriptionJSON, "excludedResItems"); + if (excluded_res_items) { + cJSON *excluded_res_items_local = NULL; + if (!cJSON_IsArray(excluded_res_items)) { + ogs_error("OpenAPI_policy_data_subscription_parseFromJSON() failed [excluded_res_items]"); + goto end; + } + + excluded_res_itemsList = OpenAPI_list_create(); + + cJSON_ArrayForEach(excluded_res_items_local, excluded_res_items) { + if (!cJSON_IsObject(excluded_res_items_local)) { + ogs_error("OpenAPI_policy_data_subscription_parseFromJSON() failed [excluded_res_items]"); + goto end; + } + OpenAPI_resource_item_t *excluded_res_itemsItem = OpenAPI_resource_item_parseFromJSON(excluded_res_items_local); + if (!excluded_res_itemsItem) { + ogs_error("No excluded_res_itemsItem"); + OpenAPI_list_free(excluded_res_itemsList); + goto end; + } + OpenAPI_list_add(excluded_res_itemsList, excluded_res_itemsItem); + } + } + expiry = cJSON_GetObjectItemCaseSensitive(policy_data_subscriptionJSON, "expiry"); if (expiry) { if (!cJSON_IsString(expiry) && !cJSON_IsNull(expiry)) { @@ -237,13 +314,36 @@ OpenAPI_policy_data_subscription_t *OpenAPI_policy_data_subscription_parseFromJS } } + reset_ids = cJSON_GetObjectItemCaseSensitive(policy_data_subscriptionJSON, "resetIds"); + if (reset_ids) { + cJSON *reset_ids_local = NULL; + if (!cJSON_IsArray(reset_ids)) { + ogs_error("OpenAPI_policy_data_subscription_parseFromJSON() failed [reset_ids]"); + goto end; + } + + reset_idsList = OpenAPI_list_create(); + + cJSON_ArrayForEach(reset_ids_local, reset_ids) { + double *localDouble = NULL; + int *localInt = NULL; + if (!cJSON_IsString(reset_ids_local)) { + ogs_error("OpenAPI_policy_data_subscription_parseFromJSON() failed [reset_ids]"); + goto end; + } + OpenAPI_list_add(reset_idsList, ogs_strdup(reset_ids_local->valuestring)); + } + } + policy_data_subscription_local_var = OpenAPI_policy_data_subscription_create ( ogs_strdup(notification_uri->valuestring), notif_id && !cJSON_IsNull(notif_id) ? ogs_strdup(notif_id->valuestring) : NULL, monitored_resource_urisList, mon_res_items ? mon_res_itemsList : NULL, + excluded_res_items ? excluded_res_itemsList : NULL, expiry && !cJSON_IsNull(expiry) ? ogs_strdup(expiry->valuestring) : NULL, - supported_features && !cJSON_IsNull(supported_features) ? ogs_strdup(supported_features->valuestring) : NULL + supported_features && !cJSON_IsNull(supported_features) ? ogs_strdup(supported_features->valuestring) : NULL, + reset_ids ? reset_idsList : NULL ); return policy_data_subscription_local_var; @@ -262,6 +362,20 @@ end: OpenAPI_list_free(mon_res_itemsList); mon_res_itemsList = NULL; } + if (excluded_res_itemsList) { + OpenAPI_list_for_each(excluded_res_itemsList, node) { + OpenAPI_resource_item_free(node->data); + } + OpenAPI_list_free(excluded_res_itemsList); + excluded_res_itemsList = NULL; + } + if (reset_idsList) { + OpenAPI_list_for_each(reset_idsList, node) { + ogs_free(node->data); + } + OpenAPI_list_free(reset_idsList); + reset_idsList = NULL; + } return NULL; } diff --git a/lib/sbi/openapi/model/policy_data_subscription.h b/lib/sbi/openapi/model/policy_data_subscription.h index ed6e79074..a456a7ab8 100644 --- a/lib/sbi/openapi/model/policy_data_subscription.h +++ b/lib/sbi/openapi/model/policy_data_subscription.h @@ -24,8 +24,10 @@ typedef struct OpenAPI_policy_data_subscription_s { char *notif_id; OpenAPI_list_t *monitored_resource_uris; OpenAPI_list_t *mon_res_items; + OpenAPI_list_t *excluded_res_items; char *expiry; char *supported_features; + OpenAPI_list_t *reset_ids; } OpenAPI_policy_data_subscription_t; OpenAPI_policy_data_subscription_t *OpenAPI_policy_data_subscription_create( @@ -33,8 +35,10 @@ OpenAPI_policy_data_subscription_t *OpenAPI_policy_data_subscription_create( char *notif_id, OpenAPI_list_t *monitored_resource_uris, OpenAPI_list_t *mon_res_items, + OpenAPI_list_t *excluded_res_items, char *expiry, - char *supported_features + char *supported_features, + OpenAPI_list_t *reset_ids ); void OpenAPI_policy_data_subscription_free(OpenAPI_policy_data_subscription_t *policy_data_subscription); OpenAPI_policy_data_subscription_t *OpenAPI_policy_data_subscription_parseFromJSON(cJSON *policy_data_subscriptionJSON); diff --git a/lib/sbi/openapi/model/policy_data_subset.c b/lib/sbi/openapi/model/policy_data_subset.c new file mode 100644 index 000000000..0b66d6aef --- /dev/null +++ b/lib/sbi/openapi/model/policy_data_subset.c @@ -0,0 +1,87 @@ + +#include +#include +#include +#include "policy_data_subset.h" + +OpenAPI_policy_data_subset_t *OpenAPI_policy_data_subset_create( +) +{ + OpenAPI_policy_data_subset_t *policy_data_subset_local_var = ogs_malloc(sizeof(OpenAPI_policy_data_subset_t)); + ogs_assert(policy_data_subset_local_var); + + + return policy_data_subset_local_var; +} + +void OpenAPI_policy_data_subset_free(OpenAPI_policy_data_subset_t *policy_data_subset) +{ + OpenAPI_lnode_t *node = NULL; + + if (NULL == policy_data_subset) { + return; + } + ogs_free(policy_data_subset); +} + +cJSON *OpenAPI_policy_data_subset_convertToJSON(OpenAPI_policy_data_subset_t *policy_data_subset) +{ + cJSON *item = NULL; + OpenAPI_lnode_t *node = NULL; + + if (policy_data_subset == NULL) { + ogs_error("OpenAPI_policy_data_subset_convertToJSON() failed [PolicyDataSubset]"); + return NULL; + } + + item = cJSON_CreateObject(); +end: + return item; +} + +OpenAPI_policy_data_subset_t *OpenAPI_policy_data_subset_parseFromJSON(cJSON *policy_data_subsetJSON) +{ + OpenAPI_policy_data_subset_t *policy_data_subset_local_var = NULL; + OpenAPI_lnode_t *node = NULL; + policy_data_subset_local_var = OpenAPI_policy_data_subset_create ( + ); + + return policy_data_subset_local_var; +end: + return NULL; +} + +OpenAPI_policy_data_subset_t *OpenAPI_policy_data_subset_copy(OpenAPI_policy_data_subset_t *dst, OpenAPI_policy_data_subset_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_policy_data_subset_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_policy_data_subset_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_policy_data_subset_free(dst); + dst = OpenAPI_policy_data_subset_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/policy_data_subset.h b/lib/sbi/openapi/model/policy_data_subset.h new file mode 100644 index 000000000..f21a4cd61 --- /dev/null +++ b/lib/sbi/openapi/model/policy_data_subset.h @@ -0,0 +1,37 @@ +/* + * policy_data_subset.h + * + * Indicates a policy data subset. + */ + +#ifndef _OpenAPI_policy_data_subset_H_ +#define _OpenAPI_policy_data_subset_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "policy_data_subset_any_of.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_policy_data_subset_s OpenAPI_policy_data_subset_t; +typedef struct OpenAPI_policy_data_subset_s { +} OpenAPI_policy_data_subset_t; + +OpenAPI_policy_data_subset_t *OpenAPI_policy_data_subset_create( +); +void OpenAPI_policy_data_subset_free(OpenAPI_policy_data_subset_t *policy_data_subset); +OpenAPI_policy_data_subset_t *OpenAPI_policy_data_subset_parseFromJSON(cJSON *policy_data_subsetJSON); +cJSON *OpenAPI_policy_data_subset_convertToJSON(OpenAPI_policy_data_subset_t *policy_data_subset); +OpenAPI_policy_data_subset_t *OpenAPI_policy_data_subset_copy(OpenAPI_policy_data_subset_t *dst, OpenAPI_policy_data_subset_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_policy_data_subset_H_ */ + diff --git a/lib/sbi/openapi/model/policy_data_subset_any_of.c b/lib/sbi/openapi/model/policy_data_subset_any_of.c new file mode 100644 index 000000000..1c771221f --- /dev/null +++ b/lib/sbi/openapi/model/policy_data_subset_any_of.c @@ -0,0 +1,30 @@ + +#include +#include +#include +#include "policy_data_subset_any_of.h" + +char* OpenAPI_policy_data_subset_any_of_ToString(OpenAPI_policy_data_subset_any_of_e policy_data_subset_any_of) +{ + const char *policy_data_subset_any_ofArray[] = { "NULL", "AM_POLICY_DATA", "SM_POLICY_DATA", "UE_POLICY_DATA", "UM_DATA", "OPERATOR_SPECIFIC_DATA" }; + size_t sizeofArray = sizeof(policy_data_subset_any_ofArray) / sizeof(policy_data_subset_any_ofArray[0]); + if (policy_data_subset_any_of < sizeofArray) + return (char *)policy_data_subset_any_ofArray[policy_data_subset_any_of]; + else + return (char *)"Unknown"; +} + +OpenAPI_policy_data_subset_any_of_e OpenAPI_policy_data_subset_any_of_FromString(char* policy_data_subset_any_of) +{ + int stringToReturn = 0; + const char *policy_data_subset_any_ofArray[] = { "NULL", "AM_POLICY_DATA", "SM_POLICY_DATA", "UE_POLICY_DATA", "UM_DATA", "OPERATOR_SPECIFIC_DATA" }; + size_t sizeofArray = sizeof(policy_data_subset_any_ofArray) / sizeof(policy_data_subset_any_ofArray[0]); + while (stringToReturn < sizeofArray) { + if (strcmp(policy_data_subset_any_of, policy_data_subset_any_ofArray[stringToReturn]) == 0) { + return stringToReturn; + } + stringToReturn++; + } + return 0; +} + diff --git a/lib/sbi/openapi/model/policy_data_subset_any_of.h b/lib/sbi/openapi/model/policy_data_subset_any_of.h new file mode 100644 index 000000000..0e613ade2 --- /dev/null +++ b/lib/sbi/openapi/model/policy_data_subset_any_of.h @@ -0,0 +1,31 @@ +/* + * policy_data_subset_any_of.h + * + * + */ + +#ifndef _OpenAPI_policy_data_subset_any_of_H_ +#define _OpenAPI_policy_data_subset_any_of_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef enum { OpenAPI_policy_data_subset_any_of_NULL = 0, OpenAPI_policy_data_subset_any_of_AM_POLICY_DATA, OpenAPI_policy_data_subset_any_of_SM_POLICY_DATA, OpenAPI_policy_data_subset_any_of_UE_POLICY_DATA, OpenAPI_policy_data_subset_any_of_UM_DATA, OpenAPI_policy_data_subset_any_of_OPERATOR_SPECIFIC_DATA } OpenAPI_policy_data_subset_any_of_e; + +char* OpenAPI_policy_data_subset_any_of_ToString(OpenAPI_policy_data_subset_any_of_e policy_data_subset_any_of); + +OpenAPI_policy_data_subset_any_of_e OpenAPI_policy_data_subset_any_of_FromString(char* policy_data_subset_any_of); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_policy_data_subset_any_of_H_ */ + diff --git a/lib/sbi/openapi/model/policy_decision_failure_code.c b/lib/sbi/openapi/model/policy_decision_failure_code.c index c05e603e5..9cc2e9712 100644 --- a/lib/sbi/openapi/model/policy_decision_failure_code.c +++ b/lib/sbi/openapi/model/policy_decision_failure_code.c @@ -6,7 +6,7 @@ char* OpenAPI_policy_decision_failure_code_ToString(OpenAPI_policy_decision_failure_code_e policy_decision_failure_code) { - const char *policy_decision_failure_codeArray[] = { "NULL", "TRA_CTRL_DECS_ERR", "QOS_DECS_ERR", "CHG_DECS_ERR", "USA_MON_DECS_ERR", "QOS_MON_DECS_ERR", "CON_DATA_ERR" }; + const char *policy_decision_failure_codeArray[] = { "NULL", "TRA_CTRL_DECS_ERR", "QOS_DECS_ERR", "CHG_DECS_ERR", "USA_MON_DECS_ERR", "QOS_MON_DECS_ERR", "CON_DATA_ERR", "POLICY_PARAM_ERR" }; size_t sizeofArray = sizeof(policy_decision_failure_codeArray) / sizeof(policy_decision_failure_codeArray[0]); if (policy_decision_failure_code < sizeofArray) return (char *)policy_decision_failure_codeArray[policy_decision_failure_code]; @@ -17,7 +17,7 @@ char* OpenAPI_policy_decision_failure_code_ToString(OpenAPI_policy_decision_fail OpenAPI_policy_decision_failure_code_e OpenAPI_policy_decision_failure_code_FromString(char* policy_decision_failure_code) { int stringToReturn = 0; - const char *policy_decision_failure_codeArray[] = { "NULL", "TRA_CTRL_DECS_ERR", "QOS_DECS_ERR", "CHG_DECS_ERR", "USA_MON_DECS_ERR", "QOS_MON_DECS_ERR", "CON_DATA_ERR" }; + const char *policy_decision_failure_codeArray[] = { "NULL", "TRA_CTRL_DECS_ERR", "QOS_DECS_ERR", "CHG_DECS_ERR", "USA_MON_DECS_ERR", "QOS_MON_DECS_ERR", "CON_DATA_ERR", "POLICY_PARAM_ERR" }; size_t sizeofArray = sizeof(policy_decision_failure_codeArray) / sizeof(policy_decision_failure_codeArray[0]); while (stringToReturn < sizeofArray) { if (strcmp(policy_decision_failure_code, policy_decision_failure_codeArray[stringToReturn]) == 0) { diff --git a/lib/sbi/openapi/model/policy_decision_failure_code.h b/lib/sbi/openapi/model/policy_decision_failure_code.h index ea916cd59..c98af3b95 100644 --- a/lib/sbi/openapi/model/policy_decision_failure_code.h +++ b/lib/sbi/openapi/model/policy_decision_failure_code.h @@ -17,7 +17,7 @@ extern "C" { #endif -typedef enum { OpenAPI_policy_decision_failure_code_NULL = 0, OpenAPI_policy_decision_failure_code_TRA_CTRL_DECS_ERR, OpenAPI_policy_decision_failure_code_QOS_DECS_ERR, OpenAPI_policy_decision_failure_code_CHG_DECS_ERR, OpenAPI_policy_decision_failure_code_USA_MON_DECS_ERR, OpenAPI_policy_decision_failure_code_QOS_MON_DECS_ERR, OpenAPI_policy_decision_failure_code_CON_DATA_ERR } OpenAPI_policy_decision_failure_code_e; +typedef enum { OpenAPI_policy_decision_failure_code_NULL = 0, OpenAPI_policy_decision_failure_code_TRA_CTRL_DECS_ERR, OpenAPI_policy_decision_failure_code_QOS_DECS_ERR, OpenAPI_policy_decision_failure_code_CHG_DECS_ERR, OpenAPI_policy_decision_failure_code_USA_MON_DECS_ERR, OpenAPI_policy_decision_failure_code_QOS_MON_DECS_ERR, OpenAPI_policy_decision_failure_code_CON_DATA_ERR, OpenAPI_policy_decision_failure_code_POLICY_PARAM_ERR } OpenAPI_policy_decision_failure_code_e; char* OpenAPI_policy_decision_failure_code_ToString(OpenAPI_policy_decision_failure_code_e policy_decision_failure_code); diff --git a/lib/sbi/openapi/model/policy_req_trigger.c b/lib/sbi/openapi/model/policy_req_trigger.c index 634ed05e5..4673625ea 100644 --- a/lib/sbi/openapi/model/policy_req_trigger.c +++ b/lib/sbi/openapi/model/policy_req_trigger.c @@ -6,7 +6,7 @@ char* OpenAPI_policy_req_trigger_ToString(OpenAPI_policy_req_trigger_e policy_req_trigger) { - const char *policy_req_triggerArray[] = { "NULL", "LOCATION_CHANGE", "PRA_CHANGE", "SARI_CHANGE", "RFSP_INDEX_CHANGE", "ALLOWED_NSSAI_CHANGE" }; + const char *policy_req_triggerArray[] = { "NULL", "LOCATION_CHANGE", "PRA_CHANGE", "ALLOWED_NSSAI_CHANGE", "NWDAF_DATA_CHANGE", "PLMN_CHANGE", "CON_STATE_CHANGE", "SMF_SELECT_CHANGE", "ACCESS_TYPE_CHANGE" }; size_t sizeofArray = sizeof(policy_req_triggerArray) / sizeof(policy_req_triggerArray[0]); if (policy_req_trigger < sizeofArray) return (char *)policy_req_triggerArray[policy_req_trigger]; @@ -17,7 +17,7 @@ char* OpenAPI_policy_req_trigger_ToString(OpenAPI_policy_req_trigger_e policy_re OpenAPI_policy_req_trigger_e OpenAPI_policy_req_trigger_FromString(char* policy_req_trigger) { int stringToReturn = 0; - const char *policy_req_triggerArray[] = { "NULL", "LOCATION_CHANGE", "PRA_CHANGE", "SARI_CHANGE", "RFSP_INDEX_CHANGE", "ALLOWED_NSSAI_CHANGE" }; + const char *policy_req_triggerArray[] = { "NULL", "LOCATION_CHANGE", "PRA_CHANGE", "ALLOWED_NSSAI_CHANGE", "NWDAF_DATA_CHANGE", "PLMN_CHANGE", "CON_STATE_CHANGE", "SMF_SELECT_CHANGE", "ACCESS_TYPE_CHANGE" }; size_t sizeofArray = sizeof(policy_req_triggerArray) / sizeof(policy_req_triggerArray[0]); while (stringToReturn < sizeofArray) { if (strcmp(policy_req_trigger, policy_req_triggerArray[stringToReturn]) == 0) { diff --git a/lib/sbi/openapi/model/policy_req_trigger.h b/lib/sbi/openapi/model/policy_req_trigger.h index 15015fe95..496adf801 100644 --- a/lib/sbi/openapi/model/policy_req_trigger.h +++ b/lib/sbi/openapi/model/policy_req_trigger.h @@ -17,7 +17,7 @@ extern "C" { #endif -typedef enum { OpenAPI_policy_req_trigger_NULL = 0, OpenAPI_policy_req_trigger_LOCATION_CHANGE, OpenAPI_policy_req_trigger_PRA_CHANGE, OpenAPI_policy_req_trigger_SARI_CHANGE, OpenAPI_policy_req_trigger_RFSP_INDEX_CHANGE, OpenAPI_policy_req_trigger_ALLOWED_NSSAI_CHANGE } OpenAPI_policy_req_trigger_e; +typedef enum { OpenAPI_policy_req_trigger_NULL = 0, OpenAPI_policy_req_trigger_LOCATION_CHANGE, OpenAPI_policy_req_trigger_PRA_CHANGE, OpenAPI_policy_req_trigger_ALLOWED_NSSAI_CHANGE, OpenAPI_policy_req_trigger_NWDAF_DATA_CHANGE, OpenAPI_policy_req_trigger_PLMN_CHANGE, OpenAPI_policy_req_trigger_CON_STATE_CHANGE, OpenAPI_policy_req_trigger_SMF_SELECT_CHANGE, OpenAPI_policy_req_trigger_ACCESS_TYPE_CHANGE } OpenAPI_policy_req_trigger_e; char* OpenAPI_policy_req_trigger_ToString(OpenAPI_policy_req_trigger_e policy_req_trigger); diff --git a/lib/sbi/openapi/model/policy_update.c b/lib/sbi/openapi/model/policy_update.c index 7fd5eae34..778828543 100644 --- a/lib/sbi/openapi/model/policy_update.c +++ b/lib/sbi/openapi/model/policy_update.c @@ -11,9 +11,15 @@ OpenAPI_policy_update_t *OpenAPI_policy_update_create( OpenAPI_wireline_service_area_restriction_t *wl_serv_area_res, bool is_rfsp, int rfsp, + bool is_target_rfsp, + int target_rfsp, OpenAPI_smf_selection_data_t *smf_sel_info, OpenAPI_ambr_t *ue_ambr, - OpenAPI_list_t* pras + OpenAPI_list_t *ue_slice_mbrs, + OpenAPI_list_t* pras, + OpenAPI_pcf_ue_callback_info_t *pcf_ue_info, + OpenAPI_list_t *match_pdus, + OpenAPI_as_time_distribution_param_t *as_time_dis_param ) { OpenAPI_policy_update_t *policy_update_local_var = ogs_malloc(sizeof(OpenAPI_policy_update_t)); @@ -25,9 +31,15 @@ OpenAPI_policy_update_t *OpenAPI_policy_update_create( policy_update_local_var->wl_serv_area_res = wl_serv_area_res; policy_update_local_var->is_rfsp = is_rfsp; policy_update_local_var->rfsp = rfsp; + policy_update_local_var->is_target_rfsp = is_target_rfsp; + policy_update_local_var->target_rfsp = target_rfsp; policy_update_local_var->smf_sel_info = smf_sel_info; policy_update_local_var->ue_ambr = ue_ambr; + policy_update_local_var->ue_slice_mbrs = ue_slice_mbrs; policy_update_local_var->pras = pras; + policy_update_local_var->pcf_ue_info = pcf_ue_info; + policy_update_local_var->match_pdus = match_pdus; + policy_update_local_var->as_time_dis_param = as_time_dis_param; return policy_update_local_var; } @@ -63,6 +75,13 @@ void OpenAPI_policy_update_free(OpenAPI_policy_update_t *policy_update) OpenAPI_ambr_free(policy_update->ue_ambr); policy_update->ue_ambr = NULL; } + if (policy_update->ue_slice_mbrs) { + OpenAPI_list_for_each(policy_update->ue_slice_mbrs, node) { + OpenAPI_ue_slice_mbr_free(node->data); + } + OpenAPI_list_free(policy_update->ue_slice_mbrs); + policy_update->ue_slice_mbrs = NULL; + } if (policy_update->pras) { OpenAPI_list_for_each(policy_update->pras, node) { OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*)node->data; @@ -73,6 +92,21 @@ void OpenAPI_policy_update_free(OpenAPI_policy_update_t *policy_update) OpenAPI_list_free(policy_update->pras); policy_update->pras = NULL; } + if (policy_update->pcf_ue_info) { + OpenAPI_pcf_ue_callback_info_free(policy_update->pcf_ue_info); + policy_update->pcf_ue_info = NULL; + } + if (policy_update->match_pdus) { + OpenAPI_list_for_each(policy_update->match_pdus, node) { + OpenAPI_pdu_session_info_free(node->data); + } + OpenAPI_list_free(policy_update->match_pdus); + policy_update->match_pdus = NULL; + } + if (policy_update->as_time_dis_param) { + OpenAPI_as_time_distribution_param_free(policy_update->as_time_dis_param); + policy_update->as_time_dis_param = NULL; + } ogs_free(policy_update); } @@ -143,6 +177,13 @@ cJSON *OpenAPI_policy_update_convertToJSON(OpenAPI_policy_update_t *policy_updat } } + if (policy_update->is_target_rfsp) { + if (cJSON_AddNumberToObject(item, "targetRfsp", policy_update->target_rfsp) == NULL) { + ogs_error("OpenAPI_policy_update_convertToJSON() failed [target_rfsp]"); + goto end; + } + } + if (policy_update->smf_sel_info) { cJSON *smf_sel_info_local_JSON = OpenAPI_smf_selection_data_convertToJSON(policy_update->smf_sel_info); if (smf_sel_info_local_JSON == NULL) { @@ -169,6 +210,22 @@ cJSON *OpenAPI_policy_update_convertToJSON(OpenAPI_policy_update_t *policy_updat } } + if (policy_update->ue_slice_mbrs) { + cJSON *ue_slice_mbrsList = cJSON_AddArrayToObject(item, "ueSliceMbrs"); + if (ue_slice_mbrsList == NULL) { + ogs_error("OpenAPI_policy_update_convertToJSON() failed [ue_slice_mbrs]"); + goto end; + } + OpenAPI_list_for_each(policy_update->ue_slice_mbrs, node) { + cJSON *itemLocal = OpenAPI_ue_slice_mbr_convertToJSON(node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_policy_update_convertToJSON() failed [ue_slice_mbrs]"); + goto end; + } + cJSON_AddItemToArray(ue_slice_mbrsList, itemLocal); + } + } + if (policy_update->pras) { cJSON *pras = cJSON_AddObjectToObject(item, "pras"); if (pras == NULL) { @@ -191,6 +248,48 @@ cJSON *OpenAPI_policy_update_convertToJSON(OpenAPI_policy_update_t *policy_updat } } + if (policy_update->pcf_ue_info) { + cJSON *pcf_ue_info_local_JSON = OpenAPI_pcf_ue_callback_info_convertToJSON(policy_update->pcf_ue_info); + if (pcf_ue_info_local_JSON == NULL) { + ogs_error("OpenAPI_policy_update_convertToJSON() failed [pcf_ue_info]"); + goto end; + } + cJSON_AddItemToObject(item, "pcfUeInfo", pcf_ue_info_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_policy_update_convertToJSON() failed [pcf_ue_info]"); + goto end; + } + } + + if (policy_update->match_pdus) { + cJSON *match_pdusList = cJSON_AddArrayToObject(item, "matchPdus"); + if (match_pdusList == NULL) { + ogs_error("OpenAPI_policy_update_convertToJSON() failed [match_pdus]"); + goto end; + } + OpenAPI_list_for_each(policy_update->match_pdus, node) { + cJSON *itemLocal = OpenAPI_pdu_session_info_convertToJSON(node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_policy_update_convertToJSON() failed [match_pdus]"); + goto end; + } + cJSON_AddItemToArray(match_pdusList, itemLocal); + } + } + + if (policy_update->as_time_dis_param) { + cJSON *as_time_dis_param_local_JSON = OpenAPI_as_time_distribution_param_convertToJSON(policy_update->as_time_dis_param); + if (as_time_dis_param_local_JSON == NULL) { + ogs_error("OpenAPI_policy_update_convertToJSON() failed [as_time_dis_param]"); + goto end; + } + cJSON_AddItemToObject(item, "asTimeDisParam", as_time_dis_param_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_policy_update_convertToJSON() failed [as_time_dis_param]"); + goto end; + } + } + end: return item; } @@ -207,12 +306,21 @@ OpenAPI_policy_update_t *OpenAPI_policy_update_parseFromJSON(cJSON *policy_updat cJSON *wl_serv_area_res = NULL; OpenAPI_wireline_service_area_restriction_t *wl_serv_area_res_local_nonprim = NULL; cJSON *rfsp = NULL; + cJSON *target_rfsp = NULL; cJSON *smf_sel_info = NULL; OpenAPI_smf_selection_data_t *smf_sel_info_local_nonprim = NULL; cJSON *ue_ambr = NULL; OpenAPI_ambr_t *ue_ambr_local_nonprim = NULL; + cJSON *ue_slice_mbrs = NULL; + OpenAPI_list_t *ue_slice_mbrsList = NULL; cJSON *pras = NULL; OpenAPI_list_t *prasList = NULL; + cJSON *pcf_ue_info = NULL; + OpenAPI_pcf_ue_callback_info_t *pcf_ue_info_local_nonprim = NULL; + cJSON *match_pdus = NULL; + OpenAPI_list_t *match_pdusList = NULL; + cJSON *as_time_dis_param = NULL; + OpenAPI_as_time_distribution_param_t *as_time_dis_param_local_nonprim = NULL; resource_uri = cJSON_GetObjectItemCaseSensitive(policy_updateJSON, "resourceUri"); if (!resource_uri) { ogs_error("OpenAPI_policy_update_parseFromJSON() failed [resource_uri]"); @@ -260,6 +368,14 @@ OpenAPI_policy_update_t *OpenAPI_policy_update_parseFromJSON(cJSON *policy_updat } } + target_rfsp = cJSON_GetObjectItemCaseSensitive(policy_updateJSON, "targetRfsp"); + if (target_rfsp) { + if (!cJSON_IsNumber(target_rfsp)) { + ogs_error("OpenAPI_policy_update_parseFromJSON() failed [target_rfsp]"); + goto end; + } + } + smf_sel_info = cJSON_GetObjectItemCaseSensitive(policy_updateJSON, "smfSelInfo"); if (smf_sel_info) { smf_sel_info_local_nonprim = OpenAPI_smf_selection_data_parseFromJSON(smf_sel_info); @@ -270,6 +386,31 @@ OpenAPI_policy_update_t *OpenAPI_policy_update_parseFromJSON(cJSON *policy_updat ue_ambr_local_nonprim = OpenAPI_ambr_parseFromJSON(ue_ambr); } + ue_slice_mbrs = cJSON_GetObjectItemCaseSensitive(policy_updateJSON, "ueSliceMbrs"); + if (ue_slice_mbrs) { + cJSON *ue_slice_mbrs_local = NULL; + if (!cJSON_IsArray(ue_slice_mbrs)) { + ogs_error("OpenAPI_policy_update_parseFromJSON() failed [ue_slice_mbrs]"); + goto end; + } + + ue_slice_mbrsList = OpenAPI_list_create(); + + cJSON_ArrayForEach(ue_slice_mbrs_local, ue_slice_mbrs) { + if (!cJSON_IsObject(ue_slice_mbrs_local)) { + ogs_error("OpenAPI_policy_update_parseFromJSON() failed [ue_slice_mbrs]"); + goto end; + } + OpenAPI_ue_slice_mbr_t *ue_slice_mbrsItem = OpenAPI_ue_slice_mbr_parseFromJSON(ue_slice_mbrs_local); + if (!ue_slice_mbrsItem) { + ogs_error("No ue_slice_mbrsItem"); + OpenAPI_list_free(ue_slice_mbrsList); + goto end; + } + OpenAPI_list_add(ue_slice_mbrsList, ue_slice_mbrsItem); + } + } + pras = cJSON_GetObjectItemCaseSensitive(policy_updateJSON, "pras"); if (pras) { cJSON *pras_local_map = NULL; @@ -296,6 +437,41 @@ OpenAPI_policy_update_t *OpenAPI_policy_update_parseFromJSON(cJSON *policy_updat } } + pcf_ue_info = cJSON_GetObjectItemCaseSensitive(policy_updateJSON, "pcfUeInfo"); + if (pcf_ue_info) { + pcf_ue_info_local_nonprim = OpenAPI_pcf_ue_callback_info_parseFromJSON(pcf_ue_info); + } + + match_pdus = cJSON_GetObjectItemCaseSensitive(policy_updateJSON, "matchPdus"); + if (match_pdus) { + cJSON *match_pdus_local = NULL; + if (!cJSON_IsArray(match_pdus)) { + ogs_error("OpenAPI_policy_update_parseFromJSON() failed [match_pdus]"); + goto end; + } + + match_pdusList = OpenAPI_list_create(); + + cJSON_ArrayForEach(match_pdus_local, match_pdus) { + if (!cJSON_IsObject(match_pdus_local)) { + ogs_error("OpenAPI_policy_update_parseFromJSON() failed [match_pdus]"); + goto end; + } + OpenAPI_pdu_session_info_t *match_pdusItem = OpenAPI_pdu_session_info_parseFromJSON(match_pdus_local); + if (!match_pdusItem) { + ogs_error("No match_pdusItem"); + OpenAPI_list_free(match_pdusList); + goto end; + } + OpenAPI_list_add(match_pdusList, match_pdusItem); + } + } + + as_time_dis_param = cJSON_GetObjectItemCaseSensitive(policy_updateJSON, "asTimeDisParam"); + if (as_time_dis_param) { + as_time_dis_param_local_nonprim = OpenAPI_as_time_distribution_param_parseFromJSON(as_time_dis_param); + } + policy_update_local_var = OpenAPI_policy_update_create ( ogs_strdup(resource_uri->valuestring), triggers ? triggersList : NULL, @@ -303,9 +479,15 @@ OpenAPI_policy_update_t *OpenAPI_policy_update_parseFromJSON(cJSON *policy_updat wl_serv_area_res ? wl_serv_area_res_local_nonprim : NULL, rfsp ? true : false, rfsp ? rfsp->valuedouble : 0, + target_rfsp ? true : false, + target_rfsp ? target_rfsp->valuedouble : 0, smf_sel_info ? smf_sel_info_local_nonprim : NULL, ue_ambr ? ue_ambr_local_nonprim : NULL, - pras ? prasList : NULL + ue_slice_mbrs ? ue_slice_mbrsList : NULL, + pras ? prasList : NULL, + pcf_ue_info ? pcf_ue_info_local_nonprim : NULL, + match_pdus ? match_pdusList : NULL, + as_time_dis_param ? as_time_dis_param_local_nonprim : NULL ); return policy_update_local_var; @@ -330,6 +512,13 @@ end: OpenAPI_ambr_free(ue_ambr_local_nonprim); ue_ambr_local_nonprim = NULL; } + if (ue_slice_mbrsList) { + OpenAPI_list_for_each(ue_slice_mbrsList, node) { + OpenAPI_ue_slice_mbr_free(node->data); + } + OpenAPI_list_free(ue_slice_mbrsList); + ue_slice_mbrsList = NULL; + } if (prasList) { OpenAPI_list_for_each(prasList, node) { OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*) node->data; @@ -340,6 +529,21 @@ end: OpenAPI_list_free(prasList); prasList = NULL; } + if (pcf_ue_info_local_nonprim) { + OpenAPI_pcf_ue_callback_info_free(pcf_ue_info_local_nonprim); + pcf_ue_info_local_nonprim = NULL; + } + if (match_pdusList) { + OpenAPI_list_for_each(match_pdusList, node) { + OpenAPI_pdu_session_info_free(node->data); + } + OpenAPI_list_free(match_pdusList); + match_pdusList = NULL; + } + if (as_time_dis_param_local_nonprim) { + OpenAPI_as_time_distribution_param_free(as_time_dis_param_local_nonprim); + as_time_dis_param_local_nonprim = NULL; + } return NULL; } diff --git a/lib/sbi/openapi/model/policy_update.h b/lib/sbi/openapi/model/policy_update.h index 3b06c5d67..da1318163 100644 --- a/lib/sbi/openapi/model/policy_update.h +++ b/lib/sbi/openapi/model/policy_update.h @@ -1,7 +1,7 @@ /* * policy_update.h * - * + * Represents updated policies that the PCF provides in a notification or in a reply to an Update Request. */ #ifndef _OpenAPI_policy_update_H_ @@ -13,10 +13,14 @@ #include "../include/keyValuePair.h" #include "../include/binary.h" #include "ambr.h" +#include "as_time_distribution_param.h" +#include "pcf_ue_callback_info.h" +#include "pdu_session_info.h" #include "presence_info_rm.h" #include "request_trigger.h" #include "service_area_restriction.h" #include "smf_selection_data.h" +#include "ue_slice_mbr.h" #include "wireline_service_area_restriction.h" #ifdef __cplusplus @@ -31,9 +35,15 @@ typedef struct OpenAPI_policy_update_s { struct OpenAPI_wireline_service_area_restriction_s *wl_serv_area_res; bool is_rfsp; int rfsp; + bool is_target_rfsp; + int target_rfsp; struct OpenAPI_smf_selection_data_s *smf_sel_info; struct OpenAPI_ambr_s *ue_ambr; + OpenAPI_list_t *ue_slice_mbrs; OpenAPI_list_t* pras; + struct OpenAPI_pcf_ue_callback_info_s *pcf_ue_info; + OpenAPI_list_t *match_pdus; + struct OpenAPI_as_time_distribution_param_s *as_time_dis_param; } OpenAPI_policy_update_t; OpenAPI_policy_update_t *OpenAPI_policy_update_create( @@ -43,9 +53,15 @@ OpenAPI_policy_update_t *OpenAPI_policy_update_create( OpenAPI_wireline_service_area_restriction_t *wl_serv_area_res, bool is_rfsp, int rfsp, + bool is_target_rfsp, + int target_rfsp, OpenAPI_smf_selection_data_t *smf_sel_info, OpenAPI_ambr_t *ue_ambr, - OpenAPI_list_t* pras + OpenAPI_list_t *ue_slice_mbrs, + OpenAPI_list_t* pras, + OpenAPI_pcf_ue_callback_info_t *pcf_ue_info, + OpenAPI_list_t *match_pdus, + OpenAPI_as_time_distribution_param_t *as_time_dis_param ); void OpenAPI_policy_update_free(OpenAPI_policy_update_t *policy_update); OpenAPI_policy_update_t *OpenAPI_policy_update_parseFromJSON(cJSON *policy_updateJSON); diff --git a/lib/sbi/openapi/model/polygon.h b/lib/sbi/openapi/model/polygon.h index 56faca4a6..7f76e1c0f 100644 --- a/lib/sbi/openapi/model/polygon.h +++ b/lib/sbi/openapi/model/polygon.h @@ -1,7 +1,7 @@ /* * polygon.h * - * + * Polygon. */ #ifndef _OpenAPI_polygon_H_ diff --git a/lib/sbi/openapi/model/port_management_container.h b/lib/sbi/openapi/model/port_management_container.h index d561ff3b2..862420215 100644 --- a/lib/sbi/openapi/model/port_management_container.h +++ b/lib/sbi/openapi/model/port_management_container.h @@ -1,7 +1,7 @@ /* * port_management_container.h * - * + * Contains the port management information container for a port. */ #ifndef _OpenAPI_port_management_container_H_ diff --git a/lib/sbi/openapi/model/pp_data.c b/lib/sbi/openapi/model/pp_data.c index 88f2d5510..9a7348065 100644 --- a/lib/sbi/openapi/model/pp_data.c +++ b/lib/sbi/openapi/model/pp_data.c @@ -12,7 +12,8 @@ OpenAPI_pp_data_t *OpenAPI_pp_data_create( OpenAPI_acs_info_rm_t *acs_info, char *stn_sr, OpenAPI_lcs_privacy_t *lcs_privacy, - OpenAPI_sor_info_t *sor_info + OpenAPI_sor_info_t *sor_info, + OpenAPI_model_5_mbs_authorization_info_t *_5mbs_authorization_info ) { OpenAPI_pp_data_t *pp_data_local_var = ogs_malloc(sizeof(OpenAPI_pp_data_t)); @@ -26,6 +27,7 @@ OpenAPI_pp_data_t *OpenAPI_pp_data_create( pp_data_local_var->stn_sr = stn_sr; pp_data_local_var->lcs_privacy = lcs_privacy; pp_data_local_var->sor_info = sor_info; + pp_data_local_var->_5mbs_authorization_info = _5mbs_authorization_info; return pp_data_local_var; } @@ -69,6 +71,10 @@ void OpenAPI_pp_data_free(OpenAPI_pp_data_t *pp_data) OpenAPI_sor_info_free(pp_data->sor_info); pp_data->sor_info = NULL; } + if (pp_data->_5mbs_authorization_info) { + OpenAPI_model_5_mbs_authorization_info_free(pp_data->_5mbs_authorization_info); + pp_data->_5mbs_authorization_info = NULL; + } ogs_free(pp_data); } @@ -175,6 +181,19 @@ cJSON *OpenAPI_pp_data_convertToJSON(OpenAPI_pp_data_t *pp_data) } } + if (pp_data->_5mbs_authorization_info) { + cJSON *_5mbs_authorization_info_local_JSON = OpenAPI_model_5_mbs_authorization_info_convertToJSON(pp_data->_5mbs_authorization_info); + if (_5mbs_authorization_info_local_JSON == NULL) { + ogs_error("OpenAPI_pp_data_convertToJSON() failed [_5mbs_authorization_info]"); + goto end; + } + cJSON_AddItemToObject(item, "5mbsAuthorizationInfo", _5mbs_authorization_info_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_pp_data_convertToJSON() failed [_5mbs_authorization_info]"); + goto end; + } + } + end: return item; } @@ -197,6 +216,8 @@ OpenAPI_pp_data_t *OpenAPI_pp_data_parseFromJSON(cJSON *pp_dataJSON) OpenAPI_lcs_privacy_t *lcs_privacy_local_nonprim = NULL; cJSON *sor_info = NULL; OpenAPI_sor_info_t *sor_info_local_nonprim = NULL; + cJSON *_5mbs_authorization_info = NULL; + OpenAPI_model_5_mbs_authorization_info_t *_5mbs_authorization_info_local_nonprim = NULL; communication_characteristics = cJSON_GetObjectItemCaseSensitive(pp_dataJSON, "communicationCharacteristics"); if (communication_characteristics) { communication_characteristics_local_nonprim = OpenAPI_communication_characteristics_parseFromJSON(communication_characteristics); @@ -243,6 +264,11 @@ OpenAPI_pp_data_t *OpenAPI_pp_data_parseFromJSON(cJSON *pp_dataJSON) sor_info_local_nonprim = OpenAPI_sor_info_parseFromJSON(sor_info); } + _5mbs_authorization_info = cJSON_GetObjectItemCaseSensitive(pp_dataJSON, "5mbsAuthorizationInfo"); + if (_5mbs_authorization_info) { + _5mbs_authorization_info_local_nonprim = OpenAPI_model_5_mbs_authorization_info_parseFromJSON(_5mbs_authorization_info); + } + pp_data_local_var = OpenAPI_pp_data_create ( communication_characteristics ? communication_characteristics_local_nonprim : NULL, supported_features && !cJSON_IsNull(supported_features) ? ogs_strdup(supported_features->valuestring) : NULL, @@ -251,7 +277,8 @@ OpenAPI_pp_data_t *OpenAPI_pp_data_parseFromJSON(cJSON *pp_dataJSON) acs_info ? acs_info_local_nonprim : NULL, stn_sr && !cJSON_IsNull(stn_sr) ? ogs_strdup(stn_sr->valuestring) : NULL, lcs_privacy ? lcs_privacy_local_nonprim : NULL, - sor_info ? sor_info_local_nonprim : NULL + sor_info ? sor_info_local_nonprim : NULL, + _5mbs_authorization_info ? _5mbs_authorization_info_local_nonprim : NULL ); return pp_data_local_var; @@ -280,6 +307,10 @@ end: OpenAPI_sor_info_free(sor_info_local_nonprim); sor_info_local_nonprim = NULL; } + if (_5mbs_authorization_info_local_nonprim) { + OpenAPI_model_5_mbs_authorization_info_free(_5mbs_authorization_info_local_nonprim); + _5mbs_authorization_info_local_nonprim = NULL; + } return NULL; } diff --git a/lib/sbi/openapi/model/pp_data.h b/lib/sbi/openapi/model/pp_data.h index 1251c4695..240dc951e 100644 --- a/lib/sbi/openapi/model/pp_data.h +++ b/lib/sbi/openapi/model/pp_data.h @@ -17,6 +17,7 @@ #include "ec_restriction.h" #include "expected_ue_behaviour.h" #include "lcs_privacy.h" +#include "model_5_mbs_authorization_info.h" #include "sor_info.h" #ifdef __cplusplus @@ -33,6 +34,7 @@ typedef struct OpenAPI_pp_data_s { char *stn_sr; struct OpenAPI_lcs_privacy_s *lcs_privacy; struct OpenAPI_sor_info_s *sor_info; + struct OpenAPI_model_5_mbs_authorization_info_s *_5mbs_authorization_info; } OpenAPI_pp_data_t; OpenAPI_pp_data_t *OpenAPI_pp_data_create( @@ -43,7 +45,8 @@ OpenAPI_pp_data_t *OpenAPI_pp_data_create( OpenAPI_acs_info_rm_t *acs_info, char *stn_sr, OpenAPI_lcs_privacy_t *lcs_privacy, - OpenAPI_sor_info_t *sor_info + OpenAPI_sor_info_t *sor_info, + OpenAPI_model_5_mbs_authorization_info_t *_5mbs_authorization_info ); void OpenAPI_pp_data_free(OpenAPI_pp_data_t *pp_data); OpenAPI_pp_data_t *OpenAPI_pp_data_parseFromJSON(cJSON *pp_dataJSON); diff --git a/lib/sbi/openapi/model/pp_data_entry.c b/lib/sbi/openapi/model/pp_data_entry.c new file mode 100644 index 000000000..baab53966 --- /dev/null +++ b/lib/sbi/openapi/model/pp_data_entry.c @@ -0,0 +1,331 @@ + +#include +#include +#include +#include "pp_data_entry.h" + +OpenAPI_pp_data_entry_t *OpenAPI_pp_data_entry_create( + OpenAPI_communication_characteristics_af_t *communication_characteristics, + bool is_reference_id, + int reference_id, + char *validity_time, + char *mtc_provider_information, + char *supported_features, + OpenAPI_ecs_addr_config_info_1_t *ecs_addr_config_info, + OpenAPI_list_t *additional_ecs_addr_config_infos, + OpenAPI_ec_restriction_1_t *ec_restriction +) +{ + OpenAPI_pp_data_entry_t *pp_data_entry_local_var = ogs_malloc(sizeof(OpenAPI_pp_data_entry_t)); + ogs_assert(pp_data_entry_local_var); + + pp_data_entry_local_var->communication_characteristics = communication_characteristics; + pp_data_entry_local_var->is_reference_id = is_reference_id; + pp_data_entry_local_var->reference_id = reference_id; + pp_data_entry_local_var->validity_time = validity_time; + pp_data_entry_local_var->mtc_provider_information = mtc_provider_information; + pp_data_entry_local_var->supported_features = supported_features; + pp_data_entry_local_var->ecs_addr_config_info = ecs_addr_config_info; + pp_data_entry_local_var->additional_ecs_addr_config_infos = additional_ecs_addr_config_infos; + pp_data_entry_local_var->ec_restriction = ec_restriction; + + return pp_data_entry_local_var; +} + +void OpenAPI_pp_data_entry_free(OpenAPI_pp_data_entry_t *pp_data_entry) +{ + OpenAPI_lnode_t *node = NULL; + + if (NULL == pp_data_entry) { + return; + } + if (pp_data_entry->communication_characteristics) { + OpenAPI_communication_characteristics_af_free(pp_data_entry->communication_characteristics); + pp_data_entry->communication_characteristics = NULL; + } + if (pp_data_entry->validity_time) { + ogs_free(pp_data_entry->validity_time); + pp_data_entry->validity_time = NULL; + } + if (pp_data_entry->mtc_provider_information) { + ogs_free(pp_data_entry->mtc_provider_information); + pp_data_entry->mtc_provider_information = NULL; + } + if (pp_data_entry->supported_features) { + ogs_free(pp_data_entry->supported_features); + pp_data_entry->supported_features = NULL; + } + if (pp_data_entry->ecs_addr_config_info) { + OpenAPI_ecs_addr_config_info_1_free(pp_data_entry->ecs_addr_config_info); + pp_data_entry->ecs_addr_config_info = NULL; + } + if (pp_data_entry->additional_ecs_addr_config_infos) { + OpenAPI_list_for_each(pp_data_entry->additional_ecs_addr_config_infos, node) { + OpenAPI_ecs_addr_config_info_1_free(node->data); + } + OpenAPI_list_free(pp_data_entry->additional_ecs_addr_config_infos); + pp_data_entry->additional_ecs_addr_config_infos = NULL; + } + if (pp_data_entry->ec_restriction) { + OpenAPI_ec_restriction_1_free(pp_data_entry->ec_restriction); + pp_data_entry->ec_restriction = NULL; + } + ogs_free(pp_data_entry); +} + +cJSON *OpenAPI_pp_data_entry_convertToJSON(OpenAPI_pp_data_entry_t *pp_data_entry) +{ + cJSON *item = NULL; + OpenAPI_lnode_t *node = NULL; + + if (pp_data_entry == NULL) { + ogs_error("OpenAPI_pp_data_entry_convertToJSON() failed [PpDataEntry]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (pp_data_entry->communication_characteristics) { + cJSON *communication_characteristics_local_JSON = OpenAPI_communication_characteristics_af_convertToJSON(pp_data_entry->communication_characteristics); + if (communication_characteristics_local_JSON == NULL) { + ogs_error("OpenAPI_pp_data_entry_convertToJSON() failed [communication_characteristics]"); + goto end; + } + cJSON_AddItemToObject(item, "communicationCharacteristics", communication_characteristics_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_pp_data_entry_convertToJSON() failed [communication_characteristics]"); + goto end; + } + } + + if (pp_data_entry->is_reference_id) { + if (cJSON_AddNumberToObject(item, "referenceId", pp_data_entry->reference_id) == NULL) { + ogs_error("OpenAPI_pp_data_entry_convertToJSON() failed [reference_id]"); + goto end; + } + } + + if (pp_data_entry->validity_time) { + if (cJSON_AddStringToObject(item, "validityTime", pp_data_entry->validity_time) == NULL) { + ogs_error("OpenAPI_pp_data_entry_convertToJSON() failed [validity_time]"); + goto end; + } + } + + if (pp_data_entry->mtc_provider_information) { + if (cJSON_AddStringToObject(item, "mtcProviderInformation", pp_data_entry->mtc_provider_information) == NULL) { + ogs_error("OpenAPI_pp_data_entry_convertToJSON() failed [mtc_provider_information]"); + goto end; + } + } + + if (pp_data_entry->supported_features) { + if (cJSON_AddStringToObject(item, "supportedFeatures", pp_data_entry->supported_features) == NULL) { + ogs_error("OpenAPI_pp_data_entry_convertToJSON() failed [supported_features]"); + goto end; + } + } + + if (pp_data_entry->ecs_addr_config_info) { + cJSON *ecs_addr_config_info_local_JSON = OpenAPI_ecs_addr_config_info_1_convertToJSON(pp_data_entry->ecs_addr_config_info); + if (ecs_addr_config_info_local_JSON == NULL) { + ogs_error("OpenAPI_pp_data_entry_convertToJSON() failed [ecs_addr_config_info]"); + goto end; + } + cJSON_AddItemToObject(item, "ecsAddrConfigInfo", ecs_addr_config_info_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_pp_data_entry_convertToJSON() failed [ecs_addr_config_info]"); + goto end; + } + } + + if (pp_data_entry->additional_ecs_addr_config_infos) { + cJSON *additional_ecs_addr_config_infosList = cJSON_AddArrayToObject(item, "additionalEcsAddrConfigInfos"); + if (additional_ecs_addr_config_infosList == NULL) { + ogs_error("OpenAPI_pp_data_entry_convertToJSON() failed [additional_ecs_addr_config_infos]"); + goto end; + } + OpenAPI_list_for_each(pp_data_entry->additional_ecs_addr_config_infos, node) { + cJSON *itemLocal = OpenAPI_ecs_addr_config_info_1_convertToJSON(node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_pp_data_entry_convertToJSON() failed [additional_ecs_addr_config_infos]"); + goto end; + } + cJSON_AddItemToArray(additional_ecs_addr_config_infosList, itemLocal); + } + } + + if (pp_data_entry->ec_restriction) { + cJSON *ec_restriction_local_JSON = OpenAPI_ec_restriction_1_convertToJSON(pp_data_entry->ec_restriction); + if (ec_restriction_local_JSON == NULL) { + ogs_error("OpenAPI_pp_data_entry_convertToJSON() failed [ec_restriction]"); + goto end; + } + cJSON_AddItemToObject(item, "ecRestriction", ec_restriction_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_pp_data_entry_convertToJSON() failed [ec_restriction]"); + goto end; + } + } + +end: + return item; +} + +OpenAPI_pp_data_entry_t *OpenAPI_pp_data_entry_parseFromJSON(cJSON *pp_data_entryJSON) +{ + OpenAPI_pp_data_entry_t *pp_data_entry_local_var = NULL; + OpenAPI_lnode_t *node = NULL; + cJSON *communication_characteristics = NULL; + OpenAPI_communication_characteristics_af_t *communication_characteristics_local_nonprim = NULL; + cJSON *reference_id = NULL; + cJSON *validity_time = NULL; + cJSON *mtc_provider_information = NULL; + cJSON *supported_features = NULL; + cJSON *ecs_addr_config_info = NULL; + OpenAPI_ecs_addr_config_info_1_t *ecs_addr_config_info_local_nonprim = NULL; + cJSON *additional_ecs_addr_config_infos = NULL; + OpenAPI_list_t *additional_ecs_addr_config_infosList = NULL; + cJSON *ec_restriction = NULL; + OpenAPI_ec_restriction_1_t *ec_restriction_local_nonprim = NULL; + communication_characteristics = cJSON_GetObjectItemCaseSensitive(pp_data_entryJSON, "communicationCharacteristics"); + if (communication_characteristics) { + communication_characteristics_local_nonprim = OpenAPI_communication_characteristics_af_parseFromJSON(communication_characteristics); + } + + reference_id = cJSON_GetObjectItemCaseSensitive(pp_data_entryJSON, "referenceId"); + if (reference_id) { + if (!cJSON_IsNumber(reference_id)) { + ogs_error("OpenAPI_pp_data_entry_parseFromJSON() failed [reference_id]"); + goto end; + } + } + + validity_time = cJSON_GetObjectItemCaseSensitive(pp_data_entryJSON, "validityTime"); + if (validity_time) { + if (!cJSON_IsString(validity_time) && !cJSON_IsNull(validity_time)) { + ogs_error("OpenAPI_pp_data_entry_parseFromJSON() failed [validity_time]"); + goto end; + } + } + + mtc_provider_information = cJSON_GetObjectItemCaseSensitive(pp_data_entryJSON, "mtcProviderInformation"); + if (mtc_provider_information) { + if (!cJSON_IsString(mtc_provider_information) && !cJSON_IsNull(mtc_provider_information)) { + ogs_error("OpenAPI_pp_data_entry_parseFromJSON() failed [mtc_provider_information]"); + goto end; + } + } + + supported_features = cJSON_GetObjectItemCaseSensitive(pp_data_entryJSON, "supportedFeatures"); + if (supported_features) { + if (!cJSON_IsString(supported_features) && !cJSON_IsNull(supported_features)) { + ogs_error("OpenAPI_pp_data_entry_parseFromJSON() failed [supported_features]"); + goto end; + } + } + + ecs_addr_config_info = cJSON_GetObjectItemCaseSensitive(pp_data_entryJSON, "ecsAddrConfigInfo"); + if (ecs_addr_config_info) { + ecs_addr_config_info_local_nonprim = OpenAPI_ecs_addr_config_info_1_parseFromJSON(ecs_addr_config_info); + } + + additional_ecs_addr_config_infos = cJSON_GetObjectItemCaseSensitive(pp_data_entryJSON, "additionalEcsAddrConfigInfos"); + if (additional_ecs_addr_config_infos) { + cJSON *additional_ecs_addr_config_infos_local = NULL; + if (!cJSON_IsArray(additional_ecs_addr_config_infos)) { + ogs_error("OpenAPI_pp_data_entry_parseFromJSON() failed [additional_ecs_addr_config_infos]"); + goto end; + } + + additional_ecs_addr_config_infosList = OpenAPI_list_create(); + + cJSON_ArrayForEach(additional_ecs_addr_config_infos_local, additional_ecs_addr_config_infos) { + if (!cJSON_IsObject(additional_ecs_addr_config_infos_local)) { + ogs_error("OpenAPI_pp_data_entry_parseFromJSON() failed [additional_ecs_addr_config_infos]"); + goto end; + } + OpenAPI_ecs_addr_config_info_1_t *additional_ecs_addr_config_infosItem = OpenAPI_ecs_addr_config_info_1_parseFromJSON(additional_ecs_addr_config_infos_local); + if (!additional_ecs_addr_config_infosItem) { + ogs_error("No additional_ecs_addr_config_infosItem"); + OpenAPI_list_free(additional_ecs_addr_config_infosList); + goto end; + } + OpenAPI_list_add(additional_ecs_addr_config_infosList, additional_ecs_addr_config_infosItem); + } + } + + ec_restriction = cJSON_GetObjectItemCaseSensitive(pp_data_entryJSON, "ecRestriction"); + if (ec_restriction) { + ec_restriction_local_nonprim = OpenAPI_ec_restriction_1_parseFromJSON(ec_restriction); + } + + pp_data_entry_local_var = OpenAPI_pp_data_entry_create ( + communication_characteristics ? communication_characteristics_local_nonprim : NULL, + reference_id ? true : false, + reference_id ? reference_id->valuedouble : 0, + validity_time && !cJSON_IsNull(validity_time) ? ogs_strdup(validity_time->valuestring) : NULL, + mtc_provider_information && !cJSON_IsNull(mtc_provider_information) ? ogs_strdup(mtc_provider_information->valuestring) : NULL, + supported_features && !cJSON_IsNull(supported_features) ? ogs_strdup(supported_features->valuestring) : NULL, + ecs_addr_config_info ? ecs_addr_config_info_local_nonprim : NULL, + additional_ecs_addr_config_infos ? additional_ecs_addr_config_infosList : NULL, + ec_restriction ? ec_restriction_local_nonprim : NULL + ); + + return pp_data_entry_local_var; +end: + if (communication_characteristics_local_nonprim) { + OpenAPI_communication_characteristics_af_free(communication_characteristics_local_nonprim); + communication_characteristics_local_nonprim = NULL; + } + if (ecs_addr_config_info_local_nonprim) { + OpenAPI_ecs_addr_config_info_1_free(ecs_addr_config_info_local_nonprim); + ecs_addr_config_info_local_nonprim = NULL; + } + if (additional_ecs_addr_config_infosList) { + OpenAPI_list_for_each(additional_ecs_addr_config_infosList, node) { + OpenAPI_ecs_addr_config_info_1_free(node->data); + } + OpenAPI_list_free(additional_ecs_addr_config_infosList); + additional_ecs_addr_config_infosList = NULL; + } + if (ec_restriction_local_nonprim) { + OpenAPI_ec_restriction_1_free(ec_restriction_local_nonprim); + ec_restriction_local_nonprim = NULL; + } + return NULL; +} + +OpenAPI_pp_data_entry_t *OpenAPI_pp_data_entry_copy(OpenAPI_pp_data_entry_t *dst, OpenAPI_pp_data_entry_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_pp_data_entry_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_pp_data_entry_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_pp_data_entry_free(dst); + dst = OpenAPI_pp_data_entry_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/pp_data_entry.h b/lib/sbi/openapi/model/pp_data_entry.h new file mode 100644 index 000000000..a46df87dc --- /dev/null +++ b/lib/sbi/openapi/model/pp_data_entry.h @@ -0,0 +1,57 @@ +/* + * pp_data_entry.h + * + * + */ + +#ifndef _OpenAPI_pp_data_entry_H_ +#define _OpenAPI_pp_data_entry_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "communication_characteristics_af.h" +#include "ec_restriction_1.h" +#include "ecs_addr_config_info_1.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_pp_data_entry_s OpenAPI_pp_data_entry_t; +typedef struct OpenAPI_pp_data_entry_s { + struct OpenAPI_communication_characteristics_af_s *communication_characteristics; + bool is_reference_id; + int reference_id; + char *validity_time; + char *mtc_provider_information; + char *supported_features; + struct OpenAPI_ecs_addr_config_info_1_s *ecs_addr_config_info; + OpenAPI_list_t *additional_ecs_addr_config_infos; + struct OpenAPI_ec_restriction_1_s *ec_restriction; +} OpenAPI_pp_data_entry_t; + +OpenAPI_pp_data_entry_t *OpenAPI_pp_data_entry_create( + OpenAPI_communication_characteristics_af_t *communication_characteristics, + bool is_reference_id, + int reference_id, + char *validity_time, + char *mtc_provider_information, + char *supported_features, + OpenAPI_ecs_addr_config_info_1_t *ecs_addr_config_info, + OpenAPI_list_t *additional_ecs_addr_config_infos, + OpenAPI_ec_restriction_1_t *ec_restriction +); +void OpenAPI_pp_data_entry_free(OpenAPI_pp_data_entry_t *pp_data_entry); +OpenAPI_pp_data_entry_t *OpenAPI_pp_data_entry_parseFromJSON(cJSON *pp_data_entryJSON); +cJSON *OpenAPI_pp_data_entry_convertToJSON(OpenAPI_pp_data_entry_t *pp_data_entry); +OpenAPI_pp_data_entry_t *OpenAPI_pp_data_entry_copy(OpenAPI_pp_data_entry_t *dst, OpenAPI_pp_data_entry_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_pp_data_entry_H_ */ + diff --git a/lib/sbi/openapi/model/pp_data_entry_list.c b/lib/sbi/openapi/model/pp_data_entry_list.c new file mode 100644 index 000000000..a1f567a29 --- /dev/null +++ b/lib/sbi/openapi/model/pp_data_entry_list.c @@ -0,0 +1,170 @@ + +#include +#include +#include +#include "pp_data_entry_list.h" + +OpenAPI_pp_data_entry_list_t *OpenAPI_pp_data_entry_list_create( + OpenAPI_list_t *pp_data_entry_list, + char *supported_features +) +{ + OpenAPI_pp_data_entry_list_t *pp_data_entry_list_local_var = ogs_malloc(sizeof(OpenAPI_pp_data_entry_list_t)); + ogs_assert(pp_data_entry_list_local_var); + + pp_data_entry_list_local_var->pp_data_entry_list = pp_data_entry_list; + pp_data_entry_list_local_var->supported_features = supported_features; + + return pp_data_entry_list_local_var; +} + +void OpenAPI_pp_data_entry_list_free(OpenAPI_pp_data_entry_list_t *pp_data_entry_list) +{ + OpenAPI_lnode_t *node = NULL; + + if (NULL == pp_data_entry_list) { + return; + } + if (pp_data_entry_list->pp_data_entry_list) { + OpenAPI_list_for_each(pp_data_entry_list->pp_data_entry_list, node) { + OpenAPI_pp_data_entry_free(node->data); + } + OpenAPI_list_free(pp_data_entry_list->pp_data_entry_list); + pp_data_entry_list->pp_data_entry_list = NULL; + } + if (pp_data_entry_list->supported_features) { + ogs_free(pp_data_entry_list->supported_features); + pp_data_entry_list->supported_features = NULL; + } + ogs_free(pp_data_entry_list); +} + +cJSON *OpenAPI_pp_data_entry_list_convertToJSON(OpenAPI_pp_data_entry_list_t *pp_data_entry_list) +{ + cJSON *item = NULL; + OpenAPI_lnode_t *node = NULL; + + if (pp_data_entry_list == NULL) { + ogs_error("OpenAPI_pp_data_entry_list_convertToJSON() failed [PpDataEntryList]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (pp_data_entry_list->pp_data_entry_list) { + cJSON *pp_data_entry_listList = cJSON_AddArrayToObject(item, "ppDataEntryList"); + if (pp_data_entry_listList == NULL) { + ogs_error("OpenAPI_pp_data_entry_list_convertToJSON() failed [pp_data_entry_list]"); + goto end; + } + OpenAPI_list_for_each(pp_data_entry_list->pp_data_entry_list, node) { + cJSON *itemLocal = OpenAPI_pp_data_entry_convertToJSON(node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_pp_data_entry_list_convertToJSON() failed [pp_data_entry_list]"); + goto end; + } + cJSON_AddItemToArray(pp_data_entry_listList, itemLocal); + } + } + + if (pp_data_entry_list->supported_features) { + if (cJSON_AddStringToObject(item, "supportedFeatures", pp_data_entry_list->supported_features) == NULL) { + ogs_error("OpenAPI_pp_data_entry_list_convertToJSON() failed [supported_features]"); + goto end; + } + } + +end: + return item; +} + +OpenAPI_pp_data_entry_list_t *OpenAPI_pp_data_entry_list_parseFromJSON(cJSON *pp_data_entry_listJSON) +{ + OpenAPI_pp_data_entry_list_t *pp_data_entry_list_local_var = NULL; + OpenAPI_lnode_t *node = NULL; + cJSON *pp_data_entry_list = NULL; + OpenAPI_list_t *pp_data_entry_listList = NULL; + cJSON *supported_features = NULL; + pp_data_entry_list = cJSON_GetObjectItemCaseSensitive(pp_data_entry_listJSON, "ppDataEntryList"); + if (pp_data_entry_list) { + cJSON *pp_data_entry_list_local = NULL; + if (!cJSON_IsArray(pp_data_entry_list)) { + ogs_error("OpenAPI_pp_data_entry_list_parseFromJSON() failed [pp_data_entry_list]"); + goto end; + } + + pp_data_entry_listList = OpenAPI_list_create(); + + cJSON_ArrayForEach(pp_data_entry_list_local, pp_data_entry_list) { + if (!cJSON_IsObject(pp_data_entry_list_local)) { + ogs_error("OpenAPI_pp_data_entry_list_parseFromJSON() failed [pp_data_entry_list]"); + goto end; + } + OpenAPI_pp_data_entry_t *pp_data_entry_listItem = OpenAPI_pp_data_entry_parseFromJSON(pp_data_entry_list_local); + if (!pp_data_entry_listItem) { + ogs_error("No pp_data_entry_listItem"); + OpenAPI_list_free(pp_data_entry_listList); + goto end; + } + OpenAPI_list_add(pp_data_entry_listList, pp_data_entry_listItem); + } + } + + supported_features = cJSON_GetObjectItemCaseSensitive(pp_data_entry_listJSON, "supportedFeatures"); + if (supported_features) { + if (!cJSON_IsString(supported_features) && !cJSON_IsNull(supported_features)) { + ogs_error("OpenAPI_pp_data_entry_list_parseFromJSON() failed [supported_features]"); + goto end; + } + } + + pp_data_entry_list_local_var = OpenAPI_pp_data_entry_list_create ( + pp_data_entry_list ? pp_data_entry_listList : NULL, + supported_features && !cJSON_IsNull(supported_features) ? ogs_strdup(supported_features->valuestring) : NULL + ); + + return pp_data_entry_list_local_var; +end: + if (pp_data_entry_listList) { + OpenAPI_list_for_each(pp_data_entry_listList, node) { + OpenAPI_pp_data_entry_free(node->data); + } + OpenAPI_list_free(pp_data_entry_listList); + pp_data_entry_listList = NULL; + } + return NULL; +} + +OpenAPI_pp_data_entry_list_t *OpenAPI_pp_data_entry_list_copy(OpenAPI_pp_data_entry_list_t *dst, OpenAPI_pp_data_entry_list_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_pp_data_entry_list_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_pp_data_entry_list_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_pp_data_entry_list_free(dst); + dst = OpenAPI_pp_data_entry_list_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/pp_data_entry_list.h b/lib/sbi/openapi/model/pp_data_entry_list.h new file mode 100644 index 000000000..6ca843e39 --- /dev/null +++ b/lib/sbi/openapi/model/pp_data_entry_list.h @@ -0,0 +1,41 @@ +/* + * pp_data_entry_list.h + * + * Contains a list of the Provisioned Parameters entries + */ + +#ifndef _OpenAPI_pp_data_entry_list_H_ +#define _OpenAPI_pp_data_entry_list_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "pp_data_entry.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_pp_data_entry_list_s OpenAPI_pp_data_entry_list_t; +typedef struct OpenAPI_pp_data_entry_list_s { + OpenAPI_list_t *pp_data_entry_list; + char *supported_features; +} OpenAPI_pp_data_entry_list_t; + +OpenAPI_pp_data_entry_list_t *OpenAPI_pp_data_entry_list_create( + OpenAPI_list_t *pp_data_entry_list, + char *supported_features +); +void OpenAPI_pp_data_entry_list_free(OpenAPI_pp_data_entry_list_t *pp_data_entry_list); +OpenAPI_pp_data_entry_list_t *OpenAPI_pp_data_entry_list_parseFromJSON(cJSON *pp_data_entry_listJSON); +cJSON *OpenAPI_pp_data_entry_list_convertToJSON(OpenAPI_pp_data_entry_list_t *pp_data_entry_list); +OpenAPI_pp_data_entry_list_t *OpenAPI_pp_data_entry_list_copy(OpenAPI_pp_data_entry_list_t *dst, OpenAPI_pp_data_entry_list_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_pp_data_entry_list_H_ */ + diff --git a/lib/sbi/openapi/model/pp_dl_packet_count_ext.c b/lib/sbi/openapi/model/pp_dl_packet_count_ext.c index 9cb929a0b..37964625d 100644 --- a/lib/sbi/openapi/model/pp_dl_packet_count_ext.c +++ b/lib/sbi/openapi/model/pp_dl_packet_count_ext.c @@ -7,6 +7,8 @@ OpenAPI_pp_dl_packet_count_ext_t *OpenAPI_pp_dl_packet_count_ext_create( char *af_instance_id, int reference_id, + char *dnn, + OpenAPI_snssai_t *single_nssai, char *validity_time, char *mtc_provider_information ) @@ -16,6 +18,8 @@ OpenAPI_pp_dl_packet_count_ext_t *OpenAPI_pp_dl_packet_count_ext_create( pp_dl_packet_count_ext_local_var->af_instance_id = af_instance_id; pp_dl_packet_count_ext_local_var->reference_id = reference_id; + pp_dl_packet_count_ext_local_var->dnn = dnn; + pp_dl_packet_count_ext_local_var->single_nssai = single_nssai; pp_dl_packet_count_ext_local_var->validity_time = validity_time; pp_dl_packet_count_ext_local_var->mtc_provider_information = mtc_provider_information; @@ -33,6 +37,14 @@ void OpenAPI_pp_dl_packet_count_ext_free(OpenAPI_pp_dl_packet_count_ext_t *pp_dl ogs_free(pp_dl_packet_count_ext->af_instance_id); pp_dl_packet_count_ext->af_instance_id = NULL; } + if (pp_dl_packet_count_ext->dnn) { + ogs_free(pp_dl_packet_count_ext->dnn); + pp_dl_packet_count_ext->dnn = NULL; + } + if (pp_dl_packet_count_ext->single_nssai) { + OpenAPI_snssai_free(pp_dl_packet_count_ext->single_nssai); + pp_dl_packet_count_ext->single_nssai = NULL; + } if (pp_dl_packet_count_ext->validity_time) { ogs_free(pp_dl_packet_count_ext->validity_time); pp_dl_packet_count_ext->validity_time = NULL; @@ -69,6 +81,26 @@ cJSON *OpenAPI_pp_dl_packet_count_ext_convertToJSON(OpenAPI_pp_dl_packet_count_e goto end; } + if (pp_dl_packet_count_ext->dnn) { + if (cJSON_AddStringToObject(item, "dnn", pp_dl_packet_count_ext->dnn) == NULL) { + ogs_error("OpenAPI_pp_dl_packet_count_ext_convertToJSON() failed [dnn]"); + goto end; + } + } + + if (pp_dl_packet_count_ext->single_nssai) { + cJSON *single_nssai_local_JSON = OpenAPI_snssai_convertToJSON(pp_dl_packet_count_ext->single_nssai); + if (single_nssai_local_JSON == NULL) { + ogs_error("OpenAPI_pp_dl_packet_count_ext_convertToJSON() failed [single_nssai]"); + goto end; + } + cJSON_AddItemToObject(item, "singleNssai", single_nssai_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_pp_dl_packet_count_ext_convertToJSON() failed [single_nssai]"); + goto end; + } + } + if (pp_dl_packet_count_ext->validity_time) { if (cJSON_AddStringToObject(item, "validityTime", pp_dl_packet_count_ext->validity_time) == NULL) { ogs_error("OpenAPI_pp_dl_packet_count_ext_convertToJSON() failed [validity_time]"); @@ -93,6 +125,9 @@ OpenAPI_pp_dl_packet_count_ext_t *OpenAPI_pp_dl_packet_count_ext_parseFromJSON(c OpenAPI_lnode_t *node = NULL; cJSON *af_instance_id = NULL; cJSON *reference_id = NULL; + cJSON *dnn = NULL; + cJSON *single_nssai = NULL; + OpenAPI_snssai_t *single_nssai_local_nonprim = NULL; cJSON *validity_time = NULL; cJSON *mtc_provider_information = NULL; af_instance_id = cJSON_GetObjectItemCaseSensitive(pp_dl_packet_count_extJSON, "afInstanceId"); @@ -115,6 +150,19 @@ OpenAPI_pp_dl_packet_count_ext_t *OpenAPI_pp_dl_packet_count_ext_parseFromJSON(c goto end; } + dnn = cJSON_GetObjectItemCaseSensitive(pp_dl_packet_count_extJSON, "dnn"); + if (dnn) { + if (!cJSON_IsString(dnn) && !cJSON_IsNull(dnn)) { + ogs_error("OpenAPI_pp_dl_packet_count_ext_parseFromJSON() failed [dnn]"); + goto end; + } + } + + single_nssai = cJSON_GetObjectItemCaseSensitive(pp_dl_packet_count_extJSON, "singleNssai"); + if (single_nssai) { + single_nssai_local_nonprim = OpenAPI_snssai_parseFromJSON(single_nssai); + } + validity_time = cJSON_GetObjectItemCaseSensitive(pp_dl_packet_count_extJSON, "validityTime"); if (validity_time) { if (!cJSON_IsString(validity_time) && !cJSON_IsNull(validity_time)) { @@ -135,12 +183,18 @@ OpenAPI_pp_dl_packet_count_ext_t *OpenAPI_pp_dl_packet_count_ext_parseFromJSON(c ogs_strdup(af_instance_id->valuestring), reference_id->valuedouble, + dnn && !cJSON_IsNull(dnn) ? ogs_strdup(dnn->valuestring) : NULL, + single_nssai ? single_nssai_local_nonprim : NULL, validity_time && !cJSON_IsNull(validity_time) ? ogs_strdup(validity_time->valuestring) : NULL, mtc_provider_information && !cJSON_IsNull(mtc_provider_information) ? ogs_strdup(mtc_provider_information->valuestring) : NULL ); return pp_dl_packet_count_ext_local_var; end: + if (single_nssai_local_nonprim) { + OpenAPI_snssai_free(single_nssai_local_nonprim); + single_nssai_local_nonprim = NULL; + } return NULL; } diff --git a/lib/sbi/openapi/model/pp_dl_packet_count_ext.h b/lib/sbi/openapi/model/pp_dl_packet_count_ext.h index 1c084d7b3..21269a45b 100644 --- a/lib/sbi/openapi/model/pp_dl_packet_count_ext.h +++ b/lib/sbi/openapi/model/pp_dl_packet_count_ext.h @@ -12,6 +12,7 @@ #include "../include/list.h" #include "../include/keyValuePair.h" #include "../include/binary.h" +#include "snssai.h" #ifdef __cplusplus extern "C" { @@ -21,6 +22,8 @@ typedef struct OpenAPI_pp_dl_packet_count_ext_s OpenAPI_pp_dl_packet_count_ext_t typedef struct OpenAPI_pp_dl_packet_count_ext_s { char *af_instance_id; int reference_id; + char *dnn; + struct OpenAPI_snssai_s *single_nssai; char *validity_time; char *mtc_provider_information; } OpenAPI_pp_dl_packet_count_ext_t; @@ -28,6 +31,8 @@ typedef struct OpenAPI_pp_dl_packet_count_ext_s { OpenAPI_pp_dl_packet_count_ext_t *OpenAPI_pp_dl_packet_count_ext_create( char *af_instance_id, int reference_id, + char *dnn, + OpenAPI_snssai_t *single_nssai, char *validity_time, char *mtc_provider_information ); diff --git a/lib/sbi/openapi/model/preemption_capability_rm.h b/lib/sbi/openapi/model/preemption_capability_rm.h index 7bbd68d74..1b4144f2f 100644 --- a/lib/sbi/openapi/model/preemption_capability_rm.h +++ b/lib/sbi/openapi/model/preemption_capability_rm.h @@ -1,7 +1,7 @@ /* * preemption_capability_rm.h * - * + * This enumeration is defined in the same way as the 'PreemptionCapability' enumeration, but with the OpenAPI 'nullable: true' property. */ #ifndef _OpenAPI_preemption_capability_rm_H_ diff --git a/lib/sbi/openapi/model/preemption_control_information_rm.h b/lib/sbi/openapi/model/preemption_control_information_rm.h index f9262f3e8..ab8580bff 100644 --- a/lib/sbi/openapi/model/preemption_control_information_rm.h +++ b/lib/sbi/openapi/model/preemption_control_information_rm.h @@ -1,7 +1,7 @@ /* * preemption_control_information_rm.h * - * + * This data type is defined in the same way as the PreemptionControlInformation data type, but with the OpenAPI nullable property set to true. */ #ifndef _OpenAPI_preemption_control_information_rm_H_ diff --git a/lib/sbi/openapi/model/preemption_vulnerability_rm.h b/lib/sbi/openapi/model/preemption_vulnerability_rm.h index 5e8ffea27..d9b781b69 100644 --- a/lib/sbi/openapi/model/preemption_vulnerability_rm.h +++ b/lib/sbi/openapi/model/preemption_vulnerability_rm.h @@ -1,7 +1,7 @@ /* * preemption_vulnerability_rm.h * - * + * This enumeration is defined in the same way as the 'PreemptionVulnerability' enumeration, but with the OpenAPI 'nullable: true' property.\" */ #ifndef _OpenAPI_preemption_vulnerability_rm_H_ diff --git a/lib/sbi/openapi/model/preferred_search.c b/lib/sbi/openapi/model/preferred_search.c index 485e2c742..7349d8dd2 100644 --- a/lib/sbi/openapi/model/preferred_search.c +++ b/lib/sbi/openapi/model/preferred_search.c @@ -16,7 +16,15 @@ OpenAPI_preferred_search_t *OpenAPI_preferred_search_create( bool is_preferred_locality_match_ind, int preferred_locality_match_ind, bool is_other_locality_ind, - int other_locality_ind + int other_locality_ind, + bool is_preferred_vendor_specific_features_ind, + int preferred_vendor_specific_features_ind, + bool is_preferred_collocated_nf_type_ind, + int preferred_collocated_nf_type_ind, + bool is_preferred_pgw_match_ind, + int preferred_pgw_match_ind, + bool is_preferred_analytics_delays_ind, + int preferred_analytics_delays_ind ) { OpenAPI_preferred_search_t *preferred_search_local_var = ogs_malloc(sizeof(OpenAPI_preferred_search_t)); @@ -34,6 +42,14 @@ OpenAPI_preferred_search_t *OpenAPI_preferred_search_create( preferred_search_local_var->preferred_locality_match_ind = preferred_locality_match_ind; preferred_search_local_var->is_other_locality_ind = is_other_locality_ind; preferred_search_local_var->other_locality_ind = other_locality_ind; + preferred_search_local_var->is_preferred_vendor_specific_features_ind = is_preferred_vendor_specific_features_ind; + preferred_search_local_var->preferred_vendor_specific_features_ind = preferred_vendor_specific_features_ind; + preferred_search_local_var->is_preferred_collocated_nf_type_ind = is_preferred_collocated_nf_type_ind; + preferred_search_local_var->preferred_collocated_nf_type_ind = preferred_collocated_nf_type_ind; + preferred_search_local_var->is_preferred_pgw_match_ind = is_preferred_pgw_match_ind; + preferred_search_local_var->preferred_pgw_match_ind = preferred_pgw_match_ind; + preferred_search_local_var->is_preferred_analytics_delays_ind = is_preferred_analytics_delays_ind; + preferred_search_local_var->preferred_analytics_delays_ind = preferred_analytics_delays_ind; return preferred_search_local_var; } @@ -101,6 +117,34 @@ cJSON *OpenAPI_preferred_search_convertToJSON(OpenAPI_preferred_search_t *prefer } } + if (preferred_search->is_preferred_vendor_specific_features_ind) { + if (cJSON_AddBoolToObject(item, "preferredVendorSpecificFeaturesInd", preferred_search->preferred_vendor_specific_features_ind) == NULL) { + ogs_error("OpenAPI_preferred_search_convertToJSON() failed [preferred_vendor_specific_features_ind]"); + goto end; + } + } + + if (preferred_search->is_preferred_collocated_nf_type_ind) { + if (cJSON_AddBoolToObject(item, "preferredCollocatedNfTypeInd", preferred_search->preferred_collocated_nf_type_ind) == NULL) { + ogs_error("OpenAPI_preferred_search_convertToJSON() failed [preferred_collocated_nf_type_ind]"); + goto end; + } + } + + if (preferred_search->is_preferred_pgw_match_ind) { + if (cJSON_AddBoolToObject(item, "preferredPgwMatchInd", preferred_search->preferred_pgw_match_ind) == NULL) { + ogs_error("OpenAPI_preferred_search_convertToJSON() failed [preferred_pgw_match_ind]"); + goto end; + } + } + + if (preferred_search->is_preferred_analytics_delays_ind) { + if (cJSON_AddBoolToObject(item, "preferredAnalyticsDelaysInd", preferred_search->preferred_analytics_delays_ind) == NULL) { + ogs_error("OpenAPI_preferred_search_convertToJSON() failed [preferred_analytics_delays_ind]"); + goto end; + } + } + end: return item; } @@ -115,6 +159,10 @@ OpenAPI_preferred_search_t *OpenAPI_preferred_search_parseFromJSON(cJSON *prefer cJSON *other_api_versions_ind = NULL; cJSON *preferred_locality_match_ind = NULL; cJSON *other_locality_ind = NULL; + cJSON *preferred_vendor_specific_features_ind = NULL; + cJSON *preferred_collocated_nf_type_ind = NULL; + cJSON *preferred_pgw_match_ind = NULL; + cJSON *preferred_analytics_delays_ind = NULL; preferred_tai_match_ind = cJSON_GetObjectItemCaseSensitive(preferred_searchJSON, "preferredTaiMatchInd"); if (preferred_tai_match_ind) { if (!cJSON_IsBool(preferred_tai_match_ind)) { @@ -163,6 +211,38 @@ OpenAPI_preferred_search_t *OpenAPI_preferred_search_parseFromJSON(cJSON *prefer } } + preferred_vendor_specific_features_ind = cJSON_GetObjectItemCaseSensitive(preferred_searchJSON, "preferredVendorSpecificFeaturesInd"); + if (preferred_vendor_specific_features_ind) { + if (!cJSON_IsBool(preferred_vendor_specific_features_ind)) { + ogs_error("OpenAPI_preferred_search_parseFromJSON() failed [preferred_vendor_specific_features_ind]"); + goto end; + } + } + + preferred_collocated_nf_type_ind = cJSON_GetObjectItemCaseSensitive(preferred_searchJSON, "preferredCollocatedNfTypeInd"); + if (preferred_collocated_nf_type_ind) { + if (!cJSON_IsBool(preferred_collocated_nf_type_ind)) { + ogs_error("OpenAPI_preferred_search_parseFromJSON() failed [preferred_collocated_nf_type_ind]"); + goto end; + } + } + + preferred_pgw_match_ind = cJSON_GetObjectItemCaseSensitive(preferred_searchJSON, "preferredPgwMatchInd"); + if (preferred_pgw_match_ind) { + if (!cJSON_IsBool(preferred_pgw_match_ind)) { + ogs_error("OpenAPI_preferred_search_parseFromJSON() failed [preferred_pgw_match_ind]"); + goto end; + } + } + + preferred_analytics_delays_ind = cJSON_GetObjectItemCaseSensitive(preferred_searchJSON, "preferredAnalyticsDelaysInd"); + if (preferred_analytics_delays_ind) { + if (!cJSON_IsBool(preferred_analytics_delays_ind)) { + ogs_error("OpenAPI_preferred_search_parseFromJSON() failed [preferred_analytics_delays_ind]"); + goto end; + } + } + preferred_search_local_var = OpenAPI_preferred_search_create ( preferred_tai_match_ind ? true : false, preferred_tai_match_ind ? preferred_tai_match_ind->valueint : 0, @@ -175,7 +255,15 @@ OpenAPI_preferred_search_t *OpenAPI_preferred_search_parseFromJSON(cJSON *prefer preferred_locality_match_ind ? true : false, preferred_locality_match_ind ? preferred_locality_match_ind->valueint : 0, other_locality_ind ? true : false, - other_locality_ind ? other_locality_ind->valueint : 0 + other_locality_ind ? other_locality_ind->valueint : 0, + preferred_vendor_specific_features_ind ? true : false, + preferred_vendor_specific_features_ind ? preferred_vendor_specific_features_ind->valueint : 0, + preferred_collocated_nf_type_ind ? true : false, + preferred_collocated_nf_type_ind ? preferred_collocated_nf_type_ind->valueint : 0, + preferred_pgw_match_ind ? true : false, + preferred_pgw_match_ind ? preferred_pgw_match_ind->valueint : 0, + preferred_analytics_delays_ind ? true : false, + preferred_analytics_delays_ind ? preferred_analytics_delays_ind->valueint : 0 ); return preferred_search_local_var; diff --git a/lib/sbi/openapi/model/preferred_search.h b/lib/sbi/openapi/model/preferred_search.h index 25abb82a3..bae016daf 100644 --- a/lib/sbi/openapi/model/preferred_search.h +++ b/lib/sbi/openapi/model/preferred_search.h @@ -1,7 +1,7 @@ /* * preferred_search.h * - * Contains information on whether the returned NFProfiles match the preferred query parameters + * Contains information on whether the returned NFProfiles match the preferred query parameters */ #ifndef _OpenAPI_preferred_search_H_ @@ -31,6 +31,14 @@ typedef struct OpenAPI_preferred_search_s { int preferred_locality_match_ind; bool is_other_locality_ind; int other_locality_ind; + bool is_preferred_vendor_specific_features_ind; + int preferred_vendor_specific_features_ind; + bool is_preferred_collocated_nf_type_ind; + int preferred_collocated_nf_type_ind; + bool is_preferred_pgw_match_ind; + int preferred_pgw_match_ind; + bool is_preferred_analytics_delays_ind; + int preferred_analytics_delays_ind; } OpenAPI_preferred_search_t; OpenAPI_preferred_search_t *OpenAPI_preferred_search_create( @@ -45,7 +53,15 @@ OpenAPI_preferred_search_t *OpenAPI_preferred_search_create( bool is_preferred_locality_match_ind, int preferred_locality_match_ind, bool is_other_locality_ind, - int other_locality_ind + int other_locality_ind, + bool is_preferred_vendor_specific_features_ind, + int preferred_vendor_specific_features_ind, + bool is_preferred_collocated_nf_type_ind, + int preferred_collocated_nf_type_ind, + bool is_preferred_pgw_match_ind, + int preferred_pgw_match_ind, + bool is_preferred_analytics_delays_ind, + int preferred_analytics_delays_ind ); void OpenAPI_preferred_search_free(OpenAPI_preferred_search_t *preferred_search); OpenAPI_preferred_search_t *OpenAPI_preferred_search_parseFromJSON(cJSON *preferred_searchJSON); diff --git a/lib/sbi/openapi/model/presence_info.h b/lib/sbi/openapi/model/presence_info.h index 53b38f3e3..0f443ced6 100644 --- a/lib/sbi/openapi/model/presence_info.h +++ b/lib/sbi/openapi/model/presence_info.h @@ -1,7 +1,7 @@ /* * presence_info.h * - * + * If the additionalPraId IE is present, this IE shall state the presence information of the UE for the individual PRA identified by the additionalPraId IE; If the additionalPraId IE is not present, this IE shall state the presence information of the UE for the PRA identified by the praId IE. */ #ifndef _OpenAPI_presence_info_H_ diff --git a/lib/sbi/openapi/model/presence_info_rm.h b/lib/sbi/openapi/model/presence_info_rm.h index 22242a4d8..4e54a95ff 100644 --- a/lib/sbi/openapi/model/presence_info_rm.h +++ b/lib/sbi/openapi/model/presence_info_rm.h @@ -1,7 +1,7 @@ /* * presence_info_rm.h * - * + * This data type is defined in the same way as the 'PresenceInfo' data type, but with the OpenAPI 'nullable: true' property. If the additionalPraId IE is present, this IE shall state the presence information of the UE for the individual PRA identified by the additionalPraId IE; If the additionalPraId IE is not present, this IE shall state the presence information of the UE for the PRA identified by the praId IE. */ #ifndef _OpenAPI_presence_info_rm_H_ diff --git a/lib/sbi/openapi/model/prev_sub_info.c b/lib/sbi/openapi/model/prev_sub_info.c new file mode 100644 index 000000000..c132d96e7 --- /dev/null +++ b/lib/sbi/openapi/model/prev_sub_info.c @@ -0,0 +1,280 @@ + +#include +#include +#include +#include "prev_sub_info.h" + +OpenAPI_prev_sub_info_t *OpenAPI_prev_sub_info_create( + char *producer_id, + char *producer_set_id, + char *subscription_id, + OpenAPI_list_t *nf_ana_events, + OpenAPI_list_t *ue_ana_events +) +{ + OpenAPI_prev_sub_info_t *prev_sub_info_local_var = ogs_malloc(sizeof(OpenAPI_prev_sub_info_t)); + ogs_assert(prev_sub_info_local_var); + + prev_sub_info_local_var->producer_id = producer_id; + prev_sub_info_local_var->producer_set_id = producer_set_id; + prev_sub_info_local_var->subscription_id = subscription_id; + prev_sub_info_local_var->nf_ana_events = nf_ana_events; + prev_sub_info_local_var->ue_ana_events = ue_ana_events; + + return prev_sub_info_local_var; +} + +void OpenAPI_prev_sub_info_free(OpenAPI_prev_sub_info_t *prev_sub_info) +{ + OpenAPI_lnode_t *node = NULL; + + if (NULL == prev_sub_info) { + return; + } + if (prev_sub_info->producer_id) { + ogs_free(prev_sub_info->producer_id); + prev_sub_info->producer_id = NULL; + } + if (prev_sub_info->producer_set_id) { + ogs_free(prev_sub_info->producer_set_id); + prev_sub_info->producer_set_id = NULL; + } + if (prev_sub_info->subscription_id) { + ogs_free(prev_sub_info->subscription_id); + prev_sub_info->subscription_id = NULL; + } + if (prev_sub_info->nf_ana_events) { + OpenAPI_list_for_each(prev_sub_info->nf_ana_events, node) { + OpenAPI_nwdaf_event_free(node->data); + } + OpenAPI_list_free(prev_sub_info->nf_ana_events); + prev_sub_info->nf_ana_events = NULL; + } + if (prev_sub_info->ue_ana_events) { + OpenAPI_list_for_each(prev_sub_info->ue_ana_events, node) { + OpenAPI_ue_analytics_context_descriptor_free(node->data); + } + OpenAPI_list_free(prev_sub_info->ue_ana_events); + prev_sub_info->ue_ana_events = NULL; + } + ogs_free(prev_sub_info); +} + +cJSON *OpenAPI_prev_sub_info_convertToJSON(OpenAPI_prev_sub_info_t *prev_sub_info) +{ + cJSON *item = NULL; + OpenAPI_lnode_t *node = NULL; + + if (prev_sub_info == NULL) { + ogs_error("OpenAPI_prev_sub_info_convertToJSON() failed [PrevSubInfo]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (prev_sub_info->producer_id) { + if (cJSON_AddStringToObject(item, "producerId", prev_sub_info->producer_id) == NULL) { + ogs_error("OpenAPI_prev_sub_info_convertToJSON() failed [producer_id]"); + goto end; + } + } + + if (prev_sub_info->producer_set_id) { + if (cJSON_AddStringToObject(item, "producerSetId", prev_sub_info->producer_set_id) == NULL) { + ogs_error("OpenAPI_prev_sub_info_convertToJSON() failed [producer_set_id]"); + goto end; + } + } + + if (!prev_sub_info->subscription_id) { + ogs_error("OpenAPI_prev_sub_info_convertToJSON() failed [subscription_id]"); + return NULL; + } + if (cJSON_AddStringToObject(item, "subscriptionId", prev_sub_info->subscription_id) == NULL) { + ogs_error("OpenAPI_prev_sub_info_convertToJSON() failed [subscription_id]"); + goto end; + } + + if (prev_sub_info->nf_ana_events) { + cJSON *nf_ana_eventsList = cJSON_AddArrayToObject(item, "nfAnaEvents"); + if (nf_ana_eventsList == NULL) { + ogs_error("OpenAPI_prev_sub_info_convertToJSON() failed [nf_ana_events]"); + goto end; + } + OpenAPI_list_for_each(prev_sub_info->nf_ana_events, node) { + cJSON *itemLocal = OpenAPI_nwdaf_event_convertToJSON(node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_prev_sub_info_convertToJSON() failed [nf_ana_events]"); + goto end; + } + cJSON_AddItemToArray(nf_ana_eventsList, itemLocal); + } + } + + if (prev_sub_info->ue_ana_events) { + cJSON *ue_ana_eventsList = cJSON_AddArrayToObject(item, "ueAnaEvents"); + if (ue_ana_eventsList == NULL) { + ogs_error("OpenAPI_prev_sub_info_convertToJSON() failed [ue_ana_events]"); + goto end; + } + OpenAPI_list_for_each(prev_sub_info->ue_ana_events, node) { + cJSON *itemLocal = OpenAPI_ue_analytics_context_descriptor_convertToJSON(node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_prev_sub_info_convertToJSON() failed [ue_ana_events]"); + goto end; + } + cJSON_AddItemToArray(ue_ana_eventsList, itemLocal); + } + } + +end: + return item; +} + +OpenAPI_prev_sub_info_t *OpenAPI_prev_sub_info_parseFromJSON(cJSON *prev_sub_infoJSON) +{ + OpenAPI_prev_sub_info_t *prev_sub_info_local_var = NULL; + OpenAPI_lnode_t *node = NULL; + cJSON *producer_id = NULL; + cJSON *producer_set_id = NULL; + cJSON *subscription_id = NULL; + cJSON *nf_ana_events = NULL; + OpenAPI_list_t *nf_ana_eventsList = NULL; + cJSON *ue_ana_events = NULL; + OpenAPI_list_t *ue_ana_eventsList = NULL; + producer_id = cJSON_GetObjectItemCaseSensitive(prev_sub_infoJSON, "producerId"); + if (producer_id) { + if (!cJSON_IsString(producer_id) && !cJSON_IsNull(producer_id)) { + ogs_error("OpenAPI_prev_sub_info_parseFromJSON() failed [producer_id]"); + goto end; + } + } + + producer_set_id = cJSON_GetObjectItemCaseSensitive(prev_sub_infoJSON, "producerSetId"); + if (producer_set_id) { + if (!cJSON_IsString(producer_set_id) && !cJSON_IsNull(producer_set_id)) { + ogs_error("OpenAPI_prev_sub_info_parseFromJSON() failed [producer_set_id]"); + goto end; + } + } + + subscription_id = cJSON_GetObjectItemCaseSensitive(prev_sub_infoJSON, "subscriptionId"); + if (!subscription_id) { + ogs_error("OpenAPI_prev_sub_info_parseFromJSON() failed [subscription_id]"); + goto end; + } + if (!cJSON_IsString(subscription_id)) { + ogs_error("OpenAPI_prev_sub_info_parseFromJSON() failed [subscription_id]"); + goto end; + } + + nf_ana_events = cJSON_GetObjectItemCaseSensitive(prev_sub_infoJSON, "nfAnaEvents"); + if (nf_ana_events) { + cJSON *nf_ana_events_local = NULL; + if (!cJSON_IsArray(nf_ana_events)) { + ogs_error("OpenAPI_prev_sub_info_parseFromJSON() failed [nf_ana_events]"); + goto end; + } + + nf_ana_eventsList = OpenAPI_list_create(); + + cJSON_ArrayForEach(nf_ana_events_local, nf_ana_events) { + if (!cJSON_IsObject(nf_ana_events_local)) { + ogs_error("OpenAPI_prev_sub_info_parseFromJSON() failed [nf_ana_events]"); + goto end; + } + OpenAPI_nwdaf_event_t *nf_ana_eventsItem = OpenAPI_nwdaf_event_parseFromJSON(nf_ana_events_local); + if (!nf_ana_eventsItem) { + ogs_error("No nf_ana_eventsItem"); + OpenAPI_list_free(nf_ana_eventsList); + goto end; + } + OpenAPI_list_add(nf_ana_eventsList, nf_ana_eventsItem); + } + } + + ue_ana_events = cJSON_GetObjectItemCaseSensitive(prev_sub_infoJSON, "ueAnaEvents"); + if (ue_ana_events) { + cJSON *ue_ana_events_local = NULL; + if (!cJSON_IsArray(ue_ana_events)) { + ogs_error("OpenAPI_prev_sub_info_parseFromJSON() failed [ue_ana_events]"); + goto end; + } + + ue_ana_eventsList = OpenAPI_list_create(); + + cJSON_ArrayForEach(ue_ana_events_local, ue_ana_events) { + if (!cJSON_IsObject(ue_ana_events_local)) { + ogs_error("OpenAPI_prev_sub_info_parseFromJSON() failed [ue_ana_events]"); + goto end; + } + OpenAPI_ue_analytics_context_descriptor_t *ue_ana_eventsItem = OpenAPI_ue_analytics_context_descriptor_parseFromJSON(ue_ana_events_local); + if (!ue_ana_eventsItem) { + ogs_error("No ue_ana_eventsItem"); + OpenAPI_list_free(ue_ana_eventsList); + goto end; + } + OpenAPI_list_add(ue_ana_eventsList, ue_ana_eventsItem); + } + } + + prev_sub_info_local_var = OpenAPI_prev_sub_info_create ( + producer_id && !cJSON_IsNull(producer_id) ? ogs_strdup(producer_id->valuestring) : NULL, + producer_set_id && !cJSON_IsNull(producer_set_id) ? ogs_strdup(producer_set_id->valuestring) : NULL, + ogs_strdup(subscription_id->valuestring), + nf_ana_events ? nf_ana_eventsList : NULL, + ue_ana_events ? ue_ana_eventsList : NULL + ); + + return prev_sub_info_local_var; +end: + if (nf_ana_eventsList) { + OpenAPI_list_for_each(nf_ana_eventsList, node) { + OpenAPI_nwdaf_event_free(node->data); + } + OpenAPI_list_free(nf_ana_eventsList); + nf_ana_eventsList = NULL; + } + if (ue_ana_eventsList) { + OpenAPI_list_for_each(ue_ana_eventsList, node) { + OpenAPI_ue_analytics_context_descriptor_free(node->data); + } + OpenAPI_list_free(ue_ana_eventsList); + ue_ana_eventsList = NULL; + } + return NULL; +} + +OpenAPI_prev_sub_info_t *OpenAPI_prev_sub_info_copy(OpenAPI_prev_sub_info_t *dst, OpenAPI_prev_sub_info_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_prev_sub_info_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_prev_sub_info_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_prev_sub_info_free(dst); + dst = OpenAPI_prev_sub_info_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/prev_sub_info.h b/lib/sbi/openapi/model/prev_sub_info.h new file mode 100644 index 000000000..d0b22e771 --- /dev/null +++ b/lib/sbi/openapi/model/prev_sub_info.h @@ -0,0 +1,48 @@ +/* + * prev_sub_info.h + * + * Information of the previous subscription. + */ + +#ifndef _OpenAPI_prev_sub_info_H_ +#define _OpenAPI_prev_sub_info_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "nwdaf_event.h" +#include "ue_analytics_context_descriptor.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_prev_sub_info_s OpenAPI_prev_sub_info_t; +typedef struct OpenAPI_prev_sub_info_s { + char *producer_id; + char *producer_set_id; + char *subscription_id; + OpenAPI_list_t *nf_ana_events; + OpenAPI_list_t *ue_ana_events; +} OpenAPI_prev_sub_info_t; + +OpenAPI_prev_sub_info_t *OpenAPI_prev_sub_info_create( + char *producer_id, + char *producer_set_id, + char *subscription_id, + OpenAPI_list_t *nf_ana_events, + OpenAPI_list_t *ue_ana_events +); +void OpenAPI_prev_sub_info_free(OpenAPI_prev_sub_info_t *prev_sub_info); +OpenAPI_prev_sub_info_t *OpenAPI_prev_sub_info_parseFromJSON(cJSON *prev_sub_infoJSON); +cJSON *OpenAPI_prev_sub_info_convertToJSON(OpenAPI_prev_sub_info_t *prev_sub_info); +OpenAPI_prev_sub_info_t *OpenAPI_prev_sub_info_copy(OpenAPI_prev_sub_info_t *dst, OpenAPI_prev_sub_info_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_prev_sub_info_H_ */ + diff --git a/lib/sbi/openapi/model/pro_se_allowed_plmn.c b/lib/sbi/openapi/model/pro_se_allowed_plmn.c new file mode 100644 index 000000000..ed87ed345 --- /dev/null +++ b/lib/sbi/openapi/model/pro_se_allowed_plmn.c @@ -0,0 +1,168 @@ + +#include +#include +#include +#include "pro_se_allowed_plmn.h" + +OpenAPI_pro_se_allowed_plmn_t *OpenAPI_pro_se_allowed_plmn_create( + OpenAPI_plmn_id_t *visited_plmn, + OpenAPI_list_t *prose_direct_allowed +) +{ + OpenAPI_pro_se_allowed_plmn_t *pro_se_allowed_plmn_local_var = ogs_malloc(sizeof(OpenAPI_pro_se_allowed_plmn_t)); + ogs_assert(pro_se_allowed_plmn_local_var); + + pro_se_allowed_plmn_local_var->visited_plmn = visited_plmn; + pro_se_allowed_plmn_local_var->prose_direct_allowed = prose_direct_allowed; + + return pro_se_allowed_plmn_local_var; +} + +void OpenAPI_pro_se_allowed_plmn_free(OpenAPI_pro_se_allowed_plmn_t *pro_se_allowed_plmn) +{ + OpenAPI_lnode_t *node = NULL; + + if (NULL == pro_se_allowed_plmn) { + return; + } + if (pro_se_allowed_plmn->visited_plmn) { + OpenAPI_plmn_id_free(pro_se_allowed_plmn->visited_plmn); + pro_se_allowed_plmn->visited_plmn = NULL; + } + if (pro_se_allowed_plmn->prose_direct_allowed) { + OpenAPI_list_free(pro_se_allowed_plmn->prose_direct_allowed); + pro_se_allowed_plmn->prose_direct_allowed = NULL; + } + ogs_free(pro_se_allowed_plmn); +} + +cJSON *OpenAPI_pro_se_allowed_plmn_convertToJSON(OpenAPI_pro_se_allowed_plmn_t *pro_se_allowed_plmn) +{ + cJSON *item = NULL; + OpenAPI_lnode_t *node = NULL; + + if (pro_se_allowed_plmn == NULL) { + ogs_error("OpenAPI_pro_se_allowed_plmn_convertToJSON() failed [ProSeAllowedPlmn]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (!pro_se_allowed_plmn->visited_plmn) { + ogs_error("OpenAPI_pro_se_allowed_plmn_convertToJSON() failed [visited_plmn]"); + return NULL; + } + cJSON *visited_plmn_local_JSON = OpenAPI_plmn_id_convertToJSON(pro_se_allowed_plmn->visited_plmn); + if (visited_plmn_local_JSON == NULL) { + ogs_error("OpenAPI_pro_se_allowed_plmn_convertToJSON() failed [visited_plmn]"); + goto end; + } + cJSON_AddItemToObject(item, "visitedPlmn", visited_plmn_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_pro_se_allowed_plmn_convertToJSON() failed [visited_plmn]"); + goto end; + } + + if (pro_se_allowed_plmn->prose_direct_allowed != OpenAPI_prose_direct_allowed_NULL) { + cJSON *prose_direct_allowedList = cJSON_AddArrayToObject(item, "proseDirectAllowed"); + if (prose_direct_allowedList == NULL) { + ogs_error("OpenAPI_pro_se_allowed_plmn_convertToJSON() failed [prose_direct_allowed]"); + goto end; + } + OpenAPI_list_for_each(pro_se_allowed_plmn->prose_direct_allowed, node) { + if (cJSON_AddStringToObject(prose_direct_allowedList, "", OpenAPI_prose_direct_allowed_ToString((intptr_t)node->data)) == NULL) { + ogs_error("OpenAPI_pro_se_allowed_plmn_convertToJSON() failed [prose_direct_allowed]"); + goto end; + } + } + } + +end: + return item; +} + +OpenAPI_pro_se_allowed_plmn_t *OpenAPI_pro_se_allowed_plmn_parseFromJSON(cJSON *pro_se_allowed_plmnJSON) +{ + OpenAPI_pro_se_allowed_plmn_t *pro_se_allowed_plmn_local_var = NULL; + OpenAPI_lnode_t *node = NULL; + cJSON *visited_plmn = NULL; + OpenAPI_plmn_id_t *visited_plmn_local_nonprim = NULL; + cJSON *prose_direct_allowed = NULL; + OpenAPI_list_t *prose_direct_allowedList = NULL; + visited_plmn = cJSON_GetObjectItemCaseSensitive(pro_se_allowed_plmnJSON, "visitedPlmn"); + if (!visited_plmn) { + ogs_error("OpenAPI_pro_se_allowed_plmn_parseFromJSON() failed [visited_plmn]"); + goto end; + } + visited_plmn_local_nonprim = OpenAPI_plmn_id_parseFromJSON(visited_plmn); + + prose_direct_allowed = cJSON_GetObjectItemCaseSensitive(pro_se_allowed_plmnJSON, "proseDirectAllowed"); + if (prose_direct_allowed) { + cJSON *prose_direct_allowed_local = NULL; + if (!cJSON_IsArray(prose_direct_allowed)) { + ogs_error("OpenAPI_pro_se_allowed_plmn_parseFromJSON() failed [prose_direct_allowed]"); + goto end; + } + + prose_direct_allowedList = OpenAPI_list_create(); + + cJSON_ArrayForEach(prose_direct_allowed_local, prose_direct_allowed) { + if (!cJSON_IsString(prose_direct_allowed_local)) { + ogs_error("OpenAPI_pro_se_allowed_plmn_parseFromJSON() failed [prose_direct_allowed]"); + goto end; + } + OpenAPI_list_add(prose_direct_allowedList, (void *)OpenAPI_prose_direct_allowed_FromString(prose_direct_allowed_local->valuestring)); + } + } + + pro_se_allowed_plmn_local_var = OpenAPI_pro_se_allowed_plmn_create ( + visited_plmn_local_nonprim, + prose_direct_allowed ? prose_direct_allowedList : NULL + ); + + return pro_se_allowed_plmn_local_var; +end: + if (visited_plmn_local_nonprim) { + OpenAPI_plmn_id_free(visited_plmn_local_nonprim); + visited_plmn_local_nonprim = NULL; + } + if (prose_direct_allowedList) { + OpenAPI_list_free(prose_direct_allowedList); + prose_direct_allowedList = NULL; + } + return NULL; +} + +OpenAPI_pro_se_allowed_plmn_t *OpenAPI_pro_se_allowed_plmn_copy(OpenAPI_pro_se_allowed_plmn_t *dst, OpenAPI_pro_se_allowed_plmn_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_pro_se_allowed_plmn_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_pro_se_allowed_plmn_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_pro_se_allowed_plmn_free(dst); + dst = OpenAPI_pro_se_allowed_plmn_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/pro_se_allowed_plmn.h b/lib/sbi/openapi/model/pro_se_allowed_plmn.h new file mode 100644 index 000000000..ab30d3baf --- /dev/null +++ b/lib/sbi/openapi/model/pro_se_allowed_plmn.h @@ -0,0 +1,42 @@ +/* + * pro_se_allowed_plmn.h + * + * Contains the PLMN identities where the Prose services are authorised to use and the authorised Prose services on this given PLMNs. + */ + +#ifndef _OpenAPI_pro_se_allowed_plmn_H_ +#define _OpenAPI_pro_se_allowed_plmn_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "plmn_id.h" +#include "prose_direct_allowed.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_pro_se_allowed_plmn_s OpenAPI_pro_se_allowed_plmn_t; +typedef struct OpenAPI_pro_se_allowed_plmn_s { + struct OpenAPI_plmn_id_s *visited_plmn; + OpenAPI_list_t *prose_direct_allowed; +} OpenAPI_pro_se_allowed_plmn_t; + +OpenAPI_pro_se_allowed_plmn_t *OpenAPI_pro_se_allowed_plmn_create( + OpenAPI_plmn_id_t *visited_plmn, + OpenAPI_list_t *prose_direct_allowed +); +void OpenAPI_pro_se_allowed_plmn_free(OpenAPI_pro_se_allowed_plmn_t *pro_se_allowed_plmn); +OpenAPI_pro_se_allowed_plmn_t *OpenAPI_pro_se_allowed_plmn_parseFromJSON(cJSON *pro_se_allowed_plmnJSON); +cJSON *OpenAPI_pro_se_allowed_plmn_convertToJSON(OpenAPI_pro_se_allowed_plmn_t *pro_se_allowed_plmn); +OpenAPI_pro_se_allowed_plmn_t *OpenAPI_pro_se_allowed_plmn_copy(OpenAPI_pro_se_allowed_plmn_t *dst, OpenAPI_pro_se_allowed_plmn_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_pro_se_allowed_plmn_H_ */ + diff --git a/lib/sbi/openapi/model/pro_se_auth_data.c b/lib/sbi/openapi/model/pro_se_auth_data.c new file mode 100644 index 000000000..2200084a3 --- /dev/null +++ b/lib/sbi/openapi/model/pro_se_auth_data.c @@ -0,0 +1,87 @@ + +#include +#include +#include +#include "pro_se_auth_data.h" + +OpenAPI_pro_se_auth_data_t *OpenAPI_pro_se_auth_data_create( +) +{ + OpenAPI_pro_se_auth_data_t *pro_se_auth_data_local_var = ogs_malloc(sizeof(OpenAPI_pro_se_auth_data_t)); + ogs_assert(pro_se_auth_data_local_var); + + + return pro_se_auth_data_local_var; +} + +void OpenAPI_pro_se_auth_data_free(OpenAPI_pro_se_auth_data_t *pro_se_auth_data) +{ + OpenAPI_lnode_t *node = NULL; + + if (NULL == pro_se_auth_data) { + return; + } + ogs_free(pro_se_auth_data); +} + +cJSON *OpenAPI_pro_se_auth_data_convertToJSON(OpenAPI_pro_se_auth_data_t *pro_se_auth_data) +{ + cJSON *item = NULL; + OpenAPI_lnode_t *node = NULL; + + if (pro_se_auth_data == NULL) { + ogs_error("OpenAPI_pro_se_auth_data_convertToJSON() failed [ProSeAuthData]"); + return NULL; + } + + item = cJSON_CreateObject(); +end: + return item; +} + +OpenAPI_pro_se_auth_data_t *OpenAPI_pro_se_auth_data_parseFromJSON(cJSON *pro_se_auth_dataJSON) +{ + OpenAPI_pro_se_auth_data_t *pro_se_auth_data_local_var = NULL; + OpenAPI_lnode_t *node = NULL; + pro_se_auth_data_local_var = OpenAPI_pro_se_auth_data_create ( + ); + + return pro_se_auth_data_local_var; +end: + return NULL; +} + +OpenAPI_pro_se_auth_data_t *OpenAPI_pro_se_auth_data_copy(OpenAPI_pro_se_auth_data_t *dst, OpenAPI_pro_se_auth_data_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_pro_se_auth_data_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_pro_se_auth_data_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_pro_se_auth_data_free(dst); + dst = OpenAPI_pro_se_auth_data_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/pro_se_auth_data.h b/lib/sbi/openapi/model/pro_se_auth_data.h new file mode 100644 index 000000000..e368ca3ff --- /dev/null +++ b/lib/sbi/openapi/model/pro_se_auth_data.h @@ -0,0 +1,36 @@ +/* + * pro_se_auth_data.h + * + * + */ + +#ifndef _OpenAPI_pro_se_auth_data_H_ +#define _OpenAPI_pro_se_auth_data_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_pro_se_auth_data_s OpenAPI_pro_se_auth_data_t; +typedef struct OpenAPI_pro_se_auth_data_s { +} OpenAPI_pro_se_auth_data_t; + +OpenAPI_pro_se_auth_data_t *OpenAPI_pro_se_auth_data_create( +); +void OpenAPI_pro_se_auth_data_free(OpenAPI_pro_se_auth_data_t *pro_se_auth_data); +OpenAPI_pro_se_auth_data_t *OpenAPI_pro_se_auth_data_parseFromJSON(cJSON *pro_se_auth_dataJSON); +cJSON *OpenAPI_pro_se_auth_data_convertToJSON(OpenAPI_pro_se_auth_data_t *pro_se_auth_data); +OpenAPI_pro_se_auth_data_t *OpenAPI_pro_se_auth_data_copy(OpenAPI_pro_se_auth_data_t *dst, OpenAPI_pro_se_auth_data_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_pro_se_auth_data_H_ */ + diff --git a/lib/sbi/openapi/model/pro_se_authentication_ctx.c b/lib/sbi/openapi/model/pro_se_authentication_ctx.c new file mode 100644 index 000000000..21e635146 --- /dev/null +++ b/lib/sbi/openapi/model/pro_se_authentication_ctx.c @@ -0,0 +1,247 @@ + +#include +#include +#include +#include "pro_se_authentication_ctx.h" + +OpenAPI_pro_se_authentication_ctx_t *OpenAPI_pro_se_authentication_ctx_create( + OpenAPI_auth_type_e auth_type, + OpenAPI_list_t* _links, + OpenAPI_pro_se_auth_data_t *pro_se_auth_data, + char *supported_features +) +{ + OpenAPI_pro_se_authentication_ctx_t *pro_se_authentication_ctx_local_var = ogs_malloc(sizeof(OpenAPI_pro_se_authentication_ctx_t)); + ogs_assert(pro_se_authentication_ctx_local_var); + + pro_se_authentication_ctx_local_var->auth_type = auth_type; + pro_se_authentication_ctx_local_var->_links = _links; + pro_se_authentication_ctx_local_var->pro_se_auth_data = pro_se_auth_data; + pro_se_authentication_ctx_local_var->supported_features = supported_features; + + return pro_se_authentication_ctx_local_var; +} + +void OpenAPI_pro_se_authentication_ctx_free(OpenAPI_pro_se_authentication_ctx_t *pro_se_authentication_ctx) +{ + OpenAPI_lnode_t *node = NULL; + + if (NULL == pro_se_authentication_ctx) { + return; + } + if (pro_se_authentication_ctx->_links) { + OpenAPI_list_for_each(pro_se_authentication_ctx->_links, node) { + OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*)node->data; + ogs_free(localKeyValue->key); + OpenAPI_links_value_schema_free(localKeyValue->value); + OpenAPI_map_free(localKeyValue); + } + OpenAPI_list_free(pro_se_authentication_ctx->_links); + pro_se_authentication_ctx->_links = NULL; + } + if (pro_se_authentication_ctx->pro_se_auth_data) { + OpenAPI_pro_se_auth_data_free(pro_se_authentication_ctx->pro_se_auth_data); + pro_se_authentication_ctx->pro_se_auth_data = NULL; + } + if (pro_se_authentication_ctx->supported_features) { + ogs_free(pro_se_authentication_ctx->supported_features); + pro_se_authentication_ctx->supported_features = NULL; + } + ogs_free(pro_se_authentication_ctx); +} + +cJSON *OpenAPI_pro_se_authentication_ctx_convertToJSON(OpenAPI_pro_se_authentication_ctx_t *pro_se_authentication_ctx) +{ + cJSON *item = NULL; + OpenAPI_lnode_t *node = NULL; + + if (pro_se_authentication_ctx == NULL) { + ogs_error("OpenAPI_pro_se_authentication_ctx_convertToJSON() failed [ProSeAuthenticationCtx]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (pro_se_authentication_ctx->auth_type == OpenAPI_auth_type_NULL) { + ogs_error("OpenAPI_pro_se_authentication_ctx_convertToJSON() failed [auth_type]"); + return NULL; + } + if (cJSON_AddStringToObject(item, "authType", OpenAPI_auth_type_ToString(pro_se_authentication_ctx->auth_type)) == NULL) { + ogs_error("OpenAPI_pro_se_authentication_ctx_convertToJSON() failed [auth_type]"); + goto end; + } + + if (!pro_se_authentication_ctx->_links) { + ogs_error("OpenAPI_pro_se_authentication_ctx_convertToJSON() failed [_links]"); + return NULL; + } + cJSON *_links = cJSON_AddObjectToObject(item, "_links"); + if (_links == NULL) { + ogs_error("OpenAPI_pro_se_authentication_ctx_convertToJSON() failed [_links]"); + goto end; + } + cJSON *localMapObject = _links; + if (pro_se_authentication_ctx->_links) { + OpenAPI_list_for_each(pro_se_authentication_ctx->_links, node) { + OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*)node->data; + cJSON *itemLocal = localKeyValue->value ? + OpenAPI_links_value_schema_convertToJSON(localKeyValue->value) : + cJSON_CreateNull(); + if (itemLocal == NULL) { + ogs_error("OpenAPI_pro_se_authentication_ctx_convertToJSON() failed [inner]"); + goto end; + } + cJSON_AddItemToObject(localMapObject, localKeyValue->key, itemLocal); + } + } + + if (!pro_se_authentication_ctx->pro_se_auth_data) { + ogs_error("OpenAPI_pro_se_authentication_ctx_convertToJSON() failed [pro_se_auth_data]"); + return NULL; + } + cJSON *pro_se_auth_data_local_JSON = OpenAPI_pro_se_auth_data_convertToJSON(pro_se_authentication_ctx->pro_se_auth_data); + if (pro_se_auth_data_local_JSON == NULL) { + ogs_error("OpenAPI_pro_se_authentication_ctx_convertToJSON() failed [pro_se_auth_data]"); + goto end; + } + cJSON_AddItemToObject(item, "proSeAuthData", pro_se_auth_data_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_pro_se_authentication_ctx_convertToJSON() failed [pro_se_auth_data]"); + goto end; + } + + if (pro_se_authentication_ctx->supported_features) { + if (cJSON_AddStringToObject(item, "supportedFeatures", pro_se_authentication_ctx->supported_features) == NULL) { + ogs_error("OpenAPI_pro_se_authentication_ctx_convertToJSON() failed [supported_features]"); + goto end; + } + } + +end: + return item; +} + +OpenAPI_pro_se_authentication_ctx_t *OpenAPI_pro_se_authentication_ctx_parseFromJSON(cJSON *pro_se_authentication_ctxJSON) +{ + OpenAPI_pro_se_authentication_ctx_t *pro_se_authentication_ctx_local_var = NULL; + OpenAPI_lnode_t *node = NULL; + cJSON *auth_type = NULL; + OpenAPI_auth_type_e auth_typeVariable = 0; + cJSON *_links = NULL; + OpenAPI_list_t *_linksList = NULL; + cJSON *pro_se_auth_data = NULL; + OpenAPI_pro_se_auth_data_t *pro_se_auth_data_local_nonprim = NULL; + cJSON *supported_features = NULL; + auth_type = cJSON_GetObjectItemCaseSensitive(pro_se_authentication_ctxJSON, "authType"); + if (!auth_type) { + ogs_error("OpenAPI_pro_se_authentication_ctx_parseFromJSON() failed [auth_type]"); + goto end; + } + if (!cJSON_IsString(auth_type)) { + ogs_error("OpenAPI_pro_se_authentication_ctx_parseFromJSON() failed [auth_type]"); + goto end; + } + auth_typeVariable = OpenAPI_auth_type_FromString(auth_type->valuestring); + + _links = cJSON_GetObjectItemCaseSensitive(pro_se_authentication_ctxJSON, "_links"); + if (!_links) { + ogs_error("OpenAPI_pro_se_authentication_ctx_parseFromJSON() failed [_links]"); + goto end; + } + cJSON *_links_local_map = NULL; + if (!cJSON_IsObject(_links) && !cJSON_IsNull(_links)) { + ogs_error("OpenAPI_pro_se_authentication_ctx_parseFromJSON() failed [_links]"); + goto end; + } + if (cJSON_IsObject(_links)) { + _linksList = OpenAPI_list_create(); + OpenAPI_map_t *localMapKeyPair = NULL; + cJSON_ArrayForEach(_links_local_map, _links) { + cJSON *localMapObject = _links_local_map; + if (cJSON_IsObject(localMapObject)) { + localMapKeyPair = OpenAPI_map_create( + ogs_strdup(localMapObject->string), OpenAPI_links_value_schema_parseFromJSON(localMapObject)); + } else if (cJSON_IsNull(localMapObject)) { + localMapKeyPair = OpenAPI_map_create(ogs_strdup(localMapObject->string), NULL); + } else { + ogs_error("OpenAPI_pro_se_authentication_ctx_parseFromJSON() failed [inner]"); + goto end; + } + OpenAPI_list_add(_linksList, localMapKeyPair); + } + } + + pro_se_auth_data = cJSON_GetObjectItemCaseSensitive(pro_se_authentication_ctxJSON, "proSeAuthData"); + if (!pro_se_auth_data) { + ogs_error("OpenAPI_pro_se_authentication_ctx_parseFromJSON() failed [pro_se_auth_data]"); + goto end; + } + pro_se_auth_data_local_nonprim = OpenAPI_pro_se_auth_data_parseFromJSON(pro_se_auth_data); + + supported_features = cJSON_GetObjectItemCaseSensitive(pro_se_authentication_ctxJSON, "supportedFeatures"); + if (supported_features) { + if (!cJSON_IsString(supported_features) && !cJSON_IsNull(supported_features)) { + ogs_error("OpenAPI_pro_se_authentication_ctx_parseFromJSON() failed [supported_features]"); + goto end; + } + } + + pro_se_authentication_ctx_local_var = OpenAPI_pro_se_authentication_ctx_create ( + auth_typeVariable, + _linksList, + pro_se_auth_data_local_nonprim, + supported_features && !cJSON_IsNull(supported_features) ? ogs_strdup(supported_features->valuestring) : NULL + ); + + return pro_se_authentication_ctx_local_var; +end: + if (_linksList) { + OpenAPI_list_for_each(_linksList, node) { + OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*) node->data; + ogs_free(localKeyValue->key); + OpenAPI_links_value_schema_free(localKeyValue->value); + OpenAPI_map_free(localKeyValue); + } + OpenAPI_list_free(_linksList); + _linksList = NULL; + } + if (pro_se_auth_data_local_nonprim) { + OpenAPI_pro_se_auth_data_free(pro_se_auth_data_local_nonprim); + pro_se_auth_data_local_nonprim = NULL; + } + return NULL; +} + +OpenAPI_pro_se_authentication_ctx_t *OpenAPI_pro_se_authentication_ctx_copy(OpenAPI_pro_se_authentication_ctx_t *dst, OpenAPI_pro_se_authentication_ctx_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_pro_se_authentication_ctx_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_pro_se_authentication_ctx_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_pro_se_authentication_ctx_free(dst); + dst = OpenAPI_pro_se_authentication_ctx_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/pro_se_authentication_ctx.h b/lib/sbi/openapi/model/pro_se_authentication_ctx.h new file mode 100644 index 000000000..f3e921f63 --- /dev/null +++ b/lib/sbi/openapi/model/pro_se_authentication_ctx.h @@ -0,0 +1,47 @@ +/* + * pro_se_authentication_ctx.h + * + * Contains the information related to the resource generated to handle the ProSe authentication. + */ + +#ifndef _OpenAPI_pro_se_authentication_ctx_H_ +#define _OpenAPI_pro_se_authentication_ctx_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "auth_type.h" +#include "links_value_schema.h" +#include "pro_se_auth_data.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_pro_se_authentication_ctx_s OpenAPI_pro_se_authentication_ctx_t; +typedef struct OpenAPI_pro_se_authentication_ctx_s { + OpenAPI_auth_type_e auth_type; + OpenAPI_list_t* _links; + struct OpenAPI_pro_se_auth_data_s *pro_se_auth_data; + char *supported_features; +} OpenAPI_pro_se_authentication_ctx_t; + +OpenAPI_pro_se_authentication_ctx_t *OpenAPI_pro_se_authentication_ctx_create( + OpenAPI_auth_type_e auth_type, + OpenAPI_list_t* _links, + OpenAPI_pro_se_auth_data_t *pro_se_auth_data, + char *supported_features +); +void OpenAPI_pro_se_authentication_ctx_free(OpenAPI_pro_se_authentication_ctx_t *pro_se_authentication_ctx); +OpenAPI_pro_se_authentication_ctx_t *OpenAPI_pro_se_authentication_ctx_parseFromJSON(cJSON *pro_se_authentication_ctxJSON); +cJSON *OpenAPI_pro_se_authentication_ctx_convertToJSON(OpenAPI_pro_se_authentication_ctx_t *pro_se_authentication_ctx); +OpenAPI_pro_se_authentication_ctx_t *OpenAPI_pro_se_authentication_ctx_copy(OpenAPI_pro_se_authentication_ctx_t *dst, OpenAPI_pro_se_authentication_ctx_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_pro_se_authentication_ctx_H_ */ + diff --git a/lib/sbi/openapi/model/pro_se_authentication_info.c b/lib/sbi/openapi/model/pro_se_authentication_info.c new file mode 100644 index 000000000..e9116e201 --- /dev/null +++ b/lib/sbi/openapi/model/pro_se_authentication_info.c @@ -0,0 +1,203 @@ + +#include +#include +#include +#include "pro_se_authentication_info.h" + +OpenAPI_pro_se_authentication_info_t *OpenAPI_pro_se_authentication_info_create( + char *supi_or_suci, + char *_5g_pruk_id, + int relay_service_code, + char *nonce1, + char *supported_features +) +{ + OpenAPI_pro_se_authentication_info_t *pro_se_authentication_info_local_var = ogs_malloc(sizeof(OpenAPI_pro_se_authentication_info_t)); + ogs_assert(pro_se_authentication_info_local_var); + + pro_se_authentication_info_local_var->supi_or_suci = supi_or_suci; + pro_se_authentication_info_local_var->_5g_pruk_id = _5g_pruk_id; + pro_se_authentication_info_local_var->relay_service_code = relay_service_code; + pro_se_authentication_info_local_var->nonce1 = nonce1; + pro_se_authentication_info_local_var->supported_features = supported_features; + + return pro_se_authentication_info_local_var; +} + +void OpenAPI_pro_se_authentication_info_free(OpenAPI_pro_se_authentication_info_t *pro_se_authentication_info) +{ + OpenAPI_lnode_t *node = NULL; + + if (NULL == pro_se_authentication_info) { + return; + } + if (pro_se_authentication_info->supi_or_suci) { + ogs_free(pro_se_authentication_info->supi_or_suci); + pro_se_authentication_info->supi_or_suci = NULL; + } + if (pro_se_authentication_info->_5g_pruk_id) { + ogs_free(pro_se_authentication_info->_5g_pruk_id); + pro_se_authentication_info->_5g_pruk_id = NULL; + } + if (pro_se_authentication_info->nonce1) { + ogs_free(pro_se_authentication_info->nonce1); + pro_se_authentication_info->nonce1 = NULL; + } + if (pro_se_authentication_info->supported_features) { + ogs_free(pro_se_authentication_info->supported_features); + pro_se_authentication_info->supported_features = NULL; + } + ogs_free(pro_se_authentication_info); +} + +cJSON *OpenAPI_pro_se_authentication_info_convertToJSON(OpenAPI_pro_se_authentication_info_t *pro_se_authentication_info) +{ + cJSON *item = NULL; + OpenAPI_lnode_t *node = NULL; + + if (pro_se_authentication_info == NULL) { + ogs_error("OpenAPI_pro_se_authentication_info_convertToJSON() failed [ProSeAuthenticationInfo]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (pro_se_authentication_info->supi_or_suci) { + if (cJSON_AddStringToObject(item, "supiOrSuci", pro_se_authentication_info->supi_or_suci) == NULL) { + ogs_error("OpenAPI_pro_se_authentication_info_convertToJSON() failed [supi_or_suci]"); + goto end; + } + } + + if (pro_se_authentication_info->_5g_pruk_id) { + if (cJSON_AddStringToObject(item, "5gPrukId", pro_se_authentication_info->_5g_pruk_id) == NULL) { + ogs_error("OpenAPI_pro_se_authentication_info_convertToJSON() failed [_5g_pruk_id]"); + goto end; + } + } + + if (cJSON_AddNumberToObject(item, "relayServiceCode", pro_se_authentication_info->relay_service_code) == NULL) { + ogs_error("OpenAPI_pro_se_authentication_info_convertToJSON() failed [relay_service_code]"); + goto end; + } + + if (!pro_se_authentication_info->nonce1) { + ogs_error("OpenAPI_pro_se_authentication_info_convertToJSON() failed [nonce1]"); + return NULL; + } + if (cJSON_AddStringToObject(item, "nonce1", pro_se_authentication_info->nonce1) == NULL) { + ogs_error("OpenAPI_pro_se_authentication_info_convertToJSON() failed [nonce1]"); + goto end; + } + + if (pro_se_authentication_info->supported_features) { + if (cJSON_AddStringToObject(item, "supportedFeatures", pro_se_authentication_info->supported_features) == NULL) { + ogs_error("OpenAPI_pro_se_authentication_info_convertToJSON() failed [supported_features]"); + goto end; + } + } + +end: + return item; +} + +OpenAPI_pro_se_authentication_info_t *OpenAPI_pro_se_authentication_info_parseFromJSON(cJSON *pro_se_authentication_infoJSON) +{ + OpenAPI_pro_se_authentication_info_t *pro_se_authentication_info_local_var = NULL; + OpenAPI_lnode_t *node = NULL; + cJSON *supi_or_suci = NULL; + cJSON *_5g_pruk_id = NULL; + cJSON *relay_service_code = NULL; + cJSON *nonce1 = NULL; + cJSON *supported_features = NULL; + supi_or_suci = cJSON_GetObjectItemCaseSensitive(pro_se_authentication_infoJSON, "supiOrSuci"); + if (supi_or_suci) { + if (!cJSON_IsString(supi_or_suci) && !cJSON_IsNull(supi_or_suci)) { + ogs_error("OpenAPI_pro_se_authentication_info_parseFromJSON() failed [supi_or_suci]"); + goto end; + } + } + + _5g_pruk_id = cJSON_GetObjectItemCaseSensitive(pro_se_authentication_infoJSON, "5gPrukId"); + if (_5g_pruk_id) { + if (!cJSON_IsString(_5g_pruk_id) && !cJSON_IsNull(_5g_pruk_id)) { + ogs_error("OpenAPI_pro_se_authentication_info_parseFromJSON() failed [_5g_pruk_id]"); + goto end; + } + } + + relay_service_code = cJSON_GetObjectItemCaseSensitive(pro_se_authentication_infoJSON, "relayServiceCode"); + if (!relay_service_code) { + ogs_error("OpenAPI_pro_se_authentication_info_parseFromJSON() failed [relay_service_code]"); + goto end; + } + if (!cJSON_IsNumber(relay_service_code)) { + ogs_error("OpenAPI_pro_se_authentication_info_parseFromJSON() failed [relay_service_code]"); + goto end; + } + + nonce1 = cJSON_GetObjectItemCaseSensitive(pro_se_authentication_infoJSON, "nonce1"); + if (!nonce1) { + ogs_error("OpenAPI_pro_se_authentication_info_parseFromJSON() failed [nonce1]"); + goto end; + } + if (!cJSON_IsString(nonce1)) { + ogs_error("OpenAPI_pro_se_authentication_info_parseFromJSON() failed [nonce1]"); + goto end; + } + + supported_features = cJSON_GetObjectItemCaseSensitive(pro_se_authentication_infoJSON, "supportedFeatures"); + if (supported_features) { + if (!cJSON_IsString(supported_features) && !cJSON_IsNull(supported_features)) { + ogs_error("OpenAPI_pro_se_authentication_info_parseFromJSON() failed [supported_features]"); + goto end; + } + } + + pro_se_authentication_info_local_var = OpenAPI_pro_se_authentication_info_create ( + supi_or_suci && !cJSON_IsNull(supi_or_suci) ? ogs_strdup(supi_or_suci->valuestring) : NULL, + _5g_pruk_id && !cJSON_IsNull(_5g_pruk_id) ? ogs_strdup(_5g_pruk_id->valuestring) : NULL, + + relay_service_code->valuedouble, + ogs_strdup(nonce1->valuestring), + supported_features && !cJSON_IsNull(supported_features) ? ogs_strdup(supported_features->valuestring) : NULL + ); + + return pro_se_authentication_info_local_var; +end: + return NULL; +} + +OpenAPI_pro_se_authentication_info_t *OpenAPI_pro_se_authentication_info_copy(OpenAPI_pro_se_authentication_info_t *dst, OpenAPI_pro_se_authentication_info_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_pro_se_authentication_info_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_pro_se_authentication_info_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_pro_se_authentication_info_free(dst); + dst = OpenAPI_pro_se_authentication_info_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/pro_se_authentication_info.h b/lib/sbi/openapi/model/pro_se_authentication_info.h new file mode 100644 index 000000000..bde70d0d3 --- /dev/null +++ b/lib/sbi/openapi/model/pro_se_authentication_info.h @@ -0,0 +1,46 @@ +/* + * pro_se_authentication_info.h + * + * Contains the UE id (i.e. SUCI) or CP-PRUK ID (in 5gPrukId IE), Relay Service Code and Nonce_1. + */ + +#ifndef _OpenAPI_pro_se_authentication_info_H_ +#define _OpenAPI_pro_se_authentication_info_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_pro_se_authentication_info_s OpenAPI_pro_se_authentication_info_t; +typedef struct OpenAPI_pro_se_authentication_info_s { + char *supi_or_suci; + char *_5g_pruk_id; + int relay_service_code; + char *nonce1; + char *supported_features; +} OpenAPI_pro_se_authentication_info_t; + +OpenAPI_pro_se_authentication_info_t *OpenAPI_pro_se_authentication_info_create( + char *supi_or_suci, + char *_5g_pruk_id, + int relay_service_code, + char *nonce1, + char *supported_features +); +void OpenAPI_pro_se_authentication_info_free(OpenAPI_pro_se_authentication_info_t *pro_se_authentication_info); +OpenAPI_pro_se_authentication_info_t *OpenAPI_pro_se_authentication_info_parseFromJSON(cJSON *pro_se_authentication_infoJSON); +cJSON *OpenAPI_pro_se_authentication_info_convertToJSON(OpenAPI_pro_se_authentication_info_t *pro_se_authentication_info); +OpenAPI_pro_se_authentication_info_t *OpenAPI_pro_se_authentication_info_copy(OpenAPI_pro_se_authentication_info_t *dst, OpenAPI_pro_se_authentication_info_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_pro_se_authentication_info_H_ */ + diff --git a/lib/sbi/openapi/model/pro_se_authentication_info_request.c b/lib/sbi/openapi/model/pro_se_authentication_info_request.c new file mode 100644 index 000000000..5a4d95a01 --- /dev/null +++ b/lib/sbi/openapi/model/pro_se_authentication_info_request.c @@ -0,0 +1,188 @@ + +#include +#include +#include +#include "pro_se_authentication_info_request.h" + +OpenAPI_pro_se_authentication_info_request_t *OpenAPI_pro_se_authentication_info_request_create( + char *serving_network_name, + int relay_service_code, + OpenAPI_resynchronization_info_t *resynchronization_info, + char *supported_features +) +{ + OpenAPI_pro_se_authentication_info_request_t *pro_se_authentication_info_request_local_var = ogs_malloc(sizeof(OpenAPI_pro_se_authentication_info_request_t)); + ogs_assert(pro_se_authentication_info_request_local_var); + + pro_se_authentication_info_request_local_var->serving_network_name = serving_network_name; + pro_se_authentication_info_request_local_var->relay_service_code = relay_service_code; + pro_se_authentication_info_request_local_var->resynchronization_info = resynchronization_info; + pro_se_authentication_info_request_local_var->supported_features = supported_features; + + return pro_se_authentication_info_request_local_var; +} + +void OpenAPI_pro_se_authentication_info_request_free(OpenAPI_pro_se_authentication_info_request_t *pro_se_authentication_info_request) +{ + OpenAPI_lnode_t *node = NULL; + + if (NULL == pro_se_authentication_info_request) { + return; + } + if (pro_se_authentication_info_request->serving_network_name) { + ogs_free(pro_se_authentication_info_request->serving_network_name); + pro_se_authentication_info_request->serving_network_name = NULL; + } + if (pro_se_authentication_info_request->resynchronization_info) { + OpenAPI_resynchronization_info_free(pro_se_authentication_info_request->resynchronization_info); + pro_se_authentication_info_request->resynchronization_info = NULL; + } + if (pro_se_authentication_info_request->supported_features) { + ogs_free(pro_se_authentication_info_request->supported_features); + pro_se_authentication_info_request->supported_features = NULL; + } + ogs_free(pro_se_authentication_info_request); +} + +cJSON *OpenAPI_pro_se_authentication_info_request_convertToJSON(OpenAPI_pro_se_authentication_info_request_t *pro_se_authentication_info_request) +{ + cJSON *item = NULL; + OpenAPI_lnode_t *node = NULL; + + if (pro_se_authentication_info_request == NULL) { + ogs_error("OpenAPI_pro_se_authentication_info_request_convertToJSON() failed [ProSeAuthenticationInfoRequest]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (!pro_se_authentication_info_request->serving_network_name) { + ogs_error("OpenAPI_pro_se_authentication_info_request_convertToJSON() failed [serving_network_name]"); + return NULL; + } + if (cJSON_AddStringToObject(item, "servingNetworkName", pro_se_authentication_info_request->serving_network_name) == NULL) { + ogs_error("OpenAPI_pro_se_authentication_info_request_convertToJSON() failed [serving_network_name]"); + goto end; + } + + if (cJSON_AddNumberToObject(item, "relayServiceCode", pro_se_authentication_info_request->relay_service_code) == NULL) { + ogs_error("OpenAPI_pro_se_authentication_info_request_convertToJSON() failed [relay_service_code]"); + goto end; + } + + if (pro_se_authentication_info_request->resynchronization_info) { + cJSON *resynchronization_info_local_JSON = OpenAPI_resynchronization_info_convertToJSON(pro_se_authentication_info_request->resynchronization_info); + if (resynchronization_info_local_JSON == NULL) { + ogs_error("OpenAPI_pro_se_authentication_info_request_convertToJSON() failed [resynchronization_info]"); + goto end; + } + cJSON_AddItemToObject(item, "resynchronizationInfo", resynchronization_info_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_pro_se_authentication_info_request_convertToJSON() failed [resynchronization_info]"); + goto end; + } + } + + if (pro_se_authentication_info_request->supported_features) { + if (cJSON_AddStringToObject(item, "supportedFeatures", pro_se_authentication_info_request->supported_features) == NULL) { + ogs_error("OpenAPI_pro_se_authentication_info_request_convertToJSON() failed [supported_features]"); + goto end; + } + } + +end: + return item; +} + +OpenAPI_pro_se_authentication_info_request_t *OpenAPI_pro_se_authentication_info_request_parseFromJSON(cJSON *pro_se_authentication_info_requestJSON) +{ + OpenAPI_pro_se_authentication_info_request_t *pro_se_authentication_info_request_local_var = NULL; + OpenAPI_lnode_t *node = NULL; + cJSON *serving_network_name = NULL; + cJSON *relay_service_code = NULL; + cJSON *resynchronization_info = NULL; + OpenAPI_resynchronization_info_t *resynchronization_info_local_nonprim = NULL; + cJSON *supported_features = NULL; + serving_network_name = cJSON_GetObjectItemCaseSensitive(pro_se_authentication_info_requestJSON, "servingNetworkName"); + if (!serving_network_name) { + ogs_error("OpenAPI_pro_se_authentication_info_request_parseFromJSON() failed [serving_network_name]"); + goto end; + } + if (!cJSON_IsString(serving_network_name)) { + ogs_error("OpenAPI_pro_se_authentication_info_request_parseFromJSON() failed [serving_network_name]"); + goto end; + } + + relay_service_code = cJSON_GetObjectItemCaseSensitive(pro_se_authentication_info_requestJSON, "relayServiceCode"); + if (!relay_service_code) { + ogs_error("OpenAPI_pro_se_authentication_info_request_parseFromJSON() failed [relay_service_code]"); + goto end; + } + if (!cJSON_IsNumber(relay_service_code)) { + ogs_error("OpenAPI_pro_se_authentication_info_request_parseFromJSON() failed [relay_service_code]"); + goto end; + } + + resynchronization_info = cJSON_GetObjectItemCaseSensitive(pro_se_authentication_info_requestJSON, "resynchronizationInfo"); + if (resynchronization_info) { + resynchronization_info_local_nonprim = OpenAPI_resynchronization_info_parseFromJSON(resynchronization_info); + } + + supported_features = cJSON_GetObjectItemCaseSensitive(pro_se_authentication_info_requestJSON, "supportedFeatures"); + if (supported_features) { + if (!cJSON_IsString(supported_features) && !cJSON_IsNull(supported_features)) { + ogs_error("OpenAPI_pro_se_authentication_info_request_parseFromJSON() failed [supported_features]"); + goto end; + } + } + + pro_se_authentication_info_request_local_var = OpenAPI_pro_se_authentication_info_request_create ( + ogs_strdup(serving_network_name->valuestring), + + relay_service_code->valuedouble, + resynchronization_info ? resynchronization_info_local_nonprim : NULL, + supported_features && !cJSON_IsNull(supported_features) ? ogs_strdup(supported_features->valuestring) : NULL + ); + + return pro_se_authentication_info_request_local_var; +end: + if (resynchronization_info_local_nonprim) { + OpenAPI_resynchronization_info_free(resynchronization_info_local_nonprim); + resynchronization_info_local_nonprim = NULL; + } + return NULL; +} + +OpenAPI_pro_se_authentication_info_request_t *OpenAPI_pro_se_authentication_info_request_copy(OpenAPI_pro_se_authentication_info_request_t *dst, OpenAPI_pro_se_authentication_info_request_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_pro_se_authentication_info_request_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_pro_se_authentication_info_request_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_pro_se_authentication_info_request_free(dst); + dst = OpenAPI_pro_se_authentication_info_request_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/pro_se_authentication_info_request.h b/lib/sbi/openapi/model/pro_se_authentication_info_request.h new file mode 100644 index 000000000..76ae4a9bd --- /dev/null +++ b/lib/sbi/openapi/model/pro_se_authentication_info_request.h @@ -0,0 +1,45 @@ +/* + * pro_se_authentication_info_request.h + * + * + */ + +#ifndef _OpenAPI_pro_se_authentication_info_request_H_ +#define _OpenAPI_pro_se_authentication_info_request_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "resynchronization_info.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_pro_se_authentication_info_request_s OpenAPI_pro_se_authentication_info_request_t; +typedef struct OpenAPI_pro_se_authentication_info_request_s { + char *serving_network_name; + int relay_service_code; + struct OpenAPI_resynchronization_info_s *resynchronization_info; + char *supported_features; +} OpenAPI_pro_se_authentication_info_request_t; + +OpenAPI_pro_se_authentication_info_request_t *OpenAPI_pro_se_authentication_info_request_create( + char *serving_network_name, + int relay_service_code, + OpenAPI_resynchronization_info_t *resynchronization_info, + char *supported_features +); +void OpenAPI_pro_se_authentication_info_request_free(OpenAPI_pro_se_authentication_info_request_t *pro_se_authentication_info_request); +OpenAPI_pro_se_authentication_info_request_t *OpenAPI_pro_se_authentication_info_request_parseFromJSON(cJSON *pro_se_authentication_info_requestJSON); +cJSON *OpenAPI_pro_se_authentication_info_request_convertToJSON(OpenAPI_pro_se_authentication_info_request_t *pro_se_authentication_info_request); +OpenAPI_pro_se_authentication_info_request_t *OpenAPI_pro_se_authentication_info_request_copy(OpenAPI_pro_se_authentication_info_request_t *dst, OpenAPI_pro_se_authentication_info_request_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_pro_se_authentication_info_request_H_ */ + diff --git a/lib/sbi/openapi/model/pro_se_authentication_info_result.c b/lib/sbi/openapi/model/pro_se_authentication_info_result.c new file mode 100644 index 000000000..29cbe1a3c --- /dev/null +++ b/lib/sbi/openapi/model/pro_se_authentication_info_result.c @@ -0,0 +1,189 @@ + +#include +#include +#include +#include "pro_se_authentication_info_result.h" + +OpenAPI_pro_se_authentication_info_result_t *OpenAPI_pro_se_authentication_info_result_create( + OpenAPI_auth_type_e auth_type, + OpenAPI_pro_se_authentication_vectors_t *prose_authentication_vectors, + char *supi, + char *supported_features +) +{ + OpenAPI_pro_se_authentication_info_result_t *pro_se_authentication_info_result_local_var = ogs_malloc(sizeof(OpenAPI_pro_se_authentication_info_result_t)); + ogs_assert(pro_se_authentication_info_result_local_var); + + pro_se_authentication_info_result_local_var->auth_type = auth_type; + pro_se_authentication_info_result_local_var->prose_authentication_vectors = prose_authentication_vectors; + pro_se_authentication_info_result_local_var->supi = supi; + pro_se_authentication_info_result_local_var->supported_features = supported_features; + + return pro_se_authentication_info_result_local_var; +} + +void OpenAPI_pro_se_authentication_info_result_free(OpenAPI_pro_se_authentication_info_result_t *pro_se_authentication_info_result) +{ + OpenAPI_lnode_t *node = NULL; + + if (NULL == pro_se_authentication_info_result) { + return; + } + if (pro_se_authentication_info_result->prose_authentication_vectors) { + OpenAPI_pro_se_authentication_vectors_free(pro_se_authentication_info_result->prose_authentication_vectors); + pro_se_authentication_info_result->prose_authentication_vectors = NULL; + } + if (pro_se_authentication_info_result->supi) { + ogs_free(pro_se_authentication_info_result->supi); + pro_se_authentication_info_result->supi = NULL; + } + if (pro_se_authentication_info_result->supported_features) { + ogs_free(pro_se_authentication_info_result->supported_features); + pro_se_authentication_info_result->supported_features = NULL; + } + ogs_free(pro_se_authentication_info_result); +} + +cJSON *OpenAPI_pro_se_authentication_info_result_convertToJSON(OpenAPI_pro_se_authentication_info_result_t *pro_se_authentication_info_result) +{ + cJSON *item = NULL; + OpenAPI_lnode_t *node = NULL; + + if (pro_se_authentication_info_result == NULL) { + ogs_error("OpenAPI_pro_se_authentication_info_result_convertToJSON() failed [ProSeAuthenticationInfoResult]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (pro_se_authentication_info_result->auth_type == OpenAPI_auth_type_NULL) { + ogs_error("OpenAPI_pro_se_authentication_info_result_convertToJSON() failed [auth_type]"); + return NULL; + } + if (cJSON_AddStringToObject(item, "authType", OpenAPI_auth_type_ToString(pro_se_authentication_info_result->auth_type)) == NULL) { + ogs_error("OpenAPI_pro_se_authentication_info_result_convertToJSON() failed [auth_type]"); + goto end; + } + + if (pro_se_authentication_info_result->prose_authentication_vectors) { + cJSON *prose_authentication_vectors_local_JSON = OpenAPI_pro_se_authentication_vectors_convertToJSON(pro_se_authentication_info_result->prose_authentication_vectors); + if (prose_authentication_vectors_local_JSON == NULL) { + ogs_error("OpenAPI_pro_se_authentication_info_result_convertToJSON() failed [prose_authentication_vectors]"); + goto end; + } + cJSON_AddItemToObject(item, "proseAuthenticationVectors", prose_authentication_vectors_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_pro_se_authentication_info_result_convertToJSON() failed [prose_authentication_vectors]"); + goto end; + } + } + + if (pro_se_authentication_info_result->supi) { + if (cJSON_AddStringToObject(item, "supi", pro_se_authentication_info_result->supi) == NULL) { + ogs_error("OpenAPI_pro_se_authentication_info_result_convertToJSON() failed [supi]"); + goto end; + } + } + + if (pro_se_authentication_info_result->supported_features) { + if (cJSON_AddStringToObject(item, "supportedFeatures", pro_se_authentication_info_result->supported_features) == NULL) { + ogs_error("OpenAPI_pro_se_authentication_info_result_convertToJSON() failed [supported_features]"); + goto end; + } + } + +end: + return item; +} + +OpenAPI_pro_se_authentication_info_result_t *OpenAPI_pro_se_authentication_info_result_parseFromJSON(cJSON *pro_se_authentication_info_resultJSON) +{ + OpenAPI_pro_se_authentication_info_result_t *pro_se_authentication_info_result_local_var = NULL; + OpenAPI_lnode_t *node = NULL; + cJSON *auth_type = NULL; + OpenAPI_auth_type_e auth_typeVariable = 0; + cJSON *prose_authentication_vectors = NULL; + OpenAPI_pro_se_authentication_vectors_t *prose_authentication_vectors_local_nonprim = NULL; + cJSON *supi = NULL; + cJSON *supported_features = NULL; + auth_type = cJSON_GetObjectItemCaseSensitive(pro_se_authentication_info_resultJSON, "authType"); + if (!auth_type) { + ogs_error("OpenAPI_pro_se_authentication_info_result_parseFromJSON() failed [auth_type]"); + goto end; + } + if (!cJSON_IsString(auth_type)) { + ogs_error("OpenAPI_pro_se_authentication_info_result_parseFromJSON() failed [auth_type]"); + goto end; + } + auth_typeVariable = OpenAPI_auth_type_FromString(auth_type->valuestring); + + prose_authentication_vectors = cJSON_GetObjectItemCaseSensitive(pro_se_authentication_info_resultJSON, "proseAuthenticationVectors"); + if (prose_authentication_vectors) { + prose_authentication_vectors_local_nonprim = OpenAPI_pro_se_authentication_vectors_parseFromJSON(prose_authentication_vectors); + } + + supi = cJSON_GetObjectItemCaseSensitive(pro_se_authentication_info_resultJSON, "supi"); + if (supi) { + if (!cJSON_IsString(supi) && !cJSON_IsNull(supi)) { + ogs_error("OpenAPI_pro_se_authentication_info_result_parseFromJSON() failed [supi]"); + goto end; + } + } + + supported_features = cJSON_GetObjectItemCaseSensitive(pro_se_authentication_info_resultJSON, "supportedFeatures"); + if (supported_features) { + if (!cJSON_IsString(supported_features) && !cJSON_IsNull(supported_features)) { + ogs_error("OpenAPI_pro_se_authentication_info_result_parseFromJSON() failed [supported_features]"); + goto end; + } + } + + pro_se_authentication_info_result_local_var = OpenAPI_pro_se_authentication_info_result_create ( + auth_typeVariable, + prose_authentication_vectors ? prose_authentication_vectors_local_nonprim : NULL, + supi && !cJSON_IsNull(supi) ? ogs_strdup(supi->valuestring) : NULL, + supported_features && !cJSON_IsNull(supported_features) ? ogs_strdup(supported_features->valuestring) : NULL + ); + + return pro_se_authentication_info_result_local_var; +end: + if (prose_authentication_vectors_local_nonprim) { + OpenAPI_pro_se_authentication_vectors_free(prose_authentication_vectors_local_nonprim); + prose_authentication_vectors_local_nonprim = NULL; + } + return NULL; +} + +OpenAPI_pro_se_authentication_info_result_t *OpenAPI_pro_se_authentication_info_result_copy(OpenAPI_pro_se_authentication_info_result_t *dst, OpenAPI_pro_se_authentication_info_result_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_pro_se_authentication_info_result_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_pro_se_authentication_info_result_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_pro_se_authentication_info_result_free(dst); + dst = OpenAPI_pro_se_authentication_info_result_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/pro_se_authentication_info_result.h b/lib/sbi/openapi/model/pro_se_authentication_info_result.h new file mode 100644 index 000000000..6ed0ab81b --- /dev/null +++ b/lib/sbi/openapi/model/pro_se_authentication_info_result.h @@ -0,0 +1,46 @@ +/* + * pro_se_authentication_info_result.h + * + * + */ + +#ifndef _OpenAPI_pro_se_authentication_info_result_H_ +#define _OpenAPI_pro_se_authentication_info_result_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "auth_type.h" +#include "pro_se_authentication_vectors.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_pro_se_authentication_info_result_s OpenAPI_pro_se_authentication_info_result_t; +typedef struct OpenAPI_pro_se_authentication_info_result_s { + OpenAPI_auth_type_e auth_type; + struct OpenAPI_pro_se_authentication_vectors_s *prose_authentication_vectors; + char *supi; + char *supported_features; +} OpenAPI_pro_se_authentication_info_result_t; + +OpenAPI_pro_se_authentication_info_result_t *OpenAPI_pro_se_authentication_info_result_create( + OpenAPI_auth_type_e auth_type, + OpenAPI_pro_se_authentication_vectors_t *prose_authentication_vectors, + char *supi, + char *supported_features +); +void OpenAPI_pro_se_authentication_info_result_free(OpenAPI_pro_se_authentication_info_result_t *pro_se_authentication_info_result); +OpenAPI_pro_se_authentication_info_result_t *OpenAPI_pro_se_authentication_info_result_parseFromJSON(cJSON *pro_se_authentication_info_resultJSON); +cJSON *OpenAPI_pro_se_authentication_info_result_convertToJSON(OpenAPI_pro_se_authentication_info_result_t *pro_se_authentication_info_result); +OpenAPI_pro_se_authentication_info_result_t *OpenAPI_pro_se_authentication_info_result_copy(OpenAPI_pro_se_authentication_info_result_t *dst, OpenAPI_pro_se_authentication_info_result_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_pro_se_authentication_info_result_H_ */ + diff --git a/lib/sbi/openapi/model/pro_se_authentication_result.c b/lib/sbi/openapi/model/pro_se_authentication_result.c new file mode 100644 index 000000000..d2adf85aa --- /dev/null +++ b/lib/sbi/openapi/model/pro_se_authentication_result.c @@ -0,0 +1,156 @@ + +#include +#include +#include +#include "pro_se_authentication_result.h" + +OpenAPI_pro_se_authentication_result_t *OpenAPI_pro_se_authentication_result_create( + char *knr_pro_se, + char *nonce2, + char *supported_features +) +{ + OpenAPI_pro_se_authentication_result_t *pro_se_authentication_result_local_var = ogs_malloc(sizeof(OpenAPI_pro_se_authentication_result_t)); + ogs_assert(pro_se_authentication_result_local_var); + + pro_se_authentication_result_local_var->knr_pro_se = knr_pro_se; + pro_se_authentication_result_local_var->nonce2 = nonce2; + pro_se_authentication_result_local_var->supported_features = supported_features; + + return pro_se_authentication_result_local_var; +} + +void OpenAPI_pro_se_authentication_result_free(OpenAPI_pro_se_authentication_result_t *pro_se_authentication_result) +{ + OpenAPI_lnode_t *node = NULL; + + if (NULL == pro_se_authentication_result) { + return; + } + if (pro_se_authentication_result->knr_pro_se) { + ogs_free(pro_se_authentication_result->knr_pro_se); + pro_se_authentication_result->knr_pro_se = NULL; + } + if (pro_se_authentication_result->nonce2) { + ogs_free(pro_se_authentication_result->nonce2); + pro_se_authentication_result->nonce2 = NULL; + } + if (pro_se_authentication_result->supported_features) { + ogs_free(pro_se_authentication_result->supported_features); + pro_se_authentication_result->supported_features = NULL; + } + ogs_free(pro_se_authentication_result); +} + +cJSON *OpenAPI_pro_se_authentication_result_convertToJSON(OpenAPI_pro_se_authentication_result_t *pro_se_authentication_result) +{ + cJSON *item = NULL; + OpenAPI_lnode_t *node = NULL; + + if (pro_se_authentication_result == NULL) { + ogs_error("OpenAPI_pro_se_authentication_result_convertToJSON() failed [ProSeAuthenticationResult]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (pro_se_authentication_result->knr_pro_se) { + if (cJSON_AddStringToObject(item, "knrProSe", pro_se_authentication_result->knr_pro_se) == NULL) { + ogs_error("OpenAPI_pro_se_authentication_result_convertToJSON() failed [knr_pro_se]"); + goto end; + } + } + + if (pro_se_authentication_result->nonce2) { + if (cJSON_AddStringToObject(item, "nonce2", pro_se_authentication_result->nonce2) == NULL) { + ogs_error("OpenAPI_pro_se_authentication_result_convertToJSON() failed [nonce2]"); + goto end; + } + } + + if (pro_se_authentication_result->supported_features) { + if (cJSON_AddStringToObject(item, "supportedFeatures", pro_se_authentication_result->supported_features) == NULL) { + ogs_error("OpenAPI_pro_se_authentication_result_convertToJSON() failed [supported_features]"); + goto end; + } + } + +end: + return item; +} + +OpenAPI_pro_se_authentication_result_t *OpenAPI_pro_se_authentication_result_parseFromJSON(cJSON *pro_se_authentication_resultJSON) +{ + OpenAPI_pro_se_authentication_result_t *pro_se_authentication_result_local_var = NULL; + OpenAPI_lnode_t *node = NULL; + cJSON *knr_pro_se = NULL; + cJSON *nonce2 = NULL; + cJSON *supported_features = NULL; + knr_pro_se = cJSON_GetObjectItemCaseSensitive(pro_se_authentication_resultJSON, "knrProSe"); + if (knr_pro_se) { + if (!cJSON_IsString(knr_pro_se) && !cJSON_IsNull(knr_pro_se)) { + ogs_error("OpenAPI_pro_se_authentication_result_parseFromJSON() failed [knr_pro_se]"); + goto end; + } + } + + nonce2 = cJSON_GetObjectItemCaseSensitive(pro_se_authentication_resultJSON, "nonce2"); + if (nonce2) { + if (!cJSON_IsString(nonce2) && !cJSON_IsNull(nonce2)) { + ogs_error("OpenAPI_pro_se_authentication_result_parseFromJSON() failed [nonce2]"); + goto end; + } + } + + supported_features = cJSON_GetObjectItemCaseSensitive(pro_se_authentication_resultJSON, "supportedFeatures"); + if (supported_features) { + if (!cJSON_IsString(supported_features) && !cJSON_IsNull(supported_features)) { + ogs_error("OpenAPI_pro_se_authentication_result_parseFromJSON() failed [supported_features]"); + goto end; + } + } + + pro_se_authentication_result_local_var = OpenAPI_pro_se_authentication_result_create ( + knr_pro_se && !cJSON_IsNull(knr_pro_se) ? ogs_strdup(knr_pro_se->valuestring) : NULL, + nonce2 && !cJSON_IsNull(nonce2) ? ogs_strdup(nonce2->valuestring) : NULL, + supported_features && !cJSON_IsNull(supported_features) ? ogs_strdup(supported_features->valuestring) : NULL + ); + + return pro_se_authentication_result_local_var; +end: + return NULL; +} + +OpenAPI_pro_se_authentication_result_t *OpenAPI_pro_se_authentication_result_copy(OpenAPI_pro_se_authentication_result_t *dst, OpenAPI_pro_se_authentication_result_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_pro_se_authentication_result_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_pro_se_authentication_result_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_pro_se_authentication_result_free(dst); + dst = OpenAPI_pro_se_authentication_result_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/pro_se_authentication_result.h b/lib/sbi/openapi/model/pro_se_authentication_result.h new file mode 100644 index 000000000..db76ff741 --- /dev/null +++ b/lib/sbi/openapi/model/pro_se_authentication_result.h @@ -0,0 +1,42 @@ +/* + * pro_se_authentication_result.h + * + * Successful authentication for CP-PRUK ID. + */ + +#ifndef _OpenAPI_pro_se_authentication_result_H_ +#define _OpenAPI_pro_se_authentication_result_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_pro_se_authentication_result_s OpenAPI_pro_se_authentication_result_t; +typedef struct OpenAPI_pro_se_authentication_result_s { + char *knr_pro_se; + char *nonce2; + char *supported_features; +} OpenAPI_pro_se_authentication_result_t; + +OpenAPI_pro_se_authentication_result_t *OpenAPI_pro_se_authentication_result_create( + char *knr_pro_se, + char *nonce2, + char *supported_features +); +void OpenAPI_pro_se_authentication_result_free(OpenAPI_pro_se_authentication_result_t *pro_se_authentication_result); +OpenAPI_pro_se_authentication_result_t *OpenAPI_pro_se_authentication_result_parseFromJSON(cJSON *pro_se_authentication_resultJSON); +cJSON *OpenAPI_pro_se_authentication_result_convertToJSON(OpenAPI_pro_se_authentication_result_t *pro_se_authentication_result); +OpenAPI_pro_se_authentication_result_t *OpenAPI_pro_se_authentication_result_copy(OpenAPI_pro_se_authentication_result_t *dst, OpenAPI_pro_se_authentication_result_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_pro_se_authentication_result_H_ */ + diff --git a/lib/sbi/openapi/model/pro_se_authentication_vectors.c b/lib/sbi/openapi/model/pro_se_authentication_vectors.c new file mode 100644 index 000000000..10d69b465 --- /dev/null +++ b/lib/sbi/openapi/model/pro_se_authentication_vectors.c @@ -0,0 +1,87 @@ + +#include +#include +#include +#include "pro_se_authentication_vectors.h" + +OpenAPI_pro_se_authentication_vectors_t *OpenAPI_pro_se_authentication_vectors_create( +) +{ + OpenAPI_pro_se_authentication_vectors_t *pro_se_authentication_vectors_local_var = ogs_malloc(sizeof(OpenAPI_pro_se_authentication_vectors_t)); + ogs_assert(pro_se_authentication_vectors_local_var); + + + return pro_se_authentication_vectors_local_var; +} + +void OpenAPI_pro_se_authentication_vectors_free(OpenAPI_pro_se_authentication_vectors_t *pro_se_authentication_vectors) +{ + OpenAPI_lnode_t *node = NULL; + + if (NULL == pro_se_authentication_vectors) { + return; + } + ogs_free(pro_se_authentication_vectors); +} + +cJSON *OpenAPI_pro_se_authentication_vectors_convertToJSON(OpenAPI_pro_se_authentication_vectors_t *pro_se_authentication_vectors) +{ + cJSON *item = NULL; + OpenAPI_lnode_t *node = NULL; + + if (pro_se_authentication_vectors == NULL) { + ogs_error("OpenAPI_pro_se_authentication_vectors_convertToJSON() failed [ProSeAuthenticationVectors]"); + return NULL; + } + + item = cJSON_CreateObject(); +end: + return item; +} + +OpenAPI_pro_se_authentication_vectors_t *OpenAPI_pro_se_authentication_vectors_parseFromJSON(cJSON *pro_se_authentication_vectorsJSON) +{ + OpenAPI_pro_se_authentication_vectors_t *pro_se_authentication_vectors_local_var = NULL; + OpenAPI_lnode_t *node = NULL; + pro_se_authentication_vectors_local_var = OpenAPI_pro_se_authentication_vectors_create ( + ); + + return pro_se_authentication_vectors_local_var; +end: + return NULL; +} + +OpenAPI_pro_se_authentication_vectors_t *OpenAPI_pro_se_authentication_vectors_copy(OpenAPI_pro_se_authentication_vectors_t *dst, OpenAPI_pro_se_authentication_vectors_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_pro_se_authentication_vectors_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_pro_se_authentication_vectors_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_pro_se_authentication_vectors_free(dst); + dst = OpenAPI_pro_se_authentication_vectors_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/pro_se_authentication_vectors.h b/lib/sbi/openapi/model/pro_se_authentication_vectors.h new file mode 100644 index 000000000..67c62c452 --- /dev/null +++ b/lib/sbi/openapi/model/pro_se_authentication_vectors.h @@ -0,0 +1,37 @@ +/* + * pro_se_authentication_vectors.h + * + * + */ + +#ifndef _OpenAPI_pro_se_authentication_vectors_H_ +#define _OpenAPI_pro_se_authentication_vectors_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "av_eap_aka_prime.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_pro_se_authentication_vectors_s OpenAPI_pro_se_authentication_vectors_t; +typedef struct OpenAPI_pro_se_authentication_vectors_s { +} OpenAPI_pro_se_authentication_vectors_t; + +OpenAPI_pro_se_authentication_vectors_t *OpenAPI_pro_se_authentication_vectors_create( +); +void OpenAPI_pro_se_authentication_vectors_free(OpenAPI_pro_se_authentication_vectors_t *pro_se_authentication_vectors); +OpenAPI_pro_se_authentication_vectors_t *OpenAPI_pro_se_authentication_vectors_parseFromJSON(cJSON *pro_se_authentication_vectorsJSON); +cJSON *OpenAPI_pro_se_authentication_vectors_convertToJSON(OpenAPI_pro_se_authentication_vectors_t *pro_se_authentication_vectors); +OpenAPI_pro_se_authentication_vectors_t *OpenAPI_pro_se_authentication_vectors_copy(OpenAPI_pro_se_authentication_vectors_t *dst, OpenAPI_pro_se_authentication_vectors_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_pro_se_authentication_vectors_H_ */ + diff --git a/lib/sbi/openapi/model/pro_se_capability.c b/lib/sbi/openapi/model/pro_se_capability.c new file mode 100644 index 000000000..7c9cadb5c --- /dev/null +++ b/lib/sbi/openapi/model/pro_se_capability.c @@ -0,0 +1,219 @@ + +#include +#include +#include +#include "pro_se_capability.h" + +OpenAPI_pro_se_capability_t *OpenAPI_pro_se_capability_create( + bool is_prose_direct_discovey, + int prose_direct_discovey, + bool is_prose_direct_communication, + int prose_direct_communication, + bool is_prose_l2_ueto_network_relay, + int prose_l2_ueto_network_relay, + bool is_prose_l3_ueto_network_relay, + int prose_l3_ueto_network_relay, + bool is_prose_l2_remote_ue, + int prose_l2_remote_ue, + bool is_prose_l3_remote_ue, + int prose_l3_remote_ue +) +{ + OpenAPI_pro_se_capability_t *pro_se_capability_local_var = ogs_malloc(sizeof(OpenAPI_pro_se_capability_t)); + ogs_assert(pro_se_capability_local_var); + + pro_se_capability_local_var->is_prose_direct_discovey = is_prose_direct_discovey; + pro_se_capability_local_var->prose_direct_discovey = prose_direct_discovey; + pro_se_capability_local_var->is_prose_direct_communication = is_prose_direct_communication; + pro_se_capability_local_var->prose_direct_communication = prose_direct_communication; + pro_se_capability_local_var->is_prose_l2_ueto_network_relay = is_prose_l2_ueto_network_relay; + pro_se_capability_local_var->prose_l2_ueto_network_relay = prose_l2_ueto_network_relay; + pro_se_capability_local_var->is_prose_l3_ueto_network_relay = is_prose_l3_ueto_network_relay; + pro_se_capability_local_var->prose_l3_ueto_network_relay = prose_l3_ueto_network_relay; + pro_se_capability_local_var->is_prose_l2_remote_ue = is_prose_l2_remote_ue; + pro_se_capability_local_var->prose_l2_remote_ue = prose_l2_remote_ue; + pro_se_capability_local_var->is_prose_l3_remote_ue = is_prose_l3_remote_ue; + pro_se_capability_local_var->prose_l3_remote_ue = prose_l3_remote_ue; + + return pro_se_capability_local_var; +} + +void OpenAPI_pro_se_capability_free(OpenAPI_pro_se_capability_t *pro_se_capability) +{ + OpenAPI_lnode_t *node = NULL; + + if (NULL == pro_se_capability) { + return; + } + ogs_free(pro_se_capability); +} + +cJSON *OpenAPI_pro_se_capability_convertToJSON(OpenAPI_pro_se_capability_t *pro_se_capability) +{ + cJSON *item = NULL; + OpenAPI_lnode_t *node = NULL; + + if (pro_se_capability == NULL) { + ogs_error("OpenAPI_pro_se_capability_convertToJSON() failed [ProSeCapability]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (pro_se_capability->is_prose_direct_discovey) { + if (cJSON_AddBoolToObject(item, "proseDirectDiscovey", pro_se_capability->prose_direct_discovey) == NULL) { + ogs_error("OpenAPI_pro_se_capability_convertToJSON() failed [prose_direct_discovey]"); + goto end; + } + } + + if (pro_se_capability->is_prose_direct_communication) { + if (cJSON_AddBoolToObject(item, "proseDirectCommunication", pro_se_capability->prose_direct_communication) == NULL) { + ogs_error("OpenAPI_pro_se_capability_convertToJSON() failed [prose_direct_communication]"); + goto end; + } + } + + if (pro_se_capability->is_prose_l2_ueto_network_relay) { + if (cJSON_AddBoolToObject(item, "proseL2UetoNetworkRelay", pro_se_capability->prose_l2_ueto_network_relay) == NULL) { + ogs_error("OpenAPI_pro_se_capability_convertToJSON() failed [prose_l2_ueto_network_relay]"); + goto end; + } + } + + if (pro_se_capability->is_prose_l3_ueto_network_relay) { + if (cJSON_AddBoolToObject(item, "proseL3UetoNetworkRelay", pro_se_capability->prose_l3_ueto_network_relay) == NULL) { + ogs_error("OpenAPI_pro_se_capability_convertToJSON() failed [prose_l3_ueto_network_relay]"); + goto end; + } + } + + if (pro_se_capability->is_prose_l2_remote_ue) { + if (cJSON_AddBoolToObject(item, "proseL2RemoteUe", pro_se_capability->prose_l2_remote_ue) == NULL) { + ogs_error("OpenAPI_pro_se_capability_convertToJSON() failed [prose_l2_remote_ue]"); + goto end; + } + } + + if (pro_se_capability->is_prose_l3_remote_ue) { + if (cJSON_AddBoolToObject(item, "proseL3RemoteUe", pro_se_capability->prose_l3_remote_ue) == NULL) { + ogs_error("OpenAPI_pro_se_capability_convertToJSON() failed [prose_l3_remote_ue]"); + goto end; + } + } + +end: + return item; +} + +OpenAPI_pro_se_capability_t *OpenAPI_pro_se_capability_parseFromJSON(cJSON *pro_se_capabilityJSON) +{ + OpenAPI_pro_se_capability_t *pro_se_capability_local_var = NULL; + OpenAPI_lnode_t *node = NULL; + cJSON *prose_direct_discovey = NULL; + cJSON *prose_direct_communication = NULL; + cJSON *prose_l2_ueto_network_relay = NULL; + cJSON *prose_l3_ueto_network_relay = NULL; + cJSON *prose_l2_remote_ue = NULL; + cJSON *prose_l3_remote_ue = NULL; + prose_direct_discovey = cJSON_GetObjectItemCaseSensitive(pro_se_capabilityJSON, "proseDirectDiscovey"); + if (prose_direct_discovey) { + if (!cJSON_IsBool(prose_direct_discovey)) { + ogs_error("OpenAPI_pro_se_capability_parseFromJSON() failed [prose_direct_discovey]"); + goto end; + } + } + + prose_direct_communication = cJSON_GetObjectItemCaseSensitive(pro_se_capabilityJSON, "proseDirectCommunication"); + if (prose_direct_communication) { + if (!cJSON_IsBool(prose_direct_communication)) { + ogs_error("OpenAPI_pro_se_capability_parseFromJSON() failed [prose_direct_communication]"); + goto end; + } + } + + prose_l2_ueto_network_relay = cJSON_GetObjectItemCaseSensitive(pro_se_capabilityJSON, "proseL2UetoNetworkRelay"); + if (prose_l2_ueto_network_relay) { + if (!cJSON_IsBool(prose_l2_ueto_network_relay)) { + ogs_error("OpenAPI_pro_se_capability_parseFromJSON() failed [prose_l2_ueto_network_relay]"); + goto end; + } + } + + prose_l3_ueto_network_relay = cJSON_GetObjectItemCaseSensitive(pro_se_capabilityJSON, "proseL3UetoNetworkRelay"); + if (prose_l3_ueto_network_relay) { + if (!cJSON_IsBool(prose_l3_ueto_network_relay)) { + ogs_error("OpenAPI_pro_se_capability_parseFromJSON() failed [prose_l3_ueto_network_relay]"); + goto end; + } + } + + prose_l2_remote_ue = cJSON_GetObjectItemCaseSensitive(pro_se_capabilityJSON, "proseL2RemoteUe"); + if (prose_l2_remote_ue) { + if (!cJSON_IsBool(prose_l2_remote_ue)) { + ogs_error("OpenAPI_pro_se_capability_parseFromJSON() failed [prose_l2_remote_ue]"); + goto end; + } + } + + prose_l3_remote_ue = cJSON_GetObjectItemCaseSensitive(pro_se_capabilityJSON, "proseL3RemoteUe"); + if (prose_l3_remote_ue) { + if (!cJSON_IsBool(prose_l3_remote_ue)) { + ogs_error("OpenAPI_pro_se_capability_parseFromJSON() failed [prose_l3_remote_ue]"); + goto end; + } + } + + pro_se_capability_local_var = OpenAPI_pro_se_capability_create ( + prose_direct_discovey ? true : false, + prose_direct_discovey ? prose_direct_discovey->valueint : 0, + prose_direct_communication ? true : false, + prose_direct_communication ? prose_direct_communication->valueint : 0, + prose_l2_ueto_network_relay ? true : false, + prose_l2_ueto_network_relay ? prose_l2_ueto_network_relay->valueint : 0, + prose_l3_ueto_network_relay ? true : false, + prose_l3_ueto_network_relay ? prose_l3_ueto_network_relay->valueint : 0, + prose_l2_remote_ue ? true : false, + prose_l2_remote_ue ? prose_l2_remote_ue->valueint : 0, + prose_l3_remote_ue ? true : false, + prose_l3_remote_ue ? prose_l3_remote_ue->valueint : 0 + ); + + return pro_se_capability_local_var; +end: + return NULL; +} + +OpenAPI_pro_se_capability_t *OpenAPI_pro_se_capability_copy(OpenAPI_pro_se_capability_t *dst, OpenAPI_pro_se_capability_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_pro_se_capability_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_pro_se_capability_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_pro_se_capability_free(dst); + dst = OpenAPI_pro_se_capability_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/pro_se_capability.h b/lib/sbi/openapi/model/pro_se_capability.h new file mode 100644 index 000000000..3b8594bd9 --- /dev/null +++ b/lib/sbi/openapi/model/pro_se_capability.h @@ -0,0 +1,60 @@ +/* + * pro_se_capability.h + * + * Indicate the supported ProSe Capability by the PCF. + */ + +#ifndef _OpenAPI_pro_se_capability_H_ +#define _OpenAPI_pro_se_capability_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_pro_se_capability_s OpenAPI_pro_se_capability_t; +typedef struct OpenAPI_pro_se_capability_s { + bool is_prose_direct_discovey; + int prose_direct_discovey; + bool is_prose_direct_communication; + int prose_direct_communication; + bool is_prose_l2_ueto_network_relay; + int prose_l2_ueto_network_relay; + bool is_prose_l3_ueto_network_relay; + int prose_l3_ueto_network_relay; + bool is_prose_l2_remote_ue; + int prose_l2_remote_ue; + bool is_prose_l3_remote_ue; + int prose_l3_remote_ue; +} OpenAPI_pro_se_capability_t; + +OpenAPI_pro_se_capability_t *OpenAPI_pro_se_capability_create( + bool is_prose_direct_discovey, + int prose_direct_discovey, + bool is_prose_direct_communication, + int prose_direct_communication, + bool is_prose_l2_ueto_network_relay, + int prose_l2_ueto_network_relay, + bool is_prose_l3_ueto_network_relay, + int prose_l3_ueto_network_relay, + bool is_prose_l2_remote_ue, + int prose_l2_remote_ue, + bool is_prose_l3_remote_ue, + int prose_l3_remote_ue +); +void OpenAPI_pro_se_capability_free(OpenAPI_pro_se_capability_t *pro_se_capability); +OpenAPI_pro_se_capability_t *OpenAPI_pro_se_capability_parseFromJSON(cJSON *pro_se_capabilityJSON); +cJSON *OpenAPI_pro_se_capability_convertToJSON(OpenAPI_pro_se_capability_t *pro_se_capability); +OpenAPI_pro_se_capability_t *OpenAPI_pro_se_capability_copy(OpenAPI_pro_se_capability_t *dst, OpenAPI_pro_se_capability_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_pro_se_capability_H_ */ + diff --git a/lib/sbi/openapi/model/pro_se_eap_session.c b/lib/sbi/openapi/model/pro_se_eap_session.c new file mode 100644 index 000000000..e2320373f --- /dev/null +++ b/lib/sbi/openapi/model/pro_se_eap_session.c @@ -0,0 +1,300 @@ + +#include +#include +#include +#include "pro_se_eap_session.h" + +OpenAPI_pro_se_eap_session_t *OpenAPI_pro_se_eap_session_create( + char *eap_payload, + char *knr_pro_se, + OpenAPI_list_t* _links, + OpenAPI_auth_result_e auth_result, + char *supported_features, + char *nonce2, + char *_5g_pruk_id +) +{ + OpenAPI_pro_se_eap_session_t *pro_se_eap_session_local_var = ogs_malloc(sizeof(OpenAPI_pro_se_eap_session_t)); + ogs_assert(pro_se_eap_session_local_var); + + pro_se_eap_session_local_var->eap_payload = eap_payload; + pro_se_eap_session_local_var->knr_pro_se = knr_pro_se; + pro_se_eap_session_local_var->_links = _links; + pro_se_eap_session_local_var->auth_result = auth_result; + pro_se_eap_session_local_var->supported_features = supported_features; + pro_se_eap_session_local_var->nonce2 = nonce2; + pro_se_eap_session_local_var->_5g_pruk_id = _5g_pruk_id; + + return pro_se_eap_session_local_var; +} + +void OpenAPI_pro_se_eap_session_free(OpenAPI_pro_se_eap_session_t *pro_se_eap_session) +{ + OpenAPI_lnode_t *node = NULL; + + if (NULL == pro_se_eap_session) { + return; + } + if (pro_se_eap_session->eap_payload) { + ogs_free(pro_se_eap_session->eap_payload); + pro_se_eap_session->eap_payload = NULL; + } + if (pro_se_eap_session->knr_pro_se) { + ogs_free(pro_se_eap_session->knr_pro_se); + pro_se_eap_session->knr_pro_se = NULL; + } + if (pro_se_eap_session->_links) { + OpenAPI_list_for_each(pro_se_eap_session->_links, node) { + OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*)node->data; + ogs_free(localKeyValue->key); + OpenAPI_links_value_schema_free(localKeyValue->value); + OpenAPI_map_free(localKeyValue); + } + OpenAPI_list_free(pro_se_eap_session->_links); + pro_se_eap_session->_links = NULL; + } + if (pro_se_eap_session->supported_features) { + ogs_free(pro_se_eap_session->supported_features); + pro_se_eap_session->supported_features = NULL; + } + if (pro_se_eap_session->nonce2) { + ogs_free(pro_se_eap_session->nonce2); + pro_se_eap_session->nonce2 = NULL; + } + if (pro_se_eap_session->_5g_pruk_id) { + ogs_free(pro_se_eap_session->_5g_pruk_id); + pro_se_eap_session->_5g_pruk_id = NULL; + } + ogs_free(pro_se_eap_session); +} + +cJSON *OpenAPI_pro_se_eap_session_convertToJSON(OpenAPI_pro_se_eap_session_t *pro_se_eap_session) +{ + cJSON *item = NULL; + OpenAPI_lnode_t *node = NULL; + + if (pro_se_eap_session == NULL) { + ogs_error("OpenAPI_pro_se_eap_session_convertToJSON() failed [ProSeEapSession]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (!pro_se_eap_session->eap_payload) { + ogs_error("OpenAPI_pro_se_eap_session_convertToJSON() failed [eap_payload]"); + return NULL; + } + if (cJSON_AddStringToObject(item, "eapPayload", pro_se_eap_session->eap_payload) == NULL) { + ogs_error("OpenAPI_pro_se_eap_session_convertToJSON() failed [eap_payload]"); + goto end; + } + + if (pro_se_eap_session->knr_pro_se) { + if (cJSON_AddStringToObject(item, "knrProSe", pro_se_eap_session->knr_pro_se) == NULL) { + ogs_error("OpenAPI_pro_se_eap_session_convertToJSON() failed [knr_pro_se]"); + goto end; + } + } + + if (pro_se_eap_session->_links) { + cJSON *_links = cJSON_AddObjectToObject(item, "_links"); + if (_links == NULL) { + ogs_error("OpenAPI_pro_se_eap_session_convertToJSON() failed [_links]"); + goto end; + } + cJSON *localMapObject = _links; + if (pro_se_eap_session->_links) { + OpenAPI_list_for_each(pro_se_eap_session->_links, node) { + OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*)node->data; + cJSON *itemLocal = localKeyValue->value ? + OpenAPI_links_value_schema_convertToJSON(localKeyValue->value) : + cJSON_CreateNull(); + if (itemLocal == NULL) { + ogs_error("OpenAPI_pro_se_eap_session_convertToJSON() failed [inner]"); + goto end; + } + cJSON_AddItemToObject(localMapObject, localKeyValue->key, itemLocal); + } + } + } + + if (pro_se_eap_session->auth_result != OpenAPI_auth_result_NULL) { + if (cJSON_AddStringToObject(item, "authResult", OpenAPI_auth_result_ToString(pro_se_eap_session->auth_result)) == NULL) { + ogs_error("OpenAPI_pro_se_eap_session_convertToJSON() failed [auth_result]"); + goto end; + } + } + + if (pro_se_eap_session->supported_features) { + if (cJSON_AddStringToObject(item, "supportedFeatures", pro_se_eap_session->supported_features) == NULL) { + ogs_error("OpenAPI_pro_se_eap_session_convertToJSON() failed [supported_features]"); + goto end; + } + } + + if (pro_se_eap_session->nonce2) { + if (cJSON_AddStringToObject(item, "nonce2", pro_se_eap_session->nonce2) == NULL) { + ogs_error("OpenAPI_pro_se_eap_session_convertToJSON() failed [nonce2]"); + goto end; + } + } + + if (pro_se_eap_session->_5g_pruk_id) { + if (cJSON_AddStringToObject(item, "5gPrukId", pro_se_eap_session->_5g_pruk_id) == NULL) { + ogs_error("OpenAPI_pro_se_eap_session_convertToJSON() failed [_5g_pruk_id]"); + goto end; + } + } + +end: + return item; +} + +OpenAPI_pro_se_eap_session_t *OpenAPI_pro_se_eap_session_parseFromJSON(cJSON *pro_se_eap_sessionJSON) +{ + OpenAPI_pro_se_eap_session_t *pro_se_eap_session_local_var = NULL; + OpenAPI_lnode_t *node = NULL; + cJSON *eap_payload = NULL; + cJSON *knr_pro_se = NULL; + cJSON *_links = NULL; + OpenAPI_list_t *_linksList = NULL; + cJSON *auth_result = NULL; + OpenAPI_auth_result_e auth_resultVariable = 0; + cJSON *supported_features = NULL; + cJSON *nonce2 = NULL; + cJSON *_5g_pruk_id = NULL; + eap_payload = cJSON_GetObjectItemCaseSensitive(pro_se_eap_sessionJSON, "eapPayload"); + if (!eap_payload) { + ogs_error("OpenAPI_pro_se_eap_session_parseFromJSON() failed [eap_payload]"); + goto end; + } + if (!cJSON_IsString(eap_payload)) { + ogs_error("OpenAPI_pro_se_eap_session_parseFromJSON() failed [eap_payload]"); + goto end; + } + + knr_pro_se = cJSON_GetObjectItemCaseSensitive(pro_se_eap_sessionJSON, "knrProSe"); + if (knr_pro_se) { + if (!cJSON_IsString(knr_pro_se) && !cJSON_IsNull(knr_pro_se)) { + ogs_error("OpenAPI_pro_se_eap_session_parseFromJSON() failed [knr_pro_se]"); + goto end; + } + } + + _links = cJSON_GetObjectItemCaseSensitive(pro_se_eap_sessionJSON, "_links"); + if (_links) { + cJSON *_links_local_map = NULL; + if (!cJSON_IsObject(_links) && !cJSON_IsNull(_links)) { + ogs_error("OpenAPI_pro_se_eap_session_parseFromJSON() failed [_links]"); + goto end; + } + if (cJSON_IsObject(_links)) { + _linksList = OpenAPI_list_create(); + OpenAPI_map_t *localMapKeyPair = NULL; + cJSON_ArrayForEach(_links_local_map, _links) { + cJSON *localMapObject = _links_local_map; + if (cJSON_IsObject(localMapObject)) { + localMapKeyPair = OpenAPI_map_create( + ogs_strdup(localMapObject->string), OpenAPI_links_value_schema_parseFromJSON(localMapObject)); + } else if (cJSON_IsNull(localMapObject)) { + localMapKeyPair = OpenAPI_map_create(ogs_strdup(localMapObject->string), NULL); + } else { + ogs_error("OpenAPI_pro_se_eap_session_parseFromJSON() failed [inner]"); + goto end; + } + OpenAPI_list_add(_linksList, localMapKeyPair); + } + } + } + + auth_result = cJSON_GetObjectItemCaseSensitive(pro_se_eap_sessionJSON, "authResult"); + if (auth_result) { + if (!cJSON_IsString(auth_result)) { + ogs_error("OpenAPI_pro_se_eap_session_parseFromJSON() failed [auth_result]"); + goto end; + } + auth_resultVariable = OpenAPI_auth_result_FromString(auth_result->valuestring); + } + + supported_features = cJSON_GetObjectItemCaseSensitive(pro_se_eap_sessionJSON, "supportedFeatures"); + if (supported_features) { + if (!cJSON_IsString(supported_features) && !cJSON_IsNull(supported_features)) { + ogs_error("OpenAPI_pro_se_eap_session_parseFromJSON() failed [supported_features]"); + goto end; + } + } + + nonce2 = cJSON_GetObjectItemCaseSensitive(pro_se_eap_sessionJSON, "nonce2"); + if (nonce2) { + if (!cJSON_IsString(nonce2) && !cJSON_IsNull(nonce2)) { + ogs_error("OpenAPI_pro_se_eap_session_parseFromJSON() failed [nonce2]"); + goto end; + } + } + + _5g_pruk_id = cJSON_GetObjectItemCaseSensitive(pro_se_eap_sessionJSON, "5gPrukId"); + if (_5g_pruk_id) { + if (!cJSON_IsString(_5g_pruk_id) && !cJSON_IsNull(_5g_pruk_id)) { + ogs_error("OpenAPI_pro_se_eap_session_parseFromJSON() failed [_5g_pruk_id]"); + goto end; + } + } + + pro_se_eap_session_local_var = OpenAPI_pro_se_eap_session_create ( + ogs_strdup(eap_payload->valuestring), + knr_pro_se && !cJSON_IsNull(knr_pro_se) ? ogs_strdup(knr_pro_se->valuestring) : NULL, + _links ? _linksList : NULL, + auth_result ? auth_resultVariable : 0, + supported_features && !cJSON_IsNull(supported_features) ? ogs_strdup(supported_features->valuestring) : NULL, + nonce2 && !cJSON_IsNull(nonce2) ? ogs_strdup(nonce2->valuestring) : NULL, + _5g_pruk_id && !cJSON_IsNull(_5g_pruk_id) ? ogs_strdup(_5g_pruk_id->valuestring) : NULL + ); + + return pro_se_eap_session_local_var; +end: + if (_linksList) { + OpenAPI_list_for_each(_linksList, node) { + OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*) node->data; + ogs_free(localKeyValue->key); + OpenAPI_links_value_schema_free(localKeyValue->value); + OpenAPI_map_free(localKeyValue); + } + OpenAPI_list_free(_linksList); + _linksList = NULL; + } + return NULL; +} + +OpenAPI_pro_se_eap_session_t *OpenAPI_pro_se_eap_session_copy(OpenAPI_pro_se_eap_session_t *dst, OpenAPI_pro_se_eap_session_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_pro_se_eap_session_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_pro_se_eap_session_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_pro_se_eap_session_free(dst); + dst = OpenAPI_pro_se_eap_session_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/pro_se_eap_session.h b/lib/sbi/openapi/model/pro_se_eap_session.h new file mode 100644 index 000000000..0adc22ee0 --- /dev/null +++ b/lib/sbi/openapi/model/pro_se_eap_session.h @@ -0,0 +1,52 @@ +/* + * pro_se_eap_session.h + * + * Contains information related to the EAP session. If present the 5gPrukId IE shall carry the CP-PRUK ID. + */ + +#ifndef _OpenAPI_pro_se_eap_session_H_ +#define _OpenAPI_pro_se_eap_session_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "auth_result.h" +#include "links_value_schema.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_pro_se_eap_session_s OpenAPI_pro_se_eap_session_t; +typedef struct OpenAPI_pro_se_eap_session_s { + char *eap_payload; + char *knr_pro_se; + OpenAPI_list_t* _links; + OpenAPI_auth_result_e auth_result; + char *supported_features; + char *nonce2; + char *_5g_pruk_id; +} OpenAPI_pro_se_eap_session_t; + +OpenAPI_pro_se_eap_session_t *OpenAPI_pro_se_eap_session_create( + char *eap_payload, + char *knr_pro_se, + OpenAPI_list_t* _links, + OpenAPI_auth_result_e auth_result, + char *supported_features, + char *nonce2, + char *_5g_pruk_id +); +void OpenAPI_pro_se_eap_session_free(OpenAPI_pro_se_eap_session_t *pro_se_eap_session); +OpenAPI_pro_se_eap_session_t *OpenAPI_pro_se_eap_session_parseFromJSON(cJSON *pro_se_eap_sessionJSON); +cJSON *OpenAPI_pro_se_eap_session_convertToJSON(OpenAPI_pro_se_eap_session_t *pro_se_eap_session); +OpenAPI_pro_se_eap_session_t *OpenAPI_pro_se_eap_session_copy(OpenAPI_pro_se_eap_session_t *dst, OpenAPI_pro_se_eap_session_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_pro_se_eap_session_H_ */ + diff --git a/lib/sbi/openapi/model/pro_se_information.c b/lib/sbi/openapi/model/pro_se_information.c new file mode 100644 index 000000000..7ba6a2f47 --- /dev/null +++ b/lib/sbi/openapi/model/pro_se_information.c @@ -0,0 +1,118 @@ + +#include +#include +#include +#include "pro_se_information.h" + +OpenAPI_pro_se_information_t *OpenAPI_pro_se_information_create( + OpenAPI_n2_info_content_t *n2_pc5_pro_se_pol +) +{ + OpenAPI_pro_se_information_t *pro_se_information_local_var = ogs_malloc(sizeof(OpenAPI_pro_se_information_t)); + ogs_assert(pro_se_information_local_var); + + pro_se_information_local_var->n2_pc5_pro_se_pol = n2_pc5_pro_se_pol; + + return pro_se_information_local_var; +} + +void OpenAPI_pro_se_information_free(OpenAPI_pro_se_information_t *pro_se_information) +{ + OpenAPI_lnode_t *node = NULL; + + if (NULL == pro_se_information) { + return; + } + if (pro_se_information->n2_pc5_pro_se_pol) { + OpenAPI_n2_info_content_free(pro_se_information->n2_pc5_pro_se_pol); + pro_se_information->n2_pc5_pro_se_pol = NULL; + } + ogs_free(pro_se_information); +} + +cJSON *OpenAPI_pro_se_information_convertToJSON(OpenAPI_pro_se_information_t *pro_se_information) +{ + cJSON *item = NULL; + OpenAPI_lnode_t *node = NULL; + + if (pro_se_information == NULL) { + ogs_error("OpenAPI_pro_se_information_convertToJSON() failed [ProSeInformation]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (pro_se_information->n2_pc5_pro_se_pol) { + cJSON *n2_pc5_pro_se_pol_local_JSON = OpenAPI_n2_info_content_convertToJSON(pro_se_information->n2_pc5_pro_se_pol); + if (n2_pc5_pro_se_pol_local_JSON == NULL) { + ogs_error("OpenAPI_pro_se_information_convertToJSON() failed [n2_pc5_pro_se_pol]"); + goto end; + } + cJSON_AddItemToObject(item, "n2Pc5ProSePol", n2_pc5_pro_se_pol_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_pro_se_information_convertToJSON() failed [n2_pc5_pro_se_pol]"); + goto end; + } + } + +end: + return item; +} + +OpenAPI_pro_se_information_t *OpenAPI_pro_se_information_parseFromJSON(cJSON *pro_se_informationJSON) +{ + OpenAPI_pro_se_information_t *pro_se_information_local_var = NULL; + OpenAPI_lnode_t *node = NULL; + cJSON *n2_pc5_pro_se_pol = NULL; + OpenAPI_n2_info_content_t *n2_pc5_pro_se_pol_local_nonprim = NULL; + n2_pc5_pro_se_pol = cJSON_GetObjectItemCaseSensitive(pro_se_informationJSON, "n2Pc5ProSePol"); + if (n2_pc5_pro_se_pol) { + n2_pc5_pro_se_pol_local_nonprim = OpenAPI_n2_info_content_parseFromJSON(n2_pc5_pro_se_pol); + } + + pro_se_information_local_var = OpenAPI_pro_se_information_create ( + n2_pc5_pro_se_pol ? n2_pc5_pro_se_pol_local_nonprim : NULL + ); + + return pro_se_information_local_var; +end: + if (n2_pc5_pro_se_pol_local_nonprim) { + OpenAPI_n2_info_content_free(n2_pc5_pro_se_pol_local_nonprim); + n2_pc5_pro_se_pol_local_nonprim = NULL; + } + return NULL; +} + +OpenAPI_pro_se_information_t *OpenAPI_pro_se_information_copy(OpenAPI_pro_se_information_t *dst, OpenAPI_pro_se_information_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_pro_se_information_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_pro_se_information_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_pro_se_information_free(dst); + dst = OpenAPI_pro_se_information_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/pro_se_information.h b/lib/sbi/openapi/model/pro_se_information.h new file mode 100644 index 000000000..0880bb80b --- /dev/null +++ b/lib/sbi/openapi/model/pro_se_information.h @@ -0,0 +1,39 @@ +/* + * pro_se_information.h + * + * Represents 5G ProSe related N2 information. + */ + +#ifndef _OpenAPI_pro_se_information_H_ +#define _OpenAPI_pro_se_information_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "n2_info_content.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_pro_se_information_s OpenAPI_pro_se_information_t; +typedef struct OpenAPI_pro_se_information_s { + struct OpenAPI_n2_info_content_s *n2_pc5_pro_se_pol; +} OpenAPI_pro_se_information_t; + +OpenAPI_pro_se_information_t *OpenAPI_pro_se_information_create( + OpenAPI_n2_info_content_t *n2_pc5_pro_se_pol +); +void OpenAPI_pro_se_information_free(OpenAPI_pro_se_information_t *pro_se_information); +OpenAPI_pro_se_information_t *OpenAPI_pro_se_information_parseFromJSON(cJSON *pro_se_informationJSON); +cJSON *OpenAPI_pro_se_information_convertToJSON(OpenAPI_pro_se_information_t *pro_se_information); +OpenAPI_pro_se_information_t *OpenAPI_pro_se_information_copy(OpenAPI_pro_se_information_t *dst, OpenAPI_pro_se_information_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_pro_se_information_H_ */ + diff --git a/lib/sbi/openapi/model/problem_details.h b/lib/sbi/openapi/model/problem_details.h index 7030e38b6..9b3748b85 100644 --- a/lib/sbi/openapi/model/problem_details.h +++ b/lib/sbi/openapi/model/problem_details.h @@ -1,7 +1,7 @@ /* * problem_details.h * - * + * Provides additional information in an error response. */ #ifndef _OpenAPI_problem_details_H_ diff --git a/lib/sbi/openapi/model/problem_details_1.h b/lib/sbi/openapi/model/problem_details_1.h index 3fc1f5ad8..3c40532c5 100644 --- a/lib/sbi/openapi/model/problem_details_1.h +++ b/lib/sbi/openapi/model/problem_details_1.h @@ -1,7 +1,7 @@ /* * problem_details_1.h * - * + * Provides additional information in an error response. */ #ifndef _OpenAPI_problem_details_1_H_ diff --git a/lib/sbi/openapi/model/problem_details_2.c b/lib/sbi/openapi/model/problem_details_2.c deleted file mode 100644 index 985513e7a..000000000 --- a/lib/sbi/openapi/model/problem_details_2.c +++ /dev/null @@ -1,284 +0,0 @@ - -#include -#include -#include -#include "problem_details_2.h" - -OpenAPI_problem_details_2_t *OpenAPI_problem_details_2_create( - char *type, - char *title, - bool is_status, - int status, - char *detail, - char *instance, - char *cause, - OpenAPI_list_t *invalid_params -) -{ - OpenAPI_problem_details_2_t *problem_details_2_local_var = ogs_malloc(sizeof(OpenAPI_problem_details_2_t)); - ogs_assert(problem_details_2_local_var); - - problem_details_2_local_var->type = type; - problem_details_2_local_var->title = title; - problem_details_2_local_var->is_status = is_status; - problem_details_2_local_var->status = status; - problem_details_2_local_var->detail = detail; - problem_details_2_local_var->instance = instance; - problem_details_2_local_var->cause = cause; - problem_details_2_local_var->invalid_params = invalid_params; - - return problem_details_2_local_var; -} - -void OpenAPI_problem_details_2_free(OpenAPI_problem_details_2_t *problem_details_2) -{ - OpenAPI_lnode_t *node = NULL; - - if (NULL == problem_details_2) { - return; - } - if (problem_details_2->type) { - ogs_free(problem_details_2->type); - problem_details_2->type = NULL; - } - if (problem_details_2->title) { - ogs_free(problem_details_2->title); - problem_details_2->title = NULL; - } - if (problem_details_2->detail) { - ogs_free(problem_details_2->detail); - problem_details_2->detail = NULL; - } - if (problem_details_2->instance) { - ogs_free(problem_details_2->instance); - problem_details_2->instance = NULL; - } - if (problem_details_2->cause) { - ogs_free(problem_details_2->cause); - problem_details_2->cause = NULL; - } - if (problem_details_2->invalid_params) { - OpenAPI_list_for_each(problem_details_2->invalid_params, node) { - OpenAPI_invalid_param_1_free(node->data); - } - OpenAPI_list_free(problem_details_2->invalid_params); - problem_details_2->invalid_params = NULL; - } - ogs_free(problem_details_2); -} - -cJSON *OpenAPI_problem_details_2_convertToJSON(OpenAPI_problem_details_2_t *problem_details_2) -{ - cJSON *item = NULL; - OpenAPI_lnode_t *node = NULL; - - if (problem_details_2 == NULL) { - ogs_error("OpenAPI_problem_details_2_convertToJSON() failed [ProblemDetails_2]"); - return NULL; - } - - item = cJSON_CreateObject(); - if (problem_details_2->type) { - if (cJSON_AddStringToObject(item, "type", problem_details_2->type) == NULL) { - ogs_error("OpenAPI_problem_details_2_convertToJSON() failed [type]"); - goto end; - } - } - - if (problem_details_2->title) { - if (cJSON_AddStringToObject(item, "title", problem_details_2->title) == NULL) { - ogs_error("OpenAPI_problem_details_2_convertToJSON() failed [title]"); - goto end; - } - } - - if (problem_details_2->is_status) { - if (cJSON_AddNumberToObject(item, "status", problem_details_2->status) == NULL) { - ogs_error("OpenAPI_problem_details_2_convertToJSON() failed [status]"); - goto end; - } - } - - if (problem_details_2->detail) { - if (cJSON_AddStringToObject(item, "detail", problem_details_2->detail) == NULL) { - ogs_error("OpenAPI_problem_details_2_convertToJSON() failed [detail]"); - goto end; - } - } - - if (problem_details_2->instance) { - if (cJSON_AddStringToObject(item, "instance", problem_details_2->instance) == NULL) { - ogs_error("OpenAPI_problem_details_2_convertToJSON() failed [instance]"); - goto end; - } - } - - if (problem_details_2->cause) { - if (cJSON_AddStringToObject(item, "cause", problem_details_2->cause) == NULL) { - ogs_error("OpenAPI_problem_details_2_convertToJSON() failed [cause]"); - goto end; - } - } - - if (problem_details_2->invalid_params) { - cJSON *invalid_paramsList = cJSON_AddArrayToObject(item, "invalidParams"); - if (invalid_paramsList == NULL) { - ogs_error("OpenAPI_problem_details_2_convertToJSON() failed [invalid_params]"); - goto end; - } - OpenAPI_list_for_each(problem_details_2->invalid_params, node) { - cJSON *itemLocal = OpenAPI_invalid_param_1_convertToJSON(node->data); - if (itemLocal == NULL) { - ogs_error("OpenAPI_problem_details_2_convertToJSON() failed [invalid_params]"); - goto end; - } - cJSON_AddItemToArray(invalid_paramsList, itemLocal); - } - } - -end: - return item; -} - -OpenAPI_problem_details_2_t *OpenAPI_problem_details_2_parseFromJSON(cJSON *problem_details_2JSON) -{ - OpenAPI_problem_details_2_t *problem_details_2_local_var = NULL; - OpenAPI_lnode_t *node = NULL; - cJSON *type = NULL; - cJSON *title = NULL; - cJSON *status = NULL; - cJSON *detail = NULL; - cJSON *instance = NULL; - cJSON *cause = NULL; - cJSON *invalid_params = NULL; - OpenAPI_list_t *invalid_paramsList = NULL; - type = cJSON_GetObjectItemCaseSensitive(problem_details_2JSON, "type"); - if (type) { - if (!cJSON_IsString(type) && !cJSON_IsNull(type)) { - ogs_error("OpenAPI_problem_details_2_parseFromJSON() failed [type]"); - goto end; - } - } - - title = cJSON_GetObjectItemCaseSensitive(problem_details_2JSON, "title"); - if (title) { - if (!cJSON_IsString(title) && !cJSON_IsNull(title)) { - ogs_error("OpenAPI_problem_details_2_parseFromJSON() failed [title]"); - goto end; - } - } - - status = cJSON_GetObjectItemCaseSensitive(problem_details_2JSON, "status"); - if (status) { - if (!cJSON_IsNumber(status)) { - ogs_error("OpenAPI_problem_details_2_parseFromJSON() failed [status]"); - goto end; - } - } - - detail = cJSON_GetObjectItemCaseSensitive(problem_details_2JSON, "detail"); - if (detail) { - if (!cJSON_IsString(detail) && !cJSON_IsNull(detail)) { - ogs_error("OpenAPI_problem_details_2_parseFromJSON() failed [detail]"); - goto end; - } - } - - instance = cJSON_GetObjectItemCaseSensitive(problem_details_2JSON, "instance"); - if (instance) { - if (!cJSON_IsString(instance) && !cJSON_IsNull(instance)) { - ogs_error("OpenAPI_problem_details_2_parseFromJSON() failed [instance]"); - goto end; - } - } - - cause = cJSON_GetObjectItemCaseSensitive(problem_details_2JSON, "cause"); - if (cause) { - if (!cJSON_IsString(cause) && !cJSON_IsNull(cause)) { - ogs_error("OpenAPI_problem_details_2_parseFromJSON() failed [cause]"); - goto end; - } - } - - invalid_params = cJSON_GetObjectItemCaseSensitive(problem_details_2JSON, "invalidParams"); - if (invalid_params) { - cJSON *invalid_params_local = NULL; - if (!cJSON_IsArray(invalid_params)) { - ogs_error("OpenAPI_problem_details_2_parseFromJSON() failed [invalid_params]"); - goto end; - } - - invalid_paramsList = OpenAPI_list_create(); - - cJSON_ArrayForEach(invalid_params_local, invalid_params) { - if (!cJSON_IsObject(invalid_params_local)) { - ogs_error("OpenAPI_problem_details_2_parseFromJSON() failed [invalid_params]"); - goto end; - } - OpenAPI_invalid_param_1_t *invalid_paramsItem = OpenAPI_invalid_param_1_parseFromJSON(invalid_params_local); - if (!invalid_paramsItem) { - ogs_error("No invalid_paramsItem"); - OpenAPI_list_free(invalid_paramsList); - goto end; - } - OpenAPI_list_add(invalid_paramsList, invalid_paramsItem); - } - } - - problem_details_2_local_var = OpenAPI_problem_details_2_create ( - type && !cJSON_IsNull(type) ? ogs_strdup(type->valuestring) : NULL, - title && !cJSON_IsNull(title) ? ogs_strdup(title->valuestring) : NULL, - status ? true : false, - status ? status->valuedouble : 0, - detail && !cJSON_IsNull(detail) ? ogs_strdup(detail->valuestring) : NULL, - instance && !cJSON_IsNull(instance) ? ogs_strdup(instance->valuestring) : NULL, - cause && !cJSON_IsNull(cause) ? ogs_strdup(cause->valuestring) : NULL, - invalid_params ? invalid_paramsList : NULL - ); - - return problem_details_2_local_var; -end: - if (invalid_paramsList) { - OpenAPI_list_for_each(invalid_paramsList, node) { - OpenAPI_invalid_param_1_free(node->data); - } - OpenAPI_list_free(invalid_paramsList); - invalid_paramsList = NULL; - } - return NULL; -} - -OpenAPI_problem_details_2_t *OpenAPI_problem_details_2_copy(OpenAPI_problem_details_2_t *dst, OpenAPI_problem_details_2_t *src) -{ - cJSON *item = NULL; - char *content = NULL; - - ogs_assert(src); - item = OpenAPI_problem_details_2_convertToJSON(src); - if (!item) { - ogs_error("OpenAPI_problem_details_2_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_problem_details_2_free(dst); - dst = OpenAPI_problem_details_2_parseFromJSON(item); - cJSON_Delete(item); - - return dst; -} - diff --git a/lib/sbi/openapi/model/problem_details_2.h b/lib/sbi/openapi/model/problem_details_2.h deleted file mode 100644 index 830b93d78..000000000 --- a/lib/sbi/openapi/model/problem_details_2.h +++ /dev/null @@ -1,53 +0,0 @@ -/* - * problem_details_2.h - * - * - */ - -#ifndef _OpenAPI_problem_details_2_H_ -#define _OpenAPI_problem_details_2_H_ - -#include -#include "../external/cJSON.h" -#include "../include/list.h" -#include "../include/keyValuePair.h" -#include "../include/binary.h" -#include "invalid_param_1.h" - -#ifdef __cplusplus -extern "C" { -#endif - -typedef struct OpenAPI_problem_details_2_s OpenAPI_problem_details_2_t; -typedef struct OpenAPI_problem_details_2_s { - char *type; - char *title; - bool is_status; - int status; - char *detail; - char *instance; - char *cause; - OpenAPI_list_t *invalid_params; -} OpenAPI_problem_details_2_t; - -OpenAPI_problem_details_2_t *OpenAPI_problem_details_2_create( - char *type, - char *title, - bool is_status, - int status, - char *detail, - char *instance, - char *cause, - OpenAPI_list_t *invalid_params -); -void OpenAPI_problem_details_2_free(OpenAPI_problem_details_2_t *problem_details_2); -OpenAPI_problem_details_2_t *OpenAPI_problem_details_2_parseFromJSON(cJSON *problem_details_2JSON); -cJSON *OpenAPI_problem_details_2_convertToJSON(OpenAPI_problem_details_2_t *problem_details_2); -OpenAPI_problem_details_2_t *OpenAPI_problem_details_2_copy(OpenAPI_problem_details_2_t *dst, OpenAPI_problem_details_2_t *src); - -#ifdef __cplusplus -} -#endif - -#endif /* _OpenAPI_problem_details_2_H_ */ - diff --git a/lib/sbi/openapi/model/problem_details_add_info.h b/lib/sbi/openapi/model/problem_details_add_info.h index c0ac0be12..52fe3934f 100644 --- a/lib/sbi/openapi/model/problem_details_add_info.h +++ b/lib/sbi/openapi/model/problem_details_add_info.h @@ -1,7 +1,7 @@ /* * problem_details_add_info.h * - * + * Problem Details Additional Information */ #ifndef _OpenAPI_problem_details_add_info_H_ diff --git a/lib/sbi/openapi/model/prose_context.c b/lib/sbi/openapi/model/prose_context.c new file mode 100644 index 000000000..1992d9da1 --- /dev/null +++ b/lib/sbi/openapi/model/prose_context.c @@ -0,0 +1,246 @@ + +#include +#include +#include +#include "prose_context.h" + +OpenAPI_prose_context_t *OpenAPI_prose_context_create( + OpenAPI_ue_auth_e direct_discovery, + OpenAPI_ue_auth_e direct_comm, + OpenAPI_ue_auth_e l2_relay, + OpenAPI_ue_auth_e l3_relay, + OpenAPI_ue_auth_e l2_remote, + char *nr_ue_pc5_ambr, + OpenAPI_pc5_qo_s_para_t *pc5_qo_s_para +) +{ + OpenAPI_prose_context_t *prose_context_local_var = ogs_malloc(sizeof(OpenAPI_prose_context_t)); + ogs_assert(prose_context_local_var); + + prose_context_local_var->direct_discovery = direct_discovery; + prose_context_local_var->direct_comm = direct_comm; + prose_context_local_var->l2_relay = l2_relay; + prose_context_local_var->l3_relay = l3_relay; + prose_context_local_var->l2_remote = l2_remote; + prose_context_local_var->nr_ue_pc5_ambr = nr_ue_pc5_ambr; + prose_context_local_var->pc5_qo_s_para = pc5_qo_s_para; + + return prose_context_local_var; +} + +void OpenAPI_prose_context_free(OpenAPI_prose_context_t *prose_context) +{ + OpenAPI_lnode_t *node = NULL; + + if (NULL == prose_context) { + return; + } + if (prose_context->nr_ue_pc5_ambr) { + ogs_free(prose_context->nr_ue_pc5_ambr); + prose_context->nr_ue_pc5_ambr = NULL; + } + if (prose_context->pc5_qo_s_para) { + OpenAPI_pc5_qo_s_para_free(prose_context->pc5_qo_s_para); + prose_context->pc5_qo_s_para = NULL; + } + ogs_free(prose_context); +} + +cJSON *OpenAPI_prose_context_convertToJSON(OpenAPI_prose_context_t *prose_context) +{ + cJSON *item = NULL; + OpenAPI_lnode_t *node = NULL; + + if (prose_context == NULL) { + ogs_error("OpenAPI_prose_context_convertToJSON() failed [ProseContext]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (prose_context->direct_discovery != OpenAPI_ue_auth_NULL) { + if (cJSON_AddStringToObject(item, "directDiscovery", OpenAPI_ue_auth_ToString(prose_context->direct_discovery)) == NULL) { + ogs_error("OpenAPI_prose_context_convertToJSON() failed [direct_discovery]"); + goto end; + } + } + + if (prose_context->direct_comm != OpenAPI_ue_auth_NULL) { + if (cJSON_AddStringToObject(item, "directComm", OpenAPI_ue_auth_ToString(prose_context->direct_comm)) == NULL) { + ogs_error("OpenAPI_prose_context_convertToJSON() failed [direct_comm]"); + goto end; + } + } + + if (prose_context->l2_relay != OpenAPI_ue_auth_NULL) { + if (cJSON_AddStringToObject(item, "l2Relay", OpenAPI_ue_auth_ToString(prose_context->l2_relay)) == NULL) { + ogs_error("OpenAPI_prose_context_convertToJSON() failed [l2_relay]"); + goto end; + } + } + + if (prose_context->l3_relay != OpenAPI_ue_auth_NULL) { + if (cJSON_AddStringToObject(item, "l3Relay", OpenAPI_ue_auth_ToString(prose_context->l3_relay)) == NULL) { + ogs_error("OpenAPI_prose_context_convertToJSON() failed [l3_relay]"); + goto end; + } + } + + if (prose_context->l2_remote != OpenAPI_ue_auth_NULL) { + if (cJSON_AddStringToObject(item, "l2Remote", OpenAPI_ue_auth_ToString(prose_context->l2_remote)) == NULL) { + ogs_error("OpenAPI_prose_context_convertToJSON() failed [l2_remote]"); + goto end; + } + } + + if (prose_context->nr_ue_pc5_ambr) { + if (cJSON_AddStringToObject(item, "nrUePc5Ambr", prose_context->nr_ue_pc5_ambr) == NULL) { + ogs_error("OpenAPI_prose_context_convertToJSON() failed [nr_ue_pc5_ambr]"); + goto end; + } + } + + if (prose_context->pc5_qo_s_para) { + cJSON *pc5_qo_s_para_local_JSON = OpenAPI_pc5_qo_s_para_convertToJSON(prose_context->pc5_qo_s_para); + if (pc5_qo_s_para_local_JSON == NULL) { + ogs_error("OpenAPI_prose_context_convertToJSON() failed [pc5_qo_s_para]"); + goto end; + } + cJSON_AddItemToObject(item, "pc5QoSPara", pc5_qo_s_para_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_prose_context_convertToJSON() failed [pc5_qo_s_para]"); + goto end; + } + } + +end: + return item; +} + +OpenAPI_prose_context_t *OpenAPI_prose_context_parseFromJSON(cJSON *prose_contextJSON) +{ + OpenAPI_prose_context_t *prose_context_local_var = NULL; + OpenAPI_lnode_t *node = NULL; + cJSON *direct_discovery = NULL; + OpenAPI_ue_auth_e direct_discoveryVariable = 0; + cJSON *direct_comm = NULL; + OpenAPI_ue_auth_e direct_commVariable = 0; + cJSON *l2_relay = NULL; + OpenAPI_ue_auth_e l2_relayVariable = 0; + cJSON *l3_relay = NULL; + OpenAPI_ue_auth_e l3_relayVariable = 0; + cJSON *l2_remote = NULL; + OpenAPI_ue_auth_e l2_remoteVariable = 0; + cJSON *nr_ue_pc5_ambr = NULL; + cJSON *pc5_qo_s_para = NULL; + OpenAPI_pc5_qo_s_para_t *pc5_qo_s_para_local_nonprim = NULL; + direct_discovery = cJSON_GetObjectItemCaseSensitive(prose_contextJSON, "directDiscovery"); + if (direct_discovery) { + if (!cJSON_IsString(direct_discovery)) { + ogs_error("OpenAPI_prose_context_parseFromJSON() failed [direct_discovery]"); + goto end; + } + direct_discoveryVariable = OpenAPI_ue_auth_FromString(direct_discovery->valuestring); + } + + direct_comm = cJSON_GetObjectItemCaseSensitive(prose_contextJSON, "directComm"); + if (direct_comm) { + if (!cJSON_IsString(direct_comm)) { + ogs_error("OpenAPI_prose_context_parseFromJSON() failed [direct_comm]"); + goto end; + } + direct_commVariable = OpenAPI_ue_auth_FromString(direct_comm->valuestring); + } + + l2_relay = cJSON_GetObjectItemCaseSensitive(prose_contextJSON, "l2Relay"); + if (l2_relay) { + if (!cJSON_IsString(l2_relay)) { + ogs_error("OpenAPI_prose_context_parseFromJSON() failed [l2_relay]"); + goto end; + } + l2_relayVariable = OpenAPI_ue_auth_FromString(l2_relay->valuestring); + } + + l3_relay = cJSON_GetObjectItemCaseSensitive(prose_contextJSON, "l3Relay"); + if (l3_relay) { + if (!cJSON_IsString(l3_relay)) { + ogs_error("OpenAPI_prose_context_parseFromJSON() failed [l3_relay]"); + goto end; + } + l3_relayVariable = OpenAPI_ue_auth_FromString(l3_relay->valuestring); + } + + l2_remote = cJSON_GetObjectItemCaseSensitive(prose_contextJSON, "l2Remote"); + if (l2_remote) { + if (!cJSON_IsString(l2_remote)) { + ogs_error("OpenAPI_prose_context_parseFromJSON() failed [l2_remote]"); + goto end; + } + l2_remoteVariable = OpenAPI_ue_auth_FromString(l2_remote->valuestring); + } + + nr_ue_pc5_ambr = cJSON_GetObjectItemCaseSensitive(prose_contextJSON, "nrUePc5Ambr"); + if (nr_ue_pc5_ambr) { + if (!cJSON_IsString(nr_ue_pc5_ambr) && !cJSON_IsNull(nr_ue_pc5_ambr)) { + ogs_error("OpenAPI_prose_context_parseFromJSON() failed [nr_ue_pc5_ambr]"); + goto end; + } + } + + pc5_qo_s_para = cJSON_GetObjectItemCaseSensitive(prose_contextJSON, "pc5QoSPara"); + if (pc5_qo_s_para) { + pc5_qo_s_para_local_nonprim = OpenAPI_pc5_qo_s_para_parseFromJSON(pc5_qo_s_para); + } + + prose_context_local_var = OpenAPI_prose_context_create ( + direct_discovery ? direct_discoveryVariable : 0, + direct_comm ? direct_commVariable : 0, + l2_relay ? l2_relayVariable : 0, + l3_relay ? l3_relayVariable : 0, + l2_remote ? l2_remoteVariable : 0, + nr_ue_pc5_ambr && !cJSON_IsNull(nr_ue_pc5_ambr) ? ogs_strdup(nr_ue_pc5_ambr->valuestring) : NULL, + pc5_qo_s_para ? pc5_qo_s_para_local_nonprim : NULL + ); + + return prose_context_local_var; +end: + if (pc5_qo_s_para_local_nonprim) { + OpenAPI_pc5_qo_s_para_free(pc5_qo_s_para_local_nonprim); + pc5_qo_s_para_local_nonprim = NULL; + } + return NULL; +} + +OpenAPI_prose_context_t *OpenAPI_prose_context_copy(OpenAPI_prose_context_t *dst, OpenAPI_prose_context_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_prose_context_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_prose_context_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_prose_context_free(dst); + dst = OpenAPI_prose_context_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/prose_context.h b/lib/sbi/openapi/model/prose_context.h new file mode 100644 index 000000000..500e31822 --- /dev/null +++ b/lib/sbi/openapi/model/prose_context.h @@ -0,0 +1,52 @@ +/* + * prose_context.h + * + * Represents the ProSe services related parameters. + */ + +#ifndef _OpenAPI_prose_context_H_ +#define _OpenAPI_prose_context_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "pc5_qo_s_para.h" +#include "ue_auth.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_prose_context_s OpenAPI_prose_context_t; +typedef struct OpenAPI_prose_context_s { + OpenAPI_ue_auth_e direct_discovery; + OpenAPI_ue_auth_e direct_comm; + OpenAPI_ue_auth_e l2_relay; + OpenAPI_ue_auth_e l3_relay; + OpenAPI_ue_auth_e l2_remote; + char *nr_ue_pc5_ambr; + struct OpenAPI_pc5_qo_s_para_s *pc5_qo_s_para; +} OpenAPI_prose_context_t; + +OpenAPI_prose_context_t *OpenAPI_prose_context_create( + OpenAPI_ue_auth_e direct_discovery, + OpenAPI_ue_auth_e direct_comm, + OpenAPI_ue_auth_e l2_relay, + OpenAPI_ue_auth_e l3_relay, + OpenAPI_ue_auth_e l2_remote, + char *nr_ue_pc5_ambr, + OpenAPI_pc5_qo_s_para_t *pc5_qo_s_para +); +void OpenAPI_prose_context_free(OpenAPI_prose_context_t *prose_context); +OpenAPI_prose_context_t *OpenAPI_prose_context_parseFromJSON(cJSON *prose_contextJSON); +cJSON *OpenAPI_prose_context_convertToJSON(OpenAPI_prose_context_t *prose_context); +OpenAPI_prose_context_t *OpenAPI_prose_context_copy(OpenAPI_prose_context_t *dst, OpenAPI_prose_context_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_prose_context_H_ */ + diff --git a/lib/sbi/openapi/model/prose_direct_allowed.c b/lib/sbi/openapi/model/prose_direct_allowed.c new file mode 100644 index 000000000..149b3c8e6 --- /dev/null +++ b/lib/sbi/openapi/model/prose_direct_allowed.c @@ -0,0 +1,30 @@ + +#include +#include +#include +#include "prose_direct_allowed.h" + +char* OpenAPI_prose_direct_allowed_ToString(OpenAPI_prose_direct_allowed_e prose_direct_allowed) +{ + const char *prose_direct_allowedArray[] = { "NULL", "ANNOUNCE", "MONITOR", "RESTRICTD_ANNOUNCE", "RESTRICTD_MONITOR", "DISCOVERER", "DISCOVEREE", "BROADCAST", "GROUPCAST", "UNICAST", "LAYER2_RELAY", "LAYER3_RELAY" }; + size_t sizeofArray = sizeof(prose_direct_allowedArray) / sizeof(prose_direct_allowedArray[0]); + if (prose_direct_allowed < sizeofArray) + return (char *)prose_direct_allowedArray[prose_direct_allowed]; + else + return (char *)"Unknown"; +} + +OpenAPI_prose_direct_allowed_e OpenAPI_prose_direct_allowed_FromString(char* prose_direct_allowed) +{ + int stringToReturn = 0; + const char *prose_direct_allowedArray[] = { "NULL", "ANNOUNCE", "MONITOR", "RESTRICTD_ANNOUNCE", "RESTRICTD_MONITOR", "DISCOVERER", "DISCOVEREE", "BROADCAST", "GROUPCAST", "UNICAST", "LAYER2_RELAY", "LAYER3_RELAY" }; + size_t sizeofArray = sizeof(prose_direct_allowedArray) / sizeof(prose_direct_allowedArray[0]); + while (stringToReturn < sizeofArray) { + if (strcmp(prose_direct_allowed, prose_direct_allowedArray[stringToReturn]) == 0) { + return stringToReturn; + } + stringToReturn++; + } + return 0; +} + diff --git a/lib/sbi/openapi/model/prose_direct_allowed.h b/lib/sbi/openapi/model/prose_direct_allowed.h new file mode 100644 index 000000000..f71822288 --- /dev/null +++ b/lib/sbi/openapi/model/prose_direct_allowed.h @@ -0,0 +1,31 @@ +/* + * prose_direct_allowed.h + * + * + */ + +#ifndef _OpenAPI_prose_direct_allowed_H_ +#define _OpenAPI_prose_direct_allowed_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef enum { OpenAPI_prose_direct_allowed_NULL = 0, OpenAPI_prose_direct_allowed_ANNOUNCE, OpenAPI_prose_direct_allowed_MONITOR, OpenAPI_prose_direct_allowed_RESTRICTD_ANNOUNCE, OpenAPI_prose_direct_allowed_RESTRICTD_MONITOR, OpenAPI_prose_direct_allowed_DISCOVERER, OpenAPI_prose_direct_allowed_DISCOVEREE, OpenAPI_prose_direct_allowed_BROADCAST, OpenAPI_prose_direct_allowed_GROUPCAST, OpenAPI_prose_direct_allowed_UNICAST, OpenAPI_prose_direct_allowed_LAYER2_RELAY, OpenAPI_prose_direct_allowed_LAYER3_RELAY } OpenAPI_prose_direct_allowed_e; + +char* OpenAPI_prose_direct_allowed_ToString(OpenAPI_prose_direct_allowed_e prose_direct_allowed); + +OpenAPI_prose_direct_allowed_e OpenAPI_prose_direct_allowed_FromString(char* prose_direct_allowed); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_prose_direct_allowed_H_ */ + diff --git a/lib/sbi/openapi/model/prose_service_auth.c b/lib/sbi/openapi/model/prose_service_auth.c new file mode 100644 index 000000000..1bb42a3c1 --- /dev/null +++ b/lib/sbi/openapi/model/prose_service_auth.c @@ -0,0 +1,129 @@ + +#include +#include +#include +#include "prose_service_auth.h" + +OpenAPI_prose_service_auth_t *OpenAPI_prose_service_auth_create( + OpenAPI_ue_auth_e prose_direct_discovery_auth, + OpenAPI_ue_auth_e prose_direct_communication_auth +) +{ + OpenAPI_prose_service_auth_t *prose_service_auth_local_var = ogs_malloc(sizeof(OpenAPI_prose_service_auth_t)); + ogs_assert(prose_service_auth_local_var); + + prose_service_auth_local_var->prose_direct_discovery_auth = prose_direct_discovery_auth; + prose_service_auth_local_var->prose_direct_communication_auth = prose_direct_communication_auth; + + return prose_service_auth_local_var; +} + +void OpenAPI_prose_service_auth_free(OpenAPI_prose_service_auth_t *prose_service_auth) +{ + OpenAPI_lnode_t *node = NULL; + + if (NULL == prose_service_auth) { + return; + } + ogs_free(prose_service_auth); +} + +cJSON *OpenAPI_prose_service_auth_convertToJSON(OpenAPI_prose_service_auth_t *prose_service_auth) +{ + cJSON *item = NULL; + OpenAPI_lnode_t *node = NULL; + + if (prose_service_auth == NULL) { + ogs_error("OpenAPI_prose_service_auth_convertToJSON() failed [ProseServiceAuth]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (prose_service_auth->prose_direct_discovery_auth != OpenAPI_ue_auth_NULL) { + if (cJSON_AddStringToObject(item, "proseDirectDiscoveryAuth", OpenAPI_ue_auth_ToString(prose_service_auth->prose_direct_discovery_auth)) == NULL) { + ogs_error("OpenAPI_prose_service_auth_convertToJSON() failed [prose_direct_discovery_auth]"); + goto end; + } + } + + if (prose_service_auth->prose_direct_communication_auth != OpenAPI_ue_auth_NULL) { + if (cJSON_AddStringToObject(item, "proseDirectCommunicationAuth", OpenAPI_ue_auth_ToString(prose_service_auth->prose_direct_communication_auth)) == NULL) { + ogs_error("OpenAPI_prose_service_auth_convertToJSON() failed [prose_direct_communication_auth]"); + goto end; + } + } + +end: + return item; +} + +OpenAPI_prose_service_auth_t *OpenAPI_prose_service_auth_parseFromJSON(cJSON *prose_service_authJSON) +{ + OpenAPI_prose_service_auth_t *prose_service_auth_local_var = NULL; + OpenAPI_lnode_t *node = NULL; + cJSON *prose_direct_discovery_auth = NULL; + OpenAPI_ue_auth_e prose_direct_discovery_authVariable = 0; + cJSON *prose_direct_communication_auth = NULL; + OpenAPI_ue_auth_e prose_direct_communication_authVariable = 0; + prose_direct_discovery_auth = cJSON_GetObjectItemCaseSensitive(prose_service_authJSON, "proseDirectDiscoveryAuth"); + if (prose_direct_discovery_auth) { + if (!cJSON_IsString(prose_direct_discovery_auth)) { + ogs_error("OpenAPI_prose_service_auth_parseFromJSON() failed [prose_direct_discovery_auth]"); + goto end; + } + prose_direct_discovery_authVariable = OpenAPI_ue_auth_FromString(prose_direct_discovery_auth->valuestring); + } + + prose_direct_communication_auth = cJSON_GetObjectItemCaseSensitive(prose_service_authJSON, "proseDirectCommunicationAuth"); + if (prose_direct_communication_auth) { + if (!cJSON_IsString(prose_direct_communication_auth)) { + ogs_error("OpenAPI_prose_service_auth_parseFromJSON() failed [prose_direct_communication_auth]"); + goto end; + } + prose_direct_communication_authVariable = OpenAPI_ue_auth_FromString(prose_direct_communication_auth->valuestring); + } + + prose_service_auth_local_var = OpenAPI_prose_service_auth_create ( + prose_direct_discovery_auth ? prose_direct_discovery_authVariable : 0, + prose_direct_communication_auth ? prose_direct_communication_authVariable : 0 + ); + + return prose_service_auth_local_var; +end: + return NULL; +} + +OpenAPI_prose_service_auth_t *OpenAPI_prose_service_auth_copy(OpenAPI_prose_service_auth_t *dst, OpenAPI_prose_service_auth_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_prose_service_auth_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_prose_service_auth_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_prose_service_auth_free(dst); + dst = OpenAPI_prose_service_auth_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/prose_service_auth.h b/lib/sbi/openapi/model/prose_service_auth.h new file mode 100644 index 000000000..7df1e2f50 --- /dev/null +++ b/lib/sbi/openapi/model/prose_service_auth.h @@ -0,0 +1,41 @@ +/* + * prose_service_auth.h + * + * Indicates whether the UE is authorized to use ProSe Direct Discovery, ProSe Direct Communication, or both. + */ + +#ifndef _OpenAPI_prose_service_auth_H_ +#define _OpenAPI_prose_service_auth_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "ue_auth.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_prose_service_auth_s OpenAPI_prose_service_auth_t; +typedef struct OpenAPI_prose_service_auth_s { + OpenAPI_ue_auth_e prose_direct_discovery_auth; + OpenAPI_ue_auth_e prose_direct_communication_auth; +} OpenAPI_prose_service_auth_t; + +OpenAPI_prose_service_auth_t *OpenAPI_prose_service_auth_create( + OpenAPI_ue_auth_e prose_direct_discovery_auth, + OpenAPI_ue_auth_e prose_direct_communication_auth +); +void OpenAPI_prose_service_auth_free(OpenAPI_prose_service_auth_t *prose_service_auth); +OpenAPI_prose_service_auth_t *OpenAPI_prose_service_auth_parseFromJSON(cJSON *prose_service_authJSON); +cJSON *OpenAPI_prose_service_auth_convertToJSON(OpenAPI_prose_service_auth_t *prose_service_auth); +OpenAPI_prose_service_auth_t *OpenAPI_prose_service_auth_copy(OpenAPI_prose_service_auth_t *dst, OpenAPI_prose_service_auth_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_prose_service_auth_H_ */ + diff --git a/lib/sbi/openapi/model/prose_subscription_data.c b/lib/sbi/openapi/model/prose_subscription_data.c new file mode 100644 index 000000000..ffd2540c5 --- /dev/null +++ b/lib/sbi/openapi/model/prose_subscription_data.c @@ -0,0 +1,201 @@ + +#include +#include +#include +#include "prose_subscription_data.h" + +OpenAPI_prose_subscription_data_t *OpenAPI_prose_subscription_data_create( + OpenAPI_prose_service_auth_t *prose_service_auth, + char *nr_ue_pc5_ambr, + OpenAPI_list_t *prose_allowed_plmn +) +{ + OpenAPI_prose_subscription_data_t *prose_subscription_data_local_var = ogs_malloc(sizeof(OpenAPI_prose_subscription_data_t)); + ogs_assert(prose_subscription_data_local_var); + + prose_subscription_data_local_var->prose_service_auth = prose_service_auth; + prose_subscription_data_local_var->nr_ue_pc5_ambr = nr_ue_pc5_ambr; + prose_subscription_data_local_var->prose_allowed_plmn = prose_allowed_plmn; + + return prose_subscription_data_local_var; +} + +void OpenAPI_prose_subscription_data_free(OpenAPI_prose_subscription_data_t *prose_subscription_data) +{ + OpenAPI_lnode_t *node = NULL; + + if (NULL == prose_subscription_data) { + return; + } + if (prose_subscription_data->prose_service_auth) { + OpenAPI_prose_service_auth_free(prose_subscription_data->prose_service_auth); + prose_subscription_data->prose_service_auth = NULL; + } + if (prose_subscription_data->nr_ue_pc5_ambr) { + ogs_free(prose_subscription_data->nr_ue_pc5_ambr); + prose_subscription_data->nr_ue_pc5_ambr = NULL; + } + if (prose_subscription_data->prose_allowed_plmn) { + OpenAPI_list_for_each(prose_subscription_data->prose_allowed_plmn, node) { + OpenAPI_pro_se_allowed_plmn_free(node->data); + } + OpenAPI_list_free(prose_subscription_data->prose_allowed_plmn); + prose_subscription_data->prose_allowed_plmn = NULL; + } + ogs_free(prose_subscription_data); +} + +cJSON *OpenAPI_prose_subscription_data_convertToJSON(OpenAPI_prose_subscription_data_t *prose_subscription_data) +{ + cJSON *item = NULL; + OpenAPI_lnode_t *node = NULL; + + if (prose_subscription_data == NULL) { + ogs_error("OpenAPI_prose_subscription_data_convertToJSON() failed [ProseSubscriptionData]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (prose_subscription_data->prose_service_auth) { + cJSON *prose_service_auth_local_JSON = OpenAPI_prose_service_auth_convertToJSON(prose_subscription_data->prose_service_auth); + if (prose_service_auth_local_JSON == NULL) { + ogs_error("OpenAPI_prose_subscription_data_convertToJSON() failed [prose_service_auth]"); + goto end; + } + cJSON_AddItemToObject(item, "proseServiceAuth", prose_service_auth_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_prose_subscription_data_convertToJSON() failed [prose_service_auth]"); + goto end; + } + } + + if (prose_subscription_data->nr_ue_pc5_ambr) { + if (cJSON_AddStringToObject(item, "nrUePc5Ambr", prose_subscription_data->nr_ue_pc5_ambr) == NULL) { + ogs_error("OpenAPI_prose_subscription_data_convertToJSON() failed [nr_ue_pc5_ambr]"); + goto end; + } + } + + if (prose_subscription_data->prose_allowed_plmn) { + cJSON *prose_allowed_plmnList = cJSON_AddArrayToObject(item, "proseAllowedPlmn"); + if (prose_allowed_plmnList == NULL) { + ogs_error("OpenAPI_prose_subscription_data_convertToJSON() failed [prose_allowed_plmn]"); + goto end; + } + OpenAPI_list_for_each(prose_subscription_data->prose_allowed_plmn, node) { + cJSON *itemLocal = OpenAPI_pro_se_allowed_plmn_convertToJSON(node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_prose_subscription_data_convertToJSON() failed [prose_allowed_plmn]"); + goto end; + } + cJSON_AddItemToArray(prose_allowed_plmnList, itemLocal); + } + } + +end: + return item; +} + +OpenAPI_prose_subscription_data_t *OpenAPI_prose_subscription_data_parseFromJSON(cJSON *prose_subscription_dataJSON) +{ + OpenAPI_prose_subscription_data_t *prose_subscription_data_local_var = NULL; + OpenAPI_lnode_t *node = NULL; + cJSON *prose_service_auth = NULL; + OpenAPI_prose_service_auth_t *prose_service_auth_local_nonprim = NULL; + cJSON *nr_ue_pc5_ambr = NULL; + cJSON *prose_allowed_plmn = NULL; + OpenAPI_list_t *prose_allowed_plmnList = NULL; + prose_service_auth = cJSON_GetObjectItemCaseSensitive(prose_subscription_dataJSON, "proseServiceAuth"); + if (prose_service_auth) { + prose_service_auth_local_nonprim = OpenAPI_prose_service_auth_parseFromJSON(prose_service_auth); + } + + nr_ue_pc5_ambr = cJSON_GetObjectItemCaseSensitive(prose_subscription_dataJSON, "nrUePc5Ambr"); + if (nr_ue_pc5_ambr) { + if (!cJSON_IsString(nr_ue_pc5_ambr) && !cJSON_IsNull(nr_ue_pc5_ambr)) { + ogs_error("OpenAPI_prose_subscription_data_parseFromJSON() failed [nr_ue_pc5_ambr]"); + goto end; + } + } + + prose_allowed_plmn = cJSON_GetObjectItemCaseSensitive(prose_subscription_dataJSON, "proseAllowedPlmn"); + if (prose_allowed_plmn) { + cJSON *prose_allowed_plmn_local = NULL; + if (!cJSON_IsArray(prose_allowed_plmn)) { + ogs_error("OpenAPI_prose_subscription_data_parseFromJSON() failed [prose_allowed_plmn]"); + goto end; + } + + prose_allowed_plmnList = OpenAPI_list_create(); + + cJSON_ArrayForEach(prose_allowed_plmn_local, prose_allowed_plmn) { + if (!cJSON_IsObject(prose_allowed_plmn_local)) { + ogs_error("OpenAPI_prose_subscription_data_parseFromJSON() failed [prose_allowed_plmn]"); + goto end; + } + OpenAPI_pro_se_allowed_plmn_t *prose_allowed_plmnItem = OpenAPI_pro_se_allowed_plmn_parseFromJSON(prose_allowed_plmn_local); + if (!prose_allowed_plmnItem) { + ogs_error("No prose_allowed_plmnItem"); + OpenAPI_list_free(prose_allowed_plmnList); + goto end; + } + OpenAPI_list_add(prose_allowed_plmnList, prose_allowed_plmnItem); + } + } + + prose_subscription_data_local_var = OpenAPI_prose_subscription_data_create ( + prose_service_auth ? prose_service_auth_local_nonprim : NULL, + nr_ue_pc5_ambr && !cJSON_IsNull(nr_ue_pc5_ambr) ? ogs_strdup(nr_ue_pc5_ambr->valuestring) : NULL, + prose_allowed_plmn ? prose_allowed_plmnList : NULL + ); + + return prose_subscription_data_local_var; +end: + if (prose_service_auth_local_nonprim) { + OpenAPI_prose_service_auth_free(prose_service_auth_local_nonprim); + prose_service_auth_local_nonprim = NULL; + } + if (prose_allowed_plmnList) { + OpenAPI_list_for_each(prose_allowed_plmnList, node) { + OpenAPI_pro_se_allowed_plmn_free(node->data); + } + OpenAPI_list_free(prose_allowed_plmnList); + prose_allowed_plmnList = NULL; + } + return NULL; +} + +OpenAPI_prose_subscription_data_t *OpenAPI_prose_subscription_data_copy(OpenAPI_prose_subscription_data_t *dst, OpenAPI_prose_subscription_data_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_prose_subscription_data_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_prose_subscription_data_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_prose_subscription_data_free(dst); + dst = OpenAPI_prose_subscription_data_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/prose_subscription_data.h b/lib/sbi/openapi/model/prose_subscription_data.h new file mode 100644 index 000000000..576f24f14 --- /dev/null +++ b/lib/sbi/openapi/model/prose_subscription_data.h @@ -0,0 +1,44 @@ +/* + * prose_subscription_data.h + * + * Contains the ProSe Subscription Data. + */ + +#ifndef _OpenAPI_prose_subscription_data_H_ +#define _OpenAPI_prose_subscription_data_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "pro_se_allowed_plmn.h" +#include "prose_service_auth.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_prose_subscription_data_s OpenAPI_prose_subscription_data_t; +typedef struct OpenAPI_prose_subscription_data_s { + struct OpenAPI_prose_service_auth_s *prose_service_auth; + char *nr_ue_pc5_ambr; + OpenAPI_list_t *prose_allowed_plmn; +} OpenAPI_prose_subscription_data_t; + +OpenAPI_prose_subscription_data_t *OpenAPI_prose_subscription_data_create( + OpenAPI_prose_service_auth_t *prose_service_auth, + char *nr_ue_pc5_ambr, + OpenAPI_list_t *prose_allowed_plmn +); +void OpenAPI_prose_subscription_data_free(OpenAPI_prose_subscription_data_t *prose_subscription_data); +OpenAPI_prose_subscription_data_t *OpenAPI_prose_subscription_data_parseFromJSON(cJSON *prose_subscription_dataJSON); +cJSON *OpenAPI_prose_subscription_data_convertToJSON(OpenAPI_prose_subscription_data_t *prose_subscription_data); +OpenAPI_prose_subscription_data_t *OpenAPI_prose_subscription_data_copy(OpenAPI_prose_subscription_data_t *dst, OpenAPI_prose_subscription_data_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_prose_subscription_data_H_ */ + diff --git a/lib/sbi/openapi/model/provisioned_data_sets.c b/lib/sbi/openapi/model/provisioned_data_sets.c index f89f7b406..3a22d08a1 100644 --- a/lib/sbi/openapi/model/provisioned_data_sets.c +++ b/lib/sbi/openapi/model/provisioned_data_sets.c @@ -8,13 +8,19 @@ OpenAPI_provisioned_data_sets_t *OpenAPI_provisioned_data_sets_create( OpenAPI_access_and_mobility_subscription_data_t *am_data, OpenAPI_smf_selection_subscription_data_t *smf_sel_data, OpenAPI_sms_subscription_data_t *sms_subs_data, - OpenAPI_list_t *sm_data, + OpenAPI_sm_subs_data_t *sm_data, OpenAPI_trace_data_t *trace_data, OpenAPI_sms_management_subscription_data_t *sms_mng_data, OpenAPI_lcs_privacy_data_t *lcs_privacy_data, OpenAPI_lcs_mo_data_t *lcs_mo_data, OpenAPI_lcs_broadcast_assistance_types_data_t *lcs_bca_data, - OpenAPI_v2x_subscription_data_t *v2x_data + OpenAPI_v2x_subscription_data_t *v2x_data, + OpenAPI_prose_subscription_data_t *prose_data, + OpenAPI_odb_data_t *odb_data, + OpenAPI_ee_profile_data_t *ee_profile_data, + OpenAPI_pp_profile_data_t *pp_profile_data, + OpenAPI_authorization_data_t *nidd_auth_data, + OpenAPI_mbs_subscription_data_1_t *mbs_subscription_data ) { OpenAPI_provisioned_data_sets_t *provisioned_data_sets_local_var = ogs_malloc(sizeof(OpenAPI_provisioned_data_sets_t)); @@ -30,6 +36,12 @@ OpenAPI_provisioned_data_sets_t *OpenAPI_provisioned_data_sets_create( provisioned_data_sets_local_var->lcs_mo_data = lcs_mo_data; provisioned_data_sets_local_var->lcs_bca_data = lcs_bca_data; provisioned_data_sets_local_var->v2x_data = v2x_data; + provisioned_data_sets_local_var->prose_data = prose_data; + provisioned_data_sets_local_var->odb_data = odb_data; + provisioned_data_sets_local_var->ee_profile_data = ee_profile_data; + provisioned_data_sets_local_var->pp_profile_data = pp_profile_data; + provisioned_data_sets_local_var->nidd_auth_data = nidd_auth_data; + provisioned_data_sets_local_var->mbs_subscription_data = mbs_subscription_data; return provisioned_data_sets_local_var; } @@ -54,10 +66,7 @@ void OpenAPI_provisioned_data_sets_free(OpenAPI_provisioned_data_sets_t *provisi provisioned_data_sets->sms_subs_data = NULL; } if (provisioned_data_sets->sm_data) { - OpenAPI_list_for_each(provisioned_data_sets->sm_data, node) { - OpenAPI_session_management_subscription_data_free(node->data); - } - OpenAPI_list_free(provisioned_data_sets->sm_data); + OpenAPI_sm_subs_data_free(provisioned_data_sets->sm_data); provisioned_data_sets->sm_data = NULL; } if (provisioned_data_sets->trace_data) { @@ -84,6 +93,30 @@ void OpenAPI_provisioned_data_sets_free(OpenAPI_provisioned_data_sets_t *provisi OpenAPI_v2x_subscription_data_free(provisioned_data_sets->v2x_data); provisioned_data_sets->v2x_data = NULL; } + if (provisioned_data_sets->prose_data) { + OpenAPI_prose_subscription_data_free(provisioned_data_sets->prose_data); + provisioned_data_sets->prose_data = NULL; + } + if (provisioned_data_sets->odb_data) { + OpenAPI_odb_data_free(provisioned_data_sets->odb_data); + provisioned_data_sets->odb_data = NULL; + } + if (provisioned_data_sets->ee_profile_data) { + OpenAPI_ee_profile_data_free(provisioned_data_sets->ee_profile_data); + provisioned_data_sets->ee_profile_data = NULL; + } + if (provisioned_data_sets->pp_profile_data) { + OpenAPI_pp_profile_data_free(provisioned_data_sets->pp_profile_data); + provisioned_data_sets->pp_profile_data = NULL; + } + if (provisioned_data_sets->nidd_auth_data) { + OpenAPI_authorization_data_free(provisioned_data_sets->nidd_auth_data); + provisioned_data_sets->nidd_auth_data = NULL; + } + if (provisioned_data_sets->mbs_subscription_data) { + OpenAPI_mbs_subscription_data_1_free(provisioned_data_sets->mbs_subscription_data); + provisioned_data_sets->mbs_subscription_data = NULL; + } ogs_free(provisioned_data_sets); } @@ -138,18 +171,15 @@ cJSON *OpenAPI_provisioned_data_sets_convertToJSON(OpenAPI_provisioned_data_sets } if (provisioned_data_sets->sm_data) { - cJSON *sm_dataList = cJSON_AddArrayToObject(item, "smData"); - if (sm_dataList == NULL) { + cJSON *sm_data_local_JSON = OpenAPI_sm_subs_data_convertToJSON(provisioned_data_sets->sm_data); + if (sm_data_local_JSON == NULL) { ogs_error("OpenAPI_provisioned_data_sets_convertToJSON() failed [sm_data]"); goto end; } - OpenAPI_list_for_each(provisioned_data_sets->sm_data, node) { - cJSON *itemLocal = OpenAPI_session_management_subscription_data_convertToJSON(node->data); - if (itemLocal == NULL) { - ogs_error("OpenAPI_provisioned_data_sets_convertToJSON() failed [sm_data]"); - goto end; - } - cJSON_AddItemToArray(sm_dataList, itemLocal); + cJSON_AddItemToObject(item, "smData", sm_data_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_provisioned_data_sets_convertToJSON() failed [sm_data]"); + goto end; } } @@ -231,6 +261,84 @@ cJSON *OpenAPI_provisioned_data_sets_convertToJSON(OpenAPI_provisioned_data_sets } } + if (provisioned_data_sets->prose_data) { + cJSON *prose_data_local_JSON = OpenAPI_prose_subscription_data_convertToJSON(provisioned_data_sets->prose_data); + if (prose_data_local_JSON == NULL) { + ogs_error("OpenAPI_provisioned_data_sets_convertToJSON() failed [prose_data]"); + goto end; + } + cJSON_AddItemToObject(item, "proseData", prose_data_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_provisioned_data_sets_convertToJSON() failed [prose_data]"); + goto end; + } + } + + if (provisioned_data_sets->odb_data) { + cJSON *odb_data_local_JSON = OpenAPI_odb_data_convertToJSON(provisioned_data_sets->odb_data); + if (odb_data_local_JSON == NULL) { + ogs_error("OpenAPI_provisioned_data_sets_convertToJSON() failed [odb_data]"); + goto end; + } + cJSON_AddItemToObject(item, "odbData", odb_data_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_provisioned_data_sets_convertToJSON() failed [odb_data]"); + goto end; + } + } + + if (provisioned_data_sets->ee_profile_data) { + cJSON *ee_profile_data_local_JSON = OpenAPI_ee_profile_data_convertToJSON(provisioned_data_sets->ee_profile_data); + if (ee_profile_data_local_JSON == NULL) { + ogs_error("OpenAPI_provisioned_data_sets_convertToJSON() failed [ee_profile_data]"); + goto end; + } + cJSON_AddItemToObject(item, "eeProfileData", ee_profile_data_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_provisioned_data_sets_convertToJSON() failed [ee_profile_data]"); + goto end; + } + } + + if (provisioned_data_sets->pp_profile_data) { + cJSON *pp_profile_data_local_JSON = OpenAPI_pp_profile_data_convertToJSON(provisioned_data_sets->pp_profile_data); + if (pp_profile_data_local_JSON == NULL) { + ogs_error("OpenAPI_provisioned_data_sets_convertToJSON() failed [pp_profile_data]"); + goto end; + } + cJSON_AddItemToObject(item, "ppProfileData", pp_profile_data_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_provisioned_data_sets_convertToJSON() failed [pp_profile_data]"); + goto end; + } + } + + if (provisioned_data_sets->nidd_auth_data) { + cJSON *nidd_auth_data_local_JSON = OpenAPI_authorization_data_convertToJSON(provisioned_data_sets->nidd_auth_data); + if (nidd_auth_data_local_JSON == NULL) { + ogs_error("OpenAPI_provisioned_data_sets_convertToJSON() failed [nidd_auth_data]"); + goto end; + } + cJSON_AddItemToObject(item, "niddAuthData", nidd_auth_data_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_provisioned_data_sets_convertToJSON() failed [nidd_auth_data]"); + goto end; + } + } + + if (provisioned_data_sets->mbs_subscription_data) { + cJSON *mbs_subscription_data_local_JSON = OpenAPI_mbs_subscription_data_1_convertToJSON(provisioned_data_sets->mbs_subscription_data); + if (mbs_subscription_data_local_JSON == NULL) { + ogs_error("OpenAPI_provisioned_data_sets_convertToJSON() failed [mbs_subscription_data]"); + goto end; + } + cJSON_AddItemToObject(item, "mbsSubscriptionData", mbs_subscription_data_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_provisioned_data_sets_convertToJSON() failed [mbs_subscription_data]"); + goto end; + } + } + end: return item; } @@ -246,7 +354,7 @@ OpenAPI_provisioned_data_sets_t *OpenAPI_provisioned_data_sets_parseFromJSON(cJS cJSON *sms_subs_data = NULL; OpenAPI_sms_subscription_data_t *sms_subs_data_local_nonprim = NULL; cJSON *sm_data = NULL; - OpenAPI_list_t *sm_dataList = NULL; + OpenAPI_sm_subs_data_t *sm_data_local_nonprim = NULL; cJSON *trace_data = NULL; OpenAPI_trace_data_t *trace_data_local_nonprim = NULL; cJSON *sms_mng_data = NULL; @@ -259,6 +367,18 @@ OpenAPI_provisioned_data_sets_t *OpenAPI_provisioned_data_sets_parseFromJSON(cJS OpenAPI_lcs_broadcast_assistance_types_data_t *lcs_bca_data_local_nonprim = NULL; cJSON *v2x_data = NULL; OpenAPI_v2x_subscription_data_t *v2x_data_local_nonprim = NULL; + cJSON *prose_data = NULL; + OpenAPI_prose_subscription_data_t *prose_data_local_nonprim = NULL; + cJSON *odb_data = NULL; + OpenAPI_odb_data_t *odb_data_local_nonprim = NULL; + cJSON *ee_profile_data = NULL; + OpenAPI_ee_profile_data_t *ee_profile_data_local_nonprim = NULL; + cJSON *pp_profile_data = NULL; + OpenAPI_pp_profile_data_t *pp_profile_data_local_nonprim = NULL; + cJSON *nidd_auth_data = NULL; + OpenAPI_authorization_data_t *nidd_auth_data_local_nonprim = NULL; + cJSON *mbs_subscription_data = NULL; + OpenAPI_mbs_subscription_data_1_t *mbs_subscription_data_local_nonprim = NULL; am_data = cJSON_GetObjectItemCaseSensitive(provisioned_data_setsJSON, "amData"); if (am_data) { am_data_local_nonprim = OpenAPI_access_and_mobility_subscription_data_parseFromJSON(am_data); @@ -276,27 +396,7 @@ OpenAPI_provisioned_data_sets_t *OpenAPI_provisioned_data_sets_parseFromJSON(cJS sm_data = cJSON_GetObjectItemCaseSensitive(provisioned_data_setsJSON, "smData"); if (sm_data) { - cJSON *sm_data_local = NULL; - if (!cJSON_IsArray(sm_data)) { - ogs_error("OpenAPI_provisioned_data_sets_parseFromJSON() failed [sm_data]"); - goto end; - } - - sm_dataList = OpenAPI_list_create(); - - cJSON_ArrayForEach(sm_data_local, sm_data) { - if (!cJSON_IsObject(sm_data_local)) { - ogs_error("OpenAPI_provisioned_data_sets_parseFromJSON() failed [sm_data]"); - goto end; - } - OpenAPI_session_management_subscription_data_t *sm_dataItem = OpenAPI_session_management_subscription_data_parseFromJSON(sm_data_local); - if (!sm_dataItem) { - ogs_error("No sm_dataItem"); - OpenAPI_list_free(sm_dataList); - goto end; - } - OpenAPI_list_add(sm_dataList, sm_dataItem); - } + sm_data_local_nonprim = OpenAPI_sm_subs_data_parseFromJSON(sm_data); } trace_data = cJSON_GetObjectItemCaseSensitive(provisioned_data_setsJSON, "traceData"); @@ -329,17 +429,53 @@ OpenAPI_provisioned_data_sets_t *OpenAPI_provisioned_data_sets_parseFromJSON(cJS v2x_data_local_nonprim = OpenAPI_v2x_subscription_data_parseFromJSON(v2x_data); } + prose_data = cJSON_GetObjectItemCaseSensitive(provisioned_data_setsJSON, "proseData"); + if (prose_data) { + prose_data_local_nonprim = OpenAPI_prose_subscription_data_parseFromJSON(prose_data); + } + + odb_data = cJSON_GetObjectItemCaseSensitive(provisioned_data_setsJSON, "odbData"); + if (odb_data) { + odb_data_local_nonprim = OpenAPI_odb_data_parseFromJSON(odb_data); + } + + ee_profile_data = cJSON_GetObjectItemCaseSensitive(provisioned_data_setsJSON, "eeProfileData"); + if (ee_profile_data) { + ee_profile_data_local_nonprim = OpenAPI_ee_profile_data_parseFromJSON(ee_profile_data); + } + + pp_profile_data = cJSON_GetObjectItemCaseSensitive(provisioned_data_setsJSON, "ppProfileData"); + if (pp_profile_data) { + pp_profile_data_local_nonprim = OpenAPI_pp_profile_data_parseFromJSON(pp_profile_data); + } + + nidd_auth_data = cJSON_GetObjectItemCaseSensitive(provisioned_data_setsJSON, "niddAuthData"); + if (nidd_auth_data) { + nidd_auth_data_local_nonprim = OpenAPI_authorization_data_parseFromJSON(nidd_auth_data); + } + + mbs_subscription_data = cJSON_GetObjectItemCaseSensitive(provisioned_data_setsJSON, "mbsSubscriptionData"); + if (mbs_subscription_data) { + mbs_subscription_data_local_nonprim = OpenAPI_mbs_subscription_data_1_parseFromJSON(mbs_subscription_data); + } + provisioned_data_sets_local_var = OpenAPI_provisioned_data_sets_create ( am_data ? am_data_local_nonprim : NULL, smf_sel_data ? smf_sel_data_local_nonprim : NULL, sms_subs_data ? sms_subs_data_local_nonprim : NULL, - sm_data ? sm_dataList : NULL, + sm_data ? sm_data_local_nonprim : NULL, trace_data ? trace_data_local_nonprim : NULL, sms_mng_data ? sms_mng_data_local_nonprim : NULL, lcs_privacy_data ? lcs_privacy_data_local_nonprim : NULL, lcs_mo_data ? lcs_mo_data_local_nonprim : NULL, lcs_bca_data ? lcs_bca_data_local_nonprim : NULL, - v2x_data ? v2x_data_local_nonprim : NULL + v2x_data ? v2x_data_local_nonprim : NULL, + prose_data ? prose_data_local_nonprim : NULL, + odb_data ? odb_data_local_nonprim : NULL, + ee_profile_data ? ee_profile_data_local_nonprim : NULL, + pp_profile_data ? pp_profile_data_local_nonprim : NULL, + nidd_auth_data ? nidd_auth_data_local_nonprim : NULL, + mbs_subscription_data ? mbs_subscription_data_local_nonprim : NULL ); return provisioned_data_sets_local_var; @@ -356,12 +492,9 @@ end: OpenAPI_sms_subscription_data_free(sms_subs_data_local_nonprim); sms_subs_data_local_nonprim = NULL; } - if (sm_dataList) { - OpenAPI_list_for_each(sm_dataList, node) { - OpenAPI_session_management_subscription_data_free(node->data); - } - OpenAPI_list_free(sm_dataList); - sm_dataList = NULL; + if (sm_data_local_nonprim) { + OpenAPI_sm_subs_data_free(sm_data_local_nonprim); + sm_data_local_nonprim = NULL; } if (trace_data_local_nonprim) { OpenAPI_trace_data_free(trace_data_local_nonprim); @@ -387,6 +520,30 @@ end: OpenAPI_v2x_subscription_data_free(v2x_data_local_nonprim); v2x_data_local_nonprim = NULL; } + if (prose_data_local_nonprim) { + OpenAPI_prose_subscription_data_free(prose_data_local_nonprim); + prose_data_local_nonprim = NULL; + } + if (odb_data_local_nonprim) { + OpenAPI_odb_data_free(odb_data_local_nonprim); + odb_data_local_nonprim = NULL; + } + if (ee_profile_data_local_nonprim) { + OpenAPI_ee_profile_data_free(ee_profile_data_local_nonprim); + ee_profile_data_local_nonprim = NULL; + } + if (pp_profile_data_local_nonprim) { + OpenAPI_pp_profile_data_free(pp_profile_data_local_nonprim); + pp_profile_data_local_nonprim = NULL; + } + if (nidd_auth_data_local_nonprim) { + OpenAPI_authorization_data_free(nidd_auth_data_local_nonprim); + nidd_auth_data_local_nonprim = NULL; + } + if (mbs_subscription_data_local_nonprim) { + OpenAPI_mbs_subscription_data_1_free(mbs_subscription_data_local_nonprim); + mbs_subscription_data_local_nonprim = NULL; + } return NULL; } diff --git a/lib/sbi/openapi/model/provisioned_data_sets.h b/lib/sbi/openapi/model/provisioned_data_sets.h index 942b57f7b..315416005 100644 --- a/lib/sbi/openapi/model/provisioned_data_sets.h +++ b/lib/sbi/openapi/model/provisioned_data_sets.h @@ -1,7 +1,7 @@ /* * provisioned_data_sets.h * - * + * Contains the provisioned data sets. */ #ifndef _OpenAPI_provisioned_data_sets_H_ @@ -13,10 +13,16 @@ #include "../include/keyValuePair.h" #include "../include/binary.h" #include "access_and_mobility_subscription_data.h" +#include "authorization_data.h" +#include "ee_profile_data.h" #include "lcs_broadcast_assistance_types_data.h" #include "lcs_mo_data.h" #include "lcs_privacy_data.h" -#include "session_management_subscription_data.h" +#include "mbs_subscription_data_1.h" +#include "odb_data.h" +#include "pp_profile_data.h" +#include "prose_subscription_data.h" +#include "sm_subs_data.h" #include "smf_selection_subscription_data.h" #include "sms_management_subscription_data.h" #include "sms_subscription_data.h" @@ -32,26 +38,38 @@ typedef struct OpenAPI_provisioned_data_sets_s { struct OpenAPI_access_and_mobility_subscription_data_s *am_data; struct OpenAPI_smf_selection_subscription_data_s *smf_sel_data; struct OpenAPI_sms_subscription_data_s *sms_subs_data; - OpenAPI_list_t *sm_data; + struct OpenAPI_sm_subs_data_s *sm_data; struct OpenAPI_trace_data_s *trace_data; struct OpenAPI_sms_management_subscription_data_s *sms_mng_data; struct OpenAPI_lcs_privacy_data_s *lcs_privacy_data; struct OpenAPI_lcs_mo_data_s *lcs_mo_data; struct OpenAPI_lcs_broadcast_assistance_types_data_s *lcs_bca_data; struct OpenAPI_v2x_subscription_data_s *v2x_data; + struct OpenAPI_prose_subscription_data_s *prose_data; + struct OpenAPI_odb_data_s *odb_data; + struct OpenAPI_ee_profile_data_s *ee_profile_data; + struct OpenAPI_pp_profile_data_s *pp_profile_data; + struct OpenAPI_authorization_data_s *nidd_auth_data; + struct OpenAPI_mbs_subscription_data_1_s *mbs_subscription_data; } OpenAPI_provisioned_data_sets_t; OpenAPI_provisioned_data_sets_t *OpenAPI_provisioned_data_sets_create( OpenAPI_access_and_mobility_subscription_data_t *am_data, OpenAPI_smf_selection_subscription_data_t *smf_sel_data, OpenAPI_sms_subscription_data_t *sms_subs_data, - OpenAPI_list_t *sm_data, + OpenAPI_sm_subs_data_t *sm_data, OpenAPI_trace_data_t *trace_data, OpenAPI_sms_management_subscription_data_t *sms_mng_data, OpenAPI_lcs_privacy_data_t *lcs_privacy_data, OpenAPI_lcs_mo_data_t *lcs_mo_data, OpenAPI_lcs_broadcast_assistance_types_data_t *lcs_bca_data, - OpenAPI_v2x_subscription_data_t *v2x_data + OpenAPI_v2x_subscription_data_t *v2x_data, + OpenAPI_prose_subscription_data_t *prose_data, + OpenAPI_odb_data_t *odb_data, + OpenAPI_ee_profile_data_t *ee_profile_data, + OpenAPI_pp_profile_data_t *pp_profile_data, + OpenAPI_authorization_data_t *nidd_auth_data, + OpenAPI_mbs_subscription_data_1_t *mbs_subscription_data ); void OpenAPI_provisioned_data_sets_free(OpenAPI_provisioned_data_sets_t *provisioned_data_sets); OpenAPI_provisioned_data_sets_t *OpenAPI_provisioned_data_sets_parseFromJSON(cJSON *provisioned_data_setsJSON); diff --git a/lib/sbi/openapi/model/psa_indication.c b/lib/sbi/openapi/model/psa_indication.c index 58e2cad96..1f9f426e3 100644 --- a/lib/sbi/openapi/model/psa_indication.c +++ b/lib/sbi/openapi/model/psa_indication.c @@ -6,7 +6,7 @@ char* OpenAPI_psa_indication_ToString(OpenAPI_psa_indication_e psa_indication) { - const char *psa_indicationArray[] = { "NULL", "PSA_INSERTED", "PSA_REMOVED" }; + const char *psa_indicationArray[] = { "NULL", "PSA_INSERTED", "PSA_REMOVED", "PSA_INSERTED_ONLY", "PSA_REMOVED_ONLY" }; size_t sizeofArray = sizeof(psa_indicationArray) / sizeof(psa_indicationArray[0]); if (psa_indication < sizeofArray) return (char *)psa_indicationArray[psa_indication]; @@ -17,7 +17,7 @@ char* OpenAPI_psa_indication_ToString(OpenAPI_psa_indication_e psa_indication) OpenAPI_psa_indication_e OpenAPI_psa_indication_FromString(char* psa_indication) { int stringToReturn = 0; - const char *psa_indicationArray[] = { "NULL", "PSA_INSERTED", "PSA_REMOVED" }; + const char *psa_indicationArray[] = { "NULL", "PSA_INSERTED", "PSA_REMOVED", "PSA_INSERTED_ONLY", "PSA_REMOVED_ONLY" }; size_t sizeofArray = sizeof(psa_indicationArray) / sizeof(psa_indicationArray[0]); while (stringToReturn < sizeofArray) { if (strcmp(psa_indication, psa_indicationArray[stringToReturn]) == 0) { diff --git a/lib/sbi/openapi/model/psa_indication.h b/lib/sbi/openapi/model/psa_indication.h index 66d7782f1..c17b330fd 100644 --- a/lib/sbi/openapi/model/psa_indication.h +++ b/lib/sbi/openapi/model/psa_indication.h @@ -17,7 +17,7 @@ extern "C" { #endif -typedef enum { OpenAPI_psa_indication_NULL = 0, OpenAPI_psa_indication_PSA_INSERTED, OpenAPI_psa_indication_PSA_REMOVED } OpenAPI_psa_indication_e; +typedef enum { OpenAPI_psa_indication_NULL = 0, OpenAPI_psa_indication_PSA_INSERTED, OpenAPI_psa_indication_PSA_REMOVED, OpenAPI_psa_indication_PSA_INSERTED_ONLY, OpenAPI_psa_indication_PSA_REMOVED_ONLY } OpenAPI_psa_indication_e; char* OpenAPI_psa_indication_ToString(OpenAPI_psa_indication_e psa_indication); diff --git a/lib/sbi/openapi/model/psa_information.h b/lib/sbi/openapi/model/psa_information.h index 1039792dd..3d878d25a 100644 --- a/lib/sbi/openapi/model/psa_information.h +++ b/lib/sbi/openapi/model/psa_information.h @@ -1,7 +1,7 @@ /* * psa_information.h * - * + * PSA Information */ #ifndef _OpenAPI_psa_information_H_ diff --git a/lib/sbi/openapi/model/pws_error_data.h b/lib/sbi/openapi/model/pws_error_data.h index 5c5c77629..20bca5290 100644 --- a/lib/sbi/openapi/model/pws_error_data.h +++ b/lib/sbi/openapi/model/pws_error_data.h @@ -1,7 +1,7 @@ /* * pws_error_data.h * - * + * Data related to PWS error included in a N2 Information Transfer failure response */ #ifndef _OpenAPI_pws_error_data_H_ diff --git a/lib/sbi/openapi/model/pws_information.c b/lib/sbi/openapi/model/pws_information.c index 9f438af81..3e07c20a4 100644 --- a/lib/sbi/openapi/model/pws_information.c +++ b/lib/sbi/openapi/model/pws_information.c @@ -11,7 +11,8 @@ OpenAPI_pws_information_t *OpenAPI_pws_information_create( OpenAPI_list_t *bc_empty_area_list, bool is_send_ran_response, int send_ran_response, - char *omc_id + char *omc_id, + char *nf_id ) { OpenAPI_pws_information_t *pws_information_local_var = ogs_malloc(sizeof(OpenAPI_pws_information_t)); @@ -24,6 +25,7 @@ OpenAPI_pws_information_t *OpenAPI_pws_information_create( pws_information_local_var->is_send_ran_response = is_send_ran_response; pws_information_local_var->send_ran_response = send_ran_response; pws_information_local_var->omc_id = omc_id; + pws_information_local_var->nf_id = nf_id; return pws_information_local_var; } @@ -50,6 +52,10 @@ void OpenAPI_pws_information_free(OpenAPI_pws_information_t *pws_information) ogs_free(pws_information->omc_id); pws_information->omc_id = NULL; } + if (pws_information->nf_id) { + ogs_free(pws_information->nf_id); + pws_information->nf_id = NULL; + } ogs_free(pws_information); } @@ -119,6 +125,13 @@ cJSON *OpenAPI_pws_information_convertToJSON(OpenAPI_pws_information_t *pws_info } } + if (pws_information->nf_id) { + if (cJSON_AddStringToObject(item, "nfId", pws_information->nf_id) == NULL) { + ogs_error("OpenAPI_pws_information_convertToJSON() failed [nf_id]"); + goto end; + } + } + end: return item; } @@ -135,6 +148,7 @@ OpenAPI_pws_information_t *OpenAPI_pws_information_parseFromJSON(cJSON *pws_info OpenAPI_list_t *bc_empty_area_listList = NULL; cJSON *send_ran_response = NULL; cJSON *omc_id = NULL; + cJSON *nf_id = NULL; message_identifier = cJSON_GetObjectItemCaseSensitive(pws_informationJSON, "messageIdentifier"); if (!message_identifier) { ogs_error("OpenAPI_pws_information_parseFromJSON() failed [message_identifier]"); @@ -203,6 +217,14 @@ OpenAPI_pws_information_t *OpenAPI_pws_information_parseFromJSON(cJSON *pws_info } } + nf_id = cJSON_GetObjectItemCaseSensitive(pws_informationJSON, "nfId"); + if (nf_id) { + if (!cJSON_IsString(nf_id) && !cJSON_IsNull(nf_id)) { + ogs_error("OpenAPI_pws_information_parseFromJSON() failed [nf_id]"); + goto end; + } + } + pws_information_local_var = OpenAPI_pws_information_create ( message_identifier->valuedouble, @@ -212,7 +234,8 @@ OpenAPI_pws_information_t *OpenAPI_pws_information_parseFromJSON(cJSON *pws_info bc_empty_area_list ? bc_empty_area_listList : NULL, send_ran_response ? true : false, send_ran_response ? send_ran_response->valueint : 0, - omc_id && !cJSON_IsNull(omc_id) ? ogs_strdup(omc_id->valuestring) : NULL + omc_id && !cJSON_IsNull(omc_id) ? ogs_strdup(omc_id->valuestring) : NULL, + nf_id && !cJSON_IsNull(nf_id) ? ogs_strdup(nf_id->valuestring) : NULL ); return pws_information_local_var; diff --git a/lib/sbi/openapi/model/pws_information.h b/lib/sbi/openapi/model/pws_information.h index b88ff6f08..151829b57 100644 --- a/lib/sbi/openapi/model/pws_information.h +++ b/lib/sbi/openapi/model/pws_information.h @@ -1,7 +1,7 @@ /* * pws_information.h * - * + * Represents a PWS related information data part */ #ifndef _OpenAPI_pws_information_H_ @@ -28,6 +28,7 @@ typedef struct OpenAPI_pws_information_s { bool is_send_ran_response; int send_ran_response; char *omc_id; + char *nf_id; } OpenAPI_pws_information_t; OpenAPI_pws_information_t *OpenAPI_pws_information_create( @@ -37,7 +38,8 @@ OpenAPI_pws_information_t *OpenAPI_pws_information_create( OpenAPI_list_t *bc_empty_area_list, bool is_send_ran_response, int send_ran_response, - char *omc_id + char *omc_id, + char *nf_id ); void OpenAPI_pws_information_free(OpenAPI_pws_information_t *pws_information); OpenAPI_pws_information_t *OpenAPI_pws_information_parseFromJSON(cJSON *pws_informationJSON); diff --git a/lib/sbi/openapi/model/pws_response_data.h b/lib/sbi/openapi/model/pws_response_data.h index 3d1c65f15..84c4555ce 100644 --- a/lib/sbi/openapi/model/pws_response_data.h +++ b/lib/sbi/openapi/model/pws_response_data.h @@ -1,7 +1,7 @@ /* * pws_response_data.h * - * + * Data related PWS included in a N2 Information Transfer response */ #ifndef _OpenAPI_pws_response_data_H_ diff --git a/lib/sbi/openapi/model/qos_characteristics.h b/lib/sbi/openapi/model/qos_characteristics.h index d715db814..696a2a870 100644 --- a/lib/sbi/openapi/model/qos_characteristics.h +++ b/lib/sbi/openapi/model/qos_characteristics.h @@ -1,7 +1,7 @@ /* * qos_characteristics.h * - * + * Contains QoS characteristics for a non-standardized or a non-configured 5QI. */ #ifndef _OpenAPI_qos_characteristics_H_ diff --git a/lib/sbi/openapi/model/qos_data.h b/lib/sbi/openapi/model/qos_data.h index 70c4cbdec..6d85bcff8 100644 --- a/lib/sbi/openapi/model/qos_data.h +++ b/lib/sbi/openapi/model/qos_data.h @@ -1,7 +1,7 @@ /* * qos_data.h * - * + * Contains the QoS parameters. */ #ifndef _OpenAPI_qos_data_H_ diff --git a/lib/sbi/openapi/model/qos_flow_add_modify_request_item.h b/lib/sbi/openapi/model/qos_flow_add_modify_request_item.h index 88ee6b642..e3e7abbd7 100644 --- a/lib/sbi/openapi/model/qos_flow_add_modify_request_item.h +++ b/lib/sbi/openapi/model/qos_flow_add_modify_request_item.h @@ -1,7 +1,7 @@ /* * qos_flow_add_modify_request_item.h * - * + * Individual QoS flow requested to be created or modified */ #ifndef _OpenAPI_qos_flow_add_modify_request_item_H_ diff --git a/lib/sbi/openapi/model/qos_flow_item.c b/lib/sbi/openapi/model/qos_flow_item.c index 3fd3de4b9..df2a45607 100644 --- a/lib/sbi/openapi/model/qos_flow_item.c +++ b/lib/sbi/openapi/model/qos_flow_item.c @@ -10,7 +10,8 @@ OpenAPI_qos_flow_item_t *OpenAPI_qos_flow_item_create( bool is_current_qos_profile_index, int current_qos_profile_index, bool is_null_qo_s_profile_index, - int null_qo_s_profile_index + int null_qo_s_profile_index, + OpenAPI_ng_ap_cause_t *ng_ap_cause ) { OpenAPI_qos_flow_item_t *qos_flow_item_local_var = ogs_malloc(sizeof(OpenAPI_qos_flow_item_t)); @@ -22,6 +23,7 @@ OpenAPI_qos_flow_item_t *OpenAPI_qos_flow_item_create( qos_flow_item_local_var->current_qos_profile_index = current_qos_profile_index; qos_flow_item_local_var->is_null_qo_s_profile_index = is_null_qo_s_profile_index; qos_flow_item_local_var->null_qo_s_profile_index = null_qo_s_profile_index; + qos_flow_item_local_var->ng_ap_cause = ng_ap_cause; return qos_flow_item_local_var; } @@ -33,6 +35,10 @@ void OpenAPI_qos_flow_item_free(OpenAPI_qos_flow_item_t *qos_flow_item) if (NULL == qos_flow_item) { return; } + if (qos_flow_item->ng_ap_cause) { + OpenAPI_ng_ap_cause_free(qos_flow_item->ng_ap_cause); + qos_flow_item->ng_ap_cause = NULL; + } ogs_free(qos_flow_item); } @@ -73,6 +79,19 @@ cJSON *OpenAPI_qos_flow_item_convertToJSON(OpenAPI_qos_flow_item_t *qos_flow_ite } } + if (qos_flow_item->ng_ap_cause) { + cJSON *ng_ap_cause_local_JSON = OpenAPI_ng_ap_cause_convertToJSON(qos_flow_item->ng_ap_cause); + if (ng_ap_cause_local_JSON == NULL) { + ogs_error("OpenAPI_qos_flow_item_convertToJSON() failed [ng_ap_cause]"); + goto end; + } + cJSON_AddItemToObject(item, "ngApCause", ng_ap_cause_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_qos_flow_item_convertToJSON() failed [ng_ap_cause]"); + goto end; + } + } + end: return item; } @@ -86,6 +105,8 @@ OpenAPI_qos_flow_item_t *OpenAPI_qos_flow_item_parseFromJSON(cJSON *qos_flow_ite OpenAPI_cause_e causeVariable = 0; cJSON *current_qos_profile_index = NULL; cJSON *null_qo_s_profile_index = NULL; + cJSON *ng_ap_cause = NULL; + OpenAPI_ng_ap_cause_t *ng_ap_cause_local_nonprim = NULL; qfi = cJSON_GetObjectItemCaseSensitive(qos_flow_itemJSON, "qfi"); if (!qfi) { ogs_error("OpenAPI_qos_flow_item_parseFromJSON() failed [qfi]"); @@ -121,6 +142,11 @@ OpenAPI_qos_flow_item_t *OpenAPI_qos_flow_item_parseFromJSON(cJSON *qos_flow_ite } } + ng_ap_cause = cJSON_GetObjectItemCaseSensitive(qos_flow_itemJSON, "ngApCause"); + if (ng_ap_cause) { + ng_ap_cause_local_nonprim = OpenAPI_ng_ap_cause_parseFromJSON(ng_ap_cause); + } + qos_flow_item_local_var = OpenAPI_qos_flow_item_create ( qfi->valuedouble, @@ -128,11 +154,16 @@ OpenAPI_qos_flow_item_t *OpenAPI_qos_flow_item_parseFromJSON(cJSON *qos_flow_ite current_qos_profile_index ? true : false, current_qos_profile_index ? current_qos_profile_index->valuedouble : 0, null_qo_s_profile_index ? true : false, - null_qo_s_profile_index ? null_qo_s_profile_index->valueint : 0 + null_qo_s_profile_index ? null_qo_s_profile_index->valueint : 0, + ng_ap_cause ? ng_ap_cause_local_nonprim : NULL ); return qos_flow_item_local_var; end: + if (ng_ap_cause_local_nonprim) { + OpenAPI_ng_ap_cause_free(ng_ap_cause_local_nonprim); + ng_ap_cause_local_nonprim = NULL; + } return NULL; } diff --git a/lib/sbi/openapi/model/qos_flow_item.h b/lib/sbi/openapi/model/qos_flow_item.h index fde46ec1c..79453b84e 100644 --- a/lib/sbi/openapi/model/qos_flow_item.h +++ b/lib/sbi/openapi/model/qos_flow_item.h @@ -1,7 +1,7 @@ /* * qos_flow_item.h * - * + * Individual QoS flow */ #ifndef _OpenAPI_qos_flow_item_H_ @@ -13,6 +13,7 @@ #include "../include/keyValuePair.h" #include "../include/binary.h" #include "cause.h" +#include "ng_ap_cause.h" #ifdef __cplusplus extern "C" { @@ -26,6 +27,7 @@ typedef struct OpenAPI_qos_flow_item_s { int current_qos_profile_index; bool is_null_qo_s_profile_index; int null_qo_s_profile_index; + struct OpenAPI_ng_ap_cause_s *ng_ap_cause; } OpenAPI_qos_flow_item_t; OpenAPI_qos_flow_item_t *OpenAPI_qos_flow_item_create( @@ -34,7 +36,8 @@ OpenAPI_qos_flow_item_t *OpenAPI_qos_flow_item_create( bool is_current_qos_profile_index, int current_qos_profile_index, bool is_null_qo_s_profile_index, - int null_qo_s_profile_index + int null_qo_s_profile_index, + OpenAPI_ng_ap_cause_t *ng_ap_cause ); void OpenAPI_qos_flow_item_free(OpenAPI_qos_flow_item_t *qos_flow_item); OpenAPI_qos_flow_item_t *OpenAPI_qos_flow_item_parseFromJSON(cJSON *qos_flow_itemJSON); diff --git a/lib/sbi/openapi/model/qos_flow_notify_item.h b/lib/sbi/openapi/model/qos_flow_notify_item.h index b675db163..71c380966 100644 --- a/lib/sbi/openapi/model/qos_flow_notify_item.h +++ b/lib/sbi/openapi/model/qos_flow_notify_item.h @@ -1,7 +1,7 @@ /* * qos_flow_notify_item.h * - * + * Notification related to a QoS flow */ #ifndef _OpenAPI_qos_flow_notify_item_H_ diff --git a/lib/sbi/openapi/model/qos_flow_profile.h b/lib/sbi/openapi/model/qos_flow_profile.h index 2c0db78dd..04f8ac036 100644 --- a/lib/sbi/openapi/model/qos_flow_profile.h +++ b/lib/sbi/openapi/model/qos_flow_profile.h @@ -1,7 +1,7 @@ /* * qos_flow_profile.h * - * + * QoS flow profile */ #ifndef _OpenAPI_qos_flow_profile_H_ diff --git a/lib/sbi/openapi/model/qos_flow_release_request_item.h b/lib/sbi/openapi/model/qos_flow_release_request_item.h index fb523f37c..bf8aa47c9 100644 --- a/lib/sbi/openapi/model/qos_flow_release_request_item.h +++ b/lib/sbi/openapi/model/qos_flow_release_request_item.h @@ -1,7 +1,7 @@ /* * qos_flow_release_request_item.h * - * + * Individual QoS flow requested to be released */ #ifndef _OpenAPI_qos_flow_release_request_item_H_ diff --git a/lib/sbi/openapi/model/qos_flow_setup_item.c b/lib/sbi/openapi/model/qos_flow_setup_item.c index 0d5cc253e..ccb34e7be 100644 --- a/lib/sbi/openapi/model/qos_flow_setup_item.c +++ b/lib/sbi/openapi/model/qos_flow_setup_item.c @@ -11,7 +11,9 @@ OpenAPI_qos_flow_setup_item_t *OpenAPI_qos_flow_setup_item_create( int ebi, char *qos_flow_description, OpenAPI_qos_flow_profile_t *qos_flow_profile, - OpenAPI_qos_flow_access_type_e associated_an_type + OpenAPI_qos_flow_access_type_e associated_an_type, + bool is_default_qos_rule_ind, + int default_qos_rule_ind ) { OpenAPI_qos_flow_setup_item_t *qos_flow_setup_item_local_var = ogs_malloc(sizeof(OpenAPI_qos_flow_setup_item_t)); @@ -24,6 +26,8 @@ OpenAPI_qos_flow_setup_item_t *OpenAPI_qos_flow_setup_item_create( qos_flow_setup_item_local_var->qos_flow_description = qos_flow_description; qos_flow_setup_item_local_var->qos_flow_profile = qos_flow_profile; qos_flow_setup_item_local_var->associated_an_type = associated_an_type; + qos_flow_setup_item_local_var->is_default_qos_rule_ind = is_default_qos_rule_ind; + qos_flow_setup_item_local_var->default_qos_rule_ind = default_qos_rule_ind; return qos_flow_setup_item_local_var; } @@ -109,6 +113,13 @@ cJSON *OpenAPI_qos_flow_setup_item_convertToJSON(OpenAPI_qos_flow_setup_item_t * } } + if (qos_flow_setup_item->is_default_qos_rule_ind) { + if (cJSON_AddBoolToObject(item, "defaultQosRuleInd", qos_flow_setup_item->default_qos_rule_ind) == NULL) { + ogs_error("OpenAPI_qos_flow_setup_item_convertToJSON() failed [default_qos_rule_ind]"); + goto end; + } + } + end: return item; } @@ -125,6 +136,7 @@ OpenAPI_qos_flow_setup_item_t *OpenAPI_qos_flow_setup_item_parseFromJSON(cJSON * OpenAPI_qos_flow_profile_t *qos_flow_profile_local_nonprim = NULL; cJSON *associated_an_type = NULL; OpenAPI_qos_flow_access_type_e associated_an_typeVariable = 0; + cJSON *default_qos_rule_ind = NULL; qfi = cJSON_GetObjectItemCaseSensitive(qos_flow_setup_itemJSON, "qfi"); if (!qfi) { ogs_error("OpenAPI_qos_flow_setup_item_parseFromJSON() failed [qfi]"); @@ -175,6 +187,14 @@ OpenAPI_qos_flow_setup_item_t *OpenAPI_qos_flow_setup_item_parseFromJSON(cJSON * associated_an_typeVariable = OpenAPI_qos_flow_access_type_FromString(associated_an_type->valuestring); } + default_qos_rule_ind = cJSON_GetObjectItemCaseSensitive(qos_flow_setup_itemJSON, "defaultQosRuleInd"); + if (default_qos_rule_ind) { + if (!cJSON_IsBool(default_qos_rule_ind)) { + ogs_error("OpenAPI_qos_flow_setup_item_parseFromJSON() failed [default_qos_rule_ind]"); + goto end; + } + } + qos_flow_setup_item_local_var = OpenAPI_qos_flow_setup_item_create ( qfi->valuedouble, @@ -183,7 +203,9 @@ OpenAPI_qos_flow_setup_item_t *OpenAPI_qos_flow_setup_item_parseFromJSON(cJSON * ebi ? ebi->valuedouble : 0, qos_flow_description && !cJSON_IsNull(qos_flow_description) ? ogs_strdup(qos_flow_description->valuestring) : NULL, qos_flow_profile ? qos_flow_profile_local_nonprim : NULL, - associated_an_type ? associated_an_typeVariable : 0 + associated_an_type ? associated_an_typeVariable : 0, + default_qos_rule_ind ? true : false, + default_qos_rule_ind ? default_qos_rule_ind->valueint : 0 ); return qos_flow_setup_item_local_var; diff --git a/lib/sbi/openapi/model/qos_flow_setup_item.h b/lib/sbi/openapi/model/qos_flow_setup_item.h index 18f4fd4ed..da5bb61ac 100644 --- a/lib/sbi/openapi/model/qos_flow_setup_item.h +++ b/lib/sbi/openapi/model/qos_flow_setup_item.h @@ -1,7 +1,7 @@ /* * qos_flow_setup_item.h * - * + * Individual QoS flow to setup */ #ifndef _OpenAPI_qos_flow_setup_item_H_ @@ -28,6 +28,8 @@ typedef struct OpenAPI_qos_flow_setup_item_s { char *qos_flow_description; struct OpenAPI_qos_flow_profile_s *qos_flow_profile; OpenAPI_qos_flow_access_type_e associated_an_type; + bool is_default_qos_rule_ind; + int default_qos_rule_ind; } OpenAPI_qos_flow_setup_item_t; OpenAPI_qos_flow_setup_item_t *OpenAPI_qos_flow_setup_item_create( @@ -37,7 +39,9 @@ OpenAPI_qos_flow_setup_item_t *OpenAPI_qos_flow_setup_item_create( int ebi, char *qos_flow_description, OpenAPI_qos_flow_profile_t *qos_flow_profile, - OpenAPI_qos_flow_access_type_e associated_an_type + OpenAPI_qos_flow_access_type_e associated_an_type, + bool is_default_qos_rule_ind, + int default_qos_rule_ind ); void OpenAPI_qos_flow_setup_item_free(OpenAPI_qos_flow_setup_item_t *qos_flow_setup_item); OpenAPI_qos_flow_setup_item_t *OpenAPI_qos_flow_setup_item_parseFromJSON(cJSON *qos_flow_setup_itemJSON); diff --git a/lib/sbi/openapi/model/qos_flow_usage_report.h b/lib/sbi/openapi/model/qos_flow_usage_report.h index 50c1cff7a..bab9522a5 100644 --- a/lib/sbi/openapi/model/qos_flow_usage_report.h +++ b/lib/sbi/openapi/model/qos_flow_usage_report.h @@ -1,7 +1,7 @@ /* * qos_flow_usage_report.h * - * + * Contains QoS flows usage data information. */ #ifndef _OpenAPI_qos_flow_usage_report_H_ diff --git a/lib/sbi/openapi/model/qos_monitoring_data.c b/lib/sbi/openapi/model/qos_monitoring_data.c index 481d62e5e..68230bc71 100644 --- a/lib/sbi/openapi/model/qos_monitoring_data.c +++ b/lib/sbi/openapi/model/qos_monitoring_data.c @@ -19,7 +19,9 @@ OpenAPI_qos_monitoring_data_t *OpenAPI_qos_monitoring_data_create( bool is_rep_period, int rep_period, char *notify_uri, - char *notify_corre_id + char *notify_corre_id, + bool is_direct_notif_ind, + int direct_notif_ind ) { OpenAPI_qos_monitoring_data_t *qos_monitoring_data_local_var = ogs_malloc(sizeof(OpenAPI_qos_monitoring_data_t)); @@ -40,6 +42,8 @@ OpenAPI_qos_monitoring_data_t *OpenAPI_qos_monitoring_data_create( qos_monitoring_data_local_var->rep_period = rep_period; qos_monitoring_data_local_var->notify_uri = notify_uri; qos_monitoring_data_local_var->notify_corre_id = notify_corre_id; + qos_monitoring_data_local_var->is_direct_notif_ind = is_direct_notif_ind; + qos_monitoring_data_local_var->direct_notif_ind = direct_notif_ind; return qos_monitoring_data_local_var; } @@ -175,6 +179,13 @@ cJSON *OpenAPI_qos_monitoring_data_convertToJSON(OpenAPI_qos_monitoring_data_t * } } + if (qos_monitoring_data->is_direct_notif_ind) { + if (cJSON_AddBoolToObject(item, "directNotifInd", qos_monitoring_data->direct_notif_ind) == NULL) { + ogs_error("OpenAPI_qos_monitoring_data_convertToJSON() failed [direct_notif_ind]"); + goto end; + } + } + end: return item; } @@ -195,6 +206,7 @@ OpenAPI_qos_monitoring_data_t *OpenAPI_qos_monitoring_data_parseFromJSON(cJSON * cJSON *rep_period = NULL; cJSON *notify_uri = NULL; cJSON *notify_corre_id = NULL; + cJSON *direct_notif_ind = NULL; qm_id = cJSON_GetObjectItemCaseSensitive(qos_monitoring_dataJSON, "qmId"); if (!qm_id) { ogs_error("OpenAPI_qos_monitoring_data_parseFromJSON() failed [qm_id]"); @@ -303,6 +315,14 @@ OpenAPI_qos_monitoring_data_t *OpenAPI_qos_monitoring_data_parseFromJSON(cJSON * } } + direct_notif_ind = cJSON_GetObjectItemCaseSensitive(qos_monitoring_dataJSON, "directNotifInd"); + if (direct_notif_ind) { + if (!cJSON_IsBool(direct_notif_ind)) { + ogs_error("OpenAPI_qos_monitoring_data_parseFromJSON() failed [direct_notif_ind]"); + goto end; + } + } + qos_monitoring_data_local_var = OpenAPI_qos_monitoring_data_create ( ogs_strdup(qm_id->valuestring), req_qos_mon_paramsList, @@ -318,7 +338,9 @@ OpenAPI_qos_monitoring_data_t *OpenAPI_qos_monitoring_data_parseFromJSON(cJSON * rep_period ? true : false, rep_period ? rep_period->valuedouble : 0, notify_uri && !cJSON_IsNull(notify_uri) ? ogs_strdup(notify_uri->valuestring) : NULL, - notify_corre_id && !cJSON_IsNull(notify_corre_id) ? ogs_strdup(notify_corre_id->valuestring) : NULL + notify_corre_id && !cJSON_IsNull(notify_corre_id) ? ogs_strdup(notify_corre_id->valuestring) : NULL, + direct_notif_ind ? true : false, + direct_notif_ind ? direct_notif_ind->valueint : 0 ); return qos_monitoring_data_local_var; diff --git a/lib/sbi/openapi/model/qos_monitoring_data.h b/lib/sbi/openapi/model/qos_monitoring_data.h index 1c59f4c80..e88a44745 100644 --- a/lib/sbi/openapi/model/qos_monitoring_data.h +++ b/lib/sbi/openapi/model/qos_monitoring_data.h @@ -1,7 +1,7 @@ /* * qos_monitoring_data.h * - * + * Contains QoS monitoring related control information. */ #ifndef _OpenAPI_qos_monitoring_data_H_ @@ -36,6 +36,8 @@ typedef struct OpenAPI_qos_monitoring_data_s { int rep_period; char *notify_uri; char *notify_corre_id; + bool is_direct_notif_ind; + int direct_notif_ind; } OpenAPI_qos_monitoring_data_t; OpenAPI_qos_monitoring_data_t *OpenAPI_qos_monitoring_data_create( @@ -53,7 +55,9 @@ OpenAPI_qos_monitoring_data_t *OpenAPI_qos_monitoring_data_create( bool is_rep_period, int rep_period, char *notify_uri, - char *notify_corre_id + char *notify_corre_id, + bool is_direct_notif_ind, + int direct_notif_ind ); void OpenAPI_qos_monitoring_data_free(OpenAPI_qos_monitoring_data_t *qos_monitoring_data); OpenAPI_qos_monitoring_data_t *OpenAPI_qos_monitoring_data_parseFromJSON(cJSON *qos_monitoring_dataJSON); diff --git a/lib/sbi/openapi/model/qos_monitoring_info.h b/lib/sbi/openapi/model/qos_monitoring_info.h index ac16ce8da..62da336ce 100644 --- a/lib/sbi/openapi/model/qos_monitoring_info.h +++ b/lib/sbi/openapi/model/qos_monitoring_info.h @@ -1,7 +1,7 @@ /* * qos_monitoring_info.h * - * + * QoS Monitoring Information */ #ifndef _OpenAPI_qos_monitoring_info_H_ diff --git a/lib/sbi/openapi/model/qos_monitoring_information_rm.h b/lib/sbi/openapi/model/qos_monitoring_information_rm.h index 0439d2452..af1c0cf7c 100644 --- a/lib/sbi/openapi/model/qos_monitoring_information_rm.h +++ b/lib/sbi/openapi/model/qos_monitoring_information_rm.h @@ -1,7 +1,7 @@ /* * qos_monitoring_information_rm.h * - * this data type is defined in the same way as the QosMonitoringInformation data type, but with the OpenAPI nullable property set to true. + * This data type is defined in the same way as the QosMonitoringInformation data type, but with the OpenAPI nullable property set to true. */ #ifndef _OpenAPI_qos_monitoring_information_rm_H_ diff --git a/lib/sbi/openapi/model/qos_monitoring_report.h b/lib/sbi/openapi/model/qos_monitoring_report.h index 502e06f7a..d933590b6 100644 --- a/lib/sbi/openapi/model/qos_monitoring_report.h +++ b/lib/sbi/openapi/model/qos_monitoring_report.h @@ -1,7 +1,7 @@ /* * qos_monitoring_report.h * - * QoS Monitoring reporting information + * QoS Monitoring reporting information. */ #ifndef _OpenAPI_qos_monitoring_report_H_ diff --git a/lib/sbi/openapi/model/qos_notification_control_info.h b/lib/sbi/openapi/model/qos_notification_control_info.h index b8f7da308..aeee9fc77 100644 --- a/lib/sbi/openapi/model/qos_notification_control_info.h +++ b/lib/sbi/openapi/model/qos_notification_control_info.h @@ -1,7 +1,7 @@ /* * qos_notification_control_info.h * - * Indicates whether the QoS targets for a GRB flow are not guaranteed or guaranteed again + * Indicates whether the QoS targets for a GRB flow are not guaranteed or guaranteed again. */ #ifndef _OpenAPI_qos_notification_control_info_H_ diff --git a/lib/sbi/openapi/model/qos_requirement.c b/lib/sbi/openapi/model/qos_requirement.c new file mode 100644 index 000000000..422d79524 --- /dev/null +++ b/lib/sbi/openapi/model/qos_requirement.c @@ -0,0 +1,221 @@ + +#include +#include +#include +#include "qos_requirement.h" + +OpenAPI_qos_requirement_t *OpenAPI_qos_requirement_create( + bool is__5qi, + int _5qi, + char *gfbr_ul, + char *gfbr_dl, + OpenAPI_qos_resource_type_e res_type, + bool is_pdb, + int pdb, + char *per +) +{ + OpenAPI_qos_requirement_t *qos_requirement_local_var = ogs_malloc(sizeof(OpenAPI_qos_requirement_t)); + ogs_assert(qos_requirement_local_var); + + qos_requirement_local_var->is__5qi = is__5qi; + qos_requirement_local_var->_5qi = _5qi; + qos_requirement_local_var->gfbr_ul = gfbr_ul; + qos_requirement_local_var->gfbr_dl = gfbr_dl; + qos_requirement_local_var->res_type = res_type; + qos_requirement_local_var->is_pdb = is_pdb; + qos_requirement_local_var->pdb = pdb; + qos_requirement_local_var->per = per; + + return qos_requirement_local_var; +} + +void OpenAPI_qos_requirement_free(OpenAPI_qos_requirement_t *qos_requirement) +{ + OpenAPI_lnode_t *node = NULL; + + if (NULL == qos_requirement) { + return; + } + if (qos_requirement->gfbr_ul) { + ogs_free(qos_requirement->gfbr_ul); + qos_requirement->gfbr_ul = NULL; + } + if (qos_requirement->gfbr_dl) { + ogs_free(qos_requirement->gfbr_dl); + qos_requirement->gfbr_dl = NULL; + } + if (qos_requirement->per) { + ogs_free(qos_requirement->per); + qos_requirement->per = NULL; + } + ogs_free(qos_requirement); +} + +cJSON *OpenAPI_qos_requirement_convertToJSON(OpenAPI_qos_requirement_t *qos_requirement) +{ + cJSON *item = NULL; + OpenAPI_lnode_t *node = NULL; + + if (qos_requirement == NULL) { + ogs_error("OpenAPI_qos_requirement_convertToJSON() failed [QosRequirement]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (qos_requirement->is__5qi) { + if (cJSON_AddNumberToObject(item, "5qi", qos_requirement->_5qi) == NULL) { + ogs_error("OpenAPI_qos_requirement_convertToJSON() failed [_5qi]"); + goto end; + } + } + + if (qos_requirement->gfbr_ul) { + if (cJSON_AddStringToObject(item, "gfbrUl", qos_requirement->gfbr_ul) == NULL) { + ogs_error("OpenAPI_qos_requirement_convertToJSON() failed [gfbr_ul]"); + goto end; + } + } + + if (qos_requirement->gfbr_dl) { + if (cJSON_AddStringToObject(item, "gfbrDl", qos_requirement->gfbr_dl) == NULL) { + ogs_error("OpenAPI_qos_requirement_convertToJSON() failed [gfbr_dl]"); + goto end; + } + } + + if (qos_requirement->res_type != OpenAPI_qos_resource_type_NULL) { + if (cJSON_AddStringToObject(item, "resType", OpenAPI_qos_resource_type_ToString(qos_requirement->res_type)) == NULL) { + ogs_error("OpenAPI_qos_requirement_convertToJSON() failed [res_type]"); + goto end; + } + } + + if (qos_requirement->is_pdb) { + if (cJSON_AddNumberToObject(item, "pdb", qos_requirement->pdb) == NULL) { + ogs_error("OpenAPI_qos_requirement_convertToJSON() failed [pdb]"); + goto end; + } + } + + if (qos_requirement->per) { + if (cJSON_AddStringToObject(item, "per", qos_requirement->per) == NULL) { + ogs_error("OpenAPI_qos_requirement_convertToJSON() failed [per]"); + goto end; + } + } + +end: + return item; +} + +OpenAPI_qos_requirement_t *OpenAPI_qos_requirement_parseFromJSON(cJSON *qos_requirementJSON) +{ + OpenAPI_qos_requirement_t *qos_requirement_local_var = NULL; + OpenAPI_lnode_t *node = NULL; + cJSON *_5qi = NULL; + cJSON *gfbr_ul = NULL; + cJSON *gfbr_dl = NULL; + cJSON *res_type = NULL; + OpenAPI_qos_resource_type_e res_typeVariable = 0; + cJSON *pdb = NULL; + cJSON *per = NULL; + _5qi = cJSON_GetObjectItemCaseSensitive(qos_requirementJSON, "5qi"); + if (_5qi) { + if (!cJSON_IsNumber(_5qi)) { + ogs_error("OpenAPI_qos_requirement_parseFromJSON() failed [_5qi]"); + goto end; + } + } + + gfbr_ul = cJSON_GetObjectItemCaseSensitive(qos_requirementJSON, "gfbrUl"); + if (gfbr_ul) { + if (!cJSON_IsString(gfbr_ul) && !cJSON_IsNull(gfbr_ul)) { + ogs_error("OpenAPI_qos_requirement_parseFromJSON() failed [gfbr_ul]"); + goto end; + } + } + + gfbr_dl = cJSON_GetObjectItemCaseSensitive(qos_requirementJSON, "gfbrDl"); + if (gfbr_dl) { + if (!cJSON_IsString(gfbr_dl) && !cJSON_IsNull(gfbr_dl)) { + ogs_error("OpenAPI_qos_requirement_parseFromJSON() failed [gfbr_dl]"); + goto end; + } + } + + res_type = cJSON_GetObjectItemCaseSensitive(qos_requirementJSON, "resType"); + if (res_type) { + if (!cJSON_IsString(res_type)) { + ogs_error("OpenAPI_qos_requirement_parseFromJSON() failed [res_type]"); + goto end; + } + res_typeVariable = OpenAPI_qos_resource_type_FromString(res_type->valuestring); + } + + pdb = cJSON_GetObjectItemCaseSensitive(qos_requirementJSON, "pdb"); + if (pdb) { + if (!cJSON_IsNumber(pdb)) { + ogs_error("OpenAPI_qos_requirement_parseFromJSON() failed [pdb]"); + goto end; + } + } + + per = cJSON_GetObjectItemCaseSensitive(qos_requirementJSON, "per"); + if (per) { + if (!cJSON_IsString(per) && !cJSON_IsNull(per)) { + ogs_error("OpenAPI_qos_requirement_parseFromJSON() failed [per]"); + goto end; + } + } + + qos_requirement_local_var = OpenAPI_qos_requirement_create ( + _5qi ? true : false, + _5qi ? _5qi->valuedouble : 0, + gfbr_ul && !cJSON_IsNull(gfbr_ul) ? ogs_strdup(gfbr_ul->valuestring) : NULL, + gfbr_dl && !cJSON_IsNull(gfbr_dl) ? ogs_strdup(gfbr_dl->valuestring) : NULL, + res_type ? res_typeVariable : 0, + pdb ? true : false, + pdb ? pdb->valuedouble : 0, + per && !cJSON_IsNull(per) ? ogs_strdup(per->valuestring) : NULL + ); + + return qos_requirement_local_var; +end: + return NULL; +} + +OpenAPI_qos_requirement_t *OpenAPI_qos_requirement_copy(OpenAPI_qos_requirement_t *dst, OpenAPI_qos_requirement_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_qos_requirement_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_qos_requirement_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_qos_requirement_free(dst); + dst = OpenAPI_qos_requirement_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/qos_requirement.h b/lib/sbi/openapi/model/qos_requirement.h new file mode 100644 index 000000000..f31af08ae --- /dev/null +++ b/lib/sbi/openapi/model/qos_requirement.h @@ -0,0 +1,53 @@ +/* + * qos_requirement.h + * + * Represents the QoS requirements. + */ + +#ifndef _OpenAPI_qos_requirement_H_ +#define _OpenAPI_qos_requirement_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "qos_resource_type.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_qos_requirement_s OpenAPI_qos_requirement_t; +typedef struct OpenAPI_qos_requirement_s { + bool is__5qi; + int _5qi; + char *gfbr_ul; + char *gfbr_dl; + OpenAPI_qos_resource_type_e res_type; + bool is_pdb; + int pdb; + char *per; +} OpenAPI_qos_requirement_t; + +OpenAPI_qos_requirement_t *OpenAPI_qos_requirement_create( + bool is__5qi, + int _5qi, + char *gfbr_ul, + char *gfbr_dl, + OpenAPI_qos_resource_type_e res_type, + bool is_pdb, + int pdb, + char *per +); +void OpenAPI_qos_requirement_free(OpenAPI_qos_requirement_t *qos_requirement); +OpenAPI_qos_requirement_t *OpenAPI_qos_requirement_parseFromJSON(cJSON *qos_requirementJSON); +cJSON *OpenAPI_qos_requirement_convertToJSON(OpenAPI_qos_requirement_t *qos_requirement); +OpenAPI_qos_requirement_t *OpenAPI_qos_requirement_copy(OpenAPI_qos_requirement_t *dst, OpenAPI_qos_requirement_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_qos_requirement_H_ */ + diff --git a/lib/sbi/openapi/model/qos_sustainability_info.c b/lib/sbi/openapi/model/qos_sustainability_info.c new file mode 100644 index 000000000..e996a0a5b --- /dev/null +++ b/lib/sbi/openapi/model/qos_sustainability_info.c @@ -0,0 +1,271 @@ + +#include +#include +#include +#include "qos_sustainability_info.h" + +OpenAPI_qos_sustainability_info_t *OpenAPI_qos_sustainability_info_create( + OpenAPI_network_area_info_t *area_info, + char *start_ts, + char *end_ts, + OpenAPI_retainability_threshold_t *qos_flow_ret_thd, + char *ran_ue_throu_thd, + OpenAPI_snssai_t *snssai, + bool is_confidence, + int confidence +) +{ + OpenAPI_qos_sustainability_info_t *qos_sustainability_info_local_var = ogs_malloc(sizeof(OpenAPI_qos_sustainability_info_t)); + ogs_assert(qos_sustainability_info_local_var); + + qos_sustainability_info_local_var->area_info = area_info; + qos_sustainability_info_local_var->start_ts = start_ts; + qos_sustainability_info_local_var->end_ts = end_ts; + qos_sustainability_info_local_var->qos_flow_ret_thd = qos_flow_ret_thd; + qos_sustainability_info_local_var->ran_ue_throu_thd = ran_ue_throu_thd; + qos_sustainability_info_local_var->snssai = snssai; + qos_sustainability_info_local_var->is_confidence = is_confidence; + qos_sustainability_info_local_var->confidence = confidence; + + return qos_sustainability_info_local_var; +} + +void OpenAPI_qos_sustainability_info_free(OpenAPI_qos_sustainability_info_t *qos_sustainability_info) +{ + OpenAPI_lnode_t *node = NULL; + + if (NULL == qos_sustainability_info) { + return; + } + if (qos_sustainability_info->area_info) { + OpenAPI_network_area_info_free(qos_sustainability_info->area_info); + qos_sustainability_info->area_info = NULL; + } + if (qos_sustainability_info->start_ts) { + ogs_free(qos_sustainability_info->start_ts); + qos_sustainability_info->start_ts = NULL; + } + if (qos_sustainability_info->end_ts) { + ogs_free(qos_sustainability_info->end_ts); + qos_sustainability_info->end_ts = NULL; + } + if (qos_sustainability_info->qos_flow_ret_thd) { + OpenAPI_retainability_threshold_free(qos_sustainability_info->qos_flow_ret_thd); + qos_sustainability_info->qos_flow_ret_thd = NULL; + } + if (qos_sustainability_info->ran_ue_throu_thd) { + ogs_free(qos_sustainability_info->ran_ue_throu_thd); + qos_sustainability_info->ran_ue_throu_thd = NULL; + } + if (qos_sustainability_info->snssai) { + OpenAPI_snssai_free(qos_sustainability_info->snssai); + qos_sustainability_info->snssai = NULL; + } + ogs_free(qos_sustainability_info); +} + +cJSON *OpenAPI_qos_sustainability_info_convertToJSON(OpenAPI_qos_sustainability_info_t *qos_sustainability_info) +{ + cJSON *item = NULL; + OpenAPI_lnode_t *node = NULL; + + if (qos_sustainability_info == NULL) { + ogs_error("OpenAPI_qos_sustainability_info_convertToJSON() failed [QosSustainabilityInfo]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (qos_sustainability_info->area_info) { + cJSON *area_info_local_JSON = OpenAPI_network_area_info_convertToJSON(qos_sustainability_info->area_info); + if (area_info_local_JSON == NULL) { + ogs_error("OpenAPI_qos_sustainability_info_convertToJSON() failed [area_info]"); + goto end; + } + cJSON_AddItemToObject(item, "areaInfo", area_info_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_qos_sustainability_info_convertToJSON() failed [area_info]"); + goto end; + } + } + + if (qos_sustainability_info->start_ts) { + if (cJSON_AddStringToObject(item, "startTs", qos_sustainability_info->start_ts) == NULL) { + ogs_error("OpenAPI_qos_sustainability_info_convertToJSON() failed [start_ts]"); + goto end; + } + } + + if (qos_sustainability_info->end_ts) { + if (cJSON_AddStringToObject(item, "endTs", qos_sustainability_info->end_ts) == NULL) { + ogs_error("OpenAPI_qos_sustainability_info_convertToJSON() failed [end_ts]"); + goto end; + } + } + + if (qos_sustainability_info->qos_flow_ret_thd) { + cJSON *qos_flow_ret_thd_local_JSON = OpenAPI_retainability_threshold_convertToJSON(qos_sustainability_info->qos_flow_ret_thd); + if (qos_flow_ret_thd_local_JSON == NULL) { + ogs_error("OpenAPI_qos_sustainability_info_convertToJSON() failed [qos_flow_ret_thd]"); + goto end; + } + cJSON_AddItemToObject(item, "qosFlowRetThd", qos_flow_ret_thd_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_qos_sustainability_info_convertToJSON() failed [qos_flow_ret_thd]"); + goto end; + } + } + + if (qos_sustainability_info->ran_ue_throu_thd) { + if (cJSON_AddStringToObject(item, "ranUeThrouThd", qos_sustainability_info->ran_ue_throu_thd) == NULL) { + ogs_error("OpenAPI_qos_sustainability_info_convertToJSON() failed [ran_ue_throu_thd]"); + goto end; + } + } + + if (qos_sustainability_info->snssai) { + cJSON *snssai_local_JSON = OpenAPI_snssai_convertToJSON(qos_sustainability_info->snssai); + if (snssai_local_JSON == NULL) { + ogs_error("OpenAPI_qos_sustainability_info_convertToJSON() failed [snssai]"); + goto end; + } + cJSON_AddItemToObject(item, "snssai", snssai_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_qos_sustainability_info_convertToJSON() failed [snssai]"); + goto end; + } + } + + if (qos_sustainability_info->is_confidence) { + if (cJSON_AddNumberToObject(item, "confidence", qos_sustainability_info->confidence) == NULL) { + ogs_error("OpenAPI_qos_sustainability_info_convertToJSON() failed [confidence]"); + goto end; + } + } + +end: + return item; +} + +OpenAPI_qos_sustainability_info_t *OpenAPI_qos_sustainability_info_parseFromJSON(cJSON *qos_sustainability_infoJSON) +{ + OpenAPI_qos_sustainability_info_t *qos_sustainability_info_local_var = NULL; + OpenAPI_lnode_t *node = NULL; + cJSON *area_info = NULL; + OpenAPI_network_area_info_t *area_info_local_nonprim = NULL; + cJSON *start_ts = NULL; + cJSON *end_ts = NULL; + cJSON *qos_flow_ret_thd = NULL; + OpenAPI_retainability_threshold_t *qos_flow_ret_thd_local_nonprim = NULL; + cJSON *ran_ue_throu_thd = NULL; + cJSON *snssai = NULL; + OpenAPI_snssai_t *snssai_local_nonprim = NULL; + cJSON *confidence = NULL; + area_info = cJSON_GetObjectItemCaseSensitive(qos_sustainability_infoJSON, "areaInfo"); + if (area_info) { + area_info_local_nonprim = OpenAPI_network_area_info_parseFromJSON(area_info); + } + + start_ts = cJSON_GetObjectItemCaseSensitive(qos_sustainability_infoJSON, "startTs"); + if (start_ts) { + if (!cJSON_IsString(start_ts) && !cJSON_IsNull(start_ts)) { + ogs_error("OpenAPI_qos_sustainability_info_parseFromJSON() failed [start_ts]"); + goto end; + } + } + + end_ts = cJSON_GetObjectItemCaseSensitive(qos_sustainability_infoJSON, "endTs"); + if (end_ts) { + if (!cJSON_IsString(end_ts) && !cJSON_IsNull(end_ts)) { + ogs_error("OpenAPI_qos_sustainability_info_parseFromJSON() failed [end_ts]"); + goto end; + } + } + + qos_flow_ret_thd = cJSON_GetObjectItemCaseSensitive(qos_sustainability_infoJSON, "qosFlowRetThd"); + if (qos_flow_ret_thd) { + qos_flow_ret_thd_local_nonprim = OpenAPI_retainability_threshold_parseFromJSON(qos_flow_ret_thd); + } + + ran_ue_throu_thd = cJSON_GetObjectItemCaseSensitive(qos_sustainability_infoJSON, "ranUeThrouThd"); + if (ran_ue_throu_thd) { + if (!cJSON_IsString(ran_ue_throu_thd) && !cJSON_IsNull(ran_ue_throu_thd)) { + ogs_error("OpenAPI_qos_sustainability_info_parseFromJSON() failed [ran_ue_throu_thd]"); + goto end; + } + } + + snssai = cJSON_GetObjectItemCaseSensitive(qos_sustainability_infoJSON, "snssai"); + if (snssai) { + snssai_local_nonprim = OpenAPI_snssai_parseFromJSON(snssai); + } + + confidence = cJSON_GetObjectItemCaseSensitive(qos_sustainability_infoJSON, "confidence"); + if (confidence) { + if (!cJSON_IsNumber(confidence)) { + ogs_error("OpenAPI_qos_sustainability_info_parseFromJSON() failed [confidence]"); + goto end; + } + } + + qos_sustainability_info_local_var = OpenAPI_qos_sustainability_info_create ( + area_info ? area_info_local_nonprim : NULL, + start_ts && !cJSON_IsNull(start_ts) ? ogs_strdup(start_ts->valuestring) : NULL, + end_ts && !cJSON_IsNull(end_ts) ? ogs_strdup(end_ts->valuestring) : NULL, + qos_flow_ret_thd ? qos_flow_ret_thd_local_nonprim : NULL, + ran_ue_throu_thd && !cJSON_IsNull(ran_ue_throu_thd) ? ogs_strdup(ran_ue_throu_thd->valuestring) : NULL, + snssai ? snssai_local_nonprim : NULL, + confidence ? true : false, + confidence ? confidence->valuedouble : 0 + ); + + return qos_sustainability_info_local_var; +end: + if (area_info_local_nonprim) { + OpenAPI_network_area_info_free(area_info_local_nonprim); + area_info_local_nonprim = NULL; + } + if (qos_flow_ret_thd_local_nonprim) { + OpenAPI_retainability_threshold_free(qos_flow_ret_thd_local_nonprim); + qos_flow_ret_thd_local_nonprim = NULL; + } + if (snssai_local_nonprim) { + OpenAPI_snssai_free(snssai_local_nonprim); + snssai_local_nonprim = NULL; + } + return NULL; +} + +OpenAPI_qos_sustainability_info_t *OpenAPI_qos_sustainability_info_copy(OpenAPI_qos_sustainability_info_t *dst, OpenAPI_qos_sustainability_info_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_qos_sustainability_info_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_qos_sustainability_info_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_qos_sustainability_info_free(dst); + dst = OpenAPI_qos_sustainability_info_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/qos_sustainability_info.h b/lib/sbi/openapi/model/qos_sustainability_info.h new file mode 100644 index 000000000..f21fe4f16 --- /dev/null +++ b/lib/sbi/openapi/model/qos_sustainability_info.h @@ -0,0 +1,55 @@ +/* + * qos_sustainability_info.h + * + * Represents the QoS Sustainability information. + */ + +#ifndef _OpenAPI_qos_sustainability_info_H_ +#define _OpenAPI_qos_sustainability_info_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "network_area_info.h" +#include "retainability_threshold.h" +#include "snssai.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_qos_sustainability_info_s OpenAPI_qos_sustainability_info_t; +typedef struct OpenAPI_qos_sustainability_info_s { + struct OpenAPI_network_area_info_s *area_info; + char *start_ts; + char *end_ts; + struct OpenAPI_retainability_threshold_s *qos_flow_ret_thd; + char *ran_ue_throu_thd; + struct OpenAPI_snssai_s *snssai; + bool is_confidence; + int confidence; +} OpenAPI_qos_sustainability_info_t; + +OpenAPI_qos_sustainability_info_t *OpenAPI_qos_sustainability_info_create( + OpenAPI_network_area_info_t *area_info, + char *start_ts, + char *end_ts, + OpenAPI_retainability_threshold_t *qos_flow_ret_thd, + char *ran_ue_throu_thd, + OpenAPI_snssai_t *snssai, + bool is_confidence, + int confidence +); +void OpenAPI_qos_sustainability_info_free(OpenAPI_qos_sustainability_info_t *qos_sustainability_info); +OpenAPI_qos_sustainability_info_t *OpenAPI_qos_sustainability_info_parseFromJSON(cJSON *qos_sustainability_infoJSON); +cJSON *OpenAPI_qos_sustainability_info_convertToJSON(OpenAPI_qos_sustainability_info_t *qos_sustainability_info); +OpenAPI_qos_sustainability_info_t *OpenAPI_qos_sustainability_info_copy(OpenAPI_qos_sustainability_info_t *dst, OpenAPI_qos_sustainability_info_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_qos_sustainability_info_H_ */ + diff --git a/lib/sbi/openapi/model/query_param_combination.c b/lib/sbi/openapi/model/query_param_combination.c new file mode 100644 index 000000000..ede2b547b --- /dev/null +++ b/lib/sbi/openapi/model/query_param_combination.c @@ -0,0 +1,151 @@ + +#include +#include +#include +#include "query_param_combination.h" + +OpenAPI_query_param_combination_t *OpenAPI_query_param_combination_create( + OpenAPI_list_t *query_params +) +{ + OpenAPI_query_param_combination_t *query_param_combination_local_var = ogs_malloc(sizeof(OpenAPI_query_param_combination_t)); + ogs_assert(query_param_combination_local_var); + + query_param_combination_local_var->query_params = query_params; + + return query_param_combination_local_var; +} + +void OpenAPI_query_param_combination_free(OpenAPI_query_param_combination_t *query_param_combination) +{ + OpenAPI_lnode_t *node = NULL; + + if (NULL == query_param_combination) { + return; + } + if (query_param_combination->query_params) { + OpenAPI_list_for_each(query_param_combination->query_params, node) { + OpenAPI_query_parameter_free(node->data); + } + OpenAPI_list_free(query_param_combination->query_params); + query_param_combination->query_params = NULL; + } + ogs_free(query_param_combination); +} + +cJSON *OpenAPI_query_param_combination_convertToJSON(OpenAPI_query_param_combination_t *query_param_combination) +{ + cJSON *item = NULL; + OpenAPI_lnode_t *node = NULL; + + if (query_param_combination == NULL) { + ogs_error("OpenAPI_query_param_combination_convertToJSON() failed [QueryParamCombination]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (!query_param_combination->query_params) { + ogs_error("OpenAPI_query_param_combination_convertToJSON() failed [query_params]"); + return NULL; + } + cJSON *query_paramsList = cJSON_AddArrayToObject(item, "queryParams"); + if (query_paramsList == NULL) { + ogs_error("OpenAPI_query_param_combination_convertToJSON() failed [query_params]"); + goto end; + } + OpenAPI_list_for_each(query_param_combination->query_params, node) { + cJSON *itemLocal = OpenAPI_query_parameter_convertToJSON(node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_query_param_combination_convertToJSON() failed [query_params]"); + goto end; + } + cJSON_AddItemToArray(query_paramsList, itemLocal); + } + +end: + return item; +} + +OpenAPI_query_param_combination_t *OpenAPI_query_param_combination_parseFromJSON(cJSON *query_param_combinationJSON) +{ + OpenAPI_query_param_combination_t *query_param_combination_local_var = NULL; + OpenAPI_lnode_t *node = NULL; + cJSON *query_params = NULL; + OpenAPI_list_t *query_paramsList = NULL; + query_params = cJSON_GetObjectItemCaseSensitive(query_param_combinationJSON, "queryParams"); + if (!query_params) { + ogs_error("OpenAPI_query_param_combination_parseFromJSON() failed [query_params]"); + goto end; + } + cJSON *query_params_local = NULL; + if (!cJSON_IsArray(query_params)) { + ogs_error("OpenAPI_query_param_combination_parseFromJSON() failed [query_params]"); + goto end; + } + + query_paramsList = OpenAPI_list_create(); + + cJSON_ArrayForEach(query_params_local, query_params) { + if (!cJSON_IsObject(query_params_local)) { + ogs_error("OpenAPI_query_param_combination_parseFromJSON() failed [query_params]"); + goto end; + } + OpenAPI_query_parameter_t *query_paramsItem = OpenAPI_query_parameter_parseFromJSON(query_params_local); + if (!query_paramsItem) { + ogs_error("No query_paramsItem"); + OpenAPI_list_free(query_paramsList); + goto end; + } + OpenAPI_list_add(query_paramsList, query_paramsItem); + } + + query_param_combination_local_var = OpenAPI_query_param_combination_create ( + query_paramsList + ); + + return query_param_combination_local_var; +end: + if (query_paramsList) { + OpenAPI_list_for_each(query_paramsList, node) { + OpenAPI_query_parameter_free(node->data); + } + OpenAPI_list_free(query_paramsList); + query_paramsList = NULL; + } + return NULL; +} + +OpenAPI_query_param_combination_t *OpenAPI_query_param_combination_copy(OpenAPI_query_param_combination_t *dst, OpenAPI_query_param_combination_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_query_param_combination_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_query_param_combination_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_query_param_combination_free(dst); + dst = OpenAPI_query_param_combination_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/query_param_combination.h b/lib/sbi/openapi/model/query_param_combination.h new file mode 100644 index 000000000..ccb4e2e0f --- /dev/null +++ b/lib/sbi/openapi/model/query_param_combination.h @@ -0,0 +1,39 @@ +/* + * query_param_combination.h + * + * Contains a list of Query Parameters + */ + +#ifndef _OpenAPI_query_param_combination_H_ +#define _OpenAPI_query_param_combination_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "query_parameter.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_query_param_combination_s OpenAPI_query_param_combination_t; +typedef struct OpenAPI_query_param_combination_s { + OpenAPI_list_t *query_params; +} OpenAPI_query_param_combination_t; + +OpenAPI_query_param_combination_t *OpenAPI_query_param_combination_create( + OpenAPI_list_t *query_params +); +void OpenAPI_query_param_combination_free(OpenAPI_query_param_combination_t *query_param_combination); +OpenAPI_query_param_combination_t *OpenAPI_query_param_combination_parseFromJSON(cJSON *query_param_combinationJSON); +cJSON *OpenAPI_query_param_combination_convertToJSON(OpenAPI_query_param_combination_t *query_param_combination); +OpenAPI_query_param_combination_t *OpenAPI_query_param_combination_copy(OpenAPI_query_param_combination_t *dst, OpenAPI_query_param_combination_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_query_param_combination_H_ */ + diff --git a/lib/sbi/openapi/model/query_parameter.c b/lib/sbi/openapi/model/query_parameter.c new file mode 100644 index 000000000..0c4a02334 --- /dev/null +++ b/lib/sbi/openapi/model/query_parameter.c @@ -0,0 +1,141 @@ + +#include +#include +#include +#include "query_parameter.h" + +OpenAPI_query_parameter_t *OpenAPI_query_parameter_create( + char *name, + char *value +) +{ + OpenAPI_query_parameter_t *query_parameter_local_var = ogs_malloc(sizeof(OpenAPI_query_parameter_t)); + ogs_assert(query_parameter_local_var); + + query_parameter_local_var->name = name; + query_parameter_local_var->value = value; + + return query_parameter_local_var; +} + +void OpenAPI_query_parameter_free(OpenAPI_query_parameter_t *query_parameter) +{ + OpenAPI_lnode_t *node = NULL; + + if (NULL == query_parameter) { + return; + } + if (query_parameter->name) { + ogs_free(query_parameter->name); + query_parameter->name = NULL; + } + if (query_parameter->value) { + ogs_free(query_parameter->value); + query_parameter->value = NULL; + } + ogs_free(query_parameter); +} + +cJSON *OpenAPI_query_parameter_convertToJSON(OpenAPI_query_parameter_t *query_parameter) +{ + cJSON *item = NULL; + OpenAPI_lnode_t *node = NULL; + + if (query_parameter == NULL) { + ogs_error("OpenAPI_query_parameter_convertToJSON() failed [QueryParameter]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (!query_parameter->name) { + ogs_error("OpenAPI_query_parameter_convertToJSON() failed [name]"); + return NULL; + } + if (cJSON_AddStringToObject(item, "name", query_parameter->name) == NULL) { + ogs_error("OpenAPI_query_parameter_convertToJSON() failed [name]"); + goto end; + } + + if (!query_parameter->value) { + ogs_error("OpenAPI_query_parameter_convertToJSON() failed [value]"); + return NULL; + } + if (cJSON_AddStringToObject(item, "value", query_parameter->value) == NULL) { + ogs_error("OpenAPI_query_parameter_convertToJSON() failed [value]"); + goto end; + } + +end: + return item; +} + +OpenAPI_query_parameter_t *OpenAPI_query_parameter_parseFromJSON(cJSON *query_parameterJSON) +{ + OpenAPI_query_parameter_t *query_parameter_local_var = NULL; + OpenAPI_lnode_t *node = NULL; + cJSON *name = NULL; + cJSON *value = NULL; + name = cJSON_GetObjectItemCaseSensitive(query_parameterJSON, "name"); + if (!name) { + ogs_error("OpenAPI_query_parameter_parseFromJSON() failed [name]"); + goto end; + } + if (!cJSON_IsString(name)) { + ogs_error("OpenAPI_query_parameter_parseFromJSON() failed [name]"); + goto end; + } + + value = cJSON_GetObjectItemCaseSensitive(query_parameterJSON, "value"); + if (!value) { + ogs_error("OpenAPI_query_parameter_parseFromJSON() failed [value]"); + goto end; + } + if (!cJSON_IsString(value)) { + ogs_error("OpenAPI_query_parameter_parseFromJSON() failed [value]"); + goto end; + } + + query_parameter_local_var = OpenAPI_query_parameter_create ( + ogs_strdup(name->valuestring), + ogs_strdup(value->valuestring) + ); + + return query_parameter_local_var; +end: + return NULL; +} + +OpenAPI_query_parameter_t *OpenAPI_query_parameter_copy(OpenAPI_query_parameter_t *dst, OpenAPI_query_parameter_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_query_parameter_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_query_parameter_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_query_parameter_free(dst); + dst = OpenAPI_query_parameter_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/query_parameter.h b/lib/sbi/openapi/model/query_parameter.h new file mode 100644 index 000000000..8c59828e4 --- /dev/null +++ b/lib/sbi/openapi/model/query_parameter.h @@ -0,0 +1,40 @@ +/* + * query_parameter.h + * + * Contains the name and value of a query parameter + */ + +#ifndef _OpenAPI_query_parameter_H_ +#define _OpenAPI_query_parameter_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_query_parameter_s OpenAPI_query_parameter_t; +typedef struct OpenAPI_query_parameter_s { + char *name; + char *value; +} OpenAPI_query_parameter_t; + +OpenAPI_query_parameter_t *OpenAPI_query_parameter_create( + char *name, + char *value +); +void OpenAPI_query_parameter_free(OpenAPI_query_parameter_t *query_parameter); +OpenAPI_query_parameter_t *OpenAPI_query_parameter_parseFromJSON(cJSON *query_parameterJSON); +cJSON *OpenAPI_query_parameter_convertToJSON(OpenAPI_query_parameter_t *query_parameter); +OpenAPI_query_parameter_t *OpenAPI_query_parameter_copy(OpenAPI_query_parameter_t *dst, OpenAPI_query_parameter_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_query_parameter_H_ */ + diff --git a/lib/sbi/openapi/model/ran_nas_rel_cause.h b/lib/sbi/openapi/model/ran_nas_rel_cause.h index 71219939a..01f0ea128 100644 --- a/lib/sbi/openapi/model/ran_nas_rel_cause.h +++ b/lib/sbi/openapi/model/ran_nas_rel_cause.h @@ -1,7 +1,7 @@ /* * ran_nas_rel_cause.h * - * + * Contains the RAN/NAS release cause. */ #ifndef _OpenAPI_ran_nas_rel_cause_H_ diff --git a/lib/sbi/openapi/model/ranking_criterion.c b/lib/sbi/openapi/model/ranking_criterion.c new file mode 100644 index 000000000..905510993 --- /dev/null +++ b/lib/sbi/openapi/model/ranking_criterion.c @@ -0,0 +1,127 @@ + +#include +#include +#include +#include "ranking_criterion.h" + +OpenAPI_ranking_criterion_t *OpenAPI_ranking_criterion_create( + int high_base, + int low_base +) +{ + OpenAPI_ranking_criterion_t *ranking_criterion_local_var = ogs_malloc(sizeof(OpenAPI_ranking_criterion_t)); + ogs_assert(ranking_criterion_local_var); + + ranking_criterion_local_var->high_base = high_base; + ranking_criterion_local_var->low_base = low_base; + + return ranking_criterion_local_var; +} + +void OpenAPI_ranking_criterion_free(OpenAPI_ranking_criterion_t *ranking_criterion) +{ + OpenAPI_lnode_t *node = NULL; + + if (NULL == ranking_criterion) { + return; + } + ogs_free(ranking_criterion); +} + +cJSON *OpenAPI_ranking_criterion_convertToJSON(OpenAPI_ranking_criterion_t *ranking_criterion) +{ + cJSON *item = NULL; + OpenAPI_lnode_t *node = NULL; + + if (ranking_criterion == NULL) { + ogs_error("OpenAPI_ranking_criterion_convertToJSON() failed [RankingCriterion]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (cJSON_AddNumberToObject(item, "highBase", ranking_criterion->high_base) == NULL) { + ogs_error("OpenAPI_ranking_criterion_convertToJSON() failed [high_base]"); + goto end; + } + + if (cJSON_AddNumberToObject(item, "lowBase", ranking_criterion->low_base) == NULL) { + ogs_error("OpenAPI_ranking_criterion_convertToJSON() failed [low_base]"); + goto end; + } + +end: + return item; +} + +OpenAPI_ranking_criterion_t *OpenAPI_ranking_criterion_parseFromJSON(cJSON *ranking_criterionJSON) +{ + OpenAPI_ranking_criterion_t *ranking_criterion_local_var = NULL; + OpenAPI_lnode_t *node = NULL; + cJSON *high_base = NULL; + cJSON *low_base = NULL; + high_base = cJSON_GetObjectItemCaseSensitive(ranking_criterionJSON, "highBase"); + if (!high_base) { + ogs_error("OpenAPI_ranking_criterion_parseFromJSON() failed [high_base]"); + goto end; + } + if (!cJSON_IsNumber(high_base)) { + ogs_error("OpenAPI_ranking_criterion_parseFromJSON() failed [high_base]"); + goto end; + } + + low_base = cJSON_GetObjectItemCaseSensitive(ranking_criterionJSON, "lowBase"); + if (!low_base) { + ogs_error("OpenAPI_ranking_criterion_parseFromJSON() failed [low_base]"); + goto end; + } + if (!cJSON_IsNumber(low_base)) { + ogs_error("OpenAPI_ranking_criterion_parseFromJSON() failed [low_base]"); + goto end; + } + + ranking_criterion_local_var = OpenAPI_ranking_criterion_create ( + + high_base->valuedouble, + + low_base->valuedouble + ); + + return ranking_criterion_local_var; +end: + return NULL; +} + +OpenAPI_ranking_criterion_t *OpenAPI_ranking_criterion_copy(OpenAPI_ranking_criterion_t *dst, OpenAPI_ranking_criterion_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_ranking_criterion_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_ranking_criterion_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_ranking_criterion_free(dst); + dst = OpenAPI_ranking_criterion_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/ranking_criterion.h b/lib/sbi/openapi/model/ranking_criterion.h new file mode 100644 index 000000000..444b2ce6c --- /dev/null +++ b/lib/sbi/openapi/model/ranking_criterion.h @@ -0,0 +1,40 @@ +/* + * ranking_criterion.h + * + * Indicates the usage ranking criterion between the high, medium and low usage UE. + */ + +#ifndef _OpenAPI_ranking_criterion_H_ +#define _OpenAPI_ranking_criterion_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_ranking_criterion_s OpenAPI_ranking_criterion_t; +typedef struct OpenAPI_ranking_criterion_s { + int high_base; + int low_base; +} OpenAPI_ranking_criterion_t; + +OpenAPI_ranking_criterion_t *OpenAPI_ranking_criterion_create( + int high_base, + int low_base +); +void OpenAPI_ranking_criterion_free(OpenAPI_ranking_criterion_t *ranking_criterion); +OpenAPI_ranking_criterion_t *OpenAPI_ranking_criterion_parseFromJSON(cJSON *ranking_criterionJSON); +cJSON *OpenAPI_ranking_criterion_convertToJSON(OpenAPI_ranking_criterion_t *ranking_criterion); +OpenAPI_ranking_criterion_t *OpenAPI_ranking_criterion_copy(OpenAPI_ranking_criterion_t *dst, OpenAPI_ranking_criterion_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_ranking_criterion_H_ */ + diff --git a/lib/sbi/openapi/model/rat_freq_information.c b/lib/sbi/openapi/model/rat_freq_information.c new file mode 100644 index 000000000..532078dd3 --- /dev/null +++ b/lib/sbi/openapi/model/rat_freq_information.c @@ -0,0 +1,236 @@ + +#include +#include +#include +#include "rat_freq_information.h" + +OpenAPI_rat_freq_information_t *OpenAPI_rat_freq_information_create( + bool is_all_freq, + int all_freq, + bool is_all_rat, + int all_rat, + bool is_freq, + int freq, + OpenAPI_rat_type_e rat_type, + OpenAPI_threshold_level_t *svc_exp_threshold, + OpenAPI_matching_direction_t *matching_dir +) +{ + OpenAPI_rat_freq_information_t *rat_freq_information_local_var = ogs_malloc(sizeof(OpenAPI_rat_freq_information_t)); + ogs_assert(rat_freq_information_local_var); + + rat_freq_information_local_var->is_all_freq = is_all_freq; + rat_freq_information_local_var->all_freq = all_freq; + rat_freq_information_local_var->is_all_rat = is_all_rat; + rat_freq_information_local_var->all_rat = all_rat; + rat_freq_information_local_var->is_freq = is_freq; + rat_freq_information_local_var->freq = freq; + rat_freq_information_local_var->rat_type = rat_type; + rat_freq_information_local_var->svc_exp_threshold = svc_exp_threshold; + rat_freq_information_local_var->matching_dir = matching_dir; + + return rat_freq_information_local_var; +} + +void OpenAPI_rat_freq_information_free(OpenAPI_rat_freq_information_t *rat_freq_information) +{ + OpenAPI_lnode_t *node = NULL; + + if (NULL == rat_freq_information) { + return; + } + if (rat_freq_information->svc_exp_threshold) { + OpenAPI_threshold_level_free(rat_freq_information->svc_exp_threshold); + rat_freq_information->svc_exp_threshold = NULL; + } + if (rat_freq_information->matching_dir) { + OpenAPI_matching_direction_free(rat_freq_information->matching_dir); + rat_freq_information->matching_dir = NULL; + } + ogs_free(rat_freq_information); +} + +cJSON *OpenAPI_rat_freq_information_convertToJSON(OpenAPI_rat_freq_information_t *rat_freq_information) +{ + cJSON *item = NULL; + OpenAPI_lnode_t *node = NULL; + + if (rat_freq_information == NULL) { + ogs_error("OpenAPI_rat_freq_information_convertToJSON() failed [RatFreqInformation]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (rat_freq_information->is_all_freq) { + if (cJSON_AddBoolToObject(item, "allFreq", rat_freq_information->all_freq) == NULL) { + ogs_error("OpenAPI_rat_freq_information_convertToJSON() failed [all_freq]"); + goto end; + } + } + + if (rat_freq_information->is_all_rat) { + if (cJSON_AddBoolToObject(item, "allRat", rat_freq_information->all_rat) == NULL) { + ogs_error("OpenAPI_rat_freq_information_convertToJSON() failed [all_rat]"); + goto end; + } + } + + if (rat_freq_information->is_freq) { + if (cJSON_AddNumberToObject(item, "freq", rat_freq_information->freq) == NULL) { + ogs_error("OpenAPI_rat_freq_information_convertToJSON() failed [freq]"); + goto end; + } + } + + if (rat_freq_information->rat_type != OpenAPI_rat_type_NULL) { + if (cJSON_AddStringToObject(item, "ratType", OpenAPI_rat_type_ToString(rat_freq_information->rat_type)) == NULL) { + ogs_error("OpenAPI_rat_freq_information_convertToJSON() failed [rat_type]"); + goto end; + } + } + + if (rat_freq_information->svc_exp_threshold) { + cJSON *svc_exp_threshold_local_JSON = OpenAPI_threshold_level_convertToJSON(rat_freq_information->svc_exp_threshold); + if (svc_exp_threshold_local_JSON == NULL) { + ogs_error("OpenAPI_rat_freq_information_convertToJSON() failed [svc_exp_threshold]"); + goto end; + } + cJSON_AddItemToObject(item, "svcExpThreshold", svc_exp_threshold_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_rat_freq_information_convertToJSON() failed [svc_exp_threshold]"); + goto end; + } + } + + if (rat_freq_information->matching_dir) { + cJSON *matching_dir_local_JSON = OpenAPI_matching_direction_convertToJSON(rat_freq_information->matching_dir); + if (matching_dir_local_JSON == NULL) { + ogs_error("OpenAPI_rat_freq_information_convertToJSON() failed [matching_dir]"); + goto end; + } + cJSON_AddItemToObject(item, "matchingDir", matching_dir_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_rat_freq_information_convertToJSON() failed [matching_dir]"); + goto end; + } + } + +end: + return item; +} + +OpenAPI_rat_freq_information_t *OpenAPI_rat_freq_information_parseFromJSON(cJSON *rat_freq_informationJSON) +{ + OpenAPI_rat_freq_information_t *rat_freq_information_local_var = NULL; + OpenAPI_lnode_t *node = NULL; + cJSON *all_freq = NULL; + cJSON *all_rat = NULL; + cJSON *freq = NULL; + cJSON *rat_type = NULL; + OpenAPI_rat_type_e rat_typeVariable = 0; + cJSON *svc_exp_threshold = NULL; + OpenAPI_threshold_level_t *svc_exp_threshold_local_nonprim = NULL; + cJSON *matching_dir = NULL; + OpenAPI_matching_direction_t *matching_dir_local_nonprim = NULL; + all_freq = cJSON_GetObjectItemCaseSensitive(rat_freq_informationJSON, "allFreq"); + if (all_freq) { + if (!cJSON_IsBool(all_freq)) { + ogs_error("OpenAPI_rat_freq_information_parseFromJSON() failed [all_freq]"); + goto end; + } + } + + all_rat = cJSON_GetObjectItemCaseSensitive(rat_freq_informationJSON, "allRat"); + if (all_rat) { + if (!cJSON_IsBool(all_rat)) { + ogs_error("OpenAPI_rat_freq_information_parseFromJSON() failed [all_rat]"); + goto end; + } + } + + freq = cJSON_GetObjectItemCaseSensitive(rat_freq_informationJSON, "freq"); + if (freq) { + if (!cJSON_IsNumber(freq)) { + ogs_error("OpenAPI_rat_freq_information_parseFromJSON() failed [freq]"); + goto end; + } + } + + rat_type = cJSON_GetObjectItemCaseSensitive(rat_freq_informationJSON, "ratType"); + if (rat_type) { + if (!cJSON_IsString(rat_type)) { + ogs_error("OpenAPI_rat_freq_information_parseFromJSON() failed [rat_type]"); + goto end; + } + rat_typeVariable = OpenAPI_rat_type_FromString(rat_type->valuestring); + } + + svc_exp_threshold = cJSON_GetObjectItemCaseSensitive(rat_freq_informationJSON, "svcExpThreshold"); + if (svc_exp_threshold) { + svc_exp_threshold_local_nonprim = OpenAPI_threshold_level_parseFromJSON(svc_exp_threshold); + } + + matching_dir = cJSON_GetObjectItemCaseSensitive(rat_freq_informationJSON, "matchingDir"); + if (matching_dir) { + matching_dir_local_nonprim = OpenAPI_matching_direction_parseFromJSON(matching_dir); + } + + rat_freq_information_local_var = OpenAPI_rat_freq_information_create ( + all_freq ? true : false, + all_freq ? all_freq->valueint : 0, + all_rat ? true : false, + all_rat ? all_rat->valueint : 0, + freq ? true : false, + freq ? freq->valuedouble : 0, + rat_type ? rat_typeVariable : 0, + svc_exp_threshold ? svc_exp_threshold_local_nonprim : NULL, + matching_dir ? matching_dir_local_nonprim : NULL + ); + + return rat_freq_information_local_var; +end: + if (svc_exp_threshold_local_nonprim) { + OpenAPI_threshold_level_free(svc_exp_threshold_local_nonprim); + svc_exp_threshold_local_nonprim = NULL; + } + if (matching_dir_local_nonprim) { + OpenAPI_matching_direction_free(matching_dir_local_nonprim); + matching_dir_local_nonprim = NULL; + } + return NULL; +} + +OpenAPI_rat_freq_information_t *OpenAPI_rat_freq_information_copy(OpenAPI_rat_freq_information_t *dst, OpenAPI_rat_freq_information_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_rat_freq_information_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_rat_freq_information_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_rat_freq_information_free(dst); + dst = OpenAPI_rat_freq_information_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/rat_freq_information.h b/lib/sbi/openapi/model/rat_freq_information.h new file mode 100644 index 000000000..edd9a233e --- /dev/null +++ b/lib/sbi/openapi/model/rat_freq_information.h @@ -0,0 +1,57 @@ +/* + * rat_freq_information.h + * + * Represents the RAT type and/or Frequency information. + */ + +#ifndef _OpenAPI_rat_freq_information_H_ +#define _OpenAPI_rat_freq_information_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "matching_direction.h" +#include "rat_type.h" +#include "threshold_level.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_rat_freq_information_s OpenAPI_rat_freq_information_t; +typedef struct OpenAPI_rat_freq_information_s { + bool is_all_freq; + int all_freq; + bool is_all_rat; + int all_rat; + bool is_freq; + int freq; + OpenAPI_rat_type_e rat_type; + struct OpenAPI_threshold_level_s *svc_exp_threshold; + struct OpenAPI_matching_direction_s *matching_dir; +} OpenAPI_rat_freq_information_t; + +OpenAPI_rat_freq_information_t *OpenAPI_rat_freq_information_create( + bool is_all_freq, + int all_freq, + bool is_all_rat, + int all_rat, + bool is_freq, + int freq, + OpenAPI_rat_type_e rat_type, + OpenAPI_threshold_level_t *svc_exp_threshold, + OpenAPI_matching_direction_t *matching_dir +); +void OpenAPI_rat_freq_information_free(OpenAPI_rat_freq_information_t *rat_freq_information); +OpenAPI_rat_freq_information_t *OpenAPI_rat_freq_information_parseFromJSON(cJSON *rat_freq_informationJSON); +cJSON *OpenAPI_rat_freq_information_convertToJSON(OpenAPI_rat_freq_information_t *rat_freq_information); +OpenAPI_rat_freq_information_t *OpenAPI_rat_freq_information_copy(OpenAPI_rat_freq_information_t *dst, OpenAPI_rat_freq_information_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_rat_freq_information_H_ */ + diff --git a/lib/sbi/openapi/model/rat_type.c b/lib/sbi/openapi/model/rat_type.c index d31d7ccd7..585589fab 100644 --- a/lib/sbi/openapi/model/rat_type.c +++ b/lib/sbi/openapi/model/rat_type.c @@ -6,7 +6,7 @@ char* OpenAPI_rat_type_ToString(OpenAPI_rat_type_e rat_type) { - const char *rat_typeArray[] = { "NULL", "NR", "EUTRA", "WLAN", "VIRTUAL", "NBIOT", "WIRELINE", "WIRELINE_CABLE", "WIRELINE_BBF", "LTE-M", "NR_U", "EUTRA_U", "TRUSTED_N3GA", "TRUSTED_WLAN", "UTRA", "GERA" }; + const char *rat_typeArray[] = { "NULL", "NR", "EUTRA", "WLAN", "VIRTUAL", "NBIOT", "WIRELINE", "WIRELINE_CABLE", "WIRELINE_BBF", "LTE-M", "NR_U", "EUTRA_U", "TRUSTED_N3GA", "TRUSTED_WLAN", "UTRA", "GERA", "NR_LEO", "NR_MEO", "NR_GEO", "NR_OTHER_SAT", "NR_REDCAP" }; size_t sizeofArray = sizeof(rat_typeArray) / sizeof(rat_typeArray[0]); if (rat_type < sizeofArray) return (char *)rat_typeArray[rat_type]; @@ -17,7 +17,7 @@ char* OpenAPI_rat_type_ToString(OpenAPI_rat_type_e rat_type) OpenAPI_rat_type_e OpenAPI_rat_type_FromString(char* rat_type) { int stringToReturn = 0; - const char *rat_typeArray[] = { "NULL", "NR", "EUTRA", "WLAN", "VIRTUAL", "NBIOT", "WIRELINE", "WIRELINE_CABLE", "WIRELINE_BBF", "LTE-M", "NR_U", "EUTRA_U", "TRUSTED_N3GA", "TRUSTED_WLAN", "UTRA", "GERA" }; + const char *rat_typeArray[] = { "NULL", "NR", "EUTRA", "WLAN", "VIRTUAL", "NBIOT", "WIRELINE", "WIRELINE_CABLE", "WIRELINE_BBF", "LTE-M", "NR_U", "EUTRA_U", "TRUSTED_N3GA", "TRUSTED_WLAN", "UTRA", "GERA", "NR_LEO", "NR_MEO", "NR_GEO", "NR_OTHER_SAT", "NR_REDCAP" }; size_t sizeofArray = sizeof(rat_typeArray) / sizeof(rat_typeArray[0]); while (stringToReturn < sizeofArray) { if (strcmp(rat_type, rat_typeArray[stringToReturn]) == 0) { diff --git a/lib/sbi/openapi/model/rat_type.h b/lib/sbi/openapi/model/rat_type.h index 9d7be784f..b044a417a 100644 --- a/lib/sbi/openapi/model/rat_type.h +++ b/lib/sbi/openapi/model/rat_type.h @@ -17,7 +17,7 @@ extern "C" { #endif -typedef enum { OpenAPI_rat_type_NULL = 0, OpenAPI_rat_type_NR, OpenAPI_rat_type_EUTRA, OpenAPI_rat_type_WLAN, OpenAPI_rat_type__VIRTUAL, OpenAPI_rat_type_NBIOT, OpenAPI_rat_type_WIRELINE, OpenAPI_rat_type_WIRELINE_CABLE, OpenAPI_rat_type_WIRELINE_BBF, OpenAPI_rat_type_LTE_M, OpenAPI_rat_type_NR_U, OpenAPI_rat_type_EUTRA_U, OpenAPI_rat_type_TRUSTED_N3GA, OpenAPI_rat_type_TRUSTED_WLAN, OpenAPI_rat_type_UTRA, OpenAPI_rat_type_GERA } OpenAPI_rat_type_e; +typedef enum { OpenAPI_rat_type_NULL = 0, OpenAPI_rat_type_NR, OpenAPI_rat_type_EUTRA, OpenAPI_rat_type_WLAN, OpenAPI_rat_type__VIRTUAL, OpenAPI_rat_type_NBIOT, OpenAPI_rat_type_WIRELINE, OpenAPI_rat_type_WIRELINE_CABLE, OpenAPI_rat_type_WIRELINE_BBF, OpenAPI_rat_type_LTE_M, OpenAPI_rat_type_NR_U, OpenAPI_rat_type_EUTRA_U, OpenAPI_rat_type_TRUSTED_N3GA, OpenAPI_rat_type_TRUSTED_WLAN, OpenAPI_rat_type_UTRA, OpenAPI_rat_type_GERA, OpenAPI_rat_type_NR_LEO, OpenAPI_rat_type_NR_MEO, OpenAPI_rat_type_NR_GEO, OpenAPI_rat_type_NR_OTHER_SAT, OpenAPI_rat_type_NR_REDCAP } OpenAPI_rat_type_e; char* OpenAPI_rat_type_ToString(OpenAPI_rat_type_e rat_type); diff --git a/lib/sbi/openapi/model/reachability_filter.h b/lib/sbi/openapi/model/reachability_filter.h index 37ac208f9..b4d2e7788 100644 --- a/lib/sbi/openapi/model/reachability_filter.h +++ b/lib/sbi/openapi/model/reachability_filter.h @@ -1,7 +1,7 @@ /* * reachability_filter.h * - * + * Event filter for REACHABILITY_REPORT event type */ #ifndef _OpenAPI_reachability_filter_H_ diff --git a/lib/sbi/openapi/model/reachability_for_data_configuration.c b/lib/sbi/openapi/model/reachability_for_data_configuration.c new file mode 100644 index 000000000..c956f3f46 --- /dev/null +++ b/lib/sbi/openapi/model/reachability_for_data_configuration.c @@ -0,0 +1,144 @@ + +#include +#include +#include +#include "reachability_for_data_configuration.h" + +OpenAPI_reachability_for_data_configuration_t *OpenAPI_reachability_for_data_configuration_create( + OpenAPI_reachability_for_data_report_config_t *report_cfg, + bool is_min_interval, + int min_interval +) +{ + OpenAPI_reachability_for_data_configuration_t *reachability_for_data_configuration_local_var = ogs_malloc(sizeof(OpenAPI_reachability_for_data_configuration_t)); + ogs_assert(reachability_for_data_configuration_local_var); + + reachability_for_data_configuration_local_var->report_cfg = report_cfg; + reachability_for_data_configuration_local_var->is_min_interval = is_min_interval; + reachability_for_data_configuration_local_var->min_interval = min_interval; + + return reachability_for_data_configuration_local_var; +} + +void OpenAPI_reachability_for_data_configuration_free(OpenAPI_reachability_for_data_configuration_t *reachability_for_data_configuration) +{ + OpenAPI_lnode_t *node = NULL; + + if (NULL == reachability_for_data_configuration) { + return; + } + if (reachability_for_data_configuration->report_cfg) { + OpenAPI_reachability_for_data_report_config_free(reachability_for_data_configuration->report_cfg); + reachability_for_data_configuration->report_cfg = NULL; + } + ogs_free(reachability_for_data_configuration); +} + +cJSON *OpenAPI_reachability_for_data_configuration_convertToJSON(OpenAPI_reachability_for_data_configuration_t *reachability_for_data_configuration) +{ + cJSON *item = NULL; + OpenAPI_lnode_t *node = NULL; + + if (reachability_for_data_configuration == NULL) { + ogs_error("OpenAPI_reachability_for_data_configuration_convertToJSON() failed [ReachabilityForDataConfiguration]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (!reachability_for_data_configuration->report_cfg) { + ogs_error("OpenAPI_reachability_for_data_configuration_convertToJSON() failed [report_cfg]"); + return NULL; + } + cJSON *report_cfg_local_JSON = OpenAPI_reachability_for_data_report_config_convertToJSON(reachability_for_data_configuration->report_cfg); + if (report_cfg_local_JSON == NULL) { + ogs_error("OpenAPI_reachability_for_data_configuration_convertToJSON() failed [report_cfg]"); + goto end; + } + cJSON_AddItemToObject(item, "reportCfg", report_cfg_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_reachability_for_data_configuration_convertToJSON() failed [report_cfg]"); + goto end; + } + + if (reachability_for_data_configuration->is_min_interval) { + if (cJSON_AddNumberToObject(item, "minInterval", reachability_for_data_configuration->min_interval) == NULL) { + ogs_error("OpenAPI_reachability_for_data_configuration_convertToJSON() failed [min_interval]"); + goto end; + } + } + +end: + return item; +} + +OpenAPI_reachability_for_data_configuration_t *OpenAPI_reachability_for_data_configuration_parseFromJSON(cJSON *reachability_for_data_configurationJSON) +{ + OpenAPI_reachability_for_data_configuration_t *reachability_for_data_configuration_local_var = NULL; + OpenAPI_lnode_t *node = NULL; + cJSON *report_cfg = NULL; + OpenAPI_reachability_for_data_report_config_t *report_cfg_local_nonprim = NULL; + cJSON *min_interval = NULL; + report_cfg = cJSON_GetObjectItemCaseSensitive(reachability_for_data_configurationJSON, "reportCfg"); + if (!report_cfg) { + ogs_error("OpenAPI_reachability_for_data_configuration_parseFromJSON() failed [report_cfg]"); + goto end; + } + report_cfg_local_nonprim = OpenAPI_reachability_for_data_report_config_parseFromJSON(report_cfg); + + min_interval = cJSON_GetObjectItemCaseSensitive(reachability_for_data_configurationJSON, "minInterval"); + if (min_interval) { + if (!cJSON_IsNumber(min_interval)) { + ogs_error("OpenAPI_reachability_for_data_configuration_parseFromJSON() failed [min_interval]"); + goto end; + } + } + + reachability_for_data_configuration_local_var = OpenAPI_reachability_for_data_configuration_create ( + report_cfg_local_nonprim, + min_interval ? true : false, + min_interval ? min_interval->valuedouble : 0 + ); + + return reachability_for_data_configuration_local_var; +end: + if (report_cfg_local_nonprim) { + OpenAPI_reachability_for_data_report_config_free(report_cfg_local_nonprim); + report_cfg_local_nonprim = NULL; + } + return NULL; +} + +OpenAPI_reachability_for_data_configuration_t *OpenAPI_reachability_for_data_configuration_copy(OpenAPI_reachability_for_data_configuration_t *dst, OpenAPI_reachability_for_data_configuration_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_reachability_for_data_configuration_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_reachability_for_data_configuration_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_reachability_for_data_configuration_free(dst); + dst = OpenAPI_reachability_for_data_configuration_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/reachability_for_data_configuration.h b/lib/sbi/openapi/model/reachability_for_data_configuration.h new file mode 100644 index 000000000..cefda28da --- /dev/null +++ b/lib/sbi/openapi/model/reachability_for_data_configuration.h @@ -0,0 +1,43 @@ +/* + * reachability_for_data_configuration.h + * + * + */ + +#ifndef _OpenAPI_reachability_for_data_configuration_H_ +#define _OpenAPI_reachability_for_data_configuration_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "reachability_for_data_report_config.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_reachability_for_data_configuration_s OpenAPI_reachability_for_data_configuration_t; +typedef struct OpenAPI_reachability_for_data_configuration_s { + struct OpenAPI_reachability_for_data_report_config_s *report_cfg; + bool is_min_interval; + int min_interval; +} OpenAPI_reachability_for_data_configuration_t; + +OpenAPI_reachability_for_data_configuration_t *OpenAPI_reachability_for_data_configuration_create( + OpenAPI_reachability_for_data_report_config_t *report_cfg, + bool is_min_interval, + int min_interval +); +void OpenAPI_reachability_for_data_configuration_free(OpenAPI_reachability_for_data_configuration_t *reachability_for_data_configuration); +OpenAPI_reachability_for_data_configuration_t *OpenAPI_reachability_for_data_configuration_parseFromJSON(cJSON *reachability_for_data_configurationJSON); +cJSON *OpenAPI_reachability_for_data_configuration_convertToJSON(OpenAPI_reachability_for_data_configuration_t *reachability_for_data_configuration); +OpenAPI_reachability_for_data_configuration_t *OpenAPI_reachability_for_data_configuration_copy(OpenAPI_reachability_for_data_configuration_t *dst, OpenAPI_reachability_for_data_configuration_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_reachability_for_data_configuration_H_ */ + diff --git a/lib/sbi/openapi/model/reachability_for_data_configuration_1.c b/lib/sbi/openapi/model/reachability_for_data_configuration_1.c new file mode 100644 index 000000000..9cff10be0 --- /dev/null +++ b/lib/sbi/openapi/model/reachability_for_data_configuration_1.c @@ -0,0 +1,144 @@ + +#include +#include +#include +#include "reachability_for_data_configuration_1.h" + +OpenAPI_reachability_for_data_configuration_1_t *OpenAPI_reachability_for_data_configuration_1_create( + OpenAPI_reachability_for_data_report_config_t *report_cfg, + bool is_min_interval, + int min_interval +) +{ + OpenAPI_reachability_for_data_configuration_1_t *reachability_for_data_configuration_1_local_var = ogs_malloc(sizeof(OpenAPI_reachability_for_data_configuration_1_t)); + ogs_assert(reachability_for_data_configuration_1_local_var); + + reachability_for_data_configuration_1_local_var->report_cfg = report_cfg; + reachability_for_data_configuration_1_local_var->is_min_interval = is_min_interval; + reachability_for_data_configuration_1_local_var->min_interval = min_interval; + + return reachability_for_data_configuration_1_local_var; +} + +void OpenAPI_reachability_for_data_configuration_1_free(OpenAPI_reachability_for_data_configuration_1_t *reachability_for_data_configuration_1) +{ + OpenAPI_lnode_t *node = NULL; + + if (NULL == reachability_for_data_configuration_1) { + return; + } + if (reachability_for_data_configuration_1->report_cfg) { + OpenAPI_reachability_for_data_report_config_free(reachability_for_data_configuration_1->report_cfg); + reachability_for_data_configuration_1->report_cfg = NULL; + } + ogs_free(reachability_for_data_configuration_1); +} + +cJSON *OpenAPI_reachability_for_data_configuration_1_convertToJSON(OpenAPI_reachability_for_data_configuration_1_t *reachability_for_data_configuration_1) +{ + cJSON *item = NULL; + OpenAPI_lnode_t *node = NULL; + + if (reachability_for_data_configuration_1 == NULL) { + ogs_error("OpenAPI_reachability_for_data_configuration_1_convertToJSON() failed [ReachabilityForDataConfiguration_1]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (!reachability_for_data_configuration_1->report_cfg) { + ogs_error("OpenAPI_reachability_for_data_configuration_1_convertToJSON() failed [report_cfg]"); + return NULL; + } + cJSON *report_cfg_local_JSON = OpenAPI_reachability_for_data_report_config_convertToJSON(reachability_for_data_configuration_1->report_cfg); + if (report_cfg_local_JSON == NULL) { + ogs_error("OpenAPI_reachability_for_data_configuration_1_convertToJSON() failed [report_cfg]"); + goto end; + } + cJSON_AddItemToObject(item, "reportCfg", report_cfg_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_reachability_for_data_configuration_1_convertToJSON() failed [report_cfg]"); + goto end; + } + + if (reachability_for_data_configuration_1->is_min_interval) { + if (cJSON_AddNumberToObject(item, "minInterval", reachability_for_data_configuration_1->min_interval) == NULL) { + ogs_error("OpenAPI_reachability_for_data_configuration_1_convertToJSON() failed [min_interval]"); + goto end; + } + } + +end: + return item; +} + +OpenAPI_reachability_for_data_configuration_1_t *OpenAPI_reachability_for_data_configuration_1_parseFromJSON(cJSON *reachability_for_data_configuration_1JSON) +{ + OpenAPI_reachability_for_data_configuration_1_t *reachability_for_data_configuration_1_local_var = NULL; + OpenAPI_lnode_t *node = NULL; + cJSON *report_cfg = NULL; + OpenAPI_reachability_for_data_report_config_t *report_cfg_local_nonprim = NULL; + cJSON *min_interval = NULL; + report_cfg = cJSON_GetObjectItemCaseSensitive(reachability_for_data_configuration_1JSON, "reportCfg"); + if (!report_cfg) { + ogs_error("OpenAPI_reachability_for_data_configuration_1_parseFromJSON() failed [report_cfg]"); + goto end; + } + report_cfg_local_nonprim = OpenAPI_reachability_for_data_report_config_parseFromJSON(report_cfg); + + min_interval = cJSON_GetObjectItemCaseSensitive(reachability_for_data_configuration_1JSON, "minInterval"); + if (min_interval) { + if (!cJSON_IsNumber(min_interval)) { + ogs_error("OpenAPI_reachability_for_data_configuration_1_parseFromJSON() failed [min_interval]"); + goto end; + } + } + + reachability_for_data_configuration_1_local_var = OpenAPI_reachability_for_data_configuration_1_create ( + report_cfg_local_nonprim, + min_interval ? true : false, + min_interval ? min_interval->valuedouble : 0 + ); + + return reachability_for_data_configuration_1_local_var; +end: + if (report_cfg_local_nonprim) { + OpenAPI_reachability_for_data_report_config_free(report_cfg_local_nonprim); + report_cfg_local_nonprim = NULL; + } + return NULL; +} + +OpenAPI_reachability_for_data_configuration_1_t *OpenAPI_reachability_for_data_configuration_1_copy(OpenAPI_reachability_for_data_configuration_1_t *dst, OpenAPI_reachability_for_data_configuration_1_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_reachability_for_data_configuration_1_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_reachability_for_data_configuration_1_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_reachability_for_data_configuration_1_free(dst); + dst = OpenAPI_reachability_for_data_configuration_1_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/reachability_for_data_configuration_1.h b/lib/sbi/openapi/model/reachability_for_data_configuration_1.h new file mode 100644 index 000000000..c36b07a97 --- /dev/null +++ b/lib/sbi/openapi/model/reachability_for_data_configuration_1.h @@ -0,0 +1,43 @@ +/* + * reachability_for_data_configuration_1.h + * + * + */ + +#ifndef _OpenAPI_reachability_for_data_configuration_1_H_ +#define _OpenAPI_reachability_for_data_configuration_1_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "reachability_for_data_report_config.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_reachability_for_data_configuration_1_s OpenAPI_reachability_for_data_configuration_1_t; +typedef struct OpenAPI_reachability_for_data_configuration_1_s { + struct OpenAPI_reachability_for_data_report_config_s *report_cfg; + bool is_min_interval; + int min_interval; +} OpenAPI_reachability_for_data_configuration_1_t; + +OpenAPI_reachability_for_data_configuration_1_t *OpenAPI_reachability_for_data_configuration_1_create( + OpenAPI_reachability_for_data_report_config_t *report_cfg, + bool is_min_interval, + int min_interval +); +void OpenAPI_reachability_for_data_configuration_1_free(OpenAPI_reachability_for_data_configuration_1_t *reachability_for_data_configuration_1); +OpenAPI_reachability_for_data_configuration_1_t *OpenAPI_reachability_for_data_configuration_1_parseFromJSON(cJSON *reachability_for_data_configuration_1JSON); +cJSON *OpenAPI_reachability_for_data_configuration_1_convertToJSON(OpenAPI_reachability_for_data_configuration_1_t *reachability_for_data_configuration_1); +OpenAPI_reachability_for_data_configuration_1_t *OpenAPI_reachability_for_data_configuration_1_copy(OpenAPI_reachability_for_data_configuration_1_t *dst, OpenAPI_reachability_for_data_configuration_1_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_reachability_for_data_configuration_1_H_ */ + diff --git a/lib/sbi/openapi/model/reachability_for_data_report_config.c b/lib/sbi/openapi/model/reachability_for_data_report_config.c new file mode 100644 index 000000000..ff72b842e --- /dev/null +++ b/lib/sbi/openapi/model/reachability_for_data_report_config.c @@ -0,0 +1,87 @@ + +#include +#include +#include +#include "reachability_for_data_report_config.h" + +OpenAPI_reachability_for_data_report_config_t *OpenAPI_reachability_for_data_report_config_create( +) +{ + OpenAPI_reachability_for_data_report_config_t *reachability_for_data_report_config_local_var = ogs_malloc(sizeof(OpenAPI_reachability_for_data_report_config_t)); + ogs_assert(reachability_for_data_report_config_local_var); + + + return reachability_for_data_report_config_local_var; +} + +void OpenAPI_reachability_for_data_report_config_free(OpenAPI_reachability_for_data_report_config_t *reachability_for_data_report_config) +{ + OpenAPI_lnode_t *node = NULL; + + if (NULL == reachability_for_data_report_config) { + return; + } + ogs_free(reachability_for_data_report_config); +} + +cJSON *OpenAPI_reachability_for_data_report_config_convertToJSON(OpenAPI_reachability_for_data_report_config_t *reachability_for_data_report_config) +{ + cJSON *item = NULL; + OpenAPI_lnode_t *node = NULL; + + if (reachability_for_data_report_config == NULL) { + ogs_error("OpenAPI_reachability_for_data_report_config_convertToJSON() failed [ReachabilityForDataReportConfig]"); + return NULL; + } + + item = cJSON_CreateObject(); +end: + return item; +} + +OpenAPI_reachability_for_data_report_config_t *OpenAPI_reachability_for_data_report_config_parseFromJSON(cJSON *reachability_for_data_report_configJSON) +{ + OpenAPI_reachability_for_data_report_config_t *reachability_for_data_report_config_local_var = NULL; + OpenAPI_lnode_t *node = NULL; + reachability_for_data_report_config_local_var = OpenAPI_reachability_for_data_report_config_create ( + ); + + return reachability_for_data_report_config_local_var; +end: + return NULL; +} + +OpenAPI_reachability_for_data_report_config_t *OpenAPI_reachability_for_data_report_config_copy(OpenAPI_reachability_for_data_report_config_t *dst, OpenAPI_reachability_for_data_report_config_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_reachability_for_data_report_config_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_reachability_for_data_report_config_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_reachability_for_data_report_config_free(dst); + dst = OpenAPI_reachability_for_data_report_config_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/reachability_for_data_report_config.h b/lib/sbi/openapi/model/reachability_for_data_report_config.h new file mode 100644 index 000000000..491466171 --- /dev/null +++ b/lib/sbi/openapi/model/reachability_for_data_report_config.h @@ -0,0 +1,37 @@ +/* + * reachability_for_data_report_config.h + * + * + */ + +#ifndef _OpenAPI_reachability_for_data_report_config_H_ +#define _OpenAPI_reachability_for_data_report_config_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "reachability_for_data_report_config_any_of.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_reachability_for_data_report_config_s OpenAPI_reachability_for_data_report_config_t; +typedef struct OpenAPI_reachability_for_data_report_config_s { +} OpenAPI_reachability_for_data_report_config_t; + +OpenAPI_reachability_for_data_report_config_t *OpenAPI_reachability_for_data_report_config_create( +); +void OpenAPI_reachability_for_data_report_config_free(OpenAPI_reachability_for_data_report_config_t *reachability_for_data_report_config); +OpenAPI_reachability_for_data_report_config_t *OpenAPI_reachability_for_data_report_config_parseFromJSON(cJSON *reachability_for_data_report_configJSON); +cJSON *OpenAPI_reachability_for_data_report_config_convertToJSON(OpenAPI_reachability_for_data_report_config_t *reachability_for_data_report_config); +OpenAPI_reachability_for_data_report_config_t *OpenAPI_reachability_for_data_report_config_copy(OpenAPI_reachability_for_data_report_config_t *dst, OpenAPI_reachability_for_data_report_config_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_reachability_for_data_report_config_H_ */ + diff --git a/lib/sbi/openapi/model/reachability_for_data_report_config_any_of.c b/lib/sbi/openapi/model/reachability_for_data_report_config_any_of.c new file mode 100644 index 000000000..bf10be3f0 --- /dev/null +++ b/lib/sbi/openapi/model/reachability_for_data_report_config_any_of.c @@ -0,0 +1,30 @@ + +#include +#include +#include +#include "reachability_for_data_report_config_any_of.h" + +char* OpenAPI_reachability_for_data_report_config_any_of_ToString(OpenAPI_reachability_for_data_report_config_any_of_e reachability_for_data_report_config_any_of) +{ + const char *reachability_for_data_report_config_any_ofArray[] = { "NULL", "DIRECT_REPORT", "INDIRECT_REPORT" }; + size_t sizeofArray = sizeof(reachability_for_data_report_config_any_ofArray) / sizeof(reachability_for_data_report_config_any_ofArray[0]); + if (reachability_for_data_report_config_any_of < sizeofArray) + return (char *)reachability_for_data_report_config_any_ofArray[reachability_for_data_report_config_any_of]; + else + return (char *)"Unknown"; +} + +OpenAPI_reachability_for_data_report_config_any_of_e OpenAPI_reachability_for_data_report_config_any_of_FromString(char* reachability_for_data_report_config_any_of) +{ + int stringToReturn = 0; + const char *reachability_for_data_report_config_any_ofArray[] = { "NULL", "DIRECT_REPORT", "INDIRECT_REPORT" }; + size_t sizeofArray = sizeof(reachability_for_data_report_config_any_ofArray) / sizeof(reachability_for_data_report_config_any_ofArray[0]); + while (stringToReturn < sizeofArray) { + if (strcmp(reachability_for_data_report_config_any_of, reachability_for_data_report_config_any_ofArray[stringToReturn]) == 0) { + return stringToReturn; + } + stringToReturn++; + } + return 0; +} + diff --git a/lib/sbi/openapi/model/reachability_for_data_report_config_any_of.h b/lib/sbi/openapi/model/reachability_for_data_report_config_any_of.h new file mode 100644 index 000000000..e0bb2903d --- /dev/null +++ b/lib/sbi/openapi/model/reachability_for_data_report_config_any_of.h @@ -0,0 +1,31 @@ +/* + * reachability_for_data_report_config_any_of.h + * + * + */ + +#ifndef _OpenAPI_reachability_for_data_report_config_any_of_H_ +#define _OpenAPI_reachability_for_data_report_config_any_of_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef enum { OpenAPI_reachability_for_data_report_config_any_of_NULL = 0, OpenAPI_reachability_for_data_report_config_any_of_DIRECT_REPORT, OpenAPI_reachability_for_data_report_config_any_of_INDIRECT_REPORT } OpenAPI_reachability_for_data_report_config_any_of_e; + +char* OpenAPI_reachability_for_data_report_config_any_of_ToString(OpenAPI_reachability_for_data_report_config_any_of_e reachability_for_data_report_config_any_of); + +OpenAPI_reachability_for_data_report_config_any_of_e OpenAPI_reachability_for_data_report_config_any_of_FromString(char* reachability_for_data_report_config_any_of); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_reachability_for_data_report_config_any_of_H_ */ + diff --git a/lib/sbi/openapi/model/red_trans_exp_ordering_criterion.c b/lib/sbi/openapi/model/red_trans_exp_ordering_criterion.c new file mode 100644 index 000000000..67bb665b5 --- /dev/null +++ b/lib/sbi/openapi/model/red_trans_exp_ordering_criterion.c @@ -0,0 +1,87 @@ + +#include +#include +#include +#include "red_trans_exp_ordering_criterion.h" + +OpenAPI_red_trans_exp_ordering_criterion_t *OpenAPI_red_trans_exp_ordering_criterion_create( +) +{ + OpenAPI_red_trans_exp_ordering_criterion_t *red_trans_exp_ordering_criterion_local_var = ogs_malloc(sizeof(OpenAPI_red_trans_exp_ordering_criterion_t)); + ogs_assert(red_trans_exp_ordering_criterion_local_var); + + + return red_trans_exp_ordering_criterion_local_var; +} + +void OpenAPI_red_trans_exp_ordering_criterion_free(OpenAPI_red_trans_exp_ordering_criterion_t *red_trans_exp_ordering_criterion) +{ + OpenAPI_lnode_t *node = NULL; + + if (NULL == red_trans_exp_ordering_criterion) { + return; + } + ogs_free(red_trans_exp_ordering_criterion); +} + +cJSON *OpenAPI_red_trans_exp_ordering_criterion_convertToJSON(OpenAPI_red_trans_exp_ordering_criterion_t *red_trans_exp_ordering_criterion) +{ + cJSON *item = NULL; + OpenAPI_lnode_t *node = NULL; + + if (red_trans_exp_ordering_criterion == NULL) { + ogs_error("OpenAPI_red_trans_exp_ordering_criterion_convertToJSON() failed [RedTransExpOrderingCriterion]"); + return NULL; + } + + item = cJSON_CreateObject(); +end: + return item; +} + +OpenAPI_red_trans_exp_ordering_criterion_t *OpenAPI_red_trans_exp_ordering_criterion_parseFromJSON(cJSON *red_trans_exp_ordering_criterionJSON) +{ + OpenAPI_red_trans_exp_ordering_criterion_t *red_trans_exp_ordering_criterion_local_var = NULL; + OpenAPI_lnode_t *node = NULL; + red_trans_exp_ordering_criterion_local_var = OpenAPI_red_trans_exp_ordering_criterion_create ( + ); + + return red_trans_exp_ordering_criterion_local_var; +end: + return NULL; +} + +OpenAPI_red_trans_exp_ordering_criterion_t *OpenAPI_red_trans_exp_ordering_criterion_copy(OpenAPI_red_trans_exp_ordering_criterion_t *dst, OpenAPI_red_trans_exp_ordering_criterion_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_red_trans_exp_ordering_criterion_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_red_trans_exp_ordering_criterion_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_red_trans_exp_ordering_criterion_free(dst); + dst = OpenAPI_red_trans_exp_ordering_criterion_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/red_trans_exp_ordering_criterion.h b/lib/sbi/openapi/model/red_trans_exp_ordering_criterion.h new file mode 100644 index 000000000..e9e5b13d8 --- /dev/null +++ b/lib/sbi/openapi/model/red_trans_exp_ordering_criterion.h @@ -0,0 +1,37 @@ +/* + * red_trans_exp_ordering_criterion.h + * + * Possible values are: - TIME_SLOT_START: Indicates the order of time slot start. - RED_TRANS_EXP: Indicates the order of Redundant Transmission Experience. + */ + +#ifndef _OpenAPI_red_trans_exp_ordering_criterion_H_ +#define _OpenAPI_red_trans_exp_ordering_criterion_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "red_trans_exp_ordering_criterion_any_of.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_red_trans_exp_ordering_criterion_s OpenAPI_red_trans_exp_ordering_criterion_t; +typedef struct OpenAPI_red_trans_exp_ordering_criterion_s { +} OpenAPI_red_trans_exp_ordering_criterion_t; + +OpenAPI_red_trans_exp_ordering_criterion_t *OpenAPI_red_trans_exp_ordering_criterion_create( +); +void OpenAPI_red_trans_exp_ordering_criterion_free(OpenAPI_red_trans_exp_ordering_criterion_t *red_trans_exp_ordering_criterion); +OpenAPI_red_trans_exp_ordering_criterion_t *OpenAPI_red_trans_exp_ordering_criterion_parseFromJSON(cJSON *red_trans_exp_ordering_criterionJSON); +cJSON *OpenAPI_red_trans_exp_ordering_criterion_convertToJSON(OpenAPI_red_trans_exp_ordering_criterion_t *red_trans_exp_ordering_criterion); +OpenAPI_red_trans_exp_ordering_criterion_t *OpenAPI_red_trans_exp_ordering_criterion_copy(OpenAPI_red_trans_exp_ordering_criterion_t *dst, OpenAPI_red_trans_exp_ordering_criterion_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_red_trans_exp_ordering_criterion_H_ */ + diff --git a/lib/sbi/openapi/model/red_trans_exp_ordering_criterion_any_of.c b/lib/sbi/openapi/model/red_trans_exp_ordering_criterion_any_of.c new file mode 100644 index 000000000..602829c4c --- /dev/null +++ b/lib/sbi/openapi/model/red_trans_exp_ordering_criterion_any_of.c @@ -0,0 +1,30 @@ + +#include +#include +#include +#include "red_trans_exp_ordering_criterion_any_of.h" + +char* OpenAPI_red_trans_exp_ordering_criterion_any_of_ToString(OpenAPI_red_trans_exp_ordering_criterion_any_of_e red_trans_exp_ordering_criterion_any_of) +{ + const char *red_trans_exp_ordering_criterion_any_ofArray[] = { "NULL", "TIME_SLOT_START", "RED_TRANS_EXP" }; + size_t sizeofArray = sizeof(red_trans_exp_ordering_criterion_any_ofArray) / sizeof(red_trans_exp_ordering_criterion_any_ofArray[0]); + if (red_trans_exp_ordering_criterion_any_of < sizeofArray) + return (char *)red_trans_exp_ordering_criterion_any_ofArray[red_trans_exp_ordering_criterion_any_of]; + else + return (char *)"Unknown"; +} + +OpenAPI_red_trans_exp_ordering_criterion_any_of_e OpenAPI_red_trans_exp_ordering_criterion_any_of_FromString(char* red_trans_exp_ordering_criterion_any_of) +{ + int stringToReturn = 0; + const char *red_trans_exp_ordering_criterion_any_ofArray[] = { "NULL", "TIME_SLOT_START", "RED_TRANS_EXP" }; + size_t sizeofArray = sizeof(red_trans_exp_ordering_criterion_any_ofArray) / sizeof(red_trans_exp_ordering_criterion_any_ofArray[0]); + while (stringToReturn < sizeofArray) { + if (strcmp(red_trans_exp_ordering_criterion_any_of, red_trans_exp_ordering_criterion_any_ofArray[stringToReturn]) == 0) { + return stringToReturn; + } + stringToReturn++; + } + return 0; +} + diff --git a/lib/sbi/openapi/model/red_trans_exp_ordering_criterion_any_of.h b/lib/sbi/openapi/model/red_trans_exp_ordering_criterion_any_of.h new file mode 100644 index 000000000..637f79a60 --- /dev/null +++ b/lib/sbi/openapi/model/red_trans_exp_ordering_criterion_any_of.h @@ -0,0 +1,31 @@ +/* + * red_trans_exp_ordering_criterion_any_of.h + * + * + */ + +#ifndef _OpenAPI_red_trans_exp_ordering_criterion_any_of_H_ +#define _OpenAPI_red_trans_exp_ordering_criterion_any_of_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef enum { OpenAPI_red_trans_exp_ordering_criterion_any_of_NULL = 0, OpenAPI_red_trans_exp_ordering_criterion_any_of_TIME_SLOT_START, OpenAPI_red_trans_exp_ordering_criterion_any_of_RED_TRANS_EXP } OpenAPI_red_trans_exp_ordering_criterion_any_of_e; + +char* OpenAPI_red_trans_exp_ordering_criterion_any_of_ToString(OpenAPI_red_trans_exp_ordering_criterion_any_of_e red_trans_exp_ordering_criterion_any_of); + +OpenAPI_red_trans_exp_ordering_criterion_any_of_e OpenAPI_red_trans_exp_ordering_criterion_any_of_FromString(char* red_trans_exp_ordering_criterion_any_of); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_red_trans_exp_ordering_criterion_any_of_H_ */ + diff --git a/lib/sbi/openapi/model/redirect_information.h b/lib/sbi/openapi/model/redirect_information.h index 610dd2d47..071b216ca 100644 --- a/lib/sbi/openapi/model/redirect_information.h +++ b/lib/sbi/openapi/model/redirect_information.h @@ -1,7 +1,7 @@ /* * redirect_information.h * - * + * Contains the redirect information. */ #ifndef _OpenAPI_redirect_information_H_ diff --git a/lib/sbi/openapi/model/redirect_response.c b/lib/sbi/openapi/model/redirect_response.c index f5610aec2..3ee4de1db 100644 --- a/lib/sbi/openapi/model/redirect_response.c +++ b/lib/sbi/openapi/model/redirect_response.c @@ -6,7 +6,8 @@ OpenAPI_redirect_response_t *OpenAPI_redirect_response_create( char *cause, - char *target_scp + char *target_scp, + char *target_sepp ) { OpenAPI_redirect_response_t *redirect_response_local_var = ogs_malloc(sizeof(OpenAPI_redirect_response_t)); @@ -14,6 +15,7 @@ OpenAPI_redirect_response_t *OpenAPI_redirect_response_create( redirect_response_local_var->cause = cause; redirect_response_local_var->target_scp = target_scp; + redirect_response_local_var->target_sepp = target_sepp; return redirect_response_local_var; } @@ -33,6 +35,10 @@ void OpenAPI_redirect_response_free(OpenAPI_redirect_response_t *redirect_respon ogs_free(redirect_response->target_scp); redirect_response->target_scp = NULL; } + if (redirect_response->target_sepp) { + ogs_free(redirect_response->target_sepp); + redirect_response->target_sepp = NULL; + } ogs_free(redirect_response); } @@ -61,6 +67,13 @@ cJSON *OpenAPI_redirect_response_convertToJSON(OpenAPI_redirect_response_t *redi } } + if (redirect_response->target_sepp) { + if (cJSON_AddStringToObject(item, "targetSepp", redirect_response->target_sepp) == NULL) { + ogs_error("OpenAPI_redirect_response_convertToJSON() failed [target_sepp]"); + goto end; + } + } + end: return item; } @@ -71,6 +84,7 @@ OpenAPI_redirect_response_t *OpenAPI_redirect_response_parseFromJSON(cJSON *redi OpenAPI_lnode_t *node = NULL; cJSON *cause = NULL; cJSON *target_scp = NULL; + cJSON *target_sepp = NULL; cause = cJSON_GetObjectItemCaseSensitive(redirect_responseJSON, "cause"); if (cause) { if (!cJSON_IsString(cause) && !cJSON_IsNull(cause)) { @@ -87,9 +101,18 @@ OpenAPI_redirect_response_t *OpenAPI_redirect_response_parseFromJSON(cJSON *redi } } + target_sepp = cJSON_GetObjectItemCaseSensitive(redirect_responseJSON, "targetSepp"); + if (target_sepp) { + if (!cJSON_IsString(target_sepp) && !cJSON_IsNull(target_sepp)) { + ogs_error("OpenAPI_redirect_response_parseFromJSON() failed [target_sepp]"); + goto end; + } + } + redirect_response_local_var = OpenAPI_redirect_response_create ( cause && !cJSON_IsNull(cause) ? ogs_strdup(cause->valuestring) : NULL, - target_scp && !cJSON_IsNull(target_scp) ? ogs_strdup(target_scp->valuestring) : NULL + target_scp && !cJSON_IsNull(target_scp) ? ogs_strdup(target_scp->valuestring) : NULL, + target_sepp && !cJSON_IsNull(target_sepp) ? ogs_strdup(target_sepp->valuestring) : NULL ); return redirect_response_local_var; diff --git a/lib/sbi/openapi/model/redirect_response.h b/lib/sbi/openapi/model/redirect_response.h index efb164d43..fba1d8380 100644 --- a/lib/sbi/openapi/model/redirect_response.h +++ b/lib/sbi/openapi/model/redirect_response.h @@ -1,7 +1,7 @@ /* * redirect_response.h * - * + * The response shall include a Location header field containing a different URI (pointing to a different URI of an other service instance), or the same URI if a request is redirected to the same target resource via a different SCP. */ #ifndef _OpenAPI_redirect_response_H_ @@ -21,11 +21,13 @@ typedef struct OpenAPI_redirect_response_s OpenAPI_redirect_response_t; typedef struct OpenAPI_redirect_response_s { char *cause; char *target_scp; + char *target_sepp; } OpenAPI_redirect_response_t; OpenAPI_redirect_response_t *OpenAPI_redirect_response_create( char *cause, - char *target_scp + char *target_scp, + char *target_sepp ); void OpenAPI_redirect_response_free(OpenAPI_redirect_response_t *redirect_response); OpenAPI_redirect_response_t *OpenAPI_redirect_response_parseFromJSON(cJSON *redirect_responseJSON); diff --git a/lib/sbi/openapi/model/redundant_pdu_session_information.c b/lib/sbi/openapi/model/redundant_pdu_session_information.c index dd028da38..2cf125a42 100644 --- a/lib/sbi/openapi/model/redundant_pdu_session_information.c +++ b/lib/sbi/openapi/model/redundant_pdu_session_information.c @@ -5,13 +5,17 @@ #include "redundant_pdu_session_information.h" OpenAPI_redundant_pdu_session_information_t *OpenAPI_redundant_pdu_session_information_create( - OpenAPI_rsn_e rsn + OpenAPI_rsn_e rsn, + bool is_pdu_session_pair_id, + int pdu_session_pair_id ) { OpenAPI_redundant_pdu_session_information_t *redundant_pdu_session_information_local_var = ogs_malloc(sizeof(OpenAPI_redundant_pdu_session_information_t)); ogs_assert(redundant_pdu_session_information_local_var); redundant_pdu_session_information_local_var->rsn = rsn; + redundant_pdu_session_information_local_var->is_pdu_session_pair_id = is_pdu_session_pair_id; + redundant_pdu_session_information_local_var->pdu_session_pair_id = pdu_session_pair_id; return redundant_pdu_session_information_local_var; } @@ -46,6 +50,13 @@ cJSON *OpenAPI_redundant_pdu_session_information_convertToJSON(OpenAPI_redundant goto end; } + if (redundant_pdu_session_information->is_pdu_session_pair_id) { + if (cJSON_AddNumberToObject(item, "pduSessionPairId", redundant_pdu_session_information->pdu_session_pair_id) == NULL) { + ogs_error("OpenAPI_redundant_pdu_session_information_convertToJSON() failed [pdu_session_pair_id]"); + goto end; + } + } + end: return item; } @@ -56,6 +67,7 @@ OpenAPI_redundant_pdu_session_information_t *OpenAPI_redundant_pdu_session_infor OpenAPI_lnode_t *node = NULL; cJSON *rsn = NULL; OpenAPI_rsn_e rsnVariable = 0; + cJSON *pdu_session_pair_id = NULL; rsn = cJSON_GetObjectItemCaseSensitive(redundant_pdu_session_informationJSON, "rsn"); if (!rsn) { ogs_error("OpenAPI_redundant_pdu_session_information_parseFromJSON() failed [rsn]"); @@ -67,8 +79,18 @@ OpenAPI_redundant_pdu_session_information_t *OpenAPI_redundant_pdu_session_infor } rsnVariable = OpenAPI_rsn_FromString(rsn->valuestring); + pdu_session_pair_id = cJSON_GetObjectItemCaseSensitive(redundant_pdu_session_informationJSON, "pduSessionPairId"); + if (pdu_session_pair_id) { + if (!cJSON_IsNumber(pdu_session_pair_id)) { + ogs_error("OpenAPI_redundant_pdu_session_information_parseFromJSON() failed [pdu_session_pair_id]"); + goto end; + } + } + redundant_pdu_session_information_local_var = OpenAPI_redundant_pdu_session_information_create ( - rsnVariable + rsnVariable, + pdu_session_pair_id ? true : false, + pdu_session_pair_id ? pdu_session_pair_id->valuedouble : 0 ); return redundant_pdu_session_information_local_var; diff --git a/lib/sbi/openapi/model/redundant_pdu_session_information.h b/lib/sbi/openapi/model/redundant_pdu_session_information.h index ac6e35114..4077834dc 100644 --- a/lib/sbi/openapi/model/redundant_pdu_session_information.h +++ b/lib/sbi/openapi/model/redundant_pdu_session_information.h @@ -21,10 +21,14 @@ extern "C" { typedef struct OpenAPI_redundant_pdu_session_information_s OpenAPI_redundant_pdu_session_information_t; typedef struct OpenAPI_redundant_pdu_session_information_s { OpenAPI_rsn_e rsn; + bool is_pdu_session_pair_id; + int pdu_session_pair_id; } OpenAPI_redundant_pdu_session_information_t; OpenAPI_redundant_pdu_session_information_t *OpenAPI_redundant_pdu_session_information_create( - OpenAPI_rsn_e rsn + OpenAPI_rsn_e rsn, + bool is_pdu_session_pair_id, + int pdu_session_pair_id ); void OpenAPI_redundant_pdu_session_information_free(OpenAPI_redundant_pdu_session_information_t *redundant_pdu_session_information); OpenAPI_redundant_pdu_session_information_t *OpenAPI_redundant_pdu_session_information_parseFromJSON(cJSON *redundant_pdu_session_informationJSON); diff --git a/lib/sbi/openapi/model/redundant_transmission_exp_info.c b/lib/sbi/openapi/model/redundant_transmission_exp_info.c new file mode 100644 index 000000000..7aad2a5a8 --- /dev/null +++ b/lib/sbi/openapi/model/redundant_transmission_exp_info.c @@ -0,0 +1,205 @@ + +#include +#include +#include +#include "redundant_transmission_exp_info.h" + +OpenAPI_redundant_transmission_exp_info_t *OpenAPI_redundant_transmission_exp_info_create( + OpenAPI_network_area_info_t *spatial_valid_con, + char *dnn, + OpenAPI_list_t *red_trans_exps +) +{ + OpenAPI_redundant_transmission_exp_info_t *redundant_transmission_exp_info_local_var = ogs_malloc(sizeof(OpenAPI_redundant_transmission_exp_info_t)); + ogs_assert(redundant_transmission_exp_info_local_var); + + redundant_transmission_exp_info_local_var->spatial_valid_con = spatial_valid_con; + redundant_transmission_exp_info_local_var->dnn = dnn; + redundant_transmission_exp_info_local_var->red_trans_exps = red_trans_exps; + + return redundant_transmission_exp_info_local_var; +} + +void OpenAPI_redundant_transmission_exp_info_free(OpenAPI_redundant_transmission_exp_info_t *redundant_transmission_exp_info) +{ + OpenAPI_lnode_t *node = NULL; + + if (NULL == redundant_transmission_exp_info) { + return; + } + if (redundant_transmission_exp_info->spatial_valid_con) { + OpenAPI_network_area_info_free(redundant_transmission_exp_info->spatial_valid_con); + redundant_transmission_exp_info->spatial_valid_con = NULL; + } + if (redundant_transmission_exp_info->dnn) { + ogs_free(redundant_transmission_exp_info->dnn); + redundant_transmission_exp_info->dnn = NULL; + } + if (redundant_transmission_exp_info->red_trans_exps) { + OpenAPI_list_for_each(redundant_transmission_exp_info->red_trans_exps, node) { + OpenAPI_redundant_transmission_exp_per_ts_free(node->data); + } + OpenAPI_list_free(redundant_transmission_exp_info->red_trans_exps); + redundant_transmission_exp_info->red_trans_exps = NULL; + } + ogs_free(redundant_transmission_exp_info); +} + +cJSON *OpenAPI_redundant_transmission_exp_info_convertToJSON(OpenAPI_redundant_transmission_exp_info_t *redundant_transmission_exp_info) +{ + cJSON *item = NULL; + OpenAPI_lnode_t *node = NULL; + + if (redundant_transmission_exp_info == NULL) { + ogs_error("OpenAPI_redundant_transmission_exp_info_convertToJSON() failed [RedundantTransmissionExpInfo]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (redundant_transmission_exp_info->spatial_valid_con) { + cJSON *spatial_valid_con_local_JSON = OpenAPI_network_area_info_convertToJSON(redundant_transmission_exp_info->spatial_valid_con); + if (spatial_valid_con_local_JSON == NULL) { + ogs_error("OpenAPI_redundant_transmission_exp_info_convertToJSON() failed [spatial_valid_con]"); + goto end; + } + cJSON_AddItemToObject(item, "spatialValidCon", spatial_valid_con_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_redundant_transmission_exp_info_convertToJSON() failed [spatial_valid_con]"); + goto end; + } + } + + if (redundant_transmission_exp_info->dnn) { + if (cJSON_AddStringToObject(item, "dnn", redundant_transmission_exp_info->dnn) == NULL) { + ogs_error("OpenAPI_redundant_transmission_exp_info_convertToJSON() failed [dnn]"); + goto end; + } + } + + if (!redundant_transmission_exp_info->red_trans_exps) { + ogs_error("OpenAPI_redundant_transmission_exp_info_convertToJSON() failed [red_trans_exps]"); + return NULL; + } + cJSON *red_trans_expsList = cJSON_AddArrayToObject(item, "redTransExps"); + if (red_trans_expsList == NULL) { + ogs_error("OpenAPI_redundant_transmission_exp_info_convertToJSON() failed [red_trans_exps]"); + goto end; + } + OpenAPI_list_for_each(redundant_transmission_exp_info->red_trans_exps, node) { + cJSON *itemLocal = OpenAPI_redundant_transmission_exp_per_ts_convertToJSON(node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_redundant_transmission_exp_info_convertToJSON() failed [red_trans_exps]"); + goto end; + } + cJSON_AddItemToArray(red_trans_expsList, itemLocal); + } + +end: + return item; +} + +OpenAPI_redundant_transmission_exp_info_t *OpenAPI_redundant_transmission_exp_info_parseFromJSON(cJSON *redundant_transmission_exp_infoJSON) +{ + OpenAPI_redundant_transmission_exp_info_t *redundant_transmission_exp_info_local_var = NULL; + OpenAPI_lnode_t *node = NULL; + cJSON *spatial_valid_con = NULL; + OpenAPI_network_area_info_t *spatial_valid_con_local_nonprim = NULL; + cJSON *dnn = NULL; + cJSON *red_trans_exps = NULL; + OpenAPI_list_t *red_trans_expsList = NULL; + spatial_valid_con = cJSON_GetObjectItemCaseSensitive(redundant_transmission_exp_infoJSON, "spatialValidCon"); + if (spatial_valid_con) { + spatial_valid_con_local_nonprim = OpenAPI_network_area_info_parseFromJSON(spatial_valid_con); + } + + dnn = cJSON_GetObjectItemCaseSensitive(redundant_transmission_exp_infoJSON, "dnn"); + if (dnn) { + if (!cJSON_IsString(dnn) && !cJSON_IsNull(dnn)) { + ogs_error("OpenAPI_redundant_transmission_exp_info_parseFromJSON() failed [dnn]"); + goto end; + } + } + + red_trans_exps = cJSON_GetObjectItemCaseSensitive(redundant_transmission_exp_infoJSON, "redTransExps"); + if (!red_trans_exps) { + ogs_error("OpenAPI_redundant_transmission_exp_info_parseFromJSON() failed [red_trans_exps]"); + goto end; + } + cJSON *red_trans_exps_local = NULL; + if (!cJSON_IsArray(red_trans_exps)) { + ogs_error("OpenAPI_redundant_transmission_exp_info_parseFromJSON() failed [red_trans_exps]"); + goto end; + } + + red_trans_expsList = OpenAPI_list_create(); + + cJSON_ArrayForEach(red_trans_exps_local, red_trans_exps) { + if (!cJSON_IsObject(red_trans_exps_local)) { + ogs_error("OpenAPI_redundant_transmission_exp_info_parseFromJSON() failed [red_trans_exps]"); + goto end; + } + OpenAPI_redundant_transmission_exp_per_ts_t *red_trans_expsItem = OpenAPI_redundant_transmission_exp_per_ts_parseFromJSON(red_trans_exps_local); + if (!red_trans_expsItem) { + ogs_error("No red_trans_expsItem"); + OpenAPI_list_free(red_trans_expsList); + goto end; + } + OpenAPI_list_add(red_trans_expsList, red_trans_expsItem); + } + + redundant_transmission_exp_info_local_var = OpenAPI_redundant_transmission_exp_info_create ( + spatial_valid_con ? spatial_valid_con_local_nonprim : NULL, + dnn && !cJSON_IsNull(dnn) ? ogs_strdup(dnn->valuestring) : NULL, + red_trans_expsList + ); + + return redundant_transmission_exp_info_local_var; +end: + if (spatial_valid_con_local_nonprim) { + OpenAPI_network_area_info_free(spatial_valid_con_local_nonprim); + spatial_valid_con_local_nonprim = NULL; + } + if (red_trans_expsList) { + OpenAPI_list_for_each(red_trans_expsList, node) { + OpenAPI_redundant_transmission_exp_per_ts_free(node->data); + } + OpenAPI_list_free(red_trans_expsList); + red_trans_expsList = NULL; + } + return NULL; +} + +OpenAPI_redundant_transmission_exp_info_t *OpenAPI_redundant_transmission_exp_info_copy(OpenAPI_redundant_transmission_exp_info_t *dst, OpenAPI_redundant_transmission_exp_info_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_redundant_transmission_exp_info_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_redundant_transmission_exp_info_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_redundant_transmission_exp_info_free(dst); + dst = OpenAPI_redundant_transmission_exp_info_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/redundant_transmission_exp_info.h b/lib/sbi/openapi/model/redundant_transmission_exp_info.h new file mode 100644 index 000000000..68a136220 --- /dev/null +++ b/lib/sbi/openapi/model/redundant_transmission_exp_info.h @@ -0,0 +1,44 @@ +/* + * redundant_transmission_exp_info.h + * + * The redundant transmission experience related information. When subscribed event is \"RED_TRANS_EXP\", the \"redTransInfos\" attribute shall be included. + */ + +#ifndef _OpenAPI_redundant_transmission_exp_info_H_ +#define _OpenAPI_redundant_transmission_exp_info_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "network_area_info.h" +#include "redundant_transmission_exp_per_ts.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_redundant_transmission_exp_info_s OpenAPI_redundant_transmission_exp_info_t; +typedef struct OpenAPI_redundant_transmission_exp_info_s { + struct OpenAPI_network_area_info_s *spatial_valid_con; + char *dnn; + OpenAPI_list_t *red_trans_exps; +} OpenAPI_redundant_transmission_exp_info_t; + +OpenAPI_redundant_transmission_exp_info_t *OpenAPI_redundant_transmission_exp_info_create( + OpenAPI_network_area_info_t *spatial_valid_con, + char *dnn, + OpenAPI_list_t *red_trans_exps +); +void OpenAPI_redundant_transmission_exp_info_free(OpenAPI_redundant_transmission_exp_info_t *redundant_transmission_exp_info); +OpenAPI_redundant_transmission_exp_info_t *OpenAPI_redundant_transmission_exp_info_parseFromJSON(cJSON *redundant_transmission_exp_infoJSON); +cJSON *OpenAPI_redundant_transmission_exp_info_convertToJSON(OpenAPI_redundant_transmission_exp_info_t *redundant_transmission_exp_info); +OpenAPI_redundant_transmission_exp_info_t *OpenAPI_redundant_transmission_exp_info_copy(OpenAPI_redundant_transmission_exp_info_t *dst, OpenAPI_redundant_transmission_exp_info_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_redundant_transmission_exp_info_H_ */ + diff --git a/lib/sbi/openapi/model/redundant_transmission_exp_per_ts.c b/lib/sbi/openapi/model/redundant_transmission_exp_per_ts.c new file mode 100644 index 000000000..5fd3ec49d --- /dev/null +++ b/lib/sbi/openapi/model/redundant_transmission_exp_per_ts.c @@ -0,0 +1,235 @@ + +#include +#include +#include +#include "redundant_transmission_exp_per_ts.h" + +OpenAPI_redundant_transmission_exp_per_ts_t *OpenAPI_redundant_transmission_exp_per_ts_create( + char *ts_start, + int ts_duration, + OpenAPI_observed_redundant_trans_exp_t *obsv_red_trans_exp, + bool is_red_trans_status, + int red_trans_status, + bool is_ue_ratio, + int ue_ratio, + bool is_confidence, + int confidence +) +{ + OpenAPI_redundant_transmission_exp_per_ts_t *redundant_transmission_exp_per_ts_local_var = ogs_malloc(sizeof(OpenAPI_redundant_transmission_exp_per_ts_t)); + ogs_assert(redundant_transmission_exp_per_ts_local_var); + + redundant_transmission_exp_per_ts_local_var->ts_start = ts_start; + redundant_transmission_exp_per_ts_local_var->ts_duration = ts_duration; + redundant_transmission_exp_per_ts_local_var->obsv_red_trans_exp = obsv_red_trans_exp; + redundant_transmission_exp_per_ts_local_var->is_red_trans_status = is_red_trans_status; + redundant_transmission_exp_per_ts_local_var->red_trans_status = red_trans_status; + redundant_transmission_exp_per_ts_local_var->is_ue_ratio = is_ue_ratio; + redundant_transmission_exp_per_ts_local_var->ue_ratio = ue_ratio; + redundant_transmission_exp_per_ts_local_var->is_confidence = is_confidence; + redundant_transmission_exp_per_ts_local_var->confidence = confidence; + + return redundant_transmission_exp_per_ts_local_var; +} + +void OpenAPI_redundant_transmission_exp_per_ts_free(OpenAPI_redundant_transmission_exp_per_ts_t *redundant_transmission_exp_per_ts) +{ + OpenAPI_lnode_t *node = NULL; + + if (NULL == redundant_transmission_exp_per_ts) { + return; + } + if (redundant_transmission_exp_per_ts->ts_start) { + ogs_free(redundant_transmission_exp_per_ts->ts_start); + redundant_transmission_exp_per_ts->ts_start = NULL; + } + if (redundant_transmission_exp_per_ts->obsv_red_trans_exp) { + OpenAPI_observed_redundant_trans_exp_free(redundant_transmission_exp_per_ts->obsv_red_trans_exp); + redundant_transmission_exp_per_ts->obsv_red_trans_exp = NULL; + } + ogs_free(redundant_transmission_exp_per_ts); +} + +cJSON *OpenAPI_redundant_transmission_exp_per_ts_convertToJSON(OpenAPI_redundant_transmission_exp_per_ts_t *redundant_transmission_exp_per_ts) +{ + cJSON *item = NULL; + OpenAPI_lnode_t *node = NULL; + + if (redundant_transmission_exp_per_ts == NULL) { + ogs_error("OpenAPI_redundant_transmission_exp_per_ts_convertToJSON() failed [RedundantTransmissionExpPerTS]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (!redundant_transmission_exp_per_ts->ts_start) { + ogs_error("OpenAPI_redundant_transmission_exp_per_ts_convertToJSON() failed [ts_start]"); + return NULL; + } + if (cJSON_AddStringToObject(item, "tsStart", redundant_transmission_exp_per_ts->ts_start) == NULL) { + ogs_error("OpenAPI_redundant_transmission_exp_per_ts_convertToJSON() failed [ts_start]"); + goto end; + } + + if (cJSON_AddNumberToObject(item, "tsDuration", redundant_transmission_exp_per_ts->ts_duration) == NULL) { + ogs_error("OpenAPI_redundant_transmission_exp_per_ts_convertToJSON() failed [ts_duration]"); + goto end; + } + + if (!redundant_transmission_exp_per_ts->obsv_red_trans_exp) { + ogs_error("OpenAPI_redundant_transmission_exp_per_ts_convertToJSON() failed [obsv_red_trans_exp]"); + return NULL; + } + cJSON *obsv_red_trans_exp_local_JSON = OpenAPI_observed_redundant_trans_exp_convertToJSON(redundant_transmission_exp_per_ts->obsv_red_trans_exp); + if (obsv_red_trans_exp_local_JSON == NULL) { + ogs_error("OpenAPI_redundant_transmission_exp_per_ts_convertToJSON() failed [obsv_red_trans_exp]"); + goto end; + } + cJSON_AddItemToObject(item, "obsvRedTransExp", obsv_red_trans_exp_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_redundant_transmission_exp_per_ts_convertToJSON() failed [obsv_red_trans_exp]"); + goto end; + } + + if (redundant_transmission_exp_per_ts->is_red_trans_status) { + if (cJSON_AddBoolToObject(item, "redTransStatus", redundant_transmission_exp_per_ts->red_trans_status) == NULL) { + ogs_error("OpenAPI_redundant_transmission_exp_per_ts_convertToJSON() failed [red_trans_status]"); + goto end; + } + } + + if (redundant_transmission_exp_per_ts->is_ue_ratio) { + if (cJSON_AddNumberToObject(item, "ueRatio", redundant_transmission_exp_per_ts->ue_ratio) == NULL) { + ogs_error("OpenAPI_redundant_transmission_exp_per_ts_convertToJSON() failed [ue_ratio]"); + goto end; + } + } + + if (redundant_transmission_exp_per_ts->is_confidence) { + if (cJSON_AddNumberToObject(item, "confidence", redundant_transmission_exp_per_ts->confidence) == NULL) { + ogs_error("OpenAPI_redundant_transmission_exp_per_ts_convertToJSON() failed [confidence]"); + goto end; + } + } + +end: + return item; +} + +OpenAPI_redundant_transmission_exp_per_ts_t *OpenAPI_redundant_transmission_exp_per_ts_parseFromJSON(cJSON *redundant_transmission_exp_per_tsJSON) +{ + OpenAPI_redundant_transmission_exp_per_ts_t *redundant_transmission_exp_per_ts_local_var = NULL; + OpenAPI_lnode_t *node = NULL; + cJSON *ts_start = NULL; + cJSON *ts_duration = NULL; + cJSON *obsv_red_trans_exp = NULL; + OpenAPI_observed_redundant_trans_exp_t *obsv_red_trans_exp_local_nonprim = NULL; + cJSON *red_trans_status = NULL; + cJSON *ue_ratio = NULL; + cJSON *confidence = NULL; + ts_start = cJSON_GetObjectItemCaseSensitive(redundant_transmission_exp_per_tsJSON, "tsStart"); + if (!ts_start) { + ogs_error("OpenAPI_redundant_transmission_exp_per_ts_parseFromJSON() failed [ts_start]"); + goto end; + } + if (!cJSON_IsString(ts_start) && !cJSON_IsNull(ts_start)) { + ogs_error("OpenAPI_redundant_transmission_exp_per_ts_parseFromJSON() failed [ts_start]"); + goto end; + } + + ts_duration = cJSON_GetObjectItemCaseSensitive(redundant_transmission_exp_per_tsJSON, "tsDuration"); + if (!ts_duration) { + ogs_error("OpenAPI_redundant_transmission_exp_per_ts_parseFromJSON() failed [ts_duration]"); + goto end; + } + if (!cJSON_IsNumber(ts_duration)) { + ogs_error("OpenAPI_redundant_transmission_exp_per_ts_parseFromJSON() failed [ts_duration]"); + goto end; + } + + obsv_red_trans_exp = cJSON_GetObjectItemCaseSensitive(redundant_transmission_exp_per_tsJSON, "obsvRedTransExp"); + if (!obsv_red_trans_exp) { + ogs_error("OpenAPI_redundant_transmission_exp_per_ts_parseFromJSON() failed [obsv_red_trans_exp]"); + goto end; + } + obsv_red_trans_exp_local_nonprim = OpenAPI_observed_redundant_trans_exp_parseFromJSON(obsv_red_trans_exp); + + red_trans_status = cJSON_GetObjectItemCaseSensitive(redundant_transmission_exp_per_tsJSON, "redTransStatus"); + if (red_trans_status) { + if (!cJSON_IsBool(red_trans_status)) { + ogs_error("OpenAPI_redundant_transmission_exp_per_ts_parseFromJSON() failed [red_trans_status]"); + goto end; + } + } + + ue_ratio = cJSON_GetObjectItemCaseSensitive(redundant_transmission_exp_per_tsJSON, "ueRatio"); + if (ue_ratio) { + if (!cJSON_IsNumber(ue_ratio)) { + ogs_error("OpenAPI_redundant_transmission_exp_per_ts_parseFromJSON() failed [ue_ratio]"); + goto end; + } + } + + confidence = cJSON_GetObjectItemCaseSensitive(redundant_transmission_exp_per_tsJSON, "confidence"); + if (confidence) { + if (!cJSON_IsNumber(confidence)) { + ogs_error("OpenAPI_redundant_transmission_exp_per_ts_parseFromJSON() failed [confidence]"); + goto end; + } + } + + redundant_transmission_exp_per_ts_local_var = OpenAPI_redundant_transmission_exp_per_ts_create ( + ogs_strdup(ts_start->valuestring), + + ts_duration->valuedouble, + obsv_red_trans_exp_local_nonprim, + red_trans_status ? true : false, + red_trans_status ? red_trans_status->valueint : 0, + ue_ratio ? true : false, + ue_ratio ? ue_ratio->valuedouble : 0, + confidence ? true : false, + confidence ? confidence->valuedouble : 0 + ); + + return redundant_transmission_exp_per_ts_local_var; +end: + if (obsv_red_trans_exp_local_nonprim) { + OpenAPI_observed_redundant_trans_exp_free(obsv_red_trans_exp_local_nonprim); + obsv_red_trans_exp_local_nonprim = NULL; + } + return NULL; +} + +OpenAPI_redundant_transmission_exp_per_ts_t *OpenAPI_redundant_transmission_exp_per_ts_copy(OpenAPI_redundant_transmission_exp_per_ts_t *dst, OpenAPI_redundant_transmission_exp_per_ts_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_redundant_transmission_exp_per_ts_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_redundant_transmission_exp_per_ts_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_redundant_transmission_exp_per_ts_free(dst); + dst = OpenAPI_redundant_transmission_exp_per_ts_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/redundant_transmission_exp_per_ts.h b/lib/sbi/openapi/model/redundant_transmission_exp_per_ts.h new file mode 100644 index 000000000..653e16158 --- /dev/null +++ b/lib/sbi/openapi/model/redundant_transmission_exp_per_ts.h @@ -0,0 +1,55 @@ +/* + * redundant_transmission_exp_per_ts.h + * + * The redundant transmission experience per Time Slot. + */ + +#ifndef _OpenAPI_redundant_transmission_exp_per_ts_H_ +#define _OpenAPI_redundant_transmission_exp_per_ts_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "observed_redundant_trans_exp.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_redundant_transmission_exp_per_ts_s OpenAPI_redundant_transmission_exp_per_ts_t; +typedef struct OpenAPI_redundant_transmission_exp_per_ts_s { + char *ts_start; + int ts_duration; + struct OpenAPI_observed_redundant_trans_exp_s *obsv_red_trans_exp; + bool is_red_trans_status; + int red_trans_status; + bool is_ue_ratio; + int ue_ratio; + bool is_confidence; + int confidence; +} OpenAPI_redundant_transmission_exp_per_ts_t; + +OpenAPI_redundant_transmission_exp_per_ts_t *OpenAPI_redundant_transmission_exp_per_ts_create( + char *ts_start, + int ts_duration, + OpenAPI_observed_redundant_trans_exp_t *obsv_red_trans_exp, + bool is_red_trans_status, + int red_trans_status, + bool is_ue_ratio, + int ue_ratio, + bool is_confidence, + int confidence +); +void OpenAPI_redundant_transmission_exp_per_ts_free(OpenAPI_redundant_transmission_exp_per_ts_t *redundant_transmission_exp_per_ts); +OpenAPI_redundant_transmission_exp_per_ts_t *OpenAPI_redundant_transmission_exp_per_ts_parseFromJSON(cJSON *redundant_transmission_exp_per_tsJSON); +cJSON *OpenAPI_redundant_transmission_exp_per_ts_convertToJSON(OpenAPI_redundant_transmission_exp_per_ts_t *redundant_transmission_exp_per_ts); +OpenAPI_redundant_transmission_exp_per_ts_t *OpenAPI_redundant_transmission_exp_per_ts_copy(OpenAPI_redundant_transmission_exp_per_ts_t *dst, OpenAPI_redundant_transmission_exp_per_ts_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_redundant_transmission_exp_per_ts_H_ */ + diff --git a/lib/sbi/openapi/model/redundant_transmission_exp_req.c b/lib/sbi/openapi/model/redundant_transmission_exp_req.c new file mode 100644 index 000000000..705a1e11b --- /dev/null +++ b/lib/sbi/openapi/model/redundant_transmission_exp_req.c @@ -0,0 +1,149 @@ + +#include +#include +#include +#include "redundant_transmission_exp_req.h" + +OpenAPI_redundant_transmission_exp_req_t *OpenAPI_redundant_transmission_exp_req_create( + OpenAPI_red_trans_exp_ordering_criterion_t *red_t_order_criter, + OpenAPI_matching_direction_t *order +) +{ + OpenAPI_redundant_transmission_exp_req_t *redundant_transmission_exp_req_local_var = ogs_malloc(sizeof(OpenAPI_redundant_transmission_exp_req_t)); + ogs_assert(redundant_transmission_exp_req_local_var); + + redundant_transmission_exp_req_local_var->red_t_order_criter = red_t_order_criter; + redundant_transmission_exp_req_local_var->order = order; + + return redundant_transmission_exp_req_local_var; +} + +void OpenAPI_redundant_transmission_exp_req_free(OpenAPI_redundant_transmission_exp_req_t *redundant_transmission_exp_req) +{ + OpenAPI_lnode_t *node = NULL; + + if (NULL == redundant_transmission_exp_req) { + return; + } + if (redundant_transmission_exp_req->red_t_order_criter) { + OpenAPI_red_trans_exp_ordering_criterion_free(redundant_transmission_exp_req->red_t_order_criter); + redundant_transmission_exp_req->red_t_order_criter = NULL; + } + if (redundant_transmission_exp_req->order) { + OpenAPI_matching_direction_free(redundant_transmission_exp_req->order); + redundant_transmission_exp_req->order = NULL; + } + ogs_free(redundant_transmission_exp_req); +} + +cJSON *OpenAPI_redundant_transmission_exp_req_convertToJSON(OpenAPI_redundant_transmission_exp_req_t *redundant_transmission_exp_req) +{ + cJSON *item = NULL; + OpenAPI_lnode_t *node = NULL; + + if (redundant_transmission_exp_req == NULL) { + ogs_error("OpenAPI_redundant_transmission_exp_req_convertToJSON() failed [RedundantTransmissionExpReq]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (redundant_transmission_exp_req->red_t_order_criter) { + cJSON *red_t_order_criter_local_JSON = OpenAPI_red_trans_exp_ordering_criterion_convertToJSON(redundant_transmission_exp_req->red_t_order_criter); + if (red_t_order_criter_local_JSON == NULL) { + ogs_error("OpenAPI_redundant_transmission_exp_req_convertToJSON() failed [red_t_order_criter]"); + goto end; + } + cJSON_AddItemToObject(item, "redTOrderCriter", red_t_order_criter_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_redundant_transmission_exp_req_convertToJSON() failed [red_t_order_criter]"); + goto end; + } + } + + if (redundant_transmission_exp_req->order) { + cJSON *order_local_JSON = OpenAPI_matching_direction_convertToJSON(redundant_transmission_exp_req->order); + if (order_local_JSON == NULL) { + ogs_error("OpenAPI_redundant_transmission_exp_req_convertToJSON() failed [order]"); + goto end; + } + cJSON_AddItemToObject(item, "order", order_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_redundant_transmission_exp_req_convertToJSON() failed [order]"); + goto end; + } + } + +end: + return item; +} + +OpenAPI_redundant_transmission_exp_req_t *OpenAPI_redundant_transmission_exp_req_parseFromJSON(cJSON *redundant_transmission_exp_reqJSON) +{ + OpenAPI_redundant_transmission_exp_req_t *redundant_transmission_exp_req_local_var = NULL; + OpenAPI_lnode_t *node = NULL; + cJSON *red_t_order_criter = NULL; + OpenAPI_red_trans_exp_ordering_criterion_t *red_t_order_criter_local_nonprim = NULL; + cJSON *order = NULL; + OpenAPI_matching_direction_t *order_local_nonprim = NULL; + red_t_order_criter = cJSON_GetObjectItemCaseSensitive(redundant_transmission_exp_reqJSON, "redTOrderCriter"); + if (red_t_order_criter) { + red_t_order_criter_local_nonprim = OpenAPI_red_trans_exp_ordering_criterion_parseFromJSON(red_t_order_criter); + } + + order = cJSON_GetObjectItemCaseSensitive(redundant_transmission_exp_reqJSON, "order"); + if (order) { + order_local_nonprim = OpenAPI_matching_direction_parseFromJSON(order); + } + + redundant_transmission_exp_req_local_var = OpenAPI_redundant_transmission_exp_req_create ( + red_t_order_criter ? red_t_order_criter_local_nonprim : NULL, + order ? order_local_nonprim : NULL + ); + + return redundant_transmission_exp_req_local_var; +end: + if (red_t_order_criter_local_nonprim) { + OpenAPI_red_trans_exp_ordering_criterion_free(red_t_order_criter_local_nonprim); + red_t_order_criter_local_nonprim = NULL; + } + if (order_local_nonprim) { + OpenAPI_matching_direction_free(order_local_nonprim); + order_local_nonprim = NULL; + } + return NULL; +} + +OpenAPI_redundant_transmission_exp_req_t *OpenAPI_redundant_transmission_exp_req_copy(OpenAPI_redundant_transmission_exp_req_t *dst, OpenAPI_redundant_transmission_exp_req_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_redundant_transmission_exp_req_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_redundant_transmission_exp_req_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_redundant_transmission_exp_req_free(dst); + dst = OpenAPI_redundant_transmission_exp_req_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/redundant_transmission_exp_req.h b/lib/sbi/openapi/model/redundant_transmission_exp_req.h new file mode 100644 index 000000000..5bb74be59 --- /dev/null +++ b/lib/sbi/openapi/model/redundant_transmission_exp_req.h @@ -0,0 +1,42 @@ +/* + * redundant_transmission_exp_req.h + * + * Represents other redundant transmission experience analytics requirements. + */ + +#ifndef _OpenAPI_redundant_transmission_exp_req_H_ +#define _OpenAPI_redundant_transmission_exp_req_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "matching_direction.h" +#include "red_trans_exp_ordering_criterion.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_redundant_transmission_exp_req_s OpenAPI_redundant_transmission_exp_req_t; +typedef struct OpenAPI_redundant_transmission_exp_req_s { + struct OpenAPI_red_trans_exp_ordering_criterion_s *red_t_order_criter; + struct OpenAPI_matching_direction_s *order; +} OpenAPI_redundant_transmission_exp_req_t; + +OpenAPI_redundant_transmission_exp_req_t *OpenAPI_redundant_transmission_exp_req_create( + OpenAPI_red_trans_exp_ordering_criterion_t *red_t_order_criter, + OpenAPI_matching_direction_t *order +); +void OpenAPI_redundant_transmission_exp_req_free(OpenAPI_redundant_transmission_exp_req_t *redundant_transmission_exp_req); +OpenAPI_redundant_transmission_exp_req_t *OpenAPI_redundant_transmission_exp_req_parseFromJSON(cJSON *redundant_transmission_exp_reqJSON); +cJSON *OpenAPI_redundant_transmission_exp_req_convertToJSON(OpenAPI_redundant_transmission_exp_req_t *redundant_transmission_exp_req); +OpenAPI_redundant_transmission_exp_req_t *OpenAPI_redundant_transmission_exp_req_copy(OpenAPI_redundant_transmission_exp_req_t *dst, OpenAPI_redundant_transmission_exp_req_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_redundant_transmission_exp_req_H_ */ + diff --git a/lib/sbi/openapi/model/ref_to_binary_data.h b/lib/sbi/openapi/model/ref_to_binary_data.h index da19d50af..0ff506787 100644 --- a/lib/sbi/openapi/model/ref_to_binary_data.h +++ b/lib/sbi/openapi/model/ref_to_binary_data.h @@ -1,7 +1,7 @@ /* * ref_to_binary_data.h * - * + * This parameter provides information about the referenced binary body data. */ #ifndef _OpenAPI_ref_to_binary_data_H_ diff --git a/lib/sbi/openapi/model/registration_context_container.h b/lib/sbi/openapi/model/registration_context_container.h index e5b6c661f..a866a2ed4 100644 --- a/lib/sbi/openapi/model/registration_context_container.h +++ b/lib/sbi/openapi/model/registration_context_container.h @@ -1,7 +1,7 @@ /* * registration_context_container.h * - * + * Registration Context Container used to send the UE context information, N1 message from UE, AN address etc during Registration with AMF re-allocation procedure */ #ifndef _OpenAPI_registration_context_container_H_ diff --git a/lib/sbi/openapi/model/registration_data_set_name.c b/lib/sbi/openapi/model/registration_data_set_name.c index af3552d8d..c2acb1807 100644 --- a/lib/sbi/openapi/model/registration_data_set_name.c +++ b/lib/sbi/openapi/model/registration_data_set_name.c @@ -6,7 +6,7 @@ char* OpenAPI_registration_data_set_name_ToString(OpenAPI_registration_data_set_name_e registration_data_set_name) { - const char *registration_data_set_nameArray[] = { "NULL", "AMF_3GPP", "AMF_NON_3GPP", "SMF_PDU_SESSIONS", "SMSF_3GPP", "SMSF_NON_3GPP" }; + const char *registration_data_set_nameArray[] = { "NULL", "AMF_3GPP", "AMF_NON_3GPP", "SMF_PDU_SESSIONS", "SMSF_3GPP", "SMSF_NON_3GPP", "IP_SM_GW", "NWDAF" }; size_t sizeofArray = sizeof(registration_data_set_nameArray) / sizeof(registration_data_set_nameArray[0]); if (registration_data_set_name < sizeofArray) return (char *)registration_data_set_nameArray[registration_data_set_name]; @@ -17,7 +17,7 @@ char* OpenAPI_registration_data_set_name_ToString(OpenAPI_registration_data_set_ OpenAPI_registration_data_set_name_e OpenAPI_registration_data_set_name_FromString(char* registration_data_set_name) { int stringToReturn = 0; - const char *registration_data_set_nameArray[] = { "NULL", "AMF_3GPP", "AMF_NON_3GPP", "SMF_PDU_SESSIONS", "SMSF_3GPP", "SMSF_NON_3GPP" }; + const char *registration_data_set_nameArray[] = { "NULL", "AMF_3GPP", "AMF_NON_3GPP", "SMF_PDU_SESSIONS", "SMSF_3GPP", "SMSF_NON_3GPP", "IP_SM_GW", "NWDAF" }; size_t sizeofArray = sizeof(registration_data_set_nameArray) / sizeof(registration_data_set_nameArray[0]); while (stringToReturn < sizeofArray) { if (strcmp(registration_data_set_name, registration_data_set_nameArray[stringToReturn]) == 0) { diff --git a/lib/sbi/openapi/model/registration_data_set_name.h b/lib/sbi/openapi/model/registration_data_set_name.h index 376248e11..574f13ad4 100644 --- a/lib/sbi/openapi/model/registration_data_set_name.h +++ b/lib/sbi/openapi/model/registration_data_set_name.h @@ -17,7 +17,7 @@ extern "C" { #endif -typedef enum { OpenAPI_registration_data_set_name_NULL = 0, OpenAPI_registration_data_set_name_AMF_3GPP, OpenAPI_registration_data_set_name_AMF_NON_3GPP, OpenAPI_registration_data_set_name_SMF_PDU_SESSIONS, OpenAPI_registration_data_set_name_SMSF_3GPP, OpenAPI_registration_data_set_name_SMSF_NON_3GPP } OpenAPI_registration_data_set_name_e; +typedef enum { OpenAPI_registration_data_set_name_NULL = 0, OpenAPI_registration_data_set_name_AMF_3GPP, OpenAPI_registration_data_set_name_AMF_NON_3GPP, OpenAPI_registration_data_set_name_SMF_PDU_SESSIONS, OpenAPI_registration_data_set_name_SMSF_3GPP, OpenAPI_registration_data_set_name_SMSF_NON_3GPP, OpenAPI_registration_data_set_name_IP_SM_GW, OpenAPI_registration_data_set_name_NWDAF } OpenAPI_registration_data_set_name_e; char* OpenAPI_registration_data_set_name_ToString(OpenAPI_registration_data_set_name_e registration_data_set_name); diff --git a/lib/sbi/openapi/model/registration_data_sets.c b/lib/sbi/openapi/model/registration_data_sets.c index de79886d5..624230d3f 100644 --- a/lib/sbi/openapi/model/registration_data_sets.c +++ b/lib/sbi/openapi/model/registration_data_sets.c @@ -9,7 +9,9 @@ OpenAPI_registration_data_sets_t *OpenAPI_registration_data_sets_create( OpenAPI_amf_non3_gpp_access_registration_t *amf_non3_gpp, OpenAPI_smf_registration_info_t *smf_registration, OpenAPI_smsf_registration_t *smsf3_gpp, - OpenAPI_smsf_registration_t *smsf_non3_gpp + OpenAPI_smsf_registration_t *smsf_non3_gpp, + OpenAPI_ip_sm_gw_registration_t *ip_sm_gw, + OpenAPI_nwdaf_registration_info_t *nwdaf_registration ) { OpenAPI_registration_data_sets_t *registration_data_sets_local_var = ogs_malloc(sizeof(OpenAPI_registration_data_sets_t)); @@ -20,6 +22,8 @@ OpenAPI_registration_data_sets_t *OpenAPI_registration_data_sets_create( registration_data_sets_local_var->smf_registration = smf_registration; registration_data_sets_local_var->smsf3_gpp = smsf3_gpp; registration_data_sets_local_var->smsf_non3_gpp = smsf_non3_gpp; + registration_data_sets_local_var->ip_sm_gw = ip_sm_gw; + registration_data_sets_local_var->nwdaf_registration = nwdaf_registration; return registration_data_sets_local_var; } @@ -51,6 +55,14 @@ void OpenAPI_registration_data_sets_free(OpenAPI_registration_data_sets_t *regis OpenAPI_smsf_registration_free(registration_data_sets->smsf_non3_gpp); registration_data_sets->smsf_non3_gpp = NULL; } + if (registration_data_sets->ip_sm_gw) { + OpenAPI_ip_sm_gw_registration_free(registration_data_sets->ip_sm_gw); + registration_data_sets->ip_sm_gw = NULL; + } + if (registration_data_sets->nwdaf_registration) { + OpenAPI_nwdaf_registration_info_free(registration_data_sets->nwdaf_registration); + registration_data_sets->nwdaf_registration = NULL; + } ogs_free(registration_data_sets); } @@ -130,6 +142,32 @@ cJSON *OpenAPI_registration_data_sets_convertToJSON(OpenAPI_registration_data_se } } + if (registration_data_sets->ip_sm_gw) { + cJSON *ip_sm_gw_local_JSON = OpenAPI_ip_sm_gw_registration_convertToJSON(registration_data_sets->ip_sm_gw); + if (ip_sm_gw_local_JSON == NULL) { + ogs_error("OpenAPI_registration_data_sets_convertToJSON() failed [ip_sm_gw]"); + goto end; + } + cJSON_AddItemToObject(item, "ipSmGw", ip_sm_gw_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_registration_data_sets_convertToJSON() failed [ip_sm_gw]"); + goto end; + } + } + + if (registration_data_sets->nwdaf_registration) { + cJSON *nwdaf_registration_local_JSON = OpenAPI_nwdaf_registration_info_convertToJSON(registration_data_sets->nwdaf_registration); + if (nwdaf_registration_local_JSON == NULL) { + ogs_error("OpenAPI_registration_data_sets_convertToJSON() failed [nwdaf_registration]"); + goto end; + } + cJSON_AddItemToObject(item, "nwdafRegistration", nwdaf_registration_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_registration_data_sets_convertToJSON() failed [nwdaf_registration]"); + goto end; + } + } + end: return item; } @@ -148,6 +186,10 @@ OpenAPI_registration_data_sets_t *OpenAPI_registration_data_sets_parseFromJSON(c OpenAPI_smsf_registration_t *smsf3_gpp_local_nonprim = NULL; cJSON *smsf_non3_gpp = NULL; OpenAPI_smsf_registration_t *smsf_non3_gpp_local_nonprim = NULL; + cJSON *ip_sm_gw = NULL; + OpenAPI_ip_sm_gw_registration_t *ip_sm_gw_local_nonprim = NULL; + cJSON *nwdaf_registration = NULL; + OpenAPI_nwdaf_registration_info_t *nwdaf_registration_local_nonprim = NULL; amf3_gpp = cJSON_GetObjectItemCaseSensitive(registration_data_setsJSON, "amf3Gpp"); if (amf3_gpp) { amf3_gpp_local_nonprim = OpenAPI_amf3_gpp_access_registration_parseFromJSON(amf3_gpp); @@ -173,12 +215,24 @@ OpenAPI_registration_data_sets_t *OpenAPI_registration_data_sets_parseFromJSON(c smsf_non3_gpp_local_nonprim = OpenAPI_smsf_registration_parseFromJSON(smsf_non3_gpp); } + ip_sm_gw = cJSON_GetObjectItemCaseSensitive(registration_data_setsJSON, "ipSmGw"); + if (ip_sm_gw) { + ip_sm_gw_local_nonprim = OpenAPI_ip_sm_gw_registration_parseFromJSON(ip_sm_gw); + } + + nwdaf_registration = cJSON_GetObjectItemCaseSensitive(registration_data_setsJSON, "nwdafRegistration"); + if (nwdaf_registration) { + nwdaf_registration_local_nonprim = OpenAPI_nwdaf_registration_info_parseFromJSON(nwdaf_registration); + } + registration_data_sets_local_var = OpenAPI_registration_data_sets_create ( amf3_gpp ? amf3_gpp_local_nonprim : NULL, amf_non3_gpp ? amf_non3_gpp_local_nonprim : NULL, smf_registration ? smf_registration_local_nonprim : NULL, smsf3_gpp ? smsf3_gpp_local_nonprim : NULL, - smsf_non3_gpp ? smsf_non3_gpp_local_nonprim : NULL + smsf_non3_gpp ? smsf_non3_gpp_local_nonprim : NULL, + ip_sm_gw ? ip_sm_gw_local_nonprim : NULL, + nwdaf_registration ? nwdaf_registration_local_nonprim : NULL ); return registration_data_sets_local_var; @@ -203,6 +257,14 @@ end: OpenAPI_smsf_registration_free(smsf_non3_gpp_local_nonprim); smsf_non3_gpp_local_nonprim = NULL; } + if (ip_sm_gw_local_nonprim) { + OpenAPI_ip_sm_gw_registration_free(ip_sm_gw_local_nonprim); + ip_sm_gw_local_nonprim = NULL; + } + if (nwdaf_registration_local_nonprim) { + OpenAPI_nwdaf_registration_info_free(nwdaf_registration_local_nonprim); + nwdaf_registration_local_nonprim = NULL; + } return NULL; } diff --git a/lib/sbi/openapi/model/registration_data_sets.h b/lib/sbi/openapi/model/registration_data_sets.h index 61a3a2e53..4133d2104 100644 --- a/lib/sbi/openapi/model/registration_data_sets.h +++ b/lib/sbi/openapi/model/registration_data_sets.h @@ -14,6 +14,8 @@ #include "../include/binary.h" #include "amf3_gpp_access_registration.h" #include "amf_non3_gpp_access_registration.h" +#include "ip_sm_gw_registration.h" +#include "nwdaf_registration_info.h" #include "smf_registration_info.h" #include "smsf_registration.h" @@ -28,6 +30,8 @@ typedef struct OpenAPI_registration_data_sets_s { struct OpenAPI_smf_registration_info_s *smf_registration; struct OpenAPI_smsf_registration_s *smsf3_gpp; struct OpenAPI_smsf_registration_s *smsf_non3_gpp; + struct OpenAPI_ip_sm_gw_registration_s *ip_sm_gw; + struct OpenAPI_nwdaf_registration_info_s *nwdaf_registration; } OpenAPI_registration_data_sets_t; OpenAPI_registration_data_sets_t *OpenAPI_registration_data_sets_create( @@ -35,7 +39,9 @@ OpenAPI_registration_data_sets_t *OpenAPI_registration_data_sets_create( OpenAPI_amf_non3_gpp_access_registration_t *amf_non3_gpp, OpenAPI_smf_registration_info_t *smf_registration, OpenAPI_smsf_registration_t *smsf3_gpp, - OpenAPI_smsf_registration_t *smsf_non3_gpp + OpenAPI_smsf_registration_t *smsf_non3_gpp, + OpenAPI_ip_sm_gw_registration_t *ip_sm_gw, + OpenAPI_nwdaf_registration_info_t *nwdaf_registration ); void OpenAPI_registration_data_sets_free(OpenAPI_registration_data_sets_t *registration_data_sets); OpenAPI_registration_data_sets_t *OpenAPI_registration_data_sets_parseFromJSON(cJSON *registration_data_setsJSON); diff --git a/lib/sbi/openapi/model/registration_location_info.c b/lib/sbi/openapi/model/registration_location_info.c index 53cb9b00d..78f60ce5d 100644 --- a/lib/sbi/openapi/model/registration_location_info.c +++ b/lib/sbi/openapi/model/registration_location_info.c @@ -6,6 +6,7 @@ OpenAPI_registration_location_info_t *OpenAPI_registration_location_info_create( char *amf_instance_id, + OpenAPI_guami_t *guami, OpenAPI_plmn_id_t *plmn_id, OpenAPI_vgmlc_address_t *vgmlc_address, OpenAPI_list_t *access_type_list @@ -15,6 +16,7 @@ OpenAPI_registration_location_info_t *OpenAPI_registration_location_info_create( ogs_assert(registration_location_info_local_var); registration_location_info_local_var->amf_instance_id = amf_instance_id; + registration_location_info_local_var->guami = guami; registration_location_info_local_var->plmn_id = plmn_id; registration_location_info_local_var->vgmlc_address = vgmlc_address; registration_location_info_local_var->access_type_list = access_type_list; @@ -33,6 +35,10 @@ void OpenAPI_registration_location_info_free(OpenAPI_registration_location_info_ ogs_free(registration_location_info->amf_instance_id); registration_location_info->amf_instance_id = NULL; } + if (registration_location_info->guami) { + OpenAPI_guami_free(registration_location_info->guami); + registration_location_info->guami = NULL; + } if (registration_location_info->plmn_id) { OpenAPI_plmn_id_free(registration_location_info->plmn_id); registration_location_info->plmn_id = NULL; @@ -68,6 +74,19 @@ cJSON *OpenAPI_registration_location_info_convertToJSON(OpenAPI_registration_loc goto end; } + if (registration_location_info->guami) { + cJSON *guami_local_JSON = OpenAPI_guami_convertToJSON(registration_location_info->guami); + if (guami_local_JSON == NULL) { + ogs_error("OpenAPI_registration_location_info_convertToJSON() failed [guami]"); + goto end; + } + cJSON_AddItemToObject(item, "guami", guami_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_registration_location_info_convertToJSON() failed [guami]"); + goto end; + } + } + if (registration_location_info->plmn_id) { cJSON *plmn_id_local_JSON = OpenAPI_plmn_id_convertToJSON(registration_location_info->plmn_id); if (plmn_id_local_JSON == NULL) { @@ -119,6 +138,8 @@ OpenAPI_registration_location_info_t *OpenAPI_registration_location_info_parseFr OpenAPI_registration_location_info_t *registration_location_info_local_var = NULL; OpenAPI_lnode_t *node = NULL; cJSON *amf_instance_id = NULL; + cJSON *guami = NULL; + OpenAPI_guami_t *guami_local_nonprim = NULL; cJSON *plmn_id = NULL; OpenAPI_plmn_id_t *plmn_id_local_nonprim = NULL; cJSON *vgmlc_address = NULL; @@ -135,6 +156,11 @@ OpenAPI_registration_location_info_t *OpenAPI_registration_location_info_parseFr goto end; } + guami = cJSON_GetObjectItemCaseSensitive(registration_location_infoJSON, "guami"); + if (guami) { + guami_local_nonprim = OpenAPI_guami_parseFromJSON(guami); + } + plmn_id = cJSON_GetObjectItemCaseSensitive(registration_location_infoJSON, "plmnId"); if (plmn_id) { plmn_id_local_nonprim = OpenAPI_plmn_id_parseFromJSON(plmn_id); @@ -168,6 +194,7 @@ OpenAPI_registration_location_info_t *OpenAPI_registration_location_info_parseFr registration_location_info_local_var = OpenAPI_registration_location_info_create ( ogs_strdup(amf_instance_id->valuestring), + guami ? guami_local_nonprim : NULL, plmn_id ? plmn_id_local_nonprim : NULL, vgmlc_address ? vgmlc_address_local_nonprim : NULL, access_type_listList @@ -175,6 +202,10 @@ OpenAPI_registration_location_info_t *OpenAPI_registration_location_info_parseFr return registration_location_info_local_var; end: + if (guami_local_nonprim) { + OpenAPI_guami_free(guami_local_nonprim); + guami_local_nonprim = NULL; + } if (plmn_id_local_nonprim) { OpenAPI_plmn_id_free(plmn_id_local_nonprim); plmn_id_local_nonprim = NULL; diff --git a/lib/sbi/openapi/model/registration_location_info.h b/lib/sbi/openapi/model/registration_location_info.h index dbf19ff6b..ab63a81ca 100644 --- a/lib/sbi/openapi/model/registration_location_info.h +++ b/lib/sbi/openapi/model/registration_location_info.h @@ -13,6 +13,7 @@ #include "../include/keyValuePair.h" #include "../include/binary.h" #include "access_type.h" +#include "guami.h" #include "plmn_id.h" #include "vgmlc_address.h" @@ -23,6 +24,7 @@ extern "C" { typedef struct OpenAPI_registration_location_info_s OpenAPI_registration_location_info_t; typedef struct OpenAPI_registration_location_info_s { char *amf_instance_id; + struct OpenAPI_guami_s *guami; struct OpenAPI_plmn_id_s *plmn_id; struct OpenAPI_vgmlc_address_s *vgmlc_address; OpenAPI_list_t *access_type_list; @@ -30,6 +32,7 @@ typedef struct OpenAPI_registration_location_info_s { OpenAPI_registration_location_info_t *OpenAPI_registration_location_info_create( char *amf_instance_id, + OpenAPI_guami_t *guami, OpenAPI_plmn_id_t *plmn_id, OpenAPI_vgmlc_address_t *vgmlc_address, OpenAPI_list_t *access_type_list diff --git a/lib/sbi/openapi/model/relative_cartesian_location.c b/lib/sbi/openapi/model/relative_cartesian_location.c new file mode 100644 index 000000000..ad7238680 --- /dev/null +++ b/lib/sbi/openapi/model/relative_cartesian_location.c @@ -0,0 +1,149 @@ + +#include +#include +#include +#include "relative_cartesian_location.h" + +OpenAPI_relative_cartesian_location_t *OpenAPI_relative_cartesian_location_create( + float x, + float y, + bool is_z, + float z +) +{ + OpenAPI_relative_cartesian_location_t *relative_cartesian_location_local_var = ogs_malloc(sizeof(OpenAPI_relative_cartesian_location_t)); + ogs_assert(relative_cartesian_location_local_var); + + relative_cartesian_location_local_var->x = x; + relative_cartesian_location_local_var->y = y; + relative_cartesian_location_local_var->is_z = is_z; + relative_cartesian_location_local_var->z = z; + + return relative_cartesian_location_local_var; +} + +void OpenAPI_relative_cartesian_location_free(OpenAPI_relative_cartesian_location_t *relative_cartesian_location) +{ + OpenAPI_lnode_t *node = NULL; + + if (NULL == relative_cartesian_location) { + return; + } + ogs_free(relative_cartesian_location); +} + +cJSON *OpenAPI_relative_cartesian_location_convertToJSON(OpenAPI_relative_cartesian_location_t *relative_cartesian_location) +{ + cJSON *item = NULL; + OpenAPI_lnode_t *node = NULL; + + if (relative_cartesian_location == NULL) { + ogs_error("OpenAPI_relative_cartesian_location_convertToJSON() failed [RelativeCartesianLocation]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (cJSON_AddNumberToObject(item, "x", relative_cartesian_location->x) == NULL) { + ogs_error("OpenAPI_relative_cartesian_location_convertToJSON() failed [x]"); + goto end; + } + + if (cJSON_AddNumberToObject(item, "y", relative_cartesian_location->y) == NULL) { + ogs_error("OpenAPI_relative_cartesian_location_convertToJSON() failed [y]"); + goto end; + } + + if (relative_cartesian_location->is_z) { + if (cJSON_AddNumberToObject(item, "z", relative_cartesian_location->z) == NULL) { + ogs_error("OpenAPI_relative_cartesian_location_convertToJSON() failed [z]"); + goto end; + } + } + +end: + return item; +} + +OpenAPI_relative_cartesian_location_t *OpenAPI_relative_cartesian_location_parseFromJSON(cJSON *relative_cartesian_locationJSON) +{ + OpenAPI_relative_cartesian_location_t *relative_cartesian_location_local_var = NULL; + OpenAPI_lnode_t *node = NULL; + cJSON *x = NULL; + cJSON *y = NULL; + cJSON *z = NULL; + x = cJSON_GetObjectItemCaseSensitive(relative_cartesian_locationJSON, "x"); + if (!x) { + ogs_error("OpenAPI_relative_cartesian_location_parseFromJSON() failed [x]"); + goto end; + } + if (!cJSON_IsNumber(x)) { + ogs_error("OpenAPI_relative_cartesian_location_parseFromJSON() failed [x]"); + goto end; + } + + y = cJSON_GetObjectItemCaseSensitive(relative_cartesian_locationJSON, "y"); + if (!y) { + ogs_error("OpenAPI_relative_cartesian_location_parseFromJSON() failed [y]"); + goto end; + } + if (!cJSON_IsNumber(y)) { + ogs_error("OpenAPI_relative_cartesian_location_parseFromJSON() failed [y]"); + goto end; + } + + z = cJSON_GetObjectItemCaseSensitive(relative_cartesian_locationJSON, "z"); + if (z) { + if (!cJSON_IsNumber(z)) { + ogs_error("OpenAPI_relative_cartesian_location_parseFromJSON() failed [z]"); + goto end; + } + } + + relative_cartesian_location_local_var = OpenAPI_relative_cartesian_location_create ( + + x->valuedouble, + + y->valuedouble, + z ? true : false, + z ? z->valuedouble : 0 + ); + + return relative_cartesian_location_local_var; +end: + return NULL; +} + +OpenAPI_relative_cartesian_location_t *OpenAPI_relative_cartesian_location_copy(OpenAPI_relative_cartesian_location_t *dst, OpenAPI_relative_cartesian_location_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_relative_cartesian_location_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_relative_cartesian_location_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_relative_cartesian_location_free(dst); + dst = OpenAPI_relative_cartesian_location_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/relative_cartesian_location.h b/lib/sbi/openapi/model/relative_cartesian_location.h new file mode 100644 index 000000000..87f7a3f40 --- /dev/null +++ b/lib/sbi/openapi/model/relative_cartesian_location.h @@ -0,0 +1,44 @@ +/* + * relative_cartesian_location.h + * + * Relative Cartesian Location + */ + +#ifndef _OpenAPI_relative_cartesian_location_H_ +#define _OpenAPI_relative_cartesian_location_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_relative_cartesian_location_s OpenAPI_relative_cartesian_location_t; +typedef struct OpenAPI_relative_cartesian_location_s { + float x; + float y; + bool is_z; + float z; +} OpenAPI_relative_cartesian_location_t; + +OpenAPI_relative_cartesian_location_t *OpenAPI_relative_cartesian_location_create( + float x, + float y, + bool is_z, + float z +); +void OpenAPI_relative_cartesian_location_free(OpenAPI_relative_cartesian_location_t *relative_cartesian_location); +OpenAPI_relative_cartesian_location_t *OpenAPI_relative_cartesian_location_parseFromJSON(cJSON *relative_cartesian_locationJSON); +cJSON *OpenAPI_relative_cartesian_location_convertToJSON(OpenAPI_relative_cartesian_location_t *relative_cartesian_location); +OpenAPI_relative_cartesian_location_t *OpenAPI_relative_cartesian_location_copy(OpenAPI_relative_cartesian_location_t *dst, OpenAPI_relative_cartesian_location_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_relative_cartesian_location_H_ */ + diff --git a/lib/sbi/openapi/model/release_cause.c b/lib/sbi/openapi/model/release_cause.c new file mode 100644 index 000000000..7e86266dc --- /dev/null +++ b/lib/sbi/openapi/model/release_cause.c @@ -0,0 +1,30 @@ + +#include +#include +#include +#include "release_cause.h" + +char* OpenAPI_release_cause_ToString(OpenAPI_release_cause_e release_cause) +{ + const char *release_causeArray[] = { "NULL", "SNPN_SNPN_MOBILITY", "NO_HR_AGREEMENT", "UNSPECIFIED" }; + size_t sizeofArray = sizeof(release_causeArray) / sizeof(release_causeArray[0]); + if (release_cause < sizeofArray) + return (char *)release_causeArray[release_cause]; + else + return (char *)"Unknown"; +} + +OpenAPI_release_cause_e OpenAPI_release_cause_FromString(char* release_cause) +{ + int stringToReturn = 0; + const char *release_causeArray[] = { "NULL", "SNPN_SNPN_MOBILITY", "NO_HR_AGREEMENT", "UNSPECIFIED" }; + size_t sizeofArray = sizeof(release_causeArray) / sizeof(release_causeArray[0]); + while (stringToReturn < sizeofArray) { + if (strcmp(release_cause, release_causeArray[stringToReturn]) == 0) { + return stringToReturn; + } + stringToReturn++; + } + return 0; +} + diff --git a/lib/sbi/openapi/model/release_cause.h b/lib/sbi/openapi/model/release_cause.h new file mode 100644 index 000000000..61098ea61 --- /dev/null +++ b/lib/sbi/openapi/model/release_cause.h @@ -0,0 +1,31 @@ +/* + * release_cause.h + * + * + */ + +#ifndef _OpenAPI_release_cause_H_ +#define _OpenAPI_release_cause_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef enum { OpenAPI_release_cause_NULL = 0, OpenAPI_release_cause_SNPN_SNPN_MOBILITY, OpenAPI_release_cause_NO_HR_AGREEMENT, OpenAPI_release_cause_UNSPECIFIED } OpenAPI_release_cause_e; + +char* OpenAPI_release_cause_ToString(OpenAPI_release_cause_e release_cause); + +OpenAPI_release_cause_e OpenAPI_release_cause_FromString(char* release_cause); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_release_cause_H_ */ + diff --git a/lib/sbi/openapi/model/release_data.h b/lib/sbi/openapi/model/release_data.h index 269bda64b..917c50330 100644 --- a/lib/sbi/openapi/model/release_data.h +++ b/lib/sbi/openapi/model/release_data.h @@ -1,7 +1,7 @@ /* * release_data.h * - * + * Data within Release Request */ #ifndef _OpenAPI_release_data_H_ diff --git a/lib/sbi/openapi/model/release_session_info.c b/lib/sbi/openapi/model/release_session_info.c new file mode 100644 index 000000000..a39c8aa18 --- /dev/null +++ b/lib/sbi/openapi/model/release_session_info.c @@ -0,0 +1,176 @@ + +#include +#include +#include +#include "release_session_info.h" + +OpenAPI_release_session_info_t *OpenAPI_release_session_info_create( + OpenAPI_list_t *release_session_list, + OpenAPI_release_cause_e release_cause +) +{ + OpenAPI_release_session_info_t *release_session_info_local_var = ogs_malloc(sizeof(OpenAPI_release_session_info_t)); + ogs_assert(release_session_info_local_var); + + release_session_info_local_var->release_session_list = release_session_list; + release_session_info_local_var->release_cause = release_cause; + + return release_session_info_local_var; +} + +void OpenAPI_release_session_info_free(OpenAPI_release_session_info_t *release_session_info) +{ + OpenAPI_lnode_t *node = NULL; + + if (NULL == release_session_info) { + return; + } + if (release_session_info->release_session_list) { + OpenAPI_list_for_each(release_session_info->release_session_list, node) { + ogs_free(node->data); + } + OpenAPI_list_free(release_session_info->release_session_list); + release_session_info->release_session_list = NULL; + } + ogs_free(release_session_info); +} + +cJSON *OpenAPI_release_session_info_convertToJSON(OpenAPI_release_session_info_t *release_session_info) +{ + cJSON *item = NULL; + OpenAPI_lnode_t *node = NULL; + + if (release_session_info == NULL) { + ogs_error("OpenAPI_release_session_info_convertToJSON() failed [ReleaseSessionInfo]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (!release_session_info->release_session_list) { + ogs_error("OpenAPI_release_session_info_convertToJSON() failed [release_session_list]"); + return NULL; + } + cJSON *release_session_listList = cJSON_AddArrayToObject(item, "releaseSessionList"); + if (release_session_listList == NULL) { + ogs_error("OpenAPI_release_session_info_convertToJSON() failed [release_session_list]"); + goto end; + } + OpenAPI_list_for_each(release_session_info->release_session_list, node) { + if (cJSON_AddNumberToObject(release_session_listList, "", (uintptr_t)node->data) == NULL) { + ogs_error("OpenAPI_release_session_info_convertToJSON() failed [release_session_list]"); + goto end; + } + } + + if (release_session_info->release_cause == OpenAPI_release_cause_NULL) { + ogs_error("OpenAPI_release_session_info_convertToJSON() failed [release_cause]"); + return NULL; + } + if (cJSON_AddStringToObject(item, "releaseCause", OpenAPI_release_cause_ToString(release_session_info->release_cause)) == NULL) { + ogs_error("OpenAPI_release_session_info_convertToJSON() failed [release_cause]"); + goto end; + } + +end: + return item; +} + +OpenAPI_release_session_info_t *OpenAPI_release_session_info_parseFromJSON(cJSON *release_session_infoJSON) +{ + OpenAPI_release_session_info_t *release_session_info_local_var = NULL; + OpenAPI_lnode_t *node = NULL; + cJSON *release_session_list = NULL; + OpenAPI_list_t *release_session_listList = NULL; + cJSON *release_cause = NULL; + OpenAPI_release_cause_e release_causeVariable = 0; + release_session_list = cJSON_GetObjectItemCaseSensitive(release_session_infoJSON, "releaseSessionList"); + if (!release_session_list) { + ogs_error("OpenAPI_release_session_info_parseFromJSON() failed [release_session_list]"); + goto end; + } + cJSON *release_session_list_local = NULL; + if (!cJSON_IsArray(release_session_list)) { + ogs_error("OpenAPI_release_session_info_parseFromJSON() failed [release_session_list]"); + goto end; + } + + release_session_listList = OpenAPI_list_create(); + + cJSON_ArrayForEach(release_session_list_local, release_session_list) { + double *localDouble = NULL; + int *localInt = NULL; + if (!cJSON_IsNumber(release_session_list_local)) { + ogs_error("OpenAPI_release_session_info_parseFromJSON() failed [release_session_list]"); + goto end; + } + localDouble = (double *)ogs_calloc(1, sizeof(double)); + if (!localDouble) { + ogs_error("OpenAPI_release_session_info_parseFromJSON() failed [release_session_list]"); + goto end; + } + *localDouble = release_session_list_local->valuedouble; + OpenAPI_list_add(release_session_listList, localDouble); + } + + release_cause = cJSON_GetObjectItemCaseSensitive(release_session_infoJSON, "releaseCause"); + if (!release_cause) { + ogs_error("OpenAPI_release_session_info_parseFromJSON() failed [release_cause]"); + goto end; + } + if (!cJSON_IsString(release_cause)) { + ogs_error("OpenAPI_release_session_info_parseFromJSON() failed [release_cause]"); + goto end; + } + release_causeVariable = OpenAPI_release_cause_FromString(release_cause->valuestring); + + release_session_info_local_var = OpenAPI_release_session_info_create ( + release_session_listList, + release_causeVariable + ); + + return release_session_info_local_var; +end: + if (release_session_listList) { + OpenAPI_list_for_each(release_session_listList, node) { + ogs_free(node->data); + } + OpenAPI_list_free(release_session_listList); + release_session_listList = NULL; + } + return NULL; +} + +OpenAPI_release_session_info_t *OpenAPI_release_session_info_copy(OpenAPI_release_session_info_t *dst, OpenAPI_release_session_info_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_release_session_info_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_release_session_info_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_release_session_info_free(dst); + dst = OpenAPI_release_session_info_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/release_session_info.h b/lib/sbi/openapi/model/release_session_info.h new file mode 100644 index 000000000..19c1b433d --- /dev/null +++ b/lib/sbi/openapi/model/release_session_info.h @@ -0,0 +1,41 @@ +/* + * release_session_info.h + * + * PDU session Id(s) and the cause for triggering the release. + */ + +#ifndef _OpenAPI_release_session_info_H_ +#define _OpenAPI_release_session_info_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "release_cause.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_release_session_info_s OpenAPI_release_session_info_t; +typedef struct OpenAPI_release_session_info_s { + OpenAPI_list_t *release_session_list; + OpenAPI_release_cause_e release_cause; +} OpenAPI_release_session_info_t; + +OpenAPI_release_session_info_t *OpenAPI_release_session_info_create( + OpenAPI_list_t *release_session_list, + OpenAPI_release_cause_e release_cause +); +void OpenAPI_release_session_info_free(OpenAPI_release_session_info_t *release_session_info); +OpenAPI_release_session_info_t *OpenAPI_release_session_info_parseFromJSON(cJSON *release_session_infoJSON); +cJSON *OpenAPI_release_session_info_convertToJSON(OpenAPI_release_session_info_t *release_session_info); +OpenAPI_release_session_info_t *OpenAPI_release_session_info_copy(OpenAPI_release_session_info_t *dst, OpenAPI_release_session_info_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_release_session_info_H_ */ + diff --git a/lib/sbi/openapi/model/released_data.h b/lib/sbi/openapi/model/released_data.h index 5dd418599..579ac2996 100644 --- a/lib/sbi/openapi/model/released_data.h +++ b/lib/sbi/openapi/model/released_data.h @@ -1,7 +1,7 @@ /* * released_data.h * - * + * Data within Release Response */ #ifndef _OpenAPI_released_data_H_ diff --git a/lib/sbi/openapi/model/relocate_ue_context_request.c b/lib/sbi/openapi/model/relocate_ue_context_request.c index a71e23211..6f79ace0f 100644 --- a/lib/sbi/openapi/model/relocate_ue_context_request.c +++ b/lib/sbi/openapi/model/relocate_ue_context_request.c @@ -6,7 +6,7 @@ OpenAPI_relocate_ue_context_request_t *OpenAPI_relocate_ue_context_request_create( OpenAPI_ue_context_relocate_data_t *json_data, - OpenAPI_binary_t* binary_data_gtpc_message, + OpenAPI_binary_t* binary_data_forward_relocation_request, OpenAPI_binary_t* binary_data_n2_information, OpenAPI_binary_t* binary_data_n2_information_ext1, OpenAPI_binary_t* binary_data_n2_information_ext2, @@ -30,7 +30,7 @@ OpenAPI_relocate_ue_context_request_t *OpenAPI_relocate_ue_context_request_creat ogs_assert(relocate_ue_context_request_local_var); relocate_ue_context_request_local_var->json_data = json_data; - relocate_ue_context_request_local_var->binary_data_gtpc_message = binary_data_gtpc_message; + relocate_ue_context_request_local_var->binary_data_forward_relocation_request = binary_data_forward_relocation_request; relocate_ue_context_request_local_var->binary_data_n2_information = binary_data_n2_information; relocate_ue_context_request_local_var->binary_data_n2_information_ext1 = binary_data_n2_information_ext1; relocate_ue_context_request_local_var->binary_data_n2_information_ext2 = binary_data_n2_information_ext2; @@ -63,9 +63,9 @@ void OpenAPI_relocate_ue_context_request_free(OpenAPI_relocate_ue_context_reques OpenAPI_ue_context_relocate_data_free(relocate_ue_context_request->json_data); relocate_ue_context_request->json_data = NULL; } - if (relocate_ue_context_request->binary_data_gtpc_message) { - ogs_free(relocate_ue_context_request->binary_data_gtpc_message->data); - relocate_ue_context_request->binary_data_gtpc_message = NULL; + if (relocate_ue_context_request->binary_data_forward_relocation_request) { + ogs_free(relocate_ue_context_request->binary_data_forward_relocation_request->data); + relocate_ue_context_request->binary_data_forward_relocation_request = NULL; } if (relocate_ue_context_request->binary_data_n2_information) { ogs_free(relocate_ue_context_request->binary_data_n2_information->data); @@ -162,13 +162,13 @@ cJSON *OpenAPI_relocate_ue_context_request_convertToJSON(OpenAPI_relocate_ue_con } } - if (relocate_ue_context_request->binary_data_gtpc_message) { - char* encoded_str_binary_data_gtpc_message = OpenAPI_base64encode(relocate_ue_context_request->binary_data_gtpc_message->data,relocate_ue_context_request->binary_data_gtpc_message->len); - if (cJSON_AddStringToObject(item, "binaryDataGtpcMessage", encoded_str_binary_data_gtpc_message) == NULL) { - ogs_error("OpenAPI_relocate_ue_context_request_convertToJSON() failed [binary_data_gtpc_message]"); + if (relocate_ue_context_request->binary_data_forward_relocation_request) { + char* encoded_str_binary_data_forward_relocation_request = OpenAPI_base64encode(relocate_ue_context_request->binary_data_forward_relocation_request->data,relocate_ue_context_request->binary_data_forward_relocation_request->len); + if (cJSON_AddStringToObject(item, "binaryDataForwardRelocationRequest", encoded_str_binary_data_forward_relocation_request) == NULL) { + ogs_error("OpenAPI_relocate_ue_context_request_convertToJSON() failed [binary_data_forward_relocation_request]"); goto end; } - ogs_free(encoded_str_binary_data_gtpc_message); + ogs_free(encoded_str_binary_data_forward_relocation_request); } if (relocate_ue_context_request->binary_data_n2_information) { @@ -334,8 +334,8 @@ OpenAPI_relocate_ue_context_request_t *OpenAPI_relocate_ue_context_request_parse OpenAPI_lnode_t *node = NULL; cJSON *json_data = NULL; OpenAPI_ue_context_relocate_data_t *json_data_local_nonprim = NULL; - cJSON *binary_data_gtpc_message = NULL; - OpenAPI_binary_t *decoded_str_binary_data_gtpc_message = NULL; + cJSON *binary_data_forward_relocation_request = NULL; + OpenAPI_binary_t *decoded_str_binary_data_forward_relocation_request = NULL; cJSON *binary_data_n2_information = NULL; OpenAPI_binary_t *decoded_str_binary_data_n2_information = NULL; cJSON *binary_data_n2_information_ext1 = NULL; @@ -375,17 +375,17 @@ OpenAPI_relocate_ue_context_request_t *OpenAPI_relocate_ue_context_request_parse json_data_local_nonprim = OpenAPI_ue_context_relocate_data_parseFromJSON(json_data); } - binary_data_gtpc_message = cJSON_GetObjectItemCaseSensitive(relocate_ue_context_requestJSON, "binaryDataGtpcMessage"); - if (binary_data_gtpc_message) { - decoded_str_binary_data_gtpc_message = ogs_malloc(sizeof(OpenAPI_binary_t)); - ogs_assert(decoded_str_binary_data_gtpc_message); - if (!cJSON_IsString(binary_data_gtpc_message)) { - ogs_error("OpenAPI_relocate_ue_context_request_parseFromJSON() failed [binary_data_gtpc_message]"); + binary_data_forward_relocation_request = cJSON_GetObjectItemCaseSensitive(relocate_ue_context_requestJSON, "binaryDataForwardRelocationRequest"); + if (binary_data_forward_relocation_request) { + decoded_str_binary_data_forward_relocation_request = ogs_malloc(sizeof(OpenAPI_binary_t)); + ogs_assert(decoded_str_binary_data_forward_relocation_request); + if (!cJSON_IsString(binary_data_forward_relocation_request)) { + ogs_error("OpenAPI_relocate_ue_context_request_parseFromJSON() failed [binary_data_forward_relocation_request]"); goto end; } - decoded_str_binary_data_gtpc_message->data = OpenAPI_base64decode(binary_data_gtpc_message->valuestring, strlen(binary_data_gtpc_message->valuestring), &decoded_str_binary_data_gtpc_message->len); - if (!decoded_str_binary_data_gtpc_message->data) { - ogs_error("OpenAPI_relocate_ue_context_request_parseFromJSON() failed [binary_data_gtpc_message]"); + decoded_str_binary_data_forward_relocation_request->data = OpenAPI_base64decode(binary_data_forward_relocation_request->valuestring, strlen(binary_data_forward_relocation_request->valuestring), &decoded_str_binary_data_forward_relocation_request->len); + if (!decoded_str_binary_data_forward_relocation_request->data) { + ogs_error("OpenAPI_relocate_ue_context_request_parseFromJSON() failed [binary_data_forward_relocation_request]"); goto end; } } @@ -647,7 +647,7 @@ OpenAPI_relocate_ue_context_request_t *OpenAPI_relocate_ue_context_request_parse relocate_ue_context_request_local_var = OpenAPI_relocate_ue_context_request_create ( json_data ? json_data_local_nonprim : NULL, - binary_data_gtpc_message ? decoded_str_binary_data_gtpc_message : NULL, + binary_data_forward_relocation_request ? decoded_str_binary_data_forward_relocation_request : NULL, binary_data_n2_information ? decoded_str_binary_data_n2_information : NULL, binary_data_n2_information_ext1 ? decoded_str_binary_data_n2_information_ext1 : NULL, binary_data_n2_information_ext2 ? decoded_str_binary_data_n2_information_ext2 : NULL, diff --git a/lib/sbi/openapi/model/relocate_ue_context_request.h b/lib/sbi/openapi/model/relocate_ue_context_request.h index d5f5b30fc..72aa3c077 100644 --- a/lib/sbi/openapi/model/relocate_ue_context_request.h +++ b/lib/sbi/openapi/model/relocate_ue_context_request.h @@ -21,7 +21,7 @@ extern "C" { typedef struct OpenAPI_relocate_ue_context_request_s OpenAPI_relocate_ue_context_request_t; typedef struct OpenAPI_relocate_ue_context_request_s { struct OpenAPI_ue_context_relocate_data_s *json_data; - OpenAPI_binary_t* binary_data_gtpc_message; + OpenAPI_binary_t* binary_data_forward_relocation_request; OpenAPI_binary_t* binary_data_n2_information; OpenAPI_binary_t* binary_data_n2_information_ext1; OpenAPI_binary_t* binary_data_n2_information_ext2; @@ -43,7 +43,7 @@ typedef struct OpenAPI_relocate_ue_context_request_s { OpenAPI_relocate_ue_context_request_t *OpenAPI_relocate_ue_context_request_create( OpenAPI_ue_context_relocate_data_t *json_data, - OpenAPI_binary_t* binary_data_gtpc_message, + OpenAPI_binary_t* binary_data_forward_relocation_request, OpenAPI_binary_t* binary_data_n2_information, OpenAPI_binary_t* binary_data_n2_information_ext1, OpenAPI_binary_t* binary_data_n2_information_ext2, diff --git a/lib/sbi/openapi/model/report_item.c b/lib/sbi/openapi/model/report_item.c index e8b6cb402..976c8c54a 100644 --- a/lib/sbi/openapi/model/report_item.c +++ b/lib/sbi/openapi/model/report_item.c @@ -5,13 +5,15 @@ #include "report_item.h" OpenAPI_report_item_t *OpenAPI_report_item_create( - char *path + char *path, + char *reason ) { OpenAPI_report_item_t *report_item_local_var = ogs_malloc(sizeof(OpenAPI_report_item_t)); ogs_assert(report_item_local_var); report_item_local_var->path = path; + report_item_local_var->reason = reason; return report_item_local_var; } @@ -27,6 +29,10 @@ void OpenAPI_report_item_free(OpenAPI_report_item_t *report_item) ogs_free(report_item->path); report_item->path = NULL; } + if (report_item->reason) { + ogs_free(report_item->reason); + report_item->reason = NULL; + } ogs_free(report_item); } @@ -50,6 +56,13 @@ cJSON *OpenAPI_report_item_convertToJSON(OpenAPI_report_item_t *report_item) goto end; } + if (report_item->reason) { + if (cJSON_AddStringToObject(item, "reason", report_item->reason) == NULL) { + ogs_error("OpenAPI_report_item_convertToJSON() failed [reason]"); + goto end; + } + } + end: return item; } @@ -59,6 +72,7 @@ OpenAPI_report_item_t *OpenAPI_report_item_parseFromJSON(cJSON *report_itemJSON) OpenAPI_report_item_t *report_item_local_var = NULL; OpenAPI_lnode_t *node = NULL; cJSON *path = NULL; + cJSON *reason = NULL; path = cJSON_GetObjectItemCaseSensitive(report_itemJSON, "path"); if (!path) { ogs_error("OpenAPI_report_item_parseFromJSON() failed [path]"); @@ -69,8 +83,17 @@ OpenAPI_report_item_t *OpenAPI_report_item_parseFromJSON(cJSON *report_itemJSON) goto end; } + reason = cJSON_GetObjectItemCaseSensitive(report_itemJSON, "reason"); + if (reason) { + if (!cJSON_IsString(reason) && !cJSON_IsNull(reason)) { + ogs_error("OpenAPI_report_item_parseFromJSON() failed [reason]"); + goto end; + } + } + report_item_local_var = OpenAPI_report_item_create ( - ogs_strdup(path->valuestring) + ogs_strdup(path->valuestring), + reason && !cJSON_IsNull(reason) ? ogs_strdup(reason->valuestring) : NULL ); return report_item_local_var; diff --git a/lib/sbi/openapi/model/report_item.h b/lib/sbi/openapi/model/report_item.h index d750c991e..a34c9d86c 100644 --- a/lib/sbi/openapi/model/report_item.h +++ b/lib/sbi/openapi/model/report_item.h @@ -1,7 +1,7 @@ /* * report_item.h * - * + * indicates performed modivications. */ #ifndef _OpenAPI_report_item_H_ @@ -20,10 +20,12 @@ extern "C" { typedef struct OpenAPI_report_item_s OpenAPI_report_item_t; typedef struct OpenAPI_report_item_s { char *path; + char *reason; } OpenAPI_report_item_t; OpenAPI_report_item_t *OpenAPI_report_item_create( - char *path + char *path, + char *reason ); void OpenAPI_report_item_free(OpenAPI_report_item_t *report_item); OpenAPI_report_item_t *OpenAPI_report_item_parseFromJSON(cJSON *report_itemJSON); diff --git a/lib/sbi/openapi/model/reporting_information.c b/lib/sbi/openapi/model/reporting_information.c new file mode 100644 index 000000000..af825e8af --- /dev/null +++ b/lib/sbi/openapi/model/reporting_information.c @@ -0,0 +1,318 @@ + +#include +#include +#include +#include "reporting_information.h" + +OpenAPI_reporting_information_t *OpenAPI_reporting_information_create( + bool is_imm_rep, + int imm_rep, + OpenAPI_notification_method_1_t *notif_method, + bool is_max_report_nbr, + int max_report_nbr, + char *mon_dur, + bool is_rep_period, + int rep_period, + bool is_samp_ratio, + int samp_ratio, + OpenAPI_list_t *partition_criteria, + bool is_grp_rep_time, + int grp_rep_time, + OpenAPI_notification_flag_e notif_flag +) +{ + OpenAPI_reporting_information_t *reporting_information_local_var = ogs_malloc(sizeof(OpenAPI_reporting_information_t)); + ogs_assert(reporting_information_local_var); + + reporting_information_local_var->is_imm_rep = is_imm_rep; + reporting_information_local_var->imm_rep = imm_rep; + reporting_information_local_var->notif_method = notif_method; + reporting_information_local_var->is_max_report_nbr = is_max_report_nbr; + reporting_information_local_var->max_report_nbr = max_report_nbr; + reporting_information_local_var->mon_dur = mon_dur; + reporting_information_local_var->is_rep_period = is_rep_period; + reporting_information_local_var->rep_period = rep_period; + reporting_information_local_var->is_samp_ratio = is_samp_ratio; + reporting_information_local_var->samp_ratio = samp_ratio; + reporting_information_local_var->partition_criteria = partition_criteria; + reporting_information_local_var->is_grp_rep_time = is_grp_rep_time; + reporting_information_local_var->grp_rep_time = grp_rep_time; + reporting_information_local_var->notif_flag = notif_flag; + + return reporting_information_local_var; +} + +void OpenAPI_reporting_information_free(OpenAPI_reporting_information_t *reporting_information) +{ + OpenAPI_lnode_t *node = NULL; + + if (NULL == reporting_information) { + return; + } + if (reporting_information->notif_method) { + OpenAPI_notification_method_1_free(reporting_information->notif_method); + reporting_information->notif_method = NULL; + } + if (reporting_information->mon_dur) { + ogs_free(reporting_information->mon_dur); + reporting_information->mon_dur = NULL; + } + if (reporting_information->partition_criteria) { + OpenAPI_list_free(reporting_information->partition_criteria); + reporting_information->partition_criteria = NULL; + } + ogs_free(reporting_information); +} + +cJSON *OpenAPI_reporting_information_convertToJSON(OpenAPI_reporting_information_t *reporting_information) +{ + cJSON *item = NULL; + OpenAPI_lnode_t *node = NULL; + + if (reporting_information == NULL) { + ogs_error("OpenAPI_reporting_information_convertToJSON() failed [ReportingInformation]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (reporting_information->is_imm_rep) { + if (cJSON_AddBoolToObject(item, "immRep", reporting_information->imm_rep) == NULL) { + ogs_error("OpenAPI_reporting_information_convertToJSON() failed [imm_rep]"); + goto end; + } + } + + if (reporting_information->notif_method) { + cJSON *notif_method_local_JSON = OpenAPI_notification_method_1_convertToJSON(reporting_information->notif_method); + if (notif_method_local_JSON == NULL) { + ogs_error("OpenAPI_reporting_information_convertToJSON() failed [notif_method]"); + goto end; + } + cJSON_AddItemToObject(item, "notifMethod", notif_method_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_reporting_information_convertToJSON() failed [notif_method]"); + goto end; + } + } + + if (reporting_information->is_max_report_nbr) { + if (cJSON_AddNumberToObject(item, "maxReportNbr", reporting_information->max_report_nbr) == NULL) { + ogs_error("OpenAPI_reporting_information_convertToJSON() failed [max_report_nbr]"); + goto end; + } + } + + if (reporting_information->mon_dur) { + if (cJSON_AddStringToObject(item, "monDur", reporting_information->mon_dur) == NULL) { + ogs_error("OpenAPI_reporting_information_convertToJSON() failed [mon_dur]"); + goto end; + } + } + + if (reporting_information->is_rep_period) { + if (cJSON_AddNumberToObject(item, "repPeriod", reporting_information->rep_period) == NULL) { + ogs_error("OpenAPI_reporting_information_convertToJSON() failed [rep_period]"); + goto end; + } + } + + if (reporting_information->is_samp_ratio) { + if (cJSON_AddNumberToObject(item, "sampRatio", reporting_information->samp_ratio) == NULL) { + ogs_error("OpenAPI_reporting_information_convertToJSON() failed [samp_ratio]"); + goto end; + } + } + + if (reporting_information->partition_criteria != OpenAPI_partitioning_criteria_NULL) { + cJSON *partition_criteriaList = cJSON_AddArrayToObject(item, "partitionCriteria"); + if (partition_criteriaList == NULL) { + ogs_error("OpenAPI_reporting_information_convertToJSON() failed [partition_criteria]"); + goto end; + } + OpenAPI_list_for_each(reporting_information->partition_criteria, node) { + if (cJSON_AddStringToObject(partition_criteriaList, "", OpenAPI_partitioning_criteria_ToString((intptr_t)node->data)) == NULL) { + ogs_error("OpenAPI_reporting_information_convertToJSON() failed [partition_criteria]"); + goto end; + } + } + } + + if (reporting_information->is_grp_rep_time) { + if (cJSON_AddNumberToObject(item, "grpRepTime", reporting_information->grp_rep_time) == NULL) { + ogs_error("OpenAPI_reporting_information_convertToJSON() failed [grp_rep_time]"); + goto end; + } + } + + if (reporting_information->notif_flag != OpenAPI_notification_flag_NULL) { + if (cJSON_AddStringToObject(item, "notifFlag", OpenAPI_notification_flag_ToString(reporting_information->notif_flag)) == NULL) { + ogs_error("OpenAPI_reporting_information_convertToJSON() failed [notif_flag]"); + goto end; + } + } + +end: + return item; +} + +OpenAPI_reporting_information_t *OpenAPI_reporting_information_parseFromJSON(cJSON *reporting_informationJSON) +{ + OpenAPI_reporting_information_t *reporting_information_local_var = NULL; + OpenAPI_lnode_t *node = NULL; + cJSON *imm_rep = NULL; + cJSON *notif_method = NULL; + OpenAPI_notification_method_1_t *notif_method_local_nonprim = NULL; + cJSON *max_report_nbr = NULL; + cJSON *mon_dur = NULL; + cJSON *rep_period = NULL; + cJSON *samp_ratio = NULL; + cJSON *partition_criteria = NULL; + OpenAPI_list_t *partition_criteriaList = NULL; + cJSON *grp_rep_time = NULL; + cJSON *notif_flag = NULL; + OpenAPI_notification_flag_e notif_flagVariable = 0; + imm_rep = cJSON_GetObjectItemCaseSensitive(reporting_informationJSON, "immRep"); + if (imm_rep) { + if (!cJSON_IsBool(imm_rep)) { + ogs_error("OpenAPI_reporting_information_parseFromJSON() failed [imm_rep]"); + goto end; + } + } + + notif_method = cJSON_GetObjectItemCaseSensitive(reporting_informationJSON, "notifMethod"); + if (notif_method) { + notif_method_local_nonprim = OpenAPI_notification_method_1_parseFromJSON(notif_method); + } + + max_report_nbr = cJSON_GetObjectItemCaseSensitive(reporting_informationJSON, "maxReportNbr"); + if (max_report_nbr) { + if (!cJSON_IsNumber(max_report_nbr)) { + ogs_error("OpenAPI_reporting_information_parseFromJSON() failed [max_report_nbr]"); + goto end; + } + } + + mon_dur = cJSON_GetObjectItemCaseSensitive(reporting_informationJSON, "monDur"); + if (mon_dur) { + if (!cJSON_IsString(mon_dur) && !cJSON_IsNull(mon_dur)) { + ogs_error("OpenAPI_reporting_information_parseFromJSON() failed [mon_dur]"); + goto end; + } + } + + rep_period = cJSON_GetObjectItemCaseSensitive(reporting_informationJSON, "repPeriod"); + if (rep_period) { + if (!cJSON_IsNumber(rep_period)) { + ogs_error("OpenAPI_reporting_information_parseFromJSON() failed [rep_period]"); + goto end; + } + } + + samp_ratio = cJSON_GetObjectItemCaseSensitive(reporting_informationJSON, "sampRatio"); + if (samp_ratio) { + if (!cJSON_IsNumber(samp_ratio)) { + ogs_error("OpenAPI_reporting_information_parseFromJSON() failed [samp_ratio]"); + goto end; + } + } + + partition_criteria = cJSON_GetObjectItemCaseSensitive(reporting_informationJSON, "partitionCriteria"); + if (partition_criteria) { + cJSON *partition_criteria_local = NULL; + if (!cJSON_IsArray(partition_criteria)) { + ogs_error("OpenAPI_reporting_information_parseFromJSON() failed [partition_criteria]"); + goto end; + } + + partition_criteriaList = OpenAPI_list_create(); + + cJSON_ArrayForEach(partition_criteria_local, partition_criteria) { + if (!cJSON_IsString(partition_criteria_local)) { + ogs_error("OpenAPI_reporting_information_parseFromJSON() failed [partition_criteria]"); + goto end; + } + OpenAPI_list_add(partition_criteriaList, (void *)OpenAPI_partitioning_criteria_FromString(partition_criteria_local->valuestring)); + } + } + + grp_rep_time = cJSON_GetObjectItemCaseSensitive(reporting_informationJSON, "grpRepTime"); + if (grp_rep_time) { + if (!cJSON_IsNumber(grp_rep_time)) { + ogs_error("OpenAPI_reporting_information_parseFromJSON() failed [grp_rep_time]"); + goto end; + } + } + + notif_flag = cJSON_GetObjectItemCaseSensitive(reporting_informationJSON, "notifFlag"); + if (notif_flag) { + if (!cJSON_IsString(notif_flag)) { + ogs_error("OpenAPI_reporting_information_parseFromJSON() failed [notif_flag]"); + goto end; + } + notif_flagVariable = OpenAPI_notification_flag_FromString(notif_flag->valuestring); + } + + reporting_information_local_var = OpenAPI_reporting_information_create ( + imm_rep ? true : false, + imm_rep ? imm_rep->valueint : 0, + notif_method ? notif_method_local_nonprim : NULL, + max_report_nbr ? true : false, + max_report_nbr ? max_report_nbr->valuedouble : 0, + mon_dur && !cJSON_IsNull(mon_dur) ? ogs_strdup(mon_dur->valuestring) : NULL, + rep_period ? true : false, + rep_period ? rep_period->valuedouble : 0, + samp_ratio ? true : false, + samp_ratio ? samp_ratio->valuedouble : 0, + partition_criteria ? partition_criteriaList : NULL, + grp_rep_time ? true : false, + grp_rep_time ? grp_rep_time->valuedouble : 0, + notif_flag ? notif_flagVariable : 0 + ); + + return reporting_information_local_var; +end: + if (notif_method_local_nonprim) { + OpenAPI_notification_method_1_free(notif_method_local_nonprim); + notif_method_local_nonprim = NULL; + } + if (partition_criteriaList) { + OpenAPI_list_free(partition_criteriaList); + partition_criteriaList = NULL; + } + return NULL; +} + +OpenAPI_reporting_information_t *OpenAPI_reporting_information_copy(OpenAPI_reporting_information_t *dst, OpenAPI_reporting_information_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_reporting_information_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_reporting_information_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_reporting_information_free(dst); + dst = OpenAPI_reporting_information_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/reporting_information.h b/lib/sbi/openapi/model/reporting_information.h new file mode 100644 index 000000000..8d300f686 --- /dev/null +++ b/lib/sbi/openapi/model/reporting_information.h @@ -0,0 +1,67 @@ +/* + * reporting_information.h + * + * Represents the type of reporting that the subscription requires. + */ + +#ifndef _OpenAPI_reporting_information_H_ +#define _OpenAPI_reporting_information_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "notification_flag.h" +#include "notification_method_1.h" +#include "partitioning_criteria.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_reporting_information_s OpenAPI_reporting_information_t; +typedef struct OpenAPI_reporting_information_s { + bool is_imm_rep; + int imm_rep; + struct OpenAPI_notification_method_1_s *notif_method; + bool is_max_report_nbr; + int max_report_nbr; + char *mon_dur; + bool is_rep_period; + int rep_period; + bool is_samp_ratio; + int samp_ratio; + OpenAPI_list_t *partition_criteria; + bool is_grp_rep_time; + int grp_rep_time; + OpenAPI_notification_flag_e notif_flag; +} OpenAPI_reporting_information_t; + +OpenAPI_reporting_information_t *OpenAPI_reporting_information_create( + bool is_imm_rep, + int imm_rep, + OpenAPI_notification_method_1_t *notif_method, + bool is_max_report_nbr, + int max_report_nbr, + char *mon_dur, + bool is_rep_period, + int rep_period, + bool is_samp_ratio, + int samp_ratio, + OpenAPI_list_t *partition_criteria, + bool is_grp_rep_time, + int grp_rep_time, + OpenAPI_notification_flag_e notif_flag +); +void OpenAPI_reporting_information_free(OpenAPI_reporting_information_t *reporting_information); +OpenAPI_reporting_information_t *OpenAPI_reporting_information_parseFromJSON(cJSON *reporting_informationJSON); +cJSON *OpenAPI_reporting_information_convertToJSON(OpenAPI_reporting_information_t *reporting_information); +OpenAPI_reporting_information_t *OpenAPI_reporting_information_copy(OpenAPI_reporting_information_t *dst, OpenAPI_reporting_information_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_reporting_information_H_ */ + diff --git a/lib/sbi/openapi/model/reporting_options.c b/lib/sbi/openapi/model/reporting_options.c index f995e37b9..daf22a421 100644 --- a/lib/sbi/openapi/model/reporting_options.c +++ b/lib/sbi/openapi/model/reporting_options.c @@ -14,7 +14,8 @@ OpenAPI_reporting_options_t *OpenAPI_reporting_options_create( bool is_guard_time, int guard_time, bool is_report_period, - int report_period + int report_period, + OpenAPI_notification_flag_e notif_flag ) { OpenAPI_reporting_options_t *reporting_options_local_var = ogs_malloc(sizeof(OpenAPI_reporting_options_t)); @@ -30,6 +31,7 @@ OpenAPI_reporting_options_t *OpenAPI_reporting_options_create( reporting_options_local_var->guard_time = guard_time; reporting_options_local_var->is_report_period = is_report_period; reporting_options_local_var->report_period = report_period; + reporting_options_local_var->notif_flag = notif_flag; return reporting_options_local_var; } @@ -111,6 +113,13 @@ cJSON *OpenAPI_reporting_options_convertToJSON(OpenAPI_reporting_options_t *repo } } + if (reporting_options->notif_flag != OpenAPI_notification_flag_NULL) { + if (cJSON_AddStringToObject(item, "notifFlag", OpenAPI_notification_flag_ToString(reporting_options->notif_flag)) == NULL) { + ogs_error("OpenAPI_reporting_options_convertToJSON() failed [notif_flag]"); + goto end; + } + } + end: return item; } @@ -126,6 +135,8 @@ OpenAPI_reporting_options_t *OpenAPI_reporting_options_parseFromJSON(cJSON *repo cJSON *sampling_ratio = NULL; cJSON *guard_time = NULL; cJSON *report_period = NULL; + cJSON *notif_flag = NULL; + OpenAPI_notification_flag_e notif_flagVariable = 0; report_mode = cJSON_GetObjectItemCaseSensitive(reporting_optionsJSON, "reportMode"); if (report_mode) { report_mode_local_nonprim = OpenAPI_event_report_mode_parseFromJSON(report_mode); @@ -171,6 +182,15 @@ OpenAPI_reporting_options_t *OpenAPI_reporting_options_parseFromJSON(cJSON *repo } } + notif_flag = cJSON_GetObjectItemCaseSensitive(reporting_optionsJSON, "notifFlag"); + if (notif_flag) { + if (!cJSON_IsString(notif_flag)) { + ogs_error("OpenAPI_reporting_options_parseFromJSON() failed [notif_flag]"); + goto end; + } + notif_flagVariable = OpenAPI_notification_flag_FromString(notif_flag->valuestring); + } + reporting_options_local_var = OpenAPI_reporting_options_create ( report_mode ? report_mode_local_nonprim : NULL, max_num_of_reports ? true : false, @@ -181,7 +201,8 @@ OpenAPI_reporting_options_t *OpenAPI_reporting_options_parseFromJSON(cJSON *repo guard_time ? true : false, guard_time ? guard_time->valuedouble : 0, report_period ? true : false, - report_period ? report_period->valuedouble : 0 + report_period ? report_period->valuedouble : 0, + notif_flag ? notif_flagVariable : 0 ); return reporting_options_local_var; diff --git a/lib/sbi/openapi/model/reporting_options.h b/lib/sbi/openapi/model/reporting_options.h index c5da8cc9f..dfb5c4894 100644 --- a/lib/sbi/openapi/model/reporting_options.h +++ b/lib/sbi/openapi/model/reporting_options.h @@ -13,6 +13,7 @@ #include "../include/keyValuePair.h" #include "../include/binary.h" #include "event_report_mode.h" +#include "notification_flag.h" #ifdef __cplusplus extern "C" { @@ -30,6 +31,7 @@ typedef struct OpenAPI_reporting_options_s { int guard_time; bool is_report_period; int report_period; + OpenAPI_notification_flag_e notif_flag; } OpenAPI_reporting_options_t; OpenAPI_reporting_options_t *OpenAPI_reporting_options_create( @@ -42,7 +44,8 @@ OpenAPI_reporting_options_t *OpenAPI_reporting_options_create( bool is_guard_time, int guard_time, bool is_report_period, - int report_period + int report_period, + OpenAPI_notification_flag_e notif_flag ); void OpenAPI_reporting_options_free(OpenAPI_reporting_options_t *reporting_options); OpenAPI_reporting_options_t *OpenAPI_reporting_options_parseFromJSON(cJSON *reporting_optionsJSON); diff --git a/lib/sbi/openapi/model/reporting_options_1.c b/lib/sbi/openapi/model/reporting_options_1.c new file mode 100644 index 000000000..1d8361e5d --- /dev/null +++ b/lib/sbi/openapi/model/reporting_options_1.c @@ -0,0 +1,250 @@ + +#include +#include +#include +#include "reporting_options_1.h" + +OpenAPI_reporting_options_1_t *OpenAPI_reporting_options_1_create( + OpenAPI_event_report_mode_t *report_mode, + bool is_max_num_of_reports, + int max_num_of_reports, + char *expiry, + bool is_sampling_ratio, + int sampling_ratio, + bool is_guard_time, + int guard_time, + bool is_report_period, + int report_period, + OpenAPI_notification_flag_e notif_flag +) +{ + OpenAPI_reporting_options_1_t *reporting_options_1_local_var = ogs_malloc(sizeof(OpenAPI_reporting_options_1_t)); + ogs_assert(reporting_options_1_local_var); + + reporting_options_1_local_var->report_mode = report_mode; + reporting_options_1_local_var->is_max_num_of_reports = is_max_num_of_reports; + reporting_options_1_local_var->max_num_of_reports = max_num_of_reports; + reporting_options_1_local_var->expiry = expiry; + reporting_options_1_local_var->is_sampling_ratio = is_sampling_ratio; + reporting_options_1_local_var->sampling_ratio = sampling_ratio; + reporting_options_1_local_var->is_guard_time = is_guard_time; + reporting_options_1_local_var->guard_time = guard_time; + reporting_options_1_local_var->is_report_period = is_report_period; + reporting_options_1_local_var->report_period = report_period; + reporting_options_1_local_var->notif_flag = notif_flag; + + return reporting_options_1_local_var; +} + +void OpenAPI_reporting_options_1_free(OpenAPI_reporting_options_1_t *reporting_options_1) +{ + OpenAPI_lnode_t *node = NULL; + + if (NULL == reporting_options_1) { + return; + } + if (reporting_options_1->report_mode) { + OpenAPI_event_report_mode_free(reporting_options_1->report_mode); + reporting_options_1->report_mode = NULL; + } + if (reporting_options_1->expiry) { + ogs_free(reporting_options_1->expiry); + reporting_options_1->expiry = NULL; + } + ogs_free(reporting_options_1); +} + +cJSON *OpenAPI_reporting_options_1_convertToJSON(OpenAPI_reporting_options_1_t *reporting_options_1) +{ + cJSON *item = NULL; + OpenAPI_lnode_t *node = NULL; + + if (reporting_options_1 == NULL) { + ogs_error("OpenAPI_reporting_options_1_convertToJSON() failed [ReportingOptions_1]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (reporting_options_1->report_mode) { + cJSON *report_mode_local_JSON = OpenAPI_event_report_mode_convertToJSON(reporting_options_1->report_mode); + if (report_mode_local_JSON == NULL) { + ogs_error("OpenAPI_reporting_options_1_convertToJSON() failed [report_mode]"); + goto end; + } + cJSON_AddItemToObject(item, "reportMode", report_mode_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_reporting_options_1_convertToJSON() failed [report_mode]"); + goto end; + } + } + + if (reporting_options_1->is_max_num_of_reports) { + if (cJSON_AddNumberToObject(item, "maxNumOfReports", reporting_options_1->max_num_of_reports) == NULL) { + ogs_error("OpenAPI_reporting_options_1_convertToJSON() failed [max_num_of_reports]"); + goto end; + } + } + + if (reporting_options_1->expiry) { + if (cJSON_AddStringToObject(item, "expiry", reporting_options_1->expiry) == NULL) { + ogs_error("OpenAPI_reporting_options_1_convertToJSON() failed [expiry]"); + goto end; + } + } + + if (reporting_options_1->is_sampling_ratio) { + if (cJSON_AddNumberToObject(item, "samplingRatio", reporting_options_1->sampling_ratio) == NULL) { + ogs_error("OpenAPI_reporting_options_1_convertToJSON() failed [sampling_ratio]"); + goto end; + } + } + + if (reporting_options_1->is_guard_time) { + if (cJSON_AddNumberToObject(item, "guardTime", reporting_options_1->guard_time) == NULL) { + ogs_error("OpenAPI_reporting_options_1_convertToJSON() failed [guard_time]"); + goto end; + } + } + + if (reporting_options_1->is_report_period) { + if (cJSON_AddNumberToObject(item, "reportPeriod", reporting_options_1->report_period) == NULL) { + ogs_error("OpenAPI_reporting_options_1_convertToJSON() failed [report_period]"); + goto end; + } + } + + if (reporting_options_1->notif_flag != OpenAPI_notification_flag_NULL) { + if (cJSON_AddStringToObject(item, "notifFlag", OpenAPI_notification_flag_ToString(reporting_options_1->notif_flag)) == NULL) { + ogs_error("OpenAPI_reporting_options_1_convertToJSON() failed [notif_flag]"); + goto end; + } + } + +end: + return item; +} + +OpenAPI_reporting_options_1_t *OpenAPI_reporting_options_1_parseFromJSON(cJSON *reporting_options_1JSON) +{ + OpenAPI_reporting_options_1_t *reporting_options_1_local_var = NULL; + OpenAPI_lnode_t *node = NULL; + cJSON *report_mode = NULL; + OpenAPI_event_report_mode_t *report_mode_local_nonprim = NULL; + cJSON *max_num_of_reports = NULL; + cJSON *expiry = NULL; + cJSON *sampling_ratio = NULL; + cJSON *guard_time = NULL; + cJSON *report_period = NULL; + cJSON *notif_flag = NULL; + OpenAPI_notification_flag_e notif_flagVariable = 0; + report_mode = cJSON_GetObjectItemCaseSensitive(reporting_options_1JSON, "reportMode"); + if (report_mode) { + report_mode_local_nonprim = OpenAPI_event_report_mode_parseFromJSON(report_mode); + } + + max_num_of_reports = cJSON_GetObjectItemCaseSensitive(reporting_options_1JSON, "maxNumOfReports"); + if (max_num_of_reports) { + if (!cJSON_IsNumber(max_num_of_reports)) { + ogs_error("OpenAPI_reporting_options_1_parseFromJSON() failed [max_num_of_reports]"); + goto end; + } + } + + expiry = cJSON_GetObjectItemCaseSensitive(reporting_options_1JSON, "expiry"); + if (expiry) { + if (!cJSON_IsString(expiry) && !cJSON_IsNull(expiry)) { + ogs_error("OpenAPI_reporting_options_1_parseFromJSON() failed [expiry]"); + goto end; + } + } + + sampling_ratio = cJSON_GetObjectItemCaseSensitive(reporting_options_1JSON, "samplingRatio"); + if (sampling_ratio) { + if (!cJSON_IsNumber(sampling_ratio)) { + ogs_error("OpenAPI_reporting_options_1_parseFromJSON() failed [sampling_ratio]"); + goto end; + } + } + + guard_time = cJSON_GetObjectItemCaseSensitive(reporting_options_1JSON, "guardTime"); + if (guard_time) { + if (!cJSON_IsNumber(guard_time)) { + ogs_error("OpenAPI_reporting_options_1_parseFromJSON() failed [guard_time]"); + goto end; + } + } + + report_period = cJSON_GetObjectItemCaseSensitive(reporting_options_1JSON, "reportPeriod"); + if (report_period) { + if (!cJSON_IsNumber(report_period)) { + ogs_error("OpenAPI_reporting_options_1_parseFromJSON() failed [report_period]"); + goto end; + } + } + + notif_flag = cJSON_GetObjectItemCaseSensitive(reporting_options_1JSON, "notifFlag"); + if (notif_flag) { + if (!cJSON_IsString(notif_flag)) { + ogs_error("OpenAPI_reporting_options_1_parseFromJSON() failed [notif_flag]"); + goto end; + } + notif_flagVariable = OpenAPI_notification_flag_FromString(notif_flag->valuestring); + } + + reporting_options_1_local_var = OpenAPI_reporting_options_1_create ( + report_mode ? report_mode_local_nonprim : NULL, + max_num_of_reports ? true : false, + max_num_of_reports ? max_num_of_reports->valuedouble : 0, + expiry && !cJSON_IsNull(expiry) ? ogs_strdup(expiry->valuestring) : NULL, + sampling_ratio ? true : false, + sampling_ratio ? sampling_ratio->valuedouble : 0, + guard_time ? true : false, + guard_time ? guard_time->valuedouble : 0, + report_period ? true : false, + report_period ? report_period->valuedouble : 0, + notif_flag ? notif_flagVariable : 0 + ); + + return reporting_options_1_local_var; +end: + if (report_mode_local_nonprim) { + OpenAPI_event_report_mode_free(report_mode_local_nonprim); + report_mode_local_nonprim = NULL; + } + return NULL; +} + +OpenAPI_reporting_options_1_t *OpenAPI_reporting_options_1_copy(OpenAPI_reporting_options_1_t *dst, OpenAPI_reporting_options_1_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_reporting_options_1_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_reporting_options_1_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_reporting_options_1_free(dst); + dst = OpenAPI_reporting_options_1_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/reporting_options_1.h b/lib/sbi/openapi/model/reporting_options_1.h new file mode 100644 index 000000000..c0475a9d0 --- /dev/null +++ b/lib/sbi/openapi/model/reporting_options_1.h @@ -0,0 +1,60 @@ +/* + * reporting_options_1.h + * + * + */ + +#ifndef _OpenAPI_reporting_options_1_H_ +#define _OpenAPI_reporting_options_1_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "event_report_mode.h" +#include "notification_flag.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_reporting_options_1_s OpenAPI_reporting_options_1_t; +typedef struct OpenAPI_reporting_options_1_s { + struct OpenAPI_event_report_mode_s *report_mode; + bool is_max_num_of_reports; + int max_num_of_reports; + char *expiry; + bool is_sampling_ratio; + int sampling_ratio; + bool is_guard_time; + int guard_time; + bool is_report_period; + int report_period; + OpenAPI_notification_flag_e notif_flag; +} OpenAPI_reporting_options_1_t; + +OpenAPI_reporting_options_1_t *OpenAPI_reporting_options_1_create( + OpenAPI_event_report_mode_t *report_mode, + bool is_max_num_of_reports, + int max_num_of_reports, + char *expiry, + bool is_sampling_ratio, + int sampling_ratio, + bool is_guard_time, + int guard_time, + bool is_report_period, + int report_period, + OpenAPI_notification_flag_e notif_flag +); +void OpenAPI_reporting_options_1_free(OpenAPI_reporting_options_1_t *reporting_options_1); +OpenAPI_reporting_options_1_t *OpenAPI_reporting_options_1_parseFromJSON(cJSON *reporting_options_1JSON); +cJSON *OpenAPI_reporting_options_1_convertToJSON(OpenAPI_reporting_options_1_t *reporting_options_1); +OpenAPI_reporting_options_1_t *OpenAPI_reporting_options_1_copy(OpenAPI_reporting_options_1_t *dst, OpenAPI_reporting_options_1_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_reporting_options_1_H_ */ + diff --git a/lib/sbi/openapi/model/request_trigger.c b/lib/sbi/openapi/model/request_trigger.c index 67e5fbf2e..aba2c87de 100644 --- a/lib/sbi/openapi/model/request_trigger.c +++ b/lib/sbi/openapi/model/request_trigger.c @@ -6,7 +6,7 @@ char* OpenAPI_request_trigger_ToString(OpenAPI_request_trigger_e request_trigger) { - const char *request_triggerArray[] = { "NULL", "LOC_CH", "PRA_CH", "SERV_AREA_CH", "RFSP_CH", "ALLOWED_NSSAI_CH", "UE_AMBR_CH", "SMF_SELECT_CH", "ACCESS_TYPE_CH" }; + const char *request_triggerArray[] = { "NULL", "LOC_CH", "PRA_CH", "SERV_AREA_CH", "RFSP_CH", "ALLOWED_NSSAI_CH", "UE_AMBR_CH", "UE_SLICE_MBR_CH", "SMF_SELECT_CH", "ACCESS_TYPE_CH", "NWDAF_DATA_CH", "TARGET_NSSAI" }; size_t sizeofArray = sizeof(request_triggerArray) / sizeof(request_triggerArray[0]); if (request_trigger < sizeofArray) return (char *)request_triggerArray[request_trigger]; @@ -17,7 +17,7 @@ char* OpenAPI_request_trigger_ToString(OpenAPI_request_trigger_e request_trigger OpenAPI_request_trigger_e OpenAPI_request_trigger_FromString(char* request_trigger) { int stringToReturn = 0; - const char *request_triggerArray[] = { "NULL", "LOC_CH", "PRA_CH", "SERV_AREA_CH", "RFSP_CH", "ALLOWED_NSSAI_CH", "UE_AMBR_CH", "SMF_SELECT_CH", "ACCESS_TYPE_CH" }; + const char *request_triggerArray[] = { "NULL", "LOC_CH", "PRA_CH", "SERV_AREA_CH", "RFSP_CH", "ALLOWED_NSSAI_CH", "UE_AMBR_CH", "UE_SLICE_MBR_CH", "SMF_SELECT_CH", "ACCESS_TYPE_CH", "NWDAF_DATA_CH", "TARGET_NSSAI" }; size_t sizeofArray = sizeof(request_triggerArray) / sizeof(request_triggerArray[0]); while (stringToReturn < sizeofArray) { if (strcmp(request_trigger, request_triggerArray[stringToReturn]) == 0) { diff --git a/lib/sbi/openapi/model/request_trigger.h b/lib/sbi/openapi/model/request_trigger.h index 7caab0976..491d2203c 100644 --- a/lib/sbi/openapi/model/request_trigger.h +++ b/lib/sbi/openapi/model/request_trigger.h @@ -17,7 +17,7 @@ extern "C" { #endif -typedef enum { OpenAPI_request_trigger_NULL = 0, OpenAPI_request_trigger_LOC_CH, OpenAPI_request_trigger_PRA_CH, OpenAPI_request_trigger_SERV_AREA_CH, OpenAPI_request_trigger_RFSP_CH, OpenAPI_request_trigger_ALLOWED_NSSAI_CH, OpenAPI_request_trigger_UE_AMBR_CH, OpenAPI_request_trigger_SMF_SELECT_CH, OpenAPI_request_trigger_ACCESS_TYPE_CH } OpenAPI_request_trigger_e; +typedef enum { OpenAPI_request_trigger_NULL = 0, OpenAPI_request_trigger_LOC_CH, OpenAPI_request_trigger_PRA_CH, OpenAPI_request_trigger_SERV_AREA_CH, OpenAPI_request_trigger_RFSP_CH, OpenAPI_request_trigger_ALLOWED_NSSAI_CH, OpenAPI_request_trigger_UE_AMBR_CH, OpenAPI_request_trigger_UE_SLICE_MBR_CH, OpenAPI_request_trigger_SMF_SELECT_CH, OpenAPI_request_trigger_ACCESS_TYPE_CH, OpenAPI_request_trigger_NWDAF_DATA_CH, OpenAPI_request_trigger_TARGET_NSSAI } OpenAPI_request_trigger_e; char* OpenAPI_request_trigger_ToString(OpenAPI_request_trigger_e request_trigger); diff --git a/lib/sbi/openapi/model/requested_qos.h b/lib/sbi/openapi/model/requested_qos.h index 75dc613b0..ebaab3cab 100644 --- a/lib/sbi/openapi/model/requested_qos.h +++ b/lib/sbi/openapi/model/requested_qos.h @@ -1,7 +1,7 @@ /* * requested_qos.h * - * + * Contains the QoS information requested by the UE. */ #ifndef _OpenAPI_requested_qos_H_ diff --git a/lib/sbi/openapi/model/requested_rule_data.h b/lib/sbi/openapi/model/requested_rule_data.h index 5d67de625..206859337 100644 --- a/lib/sbi/openapi/model/requested_rule_data.h +++ b/lib/sbi/openapi/model/requested_rule_data.h @@ -1,7 +1,7 @@ /* * requested_rule_data.h * - * + * Contains rule data requested by the PCF to receive information associated with PCC rule(s). */ #ifndef _OpenAPI_requested_rule_data_H_ diff --git a/lib/sbi/openapi/model/requested_usage_data.h b/lib/sbi/openapi/model/requested_usage_data.h index b99a0fef8..8f5b46093 100644 --- a/lib/sbi/openapi/model/requested_usage_data.h +++ b/lib/sbi/openapi/model/requested_usage_data.h @@ -1,7 +1,7 @@ /* * requested_usage_data.h * - * + * Contains usage data requested by the PCF requesting usage reports for the corresponding usage monitoring data instances. */ #ifndef _OpenAPI_requested_usage_data_H_ diff --git a/lib/sbi/openapi/model/resource_item.h b/lib/sbi/openapi/model/resource_item.h index ad2ea06fd..1c9833225 100644 --- a/lib/sbi/openapi/model/resource_item.h +++ b/lib/sbi/openapi/model/resource_item.h @@ -1,7 +1,7 @@ /* * resource_item.h * - * Identifies a subscription to policy data change notification when the change occurs in a fragment (subset of resource data) of a given resource. + * Identifies a subscription to policy data change notification when the change occurs in a fragment (subset of resource data) of a given resource. */ #ifndef _OpenAPI_resource_item_H_ diff --git a/lib/sbi/openapi/model/resource_usage.c b/lib/sbi/openapi/model/resource_usage.c new file mode 100644 index 000000000..7aeeff0df --- /dev/null +++ b/lib/sbi/openapi/model/resource_usage.c @@ -0,0 +1,153 @@ + +#include +#include +#include +#include "resource_usage.h" + +OpenAPI_resource_usage_t *OpenAPI_resource_usage_create( + bool is_cpu_usage, + int cpu_usage, + bool is_memory_usage, + int memory_usage, + bool is_storage_usage, + int storage_usage +) +{ + OpenAPI_resource_usage_t *resource_usage_local_var = ogs_malloc(sizeof(OpenAPI_resource_usage_t)); + ogs_assert(resource_usage_local_var); + + resource_usage_local_var->is_cpu_usage = is_cpu_usage; + resource_usage_local_var->cpu_usage = cpu_usage; + resource_usage_local_var->is_memory_usage = is_memory_usage; + resource_usage_local_var->memory_usage = memory_usage; + resource_usage_local_var->is_storage_usage = is_storage_usage; + resource_usage_local_var->storage_usage = storage_usage; + + return resource_usage_local_var; +} + +void OpenAPI_resource_usage_free(OpenAPI_resource_usage_t *resource_usage) +{ + OpenAPI_lnode_t *node = NULL; + + if (NULL == resource_usage) { + return; + } + ogs_free(resource_usage); +} + +cJSON *OpenAPI_resource_usage_convertToJSON(OpenAPI_resource_usage_t *resource_usage) +{ + cJSON *item = NULL; + OpenAPI_lnode_t *node = NULL; + + if (resource_usage == NULL) { + ogs_error("OpenAPI_resource_usage_convertToJSON() failed [ResourceUsage]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (resource_usage->is_cpu_usage) { + if (cJSON_AddNumberToObject(item, "cpuUsage", resource_usage->cpu_usage) == NULL) { + ogs_error("OpenAPI_resource_usage_convertToJSON() failed [cpu_usage]"); + goto end; + } + } + + if (resource_usage->is_memory_usage) { + if (cJSON_AddNumberToObject(item, "memoryUsage", resource_usage->memory_usage) == NULL) { + ogs_error("OpenAPI_resource_usage_convertToJSON() failed [memory_usage]"); + goto end; + } + } + + if (resource_usage->is_storage_usage) { + if (cJSON_AddNumberToObject(item, "storageUsage", resource_usage->storage_usage) == NULL) { + ogs_error("OpenAPI_resource_usage_convertToJSON() failed [storage_usage]"); + goto end; + } + } + +end: + return item; +} + +OpenAPI_resource_usage_t *OpenAPI_resource_usage_parseFromJSON(cJSON *resource_usageJSON) +{ + OpenAPI_resource_usage_t *resource_usage_local_var = NULL; + OpenAPI_lnode_t *node = NULL; + cJSON *cpu_usage = NULL; + cJSON *memory_usage = NULL; + cJSON *storage_usage = NULL; + cpu_usage = cJSON_GetObjectItemCaseSensitive(resource_usageJSON, "cpuUsage"); + if (cpu_usage) { + if (!cJSON_IsNumber(cpu_usage)) { + ogs_error("OpenAPI_resource_usage_parseFromJSON() failed [cpu_usage]"); + goto end; + } + } + + memory_usage = cJSON_GetObjectItemCaseSensitive(resource_usageJSON, "memoryUsage"); + if (memory_usage) { + if (!cJSON_IsNumber(memory_usage)) { + ogs_error("OpenAPI_resource_usage_parseFromJSON() failed [memory_usage]"); + goto end; + } + } + + storage_usage = cJSON_GetObjectItemCaseSensitive(resource_usageJSON, "storageUsage"); + if (storage_usage) { + if (!cJSON_IsNumber(storage_usage)) { + ogs_error("OpenAPI_resource_usage_parseFromJSON() failed [storage_usage]"); + goto end; + } + } + + resource_usage_local_var = OpenAPI_resource_usage_create ( + cpu_usage ? true : false, + cpu_usage ? cpu_usage->valuedouble : 0, + memory_usage ? true : false, + memory_usage ? memory_usage->valuedouble : 0, + storage_usage ? true : false, + storage_usage ? storage_usage->valuedouble : 0 + ); + + return resource_usage_local_var; +end: + return NULL; +} + +OpenAPI_resource_usage_t *OpenAPI_resource_usage_copy(OpenAPI_resource_usage_t *dst, OpenAPI_resource_usage_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_resource_usage_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_resource_usage_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_resource_usage_free(dst); + dst = OpenAPI_resource_usage_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/resource_usage.h b/lib/sbi/openapi/model/resource_usage.h new file mode 100644 index 000000000..8390dc4d6 --- /dev/null +++ b/lib/sbi/openapi/model/resource_usage.h @@ -0,0 +1,48 @@ +/* + * resource_usage.h + * + * The current usage of the virtual resources assigned to the NF instances belonging to a particular network slice instance. + */ + +#ifndef _OpenAPI_resource_usage_H_ +#define _OpenAPI_resource_usage_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_resource_usage_s OpenAPI_resource_usage_t; +typedef struct OpenAPI_resource_usage_s { + bool is_cpu_usage; + int cpu_usage; + bool is_memory_usage; + int memory_usage; + bool is_storage_usage; + int storage_usage; +} OpenAPI_resource_usage_t; + +OpenAPI_resource_usage_t *OpenAPI_resource_usage_create( + bool is_cpu_usage, + int cpu_usage, + bool is_memory_usage, + int memory_usage, + bool is_storage_usage, + int storage_usage +); +void OpenAPI_resource_usage_free(OpenAPI_resource_usage_t *resource_usage); +OpenAPI_resource_usage_t *OpenAPI_resource_usage_parseFromJSON(cJSON *resource_usageJSON); +cJSON *OpenAPI_resource_usage_convertToJSON(OpenAPI_resource_usage_t *resource_usage); +OpenAPI_resource_usage_t *OpenAPI_resource_usage_copy(OpenAPI_resource_usage_t *dst, OpenAPI_resource_usage_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_resource_usage_H_ */ + diff --git a/lib/sbi/openapi/model/resources_allocation_info.h b/lib/sbi/openapi/model/resources_allocation_info.h index 878a0e330..75b844785 100644 --- a/lib/sbi/openapi/model/resources_allocation_info.h +++ b/lib/sbi/openapi/model/resources_allocation_info.h @@ -1,7 +1,7 @@ /* * resources_allocation_info.h * - * describes the status of the PCC rule(s) related to certain media components. + * Describes the status of the PCC rule(s) related to certain media components. */ #ifndef _OpenAPI_resources_allocation_info_H_ diff --git a/lib/sbi/openapi/model/resynchronization_info_1.c b/lib/sbi/openapi/model/resynchronization_info_1.c new file mode 100644 index 000000000..405c6f37e --- /dev/null +++ b/lib/sbi/openapi/model/resynchronization_info_1.c @@ -0,0 +1,141 @@ + +#include +#include +#include +#include "resynchronization_info_1.h" + +OpenAPI_resynchronization_info_1_t *OpenAPI_resynchronization_info_1_create( + char *rand, + char *auts +) +{ + OpenAPI_resynchronization_info_1_t *resynchronization_info_1_local_var = ogs_malloc(sizeof(OpenAPI_resynchronization_info_1_t)); + ogs_assert(resynchronization_info_1_local_var); + + resynchronization_info_1_local_var->rand = rand; + resynchronization_info_1_local_var->auts = auts; + + return resynchronization_info_1_local_var; +} + +void OpenAPI_resynchronization_info_1_free(OpenAPI_resynchronization_info_1_t *resynchronization_info_1) +{ + OpenAPI_lnode_t *node = NULL; + + if (NULL == resynchronization_info_1) { + return; + } + if (resynchronization_info_1->rand) { + ogs_free(resynchronization_info_1->rand); + resynchronization_info_1->rand = NULL; + } + if (resynchronization_info_1->auts) { + ogs_free(resynchronization_info_1->auts); + resynchronization_info_1->auts = NULL; + } + ogs_free(resynchronization_info_1); +} + +cJSON *OpenAPI_resynchronization_info_1_convertToJSON(OpenAPI_resynchronization_info_1_t *resynchronization_info_1) +{ + cJSON *item = NULL; + OpenAPI_lnode_t *node = NULL; + + if (resynchronization_info_1 == NULL) { + ogs_error("OpenAPI_resynchronization_info_1_convertToJSON() failed [ResynchronizationInfo_1]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (!resynchronization_info_1->rand) { + ogs_error("OpenAPI_resynchronization_info_1_convertToJSON() failed [rand]"); + return NULL; + } + if (cJSON_AddStringToObject(item, "rand", resynchronization_info_1->rand) == NULL) { + ogs_error("OpenAPI_resynchronization_info_1_convertToJSON() failed [rand]"); + goto end; + } + + if (!resynchronization_info_1->auts) { + ogs_error("OpenAPI_resynchronization_info_1_convertToJSON() failed [auts]"); + return NULL; + } + if (cJSON_AddStringToObject(item, "auts", resynchronization_info_1->auts) == NULL) { + ogs_error("OpenAPI_resynchronization_info_1_convertToJSON() failed [auts]"); + goto end; + } + +end: + return item; +} + +OpenAPI_resynchronization_info_1_t *OpenAPI_resynchronization_info_1_parseFromJSON(cJSON *resynchronization_info_1JSON) +{ + OpenAPI_resynchronization_info_1_t *resynchronization_info_1_local_var = NULL; + OpenAPI_lnode_t *node = NULL; + cJSON *rand = NULL; + cJSON *auts = NULL; + rand = cJSON_GetObjectItemCaseSensitive(resynchronization_info_1JSON, "rand"); + if (!rand) { + ogs_error("OpenAPI_resynchronization_info_1_parseFromJSON() failed [rand]"); + goto end; + } + if (!cJSON_IsString(rand)) { + ogs_error("OpenAPI_resynchronization_info_1_parseFromJSON() failed [rand]"); + goto end; + } + + auts = cJSON_GetObjectItemCaseSensitive(resynchronization_info_1JSON, "auts"); + if (!auts) { + ogs_error("OpenAPI_resynchronization_info_1_parseFromJSON() failed [auts]"); + goto end; + } + if (!cJSON_IsString(auts)) { + ogs_error("OpenAPI_resynchronization_info_1_parseFromJSON() failed [auts]"); + goto end; + } + + resynchronization_info_1_local_var = OpenAPI_resynchronization_info_1_create ( + ogs_strdup(rand->valuestring), + ogs_strdup(auts->valuestring) + ); + + return resynchronization_info_1_local_var; +end: + return NULL; +} + +OpenAPI_resynchronization_info_1_t *OpenAPI_resynchronization_info_1_copy(OpenAPI_resynchronization_info_1_t *dst, OpenAPI_resynchronization_info_1_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_resynchronization_info_1_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_resynchronization_info_1_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_resynchronization_info_1_free(dst); + dst = OpenAPI_resynchronization_info_1_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/resynchronization_info_1.h b/lib/sbi/openapi/model/resynchronization_info_1.h new file mode 100644 index 000000000..dc9996d4c --- /dev/null +++ b/lib/sbi/openapi/model/resynchronization_info_1.h @@ -0,0 +1,40 @@ +/* + * resynchronization_info_1.h + * + * Contains RAND and AUTS + */ + +#ifndef _OpenAPI_resynchronization_info_1_H_ +#define _OpenAPI_resynchronization_info_1_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_resynchronization_info_1_s OpenAPI_resynchronization_info_1_t; +typedef struct OpenAPI_resynchronization_info_1_s { + char *rand; + char *auts; +} OpenAPI_resynchronization_info_1_t; + +OpenAPI_resynchronization_info_1_t *OpenAPI_resynchronization_info_1_create( + char *rand, + char *auts +); +void OpenAPI_resynchronization_info_1_free(OpenAPI_resynchronization_info_1_t *resynchronization_info_1); +OpenAPI_resynchronization_info_1_t *OpenAPI_resynchronization_info_1_parseFromJSON(cJSON *resynchronization_info_1JSON); +cJSON *OpenAPI_resynchronization_info_1_convertToJSON(OpenAPI_resynchronization_info_1_t *resynchronization_info_1); +OpenAPI_resynchronization_info_1_t *OpenAPI_resynchronization_info_1_copy(OpenAPI_resynchronization_info_1_t *dst, OpenAPI_resynchronization_info_1_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_resynchronization_info_1_H_ */ + diff --git a/lib/sbi/openapi/model/retainability_threshold.c b/lib/sbi/openapi/model/retainability_threshold.c new file mode 100644 index 000000000..9bfbd59d2 --- /dev/null +++ b/lib/sbi/openapi/model/retainability_threshold.c @@ -0,0 +1,162 @@ + +#include +#include +#include +#include "retainability_threshold.h" + +OpenAPI_retainability_threshold_t *OpenAPI_retainability_threshold_create( + bool is_rel_flow_num, + int rel_flow_num, + OpenAPI_time_unit_t *rel_time_unit, + bool is_rel_flow_ratio, + int rel_flow_ratio +) +{ + OpenAPI_retainability_threshold_t *retainability_threshold_local_var = ogs_malloc(sizeof(OpenAPI_retainability_threshold_t)); + ogs_assert(retainability_threshold_local_var); + + retainability_threshold_local_var->is_rel_flow_num = is_rel_flow_num; + retainability_threshold_local_var->rel_flow_num = rel_flow_num; + retainability_threshold_local_var->rel_time_unit = rel_time_unit; + retainability_threshold_local_var->is_rel_flow_ratio = is_rel_flow_ratio; + retainability_threshold_local_var->rel_flow_ratio = rel_flow_ratio; + + return retainability_threshold_local_var; +} + +void OpenAPI_retainability_threshold_free(OpenAPI_retainability_threshold_t *retainability_threshold) +{ + OpenAPI_lnode_t *node = NULL; + + if (NULL == retainability_threshold) { + return; + } + if (retainability_threshold->rel_time_unit) { + OpenAPI_time_unit_free(retainability_threshold->rel_time_unit); + retainability_threshold->rel_time_unit = NULL; + } + ogs_free(retainability_threshold); +} + +cJSON *OpenAPI_retainability_threshold_convertToJSON(OpenAPI_retainability_threshold_t *retainability_threshold) +{ + cJSON *item = NULL; + OpenAPI_lnode_t *node = NULL; + + if (retainability_threshold == NULL) { + ogs_error("OpenAPI_retainability_threshold_convertToJSON() failed [RetainabilityThreshold]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (retainability_threshold->is_rel_flow_num) { + if (cJSON_AddNumberToObject(item, "relFlowNum", retainability_threshold->rel_flow_num) == NULL) { + ogs_error("OpenAPI_retainability_threshold_convertToJSON() failed [rel_flow_num]"); + goto end; + } + } + + if (retainability_threshold->rel_time_unit) { + cJSON *rel_time_unit_local_JSON = OpenAPI_time_unit_convertToJSON(retainability_threshold->rel_time_unit); + if (rel_time_unit_local_JSON == NULL) { + ogs_error("OpenAPI_retainability_threshold_convertToJSON() failed [rel_time_unit]"); + goto end; + } + cJSON_AddItemToObject(item, "relTimeUnit", rel_time_unit_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_retainability_threshold_convertToJSON() failed [rel_time_unit]"); + goto end; + } + } + + if (retainability_threshold->is_rel_flow_ratio) { + if (cJSON_AddNumberToObject(item, "relFlowRatio", retainability_threshold->rel_flow_ratio) == NULL) { + ogs_error("OpenAPI_retainability_threshold_convertToJSON() failed [rel_flow_ratio]"); + goto end; + } + } + +end: + return item; +} + +OpenAPI_retainability_threshold_t *OpenAPI_retainability_threshold_parseFromJSON(cJSON *retainability_thresholdJSON) +{ + OpenAPI_retainability_threshold_t *retainability_threshold_local_var = NULL; + OpenAPI_lnode_t *node = NULL; + cJSON *rel_flow_num = NULL; + cJSON *rel_time_unit = NULL; + OpenAPI_time_unit_t *rel_time_unit_local_nonprim = NULL; + cJSON *rel_flow_ratio = NULL; + rel_flow_num = cJSON_GetObjectItemCaseSensitive(retainability_thresholdJSON, "relFlowNum"); + if (rel_flow_num) { + if (!cJSON_IsNumber(rel_flow_num)) { + ogs_error("OpenAPI_retainability_threshold_parseFromJSON() failed [rel_flow_num]"); + goto end; + } + } + + rel_time_unit = cJSON_GetObjectItemCaseSensitive(retainability_thresholdJSON, "relTimeUnit"); + if (rel_time_unit) { + rel_time_unit_local_nonprim = OpenAPI_time_unit_parseFromJSON(rel_time_unit); + } + + rel_flow_ratio = cJSON_GetObjectItemCaseSensitive(retainability_thresholdJSON, "relFlowRatio"); + if (rel_flow_ratio) { + if (!cJSON_IsNumber(rel_flow_ratio)) { + ogs_error("OpenAPI_retainability_threshold_parseFromJSON() failed [rel_flow_ratio]"); + goto end; + } + } + + retainability_threshold_local_var = OpenAPI_retainability_threshold_create ( + rel_flow_num ? true : false, + rel_flow_num ? rel_flow_num->valuedouble : 0, + rel_time_unit ? rel_time_unit_local_nonprim : NULL, + rel_flow_ratio ? true : false, + rel_flow_ratio ? rel_flow_ratio->valuedouble : 0 + ); + + return retainability_threshold_local_var; +end: + if (rel_time_unit_local_nonprim) { + OpenAPI_time_unit_free(rel_time_unit_local_nonprim); + rel_time_unit_local_nonprim = NULL; + } + return NULL; +} + +OpenAPI_retainability_threshold_t *OpenAPI_retainability_threshold_copy(OpenAPI_retainability_threshold_t *dst, OpenAPI_retainability_threshold_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_retainability_threshold_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_retainability_threshold_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_retainability_threshold_free(dst); + dst = OpenAPI_retainability_threshold_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/retainability_threshold.h b/lib/sbi/openapi/model/retainability_threshold.h new file mode 100644 index 000000000..8727360bd --- /dev/null +++ b/lib/sbi/openapi/model/retainability_threshold.h @@ -0,0 +1,47 @@ +/* + * retainability_threshold.h + * + * Represents a QoS flow retainability threshold. + */ + +#ifndef _OpenAPI_retainability_threshold_H_ +#define _OpenAPI_retainability_threshold_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "time_unit.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_retainability_threshold_s OpenAPI_retainability_threshold_t; +typedef struct OpenAPI_retainability_threshold_s { + bool is_rel_flow_num; + int rel_flow_num; + struct OpenAPI_time_unit_s *rel_time_unit; + bool is_rel_flow_ratio; + int rel_flow_ratio; +} OpenAPI_retainability_threshold_t; + +OpenAPI_retainability_threshold_t *OpenAPI_retainability_threshold_create( + bool is_rel_flow_num, + int rel_flow_num, + OpenAPI_time_unit_t *rel_time_unit, + bool is_rel_flow_ratio, + int rel_flow_ratio +); +void OpenAPI_retainability_threshold_free(OpenAPI_retainability_threshold_t *retainability_threshold); +OpenAPI_retainability_threshold_t *OpenAPI_retainability_threshold_parseFromJSON(cJSON *retainability_thresholdJSON); +cJSON *OpenAPI_retainability_threshold_convertToJSON(OpenAPI_retainability_threshold_t *retainability_threshold); +OpenAPI_retainability_threshold_t *OpenAPI_retainability_threshold_copy(OpenAPI_retainability_threshold_t *dst, OpenAPI_retainability_threshold_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_retainability_threshold_H_ */ + diff --git a/lib/sbi/openapi/model/retrieve_data.c b/lib/sbi/openapi/model/retrieve_data.c index 9223eefaf..9bdae494f 100644 --- a/lib/sbi/openapi/model/retrieve_data.c +++ b/lib/sbi/openapi/model/retrieve_data.c @@ -6,7 +6,8 @@ OpenAPI_retrieve_data_t *OpenAPI_retrieve_data_create( bool is_small_data_rate_status_req, - int small_data_rate_status_req + int small_data_rate_status_req, + OpenAPI_pdu_session_context_type_e pdu_session_context_type ) { OpenAPI_retrieve_data_t *retrieve_data_local_var = ogs_malloc(sizeof(OpenAPI_retrieve_data_t)); @@ -14,6 +15,7 @@ OpenAPI_retrieve_data_t *OpenAPI_retrieve_data_create( retrieve_data_local_var->is_small_data_rate_status_req = is_small_data_rate_status_req; retrieve_data_local_var->small_data_rate_status_req = small_data_rate_status_req; + retrieve_data_local_var->pdu_session_context_type = pdu_session_context_type; return retrieve_data_local_var; } @@ -46,6 +48,13 @@ cJSON *OpenAPI_retrieve_data_convertToJSON(OpenAPI_retrieve_data_t *retrieve_dat } } + if (retrieve_data->pdu_session_context_type != OpenAPI_pdu_session_context_type_NULL) { + if (cJSON_AddStringToObject(item, "pduSessionContextType", OpenAPI_pdu_session_context_type_ToString(retrieve_data->pdu_session_context_type)) == NULL) { + ogs_error("OpenAPI_retrieve_data_convertToJSON() failed [pdu_session_context_type]"); + goto end; + } + } + end: return item; } @@ -55,6 +64,8 @@ OpenAPI_retrieve_data_t *OpenAPI_retrieve_data_parseFromJSON(cJSON *retrieve_dat OpenAPI_retrieve_data_t *retrieve_data_local_var = NULL; OpenAPI_lnode_t *node = NULL; cJSON *small_data_rate_status_req = NULL; + cJSON *pdu_session_context_type = NULL; + OpenAPI_pdu_session_context_type_e pdu_session_context_typeVariable = 0; small_data_rate_status_req = cJSON_GetObjectItemCaseSensitive(retrieve_dataJSON, "smallDataRateStatusReq"); if (small_data_rate_status_req) { if (!cJSON_IsBool(small_data_rate_status_req)) { @@ -63,9 +74,19 @@ OpenAPI_retrieve_data_t *OpenAPI_retrieve_data_parseFromJSON(cJSON *retrieve_dat } } + pdu_session_context_type = cJSON_GetObjectItemCaseSensitive(retrieve_dataJSON, "pduSessionContextType"); + if (pdu_session_context_type) { + if (!cJSON_IsString(pdu_session_context_type)) { + ogs_error("OpenAPI_retrieve_data_parseFromJSON() failed [pdu_session_context_type]"); + goto end; + } + pdu_session_context_typeVariable = OpenAPI_pdu_session_context_type_FromString(pdu_session_context_type->valuestring); + } + retrieve_data_local_var = OpenAPI_retrieve_data_create ( small_data_rate_status_req ? true : false, - small_data_rate_status_req ? small_data_rate_status_req->valueint : 0 + small_data_rate_status_req ? small_data_rate_status_req->valueint : 0, + pdu_session_context_type ? pdu_session_context_typeVariable : 0 ); return retrieve_data_local_var; diff --git a/lib/sbi/openapi/model/retrieve_data.h b/lib/sbi/openapi/model/retrieve_data.h index 247c20567..870408a79 100644 --- a/lib/sbi/openapi/model/retrieve_data.h +++ b/lib/sbi/openapi/model/retrieve_data.h @@ -1,7 +1,7 @@ /* * retrieve_data.h * - * + * Data within Retrieve Request */ #ifndef _OpenAPI_retrieve_data_H_ @@ -12,6 +12,7 @@ #include "../include/list.h" #include "../include/keyValuePair.h" #include "../include/binary.h" +#include "pdu_session_context_type.h" #ifdef __cplusplus extern "C" { @@ -21,11 +22,13 @@ typedef struct OpenAPI_retrieve_data_s OpenAPI_retrieve_data_t; typedef struct OpenAPI_retrieve_data_s { bool is_small_data_rate_status_req; int small_data_rate_status_req; + OpenAPI_pdu_session_context_type_e pdu_session_context_type; } OpenAPI_retrieve_data_t; OpenAPI_retrieve_data_t *OpenAPI_retrieve_data_create( bool is_small_data_rate_status_req, - int small_data_rate_status_req + int small_data_rate_status_req, + OpenAPI_pdu_session_context_type_e pdu_session_context_type ); void OpenAPI_retrieve_data_free(OpenAPI_retrieve_data_t *retrieve_data); OpenAPI_retrieve_data_t *OpenAPI_retrieve_data_parseFromJSON(cJSON *retrieve_dataJSON); diff --git a/lib/sbi/openapi/model/retrieved_data.c b/lib/sbi/openapi/model/retrieved_data.c index a5c5d934a..718121b2b 100644 --- a/lib/sbi/openapi/model/retrieved_data.c +++ b/lib/sbi/openapi/model/retrieved_data.c @@ -5,13 +5,15 @@ #include "retrieved_data.h" OpenAPI_retrieved_data_t *OpenAPI_retrieved_data_create( - OpenAPI_small_data_rate_status_t *small_data_rate_status + OpenAPI_small_data_rate_status_t *small_data_rate_status, + OpenAPI_af_coordination_info_t *af_coordination_info ) { OpenAPI_retrieved_data_t *retrieved_data_local_var = ogs_malloc(sizeof(OpenAPI_retrieved_data_t)); ogs_assert(retrieved_data_local_var); retrieved_data_local_var->small_data_rate_status = small_data_rate_status; + retrieved_data_local_var->af_coordination_info = af_coordination_info; return retrieved_data_local_var; } @@ -27,6 +29,10 @@ void OpenAPI_retrieved_data_free(OpenAPI_retrieved_data_t *retrieved_data) OpenAPI_small_data_rate_status_free(retrieved_data->small_data_rate_status); retrieved_data->small_data_rate_status = NULL; } + if (retrieved_data->af_coordination_info) { + OpenAPI_af_coordination_info_free(retrieved_data->af_coordination_info); + retrieved_data->af_coordination_info = NULL; + } ogs_free(retrieved_data); } @@ -54,6 +60,19 @@ cJSON *OpenAPI_retrieved_data_convertToJSON(OpenAPI_retrieved_data_t *retrieved_ } } + if (retrieved_data->af_coordination_info) { + cJSON *af_coordination_info_local_JSON = OpenAPI_af_coordination_info_convertToJSON(retrieved_data->af_coordination_info); + if (af_coordination_info_local_JSON == NULL) { + ogs_error("OpenAPI_retrieved_data_convertToJSON() failed [af_coordination_info]"); + goto end; + } + cJSON_AddItemToObject(item, "afCoordinationInfo", af_coordination_info_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_retrieved_data_convertToJSON() failed [af_coordination_info]"); + goto end; + } + } + end: return item; } @@ -64,13 +83,21 @@ OpenAPI_retrieved_data_t *OpenAPI_retrieved_data_parseFromJSON(cJSON *retrieved_ OpenAPI_lnode_t *node = NULL; cJSON *small_data_rate_status = NULL; OpenAPI_small_data_rate_status_t *small_data_rate_status_local_nonprim = NULL; + cJSON *af_coordination_info = NULL; + OpenAPI_af_coordination_info_t *af_coordination_info_local_nonprim = NULL; small_data_rate_status = cJSON_GetObjectItemCaseSensitive(retrieved_dataJSON, "smallDataRateStatus"); if (small_data_rate_status) { small_data_rate_status_local_nonprim = OpenAPI_small_data_rate_status_parseFromJSON(small_data_rate_status); } + af_coordination_info = cJSON_GetObjectItemCaseSensitive(retrieved_dataJSON, "afCoordinationInfo"); + if (af_coordination_info) { + af_coordination_info_local_nonprim = OpenAPI_af_coordination_info_parseFromJSON(af_coordination_info); + } + retrieved_data_local_var = OpenAPI_retrieved_data_create ( - small_data_rate_status ? small_data_rate_status_local_nonprim : NULL + small_data_rate_status ? small_data_rate_status_local_nonprim : NULL, + af_coordination_info ? af_coordination_info_local_nonprim : NULL ); return retrieved_data_local_var; @@ -79,6 +106,10 @@ end: OpenAPI_small_data_rate_status_free(small_data_rate_status_local_nonprim); small_data_rate_status_local_nonprim = NULL; } + if (af_coordination_info_local_nonprim) { + OpenAPI_af_coordination_info_free(af_coordination_info_local_nonprim); + af_coordination_info_local_nonprim = NULL; + } return NULL; } diff --git a/lib/sbi/openapi/model/retrieved_data.h b/lib/sbi/openapi/model/retrieved_data.h index 6349ef5f1..8a5f9a061 100644 --- a/lib/sbi/openapi/model/retrieved_data.h +++ b/lib/sbi/openapi/model/retrieved_data.h @@ -1,7 +1,7 @@ /* * retrieved_data.h * - * + * Data within Retrieve Response */ #ifndef _OpenAPI_retrieved_data_H_ @@ -12,6 +12,7 @@ #include "../include/list.h" #include "../include/keyValuePair.h" #include "../include/binary.h" +#include "af_coordination_info.h" #include "small_data_rate_status.h" #ifdef __cplusplus @@ -21,10 +22,12 @@ extern "C" { typedef struct OpenAPI_retrieved_data_s OpenAPI_retrieved_data_t; typedef struct OpenAPI_retrieved_data_s { struct OpenAPI_small_data_rate_status_s *small_data_rate_status; + struct OpenAPI_af_coordination_info_s *af_coordination_info; } OpenAPI_retrieved_data_t; OpenAPI_retrieved_data_t *OpenAPI_retrieved_data_create( - OpenAPI_small_data_rate_status_t *small_data_rate_status + OpenAPI_small_data_rate_status_t *small_data_rate_status, + OpenAPI_af_coordination_info_t *af_coordination_info ); void OpenAPI_retrieved_data_free(OpenAPI_retrieved_data_t *retrieved_data); OpenAPI_retrieved_data_t *OpenAPI_retrieved_data_parseFromJSON(cJSON *retrieved_dataJSON); diff --git a/lib/sbi/openapi/model/rg_auth_ctx.h b/lib/sbi/openapi/model/rg_auth_ctx.h index cf8abfd5d..030ca30ac 100644 --- a/lib/sbi/openapi/model/rg_auth_ctx.h +++ b/lib/sbi/openapi/model/rg_auth_ctx.h @@ -1,7 +1,7 @@ /* * rg_auth_ctx.h * - * + * Contains the UE id (i.e. SUPI) and the authentication indication. */ #ifndef _OpenAPI_rg_auth_ctx_H_ diff --git a/lib/sbi/openapi/model/rg_authentication_info.h b/lib/sbi/openapi/model/rg_authentication_info.h index 48cbf966a..42e1b6ae3 100644 --- a/lib/sbi/openapi/model/rg_authentication_info.h +++ b/lib/sbi/openapi/model/rg_authentication_info.h @@ -1,7 +1,7 @@ /* * rg_authentication_info.h * - * + * Contains the UE id (i.e. SUCI) and the authenticated indication. */ #ifndef _OpenAPI_rg_authentication_info_H_ diff --git a/lib/sbi/openapi/model/rm_info.h b/lib/sbi/openapi/model/rm_info.h index 49297b277..76a5dea57 100644 --- a/lib/sbi/openapi/model/rm_info.h +++ b/lib/sbi/openapi/model/rm_info.h @@ -1,7 +1,7 @@ /* * rm_info.h * - * + * Represents the registration state of a UE for an access type */ #ifndef _OpenAPI_rm_info_H_ diff --git a/lib/sbi/openapi/model/rm_state.h b/lib/sbi/openapi/model/rm_state.h index 90ba34efe..263667b3e 100644 --- a/lib/sbi/openapi/model/rm_state.h +++ b/lib/sbi/openapi/model/rm_state.h @@ -1,7 +1,7 @@ /* * rm_state.h * - * + * Describes the registration management state of a UE */ #ifndef _OpenAPI_rm_state_H_ diff --git a/lib/sbi/openapi/model/roaming_info_update.c b/lib/sbi/openapi/model/roaming_info_update.c new file mode 100644 index 000000000..a9fd877f6 --- /dev/null +++ b/lib/sbi/openapi/model/roaming_info_update.c @@ -0,0 +1,144 @@ + +#include +#include +#include +#include "roaming_info_update.h" + +OpenAPI_roaming_info_update_t *OpenAPI_roaming_info_update_create( + bool is_roaming, + int roaming, + OpenAPI_plmn_id_t *serving_plmn +) +{ + OpenAPI_roaming_info_update_t *roaming_info_update_local_var = ogs_malloc(sizeof(OpenAPI_roaming_info_update_t)); + ogs_assert(roaming_info_update_local_var); + + roaming_info_update_local_var->is_roaming = is_roaming; + roaming_info_update_local_var->roaming = roaming; + roaming_info_update_local_var->serving_plmn = serving_plmn; + + return roaming_info_update_local_var; +} + +void OpenAPI_roaming_info_update_free(OpenAPI_roaming_info_update_t *roaming_info_update) +{ + OpenAPI_lnode_t *node = NULL; + + if (NULL == roaming_info_update) { + return; + } + if (roaming_info_update->serving_plmn) { + OpenAPI_plmn_id_free(roaming_info_update->serving_plmn); + roaming_info_update->serving_plmn = NULL; + } + ogs_free(roaming_info_update); +} + +cJSON *OpenAPI_roaming_info_update_convertToJSON(OpenAPI_roaming_info_update_t *roaming_info_update) +{ + cJSON *item = NULL; + OpenAPI_lnode_t *node = NULL; + + if (roaming_info_update == NULL) { + ogs_error("OpenAPI_roaming_info_update_convertToJSON() failed [RoamingInfoUpdate]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (roaming_info_update->is_roaming) { + if (cJSON_AddBoolToObject(item, "roaming", roaming_info_update->roaming) == NULL) { + ogs_error("OpenAPI_roaming_info_update_convertToJSON() failed [roaming]"); + goto end; + } + } + + if (!roaming_info_update->serving_plmn) { + ogs_error("OpenAPI_roaming_info_update_convertToJSON() failed [serving_plmn]"); + return NULL; + } + cJSON *serving_plmn_local_JSON = OpenAPI_plmn_id_convertToJSON(roaming_info_update->serving_plmn); + if (serving_plmn_local_JSON == NULL) { + ogs_error("OpenAPI_roaming_info_update_convertToJSON() failed [serving_plmn]"); + goto end; + } + cJSON_AddItemToObject(item, "servingPlmn", serving_plmn_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_roaming_info_update_convertToJSON() failed [serving_plmn]"); + goto end; + } + +end: + return item; +} + +OpenAPI_roaming_info_update_t *OpenAPI_roaming_info_update_parseFromJSON(cJSON *roaming_info_updateJSON) +{ + OpenAPI_roaming_info_update_t *roaming_info_update_local_var = NULL; + OpenAPI_lnode_t *node = NULL; + cJSON *roaming = NULL; + cJSON *serving_plmn = NULL; + OpenAPI_plmn_id_t *serving_plmn_local_nonprim = NULL; + roaming = cJSON_GetObjectItemCaseSensitive(roaming_info_updateJSON, "roaming"); + if (roaming) { + if (!cJSON_IsBool(roaming)) { + ogs_error("OpenAPI_roaming_info_update_parseFromJSON() failed [roaming]"); + goto end; + } + } + + serving_plmn = cJSON_GetObjectItemCaseSensitive(roaming_info_updateJSON, "servingPlmn"); + if (!serving_plmn) { + ogs_error("OpenAPI_roaming_info_update_parseFromJSON() failed [serving_plmn]"); + goto end; + } + serving_plmn_local_nonprim = OpenAPI_plmn_id_parseFromJSON(serving_plmn); + + roaming_info_update_local_var = OpenAPI_roaming_info_update_create ( + roaming ? true : false, + roaming ? roaming->valueint : 0, + serving_plmn_local_nonprim + ); + + return roaming_info_update_local_var; +end: + if (serving_plmn_local_nonprim) { + OpenAPI_plmn_id_free(serving_plmn_local_nonprim); + serving_plmn_local_nonprim = NULL; + } + return NULL; +} + +OpenAPI_roaming_info_update_t *OpenAPI_roaming_info_update_copy(OpenAPI_roaming_info_update_t *dst, OpenAPI_roaming_info_update_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_roaming_info_update_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_roaming_info_update_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_roaming_info_update_free(dst); + dst = OpenAPI_roaming_info_update_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/roaming_info_update.h b/lib/sbi/openapi/model/roaming_info_update.h new file mode 100644 index 000000000..03325239e --- /dev/null +++ b/lib/sbi/openapi/model/roaming_info_update.h @@ -0,0 +1,43 @@ +/* + * roaming_info_update.h + * + * Contains the Roaming Information Update + */ + +#ifndef _OpenAPI_roaming_info_update_H_ +#define _OpenAPI_roaming_info_update_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "plmn_id.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_roaming_info_update_s OpenAPI_roaming_info_update_t; +typedef struct OpenAPI_roaming_info_update_s { + bool is_roaming; + int roaming; + struct OpenAPI_plmn_id_s *serving_plmn; +} OpenAPI_roaming_info_update_t; + +OpenAPI_roaming_info_update_t *OpenAPI_roaming_info_update_create( + bool is_roaming, + int roaming, + OpenAPI_plmn_id_t *serving_plmn +); +void OpenAPI_roaming_info_update_free(OpenAPI_roaming_info_update_t *roaming_info_update); +OpenAPI_roaming_info_update_t *OpenAPI_roaming_info_update_parseFromJSON(cJSON *roaming_info_updateJSON); +cJSON *OpenAPI_roaming_info_update_convertToJSON(OpenAPI_roaming_info_update_t *roaming_info_update); +OpenAPI_roaming_info_update_t *OpenAPI_roaming_info_update_copy(OpenAPI_roaming_info_update_t *dst, OpenAPI_roaming_info_update_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_roaming_info_update_H_ */ + diff --git a/lib/sbi/openapi/model/roaming_restrictions.c b/lib/sbi/openapi/model/roaming_restrictions.c new file mode 100644 index 000000000..8197d34b4 --- /dev/null +++ b/lib/sbi/openapi/model/roaming_restrictions.c @@ -0,0 +1,109 @@ + +#include +#include +#include +#include "roaming_restrictions.h" + +OpenAPI_roaming_restrictions_t *OpenAPI_roaming_restrictions_create( + bool is_access_allowed, + int access_allowed +) +{ + OpenAPI_roaming_restrictions_t *roaming_restrictions_local_var = ogs_malloc(sizeof(OpenAPI_roaming_restrictions_t)); + ogs_assert(roaming_restrictions_local_var); + + roaming_restrictions_local_var->is_access_allowed = is_access_allowed; + roaming_restrictions_local_var->access_allowed = access_allowed; + + return roaming_restrictions_local_var; +} + +void OpenAPI_roaming_restrictions_free(OpenAPI_roaming_restrictions_t *roaming_restrictions) +{ + OpenAPI_lnode_t *node = NULL; + + if (NULL == roaming_restrictions) { + return; + } + ogs_free(roaming_restrictions); +} + +cJSON *OpenAPI_roaming_restrictions_convertToJSON(OpenAPI_roaming_restrictions_t *roaming_restrictions) +{ + cJSON *item = NULL; + OpenAPI_lnode_t *node = NULL; + + if (roaming_restrictions == NULL) { + ogs_error("OpenAPI_roaming_restrictions_convertToJSON() failed [RoamingRestrictions]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (roaming_restrictions->is_access_allowed) { + if (cJSON_AddBoolToObject(item, "accessAllowed", roaming_restrictions->access_allowed) == NULL) { + ogs_error("OpenAPI_roaming_restrictions_convertToJSON() failed [access_allowed]"); + goto end; + } + } + +end: + return item; +} + +OpenAPI_roaming_restrictions_t *OpenAPI_roaming_restrictions_parseFromJSON(cJSON *roaming_restrictionsJSON) +{ + OpenAPI_roaming_restrictions_t *roaming_restrictions_local_var = NULL; + OpenAPI_lnode_t *node = NULL; + cJSON *access_allowed = NULL; + access_allowed = cJSON_GetObjectItemCaseSensitive(roaming_restrictionsJSON, "accessAllowed"); + if (access_allowed) { + if (!cJSON_IsBool(access_allowed)) { + ogs_error("OpenAPI_roaming_restrictions_parseFromJSON() failed [access_allowed]"); + goto end; + } + } + + roaming_restrictions_local_var = OpenAPI_roaming_restrictions_create ( + access_allowed ? true : false, + access_allowed ? access_allowed->valueint : 0 + ); + + return roaming_restrictions_local_var; +end: + return NULL; +} + +OpenAPI_roaming_restrictions_t *OpenAPI_roaming_restrictions_copy(OpenAPI_roaming_restrictions_t *dst, OpenAPI_roaming_restrictions_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_roaming_restrictions_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_roaming_restrictions_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_roaming_restrictions_free(dst); + dst = OpenAPI_roaming_restrictions_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/roaming_restrictions.h b/lib/sbi/openapi/model/roaming_restrictions.h new file mode 100644 index 000000000..d908981ce --- /dev/null +++ b/lib/sbi/openapi/model/roaming_restrictions.h @@ -0,0 +1,40 @@ +/* + * roaming_restrictions.h + * + * Indicates if access is allowed to a given serving network, e.g. a PLMN (MCC, MNC) or an SNPN (MCC, MNC, NID). + */ + +#ifndef _OpenAPI_roaming_restrictions_H_ +#define _OpenAPI_roaming_restrictions_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_roaming_restrictions_s OpenAPI_roaming_restrictions_t; +typedef struct OpenAPI_roaming_restrictions_s { + bool is_access_allowed; + int access_allowed; +} OpenAPI_roaming_restrictions_t; + +OpenAPI_roaming_restrictions_t *OpenAPI_roaming_restrictions_create( + bool is_access_allowed, + int access_allowed +); +void OpenAPI_roaming_restrictions_free(OpenAPI_roaming_restrictions_t *roaming_restrictions); +OpenAPI_roaming_restrictions_t *OpenAPI_roaming_restrictions_parseFromJSON(cJSON *roaming_restrictionsJSON); +cJSON *OpenAPI_roaming_restrictions_convertToJSON(OpenAPI_roaming_restrictions_t *roaming_restrictions); +OpenAPI_roaming_restrictions_t *OpenAPI_roaming_restrictions_copy(OpenAPI_roaming_restrictions_t *dst, OpenAPI_roaming_restrictions_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_roaming_restrictions_H_ */ + diff --git a/lib/sbi/openapi/model/route_information.h b/lib/sbi/openapi/model/route_information.h index 0d35b0b42..91d9606b8 100644 --- a/lib/sbi/openapi/model/route_information.h +++ b/lib/sbi/openapi/model/route_information.h @@ -1,7 +1,7 @@ /* * route_information.h * - * + * At least one of the \"ipv4Addr\" attribute and the \"ipv6Addr\" attribute shall be included in the \"RouteInformation\" data type. */ #ifndef _OpenAPI_route_information_H_ diff --git a/lib/sbi/openapi/model/route_selection_parameter_set.c b/lib/sbi/openapi/model/route_selection_parameter_set.c new file mode 100644 index 000000000..4d69dbe1a --- /dev/null +++ b/lib/sbi/openapi/model/route_selection_parameter_set.c @@ -0,0 +1,283 @@ + +#include +#include +#include +#include "route_selection_parameter_set.h" + +OpenAPI_route_selection_parameter_set_t *OpenAPI_route_selection_parameter_set_create( + char *dnn, + OpenAPI_snssai_t *snssai, + bool is_precedence, + int precedence, + OpenAPI_list_t *spatial_validity_areas, + OpenAPI_list_t *spatial_validity_tais +) +{ + OpenAPI_route_selection_parameter_set_t *route_selection_parameter_set_local_var = ogs_malloc(sizeof(OpenAPI_route_selection_parameter_set_t)); + ogs_assert(route_selection_parameter_set_local_var); + + route_selection_parameter_set_local_var->dnn = dnn; + route_selection_parameter_set_local_var->snssai = snssai; + route_selection_parameter_set_local_var->is_precedence = is_precedence; + route_selection_parameter_set_local_var->precedence = precedence; + route_selection_parameter_set_local_var->spatial_validity_areas = spatial_validity_areas; + route_selection_parameter_set_local_var->spatial_validity_tais = spatial_validity_tais; + + return route_selection_parameter_set_local_var; +} + +void OpenAPI_route_selection_parameter_set_free(OpenAPI_route_selection_parameter_set_t *route_selection_parameter_set) +{ + OpenAPI_lnode_t *node = NULL; + + if (NULL == route_selection_parameter_set) { + return; + } + if (route_selection_parameter_set->dnn) { + ogs_free(route_selection_parameter_set->dnn); + route_selection_parameter_set->dnn = NULL; + } + if (route_selection_parameter_set->snssai) { + OpenAPI_snssai_free(route_selection_parameter_set->snssai); + route_selection_parameter_set->snssai = NULL; + } + if (route_selection_parameter_set->spatial_validity_areas) { + OpenAPI_list_for_each(route_selection_parameter_set->spatial_validity_areas, node) { + OpenAPI_geographical_area_free(node->data); + } + OpenAPI_list_free(route_selection_parameter_set->spatial_validity_areas); + route_selection_parameter_set->spatial_validity_areas = NULL; + } + if (route_selection_parameter_set->spatial_validity_tais) { + OpenAPI_list_for_each(route_selection_parameter_set->spatial_validity_tais, node) { + OpenAPI_tai_1_free(node->data); + } + OpenAPI_list_free(route_selection_parameter_set->spatial_validity_tais); + route_selection_parameter_set->spatial_validity_tais = NULL; + } + ogs_free(route_selection_parameter_set); +} + +cJSON *OpenAPI_route_selection_parameter_set_convertToJSON(OpenAPI_route_selection_parameter_set_t *route_selection_parameter_set) +{ + cJSON *item = NULL; + OpenAPI_lnode_t *node = NULL; + + if (route_selection_parameter_set == NULL) { + ogs_error("OpenAPI_route_selection_parameter_set_convertToJSON() failed [RouteSelectionParameterSet]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (route_selection_parameter_set->dnn) { + if (cJSON_AddStringToObject(item, "dnn", route_selection_parameter_set->dnn) == NULL) { + ogs_error("OpenAPI_route_selection_parameter_set_convertToJSON() failed [dnn]"); + goto end; + } + } + + if (route_selection_parameter_set->snssai) { + cJSON *snssai_local_JSON = OpenAPI_snssai_convertToJSON(route_selection_parameter_set->snssai); + if (snssai_local_JSON == NULL) { + ogs_error("OpenAPI_route_selection_parameter_set_convertToJSON() failed [snssai]"); + goto end; + } + cJSON_AddItemToObject(item, "snssai", snssai_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_route_selection_parameter_set_convertToJSON() failed [snssai]"); + goto end; + } + } + + if (route_selection_parameter_set->is_precedence) { + if (cJSON_AddNumberToObject(item, "precedence", route_selection_parameter_set->precedence) == NULL) { + ogs_error("OpenAPI_route_selection_parameter_set_convertToJSON() failed [precedence]"); + goto end; + } + } + + if (route_selection_parameter_set->spatial_validity_areas) { + cJSON *spatial_validity_areasList = cJSON_AddArrayToObject(item, "spatialValidityAreas"); + if (spatial_validity_areasList == NULL) { + ogs_error("OpenAPI_route_selection_parameter_set_convertToJSON() failed [spatial_validity_areas]"); + goto end; + } + OpenAPI_list_for_each(route_selection_parameter_set->spatial_validity_areas, node) { + cJSON *itemLocal = OpenAPI_geographical_area_convertToJSON(node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_route_selection_parameter_set_convertToJSON() failed [spatial_validity_areas]"); + goto end; + } + cJSON_AddItemToArray(spatial_validity_areasList, itemLocal); + } + } + + if (route_selection_parameter_set->spatial_validity_tais) { + cJSON *spatial_validity_taisList = cJSON_AddArrayToObject(item, "spatialValidityTais"); + if (spatial_validity_taisList == NULL) { + ogs_error("OpenAPI_route_selection_parameter_set_convertToJSON() failed [spatial_validity_tais]"); + goto end; + } + OpenAPI_list_for_each(route_selection_parameter_set->spatial_validity_tais, node) { + cJSON *itemLocal = OpenAPI_tai_1_convertToJSON(node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_route_selection_parameter_set_convertToJSON() failed [spatial_validity_tais]"); + goto end; + } + cJSON_AddItemToArray(spatial_validity_taisList, itemLocal); + } + } + +end: + return item; +} + +OpenAPI_route_selection_parameter_set_t *OpenAPI_route_selection_parameter_set_parseFromJSON(cJSON *route_selection_parameter_setJSON) +{ + OpenAPI_route_selection_parameter_set_t *route_selection_parameter_set_local_var = NULL; + OpenAPI_lnode_t *node = NULL; + cJSON *dnn = NULL; + cJSON *snssai = NULL; + OpenAPI_snssai_t *snssai_local_nonprim = NULL; + cJSON *precedence = NULL; + cJSON *spatial_validity_areas = NULL; + OpenAPI_list_t *spatial_validity_areasList = NULL; + cJSON *spatial_validity_tais = NULL; + OpenAPI_list_t *spatial_validity_taisList = NULL; + dnn = cJSON_GetObjectItemCaseSensitive(route_selection_parameter_setJSON, "dnn"); + if (dnn) { + if (!cJSON_IsString(dnn) && !cJSON_IsNull(dnn)) { + ogs_error("OpenAPI_route_selection_parameter_set_parseFromJSON() failed [dnn]"); + goto end; + } + } + + snssai = cJSON_GetObjectItemCaseSensitive(route_selection_parameter_setJSON, "snssai"); + if (snssai) { + snssai_local_nonprim = OpenAPI_snssai_parseFromJSON(snssai); + } + + precedence = cJSON_GetObjectItemCaseSensitive(route_selection_parameter_setJSON, "precedence"); + if (precedence) { + if (!cJSON_IsNumber(precedence)) { + ogs_error("OpenAPI_route_selection_parameter_set_parseFromJSON() failed [precedence]"); + goto end; + } + } + + spatial_validity_areas = cJSON_GetObjectItemCaseSensitive(route_selection_parameter_setJSON, "spatialValidityAreas"); + if (spatial_validity_areas) { + cJSON *spatial_validity_areas_local = NULL; + if (!cJSON_IsArray(spatial_validity_areas)) { + ogs_error("OpenAPI_route_selection_parameter_set_parseFromJSON() failed [spatial_validity_areas]"); + goto end; + } + + spatial_validity_areasList = OpenAPI_list_create(); + + cJSON_ArrayForEach(spatial_validity_areas_local, spatial_validity_areas) { + if (!cJSON_IsObject(spatial_validity_areas_local)) { + ogs_error("OpenAPI_route_selection_parameter_set_parseFromJSON() failed [spatial_validity_areas]"); + goto end; + } + OpenAPI_geographical_area_t *spatial_validity_areasItem = OpenAPI_geographical_area_parseFromJSON(spatial_validity_areas_local); + if (!spatial_validity_areasItem) { + ogs_error("No spatial_validity_areasItem"); + OpenAPI_list_free(spatial_validity_areasList); + goto end; + } + OpenAPI_list_add(spatial_validity_areasList, spatial_validity_areasItem); + } + } + + spatial_validity_tais = cJSON_GetObjectItemCaseSensitive(route_selection_parameter_setJSON, "spatialValidityTais"); + if (spatial_validity_tais) { + cJSON *spatial_validity_tais_local = NULL; + if (!cJSON_IsArray(spatial_validity_tais)) { + ogs_error("OpenAPI_route_selection_parameter_set_parseFromJSON() failed [spatial_validity_tais]"); + goto end; + } + + spatial_validity_taisList = OpenAPI_list_create(); + + cJSON_ArrayForEach(spatial_validity_tais_local, spatial_validity_tais) { + if (!cJSON_IsObject(spatial_validity_tais_local)) { + ogs_error("OpenAPI_route_selection_parameter_set_parseFromJSON() failed [spatial_validity_tais]"); + goto end; + } + OpenAPI_tai_1_t *spatial_validity_taisItem = OpenAPI_tai_1_parseFromJSON(spatial_validity_tais_local); + if (!spatial_validity_taisItem) { + ogs_error("No spatial_validity_taisItem"); + OpenAPI_list_free(spatial_validity_taisList); + goto end; + } + OpenAPI_list_add(spatial_validity_taisList, spatial_validity_taisItem); + } + } + + route_selection_parameter_set_local_var = OpenAPI_route_selection_parameter_set_create ( + dnn && !cJSON_IsNull(dnn) ? ogs_strdup(dnn->valuestring) : NULL, + snssai ? snssai_local_nonprim : NULL, + precedence ? true : false, + precedence ? precedence->valuedouble : 0, + spatial_validity_areas ? spatial_validity_areasList : NULL, + spatial_validity_tais ? spatial_validity_taisList : NULL + ); + + return route_selection_parameter_set_local_var; +end: + if (snssai_local_nonprim) { + OpenAPI_snssai_free(snssai_local_nonprim); + snssai_local_nonprim = NULL; + } + if (spatial_validity_areasList) { + OpenAPI_list_for_each(spatial_validity_areasList, node) { + OpenAPI_geographical_area_free(node->data); + } + OpenAPI_list_free(spatial_validity_areasList); + spatial_validity_areasList = NULL; + } + if (spatial_validity_taisList) { + OpenAPI_list_for_each(spatial_validity_taisList, node) { + OpenAPI_tai_1_free(node->data); + } + OpenAPI_list_free(spatial_validity_taisList); + spatial_validity_taisList = NULL; + } + return NULL; +} + +OpenAPI_route_selection_parameter_set_t *OpenAPI_route_selection_parameter_set_copy(OpenAPI_route_selection_parameter_set_t *dst, OpenAPI_route_selection_parameter_set_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_route_selection_parameter_set_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_route_selection_parameter_set_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_route_selection_parameter_set_free(dst); + dst = OpenAPI_route_selection_parameter_set_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/route_selection_parameter_set.h b/lib/sbi/openapi/model/route_selection_parameter_set.h new file mode 100644 index 000000000..8e6b9596c --- /dev/null +++ b/lib/sbi/openapi/model/route_selection_parameter_set.h @@ -0,0 +1,51 @@ +/* + * route_selection_parameter_set.h + * + * Contains parameters that can be used to guide the Route Selection Descriptors of the URSP. + */ + +#ifndef _OpenAPI_route_selection_parameter_set_H_ +#define _OpenAPI_route_selection_parameter_set_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "geographical_area.h" +#include "snssai.h" +#include "tai_1.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_route_selection_parameter_set_s OpenAPI_route_selection_parameter_set_t; +typedef struct OpenAPI_route_selection_parameter_set_s { + char *dnn; + struct OpenAPI_snssai_s *snssai; + bool is_precedence; + int precedence; + OpenAPI_list_t *spatial_validity_areas; + OpenAPI_list_t *spatial_validity_tais; +} OpenAPI_route_selection_parameter_set_t; + +OpenAPI_route_selection_parameter_set_t *OpenAPI_route_selection_parameter_set_create( + char *dnn, + OpenAPI_snssai_t *snssai, + bool is_precedence, + int precedence, + OpenAPI_list_t *spatial_validity_areas, + OpenAPI_list_t *spatial_validity_tais +); +void OpenAPI_route_selection_parameter_set_free(OpenAPI_route_selection_parameter_set_t *route_selection_parameter_set); +OpenAPI_route_selection_parameter_set_t *OpenAPI_route_selection_parameter_set_parseFromJSON(cJSON *route_selection_parameter_setJSON); +cJSON *OpenAPI_route_selection_parameter_set_convertToJSON(OpenAPI_route_selection_parameter_set_t *route_selection_parameter_set); +OpenAPI_route_selection_parameter_set_t *OpenAPI_route_selection_parameter_set_copy(OpenAPI_route_selection_parameter_set_t *dst, OpenAPI_route_selection_parameter_set_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_route_selection_parameter_set_H_ */ + diff --git a/lib/sbi/openapi/model/route_to_location.h b/lib/sbi/openapi/model/route_to_location.h index a49afc35f..4fb7eac92 100644 --- a/lib/sbi/openapi/model/route_to_location.h +++ b/lib/sbi/openapi/model/route_to_location.h @@ -1,7 +1,7 @@ /* * route_to_location.h * - * + * At least one of the \"routeInfo\" attribute and the \"routeProfId\" attribute shall be included in the \"RouteToLocation\" data type. */ #ifndef _OpenAPI_route_to_location_H_ diff --git a/lib/sbi/openapi/model/routing_area_id.c b/lib/sbi/openapi/model/routing_area_id.c new file mode 100644 index 000000000..ba148a926 --- /dev/null +++ b/lib/sbi/openapi/model/routing_area_id.c @@ -0,0 +1,176 @@ + +#include +#include +#include +#include "routing_area_id.h" + +OpenAPI_routing_area_id_t *OpenAPI_routing_area_id_create( + OpenAPI_plmn_id_t *plmn_id, + char *lac, + char *rac +) +{ + OpenAPI_routing_area_id_t *routing_area_id_local_var = ogs_malloc(sizeof(OpenAPI_routing_area_id_t)); + ogs_assert(routing_area_id_local_var); + + routing_area_id_local_var->plmn_id = plmn_id; + routing_area_id_local_var->lac = lac; + routing_area_id_local_var->rac = rac; + + return routing_area_id_local_var; +} + +void OpenAPI_routing_area_id_free(OpenAPI_routing_area_id_t *routing_area_id) +{ + OpenAPI_lnode_t *node = NULL; + + if (NULL == routing_area_id) { + return; + } + if (routing_area_id->plmn_id) { + OpenAPI_plmn_id_free(routing_area_id->plmn_id); + routing_area_id->plmn_id = NULL; + } + if (routing_area_id->lac) { + ogs_free(routing_area_id->lac); + routing_area_id->lac = NULL; + } + if (routing_area_id->rac) { + ogs_free(routing_area_id->rac); + routing_area_id->rac = NULL; + } + ogs_free(routing_area_id); +} + +cJSON *OpenAPI_routing_area_id_convertToJSON(OpenAPI_routing_area_id_t *routing_area_id) +{ + cJSON *item = NULL; + OpenAPI_lnode_t *node = NULL; + + if (routing_area_id == NULL) { + ogs_error("OpenAPI_routing_area_id_convertToJSON() failed [RoutingAreaId]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (!routing_area_id->plmn_id) { + ogs_error("OpenAPI_routing_area_id_convertToJSON() failed [plmn_id]"); + return NULL; + } + cJSON *plmn_id_local_JSON = OpenAPI_plmn_id_convertToJSON(routing_area_id->plmn_id); + if (plmn_id_local_JSON == NULL) { + ogs_error("OpenAPI_routing_area_id_convertToJSON() failed [plmn_id]"); + goto end; + } + cJSON_AddItemToObject(item, "plmnId", plmn_id_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_routing_area_id_convertToJSON() failed [plmn_id]"); + goto end; + } + + if (!routing_area_id->lac) { + ogs_error("OpenAPI_routing_area_id_convertToJSON() failed [lac]"); + return NULL; + } + if (cJSON_AddStringToObject(item, "lac", routing_area_id->lac) == NULL) { + ogs_error("OpenAPI_routing_area_id_convertToJSON() failed [lac]"); + goto end; + } + + if (!routing_area_id->rac) { + ogs_error("OpenAPI_routing_area_id_convertToJSON() failed [rac]"); + return NULL; + } + if (cJSON_AddStringToObject(item, "rac", routing_area_id->rac) == NULL) { + ogs_error("OpenAPI_routing_area_id_convertToJSON() failed [rac]"); + goto end; + } + +end: + return item; +} + +OpenAPI_routing_area_id_t *OpenAPI_routing_area_id_parseFromJSON(cJSON *routing_area_idJSON) +{ + OpenAPI_routing_area_id_t *routing_area_id_local_var = NULL; + OpenAPI_lnode_t *node = NULL; + cJSON *plmn_id = NULL; + OpenAPI_plmn_id_t *plmn_id_local_nonprim = NULL; + cJSON *lac = NULL; + cJSON *rac = NULL; + plmn_id = cJSON_GetObjectItemCaseSensitive(routing_area_idJSON, "plmnId"); + if (!plmn_id) { + ogs_error("OpenAPI_routing_area_id_parseFromJSON() failed [plmn_id]"); + goto end; + } + plmn_id_local_nonprim = OpenAPI_plmn_id_parseFromJSON(plmn_id); + + lac = cJSON_GetObjectItemCaseSensitive(routing_area_idJSON, "lac"); + if (!lac) { + ogs_error("OpenAPI_routing_area_id_parseFromJSON() failed [lac]"); + goto end; + } + if (!cJSON_IsString(lac)) { + ogs_error("OpenAPI_routing_area_id_parseFromJSON() failed [lac]"); + goto end; + } + + rac = cJSON_GetObjectItemCaseSensitive(routing_area_idJSON, "rac"); + if (!rac) { + ogs_error("OpenAPI_routing_area_id_parseFromJSON() failed [rac]"); + goto end; + } + if (!cJSON_IsString(rac)) { + ogs_error("OpenAPI_routing_area_id_parseFromJSON() failed [rac]"); + goto end; + } + + routing_area_id_local_var = OpenAPI_routing_area_id_create ( + plmn_id_local_nonprim, + ogs_strdup(lac->valuestring), + ogs_strdup(rac->valuestring) + ); + + return routing_area_id_local_var; +end: + if (plmn_id_local_nonprim) { + OpenAPI_plmn_id_free(plmn_id_local_nonprim); + plmn_id_local_nonprim = NULL; + } + return NULL; +} + +OpenAPI_routing_area_id_t *OpenAPI_routing_area_id_copy(OpenAPI_routing_area_id_t *dst, OpenAPI_routing_area_id_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_routing_area_id_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_routing_area_id_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_routing_area_id_free(dst); + dst = OpenAPI_routing_area_id_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/routing_area_id.h b/lib/sbi/openapi/model/routing_area_id.h new file mode 100644 index 000000000..3b4a6c89e --- /dev/null +++ b/lib/sbi/openapi/model/routing_area_id.h @@ -0,0 +1,43 @@ +/* + * routing_area_id.h + * + * Contains a Routing Area Identification as defined in 3GPP TS 23.003, clause 4.2. + */ + +#ifndef _OpenAPI_routing_area_id_H_ +#define _OpenAPI_routing_area_id_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "plmn_id.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_routing_area_id_s OpenAPI_routing_area_id_t; +typedef struct OpenAPI_routing_area_id_s { + struct OpenAPI_plmn_id_s *plmn_id; + char *lac; + char *rac; +} OpenAPI_routing_area_id_t; + +OpenAPI_routing_area_id_t *OpenAPI_routing_area_id_create( + OpenAPI_plmn_id_t *plmn_id, + char *lac, + char *rac +); +void OpenAPI_routing_area_id_free(OpenAPI_routing_area_id_t *routing_area_id); +OpenAPI_routing_area_id_t *OpenAPI_routing_area_id_parseFromJSON(cJSON *routing_area_idJSON); +cJSON *OpenAPI_routing_area_id_convertToJSON(OpenAPI_routing_area_id_t *routing_area_id); +OpenAPI_routing_area_id_t *OpenAPI_routing_area_id_copy(OpenAPI_routing_area_id_t *dst, OpenAPI_routing_area_id_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_routing_area_id_H_ */ + diff --git a/lib/sbi/openapi/model/routing_info_sm_request.c b/lib/sbi/openapi/model/routing_info_sm_request.c new file mode 100644 index 000000000..59b09a607 --- /dev/null +++ b/lib/sbi/openapi/model/routing_info_sm_request.c @@ -0,0 +1,132 @@ + +#include +#include +#include +#include "routing_info_sm_request.h" + +OpenAPI_routing_info_sm_request_t *OpenAPI_routing_info_sm_request_create( + bool is_ip_sm_gw_ind, + int ip_sm_gw_ind, + char *supported_features +) +{ + OpenAPI_routing_info_sm_request_t *routing_info_sm_request_local_var = ogs_malloc(sizeof(OpenAPI_routing_info_sm_request_t)); + ogs_assert(routing_info_sm_request_local_var); + + routing_info_sm_request_local_var->is_ip_sm_gw_ind = is_ip_sm_gw_ind; + routing_info_sm_request_local_var->ip_sm_gw_ind = ip_sm_gw_ind; + routing_info_sm_request_local_var->supported_features = supported_features; + + return routing_info_sm_request_local_var; +} + +void OpenAPI_routing_info_sm_request_free(OpenAPI_routing_info_sm_request_t *routing_info_sm_request) +{ + OpenAPI_lnode_t *node = NULL; + + if (NULL == routing_info_sm_request) { + return; + } + if (routing_info_sm_request->supported_features) { + ogs_free(routing_info_sm_request->supported_features); + routing_info_sm_request->supported_features = NULL; + } + ogs_free(routing_info_sm_request); +} + +cJSON *OpenAPI_routing_info_sm_request_convertToJSON(OpenAPI_routing_info_sm_request_t *routing_info_sm_request) +{ + cJSON *item = NULL; + OpenAPI_lnode_t *node = NULL; + + if (routing_info_sm_request == NULL) { + ogs_error("OpenAPI_routing_info_sm_request_convertToJSON() failed [RoutingInfoSmRequest]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (routing_info_sm_request->is_ip_sm_gw_ind) { + if (cJSON_AddBoolToObject(item, "ipSmGwInd", routing_info_sm_request->ip_sm_gw_ind) == NULL) { + ogs_error("OpenAPI_routing_info_sm_request_convertToJSON() failed [ip_sm_gw_ind]"); + goto end; + } + } + + if (routing_info_sm_request->supported_features) { + if (cJSON_AddStringToObject(item, "supportedFeatures", routing_info_sm_request->supported_features) == NULL) { + ogs_error("OpenAPI_routing_info_sm_request_convertToJSON() failed [supported_features]"); + goto end; + } + } + +end: + return item; +} + +OpenAPI_routing_info_sm_request_t *OpenAPI_routing_info_sm_request_parseFromJSON(cJSON *routing_info_sm_requestJSON) +{ + OpenAPI_routing_info_sm_request_t *routing_info_sm_request_local_var = NULL; + OpenAPI_lnode_t *node = NULL; + cJSON *ip_sm_gw_ind = NULL; + cJSON *supported_features = NULL; + ip_sm_gw_ind = cJSON_GetObjectItemCaseSensitive(routing_info_sm_requestJSON, "ipSmGwInd"); + if (ip_sm_gw_ind) { + if (!cJSON_IsBool(ip_sm_gw_ind)) { + ogs_error("OpenAPI_routing_info_sm_request_parseFromJSON() failed [ip_sm_gw_ind]"); + goto end; + } + } + + supported_features = cJSON_GetObjectItemCaseSensitive(routing_info_sm_requestJSON, "supportedFeatures"); + if (supported_features) { + if (!cJSON_IsString(supported_features) && !cJSON_IsNull(supported_features)) { + ogs_error("OpenAPI_routing_info_sm_request_parseFromJSON() failed [supported_features]"); + goto end; + } + } + + routing_info_sm_request_local_var = OpenAPI_routing_info_sm_request_create ( + ip_sm_gw_ind ? true : false, + ip_sm_gw_ind ? ip_sm_gw_ind->valueint : 0, + supported_features && !cJSON_IsNull(supported_features) ? ogs_strdup(supported_features->valuestring) : NULL + ); + + return routing_info_sm_request_local_var; +end: + return NULL; +} + +OpenAPI_routing_info_sm_request_t *OpenAPI_routing_info_sm_request_copy(OpenAPI_routing_info_sm_request_t *dst, OpenAPI_routing_info_sm_request_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_routing_info_sm_request_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_routing_info_sm_request_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_routing_info_sm_request_free(dst); + dst = OpenAPI_routing_info_sm_request_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/routing_info_sm_request.h b/lib/sbi/openapi/model/routing_info_sm_request.h new file mode 100644 index 000000000..7be8c7efe --- /dev/null +++ b/lib/sbi/openapi/model/routing_info_sm_request.h @@ -0,0 +1,42 @@ +/* + * routing_info_sm_request.h + * + * Request body of the send-routing-info-sm custom operation + */ + +#ifndef _OpenAPI_routing_info_sm_request_H_ +#define _OpenAPI_routing_info_sm_request_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_routing_info_sm_request_s OpenAPI_routing_info_sm_request_t; +typedef struct OpenAPI_routing_info_sm_request_s { + bool is_ip_sm_gw_ind; + int ip_sm_gw_ind; + char *supported_features; +} OpenAPI_routing_info_sm_request_t; + +OpenAPI_routing_info_sm_request_t *OpenAPI_routing_info_sm_request_create( + bool is_ip_sm_gw_ind, + int ip_sm_gw_ind, + char *supported_features +); +void OpenAPI_routing_info_sm_request_free(OpenAPI_routing_info_sm_request_t *routing_info_sm_request); +OpenAPI_routing_info_sm_request_t *OpenAPI_routing_info_sm_request_parseFromJSON(cJSON *routing_info_sm_requestJSON); +cJSON *OpenAPI_routing_info_sm_request_convertToJSON(OpenAPI_routing_info_sm_request_t *routing_info_sm_request); +OpenAPI_routing_info_sm_request_t *OpenAPI_routing_info_sm_request_copy(OpenAPI_routing_info_sm_request_t *dst, OpenAPI_routing_info_sm_request_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_routing_info_sm_request_H_ */ + diff --git a/lib/sbi/openapi/model/routing_info_sm_response.c b/lib/sbi/openapi/model/routing_info_sm_response.c new file mode 100644 index 000000000..118849a38 --- /dev/null +++ b/lib/sbi/openapi/model/routing_info_sm_response.c @@ -0,0 +1,234 @@ + +#include +#include +#include +#include "routing_info_sm_response.h" + +OpenAPI_routing_info_sm_response_t *OpenAPI_routing_info_sm_response_create( + char *supi, + OpenAPI_smsf_registration_t *smsf3_gpp, + OpenAPI_smsf_registration_t *smsf_non3_gpp, + OpenAPI_ip_sm_gw_info_t *ip_sm_gw, + OpenAPI_sms_router_info_t *sms_router +) +{ + OpenAPI_routing_info_sm_response_t *routing_info_sm_response_local_var = ogs_malloc(sizeof(OpenAPI_routing_info_sm_response_t)); + ogs_assert(routing_info_sm_response_local_var); + + routing_info_sm_response_local_var->supi = supi; + routing_info_sm_response_local_var->smsf3_gpp = smsf3_gpp; + routing_info_sm_response_local_var->smsf_non3_gpp = smsf_non3_gpp; + routing_info_sm_response_local_var->ip_sm_gw = ip_sm_gw; + routing_info_sm_response_local_var->sms_router = sms_router; + + return routing_info_sm_response_local_var; +} + +void OpenAPI_routing_info_sm_response_free(OpenAPI_routing_info_sm_response_t *routing_info_sm_response) +{ + OpenAPI_lnode_t *node = NULL; + + if (NULL == routing_info_sm_response) { + return; + } + if (routing_info_sm_response->supi) { + ogs_free(routing_info_sm_response->supi); + routing_info_sm_response->supi = NULL; + } + if (routing_info_sm_response->smsf3_gpp) { + OpenAPI_smsf_registration_free(routing_info_sm_response->smsf3_gpp); + routing_info_sm_response->smsf3_gpp = NULL; + } + if (routing_info_sm_response->smsf_non3_gpp) { + OpenAPI_smsf_registration_free(routing_info_sm_response->smsf_non3_gpp); + routing_info_sm_response->smsf_non3_gpp = NULL; + } + if (routing_info_sm_response->ip_sm_gw) { + OpenAPI_ip_sm_gw_info_free(routing_info_sm_response->ip_sm_gw); + routing_info_sm_response->ip_sm_gw = NULL; + } + if (routing_info_sm_response->sms_router) { + OpenAPI_sms_router_info_free(routing_info_sm_response->sms_router); + routing_info_sm_response->sms_router = NULL; + } + ogs_free(routing_info_sm_response); +} + +cJSON *OpenAPI_routing_info_sm_response_convertToJSON(OpenAPI_routing_info_sm_response_t *routing_info_sm_response) +{ + cJSON *item = NULL; + OpenAPI_lnode_t *node = NULL; + + if (routing_info_sm_response == NULL) { + ogs_error("OpenAPI_routing_info_sm_response_convertToJSON() failed [RoutingInfoSmResponse]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (routing_info_sm_response->supi) { + if (cJSON_AddStringToObject(item, "supi", routing_info_sm_response->supi) == NULL) { + ogs_error("OpenAPI_routing_info_sm_response_convertToJSON() failed [supi]"); + goto end; + } + } + + if (routing_info_sm_response->smsf3_gpp) { + cJSON *smsf3_gpp_local_JSON = OpenAPI_smsf_registration_convertToJSON(routing_info_sm_response->smsf3_gpp); + if (smsf3_gpp_local_JSON == NULL) { + ogs_error("OpenAPI_routing_info_sm_response_convertToJSON() failed [smsf3_gpp]"); + goto end; + } + cJSON_AddItemToObject(item, "smsf3Gpp", smsf3_gpp_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_routing_info_sm_response_convertToJSON() failed [smsf3_gpp]"); + goto end; + } + } + + if (routing_info_sm_response->smsf_non3_gpp) { + cJSON *smsf_non3_gpp_local_JSON = OpenAPI_smsf_registration_convertToJSON(routing_info_sm_response->smsf_non3_gpp); + if (smsf_non3_gpp_local_JSON == NULL) { + ogs_error("OpenAPI_routing_info_sm_response_convertToJSON() failed [smsf_non3_gpp]"); + goto end; + } + cJSON_AddItemToObject(item, "smsfNon3Gpp", smsf_non3_gpp_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_routing_info_sm_response_convertToJSON() failed [smsf_non3_gpp]"); + goto end; + } + } + + if (routing_info_sm_response->ip_sm_gw) { + cJSON *ip_sm_gw_local_JSON = OpenAPI_ip_sm_gw_info_convertToJSON(routing_info_sm_response->ip_sm_gw); + if (ip_sm_gw_local_JSON == NULL) { + ogs_error("OpenAPI_routing_info_sm_response_convertToJSON() failed [ip_sm_gw]"); + goto end; + } + cJSON_AddItemToObject(item, "ipSmGw", ip_sm_gw_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_routing_info_sm_response_convertToJSON() failed [ip_sm_gw]"); + goto end; + } + } + + if (routing_info_sm_response->sms_router) { + cJSON *sms_router_local_JSON = OpenAPI_sms_router_info_convertToJSON(routing_info_sm_response->sms_router); + if (sms_router_local_JSON == NULL) { + ogs_error("OpenAPI_routing_info_sm_response_convertToJSON() failed [sms_router]"); + goto end; + } + cJSON_AddItemToObject(item, "smsRouter", sms_router_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_routing_info_sm_response_convertToJSON() failed [sms_router]"); + goto end; + } + } + +end: + return item; +} + +OpenAPI_routing_info_sm_response_t *OpenAPI_routing_info_sm_response_parseFromJSON(cJSON *routing_info_sm_responseJSON) +{ + OpenAPI_routing_info_sm_response_t *routing_info_sm_response_local_var = NULL; + OpenAPI_lnode_t *node = NULL; + cJSON *supi = NULL; + cJSON *smsf3_gpp = NULL; + OpenAPI_smsf_registration_t *smsf3_gpp_local_nonprim = NULL; + cJSON *smsf_non3_gpp = NULL; + OpenAPI_smsf_registration_t *smsf_non3_gpp_local_nonprim = NULL; + cJSON *ip_sm_gw = NULL; + OpenAPI_ip_sm_gw_info_t *ip_sm_gw_local_nonprim = NULL; + cJSON *sms_router = NULL; + OpenAPI_sms_router_info_t *sms_router_local_nonprim = NULL; + supi = cJSON_GetObjectItemCaseSensitive(routing_info_sm_responseJSON, "supi"); + if (supi) { + if (!cJSON_IsString(supi) && !cJSON_IsNull(supi)) { + ogs_error("OpenAPI_routing_info_sm_response_parseFromJSON() failed [supi]"); + goto end; + } + } + + smsf3_gpp = cJSON_GetObjectItemCaseSensitive(routing_info_sm_responseJSON, "smsf3Gpp"); + if (smsf3_gpp) { + smsf3_gpp_local_nonprim = OpenAPI_smsf_registration_parseFromJSON(smsf3_gpp); + } + + smsf_non3_gpp = cJSON_GetObjectItemCaseSensitive(routing_info_sm_responseJSON, "smsfNon3Gpp"); + if (smsf_non3_gpp) { + smsf_non3_gpp_local_nonprim = OpenAPI_smsf_registration_parseFromJSON(smsf_non3_gpp); + } + + ip_sm_gw = cJSON_GetObjectItemCaseSensitive(routing_info_sm_responseJSON, "ipSmGw"); + if (ip_sm_gw) { + ip_sm_gw_local_nonprim = OpenAPI_ip_sm_gw_info_parseFromJSON(ip_sm_gw); + } + + sms_router = cJSON_GetObjectItemCaseSensitive(routing_info_sm_responseJSON, "smsRouter"); + if (sms_router) { + sms_router_local_nonprim = OpenAPI_sms_router_info_parseFromJSON(sms_router); + } + + routing_info_sm_response_local_var = OpenAPI_routing_info_sm_response_create ( + supi && !cJSON_IsNull(supi) ? ogs_strdup(supi->valuestring) : NULL, + smsf3_gpp ? smsf3_gpp_local_nonprim : NULL, + smsf_non3_gpp ? smsf_non3_gpp_local_nonprim : NULL, + ip_sm_gw ? ip_sm_gw_local_nonprim : NULL, + sms_router ? sms_router_local_nonprim : NULL + ); + + return routing_info_sm_response_local_var; +end: + if (smsf3_gpp_local_nonprim) { + OpenAPI_smsf_registration_free(smsf3_gpp_local_nonprim); + smsf3_gpp_local_nonprim = NULL; + } + if (smsf_non3_gpp_local_nonprim) { + OpenAPI_smsf_registration_free(smsf_non3_gpp_local_nonprim); + smsf_non3_gpp_local_nonprim = NULL; + } + if (ip_sm_gw_local_nonprim) { + OpenAPI_ip_sm_gw_info_free(ip_sm_gw_local_nonprim); + ip_sm_gw_local_nonprim = NULL; + } + if (sms_router_local_nonprim) { + OpenAPI_sms_router_info_free(sms_router_local_nonprim); + sms_router_local_nonprim = NULL; + } + return NULL; +} + +OpenAPI_routing_info_sm_response_t *OpenAPI_routing_info_sm_response_copy(OpenAPI_routing_info_sm_response_t *dst, OpenAPI_routing_info_sm_response_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_routing_info_sm_response_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_routing_info_sm_response_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_routing_info_sm_response_free(dst); + dst = OpenAPI_routing_info_sm_response_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/routing_info_sm_response.h b/lib/sbi/openapi/model/routing_info_sm_response.h new file mode 100644 index 000000000..b0f768471 --- /dev/null +++ b/lib/sbi/openapi/model/routing_info_sm_response.h @@ -0,0 +1,49 @@ +/* + * routing_info_sm_response.h + * + * Addressing information of available nodes for SMS delivery + */ + +#ifndef _OpenAPI_routing_info_sm_response_H_ +#define _OpenAPI_routing_info_sm_response_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "ip_sm_gw_info.h" +#include "sms_router_info.h" +#include "smsf_registration.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_routing_info_sm_response_s OpenAPI_routing_info_sm_response_t; +typedef struct OpenAPI_routing_info_sm_response_s { + char *supi; + struct OpenAPI_smsf_registration_s *smsf3_gpp; + struct OpenAPI_smsf_registration_s *smsf_non3_gpp; + struct OpenAPI_ip_sm_gw_info_s *ip_sm_gw; + struct OpenAPI_sms_router_info_s *sms_router; +} OpenAPI_routing_info_sm_response_t; + +OpenAPI_routing_info_sm_response_t *OpenAPI_routing_info_sm_response_create( + char *supi, + OpenAPI_smsf_registration_t *smsf3_gpp, + OpenAPI_smsf_registration_t *smsf_non3_gpp, + OpenAPI_ip_sm_gw_info_t *ip_sm_gw, + OpenAPI_sms_router_info_t *sms_router +); +void OpenAPI_routing_info_sm_response_free(OpenAPI_routing_info_sm_response_t *routing_info_sm_response); +OpenAPI_routing_info_sm_response_t *OpenAPI_routing_info_sm_response_parseFromJSON(cJSON *routing_info_sm_responseJSON); +cJSON *OpenAPI_routing_info_sm_response_convertToJSON(OpenAPI_routing_info_sm_response_t *routing_info_sm_response); +OpenAPI_routing_info_sm_response_t *OpenAPI_routing_info_sm_response_copy(OpenAPI_routing_info_sm_response_t *dst, OpenAPI_routing_info_sm_response_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_routing_info_sm_response_H_ */ + diff --git a/lib/sbi/openapi/model/rsn.c b/lib/sbi/openapi/model/rsn.c index 5b949b94f..1c71a198e 100644 --- a/lib/sbi/openapi/model/rsn.c +++ b/lib/sbi/openapi/model/rsn.c @@ -6,7 +6,7 @@ char* OpenAPI_rsn_ToString(OpenAPI_rsn_e rsn) { - const char *rsnArray[] = { "NULL", "V1", "V2" }; + const char *rsnArray[] = { "NULL", "V1", "V2", "NONE" }; size_t sizeofArray = sizeof(rsnArray) / sizeof(rsnArray[0]); if (rsn < sizeofArray) return (char *)rsnArray[rsn]; @@ -17,7 +17,7 @@ char* OpenAPI_rsn_ToString(OpenAPI_rsn_e rsn) OpenAPI_rsn_e OpenAPI_rsn_FromString(char* rsn) { int stringToReturn = 0; - const char *rsnArray[] = { "NULL", "V1", "V2" }; + const char *rsnArray[] = { "NULL", "V1", "V2", "NONE" }; size_t sizeofArray = sizeof(rsnArray) / sizeof(rsnArray[0]); while (stringToReturn < sizeofArray) { if (strcmp(rsn, rsnArray[stringToReturn]) == 0) { diff --git a/lib/sbi/openapi/model/rsn.h b/lib/sbi/openapi/model/rsn.h index 5669b43b1..116a59c4e 100644 --- a/lib/sbi/openapi/model/rsn.h +++ b/lib/sbi/openapi/model/rsn.h @@ -17,7 +17,7 @@ extern "C" { #endif -typedef enum { OpenAPI_rsn_NULL = 0, OpenAPI_rsn_V1, OpenAPI_rsn_V2 } OpenAPI_rsn_e; +typedef enum { OpenAPI_rsn_NULL = 0, OpenAPI_rsn_V1, OpenAPI_rsn_V2, OpenAPI_rsn_NONE } OpenAPI_rsn_e; char* OpenAPI_rsn_ToString(OpenAPI_rsn_e rsn); diff --git a/lib/sbi/openapi/model/rule_report.c b/lib/sbi/openapi/model/rule_report.c index 818ba5639..72e878aea 100644 --- a/lib/sbi/openapi/model/rule_report.c +++ b/lib/sbi/openapi/model/rule_report.c @@ -10,7 +10,8 @@ OpenAPI_rule_report_t *OpenAPI_rule_report_create( OpenAPI_list_t *cont_vers, OpenAPI_failure_code_e failure_code, OpenAPI_final_unit_action_t *fin_unit_act, - OpenAPI_list_t *ran_nas_rel_causes + OpenAPI_list_t *ran_nas_rel_causes, + char *alt_qos_param_id ) { OpenAPI_rule_report_t *rule_report_local_var = ogs_malloc(sizeof(OpenAPI_rule_report_t)); @@ -22,6 +23,7 @@ OpenAPI_rule_report_t *OpenAPI_rule_report_create( rule_report_local_var->failure_code = failure_code; rule_report_local_var->fin_unit_act = fin_unit_act; rule_report_local_var->ran_nas_rel_causes = ran_nas_rel_causes; + rule_report_local_var->alt_qos_param_id = alt_qos_param_id; return rule_report_local_var; } @@ -58,6 +60,10 @@ void OpenAPI_rule_report_free(OpenAPI_rule_report_t *rule_report) OpenAPI_list_free(rule_report->ran_nas_rel_causes); rule_report->ran_nas_rel_causes = NULL; } + if (rule_report->alt_qos_param_id) { + ogs_free(rule_report->alt_qos_param_id); + rule_report->alt_qos_param_id = NULL; + } ogs_free(rule_report); } @@ -147,6 +153,13 @@ cJSON *OpenAPI_rule_report_convertToJSON(OpenAPI_rule_report_t *rule_report) } } + if (rule_report->alt_qos_param_id) { + if (cJSON_AddStringToObject(item, "altQosParamId", rule_report->alt_qos_param_id) == NULL) { + ogs_error("OpenAPI_rule_report_convertToJSON() failed [alt_qos_param_id]"); + goto end; + } + } + end: return item; } @@ -167,6 +180,7 @@ OpenAPI_rule_report_t *OpenAPI_rule_report_parseFromJSON(cJSON *rule_reportJSON) OpenAPI_final_unit_action_t *fin_unit_act_local_nonprim = NULL; cJSON *ran_nas_rel_causes = NULL; OpenAPI_list_t *ran_nas_rel_causesList = NULL; + cJSON *alt_qos_param_id = NULL; pcc_rule_ids = cJSON_GetObjectItemCaseSensitive(rule_reportJSON, "pccRuleIds"); if (!pcc_rule_ids) { ogs_error("OpenAPI_rule_report_parseFromJSON() failed [pcc_rule_ids]"); @@ -267,13 +281,22 @@ OpenAPI_rule_report_t *OpenAPI_rule_report_parseFromJSON(cJSON *rule_reportJSON) } } + alt_qos_param_id = cJSON_GetObjectItemCaseSensitive(rule_reportJSON, "altQosParamId"); + if (alt_qos_param_id) { + if (!cJSON_IsString(alt_qos_param_id) && !cJSON_IsNull(alt_qos_param_id)) { + ogs_error("OpenAPI_rule_report_parseFromJSON() failed [alt_qos_param_id]"); + goto end; + } + } + rule_report_local_var = OpenAPI_rule_report_create ( pcc_rule_idsList, rule_statusVariable, cont_vers ? cont_versList : NULL, failure_code ? failure_codeVariable : 0, fin_unit_act ? fin_unit_act_local_nonprim : NULL, - ran_nas_rel_causes ? ran_nas_rel_causesList : NULL + ran_nas_rel_causes ? ran_nas_rel_causesList : NULL, + alt_qos_param_id && !cJSON_IsNull(alt_qos_param_id) ? ogs_strdup(alt_qos_param_id->valuestring) : NULL ); return rule_report_local_var; diff --git a/lib/sbi/openapi/model/rule_report.h b/lib/sbi/openapi/model/rule_report.h index 172e000cd..673df1653 100644 --- a/lib/sbi/openapi/model/rule_report.h +++ b/lib/sbi/openapi/model/rule_report.h @@ -1,7 +1,7 @@ /* * rule_report.h * - * + * Reports the status of PCC. */ #ifndef _OpenAPI_rule_report_H_ @@ -29,6 +29,7 @@ typedef struct OpenAPI_rule_report_s { OpenAPI_failure_code_e failure_code; struct OpenAPI_final_unit_action_s *fin_unit_act; OpenAPI_list_t *ran_nas_rel_causes; + char *alt_qos_param_id; } OpenAPI_rule_report_t; OpenAPI_rule_report_t *OpenAPI_rule_report_create( @@ -37,7 +38,8 @@ OpenAPI_rule_report_t *OpenAPI_rule_report_create( OpenAPI_list_t *cont_vers, OpenAPI_failure_code_e failure_code, OpenAPI_final_unit_action_t *fin_unit_act, - OpenAPI_list_t *ran_nas_rel_causes + OpenAPI_list_t *ran_nas_rel_causes, + char *alt_qos_param_id ); void OpenAPI_rule_report_free(OpenAPI_rule_report_t *rule_report); OpenAPI_rule_report_t *OpenAPI_rule_report_parseFromJSON(cJSON *rule_reportJSON); diff --git a/lib/sbi/openapi/model/satellite_backhaul_category.c b/lib/sbi/openapi/model/satellite_backhaul_category.c new file mode 100644 index 000000000..7c1499ca9 --- /dev/null +++ b/lib/sbi/openapi/model/satellite_backhaul_category.c @@ -0,0 +1,30 @@ + +#include +#include +#include +#include "satellite_backhaul_category.h" + +char* OpenAPI_satellite_backhaul_category_ToString(OpenAPI_satellite_backhaul_category_e satellite_backhaul_category) +{ + const char *satellite_backhaul_categoryArray[] = { "NULL", "GEO", "MEO", "LEO", "OTHER_SAT", "NON_SATELLITE" }; + size_t sizeofArray = sizeof(satellite_backhaul_categoryArray) / sizeof(satellite_backhaul_categoryArray[0]); + if (satellite_backhaul_category < sizeofArray) + return (char *)satellite_backhaul_categoryArray[satellite_backhaul_category]; + else + return (char *)"Unknown"; +} + +OpenAPI_satellite_backhaul_category_e OpenAPI_satellite_backhaul_category_FromString(char* satellite_backhaul_category) +{ + int stringToReturn = 0; + const char *satellite_backhaul_categoryArray[] = { "NULL", "GEO", "MEO", "LEO", "OTHER_SAT", "NON_SATELLITE" }; + size_t sizeofArray = sizeof(satellite_backhaul_categoryArray) / sizeof(satellite_backhaul_categoryArray[0]); + while (stringToReturn < sizeofArray) { + if (strcmp(satellite_backhaul_category, satellite_backhaul_categoryArray[stringToReturn]) == 0) { + return stringToReturn; + } + stringToReturn++; + } + return 0; +} + diff --git a/lib/sbi/openapi/model/satellite_backhaul_category.h b/lib/sbi/openapi/model/satellite_backhaul_category.h new file mode 100644 index 000000000..42eb06083 --- /dev/null +++ b/lib/sbi/openapi/model/satellite_backhaul_category.h @@ -0,0 +1,31 @@ +/* + * satellite_backhaul_category.h + * + * + */ + +#ifndef _OpenAPI_satellite_backhaul_category_H_ +#define _OpenAPI_satellite_backhaul_category_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef enum { OpenAPI_satellite_backhaul_category_NULL = 0, OpenAPI_satellite_backhaul_category_GEO, OpenAPI_satellite_backhaul_category_MEO, OpenAPI_satellite_backhaul_category_LEO, OpenAPI_satellite_backhaul_category_OTHER_SAT, OpenAPI_satellite_backhaul_category_NON_SATELLITE } OpenAPI_satellite_backhaul_category_e; + +char* OpenAPI_satellite_backhaul_category_ToString(OpenAPI_satellite_backhaul_category_e satellite_backhaul_category); + +OpenAPI_satellite_backhaul_category_e OpenAPI_satellite_backhaul_category_FromString(char* satellite_backhaul_category); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_satellite_backhaul_category_H_ */ + diff --git a/lib/sbi/openapi/model/scheduled_communication_time.h b/lib/sbi/openapi/model/scheduled_communication_time.h index 03bd5c7e8..b66a1f635 100644 --- a/lib/sbi/openapi/model/scheduled_communication_time.h +++ b/lib/sbi/openapi/model/scheduled_communication_time.h @@ -1,7 +1,7 @@ /* * scheduled_communication_time.h * - * + * Identifies time and day of the week when the UE is available for communication. */ #ifndef _OpenAPI_scheduled_communication_time_H_ diff --git a/lib/sbi/openapi/model/scheduled_communication_time_1.h b/lib/sbi/openapi/model/scheduled_communication_time_1.h index 9409dda79..16e17c50c 100644 --- a/lib/sbi/openapi/model/scheduled_communication_time_1.h +++ b/lib/sbi/openapi/model/scheduled_communication_time_1.h @@ -1,7 +1,7 @@ /* * scheduled_communication_time_1.h * - * + * Represents an offered scheduled communication time. */ #ifndef _OpenAPI_scheduled_communication_time_1_H_ diff --git a/lib/sbi/openapi/model/scheduled_communication_time_rm.h b/lib/sbi/openapi/model/scheduled_communication_time_rm.h index e38dd971d..69bb945fd 100644 --- a/lib/sbi/openapi/model/scheduled_communication_time_rm.h +++ b/lib/sbi/openapi/model/scheduled_communication_time_rm.h @@ -1,7 +1,7 @@ /* * scheduled_communication_time_rm.h * - * + * This data type is defined in the same way as the 'ScheduledCommunicationTime' data type, but with the OpenAPI 'nullable: true' property. */ #ifndef _OpenAPI_scheduled_communication_time_rm_H_ diff --git a/lib/sbi/openapi/model/scheduled_communication_type_rm.h b/lib/sbi/openapi/model/scheduled_communication_type_rm.h index 1eb87535e..777cd83ac 100644 --- a/lib/sbi/openapi/model/scheduled_communication_type_rm.h +++ b/lib/sbi/openapi/model/scheduled_communication_type_rm.h @@ -1,7 +1,7 @@ /* * scheduled_communication_type_rm.h * - * + * This enumeration is defined in the same way as the 'ScheduledCommunicationTypen' enumeration, but with the OpenAPI 'nullable: true' property.\" */ #ifndef _OpenAPI_scheduled_communication_type_rm_H_ diff --git a/lib/sbi/openapi/model/scp_capability.c b/lib/sbi/openapi/model/scp_capability.c new file mode 100644 index 000000000..cb434f2c1 --- /dev/null +++ b/lib/sbi/openapi/model/scp_capability.c @@ -0,0 +1,30 @@ + +#include +#include +#include +#include "scp_capability.h" + +char* OpenAPI_scp_capability_ToString(OpenAPI_scp_capability_e scp_capability) +{ + const char *scp_capabilityArray[] = { "NULL", "INDIRECT_COM_WITH_DELEG_DISC" }; + size_t sizeofArray = sizeof(scp_capabilityArray) / sizeof(scp_capabilityArray[0]); + if (scp_capability < sizeofArray) + return (char *)scp_capabilityArray[scp_capability]; + else + return (char *)"Unknown"; +} + +OpenAPI_scp_capability_e OpenAPI_scp_capability_FromString(char* scp_capability) +{ + int stringToReturn = 0; + const char *scp_capabilityArray[] = { "NULL", "INDIRECT_COM_WITH_DELEG_DISC" }; + size_t sizeofArray = sizeof(scp_capabilityArray) / sizeof(scp_capabilityArray[0]); + while (stringToReturn < sizeofArray) { + if (strcmp(scp_capability, scp_capabilityArray[stringToReturn]) == 0) { + return stringToReturn; + } + stringToReturn++; + } + return 0; +} + diff --git a/lib/sbi/openapi/model/scp_capability.h b/lib/sbi/openapi/model/scp_capability.h new file mode 100644 index 000000000..ecf4ef7af --- /dev/null +++ b/lib/sbi/openapi/model/scp_capability.h @@ -0,0 +1,31 @@ +/* + * scp_capability.h + * + * + */ + +#ifndef _OpenAPI_scp_capability_H_ +#define _OpenAPI_scp_capability_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef enum { OpenAPI_scp_capability_NULL = 0, OpenAPI_scp_capability_INDIRECT_COM_WITH_DELEG_DISC } OpenAPI_scp_capability_e; + +char* OpenAPI_scp_capability_ToString(OpenAPI_scp_capability_e scp_capability); + +OpenAPI_scp_capability_e OpenAPI_scp_capability_FromString(char* scp_capability); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_scp_capability_H_ */ + diff --git a/lib/sbi/openapi/model/scp_domain_cond.c b/lib/sbi/openapi/model/scp_domain_cond.c index 72342269a..82bc0c2e6 100644 --- a/lib/sbi/openapi/model/scp_domain_cond.c +++ b/lib/sbi/openapi/model/scp_domain_cond.c @@ -5,13 +5,15 @@ #include "scp_domain_cond.h" OpenAPI_scp_domain_cond_t *OpenAPI_scp_domain_cond_create( - OpenAPI_list_t *scp_domains + OpenAPI_list_t *scp_domains, + OpenAPI_list_t *nf_type_list ) { OpenAPI_scp_domain_cond_t *scp_domain_cond_local_var = ogs_malloc(sizeof(OpenAPI_scp_domain_cond_t)); ogs_assert(scp_domain_cond_local_var); scp_domain_cond_local_var->scp_domains = scp_domains; + scp_domain_cond_local_var->nf_type_list = nf_type_list; return scp_domain_cond_local_var; } @@ -30,6 +32,10 @@ void OpenAPI_scp_domain_cond_free(OpenAPI_scp_domain_cond_t *scp_domain_cond) OpenAPI_list_free(scp_domain_cond->scp_domains); scp_domain_cond->scp_domains = NULL; } + if (scp_domain_cond->nf_type_list) { + OpenAPI_list_free(scp_domain_cond->nf_type_list); + scp_domain_cond->nf_type_list = NULL; + } ogs_free(scp_domain_cond); } @@ -44,7 +50,10 @@ cJSON *OpenAPI_scp_domain_cond_convertToJSON(OpenAPI_scp_domain_cond_t *scp_doma } item = cJSON_CreateObject(); - if (scp_domain_cond->scp_domains) { + if (!scp_domain_cond->scp_domains) { + ogs_error("OpenAPI_scp_domain_cond_convertToJSON() failed [scp_domains]"); + return NULL; + } cJSON *scp_domainsList = cJSON_AddArrayToObject(item, "scpDomains"); if (scp_domainsList == NULL) { ogs_error("OpenAPI_scp_domain_cond_convertToJSON() failed [scp_domains]"); @@ -56,6 +65,19 @@ cJSON *OpenAPI_scp_domain_cond_convertToJSON(OpenAPI_scp_domain_cond_t *scp_doma goto end; } } + + if (scp_domain_cond->nf_type_list != OpenAPI_nf_type_NULL) { + cJSON *nf_type_listList = cJSON_AddArrayToObject(item, "nfTypeList"); + if (nf_type_listList == NULL) { + ogs_error("OpenAPI_scp_domain_cond_convertToJSON() failed [nf_type_list]"); + goto end; + } + OpenAPI_list_for_each(scp_domain_cond->nf_type_list, node) { + if (cJSON_AddStringToObject(nf_type_listList, "", OpenAPI_nf_type_ToString((intptr_t)node->data)) == NULL) { + ogs_error("OpenAPI_scp_domain_cond_convertToJSON() failed [nf_type_list]"); + goto end; + } + } } end: @@ -68,8 +90,13 @@ OpenAPI_scp_domain_cond_t *OpenAPI_scp_domain_cond_parseFromJSON(cJSON *scp_doma OpenAPI_lnode_t *node = NULL; cJSON *scp_domains = NULL; OpenAPI_list_t *scp_domainsList = NULL; + cJSON *nf_type_list = NULL; + OpenAPI_list_t *nf_type_listList = NULL; scp_domains = cJSON_GetObjectItemCaseSensitive(scp_domain_condJSON, "scpDomains"); - if (scp_domains) { + if (!scp_domains) { + ogs_error("OpenAPI_scp_domain_cond_parseFromJSON() failed [scp_domains]"); + goto end; + } cJSON *scp_domains_local = NULL; if (!cJSON_IsArray(scp_domains)) { ogs_error("OpenAPI_scp_domain_cond_parseFromJSON() failed [scp_domains]"); @@ -87,10 +114,29 @@ OpenAPI_scp_domain_cond_t *OpenAPI_scp_domain_cond_parseFromJSON(cJSON *scp_doma } OpenAPI_list_add(scp_domainsList, ogs_strdup(scp_domains_local->valuestring)); } + + nf_type_list = cJSON_GetObjectItemCaseSensitive(scp_domain_condJSON, "nfTypeList"); + if (nf_type_list) { + cJSON *nf_type_list_local = NULL; + if (!cJSON_IsArray(nf_type_list)) { + ogs_error("OpenAPI_scp_domain_cond_parseFromJSON() failed [nf_type_list]"); + goto end; + } + + nf_type_listList = OpenAPI_list_create(); + + cJSON_ArrayForEach(nf_type_list_local, nf_type_list) { + if (!cJSON_IsString(nf_type_list_local)) { + ogs_error("OpenAPI_scp_domain_cond_parseFromJSON() failed [nf_type_list]"); + goto end; + } + OpenAPI_list_add(nf_type_listList, (void *)OpenAPI_nf_type_FromString(nf_type_list_local->valuestring)); + } } scp_domain_cond_local_var = OpenAPI_scp_domain_cond_create ( - scp_domains ? scp_domainsList : NULL + scp_domainsList, + nf_type_list ? nf_type_listList : NULL ); return scp_domain_cond_local_var; @@ -102,6 +148,10 @@ end: OpenAPI_list_free(scp_domainsList); scp_domainsList = NULL; } + if (nf_type_listList) { + OpenAPI_list_free(nf_type_listList); + nf_type_listList = NULL; + } return NULL; } diff --git a/lib/sbi/openapi/model/scp_domain_cond.h b/lib/sbi/openapi/model/scp_domain_cond.h index 0918807ff..a9995c454 100644 --- a/lib/sbi/openapi/model/scp_domain_cond.h +++ b/lib/sbi/openapi/model/scp_domain_cond.h @@ -1,7 +1,7 @@ /* * scp_domain_cond.h * - * Subscription to a set of NF or SCP instances belonging to certain SCP domains + * Subscription to a set of NF or SCP or SEPP instances belonging to certain SCP domains */ #ifndef _OpenAPI_scp_domain_cond_H_ @@ -12,6 +12,7 @@ #include "../include/list.h" #include "../include/keyValuePair.h" #include "../include/binary.h" +#include "nf_type.h" #ifdef __cplusplus extern "C" { @@ -20,10 +21,12 @@ extern "C" { typedef struct OpenAPI_scp_domain_cond_s OpenAPI_scp_domain_cond_t; typedef struct OpenAPI_scp_domain_cond_s { OpenAPI_list_t *scp_domains; + OpenAPI_list_t *nf_type_list; } OpenAPI_scp_domain_cond_t; OpenAPI_scp_domain_cond_t *OpenAPI_scp_domain_cond_create( - OpenAPI_list_t *scp_domains + OpenAPI_list_t *scp_domains, + OpenAPI_list_t *nf_type_list ); void OpenAPI_scp_domain_cond_free(OpenAPI_scp_domain_cond_t *scp_domain_cond); OpenAPI_scp_domain_cond_t *OpenAPI_scp_domain_cond_parseFromJSON(cJSON *scp_domain_condJSON); diff --git a/lib/sbi/openapi/model/scp_domain_connectivity.c b/lib/sbi/openapi/model/scp_domain_connectivity.c new file mode 100644 index 000000000..a6224315b --- /dev/null +++ b/lib/sbi/openapi/model/scp_domain_connectivity.c @@ -0,0 +1,145 @@ + +#include +#include +#include +#include "scp_domain_connectivity.h" + +OpenAPI_scp_domain_connectivity_t *OpenAPI_scp_domain_connectivity_create( + OpenAPI_list_t *connected_scp_domain_list +) +{ + OpenAPI_scp_domain_connectivity_t *scp_domain_connectivity_local_var = ogs_malloc(sizeof(OpenAPI_scp_domain_connectivity_t)); + ogs_assert(scp_domain_connectivity_local_var); + + scp_domain_connectivity_local_var->connected_scp_domain_list = connected_scp_domain_list; + + return scp_domain_connectivity_local_var; +} + +void OpenAPI_scp_domain_connectivity_free(OpenAPI_scp_domain_connectivity_t *scp_domain_connectivity) +{ + OpenAPI_lnode_t *node = NULL; + + if (NULL == scp_domain_connectivity) { + return; + } + if (scp_domain_connectivity->connected_scp_domain_list) { + OpenAPI_list_for_each(scp_domain_connectivity->connected_scp_domain_list, node) { + ogs_free(node->data); + } + OpenAPI_list_free(scp_domain_connectivity->connected_scp_domain_list); + scp_domain_connectivity->connected_scp_domain_list = NULL; + } + ogs_free(scp_domain_connectivity); +} + +cJSON *OpenAPI_scp_domain_connectivity_convertToJSON(OpenAPI_scp_domain_connectivity_t *scp_domain_connectivity) +{ + cJSON *item = NULL; + OpenAPI_lnode_t *node = NULL; + + if (scp_domain_connectivity == NULL) { + ogs_error("OpenAPI_scp_domain_connectivity_convertToJSON() failed [ScpDomainConnectivity]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (!scp_domain_connectivity->connected_scp_domain_list) { + ogs_error("OpenAPI_scp_domain_connectivity_convertToJSON() failed [connected_scp_domain_list]"); + return NULL; + } + cJSON *connected_scp_domain_listList = cJSON_AddArrayToObject(item, "connectedScpDomainList"); + if (connected_scp_domain_listList == NULL) { + ogs_error("OpenAPI_scp_domain_connectivity_convertToJSON() failed [connected_scp_domain_list]"); + goto end; + } + OpenAPI_list_for_each(scp_domain_connectivity->connected_scp_domain_list, node) { + if (cJSON_AddStringToObject(connected_scp_domain_listList, "", (char*)node->data) == NULL) { + ogs_error("OpenAPI_scp_domain_connectivity_convertToJSON() failed [connected_scp_domain_list]"); + goto end; + } + } + +end: + return item; +} + +OpenAPI_scp_domain_connectivity_t *OpenAPI_scp_domain_connectivity_parseFromJSON(cJSON *scp_domain_connectivityJSON) +{ + OpenAPI_scp_domain_connectivity_t *scp_domain_connectivity_local_var = NULL; + OpenAPI_lnode_t *node = NULL; + cJSON *connected_scp_domain_list = NULL; + OpenAPI_list_t *connected_scp_domain_listList = NULL; + connected_scp_domain_list = cJSON_GetObjectItemCaseSensitive(scp_domain_connectivityJSON, "connectedScpDomainList"); + if (!connected_scp_domain_list) { + ogs_error("OpenAPI_scp_domain_connectivity_parseFromJSON() failed [connected_scp_domain_list]"); + goto end; + } + cJSON *connected_scp_domain_list_local = NULL; + if (!cJSON_IsArray(connected_scp_domain_list)) { + ogs_error("OpenAPI_scp_domain_connectivity_parseFromJSON() failed [connected_scp_domain_list]"); + goto end; + } + + connected_scp_domain_listList = OpenAPI_list_create(); + + cJSON_ArrayForEach(connected_scp_domain_list_local, connected_scp_domain_list) { + double *localDouble = NULL; + int *localInt = NULL; + if (!cJSON_IsString(connected_scp_domain_list_local)) { + ogs_error("OpenAPI_scp_domain_connectivity_parseFromJSON() failed [connected_scp_domain_list]"); + goto end; + } + OpenAPI_list_add(connected_scp_domain_listList, ogs_strdup(connected_scp_domain_list_local->valuestring)); + } + + scp_domain_connectivity_local_var = OpenAPI_scp_domain_connectivity_create ( + connected_scp_domain_listList + ); + + return scp_domain_connectivity_local_var; +end: + if (connected_scp_domain_listList) { + OpenAPI_list_for_each(connected_scp_domain_listList, node) { + ogs_free(node->data); + } + OpenAPI_list_free(connected_scp_domain_listList); + connected_scp_domain_listList = NULL; + } + return NULL; +} + +OpenAPI_scp_domain_connectivity_t *OpenAPI_scp_domain_connectivity_copy(OpenAPI_scp_domain_connectivity_t *dst, OpenAPI_scp_domain_connectivity_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_scp_domain_connectivity_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_scp_domain_connectivity_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_scp_domain_connectivity_free(dst); + dst = OpenAPI_scp_domain_connectivity_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/scp_domain_connectivity.h b/lib/sbi/openapi/model/scp_domain_connectivity.h new file mode 100644 index 000000000..4ee5101c0 --- /dev/null +++ b/lib/sbi/openapi/model/scp_domain_connectivity.h @@ -0,0 +1,38 @@ +/* + * scp_domain_connectivity.h + * + * SCP Domain Connectivity Information + */ + +#ifndef _OpenAPI_scp_domain_connectivity_H_ +#define _OpenAPI_scp_domain_connectivity_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_scp_domain_connectivity_s OpenAPI_scp_domain_connectivity_t; +typedef struct OpenAPI_scp_domain_connectivity_s { + OpenAPI_list_t *connected_scp_domain_list; +} OpenAPI_scp_domain_connectivity_t; + +OpenAPI_scp_domain_connectivity_t *OpenAPI_scp_domain_connectivity_create( + OpenAPI_list_t *connected_scp_domain_list +); +void OpenAPI_scp_domain_connectivity_free(OpenAPI_scp_domain_connectivity_t *scp_domain_connectivity); +OpenAPI_scp_domain_connectivity_t *OpenAPI_scp_domain_connectivity_parseFromJSON(cJSON *scp_domain_connectivityJSON); +cJSON *OpenAPI_scp_domain_connectivity_convertToJSON(OpenAPI_scp_domain_connectivity_t *scp_domain_connectivity); +OpenAPI_scp_domain_connectivity_t *OpenAPI_scp_domain_connectivity_copy(OpenAPI_scp_domain_connectivity_t *dst, OpenAPI_scp_domain_connectivity_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_scp_domain_connectivity_H_ */ + diff --git a/lib/sbi/openapi/model/scp_domain_routing_info_notification.c b/lib/sbi/openapi/model/scp_domain_routing_info_notification.c new file mode 100644 index 000000000..b1c5f3672 --- /dev/null +++ b/lib/sbi/openapi/model/scp_domain_routing_info_notification.c @@ -0,0 +1,144 @@ + +#include +#include +#include +#include "scp_domain_routing_info_notification.h" + +OpenAPI_scp_domain_routing_info_notification_t *OpenAPI_scp_domain_routing_info_notification_create( + OpenAPI_scp_domain_routing_information_t *routing_info, + bool is_local_ind, + int local_ind +) +{ + OpenAPI_scp_domain_routing_info_notification_t *scp_domain_routing_info_notification_local_var = ogs_malloc(sizeof(OpenAPI_scp_domain_routing_info_notification_t)); + ogs_assert(scp_domain_routing_info_notification_local_var); + + scp_domain_routing_info_notification_local_var->routing_info = routing_info; + scp_domain_routing_info_notification_local_var->is_local_ind = is_local_ind; + scp_domain_routing_info_notification_local_var->local_ind = local_ind; + + return scp_domain_routing_info_notification_local_var; +} + +void OpenAPI_scp_domain_routing_info_notification_free(OpenAPI_scp_domain_routing_info_notification_t *scp_domain_routing_info_notification) +{ + OpenAPI_lnode_t *node = NULL; + + if (NULL == scp_domain_routing_info_notification) { + return; + } + if (scp_domain_routing_info_notification->routing_info) { + OpenAPI_scp_domain_routing_information_free(scp_domain_routing_info_notification->routing_info); + scp_domain_routing_info_notification->routing_info = NULL; + } + ogs_free(scp_domain_routing_info_notification); +} + +cJSON *OpenAPI_scp_domain_routing_info_notification_convertToJSON(OpenAPI_scp_domain_routing_info_notification_t *scp_domain_routing_info_notification) +{ + cJSON *item = NULL; + OpenAPI_lnode_t *node = NULL; + + if (scp_domain_routing_info_notification == NULL) { + ogs_error("OpenAPI_scp_domain_routing_info_notification_convertToJSON() failed [ScpDomainRoutingInfoNotification]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (!scp_domain_routing_info_notification->routing_info) { + ogs_error("OpenAPI_scp_domain_routing_info_notification_convertToJSON() failed [routing_info]"); + return NULL; + } + cJSON *routing_info_local_JSON = OpenAPI_scp_domain_routing_information_convertToJSON(scp_domain_routing_info_notification->routing_info); + if (routing_info_local_JSON == NULL) { + ogs_error("OpenAPI_scp_domain_routing_info_notification_convertToJSON() failed [routing_info]"); + goto end; + } + cJSON_AddItemToObject(item, "routingInfo", routing_info_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_scp_domain_routing_info_notification_convertToJSON() failed [routing_info]"); + goto end; + } + + if (scp_domain_routing_info_notification->is_local_ind) { + if (cJSON_AddBoolToObject(item, "localInd", scp_domain_routing_info_notification->local_ind) == NULL) { + ogs_error("OpenAPI_scp_domain_routing_info_notification_convertToJSON() failed [local_ind]"); + goto end; + } + } + +end: + return item; +} + +OpenAPI_scp_domain_routing_info_notification_t *OpenAPI_scp_domain_routing_info_notification_parseFromJSON(cJSON *scp_domain_routing_info_notificationJSON) +{ + OpenAPI_scp_domain_routing_info_notification_t *scp_domain_routing_info_notification_local_var = NULL; + OpenAPI_lnode_t *node = NULL; + cJSON *routing_info = NULL; + OpenAPI_scp_domain_routing_information_t *routing_info_local_nonprim = NULL; + cJSON *local_ind = NULL; + routing_info = cJSON_GetObjectItemCaseSensitive(scp_domain_routing_info_notificationJSON, "routingInfo"); + if (!routing_info) { + ogs_error("OpenAPI_scp_domain_routing_info_notification_parseFromJSON() failed [routing_info]"); + goto end; + } + routing_info_local_nonprim = OpenAPI_scp_domain_routing_information_parseFromJSON(routing_info); + + local_ind = cJSON_GetObjectItemCaseSensitive(scp_domain_routing_info_notificationJSON, "localInd"); + if (local_ind) { + if (!cJSON_IsBool(local_ind)) { + ogs_error("OpenAPI_scp_domain_routing_info_notification_parseFromJSON() failed [local_ind]"); + goto end; + } + } + + scp_domain_routing_info_notification_local_var = OpenAPI_scp_domain_routing_info_notification_create ( + routing_info_local_nonprim, + local_ind ? true : false, + local_ind ? local_ind->valueint : 0 + ); + + return scp_domain_routing_info_notification_local_var; +end: + if (routing_info_local_nonprim) { + OpenAPI_scp_domain_routing_information_free(routing_info_local_nonprim); + routing_info_local_nonprim = NULL; + } + return NULL; +} + +OpenAPI_scp_domain_routing_info_notification_t *OpenAPI_scp_domain_routing_info_notification_copy(OpenAPI_scp_domain_routing_info_notification_t *dst, OpenAPI_scp_domain_routing_info_notification_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_scp_domain_routing_info_notification_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_scp_domain_routing_info_notification_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_scp_domain_routing_info_notification_free(dst); + dst = OpenAPI_scp_domain_routing_info_notification_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/scp_domain_routing_info_notification.h b/lib/sbi/openapi/model/scp_domain_routing_info_notification.h new file mode 100644 index 000000000..2ec1411fd --- /dev/null +++ b/lib/sbi/openapi/model/scp_domain_routing_info_notification.h @@ -0,0 +1,43 @@ +/* + * scp_domain_routing_info_notification.h + * + * SCP Domain Routing Information Notification + */ + +#ifndef _OpenAPI_scp_domain_routing_info_notification_H_ +#define _OpenAPI_scp_domain_routing_info_notification_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "scp_domain_routing_information.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_scp_domain_routing_info_notification_s OpenAPI_scp_domain_routing_info_notification_t; +typedef struct OpenAPI_scp_domain_routing_info_notification_s { + struct OpenAPI_scp_domain_routing_information_s *routing_info; + bool is_local_ind; + int local_ind; +} OpenAPI_scp_domain_routing_info_notification_t; + +OpenAPI_scp_domain_routing_info_notification_t *OpenAPI_scp_domain_routing_info_notification_create( + OpenAPI_scp_domain_routing_information_t *routing_info, + bool is_local_ind, + int local_ind +); +void OpenAPI_scp_domain_routing_info_notification_free(OpenAPI_scp_domain_routing_info_notification_t *scp_domain_routing_info_notification); +OpenAPI_scp_domain_routing_info_notification_t *OpenAPI_scp_domain_routing_info_notification_parseFromJSON(cJSON *scp_domain_routing_info_notificationJSON); +cJSON *OpenAPI_scp_domain_routing_info_notification_convertToJSON(OpenAPI_scp_domain_routing_info_notification_t *scp_domain_routing_info_notification); +OpenAPI_scp_domain_routing_info_notification_t *OpenAPI_scp_domain_routing_info_notification_copy(OpenAPI_scp_domain_routing_info_notification_t *dst, OpenAPI_scp_domain_routing_info_notification_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_scp_domain_routing_info_notification_H_ */ + diff --git a/lib/sbi/openapi/model/scp_domain_routing_info_subscription.c b/lib/sbi/openapi/model/scp_domain_routing_info_subscription.c new file mode 100644 index 000000000..9bbbe7edd --- /dev/null +++ b/lib/sbi/openapi/model/scp_domain_routing_info_subscription.c @@ -0,0 +1,182 @@ + +#include +#include +#include +#include "scp_domain_routing_info_subscription.h" + +OpenAPI_scp_domain_routing_info_subscription_t *OpenAPI_scp_domain_routing_info_subscription_create( + char *callback_uri, + char *validity_time, + char *req_instance_id, + bool is_local_ind, + int local_ind +) +{ + OpenAPI_scp_domain_routing_info_subscription_t *scp_domain_routing_info_subscription_local_var = ogs_malloc(sizeof(OpenAPI_scp_domain_routing_info_subscription_t)); + ogs_assert(scp_domain_routing_info_subscription_local_var); + + scp_domain_routing_info_subscription_local_var->callback_uri = callback_uri; + scp_domain_routing_info_subscription_local_var->validity_time = validity_time; + scp_domain_routing_info_subscription_local_var->req_instance_id = req_instance_id; + scp_domain_routing_info_subscription_local_var->is_local_ind = is_local_ind; + scp_domain_routing_info_subscription_local_var->local_ind = local_ind; + + return scp_domain_routing_info_subscription_local_var; +} + +void OpenAPI_scp_domain_routing_info_subscription_free(OpenAPI_scp_domain_routing_info_subscription_t *scp_domain_routing_info_subscription) +{ + OpenAPI_lnode_t *node = NULL; + + if (NULL == scp_domain_routing_info_subscription) { + return; + } + if (scp_domain_routing_info_subscription->callback_uri) { + ogs_free(scp_domain_routing_info_subscription->callback_uri); + scp_domain_routing_info_subscription->callback_uri = NULL; + } + if (scp_domain_routing_info_subscription->validity_time) { + ogs_free(scp_domain_routing_info_subscription->validity_time); + scp_domain_routing_info_subscription->validity_time = NULL; + } + if (scp_domain_routing_info_subscription->req_instance_id) { + ogs_free(scp_domain_routing_info_subscription->req_instance_id); + scp_domain_routing_info_subscription->req_instance_id = NULL; + } + ogs_free(scp_domain_routing_info_subscription); +} + +cJSON *OpenAPI_scp_domain_routing_info_subscription_convertToJSON(OpenAPI_scp_domain_routing_info_subscription_t *scp_domain_routing_info_subscription) +{ + cJSON *item = NULL; + OpenAPI_lnode_t *node = NULL; + + if (scp_domain_routing_info_subscription == NULL) { + ogs_error("OpenAPI_scp_domain_routing_info_subscription_convertToJSON() failed [ScpDomainRoutingInfoSubscription]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (!scp_domain_routing_info_subscription->callback_uri) { + ogs_error("OpenAPI_scp_domain_routing_info_subscription_convertToJSON() failed [callback_uri]"); + return NULL; + } + if (cJSON_AddStringToObject(item, "callbackUri", scp_domain_routing_info_subscription->callback_uri) == NULL) { + ogs_error("OpenAPI_scp_domain_routing_info_subscription_convertToJSON() failed [callback_uri]"); + goto end; + } + + if (scp_domain_routing_info_subscription->validity_time) { + if (cJSON_AddStringToObject(item, "validityTime", scp_domain_routing_info_subscription->validity_time) == NULL) { + ogs_error("OpenAPI_scp_domain_routing_info_subscription_convertToJSON() failed [validity_time]"); + goto end; + } + } + + if (scp_domain_routing_info_subscription->req_instance_id) { + if (cJSON_AddStringToObject(item, "reqInstanceId", scp_domain_routing_info_subscription->req_instance_id) == NULL) { + ogs_error("OpenAPI_scp_domain_routing_info_subscription_convertToJSON() failed [req_instance_id]"); + goto end; + } + } + + if (scp_domain_routing_info_subscription->is_local_ind) { + if (cJSON_AddBoolToObject(item, "localInd", scp_domain_routing_info_subscription->local_ind) == NULL) { + ogs_error("OpenAPI_scp_domain_routing_info_subscription_convertToJSON() failed [local_ind]"); + goto end; + } + } + +end: + return item; +} + +OpenAPI_scp_domain_routing_info_subscription_t *OpenAPI_scp_domain_routing_info_subscription_parseFromJSON(cJSON *scp_domain_routing_info_subscriptionJSON) +{ + OpenAPI_scp_domain_routing_info_subscription_t *scp_domain_routing_info_subscription_local_var = NULL; + OpenAPI_lnode_t *node = NULL; + cJSON *callback_uri = NULL; + cJSON *validity_time = NULL; + cJSON *req_instance_id = NULL; + cJSON *local_ind = NULL; + callback_uri = cJSON_GetObjectItemCaseSensitive(scp_domain_routing_info_subscriptionJSON, "callbackUri"); + if (!callback_uri) { + ogs_error("OpenAPI_scp_domain_routing_info_subscription_parseFromJSON() failed [callback_uri]"); + goto end; + } + if (!cJSON_IsString(callback_uri)) { + ogs_error("OpenAPI_scp_domain_routing_info_subscription_parseFromJSON() failed [callback_uri]"); + goto end; + } + + validity_time = cJSON_GetObjectItemCaseSensitive(scp_domain_routing_info_subscriptionJSON, "validityTime"); + if (validity_time) { + if (!cJSON_IsString(validity_time) && !cJSON_IsNull(validity_time)) { + ogs_error("OpenAPI_scp_domain_routing_info_subscription_parseFromJSON() failed [validity_time]"); + goto end; + } + } + + req_instance_id = cJSON_GetObjectItemCaseSensitive(scp_domain_routing_info_subscriptionJSON, "reqInstanceId"); + if (req_instance_id) { + if (!cJSON_IsString(req_instance_id) && !cJSON_IsNull(req_instance_id)) { + ogs_error("OpenAPI_scp_domain_routing_info_subscription_parseFromJSON() failed [req_instance_id]"); + goto end; + } + } + + local_ind = cJSON_GetObjectItemCaseSensitive(scp_domain_routing_info_subscriptionJSON, "localInd"); + if (local_ind) { + if (!cJSON_IsBool(local_ind)) { + ogs_error("OpenAPI_scp_domain_routing_info_subscription_parseFromJSON() failed [local_ind]"); + goto end; + } + } + + scp_domain_routing_info_subscription_local_var = OpenAPI_scp_domain_routing_info_subscription_create ( + ogs_strdup(callback_uri->valuestring), + validity_time && !cJSON_IsNull(validity_time) ? ogs_strdup(validity_time->valuestring) : NULL, + req_instance_id && !cJSON_IsNull(req_instance_id) ? ogs_strdup(req_instance_id->valuestring) : NULL, + local_ind ? true : false, + local_ind ? local_ind->valueint : 0 + ); + + return scp_domain_routing_info_subscription_local_var; +end: + return NULL; +} + +OpenAPI_scp_domain_routing_info_subscription_t *OpenAPI_scp_domain_routing_info_subscription_copy(OpenAPI_scp_domain_routing_info_subscription_t *dst, OpenAPI_scp_domain_routing_info_subscription_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_scp_domain_routing_info_subscription_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_scp_domain_routing_info_subscription_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_scp_domain_routing_info_subscription_free(dst); + dst = OpenAPI_scp_domain_routing_info_subscription_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/scp_domain_routing_info_subscription.h b/lib/sbi/openapi/model/scp_domain_routing_info_subscription.h new file mode 100644 index 000000000..ed0929f3c --- /dev/null +++ b/lib/sbi/openapi/model/scp_domain_routing_info_subscription.h @@ -0,0 +1,46 @@ +/* + * scp_domain_routing_info_subscription.h + * + * SCP Domain Routing Information Subscription + */ + +#ifndef _OpenAPI_scp_domain_routing_info_subscription_H_ +#define _OpenAPI_scp_domain_routing_info_subscription_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_scp_domain_routing_info_subscription_s OpenAPI_scp_domain_routing_info_subscription_t; +typedef struct OpenAPI_scp_domain_routing_info_subscription_s { + char *callback_uri; + char *validity_time; + char *req_instance_id; + bool is_local_ind; + int local_ind; +} OpenAPI_scp_domain_routing_info_subscription_t; + +OpenAPI_scp_domain_routing_info_subscription_t *OpenAPI_scp_domain_routing_info_subscription_create( + char *callback_uri, + char *validity_time, + char *req_instance_id, + bool is_local_ind, + int local_ind +); +void OpenAPI_scp_domain_routing_info_subscription_free(OpenAPI_scp_domain_routing_info_subscription_t *scp_domain_routing_info_subscription); +OpenAPI_scp_domain_routing_info_subscription_t *OpenAPI_scp_domain_routing_info_subscription_parseFromJSON(cJSON *scp_domain_routing_info_subscriptionJSON); +cJSON *OpenAPI_scp_domain_routing_info_subscription_convertToJSON(OpenAPI_scp_domain_routing_info_subscription_t *scp_domain_routing_info_subscription); +OpenAPI_scp_domain_routing_info_subscription_t *OpenAPI_scp_domain_routing_info_subscription_copy(OpenAPI_scp_domain_routing_info_subscription_t *dst, OpenAPI_scp_domain_routing_info_subscription_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_scp_domain_routing_info_subscription_H_ */ + diff --git a/lib/sbi/openapi/model/scp_domain_routing_information.c b/lib/sbi/openapi/model/scp_domain_routing_information.c new file mode 100644 index 000000000..630a372b9 --- /dev/null +++ b/lib/sbi/openapi/model/scp_domain_routing_information.c @@ -0,0 +1,164 @@ + +#include +#include +#include +#include "scp_domain_routing_information.h" + +OpenAPI_scp_domain_routing_information_t *OpenAPI_scp_domain_routing_information_create( + OpenAPI_list_t* scp_domain_list +) +{ + OpenAPI_scp_domain_routing_information_t *scp_domain_routing_information_local_var = ogs_malloc(sizeof(OpenAPI_scp_domain_routing_information_t)); + ogs_assert(scp_domain_routing_information_local_var); + + scp_domain_routing_information_local_var->scp_domain_list = scp_domain_list; + + return scp_domain_routing_information_local_var; +} + +void OpenAPI_scp_domain_routing_information_free(OpenAPI_scp_domain_routing_information_t *scp_domain_routing_information) +{ + OpenAPI_lnode_t *node = NULL; + + if (NULL == scp_domain_routing_information) { + return; + } + if (scp_domain_routing_information->scp_domain_list) { + OpenAPI_list_for_each(scp_domain_routing_information->scp_domain_list, node) { + OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*)node->data; + ogs_free(localKeyValue->key); + OpenAPI_scp_domain_connectivity_free(localKeyValue->value); + OpenAPI_map_free(localKeyValue); + } + OpenAPI_list_free(scp_domain_routing_information->scp_domain_list); + scp_domain_routing_information->scp_domain_list = NULL; + } + ogs_free(scp_domain_routing_information); +} + +cJSON *OpenAPI_scp_domain_routing_information_convertToJSON(OpenAPI_scp_domain_routing_information_t *scp_domain_routing_information) +{ + cJSON *item = NULL; + OpenAPI_lnode_t *node = NULL; + + if (scp_domain_routing_information == NULL) { + ogs_error("OpenAPI_scp_domain_routing_information_convertToJSON() failed [ScpDomainRoutingInformation]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (!scp_domain_routing_information->scp_domain_list) { + ogs_error("OpenAPI_scp_domain_routing_information_convertToJSON() failed [scp_domain_list]"); + return NULL; + } + cJSON *scp_domain_list = cJSON_AddObjectToObject(item, "scpDomainList"); + if (scp_domain_list == NULL) { + ogs_error("OpenAPI_scp_domain_routing_information_convertToJSON() failed [scp_domain_list]"); + goto end; + } + cJSON *localMapObject = scp_domain_list; + if (scp_domain_routing_information->scp_domain_list) { + OpenAPI_list_for_each(scp_domain_routing_information->scp_domain_list, node) { + OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*)node->data; + cJSON *itemLocal = localKeyValue->value ? + OpenAPI_scp_domain_connectivity_convertToJSON(localKeyValue->value) : + cJSON_CreateNull(); + if (itemLocal == NULL) { + ogs_error("OpenAPI_scp_domain_routing_information_convertToJSON() failed [inner]"); + goto end; + } + cJSON_AddItemToObject(localMapObject, localKeyValue->key, itemLocal); + } + } + +end: + return item; +} + +OpenAPI_scp_domain_routing_information_t *OpenAPI_scp_domain_routing_information_parseFromJSON(cJSON *scp_domain_routing_informationJSON) +{ + OpenAPI_scp_domain_routing_information_t *scp_domain_routing_information_local_var = NULL; + OpenAPI_lnode_t *node = NULL; + cJSON *scp_domain_list = NULL; + OpenAPI_list_t *scp_domain_listList = NULL; + scp_domain_list = cJSON_GetObjectItemCaseSensitive(scp_domain_routing_informationJSON, "scpDomainList"); + if (!scp_domain_list) { + ogs_error("OpenAPI_scp_domain_routing_information_parseFromJSON() failed [scp_domain_list]"); + goto end; + } + cJSON *scp_domain_list_local_map = NULL; + if (!cJSON_IsObject(scp_domain_list) && !cJSON_IsNull(scp_domain_list)) { + ogs_error("OpenAPI_scp_domain_routing_information_parseFromJSON() failed [scp_domain_list]"); + goto end; + } + if (cJSON_IsObject(scp_domain_list)) { + scp_domain_listList = OpenAPI_list_create(); + OpenAPI_map_t *localMapKeyPair = NULL; + cJSON_ArrayForEach(scp_domain_list_local_map, scp_domain_list) { + cJSON *localMapObject = scp_domain_list_local_map; + if (cJSON_IsObject(localMapObject)) { + localMapKeyPair = OpenAPI_map_create( + ogs_strdup(localMapObject->string), OpenAPI_scp_domain_connectivity_parseFromJSON(localMapObject)); + } else if (cJSON_IsNull(localMapObject)) { + localMapKeyPair = OpenAPI_map_create(ogs_strdup(localMapObject->string), NULL); + } else { + ogs_error("OpenAPI_scp_domain_routing_information_parseFromJSON() failed [inner]"); + goto end; + } + OpenAPI_list_add(scp_domain_listList, localMapKeyPair); + } + } + + scp_domain_routing_information_local_var = OpenAPI_scp_domain_routing_information_create ( + scp_domain_listList + ); + + return scp_domain_routing_information_local_var; +end: + if (scp_domain_listList) { + OpenAPI_list_for_each(scp_domain_listList, node) { + OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*) node->data; + ogs_free(localKeyValue->key); + OpenAPI_scp_domain_connectivity_free(localKeyValue->value); + OpenAPI_map_free(localKeyValue); + } + OpenAPI_list_free(scp_domain_listList); + scp_domain_listList = NULL; + } + return NULL; +} + +OpenAPI_scp_domain_routing_information_t *OpenAPI_scp_domain_routing_information_copy(OpenAPI_scp_domain_routing_information_t *dst, OpenAPI_scp_domain_routing_information_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_scp_domain_routing_information_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_scp_domain_routing_information_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_scp_domain_routing_information_free(dst); + dst = OpenAPI_scp_domain_routing_information_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/scp_domain_routing_information.h b/lib/sbi/openapi/model/scp_domain_routing_information.h new file mode 100644 index 000000000..886575837 --- /dev/null +++ b/lib/sbi/openapi/model/scp_domain_routing_information.h @@ -0,0 +1,39 @@ +/* + * scp_domain_routing_information.h + * + * SCP Domain Routing Information + */ + +#ifndef _OpenAPI_scp_domain_routing_information_H_ +#define _OpenAPI_scp_domain_routing_information_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "scp_domain_connectivity.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_scp_domain_routing_information_s OpenAPI_scp_domain_routing_information_t; +typedef struct OpenAPI_scp_domain_routing_information_s { + OpenAPI_list_t* scp_domain_list; +} OpenAPI_scp_domain_routing_information_t; + +OpenAPI_scp_domain_routing_information_t *OpenAPI_scp_domain_routing_information_create( + OpenAPI_list_t* scp_domain_list +); +void OpenAPI_scp_domain_routing_information_free(OpenAPI_scp_domain_routing_information_t *scp_domain_routing_information); +OpenAPI_scp_domain_routing_information_t *OpenAPI_scp_domain_routing_information_parseFromJSON(cJSON *scp_domain_routing_informationJSON); +cJSON *OpenAPI_scp_domain_routing_information_convertToJSON(OpenAPI_scp_domain_routing_information_t *scp_domain_routing_information); +OpenAPI_scp_domain_routing_information_t *OpenAPI_scp_domain_routing_information_copy(OpenAPI_scp_domain_routing_information_t *dst, OpenAPI_scp_domain_routing_information_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_scp_domain_routing_information_H_ */ + diff --git a/lib/sbi/openapi/model/scp_info.c b/lib/sbi/openapi/model/scp_info.c index 536ebbcd8..4645a9de4 100644 --- a/lib/sbi/openapi/model/scp_info.c +++ b/lib/sbi/openapi/model/scp_info.c @@ -15,7 +15,9 @@ OpenAPI_scp_info_t *OpenAPI_scp_info_create( OpenAPI_list_t *ipv6_prefix_ranges, OpenAPI_list_t *served_nf_set_id_list, OpenAPI_list_t *remote_plmn_list, - OpenAPI_ip_reachability_e ip_reachability + OpenAPI_list_t *remote_snpn_list, + OpenAPI_ip_reachability_e ip_reachability, + OpenAPI_list_t *scp_capabilities ) { OpenAPI_scp_info_t *scp_info_local_var = ogs_malloc(sizeof(OpenAPI_scp_info_t)); @@ -31,7 +33,9 @@ OpenAPI_scp_info_t *OpenAPI_scp_info_create( scp_info_local_var->ipv6_prefix_ranges = ipv6_prefix_ranges; scp_info_local_var->served_nf_set_id_list = served_nf_set_id_list; scp_info_local_var->remote_plmn_list = remote_plmn_list; + scp_info_local_var->remote_snpn_list = remote_snpn_list; scp_info_local_var->ip_reachability = ip_reachability; + scp_info_local_var->scp_capabilities = scp_capabilities; return scp_info_local_var; } @@ -47,7 +51,7 @@ void OpenAPI_scp_info_free(OpenAPI_scp_info_t *scp_info) OpenAPI_list_for_each(scp_info->scp_domain_info_list, node) { OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*)node->data; ogs_free(localKeyValue->key); - ogs_free(localKeyValue->value); + OpenAPI_scp_domain_info_free(localKeyValue->value); OpenAPI_map_free(localKeyValue); } OpenAPI_list_free(scp_info->scp_domain_info_list); @@ -116,6 +120,17 @@ void OpenAPI_scp_info_free(OpenAPI_scp_info_t *scp_info) OpenAPI_list_free(scp_info->remote_plmn_list); scp_info->remote_plmn_list = NULL; } + if (scp_info->remote_snpn_list) { + OpenAPI_list_for_each(scp_info->remote_snpn_list, node) { + OpenAPI_plmn_id_nid_free(node->data); + } + OpenAPI_list_free(scp_info->remote_snpn_list); + scp_info->remote_snpn_list = NULL; + } + if (scp_info->scp_capabilities) { + OpenAPI_list_free(scp_info->scp_capabilities); + scp_info->scp_capabilities = NULL; + } ogs_free(scp_info); } @@ -281,6 +296,22 @@ cJSON *OpenAPI_scp_info_convertToJSON(OpenAPI_scp_info_t *scp_info) } } + if (scp_info->remote_snpn_list) { + cJSON *remote_snpn_listList = cJSON_AddArrayToObject(item, "remoteSnpnList"); + if (remote_snpn_listList == NULL) { + ogs_error("OpenAPI_scp_info_convertToJSON() failed [remote_snpn_list]"); + goto end; + } + OpenAPI_list_for_each(scp_info->remote_snpn_list, node) { + cJSON *itemLocal = OpenAPI_plmn_id_nid_convertToJSON(node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_scp_info_convertToJSON() failed [remote_snpn_list]"); + goto end; + } + cJSON_AddItemToArray(remote_snpn_listList, itemLocal); + } + } + if (scp_info->ip_reachability != OpenAPI_ip_reachability_NULL) { if (cJSON_AddStringToObject(item, "ipReachability", OpenAPI_ip_reachability_ToString(scp_info->ip_reachability)) == NULL) { ogs_error("OpenAPI_scp_info_convertToJSON() failed [ip_reachability]"); @@ -288,6 +319,20 @@ cJSON *OpenAPI_scp_info_convertToJSON(OpenAPI_scp_info_t *scp_info) } } + if (scp_info->scp_capabilities != OpenAPI_scp_capability_NULL) { + cJSON *scp_capabilitiesList = cJSON_AddArrayToObject(item, "scpCapabilities"); + if (scp_capabilitiesList == NULL) { + ogs_error("OpenAPI_scp_info_convertToJSON() failed [scp_capabilities]"); + goto end; + } + OpenAPI_list_for_each(scp_info->scp_capabilities, node) { + if (cJSON_AddStringToObject(scp_capabilitiesList, "", OpenAPI_scp_capability_ToString((intptr_t)node->data)) == NULL) { + ogs_error("OpenAPI_scp_info_convertToJSON() failed [scp_capabilities]"); + goto end; + } + } + } + end: return item; } @@ -315,8 +360,12 @@ OpenAPI_scp_info_t *OpenAPI_scp_info_parseFromJSON(cJSON *scp_infoJSON) OpenAPI_list_t *served_nf_set_id_listList = NULL; cJSON *remote_plmn_list = NULL; OpenAPI_list_t *remote_plmn_listList = NULL; + cJSON *remote_snpn_list = NULL; + OpenAPI_list_t *remote_snpn_listList = NULL; cJSON *ip_reachability = NULL; OpenAPI_ip_reachability_e ip_reachabilityVariable = 0; + cJSON *scp_capabilities = NULL; + OpenAPI_list_t *scp_capabilitiesList = NULL; scp_domain_info_list = cJSON_GetObjectItemCaseSensitive(scp_infoJSON, "scpDomainInfoList"); if (scp_domain_info_list) { cJSON *scp_domain_info_list_local_map = NULL; @@ -329,8 +378,6 @@ OpenAPI_scp_info_t *OpenAPI_scp_info_parseFromJSON(cJSON *scp_infoJSON) OpenAPI_map_t *localMapKeyPair = NULL; cJSON_ArrayForEach(scp_domain_info_list_local_map, scp_domain_info_list) { cJSON *localMapObject = scp_domain_info_list_local_map; - double *localDouble = NULL; - int *localInt = NULL; if (cJSON_IsObject(localMapObject)) { localMapKeyPair = OpenAPI_map_create( ogs_strdup(localMapObject->string), OpenAPI_scp_domain_info_parseFromJSON(localMapObject)); @@ -542,6 +589,31 @@ OpenAPI_scp_info_t *OpenAPI_scp_info_parseFromJSON(cJSON *scp_infoJSON) } } + remote_snpn_list = cJSON_GetObjectItemCaseSensitive(scp_infoJSON, "remoteSnpnList"); + if (remote_snpn_list) { + cJSON *remote_snpn_list_local = NULL; + if (!cJSON_IsArray(remote_snpn_list)) { + ogs_error("OpenAPI_scp_info_parseFromJSON() failed [remote_snpn_list]"); + goto end; + } + + remote_snpn_listList = OpenAPI_list_create(); + + cJSON_ArrayForEach(remote_snpn_list_local, remote_snpn_list) { + if (!cJSON_IsObject(remote_snpn_list_local)) { + ogs_error("OpenAPI_scp_info_parseFromJSON() failed [remote_snpn_list]"); + goto end; + } + OpenAPI_plmn_id_nid_t *remote_snpn_listItem = OpenAPI_plmn_id_nid_parseFromJSON(remote_snpn_list_local); + if (!remote_snpn_listItem) { + ogs_error("No remote_snpn_listItem"); + OpenAPI_list_free(remote_snpn_listList); + goto end; + } + OpenAPI_list_add(remote_snpn_listList, remote_snpn_listItem); + } + } + ip_reachability = cJSON_GetObjectItemCaseSensitive(scp_infoJSON, "ipReachability"); if (ip_reachability) { if (!cJSON_IsString(ip_reachability)) { @@ -551,6 +623,25 @@ OpenAPI_scp_info_t *OpenAPI_scp_info_parseFromJSON(cJSON *scp_infoJSON) ip_reachabilityVariable = OpenAPI_ip_reachability_FromString(ip_reachability->valuestring); } + scp_capabilities = cJSON_GetObjectItemCaseSensitive(scp_infoJSON, "scpCapabilities"); + if (scp_capabilities) { + cJSON *scp_capabilities_local = NULL; + if (!cJSON_IsArray(scp_capabilities)) { + ogs_error("OpenAPI_scp_info_parseFromJSON() failed [scp_capabilities]"); + goto end; + } + + scp_capabilitiesList = OpenAPI_list_create(); + + cJSON_ArrayForEach(scp_capabilities_local, scp_capabilities) { + if (!cJSON_IsString(scp_capabilities_local)) { + ogs_error("OpenAPI_scp_info_parseFromJSON() failed [scp_capabilities]"); + goto end; + } + OpenAPI_list_add(scp_capabilitiesList, (void *)OpenAPI_scp_capability_FromString(scp_capabilities_local->valuestring)); + } + } + scp_info_local_var = OpenAPI_scp_info_create ( scp_domain_info_list ? scp_domain_info_listList : NULL, scp_prefix && !cJSON_IsNull(scp_prefix) ? ogs_strdup(scp_prefix->valuestring) : NULL, @@ -562,7 +653,9 @@ OpenAPI_scp_info_t *OpenAPI_scp_info_parseFromJSON(cJSON *scp_infoJSON) ipv6_prefix_ranges ? ipv6_prefix_rangesList : NULL, served_nf_set_id_list ? served_nf_set_id_listList : NULL, remote_plmn_list ? remote_plmn_listList : NULL, - ip_reachability ? ip_reachabilityVariable : 0 + remote_snpn_list ? remote_snpn_listList : NULL, + ip_reachability ? ip_reachabilityVariable : 0, + scp_capabilities ? scp_capabilitiesList : NULL ); return scp_info_local_var; @@ -571,7 +664,7 @@ end: OpenAPI_list_for_each(scp_domain_info_listList, node) { OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*) node->data; ogs_free(localKeyValue->key); - ogs_free(localKeyValue->value); + OpenAPI_scp_domain_info_free(localKeyValue->value); OpenAPI_map_free(localKeyValue); } OpenAPI_list_free(scp_domain_info_listList); @@ -636,6 +729,17 @@ end: OpenAPI_list_free(remote_plmn_listList); remote_plmn_listList = NULL; } + if (remote_snpn_listList) { + OpenAPI_list_for_each(remote_snpn_listList, node) { + OpenAPI_plmn_id_nid_free(node->data); + } + OpenAPI_list_free(remote_snpn_listList); + remote_snpn_listList = NULL; + } + if (scp_capabilitiesList) { + OpenAPI_list_free(scp_capabilitiesList); + scp_capabilitiesList = NULL; + } return NULL; } diff --git a/lib/sbi/openapi/model/scp_info.h b/lib/sbi/openapi/model/scp_info.h index 286dbe344..3231f4996 100644 --- a/lib/sbi/openapi/model/scp_info.h +++ b/lib/sbi/openapi/model/scp_info.h @@ -16,6 +16,8 @@ #include "ipv4_address_range.h" #include "ipv6_prefix_range.h" #include "plmn_id.h" +#include "plmn_id_nid.h" +#include "scp_capability.h" #include "scp_domain_info.h" #ifdef __cplusplus @@ -34,7 +36,9 @@ typedef struct OpenAPI_scp_info_s { OpenAPI_list_t *ipv6_prefix_ranges; OpenAPI_list_t *served_nf_set_id_list; OpenAPI_list_t *remote_plmn_list; + OpenAPI_list_t *remote_snpn_list; OpenAPI_ip_reachability_e ip_reachability; + OpenAPI_list_t *scp_capabilities; } OpenAPI_scp_info_t; OpenAPI_scp_info_t *OpenAPI_scp_info_create( @@ -48,7 +52,9 @@ OpenAPI_scp_info_t *OpenAPI_scp_info_create( OpenAPI_list_t *ipv6_prefix_ranges, OpenAPI_list_t *served_nf_set_id_list, OpenAPI_list_t *remote_plmn_list, - OpenAPI_ip_reachability_e ip_reachability + OpenAPI_list_t *remote_snpn_list, + OpenAPI_ip_reachability_e ip_reachability, + OpenAPI_list_t *scp_capabilities ); void OpenAPI_scp_info_free(OpenAPI_scp_info_t *scp_info); OpenAPI_scp_info_t *OpenAPI_scp_info_parseFromJSON(cJSON *scp_infoJSON); diff --git a/lib/sbi/openapi/model/sdm_subscription.c b/lib/sbi/openapi/model/sdm_subscription.c index 2e26c9fff..516d04684 100644 --- a/lib/sbi/openapi/model/sdm_subscription.c +++ b/lib/sbi/openapi/model/sdm_subscription.c @@ -18,9 +18,15 @@ OpenAPI_sdm_subscription_t *OpenAPI_sdm_subscription_create( OpenAPI_plmn_id_t *plmn_id, bool is_immediate_report, int immediate_report, - OpenAPI_subscription_data_sets_t *report, + OpenAPI_immediate_report_t *report, char *supported_features, - OpenAPI_context_info_t *context_info + OpenAPI_context_info_t *context_info, + bool is_nf_change_filter, + int nf_change_filter, + bool is_unique_subscription, + int unique_subscription, + OpenAPI_list_t *reset_ids, + OpenAPI_ue_context_in_smf_data_sub_filter_t *ue_con_smf_data_sub_filter ) { OpenAPI_sdm_subscription_t *sdm_subscription_local_var = ogs_malloc(sizeof(OpenAPI_sdm_subscription_t)); @@ -42,6 +48,12 @@ OpenAPI_sdm_subscription_t *OpenAPI_sdm_subscription_create( sdm_subscription_local_var->report = report; sdm_subscription_local_var->supported_features = supported_features; sdm_subscription_local_var->context_info = context_info; + sdm_subscription_local_var->is_nf_change_filter = is_nf_change_filter; + sdm_subscription_local_var->nf_change_filter = nf_change_filter; + sdm_subscription_local_var->is_unique_subscription = is_unique_subscription; + sdm_subscription_local_var->unique_subscription = unique_subscription; + sdm_subscription_local_var->reset_ids = reset_ids; + sdm_subscription_local_var->ue_con_smf_data_sub_filter = ue_con_smf_data_sub_filter; return sdm_subscription_local_var; } @@ -93,7 +105,7 @@ void OpenAPI_sdm_subscription_free(OpenAPI_sdm_subscription_t *sdm_subscription) sdm_subscription->plmn_id = NULL; } if (sdm_subscription->report) { - OpenAPI_subscription_data_sets_free(sdm_subscription->report); + OpenAPI_immediate_report_free(sdm_subscription->report); sdm_subscription->report = NULL; } if (sdm_subscription->supported_features) { @@ -104,6 +116,17 @@ void OpenAPI_sdm_subscription_free(OpenAPI_sdm_subscription_t *sdm_subscription) OpenAPI_context_info_free(sdm_subscription->context_info); sdm_subscription->context_info = NULL; } + if (sdm_subscription->reset_ids) { + OpenAPI_list_for_each(sdm_subscription->reset_ids, node) { + ogs_free(node->data); + } + OpenAPI_list_free(sdm_subscription->reset_ids); + sdm_subscription->reset_ids = NULL; + } + if (sdm_subscription->ue_con_smf_data_sub_filter) { + OpenAPI_ue_context_in_smf_data_sub_filter_free(sdm_subscription->ue_con_smf_data_sub_filter); + sdm_subscription->ue_con_smf_data_sub_filter = NULL; + } ogs_free(sdm_subscription); } @@ -221,7 +244,7 @@ cJSON *OpenAPI_sdm_subscription_convertToJSON(OpenAPI_sdm_subscription_t *sdm_su } if (sdm_subscription->report) { - cJSON *report_local_JSON = OpenAPI_subscription_data_sets_convertToJSON(sdm_subscription->report); + cJSON *report_local_JSON = OpenAPI_immediate_report_convertToJSON(sdm_subscription->report); if (report_local_JSON == NULL) { ogs_error("OpenAPI_sdm_subscription_convertToJSON() failed [report]"); goto end; @@ -253,6 +276,47 @@ cJSON *OpenAPI_sdm_subscription_convertToJSON(OpenAPI_sdm_subscription_t *sdm_su } } + if (sdm_subscription->is_nf_change_filter) { + if (cJSON_AddBoolToObject(item, "nfChangeFilter", sdm_subscription->nf_change_filter) == NULL) { + ogs_error("OpenAPI_sdm_subscription_convertToJSON() failed [nf_change_filter]"); + goto end; + } + } + + if (sdm_subscription->is_unique_subscription) { + if (cJSON_AddBoolToObject(item, "uniqueSubscription", sdm_subscription->unique_subscription) == NULL) { + ogs_error("OpenAPI_sdm_subscription_convertToJSON() failed [unique_subscription]"); + goto end; + } + } + + if (sdm_subscription->reset_ids) { + cJSON *reset_idsList = cJSON_AddArrayToObject(item, "resetIds"); + if (reset_idsList == NULL) { + ogs_error("OpenAPI_sdm_subscription_convertToJSON() failed [reset_ids]"); + goto end; + } + OpenAPI_list_for_each(sdm_subscription->reset_ids, node) { + if (cJSON_AddStringToObject(reset_idsList, "", (char*)node->data) == NULL) { + ogs_error("OpenAPI_sdm_subscription_convertToJSON() failed [reset_ids]"); + goto end; + } + } + } + + if (sdm_subscription->ue_con_smf_data_sub_filter) { + cJSON *ue_con_smf_data_sub_filter_local_JSON = OpenAPI_ue_context_in_smf_data_sub_filter_convertToJSON(sdm_subscription->ue_con_smf_data_sub_filter); + if (ue_con_smf_data_sub_filter_local_JSON == NULL) { + ogs_error("OpenAPI_sdm_subscription_convertToJSON() failed [ue_con_smf_data_sub_filter]"); + goto end; + } + cJSON_AddItemToObject(item, "ueConSmfDataSubFilter", ue_con_smf_data_sub_filter_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_sdm_subscription_convertToJSON() failed [ue_con_smf_data_sub_filter]"); + goto end; + } + } + end: return item; } @@ -276,10 +340,16 @@ OpenAPI_sdm_subscription_t *OpenAPI_sdm_subscription_parseFromJSON(cJSON *sdm_su OpenAPI_plmn_id_t *plmn_id_local_nonprim = NULL; cJSON *immediate_report = NULL; cJSON *report = NULL; - OpenAPI_subscription_data_sets_t *report_local_nonprim = NULL; + OpenAPI_immediate_report_t *report_local_nonprim = NULL; cJSON *supported_features = NULL; cJSON *context_info = NULL; OpenAPI_context_info_t *context_info_local_nonprim = NULL; + cJSON *nf_change_filter = NULL; + cJSON *unique_subscription = NULL; + cJSON *reset_ids = NULL; + OpenAPI_list_t *reset_idsList = NULL; + cJSON *ue_con_smf_data_sub_filter = NULL; + OpenAPI_ue_context_in_smf_data_sub_filter_t *ue_con_smf_data_sub_filter_local_nonprim = NULL; nf_instance_id = cJSON_GetObjectItemCaseSensitive(sdm_subscriptionJSON, "nfInstanceId"); if (!nf_instance_id) { ogs_error("OpenAPI_sdm_subscription_parseFromJSON() failed [nf_instance_id]"); @@ -383,7 +453,7 @@ OpenAPI_sdm_subscription_t *OpenAPI_sdm_subscription_parseFromJSON(cJSON *sdm_su report = cJSON_GetObjectItemCaseSensitive(sdm_subscriptionJSON, "report"); if (report) { - report_local_nonprim = OpenAPI_subscription_data_sets_parseFromJSON(report); + report_local_nonprim = OpenAPI_immediate_report_parseFromJSON(report); } supported_features = cJSON_GetObjectItemCaseSensitive(sdm_subscriptionJSON, "supportedFeatures"); @@ -399,6 +469,48 @@ OpenAPI_sdm_subscription_t *OpenAPI_sdm_subscription_parseFromJSON(cJSON *sdm_su context_info_local_nonprim = OpenAPI_context_info_parseFromJSON(context_info); } + nf_change_filter = cJSON_GetObjectItemCaseSensitive(sdm_subscriptionJSON, "nfChangeFilter"); + if (nf_change_filter) { + if (!cJSON_IsBool(nf_change_filter)) { + ogs_error("OpenAPI_sdm_subscription_parseFromJSON() failed [nf_change_filter]"); + goto end; + } + } + + unique_subscription = cJSON_GetObjectItemCaseSensitive(sdm_subscriptionJSON, "uniqueSubscription"); + if (unique_subscription) { + if (!cJSON_IsBool(unique_subscription)) { + ogs_error("OpenAPI_sdm_subscription_parseFromJSON() failed [unique_subscription]"); + goto end; + } + } + + reset_ids = cJSON_GetObjectItemCaseSensitive(sdm_subscriptionJSON, "resetIds"); + if (reset_ids) { + cJSON *reset_ids_local = NULL; + if (!cJSON_IsArray(reset_ids)) { + ogs_error("OpenAPI_sdm_subscription_parseFromJSON() failed [reset_ids]"); + goto end; + } + + reset_idsList = OpenAPI_list_create(); + + cJSON_ArrayForEach(reset_ids_local, reset_ids) { + double *localDouble = NULL; + int *localInt = NULL; + if (!cJSON_IsString(reset_ids_local)) { + ogs_error("OpenAPI_sdm_subscription_parseFromJSON() failed [reset_ids]"); + goto end; + } + OpenAPI_list_add(reset_idsList, ogs_strdup(reset_ids_local->valuestring)); + } + } + + ue_con_smf_data_sub_filter = cJSON_GetObjectItemCaseSensitive(sdm_subscriptionJSON, "ueConSmfDataSubFilter"); + if (ue_con_smf_data_sub_filter) { + ue_con_smf_data_sub_filter_local_nonprim = OpenAPI_ue_context_in_smf_data_sub_filter_parseFromJSON(ue_con_smf_data_sub_filter); + } + sdm_subscription_local_var = OpenAPI_sdm_subscription_create ( ogs_strdup(nf_instance_id->valuestring), implicit_unsubscribe ? true : false, @@ -415,7 +527,13 @@ OpenAPI_sdm_subscription_t *OpenAPI_sdm_subscription_parseFromJSON(cJSON *sdm_su immediate_report ? immediate_report->valueint : 0, report ? report_local_nonprim : NULL, supported_features && !cJSON_IsNull(supported_features) ? ogs_strdup(supported_features->valuestring) : NULL, - context_info ? context_info_local_nonprim : NULL + context_info ? context_info_local_nonprim : NULL, + nf_change_filter ? true : false, + nf_change_filter ? nf_change_filter->valueint : 0, + unique_subscription ? true : false, + unique_subscription ? unique_subscription->valueint : 0, + reset_ids ? reset_idsList : NULL, + ue_con_smf_data_sub_filter ? ue_con_smf_data_sub_filter_local_nonprim : NULL ); return sdm_subscription_local_var; @@ -436,13 +554,24 @@ end: plmn_id_local_nonprim = NULL; } if (report_local_nonprim) { - OpenAPI_subscription_data_sets_free(report_local_nonprim); + OpenAPI_immediate_report_free(report_local_nonprim); report_local_nonprim = NULL; } if (context_info_local_nonprim) { OpenAPI_context_info_free(context_info_local_nonprim); context_info_local_nonprim = NULL; } + if (reset_idsList) { + OpenAPI_list_for_each(reset_idsList, node) { + ogs_free(node->data); + } + OpenAPI_list_free(reset_idsList); + reset_idsList = NULL; + } + if (ue_con_smf_data_sub_filter_local_nonprim) { + OpenAPI_ue_context_in_smf_data_sub_filter_free(ue_con_smf_data_sub_filter_local_nonprim); + ue_con_smf_data_sub_filter_local_nonprim = NULL; + } return NULL; } diff --git a/lib/sbi/openapi/model/sdm_subscription.h b/lib/sbi/openapi/model/sdm_subscription.h index 2b6141356..30c512060 100644 --- a/lib/sbi/openapi/model/sdm_subscription.h +++ b/lib/sbi/openapi/model/sdm_subscription.h @@ -13,9 +13,10 @@ #include "../include/keyValuePair.h" #include "../include/binary.h" #include "context_info.h" +#include "immediate_report.h" #include "plmn_id.h" #include "snssai.h" -#include "subscription_data_sets.h" +#include "ue_context_in_smf_data_sub_filter.h" #ifdef __cplusplus extern "C" { @@ -36,9 +37,15 @@ typedef struct OpenAPI_sdm_subscription_s { struct OpenAPI_plmn_id_s *plmn_id; bool is_immediate_report; int immediate_report; - struct OpenAPI_subscription_data_sets_s *report; + struct OpenAPI_immediate_report_s *report; char *supported_features; struct OpenAPI_context_info_s *context_info; + bool is_nf_change_filter; + int nf_change_filter; + bool is_unique_subscription; + int unique_subscription; + OpenAPI_list_t *reset_ids; + struct OpenAPI_ue_context_in_smf_data_sub_filter_s *ue_con_smf_data_sub_filter; } OpenAPI_sdm_subscription_t; OpenAPI_sdm_subscription_t *OpenAPI_sdm_subscription_create( @@ -55,9 +62,15 @@ OpenAPI_sdm_subscription_t *OpenAPI_sdm_subscription_create( OpenAPI_plmn_id_t *plmn_id, bool is_immediate_report, int immediate_report, - OpenAPI_subscription_data_sets_t *report, + OpenAPI_immediate_report_t *report, char *supported_features, - OpenAPI_context_info_t *context_info + OpenAPI_context_info_t *context_info, + bool is_nf_change_filter, + int nf_change_filter, + bool is_unique_subscription, + int unique_subscription, + OpenAPI_list_t *reset_ids, + OpenAPI_ue_context_in_smf_data_sub_filter_t *ue_con_smf_data_sub_filter ); void OpenAPI_sdm_subscription_free(OpenAPI_sdm_subscription_t *sdm_subscription); OpenAPI_sdm_subscription_t *OpenAPI_sdm_subscription_parseFromJSON(cJSON *sdm_subscriptionJSON); diff --git a/lib/sbi/openapi/model/sdm_subscription_1.c b/lib/sbi/openapi/model/sdm_subscription_1.c index cc938a80c..8de49fdc0 100644 --- a/lib/sbi/openapi/model/sdm_subscription_1.c +++ b/lib/sbi/openapi/model/sdm_subscription_1.c @@ -18,9 +18,15 @@ OpenAPI_sdm_subscription_1_t *OpenAPI_sdm_subscription_1_create( OpenAPI_plmn_id_1_t *plmn_id, bool is_immediate_report, int immediate_report, - OpenAPI_subscription_data_sets_1_t *report, + OpenAPI_immediate_report_t *report, char *supported_features, - OpenAPI_context_info_t *context_info + OpenAPI_context_info_t *context_info, + bool is_nf_change_filter, + int nf_change_filter, + bool is_unique_subscription, + int unique_subscription, + OpenAPI_list_t *reset_ids, + OpenAPI_ue_context_in_smf_data_sub_filter_1_t *ue_con_smf_data_sub_filter ) { OpenAPI_sdm_subscription_1_t *sdm_subscription_1_local_var = ogs_malloc(sizeof(OpenAPI_sdm_subscription_1_t)); @@ -42,6 +48,12 @@ OpenAPI_sdm_subscription_1_t *OpenAPI_sdm_subscription_1_create( sdm_subscription_1_local_var->report = report; sdm_subscription_1_local_var->supported_features = supported_features; sdm_subscription_1_local_var->context_info = context_info; + sdm_subscription_1_local_var->is_nf_change_filter = is_nf_change_filter; + sdm_subscription_1_local_var->nf_change_filter = nf_change_filter; + sdm_subscription_1_local_var->is_unique_subscription = is_unique_subscription; + sdm_subscription_1_local_var->unique_subscription = unique_subscription; + sdm_subscription_1_local_var->reset_ids = reset_ids; + sdm_subscription_1_local_var->ue_con_smf_data_sub_filter = ue_con_smf_data_sub_filter; return sdm_subscription_1_local_var; } @@ -93,7 +105,7 @@ void OpenAPI_sdm_subscription_1_free(OpenAPI_sdm_subscription_1_t *sdm_subscript sdm_subscription_1->plmn_id = NULL; } if (sdm_subscription_1->report) { - OpenAPI_subscription_data_sets_1_free(sdm_subscription_1->report); + OpenAPI_immediate_report_free(sdm_subscription_1->report); sdm_subscription_1->report = NULL; } if (sdm_subscription_1->supported_features) { @@ -104,6 +116,17 @@ void OpenAPI_sdm_subscription_1_free(OpenAPI_sdm_subscription_1_t *sdm_subscript OpenAPI_context_info_free(sdm_subscription_1->context_info); sdm_subscription_1->context_info = NULL; } + if (sdm_subscription_1->reset_ids) { + OpenAPI_list_for_each(sdm_subscription_1->reset_ids, node) { + ogs_free(node->data); + } + OpenAPI_list_free(sdm_subscription_1->reset_ids); + sdm_subscription_1->reset_ids = NULL; + } + if (sdm_subscription_1->ue_con_smf_data_sub_filter) { + OpenAPI_ue_context_in_smf_data_sub_filter_1_free(sdm_subscription_1->ue_con_smf_data_sub_filter); + sdm_subscription_1->ue_con_smf_data_sub_filter = NULL; + } ogs_free(sdm_subscription_1); } @@ -221,7 +244,7 @@ cJSON *OpenAPI_sdm_subscription_1_convertToJSON(OpenAPI_sdm_subscription_1_t *sd } if (sdm_subscription_1->report) { - cJSON *report_local_JSON = OpenAPI_subscription_data_sets_1_convertToJSON(sdm_subscription_1->report); + cJSON *report_local_JSON = OpenAPI_immediate_report_convertToJSON(sdm_subscription_1->report); if (report_local_JSON == NULL) { ogs_error("OpenAPI_sdm_subscription_1_convertToJSON() failed [report]"); goto end; @@ -253,6 +276,47 @@ cJSON *OpenAPI_sdm_subscription_1_convertToJSON(OpenAPI_sdm_subscription_1_t *sd } } + if (sdm_subscription_1->is_nf_change_filter) { + if (cJSON_AddBoolToObject(item, "nfChangeFilter", sdm_subscription_1->nf_change_filter) == NULL) { + ogs_error("OpenAPI_sdm_subscription_1_convertToJSON() failed [nf_change_filter]"); + goto end; + } + } + + if (sdm_subscription_1->is_unique_subscription) { + if (cJSON_AddBoolToObject(item, "uniqueSubscription", sdm_subscription_1->unique_subscription) == NULL) { + ogs_error("OpenAPI_sdm_subscription_1_convertToJSON() failed [unique_subscription]"); + goto end; + } + } + + if (sdm_subscription_1->reset_ids) { + cJSON *reset_idsList = cJSON_AddArrayToObject(item, "resetIds"); + if (reset_idsList == NULL) { + ogs_error("OpenAPI_sdm_subscription_1_convertToJSON() failed [reset_ids]"); + goto end; + } + OpenAPI_list_for_each(sdm_subscription_1->reset_ids, node) { + if (cJSON_AddStringToObject(reset_idsList, "", (char*)node->data) == NULL) { + ogs_error("OpenAPI_sdm_subscription_1_convertToJSON() failed [reset_ids]"); + goto end; + } + } + } + + if (sdm_subscription_1->ue_con_smf_data_sub_filter) { + cJSON *ue_con_smf_data_sub_filter_local_JSON = OpenAPI_ue_context_in_smf_data_sub_filter_1_convertToJSON(sdm_subscription_1->ue_con_smf_data_sub_filter); + if (ue_con_smf_data_sub_filter_local_JSON == NULL) { + ogs_error("OpenAPI_sdm_subscription_1_convertToJSON() failed [ue_con_smf_data_sub_filter]"); + goto end; + } + cJSON_AddItemToObject(item, "ueConSmfDataSubFilter", ue_con_smf_data_sub_filter_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_sdm_subscription_1_convertToJSON() failed [ue_con_smf_data_sub_filter]"); + goto end; + } + } + end: return item; } @@ -276,10 +340,16 @@ OpenAPI_sdm_subscription_1_t *OpenAPI_sdm_subscription_1_parseFromJSON(cJSON *sd OpenAPI_plmn_id_1_t *plmn_id_local_nonprim = NULL; cJSON *immediate_report = NULL; cJSON *report = NULL; - OpenAPI_subscription_data_sets_1_t *report_local_nonprim = NULL; + OpenAPI_immediate_report_t *report_local_nonprim = NULL; cJSON *supported_features = NULL; cJSON *context_info = NULL; OpenAPI_context_info_t *context_info_local_nonprim = NULL; + cJSON *nf_change_filter = NULL; + cJSON *unique_subscription = NULL; + cJSON *reset_ids = NULL; + OpenAPI_list_t *reset_idsList = NULL; + cJSON *ue_con_smf_data_sub_filter = NULL; + OpenAPI_ue_context_in_smf_data_sub_filter_1_t *ue_con_smf_data_sub_filter_local_nonprim = NULL; nf_instance_id = cJSON_GetObjectItemCaseSensitive(sdm_subscription_1JSON, "nfInstanceId"); if (!nf_instance_id) { ogs_error("OpenAPI_sdm_subscription_1_parseFromJSON() failed [nf_instance_id]"); @@ -383,7 +453,7 @@ OpenAPI_sdm_subscription_1_t *OpenAPI_sdm_subscription_1_parseFromJSON(cJSON *sd report = cJSON_GetObjectItemCaseSensitive(sdm_subscription_1JSON, "report"); if (report) { - report_local_nonprim = OpenAPI_subscription_data_sets_1_parseFromJSON(report); + report_local_nonprim = OpenAPI_immediate_report_parseFromJSON(report); } supported_features = cJSON_GetObjectItemCaseSensitive(sdm_subscription_1JSON, "supportedFeatures"); @@ -399,6 +469,48 @@ OpenAPI_sdm_subscription_1_t *OpenAPI_sdm_subscription_1_parseFromJSON(cJSON *sd context_info_local_nonprim = OpenAPI_context_info_parseFromJSON(context_info); } + nf_change_filter = cJSON_GetObjectItemCaseSensitive(sdm_subscription_1JSON, "nfChangeFilter"); + if (nf_change_filter) { + if (!cJSON_IsBool(nf_change_filter)) { + ogs_error("OpenAPI_sdm_subscription_1_parseFromJSON() failed [nf_change_filter]"); + goto end; + } + } + + unique_subscription = cJSON_GetObjectItemCaseSensitive(sdm_subscription_1JSON, "uniqueSubscription"); + if (unique_subscription) { + if (!cJSON_IsBool(unique_subscription)) { + ogs_error("OpenAPI_sdm_subscription_1_parseFromJSON() failed [unique_subscription]"); + goto end; + } + } + + reset_ids = cJSON_GetObjectItemCaseSensitive(sdm_subscription_1JSON, "resetIds"); + if (reset_ids) { + cJSON *reset_ids_local = NULL; + if (!cJSON_IsArray(reset_ids)) { + ogs_error("OpenAPI_sdm_subscription_1_parseFromJSON() failed [reset_ids]"); + goto end; + } + + reset_idsList = OpenAPI_list_create(); + + cJSON_ArrayForEach(reset_ids_local, reset_ids) { + double *localDouble = NULL; + int *localInt = NULL; + if (!cJSON_IsString(reset_ids_local)) { + ogs_error("OpenAPI_sdm_subscription_1_parseFromJSON() failed [reset_ids]"); + goto end; + } + OpenAPI_list_add(reset_idsList, ogs_strdup(reset_ids_local->valuestring)); + } + } + + ue_con_smf_data_sub_filter = cJSON_GetObjectItemCaseSensitive(sdm_subscription_1JSON, "ueConSmfDataSubFilter"); + if (ue_con_smf_data_sub_filter) { + ue_con_smf_data_sub_filter_local_nonprim = OpenAPI_ue_context_in_smf_data_sub_filter_1_parseFromJSON(ue_con_smf_data_sub_filter); + } + sdm_subscription_1_local_var = OpenAPI_sdm_subscription_1_create ( ogs_strdup(nf_instance_id->valuestring), implicit_unsubscribe ? true : false, @@ -415,7 +527,13 @@ OpenAPI_sdm_subscription_1_t *OpenAPI_sdm_subscription_1_parseFromJSON(cJSON *sd immediate_report ? immediate_report->valueint : 0, report ? report_local_nonprim : NULL, supported_features && !cJSON_IsNull(supported_features) ? ogs_strdup(supported_features->valuestring) : NULL, - context_info ? context_info_local_nonprim : NULL + context_info ? context_info_local_nonprim : NULL, + nf_change_filter ? true : false, + nf_change_filter ? nf_change_filter->valueint : 0, + unique_subscription ? true : false, + unique_subscription ? unique_subscription->valueint : 0, + reset_ids ? reset_idsList : NULL, + ue_con_smf_data_sub_filter ? ue_con_smf_data_sub_filter_local_nonprim : NULL ); return sdm_subscription_1_local_var; @@ -436,13 +554,24 @@ end: plmn_id_local_nonprim = NULL; } if (report_local_nonprim) { - OpenAPI_subscription_data_sets_1_free(report_local_nonprim); + OpenAPI_immediate_report_free(report_local_nonprim); report_local_nonprim = NULL; } if (context_info_local_nonprim) { OpenAPI_context_info_free(context_info_local_nonprim); context_info_local_nonprim = NULL; } + if (reset_idsList) { + OpenAPI_list_for_each(reset_idsList, node) { + ogs_free(node->data); + } + OpenAPI_list_free(reset_idsList); + reset_idsList = NULL; + } + if (ue_con_smf_data_sub_filter_local_nonprim) { + OpenAPI_ue_context_in_smf_data_sub_filter_1_free(ue_con_smf_data_sub_filter_local_nonprim); + ue_con_smf_data_sub_filter_local_nonprim = NULL; + } return NULL; } diff --git a/lib/sbi/openapi/model/sdm_subscription_1.h b/lib/sbi/openapi/model/sdm_subscription_1.h index a2a849e22..853c5ae42 100644 --- a/lib/sbi/openapi/model/sdm_subscription_1.h +++ b/lib/sbi/openapi/model/sdm_subscription_1.h @@ -13,9 +13,10 @@ #include "../include/keyValuePair.h" #include "../include/binary.h" #include "context_info.h" +#include "immediate_report.h" #include "plmn_id_1.h" #include "snssai.h" -#include "subscription_data_sets_1.h" +#include "ue_context_in_smf_data_sub_filter_1.h" #ifdef __cplusplus extern "C" { @@ -36,9 +37,15 @@ typedef struct OpenAPI_sdm_subscription_1_s { struct OpenAPI_plmn_id_1_s *plmn_id; bool is_immediate_report; int immediate_report; - struct OpenAPI_subscription_data_sets_1_s *report; + struct OpenAPI_immediate_report_s *report; char *supported_features; struct OpenAPI_context_info_s *context_info; + bool is_nf_change_filter; + int nf_change_filter; + bool is_unique_subscription; + int unique_subscription; + OpenAPI_list_t *reset_ids; + struct OpenAPI_ue_context_in_smf_data_sub_filter_1_s *ue_con_smf_data_sub_filter; } OpenAPI_sdm_subscription_1_t; OpenAPI_sdm_subscription_1_t *OpenAPI_sdm_subscription_1_create( @@ -55,9 +62,15 @@ OpenAPI_sdm_subscription_1_t *OpenAPI_sdm_subscription_1_create( OpenAPI_plmn_id_1_t *plmn_id, bool is_immediate_report, int immediate_report, - OpenAPI_subscription_data_sets_1_t *report, + OpenAPI_immediate_report_t *report, char *supported_features, - OpenAPI_context_info_t *context_info + OpenAPI_context_info_t *context_info, + bool is_nf_change_filter, + int nf_change_filter, + bool is_unique_subscription, + int unique_subscription, + OpenAPI_list_t *reset_ids, + OpenAPI_ue_context_in_smf_data_sub_filter_1_t *ue_con_smf_data_sub_filter ); void OpenAPI_sdm_subscription_1_free(OpenAPI_sdm_subscription_1_t *sdm_subscription_1); OpenAPI_sdm_subscription_1_t *OpenAPI_sdm_subscription_1_parseFromJSON(cJSON *sdm_subscription_1JSON); diff --git a/lib/sbi/openapi/model/seaf_data.h b/lib/sbi/openapi/model/seaf_data.h index 642dc84e0..f19127dd9 100644 --- a/lib/sbi/openapi/model/seaf_data.h +++ b/lib/sbi/openapi/model/seaf_data.h @@ -1,7 +1,7 @@ /* * seaf_data.h * - * + * Represents SEAF data derived from data received from AUSF */ #ifndef _OpenAPI_seaf_data_H_ diff --git a/lib/sbi/openapi/model/search_result.c b/lib/sbi/openapi/model/search_result.c index dc1fdc9ec..7aaf9e3e1 100644 --- a/lib/sbi/openapi/model/search_result.c +++ b/lib/sbi/openapi/model/search_result.c @@ -12,7 +12,11 @@ OpenAPI_search_result_t *OpenAPI_search_result_create( bool is_num_nf_inst_complete, int num_nf_inst_complete, OpenAPI_preferred_search_t *preferred_search, - char *nrf_supported_features + char *nrf_supported_features, + OpenAPI_list_t* nf_instance_list, + bool is_altered_priority_ind, + int altered_priority_ind, + OpenAPI_no_profile_match_info_t *no_profile_match_info ) { OpenAPI_search_result_t *search_result_local_var = ogs_malloc(sizeof(OpenAPI_search_result_t)); @@ -26,6 +30,10 @@ OpenAPI_search_result_t *OpenAPI_search_result_create( search_result_local_var->num_nf_inst_complete = num_nf_inst_complete; search_result_local_var->preferred_search = preferred_search; search_result_local_var->nrf_supported_features = nrf_supported_features; + search_result_local_var->nf_instance_list = nf_instance_list; + search_result_local_var->is_altered_priority_ind = is_altered_priority_ind; + search_result_local_var->altered_priority_ind = altered_priority_ind; + search_result_local_var->no_profile_match_info = no_profile_match_info; return search_result_local_var; } @@ -56,6 +64,20 @@ void OpenAPI_search_result_free(OpenAPI_search_result_t *search_result) ogs_free(search_result->nrf_supported_features); search_result->nrf_supported_features = NULL; } + if (search_result->nf_instance_list) { + OpenAPI_list_for_each(search_result->nf_instance_list, node) { + OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*)node->data; + ogs_free(localKeyValue->key); + OpenAPI_nf_instance_info_free(localKeyValue->value); + OpenAPI_map_free(localKeyValue); + } + OpenAPI_list_free(search_result->nf_instance_list); + search_result->nf_instance_list = NULL; + } + if (search_result->no_profile_match_info) { + OpenAPI_no_profile_match_info_free(search_result->no_profile_match_info); + search_result->no_profile_match_info = NULL; + } ogs_free(search_result); } @@ -129,6 +151,48 @@ cJSON *OpenAPI_search_result_convertToJSON(OpenAPI_search_result_t *search_resul } } + if (search_result->nf_instance_list) { + cJSON *nf_instance_list = cJSON_AddObjectToObject(item, "nfInstanceList"); + if (nf_instance_list == NULL) { + ogs_error("OpenAPI_search_result_convertToJSON() failed [nf_instance_list]"); + goto end; + } + cJSON *localMapObject = nf_instance_list; + if (search_result->nf_instance_list) { + OpenAPI_list_for_each(search_result->nf_instance_list, node) { + OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*)node->data; + cJSON *itemLocal = localKeyValue->value ? + OpenAPI_nf_instance_info_convertToJSON(localKeyValue->value) : + cJSON_CreateNull(); + if (itemLocal == NULL) { + ogs_error("OpenAPI_search_result_convertToJSON() failed [inner]"); + goto end; + } + cJSON_AddItemToObject(localMapObject, localKeyValue->key, itemLocal); + } + } + } + + if (search_result->is_altered_priority_ind) { + if (cJSON_AddBoolToObject(item, "alteredPriorityInd", search_result->altered_priority_ind) == NULL) { + ogs_error("OpenAPI_search_result_convertToJSON() failed [altered_priority_ind]"); + goto end; + } + } + + if (search_result->no_profile_match_info) { + cJSON *no_profile_match_info_local_JSON = OpenAPI_no_profile_match_info_convertToJSON(search_result->no_profile_match_info); + if (no_profile_match_info_local_JSON == NULL) { + ogs_error("OpenAPI_search_result_convertToJSON() failed [no_profile_match_info]"); + goto end; + } + cJSON_AddItemToObject(item, "noProfileMatchInfo", no_profile_match_info_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_search_result_convertToJSON() failed [no_profile_match_info]"); + goto end; + } + } + end: return item; } @@ -145,6 +209,11 @@ OpenAPI_search_result_t *OpenAPI_search_result_parseFromJSON(cJSON *search_resul cJSON *preferred_search = NULL; OpenAPI_preferred_search_t *preferred_search_local_nonprim = NULL; cJSON *nrf_supported_features = NULL; + cJSON *nf_instance_list = NULL; + OpenAPI_list_t *nf_instance_listList = NULL; + cJSON *altered_priority_ind = NULL; + cJSON *no_profile_match_info = NULL; + OpenAPI_no_profile_match_info_t *no_profile_match_info_local_nonprim = NULL; validity_period = cJSON_GetObjectItemCaseSensitive(search_resultJSON, "validityPeriod"); if (validity_period) { if (!cJSON_IsNumber(validity_period)) { @@ -209,6 +278,45 @@ OpenAPI_search_result_t *OpenAPI_search_result_parseFromJSON(cJSON *search_resul } } + nf_instance_list = cJSON_GetObjectItemCaseSensitive(search_resultJSON, "nfInstanceList"); + if (nf_instance_list) { + cJSON *nf_instance_list_local_map = NULL; + if (!cJSON_IsObject(nf_instance_list) && !cJSON_IsNull(nf_instance_list)) { + ogs_error("OpenAPI_search_result_parseFromJSON() failed [nf_instance_list]"); + goto end; + } + if (cJSON_IsObject(nf_instance_list)) { + nf_instance_listList = OpenAPI_list_create(); + OpenAPI_map_t *localMapKeyPair = NULL; + cJSON_ArrayForEach(nf_instance_list_local_map, nf_instance_list) { + cJSON *localMapObject = nf_instance_list_local_map; + if (cJSON_IsObject(localMapObject)) { + localMapKeyPair = OpenAPI_map_create( + ogs_strdup(localMapObject->string), OpenAPI_nf_instance_info_parseFromJSON(localMapObject)); + } else if (cJSON_IsNull(localMapObject)) { + localMapKeyPair = OpenAPI_map_create(ogs_strdup(localMapObject->string), NULL); + } else { + ogs_error("OpenAPI_search_result_parseFromJSON() failed [inner]"); + goto end; + } + OpenAPI_list_add(nf_instance_listList, localMapKeyPair); + } + } + } + + altered_priority_ind = cJSON_GetObjectItemCaseSensitive(search_resultJSON, "alteredPriorityInd"); + if (altered_priority_ind) { + if (!cJSON_IsBool(altered_priority_ind)) { + ogs_error("OpenAPI_search_result_parseFromJSON() failed [altered_priority_ind]"); + goto end; + } + } + + no_profile_match_info = cJSON_GetObjectItemCaseSensitive(search_resultJSON, "noProfileMatchInfo"); + if (no_profile_match_info) { + no_profile_match_info_local_nonprim = OpenAPI_no_profile_match_info_parseFromJSON(no_profile_match_info); + } + search_result_local_var = OpenAPI_search_result_create ( validity_period ? true : false, validity_period ? validity_period->valuedouble : 0, @@ -217,7 +325,11 @@ OpenAPI_search_result_t *OpenAPI_search_result_parseFromJSON(cJSON *search_resul num_nf_inst_complete ? true : false, num_nf_inst_complete ? num_nf_inst_complete->valuedouble : 0, preferred_search ? preferred_search_local_nonprim : NULL, - nrf_supported_features && !cJSON_IsNull(nrf_supported_features) ? ogs_strdup(nrf_supported_features->valuestring) : NULL + nrf_supported_features && !cJSON_IsNull(nrf_supported_features) ? ogs_strdup(nrf_supported_features->valuestring) : NULL, + nf_instance_list ? nf_instance_listList : NULL, + altered_priority_ind ? true : false, + altered_priority_ind ? altered_priority_ind->valueint : 0, + no_profile_match_info ? no_profile_match_info_local_nonprim : NULL ); return search_result_local_var; @@ -233,6 +345,20 @@ end: OpenAPI_preferred_search_free(preferred_search_local_nonprim); preferred_search_local_nonprim = NULL; } + if (nf_instance_listList) { + OpenAPI_list_for_each(nf_instance_listList, node) { + OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*) node->data; + ogs_free(localKeyValue->key); + OpenAPI_nf_instance_info_free(localKeyValue->value); + OpenAPI_map_free(localKeyValue); + } + OpenAPI_list_free(nf_instance_listList); + nf_instance_listList = NULL; + } + if (no_profile_match_info_local_nonprim) { + OpenAPI_no_profile_match_info_free(no_profile_match_info_local_nonprim); + no_profile_match_info_local_nonprim = NULL; + } return NULL; } diff --git a/lib/sbi/openapi/model/search_result.h b/lib/sbi/openapi/model/search_result.h index d7362a4d8..79e505415 100644 --- a/lib/sbi/openapi/model/search_result.h +++ b/lib/sbi/openapi/model/search_result.h @@ -12,7 +12,9 @@ #include "../include/list.h" #include "../include/keyValuePair.h" #include "../include/binary.h" +#include "nf_instance_info.h" #include "nf_profile.h" +#include "no_profile_match_info.h" #include "preferred_search.h" #ifdef __cplusplus @@ -29,6 +31,10 @@ typedef struct OpenAPI_search_result_s { int num_nf_inst_complete; struct OpenAPI_preferred_search_s *preferred_search; char *nrf_supported_features; + OpenAPI_list_t* nf_instance_list; + bool is_altered_priority_ind; + int altered_priority_ind; + struct OpenAPI_no_profile_match_info_s *no_profile_match_info; } OpenAPI_search_result_t; OpenAPI_search_result_t *OpenAPI_search_result_create( @@ -39,7 +45,11 @@ OpenAPI_search_result_t *OpenAPI_search_result_create( bool is_num_nf_inst_complete, int num_nf_inst_complete, OpenAPI_preferred_search_t *preferred_search, - char *nrf_supported_features + char *nrf_supported_features, + OpenAPI_list_t* nf_instance_list, + bool is_altered_priority_ind, + int altered_priority_ind, + OpenAPI_no_profile_match_info_t *no_profile_match_info ); void OpenAPI_search_result_free(OpenAPI_search_result_t *search_result); OpenAPI_search_result_t *OpenAPI_search_result_parseFromJSON(cJSON *search_resultJSON); diff --git a/lib/sbi/openapi/model/secondary_rat_usage_info.h b/lib/sbi/openapi/model/secondary_rat_usage_info.h index 6be1dd903..1b3d8bb36 100644 --- a/lib/sbi/openapi/model/secondary_rat_usage_info.h +++ b/lib/sbi/openapi/model/secondary_rat_usage_info.h @@ -1,7 +1,7 @@ /* * secondary_rat_usage_info.h * - * + * Secondary RAT Usage Information to report usage data for a secondary RAT for QoS flows and/or the whole PDU session. */ #ifndef _OpenAPI_secondary_rat_usage_info_H_ diff --git a/lib/sbi/openapi/model/secondary_rat_usage_report.h b/lib/sbi/openapi/model/secondary_rat_usage_report.h index f209842ed..04bafc5d7 100644 --- a/lib/sbi/openapi/model/secondary_rat_usage_report.h +++ b/lib/sbi/openapi/model/secondary_rat_usage_report.h @@ -1,7 +1,7 @@ /* * secondary_rat_usage_report.h * - * + * Secondary RAT Usage Report to report usage data for a secondary RAT for QoS flows. */ #ifndef _OpenAPI_secondary_rat_usage_report_H_ diff --git a/lib/sbi/openapi/model/security_result.h b/lib/sbi/openapi/model/security_result.h index f79ef4322..3173ff22a 100644 --- a/lib/sbi/openapi/model/security_result.h +++ b/lib/sbi/openapi/model/security_result.h @@ -1,7 +1,7 @@ /* * security_result.h * - * + * Security Result */ #ifndef _OpenAPI_security_result_H_ diff --git a/lib/sbi/openapi/model/send_mo_data_req_data.h b/lib/sbi/openapi/model/send_mo_data_req_data.h index 340eba3f9..13e10196a 100644 --- a/lib/sbi/openapi/model/send_mo_data_req_data.h +++ b/lib/sbi/openapi/model/send_mo_data_req_data.h @@ -1,7 +1,7 @@ /* * send_mo_data_req_data.h * - * + * Data within Send MO Data Request */ #ifndef _OpenAPI_send_mo_data_req_data_H_ diff --git a/lib/sbi/openapi/model/sepp_info.c b/lib/sbi/openapi/model/sepp_info.c new file mode 100644 index 000000000..a7db3edbf --- /dev/null +++ b/lib/sbi/openapi/model/sepp_info.c @@ -0,0 +1,303 @@ + +#include +#include +#include +#include "sepp_info.h" + +OpenAPI_sepp_info_t *OpenAPI_sepp_info_create( + char *sepp_prefix, + OpenAPI_list_t* sepp_ports, + OpenAPI_list_t *remote_plmn_list, + OpenAPI_list_t *remote_snpn_list +) +{ + OpenAPI_sepp_info_t *sepp_info_local_var = ogs_malloc(sizeof(OpenAPI_sepp_info_t)); + ogs_assert(sepp_info_local_var); + + sepp_info_local_var->sepp_prefix = sepp_prefix; + sepp_info_local_var->sepp_ports = sepp_ports; + sepp_info_local_var->remote_plmn_list = remote_plmn_list; + sepp_info_local_var->remote_snpn_list = remote_snpn_list; + + return sepp_info_local_var; +} + +void OpenAPI_sepp_info_free(OpenAPI_sepp_info_t *sepp_info) +{ + OpenAPI_lnode_t *node = NULL; + + if (NULL == sepp_info) { + return; + } + if (sepp_info->sepp_prefix) { + ogs_free(sepp_info->sepp_prefix); + sepp_info->sepp_prefix = NULL; + } + if (sepp_info->sepp_ports) { + OpenAPI_list_for_each(sepp_info->sepp_ports, node) { + OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*)node->data; + ogs_free(localKeyValue->key); + ogs_free(localKeyValue->value); + OpenAPI_map_free(localKeyValue); + } + OpenAPI_list_free(sepp_info->sepp_ports); + sepp_info->sepp_ports = NULL; + } + if (sepp_info->remote_plmn_list) { + OpenAPI_list_for_each(sepp_info->remote_plmn_list, node) { + OpenAPI_plmn_id_free(node->data); + } + OpenAPI_list_free(sepp_info->remote_plmn_list); + sepp_info->remote_plmn_list = NULL; + } + if (sepp_info->remote_snpn_list) { + OpenAPI_list_for_each(sepp_info->remote_snpn_list, node) { + OpenAPI_plmn_id_nid_free(node->data); + } + OpenAPI_list_free(sepp_info->remote_snpn_list); + sepp_info->remote_snpn_list = NULL; + } + ogs_free(sepp_info); +} + +cJSON *OpenAPI_sepp_info_convertToJSON(OpenAPI_sepp_info_t *sepp_info) +{ + cJSON *item = NULL; + OpenAPI_lnode_t *node = NULL; + + if (sepp_info == NULL) { + ogs_error("OpenAPI_sepp_info_convertToJSON() failed [SeppInfo]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (sepp_info->sepp_prefix) { + if (cJSON_AddStringToObject(item, "seppPrefix", sepp_info->sepp_prefix) == NULL) { + ogs_error("OpenAPI_sepp_info_convertToJSON() failed [sepp_prefix]"); + goto end; + } + } + + if (sepp_info->sepp_ports) { + cJSON *sepp_ports = cJSON_AddObjectToObject(item, "seppPorts"); + if (sepp_ports == NULL) { + ogs_error("OpenAPI_sepp_info_convertToJSON() failed [sepp_ports]"); + goto end; + } + cJSON *localMapObject = sepp_ports; + if (sepp_info->sepp_ports) { + OpenAPI_list_for_each(sepp_info->sepp_ports, node) { + OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*)node->data; + if (cJSON_AddNumberToObject(localMapObject, localKeyValue->key, (uintptr_t)localKeyValue->value) == NULL) { + ogs_error("OpenAPI_sepp_info_convertToJSON() failed [inner]"); + goto end; + } + } + } + } + + if (sepp_info->remote_plmn_list) { + cJSON *remote_plmn_listList = cJSON_AddArrayToObject(item, "remotePlmnList"); + if (remote_plmn_listList == NULL) { + ogs_error("OpenAPI_sepp_info_convertToJSON() failed [remote_plmn_list]"); + goto end; + } + OpenAPI_list_for_each(sepp_info->remote_plmn_list, node) { + cJSON *itemLocal = OpenAPI_plmn_id_convertToJSON(node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_sepp_info_convertToJSON() failed [remote_plmn_list]"); + goto end; + } + cJSON_AddItemToArray(remote_plmn_listList, itemLocal); + } + } + + if (sepp_info->remote_snpn_list) { + cJSON *remote_snpn_listList = cJSON_AddArrayToObject(item, "remoteSnpnList"); + if (remote_snpn_listList == NULL) { + ogs_error("OpenAPI_sepp_info_convertToJSON() failed [remote_snpn_list]"); + goto end; + } + OpenAPI_list_for_each(sepp_info->remote_snpn_list, node) { + cJSON *itemLocal = OpenAPI_plmn_id_nid_convertToJSON(node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_sepp_info_convertToJSON() failed [remote_snpn_list]"); + goto end; + } + cJSON_AddItemToArray(remote_snpn_listList, itemLocal); + } + } + +end: + return item; +} + +OpenAPI_sepp_info_t *OpenAPI_sepp_info_parseFromJSON(cJSON *sepp_infoJSON) +{ + OpenAPI_sepp_info_t *sepp_info_local_var = NULL; + OpenAPI_lnode_t *node = NULL; + cJSON *sepp_prefix = NULL; + cJSON *sepp_ports = NULL; + OpenAPI_list_t *sepp_portsList = NULL; + cJSON *remote_plmn_list = NULL; + OpenAPI_list_t *remote_plmn_listList = NULL; + cJSON *remote_snpn_list = NULL; + OpenAPI_list_t *remote_snpn_listList = NULL; + sepp_prefix = cJSON_GetObjectItemCaseSensitive(sepp_infoJSON, "seppPrefix"); + if (sepp_prefix) { + if (!cJSON_IsString(sepp_prefix) && !cJSON_IsNull(sepp_prefix)) { + ogs_error("OpenAPI_sepp_info_parseFromJSON() failed [sepp_prefix]"); + goto end; + } + } + + sepp_ports = cJSON_GetObjectItemCaseSensitive(sepp_infoJSON, "seppPorts"); + if (sepp_ports) { + cJSON *sepp_ports_local_map = NULL; + if (!cJSON_IsObject(sepp_ports) && !cJSON_IsNull(sepp_ports)) { + ogs_error("OpenAPI_sepp_info_parseFromJSON() failed [sepp_ports]"); + goto end; + } + if (cJSON_IsObject(sepp_ports)) { + sepp_portsList = OpenAPI_list_create(); + OpenAPI_map_t *localMapKeyPair = NULL; + cJSON_ArrayForEach(sepp_ports_local_map, sepp_ports) { + cJSON *localMapObject = sepp_ports_local_map; + double *localDouble = NULL; + int *localInt = NULL; + if (!cJSON_IsNumber(localMapObject)) { + ogs_error("OpenAPI_sepp_info_parseFromJSON() failed [inner]"); + goto end; + } + localDouble = (double *)ogs_calloc(1, sizeof(double)); + if (!localDouble) { + ogs_error("OpenAPI_sepp_info_parseFromJSON() failed [inner]"); + goto end; + } + *localDouble = localMapObject->valuedouble; + localMapKeyPair = OpenAPI_map_create(ogs_strdup(localMapObject->string), localDouble); + OpenAPI_list_add(sepp_portsList, localMapKeyPair); + } + } + } + + remote_plmn_list = cJSON_GetObjectItemCaseSensitive(sepp_infoJSON, "remotePlmnList"); + if (remote_plmn_list) { + cJSON *remote_plmn_list_local = NULL; + if (!cJSON_IsArray(remote_plmn_list)) { + ogs_error("OpenAPI_sepp_info_parseFromJSON() failed [remote_plmn_list]"); + goto end; + } + + remote_plmn_listList = OpenAPI_list_create(); + + cJSON_ArrayForEach(remote_plmn_list_local, remote_plmn_list) { + if (!cJSON_IsObject(remote_plmn_list_local)) { + ogs_error("OpenAPI_sepp_info_parseFromJSON() failed [remote_plmn_list]"); + goto end; + } + OpenAPI_plmn_id_t *remote_plmn_listItem = OpenAPI_plmn_id_parseFromJSON(remote_plmn_list_local); + if (!remote_plmn_listItem) { + ogs_error("No remote_plmn_listItem"); + OpenAPI_list_free(remote_plmn_listList); + goto end; + } + OpenAPI_list_add(remote_plmn_listList, remote_plmn_listItem); + } + } + + remote_snpn_list = cJSON_GetObjectItemCaseSensitive(sepp_infoJSON, "remoteSnpnList"); + if (remote_snpn_list) { + cJSON *remote_snpn_list_local = NULL; + if (!cJSON_IsArray(remote_snpn_list)) { + ogs_error("OpenAPI_sepp_info_parseFromJSON() failed [remote_snpn_list]"); + goto end; + } + + remote_snpn_listList = OpenAPI_list_create(); + + cJSON_ArrayForEach(remote_snpn_list_local, remote_snpn_list) { + if (!cJSON_IsObject(remote_snpn_list_local)) { + ogs_error("OpenAPI_sepp_info_parseFromJSON() failed [remote_snpn_list]"); + goto end; + } + OpenAPI_plmn_id_nid_t *remote_snpn_listItem = OpenAPI_plmn_id_nid_parseFromJSON(remote_snpn_list_local); + if (!remote_snpn_listItem) { + ogs_error("No remote_snpn_listItem"); + OpenAPI_list_free(remote_snpn_listList); + goto end; + } + OpenAPI_list_add(remote_snpn_listList, remote_snpn_listItem); + } + } + + sepp_info_local_var = OpenAPI_sepp_info_create ( + sepp_prefix && !cJSON_IsNull(sepp_prefix) ? ogs_strdup(sepp_prefix->valuestring) : NULL, + sepp_ports ? sepp_portsList : NULL, + remote_plmn_list ? remote_plmn_listList : NULL, + remote_snpn_list ? remote_snpn_listList : NULL + ); + + return sepp_info_local_var; +end: + if (sepp_portsList) { + OpenAPI_list_for_each(sepp_portsList, node) { + OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*) node->data; + ogs_free(localKeyValue->key); + ogs_free(localKeyValue->value); + OpenAPI_map_free(localKeyValue); + } + OpenAPI_list_free(sepp_portsList); + sepp_portsList = NULL; + } + if (remote_plmn_listList) { + OpenAPI_list_for_each(remote_plmn_listList, node) { + OpenAPI_plmn_id_free(node->data); + } + OpenAPI_list_free(remote_plmn_listList); + remote_plmn_listList = NULL; + } + if (remote_snpn_listList) { + OpenAPI_list_for_each(remote_snpn_listList, node) { + OpenAPI_plmn_id_nid_free(node->data); + } + OpenAPI_list_free(remote_snpn_listList); + remote_snpn_listList = NULL; + } + return NULL; +} + +OpenAPI_sepp_info_t *OpenAPI_sepp_info_copy(OpenAPI_sepp_info_t *dst, OpenAPI_sepp_info_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_sepp_info_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_sepp_info_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_sepp_info_free(dst); + dst = OpenAPI_sepp_info_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/sepp_info.h b/lib/sbi/openapi/model/sepp_info.h new file mode 100644 index 000000000..8f62e3411 --- /dev/null +++ b/lib/sbi/openapi/model/sepp_info.h @@ -0,0 +1,46 @@ +/* + * sepp_info.h + * + * Information of a SEPP Instance + */ + +#ifndef _OpenAPI_sepp_info_H_ +#define _OpenAPI_sepp_info_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "plmn_id.h" +#include "plmn_id_nid.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_sepp_info_s OpenAPI_sepp_info_t; +typedef struct OpenAPI_sepp_info_s { + char *sepp_prefix; + OpenAPI_list_t* sepp_ports; + OpenAPI_list_t *remote_plmn_list; + OpenAPI_list_t *remote_snpn_list; +} OpenAPI_sepp_info_t; + +OpenAPI_sepp_info_t *OpenAPI_sepp_info_create( + char *sepp_prefix, + OpenAPI_list_t* sepp_ports, + OpenAPI_list_t *remote_plmn_list, + OpenAPI_list_t *remote_snpn_list +); +void OpenAPI_sepp_info_free(OpenAPI_sepp_info_t *sepp_info); +OpenAPI_sepp_info_t *OpenAPI_sepp_info_parseFromJSON(cJSON *sepp_infoJSON); +cJSON *OpenAPI_sepp_info_convertToJSON(OpenAPI_sepp_info_t *sepp_info); +OpenAPI_sepp_info_t *OpenAPI_sepp_info_copy(OpenAPI_sepp_info_t *dst, OpenAPI_sepp_info_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_sepp_info_H_ */ + diff --git a/lib/sbi/openapi/model/sequence_number.h b/lib/sbi/openapi/model/sequence_number.h index 5fae2fced..f0cab336b 100644 --- a/lib/sbi/openapi/model/sequence_number.h +++ b/lib/sbi/openapi/model/sequence_number.h @@ -1,7 +1,7 @@ /* * sequence_number.h * - * + * Contains the SQN. */ #ifndef _OpenAPI_sequence_number_H_ diff --git a/lib/sbi/openapi/model/serv_auth_info.c b/lib/sbi/openapi/model/serv_auth_info.c index dc4a1a9e3..ee2c6cc3e 100644 --- a/lib/sbi/openapi/model/serv_auth_info.c +++ b/lib/sbi/openapi/model/serv_auth_info.c @@ -6,7 +6,7 @@ char* OpenAPI_serv_auth_info_ToString(OpenAPI_serv_auth_info_e serv_auth_info) { - const char *serv_auth_infoArray[] = { "NULL", "TP_NOT_KNOWN", "TP_EXPIRED", "TP_NOT_YET_OCURRED" }; + const char *serv_auth_infoArray[] = { "NULL", "TP_NOT_KNOWN", "TP_EXPIRED", "TP_NOT_YET_OCURRED", "ROUT_REQ_NOT_AUTHORIZED" }; size_t sizeofArray = sizeof(serv_auth_infoArray) / sizeof(serv_auth_infoArray[0]); if (serv_auth_info < sizeofArray) return (char *)serv_auth_infoArray[serv_auth_info]; @@ -17,7 +17,7 @@ char* OpenAPI_serv_auth_info_ToString(OpenAPI_serv_auth_info_e serv_auth_info) OpenAPI_serv_auth_info_e OpenAPI_serv_auth_info_FromString(char* serv_auth_info) { int stringToReturn = 0; - const char *serv_auth_infoArray[] = { "NULL", "TP_NOT_KNOWN", "TP_EXPIRED", "TP_NOT_YET_OCURRED" }; + const char *serv_auth_infoArray[] = { "NULL", "TP_NOT_KNOWN", "TP_EXPIRED", "TP_NOT_YET_OCURRED", "ROUT_REQ_NOT_AUTHORIZED" }; size_t sizeofArray = sizeof(serv_auth_infoArray) / sizeof(serv_auth_infoArray[0]); while (stringToReturn < sizeofArray) { if (strcmp(serv_auth_info, serv_auth_infoArray[stringToReturn]) == 0) { diff --git a/lib/sbi/openapi/model/serv_auth_info.h b/lib/sbi/openapi/model/serv_auth_info.h index e24aab527..f637b97d1 100644 --- a/lib/sbi/openapi/model/serv_auth_info.h +++ b/lib/sbi/openapi/model/serv_auth_info.h @@ -17,7 +17,7 @@ extern "C" { #endif -typedef enum { OpenAPI_serv_auth_info_NULL = 0, OpenAPI_serv_auth_info_TP_NOT_KNOWN, OpenAPI_serv_auth_info_TP_EXPIRED, OpenAPI_serv_auth_info_TP_NOT_YET_OCURRED } OpenAPI_serv_auth_info_e; +typedef enum { OpenAPI_serv_auth_info_NULL = 0, OpenAPI_serv_auth_info_TP_NOT_KNOWN, OpenAPI_serv_auth_info_TP_EXPIRED, OpenAPI_serv_auth_info_TP_NOT_YET_OCURRED, OpenAPI_serv_auth_info_ROUT_REQ_NOT_AUTHORIZED } OpenAPI_serv_auth_info_e; char* OpenAPI_serv_auth_info_ToString(OpenAPI_serv_auth_info_e serv_auth_info); diff --git a/lib/sbi/openapi/model/server_addressing_info.c b/lib/sbi/openapi/model/server_addressing_info.c new file mode 100644 index 000000000..e88306405 --- /dev/null +++ b/lib/sbi/openapi/model/server_addressing_info.c @@ -0,0 +1,249 @@ + +#include +#include +#include +#include "server_addressing_info.h" + +OpenAPI_server_addressing_info_t *OpenAPI_server_addressing_info_create( + OpenAPI_list_t *ipv4_addresses, + OpenAPI_list_t *ipv6_addresses, + OpenAPI_list_t *fqdn_list +) +{ + OpenAPI_server_addressing_info_t *server_addressing_info_local_var = ogs_malloc(sizeof(OpenAPI_server_addressing_info_t)); + ogs_assert(server_addressing_info_local_var); + + server_addressing_info_local_var->ipv4_addresses = ipv4_addresses; + server_addressing_info_local_var->ipv6_addresses = ipv6_addresses; + server_addressing_info_local_var->fqdn_list = fqdn_list; + + return server_addressing_info_local_var; +} + +void OpenAPI_server_addressing_info_free(OpenAPI_server_addressing_info_t *server_addressing_info) +{ + OpenAPI_lnode_t *node = NULL; + + if (NULL == server_addressing_info) { + return; + } + if (server_addressing_info->ipv4_addresses) { + OpenAPI_list_for_each(server_addressing_info->ipv4_addresses, node) { + ogs_free(node->data); + } + OpenAPI_list_free(server_addressing_info->ipv4_addresses); + server_addressing_info->ipv4_addresses = NULL; + } + if (server_addressing_info->ipv6_addresses) { + OpenAPI_list_for_each(server_addressing_info->ipv6_addresses, node) { + ogs_free(node->data); + } + OpenAPI_list_free(server_addressing_info->ipv6_addresses); + server_addressing_info->ipv6_addresses = NULL; + } + if (server_addressing_info->fqdn_list) { + OpenAPI_list_for_each(server_addressing_info->fqdn_list, node) { + ogs_free(node->data); + } + OpenAPI_list_free(server_addressing_info->fqdn_list); + server_addressing_info->fqdn_list = NULL; + } + ogs_free(server_addressing_info); +} + +cJSON *OpenAPI_server_addressing_info_convertToJSON(OpenAPI_server_addressing_info_t *server_addressing_info) +{ + cJSON *item = NULL; + OpenAPI_lnode_t *node = NULL; + + if (server_addressing_info == NULL) { + ogs_error("OpenAPI_server_addressing_info_convertToJSON() failed [ServerAddressingInfo]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (server_addressing_info->ipv4_addresses) { + cJSON *ipv4_addressesList = cJSON_AddArrayToObject(item, "ipv4Addresses"); + if (ipv4_addressesList == NULL) { + ogs_error("OpenAPI_server_addressing_info_convertToJSON() failed [ipv4_addresses]"); + goto end; + } + OpenAPI_list_for_each(server_addressing_info->ipv4_addresses, node) { + if (cJSON_AddStringToObject(ipv4_addressesList, "", (char*)node->data) == NULL) { + ogs_error("OpenAPI_server_addressing_info_convertToJSON() failed [ipv4_addresses]"); + goto end; + } + } + } + + if (server_addressing_info->ipv6_addresses) { + cJSON *ipv6_addressesList = cJSON_AddArrayToObject(item, "ipv6Addresses"); + if (ipv6_addressesList == NULL) { + ogs_error("OpenAPI_server_addressing_info_convertToJSON() failed [ipv6_addresses]"); + goto end; + } + OpenAPI_list_for_each(server_addressing_info->ipv6_addresses, node) { + if (cJSON_AddStringToObject(ipv6_addressesList, "", (char*)node->data) == NULL) { + ogs_error("OpenAPI_server_addressing_info_convertToJSON() failed [ipv6_addresses]"); + goto end; + } + } + } + + if (server_addressing_info->fqdn_list) { + cJSON *fqdn_listList = cJSON_AddArrayToObject(item, "fqdnList"); + if (fqdn_listList == NULL) { + ogs_error("OpenAPI_server_addressing_info_convertToJSON() failed [fqdn_list]"); + goto end; + } + OpenAPI_list_for_each(server_addressing_info->fqdn_list, node) { + if (cJSON_AddStringToObject(fqdn_listList, "", (char*)node->data) == NULL) { + ogs_error("OpenAPI_server_addressing_info_convertToJSON() failed [fqdn_list]"); + goto end; + } + } + } + +end: + return item; +} + +OpenAPI_server_addressing_info_t *OpenAPI_server_addressing_info_parseFromJSON(cJSON *server_addressing_infoJSON) +{ + OpenAPI_server_addressing_info_t *server_addressing_info_local_var = NULL; + OpenAPI_lnode_t *node = NULL; + cJSON *ipv4_addresses = NULL; + OpenAPI_list_t *ipv4_addressesList = NULL; + cJSON *ipv6_addresses = NULL; + OpenAPI_list_t *ipv6_addressesList = NULL; + cJSON *fqdn_list = NULL; + OpenAPI_list_t *fqdn_listList = NULL; + ipv4_addresses = cJSON_GetObjectItemCaseSensitive(server_addressing_infoJSON, "ipv4Addresses"); + if (ipv4_addresses) { + cJSON *ipv4_addresses_local = NULL; + if (!cJSON_IsArray(ipv4_addresses)) { + ogs_error("OpenAPI_server_addressing_info_parseFromJSON() failed [ipv4_addresses]"); + goto end; + } + + ipv4_addressesList = OpenAPI_list_create(); + + cJSON_ArrayForEach(ipv4_addresses_local, ipv4_addresses) { + double *localDouble = NULL; + int *localInt = NULL; + if (!cJSON_IsString(ipv4_addresses_local)) { + ogs_error("OpenAPI_server_addressing_info_parseFromJSON() failed [ipv4_addresses]"); + goto end; + } + OpenAPI_list_add(ipv4_addressesList, ogs_strdup(ipv4_addresses_local->valuestring)); + } + } + + ipv6_addresses = cJSON_GetObjectItemCaseSensitive(server_addressing_infoJSON, "ipv6Addresses"); + if (ipv6_addresses) { + cJSON *ipv6_addresses_local = NULL; + if (!cJSON_IsArray(ipv6_addresses)) { + ogs_error("OpenAPI_server_addressing_info_parseFromJSON() failed [ipv6_addresses]"); + goto end; + } + + ipv6_addressesList = OpenAPI_list_create(); + + cJSON_ArrayForEach(ipv6_addresses_local, ipv6_addresses) { + double *localDouble = NULL; + int *localInt = NULL; + if (!cJSON_IsString(ipv6_addresses_local)) { + ogs_error("OpenAPI_server_addressing_info_parseFromJSON() failed [ipv6_addresses]"); + goto end; + } + OpenAPI_list_add(ipv6_addressesList, ogs_strdup(ipv6_addresses_local->valuestring)); + } + } + + fqdn_list = cJSON_GetObjectItemCaseSensitive(server_addressing_infoJSON, "fqdnList"); + if (fqdn_list) { + cJSON *fqdn_list_local = NULL; + if (!cJSON_IsArray(fqdn_list)) { + ogs_error("OpenAPI_server_addressing_info_parseFromJSON() failed [fqdn_list]"); + goto end; + } + + fqdn_listList = OpenAPI_list_create(); + + cJSON_ArrayForEach(fqdn_list_local, fqdn_list) { + double *localDouble = NULL; + int *localInt = NULL; + if (!cJSON_IsString(fqdn_list_local)) { + ogs_error("OpenAPI_server_addressing_info_parseFromJSON() failed [fqdn_list]"); + goto end; + } + OpenAPI_list_add(fqdn_listList, ogs_strdup(fqdn_list_local->valuestring)); + } + } + + server_addressing_info_local_var = OpenAPI_server_addressing_info_create ( + ipv4_addresses ? ipv4_addressesList : NULL, + ipv6_addresses ? ipv6_addressesList : NULL, + fqdn_list ? fqdn_listList : NULL + ); + + return server_addressing_info_local_var; +end: + if (ipv4_addressesList) { + OpenAPI_list_for_each(ipv4_addressesList, node) { + ogs_free(node->data); + } + OpenAPI_list_free(ipv4_addressesList); + ipv4_addressesList = NULL; + } + if (ipv6_addressesList) { + OpenAPI_list_for_each(ipv6_addressesList, node) { + ogs_free(node->data); + } + OpenAPI_list_free(ipv6_addressesList); + ipv6_addressesList = NULL; + } + if (fqdn_listList) { + OpenAPI_list_for_each(fqdn_listList, node) { + ogs_free(node->data); + } + OpenAPI_list_free(fqdn_listList); + fqdn_listList = NULL; + } + return NULL; +} + +OpenAPI_server_addressing_info_t *OpenAPI_server_addressing_info_copy(OpenAPI_server_addressing_info_t *dst, OpenAPI_server_addressing_info_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_server_addressing_info_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_server_addressing_info_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_server_addressing_info_free(dst); + dst = OpenAPI_server_addressing_info_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/server_addressing_info.h b/lib/sbi/openapi/model/server_addressing_info.h new file mode 100644 index 000000000..f4cf5ada8 --- /dev/null +++ b/lib/sbi/openapi/model/server_addressing_info.h @@ -0,0 +1,42 @@ +/* + * server_addressing_info.h + * + * Contains addressing information (IP addresses and/or FQDNs) of a server. + */ + +#ifndef _OpenAPI_server_addressing_info_H_ +#define _OpenAPI_server_addressing_info_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_server_addressing_info_s OpenAPI_server_addressing_info_t; +typedef struct OpenAPI_server_addressing_info_s { + OpenAPI_list_t *ipv4_addresses; + OpenAPI_list_t *ipv6_addresses; + OpenAPI_list_t *fqdn_list; +} OpenAPI_server_addressing_info_t; + +OpenAPI_server_addressing_info_t *OpenAPI_server_addressing_info_create( + OpenAPI_list_t *ipv4_addresses, + OpenAPI_list_t *ipv6_addresses, + OpenAPI_list_t *fqdn_list +); +void OpenAPI_server_addressing_info_free(OpenAPI_server_addressing_info_t *server_addressing_info); +OpenAPI_server_addressing_info_t *OpenAPI_server_addressing_info_parseFromJSON(cJSON *server_addressing_infoJSON); +cJSON *OpenAPI_server_addressing_info_convertToJSON(OpenAPI_server_addressing_info_t *server_addressing_info); +OpenAPI_server_addressing_info_t *OpenAPI_server_addressing_info_copy(OpenAPI_server_addressing_info_t *dst, OpenAPI_server_addressing_info_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_server_addressing_info_H_ */ + diff --git a/lib/sbi/openapi/model/service_area_coverage_info.c b/lib/sbi/openapi/model/service_area_coverage_info.c new file mode 100644 index 000000000..bfede8933 --- /dev/null +++ b/lib/sbi/openapi/model/service_area_coverage_info.c @@ -0,0 +1,176 @@ + +#include +#include +#include +#include "service_area_coverage_info.h" + +OpenAPI_service_area_coverage_info_t *OpenAPI_service_area_coverage_info_create( + OpenAPI_list_t *tac_list, + OpenAPI_plmn_id_nid_1_t *serving_network +) +{ + OpenAPI_service_area_coverage_info_t *service_area_coverage_info_local_var = ogs_malloc(sizeof(OpenAPI_service_area_coverage_info_t)); + ogs_assert(service_area_coverage_info_local_var); + + service_area_coverage_info_local_var->tac_list = tac_list; + service_area_coverage_info_local_var->serving_network = serving_network; + + return service_area_coverage_info_local_var; +} + +void OpenAPI_service_area_coverage_info_free(OpenAPI_service_area_coverage_info_t *service_area_coverage_info) +{ + OpenAPI_lnode_t *node = NULL; + + if (NULL == service_area_coverage_info) { + return; + } + if (service_area_coverage_info->tac_list) { + OpenAPI_list_for_each(service_area_coverage_info->tac_list, node) { + ogs_free(node->data); + } + OpenAPI_list_free(service_area_coverage_info->tac_list); + service_area_coverage_info->tac_list = NULL; + } + if (service_area_coverage_info->serving_network) { + OpenAPI_plmn_id_nid_1_free(service_area_coverage_info->serving_network); + service_area_coverage_info->serving_network = NULL; + } + ogs_free(service_area_coverage_info); +} + +cJSON *OpenAPI_service_area_coverage_info_convertToJSON(OpenAPI_service_area_coverage_info_t *service_area_coverage_info) +{ + cJSON *item = NULL; + OpenAPI_lnode_t *node = NULL; + + if (service_area_coverage_info == NULL) { + ogs_error("OpenAPI_service_area_coverage_info_convertToJSON() failed [ServiceAreaCoverageInfo]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (!service_area_coverage_info->tac_list) { + ogs_error("OpenAPI_service_area_coverage_info_convertToJSON() failed [tac_list]"); + return NULL; + } + cJSON *tac_listList = cJSON_AddArrayToObject(item, "tacList"); + if (tac_listList == NULL) { + ogs_error("OpenAPI_service_area_coverage_info_convertToJSON() failed [tac_list]"); + goto end; + } + OpenAPI_list_for_each(service_area_coverage_info->tac_list, node) { + if (cJSON_AddStringToObject(tac_listList, "", (char*)node->data) == NULL) { + ogs_error("OpenAPI_service_area_coverage_info_convertToJSON() failed [tac_list]"); + goto end; + } + } + + if (service_area_coverage_info->serving_network) { + cJSON *serving_network_local_JSON = OpenAPI_plmn_id_nid_1_convertToJSON(service_area_coverage_info->serving_network); + if (serving_network_local_JSON == NULL) { + ogs_error("OpenAPI_service_area_coverage_info_convertToJSON() failed [serving_network]"); + goto end; + } + cJSON_AddItemToObject(item, "servingNetwork", serving_network_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_service_area_coverage_info_convertToJSON() failed [serving_network]"); + goto end; + } + } + +end: + return item; +} + +OpenAPI_service_area_coverage_info_t *OpenAPI_service_area_coverage_info_parseFromJSON(cJSON *service_area_coverage_infoJSON) +{ + OpenAPI_service_area_coverage_info_t *service_area_coverage_info_local_var = NULL; + OpenAPI_lnode_t *node = NULL; + cJSON *tac_list = NULL; + OpenAPI_list_t *tac_listList = NULL; + cJSON *serving_network = NULL; + OpenAPI_plmn_id_nid_1_t *serving_network_local_nonprim = NULL; + tac_list = cJSON_GetObjectItemCaseSensitive(service_area_coverage_infoJSON, "tacList"); + if (!tac_list) { + ogs_error("OpenAPI_service_area_coverage_info_parseFromJSON() failed [tac_list]"); + goto end; + } + cJSON *tac_list_local = NULL; + if (!cJSON_IsArray(tac_list)) { + ogs_error("OpenAPI_service_area_coverage_info_parseFromJSON() failed [tac_list]"); + goto end; + } + + tac_listList = OpenAPI_list_create(); + + cJSON_ArrayForEach(tac_list_local, tac_list) { + double *localDouble = NULL; + int *localInt = NULL; + if (!cJSON_IsString(tac_list_local)) { + ogs_error("OpenAPI_service_area_coverage_info_parseFromJSON() failed [tac_list]"); + goto end; + } + OpenAPI_list_add(tac_listList, ogs_strdup(tac_list_local->valuestring)); + } + + serving_network = cJSON_GetObjectItemCaseSensitive(service_area_coverage_infoJSON, "servingNetwork"); + if (serving_network) { + serving_network_local_nonprim = OpenAPI_plmn_id_nid_1_parseFromJSON(serving_network); + } + + service_area_coverage_info_local_var = OpenAPI_service_area_coverage_info_create ( + tac_listList, + serving_network ? serving_network_local_nonprim : NULL + ); + + return service_area_coverage_info_local_var; +end: + if (tac_listList) { + OpenAPI_list_for_each(tac_listList, node) { + ogs_free(node->data); + } + OpenAPI_list_free(tac_listList); + tac_listList = NULL; + } + if (serving_network_local_nonprim) { + OpenAPI_plmn_id_nid_1_free(serving_network_local_nonprim); + serving_network_local_nonprim = NULL; + } + return NULL; +} + +OpenAPI_service_area_coverage_info_t *OpenAPI_service_area_coverage_info_copy(OpenAPI_service_area_coverage_info_t *dst, OpenAPI_service_area_coverage_info_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_service_area_coverage_info_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_service_area_coverage_info_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_service_area_coverage_info_free(dst); + dst = OpenAPI_service_area_coverage_info_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/service_area_coverage_info.h b/lib/sbi/openapi/model/service_area_coverage_info.h new file mode 100644 index 000000000..87f68b7a9 --- /dev/null +++ b/lib/sbi/openapi/model/service_area_coverage_info.h @@ -0,0 +1,41 @@ +/* + * service_area_coverage_info.h + * + * It represents a list of Tracking Areas within a serving network. + */ + +#ifndef _OpenAPI_service_area_coverage_info_H_ +#define _OpenAPI_service_area_coverage_info_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "plmn_id_nid_1.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_service_area_coverage_info_s OpenAPI_service_area_coverage_info_t; +typedef struct OpenAPI_service_area_coverage_info_s { + OpenAPI_list_t *tac_list; + struct OpenAPI_plmn_id_nid_1_s *serving_network; +} OpenAPI_service_area_coverage_info_t; + +OpenAPI_service_area_coverage_info_t *OpenAPI_service_area_coverage_info_create( + OpenAPI_list_t *tac_list, + OpenAPI_plmn_id_nid_1_t *serving_network +); +void OpenAPI_service_area_coverage_info_free(OpenAPI_service_area_coverage_info_t *service_area_coverage_info); +OpenAPI_service_area_coverage_info_t *OpenAPI_service_area_coverage_info_parseFromJSON(cJSON *service_area_coverage_infoJSON); +cJSON *OpenAPI_service_area_coverage_info_convertToJSON(OpenAPI_service_area_coverage_info_t *service_area_coverage_info); +OpenAPI_service_area_coverage_info_t *OpenAPI_service_area_coverage_info_copy(OpenAPI_service_area_coverage_info_t *dst, OpenAPI_service_area_coverage_info_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_service_area_coverage_info_H_ */ + diff --git a/lib/sbi/openapi/model/service_area_id.c b/lib/sbi/openapi/model/service_area_id.c new file mode 100644 index 000000000..ec84f8d33 --- /dev/null +++ b/lib/sbi/openapi/model/service_area_id.c @@ -0,0 +1,176 @@ + +#include +#include +#include +#include "service_area_id.h" + +OpenAPI_service_area_id_t *OpenAPI_service_area_id_create( + OpenAPI_plmn_id_t *plmn_id, + char *lac, + char *sac +) +{ + OpenAPI_service_area_id_t *service_area_id_local_var = ogs_malloc(sizeof(OpenAPI_service_area_id_t)); + ogs_assert(service_area_id_local_var); + + service_area_id_local_var->plmn_id = plmn_id; + service_area_id_local_var->lac = lac; + service_area_id_local_var->sac = sac; + + return service_area_id_local_var; +} + +void OpenAPI_service_area_id_free(OpenAPI_service_area_id_t *service_area_id) +{ + OpenAPI_lnode_t *node = NULL; + + if (NULL == service_area_id) { + return; + } + if (service_area_id->plmn_id) { + OpenAPI_plmn_id_free(service_area_id->plmn_id); + service_area_id->plmn_id = NULL; + } + if (service_area_id->lac) { + ogs_free(service_area_id->lac); + service_area_id->lac = NULL; + } + if (service_area_id->sac) { + ogs_free(service_area_id->sac); + service_area_id->sac = NULL; + } + ogs_free(service_area_id); +} + +cJSON *OpenAPI_service_area_id_convertToJSON(OpenAPI_service_area_id_t *service_area_id) +{ + cJSON *item = NULL; + OpenAPI_lnode_t *node = NULL; + + if (service_area_id == NULL) { + ogs_error("OpenAPI_service_area_id_convertToJSON() failed [ServiceAreaId]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (!service_area_id->plmn_id) { + ogs_error("OpenAPI_service_area_id_convertToJSON() failed [plmn_id]"); + return NULL; + } + cJSON *plmn_id_local_JSON = OpenAPI_plmn_id_convertToJSON(service_area_id->plmn_id); + if (plmn_id_local_JSON == NULL) { + ogs_error("OpenAPI_service_area_id_convertToJSON() failed [plmn_id]"); + goto end; + } + cJSON_AddItemToObject(item, "plmnId", plmn_id_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_service_area_id_convertToJSON() failed [plmn_id]"); + goto end; + } + + if (!service_area_id->lac) { + ogs_error("OpenAPI_service_area_id_convertToJSON() failed [lac]"); + return NULL; + } + if (cJSON_AddStringToObject(item, "lac", service_area_id->lac) == NULL) { + ogs_error("OpenAPI_service_area_id_convertToJSON() failed [lac]"); + goto end; + } + + if (!service_area_id->sac) { + ogs_error("OpenAPI_service_area_id_convertToJSON() failed [sac]"); + return NULL; + } + if (cJSON_AddStringToObject(item, "sac", service_area_id->sac) == NULL) { + ogs_error("OpenAPI_service_area_id_convertToJSON() failed [sac]"); + goto end; + } + +end: + return item; +} + +OpenAPI_service_area_id_t *OpenAPI_service_area_id_parseFromJSON(cJSON *service_area_idJSON) +{ + OpenAPI_service_area_id_t *service_area_id_local_var = NULL; + OpenAPI_lnode_t *node = NULL; + cJSON *plmn_id = NULL; + OpenAPI_plmn_id_t *plmn_id_local_nonprim = NULL; + cJSON *lac = NULL; + cJSON *sac = NULL; + plmn_id = cJSON_GetObjectItemCaseSensitive(service_area_idJSON, "plmnId"); + if (!plmn_id) { + ogs_error("OpenAPI_service_area_id_parseFromJSON() failed [plmn_id]"); + goto end; + } + plmn_id_local_nonprim = OpenAPI_plmn_id_parseFromJSON(plmn_id); + + lac = cJSON_GetObjectItemCaseSensitive(service_area_idJSON, "lac"); + if (!lac) { + ogs_error("OpenAPI_service_area_id_parseFromJSON() failed [lac]"); + goto end; + } + if (!cJSON_IsString(lac)) { + ogs_error("OpenAPI_service_area_id_parseFromJSON() failed [lac]"); + goto end; + } + + sac = cJSON_GetObjectItemCaseSensitive(service_area_idJSON, "sac"); + if (!sac) { + ogs_error("OpenAPI_service_area_id_parseFromJSON() failed [sac]"); + goto end; + } + if (!cJSON_IsString(sac)) { + ogs_error("OpenAPI_service_area_id_parseFromJSON() failed [sac]"); + goto end; + } + + service_area_id_local_var = OpenAPI_service_area_id_create ( + plmn_id_local_nonprim, + ogs_strdup(lac->valuestring), + ogs_strdup(sac->valuestring) + ); + + return service_area_id_local_var; +end: + if (plmn_id_local_nonprim) { + OpenAPI_plmn_id_free(plmn_id_local_nonprim); + plmn_id_local_nonprim = NULL; + } + return NULL; +} + +OpenAPI_service_area_id_t *OpenAPI_service_area_id_copy(OpenAPI_service_area_id_t *dst, OpenAPI_service_area_id_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_service_area_id_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_service_area_id_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_service_area_id_free(dst); + dst = OpenAPI_service_area_id_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/service_area_id.h b/lib/sbi/openapi/model/service_area_id.h new file mode 100644 index 000000000..313e86a95 --- /dev/null +++ b/lib/sbi/openapi/model/service_area_id.h @@ -0,0 +1,43 @@ +/* + * service_area_id.h + * + * Contains a Service Area Identifier as defined in 3GPP TS 23.003, clause 12.5. + */ + +#ifndef _OpenAPI_service_area_id_H_ +#define _OpenAPI_service_area_id_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "plmn_id.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_service_area_id_s OpenAPI_service_area_id_t; +typedef struct OpenAPI_service_area_id_s { + struct OpenAPI_plmn_id_s *plmn_id; + char *lac; + char *sac; +} OpenAPI_service_area_id_t; + +OpenAPI_service_area_id_t *OpenAPI_service_area_id_create( + OpenAPI_plmn_id_t *plmn_id, + char *lac, + char *sac +); +void OpenAPI_service_area_id_free(OpenAPI_service_area_id_t *service_area_id); +OpenAPI_service_area_id_t *OpenAPI_service_area_id_parseFromJSON(cJSON *service_area_idJSON); +cJSON *OpenAPI_service_area_id_convertToJSON(OpenAPI_service_area_id_t *service_area_id); +OpenAPI_service_area_id_t *OpenAPI_service_area_id_copy(OpenAPI_service_area_id_t *dst, OpenAPI_service_area_id_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_service_area_id_H_ */ + diff --git a/lib/sbi/openapi/model/service_area_restriction.h b/lib/sbi/openapi/model/service_area_restriction.h index 000aff3dc..bae39544d 100644 --- a/lib/sbi/openapi/model/service_area_restriction.h +++ b/lib/sbi/openapi/model/service_area_restriction.h @@ -1,7 +1,7 @@ /* * service_area_restriction.h * - * + * Provides information about allowed or not allowed areas. */ #ifndef _OpenAPI_service_area_restriction_H_ diff --git a/lib/sbi/openapi/model/service_area_restriction_1.h b/lib/sbi/openapi/model/service_area_restriction_1.h index fdec5edfd..d001657f9 100644 --- a/lib/sbi/openapi/model/service_area_restriction_1.h +++ b/lib/sbi/openapi/model/service_area_restriction_1.h @@ -1,7 +1,7 @@ /* * service_area_restriction_1.h * - * + * Provides information about allowed or not allowed areas. */ #ifndef _OpenAPI_service_area_restriction_1_H_ diff --git a/lib/sbi/openapi/model/service_experience_info.c b/lib/sbi/openapi/model/service_experience_info.c new file mode 100644 index 000000000..1f9b627ef --- /dev/null +++ b/lib/sbi/openapi/model/service_experience_info.c @@ -0,0 +1,580 @@ + +#include +#include +#include +#include "service_experience_info.h" + +OpenAPI_service_experience_info_t *OpenAPI_service_experience_info_create( + OpenAPI_svc_experience_t *svc_exprc, + bool is_svc_exprc_variance, + float svc_exprc_variance, + OpenAPI_list_t *supis, + OpenAPI_snssai_t *snssai, + char *app_id, + OpenAPI_service_experience_type_t *srv_expc_type, + OpenAPI_list_t *ue_locs, + OpenAPI_upf_information_t *upf_info, + char *dnai, + OpenAPI_addr_fqdn_t *app_server_inst, + bool is_confidence, + int confidence, + char *dnn, + OpenAPI_network_area_info_t *network_area, + char *nsi_id, + bool is_ratio, + int ratio, + OpenAPI_rat_freq_information_t *rat_freq +) +{ + OpenAPI_service_experience_info_t *service_experience_info_local_var = ogs_malloc(sizeof(OpenAPI_service_experience_info_t)); + ogs_assert(service_experience_info_local_var); + + service_experience_info_local_var->svc_exprc = svc_exprc; + service_experience_info_local_var->is_svc_exprc_variance = is_svc_exprc_variance; + service_experience_info_local_var->svc_exprc_variance = svc_exprc_variance; + service_experience_info_local_var->supis = supis; + service_experience_info_local_var->snssai = snssai; + service_experience_info_local_var->app_id = app_id; + service_experience_info_local_var->srv_expc_type = srv_expc_type; + service_experience_info_local_var->ue_locs = ue_locs; + service_experience_info_local_var->upf_info = upf_info; + service_experience_info_local_var->dnai = dnai; + service_experience_info_local_var->app_server_inst = app_server_inst; + service_experience_info_local_var->is_confidence = is_confidence; + service_experience_info_local_var->confidence = confidence; + service_experience_info_local_var->dnn = dnn; + service_experience_info_local_var->network_area = network_area; + service_experience_info_local_var->nsi_id = nsi_id; + service_experience_info_local_var->is_ratio = is_ratio; + service_experience_info_local_var->ratio = ratio; + service_experience_info_local_var->rat_freq = rat_freq; + + return service_experience_info_local_var; +} + +void OpenAPI_service_experience_info_free(OpenAPI_service_experience_info_t *service_experience_info) +{ + OpenAPI_lnode_t *node = NULL; + + if (NULL == service_experience_info) { + return; + } + if (service_experience_info->svc_exprc) { + OpenAPI_svc_experience_free(service_experience_info->svc_exprc); + service_experience_info->svc_exprc = NULL; + } + if (service_experience_info->supis) { + OpenAPI_list_for_each(service_experience_info->supis, node) { + ogs_free(node->data); + } + OpenAPI_list_free(service_experience_info->supis); + service_experience_info->supis = NULL; + } + if (service_experience_info->snssai) { + OpenAPI_snssai_free(service_experience_info->snssai); + service_experience_info->snssai = NULL; + } + if (service_experience_info->app_id) { + ogs_free(service_experience_info->app_id); + service_experience_info->app_id = NULL; + } + if (service_experience_info->srv_expc_type) { + OpenAPI_service_experience_type_free(service_experience_info->srv_expc_type); + service_experience_info->srv_expc_type = NULL; + } + if (service_experience_info->ue_locs) { + OpenAPI_list_for_each(service_experience_info->ue_locs, node) { + OpenAPI_location_info_free(node->data); + } + OpenAPI_list_free(service_experience_info->ue_locs); + service_experience_info->ue_locs = NULL; + } + if (service_experience_info->upf_info) { + OpenAPI_upf_information_free(service_experience_info->upf_info); + service_experience_info->upf_info = NULL; + } + if (service_experience_info->dnai) { + ogs_free(service_experience_info->dnai); + service_experience_info->dnai = NULL; + } + if (service_experience_info->app_server_inst) { + OpenAPI_addr_fqdn_free(service_experience_info->app_server_inst); + service_experience_info->app_server_inst = NULL; + } + if (service_experience_info->dnn) { + ogs_free(service_experience_info->dnn); + service_experience_info->dnn = NULL; + } + if (service_experience_info->network_area) { + OpenAPI_network_area_info_free(service_experience_info->network_area); + service_experience_info->network_area = NULL; + } + if (service_experience_info->nsi_id) { + ogs_free(service_experience_info->nsi_id); + service_experience_info->nsi_id = NULL; + } + if (service_experience_info->rat_freq) { + OpenAPI_rat_freq_information_free(service_experience_info->rat_freq); + service_experience_info->rat_freq = NULL; + } + ogs_free(service_experience_info); +} + +cJSON *OpenAPI_service_experience_info_convertToJSON(OpenAPI_service_experience_info_t *service_experience_info) +{ + cJSON *item = NULL; + OpenAPI_lnode_t *node = NULL; + + if (service_experience_info == NULL) { + ogs_error("OpenAPI_service_experience_info_convertToJSON() failed [ServiceExperienceInfo]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (!service_experience_info->svc_exprc) { + ogs_error("OpenAPI_service_experience_info_convertToJSON() failed [svc_exprc]"); + return NULL; + } + cJSON *svc_exprc_local_JSON = OpenAPI_svc_experience_convertToJSON(service_experience_info->svc_exprc); + if (svc_exprc_local_JSON == NULL) { + ogs_error("OpenAPI_service_experience_info_convertToJSON() failed [svc_exprc]"); + goto end; + } + cJSON_AddItemToObject(item, "svcExprc", svc_exprc_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_service_experience_info_convertToJSON() failed [svc_exprc]"); + goto end; + } + + if (service_experience_info->is_svc_exprc_variance) { + if (cJSON_AddNumberToObject(item, "svcExprcVariance", service_experience_info->svc_exprc_variance) == NULL) { + ogs_error("OpenAPI_service_experience_info_convertToJSON() failed [svc_exprc_variance]"); + goto end; + } + } + + if (service_experience_info->supis) { + cJSON *supisList = cJSON_AddArrayToObject(item, "supis"); + if (supisList == NULL) { + ogs_error("OpenAPI_service_experience_info_convertToJSON() failed [supis]"); + goto end; + } + OpenAPI_list_for_each(service_experience_info->supis, node) { + if (cJSON_AddStringToObject(supisList, "", (char*)node->data) == NULL) { + ogs_error("OpenAPI_service_experience_info_convertToJSON() failed [supis]"); + goto end; + } + } + } + + if (service_experience_info->snssai) { + cJSON *snssai_local_JSON = OpenAPI_snssai_convertToJSON(service_experience_info->snssai); + if (snssai_local_JSON == NULL) { + ogs_error("OpenAPI_service_experience_info_convertToJSON() failed [snssai]"); + goto end; + } + cJSON_AddItemToObject(item, "snssai", snssai_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_service_experience_info_convertToJSON() failed [snssai]"); + goto end; + } + } + + if (service_experience_info->app_id) { + if (cJSON_AddStringToObject(item, "appId", service_experience_info->app_id) == NULL) { + ogs_error("OpenAPI_service_experience_info_convertToJSON() failed [app_id]"); + goto end; + } + } + + if (service_experience_info->srv_expc_type) { + cJSON *srv_expc_type_local_JSON = OpenAPI_service_experience_type_convertToJSON(service_experience_info->srv_expc_type); + if (srv_expc_type_local_JSON == NULL) { + ogs_error("OpenAPI_service_experience_info_convertToJSON() failed [srv_expc_type]"); + goto end; + } + cJSON_AddItemToObject(item, "srvExpcType", srv_expc_type_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_service_experience_info_convertToJSON() failed [srv_expc_type]"); + goto end; + } + } + + if (service_experience_info->ue_locs) { + cJSON *ue_locsList = cJSON_AddArrayToObject(item, "ueLocs"); + if (ue_locsList == NULL) { + ogs_error("OpenAPI_service_experience_info_convertToJSON() failed [ue_locs]"); + goto end; + } + OpenAPI_list_for_each(service_experience_info->ue_locs, node) { + cJSON *itemLocal = OpenAPI_location_info_convertToJSON(node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_service_experience_info_convertToJSON() failed [ue_locs]"); + goto end; + } + cJSON_AddItemToArray(ue_locsList, itemLocal); + } + } + + if (service_experience_info->upf_info) { + cJSON *upf_info_local_JSON = OpenAPI_upf_information_convertToJSON(service_experience_info->upf_info); + if (upf_info_local_JSON == NULL) { + ogs_error("OpenAPI_service_experience_info_convertToJSON() failed [upf_info]"); + goto end; + } + cJSON_AddItemToObject(item, "upfInfo", upf_info_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_service_experience_info_convertToJSON() failed [upf_info]"); + goto end; + } + } + + if (service_experience_info->dnai) { + if (cJSON_AddStringToObject(item, "dnai", service_experience_info->dnai) == NULL) { + ogs_error("OpenAPI_service_experience_info_convertToJSON() failed [dnai]"); + goto end; + } + } + + if (service_experience_info->app_server_inst) { + cJSON *app_server_inst_local_JSON = OpenAPI_addr_fqdn_convertToJSON(service_experience_info->app_server_inst); + if (app_server_inst_local_JSON == NULL) { + ogs_error("OpenAPI_service_experience_info_convertToJSON() failed [app_server_inst]"); + goto end; + } + cJSON_AddItemToObject(item, "appServerInst", app_server_inst_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_service_experience_info_convertToJSON() failed [app_server_inst]"); + goto end; + } + } + + if (service_experience_info->is_confidence) { + if (cJSON_AddNumberToObject(item, "confidence", service_experience_info->confidence) == NULL) { + ogs_error("OpenAPI_service_experience_info_convertToJSON() failed [confidence]"); + goto end; + } + } + + if (service_experience_info->dnn) { + if (cJSON_AddStringToObject(item, "dnn", service_experience_info->dnn) == NULL) { + ogs_error("OpenAPI_service_experience_info_convertToJSON() failed [dnn]"); + goto end; + } + } + + if (service_experience_info->network_area) { + cJSON *network_area_local_JSON = OpenAPI_network_area_info_convertToJSON(service_experience_info->network_area); + if (network_area_local_JSON == NULL) { + ogs_error("OpenAPI_service_experience_info_convertToJSON() failed [network_area]"); + goto end; + } + cJSON_AddItemToObject(item, "networkArea", network_area_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_service_experience_info_convertToJSON() failed [network_area]"); + goto end; + } + } + + if (service_experience_info->nsi_id) { + if (cJSON_AddStringToObject(item, "nsiId", service_experience_info->nsi_id) == NULL) { + ogs_error("OpenAPI_service_experience_info_convertToJSON() failed [nsi_id]"); + goto end; + } + } + + if (service_experience_info->is_ratio) { + if (cJSON_AddNumberToObject(item, "ratio", service_experience_info->ratio) == NULL) { + ogs_error("OpenAPI_service_experience_info_convertToJSON() failed [ratio]"); + goto end; + } + } + + if (service_experience_info->rat_freq) { + cJSON *rat_freq_local_JSON = OpenAPI_rat_freq_information_convertToJSON(service_experience_info->rat_freq); + if (rat_freq_local_JSON == NULL) { + ogs_error("OpenAPI_service_experience_info_convertToJSON() failed [rat_freq]"); + goto end; + } + cJSON_AddItemToObject(item, "ratFreq", rat_freq_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_service_experience_info_convertToJSON() failed [rat_freq]"); + goto end; + } + } + +end: + return item; +} + +OpenAPI_service_experience_info_t *OpenAPI_service_experience_info_parseFromJSON(cJSON *service_experience_infoJSON) +{ + OpenAPI_service_experience_info_t *service_experience_info_local_var = NULL; + OpenAPI_lnode_t *node = NULL; + cJSON *svc_exprc = NULL; + OpenAPI_svc_experience_t *svc_exprc_local_nonprim = NULL; + cJSON *svc_exprc_variance = NULL; + cJSON *supis = NULL; + OpenAPI_list_t *supisList = NULL; + cJSON *snssai = NULL; + OpenAPI_snssai_t *snssai_local_nonprim = NULL; + cJSON *app_id = NULL; + cJSON *srv_expc_type = NULL; + OpenAPI_service_experience_type_t *srv_expc_type_local_nonprim = NULL; + cJSON *ue_locs = NULL; + OpenAPI_list_t *ue_locsList = NULL; + cJSON *upf_info = NULL; + OpenAPI_upf_information_t *upf_info_local_nonprim = NULL; + cJSON *dnai = NULL; + cJSON *app_server_inst = NULL; + OpenAPI_addr_fqdn_t *app_server_inst_local_nonprim = NULL; + cJSON *confidence = NULL; + cJSON *dnn = NULL; + cJSON *network_area = NULL; + OpenAPI_network_area_info_t *network_area_local_nonprim = NULL; + cJSON *nsi_id = NULL; + cJSON *ratio = NULL; + cJSON *rat_freq = NULL; + OpenAPI_rat_freq_information_t *rat_freq_local_nonprim = NULL; + svc_exprc = cJSON_GetObjectItemCaseSensitive(service_experience_infoJSON, "svcExprc"); + if (!svc_exprc) { + ogs_error("OpenAPI_service_experience_info_parseFromJSON() failed [svc_exprc]"); + goto end; + } + svc_exprc_local_nonprim = OpenAPI_svc_experience_parseFromJSON(svc_exprc); + + svc_exprc_variance = cJSON_GetObjectItemCaseSensitive(service_experience_infoJSON, "svcExprcVariance"); + if (svc_exprc_variance) { + if (!cJSON_IsNumber(svc_exprc_variance)) { + ogs_error("OpenAPI_service_experience_info_parseFromJSON() failed [svc_exprc_variance]"); + goto end; + } + } + + supis = cJSON_GetObjectItemCaseSensitive(service_experience_infoJSON, "supis"); + if (supis) { + cJSON *supis_local = NULL; + if (!cJSON_IsArray(supis)) { + ogs_error("OpenAPI_service_experience_info_parseFromJSON() failed [supis]"); + goto end; + } + + supisList = OpenAPI_list_create(); + + cJSON_ArrayForEach(supis_local, supis) { + double *localDouble = NULL; + int *localInt = NULL; + if (!cJSON_IsString(supis_local)) { + ogs_error("OpenAPI_service_experience_info_parseFromJSON() failed [supis]"); + goto end; + } + OpenAPI_list_add(supisList, ogs_strdup(supis_local->valuestring)); + } + } + + snssai = cJSON_GetObjectItemCaseSensitive(service_experience_infoJSON, "snssai"); + if (snssai) { + snssai_local_nonprim = OpenAPI_snssai_parseFromJSON(snssai); + } + + app_id = cJSON_GetObjectItemCaseSensitive(service_experience_infoJSON, "appId"); + if (app_id) { + if (!cJSON_IsString(app_id) && !cJSON_IsNull(app_id)) { + ogs_error("OpenAPI_service_experience_info_parseFromJSON() failed [app_id]"); + goto end; + } + } + + srv_expc_type = cJSON_GetObjectItemCaseSensitive(service_experience_infoJSON, "srvExpcType"); + if (srv_expc_type) { + srv_expc_type_local_nonprim = OpenAPI_service_experience_type_parseFromJSON(srv_expc_type); + } + + ue_locs = cJSON_GetObjectItemCaseSensitive(service_experience_infoJSON, "ueLocs"); + if (ue_locs) { + cJSON *ue_locs_local = NULL; + if (!cJSON_IsArray(ue_locs)) { + ogs_error("OpenAPI_service_experience_info_parseFromJSON() failed [ue_locs]"); + goto end; + } + + ue_locsList = OpenAPI_list_create(); + + cJSON_ArrayForEach(ue_locs_local, ue_locs) { + if (!cJSON_IsObject(ue_locs_local)) { + ogs_error("OpenAPI_service_experience_info_parseFromJSON() failed [ue_locs]"); + goto end; + } + OpenAPI_location_info_t *ue_locsItem = OpenAPI_location_info_parseFromJSON(ue_locs_local); + if (!ue_locsItem) { + ogs_error("No ue_locsItem"); + OpenAPI_list_free(ue_locsList); + goto end; + } + OpenAPI_list_add(ue_locsList, ue_locsItem); + } + } + + upf_info = cJSON_GetObjectItemCaseSensitive(service_experience_infoJSON, "upfInfo"); + if (upf_info) { + upf_info_local_nonprim = OpenAPI_upf_information_parseFromJSON(upf_info); + } + + dnai = cJSON_GetObjectItemCaseSensitive(service_experience_infoJSON, "dnai"); + if (dnai) { + if (!cJSON_IsString(dnai) && !cJSON_IsNull(dnai)) { + ogs_error("OpenAPI_service_experience_info_parseFromJSON() failed [dnai]"); + goto end; + } + } + + app_server_inst = cJSON_GetObjectItemCaseSensitive(service_experience_infoJSON, "appServerInst"); + if (app_server_inst) { + app_server_inst_local_nonprim = OpenAPI_addr_fqdn_parseFromJSON(app_server_inst); + } + + confidence = cJSON_GetObjectItemCaseSensitive(service_experience_infoJSON, "confidence"); + if (confidence) { + if (!cJSON_IsNumber(confidence)) { + ogs_error("OpenAPI_service_experience_info_parseFromJSON() failed [confidence]"); + goto end; + } + } + + dnn = cJSON_GetObjectItemCaseSensitive(service_experience_infoJSON, "dnn"); + if (dnn) { + if (!cJSON_IsString(dnn) && !cJSON_IsNull(dnn)) { + ogs_error("OpenAPI_service_experience_info_parseFromJSON() failed [dnn]"); + goto end; + } + } + + network_area = cJSON_GetObjectItemCaseSensitive(service_experience_infoJSON, "networkArea"); + if (network_area) { + network_area_local_nonprim = OpenAPI_network_area_info_parseFromJSON(network_area); + } + + nsi_id = cJSON_GetObjectItemCaseSensitive(service_experience_infoJSON, "nsiId"); + if (nsi_id) { + if (!cJSON_IsString(nsi_id) && !cJSON_IsNull(nsi_id)) { + ogs_error("OpenAPI_service_experience_info_parseFromJSON() failed [nsi_id]"); + goto end; + } + } + + ratio = cJSON_GetObjectItemCaseSensitive(service_experience_infoJSON, "ratio"); + if (ratio) { + if (!cJSON_IsNumber(ratio)) { + ogs_error("OpenAPI_service_experience_info_parseFromJSON() failed [ratio]"); + goto end; + } + } + + rat_freq = cJSON_GetObjectItemCaseSensitive(service_experience_infoJSON, "ratFreq"); + if (rat_freq) { + rat_freq_local_nonprim = OpenAPI_rat_freq_information_parseFromJSON(rat_freq); + } + + service_experience_info_local_var = OpenAPI_service_experience_info_create ( + svc_exprc_local_nonprim, + svc_exprc_variance ? true : false, + svc_exprc_variance ? svc_exprc_variance->valuedouble : 0, + supis ? supisList : NULL, + snssai ? snssai_local_nonprim : NULL, + app_id && !cJSON_IsNull(app_id) ? ogs_strdup(app_id->valuestring) : NULL, + srv_expc_type ? srv_expc_type_local_nonprim : NULL, + ue_locs ? ue_locsList : NULL, + upf_info ? upf_info_local_nonprim : NULL, + dnai && !cJSON_IsNull(dnai) ? ogs_strdup(dnai->valuestring) : NULL, + app_server_inst ? app_server_inst_local_nonprim : NULL, + confidence ? true : false, + confidence ? confidence->valuedouble : 0, + dnn && !cJSON_IsNull(dnn) ? ogs_strdup(dnn->valuestring) : NULL, + network_area ? network_area_local_nonprim : NULL, + nsi_id && !cJSON_IsNull(nsi_id) ? ogs_strdup(nsi_id->valuestring) : NULL, + ratio ? true : false, + ratio ? ratio->valuedouble : 0, + rat_freq ? rat_freq_local_nonprim : NULL + ); + + return service_experience_info_local_var; +end: + if (svc_exprc_local_nonprim) { + OpenAPI_svc_experience_free(svc_exprc_local_nonprim); + svc_exprc_local_nonprim = NULL; + } + if (supisList) { + OpenAPI_list_for_each(supisList, node) { + ogs_free(node->data); + } + OpenAPI_list_free(supisList); + supisList = NULL; + } + if (snssai_local_nonprim) { + OpenAPI_snssai_free(snssai_local_nonprim); + snssai_local_nonprim = NULL; + } + if (srv_expc_type_local_nonprim) { + OpenAPI_service_experience_type_free(srv_expc_type_local_nonprim); + srv_expc_type_local_nonprim = NULL; + } + if (ue_locsList) { + OpenAPI_list_for_each(ue_locsList, node) { + OpenAPI_location_info_free(node->data); + } + OpenAPI_list_free(ue_locsList); + ue_locsList = NULL; + } + if (upf_info_local_nonprim) { + OpenAPI_upf_information_free(upf_info_local_nonprim); + upf_info_local_nonprim = NULL; + } + if (app_server_inst_local_nonprim) { + OpenAPI_addr_fqdn_free(app_server_inst_local_nonprim); + app_server_inst_local_nonprim = NULL; + } + if (network_area_local_nonprim) { + OpenAPI_network_area_info_free(network_area_local_nonprim); + network_area_local_nonprim = NULL; + } + if (rat_freq_local_nonprim) { + OpenAPI_rat_freq_information_free(rat_freq_local_nonprim); + rat_freq_local_nonprim = NULL; + } + return NULL; +} + +OpenAPI_service_experience_info_t *OpenAPI_service_experience_info_copy(OpenAPI_service_experience_info_t *dst, OpenAPI_service_experience_info_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_service_experience_info_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_service_experience_info_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_service_experience_info_free(dst); + dst = OpenAPI_service_experience_info_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/service_experience_info.h b/lib/sbi/openapi/model/service_experience_info.h new file mode 100644 index 000000000..dc7977768 --- /dev/null +++ b/lib/sbi/openapi/model/service_experience_info.h @@ -0,0 +1,82 @@ +/* + * service_experience_info.h + * + * Represents service experience information. + */ + +#ifndef _OpenAPI_service_experience_info_H_ +#define _OpenAPI_service_experience_info_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "addr_fqdn.h" +#include "location_info.h" +#include "network_area_info.h" +#include "rat_freq_information.h" +#include "service_experience_type.h" +#include "snssai.h" +#include "svc_experience.h" +#include "upf_information.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_service_experience_info_s OpenAPI_service_experience_info_t; +typedef struct OpenAPI_service_experience_info_s { + struct OpenAPI_svc_experience_s *svc_exprc; + bool is_svc_exprc_variance; + float svc_exprc_variance; + OpenAPI_list_t *supis; + struct OpenAPI_snssai_s *snssai; + char *app_id; + struct OpenAPI_service_experience_type_s *srv_expc_type; + OpenAPI_list_t *ue_locs; + struct OpenAPI_upf_information_s *upf_info; + char *dnai; + struct OpenAPI_addr_fqdn_s *app_server_inst; + bool is_confidence; + int confidence; + char *dnn; + struct OpenAPI_network_area_info_s *network_area; + char *nsi_id; + bool is_ratio; + int ratio; + struct OpenAPI_rat_freq_information_s *rat_freq; +} OpenAPI_service_experience_info_t; + +OpenAPI_service_experience_info_t *OpenAPI_service_experience_info_create( + OpenAPI_svc_experience_t *svc_exprc, + bool is_svc_exprc_variance, + float svc_exprc_variance, + OpenAPI_list_t *supis, + OpenAPI_snssai_t *snssai, + char *app_id, + OpenAPI_service_experience_type_t *srv_expc_type, + OpenAPI_list_t *ue_locs, + OpenAPI_upf_information_t *upf_info, + char *dnai, + OpenAPI_addr_fqdn_t *app_server_inst, + bool is_confidence, + int confidence, + char *dnn, + OpenAPI_network_area_info_t *network_area, + char *nsi_id, + bool is_ratio, + int ratio, + OpenAPI_rat_freq_information_t *rat_freq +); +void OpenAPI_service_experience_info_free(OpenAPI_service_experience_info_t *service_experience_info); +OpenAPI_service_experience_info_t *OpenAPI_service_experience_info_parseFromJSON(cJSON *service_experience_infoJSON); +cJSON *OpenAPI_service_experience_info_convertToJSON(OpenAPI_service_experience_info_t *service_experience_info); +OpenAPI_service_experience_info_t *OpenAPI_service_experience_info_copy(OpenAPI_service_experience_info_t *dst, OpenAPI_service_experience_info_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_service_experience_info_H_ */ + diff --git a/lib/sbi/openapi/model/service_experience_type.c b/lib/sbi/openapi/model/service_experience_type.c new file mode 100644 index 000000000..39f2b65cb --- /dev/null +++ b/lib/sbi/openapi/model/service_experience_type.c @@ -0,0 +1,87 @@ + +#include +#include +#include +#include "service_experience_type.h" + +OpenAPI_service_experience_type_t *OpenAPI_service_experience_type_create( +) +{ + OpenAPI_service_experience_type_t *service_experience_type_local_var = ogs_malloc(sizeof(OpenAPI_service_experience_type_t)); + ogs_assert(service_experience_type_local_var); + + + return service_experience_type_local_var; +} + +void OpenAPI_service_experience_type_free(OpenAPI_service_experience_type_t *service_experience_type) +{ + OpenAPI_lnode_t *node = NULL; + + if (NULL == service_experience_type) { + return; + } + ogs_free(service_experience_type); +} + +cJSON *OpenAPI_service_experience_type_convertToJSON(OpenAPI_service_experience_type_t *service_experience_type) +{ + cJSON *item = NULL; + OpenAPI_lnode_t *node = NULL; + + if (service_experience_type == NULL) { + ogs_error("OpenAPI_service_experience_type_convertToJSON() failed [ServiceExperienceType]"); + return NULL; + } + + item = cJSON_CreateObject(); +end: + return item; +} + +OpenAPI_service_experience_type_t *OpenAPI_service_experience_type_parseFromJSON(cJSON *service_experience_typeJSON) +{ + OpenAPI_service_experience_type_t *service_experience_type_local_var = NULL; + OpenAPI_lnode_t *node = NULL; + service_experience_type_local_var = OpenAPI_service_experience_type_create ( + ); + + return service_experience_type_local_var; +end: + return NULL; +} + +OpenAPI_service_experience_type_t *OpenAPI_service_experience_type_copy(OpenAPI_service_experience_type_t *dst, OpenAPI_service_experience_type_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_service_experience_type_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_service_experience_type_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_service_experience_type_free(dst); + dst = OpenAPI_service_experience_type_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/service_experience_type.h b/lib/sbi/openapi/model/service_experience_type.h new file mode 100644 index 000000000..873e08316 --- /dev/null +++ b/lib/sbi/openapi/model/service_experience_type.h @@ -0,0 +1,37 @@ +/* + * service_experience_type.h + * + * Possible values are: - VOICE: Indicates that the service experience analytics is for voice service. - VIDEO: Indicates that the service experience analytics is for video service. - OTHER: Indicates that the service experience analytics is for other service. + */ + +#ifndef _OpenAPI_service_experience_type_H_ +#define _OpenAPI_service_experience_type_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "service_experience_type_any_of.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_service_experience_type_s OpenAPI_service_experience_type_t; +typedef struct OpenAPI_service_experience_type_s { +} OpenAPI_service_experience_type_t; + +OpenAPI_service_experience_type_t *OpenAPI_service_experience_type_create( +); +void OpenAPI_service_experience_type_free(OpenAPI_service_experience_type_t *service_experience_type); +OpenAPI_service_experience_type_t *OpenAPI_service_experience_type_parseFromJSON(cJSON *service_experience_typeJSON); +cJSON *OpenAPI_service_experience_type_convertToJSON(OpenAPI_service_experience_type_t *service_experience_type); +OpenAPI_service_experience_type_t *OpenAPI_service_experience_type_copy(OpenAPI_service_experience_type_t *dst, OpenAPI_service_experience_type_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_service_experience_type_H_ */ + diff --git a/lib/sbi/openapi/model/service_experience_type_any_of.c b/lib/sbi/openapi/model/service_experience_type_any_of.c new file mode 100644 index 000000000..21fea311e --- /dev/null +++ b/lib/sbi/openapi/model/service_experience_type_any_of.c @@ -0,0 +1,30 @@ + +#include +#include +#include +#include "service_experience_type_any_of.h" + +char* OpenAPI_service_experience_type_any_of_ToString(OpenAPI_service_experience_type_any_of_e service_experience_type_any_of) +{ + const char *service_experience_type_any_ofArray[] = { "NULL", "VOICE", "VIDEO", "OTHER" }; + size_t sizeofArray = sizeof(service_experience_type_any_ofArray) / sizeof(service_experience_type_any_ofArray[0]); + if (service_experience_type_any_of < sizeofArray) + return (char *)service_experience_type_any_ofArray[service_experience_type_any_of]; + else + return (char *)"Unknown"; +} + +OpenAPI_service_experience_type_any_of_e OpenAPI_service_experience_type_any_of_FromString(char* service_experience_type_any_of) +{ + int stringToReturn = 0; + const char *service_experience_type_any_ofArray[] = { "NULL", "VOICE", "VIDEO", "OTHER" }; + size_t sizeofArray = sizeof(service_experience_type_any_ofArray) / sizeof(service_experience_type_any_ofArray[0]); + while (stringToReturn < sizeofArray) { + if (strcmp(service_experience_type_any_of, service_experience_type_any_ofArray[stringToReturn]) == 0) { + return stringToReturn; + } + stringToReturn++; + } + return 0; +} + diff --git a/lib/sbi/openapi/model/service_experience_type_any_of.h b/lib/sbi/openapi/model/service_experience_type_any_of.h new file mode 100644 index 000000000..9b3efea2e --- /dev/null +++ b/lib/sbi/openapi/model/service_experience_type_any_of.h @@ -0,0 +1,31 @@ +/* + * service_experience_type_any_of.h + * + * + */ + +#ifndef _OpenAPI_service_experience_type_any_of_H_ +#define _OpenAPI_service_experience_type_any_of_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef enum { OpenAPI_service_experience_type_any_of_NULL = 0, OpenAPI_service_experience_type_any_of_VOICE, OpenAPI_service_experience_type_any_of_VIDEO, OpenAPI_service_experience_type_any_of_OTHER } OpenAPI_service_experience_type_any_of_e; + +char* OpenAPI_service_experience_type_any_of_ToString(OpenAPI_service_experience_type_any_of_e service_experience_type_any_of); + +OpenAPI_service_experience_type_any_of_e OpenAPI_service_experience_type_any_of_FromString(char* service_experience_type_any_of); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_service_experience_type_any_of_H_ */ + diff --git a/lib/sbi/openapi/model/service_name_list_cond.c b/lib/sbi/openapi/model/service_name_list_cond.c new file mode 100644 index 000000000..6ff9cabe8 --- /dev/null +++ b/lib/sbi/openapi/model/service_name_list_cond.c @@ -0,0 +1,193 @@ + +#include +#include +#include +#include "service_name_list_cond.h" + +char *OpenAPI_condition_typeservice_name_list_cond_ToString(OpenAPI_service_name_list_cond_condition_type_e condition_type) +{ + const char *condition_typeArray[] = { "NULL", "SERVICE_NAME_LIST_COND" }; + size_t sizeofArray = sizeof(condition_typeArray) / sizeof(condition_typeArray[0]); + if (condition_type < sizeofArray) + return (char *)condition_typeArray[condition_type]; + else + return (char *)"Unknown"; +} + +OpenAPI_service_name_list_cond_condition_type_e OpenAPI_condition_typeservice_name_list_cond_FromString(char* condition_type) +{ + int stringToReturn = 0; + const char *condition_typeArray[] = { "NULL", "SERVICE_NAME_LIST_COND" }; + size_t sizeofArray = sizeof(condition_typeArray) / sizeof(condition_typeArray[0]); + while (stringToReturn < sizeofArray) { + if (strcmp(condition_type, condition_typeArray[stringToReturn]) == 0) { + return stringToReturn; + } + stringToReturn++; + } + return 0; +} +OpenAPI_service_name_list_cond_t *OpenAPI_service_name_list_cond_create( + OpenAPI_service_name_list_cond_condition_type_e condition_type, + OpenAPI_list_t *service_name_list +) +{ + OpenAPI_service_name_list_cond_t *service_name_list_cond_local_var = ogs_malloc(sizeof(OpenAPI_service_name_list_cond_t)); + ogs_assert(service_name_list_cond_local_var); + + service_name_list_cond_local_var->condition_type = condition_type; + service_name_list_cond_local_var->service_name_list = service_name_list; + + return service_name_list_cond_local_var; +} + +void OpenAPI_service_name_list_cond_free(OpenAPI_service_name_list_cond_t *service_name_list_cond) +{ + OpenAPI_lnode_t *node = NULL; + + if (NULL == service_name_list_cond) { + return; + } + if (service_name_list_cond->service_name_list) { + OpenAPI_list_for_each(service_name_list_cond->service_name_list, node) { + ogs_free(node->data); + } + OpenAPI_list_free(service_name_list_cond->service_name_list); + service_name_list_cond->service_name_list = NULL; + } + ogs_free(service_name_list_cond); +} + +cJSON *OpenAPI_service_name_list_cond_convertToJSON(OpenAPI_service_name_list_cond_t *service_name_list_cond) +{ + cJSON *item = NULL; + OpenAPI_lnode_t *node = NULL; + + if (service_name_list_cond == NULL) { + ogs_error("OpenAPI_service_name_list_cond_convertToJSON() failed [ServiceNameListCond]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (service_name_list_cond->condition_type == OpenAPI_service_name_list_cond_CONDITIONTYPE_NULL) { + ogs_error("OpenAPI_service_name_list_cond_convertToJSON() failed [condition_type]"); + return NULL; + } + if (cJSON_AddStringToObject(item, "conditionType", OpenAPI_condition_typeservice_name_list_cond_ToString(service_name_list_cond->condition_type)) == NULL) { + ogs_error("OpenAPI_service_name_list_cond_convertToJSON() failed [condition_type]"); + goto end; + } + + if (!service_name_list_cond->service_name_list) { + ogs_error("OpenAPI_service_name_list_cond_convertToJSON() failed [service_name_list]"); + return NULL; + } + cJSON *service_name_listList = cJSON_AddArrayToObject(item, "serviceNameList"); + if (service_name_listList == NULL) { + ogs_error("OpenAPI_service_name_list_cond_convertToJSON() failed [service_name_list]"); + goto end; + } + OpenAPI_list_for_each(service_name_list_cond->service_name_list, node) { + if (cJSON_AddStringToObject(service_name_listList, "", (char*)node->data) == NULL) { + ogs_error("OpenAPI_service_name_list_cond_convertToJSON() failed [service_name_list]"); + goto end; + } + } + +end: + return item; +} + +OpenAPI_service_name_list_cond_t *OpenAPI_service_name_list_cond_parseFromJSON(cJSON *service_name_list_condJSON) +{ + OpenAPI_service_name_list_cond_t *service_name_list_cond_local_var = NULL; + OpenAPI_lnode_t *node = NULL; + cJSON *condition_type = NULL; + OpenAPI_service_name_list_cond_condition_type_e condition_typeVariable = 0; + cJSON *service_name_list = NULL; + OpenAPI_list_t *service_name_listList = NULL; + condition_type = cJSON_GetObjectItemCaseSensitive(service_name_list_condJSON, "conditionType"); + if (!condition_type) { + ogs_error("OpenAPI_service_name_list_cond_parseFromJSON() failed [condition_type]"); + goto end; + } + if (!cJSON_IsString(condition_type)) { + ogs_error("OpenAPI_service_name_list_cond_parseFromJSON() failed [condition_type]"); + goto end; + } + condition_typeVariable = OpenAPI_condition_typeservice_name_list_cond_FromString(condition_type->valuestring); + + service_name_list = cJSON_GetObjectItemCaseSensitive(service_name_list_condJSON, "serviceNameList"); + if (!service_name_list) { + ogs_error("OpenAPI_service_name_list_cond_parseFromJSON() failed [service_name_list]"); + goto end; + } + cJSON *service_name_list_local = NULL; + if (!cJSON_IsArray(service_name_list)) { + ogs_error("OpenAPI_service_name_list_cond_parseFromJSON() failed [service_name_list]"); + goto end; + } + + service_name_listList = OpenAPI_list_create(); + + cJSON_ArrayForEach(service_name_list_local, service_name_list) { + double *localDouble = NULL; + int *localInt = NULL; + if (!cJSON_IsString(service_name_list_local)) { + ogs_error("OpenAPI_service_name_list_cond_parseFromJSON() failed [service_name_list]"); + goto end; + } + OpenAPI_list_add(service_name_listList, ogs_strdup(service_name_list_local->valuestring)); + } + + service_name_list_cond_local_var = OpenAPI_service_name_list_cond_create ( + condition_typeVariable, + service_name_listList + ); + + return service_name_list_cond_local_var; +end: + if (service_name_listList) { + OpenAPI_list_for_each(service_name_listList, node) { + ogs_free(node->data); + } + OpenAPI_list_free(service_name_listList); + service_name_listList = NULL; + } + return NULL; +} + +OpenAPI_service_name_list_cond_t *OpenAPI_service_name_list_cond_copy(OpenAPI_service_name_list_cond_t *dst, OpenAPI_service_name_list_cond_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_service_name_list_cond_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_service_name_list_cond_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_service_name_list_cond_free(dst); + dst = OpenAPI_service_name_list_cond_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/service_name_list_cond.h b/lib/sbi/openapi/model/service_name_list_cond.h new file mode 100644 index 000000000..f6207809e --- /dev/null +++ b/lib/sbi/openapi/model/service_name_list_cond.h @@ -0,0 +1,45 @@ +/* + * service_name_list_cond.h + * + * Subscription to a set of NFs based on their support for a Service Name in the Servic Name list + */ + +#ifndef _OpenAPI_service_name_list_cond_H_ +#define _OpenAPI_service_name_list_cond_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_service_name_list_cond_s OpenAPI_service_name_list_cond_t; +typedef enum { OpenAPI_service_name_list_cond_CONDITIONTYPE_NULL = 0, OpenAPI_service_name_list_cond_CONDITIONTYPE_SERVICE_NAME_LIST_COND } OpenAPI_service_name_list_cond_condition_type_e; + +char* OpenAPI_service_name_list_cond_condition_type_ToString(OpenAPI_service_name_list_cond_condition_type_e condition_type); + +OpenAPI_service_name_list_cond_condition_type_e OpenAPI_service_name_list_cond_condition_type_FromString(char* condition_type); +typedef struct OpenAPI_service_name_list_cond_s { + OpenAPI_service_name_list_cond_condition_type_e condition_type; + OpenAPI_list_t *service_name_list; +} OpenAPI_service_name_list_cond_t; + +OpenAPI_service_name_list_cond_t *OpenAPI_service_name_list_cond_create( + OpenAPI_service_name_list_cond_condition_type_e condition_type, + OpenAPI_list_t *service_name_list +); +void OpenAPI_service_name_list_cond_free(OpenAPI_service_name_list_cond_t *service_name_list_cond); +OpenAPI_service_name_list_cond_t *OpenAPI_service_name_list_cond_parseFromJSON(cJSON *service_name_list_condJSON); +cJSON *OpenAPI_service_name_list_cond_convertToJSON(OpenAPI_service_name_list_cond_t *service_name_list_cond); +OpenAPI_service_name_list_cond_t *OpenAPI_service_name_list_cond_copy(OpenAPI_service_name_list_cond_t *dst, OpenAPI_service_name_list_cond_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_service_name_list_cond_H_ */ + diff --git a/lib/sbi/openapi/model/service_parameter_data.c b/lib/sbi/openapi/model/service_parameter_data.c index 9590b562b..cfaaa1bd3 100644 --- a/lib/sbi/openapi/model/service_parameter_data.c +++ b/lib/sbi/openapi/model/service_parameter_data.c @@ -17,8 +17,18 @@ OpenAPI_service_parameter_data_t *OpenAPI_service_parameter_data_create( int any_ue_ind, char *param_over_pc5, char *param_over_uu, + char *param_for_pro_se_dd, + char *param_for_pro_se_dc, + char *param_for_pro_se_u2_n_rel_ue, + char *param_for_pro_se_rem_ue, + OpenAPI_list_t *ursp_guidance, + OpenAPI_list_t *delivery_events, + char *polic_deliv_notif_corre_id, + char *polic_deliv_notif_uri, char *supp_feat, - char *res_uri + char *res_uri, + OpenAPI_list_t *headers, + OpenAPI_list_t *reset_ids ) { OpenAPI_service_parameter_data_t *service_parameter_data_local_var = ogs_malloc(sizeof(OpenAPI_service_parameter_data_t)); @@ -36,8 +46,18 @@ OpenAPI_service_parameter_data_t *OpenAPI_service_parameter_data_create( service_parameter_data_local_var->any_ue_ind = any_ue_ind; service_parameter_data_local_var->param_over_pc5 = param_over_pc5; service_parameter_data_local_var->param_over_uu = param_over_uu; + service_parameter_data_local_var->param_for_pro_se_dd = param_for_pro_se_dd; + service_parameter_data_local_var->param_for_pro_se_dc = param_for_pro_se_dc; + service_parameter_data_local_var->param_for_pro_se_u2_n_rel_ue = param_for_pro_se_u2_n_rel_ue; + service_parameter_data_local_var->param_for_pro_se_rem_ue = param_for_pro_se_rem_ue; + service_parameter_data_local_var->ursp_guidance = ursp_guidance; + service_parameter_data_local_var->delivery_events = delivery_events; + service_parameter_data_local_var->polic_deliv_notif_corre_id = polic_deliv_notif_corre_id; + service_parameter_data_local_var->polic_deliv_notif_uri = polic_deliv_notif_uri; service_parameter_data_local_var->supp_feat = supp_feat; service_parameter_data_local_var->res_uri = res_uri; + service_parameter_data_local_var->headers = headers; + service_parameter_data_local_var->reset_ids = reset_ids; return service_parameter_data_local_var; } @@ -89,6 +109,44 @@ void OpenAPI_service_parameter_data_free(OpenAPI_service_parameter_data_t *servi ogs_free(service_parameter_data->param_over_uu); service_parameter_data->param_over_uu = NULL; } + if (service_parameter_data->param_for_pro_se_dd) { + ogs_free(service_parameter_data->param_for_pro_se_dd); + service_parameter_data->param_for_pro_se_dd = NULL; + } + if (service_parameter_data->param_for_pro_se_dc) { + ogs_free(service_parameter_data->param_for_pro_se_dc); + service_parameter_data->param_for_pro_se_dc = NULL; + } + if (service_parameter_data->param_for_pro_se_u2_n_rel_ue) { + ogs_free(service_parameter_data->param_for_pro_se_u2_n_rel_ue); + service_parameter_data->param_for_pro_se_u2_n_rel_ue = NULL; + } + if (service_parameter_data->param_for_pro_se_rem_ue) { + ogs_free(service_parameter_data->param_for_pro_se_rem_ue); + service_parameter_data->param_for_pro_se_rem_ue = NULL; + } + if (service_parameter_data->ursp_guidance) { + OpenAPI_list_for_each(service_parameter_data->ursp_guidance, node) { + OpenAPI_ursp_rule_request_free(node->data); + } + OpenAPI_list_free(service_parameter_data->ursp_guidance); + service_parameter_data->ursp_guidance = NULL; + } + if (service_parameter_data->delivery_events) { + OpenAPI_list_for_each(service_parameter_data->delivery_events, node) { + OpenAPI_event_free(node->data); + } + OpenAPI_list_free(service_parameter_data->delivery_events); + service_parameter_data->delivery_events = NULL; + } + if (service_parameter_data->polic_deliv_notif_corre_id) { + ogs_free(service_parameter_data->polic_deliv_notif_corre_id); + service_parameter_data->polic_deliv_notif_corre_id = NULL; + } + if (service_parameter_data->polic_deliv_notif_uri) { + ogs_free(service_parameter_data->polic_deliv_notif_uri); + service_parameter_data->polic_deliv_notif_uri = NULL; + } if (service_parameter_data->supp_feat) { ogs_free(service_parameter_data->supp_feat); service_parameter_data->supp_feat = NULL; @@ -97,6 +155,20 @@ void OpenAPI_service_parameter_data_free(OpenAPI_service_parameter_data_t *servi ogs_free(service_parameter_data->res_uri); service_parameter_data->res_uri = NULL; } + if (service_parameter_data->headers) { + OpenAPI_list_for_each(service_parameter_data->headers, node) { + ogs_free(node->data); + } + OpenAPI_list_free(service_parameter_data->headers); + service_parameter_data->headers = NULL; + } + if (service_parameter_data->reset_ids) { + OpenAPI_list_for_each(service_parameter_data->reset_ids, node) { + ogs_free(node->data); + } + OpenAPI_list_free(service_parameter_data->reset_ids); + service_parameter_data->reset_ids = NULL; + } ogs_free(service_parameter_data); } @@ -194,6 +266,80 @@ cJSON *OpenAPI_service_parameter_data_convertToJSON(OpenAPI_service_parameter_da } } + if (service_parameter_data->param_for_pro_se_dd) { + if (cJSON_AddStringToObject(item, "paramForProSeDd", service_parameter_data->param_for_pro_se_dd) == NULL) { + ogs_error("OpenAPI_service_parameter_data_convertToJSON() failed [param_for_pro_se_dd]"); + goto end; + } + } + + if (service_parameter_data->param_for_pro_se_dc) { + if (cJSON_AddStringToObject(item, "paramForProSeDc", service_parameter_data->param_for_pro_se_dc) == NULL) { + ogs_error("OpenAPI_service_parameter_data_convertToJSON() failed [param_for_pro_se_dc]"); + goto end; + } + } + + if (service_parameter_data->param_for_pro_se_u2_n_rel_ue) { + if (cJSON_AddStringToObject(item, "paramForProSeU2NRelUe", service_parameter_data->param_for_pro_se_u2_n_rel_ue) == NULL) { + ogs_error("OpenAPI_service_parameter_data_convertToJSON() failed [param_for_pro_se_u2_n_rel_ue]"); + goto end; + } + } + + if (service_parameter_data->param_for_pro_se_rem_ue) { + if (cJSON_AddStringToObject(item, "paramForProSeRemUe", service_parameter_data->param_for_pro_se_rem_ue) == NULL) { + ogs_error("OpenAPI_service_parameter_data_convertToJSON() failed [param_for_pro_se_rem_ue]"); + goto end; + } + } + + if (service_parameter_data->ursp_guidance) { + cJSON *ursp_guidanceList = cJSON_AddArrayToObject(item, "urspGuidance"); + if (ursp_guidanceList == NULL) { + ogs_error("OpenAPI_service_parameter_data_convertToJSON() failed [ursp_guidance]"); + goto end; + } + OpenAPI_list_for_each(service_parameter_data->ursp_guidance, node) { + cJSON *itemLocal = OpenAPI_ursp_rule_request_convertToJSON(node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_service_parameter_data_convertToJSON() failed [ursp_guidance]"); + goto end; + } + cJSON_AddItemToArray(ursp_guidanceList, itemLocal); + } + } + + if (service_parameter_data->delivery_events) { + cJSON *delivery_eventsList = cJSON_AddArrayToObject(item, "deliveryEvents"); + if (delivery_eventsList == NULL) { + ogs_error("OpenAPI_service_parameter_data_convertToJSON() failed [delivery_events]"); + goto end; + } + OpenAPI_list_for_each(service_parameter_data->delivery_events, node) { + cJSON *itemLocal = OpenAPI_event_convertToJSON(node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_service_parameter_data_convertToJSON() failed [delivery_events]"); + goto end; + } + cJSON_AddItemToArray(delivery_eventsList, itemLocal); + } + } + + if (service_parameter_data->polic_deliv_notif_corre_id) { + if (cJSON_AddStringToObject(item, "policDelivNotifCorreId", service_parameter_data->polic_deliv_notif_corre_id) == NULL) { + ogs_error("OpenAPI_service_parameter_data_convertToJSON() failed [polic_deliv_notif_corre_id]"); + goto end; + } + } + + if (service_parameter_data->polic_deliv_notif_uri) { + if (cJSON_AddStringToObject(item, "policDelivNotifUri", service_parameter_data->polic_deliv_notif_uri) == NULL) { + ogs_error("OpenAPI_service_parameter_data_convertToJSON() failed [polic_deliv_notif_uri]"); + goto end; + } + } + if (service_parameter_data->supp_feat) { if (cJSON_AddStringToObject(item, "suppFeat", service_parameter_data->supp_feat) == NULL) { ogs_error("OpenAPI_service_parameter_data_convertToJSON() failed [supp_feat]"); @@ -208,6 +354,34 @@ cJSON *OpenAPI_service_parameter_data_convertToJSON(OpenAPI_service_parameter_da } } + if (service_parameter_data->headers) { + cJSON *headersList = cJSON_AddArrayToObject(item, "headers"); + if (headersList == NULL) { + ogs_error("OpenAPI_service_parameter_data_convertToJSON() failed [headers]"); + goto end; + } + OpenAPI_list_for_each(service_parameter_data->headers, node) { + if (cJSON_AddStringToObject(headersList, "", (char*)node->data) == NULL) { + ogs_error("OpenAPI_service_parameter_data_convertToJSON() failed [headers]"); + goto end; + } + } + } + + if (service_parameter_data->reset_ids) { + cJSON *reset_idsList = cJSON_AddArrayToObject(item, "resetIds"); + if (reset_idsList == NULL) { + ogs_error("OpenAPI_service_parameter_data_convertToJSON() failed [reset_ids]"); + goto end; + } + OpenAPI_list_for_each(service_parameter_data->reset_ids, node) { + if (cJSON_AddStringToObject(reset_idsList, "", (char*)node->data) == NULL) { + ogs_error("OpenAPI_service_parameter_data_convertToJSON() failed [reset_ids]"); + goto end; + } + } + } + end: return item; } @@ -228,8 +402,22 @@ OpenAPI_service_parameter_data_t *OpenAPI_service_parameter_data_parseFromJSON(c cJSON *any_ue_ind = NULL; cJSON *param_over_pc5 = NULL; cJSON *param_over_uu = NULL; + cJSON *param_for_pro_se_dd = NULL; + cJSON *param_for_pro_se_dc = NULL; + cJSON *param_for_pro_se_u2_n_rel_ue = NULL; + cJSON *param_for_pro_se_rem_ue = NULL; + cJSON *ursp_guidance = NULL; + OpenAPI_list_t *ursp_guidanceList = NULL; + cJSON *delivery_events = NULL; + OpenAPI_list_t *delivery_eventsList = NULL; + cJSON *polic_deliv_notif_corre_id = NULL; + cJSON *polic_deliv_notif_uri = NULL; cJSON *supp_feat = NULL; cJSON *res_uri = NULL; + cJSON *headers = NULL; + OpenAPI_list_t *headersList = NULL; + cJSON *reset_ids = NULL; + OpenAPI_list_t *reset_idsList = NULL; app_id = cJSON_GetObjectItemCaseSensitive(service_parameter_dataJSON, "appId"); if (app_id) { if (!cJSON_IsString(app_id) && !cJSON_IsNull(app_id)) { @@ -315,6 +503,104 @@ OpenAPI_service_parameter_data_t *OpenAPI_service_parameter_data_parseFromJSON(c } } + param_for_pro_se_dd = cJSON_GetObjectItemCaseSensitive(service_parameter_dataJSON, "paramForProSeDd"); + if (param_for_pro_se_dd) { + if (!cJSON_IsString(param_for_pro_se_dd) && !cJSON_IsNull(param_for_pro_se_dd)) { + ogs_error("OpenAPI_service_parameter_data_parseFromJSON() failed [param_for_pro_se_dd]"); + goto end; + } + } + + param_for_pro_se_dc = cJSON_GetObjectItemCaseSensitive(service_parameter_dataJSON, "paramForProSeDc"); + if (param_for_pro_se_dc) { + if (!cJSON_IsString(param_for_pro_se_dc) && !cJSON_IsNull(param_for_pro_se_dc)) { + ogs_error("OpenAPI_service_parameter_data_parseFromJSON() failed [param_for_pro_se_dc]"); + goto end; + } + } + + param_for_pro_se_u2_n_rel_ue = cJSON_GetObjectItemCaseSensitive(service_parameter_dataJSON, "paramForProSeU2NRelUe"); + if (param_for_pro_se_u2_n_rel_ue) { + if (!cJSON_IsString(param_for_pro_se_u2_n_rel_ue) && !cJSON_IsNull(param_for_pro_se_u2_n_rel_ue)) { + ogs_error("OpenAPI_service_parameter_data_parseFromJSON() failed [param_for_pro_se_u2_n_rel_ue]"); + goto end; + } + } + + param_for_pro_se_rem_ue = cJSON_GetObjectItemCaseSensitive(service_parameter_dataJSON, "paramForProSeRemUe"); + if (param_for_pro_se_rem_ue) { + if (!cJSON_IsString(param_for_pro_se_rem_ue) && !cJSON_IsNull(param_for_pro_se_rem_ue)) { + ogs_error("OpenAPI_service_parameter_data_parseFromJSON() failed [param_for_pro_se_rem_ue]"); + goto end; + } + } + + ursp_guidance = cJSON_GetObjectItemCaseSensitive(service_parameter_dataJSON, "urspGuidance"); + if (ursp_guidance) { + cJSON *ursp_guidance_local = NULL; + if (!cJSON_IsArray(ursp_guidance)) { + ogs_error("OpenAPI_service_parameter_data_parseFromJSON() failed [ursp_guidance]"); + goto end; + } + + ursp_guidanceList = OpenAPI_list_create(); + + cJSON_ArrayForEach(ursp_guidance_local, ursp_guidance) { + if (!cJSON_IsObject(ursp_guidance_local)) { + ogs_error("OpenAPI_service_parameter_data_parseFromJSON() failed [ursp_guidance]"); + goto end; + } + OpenAPI_ursp_rule_request_t *ursp_guidanceItem = OpenAPI_ursp_rule_request_parseFromJSON(ursp_guidance_local); + if (!ursp_guidanceItem) { + ogs_error("No ursp_guidanceItem"); + OpenAPI_list_free(ursp_guidanceList); + goto end; + } + OpenAPI_list_add(ursp_guidanceList, ursp_guidanceItem); + } + } + + delivery_events = cJSON_GetObjectItemCaseSensitive(service_parameter_dataJSON, "deliveryEvents"); + if (delivery_events) { + cJSON *delivery_events_local = NULL; + if (!cJSON_IsArray(delivery_events)) { + ogs_error("OpenAPI_service_parameter_data_parseFromJSON() failed [delivery_events]"); + goto end; + } + + delivery_eventsList = OpenAPI_list_create(); + + cJSON_ArrayForEach(delivery_events_local, delivery_events) { + if (!cJSON_IsObject(delivery_events_local)) { + ogs_error("OpenAPI_service_parameter_data_parseFromJSON() failed [delivery_events]"); + goto end; + } + OpenAPI_event_t *delivery_eventsItem = OpenAPI_event_parseFromJSON(delivery_events_local); + if (!delivery_eventsItem) { + ogs_error("No delivery_eventsItem"); + OpenAPI_list_free(delivery_eventsList); + goto end; + } + OpenAPI_list_add(delivery_eventsList, delivery_eventsItem); + } + } + + polic_deliv_notif_corre_id = cJSON_GetObjectItemCaseSensitive(service_parameter_dataJSON, "policDelivNotifCorreId"); + if (polic_deliv_notif_corre_id) { + if (!cJSON_IsString(polic_deliv_notif_corre_id) && !cJSON_IsNull(polic_deliv_notif_corre_id)) { + ogs_error("OpenAPI_service_parameter_data_parseFromJSON() failed [polic_deliv_notif_corre_id]"); + goto end; + } + } + + polic_deliv_notif_uri = cJSON_GetObjectItemCaseSensitive(service_parameter_dataJSON, "policDelivNotifUri"); + if (polic_deliv_notif_uri) { + if (!cJSON_IsString(polic_deliv_notif_uri) && !cJSON_IsNull(polic_deliv_notif_uri)) { + ogs_error("OpenAPI_service_parameter_data_parseFromJSON() failed [polic_deliv_notif_uri]"); + goto end; + } + } + supp_feat = cJSON_GetObjectItemCaseSensitive(service_parameter_dataJSON, "suppFeat"); if (supp_feat) { if (!cJSON_IsString(supp_feat) && !cJSON_IsNull(supp_feat)) { @@ -331,6 +617,48 @@ OpenAPI_service_parameter_data_t *OpenAPI_service_parameter_data_parseFromJSON(c } } + headers = cJSON_GetObjectItemCaseSensitive(service_parameter_dataJSON, "headers"); + if (headers) { + cJSON *headers_local = NULL; + if (!cJSON_IsArray(headers)) { + ogs_error("OpenAPI_service_parameter_data_parseFromJSON() failed [headers]"); + goto end; + } + + headersList = OpenAPI_list_create(); + + cJSON_ArrayForEach(headers_local, headers) { + double *localDouble = NULL; + int *localInt = NULL; + if (!cJSON_IsString(headers_local)) { + ogs_error("OpenAPI_service_parameter_data_parseFromJSON() failed [headers]"); + goto end; + } + OpenAPI_list_add(headersList, ogs_strdup(headers_local->valuestring)); + } + } + + reset_ids = cJSON_GetObjectItemCaseSensitive(service_parameter_dataJSON, "resetIds"); + if (reset_ids) { + cJSON *reset_ids_local = NULL; + if (!cJSON_IsArray(reset_ids)) { + ogs_error("OpenAPI_service_parameter_data_parseFromJSON() failed [reset_ids]"); + goto end; + } + + reset_idsList = OpenAPI_list_create(); + + cJSON_ArrayForEach(reset_ids_local, reset_ids) { + double *localDouble = NULL; + int *localInt = NULL; + if (!cJSON_IsString(reset_ids_local)) { + ogs_error("OpenAPI_service_parameter_data_parseFromJSON() failed [reset_ids]"); + goto end; + } + OpenAPI_list_add(reset_idsList, ogs_strdup(reset_ids_local->valuestring)); + } + } + service_parameter_data_local_var = OpenAPI_service_parameter_data_create ( app_id && !cJSON_IsNull(app_id) ? ogs_strdup(app_id->valuestring) : NULL, dnn && !cJSON_IsNull(dnn) ? ogs_strdup(dnn->valuestring) : NULL, @@ -344,8 +672,18 @@ OpenAPI_service_parameter_data_t *OpenAPI_service_parameter_data_parseFromJSON(c any_ue_ind ? any_ue_ind->valueint : 0, param_over_pc5 && !cJSON_IsNull(param_over_pc5) ? ogs_strdup(param_over_pc5->valuestring) : NULL, param_over_uu && !cJSON_IsNull(param_over_uu) ? ogs_strdup(param_over_uu->valuestring) : NULL, + param_for_pro_se_dd && !cJSON_IsNull(param_for_pro_se_dd) ? ogs_strdup(param_for_pro_se_dd->valuestring) : NULL, + param_for_pro_se_dc && !cJSON_IsNull(param_for_pro_se_dc) ? ogs_strdup(param_for_pro_se_dc->valuestring) : NULL, + param_for_pro_se_u2_n_rel_ue && !cJSON_IsNull(param_for_pro_se_u2_n_rel_ue) ? ogs_strdup(param_for_pro_se_u2_n_rel_ue->valuestring) : NULL, + param_for_pro_se_rem_ue && !cJSON_IsNull(param_for_pro_se_rem_ue) ? ogs_strdup(param_for_pro_se_rem_ue->valuestring) : NULL, + ursp_guidance ? ursp_guidanceList : NULL, + delivery_events ? delivery_eventsList : NULL, + polic_deliv_notif_corre_id && !cJSON_IsNull(polic_deliv_notif_corre_id) ? ogs_strdup(polic_deliv_notif_corre_id->valuestring) : NULL, + polic_deliv_notif_uri && !cJSON_IsNull(polic_deliv_notif_uri) ? ogs_strdup(polic_deliv_notif_uri->valuestring) : NULL, supp_feat && !cJSON_IsNull(supp_feat) ? ogs_strdup(supp_feat->valuestring) : NULL, - res_uri && !cJSON_IsNull(res_uri) ? ogs_strdup(res_uri->valuestring) : NULL + res_uri && !cJSON_IsNull(res_uri) ? ogs_strdup(res_uri->valuestring) : NULL, + headers ? headersList : NULL, + reset_ids ? reset_idsList : NULL ); return service_parameter_data_local_var; @@ -354,6 +692,34 @@ end: OpenAPI_snssai_free(snssai_local_nonprim); snssai_local_nonprim = NULL; } + if (ursp_guidanceList) { + OpenAPI_list_for_each(ursp_guidanceList, node) { + OpenAPI_ursp_rule_request_free(node->data); + } + OpenAPI_list_free(ursp_guidanceList); + ursp_guidanceList = NULL; + } + if (delivery_eventsList) { + OpenAPI_list_for_each(delivery_eventsList, node) { + OpenAPI_event_free(node->data); + } + OpenAPI_list_free(delivery_eventsList); + delivery_eventsList = NULL; + } + if (headersList) { + OpenAPI_list_for_each(headersList, node) { + ogs_free(node->data); + } + OpenAPI_list_free(headersList); + headersList = NULL; + } + if (reset_idsList) { + OpenAPI_list_for_each(reset_idsList, node) { + ogs_free(node->data); + } + OpenAPI_list_free(reset_idsList); + reset_idsList = NULL; + } return NULL; } diff --git a/lib/sbi/openapi/model/service_parameter_data.h b/lib/sbi/openapi/model/service_parameter_data.h index 54942b414..68ca0a791 100644 --- a/lib/sbi/openapi/model/service_parameter_data.h +++ b/lib/sbi/openapi/model/service_parameter_data.h @@ -1,7 +1,7 @@ /* * service_parameter_data.h * - * + * Represents the service parameter data. */ #ifndef _OpenAPI_service_parameter_data_H_ @@ -12,7 +12,9 @@ #include "../include/list.h" #include "../include/keyValuePair.h" #include "../include/binary.h" +#include "event.h" #include "snssai.h" +#include "ursp_rule_request.h" #ifdef __cplusplus extern "C" { @@ -32,8 +34,18 @@ typedef struct OpenAPI_service_parameter_data_s { int any_ue_ind; char *param_over_pc5; char *param_over_uu; + char *param_for_pro_se_dd; + char *param_for_pro_se_dc; + char *param_for_pro_se_u2_n_rel_ue; + char *param_for_pro_se_rem_ue; + OpenAPI_list_t *ursp_guidance; + OpenAPI_list_t *delivery_events; + char *polic_deliv_notif_corre_id; + char *polic_deliv_notif_uri; char *supp_feat; char *res_uri; + OpenAPI_list_t *headers; + OpenAPI_list_t *reset_ids; } OpenAPI_service_parameter_data_t; OpenAPI_service_parameter_data_t *OpenAPI_service_parameter_data_create( @@ -49,8 +61,18 @@ OpenAPI_service_parameter_data_t *OpenAPI_service_parameter_data_create( int any_ue_ind, char *param_over_pc5, char *param_over_uu, + char *param_for_pro_se_dd, + char *param_for_pro_se_dc, + char *param_for_pro_se_u2_n_rel_ue, + char *param_for_pro_se_rem_ue, + OpenAPI_list_t *ursp_guidance, + OpenAPI_list_t *delivery_events, + char *polic_deliv_notif_corre_id, + char *polic_deliv_notif_uri, char *supp_feat, - char *res_uri + char *res_uri, + OpenAPI_list_t *headers, + OpenAPI_list_t *reset_ids ); void OpenAPI_service_parameter_data_free(OpenAPI_service_parameter_data_t *service_parameter_data); OpenAPI_service_parameter_data_t *OpenAPI_service_parameter_data_parseFromJSON(cJSON *service_parameter_dataJSON); diff --git a/lib/sbi/openapi/model/service_parameter_data_patch.c b/lib/sbi/openapi/model/service_parameter_data_patch.c index ba0ac3ad8..d1790b001 100644 --- a/lib/sbi/openapi/model/service_parameter_data_patch.c +++ b/lib/sbi/openapi/model/service_parameter_data_patch.c @@ -6,7 +6,14 @@ OpenAPI_service_parameter_data_patch_t *OpenAPI_service_parameter_data_patch_create( char *param_over_pc5, - char *param_over_uu + char *param_over_uu, + char *param_for_pro_se_dd, + char *param_for_pro_se_dc, + char *param_for_pro_se_u2_n_rel_ue, + char *param_for_pro_se_rem_ue, + OpenAPI_list_t *ursp_influence, + OpenAPI_list_t *delivery_events, + char *polic_deliv_notif_uri ) { OpenAPI_service_parameter_data_patch_t *service_parameter_data_patch_local_var = ogs_malloc(sizeof(OpenAPI_service_parameter_data_patch_t)); @@ -14,6 +21,13 @@ OpenAPI_service_parameter_data_patch_t *OpenAPI_service_parameter_data_patch_cre service_parameter_data_patch_local_var->param_over_pc5 = param_over_pc5; service_parameter_data_patch_local_var->param_over_uu = param_over_uu; + service_parameter_data_patch_local_var->param_for_pro_se_dd = param_for_pro_se_dd; + service_parameter_data_patch_local_var->param_for_pro_se_dc = param_for_pro_se_dc; + service_parameter_data_patch_local_var->param_for_pro_se_u2_n_rel_ue = param_for_pro_se_u2_n_rel_ue; + service_parameter_data_patch_local_var->param_for_pro_se_rem_ue = param_for_pro_se_rem_ue; + service_parameter_data_patch_local_var->ursp_influence = ursp_influence; + service_parameter_data_patch_local_var->delivery_events = delivery_events; + service_parameter_data_patch_local_var->polic_deliv_notif_uri = polic_deliv_notif_uri; return service_parameter_data_patch_local_var; } @@ -33,6 +47,40 @@ void OpenAPI_service_parameter_data_patch_free(OpenAPI_service_parameter_data_pa ogs_free(service_parameter_data_patch->param_over_uu); service_parameter_data_patch->param_over_uu = NULL; } + if (service_parameter_data_patch->param_for_pro_se_dd) { + ogs_free(service_parameter_data_patch->param_for_pro_se_dd); + service_parameter_data_patch->param_for_pro_se_dd = NULL; + } + if (service_parameter_data_patch->param_for_pro_se_dc) { + ogs_free(service_parameter_data_patch->param_for_pro_se_dc); + service_parameter_data_patch->param_for_pro_se_dc = NULL; + } + if (service_parameter_data_patch->param_for_pro_se_u2_n_rel_ue) { + ogs_free(service_parameter_data_patch->param_for_pro_se_u2_n_rel_ue); + service_parameter_data_patch->param_for_pro_se_u2_n_rel_ue = NULL; + } + if (service_parameter_data_patch->param_for_pro_se_rem_ue) { + ogs_free(service_parameter_data_patch->param_for_pro_se_rem_ue); + service_parameter_data_patch->param_for_pro_se_rem_ue = NULL; + } + if (service_parameter_data_patch->ursp_influence) { + OpenAPI_list_for_each(service_parameter_data_patch->ursp_influence, node) { + OpenAPI_ursp_rule_request_free(node->data); + } + OpenAPI_list_free(service_parameter_data_patch->ursp_influence); + service_parameter_data_patch->ursp_influence = NULL; + } + if (service_parameter_data_patch->delivery_events) { + OpenAPI_list_for_each(service_parameter_data_patch->delivery_events, node) { + OpenAPI_event_free(node->data); + } + OpenAPI_list_free(service_parameter_data_patch->delivery_events); + service_parameter_data_patch->delivery_events = NULL; + } + if (service_parameter_data_patch->polic_deliv_notif_uri) { + ogs_free(service_parameter_data_patch->polic_deliv_notif_uri); + service_parameter_data_patch->polic_deliv_notif_uri = NULL; + } ogs_free(service_parameter_data_patch); } @@ -61,6 +109,73 @@ cJSON *OpenAPI_service_parameter_data_patch_convertToJSON(OpenAPI_service_parame } } + if (service_parameter_data_patch->param_for_pro_se_dd) { + if (cJSON_AddStringToObject(item, "paramForProSeDd", service_parameter_data_patch->param_for_pro_se_dd) == NULL) { + ogs_error("OpenAPI_service_parameter_data_patch_convertToJSON() failed [param_for_pro_se_dd]"); + goto end; + } + } + + if (service_parameter_data_patch->param_for_pro_se_dc) { + if (cJSON_AddStringToObject(item, "paramForProSeDc", service_parameter_data_patch->param_for_pro_se_dc) == NULL) { + ogs_error("OpenAPI_service_parameter_data_patch_convertToJSON() failed [param_for_pro_se_dc]"); + goto end; + } + } + + if (service_parameter_data_patch->param_for_pro_se_u2_n_rel_ue) { + if (cJSON_AddStringToObject(item, "paramForProSeU2NRelUe", service_parameter_data_patch->param_for_pro_se_u2_n_rel_ue) == NULL) { + ogs_error("OpenAPI_service_parameter_data_patch_convertToJSON() failed [param_for_pro_se_u2_n_rel_ue]"); + goto end; + } + } + + if (service_parameter_data_patch->param_for_pro_se_rem_ue) { + if (cJSON_AddStringToObject(item, "paramForProSeRemUe", service_parameter_data_patch->param_for_pro_se_rem_ue) == NULL) { + ogs_error("OpenAPI_service_parameter_data_patch_convertToJSON() failed [param_for_pro_se_rem_ue]"); + goto end; + } + } + + if (service_parameter_data_patch->ursp_influence) { + cJSON *ursp_influenceList = cJSON_AddArrayToObject(item, "urspInfluence"); + if (ursp_influenceList == NULL) { + ogs_error("OpenAPI_service_parameter_data_patch_convertToJSON() failed [ursp_influence]"); + goto end; + } + OpenAPI_list_for_each(service_parameter_data_patch->ursp_influence, node) { + cJSON *itemLocal = OpenAPI_ursp_rule_request_convertToJSON(node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_service_parameter_data_patch_convertToJSON() failed [ursp_influence]"); + goto end; + } + cJSON_AddItemToArray(ursp_influenceList, itemLocal); + } + } + + if (service_parameter_data_patch->delivery_events) { + cJSON *delivery_eventsList = cJSON_AddArrayToObject(item, "deliveryEvents"); + if (delivery_eventsList == NULL) { + ogs_error("OpenAPI_service_parameter_data_patch_convertToJSON() failed [delivery_events]"); + goto end; + } + OpenAPI_list_for_each(service_parameter_data_patch->delivery_events, node) { + cJSON *itemLocal = OpenAPI_event_convertToJSON(node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_service_parameter_data_patch_convertToJSON() failed [delivery_events]"); + goto end; + } + cJSON_AddItemToArray(delivery_eventsList, itemLocal); + } + } + + if (service_parameter_data_patch->polic_deliv_notif_uri) { + if (cJSON_AddStringToObject(item, "policDelivNotifUri", service_parameter_data_patch->polic_deliv_notif_uri) == NULL) { + ogs_error("OpenAPI_service_parameter_data_patch_convertToJSON() failed [polic_deliv_notif_uri]"); + goto end; + } + } + end: return item; } @@ -71,6 +186,15 @@ OpenAPI_service_parameter_data_patch_t *OpenAPI_service_parameter_data_patch_par OpenAPI_lnode_t *node = NULL; cJSON *param_over_pc5 = NULL; cJSON *param_over_uu = NULL; + cJSON *param_for_pro_se_dd = NULL; + cJSON *param_for_pro_se_dc = NULL; + cJSON *param_for_pro_se_u2_n_rel_ue = NULL; + cJSON *param_for_pro_se_rem_ue = NULL; + cJSON *ursp_influence = NULL; + OpenAPI_list_t *ursp_influenceList = NULL; + cJSON *delivery_events = NULL; + OpenAPI_list_t *delivery_eventsList = NULL; + cJSON *polic_deliv_notif_uri = NULL; param_over_pc5 = cJSON_GetObjectItemCaseSensitive(service_parameter_data_patchJSON, "paramOverPc5"); if (param_over_pc5) { if (!cJSON_IsString(param_over_pc5) && !cJSON_IsNull(param_over_pc5)) { @@ -87,13 +211,124 @@ OpenAPI_service_parameter_data_patch_t *OpenAPI_service_parameter_data_patch_par } } + param_for_pro_se_dd = cJSON_GetObjectItemCaseSensitive(service_parameter_data_patchJSON, "paramForProSeDd"); + if (param_for_pro_se_dd) { + if (!cJSON_IsString(param_for_pro_se_dd) && !cJSON_IsNull(param_for_pro_se_dd)) { + ogs_error("OpenAPI_service_parameter_data_patch_parseFromJSON() failed [param_for_pro_se_dd]"); + goto end; + } + } + + param_for_pro_se_dc = cJSON_GetObjectItemCaseSensitive(service_parameter_data_patchJSON, "paramForProSeDc"); + if (param_for_pro_se_dc) { + if (!cJSON_IsString(param_for_pro_se_dc) && !cJSON_IsNull(param_for_pro_se_dc)) { + ogs_error("OpenAPI_service_parameter_data_patch_parseFromJSON() failed [param_for_pro_se_dc]"); + goto end; + } + } + + param_for_pro_se_u2_n_rel_ue = cJSON_GetObjectItemCaseSensitive(service_parameter_data_patchJSON, "paramForProSeU2NRelUe"); + if (param_for_pro_se_u2_n_rel_ue) { + if (!cJSON_IsString(param_for_pro_se_u2_n_rel_ue) && !cJSON_IsNull(param_for_pro_se_u2_n_rel_ue)) { + ogs_error("OpenAPI_service_parameter_data_patch_parseFromJSON() failed [param_for_pro_se_u2_n_rel_ue]"); + goto end; + } + } + + param_for_pro_se_rem_ue = cJSON_GetObjectItemCaseSensitive(service_parameter_data_patchJSON, "paramForProSeRemUe"); + if (param_for_pro_se_rem_ue) { + if (!cJSON_IsString(param_for_pro_se_rem_ue) && !cJSON_IsNull(param_for_pro_se_rem_ue)) { + ogs_error("OpenAPI_service_parameter_data_patch_parseFromJSON() failed [param_for_pro_se_rem_ue]"); + goto end; + } + } + + ursp_influence = cJSON_GetObjectItemCaseSensitive(service_parameter_data_patchJSON, "urspInfluence"); + if (ursp_influence) { + cJSON *ursp_influence_local = NULL; + if (!cJSON_IsArray(ursp_influence)) { + ogs_error("OpenAPI_service_parameter_data_patch_parseFromJSON() failed [ursp_influence]"); + goto end; + } + + ursp_influenceList = OpenAPI_list_create(); + + cJSON_ArrayForEach(ursp_influence_local, ursp_influence) { + if (!cJSON_IsObject(ursp_influence_local)) { + ogs_error("OpenAPI_service_parameter_data_patch_parseFromJSON() failed [ursp_influence]"); + goto end; + } + OpenAPI_ursp_rule_request_t *ursp_influenceItem = OpenAPI_ursp_rule_request_parseFromJSON(ursp_influence_local); + if (!ursp_influenceItem) { + ogs_error("No ursp_influenceItem"); + OpenAPI_list_free(ursp_influenceList); + goto end; + } + OpenAPI_list_add(ursp_influenceList, ursp_influenceItem); + } + } + + delivery_events = cJSON_GetObjectItemCaseSensitive(service_parameter_data_patchJSON, "deliveryEvents"); + if (delivery_events) { + cJSON *delivery_events_local = NULL; + if (!cJSON_IsArray(delivery_events)) { + ogs_error("OpenAPI_service_parameter_data_patch_parseFromJSON() failed [delivery_events]"); + goto end; + } + + delivery_eventsList = OpenAPI_list_create(); + + cJSON_ArrayForEach(delivery_events_local, delivery_events) { + if (!cJSON_IsObject(delivery_events_local)) { + ogs_error("OpenAPI_service_parameter_data_patch_parseFromJSON() failed [delivery_events]"); + goto end; + } + OpenAPI_event_t *delivery_eventsItem = OpenAPI_event_parseFromJSON(delivery_events_local); + if (!delivery_eventsItem) { + ogs_error("No delivery_eventsItem"); + OpenAPI_list_free(delivery_eventsList); + goto end; + } + OpenAPI_list_add(delivery_eventsList, delivery_eventsItem); + } + } + + polic_deliv_notif_uri = cJSON_GetObjectItemCaseSensitive(service_parameter_data_patchJSON, "policDelivNotifUri"); + if (polic_deliv_notif_uri) { + if (!cJSON_IsString(polic_deliv_notif_uri) && !cJSON_IsNull(polic_deliv_notif_uri)) { + ogs_error("OpenAPI_service_parameter_data_patch_parseFromJSON() failed [polic_deliv_notif_uri]"); + goto end; + } + } + service_parameter_data_patch_local_var = OpenAPI_service_parameter_data_patch_create ( param_over_pc5 && !cJSON_IsNull(param_over_pc5) ? ogs_strdup(param_over_pc5->valuestring) : NULL, - param_over_uu && !cJSON_IsNull(param_over_uu) ? ogs_strdup(param_over_uu->valuestring) : NULL + param_over_uu && !cJSON_IsNull(param_over_uu) ? ogs_strdup(param_over_uu->valuestring) : NULL, + param_for_pro_se_dd && !cJSON_IsNull(param_for_pro_se_dd) ? ogs_strdup(param_for_pro_se_dd->valuestring) : NULL, + param_for_pro_se_dc && !cJSON_IsNull(param_for_pro_se_dc) ? ogs_strdup(param_for_pro_se_dc->valuestring) : NULL, + param_for_pro_se_u2_n_rel_ue && !cJSON_IsNull(param_for_pro_se_u2_n_rel_ue) ? ogs_strdup(param_for_pro_se_u2_n_rel_ue->valuestring) : NULL, + param_for_pro_se_rem_ue && !cJSON_IsNull(param_for_pro_se_rem_ue) ? ogs_strdup(param_for_pro_se_rem_ue->valuestring) : NULL, + ursp_influence ? ursp_influenceList : NULL, + delivery_events ? delivery_eventsList : NULL, + polic_deliv_notif_uri && !cJSON_IsNull(polic_deliv_notif_uri) ? ogs_strdup(polic_deliv_notif_uri->valuestring) : NULL ); return service_parameter_data_patch_local_var; end: + if (ursp_influenceList) { + OpenAPI_list_for_each(ursp_influenceList, node) { + OpenAPI_ursp_rule_request_free(node->data); + } + OpenAPI_list_free(ursp_influenceList); + ursp_influenceList = NULL; + } + if (delivery_eventsList) { + OpenAPI_list_for_each(delivery_eventsList, node) { + OpenAPI_event_free(node->data); + } + OpenAPI_list_free(delivery_eventsList); + delivery_eventsList = NULL; + } return NULL; } diff --git a/lib/sbi/openapi/model/service_parameter_data_patch.h b/lib/sbi/openapi/model/service_parameter_data_patch.h index 8c5723220..712ad3909 100644 --- a/lib/sbi/openapi/model/service_parameter_data_patch.h +++ b/lib/sbi/openapi/model/service_parameter_data_patch.h @@ -1,7 +1,7 @@ /* * service_parameter_data_patch.h * - * + * Represents the service parameter data that can be updated. */ #ifndef _OpenAPI_service_parameter_data_patch_H_ @@ -12,6 +12,8 @@ #include "../include/list.h" #include "../include/keyValuePair.h" #include "../include/binary.h" +#include "event.h" +#include "ursp_rule_request.h" #ifdef __cplusplus extern "C" { @@ -21,11 +23,25 @@ typedef struct OpenAPI_service_parameter_data_patch_s OpenAPI_service_parameter_ typedef struct OpenAPI_service_parameter_data_patch_s { char *param_over_pc5; char *param_over_uu; + char *param_for_pro_se_dd; + char *param_for_pro_se_dc; + char *param_for_pro_se_u2_n_rel_ue; + char *param_for_pro_se_rem_ue; + OpenAPI_list_t *ursp_influence; + OpenAPI_list_t *delivery_events; + char *polic_deliv_notif_uri; } OpenAPI_service_parameter_data_patch_t; OpenAPI_service_parameter_data_patch_t *OpenAPI_service_parameter_data_patch_create( char *param_over_pc5, - char *param_over_uu + char *param_over_uu, + char *param_for_pro_se_dd, + char *param_for_pro_se_dc, + char *param_for_pro_se_u2_n_rel_ue, + char *param_for_pro_se_rem_ue, + OpenAPI_list_t *ursp_influence, + OpenAPI_list_t *delivery_events, + char *polic_deliv_notif_uri ); void OpenAPI_service_parameter_data_patch_free(OpenAPI_service_parameter_data_patch_t *service_parameter_data_patch); OpenAPI_service_parameter_data_patch_t *OpenAPI_service_parameter_data_patch_parseFromJSON(cJSON *service_parameter_data_patchJSON); diff --git a/lib/sbi/openapi/model/service_specific_authorization_info.c b/lib/sbi/openapi/model/service_specific_authorization_info.c new file mode 100644 index 000000000..b5d6ee77d --- /dev/null +++ b/lib/sbi/openapi/model/service_specific_authorization_info.c @@ -0,0 +1,151 @@ + +#include +#include +#include +#include "service_specific_authorization_info.h" + +OpenAPI_service_specific_authorization_info_t *OpenAPI_service_specific_authorization_info_create( + OpenAPI_list_t *service_specific_authorization_list +) +{ + OpenAPI_service_specific_authorization_info_t *service_specific_authorization_info_local_var = ogs_malloc(sizeof(OpenAPI_service_specific_authorization_info_t)); + ogs_assert(service_specific_authorization_info_local_var); + + service_specific_authorization_info_local_var->service_specific_authorization_list = service_specific_authorization_list; + + return service_specific_authorization_info_local_var; +} + +void OpenAPI_service_specific_authorization_info_free(OpenAPI_service_specific_authorization_info_t *service_specific_authorization_info) +{ + OpenAPI_lnode_t *node = NULL; + + if (NULL == service_specific_authorization_info) { + return; + } + if (service_specific_authorization_info->service_specific_authorization_list) { + OpenAPI_list_for_each(service_specific_authorization_info->service_specific_authorization_list, node) { + OpenAPI_authorization_info_free(node->data); + } + OpenAPI_list_free(service_specific_authorization_info->service_specific_authorization_list); + service_specific_authorization_info->service_specific_authorization_list = NULL; + } + ogs_free(service_specific_authorization_info); +} + +cJSON *OpenAPI_service_specific_authorization_info_convertToJSON(OpenAPI_service_specific_authorization_info_t *service_specific_authorization_info) +{ + cJSON *item = NULL; + OpenAPI_lnode_t *node = NULL; + + if (service_specific_authorization_info == NULL) { + ogs_error("OpenAPI_service_specific_authorization_info_convertToJSON() failed [ServiceSpecificAuthorizationInfo]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (!service_specific_authorization_info->service_specific_authorization_list) { + ogs_error("OpenAPI_service_specific_authorization_info_convertToJSON() failed [service_specific_authorization_list]"); + return NULL; + } + cJSON *service_specific_authorization_listList = cJSON_AddArrayToObject(item, "serviceSpecificAuthorizationList"); + if (service_specific_authorization_listList == NULL) { + ogs_error("OpenAPI_service_specific_authorization_info_convertToJSON() failed [service_specific_authorization_list]"); + goto end; + } + OpenAPI_list_for_each(service_specific_authorization_info->service_specific_authorization_list, node) { + cJSON *itemLocal = OpenAPI_authorization_info_convertToJSON(node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_service_specific_authorization_info_convertToJSON() failed [service_specific_authorization_list]"); + goto end; + } + cJSON_AddItemToArray(service_specific_authorization_listList, itemLocal); + } + +end: + return item; +} + +OpenAPI_service_specific_authorization_info_t *OpenAPI_service_specific_authorization_info_parseFromJSON(cJSON *service_specific_authorization_infoJSON) +{ + OpenAPI_service_specific_authorization_info_t *service_specific_authorization_info_local_var = NULL; + OpenAPI_lnode_t *node = NULL; + cJSON *service_specific_authorization_list = NULL; + OpenAPI_list_t *service_specific_authorization_listList = NULL; + service_specific_authorization_list = cJSON_GetObjectItemCaseSensitive(service_specific_authorization_infoJSON, "serviceSpecificAuthorizationList"); + if (!service_specific_authorization_list) { + ogs_error("OpenAPI_service_specific_authorization_info_parseFromJSON() failed [service_specific_authorization_list]"); + goto end; + } + cJSON *service_specific_authorization_list_local = NULL; + if (!cJSON_IsArray(service_specific_authorization_list)) { + ogs_error("OpenAPI_service_specific_authorization_info_parseFromJSON() failed [service_specific_authorization_list]"); + goto end; + } + + service_specific_authorization_listList = OpenAPI_list_create(); + + cJSON_ArrayForEach(service_specific_authorization_list_local, service_specific_authorization_list) { + if (!cJSON_IsObject(service_specific_authorization_list_local)) { + ogs_error("OpenAPI_service_specific_authorization_info_parseFromJSON() failed [service_specific_authorization_list]"); + goto end; + } + OpenAPI_authorization_info_t *service_specific_authorization_listItem = OpenAPI_authorization_info_parseFromJSON(service_specific_authorization_list_local); + if (!service_specific_authorization_listItem) { + ogs_error("No service_specific_authorization_listItem"); + OpenAPI_list_free(service_specific_authorization_listList); + goto end; + } + OpenAPI_list_add(service_specific_authorization_listList, service_specific_authorization_listItem); + } + + service_specific_authorization_info_local_var = OpenAPI_service_specific_authorization_info_create ( + service_specific_authorization_listList + ); + + return service_specific_authorization_info_local_var; +end: + if (service_specific_authorization_listList) { + OpenAPI_list_for_each(service_specific_authorization_listList, node) { + OpenAPI_authorization_info_free(node->data); + } + OpenAPI_list_free(service_specific_authorization_listList); + service_specific_authorization_listList = NULL; + } + return NULL; +} + +OpenAPI_service_specific_authorization_info_t *OpenAPI_service_specific_authorization_info_copy(OpenAPI_service_specific_authorization_info_t *dst, OpenAPI_service_specific_authorization_info_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_service_specific_authorization_info_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_service_specific_authorization_info_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_service_specific_authorization_info_free(dst); + dst = OpenAPI_service_specific_authorization_info_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/service_specific_authorization_info.h b/lib/sbi/openapi/model/service_specific_authorization_info.h new file mode 100644 index 000000000..a0c7e7966 --- /dev/null +++ b/lib/sbi/openapi/model/service_specific_authorization_info.h @@ -0,0 +1,39 @@ +/* + * service_specific_authorization_info.h + * + * Information related to active Service Specific Authorizations + */ + +#ifndef _OpenAPI_service_specific_authorization_info_H_ +#define _OpenAPI_service_specific_authorization_info_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "authorization_info.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_service_specific_authorization_info_s OpenAPI_service_specific_authorization_info_t; +typedef struct OpenAPI_service_specific_authorization_info_s { + OpenAPI_list_t *service_specific_authorization_list; +} OpenAPI_service_specific_authorization_info_t; + +OpenAPI_service_specific_authorization_info_t *OpenAPI_service_specific_authorization_info_create( + OpenAPI_list_t *service_specific_authorization_list +); +void OpenAPI_service_specific_authorization_info_free(OpenAPI_service_specific_authorization_info_t *service_specific_authorization_info); +OpenAPI_service_specific_authorization_info_t *OpenAPI_service_specific_authorization_info_parseFromJSON(cJSON *service_specific_authorization_infoJSON); +cJSON *OpenAPI_service_specific_authorization_info_convertToJSON(OpenAPI_service_specific_authorization_info_t *service_specific_authorization_info); +OpenAPI_service_specific_authorization_info_t *OpenAPI_service_specific_authorization_info_copy(OpenAPI_service_specific_authorization_info_t *dst, OpenAPI_service_specific_authorization_info_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_service_specific_authorization_info_H_ */ + diff --git a/lib/sbi/openapi/model/service_type.c b/lib/sbi/openapi/model/service_type.c new file mode 100644 index 000000000..d21edbfae --- /dev/null +++ b/lib/sbi/openapi/model/service_type.c @@ -0,0 +1,87 @@ + +#include +#include +#include +#include "service_type.h" + +OpenAPI_service_type_t *OpenAPI_service_type_create( +) +{ + OpenAPI_service_type_t *service_type_local_var = ogs_malloc(sizeof(OpenAPI_service_type_t)); + ogs_assert(service_type_local_var); + + + return service_type_local_var; +} + +void OpenAPI_service_type_free(OpenAPI_service_type_t *service_type) +{ + OpenAPI_lnode_t *node = NULL; + + if (NULL == service_type) { + return; + } + ogs_free(service_type); +} + +cJSON *OpenAPI_service_type_convertToJSON(OpenAPI_service_type_t *service_type) +{ + cJSON *item = NULL; + OpenAPI_lnode_t *node = NULL; + + if (service_type == NULL) { + ogs_error("OpenAPI_service_type_convertToJSON() failed [ServiceType]"); + return NULL; + } + + item = cJSON_CreateObject(); +end: + return item; +} + +OpenAPI_service_type_t *OpenAPI_service_type_parseFromJSON(cJSON *service_typeJSON) +{ + OpenAPI_service_type_t *service_type_local_var = NULL; + OpenAPI_lnode_t *node = NULL; + service_type_local_var = OpenAPI_service_type_create ( + ); + + return service_type_local_var; +end: + return NULL; +} + +OpenAPI_service_type_t *OpenAPI_service_type_copy(OpenAPI_service_type_t *dst, OpenAPI_service_type_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_service_type_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_service_type_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_service_type_free(dst); + dst = OpenAPI_service_type_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/service_type.h b/lib/sbi/openapi/model/service_type.h new file mode 100644 index 000000000..4a797c986 --- /dev/null +++ b/lib/sbi/openapi/model/service_type.h @@ -0,0 +1,37 @@ +/* + * service_type.h + * + * Possible values are - AF_GUIDANCE_FOR_URSP + */ + +#ifndef _OpenAPI_service_type_H_ +#define _OpenAPI_service_type_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "service_type_any_of.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_service_type_s OpenAPI_service_type_t; +typedef struct OpenAPI_service_type_s { +} OpenAPI_service_type_t; + +OpenAPI_service_type_t *OpenAPI_service_type_create( +); +void OpenAPI_service_type_free(OpenAPI_service_type_t *service_type); +OpenAPI_service_type_t *OpenAPI_service_type_parseFromJSON(cJSON *service_typeJSON); +cJSON *OpenAPI_service_type_convertToJSON(OpenAPI_service_type_t *service_type); +OpenAPI_service_type_t *OpenAPI_service_type_copy(OpenAPI_service_type_t *dst, OpenAPI_service_type_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_service_type_H_ */ + diff --git a/lib/sbi/openapi/model/service_type_any_of.c b/lib/sbi/openapi/model/service_type_any_of.c new file mode 100644 index 000000000..b02f5fe81 --- /dev/null +++ b/lib/sbi/openapi/model/service_type_any_of.c @@ -0,0 +1,30 @@ + +#include +#include +#include +#include "service_type_any_of.h" + +char* OpenAPI_service_type_any_of_ToString(OpenAPI_service_type_any_of_e service_type_any_of) +{ + const char *service_type_any_ofArray[] = { "NULL", "AF_GUIDANCE_FOR_URSP" }; + size_t sizeofArray = sizeof(service_type_any_ofArray) / sizeof(service_type_any_ofArray[0]); + if (service_type_any_of < sizeofArray) + return (char *)service_type_any_ofArray[service_type_any_of]; + else + return (char *)"Unknown"; +} + +OpenAPI_service_type_any_of_e OpenAPI_service_type_any_of_FromString(char* service_type_any_of) +{ + int stringToReturn = 0; + const char *service_type_any_ofArray[] = { "NULL", "AF_GUIDANCE_FOR_URSP" }; + size_t sizeofArray = sizeof(service_type_any_ofArray) / sizeof(service_type_any_ofArray[0]); + while (stringToReturn < sizeofArray) { + if (strcmp(service_type_any_of, service_type_any_ofArray[stringToReturn]) == 0) { + return stringToReturn; + } + stringToReturn++; + } + return 0; +} + diff --git a/lib/sbi/openapi/model/service_type_any_of.h b/lib/sbi/openapi/model/service_type_any_of.h new file mode 100644 index 000000000..dabfc28c9 --- /dev/null +++ b/lib/sbi/openapi/model/service_type_any_of.h @@ -0,0 +1,31 @@ +/* + * service_type_any_of.h + * + * + */ + +#ifndef _OpenAPI_service_type_any_of_H_ +#define _OpenAPI_service_type_any_of_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef enum { OpenAPI_service_type_any_of_NULL = 0, OpenAPI_service_type_any_of_AF_GUIDANCE_FOR_URSP } OpenAPI_service_type_any_of_e; + +char* OpenAPI_service_type_any_of_ToString(OpenAPI_service_type_any_of_e service_type_any_of); + +OpenAPI_service_type_any_of_e OpenAPI_service_type_any_of_FromString(char* service_type_any_of); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_service_type_any_of_H_ */ + diff --git a/lib/sbi/openapi/model/service_type_unrelated_class_1.c b/lib/sbi/openapi/model/service_type_unrelated_class_1.c deleted file mode 100644 index 586d8b60f..000000000 --- a/lib/sbi/openapi/model/service_type_unrelated_class_1.c +++ /dev/null @@ -1,294 +0,0 @@ - -#include -#include -#include -#include "service_type_unrelated_class_1.h" - -OpenAPI_service_type_unrelated_class_1_t *OpenAPI_service_type_unrelated_class_1_create( - int service_type, - OpenAPI_list_t *allowed_geographic_area, - OpenAPI_privacy_check_related_action_e privacy_check_related_action, - OpenAPI_code_word_ind_e code_word_ind, - OpenAPI_valid_time_period_1_t *valid_time_period, - OpenAPI_list_t *code_word_list -) -{ - OpenAPI_service_type_unrelated_class_1_t *service_type_unrelated_class_1_local_var = ogs_malloc(sizeof(OpenAPI_service_type_unrelated_class_1_t)); - ogs_assert(service_type_unrelated_class_1_local_var); - - service_type_unrelated_class_1_local_var->service_type = service_type; - service_type_unrelated_class_1_local_var->allowed_geographic_area = allowed_geographic_area; - service_type_unrelated_class_1_local_var->privacy_check_related_action = privacy_check_related_action; - service_type_unrelated_class_1_local_var->code_word_ind = code_word_ind; - service_type_unrelated_class_1_local_var->valid_time_period = valid_time_period; - service_type_unrelated_class_1_local_var->code_word_list = code_word_list; - - return service_type_unrelated_class_1_local_var; -} - -void OpenAPI_service_type_unrelated_class_1_free(OpenAPI_service_type_unrelated_class_1_t *service_type_unrelated_class_1) -{ - OpenAPI_lnode_t *node = NULL; - - if (NULL == service_type_unrelated_class_1) { - return; - } - if (service_type_unrelated_class_1->allowed_geographic_area) { - OpenAPI_list_for_each(service_type_unrelated_class_1->allowed_geographic_area, node) { - OpenAPI_geographic_area_free(node->data); - } - OpenAPI_list_free(service_type_unrelated_class_1->allowed_geographic_area); - service_type_unrelated_class_1->allowed_geographic_area = NULL; - } - if (service_type_unrelated_class_1->valid_time_period) { - OpenAPI_valid_time_period_1_free(service_type_unrelated_class_1->valid_time_period); - service_type_unrelated_class_1->valid_time_period = NULL; - } - if (service_type_unrelated_class_1->code_word_list) { - OpenAPI_list_for_each(service_type_unrelated_class_1->code_word_list, node) { - ogs_free(node->data); - } - OpenAPI_list_free(service_type_unrelated_class_1->code_word_list); - service_type_unrelated_class_1->code_word_list = NULL; - } - ogs_free(service_type_unrelated_class_1); -} - -cJSON *OpenAPI_service_type_unrelated_class_1_convertToJSON(OpenAPI_service_type_unrelated_class_1_t *service_type_unrelated_class_1) -{ - cJSON *item = NULL; - OpenAPI_lnode_t *node = NULL; - - if (service_type_unrelated_class_1 == NULL) { - ogs_error("OpenAPI_service_type_unrelated_class_1_convertToJSON() failed [ServiceTypeUnrelatedClass_1]"); - return NULL; - } - - item = cJSON_CreateObject(); - if (cJSON_AddNumberToObject(item, "serviceType", service_type_unrelated_class_1->service_type) == NULL) { - ogs_error("OpenAPI_service_type_unrelated_class_1_convertToJSON() failed [service_type]"); - goto end; - } - - if (service_type_unrelated_class_1->allowed_geographic_area) { - cJSON *allowed_geographic_areaList = cJSON_AddArrayToObject(item, "allowedGeographicArea"); - if (allowed_geographic_areaList == NULL) { - ogs_error("OpenAPI_service_type_unrelated_class_1_convertToJSON() failed [allowed_geographic_area]"); - goto end; - } - OpenAPI_list_for_each(service_type_unrelated_class_1->allowed_geographic_area, node) { - cJSON *itemLocal = OpenAPI_geographic_area_convertToJSON(node->data); - if (itemLocal == NULL) { - ogs_error("OpenAPI_service_type_unrelated_class_1_convertToJSON() failed [allowed_geographic_area]"); - goto end; - } - cJSON_AddItemToArray(allowed_geographic_areaList, itemLocal); - } - } - - if (service_type_unrelated_class_1->privacy_check_related_action != OpenAPI_privacy_check_related_action_NULL) { - if (cJSON_AddStringToObject(item, "privacyCheckRelatedAction", OpenAPI_privacy_check_related_action_ToString(service_type_unrelated_class_1->privacy_check_related_action)) == NULL) { - ogs_error("OpenAPI_service_type_unrelated_class_1_convertToJSON() failed [privacy_check_related_action]"); - goto end; - } - } - - if (service_type_unrelated_class_1->code_word_ind != OpenAPI_code_word_ind_NULL) { - if (cJSON_AddStringToObject(item, "codeWordInd", OpenAPI_code_word_ind_ToString(service_type_unrelated_class_1->code_word_ind)) == NULL) { - ogs_error("OpenAPI_service_type_unrelated_class_1_convertToJSON() failed [code_word_ind]"); - goto end; - } - } - - if (service_type_unrelated_class_1->valid_time_period) { - cJSON *valid_time_period_local_JSON = OpenAPI_valid_time_period_1_convertToJSON(service_type_unrelated_class_1->valid_time_period); - if (valid_time_period_local_JSON == NULL) { - ogs_error("OpenAPI_service_type_unrelated_class_1_convertToJSON() failed [valid_time_period]"); - goto end; - } - cJSON_AddItemToObject(item, "validTimePeriod", valid_time_period_local_JSON); - if (item->child == NULL) { - ogs_error("OpenAPI_service_type_unrelated_class_1_convertToJSON() failed [valid_time_period]"); - goto end; - } - } - - if (service_type_unrelated_class_1->code_word_list) { - cJSON *code_word_listList = cJSON_AddArrayToObject(item, "codeWordList"); - if (code_word_listList == NULL) { - ogs_error("OpenAPI_service_type_unrelated_class_1_convertToJSON() failed [code_word_list]"); - goto end; - } - OpenAPI_list_for_each(service_type_unrelated_class_1->code_word_list, node) { - if (cJSON_AddStringToObject(code_word_listList, "", (char*)node->data) == NULL) { - ogs_error("OpenAPI_service_type_unrelated_class_1_convertToJSON() failed [code_word_list]"); - goto end; - } - } - } - -end: - return item; -} - -OpenAPI_service_type_unrelated_class_1_t *OpenAPI_service_type_unrelated_class_1_parseFromJSON(cJSON *service_type_unrelated_class_1JSON) -{ - OpenAPI_service_type_unrelated_class_1_t *service_type_unrelated_class_1_local_var = NULL; - OpenAPI_lnode_t *node = NULL; - cJSON *service_type = NULL; - cJSON *allowed_geographic_area = NULL; - OpenAPI_list_t *allowed_geographic_areaList = NULL; - cJSON *privacy_check_related_action = NULL; - OpenAPI_privacy_check_related_action_e privacy_check_related_actionVariable = 0; - cJSON *code_word_ind = NULL; - OpenAPI_code_word_ind_e code_word_indVariable = 0; - cJSON *valid_time_period = NULL; - OpenAPI_valid_time_period_1_t *valid_time_period_local_nonprim = NULL; - cJSON *code_word_list = NULL; - OpenAPI_list_t *code_word_listList = NULL; - service_type = cJSON_GetObjectItemCaseSensitive(service_type_unrelated_class_1JSON, "serviceType"); - if (!service_type) { - ogs_error("OpenAPI_service_type_unrelated_class_1_parseFromJSON() failed [service_type]"); - goto end; - } - if (!cJSON_IsNumber(service_type)) { - ogs_error("OpenAPI_service_type_unrelated_class_1_parseFromJSON() failed [service_type]"); - goto end; - } - - allowed_geographic_area = cJSON_GetObjectItemCaseSensitive(service_type_unrelated_class_1JSON, "allowedGeographicArea"); - if (allowed_geographic_area) { - cJSON *allowed_geographic_area_local = NULL; - if (!cJSON_IsArray(allowed_geographic_area)) { - ogs_error("OpenAPI_service_type_unrelated_class_1_parseFromJSON() failed [allowed_geographic_area]"); - goto end; - } - - allowed_geographic_areaList = OpenAPI_list_create(); - - cJSON_ArrayForEach(allowed_geographic_area_local, allowed_geographic_area) { - if (!cJSON_IsObject(allowed_geographic_area_local)) { - ogs_error("OpenAPI_service_type_unrelated_class_1_parseFromJSON() failed [allowed_geographic_area]"); - goto end; - } - OpenAPI_geographic_area_t *allowed_geographic_areaItem = OpenAPI_geographic_area_parseFromJSON(allowed_geographic_area_local); - if (!allowed_geographic_areaItem) { - ogs_error("No allowed_geographic_areaItem"); - OpenAPI_list_free(allowed_geographic_areaList); - goto end; - } - OpenAPI_list_add(allowed_geographic_areaList, allowed_geographic_areaItem); - } - } - - privacy_check_related_action = cJSON_GetObjectItemCaseSensitive(service_type_unrelated_class_1JSON, "privacyCheckRelatedAction"); - if (privacy_check_related_action) { - if (!cJSON_IsString(privacy_check_related_action)) { - ogs_error("OpenAPI_service_type_unrelated_class_1_parseFromJSON() failed [privacy_check_related_action]"); - goto end; - } - privacy_check_related_actionVariable = OpenAPI_privacy_check_related_action_FromString(privacy_check_related_action->valuestring); - } - - code_word_ind = cJSON_GetObjectItemCaseSensitive(service_type_unrelated_class_1JSON, "codeWordInd"); - if (code_word_ind) { - if (!cJSON_IsString(code_word_ind)) { - ogs_error("OpenAPI_service_type_unrelated_class_1_parseFromJSON() failed [code_word_ind]"); - goto end; - } - code_word_indVariable = OpenAPI_code_word_ind_FromString(code_word_ind->valuestring); - } - - valid_time_period = cJSON_GetObjectItemCaseSensitive(service_type_unrelated_class_1JSON, "validTimePeriod"); - if (valid_time_period) { - valid_time_period_local_nonprim = OpenAPI_valid_time_period_1_parseFromJSON(valid_time_period); - } - - code_word_list = cJSON_GetObjectItemCaseSensitive(service_type_unrelated_class_1JSON, "codeWordList"); - if (code_word_list) { - cJSON *code_word_list_local = NULL; - if (!cJSON_IsArray(code_word_list)) { - ogs_error("OpenAPI_service_type_unrelated_class_1_parseFromJSON() failed [code_word_list]"); - goto end; - } - - code_word_listList = OpenAPI_list_create(); - - cJSON_ArrayForEach(code_word_list_local, code_word_list) { - double *localDouble = NULL; - int *localInt = NULL; - if (!cJSON_IsString(code_word_list_local)) { - ogs_error("OpenAPI_service_type_unrelated_class_1_parseFromJSON() failed [code_word_list]"); - goto end; - } - OpenAPI_list_add(code_word_listList, ogs_strdup(code_word_list_local->valuestring)); - } - } - - service_type_unrelated_class_1_local_var = OpenAPI_service_type_unrelated_class_1_create ( - - service_type->valuedouble, - allowed_geographic_area ? allowed_geographic_areaList : NULL, - privacy_check_related_action ? privacy_check_related_actionVariable : 0, - code_word_ind ? code_word_indVariable : 0, - valid_time_period ? valid_time_period_local_nonprim : NULL, - code_word_list ? code_word_listList : NULL - ); - - return service_type_unrelated_class_1_local_var; -end: - if (allowed_geographic_areaList) { - OpenAPI_list_for_each(allowed_geographic_areaList, node) { - OpenAPI_geographic_area_free(node->data); - } - OpenAPI_list_free(allowed_geographic_areaList); - allowed_geographic_areaList = NULL; - } - if (valid_time_period_local_nonprim) { - OpenAPI_valid_time_period_1_free(valid_time_period_local_nonprim); - valid_time_period_local_nonprim = NULL; - } - if (code_word_listList) { - OpenAPI_list_for_each(code_word_listList, node) { - ogs_free(node->data); - } - OpenAPI_list_free(code_word_listList); - code_word_listList = NULL; - } - return NULL; -} - -OpenAPI_service_type_unrelated_class_1_t *OpenAPI_service_type_unrelated_class_1_copy(OpenAPI_service_type_unrelated_class_1_t *dst, OpenAPI_service_type_unrelated_class_1_t *src) -{ - cJSON *item = NULL; - char *content = NULL; - - ogs_assert(src); - item = OpenAPI_service_type_unrelated_class_1_convertToJSON(src); - if (!item) { - ogs_error("OpenAPI_service_type_unrelated_class_1_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_service_type_unrelated_class_1_free(dst); - dst = OpenAPI_service_type_unrelated_class_1_parseFromJSON(item); - cJSON_Delete(item); - - return dst; -} - diff --git a/lib/sbi/openapi/model/service_type_unrelated_class_1.h b/lib/sbi/openapi/model/service_type_unrelated_class_1.h deleted file mode 100644 index 4491effee..000000000 --- a/lib/sbi/openapi/model/service_type_unrelated_class_1.h +++ /dev/null @@ -1,52 +0,0 @@ -/* - * service_type_unrelated_class_1.h - * - * - */ - -#ifndef _OpenAPI_service_type_unrelated_class_1_H_ -#define _OpenAPI_service_type_unrelated_class_1_H_ - -#include -#include "../external/cJSON.h" -#include "../include/list.h" -#include "../include/keyValuePair.h" -#include "../include/binary.h" -#include "code_word_ind.h" -#include "geographic_area.h" -#include "privacy_check_related_action.h" -#include "valid_time_period_1.h" - -#ifdef __cplusplus -extern "C" { -#endif - -typedef struct OpenAPI_service_type_unrelated_class_1_s OpenAPI_service_type_unrelated_class_1_t; -typedef struct OpenAPI_service_type_unrelated_class_1_s { - int service_type; - OpenAPI_list_t *allowed_geographic_area; - OpenAPI_privacy_check_related_action_e privacy_check_related_action; - OpenAPI_code_word_ind_e code_word_ind; - struct OpenAPI_valid_time_period_1_s *valid_time_period; - OpenAPI_list_t *code_word_list; -} OpenAPI_service_type_unrelated_class_1_t; - -OpenAPI_service_type_unrelated_class_1_t *OpenAPI_service_type_unrelated_class_1_create( - int service_type, - OpenAPI_list_t *allowed_geographic_area, - OpenAPI_privacy_check_related_action_e privacy_check_related_action, - OpenAPI_code_word_ind_e code_word_ind, - OpenAPI_valid_time_period_1_t *valid_time_period, - OpenAPI_list_t *code_word_list -); -void OpenAPI_service_type_unrelated_class_1_free(OpenAPI_service_type_unrelated_class_1_t *service_type_unrelated_class_1); -OpenAPI_service_type_unrelated_class_1_t *OpenAPI_service_type_unrelated_class_1_parseFromJSON(cJSON *service_type_unrelated_class_1JSON); -cJSON *OpenAPI_service_type_unrelated_class_1_convertToJSON(OpenAPI_service_type_unrelated_class_1_t *service_type_unrelated_class_1); -OpenAPI_service_type_unrelated_class_1_t *OpenAPI_service_type_unrelated_class_1_copy(OpenAPI_service_type_unrelated_class_1_t *dst, OpenAPI_service_type_unrelated_class_1_t *src); - -#ifdef __cplusplus -} -#endif - -#endif /* _OpenAPI_service_type_unrelated_class_1_H_ */ - diff --git a/lib/sbi/openapi/model/serving_nf_identity.c b/lib/sbi/openapi/model/serving_nf_identity.c index 0996be885..d98cf2a63 100644 --- a/lib/sbi/openapi/model/serving_nf_identity.c +++ b/lib/sbi/openapi/model/serving_nf_identity.c @@ -7,7 +7,8 @@ OpenAPI_serving_nf_identity_t *OpenAPI_serving_nf_identity_create( char *serv_nf_inst_id, OpenAPI_guami_t *guami, - OpenAPI_an_gw_address_t *an_gw_addr + OpenAPI_an_gw_address_t *an_gw_addr, + OpenAPI_sgsn_address_t *sgsn_addr ) { OpenAPI_serving_nf_identity_t *serving_nf_identity_local_var = ogs_malloc(sizeof(OpenAPI_serving_nf_identity_t)); @@ -16,6 +17,7 @@ OpenAPI_serving_nf_identity_t *OpenAPI_serving_nf_identity_create( serving_nf_identity_local_var->serv_nf_inst_id = serv_nf_inst_id; serving_nf_identity_local_var->guami = guami; serving_nf_identity_local_var->an_gw_addr = an_gw_addr; + serving_nf_identity_local_var->sgsn_addr = sgsn_addr; return serving_nf_identity_local_var; } @@ -39,6 +41,10 @@ void OpenAPI_serving_nf_identity_free(OpenAPI_serving_nf_identity_t *serving_nf_ OpenAPI_an_gw_address_free(serving_nf_identity->an_gw_addr); serving_nf_identity->an_gw_addr = NULL; } + if (serving_nf_identity->sgsn_addr) { + OpenAPI_sgsn_address_free(serving_nf_identity->sgsn_addr); + serving_nf_identity->sgsn_addr = NULL; + } ogs_free(serving_nf_identity); } @@ -86,6 +92,19 @@ cJSON *OpenAPI_serving_nf_identity_convertToJSON(OpenAPI_serving_nf_identity_t * } } + if (serving_nf_identity->sgsn_addr) { + cJSON *sgsn_addr_local_JSON = OpenAPI_sgsn_address_convertToJSON(serving_nf_identity->sgsn_addr); + if (sgsn_addr_local_JSON == NULL) { + ogs_error("OpenAPI_serving_nf_identity_convertToJSON() failed [sgsn_addr]"); + goto end; + } + cJSON_AddItemToObject(item, "sgsnAddr", sgsn_addr_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_serving_nf_identity_convertToJSON() failed [sgsn_addr]"); + goto end; + } + } + end: return item; } @@ -99,6 +118,8 @@ OpenAPI_serving_nf_identity_t *OpenAPI_serving_nf_identity_parseFromJSON(cJSON * OpenAPI_guami_t *guami_local_nonprim = NULL; cJSON *an_gw_addr = NULL; OpenAPI_an_gw_address_t *an_gw_addr_local_nonprim = NULL; + cJSON *sgsn_addr = NULL; + OpenAPI_sgsn_address_t *sgsn_addr_local_nonprim = NULL; serv_nf_inst_id = cJSON_GetObjectItemCaseSensitive(serving_nf_identityJSON, "servNfInstId"); if (serv_nf_inst_id) { if (!cJSON_IsString(serv_nf_inst_id) && !cJSON_IsNull(serv_nf_inst_id)) { @@ -117,10 +138,16 @@ OpenAPI_serving_nf_identity_t *OpenAPI_serving_nf_identity_parseFromJSON(cJSON * an_gw_addr_local_nonprim = OpenAPI_an_gw_address_parseFromJSON(an_gw_addr); } + sgsn_addr = cJSON_GetObjectItemCaseSensitive(serving_nf_identityJSON, "sgsnAddr"); + if (sgsn_addr) { + sgsn_addr_local_nonprim = OpenAPI_sgsn_address_parseFromJSON(sgsn_addr); + } + serving_nf_identity_local_var = OpenAPI_serving_nf_identity_create ( serv_nf_inst_id && !cJSON_IsNull(serv_nf_inst_id) ? ogs_strdup(serv_nf_inst_id->valuestring) : NULL, guami ? guami_local_nonprim : NULL, - an_gw_addr ? an_gw_addr_local_nonprim : NULL + an_gw_addr ? an_gw_addr_local_nonprim : NULL, + sgsn_addr ? sgsn_addr_local_nonprim : NULL ); return serving_nf_identity_local_var; @@ -133,6 +160,10 @@ end: OpenAPI_an_gw_address_free(an_gw_addr_local_nonprim); an_gw_addr_local_nonprim = NULL; } + if (sgsn_addr_local_nonprim) { + OpenAPI_sgsn_address_free(sgsn_addr_local_nonprim); + sgsn_addr_local_nonprim = NULL; + } return NULL; } diff --git a/lib/sbi/openapi/model/serving_nf_identity.h b/lib/sbi/openapi/model/serving_nf_identity.h index 7bc3a921d..fb53ed472 100644 --- a/lib/sbi/openapi/model/serving_nf_identity.h +++ b/lib/sbi/openapi/model/serving_nf_identity.h @@ -1,7 +1,7 @@ /* * serving_nf_identity.h * - * + * Contains the serving Network Function identity. */ #ifndef _OpenAPI_serving_nf_identity_H_ @@ -14,6 +14,7 @@ #include "../include/binary.h" #include "an_gw_address.h" #include "guami.h" +#include "sgsn_address.h" #ifdef __cplusplus extern "C" { @@ -24,12 +25,14 @@ typedef struct OpenAPI_serving_nf_identity_s { char *serv_nf_inst_id; struct OpenAPI_guami_s *guami; struct OpenAPI_an_gw_address_s *an_gw_addr; + struct OpenAPI_sgsn_address_s *sgsn_addr; } OpenAPI_serving_nf_identity_t; OpenAPI_serving_nf_identity_t *OpenAPI_serving_nf_identity_create( char *serv_nf_inst_id, OpenAPI_guami_t *guami, - OpenAPI_an_gw_address_t *an_gw_addr + OpenAPI_an_gw_address_t *an_gw_addr, + OpenAPI_sgsn_address_t *sgsn_addr ); void OpenAPI_serving_nf_identity_free(OpenAPI_serving_nf_identity_t *serving_nf_identity); OpenAPI_serving_nf_identity_t *OpenAPI_serving_nf_identity_parseFromJSON(cJSON *serving_nf_identityJSON); diff --git a/lib/sbi/openapi/model/sess_inact_timer_for_ue_comm.c b/lib/sbi/openapi/model/sess_inact_timer_for_ue_comm.c new file mode 100644 index 000000000..9d04a9f92 --- /dev/null +++ b/lib/sbi/openapi/model/sess_inact_timer_for_ue_comm.c @@ -0,0 +1,127 @@ + +#include +#include +#include +#include "sess_inact_timer_for_ue_comm.h" + +OpenAPI_sess_inact_timer_for_ue_comm_t *OpenAPI_sess_inact_timer_for_ue_comm_create( + int n4_sess_id, + int sess_inactive_timer +) +{ + OpenAPI_sess_inact_timer_for_ue_comm_t *sess_inact_timer_for_ue_comm_local_var = ogs_malloc(sizeof(OpenAPI_sess_inact_timer_for_ue_comm_t)); + ogs_assert(sess_inact_timer_for_ue_comm_local_var); + + sess_inact_timer_for_ue_comm_local_var->n4_sess_id = n4_sess_id; + sess_inact_timer_for_ue_comm_local_var->sess_inactive_timer = sess_inactive_timer; + + return sess_inact_timer_for_ue_comm_local_var; +} + +void OpenAPI_sess_inact_timer_for_ue_comm_free(OpenAPI_sess_inact_timer_for_ue_comm_t *sess_inact_timer_for_ue_comm) +{ + OpenAPI_lnode_t *node = NULL; + + if (NULL == sess_inact_timer_for_ue_comm) { + return; + } + ogs_free(sess_inact_timer_for_ue_comm); +} + +cJSON *OpenAPI_sess_inact_timer_for_ue_comm_convertToJSON(OpenAPI_sess_inact_timer_for_ue_comm_t *sess_inact_timer_for_ue_comm) +{ + cJSON *item = NULL; + OpenAPI_lnode_t *node = NULL; + + if (sess_inact_timer_for_ue_comm == NULL) { + ogs_error("OpenAPI_sess_inact_timer_for_ue_comm_convertToJSON() failed [SessInactTimerForUeComm]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (cJSON_AddNumberToObject(item, "n4SessId", sess_inact_timer_for_ue_comm->n4_sess_id) == NULL) { + ogs_error("OpenAPI_sess_inact_timer_for_ue_comm_convertToJSON() failed [n4_sess_id]"); + goto end; + } + + if (cJSON_AddNumberToObject(item, "sessInactiveTimer", sess_inact_timer_for_ue_comm->sess_inactive_timer) == NULL) { + ogs_error("OpenAPI_sess_inact_timer_for_ue_comm_convertToJSON() failed [sess_inactive_timer]"); + goto end; + } + +end: + return item; +} + +OpenAPI_sess_inact_timer_for_ue_comm_t *OpenAPI_sess_inact_timer_for_ue_comm_parseFromJSON(cJSON *sess_inact_timer_for_ue_commJSON) +{ + OpenAPI_sess_inact_timer_for_ue_comm_t *sess_inact_timer_for_ue_comm_local_var = NULL; + OpenAPI_lnode_t *node = NULL; + cJSON *n4_sess_id = NULL; + cJSON *sess_inactive_timer = NULL; + n4_sess_id = cJSON_GetObjectItemCaseSensitive(sess_inact_timer_for_ue_commJSON, "n4SessId"); + if (!n4_sess_id) { + ogs_error("OpenAPI_sess_inact_timer_for_ue_comm_parseFromJSON() failed [n4_sess_id]"); + goto end; + } + if (!cJSON_IsNumber(n4_sess_id)) { + ogs_error("OpenAPI_sess_inact_timer_for_ue_comm_parseFromJSON() failed [n4_sess_id]"); + goto end; + } + + sess_inactive_timer = cJSON_GetObjectItemCaseSensitive(sess_inact_timer_for_ue_commJSON, "sessInactiveTimer"); + if (!sess_inactive_timer) { + ogs_error("OpenAPI_sess_inact_timer_for_ue_comm_parseFromJSON() failed [sess_inactive_timer]"); + goto end; + } + if (!cJSON_IsNumber(sess_inactive_timer)) { + ogs_error("OpenAPI_sess_inact_timer_for_ue_comm_parseFromJSON() failed [sess_inactive_timer]"); + goto end; + } + + sess_inact_timer_for_ue_comm_local_var = OpenAPI_sess_inact_timer_for_ue_comm_create ( + + n4_sess_id->valuedouble, + + sess_inactive_timer->valuedouble + ); + + return sess_inact_timer_for_ue_comm_local_var; +end: + return NULL; +} + +OpenAPI_sess_inact_timer_for_ue_comm_t *OpenAPI_sess_inact_timer_for_ue_comm_copy(OpenAPI_sess_inact_timer_for_ue_comm_t *dst, OpenAPI_sess_inact_timer_for_ue_comm_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_sess_inact_timer_for_ue_comm_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_sess_inact_timer_for_ue_comm_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_sess_inact_timer_for_ue_comm_free(dst); + dst = OpenAPI_sess_inact_timer_for_ue_comm_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/sess_inact_timer_for_ue_comm.h b/lib/sbi/openapi/model/sess_inact_timer_for_ue_comm.h new file mode 100644 index 000000000..d8620d891 --- /dev/null +++ b/lib/sbi/openapi/model/sess_inact_timer_for_ue_comm.h @@ -0,0 +1,40 @@ +/* + * sess_inact_timer_for_ue_comm.h + * + * Represents the N4 Session inactivity timer. + */ + +#ifndef _OpenAPI_sess_inact_timer_for_ue_comm_H_ +#define _OpenAPI_sess_inact_timer_for_ue_comm_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_sess_inact_timer_for_ue_comm_s OpenAPI_sess_inact_timer_for_ue_comm_t; +typedef struct OpenAPI_sess_inact_timer_for_ue_comm_s { + int n4_sess_id; + int sess_inactive_timer; +} OpenAPI_sess_inact_timer_for_ue_comm_t; + +OpenAPI_sess_inact_timer_for_ue_comm_t *OpenAPI_sess_inact_timer_for_ue_comm_create( + int n4_sess_id, + int sess_inactive_timer +); +void OpenAPI_sess_inact_timer_for_ue_comm_free(OpenAPI_sess_inact_timer_for_ue_comm_t *sess_inact_timer_for_ue_comm); +OpenAPI_sess_inact_timer_for_ue_comm_t *OpenAPI_sess_inact_timer_for_ue_comm_parseFromJSON(cJSON *sess_inact_timer_for_ue_commJSON); +cJSON *OpenAPI_sess_inact_timer_for_ue_comm_convertToJSON(OpenAPI_sess_inact_timer_for_ue_comm_t *sess_inact_timer_for_ue_comm); +OpenAPI_sess_inact_timer_for_ue_comm_t *OpenAPI_sess_inact_timer_for_ue_comm_copy(OpenAPI_sess_inact_timer_for_ue_comm_t *dst, OpenAPI_sess_inact_timer_for_ue_comm_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_sess_inact_timer_for_ue_comm_H_ */ + diff --git a/lib/sbi/openapi/model/session_management_subscription_data.c b/lib/sbi/openapi/model/session_management_subscription_data.c index 364b9576f..b6467ac0c 100644 --- a/lib/sbi/openapi/model/session_management_subscription_data.c +++ b/lib/sbi/openapi/model/session_management_subscription_data.c @@ -15,7 +15,8 @@ OpenAPI_session_management_subscription_data_t *OpenAPI_session_management_subsc char *shared_trace_data_id, OpenAPI_list_t* expected_ue_behaviours_list, OpenAPI_list_t* suggested_packet_num_dl_list, - char *_3gpp_charging_characteristics + char *_3gpp_charging_characteristics, + char *supported_features ) { OpenAPI_session_management_subscription_data_t *session_management_subscription_data_local_var = ogs_malloc(sizeof(OpenAPI_session_management_subscription_data_t)); @@ -32,6 +33,7 @@ OpenAPI_session_management_subscription_data_t *OpenAPI_session_management_subsc session_management_subscription_data_local_var->expected_ue_behaviours_list = expected_ue_behaviours_list; session_management_subscription_data_local_var->suggested_packet_num_dl_list = suggested_packet_num_dl_list; session_management_subscription_data_local_var->_3gpp_charging_characteristics = _3gpp_charging_characteristics; + session_management_subscription_data_local_var->supported_features = supported_features; return session_management_subscription_data_local_var; } @@ -110,6 +112,10 @@ void OpenAPI_session_management_subscription_data_free(OpenAPI_session_managemen ogs_free(session_management_subscription_data->_3gpp_charging_characteristics); session_management_subscription_data->_3gpp_charging_characteristics = NULL; } + if (session_management_subscription_data->supported_features) { + ogs_free(session_management_subscription_data->supported_features); + session_management_subscription_data->supported_features = NULL; + } ogs_free(session_management_subscription_data); } @@ -278,6 +284,13 @@ cJSON *OpenAPI_session_management_subscription_data_convertToJSON(OpenAPI_sessio } } + if (session_management_subscription_data->supported_features) { + if (cJSON_AddStringToObject(item, "supportedFeatures", session_management_subscription_data->supported_features) == NULL) { + ogs_error("OpenAPI_session_management_subscription_data_convertToJSON() failed [supported_features]"); + goto end; + } + } + end: return item; } @@ -305,6 +318,7 @@ OpenAPI_session_management_subscription_data_t *OpenAPI_session_management_subsc cJSON *suggested_packet_num_dl_list = NULL; OpenAPI_list_t *suggested_packet_num_dl_listList = NULL; cJSON *_3gpp_charging_characteristics = NULL; + cJSON *supported_features = NULL; single_nssai = cJSON_GetObjectItemCaseSensitive(session_management_subscription_dataJSON, "singleNssai"); if (!single_nssai) { ogs_error("OpenAPI_session_management_subscription_data_parseFromJSON() failed [single_nssai]"); @@ -473,6 +487,14 @@ OpenAPI_session_management_subscription_data_t *OpenAPI_session_management_subsc } } + supported_features = cJSON_GetObjectItemCaseSensitive(session_management_subscription_dataJSON, "supportedFeatures"); + if (supported_features) { + if (!cJSON_IsString(supported_features) && !cJSON_IsNull(supported_features)) { + ogs_error("OpenAPI_session_management_subscription_data_parseFromJSON() failed [supported_features]"); + goto end; + } + } + session_management_subscription_data_local_var = OpenAPI_session_management_subscription_data_create ( single_nssai_local_nonprim, dnn_configurations ? dnn_configurationsList : NULL, @@ -484,7 +506,8 @@ OpenAPI_session_management_subscription_data_t *OpenAPI_session_management_subsc shared_trace_data_id && !cJSON_IsNull(shared_trace_data_id) ? ogs_strdup(shared_trace_data_id->valuestring) : NULL, expected_ue_behaviours_list ? expected_ue_behaviours_listList : NULL, suggested_packet_num_dl_list ? suggested_packet_num_dl_listList : NULL, - _3gpp_charging_characteristics && !cJSON_IsNull(_3gpp_charging_characteristics) ? ogs_strdup(_3gpp_charging_characteristics->valuestring) : NULL + _3gpp_charging_characteristics && !cJSON_IsNull(_3gpp_charging_characteristics) ? ogs_strdup(_3gpp_charging_characteristics->valuestring) : NULL, + supported_features && !cJSON_IsNull(supported_features) ? ogs_strdup(supported_features->valuestring) : NULL ); return session_management_subscription_data_local_var; diff --git a/lib/sbi/openapi/model/session_management_subscription_data.h b/lib/sbi/openapi/model/session_management_subscription_data.h index 06d7ddf8e..cde1aab56 100644 --- a/lib/sbi/openapi/model/session_management_subscription_data.h +++ b/lib/sbi/openapi/model/session_management_subscription_data.h @@ -36,6 +36,7 @@ typedef struct OpenAPI_session_management_subscription_data_s { OpenAPI_list_t* expected_ue_behaviours_list; OpenAPI_list_t* suggested_packet_num_dl_list; char *_3gpp_charging_characteristics; + char *supported_features; } OpenAPI_session_management_subscription_data_t; OpenAPI_session_management_subscription_data_t *OpenAPI_session_management_subscription_data_create( @@ -49,7 +50,8 @@ OpenAPI_session_management_subscription_data_t *OpenAPI_session_management_subsc char *shared_trace_data_id, OpenAPI_list_t* expected_ue_behaviours_list, OpenAPI_list_t* suggested_packet_num_dl_list, - char *_3gpp_charging_characteristics + char *_3gpp_charging_characteristics, + char *supported_features ); void OpenAPI_session_management_subscription_data_free(OpenAPI_session_management_subscription_data_t *session_management_subscription_data); OpenAPI_session_management_subscription_data_t *OpenAPI_session_management_subscription_data_parseFromJSON(cJSON *session_management_subscription_dataJSON); diff --git a/lib/sbi/openapi/model/session_management_subscription_data_1.c b/lib/sbi/openapi/model/session_management_subscription_data_1.c index c898ef98b..29f4b03f0 100644 --- a/lib/sbi/openapi/model/session_management_subscription_data_1.c +++ b/lib/sbi/openapi/model/session_management_subscription_data_1.c @@ -15,7 +15,8 @@ OpenAPI_session_management_subscription_data_1_t *OpenAPI_session_management_sub char *shared_trace_data_id, OpenAPI_list_t* expected_ue_behaviours_list, OpenAPI_list_t* suggested_packet_num_dl_list, - char *_3gpp_charging_characteristics + char *_3gpp_charging_characteristics, + char *supported_features ) { OpenAPI_session_management_subscription_data_1_t *session_management_subscription_data_1_local_var = ogs_malloc(sizeof(OpenAPI_session_management_subscription_data_1_t)); @@ -32,6 +33,7 @@ OpenAPI_session_management_subscription_data_1_t *OpenAPI_session_management_sub session_management_subscription_data_1_local_var->expected_ue_behaviours_list = expected_ue_behaviours_list; session_management_subscription_data_1_local_var->suggested_packet_num_dl_list = suggested_packet_num_dl_list; session_management_subscription_data_1_local_var->_3gpp_charging_characteristics = _3gpp_charging_characteristics; + session_management_subscription_data_1_local_var->supported_features = supported_features; return session_management_subscription_data_1_local_var; } @@ -110,6 +112,10 @@ void OpenAPI_session_management_subscription_data_1_free(OpenAPI_session_managem ogs_free(session_management_subscription_data_1->_3gpp_charging_characteristics); session_management_subscription_data_1->_3gpp_charging_characteristics = NULL; } + if (session_management_subscription_data_1->supported_features) { + ogs_free(session_management_subscription_data_1->supported_features); + session_management_subscription_data_1->supported_features = NULL; + } ogs_free(session_management_subscription_data_1); } @@ -278,6 +284,13 @@ cJSON *OpenAPI_session_management_subscription_data_1_convertToJSON(OpenAPI_sess } } + if (session_management_subscription_data_1->supported_features) { + if (cJSON_AddStringToObject(item, "supportedFeatures", session_management_subscription_data_1->supported_features) == NULL) { + ogs_error("OpenAPI_session_management_subscription_data_1_convertToJSON() failed [supported_features]"); + goto end; + } + } + end: return item; } @@ -305,6 +318,7 @@ OpenAPI_session_management_subscription_data_1_t *OpenAPI_session_management_sub cJSON *suggested_packet_num_dl_list = NULL; OpenAPI_list_t *suggested_packet_num_dl_listList = NULL; cJSON *_3gpp_charging_characteristics = NULL; + cJSON *supported_features = NULL; single_nssai = cJSON_GetObjectItemCaseSensitive(session_management_subscription_data_1JSON, "singleNssai"); if (!single_nssai) { ogs_error("OpenAPI_session_management_subscription_data_1_parseFromJSON() failed [single_nssai]"); @@ -473,6 +487,14 @@ OpenAPI_session_management_subscription_data_1_t *OpenAPI_session_management_sub } } + supported_features = cJSON_GetObjectItemCaseSensitive(session_management_subscription_data_1JSON, "supportedFeatures"); + if (supported_features) { + if (!cJSON_IsString(supported_features) && !cJSON_IsNull(supported_features)) { + ogs_error("OpenAPI_session_management_subscription_data_1_parseFromJSON() failed [supported_features]"); + goto end; + } + } + session_management_subscription_data_1_local_var = OpenAPI_session_management_subscription_data_1_create ( single_nssai_local_nonprim, dnn_configurations ? dnn_configurationsList : NULL, @@ -484,7 +506,8 @@ OpenAPI_session_management_subscription_data_1_t *OpenAPI_session_management_sub shared_trace_data_id && !cJSON_IsNull(shared_trace_data_id) ? ogs_strdup(shared_trace_data_id->valuestring) : NULL, expected_ue_behaviours_list ? expected_ue_behaviours_listList : NULL, suggested_packet_num_dl_list ? suggested_packet_num_dl_listList : NULL, - _3gpp_charging_characteristics && !cJSON_IsNull(_3gpp_charging_characteristics) ? ogs_strdup(_3gpp_charging_characteristics->valuestring) : NULL + _3gpp_charging_characteristics && !cJSON_IsNull(_3gpp_charging_characteristics) ? ogs_strdup(_3gpp_charging_characteristics->valuestring) : NULL, + supported_features && !cJSON_IsNull(supported_features) ? ogs_strdup(supported_features->valuestring) : NULL ); return session_management_subscription_data_1_local_var; diff --git a/lib/sbi/openapi/model/session_management_subscription_data_1.h b/lib/sbi/openapi/model/session_management_subscription_data_1.h index 08561ef86..7cecfb3c5 100644 --- a/lib/sbi/openapi/model/session_management_subscription_data_1.h +++ b/lib/sbi/openapi/model/session_management_subscription_data_1.h @@ -36,6 +36,7 @@ typedef struct OpenAPI_session_management_subscription_data_1_s { OpenAPI_list_t* expected_ue_behaviours_list; OpenAPI_list_t* suggested_packet_num_dl_list; char *_3gpp_charging_characteristics; + char *supported_features; } OpenAPI_session_management_subscription_data_1_t; OpenAPI_session_management_subscription_data_1_t *OpenAPI_session_management_subscription_data_1_create( @@ -49,7 +50,8 @@ OpenAPI_session_management_subscription_data_1_t *OpenAPI_session_management_sub char *shared_trace_data_id, OpenAPI_list_t* expected_ue_behaviours_list, OpenAPI_list_t* suggested_packet_num_dl_list, - char *_3gpp_charging_characteristics + char *_3gpp_charging_characteristics, + char *supported_features ); void OpenAPI_session_management_subscription_data_1_free(OpenAPI_session_management_subscription_data_1_t *session_management_subscription_data_1); OpenAPI_session_management_subscription_data_1_t *OpenAPI_session_management_subscription_data_1_parseFromJSON(cJSON *session_management_subscription_data_1JSON); diff --git a/lib/sbi/openapi/model/session_rule.h b/lib/sbi/openapi/model/session_rule.h index ee143d69f..d15a72c2e 100644 --- a/lib/sbi/openapi/model/session_rule.h +++ b/lib/sbi/openapi/model/session_rule.h @@ -1,7 +1,7 @@ /* * session_rule.h * - * + * Contains session level policy information. */ #ifndef _OpenAPI_session_rule_H_ diff --git a/lib/sbi/openapi/model/session_rule_failure_code.c b/lib/sbi/openapi/model/session_rule_failure_code.c index 4b6e0753c..236d08e16 100644 --- a/lib/sbi/openapi/model/session_rule_failure_code.c +++ b/lib/sbi/openapi/model/session_rule_failure_code.c @@ -6,7 +6,7 @@ char* OpenAPI_session_rule_failure_code_ToString(OpenAPI_session_rule_failure_code_e session_rule_failure_code) { - const char *session_rule_failure_codeArray[] = { "NULL", "NF_MAL", "RES_LIM", "UNSUCC_QOS_VAL", "UE_STA_SUSP" }; + const char *session_rule_failure_codeArray[] = { "NULL", "NF_MAL", "RES_LIM", "SESSION_RESOURCE_ALLOCATION_FAILURE", "UNSUCC_QOS_VAL", "INCORRECT_UM", "UE_STA_SUSP", "UNKNOWN_REF_ID", "INCORRECT_COND_DATA", "REF_ID_COLLISION", "AN_GW_FAILED" }; size_t sizeofArray = sizeof(session_rule_failure_codeArray) / sizeof(session_rule_failure_codeArray[0]); if (session_rule_failure_code < sizeofArray) return (char *)session_rule_failure_codeArray[session_rule_failure_code]; @@ -17,7 +17,7 @@ char* OpenAPI_session_rule_failure_code_ToString(OpenAPI_session_rule_failure_co OpenAPI_session_rule_failure_code_e OpenAPI_session_rule_failure_code_FromString(char* session_rule_failure_code) { int stringToReturn = 0; - const char *session_rule_failure_codeArray[] = { "NULL", "NF_MAL", "RES_LIM", "UNSUCC_QOS_VAL", "UE_STA_SUSP" }; + const char *session_rule_failure_codeArray[] = { "NULL", "NF_MAL", "RES_LIM", "SESSION_RESOURCE_ALLOCATION_FAILURE", "UNSUCC_QOS_VAL", "INCORRECT_UM", "UE_STA_SUSP", "UNKNOWN_REF_ID", "INCORRECT_COND_DATA", "REF_ID_COLLISION", "AN_GW_FAILED" }; size_t sizeofArray = sizeof(session_rule_failure_codeArray) / sizeof(session_rule_failure_codeArray[0]); while (stringToReturn < sizeofArray) { if (strcmp(session_rule_failure_code, session_rule_failure_codeArray[stringToReturn]) == 0) { diff --git a/lib/sbi/openapi/model/session_rule_failure_code.h b/lib/sbi/openapi/model/session_rule_failure_code.h index a0d44d06a..81e25f67d 100644 --- a/lib/sbi/openapi/model/session_rule_failure_code.h +++ b/lib/sbi/openapi/model/session_rule_failure_code.h @@ -17,7 +17,7 @@ extern "C" { #endif -typedef enum { OpenAPI_session_rule_failure_code_NULL = 0, OpenAPI_session_rule_failure_code_NF_MAL, OpenAPI_session_rule_failure_code_RES_LIM, OpenAPI_session_rule_failure_code_UNSUCC_QOS_VAL, OpenAPI_session_rule_failure_code_UE_STA_SUSP } OpenAPI_session_rule_failure_code_e; +typedef enum { OpenAPI_session_rule_failure_code_NULL = 0, OpenAPI_session_rule_failure_code_NF_MAL, OpenAPI_session_rule_failure_code_RES_LIM, OpenAPI_session_rule_failure_code_SESSION_RESOURCE_ALLOCATION_FAILURE, OpenAPI_session_rule_failure_code_UNSUCC_QOS_VAL, OpenAPI_session_rule_failure_code_INCORRECT_UM, OpenAPI_session_rule_failure_code_UE_STA_SUSP, OpenAPI_session_rule_failure_code_UNKNOWN_REF_ID, OpenAPI_session_rule_failure_code_INCORRECT_COND_DATA, OpenAPI_session_rule_failure_code_REF_ID_COLLISION, OpenAPI_session_rule_failure_code_AN_GW_FAILED } OpenAPI_session_rule_failure_code_e; char* OpenAPI_session_rule_failure_code_ToString(OpenAPI_session_rule_failure_code_e session_rule_failure_code); diff --git a/lib/sbi/openapi/model/session_rule_report.h b/lib/sbi/openapi/model/session_rule_report.h index 4b6f8c093..f8d95af92 100644 --- a/lib/sbi/openapi/model/session_rule_report.h +++ b/lib/sbi/openapi/model/session_rule_report.h @@ -1,7 +1,7 @@ /* * session_rule_report.h * - * + * Represents reporting of the status of a session rule. */ #ifndef _OpenAPI_session_rule_report_H_ diff --git a/lib/sbi/openapi/model/sgsn_address.c b/lib/sbi/openapi/model/sgsn_address.c new file mode 100644 index 000000000..5061dd80f --- /dev/null +++ b/lib/sbi/openapi/model/sgsn_address.c @@ -0,0 +1,133 @@ + +#include +#include +#include +#include "sgsn_address.h" + +OpenAPI_sgsn_address_t *OpenAPI_sgsn_address_create( + char *sgsn_ipv4_addr, + char *sgsn_ipv6_addr +) +{ + OpenAPI_sgsn_address_t *sgsn_address_local_var = ogs_malloc(sizeof(OpenAPI_sgsn_address_t)); + ogs_assert(sgsn_address_local_var); + + sgsn_address_local_var->sgsn_ipv4_addr = sgsn_ipv4_addr; + sgsn_address_local_var->sgsn_ipv6_addr = sgsn_ipv6_addr; + + return sgsn_address_local_var; +} + +void OpenAPI_sgsn_address_free(OpenAPI_sgsn_address_t *sgsn_address) +{ + OpenAPI_lnode_t *node = NULL; + + if (NULL == sgsn_address) { + return; + } + if (sgsn_address->sgsn_ipv4_addr) { + ogs_free(sgsn_address->sgsn_ipv4_addr); + sgsn_address->sgsn_ipv4_addr = NULL; + } + if (sgsn_address->sgsn_ipv6_addr) { + ogs_free(sgsn_address->sgsn_ipv6_addr); + sgsn_address->sgsn_ipv6_addr = NULL; + } + ogs_free(sgsn_address); +} + +cJSON *OpenAPI_sgsn_address_convertToJSON(OpenAPI_sgsn_address_t *sgsn_address) +{ + cJSON *item = NULL; + OpenAPI_lnode_t *node = NULL; + + if (sgsn_address == NULL) { + ogs_error("OpenAPI_sgsn_address_convertToJSON() failed [SgsnAddress]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (sgsn_address->sgsn_ipv4_addr) { + if (cJSON_AddStringToObject(item, "sgsnIpv4Addr", sgsn_address->sgsn_ipv4_addr) == NULL) { + ogs_error("OpenAPI_sgsn_address_convertToJSON() failed [sgsn_ipv4_addr]"); + goto end; + } + } + + if (sgsn_address->sgsn_ipv6_addr) { + if (cJSON_AddStringToObject(item, "sgsnIpv6Addr", sgsn_address->sgsn_ipv6_addr) == NULL) { + ogs_error("OpenAPI_sgsn_address_convertToJSON() failed [sgsn_ipv6_addr]"); + goto end; + } + } + +end: + return item; +} + +OpenAPI_sgsn_address_t *OpenAPI_sgsn_address_parseFromJSON(cJSON *sgsn_addressJSON) +{ + OpenAPI_sgsn_address_t *sgsn_address_local_var = NULL; + OpenAPI_lnode_t *node = NULL; + cJSON *sgsn_ipv4_addr = NULL; + cJSON *sgsn_ipv6_addr = NULL; + sgsn_ipv4_addr = cJSON_GetObjectItemCaseSensitive(sgsn_addressJSON, "sgsnIpv4Addr"); + if (sgsn_ipv4_addr) { + if (!cJSON_IsString(sgsn_ipv4_addr) && !cJSON_IsNull(sgsn_ipv4_addr)) { + ogs_error("OpenAPI_sgsn_address_parseFromJSON() failed [sgsn_ipv4_addr]"); + goto end; + } + } + + sgsn_ipv6_addr = cJSON_GetObjectItemCaseSensitive(sgsn_addressJSON, "sgsnIpv6Addr"); + if (sgsn_ipv6_addr) { + if (!cJSON_IsString(sgsn_ipv6_addr) && !cJSON_IsNull(sgsn_ipv6_addr)) { + ogs_error("OpenAPI_sgsn_address_parseFromJSON() failed [sgsn_ipv6_addr]"); + goto end; + } + } + + sgsn_address_local_var = OpenAPI_sgsn_address_create ( + sgsn_ipv4_addr && !cJSON_IsNull(sgsn_ipv4_addr) ? ogs_strdup(sgsn_ipv4_addr->valuestring) : NULL, + sgsn_ipv6_addr && !cJSON_IsNull(sgsn_ipv6_addr) ? ogs_strdup(sgsn_ipv6_addr->valuestring) : NULL + ); + + return sgsn_address_local_var; +end: + return NULL; +} + +OpenAPI_sgsn_address_t *OpenAPI_sgsn_address_copy(OpenAPI_sgsn_address_t *dst, OpenAPI_sgsn_address_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_sgsn_address_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_sgsn_address_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_sgsn_address_free(dst); + dst = OpenAPI_sgsn_address_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/sgsn_address.h b/lib/sbi/openapi/model/sgsn_address.h new file mode 100644 index 000000000..e4b6556d6 --- /dev/null +++ b/lib/sbi/openapi/model/sgsn_address.h @@ -0,0 +1,40 @@ +/* + * sgsn_address.h + * + * describes the address of the SGSN + */ + +#ifndef _OpenAPI_sgsn_address_H_ +#define _OpenAPI_sgsn_address_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_sgsn_address_s OpenAPI_sgsn_address_t; +typedef struct OpenAPI_sgsn_address_s { + char *sgsn_ipv4_addr; + char *sgsn_ipv6_addr; +} OpenAPI_sgsn_address_t; + +OpenAPI_sgsn_address_t *OpenAPI_sgsn_address_create( + char *sgsn_ipv4_addr, + char *sgsn_ipv6_addr +); +void OpenAPI_sgsn_address_free(OpenAPI_sgsn_address_t *sgsn_address); +OpenAPI_sgsn_address_t *OpenAPI_sgsn_address_parseFromJSON(cJSON *sgsn_addressJSON); +cJSON *OpenAPI_sgsn_address_convertToJSON(OpenAPI_sgsn_address_t *sgsn_address); +OpenAPI_sgsn_address_t *OpenAPI_sgsn_address_copy(OpenAPI_sgsn_address_t *dst, OpenAPI_sgsn_address_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_sgsn_address_H_ */ + diff --git a/lib/sbi/openapi/model/shared_data.c b/lib/sbi/openapi/model/shared_data.c index 847974122..39835dd7e 100644 --- a/lib/sbi/openapi/model/shared_data.c +++ b/lib/sbi/openapi/model/shared_data.c @@ -12,7 +12,10 @@ OpenAPI_shared_data_t *OpenAPI_shared_data_create( OpenAPI_list_t* shared_dnn_configurations, OpenAPI_trace_data_t *shared_trace_data, OpenAPI_list_t* shared_snssai_infos, - OpenAPI_list_t* shared_vn_group_datas + OpenAPI_list_t* shared_vn_group_datas, + OpenAPI_list_t* treatment_instructions, + OpenAPI_session_management_subscription_data_t *shared_sm_subs_data, + OpenAPI_ecs_addr_config_info_t *shared_ecs_addr_config_info ) { OpenAPI_shared_data_t *shared_data_local_var = ogs_malloc(sizeof(OpenAPI_shared_data_t)); @@ -26,6 +29,9 @@ OpenAPI_shared_data_t *OpenAPI_shared_data_create( shared_data_local_var->shared_trace_data = shared_trace_data; shared_data_local_var->shared_snssai_infos = shared_snssai_infos; shared_data_local_var->shared_vn_group_datas = shared_vn_group_datas; + shared_data_local_var->treatment_instructions = treatment_instructions; + shared_data_local_var->shared_sm_subs_data = shared_sm_subs_data; + shared_data_local_var->shared_ecs_addr_config_info = shared_ecs_addr_config_info; return shared_data_local_var; } @@ -87,6 +93,23 @@ void OpenAPI_shared_data_free(OpenAPI_shared_data_t *shared_data) OpenAPI_list_free(shared_data->shared_vn_group_datas); shared_data->shared_vn_group_datas = NULL; } + if (shared_data->treatment_instructions) { + OpenAPI_list_for_each(shared_data->treatment_instructions, node) { + OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*)node->data; + ogs_free(localKeyValue->key); + OpenAPI_map_free(localKeyValue); + } + OpenAPI_list_free(shared_data->treatment_instructions); + shared_data->treatment_instructions = NULL; + } + if (shared_data->shared_sm_subs_data) { + OpenAPI_session_management_subscription_data_free(shared_data->shared_sm_subs_data); + shared_data->shared_sm_subs_data = NULL; + } + if (shared_data->shared_ecs_addr_config_info) { + OpenAPI_ecs_addr_config_info_free(shared_data->shared_ecs_addr_config_info); + shared_data->shared_ecs_addr_config_info = NULL; + } ogs_free(shared_data); } @@ -228,6 +251,50 @@ cJSON *OpenAPI_shared_data_convertToJSON(OpenAPI_shared_data_t *shared_data) } } + if (shared_data->treatment_instructions != OpenAPI_shared_data_treatment_instruction_NULL) { + cJSON *treatment_instructions = cJSON_AddObjectToObject(item, "treatmentInstructions"); + if (treatment_instructions == NULL) { + ogs_error("OpenAPI_shared_data_convertToJSON() failed [treatment_instructions]"); + goto end; + } + cJSON *localMapObject = treatment_instructions; + if (shared_data->treatment_instructions) { + OpenAPI_list_for_each(shared_data->treatment_instructions, node) { + OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*)node->data; + if (cJSON_AddStringToObject(localMapObject, localKeyValue->key, OpenAPI_shared_data_treatment_instruction_ToString((intptr_t)localKeyValue->value)) == NULL) { + ogs_error("OpenAPI_shared_data_convertToJSON() failed [treatment_instructions]"); + goto end; + } + } + } + } + + if (shared_data->shared_sm_subs_data) { + cJSON *shared_sm_subs_data_local_JSON = OpenAPI_session_management_subscription_data_convertToJSON(shared_data->shared_sm_subs_data); + if (shared_sm_subs_data_local_JSON == NULL) { + ogs_error("OpenAPI_shared_data_convertToJSON() failed [shared_sm_subs_data]"); + goto end; + } + cJSON_AddItemToObject(item, "sharedSmSubsData", shared_sm_subs_data_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_shared_data_convertToJSON() failed [shared_sm_subs_data]"); + goto end; + } + } + + if (shared_data->shared_ecs_addr_config_info) { + cJSON *shared_ecs_addr_config_info_local_JSON = OpenAPI_ecs_addr_config_info_convertToJSON(shared_data->shared_ecs_addr_config_info); + if (shared_ecs_addr_config_info_local_JSON == NULL) { + ogs_error("OpenAPI_shared_data_convertToJSON() failed [shared_ecs_addr_config_info]"); + goto end; + } + cJSON_AddItemToObject(item, "sharedEcsAddrConfigInfo", shared_ecs_addr_config_info_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_shared_data_convertToJSON() failed [shared_ecs_addr_config_info]"); + goto end; + } + } + end: return item; } @@ -251,6 +318,12 @@ OpenAPI_shared_data_t *OpenAPI_shared_data_parseFromJSON(cJSON *shared_dataJSON) OpenAPI_list_t *shared_snssai_infosList = NULL; cJSON *shared_vn_group_datas = NULL; OpenAPI_list_t *shared_vn_group_datasList = NULL; + cJSON *treatment_instructions = NULL; + OpenAPI_list_t *treatment_instructionsList = NULL; + cJSON *shared_sm_subs_data = NULL; + OpenAPI_session_management_subscription_data_t *shared_sm_subs_data_local_nonprim = NULL; + cJSON *shared_ecs_addr_config_info = NULL; + OpenAPI_ecs_addr_config_info_t *shared_ecs_addr_config_info_local_nonprim = NULL; shared_data_id = cJSON_GetObjectItemCaseSensitive(shared_dataJSON, "sharedDataId"); if (!shared_data_id) { ogs_error("OpenAPI_shared_data_parseFromJSON() failed [shared_data_id]"); @@ -359,6 +432,38 @@ OpenAPI_shared_data_t *OpenAPI_shared_data_parseFromJSON(cJSON *shared_dataJSON) } } + treatment_instructions = cJSON_GetObjectItemCaseSensitive(shared_dataJSON, "treatmentInstructions"); + if (treatment_instructions) { + cJSON *treatment_instructions_local_map = NULL; + if (!cJSON_IsObject(treatment_instructions) && !cJSON_IsNull(treatment_instructions)) { + ogs_error("OpenAPI_shared_data_parseFromJSON() failed [treatment_instructions]"); + goto end; + } + if (cJSON_IsObject(treatment_instructions)) { + treatment_instructionsList = OpenAPI_list_create(); + OpenAPI_map_t *localMapKeyPair = NULL; + cJSON_ArrayForEach(treatment_instructions_local_map, treatment_instructions) { + cJSON *localMapObject = treatment_instructions_local_map; + if (!cJSON_IsString(localMapObject)) { + ogs_error("OpenAPI_shared_data_parseFromJSON() failed [treatment_instructions]"); + goto end; + } + localMapKeyPair = OpenAPI_map_create(ogs_strdup(localMapObject->string), (void *)OpenAPI_shared_data_treatment_instruction_FromString(localMapObject->string)); + OpenAPI_list_add(treatment_instructionsList, localMapKeyPair); + } + } + } + + shared_sm_subs_data = cJSON_GetObjectItemCaseSensitive(shared_dataJSON, "sharedSmSubsData"); + if (shared_sm_subs_data) { + shared_sm_subs_data_local_nonprim = OpenAPI_session_management_subscription_data_parseFromJSON(shared_sm_subs_data); + } + + shared_ecs_addr_config_info = cJSON_GetObjectItemCaseSensitive(shared_dataJSON, "sharedEcsAddrConfigInfo"); + if (shared_ecs_addr_config_info) { + shared_ecs_addr_config_info_local_nonprim = OpenAPI_ecs_addr_config_info_parseFromJSON(shared_ecs_addr_config_info); + } + shared_data_local_var = OpenAPI_shared_data_create ( ogs_strdup(shared_data_id->valuestring), shared_am_data ? shared_am_data_local_nonprim : NULL, @@ -367,7 +472,10 @@ OpenAPI_shared_data_t *OpenAPI_shared_data_parseFromJSON(cJSON *shared_dataJSON) shared_dnn_configurations ? shared_dnn_configurationsList : NULL, shared_trace_data ? shared_trace_data_local_nonprim : NULL, shared_snssai_infos ? shared_snssai_infosList : NULL, - shared_vn_group_datas ? shared_vn_group_datasList : NULL + shared_vn_group_datas ? shared_vn_group_datasList : NULL, + treatment_instructions ? treatment_instructionsList : NULL, + shared_sm_subs_data ? shared_sm_subs_data_local_nonprim : NULL, + shared_ecs_addr_config_info ? shared_ecs_addr_config_info_local_nonprim : NULL ); return shared_data_local_var; @@ -418,6 +526,23 @@ end: OpenAPI_list_free(shared_vn_group_datasList); shared_vn_group_datasList = NULL; } + if (treatment_instructionsList) { + OpenAPI_list_for_each(treatment_instructionsList, node) { + OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*) node->data; + ogs_free(localKeyValue->key); + OpenAPI_map_free(localKeyValue); + } + OpenAPI_list_free(treatment_instructionsList); + treatment_instructionsList = NULL; + } + if (shared_sm_subs_data_local_nonprim) { + OpenAPI_session_management_subscription_data_free(shared_sm_subs_data_local_nonprim); + shared_sm_subs_data_local_nonprim = NULL; + } + if (shared_ecs_addr_config_info_local_nonprim) { + OpenAPI_ecs_addr_config_info_free(shared_ecs_addr_config_info_local_nonprim); + shared_ecs_addr_config_info_local_nonprim = NULL; + } return NULL; } diff --git a/lib/sbi/openapi/model/shared_data.h b/lib/sbi/openapi/model/shared_data.h index cdad9751f..1bb960ad8 100644 --- a/lib/sbi/openapi/model/shared_data.h +++ b/lib/sbi/openapi/model/shared_data.h @@ -14,6 +14,9 @@ #include "../include/binary.h" #include "access_and_mobility_subscription_data.h" #include "dnn_configuration.h" +#include "ecs_addr_config_info.h" +#include "session_management_subscription_data.h" +#include "shared_data_treatment_instruction.h" #include "sms_management_subscription_data.h" #include "sms_subscription_data.h" #include "snssai_info.h" @@ -34,6 +37,9 @@ typedef struct OpenAPI_shared_data_s { struct OpenAPI_trace_data_s *shared_trace_data; OpenAPI_list_t* shared_snssai_infos; OpenAPI_list_t* shared_vn_group_datas; + OpenAPI_list_t* treatment_instructions; + struct OpenAPI_session_management_subscription_data_s *shared_sm_subs_data; + struct OpenAPI_ecs_addr_config_info_s *shared_ecs_addr_config_info; } OpenAPI_shared_data_t; OpenAPI_shared_data_t *OpenAPI_shared_data_create( @@ -44,7 +50,10 @@ OpenAPI_shared_data_t *OpenAPI_shared_data_create( OpenAPI_list_t* shared_dnn_configurations, OpenAPI_trace_data_t *shared_trace_data, OpenAPI_list_t* shared_snssai_infos, - OpenAPI_list_t* shared_vn_group_datas + OpenAPI_list_t* shared_vn_group_datas, + OpenAPI_list_t* treatment_instructions, + OpenAPI_session_management_subscription_data_t *shared_sm_subs_data, + OpenAPI_ecs_addr_config_info_t *shared_ecs_addr_config_info ); void OpenAPI_shared_data_free(OpenAPI_shared_data_t *shared_data); OpenAPI_shared_data_t *OpenAPI_shared_data_parseFromJSON(cJSON *shared_dataJSON); diff --git a/lib/sbi/openapi/model/shared_data_id_range.c b/lib/sbi/openapi/model/shared_data_id_range.c new file mode 100644 index 000000000..d31e245c2 --- /dev/null +++ b/lib/sbi/openapi/model/shared_data_id_range.c @@ -0,0 +1,110 @@ + +#include +#include +#include +#include "shared_data_id_range.h" + +OpenAPI_shared_data_id_range_t *OpenAPI_shared_data_id_range_create( + char *pattern +) +{ + OpenAPI_shared_data_id_range_t *shared_data_id_range_local_var = ogs_malloc(sizeof(OpenAPI_shared_data_id_range_t)); + ogs_assert(shared_data_id_range_local_var); + + shared_data_id_range_local_var->pattern = pattern; + + return shared_data_id_range_local_var; +} + +void OpenAPI_shared_data_id_range_free(OpenAPI_shared_data_id_range_t *shared_data_id_range) +{ + OpenAPI_lnode_t *node = NULL; + + if (NULL == shared_data_id_range) { + return; + } + if (shared_data_id_range->pattern) { + ogs_free(shared_data_id_range->pattern); + shared_data_id_range->pattern = NULL; + } + ogs_free(shared_data_id_range); +} + +cJSON *OpenAPI_shared_data_id_range_convertToJSON(OpenAPI_shared_data_id_range_t *shared_data_id_range) +{ + cJSON *item = NULL; + OpenAPI_lnode_t *node = NULL; + + if (shared_data_id_range == NULL) { + ogs_error("OpenAPI_shared_data_id_range_convertToJSON() failed [SharedDataIdRange]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (shared_data_id_range->pattern) { + if (cJSON_AddStringToObject(item, "pattern", shared_data_id_range->pattern) == NULL) { + ogs_error("OpenAPI_shared_data_id_range_convertToJSON() failed [pattern]"); + goto end; + } + } + +end: + return item; +} + +OpenAPI_shared_data_id_range_t *OpenAPI_shared_data_id_range_parseFromJSON(cJSON *shared_data_id_rangeJSON) +{ + OpenAPI_shared_data_id_range_t *shared_data_id_range_local_var = NULL; + OpenAPI_lnode_t *node = NULL; + cJSON *pattern = NULL; + pattern = cJSON_GetObjectItemCaseSensitive(shared_data_id_rangeJSON, "pattern"); + if (pattern) { + if (!cJSON_IsString(pattern) && !cJSON_IsNull(pattern)) { + ogs_error("OpenAPI_shared_data_id_range_parseFromJSON() failed [pattern]"); + goto end; + } + } + + shared_data_id_range_local_var = OpenAPI_shared_data_id_range_create ( + pattern && !cJSON_IsNull(pattern) ? ogs_strdup(pattern->valuestring) : NULL + ); + + return shared_data_id_range_local_var; +end: + return NULL; +} + +OpenAPI_shared_data_id_range_t *OpenAPI_shared_data_id_range_copy(OpenAPI_shared_data_id_range_t *dst, OpenAPI_shared_data_id_range_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_shared_data_id_range_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_shared_data_id_range_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_shared_data_id_range_free(dst); + dst = OpenAPI_shared_data_id_range_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/shared_data_id_range.h b/lib/sbi/openapi/model/shared_data_id_range.h new file mode 100644 index 000000000..8e665a685 --- /dev/null +++ b/lib/sbi/openapi/model/shared_data_id_range.h @@ -0,0 +1,38 @@ +/* + * shared_data_id_range.h + * + * A range of SharedDataIds based on regular-expression matching + */ + +#ifndef _OpenAPI_shared_data_id_range_H_ +#define _OpenAPI_shared_data_id_range_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_shared_data_id_range_s OpenAPI_shared_data_id_range_t; +typedef struct OpenAPI_shared_data_id_range_s { + char *pattern; +} OpenAPI_shared_data_id_range_t; + +OpenAPI_shared_data_id_range_t *OpenAPI_shared_data_id_range_create( + char *pattern +); +void OpenAPI_shared_data_id_range_free(OpenAPI_shared_data_id_range_t *shared_data_id_range); +OpenAPI_shared_data_id_range_t *OpenAPI_shared_data_id_range_parseFromJSON(cJSON *shared_data_id_rangeJSON); +cJSON *OpenAPI_shared_data_id_range_convertToJSON(OpenAPI_shared_data_id_range_t *shared_data_id_range); +OpenAPI_shared_data_id_range_t *OpenAPI_shared_data_id_range_copy(OpenAPI_shared_data_id_range_t *dst, OpenAPI_shared_data_id_range_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_shared_data_id_range_H_ */ + diff --git a/lib/sbi/openapi/model/shared_data_treatment_instruction.c b/lib/sbi/openapi/model/shared_data_treatment_instruction.c new file mode 100644 index 000000000..d51b270ad --- /dev/null +++ b/lib/sbi/openapi/model/shared_data_treatment_instruction.c @@ -0,0 +1,30 @@ + +#include +#include +#include +#include "shared_data_treatment_instruction.h" + +char* OpenAPI_shared_data_treatment_instruction_ToString(OpenAPI_shared_data_treatment_instruction_e shared_data_treatment_instruction) +{ + const char *shared_data_treatment_instructionArray[] = { "NULL", "USE_IF_NO_CLASH", "OVERWRITE", "MAX", "MIN" }; + size_t sizeofArray = sizeof(shared_data_treatment_instructionArray) / sizeof(shared_data_treatment_instructionArray[0]); + if (shared_data_treatment_instruction < sizeofArray) + return (char *)shared_data_treatment_instructionArray[shared_data_treatment_instruction]; + else + return (char *)"Unknown"; +} + +OpenAPI_shared_data_treatment_instruction_e OpenAPI_shared_data_treatment_instruction_FromString(char* shared_data_treatment_instruction) +{ + int stringToReturn = 0; + const char *shared_data_treatment_instructionArray[] = { "NULL", "USE_IF_NO_CLASH", "OVERWRITE", "MAX", "MIN" }; + size_t sizeofArray = sizeof(shared_data_treatment_instructionArray) / sizeof(shared_data_treatment_instructionArray[0]); + while (stringToReturn < sizeofArray) { + if (strcmp(shared_data_treatment_instruction, shared_data_treatment_instructionArray[stringToReturn]) == 0) { + return stringToReturn; + } + stringToReturn++; + } + return 0; +} + diff --git a/lib/sbi/openapi/model/shared_data_treatment_instruction.h b/lib/sbi/openapi/model/shared_data_treatment_instruction.h new file mode 100644 index 000000000..7a3515107 --- /dev/null +++ b/lib/sbi/openapi/model/shared_data_treatment_instruction.h @@ -0,0 +1,31 @@ +/* + * shared_data_treatment_instruction.h + * + * + */ + +#ifndef _OpenAPI_shared_data_treatment_instruction_H_ +#define _OpenAPI_shared_data_treatment_instruction_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef enum { OpenAPI_shared_data_treatment_instruction_NULL = 0, OpenAPI_shared_data_treatment_instruction_USE_IF_NO_CLASH, OpenAPI_shared_data_treatment_instruction_OVERWRITE, OpenAPI_shared_data_treatment_instruction_MAX, OpenAPI_shared_data_treatment_instruction_MIN } OpenAPI_shared_data_treatment_instruction_e; + +char* OpenAPI_shared_data_treatment_instruction_ToString(OpenAPI_shared_data_treatment_instruction_e shared_data_treatment_instruction); + +OpenAPI_shared_data_treatment_instruction_e OpenAPI_shared_data_treatment_instruction_FromString(char* shared_data_treatment_instruction); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_shared_data_treatment_instruction_H_ */ + diff --git a/lib/sbi/openapi/model/sign.h b/lib/sbi/openapi/model/sign.h index 259f3995a..61227c6da 100644 --- a/lib/sbi/openapi/model/sign.h +++ b/lib/sbi/openapi/model/sign.h @@ -1,7 +1,7 @@ /* * sign.h * - * + * Sign of the DIF value. */ #ifndef _OpenAPI_sign_H_ diff --git a/lib/sbi/openapi/model/slice_info_for_pdu_session.h b/lib/sbi/openapi/model/slice_info_for_pdu_session.h index 7043aca00..abbef7923 100644 --- a/lib/sbi/openapi/model/slice_info_for_pdu_session.h +++ b/lib/sbi/openapi/model/slice_info_for_pdu_session.h @@ -1,7 +1,7 @@ /* * slice_info_for_pdu_session.h * - * + * Contains the slice information requested during PDU Session establishment procedure */ #ifndef _OpenAPI_slice_info_for_pdu_session_H_ diff --git a/lib/sbi/openapi/model/slice_info_for_registration.c b/lib/sbi/openapi/model/slice_info_for_registration.c index 0df1971ac..16be87504 100644 --- a/lib/sbi/openapi/model/slice_info_for_registration.c +++ b/lib/sbi/openapi/model/slice_info_for_registration.c @@ -14,7 +14,13 @@ OpenAPI_slice_info_for_registration_t *OpenAPI_slice_info_for_registration_creat int default_configured_snssai_ind, OpenAPI_list_t *mapping_of_nssai, bool is_request_mapping, - int request_mapping + int request_mapping, + bool is_ue_sup_nssrg_ind, + int ue_sup_nssrg_ind, + bool is_suppress_nssrg_ind, + int suppress_nssrg_ind, + bool is_nsag_supported, + int nsag_supported ) { OpenAPI_slice_info_for_registration_t *slice_info_for_registration_local_var = ogs_malloc(sizeof(OpenAPI_slice_info_for_registration_t)); @@ -30,6 +36,12 @@ OpenAPI_slice_info_for_registration_t *OpenAPI_slice_info_for_registration_creat slice_info_for_registration_local_var->mapping_of_nssai = mapping_of_nssai; slice_info_for_registration_local_var->is_request_mapping = is_request_mapping; slice_info_for_registration_local_var->request_mapping = request_mapping; + slice_info_for_registration_local_var->is_ue_sup_nssrg_ind = is_ue_sup_nssrg_ind; + slice_info_for_registration_local_var->ue_sup_nssrg_ind = ue_sup_nssrg_ind; + slice_info_for_registration_local_var->is_suppress_nssrg_ind = is_suppress_nssrg_ind; + slice_info_for_registration_local_var->suppress_nssrg_ind = suppress_nssrg_ind; + slice_info_for_registration_local_var->is_nsag_supported = is_nsag_supported; + slice_info_for_registration_local_var->nsag_supported = nsag_supported; return slice_info_for_registration_local_var; } @@ -195,6 +207,27 @@ cJSON *OpenAPI_slice_info_for_registration_convertToJSON(OpenAPI_slice_info_for_ } } + if (slice_info_for_registration->is_ue_sup_nssrg_ind) { + if (cJSON_AddBoolToObject(item, "ueSupNssrgInd", slice_info_for_registration->ue_sup_nssrg_ind) == NULL) { + ogs_error("OpenAPI_slice_info_for_registration_convertToJSON() failed [ue_sup_nssrg_ind]"); + goto end; + } + } + + if (slice_info_for_registration->is_suppress_nssrg_ind) { + if (cJSON_AddBoolToObject(item, "suppressNssrgInd", slice_info_for_registration->suppress_nssrg_ind) == NULL) { + ogs_error("OpenAPI_slice_info_for_registration_convertToJSON() failed [suppress_nssrg_ind]"); + goto end; + } + } + + if (slice_info_for_registration->is_nsag_supported) { + if (cJSON_AddBoolToObject(item, "nsagSupported", slice_info_for_registration->nsag_supported) == NULL) { + ogs_error("OpenAPI_slice_info_for_registration_convertToJSON() failed [nsag_supported]"); + goto end; + } + } + end: return item; } @@ -217,6 +250,9 @@ OpenAPI_slice_info_for_registration_t *OpenAPI_slice_info_for_registration_parse cJSON *mapping_of_nssai = NULL; OpenAPI_list_t *mapping_of_nssaiList = NULL; cJSON *request_mapping = NULL; + cJSON *ue_sup_nssrg_ind = NULL; + cJSON *suppress_nssrg_ind = NULL; + cJSON *nsag_supported = NULL; subscribed_nssai = cJSON_GetObjectItemCaseSensitive(slice_info_for_registrationJSON, "subscribedNssai"); if (subscribed_nssai) { cJSON *subscribed_nssai_local = NULL; @@ -343,6 +379,30 @@ OpenAPI_slice_info_for_registration_t *OpenAPI_slice_info_for_registration_parse } } + ue_sup_nssrg_ind = cJSON_GetObjectItemCaseSensitive(slice_info_for_registrationJSON, "ueSupNssrgInd"); + if (ue_sup_nssrg_ind) { + if (!cJSON_IsBool(ue_sup_nssrg_ind)) { + ogs_error("OpenAPI_slice_info_for_registration_parseFromJSON() failed [ue_sup_nssrg_ind]"); + goto end; + } + } + + suppress_nssrg_ind = cJSON_GetObjectItemCaseSensitive(slice_info_for_registrationJSON, "suppressNssrgInd"); + if (suppress_nssrg_ind) { + if (!cJSON_IsBool(suppress_nssrg_ind)) { + ogs_error("OpenAPI_slice_info_for_registration_parseFromJSON() failed [suppress_nssrg_ind]"); + goto end; + } + } + + nsag_supported = cJSON_GetObjectItemCaseSensitive(slice_info_for_registrationJSON, "nsagSupported"); + if (nsag_supported) { + if (!cJSON_IsBool(nsag_supported)) { + ogs_error("OpenAPI_slice_info_for_registration_parseFromJSON() failed [nsag_supported]"); + goto end; + } + } + slice_info_for_registration_local_var = OpenAPI_slice_info_for_registration_create ( subscribed_nssai ? subscribed_nssaiList : NULL, allowed_nssai_current_access ? allowed_nssai_current_access_local_nonprim : NULL, @@ -353,7 +413,13 @@ OpenAPI_slice_info_for_registration_t *OpenAPI_slice_info_for_registration_parse default_configured_snssai_ind ? default_configured_snssai_ind->valueint : 0, mapping_of_nssai ? mapping_of_nssaiList : NULL, request_mapping ? true : false, - request_mapping ? request_mapping->valueint : 0 + request_mapping ? request_mapping->valueint : 0, + ue_sup_nssrg_ind ? true : false, + ue_sup_nssrg_ind ? ue_sup_nssrg_ind->valueint : 0, + suppress_nssrg_ind ? true : false, + suppress_nssrg_ind ? suppress_nssrg_ind->valueint : 0, + nsag_supported ? true : false, + nsag_supported ? nsag_supported->valueint : 0 ); return slice_info_for_registration_local_var; diff --git a/lib/sbi/openapi/model/slice_info_for_registration.h b/lib/sbi/openapi/model/slice_info_for_registration.h index ce295867b..38e203383 100644 --- a/lib/sbi/openapi/model/slice_info_for_registration.h +++ b/lib/sbi/openapi/model/slice_info_for_registration.h @@ -1,7 +1,7 @@ /* * slice_info_for_registration.h * - * + * Contains the slice information requested during a Registration procedure */ #ifndef _OpenAPI_slice_info_for_registration_H_ @@ -33,6 +33,12 @@ typedef struct OpenAPI_slice_info_for_registration_s { OpenAPI_list_t *mapping_of_nssai; bool is_request_mapping; int request_mapping; + bool is_ue_sup_nssrg_ind; + int ue_sup_nssrg_ind; + bool is_suppress_nssrg_ind; + int suppress_nssrg_ind; + bool is_nsag_supported; + int nsag_supported; } OpenAPI_slice_info_for_registration_t; OpenAPI_slice_info_for_registration_t *OpenAPI_slice_info_for_registration_create( @@ -45,7 +51,13 @@ OpenAPI_slice_info_for_registration_t *OpenAPI_slice_info_for_registration_creat int default_configured_snssai_ind, OpenAPI_list_t *mapping_of_nssai, bool is_request_mapping, - int request_mapping + int request_mapping, + bool is_ue_sup_nssrg_ind, + int ue_sup_nssrg_ind, + bool is_suppress_nssrg_ind, + int suppress_nssrg_ind, + bool is_nsag_supported, + int nsag_supported ); void OpenAPI_slice_info_for_registration_free(OpenAPI_slice_info_for_registration_t *slice_info_for_registration); OpenAPI_slice_info_for_registration_t *OpenAPI_slice_info_for_registration_parseFromJSON(cJSON *slice_info_for_registrationJSON); diff --git a/lib/sbi/openapi/model/slice_info_for_ue_configuration_update.c b/lib/sbi/openapi/model/slice_info_for_ue_configuration_update.c index 98a29b6d5..a61b8ea31 100644 --- a/lib/sbi/openapi/model/slice_info_for_ue_configuration_update.c +++ b/lib/sbi/openapi/model/slice_info_for_ue_configuration_update.c @@ -11,7 +11,14 @@ OpenAPI_slice_info_for_ue_configuration_update_t *OpenAPI_slice_info_for_ue_conf bool is_default_configured_snssai_ind, int default_configured_snssai_ind, OpenAPI_list_t *requested_nssai, - OpenAPI_list_t *mapping_of_nssai + OpenAPI_list_t *mapping_of_nssai, + bool is_ue_sup_nssrg_ind, + int ue_sup_nssrg_ind, + bool is_suppress_nssrg_ind, + int suppress_nssrg_ind, + OpenAPI_list_t *rejected_nssai_ra, + bool is_nsag_supported, + int nsag_supported ) { OpenAPI_slice_info_for_ue_configuration_update_t *slice_info_for_ue_configuration_update_local_var = ogs_malloc(sizeof(OpenAPI_slice_info_for_ue_configuration_update_t)); @@ -24,6 +31,13 @@ OpenAPI_slice_info_for_ue_configuration_update_t *OpenAPI_slice_info_for_ue_conf slice_info_for_ue_configuration_update_local_var->default_configured_snssai_ind = default_configured_snssai_ind; slice_info_for_ue_configuration_update_local_var->requested_nssai = requested_nssai; slice_info_for_ue_configuration_update_local_var->mapping_of_nssai = mapping_of_nssai; + slice_info_for_ue_configuration_update_local_var->is_ue_sup_nssrg_ind = is_ue_sup_nssrg_ind; + slice_info_for_ue_configuration_update_local_var->ue_sup_nssrg_ind = ue_sup_nssrg_ind; + slice_info_for_ue_configuration_update_local_var->is_suppress_nssrg_ind = is_suppress_nssrg_ind; + slice_info_for_ue_configuration_update_local_var->suppress_nssrg_ind = suppress_nssrg_ind; + slice_info_for_ue_configuration_update_local_var->rejected_nssai_ra = rejected_nssai_ra; + slice_info_for_ue_configuration_update_local_var->is_nsag_supported = is_nsag_supported; + slice_info_for_ue_configuration_update_local_var->nsag_supported = nsag_supported; return slice_info_for_ue_configuration_update_local_var; } @@ -64,6 +78,13 @@ void OpenAPI_slice_info_for_ue_configuration_update_free(OpenAPI_slice_info_for_ OpenAPI_list_free(slice_info_for_ue_configuration_update->mapping_of_nssai); slice_info_for_ue_configuration_update->mapping_of_nssai = NULL; } + if (slice_info_for_ue_configuration_update->rejected_nssai_ra) { + OpenAPI_list_for_each(slice_info_for_ue_configuration_update->rejected_nssai_ra, node) { + OpenAPI_snssai_free(node->data); + } + OpenAPI_list_free(slice_info_for_ue_configuration_update->rejected_nssai_ra); + slice_info_for_ue_configuration_update->rejected_nssai_ra = NULL; + } ogs_free(slice_info_for_ue_configuration_update); } @@ -159,6 +180,43 @@ cJSON *OpenAPI_slice_info_for_ue_configuration_update_convertToJSON(OpenAPI_slic } } + if (slice_info_for_ue_configuration_update->is_ue_sup_nssrg_ind) { + if (cJSON_AddBoolToObject(item, "ueSupNssrgInd", slice_info_for_ue_configuration_update->ue_sup_nssrg_ind) == NULL) { + ogs_error("OpenAPI_slice_info_for_ue_configuration_update_convertToJSON() failed [ue_sup_nssrg_ind]"); + goto end; + } + } + + if (slice_info_for_ue_configuration_update->is_suppress_nssrg_ind) { + if (cJSON_AddBoolToObject(item, "suppressNssrgInd", slice_info_for_ue_configuration_update->suppress_nssrg_ind) == NULL) { + ogs_error("OpenAPI_slice_info_for_ue_configuration_update_convertToJSON() failed [suppress_nssrg_ind]"); + goto end; + } + } + + if (slice_info_for_ue_configuration_update->rejected_nssai_ra) { + cJSON *rejected_nssai_raList = cJSON_AddArrayToObject(item, "rejectedNssaiRa"); + if (rejected_nssai_raList == NULL) { + ogs_error("OpenAPI_slice_info_for_ue_configuration_update_convertToJSON() failed [rejected_nssai_ra]"); + goto end; + } + OpenAPI_list_for_each(slice_info_for_ue_configuration_update->rejected_nssai_ra, node) { + cJSON *itemLocal = OpenAPI_snssai_convertToJSON(node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_slice_info_for_ue_configuration_update_convertToJSON() failed [rejected_nssai_ra]"); + goto end; + } + cJSON_AddItemToArray(rejected_nssai_raList, itemLocal); + } + } + + if (slice_info_for_ue_configuration_update->is_nsag_supported) { + if (cJSON_AddBoolToObject(item, "nsagSupported", slice_info_for_ue_configuration_update->nsag_supported) == NULL) { + ogs_error("OpenAPI_slice_info_for_ue_configuration_update_convertToJSON() failed [nsag_supported]"); + goto end; + } + } + end: return item; } @@ -178,6 +236,11 @@ OpenAPI_slice_info_for_ue_configuration_update_t *OpenAPI_slice_info_for_ue_conf OpenAPI_list_t *requested_nssaiList = NULL; cJSON *mapping_of_nssai = NULL; OpenAPI_list_t *mapping_of_nssaiList = NULL; + cJSON *ue_sup_nssrg_ind = NULL; + cJSON *suppress_nssrg_ind = NULL; + cJSON *rejected_nssai_ra = NULL; + OpenAPI_list_t *rejected_nssai_raList = NULL; + cJSON *nsag_supported = NULL; subscribed_nssai = cJSON_GetObjectItemCaseSensitive(slice_info_for_ue_configuration_updateJSON, "subscribedNssai"); if (subscribed_nssai) { cJSON *subscribed_nssai_local = NULL; @@ -271,6 +334,55 @@ OpenAPI_slice_info_for_ue_configuration_update_t *OpenAPI_slice_info_for_ue_conf } } + ue_sup_nssrg_ind = cJSON_GetObjectItemCaseSensitive(slice_info_for_ue_configuration_updateJSON, "ueSupNssrgInd"); + if (ue_sup_nssrg_ind) { + if (!cJSON_IsBool(ue_sup_nssrg_ind)) { + ogs_error("OpenAPI_slice_info_for_ue_configuration_update_parseFromJSON() failed [ue_sup_nssrg_ind]"); + goto end; + } + } + + suppress_nssrg_ind = cJSON_GetObjectItemCaseSensitive(slice_info_for_ue_configuration_updateJSON, "suppressNssrgInd"); + if (suppress_nssrg_ind) { + if (!cJSON_IsBool(suppress_nssrg_ind)) { + ogs_error("OpenAPI_slice_info_for_ue_configuration_update_parseFromJSON() failed [suppress_nssrg_ind]"); + goto end; + } + } + + rejected_nssai_ra = cJSON_GetObjectItemCaseSensitive(slice_info_for_ue_configuration_updateJSON, "rejectedNssaiRa"); + if (rejected_nssai_ra) { + cJSON *rejected_nssai_ra_local = NULL; + if (!cJSON_IsArray(rejected_nssai_ra)) { + ogs_error("OpenAPI_slice_info_for_ue_configuration_update_parseFromJSON() failed [rejected_nssai_ra]"); + goto end; + } + + rejected_nssai_raList = OpenAPI_list_create(); + + cJSON_ArrayForEach(rejected_nssai_ra_local, rejected_nssai_ra) { + if (!cJSON_IsObject(rejected_nssai_ra_local)) { + ogs_error("OpenAPI_slice_info_for_ue_configuration_update_parseFromJSON() failed [rejected_nssai_ra]"); + goto end; + } + OpenAPI_snssai_t *rejected_nssai_raItem = OpenAPI_snssai_parseFromJSON(rejected_nssai_ra_local); + if (!rejected_nssai_raItem) { + ogs_error("No rejected_nssai_raItem"); + OpenAPI_list_free(rejected_nssai_raList); + goto end; + } + OpenAPI_list_add(rejected_nssai_raList, rejected_nssai_raItem); + } + } + + nsag_supported = cJSON_GetObjectItemCaseSensitive(slice_info_for_ue_configuration_updateJSON, "nsagSupported"); + if (nsag_supported) { + if (!cJSON_IsBool(nsag_supported)) { + ogs_error("OpenAPI_slice_info_for_ue_configuration_update_parseFromJSON() failed [nsag_supported]"); + goto end; + } + } + slice_info_for_ue_configuration_update_local_var = OpenAPI_slice_info_for_ue_configuration_update_create ( subscribed_nssai ? subscribed_nssaiList : NULL, allowed_nssai_current_access ? allowed_nssai_current_access_local_nonprim : NULL, @@ -278,7 +390,14 @@ OpenAPI_slice_info_for_ue_configuration_update_t *OpenAPI_slice_info_for_ue_conf default_configured_snssai_ind ? true : false, default_configured_snssai_ind ? default_configured_snssai_ind->valueint : 0, requested_nssai ? requested_nssaiList : NULL, - mapping_of_nssai ? mapping_of_nssaiList : NULL + mapping_of_nssai ? mapping_of_nssaiList : NULL, + ue_sup_nssrg_ind ? true : false, + ue_sup_nssrg_ind ? ue_sup_nssrg_ind->valueint : 0, + suppress_nssrg_ind ? true : false, + suppress_nssrg_ind ? suppress_nssrg_ind->valueint : 0, + rejected_nssai_ra ? rejected_nssai_raList : NULL, + nsag_supported ? true : false, + nsag_supported ? nsag_supported->valueint : 0 ); return slice_info_for_ue_configuration_update_local_var; @@ -312,6 +431,13 @@ end: OpenAPI_list_free(mapping_of_nssaiList); mapping_of_nssaiList = NULL; } + if (rejected_nssai_raList) { + OpenAPI_list_for_each(rejected_nssai_raList, node) { + OpenAPI_snssai_free(node->data); + } + OpenAPI_list_free(rejected_nssai_raList); + rejected_nssai_raList = NULL; + } return NULL; } diff --git a/lib/sbi/openapi/model/slice_info_for_ue_configuration_update.h b/lib/sbi/openapi/model/slice_info_for_ue_configuration_update.h index 614626a79..3ccdcc4bd 100644 --- a/lib/sbi/openapi/model/slice_info_for_ue_configuration_update.h +++ b/lib/sbi/openapi/model/slice_info_for_ue_configuration_update.h @@ -1,7 +1,7 @@ /* * slice_info_for_ue_configuration_update.h * - * + * Contains the slice information requested during UE configuration update procedure */ #ifndef _OpenAPI_slice_info_for_ue_configuration_update_H_ @@ -30,6 +30,13 @@ typedef struct OpenAPI_slice_info_for_ue_configuration_update_s { int default_configured_snssai_ind; OpenAPI_list_t *requested_nssai; OpenAPI_list_t *mapping_of_nssai; + bool is_ue_sup_nssrg_ind; + int ue_sup_nssrg_ind; + bool is_suppress_nssrg_ind; + int suppress_nssrg_ind; + OpenAPI_list_t *rejected_nssai_ra; + bool is_nsag_supported; + int nsag_supported; } OpenAPI_slice_info_for_ue_configuration_update_t; OpenAPI_slice_info_for_ue_configuration_update_t *OpenAPI_slice_info_for_ue_configuration_update_create( @@ -39,7 +46,14 @@ OpenAPI_slice_info_for_ue_configuration_update_t *OpenAPI_slice_info_for_ue_conf bool is_default_configured_snssai_ind, int default_configured_snssai_ind, OpenAPI_list_t *requested_nssai, - OpenAPI_list_t *mapping_of_nssai + OpenAPI_list_t *mapping_of_nssai, + bool is_ue_sup_nssrg_ind, + int ue_sup_nssrg_ind, + bool is_suppress_nssrg_ind, + int suppress_nssrg_ind, + OpenAPI_list_t *rejected_nssai_ra, + bool is_nsag_supported, + int nsag_supported ); void OpenAPI_slice_info_for_ue_configuration_update_free(OpenAPI_slice_info_for_ue_configuration_update_t *slice_info_for_ue_configuration_update); OpenAPI_slice_info_for_ue_configuration_update_t *OpenAPI_slice_info_for_ue_configuration_update_parseFromJSON(cJSON *slice_info_for_ue_configuration_updateJSON); diff --git a/lib/sbi/openapi/model/slice_load_level_information.c b/lib/sbi/openapi/model/slice_load_level_information.c new file mode 100644 index 000000000..16ae896a2 --- /dev/null +++ b/lib/sbi/openapi/model/slice_load_level_information.c @@ -0,0 +1,171 @@ + +#include +#include +#include +#include "slice_load_level_information.h" + +OpenAPI_slice_load_level_information_t *OpenAPI_slice_load_level_information_create( + int load_level_information, + OpenAPI_list_t *snssais +) +{ + OpenAPI_slice_load_level_information_t *slice_load_level_information_local_var = ogs_malloc(sizeof(OpenAPI_slice_load_level_information_t)); + ogs_assert(slice_load_level_information_local_var); + + slice_load_level_information_local_var->load_level_information = load_level_information; + slice_load_level_information_local_var->snssais = snssais; + + return slice_load_level_information_local_var; +} + +void OpenAPI_slice_load_level_information_free(OpenAPI_slice_load_level_information_t *slice_load_level_information) +{ + OpenAPI_lnode_t *node = NULL; + + if (NULL == slice_load_level_information) { + return; + } + if (slice_load_level_information->snssais) { + OpenAPI_list_for_each(slice_load_level_information->snssais, node) { + OpenAPI_snssai_free(node->data); + } + OpenAPI_list_free(slice_load_level_information->snssais); + slice_load_level_information->snssais = NULL; + } + ogs_free(slice_load_level_information); +} + +cJSON *OpenAPI_slice_load_level_information_convertToJSON(OpenAPI_slice_load_level_information_t *slice_load_level_information) +{ + cJSON *item = NULL; + OpenAPI_lnode_t *node = NULL; + + if (slice_load_level_information == NULL) { + ogs_error("OpenAPI_slice_load_level_information_convertToJSON() failed [SliceLoadLevelInformation]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (cJSON_AddNumberToObject(item, "loadLevelInformation", slice_load_level_information->load_level_information) == NULL) { + ogs_error("OpenAPI_slice_load_level_information_convertToJSON() failed [load_level_information]"); + goto end; + } + + if (!slice_load_level_information->snssais) { + ogs_error("OpenAPI_slice_load_level_information_convertToJSON() failed [snssais]"); + return NULL; + } + cJSON *snssaisList = cJSON_AddArrayToObject(item, "snssais"); + if (snssaisList == NULL) { + ogs_error("OpenAPI_slice_load_level_information_convertToJSON() failed [snssais]"); + goto end; + } + OpenAPI_list_for_each(slice_load_level_information->snssais, node) { + cJSON *itemLocal = OpenAPI_snssai_convertToJSON(node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_slice_load_level_information_convertToJSON() failed [snssais]"); + goto end; + } + cJSON_AddItemToArray(snssaisList, itemLocal); + } + +end: + return item; +} + +OpenAPI_slice_load_level_information_t *OpenAPI_slice_load_level_information_parseFromJSON(cJSON *slice_load_level_informationJSON) +{ + OpenAPI_slice_load_level_information_t *slice_load_level_information_local_var = NULL; + OpenAPI_lnode_t *node = NULL; + cJSON *load_level_information = NULL; + cJSON *snssais = NULL; + OpenAPI_list_t *snssaisList = NULL; + load_level_information = cJSON_GetObjectItemCaseSensitive(slice_load_level_informationJSON, "loadLevelInformation"); + if (!load_level_information) { + ogs_error("OpenAPI_slice_load_level_information_parseFromJSON() failed [load_level_information]"); + goto end; + } + if (!cJSON_IsNumber(load_level_information)) { + ogs_error("OpenAPI_slice_load_level_information_parseFromJSON() failed [load_level_information]"); + goto end; + } + + snssais = cJSON_GetObjectItemCaseSensitive(slice_load_level_informationJSON, "snssais"); + if (!snssais) { + ogs_error("OpenAPI_slice_load_level_information_parseFromJSON() failed [snssais]"); + goto end; + } + cJSON *snssais_local = NULL; + if (!cJSON_IsArray(snssais)) { + ogs_error("OpenAPI_slice_load_level_information_parseFromJSON() failed [snssais]"); + goto end; + } + + snssaisList = OpenAPI_list_create(); + + cJSON_ArrayForEach(snssais_local, snssais) { + if (!cJSON_IsObject(snssais_local)) { + ogs_error("OpenAPI_slice_load_level_information_parseFromJSON() failed [snssais]"); + goto end; + } + OpenAPI_snssai_t *snssaisItem = OpenAPI_snssai_parseFromJSON(snssais_local); + if (!snssaisItem) { + ogs_error("No snssaisItem"); + OpenAPI_list_free(snssaisList); + goto end; + } + OpenAPI_list_add(snssaisList, snssaisItem); + } + + slice_load_level_information_local_var = OpenAPI_slice_load_level_information_create ( + + load_level_information->valuedouble, + snssaisList + ); + + return slice_load_level_information_local_var; +end: + if (snssaisList) { + OpenAPI_list_for_each(snssaisList, node) { + OpenAPI_snssai_free(node->data); + } + OpenAPI_list_free(snssaisList); + snssaisList = NULL; + } + return NULL; +} + +OpenAPI_slice_load_level_information_t *OpenAPI_slice_load_level_information_copy(OpenAPI_slice_load_level_information_t *dst, OpenAPI_slice_load_level_information_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_slice_load_level_information_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_slice_load_level_information_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_slice_load_level_information_free(dst); + dst = OpenAPI_slice_load_level_information_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/slice_load_level_information.h b/lib/sbi/openapi/model/slice_load_level_information.h new file mode 100644 index 000000000..c89bacc01 --- /dev/null +++ b/lib/sbi/openapi/model/slice_load_level_information.h @@ -0,0 +1,41 @@ +/* + * slice_load_level_information.h + * + * Contains load level information applicable for one or several slices. + */ + +#ifndef _OpenAPI_slice_load_level_information_H_ +#define _OpenAPI_slice_load_level_information_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "snssai.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_slice_load_level_information_s OpenAPI_slice_load_level_information_t; +typedef struct OpenAPI_slice_load_level_information_s { + int load_level_information; + OpenAPI_list_t *snssais; +} OpenAPI_slice_load_level_information_t; + +OpenAPI_slice_load_level_information_t *OpenAPI_slice_load_level_information_create( + int load_level_information, + OpenAPI_list_t *snssais +); +void OpenAPI_slice_load_level_information_free(OpenAPI_slice_load_level_information_t *slice_load_level_information); +OpenAPI_slice_load_level_information_t *OpenAPI_slice_load_level_information_parseFromJSON(cJSON *slice_load_level_informationJSON); +cJSON *OpenAPI_slice_load_level_information_convertToJSON(OpenAPI_slice_load_level_information_t *slice_load_level_information); +OpenAPI_slice_load_level_information_t *OpenAPI_slice_load_level_information_copy(OpenAPI_slice_load_level_information_t *dst, OpenAPI_slice_load_level_information_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_slice_load_level_information_H_ */ + diff --git a/lib/sbi/openapi/model/slice_mbr.c b/lib/sbi/openapi/model/slice_mbr.c new file mode 100644 index 000000000..052427044 --- /dev/null +++ b/lib/sbi/openapi/model/slice_mbr.c @@ -0,0 +1,141 @@ + +#include +#include +#include +#include "slice_mbr.h" + +OpenAPI_slice_mbr_t *OpenAPI_slice_mbr_create( + char *uplink, + char *downlink +) +{ + OpenAPI_slice_mbr_t *slice_mbr_local_var = ogs_malloc(sizeof(OpenAPI_slice_mbr_t)); + ogs_assert(slice_mbr_local_var); + + slice_mbr_local_var->uplink = uplink; + slice_mbr_local_var->downlink = downlink; + + return slice_mbr_local_var; +} + +void OpenAPI_slice_mbr_free(OpenAPI_slice_mbr_t *slice_mbr) +{ + OpenAPI_lnode_t *node = NULL; + + if (NULL == slice_mbr) { + return; + } + if (slice_mbr->uplink) { + ogs_free(slice_mbr->uplink); + slice_mbr->uplink = NULL; + } + if (slice_mbr->downlink) { + ogs_free(slice_mbr->downlink); + slice_mbr->downlink = NULL; + } + ogs_free(slice_mbr); +} + +cJSON *OpenAPI_slice_mbr_convertToJSON(OpenAPI_slice_mbr_t *slice_mbr) +{ + cJSON *item = NULL; + OpenAPI_lnode_t *node = NULL; + + if (slice_mbr == NULL) { + ogs_error("OpenAPI_slice_mbr_convertToJSON() failed [SliceMbr]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (!slice_mbr->uplink) { + ogs_error("OpenAPI_slice_mbr_convertToJSON() failed [uplink]"); + return NULL; + } + if (cJSON_AddStringToObject(item, "uplink", slice_mbr->uplink) == NULL) { + ogs_error("OpenAPI_slice_mbr_convertToJSON() failed [uplink]"); + goto end; + } + + if (!slice_mbr->downlink) { + ogs_error("OpenAPI_slice_mbr_convertToJSON() failed [downlink]"); + return NULL; + } + if (cJSON_AddStringToObject(item, "downlink", slice_mbr->downlink) == NULL) { + ogs_error("OpenAPI_slice_mbr_convertToJSON() failed [downlink]"); + goto end; + } + +end: + return item; +} + +OpenAPI_slice_mbr_t *OpenAPI_slice_mbr_parseFromJSON(cJSON *slice_mbrJSON) +{ + OpenAPI_slice_mbr_t *slice_mbr_local_var = NULL; + OpenAPI_lnode_t *node = NULL; + cJSON *uplink = NULL; + cJSON *downlink = NULL; + uplink = cJSON_GetObjectItemCaseSensitive(slice_mbrJSON, "uplink"); + if (!uplink) { + ogs_error("OpenAPI_slice_mbr_parseFromJSON() failed [uplink]"); + goto end; + } + if (!cJSON_IsString(uplink)) { + ogs_error("OpenAPI_slice_mbr_parseFromJSON() failed [uplink]"); + goto end; + } + + downlink = cJSON_GetObjectItemCaseSensitive(slice_mbrJSON, "downlink"); + if (!downlink) { + ogs_error("OpenAPI_slice_mbr_parseFromJSON() failed [downlink]"); + goto end; + } + if (!cJSON_IsString(downlink)) { + ogs_error("OpenAPI_slice_mbr_parseFromJSON() failed [downlink]"); + goto end; + } + + slice_mbr_local_var = OpenAPI_slice_mbr_create ( + ogs_strdup(uplink->valuestring), + ogs_strdup(downlink->valuestring) + ); + + return slice_mbr_local_var; +end: + return NULL; +} + +OpenAPI_slice_mbr_t *OpenAPI_slice_mbr_copy(OpenAPI_slice_mbr_t *dst, OpenAPI_slice_mbr_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_slice_mbr_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_slice_mbr_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_slice_mbr_free(dst); + dst = OpenAPI_slice_mbr_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/slice_mbr.h b/lib/sbi/openapi/model/slice_mbr.h new file mode 100644 index 000000000..50a8fbfc0 --- /dev/null +++ b/lib/sbi/openapi/model/slice_mbr.h @@ -0,0 +1,40 @@ +/* + * slice_mbr.h + * + * MBR related to slice + */ + +#ifndef _OpenAPI_slice_mbr_H_ +#define _OpenAPI_slice_mbr_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_slice_mbr_s OpenAPI_slice_mbr_t; +typedef struct OpenAPI_slice_mbr_s { + char *uplink; + char *downlink; +} OpenAPI_slice_mbr_t; + +OpenAPI_slice_mbr_t *OpenAPI_slice_mbr_create( + char *uplink, + char *downlink +); +void OpenAPI_slice_mbr_free(OpenAPI_slice_mbr_t *slice_mbr); +OpenAPI_slice_mbr_t *OpenAPI_slice_mbr_parseFromJSON(cJSON *slice_mbrJSON); +cJSON *OpenAPI_slice_mbr_convertToJSON(OpenAPI_slice_mbr_t *slice_mbr); +OpenAPI_slice_mbr_t *OpenAPI_slice_mbr_copy(OpenAPI_slice_mbr_t *dst, OpenAPI_slice_mbr_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_slice_mbr_H_ */ + diff --git a/lib/sbi/openapi/model/slice_mbr_1.c b/lib/sbi/openapi/model/slice_mbr_1.c new file mode 100644 index 000000000..e5838d90f --- /dev/null +++ b/lib/sbi/openapi/model/slice_mbr_1.c @@ -0,0 +1,141 @@ + +#include +#include +#include +#include "slice_mbr_1.h" + +OpenAPI_slice_mbr_1_t *OpenAPI_slice_mbr_1_create( + char *uplink, + char *downlink +) +{ + OpenAPI_slice_mbr_1_t *slice_mbr_1_local_var = ogs_malloc(sizeof(OpenAPI_slice_mbr_1_t)); + ogs_assert(slice_mbr_1_local_var); + + slice_mbr_1_local_var->uplink = uplink; + slice_mbr_1_local_var->downlink = downlink; + + return slice_mbr_1_local_var; +} + +void OpenAPI_slice_mbr_1_free(OpenAPI_slice_mbr_1_t *slice_mbr_1) +{ + OpenAPI_lnode_t *node = NULL; + + if (NULL == slice_mbr_1) { + return; + } + if (slice_mbr_1->uplink) { + ogs_free(slice_mbr_1->uplink); + slice_mbr_1->uplink = NULL; + } + if (slice_mbr_1->downlink) { + ogs_free(slice_mbr_1->downlink); + slice_mbr_1->downlink = NULL; + } + ogs_free(slice_mbr_1); +} + +cJSON *OpenAPI_slice_mbr_1_convertToJSON(OpenAPI_slice_mbr_1_t *slice_mbr_1) +{ + cJSON *item = NULL; + OpenAPI_lnode_t *node = NULL; + + if (slice_mbr_1 == NULL) { + ogs_error("OpenAPI_slice_mbr_1_convertToJSON() failed [SliceMbr_1]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (!slice_mbr_1->uplink) { + ogs_error("OpenAPI_slice_mbr_1_convertToJSON() failed [uplink]"); + return NULL; + } + if (cJSON_AddStringToObject(item, "uplink", slice_mbr_1->uplink) == NULL) { + ogs_error("OpenAPI_slice_mbr_1_convertToJSON() failed [uplink]"); + goto end; + } + + if (!slice_mbr_1->downlink) { + ogs_error("OpenAPI_slice_mbr_1_convertToJSON() failed [downlink]"); + return NULL; + } + if (cJSON_AddStringToObject(item, "downlink", slice_mbr_1->downlink) == NULL) { + ogs_error("OpenAPI_slice_mbr_1_convertToJSON() failed [downlink]"); + goto end; + } + +end: + return item; +} + +OpenAPI_slice_mbr_1_t *OpenAPI_slice_mbr_1_parseFromJSON(cJSON *slice_mbr_1JSON) +{ + OpenAPI_slice_mbr_1_t *slice_mbr_1_local_var = NULL; + OpenAPI_lnode_t *node = NULL; + cJSON *uplink = NULL; + cJSON *downlink = NULL; + uplink = cJSON_GetObjectItemCaseSensitive(slice_mbr_1JSON, "uplink"); + if (!uplink) { + ogs_error("OpenAPI_slice_mbr_1_parseFromJSON() failed [uplink]"); + goto end; + } + if (!cJSON_IsString(uplink)) { + ogs_error("OpenAPI_slice_mbr_1_parseFromJSON() failed [uplink]"); + goto end; + } + + downlink = cJSON_GetObjectItemCaseSensitive(slice_mbr_1JSON, "downlink"); + if (!downlink) { + ogs_error("OpenAPI_slice_mbr_1_parseFromJSON() failed [downlink]"); + goto end; + } + if (!cJSON_IsString(downlink)) { + ogs_error("OpenAPI_slice_mbr_1_parseFromJSON() failed [downlink]"); + goto end; + } + + slice_mbr_1_local_var = OpenAPI_slice_mbr_1_create ( + ogs_strdup(uplink->valuestring), + ogs_strdup(downlink->valuestring) + ); + + return slice_mbr_1_local_var; +end: + return NULL; +} + +OpenAPI_slice_mbr_1_t *OpenAPI_slice_mbr_1_copy(OpenAPI_slice_mbr_1_t *dst, OpenAPI_slice_mbr_1_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_slice_mbr_1_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_slice_mbr_1_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_slice_mbr_1_free(dst); + dst = OpenAPI_slice_mbr_1_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/slice_mbr_1.h b/lib/sbi/openapi/model/slice_mbr_1.h new file mode 100644 index 000000000..320ae2fe9 --- /dev/null +++ b/lib/sbi/openapi/model/slice_mbr_1.h @@ -0,0 +1,40 @@ +/* + * slice_mbr_1.h + * + * MBR related to slice + */ + +#ifndef _OpenAPI_slice_mbr_1_H_ +#define _OpenAPI_slice_mbr_1_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_slice_mbr_1_s OpenAPI_slice_mbr_1_t; +typedef struct OpenAPI_slice_mbr_1_s { + char *uplink; + char *downlink; +} OpenAPI_slice_mbr_1_t; + +OpenAPI_slice_mbr_1_t *OpenAPI_slice_mbr_1_create( + char *uplink, + char *downlink +); +void OpenAPI_slice_mbr_1_free(OpenAPI_slice_mbr_1_t *slice_mbr_1); +OpenAPI_slice_mbr_1_t *OpenAPI_slice_mbr_1_parseFromJSON(cJSON *slice_mbr_1JSON); +cJSON *OpenAPI_slice_mbr_1_convertToJSON(OpenAPI_slice_mbr_1_t *slice_mbr_1); +OpenAPI_slice_mbr_1_t *OpenAPI_slice_mbr_1_copy(OpenAPI_slice_mbr_1_t *dst, OpenAPI_slice_mbr_1_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_slice_mbr_1_H_ */ + diff --git a/lib/sbi/openapi/model/slice_mbr_rm.c b/lib/sbi/openapi/model/slice_mbr_rm.c new file mode 100644 index 000000000..7e53d2b18 --- /dev/null +++ b/lib/sbi/openapi/model/slice_mbr_rm.c @@ -0,0 +1,141 @@ + +#include +#include +#include +#include "slice_mbr_rm.h" + +OpenAPI_slice_mbr_rm_t *OpenAPI_slice_mbr_rm_create( + char *uplink, + char *downlink +) +{ + OpenAPI_slice_mbr_rm_t *slice_mbr_rm_local_var = ogs_malloc(sizeof(OpenAPI_slice_mbr_rm_t)); + ogs_assert(slice_mbr_rm_local_var); + + slice_mbr_rm_local_var->uplink = uplink; + slice_mbr_rm_local_var->downlink = downlink; + + return slice_mbr_rm_local_var; +} + +void OpenAPI_slice_mbr_rm_free(OpenAPI_slice_mbr_rm_t *slice_mbr_rm) +{ + OpenAPI_lnode_t *node = NULL; + + if (NULL == slice_mbr_rm) { + return; + } + if (slice_mbr_rm->uplink) { + ogs_free(slice_mbr_rm->uplink); + slice_mbr_rm->uplink = NULL; + } + if (slice_mbr_rm->downlink) { + ogs_free(slice_mbr_rm->downlink); + slice_mbr_rm->downlink = NULL; + } + ogs_free(slice_mbr_rm); +} + +cJSON *OpenAPI_slice_mbr_rm_convertToJSON(OpenAPI_slice_mbr_rm_t *slice_mbr_rm) +{ + cJSON *item = NULL; + OpenAPI_lnode_t *node = NULL; + + if (slice_mbr_rm == NULL) { + ogs_error("OpenAPI_slice_mbr_rm_convertToJSON() failed [SliceMbrRm]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (!slice_mbr_rm->uplink) { + ogs_error("OpenAPI_slice_mbr_rm_convertToJSON() failed [uplink]"); + return NULL; + } + if (cJSON_AddStringToObject(item, "uplink", slice_mbr_rm->uplink) == NULL) { + ogs_error("OpenAPI_slice_mbr_rm_convertToJSON() failed [uplink]"); + goto end; + } + + if (!slice_mbr_rm->downlink) { + ogs_error("OpenAPI_slice_mbr_rm_convertToJSON() failed [downlink]"); + return NULL; + } + if (cJSON_AddStringToObject(item, "downlink", slice_mbr_rm->downlink) == NULL) { + ogs_error("OpenAPI_slice_mbr_rm_convertToJSON() failed [downlink]"); + goto end; + } + +end: + return item; +} + +OpenAPI_slice_mbr_rm_t *OpenAPI_slice_mbr_rm_parseFromJSON(cJSON *slice_mbr_rmJSON) +{ + OpenAPI_slice_mbr_rm_t *slice_mbr_rm_local_var = NULL; + OpenAPI_lnode_t *node = NULL; + cJSON *uplink = NULL; + cJSON *downlink = NULL; + uplink = cJSON_GetObjectItemCaseSensitive(slice_mbr_rmJSON, "uplink"); + if (!uplink) { + ogs_error("OpenAPI_slice_mbr_rm_parseFromJSON() failed [uplink]"); + goto end; + } + if (!cJSON_IsString(uplink)) { + ogs_error("OpenAPI_slice_mbr_rm_parseFromJSON() failed [uplink]"); + goto end; + } + + downlink = cJSON_GetObjectItemCaseSensitive(slice_mbr_rmJSON, "downlink"); + if (!downlink) { + ogs_error("OpenAPI_slice_mbr_rm_parseFromJSON() failed [downlink]"); + goto end; + } + if (!cJSON_IsString(downlink)) { + ogs_error("OpenAPI_slice_mbr_rm_parseFromJSON() failed [downlink]"); + goto end; + } + + slice_mbr_rm_local_var = OpenAPI_slice_mbr_rm_create ( + ogs_strdup(uplink->valuestring), + ogs_strdup(downlink->valuestring) + ); + + return slice_mbr_rm_local_var; +end: + return NULL; +} + +OpenAPI_slice_mbr_rm_t *OpenAPI_slice_mbr_rm_copy(OpenAPI_slice_mbr_rm_t *dst, OpenAPI_slice_mbr_rm_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_slice_mbr_rm_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_slice_mbr_rm_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_slice_mbr_rm_free(dst); + dst = OpenAPI_slice_mbr_rm_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/slice_mbr_rm.h b/lib/sbi/openapi/model/slice_mbr_rm.h new file mode 100644 index 000000000..67cdcf22d --- /dev/null +++ b/lib/sbi/openapi/model/slice_mbr_rm.h @@ -0,0 +1,42 @@ +/* + * slice_mbr_rm.h + * + * SliceMbr with nullable: true + */ + +#ifndef _OpenAPI_slice_mbr_rm_H_ +#define _OpenAPI_slice_mbr_rm_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "null_value.h" +#include "slice_mbr.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_slice_mbr_rm_s OpenAPI_slice_mbr_rm_t; +typedef struct OpenAPI_slice_mbr_rm_s { + char *uplink; + char *downlink; +} OpenAPI_slice_mbr_rm_t; + +OpenAPI_slice_mbr_rm_t *OpenAPI_slice_mbr_rm_create( + char *uplink, + char *downlink +); +void OpenAPI_slice_mbr_rm_free(OpenAPI_slice_mbr_rm_t *slice_mbr_rm); +OpenAPI_slice_mbr_rm_t *OpenAPI_slice_mbr_rm_parseFromJSON(cJSON *slice_mbr_rmJSON); +cJSON *OpenAPI_slice_mbr_rm_convertToJSON(OpenAPI_slice_mbr_rm_t *slice_mbr_rm); +OpenAPI_slice_mbr_rm_t *OpenAPI_slice_mbr_rm_copy(OpenAPI_slice_mbr_rm_t *dst, OpenAPI_slice_mbr_rm_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_slice_mbr_rm_H_ */ + diff --git a/lib/sbi/openapi/model/slice_policy_data.c b/lib/sbi/openapi/model/slice_policy_data.c new file mode 100644 index 000000000..1a5aa11fb --- /dev/null +++ b/lib/sbi/openapi/model/slice_policy_data.c @@ -0,0 +1,256 @@ + +#include +#include +#include +#include "slice_policy_data.h" + +OpenAPI_slice_policy_data_t *OpenAPI_slice_policy_data_create( + char *mbr_ul, + char *mbr_dl, + char *remain_mbr_ul, + char *remain_mbr_dl, + char *supp_feat, + OpenAPI_list_t *reset_ids +) +{ + OpenAPI_slice_policy_data_t *slice_policy_data_local_var = ogs_malloc(sizeof(OpenAPI_slice_policy_data_t)); + ogs_assert(slice_policy_data_local_var); + + slice_policy_data_local_var->mbr_ul = mbr_ul; + slice_policy_data_local_var->mbr_dl = mbr_dl; + slice_policy_data_local_var->remain_mbr_ul = remain_mbr_ul; + slice_policy_data_local_var->remain_mbr_dl = remain_mbr_dl; + slice_policy_data_local_var->supp_feat = supp_feat; + slice_policy_data_local_var->reset_ids = reset_ids; + + return slice_policy_data_local_var; +} + +void OpenAPI_slice_policy_data_free(OpenAPI_slice_policy_data_t *slice_policy_data) +{ + OpenAPI_lnode_t *node = NULL; + + if (NULL == slice_policy_data) { + return; + } + if (slice_policy_data->mbr_ul) { + ogs_free(slice_policy_data->mbr_ul); + slice_policy_data->mbr_ul = NULL; + } + if (slice_policy_data->mbr_dl) { + ogs_free(slice_policy_data->mbr_dl); + slice_policy_data->mbr_dl = NULL; + } + if (slice_policy_data->remain_mbr_ul) { + ogs_free(slice_policy_data->remain_mbr_ul); + slice_policy_data->remain_mbr_ul = NULL; + } + if (slice_policy_data->remain_mbr_dl) { + ogs_free(slice_policy_data->remain_mbr_dl); + slice_policy_data->remain_mbr_dl = NULL; + } + if (slice_policy_data->supp_feat) { + ogs_free(slice_policy_data->supp_feat); + slice_policy_data->supp_feat = NULL; + } + if (slice_policy_data->reset_ids) { + OpenAPI_list_for_each(slice_policy_data->reset_ids, node) { + ogs_free(node->data); + } + OpenAPI_list_free(slice_policy_data->reset_ids); + slice_policy_data->reset_ids = NULL; + } + ogs_free(slice_policy_data); +} + +cJSON *OpenAPI_slice_policy_data_convertToJSON(OpenAPI_slice_policy_data_t *slice_policy_data) +{ + cJSON *item = NULL; + OpenAPI_lnode_t *node = NULL; + + if (slice_policy_data == NULL) { + ogs_error("OpenAPI_slice_policy_data_convertToJSON() failed [SlicePolicyData]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (slice_policy_data->mbr_ul) { + if (cJSON_AddStringToObject(item, "mbrUl", slice_policy_data->mbr_ul) == NULL) { + ogs_error("OpenAPI_slice_policy_data_convertToJSON() failed [mbr_ul]"); + goto end; + } + } + + if (slice_policy_data->mbr_dl) { + if (cJSON_AddStringToObject(item, "mbrDl", slice_policy_data->mbr_dl) == NULL) { + ogs_error("OpenAPI_slice_policy_data_convertToJSON() failed [mbr_dl]"); + goto end; + } + } + + if (slice_policy_data->remain_mbr_ul) { + if (cJSON_AddStringToObject(item, "remainMbrUl", slice_policy_data->remain_mbr_ul) == NULL) { + ogs_error("OpenAPI_slice_policy_data_convertToJSON() failed [remain_mbr_ul]"); + goto end; + } + } + + if (slice_policy_data->remain_mbr_dl) { + if (cJSON_AddStringToObject(item, "remainMbrDl", slice_policy_data->remain_mbr_dl) == NULL) { + ogs_error("OpenAPI_slice_policy_data_convertToJSON() failed [remain_mbr_dl]"); + goto end; + } + } + + if (slice_policy_data->supp_feat) { + if (cJSON_AddStringToObject(item, "suppFeat", slice_policy_data->supp_feat) == NULL) { + ogs_error("OpenAPI_slice_policy_data_convertToJSON() failed [supp_feat]"); + goto end; + } + } + + if (slice_policy_data->reset_ids) { + cJSON *reset_idsList = cJSON_AddArrayToObject(item, "resetIds"); + if (reset_idsList == NULL) { + ogs_error("OpenAPI_slice_policy_data_convertToJSON() failed [reset_ids]"); + goto end; + } + OpenAPI_list_for_each(slice_policy_data->reset_ids, node) { + if (cJSON_AddStringToObject(reset_idsList, "", (char*)node->data) == NULL) { + ogs_error("OpenAPI_slice_policy_data_convertToJSON() failed [reset_ids]"); + goto end; + } + } + } + +end: + return item; +} + +OpenAPI_slice_policy_data_t *OpenAPI_slice_policy_data_parseFromJSON(cJSON *slice_policy_dataJSON) +{ + OpenAPI_slice_policy_data_t *slice_policy_data_local_var = NULL; + OpenAPI_lnode_t *node = NULL; + cJSON *mbr_ul = NULL; + cJSON *mbr_dl = NULL; + cJSON *remain_mbr_ul = NULL; + cJSON *remain_mbr_dl = NULL; + cJSON *supp_feat = NULL; + cJSON *reset_ids = NULL; + OpenAPI_list_t *reset_idsList = NULL; + mbr_ul = cJSON_GetObjectItemCaseSensitive(slice_policy_dataJSON, "mbrUl"); + if (mbr_ul) { + if (!cJSON_IsString(mbr_ul) && !cJSON_IsNull(mbr_ul)) { + ogs_error("OpenAPI_slice_policy_data_parseFromJSON() failed [mbr_ul]"); + goto end; + } + } + + mbr_dl = cJSON_GetObjectItemCaseSensitive(slice_policy_dataJSON, "mbrDl"); + if (mbr_dl) { + if (!cJSON_IsString(mbr_dl) && !cJSON_IsNull(mbr_dl)) { + ogs_error("OpenAPI_slice_policy_data_parseFromJSON() failed [mbr_dl]"); + goto end; + } + } + + remain_mbr_ul = cJSON_GetObjectItemCaseSensitive(slice_policy_dataJSON, "remainMbrUl"); + if (remain_mbr_ul) { + if (!cJSON_IsString(remain_mbr_ul) && !cJSON_IsNull(remain_mbr_ul)) { + ogs_error("OpenAPI_slice_policy_data_parseFromJSON() failed [remain_mbr_ul]"); + goto end; + } + } + + remain_mbr_dl = cJSON_GetObjectItemCaseSensitive(slice_policy_dataJSON, "remainMbrDl"); + if (remain_mbr_dl) { + if (!cJSON_IsString(remain_mbr_dl) && !cJSON_IsNull(remain_mbr_dl)) { + ogs_error("OpenAPI_slice_policy_data_parseFromJSON() failed [remain_mbr_dl]"); + goto end; + } + } + + supp_feat = cJSON_GetObjectItemCaseSensitive(slice_policy_dataJSON, "suppFeat"); + if (supp_feat) { + if (!cJSON_IsString(supp_feat) && !cJSON_IsNull(supp_feat)) { + ogs_error("OpenAPI_slice_policy_data_parseFromJSON() failed [supp_feat]"); + goto end; + } + } + + reset_ids = cJSON_GetObjectItemCaseSensitive(slice_policy_dataJSON, "resetIds"); + if (reset_ids) { + cJSON *reset_ids_local = NULL; + if (!cJSON_IsArray(reset_ids)) { + ogs_error("OpenAPI_slice_policy_data_parseFromJSON() failed [reset_ids]"); + goto end; + } + + reset_idsList = OpenAPI_list_create(); + + cJSON_ArrayForEach(reset_ids_local, reset_ids) { + double *localDouble = NULL; + int *localInt = NULL; + if (!cJSON_IsString(reset_ids_local)) { + ogs_error("OpenAPI_slice_policy_data_parseFromJSON() failed [reset_ids]"); + goto end; + } + OpenAPI_list_add(reset_idsList, ogs_strdup(reset_ids_local->valuestring)); + } + } + + slice_policy_data_local_var = OpenAPI_slice_policy_data_create ( + mbr_ul && !cJSON_IsNull(mbr_ul) ? ogs_strdup(mbr_ul->valuestring) : NULL, + mbr_dl && !cJSON_IsNull(mbr_dl) ? ogs_strdup(mbr_dl->valuestring) : NULL, + remain_mbr_ul && !cJSON_IsNull(remain_mbr_ul) ? ogs_strdup(remain_mbr_ul->valuestring) : NULL, + remain_mbr_dl && !cJSON_IsNull(remain_mbr_dl) ? ogs_strdup(remain_mbr_dl->valuestring) : NULL, + supp_feat && !cJSON_IsNull(supp_feat) ? ogs_strdup(supp_feat->valuestring) : NULL, + reset_ids ? reset_idsList : NULL + ); + + return slice_policy_data_local_var; +end: + if (reset_idsList) { + OpenAPI_list_for_each(reset_idsList, node) { + ogs_free(node->data); + } + OpenAPI_list_free(reset_idsList); + reset_idsList = NULL; + } + return NULL; +} + +OpenAPI_slice_policy_data_t *OpenAPI_slice_policy_data_copy(OpenAPI_slice_policy_data_t *dst, OpenAPI_slice_policy_data_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_slice_policy_data_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_slice_policy_data_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_slice_policy_data_free(dst); + dst = OpenAPI_slice_policy_data_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/slice_policy_data.h b/lib/sbi/openapi/model/slice_policy_data.h new file mode 100644 index 000000000..fdc2f779e --- /dev/null +++ b/lib/sbi/openapi/model/slice_policy_data.h @@ -0,0 +1,48 @@ +/* + * slice_policy_data.h + * + * Contains the network slice specific policy control information. + */ + +#ifndef _OpenAPI_slice_policy_data_H_ +#define _OpenAPI_slice_policy_data_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_slice_policy_data_s OpenAPI_slice_policy_data_t; +typedef struct OpenAPI_slice_policy_data_s { + char *mbr_ul; + char *mbr_dl; + char *remain_mbr_ul; + char *remain_mbr_dl; + char *supp_feat; + OpenAPI_list_t *reset_ids; +} OpenAPI_slice_policy_data_t; + +OpenAPI_slice_policy_data_t *OpenAPI_slice_policy_data_create( + char *mbr_ul, + char *mbr_dl, + char *remain_mbr_ul, + char *remain_mbr_dl, + char *supp_feat, + OpenAPI_list_t *reset_ids +); +void OpenAPI_slice_policy_data_free(OpenAPI_slice_policy_data_t *slice_policy_data); +OpenAPI_slice_policy_data_t *OpenAPI_slice_policy_data_parseFromJSON(cJSON *slice_policy_dataJSON); +cJSON *OpenAPI_slice_policy_data_convertToJSON(OpenAPI_slice_policy_data_t *slice_policy_data); +OpenAPI_slice_policy_data_t *OpenAPI_slice_policy_data_copy(OpenAPI_slice_policy_data_t *dst, OpenAPI_slice_policy_data_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_slice_policy_data_H_ */ + diff --git a/lib/sbi/openapi/model/sm_context.c b/lib/sbi/openapi/model/sm_context.c index 5444b601b..32af41773 100644 --- a/lib/sbi/openapi/model/sm_context.c +++ b/lib/sbi/openapi/model/sm_context.c @@ -15,12 +15,16 @@ OpenAPI_sm_context_t *OpenAPI_sm_context_create( char *h_smf_uri, char *smf_uri, char *pdu_session_ref, + char *inter_plmn_api_root, + char *intra_plmn_api_root, char *pcf_id, char *pcf_group_id, char *pcf_set_id, OpenAPI_dnn_selection_mode_e sel_mode, char *udm_group_id, char *routing_indicator, + bool is_h_nw_pub_key_id, + int h_nw_pub_key_id, OpenAPI_ambr_t *session_ambr, OpenAPI_list_t *qos_flows_list, char *h_smf_instance_id, @@ -35,6 +39,7 @@ OpenAPI_sm_context_t *OpenAPI_sm_context_create( OpenAPI_eps_pdn_cnx_info_t *eps_pdn_cnx_info, OpenAPI_list_t *eps_bearer_info, OpenAPI_max_integrity_protected_data_rate_e max_integrity_protected_data_rate, + OpenAPI_max_integrity_protected_data_rate_e max_integrity_protected_data_rate_dl, bool is_always_on_granted, int always_on_granted, OpenAPI_up_security_t *up_security, @@ -56,7 +61,20 @@ OpenAPI_sm_context_t *OpenAPI_sm_context_create( OpenAPI_qos_flow_tunnel_t *ran_tunnel_info, OpenAPI_list_t *add_ran_tunnel_info, OpenAPI_qos_flow_tunnel_t *red_ran_tunnel_info, - OpenAPI_list_t *add_red_ran_tunnel_info + OpenAPI_list_t *add_red_ran_tunnel_info, + bool is_nspu_support_ind, + int nspu_support_ind, + char *smf_binding_info, + OpenAPI_satellite_backhaul_category_e satellite_backhaul_cat, + char *ssc_mode, + bool is_dlset_support_ind, + int dlset_support_ind, + bool is_n9fsc_support_ind, + int n9fsc_support_ind, + bool is_disaster_roaming_ind, + int disaster_roaming_ind, + bool is_anchor_smf_oauth2_required, + int anchor_smf_oauth2_required ) { OpenAPI_sm_context_t *sm_context_local_var = ogs_malloc(sizeof(OpenAPI_sm_context_t)); @@ -72,12 +90,16 @@ OpenAPI_sm_context_t *OpenAPI_sm_context_create( sm_context_local_var->h_smf_uri = h_smf_uri; sm_context_local_var->smf_uri = smf_uri; sm_context_local_var->pdu_session_ref = pdu_session_ref; + sm_context_local_var->inter_plmn_api_root = inter_plmn_api_root; + sm_context_local_var->intra_plmn_api_root = intra_plmn_api_root; sm_context_local_var->pcf_id = pcf_id; sm_context_local_var->pcf_group_id = pcf_group_id; sm_context_local_var->pcf_set_id = pcf_set_id; sm_context_local_var->sel_mode = sel_mode; sm_context_local_var->udm_group_id = udm_group_id; sm_context_local_var->routing_indicator = routing_indicator; + sm_context_local_var->is_h_nw_pub_key_id = is_h_nw_pub_key_id; + sm_context_local_var->h_nw_pub_key_id = h_nw_pub_key_id; sm_context_local_var->session_ambr = session_ambr; sm_context_local_var->qos_flows_list = qos_flows_list; sm_context_local_var->h_smf_instance_id = h_smf_instance_id; @@ -92,6 +114,7 @@ OpenAPI_sm_context_t *OpenAPI_sm_context_create( sm_context_local_var->eps_pdn_cnx_info = eps_pdn_cnx_info; sm_context_local_var->eps_bearer_info = eps_bearer_info; sm_context_local_var->max_integrity_protected_data_rate = max_integrity_protected_data_rate; + sm_context_local_var->max_integrity_protected_data_rate_dl = max_integrity_protected_data_rate_dl; sm_context_local_var->is_always_on_granted = is_always_on_granted; sm_context_local_var->always_on_granted = always_on_granted; sm_context_local_var->up_security = up_security; @@ -114,6 +137,19 @@ OpenAPI_sm_context_t *OpenAPI_sm_context_create( sm_context_local_var->add_ran_tunnel_info = add_ran_tunnel_info; sm_context_local_var->red_ran_tunnel_info = red_ran_tunnel_info; sm_context_local_var->add_red_ran_tunnel_info = add_red_ran_tunnel_info; + sm_context_local_var->is_nspu_support_ind = is_nspu_support_ind; + sm_context_local_var->nspu_support_ind = nspu_support_ind; + sm_context_local_var->smf_binding_info = smf_binding_info; + sm_context_local_var->satellite_backhaul_cat = satellite_backhaul_cat; + sm_context_local_var->ssc_mode = ssc_mode; + sm_context_local_var->is_dlset_support_ind = is_dlset_support_ind; + sm_context_local_var->dlset_support_ind = dlset_support_ind; + sm_context_local_var->is_n9fsc_support_ind = is_n9fsc_support_ind; + sm_context_local_var->n9fsc_support_ind = n9fsc_support_ind; + sm_context_local_var->is_disaster_roaming_ind = is_disaster_roaming_ind; + sm_context_local_var->disaster_roaming_ind = disaster_roaming_ind; + sm_context_local_var->is_anchor_smf_oauth2_required = is_anchor_smf_oauth2_required; + sm_context_local_var->anchor_smf_oauth2_required = anchor_smf_oauth2_required; return sm_context_local_var; } @@ -157,6 +193,14 @@ void OpenAPI_sm_context_free(OpenAPI_sm_context_t *sm_context) ogs_free(sm_context->pdu_session_ref); sm_context->pdu_session_ref = NULL; } + if (sm_context->inter_plmn_api_root) { + ogs_free(sm_context->inter_plmn_api_root); + sm_context->inter_plmn_api_root = NULL; + } + if (sm_context->intra_plmn_api_root) { + ogs_free(sm_context->intra_plmn_api_root); + sm_context->intra_plmn_api_root = NULL; + } if (sm_context->pcf_id) { ogs_free(sm_context->pcf_id); sm_context->pcf_id = NULL; @@ -285,6 +329,14 @@ void OpenAPI_sm_context_free(OpenAPI_sm_context_t *sm_context) OpenAPI_list_free(sm_context->add_red_ran_tunnel_info); sm_context->add_red_ran_tunnel_info = NULL; } + if (sm_context->smf_binding_info) { + ogs_free(sm_context->smf_binding_info); + sm_context->smf_binding_info = NULL; + } + if (sm_context->ssc_mode) { + ogs_free(sm_context->ssc_mode); + sm_context->ssc_mode = NULL; + } ogs_free(sm_context); } @@ -385,6 +437,20 @@ cJSON *OpenAPI_sm_context_convertToJSON(OpenAPI_sm_context_t *sm_context) } } + if (sm_context->inter_plmn_api_root) { + if (cJSON_AddStringToObject(item, "interPlmnApiRoot", sm_context->inter_plmn_api_root) == NULL) { + ogs_error("OpenAPI_sm_context_convertToJSON() failed [inter_plmn_api_root]"); + goto end; + } + } + + if (sm_context->intra_plmn_api_root) { + if (cJSON_AddStringToObject(item, "intraPlmnApiRoot", sm_context->intra_plmn_api_root) == NULL) { + ogs_error("OpenAPI_sm_context_convertToJSON() failed [intra_plmn_api_root]"); + goto end; + } + } + if (sm_context->pcf_id) { if (cJSON_AddStringToObject(item, "pcfId", sm_context->pcf_id) == NULL) { ogs_error("OpenAPI_sm_context_convertToJSON() failed [pcf_id]"); @@ -427,6 +493,13 @@ cJSON *OpenAPI_sm_context_convertToJSON(OpenAPI_sm_context_t *sm_context) } } + if (sm_context->is_h_nw_pub_key_id) { + if (cJSON_AddNumberToObject(item, "hNwPubKeyId", sm_context->h_nw_pub_key_id) == NULL) { + ogs_error("OpenAPI_sm_context_convertToJSON() failed [h_nw_pub_key_id]"); + goto end; + } + } + if (!sm_context->session_ambr) { ogs_error("OpenAPI_sm_context_convertToJSON() failed [session_ambr]"); return NULL; @@ -552,6 +625,13 @@ cJSON *OpenAPI_sm_context_convertToJSON(OpenAPI_sm_context_t *sm_context) } } + if (sm_context->max_integrity_protected_data_rate_dl != OpenAPI_max_integrity_protected_data_rate_NULL) { + if (cJSON_AddStringToObject(item, "maxIntegrityProtectedDataRateDl", OpenAPI_max_integrity_protected_data_rate_ToString(sm_context->max_integrity_protected_data_rate_dl)) == NULL) { + ogs_error("OpenAPI_sm_context_convertToJSON() failed [max_integrity_protected_data_rate_dl]"); + goto end; + } + } + if (sm_context->is_always_on_granted) { if (cJSON_AddBoolToObject(item, "alwaysOnGranted", sm_context->always_on_granted) == NULL) { ogs_error("OpenAPI_sm_context_convertToJSON() failed [always_on_granted]"); @@ -744,6 +824,62 @@ cJSON *OpenAPI_sm_context_convertToJSON(OpenAPI_sm_context_t *sm_context) } } + if (sm_context->is_nspu_support_ind) { + if (cJSON_AddBoolToObject(item, "nspuSupportInd", sm_context->nspu_support_ind) == NULL) { + ogs_error("OpenAPI_sm_context_convertToJSON() failed [nspu_support_ind]"); + goto end; + } + } + + if (sm_context->smf_binding_info) { + if (cJSON_AddStringToObject(item, "smfBindingInfo", sm_context->smf_binding_info) == NULL) { + ogs_error("OpenAPI_sm_context_convertToJSON() failed [smf_binding_info]"); + goto end; + } + } + + if (sm_context->satellite_backhaul_cat != OpenAPI_satellite_backhaul_category_NULL) { + if (cJSON_AddStringToObject(item, "satelliteBackhaulCat", OpenAPI_satellite_backhaul_category_ToString(sm_context->satellite_backhaul_cat)) == NULL) { + ogs_error("OpenAPI_sm_context_convertToJSON() failed [satellite_backhaul_cat]"); + goto end; + } + } + + if (sm_context->ssc_mode) { + if (cJSON_AddStringToObject(item, "sscMode", sm_context->ssc_mode) == NULL) { + ogs_error("OpenAPI_sm_context_convertToJSON() failed [ssc_mode]"); + goto end; + } + } + + if (sm_context->is_dlset_support_ind) { + if (cJSON_AddBoolToObject(item, "dlsetSupportInd", sm_context->dlset_support_ind) == NULL) { + ogs_error("OpenAPI_sm_context_convertToJSON() failed [dlset_support_ind]"); + goto end; + } + } + + if (sm_context->is_n9fsc_support_ind) { + if (cJSON_AddBoolToObject(item, "n9fscSupportInd", sm_context->n9fsc_support_ind) == NULL) { + ogs_error("OpenAPI_sm_context_convertToJSON() failed [n9fsc_support_ind]"); + goto end; + } + } + + if (sm_context->is_disaster_roaming_ind) { + if (cJSON_AddBoolToObject(item, "disasterRoamingInd", sm_context->disaster_roaming_ind) == NULL) { + ogs_error("OpenAPI_sm_context_convertToJSON() failed [disaster_roaming_ind]"); + goto end; + } + } + + if (sm_context->is_anchor_smf_oauth2_required) { + if (cJSON_AddBoolToObject(item, "anchorSmfOauth2Required", sm_context->anchor_smf_oauth2_required) == NULL) { + ogs_error("OpenAPI_sm_context_convertToJSON() failed [anchor_smf_oauth2_required]"); + goto end; + } + } + end: return item; } @@ -765,6 +901,8 @@ OpenAPI_sm_context_t *OpenAPI_sm_context_parseFromJSON(cJSON *sm_contextJSON) cJSON *h_smf_uri = NULL; cJSON *smf_uri = NULL; cJSON *pdu_session_ref = NULL; + cJSON *inter_plmn_api_root = NULL; + cJSON *intra_plmn_api_root = NULL; cJSON *pcf_id = NULL; cJSON *pcf_group_id = NULL; cJSON *pcf_set_id = NULL; @@ -772,6 +910,7 @@ OpenAPI_sm_context_t *OpenAPI_sm_context_parseFromJSON(cJSON *sm_contextJSON) OpenAPI_dnn_selection_mode_e sel_modeVariable = 0; cJSON *udm_group_id = NULL; cJSON *routing_indicator = NULL; + cJSON *h_nw_pub_key_id = NULL; cJSON *session_ambr = NULL; OpenAPI_ambr_t *session_ambr_local_nonprim = NULL; cJSON *qos_flows_list = NULL; @@ -791,6 +930,8 @@ OpenAPI_sm_context_t *OpenAPI_sm_context_parseFromJSON(cJSON *sm_contextJSON) OpenAPI_list_t *eps_bearer_infoList = NULL; cJSON *max_integrity_protected_data_rate = NULL; OpenAPI_max_integrity_protected_data_rate_e max_integrity_protected_data_rateVariable = 0; + cJSON *max_integrity_protected_data_rate_dl = NULL; + OpenAPI_max_integrity_protected_data_rate_e max_integrity_protected_data_rate_dlVariable = 0; cJSON *always_on_granted = NULL; cJSON *up_security = NULL; OpenAPI_up_security_t *up_security_local_nonprim = NULL; @@ -819,6 +960,15 @@ OpenAPI_sm_context_t *OpenAPI_sm_context_parseFromJSON(cJSON *sm_contextJSON) OpenAPI_qos_flow_tunnel_t *red_ran_tunnel_info_local_nonprim = NULL; cJSON *add_red_ran_tunnel_info = NULL; OpenAPI_list_t *add_red_ran_tunnel_infoList = NULL; + cJSON *nspu_support_ind = NULL; + cJSON *smf_binding_info = NULL; + cJSON *satellite_backhaul_cat = NULL; + OpenAPI_satellite_backhaul_category_e satellite_backhaul_catVariable = 0; + cJSON *ssc_mode = NULL; + cJSON *dlset_support_ind = NULL; + cJSON *n9fsc_support_ind = NULL; + cJSON *disaster_roaming_ind = NULL; + cJSON *anchor_smf_oauth2_required = NULL; pdu_session_id = cJSON_GetObjectItemCaseSensitive(sm_contextJSON, "pduSessionId"); if (!pdu_session_id) { ogs_error("OpenAPI_sm_context_parseFromJSON() failed [pdu_session_id]"); @@ -902,6 +1052,22 @@ OpenAPI_sm_context_t *OpenAPI_sm_context_parseFromJSON(cJSON *sm_contextJSON) } } + inter_plmn_api_root = cJSON_GetObjectItemCaseSensitive(sm_contextJSON, "interPlmnApiRoot"); + if (inter_plmn_api_root) { + if (!cJSON_IsString(inter_plmn_api_root) && !cJSON_IsNull(inter_plmn_api_root)) { + ogs_error("OpenAPI_sm_context_parseFromJSON() failed [inter_plmn_api_root]"); + goto end; + } + } + + intra_plmn_api_root = cJSON_GetObjectItemCaseSensitive(sm_contextJSON, "intraPlmnApiRoot"); + if (intra_plmn_api_root) { + if (!cJSON_IsString(intra_plmn_api_root) && !cJSON_IsNull(intra_plmn_api_root)) { + ogs_error("OpenAPI_sm_context_parseFromJSON() failed [intra_plmn_api_root]"); + goto end; + } + } + pcf_id = cJSON_GetObjectItemCaseSensitive(sm_contextJSON, "pcfId"); if (pcf_id) { if (!cJSON_IsString(pcf_id) && !cJSON_IsNull(pcf_id)) { @@ -951,6 +1117,14 @@ OpenAPI_sm_context_t *OpenAPI_sm_context_parseFromJSON(cJSON *sm_contextJSON) } } + h_nw_pub_key_id = cJSON_GetObjectItemCaseSensitive(sm_contextJSON, "hNwPubKeyId"); + if (h_nw_pub_key_id) { + if (!cJSON_IsNumber(h_nw_pub_key_id)) { + ogs_error("OpenAPI_sm_context_parseFromJSON() failed [h_nw_pub_key_id]"); + goto end; + } + } + session_ambr = cJSON_GetObjectItemCaseSensitive(sm_contextJSON, "sessionAmbr"); if (!session_ambr) { ogs_error("OpenAPI_sm_context_parseFromJSON() failed [session_ambr]"); @@ -1089,6 +1263,15 @@ OpenAPI_sm_context_t *OpenAPI_sm_context_parseFromJSON(cJSON *sm_contextJSON) max_integrity_protected_data_rateVariable = OpenAPI_max_integrity_protected_data_rate_FromString(max_integrity_protected_data_rate->valuestring); } + max_integrity_protected_data_rate_dl = cJSON_GetObjectItemCaseSensitive(sm_contextJSON, "maxIntegrityProtectedDataRateDl"); + if (max_integrity_protected_data_rate_dl) { + if (!cJSON_IsString(max_integrity_protected_data_rate_dl)) { + ogs_error("OpenAPI_sm_context_parseFromJSON() failed [max_integrity_protected_data_rate_dl]"); + goto end; + } + max_integrity_protected_data_rate_dlVariable = OpenAPI_max_integrity_protected_data_rate_FromString(max_integrity_protected_data_rate_dl->valuestring); + } + always_on_granted = cJSON_GetObjectItemCaseSensitive(sm_contextJSON, "alwaysOnGranted"); if (always_on_granted) { if (!cJSON_IsBool(always_on_granted)) { @@ -1243,6 +1426,71 @@ OpenAPI_sm_context_t *OpenAPI_sm_context_parseFromJSON(cJSON *sm_contextJSON) } } + nspu_support_ind = cJSON_GetObjectItemCaseSensitive(sm_contextJSON, "nspuSupportInd"); + if (nspu_support_ind) { + if (!cJSON_IsBool(nspu_support_ind)) { + ogs_error("OpenAPI_sm_context_parseFromJSON() failed [nspu_support_ind]"); + goto end; + } + } + + smf_binding_info = cJSON_GetObjectItemCaseSensitive(sm_contextJSON, "smfBindingInfo"); + if (smf_binding_info) { + if (!cJSON_IsString(smf_binding_info) && !cJSON_IsNull(smf_binding_info)) { + ogs_error("OpenAPI_sm_context_parseFromJSON() failed [smf_binding_info]"); + goto end; + } + } + + satellite_backhaul_cat = cJSON_GetObjectItemCaseSensitive(sm_contextJSON, "satelliteBackhaulCat"); + if (satellite_backhaul_cat) { + if (!cJSON_IsString(satellite_backhaul_cat)) { + ogs_error("OpenAPI_sm_context_parseFromJSON() failed [satellite_backhaul_cat]"); + goto end; + } + satellite_backhaul_catVariable = OpenAPI_satellite_backhaul_category_FromString(satellite_backhaul_cat->valuestring); + } + + ssc_mode = cJSON_GetObjectItemCaseSensitive(sm_contextJSON, "sscMode"); + if (ssc_mode) { + if (!cJSON_IsString(ssc_mode) && !cJSON_IsNull(ssc_mode)) { + ogs_error("OpenAPI_sm_context_parseFromJSON() failed [ssc_mode]"); + goto end; + } + } + + dlset_support_ind = cJSON_GetObjectItemCaseSensitive(sm_contextJSON, "dlsetSupportInd"); + if (dlset_support_ind) { + if (!cJSON_IsBool(dlset_support_ind)) { + ogs_error("OpenAPI_sm_context_parseFromJSON() failed [dlset_support_ind]"); + goto end; + } + } + + n9fsc_support_ind = cJSON_GetObjectItemCaseSensitive(sm_contextJSON, "n9fscSupportInd"); + if (n9fsc_support_ind) { + if (!cJSON_IsBool(n9fsc_support_ind)) { + ogs_error("OpenAPI_sm_context_parseFromJSON() failed [n9fsc_support_ind]"); + goto end; + } + } + + disaster_roaming_ind = cJSON_GetObjectItemCaseSensitive(sm_contextJSON, "disasterRoamingInd"); + if (disaster_roaming_ind) { + if (!cJSON_IsBool(disaster_roaming_ind)) { + ogs_error("OpenAPI_sm_context_parseFromJSON() failed [disaster_roaming_ind]"); + goto end; + } + } + + anchor_smf_oauth2_required = cJSON_GetObjectItemCaseSensitive(sm_contextJSON, "anchorSmfOauth2Required"); + if (anchor_smf_oauth2_required) { + if (!cJSON_IsBool(anchor_smf_oauth2_required)) { + ogs_error("OpenAPI_sm_context_parseFromJSON() failed [anchor_smf_oauth2_required]"); + goto end; + } + } + sm_context_local_var = OpenAPI_sm_context_create ( pdu_session_id->valuedouble, @@ -1255,12 +1503,16 @@ OpenAPI_sm_context_t *OpenAPI_sm_context_parseFromJSON(cJSON *sm_contextJSON) h_smf_uri && !cJSON_IsNull(h_smf_uri) ? ogs_strdup(h_smf_uri->valuestring) : NULL, smf_uri && !cJSON_IsNull(smf_uri) ? ogs_strdup(smf_uri->valuestring) : NULL, pdu_session_ref && !cJSON_IsNull(pdu_session_ref) ? ogs_strdup(pdu_session_ref->valuestring) : NULL, + inter_plmn_api_root && !cJSON_IsNull(inter_plmn_api_root) ? ogs_strdup(inter_plmn_api_root->valuestring) : NULL, + intra_plmn_api_root && !cJSON_IsNull(intra_plmn_api_root) ? ogs_strdup(intra_plmn_api_root->valuestring) : NULL, pcf_id && !cJSON_IsNull(pcf_id) ? ogs_strdup(pcf_id->valuestring) : NULL, pcf_group_id && !cJSON_IsNull(pcf_group_id) ? ogs_strdup(pcf_group_id->valuestring) : NULL, pcf_set_id && !cJSON_IsNull(pcf_set_id) ? ogs_strdup(pcf_set_id->valuestring) : NULL, sel_mode ? sel_modeVariable : 0, udm_group_id && !cJSON_IsNull(udm_group_id) ? ogs_strdup(udm_group_id->valuestring) : NULL, routing_indicator && !cJSON_IsNull(routing_indicator) ? ogs_strdup(routing_indicator->valuestring) : NULL, + h_nw_pub_key_id ? true : false, + h_nw_pub_key_id ? h_nw_pub_key_id->valuedouble : 0, session_ambr_local_nonprim, qos_flows_listList, h_smf_instance_id && !cJSON_IsNull(h_smf_instance_id) ? ogs_strdup(h_smf_instance_id->valuestring) : NULL, @@ -1275,6 +1527,7 @@ OpenAPI_sm_context_t *OpenAPI_sm_context_parseFromJSON(cJSON *sm_contextJSON) eps_pdn_cnx_info ? eps_pdn_cnx_info_local_nonprim : NULL, eps_bearer_info ? eps_bearer_infoList : NULL, max_integrity_protected_data_rate ? max_integrity_protected_data_rateVariable : 0, + max_integrity_protected_data_rate_dl ? max_integrity_protected_data_rate_dlVariable : 0, always_on_granted ? true : false, always_on_granted ? always_on_granted->valueint : 0, up_security ? up_security_local_nonprim : NULL, @@ -1296,7 +1549,20 @@ OpenAPI_sm_context_t *OpenAPI_sm_context_parseFromJSON(cJSON *sm_contextJSON) ran_tunnel_info ? ran_tunnel_info_local_nonprim : NULL, add_ran_tunnel_info ? add_ran_tunnel_infoList : NULL, red_ran_tunnel_info ? red_ran_tunnel_info_local_nonprim : NULL, - add_red_ran_tunnel_info ? add_red_ran_tunnel_infoList : NULL + add_red_ran_tunnel_info ? add_red_ran_tunnel_infoList : NULL, + nspu_support_ind ? true : false, + nspu_support_ind ? nspu_support_ind->valueint : 0, + smf_binding_info && !cJSON_IsNull(smf_binding_info) ? ogs_strdup(smf_binding_info->valuestring) : NULL, + satellite_backhaul_cat ? satellite_backhaul_catVariable : 0, + ssc_mode && !cJSON_IsNull(ssc_mode) ? ogs_strdup(ssc_mode->valuestring) : NULL, + dlset_support_ind ? true : false, + dlset_support_ind ? dlset_support_ind->valueint : 0, + n9fsc_support_ind ? true : false, + n9fsc_support_ind ? n9fsc_support_ind->valueint : 0, + disaster_roaming_ind ? true : false, + disaster_roaming_ind ? disaster_roaming_ind->valueint : 0, + anchor_smf_oauth2_required ? true : false, + anchor_smf_oauth2_required ? anchor_smf_oauth2_required->valueint : 0 ); return sm_context_local_var; diff --git a/lib/sbi/openapi/model/sm_context.h b/lib/sbi/openapi/model/sm_context.h index 4938c74b6..6b704bb31 100644 --- a/lib/sbi/openapi/model/sm_context.h +++ b/lib/sbi/openapi/model/sm_context.h @@ -1,7 +1,7 @@ /* * sm_context.h * - * + * Complete SM Context */ #ifndef _OpenAPI_sm_context_H_ @@ -24,6 +24,7 @@ #include "qos_flow_tunnel.h" #include "redundant_pdu_session_information.h" #include "roaming_charging_profile.h" +#include "satellite_backhaul_category.h" #include "sbi_binding_level.h" #include "snssai.h" #include "tunnel_info.h" @@ -45,12 +46,16 @@ typedef struct OpenAPI_sm_context_s { char *h_smf_uri; char *smf_uri; char *pdu_session_ref; + char *inter_plmn_api_root; + char *intra_plmn_api_root; char *pcf_id; char *pcf_group_id; char *pcf_set_id; OpenAPI_dnn_selection_mode_e sel_mode; char *udm_group_id; char *routing_indicator; + bool is_h_nw_pub_key_id; + int h_nw_pub_key_id; struct OpenAPI_ambr_s *session_ambr; OpenAPI_list_t *qos_flows_list; char *h_smf_instance_id; @@ -65,6 +70,7 @@ typedef struct OpenAPI_sm_context_s { struct OpenAPI_eps_pdn_cnx_info_s *eps_pdn_cnx_info; OpenAPI_list_t *eps_bearer_info; OpenAPI_max_integrity_protected_data_rate_e max_integrity_protected_data_rate; + OpenAPI_max_integrity_protected_data_rate_e max_integrity_protected_data_rate_dl; bool is_always_on_granted; int always_on_granted; struct OpenAPI_up_security_s *up_security; @@ -87,6 +93,19 @@ typedef struct OpenAPI_sm_context_s { OpenAPI_list_t *add_ran_tunnel_info; struct OpenAPI_qos_flow_tunnel_s *red_ran_tunnel_info; OpenAPI_list_t *add_red_ran_tunnel_info; + bool is_nspu_support_ind; + int nspu_support_ind; + char *smf_binding_info; + OpenAPI_satellite_backhaul_category_e satellite_backhaul_cat; + char *ssc_mode; + bool is_dlset_support_ind; + int dlset_support_ind; + bool is_n9fsc_support_ind; + int n9fsc_support_ind; + bool is_disaster_roaming_ind; + int disaster_roaming_ind; + bool is_anchor_smf_oauth2_required; + int anchor_smf_oauth2_required; } OpenAPI_sm_context_t; OpenAPI_sm_context_t *OpenAPI_sm_context_create( @@ -100,12 +119,16 @@ OpenAPI_sm_context_t *OpenAPI_sm_context_create( char *h_smf_uri, char *smf_uri, char *pdu_session_ref, + char *inter_plmn_api_root, + char *intra_plmn_api_root, char *pcf_id, char *pcf_group_id, char *pcf_set_id, OpenAPI_dnn_selection_mode_e sel_mode, char *udm_group_id, char *routing_indicator, + bool is_h_nw_pub_key_id, + int h_nw_pub_key_id, OpenAPI_ambr_t *session_ambr, OpenAPI_list_t *qos_flows_list, char *h_smf_instance_id, @@ -120,6 +143,7 @@ OpenAPI_sm_context_t *OpenAPI_sm_context_create( OpenAPI_eps_pdn_cnx_info_t *eps_pdn_cnx_info, OpenAPI_list_t *eps_bearer_info, OpenAPI_max_integrity_protected_data_rate_e max_integrity_protected_data_rate, + OpenAPI_max_integrity_protected_data_rate_e max_integrity_protected_data_rate_dl, bool is_always_on_granted, int always_on_granted, OpenAPI_up_security_t *up_security, @@ -141,7 +165,20 @@ OpenAPI_sm_context_t *OpenAPI_sm_context_create( OpenAPI_qos_flow_tunnel_t *ran_tunnel_info, OpenAPI_list_t *add_ran_tunnel_info, OpenAPI_qos_flow_tunnel_t *red_ran_tunnel_info, - OpenAPI_list_t *add_red_ran_tunnel_info + OpenAPI_list_t *add_red_ran_tunnel_info, + bool is_nspu_support_ind, + int nspu_support_ind, + char *smf_binding_info, + OpenAPI_satellite_backhaul_category_e satellite_backhaul_cat, + char *ssc_mode, + bool is_dlset_support_ind, + int dlset_support_ind, + bool is_n9fsc_support_ind, + int n9fsc_support_ind, + bool is_disaster_roaming_ind, + int disaster_roaming_ind, + bool is_anchor_smf_oauth2_required, + int anchor_smf_oauth2_required ); void OpenAPI_sm_context_free(OpenAPI_sm_context_t *sm_context); OpenAPI_sm_context_t *OpenAPI_sm_context_parseFromJSON(cJSON *sm_contextJSON); diff --git a/lib/sbi/openapi/model/sm_context_create_data.c b/lib/sbi/openapi/model/sm_context_create_data.c index c5cc503e7..cb67a394f 100644 --- a/lib/sbi/openapi/model/sm_context_create_data.c +++ b/lib/sbi/openapi/model/sm_context_create_data.c @@ -53,6 +53,8 @@ OpenAPI_sm_context_create_data_t *OpenAPI_sm_context_create_data_create( OpenAPI_trace_data_t *trace_data, char *udm_group_id, char *routing_indicator, + bool is_h_nw_pub_key_id, + int h_nw_pub_key_id, OpenAPI_eps_interworking_indication_e eps_interworking_ind, bool is_indirect_forwarding_flag, int indirect_forwarding_flag, @@ -75,6 +77,7 @@ OpenAPI_sm_context_create_data_t *OpenAPI_sm_context_create_data_create( OpenAPI_ref_to_binary_data_t *n2_sm_info_ext1, OpenAPI_n2_sm_info_type_e n2_sm_info_type_ext1, char *sm_context_ref, + OpenAPI_plmn_id_nid_t *sm_context_smf_plmn_id, char *sm_context_smf_id, char *sm_context_smf_set_id, char *sm_context_smf_service_set_id, @@ -95,7 +98,33 @@ OpenAPI_sm_context_create_data_t *OpenAPI_sm_context_create_data_create( OpenAPI_tngf_info_t *tngf_info, OpenAPI_twif_info_t *twif_info, bool is_ran_unchanged_ind, - int ran_unchanged_ind + int ran_unchanged_ind, + bool is_same_pcf_selection_ind, + int same_pcf_selection_ind, + char *target_dnai, + char *nrf_management_uri, + char *nrf_discovery_uri, + char *nrf_access_token_uri, + OpenAPI_list_t* nrf_oauth2_required, + char *smf_binding_info, + OpenAPI_list_t *pvs_info, + bool is_onboarding_ind, + int onboarding_ind, + char *old_pdu_session_ref, + bool is_sm_policy_notify_ind, + int sm_policy_notify_ind, + OpenAPI_pcf_ue_callback_info_t *pcf_ue_callback_info, + OpenAPI_satellite_backhaul_category_e satellite_backhaul_cat, + bool is_upip_supported, + int upip_supported, + bool is_uav_authenticated, + int uav_authenticated, + bool is_disaster_roaming_ind, + int disaster_roaming_ind, + bool is_anchor_smf_oauth2_required, + int anchor_smf_oauth2_required, + bool is_sm_context_smf_oauth2_required, + int sm_context_smf_oauth2_required ) { OpenAPI_sm_context_create_data_t *sm_context_create_data_local_var = ogs_malloc(sizeof(OpenAPI_sm_context_create_data_t)); @@ -149,6 +178,8 @@ OpenAPI_sm_context_create_data_t *OpenAPI_sm_context_create_data_create( sm_context_create_data_local_var->trace_data = trace_data; sm_context_create_data_local_var->udm_group_id = udm_group_id; sm_context_create_data_local_var->routing_indicator = routing_indicator; + sm_context_create_data_local_var->is_h_nw_pub_key_id = is_h_nw_pub_key_id; + sm_context_create_data_local_var->h_nw_pub_key_id = h_nw_pub_key_id; sm_context_create_data_local_var->eps_interworking_ind = eps_interworking_ind; sm_context_create_data_local_var->is_indirect_forwarding_flag = is_indirect_forwarding_flag; sm_context_create_data_local_var->indirect_forwarding_flag = indirect_forwarding_flag; @@ -171,6 +202,7 @@ OpenAPI_sm_context_create_data_t *OpenAPI_sm_context_create_data_create( sm_context_create_data_local_var->n2_sm_info_ext1 = n2_sm_info_ext1; sm_context_create_data_local_var->n2_sm_info_type_ext1 = n2_sm_info_type_ext1; sm_context_create_data_local_var->sm_context_ref = sm_context_ref; + sm_context_create_data_local_var->sm_context_smf_plmn_id = sm_context_smf_plmn_id; sm_context_create_data_local_var->sm_context_smf_id = sm_context_smf_id; sm_context_create_data_local_var->sm_context_smf_set_id = sm_context_smf_set_id; sm_context_create_data_local_var->sm_context_smf_service_set_id = sm_context_smf_service_set_id; @@ -192,6 +224,32 @@ OpenAPI_sm_context_create_data_t *OpenAPI_sm_context_create_data_create( sm_context_create_data_local_var->twif_info = twif_info; sm_context_create_data_local_var->is_ran_unchanged_ind = is_ran_unchanged_ind; sm_context_create_data_local_var->ran_unchanged_ind = ran_unchanged_ind; + sm_context_create_data_local_var->is_same_pcf_selection_ind = is_same_pcf_selection_ind; + sm_context_create_data_local_var->same_pcf_selection_ind = same_pcf_selection_ind; + sm_context_create_data_local_var->target_dnai = target_dnai; + sm_context_create_data_local_var->nrf_management_uri = nrf_management_uri; + sm_context_create_data_local_var->nrf_discovery_uri = nrf_discovery_uri; + sm_context_create_data_local_var->nrf_access_token_uri = nrf_access_token_uri; + sm_context_create_data_local_var->nrf_oauth2_required = nrf_oauth2_required; + sm_context_create_data_local_var->smf_binding_info = smf_binding_info; + sm_context_create_data_local_var->pvs_info = pvs_info; + sm_context_create_data_local_var->is_onboarding_ind = is_onboarding_ind; + sm_context_create_data_local_var->onboarding_ind = onboarding_ind; + sm_context_create_data_local_var->old_pdu_session_ref = old_pdu_session_ref; + sm_context_create_data_local_var->is_sm_policy_notify_ind = is_sm_policy_notify_ind; + sm_context_create_data_local_var->sm_policy_notify_ind = sm_policy_notify_ind; + sm_context_create_data_local_var->pcf_ue_callback_info = pcf_ue_callback_info; + sm_context_create_data_local_var->satellite_backhaul_cat = satellite_backhaul_cat; + sm_context_create_data_local_var->is_upip_supported = is_upip_supported; + sm_context_create_data_local_var->upip_supported = upip_supported; + sm_context_create_data_local_var->is_uav_authenticated = is_uav_authenticated; + sm_context_create_data_local_var->uav_authenticated = uav_authenticated; + sm_context_create_data_local_var->is_disaster_roaming_ind = is_disaster_roaming_ind; + sm_context_create_data_local_var->disaster_roaming_ind = disaster_roaming_ind; + sm_context_create_data_local_var->is_anchor_smf_oauth2_required = is_anchor_smf_oauth2_required; + sm_context_create_data_local_var->anchor_smf_oauth2_required = anchor_smf_oauth2_required; + sm_context_create_data_local_var->is_sm_context_smf_oauth2_required = is_sm_context_smf_oauth2_required; + sm_context_create_data_local_var->sm_context_smf_oauth2_required = sm_context_smf_oauth2_required; return sm_context_create_data_local_var; } @@ -381,6 +439,10 @@ void OpenAPI_sm_context_create_data_free(OpenAPI_sm_context_create_data_t *sm_co ogs_free(sm_context_create_data->sm_context_ref); sm_context_create_data->sm_context_ref = NULL; } + if (sm_context_create_data->sm_context_smf_plmn_id) { + OpenAPI_plmn_id_nid_free(sm_context_create_data->sm_context_smf_plmn_id); + sm_context_create_data->sm_context_smf_plmn_id = NULL; + } if (sm_context_create_data->sm_context_smf_id) { ogs_free(sm_context_create_data->sm_context_smf_id); sm_context_create_data->sm_context_smf_id = NULL; @@ -425,6 +487,51 @@ void OpenAPI_sm_context_create_data_free(OpenAPI_sm_context_create_data_t *sm_co OpenAPI_twif_info_free(sm_context_create_data->twif_info); sm_context_create_data->twif_info = NULL; } + if (sm_context_create_data->target_dnai) { + ogs_free(sm_context_create_data->target_dnai); + sm_context_create_data->target_dnai = NULL; + } + if (sm_context_create_data->nrf_management_uri) { + ogs_free(sm_context_create_data->nrf_management_uri); + sm_context_create_data->nrf_management_uri = NULL; + } + if (sm_context_create_data->nrf_discovery_uri) { + ogs_free(sm_context_create_data->nrf_discovery_uri); + sm_context_create_data->nrf_discovery_uri = NULL; + } + if (sm_context_create_data->nrf_access_token_uri) { + ogs_free(sm_context_create_data->nrf_access_token_uri); + sm_context_create_data->nrf_access_token_uri = NULL; + } + if (sm_context_create_data->nrf_oauth2_required) { + OpenAPI_list_for_each(sm_context_create_data->nrf_oauth2_required, node) { + OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*)node->data; + ogs_free(localKeyValue->key); + ogs_free(localKeyValue->value); + OpenAPI_map_free(localKeyValue); + } + OpenAPI_list_free(sm_context_create_data->nrf_oauth2_required); + sm_context_create_data->nrf_oauth2_required = NULL; + } + if (sm_context_create_data->smf_binding_info) { + ogs_free(sm_context_create_data->smf_binding_info); + sm_context_create_data->smf_binding_info = NULL; + } + if (sm_context_create_data->pvs_info) { + OpenAPI_list_for_each(sm_context_create_data->pvs_info, node) { + OpenAPI_server_addressing_info_free(node->data); + } + OpenAPI_list_free(sm_context_create_data->pvs_info); + sm_context_create_data->pvs_info = NULL; + } + if (sm_context_create_data->old_pdu_session_ref) { + ogs_free(sm_context_create_data->old_pdu_session_ref); + sm_context_create_data->old_pdu_session_ref = NULL; + } + if (sm_context_create_data->pcf_ue_callback_info) { + OpenAPI_pcf_ue_callback_info_free(sm_context_create_data->pcf_ue_callback_info); + sm_context_create_data->pcf_ue_callback_info = NULL; + } ogs_free(sm_context_create_data); } @@ -854,6 +961,13 @@ cJSON *OpenAPI_sm_context_create_data_convertToJSON(OpenAPI_sm_context_create_da } } + if (sm_context_create_data->is_h_nw_pub_key_id) { + if (cJSON_AddNumberToObject(item, "hNwPubKeyId", sm_context_create_data->h_nw_pub_key_id) == NULL) { + ogs_error("OpenAPI_sm_context_create_data_convertToJSON() failed [h_nw_pub_key_id]"); + goto end; + } + } + if (sm_context_create_data->eps_interworking_ind != OpenAPI_eps_interworking_indication_NULL) { if (cJSON_AddStringToObject(item, "epsInterworkingInd", OpenAPI_eps_interworking_indication_ToString(sm_context_create_data->eps_interworking_ind)) == NULL) { ogs_error("OpenAPI_sm_context_create_data_convertToJSON() failed [eps_interworking_ind]"); @@ -977,6 +1091,19 @@ cJSON *OpenAPI_sm_context_create_data_convertToJSON(OpenAPI_sm_context_create_da } } + if (sm_context_create_data->sm_context_smf_plmn_id) { + cJSON *sm_context_smf_plmn_id_local_JSON = OpenAPI_plmn_id_nid_convertToJSON(sm_context_create_data->sm_context_smf_plmn_id); + if (sm_context_smf_plmn_id_local_JSON == NULL) { + ogs_error("OpenAPI_sm_context_create_data_convertToJSON() failed [sm_context_smf_plmn_id]"); + goto end; + } + cJSON_AddItemToObject(item, "smContextSmfPlmnId", sm_context_smf_plmn_id_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_sm_context_create_data_convertToJSON() failed [sm_context_smf_plmn_id]"); + goto end; + } + } + if (sm_context_create_data->sm_context_smf_id) { if (cJSON_AddStringToObject(item, "smContextSmfId", sm_context_create_data->sm_context_smf_id) == NULL) { ogs_error("OpenAPI_sm_context_create_data_convertToJSON() failed [sm_context_smf_id]"); @@ -1132,6 +1259,158 @@ cJSON *OpenAPI_sm_context_create_data_convertToJSON(OpenAPI_sm_context_create_da } } + if (sm_context_create_data->is_same_pcf_selection_ind) { + if (cJSON_AddBoolToObject(item, "samePcfSelectionInd", sm_context_create_data->same_pcf_selection_ind) == NULL) { + ogs_error("OpenAPI_sm_context_create_data_convertToJSON() failed [same_pcf_selection_ind]"); + goto end; + } + } + + if (sm_context_create_data->target_dnai) { + if (cJSON_AddStringToObject(item, "targetDnai", sm_context_create_data->target_dnai) == NULL) { + ogs_error("OpenAPI_sm_context_create_data_convertToJSON() failed [target_dnai]"); + goto end; + } + } + + if (sm_context_create_data->nrf_management_uri) { + if (cJSON_AddStringToObject(item, "nrfManagementUri", sm_context_create_data->nrf_management_uri) == NULL) { + ogs_error("OpenAPI_sm_context_create_data_convertToJSON() failed [nrf_management_uri]"); + goto end; + } + } + + if (sm_context_create_data->nrf_discovery_uri) { + if (cJSON_AddStringToObject(item, "nrfDiscoveryUri", sm_context_create_data->nrf_discovery_uri) == NULL) { + ogs_error("OpenAPI_sm_context_create_data_convertToJSON() failed [nrf_discovery_uri]"); + goto end; + } + } + + if (sm_context_create_data->nrf_access_token_uri) { + if (cJSON_AddStringToObject(item, "nrfAccessTokenUri", sm_context_create_data->nrf_access_token_uri) == NULL) { + ogs_error("OpenAPI_sm_context_create_data_convertToJSON() failed [nrf_access_token_uri]"); + goto end; + } + } + + if (sm_context_create_data->nrf_oauth2_required) { + cJSON *nrf_oauth2_required = cJSON_AddObjectToObject(item, "nrfOauth2Required"); + if (nrf_oauth2_required == NULL) { + ogs_error("OpenAPI_sm_context_create_data_convertToJSON() failed [nrf_oauth2_required]"); + goto end; + } + cJSON *localMapObject = nrf_oauth2_required; + if (sm_context_create_data->nrf_oauth2_required) { + OpenAPI_list_for_each(sm_context_create_data->nrf_oauth2_required, node) { + OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*)node->data; + if (cJSON_AddBoolToObject(localMapObject, localKeyValue->key, (uintptr_t)localKeyValue->value) == NULL) { + ogs_error("OpenAPI_sm_context_create_data_convertToJSON() failed [inner]"); + goto end; + } + } + } + } + + if (sm_context_create_data->smf_binding_info) { + if (cJSON_AddStringToObject(item, "smfBindingInfo", sm_context_create_data->smf_binding_info) == NULL) { + ogs_error("OpenAPI_sm_context_create_data_convertToJSON() failed [smf_binding_info]"); + goto end; + } + } + + if (sm_context_create_data->pvs_info) { + cJSON *pvs_infoList = cJSON_AddArrayToObject(item, "pvsInfo"); + if (pvs_infoList == NULL) { + ogs_error("OpenAPI_sm_context_create_data_convertToJSON() failed [pvs_info]"); + goto end; + } + OpenAPI_list_for_each(sm_context_create_data->pvs_info, node) { + cJSON *itemLocal = OpenAPI_server_addressing_info_convertToJSON(node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_sm_context_create_data_convertToJSON() failed [pvs_info]"); + goto end; + } + cJSON_AddItemToArray(pvs_infoList, itemLocal); + } + } + + if (sm_context_create_data->is_onboarding_ind) { + if (cJSON_AddBoolToObject(item, "onboardingInd", sm_context_create_data->onboarding_ind) == NULL) { + ogs_error("OpenAPI_sm_context_create_data_convertToJSON() failed [onboarding_ind]"); + goto end; + } + } + + if (sm_context_create_data->old_pdu_session_ref) { + if (cJSON_AddStringToObject(item, "oldPduSessionRef", sm_context_create_data->old_pdu_session_ref) == NULL) { + ogs_error("OpenAPI_sm_context_create_data_convertToJSON() failed [old_pdu_session_ref]"); + goto end; + } + } + + if (sm_context_create_data->is_sm_policy_notify_ind) { + if (cJSON_AddBoolToObject(item, "smPolicyNotifyInd", sm_context_create_data->sm_policy_notify_ind) == NULL) { + ogs_error("OpenAPI_sm_context_create_data_convertToJSON() failed [sm_policy_notify_ind]"); + goto end; + } + } + + if (sm_context_create_data->pcf_ue_callback_info) { + cJSON *pcf_ue_callback_info_local_JSON = OpenAPI_pcf_ue_callback_info_convertToJSON(sm_context_create_data->pcf_ue_callback_info); + if (pcf_ue_callback_info_local_JSON == NULL) { + ogs_error("OpenAPI_sm_context_create_data_convertToJSON() failed [pcf_ue_callback_info]"); + goto end; + } + cJSON_AddItemToObject(item, "pcfUeCallbackInfo", pcf_ue_callback_info_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_sm_context_create_data_convertToJSON() failed [pcf_ue_callback_info]"); + goto end; + } + } + + if (sm_context_create_data->satellite_backhaul_cat != OpenAPI_satellite_backhaul_category_NULL) { + if (cJSON_AddStringToObject(item, "satelliteBackhaulCat", OpenAPI_satellite_backhaul_category_ToString(sm_context_create_data->satellite_backhaul_cat)) == NULL) { + ogs_error("OpenAPI_sm_context_create_data_convertToJSON() failed [satellite_backhaul_cat]"); + goto end; + } + } + + if (sm_context_create_data->is_upip_supported) { + if (cJSON_AddBoolToObject(item, "upipSupported", sm_context_create_data->upip_supported) == NULL) { + ogs_error("OpenAPI_sm_context_create_data_convertToJSON() failed [upip_supported]"); + goto end; + } + } + + if (sm_context_create_data->is_uav_authenticated) { + if (cJSON_AddBoolToObject(item, "uavAuthenticated", sm_context_create_data->uav_authenticated) == NULL) { + ogs_error("OpenAPI_sm_context_create_data_convertToJSON() failed [uav_authenticated]"); + goto end; + } + } + + if (sm_context_create_data->is_disaster_roaming_ind) { + if (cJSON_AddBoolToObject(item, "disasterRoamingInd", sm_context_create_data->disaster_roaming_ind) == NULL) { + ogs_error("OpenAPI_sm_context_create_data_convertToJSON() failed [disaster_roaming_ind]"); + goto end; + } + } + + if (sm_context_create_data->is_anchor_smf_oauth2_required) { + if (cJSON_AddBoolToObject(item, "anchorSmfOauth2Required", sm_context_create_data->anchor_smf_oauth2_required) == NULL) { + ogs_error("OpenAPI_sm_context_create_data_convertToJSON() failed [anchor_smf_oauth2_required]"); + goto end; + } + } + + if (sm_context_create_data->is_sm_context_smf_oauth2_required) { + if (cJSON_AddBoolToObject(item, "smContextSmfOauth2Required", sm_context_create_data->sm_context_smf_oauth2_required) == NULL) { + ogs_error("OpenAPI_sm_context_create_data_convertToJSON() failed [sm_context_smf_oauth2_required]"); + goto end; + } + } + end: return item; } @@ -1206,6 +1485,7 @@ OpenAPI_sm_context_create_data_t *OpenAPI_sm_context_create_data_parseFromJSON(c OpenAPI_trace_data_t *trace_data_local_nonprim = NULL; cJSON *udm_group_id = NULL; cJSON *routing_indicator = NULL; + cJSON *h_nw_pub_key_id = NULL; cJSON *eps_interworking_ind = NULL; OpenAPI_eps_interworking_indication_e eps_interworking_indVariable = 0; cJSON *indirect_forwarding_flag = NULL; @@ -1227,6 +1507,8 @@ OpenAPI_sm_context_create_data_t *OpenAPI_sm_context_create_data_parseFromJSON(c cJSON *n2_sm_info_type_ext1 = NULL; OpenAPI_n2_sm_info_type_e n2_sm_info_type_ext1Variable = 0; cJSON *sm_context_ref = NULL; + cJSON *sm_context_smf_plmn_id = NULL; + OpenAPI_plmn_id_nid_t *sm_context_smf_plmn_id_local_nonprim = NULL; cJSON *sm_context_smf_id = NULL; cJSON *sm_context_smf_set_id = NULL; cJSON *sm_context_smf_service_set_id = NULL; @@ -1252,6 +1534,28 @@ OpenAPI_sm_context_create_data_t *OpenAPI_sm_context_create_data_parseFromJSON(c cJSON *twif_info = NULL; OpenAPI_twif_info_t *twif_info_local_nonprim = NULL; cJSON *ran_unchanged_ind = NULL; + cJSON *same_pcf_selection_ind = NULL; + cJSON *target_dnai = NULL; + cJSON *nrf_management_uri = NULL; + cJSON *nrf_discovery_uri = NULL; + cJSON *nrf_access_token_uri = NULL; + cJSON *nrf_oauth2_required = NULL; + OpenAPI_list_t *nrf_oauth2_requiredList = NULL; + cJSON *smf_binding_info = NULL; + cJSON *pvs_info = NULL; + OpenAPI_list_t *pvs_infoList = NULL; + cJSON *onboarding_ind = NULL; + cJSON *old_pdu_session_ref = NULL; + cJSON *sm_policy_notify_ind = NULL; + cJSON *pcf_ue_callback_info = NULL; + OpenAPI_pcf_ue_callback_info_t *pcf_ue_callback_info_local_nonprim = NULL; + cJSON *satellite_backhaul_cat = NULL; + OpenAPI_satellite_backhaul_category_e satellite_backhaul_catVariable = 0; + cJSON *upip_supported = NULL; + cJSON *uav_authenticated = NULL; + cJSON *disaster_roaming_ind = NULL; + cJSON *anchor_smf_oauth2_required = NULL; + cJSON *sm_context_smf_oauth2_required = NULL; supi = cJSON_GetObjectItemCaseSensitive(sm_context_create_dataJSON, "supi"); if (supi) { if (!cJSON_IsString(supi) && !cJSON_IsNull(supi)) { @@ -1691,6 +1995,14 @@ OpenAPI_sm_context_create_data_t *OpenAPI_sm_context_create_data_parseFromJSON(c } } + h_nw_pub_key_id = cJSON_GetObjectItemCaseSensitive(sm_context_create_dataJSON, "hNwPubKeyId"); + if (h_nw_pub_key_id) { + if (!cJSON_IsNumber(h_nw_pub_key_id)) { + ogs_error("OpenAPI_sm_context_create_data_parseFromJSON() failed [h_nw_pub_key_id]"); + goto end; + } + } + eps_interworking_ind = cJSON_GetObjectItemCaseSensitive(sm_context_create_dataJSON, "epsInterworkingInd"); if (eps_interworking_ind) { if (!cJSON_IsString(eps_interworking_ind)) { @@ -1805,6 +2117,11 @@ OpenAPI_sm_context_create_data_t *OpenAPI_sm_context_create_data_parseFromJSON(c } } + sm_context_smf_plmn_id = cJSON_GetObjectItemCaseSensitive(sm_context_create_dataJSON, "smContextSmfPlmnId"); + if (sm_context_smf_plmn_id) { + sm_context_smf_plmn_id_local_nonprim = OpenAPI_plmn_id_nid_parseFromJSON(sm_context_smf_plmn_id); + } + sm_context_smf_id = cJSON_GetObjectItemCaseSensitive(sm_context_create_dataJSON, "smContextSmfId"); if (sm_context_smf_id) { if (!cJSON_IsString(sm_context_smf_id) && !cJSON_IsNull(sm_context_smf_id)) { @@ -1925,6 +2242,187 @@ OpenAPI_sm_context_create_data_t *OpenAPI_sm_context_create_data_parseFromJSON(c } } + same_pcf_selection_ind = cJSON_GetObjectItemCaseSensitive(sm_context_create_dataJSON, "samePcfSelectionInd"); + if (same_pcf_selection_ind) { + if (!cJSON_IsBool(same_pcf_selection_ind)) { + ogs_error("OpenAPI_sm_context_create_data_parseFromJSON() failed [same_pcf_selection_ind]"); + goto end; + } + } + + target_dnai = cJSON_GetObjectItemCaseSensitive(sm_context_create_dataJSON, "targetDnai"); + if (target_dnai) { + if (!cJSON_IsString(target_dnai) && !cJSON_IsNull(target_dnai)) { + ogs_error("OpenAPI_sm_context_create_data_parseFromJSON() failed [target_dnai]"); + goto end; + } + } + + nrf_management_uri = cJSON_GetObjectItemCaseSensitive(sm_context_create_dataJSON, "nrfManagementUri"); + if (nrf_management_uri) { + if (!cJSON_IsString(nrf_management_uri) && !cJSON_IsNull(nrf_management_uri)) { + ogs_error("OpenAPI_sm_context_create_data_parseFromJSON() failed [nrf_management_uri]"); + goto end; + } + } + + nrf_discovery_uri = cJSON_GetObjectItemCaseSensitive(sm_context_create_dataJSON, "nrfDiscoveryUri"); + if (nrf_discovery_uri) { + if (!cJSON_IsString(nrf_discovery_uri) && !cJSON_IsNull(nrf_discovery_uri)) { + ogs_error("OpenAPI_sm_context_create_data_parseFromJSON() failed [nrf_discovery_uri]"); + goto end; + } + } + + nrf_access_token_uri = cJSON_GetObjectItemCaseSensitive(sm_context_create_dataJSON, "nrfAccessTokenUri"); + if (nrf_access_token_uri) { + if (!cJSON_IsString(nrf_access_token_uri) && !cJSON_IsNull(nrf_access_token_uri)) { + ogs_error("OpenAPI_sm_context_create_data_parseFromJSON() failed [nrf_access_token_uri]"); + goto end; + } + } + + nrf_oauth2_required = cJSON_GetObjectItemCaseSensitive(sm_context_create_dataJSON, "nrfOauth2Required"); + if (nrf_oauth2_required) { + cJSON *nrf_oauth2_required_local_map = NULL; + if (!cJSON_IsObject(nrf_oauth2_required) && !cJSON_IsNull(nrf_oauth2_required)) { + ogs_error("OpenAPI_sm_context_create_data_parseFromJSON() failed [nrf_oauth2_required]"); + goto end; + } + if (cJSON_IsObject(nrf_oauth2_required)) { + nrf_oauth2_requiredList = OpenAPI_list_create(); + OpenAPI_map_t *localMapKeyPair = NULL; + cJSON_ArrayForEach(nrf_oauth2_required_local_map, nrf_oauth2_required) { + cJSON *localMapObject = nrf_oauth2_required_local_map; + double *localDouble = NULL; + int *localInt = NULL; + if (!cJSON_IsBool(localMapObject)) { + ogs_error("OpenAPI_sm_context_create_data_parseFromJSON() failed [inner]"); + goto end; + } + localInt = (int *)ogs_calloc(1, sizeof(int)); + if (!localInt) { + ogs_error("OpenAPI_sm_context_create_data_parseFromJSON() failed [inner]"); + goto end; + } + *localInt = localMapObject->valueint; + localMapKeyPair = OpenAPI_map_create(ogs_strdup(localMapObject->string), localInt); + OpenAPI_list_add(nrf_oauth2_requiredList, localMapKeyPair); + } + } + } + + smf_binding_info = cJSON_GetObjectItemCaseSensitive(sm_context_create_dataJSON, "smfBindingInfo"); + if (smf_binding_info) { + if (!cJSON_IsString(smf_binding_info) && !cJSON_IsNull(smf_binding_info)) { + ogs_error("OpenAPI_sm_context_create_data_parseFromJSON() failed [smf_binding_info]"); + goto end; + } + } + + pvs_info = cJSON_GetObjectItemCaseSensitive(sm_context_create_dataJSON, "pvsInfo"); + if (pvs_info) { + cJSON *pvs_info_local = NULL; + if (!cJSON_IsArray(pvs_info)) { + ogs_error("OpenAPI_sm_context_create_data_parseFromJSON() failed [pvs_info]"); + goto end; + } + + pvs_infoList = OpenAPI_list_create(); + + cJSON_ArrayForEach(pvs_info_local, pvs_info) { + if (!cJSON_IsObject(pvs_info_local)) { + ogs_error("OpenAPI_sm_context_create_data_parseFromJSON() failed [pvs_info]"); + goto end; + } + OpenAPI_server_addressing_info_t *pvs_infoItem = OpenAPI_server_addressing_info_parseFromJSON(pvs_info_local); + if (!pvs_infoItem) { + ogs_error("No pvs_infoItem"); + OpenAPI_list_free(pvs_infoList); + goto end; + } + OpenAPI_list_add(pvs_infoList, pvs_infoItem); + } + } + + onboarding_ind = cJSON_GetObjectItemCaseSensitive(sm_context_create_dataJSON, "onboardingInd"); + if (onboarding_ind) { + if (!cJSON_IsBool(onboarding_ind)) { + ogs_error("OpenAPI_sm_context_create_data_parseFromJSON() failed [onboarding_ind]"); + goto end; + } + } + + old_pdu_session_ref = cJSON_GetObjectItemCaseSensitive(sm_context_create_dataJSON, "oldPduSessionRef"); + if (old_pdu_session_ref) { + if (!cJSON_IsString(old_pdu_session_ref) && !cJSON_IsNull(old_pdu_session_ref)) { + ogs_error("OpenAPI_sm_context_create_data_parseFromJSON() failed [old_pdu_session_ref]"); + goto end; + } + } + + sm_policy_notify_ind = cJSON_GetObjectItemCaseSensitive(sm_context_create_dataJSON, "smPolicyNotifyInd"); + if (sm_policy_notify_ind) { + if (!cJSON_IsBool(sm_policy_notify_ind)) { + ogs_error("OpenAPI_sm_context_create_data_parseFromJSON() failed [sm_policy_notify_ind]"); + goto end; + } + } + + pcf_ue_callback_info = cJSON_GetObjectItemCaseSensitive(sm_context_create_dataJSON, "pcfUeCallbackInfo"); + if (pcf_ue_callback_info) { + pcf_ue_callback_info_local_nonprim = OpenAPI_pcf_ue_callback_info_parseFromJSON(pcf_ue_callback_info); + } + + satellite_backhaul_cat = cJSON_GetObjectItemCaseSensitive(sm_context_create_dataJSON, "satelliteBackhaulCat"); + if (satellite_backhaul_cat) { + if (!cJSON_IsString(satellite_backhaul_cat)) { + ogs_error("OpenAPI_sm_context_create_data_parseFromJSON() failed [satellite_backhaul_cat]"); + goto end; + } + satellite_backhaul_catVariable = OpenAPI_satellite_backhaul_category_FromString(satellite_backhaul_cat->valuestring); + } + + upip_supported = cJSON_GetObjectItemCaseSensitive(sm_context_create_dataJSON, "upipSupported"); + if (upip_supported) { + if (!cJSON_IsBool(upip_supported)) { + ogs_error("OpenAPI_sm_context_create_data_parseFromJSON() failed [upip_supported]"); + goto end; + } + } + + uav_authenticated = cJSON_GetObjectItemCaseSensitive(sm_context_create_dataJSON, "uavAuthenticated"); + if (uav_authenticated) { + if (!cJSON_IsBool(uav_authenticated)) { + ogs_error("OpenAPI_sm_context_create_data_parseFromJSON() failed [uav_authenticated]"); + goto end; + } + } + + disaster_roaming_ind = cJSON_GetObjectItemCaseSensitive(sm_context_create_dataJSON, "disasterRoamingInd"); + if (disaster_roaming_ind) { + if (!cJSON_IsBool(disaster_roaming_ind)) { + ogs_error("OpenAPI_sm_context_create_data_parseFromJSON() failed [disaster_roaming_ind]"); + goto end; + } + } + + anchor_smf_oauth2_required = cJSON_GetObjectItemCaseSensitive(sm_context_create_dataJSON, "anchorSmfOauth2Required"); + if (anchor_smf_oauth2_required) { + if (!cJSON_IsBool(anchor_smf_oauth2_required)) { + ogs_error("OpenAPI_sm_context_create_data_parseFromJSON() failed [anchor_smf_oauth2_required]"); + goto end; + } + } + + sm_context_smf_oauth2_required = cJSON_GetObjectItemCaseSensitive(sm_context_create_dataJSON, "smContextSmfOauth2Required"); + if (sm_context_smf_oauth2_required) { + if (!cJSON_IsBool(sm_context_smf_oauth2_required)) { + ogs_error("OpenAPI_sm_context_create_data_parseFromJSON() failed [sm_context_smf_oauth2_required]"); + goto end; + } + } + sm_context_create_data_local_var = OpenAPI_sm_context_create_data_create ( supi && !cJSON_IsNull(supi) ? ogs_strdup(supi->valuestring) : NULL, unauthenticated_supi ? true : false, @@ -1974,6 +2472,8 @@ OpenAPI_sm_context_create_data_t *OpenAPI_sm_context_create_data_parseFromJSON(c trace_data ? trace_data_local_nonprim : NULL, udm_group_id && !cJSON_IsNull(udm_group_id) ? ogs_strdup(udm_group_id->valuestring) : NULL, routing_indicator && !cJSON_IsNull(routing_indicator) ? ogs_strdup(routing_indicator->valuestring) : NULL, + h_nw_pub_key_id ? true : false, + h_nw_pub_key_id ? h_nw_pub_key_id->valuedouble : 0, eps_interworking_ind ? eps_interworking_indVariable : 0, indirect_forwarding_flag ? true : false, indirect_forwarding_flag ? indirect_forwarding_flag->valueint : 0, @@ -1996,6 +2496,7 @@ OpenAPI_sm_context_create_data_t *OpenAPI_sm_context_create_data_parseFromJSON(c n2_sm_info_ext1 ? n2_sm_info_ext1_local_nonprim : NULL, n2_sm_info_type_ext1 ? n2_sm_info_type_ext1Variable : 0, sm_context_ref && !cJSON_IsNull(sm_context_ref) ? ogs_strdup(sm_context_ref->valuestring) : NULL, + sm_context_smf_plmn_id ? sm_context_smf_plmn_id_local_nonprim : NULL, sm_context_smf_id && !cJSON_IsNull(sm_context_smf_id) ? ogs_strdup(sm_context_smf_id->valuestring) : NULL, sm_context_smf_set_id && !cJSON_IsNull(sm_context_smf_set_id) ? ogs_strdup(sm_context_smf_set_id->valuestring) : NULL, sm_context_smf_service_set_id && !cJSON_IsNull(sm_context_smf_service_set_id) ? ogs_strdup(sm_context_smf_service_set_id->valuestring) : NULL, @@ -2016,7 +2517,33 @@ OpenAPI_sm_context_create_data_t *OpenAPI_sm_context_create_data_parseFromJSON(c tngf_info ? tngf_info_local_nonprim : NULL, twif_info ? twif_info_local_nonprim : NULL, ran_unchanged_ind ? true : false, - ran_unchanged_ind ? ran_unchanged_ind->valueint : 0 + ran_unchanged_ind ? ran_unchanged_ind->valueint : 0, + same_pcf_selection_ind ? true : false, + same_pcf_selection_ind ? same_pcf_selection_ind->valueint : 0, + target_dnai && !cJSON_IsNull(target_dnai) ? ogs_strdup(target_dnai->valuestring) : NULL, + nrf_management_uri && !cJSON_IsNull(nrf_management_uri) ? ogs_strdup(nrf_management_uri->valuestring) : NULL, + nrf_discovery_uri && !cJSON_IsNull(nrf_discovery_uri) ? ogs_strdup(nrf_discovery_uri->valuestring) : NULL, + nrf_access_token_uri && !cJSON_IsNull(nrf_access_token_uri) ? ogs_strdup(nrf_access_token_uri->valuestring) : NULL, + nrf_oauth2_required ? nrf_oauth2_requiredList : NULL, + smf_binding_info && !cJSON_IsNull(smf_binding_info) ? ogs_strdup(smf_binding_info->valuestring) : NULL, + pvs_info ? pvs_infoList : NULL, + onboarding_ind ? true : false, + onboarding_ind ? onboarding_ind->valueint : 0, + old_pdu_session_ref && !cJSON_IsNull(old_pdu_session_ref) ? ogs_strdup(old_pdu_session_ref->valuestring) : NULL, + sm_policy_notify_ind ? true : false, + sm_policy_notify_ind ? sm_policy_notify_ind->valueint : 0, + pcf_ue_callback_info ? pcf_ue_callback_info_local_nonprim : NULL, + satellite_backhaul_cat ? satellite_backhaul_catVariable : 0, + upip_supported ? true : false, + upip_supported ? upip_supported->valueint : 0, + uav_authenticated ? true : false, + uav_authenticated ? uav_authenticated->valueint : 0, + disaster_roaming_ind ? true : false, + disaster_roaming_ind ? disaster_roaming_ind->valueint : 0, + anchor_smf_oauth2_required ? true : false, + anchor_smf_oauth2_required ? anchor_smf_oauth2_required->valueint : 0, + sm_context_smf_oauth2_required ? true : false, + sm_context_smf_oauth2_required ? sm_context_smf_oauth2_required->valueint : 0 ); return sm_context_create_data_local_var; @@ -2107,6 +2634,10 @@ end: OpenAPI_ref_to_binary_data_free(n2_sm_info_ext1_local_nonprim); n2_sm_info_ext1_local_nonprim = NULL; } + if (sm_context_smf_plmn_id_local_nonprim) { + OpenAPI_plmn_id_nid_free(sm_context_smf_plmn_id_local_nonprim); + sm_context_smf_plmn_id_local_nonprim = NULL; + } if (small_data_rate_status_local_nonprim) { OpenAPI_small_data_rate_status_free(small_data_rate_status_local_nonprim); small_data_rate_status_local_nonprim = NULL; @@ -2131,6 +2662,27 @@ end: OpenAPI_twif_info_free(twif_info_local_nonprim); twif_info_local_nonprim = NULL; } + if (nrf_oauth2_requiredList) { + OpenAPI_list_for_each(nrf_oauth2_requiredList, node) { + OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*) node->data; + ogs_free(localKeyValue->key); + ogs_free(localKeyValue->value); + OpenAPI_map_free(localKeyValue); + } + OpenAPI_list_free(nrf_oauth2_requiredList); + nrf_oauth2_requiredList = NULL; + } + if (pvs_infoList) { + OpenAPI_list_for_each(pvs_infoList, node) { + OpenAPI_server_addressing_info_free(node->data); + } + OpenAPI_list_free(pvs_infoList); + pvs_infoList = NULL; + } + if (pcf_ue_callback_info_local_nonprim) { + OpenAPI_pcf_ue_callback_info_free(pcf_ue_callback_info_local_nonprim); + pcf_ue_callback_info_local_nonprim = NULL; + } return NULL; } diff --git a/lib/sbi/openapi/model/sm_context_create_data.h b/lib/sbi/openapi/model/sm_context_create_data.h index 90b904b85..24a2e5037 100644 --- a/lib/sbi/openapi/model/sm_context_create_data.h +++ b/lib/sbi/openapi/model/sm_context_create_data.h @@ -1,7 +1,7 @@ /* * sm_context_create_data.h * - * + * Data within Create SM Context Request */ #ifndef _OpenAPI_sm_context_create_data_H_ @@ -22,12 +22,15 @@ #include "ho_state.h" #include "n2_sm_info_type.h" #include "ng_ran_target_id.h" +#include "pcf_ue_callback_info.h" #include "plmn_id_nid.h" #include "presence_state.h" #include "rat_type.h" #include "ref_to_binary_data.h" #include "request_type.h" +#include "satellite_backhaul_category.h" #include "sbi_binding_level.h" +#include "server_addressing_info.h" #include "small_data_rate_status.h" #include "snssai.h" #include "tngf_info.h" @@ -91,6 +94,8 @@ typedef struct OpenAPI_sm_context_create_data_s { struct OpenAPI_trace_data_s *trace_data; char *udm_group_id; char *routing_indicator; + bool is_h_nw_pub_key_id; + int h_nw_pub_key_id; OpenAPI_eps_interworking_indication_e eps_interworking_ind; bool is_indirect_forwarding_flag; int indirect_forwarding_flag; @@ -113,6 +118,7 @@ typedef struct OpenAPI_sm_context_create_data_s { struct OpenAPI_ref_to_binary_data_s *n2_sm_info_ext1; OpenAPI_n2_sm_info_type_e n2_sm_info_type_ext1; char *sm_context_ref; + struct OpenAPI_plmn_id_nid_s *sm_context_smf_plmn_id; char *sm_context_smf_id; char *sm_context_smf_set_id; char *sm_context_smf_service_set_id; @@ -134,6 +140,32 @@ typedef struct OpenAPI_sm_context_create_data_s { struct OpenAPI_twif_info_s *twif_info; bool is_ran_unchanged_ind; int ran_unchanged_ind; + bool is_same_pcf_selection_ind; + int same_pcf_selection_ind; + char *target_dnai; + char *nrf_management_uri; + char *nrf_discovery_uri; + char *nrf_access_token_uri; + OpenAPI_list_t* nrf_oauth2_required; + char *smf_binding_info; + OpenAPI_list_t *pvs_info; + bool is_onboarding_ind; + int onboarding_ind; + char *old_pdu_session_ref; + bool is_sm_policy_notify_ind; + int sm_policy_notify_ind; + struct OpenAPI_pcf_ue_callback_info_s *pcf_ue_callback_info; + OpenAPI_satellite_backhaul_category_e satellite_backhaul_cat; + bool is_upip_supported; + int upip_supported; + bool is_uav_authenticated; + int uav_authenticated; + bool is_disaster_roaming_ind; + int disaster_roaming_ind; + bool is_anchor_smf_oauth2_required; + int anchor_smf_oauth2_required; + bool is_sm_context_smf_oauth2_required; + int sm_context_smf_oauth2_required; } OpenAPI_sm_context_create_data_t; OpenAPI_sm_context_create_data_t *OpenAPI_sm_context_create_data_create( @@ -185,6 +217,8 @@ OpenAPI_sm_context_create_data_t *OpenAPI_sm_context_create_data_create( OpenAPI_trace_data_t *trace_data, char *udm_group_id, char *routing_indicator, + bool is_h_nw_pub_key_id, + int h_nw_pub_key_id, OpenAPI_eps_interworking_indication_e eps_interworking_ind, bool is_indirect_forwarding_flag, int indirect_forwarding_flag, @@ -207,6 +241,7 @@ OpenAPI_sm_context_create_data_t *OpenAPI_sm_context_create_data_create( OpenAPI_ref_to_binary_data_t *n2_sm_info_ext1, OpenAPI_n2_sm_info_type_e n2_sm_info_type_ext1, char *sm_context_ref, + OpenAPI_plmn_id_nid_t *sm_context_smf_plmn_id, char *sm_context_smf_id, char *sm_context_smf_set_id, char *sm_context_smf_service_set_id, @@ -227,7 +262,33 @@ OpenAPI_sm_context_create_data_t *OpenAPI_sm_context_create_data_create( OpenAPI_tngf_info_t *tngf_info, OpenAPI_twif_info_t *twif_info, bool is_ran_unchanged_ind, - int ran_unchanged_ind + int ran_unchanged_ind, + bool is_same_pcf_selection_ind, + int same_pcf_selection_ind, + char *target_dnai, + char *nrf_management_uri, + char *nrf_discovery_uri, + char *nrf_access_token_uri, + OpenAPI_list_t* nrf_oauth2_required, + char *smf_binding_info, + OpenAPI_list_t *pvs_info, + bool is_onboarding_ind, + int onboarding_ind, + char *old_pdu_session_ref, + bool is_sm_policy_notify_ind, + int sm_policy_notify_ind, + OpenAPI_pcf_ue_callback_info_t *pcf_ue_callback_info, + OpenAPI_satellite_backhaul_category_e satellite_backhaul_cat, + bool is_upip_supported, + int upip_supported, + bool is_uav_authenticated, + int uav_authenticated, + bool is_disaster_roaming_ind, + int disaster_roaming_ind, + bool is_anchor_smf_oauth2_required, + int anchor_smf_oauth2_required, + bool is_sm_context_smf_oauth2_required, + int sm_context_smf_oauth2_required ); void OpenAPI_sm_context_create_data_free(OpenAPI_sm_context_create_data_t *sm_context_create_data); OpenAPI_sm_context_create_data_t *OpenAPI_sm_context_create_data_parseFromJSON(cJSON *sm_context_create_dataJSON); diff --git a/lib/sbi/openapi/model/sm_context_create_error.h b/lib/sbi/openapi/model/sm_context_create_error.h index f6a0bdd1d..816145c71 100644 --- a/lib/sbi/openapi/model/sm_context_create_error.h +++ b/lib/sbi/openapi/model/sm_context_create_error.h @@ -1,7 +1,7 @@ /* * sm_context_create_error.h * - * + * Error within Create SM Context Response */ #ifndef _OpenAPI_sm_context_create_error_H_ diff --git a/lib/sbi/openapi/model/sm_context_created_data.c b/lib/sbi/openapi/model/sm_context_created_data.c index f3f6bfc2f..eb5635fbb 100644 --- a/lib/sbi/openapi/model/sm_context_created_data.c +++ b/lib/sbi/openapi/model/sm_context_created_data.c @@ -20,7 +20,8 @@ OpenAPI_sm_context_created_data_t *OpenAPI_sm_context_created_data_create( char *recovery_time, char *supported_features, char *selected_smf_id, - char *selected_old_smf_id + char *selected_old_smf_id, + char *inter_plmn_api_root ) { OpenAPI_sm_context_created_data_t *sm_context_created_data_local_var = ogs_malloc(sizeof(OpenAPI_sm_context_created_data_t)); @@ -42,6 +43,7 @@ OpenAPI_sm_context_created_data_t *OpenAPI_sm_context_created_data_create( sm_context_created_data_local_var->supported_features = supported_features; sm_context_created_data_local_var->selected_smf_id = selected_smf_id; sm_context_created_data_local_var->selected_old_smf_id = selected_old_smf_id; + sm_context_created_data_local_var->inter_plmn_api_root = inter_plmn_api_root; return sm_context_created_data_local_var; } @@ -100,6 +102,10 @@ void OpenAPI_sm_context_created_data_free(OpenAPI_sm_context_created_data_t *sm_ ogs_free(sm_context_created_data->selected_old_smf_id); sm_context_created_data->selected_old_smf_id = NULL; } + if (sm_context_created_data->inter_plmn_api_root) { + ogs_free(sm_context_created_data->inter_plmn_api_root); + sm_context_created_data->inter_plmn_api_root = NULL; + } ogs_free(sm_context_created_data); } @@ -240,6 +246,13 @@ cJSON *OpenAPI_sm_context_created_data_convertToJSON(OpenAPI_sm_context_created_ } } + if (sm_context_created_data->inter_plmn_api_root) { + if (cJSON_AddStringToObject(item, "interPlmnApiRoot", sm_context_created_data->inter_plmn_api_root) == NULL) { + ogs_error("OpenAPI_sm_context_created_data_convertToJSON() failed [inter_plmn_api_root]"); + goto end; + } + } + end: return item; } @@ -269,6 +282,7 @@ OpenAPI_sm_context_created_data_t *OpenAPI_sm_context_created_data_parseFromJSON cJSON *supported_features = NULL; cJSON *selected_smf_id = NULL; cJSON *selected_old_smf_id = NULL; + cJSON *inter_plmn_api_root = NULL; h_smf_uri = cJSON_GetObjectItemCaseSensitive(sm_context_created_dataJSON, "hSmfUri"); if (h_smf_uri) { if (!cJSON_IsString(h_smf_uri) && !cJSON_IsNull(h_smf_uri)) { @@ -403,6 +417,14 @@ OpenAPI_sm_context_created_data_t *OpenAPI_sm_context_created_data_parseFromJSON } } + inter_plmn_api_root = cJSON_GetObjectItemCaseSensitive(sm_context_created_dataJSON, "interPlmnApiRoot"); + if (inter_plmn_api_root) { + if (!cJSON_IsString(inter_plmn_api_root) && !cJSON_IsNull(inter_plmn_api_root)) { + ogs_error("OpenAPI_sm_context_created_data_parseFromJSON() failed [inter_plmn_api_root]"); + goto end; + } + } + sm_context_created_data_local_var = OpenAPI_sm_context_created_data_create ( h_smf_uri && !cJSON_IsNull(h_smf_uri) ? ogs_strdup(h_smf_uri->valuestring) : NULL, smf_uri && !cJSON_IsNull(smf_uri) ? ogs_strdup(smf_uri->valuestring) : NULL, @@ -419,7 +441,8 @@ OpenAPI_sm_context_created_data_t *OpenAPI_sm_context_created_data_parseFromJSON recovery_time && !cJSON_IsNull(recovery_time) ? ogs_strdup(recovery_time->valuestring) : NULL, supported_features && !cJSON_IsNull(supported_features) ? ogs_strdup(supported_features->valuestring) : NULL, selected_smf_id && !cJSON_IsNull(selected_smf_id) ? ogs_strdup(selected_smf_id->valuestring) : NULL, - selected_old_smf_id && !cJSON_IsNull(selected_old_smf_id) ? ogs_strdup(selected_old_smf_id->valuestring) : NULL + selected_old_smf_id && !cJSON_IsNull(selected_old_smf_id) ? ogs_strdup(selected_old_smf_id->valuestring) : NULL, + inter_plmn_api_root && !cJSON_IsNull(inter_plmn_api_root) ? ogs_strdup(inter_plmn_api_root->valuestring) : NULL ); return sm_context_created_data_local_var; diff --git a/lib/sbi/openapi/model/sm_context_created_data.h b/lib/sbi/openapi/model/sm_context_created_data.h index 2b9921af3..5511841f3 100644 --- a/lib/sbi/openapi/model/sm_context_created_data.h +++ b/lib/sbi/openapi/model/sm_context_created_data.h @@ -1,7 +1,7 @@ /* * sm_context_created_data.h * - * + * Data within Create SM Context Response */ #ifndef _OpenAPI_sm_context_created_data_H_ @@ -41,6 +41,7 @@ typedef struct OpenAPI_sm_context_created_data_s { char *supported_features; char *selected_smf_id; char *selected_old_smf_id; + char *inter_plmn_api_root; } OpenAPI_sm_context_created_data_t; OpenAPI_sm_context_created_data_t *OpenAPI_sm_context_created_data_create( @@ -59,7 +60,8 @@ OpenAPI_sm_context_created_data_t *OpenAPI_sm_context_created_data_create( char *recovery_time, char *supported_features, char *selected_smf_id, - char *selected_old_smf_id + char *selected_old_smf_id, + char *inter_plmn_api_root ); void OpenAPI_sm_context_created_data_free(OpenAPI_sm_context_created_data_t *sm_context_created_data); OpenAPI_sm_context_created_data_t *OpenAPI_sm_context_created_data_parseFromJSON(cJSON *sm_context_created_dataJSON); diff --git a/lib/sbi/openapi/model/sm_context_release_data.h b/lib/sbi/openapi/model/sm_context_release_data.h index 0f985da51..e71b6db85 100644 --- a/lib/sbi/openapi/model/sm_context_release_data.h +++ b/lib/sbi/openapi/model/sm_context_release_data.h @@ -1,7 +1,7 @@ /* * sm_context_release_data.h * - * + * Data within Release SM Context Request */ #ifndef _OpenAPI_sm_context_release_data_H_ diff --git a/lib/sbi/openapi/model/sm_context_released_data.h b/lib/sbi/openapi/model/sm_context_released_data.h index bad5c3f8b..dba729e4c 100644 --- a/lib/sbi/openapi/model/sm_context_released_data.h +++ b/lib/sbi/openapi/model/sm_context_released_data.h @@ -1,7 +1,7 @@ /* * sm_context_released_data.h * - * + * Data within Release SM Context Response */ #ifndef _OpenAPI_sm_context_released_data_H_ diff --git a/lib/sbi/openapi/model/sm_context_retrieve_data.h b/lib/sbi/openapi/model/sm_context_retrieve_data.h index 7911d8105..e14d6ee5c 100644 --- a/lib/sbi/openapi/model/sm_context_retrieve_data.h +++ b/lib/sbi/openapi/model/sm_context_retrieve_data.h @@ -1,7 +1,7 @@ /* * sm_context_retrieve_data.h * - * + * Data within Retrieve SM Context Request */ #ifndef _OpenAPI_sm_context_retrieve_data_H_ diff --git a/lib/sbi/openapi/model/sm_context_retrieved_data.c b/lib/sbi/openapi/model/sm_context_retrieved_data.c index fe151fc05..3e5e588b0 100644 --- a/lib/sbi/openapi/model/sm_context_retrieved_data.c +++ b/lib/sbi/openapi/model/sm_context_retrieved_data.c @@ -10,7 +10,8 @@ OpenAPI_sm_context_retrieved_data_t *OpenAPI_sm_context_retrieved_data_create( OpenAPI_small_data_rate_status_t *small_data_rate_status, OpenAPI_apn_rate_status_t *apn_rate_status, bool is_dl_data_waiting_ind, - int dl_data_waiting_ind + int dl_data_waiting_ind, + OpenAPI_af_coordination_info_t *af_coordination_info ) { OpenAPI_sm_context_retrieved_data_t *sm_context_retrieved_data_local_var = ogs_malloc(sizeof(OpenAPI_sm_context_retrieved_data_t)); @@ -22,6 +23,7 @@ OpenAPI_sm_context_retrieved_data_t *OpenAPI_sm_context_retrieved_data_create( sm_context_retrieved_data_local_var->apn_rate_status = apn_rate_status; sm_context_retrieved_data_local_var->is_dl_data_waiting_ind = is_dl_data_waiting_ind; sm_context_retrieved_data_local_var->dl_data_waiting_ind = dl_data_waiting_ind; + sm_context_retrieved_data_local_var->af_coordination_info = af_coordination_info; return sm_context_retrieved_data_local_var; } @@ -49,6 +51,10 @@ void OpenAPI_sm_context_retrieved_data_free(OpenAPI_sm_context_retrieved_data_t OpenAPI_apn_rate_status_free(sm_context_retrieved_data->apn_rate_status); sm_context_retrieved_data->apn_rate_status = NULL; } + if (sm_context_retrieved_data->af_coordination_info) { + OpenAPI_af_coordination_info_free(sm_context_retrieved_data->af_coordination_info); + sm_context_retrieved_data->af_coordination_info = NULL; + } ogs_free(sm_context_retrieved_data); } @@ -118,6 +124,19 @@ cJSON *OpenAPI_sm_context_retrieved_data_convertToJSON(OpenAPI_sm_context_retrie } } + if (sm_context_retrieved_data->af_coordination_info) { + cJSON *af_coordination_info_local_JSON = OpenAPI_af_coordination_info_convertToJSON(sm_context_retrieved_data->af_coordination_info); + if (af_coordination_info_local_JSON == NULL) { + ogs_error("OpenAPI_sm_context_retrieved_data_convertToJSON() failed [af_coordination_info]"); + goto end; + } + cJSON_AddItemToObject(item, "afCoordinationInfo", af_coordination_info_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_sm_context_retrieved_data_convertToJSON() failed [af_coordination_info]"); + goto end; + } + } + end: return item; } @@ -134,6 +153,8 @@ OpenAPI_sm_context_retrieved_data_t *OpenAPI_sm_context_retrieved_data_parseFrom cJSON *apn_rate_status = NULL; OpenAPI_apn_rate_status_t *apn_rate_status_local_nonprim = NULL; cJSON *dl_data_waiting_ind = NULL; + cJSON *af_coordination_info = NULL; + OpenAPI_af_coordination_info_t *af_coordination_info_local_nonprim = NULL; ue_eps_pdn_connection = cJSON_GetObjectItemCaseSensitive(sm_context_retrieved_dataJSON, "ueEpsPdnConnection"); if (!ue_eps_pdn_connection) { ogs_error("OpenAPI_sm_context_retrieved_data_parseFromJSON() failed [ue_eps_pdn_connection]"); @@ -167,13 +188,19 @@ OpenAPI_sm_context_retrieved_data_t *OpenAPI_sm_context_retrieved_data_parseFrom } } + af_coordination_info = cJSON_GetObjectItemCaseSensitive(sm_context_retrieved_dataJSON, "afCoordinationInfo"); + if (af_coordination_info) { + af_coordination_info_local_nonprim = OpenAPI_af_coordination_info_parseFromJSON(af_coordination_info); + } + sm_context_retrieved_data_local_var = OpenAPI_sm_context_retrieved_data_create ( ogs_strdup(ue_eps_pdn_connection->valuestring), sm_context ? sm_context_local_nonprim : NULL, small_data_rate_status ? small_data_rate_status_local_nonprim : NULL, apn_rate_status ? apn_rate_status_local_nonprim : NULL, dl_data_waiting_ind ? true : false, - dl_data_waiting_ind ? dl_data_waiting_ind->valueint : 0 + dl_data_waiting_ind ? dl_data_waiting_ind->valueint : 0, + af_coordination_info ? af_coordination_info_local_nonprim : NULL ); return sm_context_retrieved_data_local_var; @@ -190,6 +217,10 @@ end: OpenAPI_apn_rate_status_free(apn_rate_status_local_nonprim); apn_rate_status_local_nonprim = NULL; } + if (af_coordination_info_local_nonprim) { + OpenAPI_af_coordination_info_free(af_coordination_info_local_nonprim); + af_coordination_info_local_nonprim = NULL; + } return NULL; } diff --git a/lib/sbi/openapi/model/sm_context_retrieved_data.h b/lib/sbi/openapi/model/sm_context_retrieved_data.h index 4f2f518aa..9eeb030e6 100644 --- a/lib/sbi/openapi/model/sm_context_retrieved_data.h +++ b/lib/sbi/openapi/model/sm_context_retrieved_data.h @@ -1,7 +1,7 @@ /* * sm_context_retrieved_data.h * - * + * Data within Retrieve SM Context Response */ #ifndef _OpenAPI_sm_context_retrieved_data_H_ @@ -12,6 +12,7 @@ #include "../include/list.h" #include "../include/keyValuePair.h" #include "../include/binary.h" +#include "af_coordination_info.h" #include "apn_rate_status.h" #include "sm_context.h" #include "small_data_rate_status.h" @@ -28,6 +29,7 @@ typedef struct OpenAPI_sm_context_retrieved_data_s { struct OpenAPI_apn_rate_status_s *apn_rate_status; bool is_dl_data_waiting_ind; int dl_data_waiting_ind; + struct OpenAPI_af_coordination_info_s *af_coordination_info; } OpenAPI_sm_context_retrieved_data_t; OpenAPI_sm_context_retrieved_data_t *OpenAPI_sm_context_retrieved_data_create( @@ -36,7 +38,8 @@ OpenAPI_sm_context_retrieved_data_t *OpenAPI_sm_context_retrieved_data_create( OpenAPI_small_data_rate_status_t *small_data_rate_status, OpenAPI_apn_rate_status_t *apn_rate_status, bool is_dl_data_waiting_ind, - int dl_data_waiting_ind + int dl_data_waiting_ind, + OpenAPI_af_coordination_info_t *af_coordination_info ); void OpenAPI_sm_context_retrieved_data_free(OpenAPI_sm_context_retrieved_data_t *sm_context_retrieved_data); OpenAPI_sm_context_retrieved_data_t *OpenAPI_sm_context_retrieved_data_parseFromJSON(cJSON *sm_context_retrieved_dataJSON); diff --git a/lib/sbi/openapi/model/sm_context_status_notification.c b/lib/sbi/openapi/model/sm_context_status_notification.c index 4ff50bb05..93ae86d67 100644 --- a/lib/sbi/openapi/model/sm_context_status_notification.c +++ b/lib/sbi/openapi/model/sm_context_status_notification.c @@ -11,12 +11,16 @@ OpenAPI_sm_context_status_notification_t *OpenAPI_sm_context_status_notification bool is_ddn_failure_status, int ddn_failure_status, OpenAPI_list_t *notify_correlation_ids_forddn_failure, + char *new_intermediate_smf_id, char *new_smf_id, char *new_smf_set_id, char *old_smf_id, char *old_sm_context_ref, char *alt_anchor_smf_uri, - char *alt_anchor_smf_id + char *alt_anchor_smf_id, + OpenAPI_target_dnai_info_t *target_dnai_info, + char *old_pdu_session_ref, + char *inter_plmn_api_root ) { OpenAPI_sm_context_status_notification_t *sm_context_status_notification_local_var = ogs_malloc(sizeof(OpenAPI_sm_context_status_notification_t)); @@ -28,12 +32,16 @@ OpenAPI_sm_context_status_notification_t *OpenAPI_sm_context_status_notification sm_context_status_notification_local_var->is_ddn_failure_status = is_ddn_failure_status; sm_context_status_notification_local_var->ddn_failure_status = ddn_failure_status; sm_context_status_notification_local_var->notify_correlation_ids_forddn_failure = notify_correlation_ids_forddn_failure; + sm_context_status_notification_local_var->new_intermediate_smf_id = new_intermediate_smf_id; sm_context_status_notification_local_var->new_smf_id = new_smf_id; sm_context_status_notification_local_var->new_smf_set_id = new_smf_set_id; sm_context_status_notification_local_var->old_smf_id = old_smf_id; sm_context_status_notification_local_var->old_sm_context_ref = old_sm_context_ref; sm_context_status_notification_local_var->alt_anchor_smf_uri = alt_anchor_smf_uri; sm_context_status_notification_local_var->alt_anchor_smf_id = alt_anchor_smf_id; + sm_context_status_notification_local_var->target_dnai_info = target_dnai_info; + sm_context_status_notification_local_var->old_pdu_session_ref = old_pdu_session_ref; + sm_context_status_notification_local_var->inter_plmn_api_root = inter_plmn_api_root; return sm_context_status_notification_local_var; } @@ -64,6 +72,10 @@ void OpenAPI_sm_context_status_notification_free(OpenAPI_sm_context_status_notif OpenAPI_list_free(sm_context_status_notification->notify_correlation_ids_forddn_failure); sm_context_status_notification->notify_correlation_ids_forddn_failure = NULL; } + if (sm_context_status_notification->new_intermediate_smf_id) { + ogs_free(sm_context_status_notification->new_intermediate_smf_id); + sm_context_status_notification->new_intermediate_smf_id = NULL; + } if (sm_context_status_notification->new_smf_id) { ogs_free(sm_context_status_notification->new_smf_id); sm_context_status_notification->new_smf_id = NULL; @@ -88,6 +100,18 @@ void OpenAPI_sm_context_status_notification_free(OpenAPI_sm_context_status_notif ogs_free(sm_context_status_notification->alt_anchor_smf_id); sm_context_status_notification->alt_anchor_smf_id = NULL; } + if (sm_context_status_notification->target_dnai_info) { + OpenAPI_target_dnai_info_free(sm_context_status_notification->target_dnai_info); + sm_context_status_notification->target_dnai_info = NULL; + } + if (sm_context_status_notification->old_pdu_session_ref) { + ogs_free(sm_context_status_notification->old_pdu_session_ref); + sm_context_status_notification->old_pdu_session_ref = NULL; + } + if (sm_context_status_notification->inter_plmn_api_root) { + ogs_free(sm_context_status_notification->inter_plmn_api_root); + sm_context_status_notification->inter_plmn_api_root = NULL; + } ogs_free(sm_context_status_notification); } @@ -164,6 +188,13 @@ cJSON *OpenAPI_sm_context_status_notification_convertToJSON(OpenAPI_sm_context_s } } + if (sm_context_status_notification->new_intermediate_smf_id) { + if (cJSON_AddStringToObject(item, "newIntermediateSmfId", sm_context_status_notification->new_intermediate_smf_id) == NULL) { + ogs_error("OpenAPI_sm_context_status_notification_convertToJSON() failed [new_intermediate_smf_id]"); + goto end; + } + } + if (sm_context_status_notification->new_smf_id) { if (cJSON_AddStringToObject(item, "newSmfId", sm_context_status_notification->new_smf_id) == NULL) { ogs_error("OpenAPI_sm_context_status_notification_convertToJSON() failed [new_smf_id]"); @@ -206,6 +237,33 @@ cJSON *OpenAPI_sm_context_status_notification_convertToJSON(OpenAPI_sm_context_s } } + if (sm_context_status_notification->target_dnai_info) { + cJSON *target_dnai_info_local_JSON = OpenAPI_target_dnai_info_convertToJSON(sm_context_status_notification->target_dnai_info); + if (target_dnai_info_local_JSON == NULL) { + ogs_error("OpenAPI_sm_context_status_notification_convertToJSON() failed [target_dnai_info]"); + goto end; + } + cJSON_AddItemToObject(item, "targetDnaiInfo", target_dnai_info_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_sm_context_status_notification_convertToJSON() failed [target_dnai_info]"); + goto end; + } + } + + if (sm_context_status_notification->old_pdu_session_ref) { + if (cJSON_AddStringToObject(item, "oldPduSessionRef", sm_context_status_notification->old_pdu_session_ref) == NULL) { + ogs_error("OpenAPI_sm_context_status_notification_convertToJSON() failed [old_pdu_session_ref]"); + goto end; + } + } + + if (sm_context_status_notification->inter_plmn_api_root) { + if (cJSON_AddStringToObject(item, "interPlmnApiRoot", sm_context_status_notification->inter_plmn_api_root) == NULL) { + ogs_error("OpenAPI_sm_context_status_notification_convertToJSON() failed [inter_plmn_api_root]"); + goto end; + } + } + end: return item; } @@ -223,12 +281,17 @@ OpenAPI_sm_context_status_notification_t *OpenAPI_sm_context_status_notification cJSON *ddn_failure_status = NULL; cJSON *notify_correlation_ids_forddn_failure = NULL; OpenAPI_list_t *notify_correlation_ids_forddn_failureList = NULL; + cJSON *new_intermediate_smf_id = NULL; cJSON *new_smf_id = NULL; cJSON *new_smf_set_id = NULL; cJSON *old_smf_id = NULL; cJSON *old_sm_context_ref = NULL; cJSON *alt_anchor_smf_uri = NULL; cJSON *alt_anchor_smf_id = NULL; + cJSON *target_dnai_info = NULL; + OpenAPI_target_dnai_info_t *target_dnai_info_local_nonprim = NULL; + cJSON *old_pdu_session_ref = NULL; + cJSON *inter_plmn_api_root = NULL; status_info = cJSON_GetObjectItemCaseSensitive(sm_context_status_notificationJSON, "statusInfo"); if (!status_info) { ogs_error("OpenAPI_sm_context_status_notification_parseFromJSON() failed [status_info]"); @@ -275,6 +338,14 @@ OpenAPI_sm_context_status_notification_t *OpenAPI_sm_context_status_notification } } + new_intermediate_smf_id = cJSON_GetObjectItemCaseSensitive(sm_context_status_notificationJSON, "newIntermediateSmfId"); + if (new_intermediate_smf_id) { + if (!cJSON_IsString(new_intermediate_smf_id) && !cJSON_IsNull(new_intermediate_smf_id)) { + ogs_error("OpenAPI_sm_context_status_notification_parseFromJSON() failed [new_intermediate_smf_id]"); + goto end; + } + } + new_smf_id = cJSON_GetObjectItemCaseSensitive(sm_context_status_notificationJSON, "newSmfId"); if (new_smf_id) { if (!cJSON_IsString(new_smf_id) && !cJSON_IsNull(new_smf_id)) { @@ -323,6 +394,27 @@ OpenAPI_sm_context_status_notification_t *OpenAPI_sm_context_status_notification } } + target_dnai_info = cJSON_GetObjectItemCaseSensitive(sm_context_status_notificationJSON, "targetDnaiInfo"); + if (target_dnai_info) { + target_dnai_info_local_nonprim = OpenAPI_target_dnai_info_parseFromJSON(target_dnai_info); + } + + old_pdu_session_ref = cJSON_GetObjectItemCaseSensitive(sm_context_status_notificationJSON, "oldPduSessionRef"); + if (old_pdu_session_ref) { + if (!cJSON_IsString(old_pdu_session_ref) && !cJSON_IsNull(old_pdu_session_ref)) { + ogs_error("OpenAPI_sm_context_status_notification_parseFromJSON() failed [old_pdu_session_ref]"); + goto end; + } + } + + inter_plmn_api_root = cJSON_GetObjectItemCaseSensitive(sm_context_status_notificationJSON, "interPlmnApiRoot"); + if (inter_plmn_api_root) { + if (!cJSON_IsString(inter_plmn_api_root) && !cJSON_IsNull(inter_plmn_api_root)) { + ogs_error("OpenAPI_sm_context_status_notification_parseFromJSON() failed [inter_plmn_api_root]"); + goto end; + } + } + sm_context_status_notification_local_var = OpenAPI_sm_context_status_notification_create ( status_info_local_nonprim, small_data_rate_status ? small_data_rate_status_local_nonprim : NULL, @@ -330,12 +422,16 @@ OpenAPI_sm_context_status_notification_t *OpenAPI_sm_context_status_notification ddn_failure_status ? true : false, ddn_failure_status ? ddn_failure_status->valueint : 0, notify_correlation_ids_forddn_failure ? notify_correlation_ids_forddn_failureList : NULL, + new_intermediate_smf_id && !cJSON_IsNull(new_intermediate_smf_id) ? ogs_strdup(new_intermediate_smf_id->valuestring) : NULL, new_smf_id && !cJSON_IsNull(new_smf_id) ? ogs_strdup(new_smf_id->valuestring) : NULL, new_smf_set_id && !cJSON_IsNull(new_smf_set_id) ? ogs_strdup(new_smf_set_id->valuestring) : NULL, old_smf_id && !cJSON_IsNull(old_smf_id) ? ogs_strdup(old_smf_id->valuestring) : NULL, old_sm_context_ref && !cJSON_IsNull(old_sm_context_ref) ? ogs_strdup(old_sm_context_ref->valuestring) : NULL, alt_anchor_smf_uri && !cJSON_IsNull(alt_anchor_smf_uri) ? ogs_strdup(alt_anchor_smf_uri->valuestring) : NULL, - alt_anchor_smf_id && !cJSON_IsNull(alt_anchor_smf_id) ? ogs_strdup(alt_anchor_smf_id->valuestring) : NULL + alt_anchor_smf_id && !cJSON_IsNull(alt_anchor_smf_id) ? ogs_strdup(alt_anchor_smf_id->valuestring) : NULL, + target_dnai_info ? target_dnai_info_local_nonprim : NULL, + old_pdu_session_ref && !cJSON_IsNull(old_pdu_session_ref) ? ogs_strdup(old_pdu_session_ref->valuestring) : NULL, + inter_plmn_api_root && !cJSON_IsNull(inter_plmn_api_root) ? ogs_strdup(inter_plmn_api_root->valuestring) : NULL ); return sm_context_status_notification_local_var; @@ -359,6 +455,10 @@ end: OpenAPI_list_free(notify_correlation_ids_forddn_failureList); notify_correlation_ids_forddn_failureList = NULL; } + if (target_dnai_info_local_nonprim) { + OpenAPI_target_dnai_info_free(target_dnai_info_local_nonprim); + target_dnai_info_local_nonprim = NULL; + } return NULL; } diff --git a/lib/sbi/openapi/model/sm_context_status_notification.h b/lib/sbi/openapi/model/sm_context_status_notification.h index c40e607c1..9091bac59 100644 --- a/lib/sbi/openapi/model/sm_context_status_notification.h +++ b/lib/sbi/openapi/model/sm_context_status_notification.h @@ -1,7 +1,7 @@ /* * sm_context_status_notification.h * - * + * Data within Notify SM Context Status Request */ #ifndef _OpenAPI_sm_context_status_notification_H_ @@ -15,6 +15,7 @@ #include "apn_rate_status.h" #include "small_data_rate_status.h" #include "status_info.h" +#include "target_dnai_info.h" #ifdef __cplusplus extern "C" { @@ -28,12 +29,16 @@ typedef struct OpenAPI_sm_context_status_notification_s { bool is_ddn_failure_status; int ddn_failure_status; OpenAPI_list_t *notify_correlation_ids_forddn_failure; + char *new_intermediate_smf_id; char *new_smf_id; char *new_smf_set_id; char *old_smf_id; char *old_sm_context_ref; char *alt_anchor_smf_uri; char *alt_anchor_smf_id; + struct OpenAPI_target_dnai_info_s *target_dnai_info; + char *old_pdu_session_ref; + char *inter_plmn_api_root; } OpenAPI_sm_context_status_notification_t; OpenAPI_sm_context_status_notification_t *OpenAPI_sm_context_status_notification_create( @@ -43,12 +48,16 @@ OpenAPI_sm_context_status_notification_t *OpenAPI_sm_context_status_notification bool is_ddn_failure_status, int ddn_failure_status, OpenAPI_list_t *notify_correlation_ids_forddn_failure, + char *new_intermediate_smf_id, char *new_smf_id, char *new_smf_set_id, char *old_smf_id, char *old_sm_context_ref, char *alt_anchor_smf_uri, - char *alt_anchor_smf_id + char *alt_anchor_smf_id, + OpenAPI_target_dnai_info_t *target_dnai_info, + char *old_pdu_session_ref, + char *inter_plmn_api_root ); void OpenAPI_sm_context_status_notification_free(OpenAPI_sm_context_status_notification_t *sm_context_status_notification); OpenAPI_sm_context_status_notification_t *OpenAPI_sm_context_status_notification_parseFromJSON(cJSON *sm_context_status_notificationJSON); diff --git a/lib/sbi/openapi/model/sm_context_type.c b/lib/sbi/openapi/model/sm_context_type.c index e0f54845a..98c99e5fc 100644 --- a/lib/sbi/openapi/model/sm_context_type.c +++ b/lib/sbi/openapi/model/sm_context_type.c @@ -6,7 +6,7 @@ char* OpenAPI_sm_context_type_ToString(OpenAPI_sm_context_type_e sm_context_type) { - const char *sm_context_typeArray[] = { "NULL", "EPS_PDN_CONNECTION", "SM_CONTEXT" }; + const char *sm_context_typeArray[] = { "NULL", "EPS_PDN_CONNECTION", "SM_CONTEXT", "AF_COORDINATION_INFO" }; size_t sizeofArray = sizeof(sm_context_typeArray) / sizeof(sm_context_typeArray[0]); if (sm_context_type < sizeofArray) return (char *)sm_context_typeArray[sm_context_type]; @@ -17,7 +17,7 @@ char* OpenAPI_sm_context_type_ToString(OpenAPI_sm_context_type_e sm_context_type OpenAPI_sm_context_type_e OpenAPI_sm_context_type_FromString(char* sm_context_type) { int stringToReturn = 0; - const char *sm_context_typeArray[] = { "NULL", "EPS_PDN_CONNECTION", "SM_CONTEXT" }; + const char *sm_context_typeArray[] = { "NULL", "EPS_PDN_CONNECTION", "SM_CONTEXT", "AF_COORDINATION_INFO" }; size_t sizeofArray = sizeof(sm_context_typeArray) / sizeof(sm_context_typeArray[0]); while (stringToReturn < sizeofArray) { if (strcmp(sm_context_type, sm_context_typeArray[stringToReturn]) == 0) { diff --git a/lib/sbi/openapi/model/sm_context_type.h b/lib/sbi/openapi/model/sm_context_type.h index 601fe1011..61268242a 100644 --- a/lib/sbi/openapi/model/sm_context_type.h +++ b/lib/sbi/openapi/model/sm_context_type.h @@ -17,7 +17,7 @@ extern "C" { #endif -typedef enum { OpenAPI_sm_context_type_NULL = 0, OpenAPI_sm_context_type_EPS_PDN_CONNECTION, OpenAPI_sm_context_type_SM_CONTEXT } OpenAPI_sm_context_type_e; +typedef enum { OpenAPI_sm_context_type_NULL = 0, OpenAPI_sm_context_type_EPS_PDN_CONNECTION, OpenAPI_sm_context_type_SM_CONTEXT, OpenAPI_sm_context_type_AF_COORDINATION_INFO } OpenAPI_sm_context_type_e; char* OpenAPI_sm_context_type_ToString(OpenAPI_sm_context_type_e sm_context_type); diff --git a/lib/sbi/openapi/model/sm_context_update_data.c b/lib/sbi/openapi/model/sm_context_update_data.c index 7a4ff5e07..0350c30d9 100644 --- a/lib/sbi/openapi/model/sm_context_update_data.c +++ b/lib/sbi/openapi/model/sm_context_update_data.c @@ -4,6 +4,29 @@ #include #include "sm_context_update_data.h" +char *OpenAPI_sm_policy_notify_indsm_context_update_data_ToString(OpenAPI_sm_context_update_data_sm_policy_notify_ind_e sm_policy_notify_ind) +{ + const char *sm_policy_notify_indArray[] = { "NULL", "true" }; + size_t sizeofArray = sizeof(sm_policy_notify_indArray) / sizeof(sm_policy_notify_indArray[0]); + if (sm_policy_notify_ind < sizeofArray) + return (char *)sm_policy_notify_indArray[sm_policy_notify_ind]; + else + return (char *)"Unknown"; +} + +OpenAPI_sm_context_update_data_sm_policy_notify_ind_e OpenAPI_sm_policy_notify_indsm_context_update_data_FromString(char* sm_policy_notify_ind) +{ + int stringToReturn = 0; + const char *sm_policy_notify_indArray[] = { "NULL", "true" }; + size_t sizeofArray = sizeof(sm_policy_notify_indArray) / sizeof(sm_policy_notify_indArray[0]); + while (stringToReturn < sizeofArray) { + if (strcmp(sm_policy_notify_ind, sm_policy_notify_indArray[stringToReturn]) == 0) { + return stringToReturn; + } + stringToReturn++; + } + return 0; +} OpenAPI_sm_context_update_data_t *OpenAPI_sm_context_update_data_create( char *pei, char *serving_nf_id, @@ -35,6 +58,9 @@ OpenAPI_sm_context_update_data_t *OpenAPI_sm_context_update_data_create( OpenAPI_tunnel_info_t *n9_forwarding_tunnel, OpenAPI_list_t *n9_dl_forwarding_tnl_list, OpenAPI_list_t *n9_ul_forwarding_tnl_list, + OpenAPI_tunnel_info_t *n9_dl_forwarding_tunnel, + bool is_n9_inactivity_timer, + int n9_inactivity_timer, OpenAPI_list_t *eps_bearer_setup, OpenAPI_list_t *revoke_ebi_list, bool is_release, @@ -62,7 +88,13 @@ OpenAPI_sm_context_update_data_t *OpenAPI_sm_context_update_data_create( int extended_nas_sm_timer_ind, char *forwarding_f_teid, OpenAPI_list_t *forwarding_bearer_contexts, - OpenAPI_ddn_failure_subs_t *ddn_failure_subs + OpenAPI_ddn_failure_subs_t *ddn_failure_subs, + bool is_skip_n2_pdu_session_res_rel_ind, + int skip_n2_pdu_session_res_rel_ind, + OpenAPI_list_t *secondary_rat_usage_data_report_container, + OpenAPI_sm_context_update_data_sm_policy_notify_ind_e sm_policy_notify_ind, + OpenAPI_pcf_ue_callback_info_t *pcf_ue_callback_info, + OpenAPI_satellite_backhaul_category_e satellite_backhaul_cat ) { OpenAPI_sm_context_update_data_t *sm_context_update_data_local_var = ogs_malloc(sizeof(OpenAPI_sm_context_update_data_t)); @@ -98,6 +130,9 @@ OpenAPI_sm_context_update_data_t *OpenAPI_sm_context_update_data_create( sm_context_update_data_local_var->n9_forwarding_tunnel = n9_forwarding_tunnel; sm_context_update_data_local_var->n9_dl_forwarding_tnl_list = n9_dl_forwarding_tnl_list; sm_context_update_data_local_var->n9_ul_forwarding_tnl_list = n9_ul_forwarding_tnl_list; + sm_context_update_data_local_var->n9_dl_forwarding_tunnel = n9_dl_forwarding_tunnel; + sm_context_update_data_local_var->is_n9_inactivity_timer = is_n9_inactivity_timer; + sm_context_update_data_local_var->n9_inactivity_timer = n9_inactivity_timer; sm_context_update_data_local_var->eps_bearer_setup = eps_bearer_setup; sm_context_update_data_local_var->revoke_ebi_list = revoke_ebi_list; sm_context_update_data_local_var->is_release = is_release; @@ -126,6 +161,12 @@ OpenAPI_sm_context_update_data_t *OpenAPI_sm_context_update_data_create( sm_context_update_data_local_var->forwarding_f_teid = forwarding_f_teid; sm_context_update_data_local_var->forwarding_bearer_contexts = forwarding_bearer_contexts; sm_context_update_data_local_var->ddn_failure_subs = ddn_failure_subs; + sm_context_update_data_local_var->is_skip_n2_pdu_session_res_rel_ind = is_skip_n2_pdu_session_res_rel_ind; + sm_context_update_data_local_var->skip_n2_pdu_session_res_rel_ind = skip_n2_pdu_session_res_rel_ind; + sm_context_update_data_local_var->secondary_rat_usage_data_report_container = secondary_rat_usage_data_report_container; + sm_context_update_data_local_var->sm_policy_notify_ind = sm_policy_notify_ind; + sm_context_update_data_local_var->pcf_ue_callback_info = pcf_ue_callback_info; + sm_context_update_data_local_var->satellite_backhaul_cat = satellite_backhaul_cat; return sm_context_update_data_local_var; } @@ -210,6 +251,10 @@ void OpenAPI_sm_context_update_data_free(OpenAPI_sm_context_update_data_t *sm_co OpenAPI_list_free(sm_context_update_data->n9_ul_forwarding_tnl_list); sm_context_update_data->n9_ul_forwarding_tnl_list = NULL; } + if (sm_context_update_data->n9_dl_forwarding_tunnel) { + OpenAPI_tunnel_info_free(sm_context_update_data->n9_dl_forwarding_tunnel); + sm_context_update_data->n9_dl_forwarding_tunnel = NULL; + } if (sm_context_update_data->eps_bearer_setup) { OpenAPI_list_for_each(sm_context_update_data->eps_bearer_setup, node) { ogs_free(node->data); @@ -267,6 +312,17 @@ void OpenAPI_sm_context_update_data_free(OpenAPI_sm_context_update_data_t *sm_co OpenAPI_ddn_failure_subs_free(sm_context_update_data->ddn_failure_subs); sm_context_update_data->ddn_failure_subs = NULL; } + if (sm_context_update_data->secondary_rat_usage_data_report_container) { + OpenAPI_list_for_each(sm_context_update_data->secondary_rat_usage_data_report_container, node) { + ogs_free(node->data); + } + OpenAPI_list_free(sm_context_update_data->secondary_rat_usage_data_report_container); + sm_context_update_data->secondary_rat_usage_data_report_container = NULL; + } + if (sm_context_update_data->pcf_ue_callback_info) { + OpenAPI_pcf_ue_callback_info_free(sm_context_update_data->pcf_ue_callback_info); + sm_context_update_data->pcf_ue_callback_info = NULL; + } ogs_free(sm_context_update_data); } @@ -545,6 +601,26 @@ cJSON *OpenAPI_sm_context_update_data_convertToJSON(OpenAPI_sm_context_update_da } } + if (sm_context_update_data->n9_dl_forwarding_tunnel) { + cJSON *n9_dl_forwarding_tunnel_local_JSON = OpenAPI_tunnel_info_convertToJSON(sm_context_update_data->n9_dl_forwarding_tunnel); + if (n9_dl_forwarding_tunnel_local_JSON == NULL) { + ogs_error("OpenAPI_sm_context_update_data_convertToJSON() failed [n9_dl_forwarding_tunnel]"); + goto end; + } + cJSON_AddItemToObject(item, "n9DlForwardingTunnel", n9_dl_forwarding_tunnel_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_sm_context_update_data_convertToJSON() failed [n9_dl_forwarding_tunnel]"); + goto end; + } + } + + if (sm_context_update_data->is_n9_inactivity_timer) { + if (cJSON_AddNumberToObject(item, "n9InactivityTimer", sm_context_update_data->n9_inactivity_timer) == NULL) { + ogs_error("OpenAPI_sm_context_update_data_convertToJSON() failed [n9_inactivity_timer]"); + goto end; + } + } + if (sm_context_update_data->eps_bearer_setup) { cJSON *eps_bearer_setupList = cJSON_AddArrayToObject(item, "epsBearerSetup"); if (eps_bearer_setupList == NULL) { @@ -762,6 +838,54 @@ cJSON *OpenAPI_sm_context_update_data_convertToJSON(OpenAPI_sm_context_update_da } } + if (sm_context_update_data->is_skip_n2_pdu_session_res_rel_ind) { + if (cJSON_AddBoolToObject(item, "skipN2PduSessionResRelInd", sm_context_update_data->skip_n2_pdu_session_res_rel_ind) == NULL) { + ogs_error("OpenAPI_sm_context_update_data_convertToJSON() failed [skip_n2_pdu_session_res_rel_ind]"); + goto end; + } + } + + if (sm_context_update_data->secondary_rat_usage_data_report_container) { + cJSON *secondary_rat_usage_data_report_containerList = cJSON_AddArrayToObject(item, "secondaryRatUsageDataReportContainer"); + if (secondary_rat_usage_data_report_containerList == NULL) { + ogs_error("OpenAPI_sm_context_update_data_convertToJSON() failed [secondary_rat_usage_data_report_container]"); + goto end; + } + OpenAPI_list_for_each(sm_context_update_data->secondary_rat_usage_data_report_container, node) { + if (cJSON_AddStringToObject(secondary_rat_usage_data_report_containerList, "", (char*)node->data) == NULL) { + ogs_error("OpenAPI_sm_context_update_data_convertToJSON() failed [secondary_rat_usage_data_report_container]"); + goto end; + } + } + } + + if (sm_context_update_data->sm_policy_notify_ind != OpenAPI_sm_context_update_data_SMPOLICYNOTIFYIND_NULL) { + if (cJSON_AddStringToObject(item, "smPolicyNotifyInd", OpenAPI_sm_policy_notify_indsm_context_update_data_ToString(sm_context_update_data->sm_policy_notify_ind)) == NULL) { + ogs_error("OpenAPI_sm_context_update_data_convertToJSON() failed [sm_policy_notify_ind]"); + goto end; + } + } + + if (sm_context_update_data->pcf_ue_callback_info) { + cJSON *pcf_ue_callback_info_local_JSON = OpenAPI_pcf_ue_callback_info_convertToJSON(sm_context_update_data->pcf_ue_callback_info); + if (pcf_ue_callback_info_local_JSON == NULL) { + ogs_error("OpenAPI_sm_context_update_data_convertToJSON() failed [pcf_ue_callback_info]"); + goto end; + } + cJSON_AddItemToObject(item, "pcfUeCallbackInfo", pcf_ue_callback_info_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_sm_context_update_data_convertToJSON() failed [pcf_ue_callback_info]"); + goto end; + } + } + + if (sm_context_update_data->satellite_backhaul_cat != OpenAPI_satellite_backhaul_category_NULL) { + if (cJSON_AddStringToObject(item, "satelliteBackhaulCat", OpenAPI_satellite_backhaul_category_ToString(sm_context_update_data->satellite_backhaul_cat)) == NULL) { + ogs_error("OpenAPI_sm_context_update_data_convertToJSON() failed [satellite_backhaul_cat]"); + goto end; + } + } + end: return item; } @@ -816,6 +940,9 @@ OpenAPI_sm_context_update_data_t *OpenAPI_sm_context_update_data_parseFromJSON(c OpenAPI_list_t *n9_dl_forwarding_tnl_listList = NULL; cJSON *n9_ul_forwarding_tnl_list = NULL; OpenAPI_list_t *n9_ul_forwarding_tnl_listList = NULL; + cJSON *n9_dl_forwarding_tunnel = NULL; + OpenAPI_tunnel_info_t *n9_dl_forwarding_tunnel_local_nonprim = NULL; + cJSON *n9_inactivity_timer = NULL; cJSON *eps_bearer_setup = NULL; OpenAPI_list_t *eps_bearer_setupList = NULL; cJSON *revoke_ebi_list = NULL; @@ -852,6 +979,15 @@ OpenAPI_sm_context_update_data_t *OpenAPI_sm_context_update_data_parseFromJSON(c OpenAPI_list_t *forwarding_bearer_contextsList = NULL; cJSON *ddn_failure_subs = NULL; OpenAPI_ddn_failure_subs_t *ddn_failure_subs_local_nonprim = NULL; + cJSON *skip_n2_pdu_session_res_rel_ind = NULL; + cJSON *secondary_rat_usage_data_report_container = NULL; + OpenAPI_list_t *secondary_rat_usage_data_report_containerList = NULL; + cJSON *sm_policy_notify_ind = NULL; + OpenAPI_sm_context_update_data_sm_policy_notify_ind_e sm_policy_notify_indVariable = 0; + cJSON *pcf_ue_callback_info = NULL; + OpenAPI_pcf_ue_callback_info_t *pcf_ue_callback_info_local_nonprim = NULL; + cJSON *satellite_backhaul_cat = NULL; + OpenAPI_satellite_backhaul_category_e satellite_backhaul_catVariable = 0; pei = cJSON_GetObjectItemCaseSensitive(sm_context_update_dataJSON, "pei"); if (pei) { if (!cJSON_IsString(pei) && !cJSON_IsNull(pei)) { @@ -1103,6 +1239,19 @@ OpenAPI_sm_context_update_data_t *OpenAPI_sm_context_update_data_parseFromJSON(c } } + n9_dl_forwarding_tunnel = cJSON_GetObjectItemCaseSensitive(sm_context_update_dataJSON, "n9DlForwardingTunnel"); + if (n9_dl_forwarding_tunnel) { + n9_dl_forwarding_tunnel_local_nonprim = OpenAPI_tunnel_info_parseFromJSON(n9_dl_forwarding_tunnel); + } + + n9_inactivity_timer = cJSON_GetObjectItemCaseSensitive(sm_context_update_dataJSON, "n9InactivityTimer"); + if (n9_inactivity_timer) { + if (!cJSON_IsNumber(n9_inactivity_timer)) { + ogs_error("OpenAPI_sm_context_update_data_parseFromJSON() failed [n9_inactivity_timer]"); + goto end; + } + } + eps_bearer_setup = cJSON_GetObjectItemCaseSensitive(sm_context_update_dataJSON, "epsBearerSetup"); if (eps_bearer_setup) { cJSON *eps_bearer_setup_local = NULL; @@ -1307,6 +1456,58 @@ OpenAPI_sm_context_update_data_t *OpenAPI_sm_context_update_data_parseFromJSON(c ddn_failure_subs_local_nonprim = OpenAPI_ddn_failure_subs_parseFromJSON(ddn_failure_subs); } + skip_n2_pdu_session_res_rel_ind = cJSON_GetObjectItemCaseSensitive(sm_context_update_dataJSON, "skipN2PduSessionResRelInd"); + if (skip_n2_pdu_session_res_rel_ind) { + if (!cJSON_IsBool(skip_n2_pdu_session_res_rel_ind)) { + ogs_error("OpenAPI_sm_context_update_data_parseFromJSON() failed [skip_n2_pdu_session_res_rel_ind]"); + goto end; + } + } + + secondary_rat_usage_data_report_container = cJSON_GetObjectItemCaseSensitive(sm_context_update_dataJSON, "secondaryRatUsageDataReportContainer"); + if (secondary_rat_usage_data_report_container) { + cJSON *secondary_rat_usage_data_report_container_local = NULL; + if (!cJSON_IsArray(secondary_rat_usage_data_report_container)) { + ogs_error("OpenAPI_sm_context_update_data_parseFromJSON() failed [secondary_rat_usage_data_report_container]"); + goto end; + } + + secondary_rat_usage_data_report_containerList = OpenAPI_list_create(); + + cJSON_ArrayForEach(secondary_rat_usage_data_report_container_local, secondary_rat_usage_data_report_container) { + double *localDouble = NULL; + int *localInt = NULL; + if (!cJSON_IsString(secondary_rat_usage_data_report_container_local)) { + ogs_error("OpenAPI_sm_context_update_data_parseFromJSON() failed [secondary_rat_usage_data_report_container]"); + goto end; + } + OpenAPI_list_add(secondary_rat_usage_data_report_containerList, ogs_strdup(secondary_rat_usage_data_report_container_local->valuestring)); + } + } + + sm_policy_notify_ind = cJSON_GetObjectItemCaseSensitive(sm_context_update_dataJSON, "smPolicyNotifyInd"); + if (sm_policy_notify_ind) { + if (!cJSON_IsString(sm_policy_notify_ind)) { + ogs_error("OpenAPI_sm_context_update_data_parseFromJSON() failed [sm_policy_notify_ind]"); + goto end; + } + sm_policy_notify_indVariable = OpenAPI_sm_policy_notify_indsm_context_update_data_FromString(sm_policy_notify_ind->valuestring); + } + + pcf_ue_callback_info = cJSON_GetObjectItemCaseSensitive(sm_context_update_dataJSON, "pcfUeCallbackInfo"); + if (pcf_ue_callback_info) { + pcf_ue_callback_info_local_nonprim = OpenAPI_pcf_ue_callback_info_parseFromJSON(pcf_ue_callback_info); + } + + satellite_backhaul_cat = cJSON_GetObjectItemCaseSensitive(sm_context_update_dataJSON, "satelliteBackhaulCat"); + if (satellite_backhaul_cat) { + if (!cJSON_IsString(satellite_backhaul_cat)) { + ogs_error("OpenAPI_sm_context_update_data_parseFromJSON() failed [satellite_backhaul_cat]"); + goto end; + } + satellite_backhaul_catVariable = OpenAPI_satellite_backhaul_category_FromString(satellite_backhaul_cat->valuestring); + } + sm_context_update_data_local_var = OpenAPI_sm_context_update_data_create ( pei && !cJSON_IsNull(pei) ? ogs_strdup(pei->valuestring) : NULL, serving_nf_id && !cJSON_IsNull(serving_nf_id) ? ogs_strdup(serving_nf_id->valuestring) : NULL, @@ -1338,6 +1539,9 @@ OpenAPI_sm_context_update_data_t *OpenAPI_sm_context_update_data_parseFromJSON(c n9_forwarding_tunnel ? n9_forwarding_tunnel_local_nonprim : NULL, n9_dl_forwarding_tnl_list ? n9_dl_forwarding_tnl_listList : NULL, n9_ul_forwarding_tnl_list ? n9_ul_forwarding_tnl_listList : NULL, + n9_dl_forwarding_tunnel ? n9_dl_forwarding_tunnel_local_nonprim : NULL, + n9_inactivity_timer ? true : false, + n9_inactivity_timer ? n9_inactivity_timer->valuedouble : 0, eps_bearer_setup ? eps_bearer_setupList : NULL, revoke_ebi_list ? revoke_ebi_listList : NULL, release ? true : false, @@ -1365,7 +1569,13 @@ OpenAPI_sm_context_update_data_t *OpenAPI_sm_context_update_data_parseFromJSON(c extended_nas_sm_timer_ind ? extended_nas_sm_timer_ind->valueint : 0, forwarding_f_teid && !cJSON_IsNull(forwarding_f_teid) ? ogs_strdup(forwarding_f_teid->valuestring) : NULL, forwarding_bearer_contexts ? forwarding_bearer_contextsList : NULL, - ddn_failure_subs ? ddn_failure_subs_local_nonprim : NULL + ddn_failure_subs ? ddn_failure_subs_local_nonprim : NULL, + skip_n2_pdu_session_res_rel_ind ? true : false, + skip_n2_pdu_session_res_rel_ind ? skip_n2_pdu_session_res_rel_ind->valueint : 0, + secondary_rat_usage_data_report_container ? secondary_rat_usage_data_report_containerList : NULL, + sm_policy_notify_ind ? sm_policy_notify_indVariable : 0, + pcf_ue_callback_info ? pcf_ue_callback_info_local_nonprim : NULL, + satellite_backhaul_cat ? satellite_backhaul_catVariable : 0 ); return sm_context_update_data_local_var; @@ -1423,6 +1633,10 @@ end: OpenAPI_list_free(n9_ul_forwarding_tnl_listList); n9_ul_forwarding_tnl_listList = NULL; } + if (n9_dl_forwarding_tunnel_local_nonprim) { + OpenAPI_tunnel_info_free(n9_dl_forwarding_tunnel_local_nonprim); + n9_dl_forwarding_tunnel_local_nonprim = NULL; + } if (eps_bearer_setupList) { OpenAPI_list_for_each(eps_bearer_setupList, node) { ogs_free(node->data); @@ -1472,6 +1686,17 @@ end: OpenAPI_ddn_failure_subs_free(ddn_failure_subs_local_nonprim); ddn_failure_subs_local_nonprim = NULL; } + if (secondary_rat_usage_data_report_containerList) { + OpenAPI_list_for_each(secondary_rat_usage_data_report_containerList, node) { + ogs_free(node->data); + } + OpenAPI_list_free(secondary_rat_usage_data_report_containerList); + secondary_rat_usage_data_report_containerList = NULL; + } + if (pcf_ue_callback_info_local_nonprim) { + OpenAPI_pcf_ue_callback_info_free(pcf_ue_callback_info_local_nonprim); + pcf_ue_callback_info_local_nonprim = NULL; + } return NULL; } diff --git a/lib/sbi/openapi/model/sm_context_update_data.h b/lib/sbi/openapi/model/sm_context_update_data.h index 68ae98f03..6b814567a 100644 --- a/lib/sbi/openapi/model/sm_context_update_data.h +++ b/lib/sbi/openapi/model/sm_context_update_data.h @@ -1,7 +1,7 @@ /* * sm_context_update_data.h * - * + * Data within Update SM Context Request */ #ifndef _OpenAPI_sm_context_update_data_H_ @@ -26,10 +26,12 @@ #include "n2_sm_info_type.h" #include "ng_ap_cause.h" #include "ng_ran_target_id.h" +#include "pcf_ue_callback_info.h" #include "plmn_id_nid.h" #include "presence_state.h" #include "rat_type.h" #include "ref_to_binary_data.h" +#include "satellite_backhaul_category.h" #include "snssai.h" #include "trace_data.h" #include "tunnel_info.h" @@ -41,6 +43,11 @@ extern "C" { #endif typedef struct OpenAPI_sm_context_update_data_s OpenAPI_sm_context_update_data_t; +typedef enum { OpenAPI_sm_context_update_data_SMPOLICYNOTIFYIND_NULL = 0, OpenAPI_sm_context_update_data_SMPOLICYNOTIFYIND__true } OpenAPI_sm_context_update_data_sm_policy_notify_ind_e; + +char* OpenAPI_sm_context_update_data_sm_policy_notify_ind_ToString(OpenAPI_sm_context_update_data_sm_policy_notify_ind_e sm_policy_notify_ind); + +OpenAPI_sm_context_update_data_sm_policy_notify_ind_e OpenAPI_sm_context_update_data_sm_policy_notify_ind_FromString(char* sm_policy_notify_ind); typedef struct OpenAPI_sm_context_update_data_s { char *pei; char *serving_nf_id; @@ -72,6 +79,9 @@ typedef struct OpenAPI_sm_context_update_data_s { struct OpenAPI_tunnel_info_s *n9_forwarding_tunnel; OpenAPI_list_t *n9_dl_forwarding_tnl_list; OpenAPI_list_t *n9_ul_forwarding_tnl_list; + struct OpenAPI_tunnel_info_s *n9_dl_forwarding_tunnel; + bool is_n9_inactivity_timer; + int n9_inactivity_timer; OpenAPI_list_t *eps_bearer_setup; OpenAPI_list_t *revoke_ebi_list; bool is_release; @@ -100,6 +110,12 @@ typedef struct OpenAPI_sm_context_update_data_s { char *forwarding_f_teid; OpenAPI_list_t *forwarding_bearer_contexts; struct OpenAPI_ddn_failure_subs_s *ddn_failure_subs; + bool is_skip_n2_pdu_session_res_rel_ind; + int skip_n2_pdu_session_res_rel_ind; + OpenAPI_list_t *secondary_rat_usage_data_report_container; + OpenAPI_sm_context_update_data_sm_policy_notify_ind_e sm_policy_notify_ind; + struct OpenAPI_pcf_ue_callback_info_s *pcf_ue_callback_info; + OpenAPI_satellite_backhaul_category_e satellite_backhaul_cat; } OpenAPI_sm_context_update_data_t; OpenAPI_sm_context_update_data_t *OpenAPI_sm_context_update_data_create( @@ -133,6 +149,9 @@ OpenAPI_sm_context_update_data_t *OpenAPI_sm_context_update_data_create( OpenAPI_tunnel_info_t *n9_forwarding_tunnel, OpenAPI_list_t *n9_dl_forwarding_tnl_list, OpenAPI_list_t *n9_ul_forwarding_tnl_list, + OpenAPI_tunnel_info_t *n9_dl_forwarding_tunnel, + bool is_n9_inactivity_timer, + int n9_inactivity_timer, OpenAPI_list_t *eps_bearer_setup, OpenAPI_list_t *revoke_ebi_list, bool is_release, @@ -160,7 +179,13 @@ OpenAPI_sm_context_update_data_t *OpenAPI_sm_context_update_data_create( int extended_nas_sm_timer_ind, char *forwarding_f_teid, OpenAPI_list_t *forwarding_bearer_contexts, - OpenAPI_ddn_failure_subs_t *ddn_failure_subs + OpenAPI_ddn_failure_subs_t *ddn_failure_subs, + bool is_skip_n2_pdu_session_res_rel_ind, + int skip_n2_pdu_session_res_rel_ind, + OpenAPI_list_t *secondary_rat_usage_data_report_container, + OpenAPI_sm_context_update_data_sm_policy_notify_ind_e sm_policy_notify_ind, + OpenAPI_pcf_ue_callback_info_t *pcf_ue_callback_info, + OpenAPI_satellite_backhaul_category_e satellite_backhaul_cat ); void OpenAPI_sm_context_update_data_free(OpenAPI_sm_context_update_data_t *sm_context_update_data); OpenAPI_sm_context_update_data_t *OpenAPI_sm_context_update_data_parseFromJSON(cJSON *sm_context_update_dataJSON); diff --git a/lib/sbi/openapi/model/sm_context_update_error.h b/lib/sbi/openapi/model/sm_context_update_error.h index a6644aa91..913c3e593 100644 --- a/lib/sbi/openapi/model/sm_context_update_error.h +++ b/lib/sbi/openapi/model/sm_context_update_error.h @@ -1,7 +1,7 @@ /* * sm_context_update_error.h * - * + * Error within Update SM Context Response */ #ifndef _OpenAPI_sm_context_update_error_H_ diff --git a/lib/sbi/openapi/model/sm_context_updated_data.c b/lib/sbi/openapi/model/sm_context_updated_data.c index 9c3067ef0..5836d9a28 100644 --- a/lib/sbi/openapi/model/sm_context_updated_data.c +++ b/lib/sbi/openapi/model/sm_context_updated_data.c @@ -18,6 +18,7 @@ OpenAPI_sm_context_updated_data_t *OpenAPI_sm_context_updated_data_create( int data_forwarding, OpenAPI_list_t *n3_dl_forwarding_tnl_list, OpenAPI_list_t *n3_ul_forwarding_tnl_list, + OpenAPI_tunnel_info_t *n9_ul_forwarding_tunnel, OpenAPI_cause_e cause, bool is_ma_accepted_ind, int ma_accepted_ind, @@ -25,7 +26,9 @@ OpenAPI_sm_context_updated_data_t *OpenAPI_sm_context_updated_data_create( char *forwarding_f_teid, OpenAPI_list_t *forwarding_bearer_contexts, char *selected_smf_id, - char *selected_old_smf_id + char *selected_old_smf_id, + char *inter_plmn_api_root, + OpenAPI_anchor_smf_features_t *anchor_smf_features ) { OpenAPI_sm_context_updated_data_t *sm_context_updated_data_local_var = ogs_malloc(sizeof(OpenAPI_sm_context_updated_data_t)); @@ -44,6 +47,7 @@ OpenAPI_sm_context_updated_data_t *OpenAPI_sm_context_updated_data_create( sm_context_updated_data_local_var->data_forwarding = data_forwarding; sm_context_updated_data_local_var->n3_dl_forwarding_tnl_list = n3_dl_forwarding_tnl_list; sm_context_updated_data_local_var->n3_ul_forwarding_tnl_list = n3_ul_forwarding_tnl_list; + sm_context_updated_data_local_var->n9_ul_forwarding_tunnel = n9_ul_forwarding_tunnel; sm_context_updated_data_local_var->cause = cause; sm_context_updated_data_local_var->is_ma_accepted_ind = is_ma_accepted_ind; sm_context_updated_data_local_var->ma_accepted_ind = ma_accepted_ind; @@ -52,6 +56,8 @@ OpenAPI_sm_context_updated_data_t *OpenAPI_sm_context_updated_data_create( sm_context_updated_data_local_var->forwarding_bearer_contexts = forwarding_bearer_contexts; sm_context_updated_data_local_var->selected_smf_id = selected_smf_id; sm_context_updated_data_local_var->selected_old_smf_id = selected_old_smf_id; + sm_context_updated_data_local_var->inter_plmn_api_root = inter_plmn_api_root; + sm_context_updated_data_local_var->anchor_smf_features = anchor_smf_features; return sm_context_updated_data_local_var; } @@ -113,6 +119,10 @@ void OpenAPI_sm_context_updated_data_free(OpenAPI_sm_context_updated_data_t *sm_ OpenAPI_list_free(sm_context_updated_data->n3_ul_forwarding_tnl_list); sm_context_updated_data->n3_ul_forwarding_tnl_list = NULL; } + if (sm_context_updated_data->n9_ul_forwarding_tunnel) { + OpenAPI_tunnel_info_free(sm_context_updated_data->n9_ul_forwarding_tunnel); + sm_context_updated_data->n9_ul_forwarding_tunnel = NULL; + } if (sm_context_updated_data->supported_features) { ogs_free(sm_context_updated_data->supported_features); sm_context_updated_data->supported_features = NULL; @@ -136,6 +146,14 @@ void OpenAPI_sm_context_updated_data_free(OpenAPI_sm_context_updated_data_t *sm_ ogs_free(sm_context_updated_data->selected_old_smf_id); sm_context_updated_data->selected_old_smf_id = NULL; } + if (sm_context_updated_data->inter_plmn_api_root) { + ogs_free(sm_context_updated_data->inter_plmn_api_root); + sm_context_updated_data->inter_plmn_api_root = NULL; + } + if (sm_context_updated_data->anchor_smf_features) { + OpenAPI_anchor_smf_features_free(sm_context_updated_data->anchor_smf_features); + sm_context_updated_data->anchor_smf_features = NULL; + } ogs_free(sm_context_updated_data); } @@ -296,6 +314,19 @@ cJSON *OpenAPI_sm_context_updated_data_convertToJSON(OpenAPI_sm_context_updated_ } } + if (sm_context_updated_data->n9_ul_forwarding_tunnel) { + cJSON *n9_ul_forwarding_tunnel_local_JSON = OpenAPI_tunnel_info_convertToJSON(sm_context_updated_data->n9_ul_forwarding_tunnel); + if (n9_ul_forwarding_tunnel_local_JSON == NULL) { + ogs_error("OpenAPI_sm_context_updated_data_convertToJSON() failed [n9_ul_forwarding_tunnel]"); + goto end; + } + cJSON_AddItemToObject(item, "n9UlForwardingTunnel", n9_ul_forwarding_tunnel_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_sm_context_updated_data_convertToJSON() failed [n9_ul_forwarding_tunnel]"); + goto end; + } + } + if (sm_context_updated_data->cause != OpenAPI_cause_NULL) { if (cJSON_AddStringToObject(item, "cause", OpenAPI_cause_ToString(sm_context_updated_data->cause)) == NULL) { ogs_error("OpenAPI_sm_context_updated_data_convertToJSON() failed [cause]"); @@ -352,6 +383,26 @@ cJSON *OpenAPI_sm_context_updated_data_convertToJSON(OpenAPI_sm_context_updated_ } } + if (sm_context_updated_data->inter_plmn_api_root) { + if (cJSON_AddStringToObject(item, "interPlmnApiRoot", sm_context_updated_data->inter_plmn_api_root) == NULL) { + ogs_error("OpenAPI_sm_context_updated_data_convertToJSON() failed [inter_plmn_api_root]"); + goto end; + } + } + + if (sm_context_updated_data->anchor_smf_features) { + cJSON *anchor_smf_features_local_JSON = OpenAPI_anchor_smf_features_convertToJSON(sm_context_updated_data->anchor_smf_features); + if (anchor_smf_features_local_JSON == NULL) { + ogs_error("OpenAPI_sm_context_updated_data_convertToJSON() failed [anchor_smf_features]"); + goto end; + } + cJSON_AddItemToObject(item, "anchorSmfFeatures", anchor_smf_features_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_sm_context_updated_data_convertToJSON() failed [anchor_smf_features]"); + goto end; + } + } + end: return item; } @@ -383,6 +434,8 @@ OpenAPI_sm_context_updated_data_t *OpenAPI_sm_context_updated_data_parseFromJSON OpenAPI_list_t *n3_dl_forwarding_tnl_listList = NULL; cJSON *n3_ul_forwarding_tnl_list = NULL; OpenAPI_list_t *n3_ul_forwarding_tnl_listList = NULL; + cJSON *n9_ul_forwarding_tunnel = NULL; + OpenAPI_tunnel_info_t *n9_ul_forwarding_tunnel_local_nonprim = NULL; cJSON *cause = NULL; OpenAPI_cause_e causeVariable = 0; cJSON *ma_accepted_ind = NULL; @@ -392,6 +445,9 @@ OpenAPI_sm_context_updated_data_t *OpenAPI_sm_context_updated_data_parseFromJSON OpenAPI_list_t *forwarding_bearer_contextsList = NULL; cJSON *selected_smf_id = NULL; cJSON *selected_old_smf_id = NULL; + cJSON *inter_plmn_api_root = NULL; + cJSON *anchor_smf_features = NULL; + OpenAPI_anchor_smf_features_t *anchor_smf_features_local_nonprim = NULL; up_cnx_state = cJSON_GetObjectItemCaseSensitive(sm_context_updated_dataJSON, "upCnxState"); if (up_cnx_state) { if (!cJSON_IsString(up_cnx_state)) { @@ -585,6 +641,11 @@ OpenAPI_sm_context_updated_data_t *OpenAPI_sm_context_updated_data_parseFromJSON } } + n9_ul_forwarding_tunnel = cJSON_GetObjectItemCaseSensitive(sm_context_updated_dataJSON, "n9UlForwardingTunnel"); + if (n9_ul_forwarding_tunnel) { + n9_ul_forwarding_tunnel_local_nonprim = OpenAPI_tunnel_info_parseFromJSON(n9_ul_forwarding_tunnel); + } + cause = cJSON_GetObjectItemCaseSensitive(sm_context_updated_dataJSON, "cause"); if (cause) { if (!cJSON_IsString(cause)) { @@ -655,6 +716,19 @@ OpenAPI_sm_context_updated_data_t *OpenAPI_sm_context_updated_data_parseFromJSON } } + inter_plmn_api_root = cJSON_GetObjectItemCaseSensitive(sm_context_updated_dataJSON, "interPlmnApiRoot"); + if (inter_plmn_api_root) { + if (!cJSON_IsString(inter_plmn_api_root) && !cJSON_IsNull(inter_plmn_api_root)) { + ogs_error("OpenAPI_sm_context_updated_data_parseFromJSON() failed [inter_plmn_api_root]"); + goto end; + } + } + + anchor_smf_features = cJSON_GetObjectItemCaseSensitive(sm_context_updated_dataJSON, "anchorSmfFeatures"); + if (anchor_smf_features) { + anchor_smf_features_local_nonprim = OpenAPI_anchor_smf_features_parseFromJSON(anchor_smf_features); + } + sm_context_updated_data_local_var = OpenAPI_sm_context_updated_data_create ( up_cnx_state ? up_cnx_stateVariable : 0, ho_state ? ho_stateVariable : 0, @@ -669,6 +743,7 @@ OpenAPI_sm_context_updated_data_t *OpenAPI_sm_context_updated_data_parseFromJSON data_forwarding ? data_forwarding->valueint : 0, n3_dl_forwarding_tnl_list ? n3_dl_forwarding_tnl_listList : NULL, n3_ul_forwarding_tnl_list ? n3_ul_forwarding_tnl_listList : NULL, + n9_ul_forwarding_tunnel ? n9_ul_forwarding_tunnel_local_nonprim : NULL, cause ? causeVariable : 0, ma_accepted_ind ? true : false, ma_accepted_ind ? ma_accepted_ind->valueint : 0, @@ -676,7 +751,9 @@ OpenAPI_sm_context_updated_data_t *OpenAPI_sm_context_updated_data_parseFromJSON forwarding_f_teid && !cJSON_IsNull(forwarding_f_teid) ? ogs_strdup(forwarding_f_teid->valuestring) : NULL, forwarding_bearer_contexts ? forwarding_bearer_contextsList : NULL, selected_smf_id && !cJSON_IsNull(selected_smf_id) ? ogs_strdup(selected_smf_id->valuestring) : NULL, - selected_old_smf_id && !cJSON_IsNull(selected_old_smf_id) ? ogs_strdup(selected_old_smf_id->valuestring) : NULL + selected_old_smf_id && !cJSON_IsNull(selected_old_smf_id) ? ogs_strdup(selected_old_smf_id->valuestring) : NULL, + inter_plmn_api_root && !cJSON_IsNull(inter_plmn_api_root) ? ogs_strdup(inter_plmn_api_root->valuestring) : NULL, + anchor_smf_features ? anchor_smf_features_local_nonprim : NULL ); return sm_context_updated_data_local_var; @@ -731,6 +808,10 @@ end: OpenAPI_list_free(n3_ul_forwarding_tnl_listList); n3_ul_forwarding_tnl_listList = NULL; } + if (n9_ul_forwarding_tunnel_local_nonprim) { + OpenAPI_tunnel_info_free(n9_ul_forwarding_tunnel_local_nonprim); + n9_ul_forwarding_tunnel_local_nonprim = NULL; + } if (forwarding_bearer_contextsList) { OpenAPI_list_for_each(forwarding_bearer_contextsList, node) { ogs_free(node->data); @@ -738,6 +819,10 @@ end: OpenAPI_list_free(forwarding_bearer_contextsList); forwarding_bearer_contextsList = NULL; } + if (anchor_smf_features_local_nonprim) { + OpenAPI_anchor_smf_features_free(anchor_smf_features_local_nonprim); + anchor_smf_features_local_nonprim = NULL; + } return NULL; } diff --git a/lib/sbi/openapi/model/sm_context_updated_data.h b/lib/sbi/openapi/model/sm_context_updated_data.h index 63d44f8e2..c2b3197e5 100644 --- a/lib/sbi/openapi/model/sm_context_updated_data.h +++ b/lib/sbi/openapi/model/sm_context_updated_data.h @@ -1,7 +1,7 @@ /* * sm_context_updated_data.h * - * + * Data within Update SM Context Response */ #ifndef _OpenAPI_sm_context_updated_data_H_ @@ -12,12 +12,14 @@ #include "../include/list.h" #include "../include/keyValuePair.h" #include "../include/binary.h" +#include "anchor_smf_features.h" #include "cause.h" #include "ebi_arp_mapping.h" #include "ho_state.h" #include "indirect_data_forwarding_tunnel_info.h" #include "n2_sm_info_type.h" #include "ref_to_binary_data.h" +#include "tunnel_info.h" #include "up_cnx_state.h" #ifdef __cplusplus @@ -39,6 +41,7 @@ typedef struct OpenAPI_sm_context_updated_data_s { int data_forwarding; OpenAPI_list_t *n3_dl_forwarding_tnl_list; OpenAPI_list_t *n3_ul_forwarding_tnl_list; + struct OpenAPI_tunnel_info_s *n9_ul_forwarding_tunnel; OpenAPI_cause_e cause; bool is_ma_accepted_ind; int ma_accepted_ind; @@ -47,6 +50,8 @@ typedef struct OpenAPI_sm_context_updated_data_s { OpenAPI_list_t *forwarding_bearer_contexts; char *selected_smf_id; char *selected_old_smf_id; + char *inter_plmn_api_root; + struct OpenAPI_anchor_smf_features_s *anchor_smf_features; } OpenAPI_sm_context_updated_data_t; OpenAPI_sm_context_updated_data_t *OpenAPI_sm_context_updated_data_create( @@ -63,6 +68,7 @@ OpenAPI_sm_context_updated_data_t *OpenAPI_sm_context_updated_data_create( int data_forwarding, OpenAPI_list_t *n3_dl_forwarding_tnl_list, OpenAPI_list_t *n3_ul_forwarding_tnl_list, + OpenAPI_tunnel_info_t *n9_ul_forwarding_tunnel, OpenAPI_cause_e cause, bool is_ma_accepted_ind, int ma_accepted_ind, @@ -70,7 +76,9 @@ OpenAPI_sm_context_updated_data_t *OpenAPI_sm_context_updated_data_create( char *forwarding_f_teid, OpenAPI_list_t *forwarding_bearer_contexts, char *selected_smf_id, - char *selected_old_smf_id + char *selected_old_smf_id, + char *inter_plmn_api_root, + OpenAPI_anchor_smf_features_t *anchor_smf_features ); void OpenAPI_sm_context_updated_data_free(OpenAPI_sm_context_updated_data_t *sm_context_updated_data); OpenAPI_sm_context_updated_data_t *OpenAPI_sm_context_updated_data_parseFromJSON(cJSON *sm_context_updated_dataJSON); diff --git a/lib/sbi/openapi/model/sm_policy_association_release_cause.c b/lib/sbi/openapi/model/sm_policy_association_release_cause.c index 10d4a5269..272ab95c0 100644 --- a/lib/sbi/openapi/model/sm_policy_association_release_cause.c +++ b/lib/sbi/openapi/model/sm_policy_association_release_cause.c @@ -6,7 +6,7 @@ char* OpenAPI_sm_policy_association_release_cause_ToString(OpenAPI_sm_policy_association_release_cause_e sm_policy_association_release_cause) { - const char *sm_policy_association_release_causeArray[] = { "NULL", "UNSPECIFIED", "UE_SUBSCRIPTION", "INSUFFICIENT_RES", "VALIDATION_CONDITION_NOT_MET" }; + const char *sm_policy_association_release_causeArray[] = { "NULL", "UNSPECIFIED", "UE_SUBSCRIPTION", "INSUFFICIENT_RES", "VALIDATION_CONDITION_NOT_MET", "REACTIVATION_REQUESTED" }; size_t sizeofArray = sizeof(sm_policy_association_release_causeArray) / sizeof(sm_policy_association_release_causeArray[0]); if (sm_policy_association_release_cause < sizeofArray) return (char *)sm_policy_association_release_causeArray[sm_policy_association_release_cause]; @@ -17,7 +17,7 @@ char* OpenAPI_sm_policy_association_release_cause_ToString(OpenAPI_sm_policy_ass OpenAPI_sm_policy_association_release_cause_e OpenAPI_sm_policy_association_release_cause_FromString(char* sm_policy_association_release_cause) { int stringToReturn = 0; - const char *sm_policy_association_release_causeArray[] = { "NULL", "UNSPECIFIED", "UE_SUBSCRIPTION", "INSUFFICIENT_RES", "VALIDATION_CONDITION_NOT_MET" }; + const char *sm_policy_association_release_causeArray[] = { "NULL", "UNSPECIFIED", "UE_SUBSCRIPTION", "INSUFFICIENT_RES", "VALIDATION_CONDITION_NOT_MET", "REACTIVATION_REQUESTED" }; size_t sizeofArray = sizeof(sm_policy_association_release_causeArray) / sizeof(sm_policy_association_release_causeArray[0]); while (stringToReturn < sizeofArray) { if (strcmp(sm_policy_association_release_cause, sm_policy_association_release_causeArray[stringToReturn]) == 0) { diff --git a/lib/sbi/openapi/model/sm_policy_association_release_cause.h b/lib/sbi/openapi/model/sm_policy_association_release_cause.h index d466cbd43..2ccdacf16 100644 --- a/lib/sbi/openapi/model/sm_policy_association_release_cause.h +++ b/lib/sbi/openapi/model/sm_policy_association_release_cause.h @@ -17,7 +17,7 @@ extern "C" { #endif -typedef enum { OpenAPI_sm_policy_association_release_cause_NULL = 0, OpenAPI_sm_policy_association_release_cause_UNSPECIFIED, OpenAPI_sm_policy_association_release_cause_UE_SUBSCRIPTION, OpenAPI_sm_policy_association_release_cause_INSUFFICIENT_RES, OpenAPI_sm_policy_association_release_cause_VALIDATION_CONDITION_NOT_MET } OpenAPI_sm_policy_association_release_cause_e; +typedef enum { OpenAPI_sm_policy_association_release_cause_NULL = 0, OpenAPI_sm_policy_association_release_cause_UNSPECIFIED, OpenAPI_sm_policy_association_release_cause_UE_SUBSCRIPTION, OpenAPI_sm_policy_association_release_cause_INSUFFICIENT_RES, OpenAPI_sm_policy_association_release_cause_VALIDATION_CONDITION_NOT_MET, OpenAPI_sm_policy_association_release_cause_REACTIVATION_REQUESTED } OpenAPI_sm_policy_association_release_cause_e; char* OpenAPI_sm_policy_association_release_cause_ToString(OpenAPI_sm_policy_association_release_cause_e sm_policy_association_release_cause); diff --git a/lib/sbi/openapi/model/sm_policy_context_data.c b/lib/sbi/openapi/model/sm_policy_context_data.c index d9705c274..c5dbbaf2d 100644 --- a/lib/sbi/openapi/model/sm_policy_context_data.c +++ b/lib/sbi/openapi/model/sm_policy_context_data.c @@ -50,9 +50,15 @@ OpenAPI_sm_policy_context_data_t *OpenAPI_sm_policy_context_data_create( char *smf_id, char *recovery_time, OpenAPI_ma_pdu_indication_e ma_pdu_ind, - OpenAPI_atsss_capability_t *atsss_capab, + OpenAPI_npcf_atsss_capability_e atsss_capab, OpenAPI_list_t *ipv4_frame_route_list, - OpenAPI_list_t *ipv6_frame_route_list + OpenAPI_list_t *ipv6_frame_route_list, + OpenAPI_satellite_backhaul_category_e sat_backhaul_category, + OpenAPI_pcf_ue_callback_info_t *pcf_ue_info, + OpenAPI_list_t *pvs_info, + bool is_onboard_ind, + int onboard_ind, + OpenAPI_list_t *nwdaf_datas ) { OpenAPI_sm_policy_context_data_t *sm_policy_context_data_local_var = ogs_malloc(sizeof(OpenAPI_sm_policy_context_data_t)); @@ -106,6 +112,12 @@ OpenAPI_sm_policy_context_data_t *OpenAPI_sm_policy_context_data_create( sm_policy_context_data_local_var->atsss_capab = atsss_capab; sm_policy_context_data_local_var->ipv4_frame_route_list = ipv4_frame_route_list; sm_policy_context_data_local_var->ipv6_frame_route_list = ipv6_frame_route_list; + sm_policy_context_data_local_var->sat_backhaul_category = sat_backhaul_category; + sm_policy_context_data_local_var->pcf_ue_info = pcf_ue_info; + sm_policy_context_data_local_var->pvs_info = pvs_info; + sm_policy_context_data_local_var->is_onboard_ind = is_onboard_ind; + sm_policy_context_data_local_var->onboard_ind = onboard_ind; + sm_policy_context_data_local_var->nwdaf_datas = nwdaf_datas; return sm_policy_context_data_local_var; } @@ -224,10 +236,6 @@ void OpenAPI_sm_policy_context_data_free(OpenAPI_sm_policy_context_data_t *sm_po ogs_free(sm_policy_context_data->recovery_time); sm_policy_context_data->recovery_time = NULL; } - if (sm_policy_context_data->atsss_capab) { - OpenAPI_atsss_capability_free(sm_policy_context_data->atsss_capab); - sm_policy_context_data->atsss_capab = NULL; - } if (sm_policy_context_data->ipv4_frame_route_list) { OpenAPI_list_for_each(sm_policy_context_data->ipv4_frame_route_list, node) { ogs_free(node->data); @@ -242,6 +250,24 @@ void OpenAPI_sm_policy_context_data_free(OpenAPI_sm_policy_context_data_t *sm_po OpenAPI_list_free(sm_policy_context_data->ipv6_frame_route_list); sm_policy_context_data->ipv6_frame_route_list = NULL; } + if (sm_policy_context_data->pcf_ue_info) { + OpenAPI_pcf_ue_callback_info_free(sm_policy_context_data->pcf_ue_info); + sm_policy_context_data->pcf_ue_info = NULL; + } + if (sm_policy_context_data->pvs_info) { + OpenAPI_list_for_each(sm_policy_context_data->pvs_info, node) { + OpenAPI_server_addressing_info_free(node->data); + } + OpenAPI_list_free(sm_policy_context_data->pvs_info); + sm_policy_context_data->pvs_info = NULL; + } + if (sm_policy_context_data->nwdaf_datas) { + OpenAPI_list_for_each(sm_policy_context_data->nwdaf_datas, node) { + OpenAPI_nwdaf_data_free(node->data); + } + OpenAPI_list_free(sm_policy_context_data->nwdaf_datas); + sm_policy_context_data->nwdaf_datas = NULL; + } ogs_free(sm_policy_context_data); } @@ -610,14 +636,8 @@ cJSON *OpenAPI_sm_policy_context_data_convertToJSON(OpenAPI_sm_policy_context_da } } - if (sm_policy_context_data->atsss_capab) { - cJSON *atsss_capab_local_JSON = OpenAPI_atsss_capability_convertToJSON(sm_policy_context_data->atsss_capab); - if (atsss_capab_local_JSON == NULL) { - ogs_error("OpenAPI_sm_policy_context_data_convertToJSON() failed [atsss_capab]"); - goto end; - } - cJSON_AddItemToObject(item, "atsssCapab", atsss_capab_local_JSON); - if (item->child == NULL) { + if (sm_policy_context_data->atsss_capab != OpenAPI_npcf_atsss_capability_NULL) { + if (cJSON_AddStringToObject(item, "atsssCapab", OpenAPI_npcf_atsss_capability_ToString(sm_policy_context_data->atsss_capab)) == NULL) { ogs_error("OpenAPI_sm_policy_context_data_convertToJSON() failed [atsss_capab]"); goto end; } @@ -651,6 +671,65 @@ cJSON *OpenAPI_sm_policy_context_data_convertToJSON(OpenAPI_sm_policy_context_da } } + if (sm_policy_context_data->sat_backhaul_category != OpenAPI_satellite_backhaul_category_NULL) { + if (cJSON_AddStringToObject(item, "satBackhaulCategory", OpenAPI_satellite_backhaul_category_ToString(sm_policy_context_data->sat_backhaul_category)) == NULL) { + ogs_error("OpenAPI_sm_policy_context_data_convertToJSON() failed [sat_backhaul_category]"); + goto end; + } + } + + if (sm_policy_context_data->pcf_ue_info) { + cJSON *pcf_ue_info_local_JSON = OpenAPI_pcf_ue_callback_info_convertToJSON(sm_policy_context_data->pcf_ue_info); + if (pcf_ue_info_local_JSON == NULL) { + ogs_error("OpenAPI_sm_policy_context_data_convertToJSON() failed [pcf_ue_info]"); + goto end; + } + cJSON_AddItemToObject(item, "pcfUeInfo", pcf_ue_info_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_sm_policy_context_data_convertToJSON() failed [pcf_ue_info]"); + goto end; + } + } + + if (sm_policy_context_data->pvs_info) { + cJSON *pvs_infoList = cJSON_AddArrayToObject(item, "pvsInfo"); + if (pvs_infoList == NULL) { + ogs_error("OpenAPI_sm_policy_context_data_convertToJSON() failed [pvs_info]"); + goto end; + } + OpenAPI_list_for_each(sm_policy_context_data->pvs_info, node) { + cJSON *itemLocal = OpenAPI_server_addressing_info_convertToJSON(node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_sm_policy_context_data_convertToJSON() failed [pvs_info]"); + goto end; + } + cJSON_AddItemToArray(pvs_infoList, itemLocal); + } + } + + if (sm_policy_context_data->is_onboard_ind) { + if (cJSON_AddBoolToObject(item, "onboardInd", sm_policy_context_data->onboard_ind) == NULL) { + ogs_error("OpenAPI_sm_policy_context_data_convertToJSON() failed [onboard_ind]"); + goto end; + } + } + + if (sm_policy_context_data->nwdaf_datas) { + cJSON *nwdaf_datasList = cJSON_AddArrayToObject(item, "nwdafDatas"); + if (nwdaf_datasList == NULL) { + ogs_error("OpenAPI_sm_policy_context_data_convertToJSON() failed [nwdaf_datas]"); + goto end; + } + OpenAPI_list_for_each(sm_policy_context_data->nwdaf_datas, node) { + cJSON *itemLocal = OpenAPI_nwdaf_data_convertToJSON(node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_sm_policy_context_data_convertToJSON() failed [nwdaf_datas]"); + goto end; + } + cJSON_AddItemToArray(nwdaf_datasList, itemLocal); + } + } + end: return item; } @@ -717,11 +796,20 @@ OpenAPI_sm_policy_context_data_t *OpenAPI_sm_policy_context_data_parseFromJSON(c cJSON *ma_pdu_ind = NULL; OpenAPI_ma_pdu_indication_e ma_pdu_indVariable = 0; cJSON *atsss_capab = NULL; - OpenAPI_atsss_capability_t *atsss_capab_local_nonprim = NULL; + OpenAPI_npcf_atsss_capability_e atsss_capabVariable = 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; + cJSON *sat_backhaul_category = NULL; + OpenAPI_satellite_backhaul_category_e sat_backhaul_categoryVariable = 0; + cJSON *pcf_ue_info = NULL; + OpenAPI_pcf_ue_callback_info_t *pcf_ue_info_local_nonprim = NULL; + cJSON *pvs_info = NULL; + OpenAPI_list_t *pvs_infoList = NULL; + cJSON *onboard_ind = NULL; + cJSON *nwdaf_datas = NULL; + OpenAPI_list_t *nwdaf_datasList = NULL; acc_net_ch_id = cJSON_GetObjectItemCaseSensitive(sm_policy_context_dataJSON, "accNetChId"); if (acc_net_ch_id) { acc_net_ch_id_local_nonprim = OpenAPI_acc_net_ch_id_parseFromJSON(acc_net_ch_id); @@ -1034,7 +1122,11 @@ OpenAPI_sm_policy_context_data_t *OpenAPI_sm_policy_context_data_parseFromJSON(c atsss_capab = cJSON_GetObjectItemCaseSensitive(sm_policy_context_dataJSON, "atsssCapab"); if (atsss_capab) { - atsss_capab_local_nonprim = OpenAPI_atsss_capability_parseFromJSON(atsss_capab); + if (!cJSON_IsString(atsss_capab)) { + ogs_error("OpenAPI_sm_policy_context_data_parseFromJSON() failed [atsss_capab]"); + goto end; + } + atsss_capabVariable = OpenAPI_npcf_atsss_capability_FromString(atsss_capab->valuestring); } ipv4_frame_route_list = cJSON_GetObjectItemCaseSensitive(sm_policy_context_dataJSON, "ipv4FrameRouteList"); @@ -1079,6 +1171,78 @@ OpenAPI_sm_policy_context_data_t *OpenAPI_sm_policy_context_data_parseFromJSON(c } } + sat_backhaul_category = cJSON_GetObjectItemCaseSensitive(sm_policy_context_dataJSON, "satBackhaulCategory"); + if (sat_backhaul_category) { + if (!cJSON_IsString(sat_backhaul_category)) { + ogs_error("OpenAPI_sm_policy_context_data_parseFromJSON() failed [sat_backhaul_category]"); + goto end; + } + sat_backhaul_categoryVariable = OpenAPI_satellite_backhaul_category_FromString(sat_backhaul_category->valuestring); + } + + pcf_ue_info = cJSON_GetObjectItemCaseSensitive(sm_policy_context_dataJSON, "pcfUeInfo"); + if (pcf_ue_info) { + pcf_ue_info_local_nonprim = OpenAPI_pcf_ue_callback_info_parseFromJSON(pcf_ue_info); + } + + pvs_info = cJSON_GetObjectItemCaseSensitive(sm_policy_context_dataJSON, "pvsInfo"); + if (pvs_info) { + cJSON *pvs_info_local = NULL; + if (!cJSON_IsArray(pvs_info)) { + ogs_error("OpenAPI_sm_policy_context_data_parseFromJSON() failed [pvs_info]"); + goto end; + } + + pvs_infoList = OpenAPI_list_create(); + + cJSON_ArrayForEach(pvs_info_local, pvs_info) { + if (!cJSON_IsObject(pvs_info_local)) { + ogs_error("OpenAPI_sm_policy_context_data_parseFromJSON() failed [pvs_info]"); + goto end; + } + OpenAPI_server_addressing_info_t *pvs_infoItem = OpenAPI_server_addressing_info_parseFromJSON(pvs_info_local); + if (!pvs_infoItem) { + ogs_error("No pvs_infoItem"); + OpenAPI_list_free(pvs_infoList); + goto end; + } + OpenAPI_list_add(pvs_infoList, pvs_infoItem); + } + } + + onboard_ind = cJSON_GetObjectItemCaseSensitive(sm_policy_context_dataJSON, "onboardInd"); + if (onboard_ind) { + if (!cJSON_IsBool(onboard_ind)) { + ogs_error("OpenAPI_sm_policy_context_data_parseFromJSON() failed [onboard_ind]"); + goto end; + } + } + + nwdaf_datas = cJSON_GetObjectItemCaseSensitive(sm_policy_context_dataJSON, "nwdafDatas"); + if (nwdaf_datas) { + cJSON *nwdaf_datas_local = NULL; + if (!cJSON_IsArray(nwdaf_datas)) { + ogs_error("OpenAPI_sm_policy_context_data_parseFromJSON() failed [nwdaf_datas]"); + goto end; + } + + nwdaf_datasList = OpenAPI_list_create(); + + cJSON_ArrayForEach(nwdaf_datas_local, nwdaf_datas) { + if (!cJSON_IsObject(nwdaf_datas_local)) { + ogs_error("OpenAPI_sm_policy_context_data_parseFromJSON() failed [nwdaf_datas]"); + goto end; + } + OpenAPI_nwdaf_data_t *nwdaf_datasItem = OpenAPI_nwdaf_data_parseFromJSON(nwdaf_datas_local); + if (!nwdaf_datasItem) { + ogs_error("No nwdaf_datasItem"); + OpenAPI_list_free(nwdaf_datasList); + goto end; + } + OpenAPI_list_add(nwdaf_datasList, nwdaf_datasItem); + } + } + sm_policy_context_data_local_var = OpenAPI_sm_policy_context_data_create ( acc_net_ch_id ? acc_net_ch_id_local_nonprim : NULL, charg_entity_addr ? charg_entity_addr_local_nonprim : NULL, @@ -1126,9 +1290,15 @@ OpenAPI_sm_policy_context_data_t *OpenAPI_sm_policy_context_data_parseFromJSON(c smf_id && !cJSON_IsNull(smf_id) ? ogs_strdup(smf_id->valuestring) : NULL, recovery_time && !cJSON_IsNull(recovery_time) ? ogs_strdup(recovery_time->valuestring) : NULL, ma_pdu_ind ? ma_pdu_indVariable : 0, - atsss_capab ? atsss_capab_local_nonprim : NULL, + atsss_capab ? atsss_capabVariable : 0, ipv4_frame_route_list ? ipv4_frame_route_listList : NULL, - ipv6_frame_route_list ? ipv6_frame_route_listList : NULL + ipv6_frame_route_list ? ipv6_frame_route_listList : NULL, + sat_backhaul_category ? sat_backhaul_categoryVariable : 0, + pcf_ue_info ? pcf_ue_info_local_nonprim : NULL, + pvs_info ? pvs_infoList : NULL, + onboard_ind ? true : false, + onboard_ind ? onboard_ind->valueint : 0, + nwdaf_datas ? nwdaf_datasList : NULL ); return sm_policy_context_data_local_var; @@ -1184,10 +1354,6 @@ end: OpenAPI_serving_nf_identity_free(serv_nf_id_local_nonprim); serv_nf_id_local_nonprim = NULL; } - if (atsss_capab_local_nonprim) { - OpenAPI_atsss_capability_free(atsss_capab_local_nonprim); - atsss_capab_local_nonprim = NULL; - } if (ipv4_frame_route_listList) { OpenAPI_list_for_each(ipv4_frame_route_listList, node) { ogs_free(node->data); @@ -1202,6 +1368,24 @@ end: OpenAPI_list_free(ipv6_frame_route_listList); ipv6_frame_route_listList = NULL; } + if (pcf_ue_info_local_nonprim) { + OpenAPI_pcf_ue_callback_info_free(pcf_ue_info_local_nonprim); + pcf_ue_info_local_nonprim = NULL; + } + if (pvs_infoList) { + OpenAPI_list_for_each(pvs_infoList, node) { + OpenAPI_server_addressing_info_free(node->data); + } + OpenAPI_list_free(pvs_infoList); + pvs_infoList = NULL; + } + if (nwdaf_datasList) { + OpenAPI_list_for_each(nwdaf_datasList, node) { + OpenAPI_nwdaf_data_free(node->data); + } + OpenAPI_list_free(nwdaf_datasList); + nwdaf_datasList = NULL; + } return NULL; } diff --git a/lib/sbi/openapi/model/sm_policy_context_data.h b/lib/sbi/openapi/model/sm_policy_context_data.h index eff0e52db..d5ba2b7a4 100644 --- a/lib/sbi/openapi/model/sm_policy_context_data.h +++ b/lib/sbi/openapi/model/sm_policy_context_data.h @@ -1,7 +1,7 @@ /* * sm_policy_context_data.h * - * + * Contains the parameters used to create an Individual SM policy resource. */ #ifndef _OpenAPI_sm_policy_context_data_H_ @@ -17,13 +17,17 @@ #include "access_type.h" #include "additional_access_info.h" #include "ambr.h" -#include "atsss_capability.h" #include "dnn_selection_mode.h" #include "ma_pdu_indication.h" +#include "npcf_atsss_capability.h" +#include "nwdaf_data.h" +#include "pcf_ue_callback_info.h" #include "pdu_session_type.h" #include "plmn_id_nid.h" #include "qos_flow_usage.h" #include "rat_type.h" +#include "satellite_backhaul_category.h" +#include "server_addressing_info.h" #include "serving_nf_identity.h" #include "snssai.h" #include "subscribed_default_qos.h" @@ -82,9 +86,15 @@ typedef struct OpenAPI_sm_policy_context_data_s { char *smf_id; char *recovery_time; OpenAPI_ma_pdu_indication_e ma_pdu_ind; - struct OpenAPI_atsss_capability_s *atsss_capab; + OpenAPI_npcf_atsss_capability_e atsss_capab; OpenAPI_list_t *ipv4_frame_route_list; OpenAPI_list_t *ipv6_frame_route_list; + OpenAPI_satellite_backhaul_category_e sat_backhaul_category; + struct OpenAPI_pcf_ue_callback_info_s *pcf_ue_info; + OpenAPI_list_t *pvs_info; + bool is_onboard_ind; + int onboard_ind; + OpenAPI_list_t *nwdaf_datas; } OpenAPI_sm_policy_context_data_t; OpenAPI_sm_policy_context_data_t *OpenAPI_sm_policy_context_data_create( @@ -133,9 +143,15 @@ OpenAPI_sm_policy_context_data_t *OpenAPI_sm_policy_context_data_create( char *smf_id, char *recovery_time, OpenAPI_ma_pdu_indication_e ma_pdu_ind, - OpenAPI_atsss_capability_t *atsss_capab, + OpenAPI_npcf_atsss_capability_e atsss_capab, OpenAPI_list_t *ipv4_frame_route_list, - OpenAPI_list_t *ipv6_frame_route_list + OpenAPI_list_t *ipv6_frame_route_list, + OpenAPI_satellite_backhaul_category_e sat_backhaul_category, + OpenAPI_pcf_ue_callback_info_t *pcf_ue_info, + OpenAPI_list_t *pvs_info, + bool is_onboard_ind, + int onboard_ind, + OpenAPI_list_t *nwdaf_datas ); void OpenAPI_sm_policy_context_data_free(OpenAPI_sm_policy_context_data_t *sm_policy_context_data); OpenAPI_sm_policy_context_data_t *OpenAPI_sm_policy_context_data_parseFromJSON(cJSON *sm_policy_context_dataJSON); diff --git a/lib/sbi/openapi/model/sm_policy_control.h b/lib/sbi/openapi/model/sm_policy_control.h index 75ce6c52a..03097cb54 100644 --- a/lib/sbi/openapi/model/sm_policy_control.h +++ b/lib/sbi/openapi/model/sm_policy_control.h @@ -1,7 +1,7 @@ /* * sm_policy_control.h * - * + * Contains the parameters used to request the SM policies and the SM policies authorized by the PCF. */ #ifndef _OpenAPI_sm_policy_control_H_ diff --git a/lib/sbi/openapi/model/sm_policy_data.c b/lib/sbi/openapi/model/sm_policy_data.c index 3eee8ed51..6c25a0ae8 100644 --- a/lib/sbi/openapi/model/sm_policy_data.c +++ b/lib/sbi/openapi/model/sm_policy_data.c @@ -8,7 +8,8 @@ OpenAPI_sm_policy_data_t *OpenAPI_sm_policy_data_create( OpenAPI_list_t* sm_policy_snssai_data, OpenAPI_list_t* um_data_limits, OpenAPI_list_t* um_data, - char *supp_feat + char *supp_feat, + OpenAPI_list_t *reset_ids ) { OpenAPI_sm_policy_data_t *sm_policy_data_local_var = ogs_malloc(sizeof(OpenAPI_sm_policy_data_t)); @@ -18,6 +19,7 @@ OpenAPI_sm_policy_data_t *OpenAPI_sm_policy_data_create( sm_policy_data_local_var->um_data_limits = um_data_limits; sm_policy_data_local_var->um_data = um_data; sm_policy_data_local_var->supp_feat = supp_feat; + sm_policy_data_local_var->reset_ids = reset_ids; return sm_policy_data_local_var; } @@ -63,6 +65,13 @@ void OpenAPI_sm_policy_data_free(OpenAPI_sm_policy_data_t *sm_policy_data) ogs_free(sm_policy_data->supp_feat); sm_policy_data->supp_feat = NULL; } + if (sm_policy_data->reset_ids) { + OpenAPI_list_for_each(sm_policy_data->reset_ids, node) { + ogs_free(node->data); + } + OpenAPI_list_free(sm_policy_data->reset_ids); + sm_policy_data->reset_ids = NULL; + } ogs_free(sm_policy_data); } @@ -152,6 +161,20 @@ cJSON *OpenAPI_sm_policy_data_convertToJSON(OpenAPI_sm_policy_data_t *sm_policy_ } } + if (sm_policy_data->reset_ids) { + cJSON *reset_idsList = cJSON_AddArrayToObject(item, "resetIds"); + if (reset_idsList == NULL) { + ogs_error("OpenAPI_sm_policy_data_convertToJSON() failed [reset_ids]"); + goto end; + } + OpenAPI_list_for_each(sm_policy_data->reset_ids, node) { + if (cJSON_AddStringToObject(reset_idsList, "", (char*)node->data) == NULL) { + ogs_error("OpenAPI_sm_policy_data_convertToJSON() failed [reset_ids]"); + goto end; + } + } + } + end: return item; } @@ -167,6 +190,8 @@ OpenAPI_sm_policy_data_t *OpenAPI_sm_policy_data_parseFromJSON(cJSON *sm_policy_ cJSON *um_data = NULL; OpenAPI_list_t *um_dataList = NULL; cJSON *supp_feat = NULL; + cJSON *reset_ids = NULL; + OpenAPI_list_t *reset_idsList = NULL; sm_policy_snssai_data = cJSON_GetObjectItemCaseSensitive(sm_policy_dataJSON, "smPolicySnssaiData"); if (!sm_policy_snssai_data) { ogs_error("OpenAPI_sm_policy_data_parseFromJSON() failed [sm_policy_snssai_data]"); @@ -255,11 +280,33 @@ OpenAPI_sm_policy_data_t *OpenAPI_sm_policy_data_parseFromJSON(cJSON *sm_policy_ } } + reset_ids = cJSON_GetObjectItemCaseSensitive(sm_policy_dataJSON, "resetIds"); + if (reset_ids) { + cJSON *reset_ids_local = NULL; + if (!cJSON_IsArray(reset_ids)) { + ogs_error("OpenAPI_sm_policy_data_parseFromJSON() failed [reset_ids]"); + goto end; + } + + reset_idsList = OpenAPI_list_create(); + + cJSON_ArrayForEach(reset_ids_local, reset_ids) { + double *localDouble = NULL; + int *localInt = NULL; + if (!cJSON_IsString(reset_ids_local)) { + ogs_error("OpenAPI_sm_policy_data_parseFromJSON() failed [reset_ids]"); + goto end; + } + OpenAPI_list_add(reset_idsList, ogs_strdup(reset_ids_local->valuestring)); + } + } + sm_policy_data_local_var = OpenAPI_sm_policy_data_create ( sm_policy_snssai_dataList, um_data_limits ? um_data_limitsList : NULL, um_data ? um_dataList : NULL, - supp_feat && !cJSON_IsNull(supp_feat) ? ogs_strdup(supp_feat->valuestring) : NULL + supp_feat && !cJSON_IsNull(supp_feat) ? ogs_strdup(supp_feat->valuestring) : NULL, + reset_ids ? reset_idsList : NULL ); return sm_policy_data_local_var; @@ -294,6 +341,13 @@ end: OpenAPI_list_free(um_dataList); um_dataList = NULL; } + if (reset_idsList) { + OpenAPI_list_for_each(reset_idsList, node) { + ogs_free(node->data); + } + OpenAPI_list_free(reset_idsList); + reset_idsList = NULL; + } return NULL; } diff --git a/lib/sbi/openapi/model/sm_policy_data.h b/lib/sbi/openapi/model/sm_policy_data.h index baabfc80c..0cbfd6808 100644 --- a/lib/sbi/openapi/model/sm_policy_data.h +++ b/lib/sbi/openapi/model/sm_policy_data.h @@ -26,13 +26,15 @@ typedef struct OpenAPI_sm_policy_data_s { OpenAPI_list_t* um_data_limits; OpenAPI_list_t* um_data; char *supp_feat; + OpenAPI_list_t *reset_ids; } OpenAPI_sm_policy_data_t; OpenAPI_sm_policy_data_t *OpenAPI_sm_policy_data_create( OpenAPI_list_t* sm_policy_snssai_data, OpenAPI_list_t* um_data_limits, OpenAPI_list_t* um_data, - char *supp_feat + char *supp_feat, + OpenAPI_list_t *reset_ids ); void OpenAPI_sm_policy_data_free(OpenAPI_sm_policy_data_t *sm_policy_data); OpenAPI_sm_policy_data_t *OpenAPI_sm_policy_data_parseFromJSON(cJSON *sm_policy_dataJSON); diff --git a/lib/sbi/openapi/model/sm_policy_decision.c b/lib/sbi/openapi/model/sm_policy_decision.c index 9a96c6670..66aa6df8e 100644 --- a/lib/sbi/openapi/model/sm_policy_decision.c +++ b/lib/sbi/openapi/model/sm_policy_decision.c @@ -24,6 +24,8 @@ OpenAPI_sm_policy_decision_t *OpenAPI_sm_policy_decision_create( int offline, bool is_online, int online, + bool is_offline_ch_only, + int offline_ch_only, OpenAPI_list_t *policy_ctrl_req_triggers, OpenAPI_list_t *last_req_rule_data, OpenAPI_requested_usage_data_t *last_req_usage_data, @@ -64,6 +66,8 @@ OpenAPI_sm_policy_decision_t *OpenAPI_sm_policy_decision_create( sm_policy_decision_local_var->offline = offline; sm_policy_decision_local_var->is_online = is_online; sm_policy_decision_local_var->online = online; + sm_policy_decision_local_var->is_offline_ch_only = is_offline_ch_only; + sm_policy_decision_local_var->offline_ch_only = offline_ch_only; 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; @@ -493,6 +497,13 @@ cJSON *OpenAPI_sm_policy_decision_convertToJSON(OpenAPI_sm_policy_decision_t *sm } } + 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; + } + } + 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) { @@ -675,6 +686,7 @@ OpenAPI_sm_policy_decision_t *OpenAPI_sm_policy_decision_parseFromJSON(cJSON *sm cJSON *revalidation_time = NULL; cJSON *offline = NULL; cJSON *online = NULL; + cJSON *offline_ch_only = NULL; cJSON *policy_ctrl_req_triggers = NULL; OpenAPI_list_t *policy_ctrl_req_triggersList = NULL; cJSON *last_req_rule_data = NULL; @@ -976,6 +988,14 @@ OpenAPI_sm_policy_decision_t *OpenAPI_sm_policy_decision_parseFromJSON(cJSON *sm } } + 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; + } + } + policy_ctrl_req_triggers = cJSON_GetObjectItemCaseSensitive(sm_policy_decisionJSON, "policyCtrlReqTriggers"); if (policy_ctrl_req_triggers) { cJSON *policy_ctrl_req_triggers_local = NULL; @@ -1156,6 +1176,8 @@ OpenAPI_sm_policy_decision_t *OpenAPI_sm_policy_decision_parseFromJSON(cJSON *sm offline ? offline->valueint : 0, online ? true : false, online ? online->valueint : 0, + offline_ch_only ? true : false, + offline_ch_only ? offline_ch_only->valueint : 0, 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, diff --git a/lib/sbi/openapi/model/sm_policy_decision.h b/lib/sbi/openapi/model/sm_policy_decision.h index 9b90b8270..389964fe5 100644 --- a/lib/sbi/openapi/model/sm_policy_decision.h +++ b/lib/sbi/openapi/model/sm_policy_decision.h @@ -1,7 +1,7 @@ /* * sm_policy_decision.h * - * + * Contains the SM policies authorized by the PCF. */ #ifndef _OpenAPI_sm_policy_decision_H_ @@ -56,6 +56,8 @@ typedef struct OpenAPI_sm_policy_decision_s { int offline; bool is_online; int online; + bool is_offline_ch_only; + int offline_ch_only; OpenAPI_list_t *policy_ctrl_req_triggers; OpenAPI_list_t *last_req_rule_data; struct OpenAPI_requested_usage_data_s *last_req_usage_data; @@ -94,6 +96,8 @@ OpenAPI_sm_policy_decision_t *OpenAPI_sm_policy_decision_create( int offline, bool is_online, int online, + bool is_offline_ch_only, + int offline_ch_only, OpenAPI_list_t *policy_ctrl_req_triggers, OpenAPI_list_t *last_req_rule_data, OpenAPI_requested_usage_data_t *last_req_usage_data, diff --git a/lib/sbi/openapi/model/sm_policy_delete_data.h b/lib/sbi/openapi/model/sm_policy_delete_data.h index 5fef3e7a8..a1c9448f2 100644 --- a/lib/sbi/openapi/model/sm_policy_delete_data.h +++ b/lib/sbi/openapi/model/sm_policy_delete_data.h @@ -1,7 +1,7 @@ /* * sm_policy_delete_data.h * - * + * Contains the parameters to be sent to the PCF when an individual SM policy is deleted. */ #ifndef _OpenAPI_sm_policy_delete_data_H_ diff --git a/lib/sbi/openapi/model/sm_policy_notification.h b/lib/sbi/openapi/model/sm_policy_notification.h index 1f8716baa..4a6768c33 100644 --- a/lib/sbi/openapi/model/sm_policy_notification.h +++ b/lib/sbi/openapi/model/sm_policy_notification.h @@ -1,7 +1,7 @@ /* * sm_policy_notification.h * - * + * Represents a notification on the update of the SM policies. */ #ifndef _OpenAPI_sm_policy_notification_H_ diff --git a/lib/sbi/openapi/model/sm_policy_snssai_data.c b/lib/sbi/openapi/model/sm_policy_snssai_data.c index 765792a35..947378e1b 100644 --- a/lib/sbi/openapi/model/sm_policy_snssai_data.c +++ b/lib/sbi/openapi/model/sm_policy_snssai_data.c @@ -6,7 +6,8 @@ OpenAPI_sm_policy_snssai_data_t *OpenAPI_sm_policy_snssai_data_create( OpenAPI_snssai_t *snssai, - OpenAPI_list_t* sm_policy_dnn_data + OpenAPI_list_t* sm_policy_dnn_data, + OpenAPI_slice_mbr_1_t *ue_slice_mbr ) { OpenAPI_sm_policy_snssai_data_t *sm_policy_snssai_data_local_var = ogs_malloc(sizeof(OpenAPI_sm_policy_snssai_data_t)); @@ -14,6 +15,7 @@ OpenAPI_sm_policy_snssai_data_t *OpenAPI_sm_policy_snssai_data_create( sm_policy_snssai_data_local_var->snssai = snssai; sm_policy_snssai_data_local_var->sm_policy_dnn_data = sm_policy_dnn_data; + sm_policy_snssai_data_local_var->ue_slice_mbr = ue_slice_mbr; return sm_policy_snssai_data_local_var; } @@ -39,6 +41,10 @@ void OpenAPI_sm_policy_snssai_data_free(OpenAPI_sm_policy_snssai_data_t *sm_poli OpenAPI_list_free(sm_policy_snssai_data->sm_policy_dnn_data); sm_policy_snssai_data->sm_policy_dnn_data = NULL; } + if (sm_policy_snssai_data->ue_slice_mbr) { + OpenAPI_slice_mbr_1_free(sm_policy_snssai_data->ue_slice_mbr); + sm_policy_snssai_data->ue_slice_mbr = NULL; + } ogs_free(sm_policy_snssai_data); } @@ -90,6 +96,19 @@ cJSON *OpenAPI_sm_policy_snssai_data_convertToJSON(OpenAPI_sm_policy_snssai_data } } + if (sm_policy_snssai_data->ue_slice_mbr) { + cJSON *ue_slice_mbr_local_JSON = OpenAPI_slice_mbr_1_convertToJSON(sm_policy_snssai_data->ue_slice_mbr); + if (ue_slice_mbr_local_JSON == NULL) { + ogs_error("OpenAPI_sm_policy_snssai_data_convertToJSON() failed [ue_slice_mbr]"); + goto end; + } + cJSON_AddItemToObject(item, "ueSliceMbr", ue_slice_mbr_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_sm_policy_snssai_data_convertToJSON() failed [ue_slice_mbr]"); + goto end; + } + } + end: return item; } @@ -102,6 +121,8 @@ OpenAPI_sm_policy_snssai_data_t *OpenAPI_sm_policy_snssai_data_parseFromJSON(cJS OpenAPI_snssai_t *snssai_local_nonprim = NULL; cJSON *sm_policy_dnn_data = NULL; OpenAPI_list_t *sm_policy_dnn_dataList = NULL; + cJSON *ue_slice_mbr = NULL; + OpenAPI_slice_mbr_1_t *ue_slice_mbr_local_nonprim = NULL; snssai = cJSON_GetObjectItemCaseSensitive(sm_policy_snssai_dataJSON, "snssai"); if (!snssai) { ogs_error("OpenAPI_sm_policy_snssai_data_parseFromJSON() failed [snssai]"); @@ -135,9 +156,15 @@ OpenAPI_sm_policy_snssai_data_t *OpenAPI_sm_policy_snssai_data_parseFromJSON(cJS } } + ue_slice_mbr = cJSON_GetObjectItemCaseSensitive(sm_policy_snssai_dataJSON, "ueSliceMbr"); + if (ue_slice_mbr) { + ue_slice_mbr_local_nonprim = OpenAPI_slice_mbr_1_parseFromJSON(ue_slice_mbr); + } + sm_policy_snssai_data_local_var = OpenAPI_sm_policy_snssai_data_create ( snssai_local_nonprim, - sm_policy_dnn_data ? sm_policy_dnn_dataList : NULL + sm_policy_dnn_data ? sm_policy_dnn_dataList : NULL, + ue_slice_mbr ? ue_slice_mbr_local_nonprim : NULL ); return sm_policy_snssai_data_local_var; @@ -156,6 +183,10 @@ end: OpenAPI_list_free(sm_policy_dnn_dataList); sm_policy_dnn_dataList = NULL; } + if (ue_slice_mbr_local_nonprim) { + OpenAPI_slice_mbr_1_free(ue_slice_mbr_local_nonprim); + ue_slice_mbr_local_nonprim = NULL; + } return NULL; } diff --git a/lib/sbi/openapi/model/sm_policy_snssai_data.h b/lib/sbi/openapi/model/sm_policy_snssai_data.h index d478617f2..9cec3a3f0 100644 --- a/lib/sbi/openapi/model/sm_policy_snssai_data.h +++ b/lib/sbi/openapi/model/sm_policy_snssai_data.h @@ -12,6 +12,7 @@ #include "../include/list.h" #include "../include/keyValuePair.h" #include "../include/binary.h" +#include "slice_mbr_1.h" #include "sm_policy_dnn_data.h" #include "snssai.h" @@ -23,11 +24,13 @@ typedef struct OpenAPI_sm_policy_snssai_data_s OpenAPI_sm_policy_snssai_data_t; typedef struct OpenAPI_sm_policy_snssai_data_s { struct OpenAPI_snssai_s *snssai; OpenAPI_list_t* sm_policy_dnn_data; + struct OpenAPI_slice_mbr_1_s *ue_slice_mbr; } OpenAPI_sm_policy_snssai_data_t; OpenAPI_sm_policy_snssai_data_t *OpenAPI_sm_policy_snssai_data_create( OpenAPI_snssai_t *snssai, - OpenAPI_list_t* sm_policy_dnn_data + OpenAPI_list_t* sm_policy_dnn_data, + OpenAPI_slice_mbr_1_t *ue_slice_mbr ); void OpenAPI_sm_policy_snssai_data_free(OpenAPI_sm_policy_snssai_data_t *sm_policy_snssai_data); OpenAPI_sm_policy_snssai_data_t *OpenAPI_sm_policy_snssai_data_parseFromJSON(cJSON *sm_policy_snssai_dataJSON); diff --git a/lib/sbi/openapi/model/sm_policy_update_context_data.c b/lib/sbi/openapi/model/sm_policy_update_context_data.c index 4e6f6b6e7..b6acf171e 100644 --- a/lib/sbi/openapi/model/sm_policy_update_context_data.c +++ b/lib/sbi/openapi/model/sm_policy_update_context_data.c @@ -27,6 +27,8 @@ OpenAPI_sm_policy_update_context_data_t *OpenAPI_sm_policy_update_context_data_c char *auth_prof_index, OpenAPI_subscribed_default_qos_t *subs_def_qos, OpenAPI_vplmn_qos_t *vplmn_qos, + bool is_vplmn_qos_not_app, + int vplmn_qos_not_app, bool is_num_of_pack_filter, int num_of_pack_filter, OpenAPI_list_t *accu_usage_reports, @@ -47,17 +49,23 @@ OpenAPI_sm_policy_update_context_data_t *OpenAPI_sm_policy_update_context_data_c OpenAPI_serving_nf_identity_t *serv_nf_id, OpenAPI_trace_data_t *trace_req, OpenAPI_ma_pdu_indication_e ma_pdu_ind, - OpenAPI_atsss_capability_t *atsss_capab, + OpenAPI_npcf_atsss_capability_e atsss_capab, OpenAPI_tsn_bridge_info_t *tsn_bridge_info, OpenAPI_bridge_management_container_t *tsn_bridge_man_cont, OpenAPI_port_management_container_t *tsn_port_man_cont_dstt, OpenAPI_list_t *tsn_port_man_cont_nwtts, OpenAPI_list_t *mul_addr_infos, OpenAPI_list_t *policy_dec_failure_reports, + OpenAPI_list_t *invalid_policy_decs, OpenAPI_list_t *traffic_descriptors, char *pcc_rule_id, + OpenAPI_list_t *types_of_notif, OpenAPI_list_t *inter_grp_ids, - OpenAPI_list_t *types_of_notif + OpenAPI_satellite_backhaul_category_e sat_backhaul_category, + OpenAPI_pcf_ue_callback_info_t *pcf_ue_info, + OpenAPI_list_t *nwdaf_datas, + bool is_an_gw_status, + int an_gw_status ) { OpenAPI_sm_policy_update_context_data_t *sm_policy_update_context_data_local_var = ogs_malloc(sizeof(OpenAPI_sm_policy_update_context_data_t)); @@ -85,6 +93,8 @@ OpenAPI_sm_policy_update_context_data_t *OpenAPI_sm_policy_update_context_data_c sm_policy_update_context_data_local_var->auth_prof_index = auth_prof_index; sm_policy_update_context_data_local_var->subs_def_qos = subs_def_qos; sm_policy_update_context_data_local_var->vplmn_qos = vplmn_qos; + sm_policy_update_context_data_local_var->is_vplmn_qos_not_app = is_vplmn_qos_not_app; + sm_policy_update_context_data_local_var->vplmn_qos_not_app = vplmn_qos_not_app; sm_policy_update_context_data_local_var->is_num_of_pack_filter = is_num_of_pack_filter; sm_policy_update_context_data_local_var->num_of_pack_filter = num_of_pack_filter; sm_policy_update_context_data_local_var->accu_usage_reports = accu_usage_reports; @@ -112,10 +122,16 @@ OpenAPI_sm_policy_update_context_data_t *OpenAPI_sm_policy_update_context_data_c sm_policy_update_context_data_local_var->tsn_port_man_cont_nwtts = tsn_port_man_cont_nwtts; sm_policy_update_context_data_local_var->mul_addr_infos = mul_addr_infos; sm_policy_update_context_data_local_var->policy_dec_failure_reports = policy_dec_failure_reports; + sm_policy_update_context_data_local_var->invalid_policy_decs = invalid_policy_decs; sm_policy_update_context_data_local_var->traffic_descriptors = traffic_descriptors; sm_policy_update_context_data_local_var->pcc_rule_id = pcc_rule_id; - sm_policy_update_context_data_local_var->inter_grp_ids = inter_grp_ids; sm_policy_update_context_data_local_var->types_of_notif = types_of_notif; + sm_policy_update_context_data_local_var->inter_grp_ids = inter_grp_ids; + sm_policy_update_context_data_local_var->sat_backhaul_category = sat_backhaul_category; + sm_policy_update_context_data_local_var->pcf_ue_info = pcf_ue_info; + sm_policy_update_context_data_local_var->nwdaf_datas = nwdaf_datas; + sm_policy_update_context_data_local_var->is_an_gw_status = is_an_gw_status; + sm_policy_update_context_data_local_var->an_gw_status = an_gw_status; return sm_policy_update_context_data_local_var; } @@ -278,10 +294,6 @@ void OpenAPI_sm_policy_update_context_data_free(OpenAPI_sm_policy_update_context OpenAPI_trace_data_free(sm_policy_update_context_data->trace_req); sm_policy_update_context_data->trace_req = NULL; } - if (sm_policy_update_context_data->atsss_capab) { - OpenAPI_atsss_capability_free(sm_policy_update_context_data->atsss_capab); - sm_policy_update_context_data->atsss_capab = NULL; - } if (sm_policy_update_context_data->tsn_bridge_info) { OpenAPI_tsn_bridge_info_free(sm_policy_update_context_data->tsn_bridge_info); sm_policy_update_context_data->tsn_bridge_info = NULL; @@ -312,6 +324,13 @@ void OpenAPI_sm_policy_update_context_data_free(OpenAPI_sm_policy_update_context OpenAPI_list_free(sm_policy_update_context_data->policy_dec_failure_reports); sm_policy_update_context_data->policy_dec_failure_reports = NULL; } + if (sm_policy_update_context_data->invalid_policy_decs) { + OpenAPI_list_for_each(sm_policy_update_context_data->invalid_policy_decs, node) { + OpenAPI_invalid_param_free(node->data); + } + OpenAPI_list_free(sm_policy_update_context_data->invalid_policy_decs); + sm_policy_update_context_data->invalid_policy_decs = NULL; + } if (sm_policy_update_context_data->traffic_descriptors) { OpenAPI_list_for_each(sm_policy_update_context_data->traffic_descriptors, node) { OpenAPI_ddd_traffic_descriptor_free(node->data); @@ -323,6 +342,10 @@ void OpenAPI_sm_policy_update_context_data_free(OpenAPI_sm_policy_update_context ogs_free(sm_policy_update_context_data->pcc_rule_id); sm_policy_update_context_data->pcc_rule_id = NULL; } + if (sm_policy_update_context_data->types_of_notif) { + OpenAPI_list_free(sm_policy_update_context_data->types_of_notif); + sm_policy_update_context_data->types_of_notif = NULL; + } if (sm_policy_update_context_data->inter_grp_ids) { OpenAPI_list_for_each(sm_policy_update_context_data->inter_grp_ids, node) { ogs_free(node->data); @@ -330,9 +353,16 @@ void OpenAPI_sm_policy_update_context_data_free(OpenAPI_sm_policy_update_context OpenAPI_list_free(sm_policy_update_context_data->inter_grp_ids); sm_policy_update_context_data->inter_grp_ids = NULL; } - if (sm_policy_update_context_data->types_of_notif) { - OpenAPI_list_free(sm_policy_update_context_data->types_of_notif); - sm_policy_update_context_data->types_of_notif = NULL; + if (sm_policy_update_context_data->pcf_ue_info) { + OpenAPI_pcf_ue_callback_info_free(sm_policy_update_context_data->pcf_ue_info); + sm_policy_update_context_data->pcf_ue_info = NULL; + } + if (sm_policy_update_context_data->nwdaf_datas) { + OpenAPI_list_for_each(sm_policy_update_context_data->nwdaf_datas, node) { + OpenAPI_nwdaf_data_free(node->data); + } + OpenAPI_list_free(sm_policy_update_context_data->nwdaf_datas); + sm_policy_update_context_data->nwdaf_datas = NULL; } ogs_free(sm_policy_update_context_data); } @@ -560,6 +590,13 @@ cJSON *OpenAPI_sm_policy_update_context_data_convertToJSON(OpenAPI_sm_policy_upd } } + if (sm_policy_update_context_data->is_vplmn_qos_not_app) { + if (cJSON_AddBoolToObject(item, "vplmnQosNotApp", sm_policy_update_context_data->vplmn_qos_not_app) == NULL) { + ogs_error("OpenAPI_sm_policy_update_context_data_convertToJSON() failed [vplmn_qos_not_app]"); + goto end; + } + } + if (sm_policy_update_context_data->is_num_of_pack_filter) { if (cJSON_AddNumberToObject(item, "numOfPackFilter", sm_policy_update_context_data->num_of_pack_filter) == NULL) { ogs_error("OpenAPI_sm_policy_update_context_data_convertToJSON() failed [num_of_pack_filter]"); @@ -766,14 +803,8 @@ cJSON *OpenAPI_sm_policy_update_context_data_convertToJSON(OpenAPI_sm_policy_upd } } - if (sm_policy_update_context_data->atsss_capab) { - cJSON *atsss_capab_local_JSON = OpenAPI_atsss_capability_convertToJSON(sm_policy_update_context_data->atsss_capab); - if (atsss_capab_local_JSON == NULL) { - ogs_error("OpenAPI_sm_policy_update_context_data_convertToJSON() failed [atsss_capab]"); - goto end; - } - cJSON_AddItemToObject(item, "atsssCapab", atsss_capab_local_JSON); - if (item->child == NULL) { + if (sm_policy_update_context_data->atsss_capab != OpenAPI_npcf_atsss_capability_NULL) { + if (cJSON_AddStringToObject(item, "atsssCapab", OpenAPI_npcf_atsss_capability_ToString(sm_policy_update_context_data->atsss_capab)) == NULL) { ogs_error("OpenAPI_sm_policy_update_context_data_convertToJSON() failed [atsss_capab]"); goto end; } @@ -864,6 +895,22 @@ cJSON *OpenAPI_sm_policy_update_context_data_convertToJSON(OpenAPI_sm_policy_upd } } + if (sm_policy_update_context_data->invalid_policy_decs) { + cJSON *invalid_policy_decsList = cJSON_AddArrayToObject(item, "invalidPolicyDecs"); + if (invalid_policy_decsList == NULL) { + ogs_error("OpenAPI_sm_policy_update_context_data_convertToJSON() failed [invalid_policy_decs]"); + goto end; + } + OpenAPI_list_for_each(sm_policy_update_context_data->invalid_policy_decs, node) { + cJSON *itemLocal = OpenAPI_invalid_param_convertToJSON(node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_sm_policy_update_context_data_convertToJSON() failed [invalid_policy_decs]"); + goto end; + } + cJSON_AddItemToArray(invalid_policy_decsList, itemLocal); + } + } + if (sm_policy_update_context_data->traffic_descriptors) { cJSON *traffic_descriptorsList = cJSON_AddArrayToObject(item, "trafficDescriptors"); if (traffic_descriptorsList == NULL) { @@ -887,6 +934,20 @@ cJSON *OpenAPI_sm_policy_update_context_data_convertToJSON(OpenAPI_sm_policy_upd } } + if (sm_policy_update_context_data->types_of_notif != OpenAPI_dl_data_delivery_status_NULL) { + cJSON *types_of_notifList = cJSON_AddArrayToObject(item, "typesOfNotif"); + if (types_of_notifList == NULL) { + ogs_error("OpenAPI_sm_policy_update_context_data_convertToJSON() failed [types_of_notif]"); + goto end; + } + OpenAPI_list_for_each(sm_policy_update_context_data->types_of_notif, node) { + if (cJSON_AddStringToObject(types_of_notifList, "", OpenAPI_dl_data_delivery_status_ToString((intptr_t)node->data)) == NULL) { + ogs_error("OpenAPI_sm_policy_update_context_data_convertToJSON() failed [types_of_notif]"); + goto end; + } + } + } + if (sm_policy_update_context_data->inter_grp_ids) { cJSON *inter_grp_idsList = cJSON_AddArrayToObject(item, "interGrpIds"); if (inter_grp_idsList == NULL) { @@ -901,17 +962,46 @@ cJSON *OpenAPI_sm_policy_update_context_data_convertToJSON(OpenAPI_sm_policy_upd } } - if (sm_policy_update_context_data->types_of_notif != OpenAPI_dl_data_delivery_status_NULL) { - cJSON *types_of_notifList = cJSON_AddArrayToObject(item, "typesOfNotif"); - if (types_of_notifList == NULL) { - ogs_error("OpenAPI_sm_policy_update_context_data_convertToJSON() failed [types_of_notif]"); + if (sm_policy_update_context_data->sat_backhaul_category != OpenAPI_satellite_backhaul_category_NULL) { + if (cJSON_AddStringToObject(item, "satBackhaulCategory", OpenAPI_satellite_backhaul_category_ToString(sm_policy_update_context_data->sat_backhaul_category)) == NULL) { + ogs_error("OpenAPI_sm_policy_update_context_data_convertToJSON() failed [sat_backhaul_category]"); goto end; } - OpenAPI_list_for_each(sm_policy_update_context_data->types_of_notif, node) { - if (cJSON_AddStringToObject(types_of_notifList, "", OpenAPI_dl_data_delivery_status_ToString((intptr_t)node->data)) == NULL) { - ogs_error("OpenAPI_sm_policy_update_context_data_convertToJSON() failed [types_of_notif]"); + } + + if (sm_policy_update_context_data->pcf_ue_info) { + cJSON *pcf_ue_info_local_JSON = OpenAPI_pcf_ue_callback_info_convertToJSON(sm_policy_update_context_data->pcf_ue_info); + if (pcf_ue_info_local_JSON == NULL) { + ogs_error("OpenAPI_sm_policy_update_context_data_convertToJSON() failed [pcf_ue_info]"); + goto end; + } + cJSON_AddItemToObject(item, "pcfUeInfo", pcf_ue_info_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_sm_policy_update_context_data_convertToJSON() failed [pcf_ue_info]"); + goto end; + } + } + + if (sm_policy_update_context_data->nwdaf_datas) { + cJSON *nwdaf_datasList = cJSON_AddArrayToObject(item, "nwdafDatas"); + if (nwdaf_datasList == NULL) { + ogs_error("OpenAPI_sm_policy_update_context_data_convertToJSON() failed [nwdaf_datas]"); + goto end; + } + OpenAPI_list_for_each(sm_policy_update_context_data->nwdaf_datas, node) { + cJSON *itemLocal = OpenAPI_nwdaf_data_convertToJSON(node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_sm_policy_update_context_data_convertToJSON() failed [nwdaf_datas]"); goto end; } + cJSON_AddItemToArray(nwdaf_datasList, itemLocal); + } + } + + if (sm_policy_update_context_data->is_an_gw_status) { + if (cJSON_AddBoolToObject(item, "anGwStatus", sm_policy_update_context_data->an_gw_status) == NULL) { + ogs_error("OpenAPI_sm_policy_update_context_data_convertToJSON() failed [an_gw_status]"); + goto end; } } @@ -956,6 +1046,7 @@ OpenAPI_sm_policy_update_context_data_t *OpenAPI_sm_policy_update_context_data_p OpenAPI_subscribed_default_qos_t *subs_def_qos_local_nonprim = NULL; cJSON *vplmn_qos = NULL; OpenAPI_vplmn_qos_t *vplmn_qos_local_nonprim = NULL; + cJSON *vplmn_qos_not_app = NULL; cJSON *num_of_pack_filter = NULL; cJSON *accu_usage_reports = NULL; OpenAPI_list_t *accu_usage_reportsList = NULL; @@ -987,7 +1078,7 @@ OpenAPI_sm_policy_update_context_data_t *OpenAPI_sm_policy_update_context_data_p cJSON *ma_pdu_ind = NULL; OpenAPI_ma_pdu_indication_e ma_pdu_indVariable = 0; cJSON *atsss_capab = NULL; - OpenAPI_atsss_capability_t *atsss_capab_local_nonprim = NULL; + OpenAPI_npcf_atsss_capability_e atsss_capabVariable = 0; cJSON *tsn_bridge_info = NULL; OpenAPI_tsn_bridge_info_t *tsn_bridge_info_local_nonprim = NULL; cJSON *tsn_bridge_man_cont = NULL; @@ -1000,13 +1091,22 @@ OpenAPI_sm_policy_update_context_data_t *OpenAPI_sm_policy_update_context_data_p OpenAPI_list_t *mul_addr_infosList = NULL; cJSON *policy_dec_failure_reports = NULL; OpenAPI_list_t *policy_dec_failure_reportsList = NULL; + cJSON *invalid_policy_decs = NULL; + OpenAPI_list_t *invalid_policy_decsList = NULL; cJSON *traffic_descriptors = NULL; OpenAPI_list_t *traffic_descriptorsList = NULL; cJSON *pcc_rule_id = NULL; - cJSON *inter_grp_ids = NULL; - OpenAPI_list_t *inter_grp_idsList = NULL; cJSON *types_of_notif = NULL; OpenAPI_list_t *types_of_notifList = NULL; + cJSON *inter_grp_ids = NULL; + OpenAPI_list_t *inter_grp_idsList = NULL; + cJSON *sat_backhaul_category = NULL; + OpenAPI_satellite_backhaul_category_e sat_backhaul_categoryVariable = 0; + cJSON *pcf_ue_info = NULL; + OpenAPI_pcf_ue_callback_info_t *pcf_ue_info_local_nonprim = NULL; + cJSON *nwdaf_datas = NULL; + OpenAPI_list_t *nwdaf_datasList = NULL; + cJSON *an_gw_status = NULL; rep_policy_ctrl_req_triggers = cJSON_GetObjectItemCaseSensitive(sm_policy_update_context_dataJSON, "repPolicyCtrlReqTriggers"); if (rep_policy_ctrl_req_triggers) { cJSON *rep_policy_ctrl_req_triggers_local = NULL; @@ -1192,6 +1292,14 @@ OpenAPI_sm_policy_update_context_data_t *OpenAPI_sm_policy_update_context_data_p vplmn_qos_local_nonprim = OpenAPI_vplmn_qos_parseFromJSON(vplmn_qos); } + vplmn_qos_not_app = cJSON_GetObjectItemCaseSensitive(sm_policy_update_context_dataJSON, "vplmnQosNotApp"); + if (vplmn_qos_not_app) { + if (!cJSON_IsBool(vplmn_qos_not_app)) { + ogs_error("OpenAPI_sm_policy_update_context_data_parseFromJSON() failed [vplmn_qos_not_app]"); + goto end; + } + } + num_of_pack_filter = cJSON_GetObjectItemCaseSensitive(sm_policy_update_context_dataJSON, "numOfPackFilter"); if (num_of_pack_filter) { if (!cJSON_IsNumber(num_of_pack_filter)) { @@ -1444,7 +1552,11 @@ OpenAPI_sm_policy_update_context_data_t *OpenAPI_sm_policy_update_context_data_p atsss_capab = cJSON_GetObjectItemCaseSensitive(sm_policy_update_context_dataJSON, "atsssCapab"); if (atsss_capab) { - atsss_capab_local_nonprim = OpenAPI_atsss_capability_parseFromJSON(atsss_capab); + if (!cJSON_IsString(atsss_capab)) { + ogs_error("OpenAPI_sm_policy_update_context_data_parseFromJSON() failed [atsss_capab]"); + goto end; + } + atsss_capabVariable = OpenAPI_npcf_atsss_capability_FromString(atsss_capab->valuestring); } tsn_bridge_info = cJSON_GetObjectItemCaseSensitive(sm_policy_update_context_dataJSON, "tsnBridgeInfo"); @@ -1531,6 +1643,31 @@ OpenAPI_sm_policy_update_context_data_t *OpenAPI_sm_policy_update_context_data_p } } + invalid_policy_decs = cJSON_GetObjectItemCaseSensitive(sm_policy_update_context_dataJSON, "invalidPolicyDecs"); + if (invalid_policy_decs) { + cJSON *invalid_policy_decs_local = NULL; + if (!cJSON_IsArray(invalid_policy_decs)) { + ogs_error("OpenAPI_sm_policy_update_context_data_parseFromJSON() failed [invalid_policy_decs]"); + goto end; + } + + invalid_policy_decsList = OpenAPI_list_create(); + + cJSON_ArrayForEach(invalid_policy_decs_local, invalid_policy_decs) { + if (!cJSON_IsObject(invalid_policy_decs_local)) { + ogs_error("OpenAPI_sm_policy_update_context_data_parseFromJSON() failed [invalid_policy_decs]"); + goto end; + } + OpenAPI_invalid_param_t *invalid_policy_decsItem = OpenAPI_invalid_param_parseFromJSON(invalid_policy_decs_local); + if (!invalid_policy_decsItem) { + ogs_error("No invalid_policy_decsItem"); + OpenAPI_list_free(invalid_policy_decsList); + goto end; + } + OpenAPI_list_add(invalid_policy_decsList, invalid_policy_decsItem); + } + } + traffic_descriptors = cJSON_GetObjectItemCaseSensitive(sm_policy_update_context_dataJSON, "trafficDescriptors"); if (traffic_descriptors) { cJSON *traffic_descriptors_local = NULL; @@ -1564,6 +1701,25 @@ OpenAPI_sm_policy_update_context_data_t *OpenAPI_sm_policy_update_context_data_p } } + types_of_notif = cJSON_GetObjectItemCaseSensitive(sm_policy_update_context_dataJSON, "typesOfNotif"); + if (types_of_notif) { + cJSON *types_of_notif_local = NULL; + if (!cJSON_IsArray(types_of_notif)) { + ogs_error("OpenAPI_sm_policy_update_context_data_parseFromJSON() failed [types_of_notif]"); + goto end; + } + + types_of_notifList = OpenAPI_list_create(); + + cJSON_ArrayForEach(types_of_notif_local, types_of_notif) { + if (!cJSON_IsString(types_of_notif_local)) { + ogs_error("OpenAPI_sm_policy_update_context_data_parseFromJSON() failed [types_of_notif]"); + goto end; + } + OpenAPI_list_add(types_of_notifList, (void *)OpenAPI_dl_data_delivery_status_FromString(types_of_notif_local->valuestring)); + } + } + inter_grp_ids = cJSON_GetObjectItemCaseSensitive(sm_policy_update_context_dataJSON, "interGrpIds"); if (inter_grp_ids) { cJSON *inter_grp_ids_local = NULL; @@ -1585,25 +1741,53 @@ OpenAPI_sm_policy_update_context_data_t *OpenAPI_sm_policy_update_context_data_p } } - types_of_notif = cJSON_GetObjectItemCaseSensitive(sm_policy_update_context_dataJSON, "typesOfNotif"); - if (types_of_notif) { - cJSON *types_of_notif_local = NULL; - if (!cJSON_IsArray(types_of_notif)) { - ogs_error("OpenAPI_sm_policy_update_context_data_parseFromJSON() failed [types_of_notif]"); + sat_backhaul_category = cJSON_GetObjectItemCaseSensitive(sm_policy_update_context_dataJSON, "satBackhaulCategory"); + if (sat_backhaul_category) { + if (!cJSON_IsString(sat_backhaul_category)) { + ogs_error("OpenAPI_sm_policy_update_context_data_parseFromJSON() failed [sat_backhaul_category]"); + goto end; + } + sat_backhaul_categoryVariable = OpenAPI_satellite_backhaul_category_FromString(sat_backhaul_category->valuestring); + } + + pcf_ue_info = cJSON_GetObjectItemCaseSensitive(sm_policy_update_context_dataJSON, "pcfUeInfo"); + if (pcf_ue_info) { + pcf_ue_info_local_nonprim = OpenAPI_pcf_ue_callback_info_parseFromJSON(pcf_ue_info); + } + + nwdaf_datas = cJSON_GetObjectItemCaseSensitive(sm_policy_update_context_dataJSON, "nwdafDatas"); + if (nwdaf_datas) { + cJSON *nwdaf_datas_local = NULL; + if (!cJSON_IsArray(nwdaf_datas)) { + ogs_error("OpenAPI_sm_policy_update_context_data_parseFromJSON() failed [nwdaf_datas]"); goto end; } - types_of_notifList = OpenAPI_list_create(); + nwdaf_datasList = OpenAPI_list_create(); - cJSON_ArrayForEach(types_of_notif_local, types_of_notif) { - if (!cJSON_IsString(types_of_notif_local)) { - ogs_error("OpenAPI_sm_policy_update_context_data_parseFromJSON() failed [types_of_notif]"); + cJSON_ArrayForEach(nwdaf_datas_local, nwdaf_datas) { + if (!cJSON_IsObject(nwdaf_datas_local)) { + ogs_error("OpenAPI_sm_policy_update_context_data_parseFromJSON() failed [nwdaf_datas]"); goto end; } - OpenAPI_list_add(types_of_notifList, (void *)OpenAPI_dl_data_delivery_status_FromString(types_of_notif_local->valuestring)); + OpenAPI_nwdaf_data_t *nwdaf_datasItem = OpenAPI_nwdaf_data_parseFromJSON(nwdaf_datas_local); + if (!nwdaf_datasItem) { + ogs_error("No nwdaf_datasItem"); + OpenAPI_list_free(nwdaf_datasList); + goto end; + } + OpenAPI_list_add(nwdaf_datasList, nwdaf_datasItem); } } + an_gw_status = cJSON_GetObjectItemCaseSensitive(sm_policy_update_context_dataJSON, "anGwStatus"); + if (an_gw_status) { + if (!cJSON_IsBool(an_gw_status)) { + ogs_error("OpenAPI_sm_policy_update_context_data_parseFromJSON() failed [an_gw_status]"); + goto end; + } + } + sm_policy_update_context_data_local_var = OpenAPI_sm_policy_update_context_data_create ( rep_policy_ctrl_req_triggers ? rep_policy_ctrl_req_triggersList : NULL, acc_net_ch_ids ? acc_net_ch_idsList : NULL, @@ -1627,6 +1811,8 @@ OpenAPI_sm_policy_update_context_data_t *OpenAPI_sm_policy_update_context_data_p auth_prof_index && !cJSON_IsNull(auth_prof_index) ? ogs_strdup(auth_prof_index->valuestring) : NULL, subs_def_qos ? subs_def_qos_local_nonprim : NULL, vplmn_qos ? vplmn_qos_local_nonprim : NULL, + vplmn_qos_not_app ? true : false, + vplmn_qos_not_app ? vplmn_qos_not_app->valueint : 0, num_of_pack_filter ? true : false, num_of_pack_filter ? num_of_pack_filter->valuedouble : 0, accu_usage_reports ? accu_usage_reportsList : NULL, @@ -1647,17 +1833,23 @@ OpenAPI_sm_policy_update_context_data_t *OpenAPI_sm_policy_update_context_data_p serv_nf_id ? serv_nf_id_local_nonprim : NULL, trace_req ? trace_req_local_nonprim : NULL, ma_pdu_ind ? ma_pdu_indVariable : 0, - atsss_capab ? atsss_capab_local_nonprim : NULL, + atsss_capab ? atsss_capabVariable : 0, tsn_bridge_info ? tsn_bridge_info_local_nonprim : NULL, tsn_bridge_man_cont ? tsn_bridge_man_cont_local_nonprim : NULL, tsn_port_man_cont_dstt ? tsn_port_man_cont_dstt_local_nonprim : NULL, tsn_port_man_cont_nwtts ? tsn_port_man_cont_nwttsList : NULL, mul_addr_infos ? mul_addr_infosList : NULL, policy_dec_failure_reports ? policy_dec_failure_reportsList : NULL, + invalid_policy_decs ? invalid_policy_decsList : NULL, traffic_descriptors ? traffic_descriptorsList : NULL, pcc_rule_id && !cJSON_IsNull(pcc_rule_id) ? ogs_strdup(pcc_rule_id->valuestring) : NULL, + types_of_notif ? types_of_notifList : NULL, inter_grp_ids ? inter_grp_idsList : NULL, - types_of_notif ? types_of_notifList : NULL + sat_backhaul_category ? sat_backhaul_categoryVariable : 0, + pcf_ue_info ? pcf_ue_info_local_nonprim : NULL, + nwdaf_datas ? nwdaf_datasList : NULL, + an_gw_status ? true : false, + an_gw_status ? an_gw_status->valueint : 0 ); return sm_policy_update_context_data_local_var; @@ -1765,10 +1957,6 @@ end: OpenAPI_trace_data_free(trace_req_local_nonprim); trace_req_local_nonprim = NULL; } - if (atsss_capab_local_nonprim) { - OpenAPI_atsss_capability_free(atsss_capab_local_nonprim); - atsss_capab_local_nonprim = NULL; - } if (tsn_bridge_info_local_nonprim) { OpenAPI_tsn_bridge_info_free(tsn_bridge_info_local_nonprim); tsn_bridge_info_local_nonprim = NULL; @@ -1799,6 +1987,13 @@ end: OpenAPI_list_free(policy_dec_failure_reportsList); policy_dec_failure_reportsList = NULL; } + if (invalid_policy_decsList) { + OpenAPI_list_for_each(invalid_policy_decsList, node) { + OpenAPI_invalid_param_free(node->data); + } + OpenAPI_list_free(invalid_policy_decsList); + invalid_policy_decsList = NULL; + } if (traffic_descriptorsList) { OpenAPI_list_for_each(traffic_descriptorsList, node) { OpenAPI_ddd_traffic_descriptor_free(node->data); @@ -1806,6 +2001,10 @@ end: OpenAPI_list_free(traffic_descriptorsList); traffic_descriptorsList = NULL; } + if (types_of_notifList) { + OpenAPI_list_free(types_of_notifList); + types_of_notifList = NULL; + } if (inter_grp_idsList) { OpenAPI_list_for_each(inter_grp_idsList, node) { ogs_free(node->data); @@ -1813,9 +2012,16 @@ end: OpenAPI_list_free(inter_grp_idsList); inter_grp_idsList = NULL; } - if (types_of_notifList) { - OpenAPI_list_free(types_of_notifList); - types_of_notifList = NULL; + if (pcf_ue_info_local_nonprim) { + OpenAPI_pcf_ue_callback_info_free(pcf_ue_info_local_nonprim); + pcf_ue_info_local_nonprim = NULL; + } + if (nwdaf_datasList) { + OpenAPI_list_for_each(nwdaf_datasList, node) { + OpenAPI_nwdaf_data_free(node->data); + } + OpenAPI_list_free(nwdaf_datasList); + nwdaf_datasList = NULL; } return NULL; } diff --git a/lib/sbi/openapi/model/sm_policy_update_context_data.h b/lib/sbi/openapi/model/sm_policy_update_context_data.h index 16656e731..4ee2e1e41 100644 --- a/lib/sbi/openapi/model/sm_policy_update_context_data.h +++ b/lib/sbi/openapi/model/sm_policy_update_context_data.h @@ -1,7 +1,7 @@ /* * sm_policy_update_context_data.h * - * + * Contains the policy control request trigger(s) that were met and the corresponding new value(s) or the error report of the policy enforcement. */ #ifndef _OpenAPI_sm_policy_update_context_data_H_ @@ -18,13 +18,16 @@ #include "additional_access_info.h" #include "ambr.h" #include "app_detection_info.h" -#include "atsss_capability.h" #include "bridge_management_container.h" #include "credit_management_status.h" #include "ddd_traffic_descriptor.h" #include "dl_data_delivery_status.h" +#include "invalid_param.h" #include "ip_multicast_address_info.h" #include "ma_pdu_indication.h" +#include "npcf_atsss_capability.h" +#include "nwdaf_data.h" +#include "pcf_ue_callback_info.h" #include "plmn_id_nid.h" #include "policy_control_request_trigger.h" #include "policy_decision_failure_code.h" @@ -35,6 +38,7 @@ #include "qos_notification_control_info.h" #include "rat_type.h" #include "rule_report.h" +#include "satellite_backhaul_category.h" #include "serving_nf_identity.h" #include "session_rule_report.h" #include "subscribed_default_qos.h" @@ -72,6 +76,8 @@ typedef struct OpenAPI_sm_policy_update_context_data_s { char *auth_prof_index; struct OpenAPI_subscribed_default_qos_s *subs_def_qos; struct OpenAPI_vplmn_qos_s *vplmn_qos; + bool is_vplmn_qos_not_app; + int vplmn_qos_not_app; bool is_num_of_pack_filter; int num_of_pack_filter; OpenAPI_list_t *accu_usage_reports; @@ -92,17 +98,23 @@ typedef struct OpenAPI_sm_policy_update_context_data_s { struct OpenAPI_serving_nf_identity_s *serv_nf_id; struct OpenAPI_trace_data_s *trace_req; OpenAPI_ma_pdu_indication_e ma_pdu_ind; - struct OpenAPI_atsss_capability_s *atsss_capab; + OpenAPI_npcf_atsss_capability_e atsss_capab; struct OpenAPI_tsn_bridge_info_s *tsn_bridge_info; struct OpenAPI_bridge_management_container_s *tsn_bridge_man_cont; struct OpenAPI_port_management_container_s *tsn_port_man_cont_dstt; OpenAPI_list_t *tsn_port_man_cont_nwtts; OpenAPI_list_t *mul_addr_infos; OpenAPI_list_t *policy_dec_failure_reports; + OpenAPI_list_t *invalid_policy_decs; OpenAPI_list_t *traffic_descriptors; char *pcc_rule_id; - OpenAPI_list_t *inter_grp_ids; OpenAPI_list_t *types_of_notif; + OpenAPI_list_t *inter_grp_ids; + OpenAPI_satellite_backhaul_category_e sat_backhaul_category; + struct OpenAPI_pcf_ue_callback_info_s *pcf_ue_info; + OpenAPI_list_t *nwdaf_datas; + bool is_an_gw_status; + int an_gw_status; } OpenAPI_sm_policy_update_context_data_t; OpenAPI_sm_policy_update_context_data_t *OpenAPI_sm_policy_update_context_data_create( @@ -128,6 +140,8 @@ OpenAPI_sm_policy_update_context_data_t *OpenAPI_sm_policy_update_context_data_c char *auth_prof_index, OpenAPI_subscribed_default_qos_t *subs_def_qos, OpenAPI_vplmn_qos_t *vplmn_qos, + bool is_vplmn_qos_not_app, + int vplmn_qos_not_app, bool is_num_of_pack_filter, int num_of_pack_filter, OpenAPI_list_t *accu_usage_reports, @@ -148,17 +162,23 @@ OpenAPI_sm_policy_update_context_data_t *OpenAPI_sm_policy_update_context_data_c OpenAPI_serving_nf_identity_t *serv_nf_id, OpenAPI_trace_data_t *trace_req, OpenAPI_ma_pdu_indication_e ma_pdu_ind, - OpenAPI_atsss_capability_t *atsss_capab, + OpenAPI_npcf_atsss_capability_e atsss_capab, OpenAPI_tsn_bridge_info_t *tsn_bridge_info, OpenAPI_bridge_management_container_t *tsn_bridge_man_cont, OpenAPI_port_management_container_t *tsn_port_man_cont_dstt, OpenAPI_list_t *tsn_port_man_cont_nwtts, OpenAPI_list_t *mul_addr_infos, OpenAPI_list_t *policy_dec_failure_reports, + OpenAPI_list_t *invalid_policy_decs, OpenAPI_list_t *traffic_descriptors, char *pcc_rule_id, + OpenAPI_list_t *types_of_notif, OpenAPI_list_t *inter_grp_ids, - OpenAPI_list_t *types_of_notif + OpenAPI_satellite_backhaul_category_e sat_backhaul_category, + OpenAPI_pcf_ue_callback_info_t *pcf_ue_info, + OpenAPI_list_t *nwdaf_datas, + bool is_an_gw_status, + int an_gw_status ); void OpenAPI_sm_policy_update_context_data_free(OpenAPI_sm_policy_update_context_data_t *sm_policy_update_context_data); OpenAPI_sm_policy_update_context_data_t *OpenAPI_sm_policy_update_context_data_parseFromJSON(cJSON *sm_policy_update_context_dataJSON); diff --git a/lib/sbi/openapi/model/sm_subs_data.c b/lib/sbi/openapi/model/sm_subs_data.c new file mode 100644 index 000000000..f37eded52 --- /dev/null +++ b/lib/sbi/openapi/model/sm_subs_data.c @@ -0,0 +1,205 @@ + +#include +#include +#include +#include "sm_subs_data.h" + +OpenAPI_sm_subs_data_t *OpenAPI_sm_subs_data_create( + OpenAPI_list_t *shared_sm_subs_data_ids, + OpenAPI_list_t *individual_sm_subs_data +) +{ + OpenAPI_sm_subs_data_t *sm_subs_data_local_var = ogs_malloc(sizeof(OpenAPI_sm_subs_data_t)); + ogs_assert(sm_subs_data_local_var); + + sm_subs_data_local_var->shared_sm_subs_data_ids = shared_sm_subs_data_ids; + sm_subs_data_local_var->individual_sm_subs_data = individual_sm_subs_data; + + return sm_subs_data_local_var; +} + +void OpenAPI_sm_subs_data_free(OpenAPI_sm_subs_data_t *sm_subs_data) +{ + OpenAPI_lnode_t *node = NULL; + + if (NULL == sm_subs_data) { + return; + } + if (sm_subs_data->shared_sm_subs_data_ids) { + OpenAPI_list_for_each(sm_subs_data->shared_sm_subs_data_ids, node) { + ogs_free(node->data); + } + OpenAPI_list_free(sm_subs_data->shared_sm_subs_data_ids); + sm_subs_data->shared_sm_subs_data_ids = NULL; + } + if (sm_subs_data->individual_sm_subs_data) { + OpenAPI_list_for_each(sm_subs_data->individual_sm_subs_data, node) { + OpenAPI_session_management_subscription_data_free(node->data); + } + OpenAPI_list_free(sm_subs_data->individual_sm_subs_data); + sm_subs_data->individual_sm_subs_data = NULL; + } + ogs_free(sm_subs_data); +} + +cJSON *OpenAPI_sm_subs_data_convertToJSON(OpenAPI_sm_subs_data_t *sm_subs_data) +{ + cJSON *item = NULL; + OpenAPI_lnode_t *node = NULL; + + if (sm_subs_data == NULL) { + ogs_error("OpenAPI_sm_subs_data_convertToJSON() failed [SmSubsData]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (!sm_subs_data->shared_sm_subs_data_ids) { + ogs_error("OpenAPI_sm_subs_data_convertToJSON() failed [shared_sm_subs_data_ids]"); + return NULL; + } + cJSON *shared_sm_subs_data_idsList = cJSON_AddArrayToObject(item, "sharedSmSubsDataIds"); + if (shared_sm_subs_data_idsList == NULL) { + ogs_error("OpenAPI_sm_subs_data_convertToJSON() failed [shared_sm_subs_data_ids]"); + goto end; + } + OpenAPI_list_for_each(sm_subs_data->shared_sm_subs_data_ids, node) { + if (cJSON_AddStringToObject(shared_sm_subs_data_idsList, "", (char*)node->data) == NULL) { + ogs_error("OpenAPI_sm_subs_data_convertToJSON() failed [shared_sm_subs_data_ids]"); + goto end; + } + } + + if (sm_subs_data->individual_sm_subs_data) { + cJSON *individual_sm_subs_dataList = cJSON_AddArrayToObject(item, "individualSmSubsData"); + if (individual_sm_subs_dataList == NULL) { + ogs_error("OpenAPI_sm_subs_data_convertToJSON() failed [individual_sm_subs_data]"); + goto end; + } + OpenAPI_list_for_each(sm_subs_data->individual_sm_subs_data, node) { + cJSON *itemLocal = OpenAPI_session_management_subscription_data_convertToJSON(node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_sm_subs_data_convertToJSON() failed [individual_sm_subs_data]"); + goto end; + } + cJSON_AddItemToArray(individual_sm_subs_dataList, itemLocal); + } + } + +end: + return item; +} + +OpenAPI_sm_subs_data_t *OpenAPI_sm_subs_data_parseFromJSON(cJSON *sm_subs_dataJSON) +{ + OpenAPI_sm_subs_data_t *sm_subs_data_local_var = NULL; + OpenAPI_lnode_t *node = NULL; + cJSON *shared_sm_subs_data_ids = NULL; + OpenAPI_list_t *shared_sm_subs_data_idsList = NULL; + cJSON *individual_sm_subs_data = NULL; + OpenAPI_list_t *individual_sm_subs_dataList = NULL; + shared_sm_subs_data_ids = cJSON_GetObjectItemCaseSensitive(sm_subs_dataJSON, "sharedSmSubsDataIds"); + if (!shared_sm_subs_data_ids) { + ogs_error("OpenAPI_sm_subs_data_parseFromJSON() failed [shared_sm_subs_data_ids]"); + goto end; + } + cJSON *shared_sm_subs_data_ids_local = NULL; + if (!cJSON_IsArray(shared_sm_subs_data_ids)) { + ogs_error("OpenAPI_sm_subs_data_parseFromJSON() failed [shared_sm_subs_data_ids]"); + goto end; + } + + shared_sm_subs_data_idsList = OpenAPI_list_create(); + + cJSON_ArrayForEach(shared_sm_subs_data_ids_local, shared_sm_subs_data_ids) { + double *localDouble = NULL; + int *localInt = NULL; + if (!cJSON_IsString(shared_sm_subs_data_ids_local)) { + ogs_error("OpenAPI_sm_subs_data_parseFromJSON() failed [shared_sm_subs_data_ids]"); + goto end; + } + OpenAPI_list_add(shared_sm_subs_data_idsList, ogs_strdup(shared_sm_subs_data_ids_local->valuestring)); + } + + individual_sm_subs_data = cJSON_GetObjectItemCaseSensitive(sm_subs_dataJSON, "individualSmSubsData"); + if (individual_sm_subs_data) { + cJSON *individual_sm_subs_data_local = NULL; + if (!cJSON_IsArray(individual_sm_subs_data)) { + ogs_error("OpenAPI_sm_subs_data_parseFromJSON() failed [individual_sm_subs_data]"); + goto end; + } + + individual_sm_subs_dataList = OpenAPI_list_create(); + + cJSON_ArrayForEach(individual_sm_subs_data_local, individual_sm_subs_data) { + if (!cJSON_IsObject(individual_sm_subs_data_local)) { + ogs_error("OpenAPI_sm_subs_data_parseFromJSON() failed [individual_sm_subs_data]"); + goto end; + } + OpenAPI_session_management_subscription_data_t *individual_sm_subs_dataItem = OpenAPI_session_management_subscription_data_parseFromJSON(individual_sm_subs_data_local); + if (!individual_sm_subs_dataItem) { + ogs_error("No individual_sm_subs_dataItem"); + OpenAPI_list_free(individual_sm_subs_dataList); + goto end; + } + OpenAPI_list_add(individual_sm_subs_dataList, individual_sm_subs_dataItem); + } + } + + sm_subs_data_local_var = OpenAPI_sm_subs_data_create ( + shared_sm_subs_data_idsList, + individual_sm_subs_data ? individual_sm_subs_dataList : NULL + ); + + return sm_subs_data_local_var; +end: + if (shared_sm_subs_data_idsList) { + OpenAPI_list_for_each(shared_sm_subs_data_idsList, node) { + ogs_free(node->data); + } + OpenAPI_list_free(shared_sm_subs_data_idsList); + shared_sm_subs_data_idsList = NULL; + } + if (individual_sm_subs_dataList) { + OpenAPI_list_for_each(individual_sm_subs_dataList, node) { + OpenAPI_session_management_subscription_data_free(node->data); + } + OpenAPI_list_free(individual_sm_subs_dataList); + individual_sm_subs_dataList = NULL; + } + return NULL; +} + +OpenAPI_sm_subs_data_t *OpenAPI_sm_subs_data_copy(OpenAPI_sm_subs_data_t *dst, OpenAPI_sm_subs_data_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_sm_subs_data_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_sm_subs_data_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_subs_data_free(dst); + dst = OpenAPI_sm_subs_data_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/sm_subs_data.h b/lib/sbi/openapi/model/sm_subs_data.h new file mode 100644 index 000000000..caae88556 --- /dev/null +++ b/lib/sbi/openapi/model/sm_subs_data.h @@ -0,0 +1,42 @@ +/* + * sm_subs_data.h + * + * + */ + +#ifndef _OpenAPI_sm_subs_data_H_ +#define _OpenAPI_sm_subs_data_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "extended_sm_subs_data.h" +#include "session_management_subscription_data.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_sm_subs_data_s OpenAPI_sm_subs_data_t; +typedef struct OpenAPI_sm_subs_data_s { + OpenAPI_list_t *shared_sm_subs_data_ids; + OpenAPI_list_t *individual_sm_subs_data; +} OpenAPI_sm_subs_data_t; + +OpenAPI_sm_subs_data_t *OpenAPI_sm_subs_data_create( + OpenAPI_list_t *shared_sm_subs_data_ids, + OpenAPI_list_t *individual_sm_subs_data +); +void OpenAPI_sm_subs_data_free(OpenAPI_sm_subs_data_t *sm_subs_data); +OpenAPI_sm_subs_data_t *OpenAPI_sm_subs_data_parseFromJSON(cJSON *sm_subs_dataJSON); +cJSON *OpenAPI_sm_subs_data_convertToJSON(OpenAPI_sm_subs_data_t *sm_subs_data); +OpenAPI_sm_subs_data_t *OpenAPI_sm_subs_data_copy(OpenAPI_sm_subs_data_t *dst, OpenAPI_sm_subs_data_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_sm_subs_data_H_ */ + diff --git a/lib/sbi/openapi/model/small_data_rate_status.h b/lib/sbi/openapi/model/small_data_rate_status.h index e06d94c09..786461379 100644 --- a/lib/sbi/openapi/model/small_data_rate_status.h +++ b/lib/sbi/openapi/model/small_data_rate_status.h @@ -1,7 +1,7 @@ /* * small_data_rate_status.h * - * + * It indicates theSmall Data Rate Control Status */ #ifndef _OpenAPI_small_data_rate_status_H_ diff --git a/lib/sbi/openapi/model/small_data_rate_status_info.h b/lib/sbi/openapi/model/small_data_rate_status_info.h index 2d1885c02..d0e962f0d 100644 --- a/lib/sbi/openapi/model/small_data_rate_status_info.h +++ b/lib/sbi/openapi/model/small_data_rate_status_info.h @@ -1,7 +1,7 @@ /* * small_data_rate_status_info.h * - * + * Represents the small data rate status */ #ifndef _OpenAPI_small_data_rate_status_info_H_ diff --git a/lib/sbi/openapi/model/smcce_info.c b/lib/sbi/openapi/model/smcce_info.c new file mode 100644 index 000000000..68f129dab --- /dev/null +++ b/lib/sbi/openapi/model/smcce_info.c @@ -0,0 +1,176 @@ + +#include +#include +#include +#include "smcce_info.h" + +OpenAPI_smcce_info_t *OpenAPI_smcce_info_create( + char *dnn, + OpenAPI_snssai_t *snssai, + OpenAPI_smcce_ue_list_t *smcce_ue_list +) +{ + OpenAPI_smcce_info_t *smcce_info_local_var = ogs_malloc(sizeof(OpenAPI_smcce_info_t)); + ogs_assert(smcce_info_local_var); + + smcce_info_local_var->dnn = dnn; + smcce_info_local_var->snssai = snssai; + smcce_info_local_var->smcce_ue_list = smcce_ue_list; + + return smcce_info_local_var; +} + +void OpenAPI_smcce_info_free(OpenAPI_smcce_info_t *smcce_info) +{ + OpenAPI_lnode_t *node = NULL; + + if (NULL == smcce_info) { + return; + } + if (smcce_info->dnn) { + ogs_free(smcce_info->dnn); + smcce_info->dnn = NULL; + } + if (smcce_info->snssai) { + OpenAPI_snssai_free(smcce_info->snssai); + smcce_info->snssai = NULL; + } + if (smcce_info->smcce_ue_list) { + OpenAPI_smcce_ue_list_free(smcce_info->smcce_ue_list); + smcce_info->smcce_ue_list = NULL; + } + ogs_free(smcce_info); +} + +cJSON *OpenAPI_smcce_info_convertToJSON(OpenAPI_smcce_info_t *smcce_info) +{ + cJSON *item = NULL; + OpenAPI_lnode_t *node = NULL; + + if (smcce_info == NULL) { + ogs_error("OpenAPI_smcce_info_convertToJSON() failed [SmcceInfo]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (smcce_info->dnn) { + if (cJSON_AddStringToObject(item, "dnn", smcce_info->dnn) == NULL) { + ogs_error("OpenAPI_smcce_info_convertToJSON() failed [dnn]"); + goto end; + } + } + + if (smcce_info->snssai) { + cJSON *snssai_local_JSON = OpenAPI_snssai_convertToJSON(smcce_info->snssai); + if (snssai_local_JSON == NULL) { + ogs_error("OpenAPI_smcce_info_convertToJSON() failed [snssai]"); + goto end; + } + cJSON_AddItemToObject(item, "snssai", snssai_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_smcce_info_convertToJSON() failed [snssai]"); + goto end; + } + } + + if (!smcce_info->smcce_ue_list) { + ogs_error("OpenAPI_smcce_info_convertToJSON() failed [smcce_ue_list]"); + return NULL; + } + cJSON *smcce_ue_list_local_JSON = OpenAPI_smcce_ue_list_convertToJSON(smcce_info->smcce_ue_list); + if (smcce_ue_list_local_JSON == NULL) { + ogs_error("OpenAPI_smcce_info_convertToJSON() failed [smcce_ue_list]"); + goto end; + } + cJSON_AddItemToObject(item, "smcceUeList", smcce_ue_list_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_smcce_info_convertToJSON() failed [smcce_ue_list]"); + goto end; + } + +end: + return item; +} + +OpenAPI_smcce_info_t *OpenAPI_smcce_info_parseFromJSON(cJSON *smcce_infoJSON) +{ + OpenAPI_smcce_info_t *smcce_info_local_var = NULL; + OpenAPI_lnode_t *node = NULL; + cJSON *dnn = NULL; + cJSON *snssai = NULL; + OpenAPI_snssai_t *snssai_local_nonprim = NULL; + cJSON *smcce_ue_list = NULL; + OpenAPI_smcce_ue_list_t *smcce_ue_list_local_nonprim = NULL; + dnn = cJSON_GetObjectItemCaseSensitive(smcce_infoJSON, "dnn"); + if (dnn) { + if (!cJSON_IsString(dnn) && !cJSON_IsNull(dnn)) { + ogs_error("OpenAPI_smcce_info_parseFromJSON() failed [dnn]"); + goto end; + } + } + + snssai = cJSON_GetObjectItemCaseSensitive(smcce_infoJSON, "snssai"); + if (snssai) { + snssai_local_nonprim = OpenAPI_snssai_parseFromJSON(snssai); + } + + smcce_ue_list = cJSON_GetObjectItemCaseSensitive(smcce_infoJSON, "smcceUeList"); + if (!smcce_ue_list) { + ogs_error("OpenAPI_smcce_info_parseFromJSON() failed [smcce_ue_list]"); + goto end; + } + smcce_ue_list_local_nonprim = OpenAPI_smcce_ue_list_parseFromJSON(smcce_ue_list); + + smcce_info_local_var = OpenAPI_smcce_info_create ( + dnn && !cJSON_IsNull(dnn) ? ogs_strdup(dnn->valuestring) : NULL, + snssai ? snssai_local_nonprim : NULL, + smcce_ue_list_local_nonprim + ); + + return smcce_info_local_var; +end: + if (snssai_local_nonprim) { + OpenAPI_snssai_free(snssai_local_nonprim); + snssai_local_nonprim = NULL; + } + if (smcce_ue_list_local_nonprim) { + OpenAPI_smcce_ue_list_free(smcce_ue_list_local_nonprim); + smcce_ue_list_local_nonprim = NULL; + } + return NULL; +} + +OpenAPI_smcce_info_t *OpenAPI_smcce_info_copy(OpenAPI_smcce_info_t *dst, OpenAPI_smcce_info_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_smcce_info_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_smcce_info_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_smcce_info_free(dst); + dst = OpenAPI_smcce_info_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/smcce_info.h b/lib/sbi/openapi/model/smcce_info.h new file mode 100644 index 000000000..b1acfd445 --- /dev/null +++ b/lib/sbi/openapi/model/smcce_info.h @@ -0,0 +1,44 @@ +/* + * smcce_info.h + * + * Represents the Session Management congestion control experience information. + */ + +#ifndef _OpenAPI_smcce_info_H_ +#define _OpenAPI_smcce_info_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "smcce_ue_list.h" +#include "snssai.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_smcce_info_s OpenAPI_smcce_info_t; +typedef struct OpenAPI_smcce_info_s { + char *dnn; + struct OpenAPI_snssai_s *snssai; + struct OpenAPI_smcce_ue_list_s *smcce_ue_list; +} OpenAPI_smcce_info_t; + +OpenAPI_smcce_info_t *OpenAPI_smcce_info_create( + char *dnn, + OpenAPI_snssai_t *snssai, + OpenAPI_smcce_ue_list_t *smcce_ue_list +); +void OpenAPI_smcce_info_free(OpenAPI_smcce_info_t *smcce_info); +OpenAPI_smcce_info_t *OpenAPI_smcce_info_parseFromJSON(cJSON *smcce_infoJSON); +cJSON *OpenAPI_smcce_info_convertToJSON(OpenAPI_smcce_info_t *smcce_info); +OpenAPI_smcce_info_t *OpenAPI_smcce_info_copy(OpenAPI_smcce_info_t *dst, OpenAPI_smcce_info_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_smcce_info_H_ */ + diff --git a/lib/sbi/openapi/model/smcce_ue_list.c b/lib/sbi/openapi/model/smcce_ue_list.c new file mode 100644 index 000000000..ec389d41b --- /dev/null +++ b/lib/sbi/openapi/model/smcce_ue_list.c @@ -0,0 +1,249 @@ + +#include +#include +#include +#include "smcce_ue_list.h" + +OpenAPI_smcce_ue_list_t *OpenAPI_smcce_ue_list_create( + OpenAPI_list_t *high_level, + OpenAPI_list_t *medium_level, + OpenAPI_list_t *low_level +) +{ + OpenAPI_smcce_ue_list_t *smcce_ue_list_local_var = ogs_malloc(sizeof(OpenAPI_smcce_ue_list_t)); + ogs_assert(smcce_ue_list_local_var); + + smcce_ue_list_local_var->high_level = high_level; + smcce_ue_list_local_var->medium_level = medium_level; + smcce_ue_list_local_var->low_level = low_level; + + return smcce_ue_list_local_var; +} + +void OpenAPI_smcce_ue_list_free(OpenAPI_smcce_ue_list_t *smcce_ue_list) +{ + OpenAPI_lnode_t *node = NULL; + + if (NULL == smcce_ue_list) { + return; + } + if (smcce_ue_list->high_level) { + OpenAPI_list_for_each(smcce_ue_list->high_level, node) { + ogs_free(node->data); + } + OpenAPI_list_free(smcce_ue_list->high_level); + smcce_ue_list->high_level = NULL; + } + if (smcce_ue_list->medium_level) { + OpenAPI_list_for_each(smcce_ue_list->medium_level, node) { + ogs_free(node->data); + } + OpenAPI_list_free(smcce_ue_list->medium_level); + smcce_ue_list->medium_level = NULL; + } + if (smcce_ue_list->low_level) { + OpenAPI_list_for_each(smcce_ue_list->low_level, node) { + ogs_free(node->data); + } + OpenAPI_list_free(smcce_ue_list->low_level); + smcce_ue_list->low_level = NULL; + } + ogs_free(smcce_ue_list); +} + +cJSON *OpenAPI_smcce_ue_list_convertToJSON(OpenAPI_smcce_ue_list_t *smcce_ue_list) +{ + cJSON *item = NULL; + OpenAPI_lnode_t *node = NULL; + + if (smcce_ue_list == NULL) { + ogs_error("OpenAPI_smcce_ue_list_convertToJSON() failed [SmcceUeList]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (smcce_ue_list->high_level) { + cJSON *high_levelList = cJSON_AddArrayToObject(item, "highLevel"); + if (high_levelList == NULL) { + ogs_error("OpenAPI_smcce_ue_list_convertToJSON() failed [high_level]"); + goto end; + } + OpenAPI_list_for_each(smcce_ue_list->high_level, node) { + if (cJSON_AddStringToObject(high_levelList, "", (char*)node->data) == NULL) { + ogs_error("OpenAPI_smcce_ue_list_convertToJSON() failed [high_level]"); + goto end; + } + } + } + + if (smcce_ue_list->medium_level) { + cJSON *medium_levelList = cJSON_AddArrayToObject(item, "mediumLevel"); + if (medium_levelList == NULL) { + ogs_error("OpenAPI_smcce_ue_list_convertToJSON() failed [medium_level]"); + goto end; + } + OpenAPI_list_for_each(smcce_ue_list->medium_level, node) { + if (cJSON_AddStringToObject(medium_levelList, "", (char*)node->data) == NULL) { + ogs_error("OpenAPI_smcce_ue_list_convertToJSON() failed [medium_level]"); + goto end; + } + } + } + + if (smcce_ue_list->low_level) { + cJSON *low_levelList = cJSON_AddArrayToObject(item, "lowLevel"); + if (low_levelList == NULL) { + ogs_error("OpenAPI_smcce_ue_list_convertToJSON() failed [low_level]"); + goto end; + } + OpenAPI_list_for_each(smcce_ue_list->low_level, node) { + if (cJSON_AddStringToObject(low_levelList, "", (char*)node->data) == NULL) { + ogs_error("OpenAPI_smcce_ue_list_convertToJSON() failed [low_level]"); + goto end; + } + } + } + +end: + return item; +} + +OpenAPI_smcce_ue_list_t *OpenAPI_smcce_ue_list_parseFromJSON(cJSON *smcce_ue_listJSON) +{ + OpenAPI_smcce_ue_list_t *smcce_ue_list_local_var = NULL; + OpenAPI_lnode_t *node = NULL; + cJSON *high_level = NULL; + OpenAPI_list_t *high_levelList = NULL; + cJSON *medium_level = NULL; + OpenAPI_list_t *medium_levelList = NULL; + cJSON *low_level = NULL; + OpenAPI_list_t *low_levelList = NULL; + high_level = cJSON_GetObjectItemCaseSensitive(smcce_ue_listJSON, "highLevel"); + if (high_level) { + cJSON *high_level_local = NULL; + if (!cJSON_IsArray(high_level)) { + ogs_error("OpenAPI_smcce_ue_list_parseFromJSON() failed [high_level]"); + goto end; + } + + high_levelList = OpenAPI_list_create(); + + cJSON_ArrayForEach(high_level_local, high_level) { + double *localDouble = NULL; + int *localInt = NULL; + if (!cJSON_IsString(high_level_local)) { + ogs_error("OpenAPI_smcce_ue_list_parseFromJSON() failed [high_level]"); + goto end; + } + OpenAPI_list_add(high_levelList, ogs_strdup(high_level_local->valuestring)); + } + } + + medium_level = cJSON_GetObjectItemCaseSensitive(smcce_ue_listJSON, "mediumLevel"); + if (medium_level) { + cJSON *medium_level_local = NULL; + if (!cJSON_IsArray(medium_level)) { + ogs_error("OpenAPI_smcce_ue_list_parseFromJSON() failed [medium_level]"); + goto end; + } + + medium_levelList = OpenAPI_list_create(); + + cJSON_ArrayForEach(medium_level_local, medium_level) { + double *localDouble = NULL; + int *localInt = NULL; + if (!cJSON_IsString(medium_level_local)) { + ogs_error("OpenAPI_smcce_ue_list_parseFromJSON() failed [medium_level]"); + goto end; + } + OpenAPI_list_add(medium_levelList, ogs_strdup(medium_level_local->valuestring)); + } + } + + low_level = cJSON_GetObjectItemCaseSensitive(smcce_ue_listJSON, "lowLevel"); + if (low_level) { + cJSON *low_level_local = NULL; + if (!cJSON_IsArray(low_level)) { + ogs_error("OpenAPI_smcce_ue_list_parseFromJSON() failed [low_level]"); + goto end; + } + + low_levelList = OpenAPI_list_create(); + + cJSON_ArrayForEach(low_level_local, low_level) { + double *localDouble = NULL; + int *localInt = NULL; + if (!cJSON_IsString(low_level_local)) { + ogs_error("OpenAPI_smcce_ue_list_parseFromJSON() failed [low_level]"); + goto end; + } + OpenAPI_list_add(low_levelList, ogs_strdup(low_level_local->valuestring)); + } + } + + smcce_ue_list_local_var = OpenAPI_smcce_ue_list_create ( + high_level ? high_levelList : NULL, + medium_level ? medium_levelList : NULL, + low_level ? low_levelList : NULL + ); + + return smcce_ue_list_local_var; +end: + if (high_levelList) { + OpenAPI_list_for_each(high_levelList, node) { + ogs_free(node->data); + } + OpenAPI_list_free(high_levelList); + high_levelList = NULL; + } + if (medium_levelList) { + OpenAPI_list_for_each(medium_levelList, node) { + ogs_free(node->data); + } + OpenAPI_list_free(medium_levelList); + medium_levelList = NULL; + } + if (low_levelList) { + OpenAPI_list_for_each(low_levelList, node) { + ogs_free(node->data); + } + OpenAPI_list_free(low_levelList); + low_levelList = NULL; + } + return NULL; +} + +OpenAPI_smcce_ue_list_t *OpenAPI_smcce_ue_list_copy(OpenAPI_smcce_ue_list_t *dst, OpenAPI_smcce_ue_list_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_smcce_ue_list_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_smcce_ue_list_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_smcce_ue_list_free(dst); + dst = OpenAPI_smcce_ue_list_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/smcce_ue_list.h b/lib/sbi/openapi/model/smcce_ue_list.h new file mode 100644 index 000000000..3c2c2981f --- /dev/null +++ b/lib/sbi/openapi/model/smcce_ue_list.h @@ -0,0 +1,42 @@ +/* + * smcce_ue_list.h + * + * Represents the List of UEs classified based on experience level of Session Management congestion control. + */ + +#ifndef _OpenAPI_smcce_ue_list_H_ +#define _OpenAPI_smcce_ue_list_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_smcce_ue_list_s OpenAPI_smcce_ue_list_t; +typedef struct OpenAPI_smcce_ue_list_s { + OpenAPI_list_t *high_level; + OpenAPI_list_t *medium_level; + OpenAPI_list_t *low_level; +} OpenAPI_smcce_ue_list_t; + +OpenAPI_smcce_ue_list_t *OpenAPI_smcce_ue_list_create( + OpenAPI_list_t *high_level, + OpenAPI_list_t *medium_level, + OpenAPI_list_t *low_level +); +void OpenAPI_smcce_ue_list_free(OpenAPI_smcce_ue_list_t *smcce_ue_list); +OpenAPI_smcce_ue_list_t *OpenAPI_smcce_ue_list_parseFromJSON(cJSON *smcce_ue_listJSON); +cJSON *OpenAPI_smcce_ue_list_convertToJSON(OpenAPI_smcce_ue_list_t *smcce_ue_list); +OpenAPI_smcce_ue_list_t *OpenAPI_smcce_ue_list_copy(OpenAPI_smcce_ue_list_t *dst, OpenAPI_smcce_ue_list_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_smcce_ue_list_H_ */ + diff --git a/lib/sbi/openapi/model/smf_change_info.h b/lib/sbi/openapi/model/smf_change_info.h index 22dcf1d0c..ef82b290e 100644 --- a/lib/sbi/openapi/model/smf_change_info.h +++ b/lib/sbi/openapi/model/smf_change_info.h @@ -1,7 +1,7 @@ /* * smf_change_info.h * - * + * SMF change information for PDU session(s) */ #ifndef _OpenAPI_smf_change_info_H_ diff --git a/lib/sbi/openapi/model/smf_info.c b/lib/sbi/openapi/model/smf_info.c index 1dc8fafd1..d91ca11ee 100644 --- a/lib/sbi/openapi/model/smf_info.c +++ b/lib/sbi/openapi/model/smf_info.c @@ -9,11 +9,19 @@ OpenAPI_smf_info_t *OpenAPI_smf_info_create( OpenAPI_list_t *tai_list, OpenAPI_list_t *tai_range_list, char *pgw_fqdn, + OpenAPI_list_t *pgw_ip_addr_list, OpenAPI_list_t *access_type, bool is_priority, int priority, bool is_vsmf_support_ind, - int vsmf_support_ind + int vsmf_support_ind, + OpenAPI_list_t *pgw_fqdn_list, + bool is_smf_onboarding_capability, + int smf_onboarding_capability, + bool is_ismf_support_ind, + int ismf_support_ind, + bool is_smf_uprp_capability, + int smf_uprp_capability ) { OpenAPI_smf_info_t *smf_info_local_var = ogs_malloc(sizeof(OpenAPI_smf_info_t)); @@ -23,11 +31,19 @@ OpenAPI_smf_info_t *OpenAPI_smf_info_create( smf_info_local_var->tai_list = tai_list; smf_info_local_var->tai_range_list = tai_range_list; smf_info_local_var->pgw_fqdn = pgw_fqdn; + smf_info_local_var->pgw_ip_addr_list = pgw_ip_addr_list; smf_info_local_var->access_type = access_type; smf_info_local_var->is_priority = is_priority; smf_info_local_var->priority = priority; smf_info_local_var->is_vsmf_support_ind = is_vsmf_support_ind; smf_info_local_var->vsmf_support_ind = vsmf_support_ind; + smf_info_local_var->pgw_fqdn_list = pgw_fqdn_list; + smf_info_local_var->is_smf_onboarding_capability = is_smf_onboarding_capability; + smf_info_local_var->smf_onboarding_capability = smf_onboarding_capability; + smf_info_local_var->is_ismf_support_ind = is_ismf_support_ind; + smf_info_local_var->ismf_support_ind = ismf_support_ind; + smf_info_local_var->is_smf_uprp_capability = is_smf_uprp_capability; + smf_info_local_var->smf_uprp_capability = smf_uprp_capability; return smf_info_local_var; } @@ -64,10 +80,24 @@ void OpenAPI_smf_info_free(OpenAPI_smf_info_t *smf_info) ogs_free(smf_info->pgw_fqdn); smf_info->pgw_fqdn = NULL; } + if (smf_info->pgw_ip_addr_list) { + OpenAPI_list_for_each(smf_info->pgw_ip_addr_list, node) { + OpenAPI_ip_addr_free(node->data); + } + OpenAPI_list_free(smf_info->pgw_ip_addr_list); + smf_info->pgw_ip_addr_list = NULL; + } if (smf_info->access_type) { OpenAPI_list_free(smf_info->access_type); smf_info->access_type = NULL; } + if (smf_info->pgw_fqdn_list) { + OpenAPI_list_for_each(smf_info->pgw_fqdn_list, node) { + ogs_free(node->data); + } + OpenAPI_list_free(smf_info->pgw_fqdn_list); + smf_info->pgw_fqdn_list = NULL; + } ogs_free(smf_info); } @@ -139,6 +169,22 @@ cJSON *OpenAPI_smf_info_convertToJSON(OpenAPI_smf_info_t *smf_info) } } + if (smf_info->pgw_ip_addr_list) { + cJSON *pgw_ip_addr_listList = cJSON_AddArrayToObject(item, "pgwIpAddrList"); + if (pgw_ip_addr_listList == NULL) { + ogs_error("OpenAPI_smf_info_convertToJSON() failed [pgw_ip_addr_list]"); + goto end; + } + OpenAPI_list_for_each(smf_info->pgw_ip_addr_list, node) { + cJSON *itemLocal = OpenAPI_ip_addr_convertToJSON(node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_smf_info_convertToJSON() failed [pgw_ip_addr_list]"); + goto end; + } + cJSON_AddItemToArray(pgw_ip_addr_listList, itemLocal); + } + } + if (smf_info->access_type != OpenAPI_access_type_NULL) { cJSON *access_typeList = cJSON_AddArrayToObject(item, "accessType"); if (access_typeList == NULL) { @@ -167,6 +213,41 @@ cJSON *OpenAPI_smf_info_convertToJSON(OpenAPI_smf_info_t *smf_info) } } + if (smf_info->pgw_fqdn_list) { + cJSON *pgw_fqdn_listList = cJSON_AddArrayToObject(item, "pgwFqdnList"); + if (pgw_fqdn_listList == NULL) { + ogs_error("OpenAPI_smf_info_convertToJSON() failed [pgw_fqdn_list]"); + goto end; + } + OpenAPI_list_for_each(smf_info->pgw_fqdn_list, node) { + if (cJSON_AddStringToObject(pgw_fqdn_listList, "", (char*)node->data) == NULL) { + ogs_error("OpenAPI_smf_info_convertToJSON() failed [pgw_fqdn_list]"); + goto end; + } + } + } + + if (smf_info->is_smf_onboarding_capability) { + if (cJSON_AddBoolToObject(item, "smfOnboardingCapability", smf_info->smf_onboarding_capability) == NULL) { + ogs_error("OpenAPI_smf_info_convertToJSON() failed [smf_onboarding_capability]"); + goto end; + } + } + + if (smf_info->is_ismf_support_ind) { + if (cJSON_AddBoolToObject(item, "ismfSupportInd", smf_info->ismf_support_ind) == NULL) { + ogs_error("OpenAPI_smf_info_convertToJSON() failed [ismf_support_ind]"); + goto end; + } + } + + if (smf_info->is_smf_uprp_capability) { + if (cJSON_AddBoolToObject(item, "smfUPRPCapability", smf_info->smf_uprp_capability) == NULL) { + ogs_error("OpenAPI_smf_info_convertToJSON() failed [smf_uprp_capability]"); + goto end; + } + } + end: return item; } @@ -182,10 +263,17 @@ OpenAPI_smf_info_t *OpenAPI_smf_info_parseFromJSON(cJSON *smf_infoJSON) cJSON *tai_range_list = NULL; OpenAPI_list_t *tai_range_listList = NULL; cJSON *pgw_fqdn = NULL; + cJSON *pgw_ip_addr_list = NULL; + OpenAPI_list_t *pgw_ip_addr_listList = NULL; cJSON *access_type = NULL; OpenAPI_list_t *access_typeList = NULL; cJSON *priority = NULL; cJSON *vsmf_support_ind = NULL; + cJSON *pgw_fqdn_list = NULL; + OpenAPI_list_t *pgw_fqdn_listList = NULL; + cJSON *smf_onboarding_capability = NULL; + cJSON *ismf_support_ind = NULL; + cJSON *smf_uprp_capability = NULL; s_nssai_smf_info_list = cJSON_GetObjectItemCaseSensitive(smf_infoJSON, "sNssaiSmfInfoList"); if (!s_nssai_smf_info_list) { ogs_error("OpenAPI_smf_info_parseFromJSON() failed [s_nssai_smf_info_list]"); @@ -271,6 +359,31 @@ OpenAPI_smf_info_t *OpenAPI_smf_info_parseFromJSON(cJSON *smf_infoJSON) } } + pgw_ip_addr_list = cJSON_GetObjectItemCaseSensitive(smf_infoJSON, "pgwIpAddrList"); + if (pgw_ip_addr_list) { + cJSON *pgw_ip_addr_list_local = NULL; + if (!cJSON_IsArray(pgw_ip_addr_list)) { + ogs_error("OpenAPI_smf_info_parseFromJSON() failed [pgw_ip_addr_list]"); + goto end; + } + + pgw_ip_addr_listList = OpenAPI_list_create(); + + cJSON_ArrayForEach(pgw_ip_addr_list_local, pgw_ip_addr_list) { + if (!cJSON_IsObject(pgw_ip_addr_list_local)) { + ogs_error("OpenAPI_smf_info_parseFromJSON() failed [pgw_ip_addr_list]"); + goto end; + } + OpenAPI_ip_addr_t *pgw_ip_addr_listItem = OpenAPI_ip_addr_parseFromJSON(pgw_ip_addr_list_local); + if (!pgw_ip_addr_listItem) { + ogs_error("No pgw_ip_addr_listItem"); + OpenAPI_list_free(pgw_ip_addr_listList); + goto end; + } + OpenAPI_list_add(pgw_ip_addr_listList, pgw_ip_addr_listItem); + } + } + access_type = cJSON_GetObjectItemCaseSensitive(smf_infoJSON, "accessType"); if (access_type) { cJSON *access_type_local = NULL; @@ -306,16 +419,69 @@ OpenAPI_smf_info_t *OpenAPI_smf_info_parseFromJSON(cJSON *smf_infoJSON) } } + pgw_fqdn_list = cJSON_GetObjectItemCaseSensitive(smf_infoJSON, "pgwFqdnList"); + if (pgw_fqdn_list) { + cJSON *pgw_fqdn_list_local = NULL; + if (!cJSON_IsArray(pgw_fqdn_list)) { + ogs_error("OpenAPI_smf_info_parseFromJSON() failed [pgw_fqdn_list]"); + goto end; + } + + pgw_fqdn_listList = OpenAPI_list_create(); + + cJSON_ArrayForEach(pgw_fqdn_list_local, pgw_fqdn_list) { + double *localDouble = NULL; + int *localInt = NULL; + if (!cJSON_IsString(pgw_fqdn_list_local)) { + ogs_error("OpenAPI_smf_info_parseFromJSON() failed [pgw_fqdn_list]"); + goto end; + } + OpenAPI_list_add(pgw_fqdn_listList, ogs_strdup(pgw_fqdn_list_local->valuestring)); + } + } + + smf_onboarding_capability = cJSON_GetObjectItemCaseSensitive(smf_infoJSON, "smfOnboardingCapability"); + if (smf_onboarding_capability) { + if (!cJSON_IsBool(smf_onboarding_capability)) { + ogs_error("OpenAPI_smf_info_parseFromJSON() failed [smf_onboarding_capability]"); + goto end; + } + } + + ismf_support_ind = cJSON_GetObjectItemCaseSensitive(smf_infoJSON, "ismfSupportInd"); + if (ismf_support_ind) { + if (!cJSON_IsBool(ismf_support_ind)) { + ogs_error("OpenAPI_smf_info_parseFromJSON() failed [ismf_support_ind]"); + goto end; + } + } + + smf_uprp_capability = cJSON_GetObjectItemCaseSensitive(smf_infoJSON, "smfUPRPCapability"); + if (smf_uprp_capability) { + if (!cJSON_IsBool(smf_uprp_capability)) { + ogs_error("OpenAPI_smf_info_parseFromJSON() failed [smf_uprp_capability]"); + goto end; + } + } + smf_info_local_var = OpenAPI_smf_info_create ( s_nssai_smf_info_listList, tai_list ? tai_listList : NULL, tai_range_list ? tai_range_listList : NULL, pgw_fqdn && !cJSON_IsNull(pgw_fqdn) ? ogs_strdup(pgw_fqdn->valuestring) : NULL, + pgw_ip_addr_list ? pgw_ip_addr_listList : NULL, access_type ? access_typeList : NULL, priority ? true : false, priority ? priority->valuedouble : 0, vsmf_support_ind ? true : false, - vsmf_support_ind ? vsmf_support_ind->valueint : 0 + vsmf_support_ind ? vsmf_support_ind->valueint : 0, + pgw_fqdn_list ? pgw_fqdn_listList : NULL, + smf_onboarding_capability ? true : false, + smf_onboarding_capability ? smf_onboarding_capability->valueint : 0, + ismf_support_ind ? true : false, + ismf_support_ind ? ismf_support_ind->valueint : 0, + smf_uprp_capability ? true : false, + smf_uprp_capability ? smf_uprp_capability->valueint : 0 ); return smf_info_local_var; @@ -341,10 +507,24 @@ end: OpenAPI_list_free(tai_range_listList); tai_range_listList = NULL; } + if (pgw_ip_addr_listList) { + OpenAPI_list_for_each(pgw_ip_addr_listList, node) { + OpenAPI_ip_addr_free(node->data); + } + OpenAPI_list_free(pgw_ip_addr_listList); + pgw_ip_addr_listList = NULL; + } if (access_typeList) { OpenAPI_list_free(access_typeList); access_typeList = NULL; } + if (pgw_fqdn_listList) { + OpenAPI_list_for_each(pgw_fqdn_listList, node) { + ogs_free(node->data); + } + OpenAPI_list_free(pgw_fqdn_listList); + pgw_fqdn_listList = NULL; + } return NULL; } diff --git a/lib/sbi/openapi/model/smf_info.h b/lib/sbi/openapi/model/smf_info.h index 8a85a649b..9c1577a91 100644 --- a/lib/sbi/openapi/model/smf_info.h +++ b/lib/sbi/openapi/model/smf_info.h @@ -13,6 +13,7 @@ #include "../include/keyValuePair.h" #include "../include/binary.h" #include "access_type.h" +#include "ip_addr.h" #include "snssai_smf_info_item.h" #include "tai.h" #include "tai_range.h" @@ -27,11 +28,19 @@ typedef struct OpenAPI_smf_info_s { OpenAPI_list_t *tai_list; OpenAPI_list_t *tai_range_list; char *pgw_fqdn; + OpenAPI_list_t *pgw_ip_addr_list; OpenAPI_list_t *access_type; bool is_priority; int priority; bool is_vsmf_support_ind; int vsmf_support_ind; + OpenAPI_list_t *pgw_fqdn_list; + bool is_smf_onboarding_capability; + int smf_onboarding_capability; + bool is_ismf_support_ind; + int ismf_support_ind; + bool is_smf_uprp_capability; + int smf_uprp_capability; } OpenAPI_smf_info_t; OpenAPI_smf_info_t *OpenAPI_smf_info_create( @@ -39,11 +48,19 @@ OpenAPI_smf_info_t *OpenAPI_smf_info_create( OpenAPI_list_t *tai_list, OpenAPI_list_t *tai_range_list, char *pgw_fqdn, + OpenAPI_list_t *pgw_ip_addr_list, OpenAPI_list_t *access_type, bool is_priority, int priority, bool is_vsmf_support_ind, - int vsmf_support_ind + int vsmf_support_ind, + OpenAPI_list_t *pgw_fqdn_list, + bool is_smf_onboarding_capability, + int smf_onboarding_capability, + bool is_ismf_support_ind, + int ismf_support_ind, + bool is_smf_uprp_capability, + int smf_uprp_capability ); void OpenAPI_smf_info_free(OpenAPI_smf_info_t *smf_info); OpenAPI_smf_info_t *OpenAPI_smf_info_parseFromJSON(cJSON *smf_infoJSON); diff --git a/lib/sbi/openapi/model/smf_registration.c b/lib/sbi/openapi/model/smf_registration.c index 8820652dd..ecf42b02e 100644 --- a/lib/sbi/openapi/model/smf_registration.c +++ b/lib/sbi/openapi/model/smf_registration.c @@ -16,12 +16,19 @@ OpenAPI_smf_registration_t *OpenAPI_smf_registration_create( char *pcscf_restoration_callback_uri, OpenAPI_plmn_id_t *plmn_id, char *pgw_fqdn, + OpenAPI_ip_address_t *pgw_ip_addr, bool is_epdg_ind, int epdg_ind, char *dereg_callback_uri, OpenAPI_registration_reason_e registration_reason, char *registration_time, - OpenAPI_context_info_t *context_info + OpenAPI_context_info_t *context_info, + char *pcf_id, + char *data_restoration_callback_uri, + OpenAPI_list_t *reset_ids, + bool is_udr_restart_ind, + int udr_restart_ind, + char *last_synchronization_time ) { OpenAPI_smf_registration_t *smf_registration_local_var = ogs_malloc(sizeof(OpenAPI_smf_registration_t)); @@ -38,12 +45,19 @@ OpenAPI_smf_registration_t *OpenAPI_smf_registration_create( smf_registration_local_var->pcscf_restoration_callback_uri = pcscf_restoration_callback_uri; smf_registration_local_var->plmn_id = plmn_id; smf_registration_local_var->pgw_fqdn = pgw_fqdn; + smf_registration_local_var->pgw_ip_addr = pgw_ip_addr; smf_registration_local_var->is_epdg_ind = is_epdg_ind; smf_registration_local_var->epdg_ind = epdg_ind; smf_registration_local_var->dereg_callback_uri = dereg_callback_uri; smf_registration_local_var->registration_reason = registration_reason; smf_registration_local_var->registration_time = registration_time; smf_registration_local_var->context_info = context_info; + smf_registration_local_var->pcf_id = pcf_id; + smf_registration_local_var->data_restoration_callback_uri = data_restoration_callback_uri; + smf_registration_local_var->reset_ids = reset_ids; + smf_registration_local_var->is_udr_restart_ind = is_udr_restart_ind; + smf_registration_local_var->udr_restart_ind = udr_restart_ind; + smf_registration_local_var->last_synchronization_time = last_synchronization_time; return smf_registration_local_var; } @@ -87,6 +101,10 @@ void OpenAPI_smf_registration_free(OpenAPI_smf_registration_t *smf_registration) ogs_free(smf_registration->pgw_fqdn); smf_registration->pgw_fqdn = NULL; } + if (smf_registration->pgw_ip_addr) { + OpenAPI_ip_address_free(smf_registration->pgw_ip_addr); + smf_registration->pgw_ip_addr = NULL; + } if (smf_registration->dereg_callback_uri) { ogs_free(smf_registration->dereg_callback_uri); smf_registration->dereg_callback_uri = NULL; @@ -99,6 +117,25 @@ void OpenAPI_smf_registration_free(OpenAPI_smf_registration_t *smf_registration) OpenAPI_context_info_free(smf_registration->context_info); smf_registration->context_info = NULL; } + if (smf_registration->pcf_id) { + ogs_free(smf_registration->pcf_id); + smf_registration->pcf_id = NULL; + } + if (smf_registration->data_restoration_callback_uri) { + ogs_free(smf_registration->data_restoration_callback_uri); + smf_registration->data_restoration_callback_uri = NULL; + } + if (smf_registration->reset_ids) { + OpenAPI_list_for_each(smf_registration->reset_ids, node) { + ogs_free(node->data); + } + OpenAPI_list_free(smf_registration->reset_ids); + smf_registration->reset_ids = NULL; + } + if (smf_registration->last_synchronization_time) { + ogs_free(smf_registration->last_synchronization_time); + smf_registration->last_synchronization_time = NULL; + } ogs_free(smf_registration); } @@ -199,6 +236,19 @@ cJSON *OpenAPI_smf_registration_convertToJSON(OpenAPI_smf_registration_t *smf_re } } + if (smf_registration->pgw_ip_addr) { + cJSON *pgw_ip_addr_local_JSON = OpenAPI_ip_address_convertToJSON(smf_registration->pgw_ip_addr); + if (pgw_ip_addr_local_JSON == NULL) { + ogs_error("OpenAPI_smf_registration_convertToJSON() failed [pgw_ip_addr]"); + goto end; + } + cJSON_AddItemToObject(item, "pgwIpAddr", pgw_ip_addr_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_smf_registration_convertToJSON() failed [pgw_ip_addr]"); + goto end; + } + } + if (smf_registration->is_epdg_ind) { if (cJSON_AddBoolToObject(item, "epdgInd", smf_registration->epdg_ind) == NULL) { ogs_error("OpenAPI_smf_registration_convertToJSON() failed [epdg_ind]"); @@ -240,6 +290,48 @@ cJSON *OpenAPI_smf_registration_convertToJSON(OpenAPI_smf_registration_t *smf_re } } + if (smf_registration->pcf_id) { + if (cJSON_AddStringToObject(item, "pcfId", smf_registration->pcf_id) == NULL) { + ogs_error("OpenAPI_smf_registration_convertToJSON() failed [pcf_id]"); + goto end; + } + } + + if (smf_registration->data_restoration_callback_uri) { + if (cJSON_AddStringToObject(item, "dataRestorationCallbackUri", smf_registration->data_restoration_callback_uri) == NULL) { + ogs_error("OpenAPI_smf_registration_convertToJSON() failed [data_restoration_callback_uri]"); + goto end; + } + } + + if (smf_registration->reset_ids) { + cJSON *reset_idsList = cJSON_AddArrayToObject(item, "resetIds"); + if (reset_idsList == NULL) { + ogs_error("OpenAPI_smf_registration_convertToJSON() failed [reset_ids]"); + goto end; + } + OpenAPI_list_for_each(smf_registration->reset_ids, node) { + if (cJSON_AddStringToObject(reset_idsList, "", (char*)node->data) == NULL) { + ogs_error("OpenAPI_smf_registration_convertToJSON() failed [reset_ids]"); + goto end; + } + } + } + + if (smf_registration->is_udr_restart_ind) { + if (cJSON_AddBoolToObject(item, "udrRestartInd", smf_registration->udr_restart_ind) == NULL) { + ogs_error("OpenAPI_smf_registration_convertToJSON() failed [udr_restart_ind]"); + goto end; + } + } + + if (smf_registration->last_synchronization_time) { + if (cJSON_AddStringToObject(item, "lastSynchronizationTime", smf_registration->last_synchronization_time) == NULL) { + ogs_error("OpenAPI_smf_registration_convertToJSON() failed [last_synchronization_time]"); + goto end; + } + } + end: return item; } @@ -260,6 +352,8 @@ OpenAPI_smf_registration_t *OpenAPI_smf_registration_parseFromJSON(cJSON *smf_re cJSON *plmn_id = NULL; OpenAPI_plmn_id_t *plmn_id_local_nonprim = NULL; cJSON *pgw_fqdn = NULL; + cJSON *pgw_ip_addr = NULL; + OpenAPI_ip_address_t *pgw_ip_addr_local_nonprim = NULL; cJSON *epdg_ind = NULL; cJSON *dereg_callback_uri = NULL; cJSON *registration_reason = NULL; @@ -267,6 +361,12 @@ OpenAPI_smf_registration_t *OpenAPI_smf_registration_parseFromJSON(cJSON *smf_re cJSON *registration_time = NULL; cJSON *context_info = NULL; OpenAPI_context_info_t *context_info_local_nonprim = NULL; + cJSON *pcf_id = NULL; + cJSON *data_restoration_callback_uri = NULL; + cJSON *reset_ids = NULL; + OpenAPI_list_t *reset_idsList = NULL; + cJSON *udr_restart_ind = NULL; + cJSON *last_synchronization_time = NULL; smf_instance_id = cJSON_GetObjectItemCaseSensitive(smf_registrationJSON, "smfInstanceId"); if (!smf_instance_id) { ogs_error("OpenAPI_smf_registration_parseFromJSON() failed [smf_instance_id]"); @@ -349,6 +449,11 @@ OpenAPI_smf_registration_t *OpenAPI_smf_registration_parseFromJSON(cJSON *smf_re } } + pgw_ip_addr = cJSON_GetObjectItemCaseSensitive(smf_registrationJSON, "pgwIpAddr"); + if (pgw_ip_addr) { + pgw_ip_addr_local_nonprim = OpenAPI_ip_address_parseFromJSON(pgw_ip_addr); + } + epdg_ind = cJSON_GetObjectItemCaseSensitive(smf_registrationJSON, "epdgInd"); if (epdg_ind) { if (!cJSON_IsBool(epdg_ind)) { @@ -387,6 +492,59 @@ OpenAPI_smf_registration_t *OpenAPI_smf_registration_parseFromJSON(cJSON *smf_re context_info_local_nonprim = OpenAPI_context_info_parseFromJSON(context_info); } + pcf_id = cJSON_GetObjectItemCaseSensitive(smf_registrationJSON, "pcfId"); + if (pcf_id) { + if (!cJSON_IsString(pcf_id) && !cJSON_IsNull(pcf_id)) { + ogs_error("OpenAPI_smf_registration_parseFromJSON() failed [pcf_id]"); + goto end; + } + } + + data_restoration_callback_uri = cJSON_GetObjectItemCaseSensitive(smf_registrationJSON, "dataRestorationCallbackUri"); + if (data_restoration_callback_uri) { + if (!cJSON_IsString(data_restoration_callback_uri) && !cJSON_IsNull(data_restoration_callback_uri)) { + ogs_error("OpenAPI_smf_registration_parseFromJSON() failed [data_restoration_callback_uri]"); + goto end; + } + } + + reset_ids = cJSON_GetObjectItemCaseSensitive(smf_registrationJSON, "resetIds"); + if (reset_ids) { + cJSON *reset_ids_local = NULL; + if (!cJSON_IsArray(reset_ids)) { + ogs_error("OpenAPI_smf_registration_parseFromJSON() failed [reset_ids]"); + goto end; + } + + reset_idsList = OpenAPI_list_create(); + + cJSON_ArrayForEach(reset_ids_local, reset_ids) { + double *localDouble = NULL; + int *localInt = NULL; + if (!cJSON_IsString(reset_ids_local)) { + ogs_error("OpenAPI_smf_registration_parseFromJSON() failed [reset_ids]"); + goto end; + } + OpenAPI_list_add(reset_idsList, ogs_strdup(reset_ids_local->valuestring)); + } + } + + udr_restart_ind = cJSON_GetObjectItemCaseSensitive(smf_registrationJSON, "udrRestartInd"); + if (udr_restart_ind) { + if (!cJSON_IsBool(udr_restart_ind)) { + ogs_error("OpenAPI_smf_registration_parseFromJSON() failed [udr_restart_ind]"); + goto end; + } + } + + last_synchronization_time = cJSON_GetObjectItemCaseSensitive(smf_registrationJSON, "lastSynchronizationTime"); + if (last_synchronization_time) { + if (!cJSON_IsString(last_synchronization_time) && !cJSON_IsNull(last_synchronization_time)) { + ogs_error("OpenAPI_smf_registration_parseFromJSON() failed [last_synchronization_time]"); + goto end; + } + } + smf_registration_local_var = OpenAPI_smf_registration_create ( ogs_strdup(smf_instance_id->valuestring), smf_set_id && !cJSON_IsNull(smf_set_id) ? ogs_strdup(smf_set_id->valuestring) : NULL, @@ -400,12 +558,19 @@ OpenAPI_smf_registration_t *OpenAPI_smf_registration_parseFromJSON(cJSON *smf_re pcscf_restoration_callback_uri && !cJSON_IsNull(pcscf_restoration_callback_uri) ? ogs_strdup(pcscf_restoration_callback_uri->valuestring) : NULL, plmn_id_local_nonprim, pgw_fqdn && !cJSON_IsNull(pgw_fqdn) ? ogs_strdup(pgw_fqdn->valuestring) : NULL, + pgw_ip_addr ? pgw_ip_addr_local_nonprim : NULL, epdg_ind ? true : false, epdg_ind ? epdg_ind->valueint : 0, dereg_callback_uri && !cJSON_IsNull(dereg_callback_uri) ? ogs_strdup(dereg_callback_uri->valuestring) : NULL, registration_reason ? registration_reasonVariable : 0, registration_time && !cJSON_IsNull(registration_time) ? ogs_strdup(registration_time->valuestring) : NULL, - context_info ? context_info_local_nonprim : NULL + context_info ? context_info_local_nonprim : NULL, + pcf_id && !cJSON_IsNull(pcf_id) ? ogs_strdup(pcf_id->valuestring) : NULL, + data_restoration_callback_uri && !cJSON_IsNull(data_restoration_callback_uri) ? ogs_strdup(data_restoration_callback_uri->valuestring) : NULL, + reset_ids ? reset_idsList : NULL, + udr_restart_ind ? true : false, + udr_restart_ind ? udr_restart_ind->valueint : 0, + last_synchronization_time && !cJSON_IsNull(last_synchronization_time) ? ogs_strdup(last_synchronization_time->valuestring) : NULL ); return smf_registration_local_var; @@ -418,10 +583,21 @@ end: OpenAPI_plmn_id_free(plmn_id_local_nonprim); plmn_id_local_nonprim = NULL; } + if (pgw_ip_addr_local_nonprim) { + OpenAPI_ip_address_free(pgw_ip_addr_local_nonprim); + pgw_ip_addr_local_nonprim = NULL; + } if (context_info_local_nonprim) { OpenAPI_context_info_free(context_info_local_nonprim); context_info_local_nonprim = NULL; } + if (reset_idsList) { + OpenAPI_list_for_each(reset_idsList, node) { + ogs_free(node->data); + } + OpenAPI_list_free(reset_idsList); + reset_idsList = NULL; + } return NULL; } diff --git a/lib/sbi/openapi/model/smf_registration.h b/lib/sbi/openapi/model/smf_registration.h index 67561eed2..b968f7e02 100644 --- a/lib/sbi/openapi/model/smf_registration.h +++ b/lib/sbi/openapi/model/smf_registration.h @@ -13,6 +13,7 @@ #include "../include/keyValuePair.h" #include "../include/binary.h" #include "context_info.h" +#include "ip_address.h" #include "plmn_id.h" #include "registration_reason.h" #include "snssai.h" @@ -34,12 +35,19 @@ typedef struct OpenAPI_smf_registration_s { char *pcscf_restoration_callback_uri; struct OpenAPI_plmn_id_s *plmn_id; char *pgw_fqdn; + struct OpenAPI_ip_address_s *pgw_ip_addr; bool is_epdg_ind; int epdg_ind; char *dereg_callback_uri; OpenAPI_registration_reason_e registration_reason; char *registration_time; struct OpenAPI_context_info_s *context_info; + char *pcf_id; + char *data_restoration_callback_uri; + OpenAPI_list_t *reset_ids; + bool is_udr_restart_ind; + int udr_restart_ind; + char *last_synchronization_time; } OpenAPI_smf_registration_t; OpenAPI_smf_registration_t *OpenAPI_smf_registration_create( @@ -54,12 +62,19 @@ OpenAPI_smf_registration_t *OpenAPI_smf_registration_create( char *pcscf_restoration_callback_uri, OpenAPI_plmn_id_t *plmn_id, char *pgw_fqdn, + OpenAPI_ip_address_t *pgw_ip_addr, bool is_epdg_ind, int epdg_ind, char *dereg_callback_uri, OpenAPI_registration_reason_e registration_reason, char *registration_time, - OpenAPI_context_info_t *context_info + OpenAPI_context_info_t *context_info, + char *pcf_id, + char *data_restoration_callback_uri, + OpenAPI_list_t *reset_ids, + bool is_udr_restart_ind, + int udr_restart_ind, + char *last_synchronization_time ); void OpenAPI_smf_registration_free(OpenAPI_smf_registration_t *smf_registration); OpenAPI_smf_registration_t *OpenAPI_smf_registration_parseFromJSON(cJSON *smf_registrationJSON); diff --git a/lib/sbi/openapi/model/smf_registration_modification.c b/lib/sbi/openapi/model/smf_registration_modification.c new file mode 100644 index 000000000..afcf5e06e --- /dev/null +++ b/lib/sbi/openapi/model/smf_registration_modification.c @@ -0,0 +1,168 @@ + +#include +#include +#include +#include "smf_registration_modification.h" + +OpenAPI_smf_registration_modification_t *OpenAPI_smf_registration_modification_create( + char *smf_instance_id, + char *smf_set_id, + OpenAPI_fqdn_rm_t *pgw_fqdn +) +{ + OpenAPI_smf_registration_modification_t *smf_registration_modification_local_var = ogs_malloc(sizeof(OpenAPI_smf_registration_modification_t)); + ogs_assert(smf_registration_modification_local_var); + + smf_registration_modification_local_var->smf_instance_id = smf_instance_id; + smf_registration_modification_local_var->smf_set_id = smf_set_id; + smf_registration_modification_local_var->pgw_fqdn = pgw_fqdn; + + return smf_registration_modification_local_var; +} + +void OpenAPI_smf_registration_modification_free(OpenAPI_smf_registration_modification_t *smf_registration_modification) +{ + OpenAPI_lnode_t *node = NULL; + + if (NULL == smf_registration_modification) { + return; + } + if (smf_registration_modification->smf_instance_id) { + ogs_free(smf_registration_modification->smf_instance_id); + smf_registration_modification->smf_instance_id = NULL; + } + if (smf_registration_modification->smf_set_id) { + ogs_free(smf_registration_modification->smf_set_id); + smf_registration_modification->smf_set_id = NULL; + } + if (smf_registration_modification->pgw_fqdn) { + OpenAPI_fqdn_rm_free(smf_registration_modification->pgw_fqdn); + smf_registration_modification->pgw_fqdn = NULL; + } + ogs_free(smf_registration_modification); +} + +cJSON *OpenAPI_smf_registration_modification_convertToJSON(OpenAPI_smf_registration_modification_t *smf_registration_modification) +{ + cJSON *item = NULL; + OpenAPI_lnode_t *node = NULL; + + if (smf_registration_modification == NULL) { + ogs_error("OpenAPI_smf_registration_modification_convertToJSON() failed [SmfRegistrationModification]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (!smf_registration_modification->smf_instance_id) { + ogs_error("OpenAPI_smf_registration_modification_convertToJSON() failed [smf_instance_id]"); + return NULL; + } + if (cJSON_AddStringToObject(item, "smfInstanceId", smf_registration_modification->smf_instance_id) == NULL) { + ogs_error("OpenAPI_smf_registration_modification_convertToJSON() failed [smf_instance_id]"); + goto end; + } + + if (smf_registration_modification->smf_set_id) { + if (cJSON_AddStringToObject(item, "smfSetId", smf_registration_modification->smf_set_id) == NULL) { + ogs_error("OpenAPI_smf_registration_modification_convertToJSON() failed [smf_set_id]"); + goto end; + } + } + + if (smf_registration_modification->pgw_fqdn) { + cJSON *pgw_fqdn_local_JSON = OpenAPI_fqdn_rm_convertToJSON(smf_registration_modification->pgw_fqdn); + if (pgw_fqdn_local_JSON == NULL) { + ogs_error("OpenAPI_smf_registration_modification_convertToJSON() failed [pgw_fqdn]"); + goto end; + } + cJSON_AddItemToObject(item, "pgwFqdn", pgw_fqdn_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_smf_registration_modification_convertToJSON() failed [pgw_fqdn]"); + goto end; + } + } + +end: + return item; +} + +OpenAPI_smf_registration_modification_t *OpenAPI_smf_registration_modification_parseFromJSON(cJSON *smf_registration_modificationJSON) +{ + OpenAPI_smf_registration_modification_t *smf_registration_modification_local_var = NULL; + OpenAPI_lnode_t *node = NULL; + cJSON *smf_instance_id = NULL; + cJSON *smf_set_id = NULL; + cJSON *pgw_fqdn = NULL; + OpenAPI_fqdn_rm_t *pgw_fqdn_local_nonprim = NULL; + smf_instance_id = cJSON_GetObjectItemCaseSensitive(smf_registration_modificationJSON, "smfInstanceId"); + if (!smf_instance_id) { + ogs_error("OpenAPI_smf_registration_modification_parseFromJSON() failed [smf_instance_id]"); + goto end; + } + if (!cJSON_IsString(smf_instance_id)) { + ogs_error("OpenAPI_smf_registration_modification_parseFromJSON() failed [smf_instance_id]"); + goto end; + } + + smf_set_id = cJSON_GetObjectItemCaseSensitive(smf_registration_modificationJSON, "smfSetId"); + if (smf_set_id) { + if (!cJSON_IsString(smf_set_id) && !cJSON_IsNull(smf_set_id)) { + ogs_error("OpenAPI_smf_registration_modification_parseFromJSON() failed [smf_set_id]"); + goto end; + } + } + + pgw_fqdn = cJSON_GetObjectItemCaseSensitive(smf_registration_modificationJSON, "pgwFqdn"); + if (pgw_fqdn) { + pgw_fqdn_local_nonprim = OpenAPI_fqdn_rm_parseFromJSON(pgw_fqdn); + } + + smf_registration_modification_local_var = OpenAPI_smf_registration_modification_create ( + ogs_strdup(smf_instance_id->valuestring), + smf_set_id && !cJSON_IsNull(smf_set_id) ? ogs_strdup(smf_set_id->valuestring) : NULL, + pgw_fqdn ? pgw_fqdn_local_nonprim : NULL + ); + + return smf_registration_modification_local_var; +end: + if (pgw_fqdn_local_nonprim) { + OpenAPI_fqdn_rm_free(pgw_fqdn_local_nonprim); + pgw_fqdn_local_nonprim = NULL; + } + return NULL; +} + +OpenAPI_smf_registration_modification_t *OpenAPI_smf_registration_modification_copy(OpenAPI_smf_registration_modification_t *dst, OpenAPI_smf_registration_modification_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_smf_registration_modification_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_smf_registration_modification_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_smf_registration_modification_free(dst); + dst = OpenAPI_smf_registration_modification_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/smf_registration_modification.h b/lib/sbi/openapi/model/smf_registration_modification.h new file mode 100644 index 000000000..d1a95f82c --- /dev/null +++ b/lib/sbi/openapi/model/smf_registration_modification.h @@ -0,0 +1,43 @@ +/* + * smf_registration_modification.h + * + * Contains attributes of SmfRegistration that can be modified using PATCH + */ + +#ifndef _OpenAPI_smf_registration_modification_H_ +#define _OpenAPI_smf_registration_modification_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "fqdn_rm.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_smf_registration_modification_s OpenAPI_smf_registration_modification_t; +typedef struct OpenAPI_smf_registration_modification_s { + char *smf_instance_id; + char *smf_set_id; + struct OpenAPI_fqdn_rm_s *pgw_fqdn; +} OpenAPI_smf_registration_modification_t; + +OpenAPI_smf_registration_modification_t *OpenAPI_smf_registration_modification_create( + char *smf_instance_id, + char *smf_set_id, + OpenAPI_fqdn_rm_t *pgw_fqdn +); +void OpenAPI_smf_registration_modification_free(OpenAPI_smf_registration_modification_t *smf_registration_modification); +OpenAPI_smf_registration_modification_t *OpenAPI_smf_registration_modification_parseFromJSON(cJSON *smf_registration_modificationJSON); +cJSON *OpenAPI_smf_registration_modification_convertToJSON(OpenAPI_smf_registration_modification_t *smf_registration_modification); +OpenAPI_smf_registration_modification_t *OpenAPI_smf_registration_modification_copy(OpenAPI_smf_registration_modification_t *dst, OpenAPI_smf_registration_modification_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_smf_registration_modification_H_ */ + diff --git a/lib/sbi/openapi/model/smf_selection_data.h b/lib/sbi/openapi/model/smf_selection_data.h index 34e5fd70c..e4e969ae5 100644 --- a/lib/sbi/openapi/model/smf_selection_data.h +++ b/lib/sbi/openapi/model/smf_selection_data.h @@ -1,7 +1,7 @@ /* * smf_selection_data.h * - * + * Represents the SMF Selection information that may be replaced by the PCF. */ #ifndef _OpenAPI_smf_selection_data_H_ diff --git a/lib/sbi/openapi/model/smf_selection_subscription_data.c b/lib/sbi/openapi/model/smf_selection_subscription_data.c index 5c16e76f9..8d87f82dc 100644 --- a/lib/sbi/openapi/model/smf_selection_subscription_data.c +++ b/lib/sbi/openapi/model/smf_selection_subscription_data.c @@ -7,7 +7,8 @@ OpenAPI_smf_selection_subscription_data_t *OpenAPI_smf_selection_subscription_data_create( char *supported_features, OpenAPI_list_t* subscribed_snssai_infos, - char *shared_snssai_infos_id + char *shared_snssai_infos_id, + char *hss_group_id ) { OpenAPI_smf_selection_subscription_data_t *smf_selection_subscription_data_local_var = ogs_malloc(sizeof(OpenAPI_smf_selection_subscription_data_t)); @@ -16,6 +17,7 @@ OpenAPI_smf_selection_subscription_data_t *OpenAPI_smf_selection_subscription_da smf_selection_subscription_data_local_var->supported_features = supported_features; smf_selection_subscription_data_local_var->subscribed_snssai_infos = subscribed_snssai_infos; smf_selection_subscription_data_local_var->shared_snssai_infos_id = shared_snssai_infos_id; + smf_selection_subscription_data_local_var->hss_group_id = hss_group_id; return smf_selection_subscription_data_local_var; } @@ -45,6 +47,10 @@ void OpenAPI_smf_selection_subscription_data_free(OpenAPI_smf_selection_subscrip ogs_free(smf_selection_subscription_data->shared_snssai_infos_id); smf_selection_subscription_data->shared_snssai_infos_id = NULL; } + if (smf_selection_subscription_data->hss_group_id) { + ogs_free(smf_selection_subscription_data->hss_group_id); + smf_selection_subscription_data->hss_group_id = NULL; + } ogs_free(smf_selection_subscription_data); } @@ -95,6 +101,13 @@ cJSON *OpenAPI_smf_selection_subscription_data_convertToJSON(OpenAPI_smf_selecti } } + if (smf_selection_subscription_data->hss_group_id) { + if (cJSON_AddStringToObject(item, "hssGroupId", smf_selection_subscription_data->hss_group_id) == NULL) { + ogs_error("OpenAPI_smf_selection_subscription_data_convertToJSON() failed [hss_group_id]"); + goto end; + } + } + end: return item; } @@ -107,6 +120,7 @@ OpenAPI_smf_selection_subscription_data_t *OpenAPI_smf_selection_subscription_da cJSON *subscribed_snssai_infos = NULL; OpenAPI_list_t *subscribed_snssai_infosList = NULL; cJSON *shared_snssai_infos_id = NULL; + cJSON *hss_group_id = NULL; supported_features = cJSON_GetObjectItemCaseSensitive(smf_selection_subscription_dataJSON, "supportedFeatures"); if (supported_features) { if (!cJSON_IsString(supported_features) && !cJSON_IsNull(supported_features)) { @@ -149,10 +163,19 @@ OpenAPI_smf_selection_subscription_data_t *OpenAPI_smf_selection_subscription_da } } + hss_group_id = cJSON_GetObjectItemCaseSensitive(smf_selection_subscription_dataJSON, "hssGroupId"); + if (hss_group_id) { + if (!cJSON_IsString(hss_group_id) && !cJSON_IsNull(hss_group_id)) { + ogs_error("OpenAPI_smf_selection_subscription_data_parseFromJSON() failed [hss_group_id]"); + goto end; + } + } + smf_selection_subscription_data_local_var = OpenAPI_smf_selection_subscription_data_create ( supported_features && !cJSON_IsNull(supported_features) ? ogs_strdup(supported_features->valuestring) : NULL, subscribed_snssai_infos ? subscribed_snssai_infosList : NULL, - shared_snssai_infos_id && !cJSON_IsNull(shared_snssai_infos_id) ? ogs_strdup(shared_snssai_infos_id->valuestring) : NULL + shared_snssai_infos_id && !cJSON_IsNull(shared_snssai_infos_id) ? ogs_strdup(shared_snssai_infos_id->valuestring) : NULL, + hss_group_id && !cJSON_IsNull(hss_group_id) ? ogs_strdup(hss_group_id->valuestring) : NULL ); return smf_selection_subscription_data_local_var; diff --git a/lib/sbi/openapi/model/smf_selection_subscription_data.h b/lib/sbi/openapi/model/smf_selection_subscription_data.h index 335a9f001..06c82fbd2 100644 --- a/lib/sbi/openapi/model/smf_selection_subscription_data.h +++ b/lib/sbi/openapi/model/smf_selection_subscription_data.h @@ -23,12 +23,14 @@ typedef struct OpenAPI_smf_selection_subscription_data_s { char *supported_features; OpenAPI_list_t* subscribed_snssai_infos; char *shared_snssai_infos_id; + char *hss_group_id; } OpenAPI_smf_selection_subscription_data_t; OpenAPI_smf_selection_subscription_data_t *OpenAPI_smf_selection_subscription_data_create( char *supported_features, OpenAPI_list_t* subscribed_snssai_infos, - char *shared_snssai_infos_id + char *shared_snssai_infos_id, + char *hss_group_id ); void OpenAPI_smf_selection_subscription_data_free(OpenAPI_smf_selection_subscription_data_t *smf_selection_subscription_data); OpenAPI_smf_selection_subscription_data_t *OpenAPI_smf_selection_subscription_data_parseFromJSON(cJSON *smf_selection_subscription_dataJSON); diff --git a/lib/sbi/openapi/model/smf_selection_subscription_data_1.c b/lib/sbi/openapi/model/smf_selection_subscription_data_1.c deleted file mode 100644 index c8db849fd..000000000 --- a/lib/sbi/openapi/model/smf_selection_subscription_data_1.c +++ /dev/null @@ -1,206 +0,0 @@ - -#include -#include -#include -#include "smf_selection_subscription_data_1.h" - -OpenAPI_smf_selection_subscription_data_1_t *OpenAPI_smf_selection_subscription_data_1_create( - char *supported_features, - OpenAPI_list_t* subscribed_snssai_infos, - char *shared_snssai_infos_id -) -{ - OpenAPI_smf_selection_subscription_data_1_t *smf_selection_subscription_data_1_local_var = ogs_malloc(sizeof(OpenAPI_smf_selection_subscription_data_1_t)); - ogs_assert(smf_selection_subscription_data_1_local_var); - - smf_selection_subscription_data_1_local_var->supported_features = supported_features; - smf_selection_subscription_data_1_local_var->subscribed_snssai_infos = subscribed_snssai_infos; - smf_selection_subscription_data_1_local_var->shared_snssai_infos_id = shared_snssai_infos_id; - - return smf_selection_subscription_data_1_local_var; -} - -void OpenAPI_smf_selection_subscription_data_1_free(OpenAPI_smf_selection_subscription_data_1_t *smf_selection_subscription_data_1) -{ - OpenAPI_lnode_t *node = NULL; - - if (NULL == smf_selection_subscription_data_1) { - return; - } - if (smf_selection_subscription_data_1->supported_features) { - ogs_free(smf_selection_subscription_data_1->supported_features); - smf_selection_subscription_data_1->supported_features = NULL; - } - if (smf_selection_subscription_data_1->subscribed_snssai_infos) { - OpenAPI_list_for_each(smf_selection_subscription_data_1->subscribed_snssai_infos, node) { - OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*)node->data; - ogs_free(localKeyValue->key); - OpenAPI_snssai_info_free(localKeyValue->value); - OpenAPI_map_free(localKeyValue); - } - OpenAPI_list_free(smf_selection_subscription_data_1->subscribed_snssai_infos); - smf_selection_subscription_data_1->subscribed_snssai_infos = NULL; - } - if (smf_selection_subscription_data_1->shared_snssai_infos_id) { - ogs_free(smf_selection_subscription_data_1->shared_snssai_infos_id); - smf_selection_subscription_data_1->shared_snssai_infos_id = NULL; - } - ogs_free(smf_selection_subscription_data_1); -} - -cJSON *OpenAPI_smf_selection_subscription_data_1_convertToJSON(OpenAPI_smf_selection_subscription_data_1_t *smf_selection_subscription_data_1) -{ - cJSON *item = NULL; - OpenAPI_lnode_t *node = NULL; - - if (smf_selection_subscription_data_1 == NULL) { - ogs_error("OpenAPI_smf_selection_subscription_data_1_convertToJSON() failed [SmfSelectionSubscriptionData_1]"); - return NULL; - } - - item = cJSON_CreateObject(); - if (smf_selection_subscription_data_1->supported_features) { - if (cJSON_AddStringToObject(item, "supportedFeatures", smf_selection_subscription_data_1->supported_features) == NULL) { - ogs_error("OpenAPI_smf_selection_subscription_data_1_convertToJSON() failed [supported_features]"); - goto end; - } - } - - if (smf_selection_subscription_data_1->subscribed_snssai_infos) { - cJSON *subscribed_snssai_infos = cJSON_AddObjectToObject(item, "subscribedSnssaiInfos"); - if (subscribed_snssai_infos == NULL) { - ogs_error("OpenAPI_smf_selection_subscription_data_1_convertToJSON() failed [subscribed_snssai_infos]"); - goto end; - } - cJSON *localMapObject = subscribed_snssai_infos; - if (smf_selection_subscription_data_1->subscribed_snssai_infos) { - OpenAPI_list_for_each(smf_selection_subscription_data_1->subscribed_snssai_infos, node) { - OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*)node->data; - cJSON *itemLocal = localKeyValue->value ? - OpenAPI_snssai_info_convertToJSON(localKeyValue->value) : - cJSON_CreateNull(); - if (itemLocal == NULL) { - ogs_error("OpenAPI_smf_selection_subscription_data_1_convertToJSON() failed [inner]"); - goto end; - } - cJSON_AddItemToObject(localMapObject, localKeyValue->key, itemLocal); - } - } - } - - if (smf_selection_subscription_data_1->shared_snssai_infos_id) { - if (cJSON_AddStringToObject(item, "sharedSnssaiInfosId", smf_selection_subscription_data_1->shared_snssai_infos_id) == NULL) { - ogs_error("OpenAPI_smf_selection_subscription_data_1_convertToJSON() failed [shared_snssai_infos_id]"); - goto end; - } - } - -end: - return item; -} - -OpenAPI_smf_selection_subscription_data_1_t *OpenAPI_smf_selection_subscription_data_1_parseFromJSON(cJSON *smf_selection_subscription_data_1JSON) -{ - OpenAPI_smf_selection_subscription_data_1_t *smf_selection_subscription_data_1_local_var = NULL; - OpenAPI_lnode_t *node = NULL; - cJSON *supported_features = NULL; - cJSON *subscribed_snssai_infos = NULL; - OpenAPI_list_t *subscribed_snssai_infosList = NULL; - cJSON *shared_snssai_infos_id = NULL; - supported_features = cJSON_GetObjectItemCaseSensitive(smf_selection_subscription_data_1JSON, "supportedFeatures"); - if (supported_features) { - if (!cJSON_IsString(supported_features) && !cJSON_IsNull(supported_features)) { - ogs_error("OpenAPI_smf_selection_subscription_data_1_parseFromJSON() failed [supported_features]"); - goto end; - } - } - - subscribed_snssai_infos = cJSON_GetObjectItemCaseSensitive(smf_selection_subscription_data_1JSON, "subscribedSnssaiInfos"); - if (subscribed_snssai_infos) { - cJSON *subscribed_snssai_infos_local_map = NULL; - if (!cJSON_IsObject(subscribed_snssai_infos) && !cJSON_IsNull(subscribed_snssai_infos)) { - ogs_error("OpenAPI_smf_selection_subscription_data_1_parseFromJSON() failed [subscribed_snssai_infos]"); - goto end; - } - if (cJSON_IsObject(subscribed_snssai_infos)) { - subscribed_snssai_infosList = OpenAPI_list_create(); - OpenAPI_map_t *localMapKeyPair = NULL; - cJSON_ArrayForEach(subscribed_snssai_infos_local_map, subscribed_snssai_infos) { - cJSON *localMapObject = subscribed_snssai_infos_local_map; - if (cJSON_IsObject(localMapObject)) { - localMapKeyPair = OpenAPI_map_create( - ogs_strdup(localMapObject->string), OpenAPI_snssai_info_parseFromJSON(localMapObject)); - } else if (cJSON_IsNull(localMapObject)) { - localMapKeyPair = OpenAPI_map_create(ogs_strdup(localMapObject->string), NULL); - } else { - ogs_error("OpenAPI_smf_selection_subscription_data_1_parseFromJSON() failed [inner]"); - goto end; - } - OpenAPI_list_add(subscribed_snssai_infosList, localMapKeyPair); - } - } - } - - shared_snssai_infos_id = cJSON_GetObjectItemCaseSensitive(smf_selection_subscription_data_1JSON, "sharedSnssaiInfosId"); - if (shared_snssai_infos_id) { - if (!cJSON_IsString(shared_snssai_infos_id) && !cJSON_IsNull(shared_snssai_infos_id)) { - ogs_error("OpenAPI_smf_selection_subscription_data_1_parseFromJSON() failed [shared_snssai_infos_id]"); - goto end; - } - } - - smf_selection_subscription_data_1_local_var = OpenAPI_smf_selection_subscription_data_1_create ( - supported_features && !cJSON_IsNull(supported_features) ? ogs_strdup(supported_features->valuestring) : NULL, - subscribed_snssai_infos ? subscribed_snssai_infosList : NULL, - shared_snssai_infos_id && !cJSON_IsNull(shared_snssai_infos_id) ? ogs_strdup(shared_snssai_infos_id->valuestring) : NULL - ); - - return smf_selection_subscription_data_1_local_var; -end: - if (subscribed_snssai_infosList) { - OpenAPI_list_for_each(subscribed_snssai_infosList, node) { - OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*) node->data; - ogs_free(localKeyValue->key); - OpenAPI_snssai_info_free(localKeyValue->value); - OpenAPI_map_free(localKeyValue); - } - OpenAPI_list_free(subscribed_snssai_infosList); - subscribed_snssai_infosList = NULL; - } - return NULL; -} - -OpenAPI_smf_selection_subscription_data_1_t *OpenAPI_smf_selection_subscription_data_1_copy(OpenAPI_smf_selection_subscription_data_1_t *dst, OpenAPI_smf_selection_subscription_data_1_t *src) -{ - cJSON *item = NULL; - char *content = NULL; - - ogs_assert(src); - item = OpenAPI_smf_selection_subscription_data_1_convertToJSON(src); - if (!item) { - ogs_error("OpenAPI_smf_selection_subscription_data_1_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_smf_selection_subscription_data_1_free(dst); - dst = OpenAPI_smf_selection_subscription_data_1_parseFromJSON(item); - cJSON_Delete(item); - - return dst; -} - diff --git a/lib/sbi/openapi/model/smf_selection_subscription_data_1.h b/lib/sbi/openapi/model/smf_selection_subscription_data_1.h deleted file mode 100644 index 8bb1338b2..000000000 --- a/lib/sbi/openapi/model/smf_selection_subscription_data_1.h +++ /dev/null @@ -1,43 +0,0 @@ -/* - * smf_selection_subscription_data_1.h - * - * - */ - -#ifndef _OpenAPI_smf_selection_subscription_data_1_H_ -#define _OpenAPI_smf_selection_subscription_data_1_H_ - -#include -#include "../external/cJSON.h" -#include "../include/list.h" -#include "../include/keyValuePair.h" -#include "../include/binary.h" -#include "snssai_info.h" - -#ifdef __cplusplus -extern "C" { -#endif - -typedef struct OpenAPI_smf_selection_subscription_data_1_s OpenAPI_smf_selection_subscription_data_1_t; -typedef struct OpenAPI_smf_selection_subscription_data_1_s { - char *supported_features; - OpenAPI_list_t* subscribed_snssai_infos; - char *shared_snssai_infos_id; -} OpenAPI_smf_selection_subscription_data_1_t; - -OpenAPI_smf_selection_subscription_data_1_t *OpenAPI_smf_selection_subscription_data_1_create( - char *supported_features, - OpenAPI_list_t* subscribed_snssai_infos, - char *shared_snssai_infos_id -); -void OpenAPI_smf_selection_subscription_data_1_free(OpenAPI_smf_selection_subscription_data_1_t *smf_selection_subscription_data_1); -OpenAPI_smf_selection_subscription_data_1_t *OpenAPI_smf_selection_subscription_data_1_parseFromJSON(cJSON *smf_selection_subscription_data_1JSON); -cJSON *OpenAPI_smf_selection_subscription_data_1_convertToJSON(OpenAPI_smf_selection_subscription_data_1_t *smf_selection_subscription_data_1); -OpenAPI_smf_selection_subscription_data_1_t *OpenAPI_smf_selection_subscription_data_1_copy(OpenAPI_smf_selection_subscription_data_1_t *dst, OpenAPI_smf_selection_subscription_data_1_t *src); - -#ifdef __cplusplus -} -#endif - -#endif /* _OpenAPI_smf_selection_subscription_data_1_H_ */ - diff --git a/lib/sbi/openapi/model/smf_selection_type.c b/lib/sbi/openapi/model/smf_selection_type.c new file mode 100644 index 000000000..13f1f7b9e --- /dev/null +++ b/lib/sbi/openapi/model/smf_selection_type.c @@ -0,0 +1,30 @@ + +#include +#include +#include +#include "smf_selection_type.h" + +char* OpenAPI_smf_selection_type_ToString(OpenAPI_smf_selection_type_e smf_selection_type) +{ + const char *smf_selection_typeArray[] = { "NULL", "CURRENT_PDU_SESSION", "NEXT_PDU_SESSION" }; + size_t sizeofArray = sizeof(smf_selection_typeArray) / sizeof(smf_selection_typeArray[0]); + if (smf_selection_type < sizeofArray) + return (char *)smf_selection_typeArray[smf_selection_type]; + else + return (char *)"Unknown"; +} + +OpenAPI_smf_selection_type_e OpenAPI_smf_selection_type_FromString(char* smf_selection_type) +{ + int stringToReturn = 0; + const char *smf_selection_typeArray[] = { "NULL", "CURRENT_PDU_SESSION", "NEXT_PDU_SESSION" }; + size_t sizeofArray = sizeof(smf_selection_typeArray) / sizeof(smf_selection_typeArray[0]); + while (stringToReturn < sizeofArray) { + if (strcmp(smf_selection_type, smf_selection_typeArray[stringToReturn]) == 0) { + return stringToReturn; + } + stringToReturn++; + } + return 0; +} + diff --git a/lib/sbi/openapi/model/smf_selection_type.h b/lib/sbi/openapi/model/smf_selection_type.h new file mode 100644 index 000000000..10293ee71 --- /dev/null +++ b/lib/sbi/openapi/model/smf_selection_type.h @@ -0,0 +1,31 @@ +/* + * smf_selection_type.h + * + * + */ + +#ifndef _OpenAPI_smf_selection_type_H_ +#define _OpenAPI_smf_selection_type_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef enum { OpenAPI_smf_selection_type_NULL = 0, OpenAPI_smf_selection_type_CURRENT_PDU_SESSION, OpenAPI_smf_selection_type_NEXT_PDU_SESSION } OpenAPI_smf_selection_type_e; + +char* OpenAPI_smf_selection_type_ToString(OpenAPI_smf_selection_type_e smf_selection_type); + +OpenAPI_smf_selection_type_e OpenAPI_smf_selection_type_FromString(char* smf_selection_type); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_smf_selection_type_H_ */ + diff --git a/lib/sbi/openapi/model/smf_subscription_item.c b/lib/sbi/openapi/model/smf_subscription_item.c index c36aaa915..2d2a7ed8c 100644 --- a/lib/sbi/openapi/model/smf_subscription_item.c +++ b/lib/sbi/openapi/model/smf_subscription_item.c @@ -6,7 +6,8 @@ OpenAPI_smf_subscription_item_t *OpenAPI_smf_subscription_item_create( char *smf_instance_id, - char *subscription_id + char *subscription_id, + OpenAPI_context_info_t *context_info ) { OpenAPI_smf_subscription_item_t *smf_subscription_item_local_var = ogs_malloc(sizeof(OpenAPI_smf_subscription_item_t)); @@ -14,6 +15,7 @@ OpenAPI_smf_subscription_item_t *OpenAPI_smf_subscription_item_create( smf_subscription_item_local_var->smf_instance_id = smf_instance_id; smf_subscription_item_local_var->subscription_id = subscription_id; + smf_subscription_item_local_var->context_info = context_info; return smf_subscription_item_local_var; } @@ -33,6 +35,10 @@ void OpenAPI_smf_subscription_item_free(OpenAPI_smf_subscription_item_t *smf_sub ogs_free(smf_subscription_item->subscription_id); smf_subscription_item->subscription_id = NULL; } + if (smf_subscription_item->context_info) { + OpenAPI_context_info_free(smf_subscription_item->context_info); + smf_subscription_item->context_info = NULL; + } ogs_free(smf_subscription_item); } @@ -65,6 +71,19 @@ cJSON *OpenAPI_smf_subscription_item_convertToJSON(OpenAPI_smf_subscription_item goto end; } + if (smf_subscription_item->context_info) { + cJSON *context_info_local_JSON = OpenAPI_context_info_convertToJSON(smf_subscription_item->context_info); + if (context_info_local_JSON == NULL) { + ogs_error("OpenAPI_smf_subscription_item_convertToJSON() failed [context_info]"); + goto end; + } + cJSON_AddItemToObject(item, "contextInfo", context_info_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_smf_subscription_item_convertToJSON() failed [context_info]"); + goto end; + } + } + end: return item; } @@ -75,6 +94,8 @@ OpenAPI_smf_subscription_item_t *OpenAPI_smf_subscription_item_parseFromJSON(cJS OpenAPI_lnode_t *node = NULL; cJSON *smf_instance_id = NULL; cJSON *subscription_id = NULL; + cJSON *context_info = NULL; + OpenAPI_context_info_t *context_info_local_nonprim = NULL; smf_instance_id = cJSON_GetObjectItemCaseSensitive(smf_subscription_itemJSON, "smfInstanceId"); if (!smf_instance_id) { ogs_error("OpenAPI_smf_subscription_item_parseFromJSON() failed [smf_instance_id]"); @@ -95,13 +116,23 @@ OpenAPI_smf_subscription_item_t *OpenAPI_smf_subscription_item_parseFromJSON(cJS goto end; } + context_info = cJSON_GetObjectItemCaseSensitive(smf_subscription_itemJSON, "contextInfo"); + if (context_info) { + context_info_local_nonprim = OpenAPI_context_info_parseFromJSON(context_info); + } + smf_subscription_item_local_var = OpenAPI_smf_subscription_item_create ( ogs_strdup(smf_instance_id->valuestring), - ogs_strdup(subscription_id->valuestring) + ogs_strdup(subscription_id->valuestring), + context_info ? context_info_local_nonprim : NULL ); return smf_subscription_item_local_var; end: + if (context_info_local_nonprim) { + OpenAPI_context_info_free(context_info_local_nonprim); + context_info_local_nonprim = NULL; + } return NULL; } diff --git a/lib/sbi/openapi/model/smf_subscription_item.h b/lib/sbi/openapi/model/smf_subscription_item.h index 7808461ff..30d0fe8af 100644 --- a/lib/sbi/openapi/model/smf_subscription_item.h +++ b/lib/sbi/openapi/model/smf_subscription_item.h @@ -12,6 +12,7 @@ #include "../include/list.h" #include "../include/keyValuePair.h" #include "../include/binary.h" +#include "context_info.h" #ifdef __cplusplus extern "C" { @@ -21,11 +22,13 @@ typedef struct OpenAPI_smf_subscription_item_s OpenAPI_smf_subscription_item_t; typedef struct OpenAPI_smf_subscription_item_s { char *smf_instance_id; char *subscription_id; + struct OpenAPI_context_info_s *context_info; } OpenAPI_smf_subscription_item_t; OpenAPI_smf_subscription_item_t *OpenAPI_smf_subscription_item_create( char *smf_instance_id, - char *subscription_id + char *subscription_id, + OpenAPI_context_info_t *context_info ); void OpenAPI_smf_subscription_item_free(OpenAPI_smf_subscription_item_t *smf_subscription_item); OpenAPI_smf_subscription_item_t *OpenAPI_smf_subscription_item_parseFromJSON(cJSON *smf_subscription_itemJSON); diff --git a/lib/sbi/openapi/model/sms_router_info.c b/lib/sbi/openapi/model/sms_router_info.c new file mode 100644 index 000000000..b7ceb0537 --- /dev/null +++ b/lib/sbi/openapi/model/sms_router_info.c @@ -0,0 +1,233 @@ + +#include +#include +#include +#include "sms_router_info.h" + +OpenAPI_sms_router_info_t *OpenAPI_sms_router_info_create( + char *nf_instance_id, + OpenAPI_network_node_diameter_address_t *diameter_address, + char *map_address, + char *router_ipv4, + char *router_ipv6, + char *router_fqdn +) +{ + OpenAPI_sms_router_info_t *sms_router_info_local_var = ogs_malloc(sizeof(OpenAPI_sms_router_info_t)); + ogs_assert(sms_router_info_local_var); + + sms_router_info_local_var->nf_instance_id = nf_instance_id; + sms_router_info_local_var->diameter_address = diameter_address; + sms_router_info_local_var->map_address = map_address; + sms_router_info_local_var->router_ipv4 = router_ipv4; + sms_router_info_local_var->router_ipv6 = router_ipv6; + sms_router_info_local_var->router_fqdn = router_fqdn; + + return sms_router_info_local_var; +} + +void OpenAPI_sms_router_info_free(OpenAPI_sms_router_info_t *sms_router_info) +{ + OpenAPI_lnode_t *node = NULL; + + if (NULL == sms_router_info) { + return; + } + if (sms_router_info->nf_instance_id) { + ogs_free(sms_router_info->nf_instance_id); + sms_router_info->nf_instance_id = NULL; + } + if (sms_router_info->diameter_address) { + OpenAPI_network_node_diameter_address_free(sms_router_info->diameter_address); + sms_router_info->diameter_address = NULL; + } + if (sms_router_info->map_address) { + ogs_free(sms_router_info->map_address); + sms_router_info->map_address = NULL; + } + if (sms_router_info->router_ipv4) { + ogs_free(sms_router_info->router_ipv4); + sms_router_info->router_ipv4 = NULL; + } + if (sms_router_info->router_ipv6) { + ogs_free(sms_router_info->router_ipv6); + sms_router_info->router_ipv6 = NULL; + } + if (sms_router_info->router_fqdn) { + ogs_free(sms_router_info->router_fqdn); + sms_router_info->router_fqdn = NULL; + } + ogs_free(sms_router_info); +} + +cJSON *OpenAPI_sms_router_info_convertToJSON(OpenAPI_sms_router_info_t *sms_router_info) +{ + cJSON *item = NULL; + OpenAPI_lnode_t *node = NULL; + + if (sms_router_info == NULL) { + ogs_error("OpenAPI_sms_router_info_convertToJSON() failed [SmsRouterInfo]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (sms_router_info->nf_instance_id) { + if (cJSON_AddStringToObject(item, "nfInstanceId", sms_router_info->nf_instance_id) == NULL) { + ogs_error("OpenAPI_sms_router_info_convertToJSON() failed [nf_instance_id]"); + goto end; + } + } + + if (sms_router_info->diameter_address) { + cJSON *diameter_address_local_JSON = OpenAPI_network_node_diameter_address_convertToJSON(sms_router_info->diameter_address); + if (diameter_address_local_JSON == NULL) { + ogs_error("OpenAPI_sms_router_info_convertToJSON() failed [diameter_address]"); + goto end; + } + cJSON_AddItemToObject(item, "diameterAddress", diameter_address_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_sms_router_info_convertToJSON() failed [diameter_address]"); + goto end; + } + } + + if (sms_router_info->map_address) { + if (cJSON_AddStringToObject(item, "mapAddress", sms_router_info->map_address) == NULL) { + ogs_error("OpenAPI_sms_router_info_convertToJSON() failed [map_address]"); + goto end; + } + } + + if (sms_router_info->router_ipv4) { + if (cJSON_AddStringToObject(item, "routerIpv4", sms_router_info->router_ipv4) == NULL) { + ogs_error("OpenAPI_sms_router_info_convertToJSON() failed [router_ipv4]"); + goto end; + } + } + + if (sms_router_info->router_ipv6) { + if (cJSON_AddStringToObject(item, "routerIpv6", sms_router_info->router_ipv6) == NULL) { + ogs_error("OpenAPI_sms_router_info_convertToJSON() failed [router_ipv6]"); + goto end; + } + } + + if (sms_router_info->router_fqdn) { + if (cJSON_AddStringToObject(item, "routerFqdn", sms_router_info->router_fqdn) == NULL) { + ogs_error("OpenAPI_sms_router_info_convertToJSON() failed [router_fqdn]"); + goto end; + } + } + +end: + return item; +} + +OpenAPI_sms_router_info_t *OpenAPI_sms_router_info_parseFromJSON(cJSON *sms_router_infoJSON) +{ + OpenAPI_sms_router_info_t *sms_router_info_local_var = NULL; + OpenAPI_lnode_t *node = NULL; + cJSON *nf_instance_id = NULL; + cJSON *diameter_address = NULL; + OpenAPI_network_node_diameter_address_t *diameter_address_local_nonprim = NULL; + cJSON *map_address = NULL; + cJSON *router_ipv4 = NULL; + cJSON *router_ipv6 = NULL; + cJSON *router_fqdn = NULL; + nf_instance_id = cJSON_GetObjectItemCaseSensitive(sms_router_infoJSON, "nfInstanceId"); + if (nf_instance_id) { + if (!cJSON_IsString(nf_instance_id) && !cJSON_IsNull(nf_instance_id)) { + ogs_error("OpenAPI_sms_router_info_parseFromJSON() failed [nf_instance_id]"); + goto end; + } + } + + diameter_address = cJSON_GetObjectItemCaseSensitive(sms_router_infoJSON, "diameterAddress"); + if (diameter_address) { + diameter_address_local_nonprim = OpenAPI_network_node_diameter_address_parseFromJSON(diameter_address); + } + + map_address = cJSON_GetObjectItemCaseSensitive(sms_router_infoJSON, "mapAddress"); + if (map_address) { + if (!cJSON_IsString(map_address) && !cJSON_IsNull(map_address)) { + ogs_error("OpenAPI_sms_router_info_parseFromJSON() failed [map_address]"); + goto end; + } + } + + router_ipv4 = cJSON_GetObjectItemCaseSensitive(sms_router_infoJSON, "routerIpv4"); + if (router_ipv4) { + if (!cJSON_IsString(router_ipv4) && !cJSON_IsNull(router_ipv4)) { + ogs_error("OpenAPI_sms_router_info_parseFromJSON() failed [router_ipv4]"); + goto end; + } + } + + router_ipv6 = cJSON_GetObjectItemCaseSensitive(sms_router_infoJSON, "routerIpv6"); + if (router_ipv6) { + if (!cJSON_IsString(router_ipv6) && !cJSON_IsNull(router_ipv6)) { + ogs_error("OpenAPI_sms_router_info_parseFromJSON() failed [router_ipv6]"); + goto end; + } + } + + router_fqdn = cJSON_GetObjectItemCaseSensitive(sms_router_infoJSON, "routerFqdn"); + if (router_fqdn) { + if (!cJSON_IsString(router_fqdn) && !cJSON_IsNull(router_fqdn)) { + ogs_error("OpenAPI_sms_router_info_parseFromJSON() failed [router_fqdn]"); + goto end; + } + } + + sms_router_info_local_var = OpenAPI_sms_router_info_create ( + nf_instance_id && !cJSON_IsNull(nf_instance_id) ? ogs_strdup(nf_instance_id->valuestring) : NULL, + diameter_address ? diameter_address_local_nonprim : NULL, + map_address && !cJSON_IsNull(map_address) ? ogs_strdup(map_address->valuestring) : NULL, + router_ipv4 && !cJSON_IsNull(router_ipv4) ? ogs_strdup(router_ipv4->valuestring) : NULL, + router_ipv6 && !cJSON_IsNull(router_ipv6) ? ogs_strdup(router_ipv6->valuestring) : NULL, + router_fqdn && !cJSON_IsNull(router_fqdn) ? ogs_strdup(router_fqdn->valuestring) : NULL + ); + + return sms_router_info_local_var; +end: + if (diameter_address_local_nonprim) { + OpenAPI_network_node_diameter_address_free(diameter_address_local_nonprim); + diameter_address_local_nonprim = NULL; + } + return NULL; +} + +OpenAPI_sms_router_info_t *OpenAPI_sms_router_info_copy(OpenAPI_sms_router_info_t *dst, OpenAPI_sms_router_info_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_sms_router_info_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_sms_router_info_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_sms_router_info_free(dst); + dst = OpenAPI_sms_router_info_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/sms_router_info.h b/lib/sbi/openapi/model/sms_router_info.h new file mode 100644 index 000000000..b1acdf4e1 --- /dev/null +++ b/lib/sbi/openapi/model/sms_router_info.h @@ -0,0 +1,49 @@ +/* + * sms_router_info.h + * + * Addressing information of the SMS Router configured at the UDM + */ + +#ifndef _OpenAPI_sms_router_info_H_ +#define _OpenAPI_sms_router_info_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "network_node_diameter_address.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_sms_router_info_s OpenAPI_sms_router_info_t; +typedef struct OpenAPI_sms_router_info_s { + char *nf_instance_id; + struct OpenAPI_network_node_diameter_address_s *diameter_address; + char *map_address; + char *router_ipv4; + char *router_ipv6; + char *router_fqdn; +} OpenAPI_sms_router_info_t; + +OpenAPI_sms_router_info_t *OpenAPI_sms_router_info_create( + char *nf_instance_id, + OpenAPI_network_node_diameter_address_t *diameter_address, + char *map_address, + char *router_ipv4, + char *router_ipv6, + char *router_fqdn +); +void OpenAPI_sms_router_info_free(OpenAPI_sms_router_info_t *sms_router_info); +OpenAPI_sms_router_info_t *OpenAPI_sms_router_info_parseFromJSON(cJSON *sms_router_infoJSON); +cJSON *OpenAPI_sms_router_info_convertToJSON(OpenAPI_sms_router_info_t *sms_router_info); +OpenAPI_sms_router_info_t *OpenAPI_sms_router_info_copy(OpenAPI_sms_router_info_t *dst, OpenAPI_sms_router_info_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_sms_router_info_H_ */ + diff --git a/lib/sbi/openapi/model/sms_subscription_data.c b/lib/sbi/openapi/model/sms_subscription_data.c index 0506d78b0..7173dfa2b 100644 --- a/lib/sbi/openapi/model/sms_subscription_data.c +++ b/lib/sbi/openapi/model/sms_subscription_data.c @@ -7,7 +7,8 @@ OpenAPI_sms_subscription_data_t *OpenAPI_sms_subscription_data_create( bool is_sms_subscribed, int sms_subscribed, - char *shared_sms_subs_data_id + char *shared_sms_subs_data_id, + char *supported_features ) { OpenAPI_sms_subscription_data_t *sms_subscription_data_local_var = ogs_malloc(sizeof(OpenAPI_sms_subscription_data_t)); @@ -16,6 +17,7 @@ OpenAPI_sms_subscription_data_t *OpenAPI_sms_subscription_data_create( sms_subscription_data_local_var->is_sms_subscribed = is_sms_subscribed; sms_subscription_data_local_var->sms_subscribed = sms_subscribed; sms_subscription_data_local_var->shared_sms_subs_data_id = shared_sms_subs_data_id; + sms_subscription_data_local_var->supported_features = supported_features; return sms_subscription_data_local_var; } @@ -31,6 +33,10 @@ void OpenAPI_sms_subscription_data_free(OpenAPI_sms_subscription_data_t *sms_sub ogs_free(sms_subscription_data->shared_sms_subs_data_id); sms_subscription_data->shared_sms_subs_data_id = NULL; } + if (sms_subscription_data->supported_features) { + ogs_free(sms_subscription_data->supported_features); + sms_subscription_data->supported_features = NULL; + } ogs_free(sms_subscription_data); } @@ -59,6 +65,13 @@ cJSON *OpenAPI_sms_subscription_data_convertToJSON(OpenAPI_sms_subscription_data } } + if (sms_subscription_data->supported_features) { + if (cJSON_AddStringToObject(item, "supportedFeatures", sms_subscription_data->supported_features) == NULL) { + ogs_error("OpenAPI_sms_subscription_data_convertToJSON() failed [supported_features]"); + goto end; + } + } + end: return item; } @@ -69,6 +82,7 @@ OpenAPI_sms_subscription_data_t *OpenAPI_sms_subscription_data_parseFromJSON(cJS OpenAPI_lnode_t *node = NULL; cJSON *sms_subscribed = NULL; cJSON *shared_sms_subs_data_id = NULL; + cJSON *supported_features = NULL; sms_subscribed = cJSON_GetObjectItemCaseSensitive(sms_subscription_dataJSON, "smsSubscribed"); if (sms_subscribed) { if (!cJSON_IsBool(sms_subscribed)) { @@ -85,10 +99,19 @@ OpenAPI_sms_subscription_data_t *OpenAPI_sms_subscription_data_parseFromJSON(cJS } } + supported_features = cJSON_GetObjectItemCaseSensitive(sms_subscription_dataJSON, "supportedFeatures"); + if (supported_features) { + if (!cJSON_IsString(supported_features) && !cJSON_IsNull(supported_features)) { + ogs_error("OpenAPI_sms_subscription_data_parseFromJSON() failed [supported_features]"); + goto end; + } + } + sms_subscription_data_local_var = OpenAPI_sms_subscription_data_create ( sms_subscribed ? true : false, sms_subscribed ? sms_subscribed->valueint : 0, - shared_sms_subs_data_id && !cJSON_IsNull(shared_sms_subs_data_id) ? ogs_strdup(shared_sms_subs_data_id->valuestring) : NULL + shared_sms_subs_data_id && !cJSON_IsNull(shared_sms_subs_data_id) ? ogs_strdup(shared_sms_subs_data_id->valuestring) : NULL, + supported_features && !cJSON_IsNull(supported_features) ? ogs_strdup(supported_features->valuestring) : NULL ); return sms_subscription_data_local_var; diff --git a/lib/sbi/openapi/model/sms_subscription_data.h b/lib/sbi/openapi/model/sms_subscription_data.h index ed65b9148..dec094769 100644 --- a/lib/sbi/openapi/model/sms_subscription_data.h +++ b/lib/sbi/openapi/model/sms_subscription_data.h @@ -22,12 +22,14 @@ typedef struct OpenAPI_sms_subscription_data_s { bool is_sms_subscribed; int sms_subscribed; char *shared_sms_subs_data_id; + char *supported_features; } OpenAPI_sms_subscription_data_t; OpenAPI_sms_subscription_data_t *OpenAPI_sms_subscription_data_create( bool is_sms_subscribed, int sms_subscribed, - char *shared_sms_subs_data_id + char *shared_sms_subs_data_id, + char *supported_features ); void OpenAPI_sms_subscription_data_free(OpenAPI_sms_subscription_data_t *sms_subscription_data); OpenAPI_sms_subscription_data_t *OpenAPI_sms_subscription_data_parseFromJSON(cJSON *sms_subscription_dataJSON); diff --git a/lib/sbi/openapi/model/sms_subscription_data_1.c b/lib/sbi/openapi/model/sms_subscription_data_1.c index edfced2ed..e0166a7f5 100644 --- a/lib/sbi/openapi/model/sms_subscription_data_1.c +++ b/lib/sbi/openapi/model/sms_subscription_data_1.c @@ -7,7 +7,8 @@ OpenAPI_sms_subscription_data_1_t *OpenAPI_sms_subscription_data_1_create( bool is_sms_subscribed, int sms_subscribed, - char *shared_sms_subs_data_id + char *shared_sms_subs_data_id, + char *supported_features ) { OpenAPI_sms_subscription_data_1_t *sms_subscription_data_1_local_var = ogs_malloc(sizeof(OpenAPI_sms_subscription_data_1_t)); @@ -16,6 +17,7 @@ OpenAPI_sms_subscription_data_1_t *OpenAPI_sms_subscription_data_1_create( sms_subscription_data_1_local_var->is_sms_subscribed = is_sms_subscribed; sms_subscription_data_1_local_var->sms_subscribed = sms_subscribed; sms_subscription_data_1_local_var->shared_sms_subs_data_id = shared_sms_subs_data_id; + sms_subscription_data_1_local_var->supported_features = supported_features; return sms_subscription_data_1_local_var; } @@ -31,6 +33,10 @@ void OpenAPI_sms_subscription_data_1_free(OpenAPI_sms_subscription_data_1_t *sms ogs_free(sms_subscription_data_1->shared_sms_subs_data_id); sms_subscription_data_1->shared_sms_subs_data_id = NULL; } + if (sms_subscription_data_1->supported_features) { + ogs_free(sms_subscription_data_1->supported_features); + sms_subscription_data_1->supported_features = NULL; + } ogs_free(sms_subscription_data_1); } @@ -59,6 +65,13 @@ cJSON *OpenAPI_sms_subscription_data_1_convertToJSON(OpenAPI_sms_subscription_da } } + if (sms_subscription_data_1->supported_features) { + if (cJSON_AddStringToObject(item, "supportedFeatures", sms_subscription_data_1->supported_features) == NULL) { + ogs_error("OpenAPI_sms_subscription_data_1_convertToJSON() failed [supported_features]"); + goto end; + } + } + end: return item; } @@ -69,6 +82,7 @@ OpenAPI_sms_subscription_data_1_t *OpenAPI_sms_subscription_data_1_parseFromJSON OpenAPI_lnode_t *node = NULL; cJSON *sms_subscribed = NULL; cJSON *shared_sms_subs_data_id = NULL; + cJSON *supported_features = NULL; sms_subscribed = cJSON_GetObjectItemCaseSensitive(sms_subscription_data_1JSON, "smsSubscribed"); if (sms_subscribed) { if (!cJSON_IsBool(sms_subscribed)) { @@ -85,10 +99,19 @@ OpenAPI_sms_subscription_data_1_t *OpenAPI_sms_subscription_data_1_parseFromJSON } } + supported_features = cJSON_GetObjectItemCaseSensitive(sms_subscription_data_1JSON, "supportedFeatures"); + if (supported_features) { + if (!cJSON_IsString(supported_features) && !cJSON_IsNull(supported_features)) { + ogs_error("OpenAPI_sms_subscription_data_1_parseFromJSON() failed [supported_features]"); + goto end; + } + } + sms_subscription_data_1_local_var = OpenAPI_sms_subscription_data_1_create ( sms_subscribed ? true : false, sms_subscribed ? sms_subscribed->valueint : 0, - shared_sms_subs_data_id && !cJSON_IsNull(shared_sms_subs_data_id) ? ogs_strdup(shared_sms_subs_data_id->valuestring) : NULL + shared_sms_subs_data_id && !cJSON_IsNull(shared_sms_subs_data_id) ? ogs_strdup(shared_sms_subs_data_id->valuestring) : NULL, + supported_features && !cJSON_IsNull(supported_features) ? ogs_strdup(supported_features->valuestring) : NULL ); return sms_subscription_data_1_local_var; diff --git a/lib/sbi/openapi/model/sms_subscription_data_1.h b/lib/sbi/openapi/model/sms_subscription_data_1.h index 9192d2500..cf929ef42 100644 --- a/lib/sbi/openapi/model/sms_subscription_data_1.h +++ b/lib/sbi/openapi/model/sms_subscription_data_1.h @@ -22,12 +22,14 @@ typedef struct OpenAPI_sms_subscription_data_1_s { bool is_sms_subscribed; int sms_subscribed; char *shared_sms_subs_data_id; + char *supported_features; } OpenAPI_sms_subscription_data_1_t; OpenAPI_sms_subscription_data_1_t *OpenAPI_sms_subscription_data_1_create( bool is_sms_subscribed, int sms_subscribed, - char *shared_sms_subs_data_id + char *shared_sms_subs_data_id, + char *supported_features ); void OpenAPI_sms_subscription_data_1_free(OpenAPI_sms_subscription_data_1_t *sms_subscription_data_1); OpenAPI_sms_subscription_data_1_t *OpenAPI_sms_subscription_data_1_parseFromJSON(cJSON *sms_subscription_data_1JSON); diff --git a/lib/sbi/openapi/model/smsc_data.h b/lib/sbi/openapi/model/smsc_data.h index b76bf7e4a..27c37ea05 100644 --- a/lib/sbi/openapi/model/smsc_data.h +++ b/lib/sbi/openapi/model/smsc_data.h @@ -1,7 +1,7 @@ /* * smsc_data.h * - * + * Addresses of SM-Service Center entities with SMS wating to be delivered to the UE. */ #ifndef _OpenAPI_smsc_data_H_ diff --git a/lib/sbi/openapi/model/smsf_info.c b/lib/sbi/openapi/model/smsf_info.c index b08ec99bb..c41dad9ad 100644 --- a/lib/sbi/openapi/model/smsf_info.c +++ b/lib/sbi/openapi/model/smsf_info.c @@ -6,7 +6,8 @@ OpenAPI_smsf_info_t *OpenAPI_smsf_info_create( char *smsf_instance_id, - OpenAPI_plmn_id_t *plmn_id + OpenAPI_plmn_id_t *plmn_id, + char *smsf_set_id ) { OpenAPI_smsf_info_t *smsf_info_local_var = ogs_malloc(sizeof(OpenAPI_smsf_info_t)); @@ -14,6 +15,7 @@ OpenAPI_smsf_info_t *OpenAPI_smsf_info_create( smsf_info_local_var->smsf_instance_id = smsf_instance_id; smsf_info_local_var->plmn_id = plmn_id; + smsf_info_local_var->smsf_set_id = smsf_set_id; return smsf_info_local_var; } @@ -33,6 +35,10 @@ void OpenAPI_smsf_info_free(OpenAPI_smsf_info_t *smsf_info) OpenAPI_plmn_id_free(smsf_info->plmn_id); smsf_info->plmn_id = NULL; } + if (smsf_info->smsf_set_id) { + ogs_free(smsf_info->smsf_set_id); + smsf_info->smsf_set_id = NULL; + } ogs_free(smsf_info); } @@ -71,6 +77,13 @@ cJSON *OpenAPI_smsf_info_convertToJSON(OpenAPI_smsf_info_t *smsf_info) goto end; } + if (smsf_info->smsf_set_id) { + if (cJSON_AddStringToObject(item, "smsfSetId", smsf_info->smsf_set_id) == NULL) { + ogs_error("OpenAPI_smsf_info_convertToJSON() failed [smsf_set_id]"); + goto end; + } + } + end: return item; } @@ -82,6 +95,7 @@ OpenAPI_smsf_info_t *OpenAPI_smsf_info_parseFromJSON(cJSON *smsf_infoJSON) cJSON *smsf_instance_id = NULL; cJSON *plmn_id = NULL; OpenAPI_plmn_id_t *plmn_id_local_nonprim = NULL; + cJSON *smsf_set_id = NULL; smsf_instance_id = cJSON_GetObjectItemCaseSensitive(smsf_infoJSON, "smsfInstanceId"); if (!smsf_instance_id) { ogs_error("OpenAPI_smsf_info_parseFromJSON() failed [smsf_instance_id]"); @@ -99,9 +113,18 @@ OpenAPI_smsf_info_t *OpenAPI_smsf_info_parseFromJSON(cJSON *smsf_infoJSON) } plmn_id_local_nonprim = OpenAPI_plmn_id_parseFromJSON(plmn_id); + smsf_set_id = cJSON_GetObjectItemCaseSensitive(smsf_infoJSON, "smsfSetId"); + if (smsf_set_id) { + if (!cJSON_IsString(smsf_set_id) && !cJSON_IsNull(smsf_set_id)) { + ogs_error("OpenAPI_smsf_info_parseFromJSON() failed [smsf_set_id]"); + goto end; + } + } + smsf_info_local_var = OpenAPI_smsf_info_create ( ogs_strdup(smsf_instance_id->valuestring), - plmn_id_local_nonprim + plmn_id_local_nonprim, + smsf_set_id && !cJSON_IsNull(smsf_set_id) ? ogs_strdup(smsf_set_id->valuestring) : NULL ); return smsf_info_local_var; diff --git a/lib/sbi/openapi/model/smsf_info.h b/lib/sbi/openapi/model/smsf_info.h index a79aa3339..e969acc93 100644 --- a/lib/sbi/openapi/model/smsf_info.h +++ b/lib/sbi/openapi/model/smsf_info.h @@ -22,11 +22,13 @@ typedef struct OpenAPI_smsf_info_s OpenAPI_smsf_info_t; typedef struct OpenAPI_smsf_info_s { char *smsf_instance_id; struct OpenAPI_plmn_id_s *plmn_id; + char *smsf_set_id; } OpenAPI_smsf_info_t; OpenAPI_smsf_info_t *OpenAPI_smsf_info_create( char *smsf_instance_id, - OpenAPI_plmn_id_t *plmn_id + OpenAPI_plmn_id_t *plmn_id, + char *smsf_set_id ); void OpenAPI_smsf_info_free(OpenAPI_smsf_info_t *smsf_info); OpenAPI_smsf_info_t *OpenAPI_smsf_info_parseFromJSON(cJSON *smsf_infoJSON); diff --git a/lib/sbi/openapi/model/smsf_info_1.c b/lib/sbi/openapi/model/smsf_info_1.c deleted file mode 100644 index 3d9cf01a8..000000000 --- a/lib/sbi/openapi/model/smsf_info_1.c +++ /dev/null @@ -1,149 +0,0 @@ - -#include -#include -#include -#include "smsf_info_1.h" - -OpenAPI_smsf_info_1_t *OpenAPI_smsf_info_1_create( - char *smsf_instance_id, - OpenAPI_plmn_id_1_t *plmn_id -) -{ - OpenAPI_smsf_info_1_t *smsf_info_1_local_var = ogs_malloc(sizeof(OpenAPI_smsf_info_1_t)); - ogs_assert(smsf_info_1_local_var); - - smsf_info_1_local_var->smsf_instance_id = smsf_instance_id; - smsf_info_1_local_var->plmn_id = plmn_id; - - return smsf_info_1_local_var; -} - -void OpenAPI_smsf_info_1_free(OpenAPI_smsf_info_1_t *smsf_info_1) -{ - OpenAPI_lnode_t *node = NULL; - - if (NULL == smsf_info_1) { - return; - } - if (smsf_info_1->smsf_instance_id) { - ogs_free(smsf_info_1->smsf_instance_id); - smsf_info_1->smsf_instance_id = NULL; - } - if (smsf_info_1->plmn_id) { - OpenAPI_plmn_id_1_free(smsf_info_1->plmn_id); - smsf_info_1->plmn_id = NULL; - } - ogs_free(smsf_info_1); -} - -cJSON *OpenAPI_smsf_info_1_convertToJSON(OpenAPI_smsf_info_1_t *smsf_info_1) -{ - cJSON *item = NULL; - OpenAPI_lnode_t *node = NULL; - - if (smsf_info_1 == NULL) { - ogs_error("OpenAPI_smsf_info_1_convertToJSON() failed [SmsfInfo_1]"); - return NULL; - } - - item = cJSON_CreateObject(); - if (!smsf_info_1->smsf_instance_id) { - ogs_error("OpenAPI_smsf_info_1_convertToJSON() failed [smsf_instance_id]"); - return NULL; - } - if (cJSON_AddStringToObject(item, "smsfInstanceId", smsf_info_1->smsf_instance_id) == NULL) { - ogs_error("OpenAPI_smsf_info_1_convertToJSON() failed [smsf_instance_id]"); - goto end; - } - - if (!smsf_info_1->plmn_id) { - ogs_error("OpenAPI_smsf_info_1_convertToJSON() failed [plmn_id]"); - return NULL; - } - cJSON *plmn_id_local_JSON = OpenAPI_plmn_id_1_convertToJSON(smsf_info_1->plmn_id); - if (plmn_id_local_JSON == NULL) { - ogs_error("OpenAPI_smsf_info_1_convertToJSON() failed [plmn_id]"); - goto end; - } - cJSON_AddItemToObject(item, "plmnId", plmn_id_local_JSON); - if (item->child == NULL) { - ogs_error("OpenAPI_smsf_info_1_convertToJSON() failed [plmn_id]"); - goto end; - } - -end: - return item; -} - -OpenAPI_smsf_info_1_t *OpenAPI_smsf_info_1_parseFromJSON(cJSON *smsf_info_1JSON) -{ - OpenAPI_smsf_info_1_t *smsf_info_1_local_var = NULL; - OpenAPI_lnode_t *node = NULL; - cJSON *smsf_instance_id = NULL; - cJSON *plmn_id = NULL; - OpenAPI_plmn_id_1_t *plmn_id_local_nonprim = NULL; - smsf_instance_id = cJSON_GetObjectItemCaseSensitive(smsf_info_1JSON, "smsfInstanceId"); - if (!smsf_instance_id) { - ogs_error("OpenAPI_smsf_info_1_parseFromJSON() failed [smsf_instance_id]"); - goto end; - } - if (!cJSON_IsString(smsf_instance_id)) { - ogs_error("OpenAPI_smsf_info_1_parseFromJSON() failed [smsf_instance_id]"); - goto end; - } - - plmn_id = cJSON_GetObjectItemCaseSensitive(smsf_info_1JSON, "plmnId"); - if (!plmn_id) { - ogs_error("OpenAPI_smsf_info_1_parseFromJSON() failed [plmn_id]"); - goto end; - } - plmn_id_local_nonprim = OpenAPI_plmn_id_1_parseFromJSON(plmn_id); - - smsf_info_1_local_var = OpenAPI_smsf_info_1_create ( - ogs_strdup(smsf_instance_id->valuestring), - plmn_id_local_nonprim - ); - - return smsf_info_1_local_var; -end: - if (plmn_id_local_nonprim) { - OpenAPI_plmn_id_1_free(plmn_id_local_nonprim); - plmn_id_local_nonprim = NULL; - } - return NULL; -} - -OpenAPI_smsf_info_1_t *OpenAPI_smsf_info_1_copy(OpenAPI_smsf_info_1_t *dst, OpenAPI_smsf_info_1_t *src) -{ - cJSON *item = NULL; - char *content = NULL; - - ogs_assert(src); - item = OpenAPI_smsf_info_1_convertToJSON(src); - if (!item) { - ogs_error("OpenAPI_smsf_info_1_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_smsf_info_1_free(dst); - dst = OpenAPI_smsf_info_1_parseFromJSON(item); - cJSON_Delete(item); - - return dst; -} - diff --git a/lib/sbi/openapi/model/smsf_info_1.h b/lib/sbi/openapi/model/smsf_info_1.h deleted file mode 100644 index 94bf01db9..000000000 --- a/lib/sbi/openapi/model/smsf_info_1.h +++ /dev/null @@ -1,41 +0,0 @@ -/* - * smsf_info_1.h - * - * - */ - -#ifndef _OpenAPI_smsf_info_1_H_ -#define _OpenAPI_smsf_info_1_H_ - -#include -#include "../external/cJSON.h" -#include "../include/list.h" -#include "../include/keyValuePair.h" -#include "../include/binary.h" -#include "plmn_id_1.h" - -#ifdef __cplusplus -extern "C" { -#endif - -typedef struct OpenAPI_smsf_info_1_s OpenAPI_smsf_info_1_t; -typedef struct OpenAPI_smsf_info_1_s { - char *smsf_instance_id; - struct OpenAPI_plmn_id_1_s *plmn_id; -} OpenAPI_smsf_info_1_t; - -OpenAPI_smsf_info_1_t *OpenAPI_smsf_info_1_create( - char *smsf_instance_id, - OpenAPI_plmn_id_1_t *plmn_id -); -void OpenAPI_smsf_info_1_free(OpenAPI_smsf_info_1_t *smsf_info_1); -OpenAPI_smsf_info_1_t *OpenAPI_smsf_info_1_parseFromJSON(cJSON *smsf_info_1JSON); -cJSON *OpenAPI_smsf_info_1_convertToJSON(OpenAPI_smsf_info_1_t *smsf_info_1); -OpenAPI_smsf_info_1_t *OpenAPI_smsf_info_1_copy(OpenAPI_smsf_info_1_t *dst, OpenAPI_smsf_info_1_t *src); - -#ifdef __cplusplus -} -#endif - -#endif /* _OpenAPI_smsf_info_1_H_ */ - diff --git a/lib/sbi/openapi/model/smsf_registration.c b/lib/sbi/openapi/model/smsf_registration.c index 2660ab077..ec6b7dff4 100644 --- a/lib/sbi/openapi/model/smsf_registration.c +++ b/lib/sbi/openapi/model/smsf_registration.c @@ -12,7 +12,14 @@ OpenAPI_smsf_registration_t *OpenAPI_smsf_registration_create( char *smsf_map_address, OpenAPI_network_node_diameter_address_t *smsf_diameter_address, char *registration_time, - OpenAPI_context_info_t *context_info + OpenAPI_context_info_t *context_info, + char *data_restoration_callback_uri, + OpenAPI_list_t *reset_ids, + bool is_smsf_sbi_sup_ind, + int smsf_sbi_sup_ind, + bool is_udr_restart_ind, + int udr_restart_ind, + char *last_synchronization_time ) { OpenAPI_smsf_registration_t *smsf_registration_local_var = ogs_malloc(sizeof(OpenAPI_smsf_registration_t)); @@ -26,6 +33,13 @@ OpenAPI_smsf_registration_t *OpenAPI_smsf_registration_create( smsf_registration_local_var->smsf_diameter_address = smsf_diameter_address; smsf_registration_local_var->registration_time = registration_time; smsf_registration_local_var->context_info = context_info; + smsf_registration_local_var->data_restoration_callback_uri = data_restoration_callback_uri; + smsf_registration_local_var->reset_ids = reset_ids; + smsf_registration_local_var->is_smsf_sbi_sup_ind = is_smsf_sbi_sup_ind; + smsf_registration_local_var->smsf_sbi_sup_ind = smsf_sbi_sup_ind; + smsf_registration_local_var->is_udr_restart_ind = is_udr_restart_ind; + smsf_registration_local_var->udr_restart_ind = udr_restart_ind; + smsf_registration_local_var->last_synchronization_time = last_synchronization_time; return smsf_registration_local_var; } @@ -69,6 +83,21 @@ void OpenAPI_smsf_registration_free(OpenAPI_smsf_registration_t *smsf_registrati OpenAPI_context_info_free(smsf_registration->context_info); smsf_registration->context_info = NULL; } + if (smsf_registration->data_restoration_callback_uri) { + ogs_free(smsf_registration->data_restoration_callback_uri); + smsf_registration->data_restoration_callback_uri = NULL; + } + if (smsf_registration->reset_ids) { + OpenAPI_list_for_each(smsf_registration->reset_ids, node) { + ogs_free(node->data); + } + OpenAPI_list_free(smsf_registration->reset_ids); + smsf_registration->reset_ids = NULL; + } + if (smsf_registration->last_synchronization_time) { + ogs_free(smsf_registration->last_synchronization_time); + smsf_registration->last_synchronization_time = NULL; + } ogs_free(smsf_registration); } @@ -161,6 +190,48 @@ cJSON *OpenAPI_smsf_registration_convertToJSON(OpenAPI_smsf_registration_t *smsf } } + if (smsf_registration->data_restoration_callback_uri) { + if (cJSON_AddStringToObject(item, "dataRestorationCallbackUri", smsf_registration->data_restoration_callback_uri) == NULL) { + ogs_error("OpenAPI_smsf_registration_convertToJSON() failed [data_restoration_callback_uri]"); + goto end; + } + } + + if (smsf_registration->reset_ids) { + cJSON *reset_idsList = cJSON_AddArrayToObject(item, "resetIds"); + if (reset_idsList == NULL) { + ogs_error("OpenAPI_smsf_registration_convertToJSON() failed [reset_ids]"); + goto end; + } + OpenAPI_list_for_each(smsf_registration->reset_ids, node) { + if (cJSON_AddStringToObject(reset_idsList, "", (char*)node->data) == NULL) { + ogs_error("OpenAPI_smsf_registration_convertToJSON() failed [reset_ids]"); + goto end; + } + } + } + + if (smsf_registration->is_smsf_sbi_sup_ind) { + if (cJSON_AddBoolToObject(item, "smsfSbiSupInd", smsf_registration->smsf_sbi_sup_ind) == NULL) { + ogs_error("OpenAPI_smsf_registration_convertToJSON() failed [smsf_sbi_sup_ind]"); + goto end; + } + } + + if (smsf_registration->is_udr_restart_ind) { + if (cJSON_AddBoolToObject(item, "udrRestartInd", smsf_registration->udr_restart_ind) == NULL) { + ogs_error("OpenAPI_smsf_registration_convertToJSON() failed [udr_restart_ind]"); + goto end; + } + } + + if (smsf_registration->last_synchronization_time) { + if (cJSON_AddStringToObject(item, "lastSynchronizationTime", smsf_registration->last_synchronization_time) == NULL) { + ogs_error("OpenAPI_smsf_registration_convertToJSON() failed [last_synchronization_time]"); + goto end; + } + } + end: return item; } @@ -180,6 +251,12 @@ OpenAPI_smsf_registration_t *OpenAPI_smsf_registration_parseFromJSON(cJSON *smsf cJSON *registration_time = NULL; cJSON *context_info = NULL; OpenAPI_context_info_t *context_info_local_nonprim = NULL; + cJSON *data_restoration_callback_uri = NULL; + cJSON *reset_ids = NULL; + OpenAPI_list_t *reset_idsList = NULL; + cJSON *smsf_sbi_sup_ind = NULL; + cJSON *udr_restart_ind = NULL; + cJSON *last_synchronization_time = NULL; smsf_instance_id = cJSON_GetObjectItemCaseSensitive(smsf_registrationJSON, "smsfInstanceId"); if (!smsf_instance_id) { ogs_error("OpenAPI_smsf_registration_parseFromJSON() failed [smsf_instance_id]"); @@ -239,6 +316,59 @@ OpenAPI_smsf_registration_t *OpenAPI_smsf_registration_parseFromJSON(cJSON *smsf context_info_local_nonprim = OpenAPI_context_info_parseFromJSON(context_info); } + data_restoration_callback_uri = cJSON_GetObjectItemCaseSensitive(smsf_registrationJSON, "dataRestorationCallbackUri"); + if (data_restoration_callback_uri) { + if (!cJSON_IsString(data_restoration_callback_uri) && !cJSON_IsNull(data_restoration_callback_uri)) { + ogs_error("OpenAPI_smsf_registration_parseFromJSON() failed [data_restoration_callback_uri]"); + goto end; + } + } + + reset_ids = cJSON_GetObjectItemCaseSensitive(smsf_registrationJSON, "resetIds"); + if (reset_ids) { + cJSON *reset_ids_local = NULL; + if (!cJSON_IsArray(reset_ids)) { + ogs_error("OpenAPI_smsf_registration_parseFromJSON() failed [reset_ids]"); + goto end; + } + + reset_idsList = OpenAPI_list_create(); + + cJSON_ArrayForEach(reset_ids_local, reset_ids) { + double *localDouble = NULL; + int *localInt = NULL; + if (!cJSON_IsString(reset_ids_local)) { + ogs_error("OpenAPI_smsf_registration_parseFromJSON() failed [reset_ids]"); + goto end; + } + OpenAPI_list_add(reset_idsList, ogs_strdup(reset_ids_local->valuestring)); + } + } + + smsf_sbi_sup_ind = cJSON_GetObjectItemCaseSensitive(smsf_registrationJSON, "smsfSbiSupInd"); + if (smsf_sbi_sup_ind) { + if (!cJSON_IsBool(smsf_sbi_sup_ind)) { + ogs_error("OpenAPI_smsf_registration_parseFromJSON() failed [smsf_sbi_sup_ind]"); + goto end; + } + } + + udr_restart_ind = cJSON_GetObjectItemCaseSensitive(smsf_registrationJSON, "udrRestartInd"); + if (udr_restart_ind) { + if (!cJSON_IsBool(udr_restart_ind)) { + ogs_error("OpenAPI_smsf_registration_parseFromJSON() failed [udr_restart_ind]"); + goto end; + } + } + + last_synchronization_time = cJSON_GetObjectItemCaseSensitive(smsf_registrationJSON, "lastSynchronizationTime"); + if (last_synchronization_time) { + if (!cJSON_IsString(last_synchronization_time) && !cJSON_IsNull(last_synchronization_time)) { + ogs_error("OpenAPI_smsf_registration_parseFromJSON() failed [last_synchronization_time]"); + goto end; + } + } + smsf_registration_local_var = OpenAPI_smsf_registration_create ( ogs_strdup(smsf_instance_id->valuestring), smsf_set_id && !cJSON_IsNull(smsf_set_id) ? ogs_strdup(smsf_set_id->valuestring) : NULL, @@ -247,7 +377,14 @@ OpenAPI_smsf_registration_t *OpenAPI_smsf_registration_parseFromJSON(cJSON *smsf smsf_map_address && !cJSON_IsNull(smsf_map_address) ? ogs_strdup(smsf_map_address->valuestring) : NULL, smsf_diameter_address ? smsf_diameter_address_local_nonprim : NULL, registration_time && !cJSON_IsNull(registration_time) ? ogs_strdup(registration_time->valuestring) : NULL, - context_info ? context_info_local_nonprim : NULL + context_info ? context_info_local_nonprim : NULL, + data_restoration_callback_uri && !cJSON_IsNull(data_restoration_callback_uri) ? ogs_strdup(data_restoration_callback_uri->valuestring) : NULL, + reset_ids ? reset_idsList : NULL, + smsf_sbi_sup_ind ? true : false, + smsf_sbi_sup_ind ? smsf_sbi_sup_ind->valueint : 0, + udr_restart_ind ? true : false, + udr_restart_ind ? udr_restart_ind->valueint : 0, + last_synchronization_time && !cJSON_IsNull(last_synchronization_time) ? ogs_strdup(last_synchronization_time->valuestring) : NULL ); return smsf_registration_local_var; @@ -264,6 +401,13 @@ end: OpenAPI_context_info_free(context_info_local_nonprim); context_info_local_nonprim = NULL; } + if (reset_idsList) { + OpenAPI_list_for_each(reset_idsList, node) { + ogs_free(node->data); + } + OpenAPI_list_free(reset_idsList); + reset_idsList = NULL; + } return NULL; } diff --git a/lib/sbi/openapi/model/smsf_registration.h b/lib/sbi/openapi/model/smsf_registration.h index 5e0b423f4..08ff04cf6 100644 --- a/lib/sbi/openapi/model/smsf_registration.h +++ b/lib/sbi/openapi/model/smsf_registration.h @@ -30,6 +30,13 @@ typedef struct OpenAPI_smsf_registration_s { struct OpenAPI_network_node_diameter_address_s *smsf_diameter_address; char *registration_time; struct OpenAPI_context_info_s *context_info; + char *data_restoration_callback_uri; + OpenAPI_list_t *reset_ids; + bool is_smsf_sbi_sup_ind; + int smsf_sbi_sup_ind; + bool is_udr_restart_ind; + int udr_restart_ind; + char *last_synchronization_time; } OpenAPI_smsf_registration_t; OpenAPI_smsf_registration_t *OpenAPI_smsf_registration_create( @@ -40,7 +47,14 @@ OpenAPI_smsf_registration_t *OpenAPI_smsf_registration_create( char *smsf_map_address, OpenAPI_network_node_diameter_address_t *smsf_diameter_address, char *registration_time, - OpenAPI_context_info_t *context_info + OpenAPI_context_info_t *context_info, + char *data_restoration_callback_uri, + OpenAPI_list_t *reset_ids, + bool is_smsf_sbi_sup_ind, + int smsf_sbi_sup_ind, + bool is_udr_restart_ind, + int udr_restart_ind, + char *last_synchronization_time ); void OpenAPI_smsf_registration_free(OpenAPI_smsf_registration_t *smsf_registration); OpenAPI_smsf_registration_t *OpenAPI_smsf_registration_parseFromJSON(cJSON *smsf_registrationJSON); diff --git a/lib/sbi/openapi/model/snssai.h b/lib/sbi/openapi/model/snssai.h index e5aacc2f7..0e6cb0296 100644 --- a/lib/sbi/openapi/model/snssai.h +++ b/lib/sbi/openapi/model/snssai.h @@ -1,7 +1,7 @@ /* * snssai.h * - * + * When Snssai needs to be converted to string (e.g. when used in maps as key), the string shall be composed of one to three digits \"sst\" optionally followed by \"-\" and 6 hexadecimal digits \"sd\". */ #ifndef _OpenAPI_snssai_H_ diff --git a/lib/sbi/openapi/model/snssai_dnn_pair.c b/lib/sbi/openapi/model/snssai_dnn_pair.c new file mode 100644 index 000000000..bbf191cca --- /dev/null +++ b/lib/sbi/openapi/model/snssai_dnn_pair.c @@ -0,0 +1,149 @@ + +#include +#include +#include +#include "snssai_dnn_pair.h" + +OpenAPI_snssai_dnn_pair_t *OpenAPI_snssai_dnn_pair_create( + char *dnn, + OpenAPI_snssai_t *snssai +) +{ + OpenAPI_snssai_dnn_pair_t *snssai_dnn_pair_local_var = ogs_malloc(sizeof(OpenAPI_snssai_dnn_pair_t)); + ogs_assert(snssai_dnn_pair_local_var); + + snssai_dnn_pair_local_var->dnn = dnn; + snssai_dnn_pair_local_var->snssai = snssai; + + return snssai_dnn_pair_local_var; +} + +void OpenAPI_snssai_dnn_pair_free(OpenAPI_snssai_dnn_pair_t *snssai_dnn_pair) +{ + OpenAPI_lnode_t *node = NULL; + + if (NULL == snssai_dnn_pair) { + return; + } + if (snssai_dnn_pair->dnn) { + ogs_free(snssai_dnn_pair->dnn); + snssai_dnn_pair->dnn = NULL; + } + if (snssai_dnn_pair->snssai) { + OpenAPI_snssai_free(snssai_dnn_pair->snssai); + snssai_dnn_pair->snssai = NULL; + } + ogs_free(snssai_dnn_pair); +} + +cJSON *OpenAPI_snssai_dnn_pair_convertToJSON(OpenAPI_snssai_dnn_pair_t *snssai_dnn_pair) +{ + cJSON *item = NULL; + OpenAPI_lnode_t *node = NULL; + + if (snssai_dnn_pair == NULL) { + ogs_error("OpenAPI_snssai_dnn_pair_convertToJSON() failed [SnssaiDnnPair]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (!snssai_dnn_pair->dnn) { + ogs_error("OpenAPI_snssai_dnn_pair_convertToJSON() failed [dnn]"); + return NULL; + } + if (cJSON_AddStringToObject(item, "dnn", snssai_dnn_pair->dnn) == NULL) { + ogs_error("OpenAPI_snssai_dnn_pair_convertToJSON() failed [dnn]"); + goto end; + } + + if (!snssai_dnn_pair->snssai) { + ogs_error("OpenAPI_snssai_dnn_pair_convertToJSON() failed [snssai]"); + return NULL; + } + cJSON *snssai_local_JSON = OpenAPI_snssai_convertToJSON(snssai_dnn_pair->snssai); + if (snssai_local_JSON == NULL) { + ogs_error("OpenAPI_snssai_dnn_pair_convertToJSON() failed [snssai]"); + goto end; + } + cJSON_AddItemToObject(item, "snssai", snssai_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_snssai_dnn_pair_convertToJSON() failed [snssai]"); + goto end; + } + +end: + return item; +} + +OpenAPI_snssai_dnn_pair_t *OpenAPI_snssai_dnn_pair_parseFromJSON(cJSON *snssai_dnn_pairJSON) +{ + OpenAPI_snssai_dnn_pair_t *snssai_dnn_pair_local_var = NULL; + OpenAPI_lnode_t *node = NULL; + cJSON *dnn = NULL; + cJSON *snssai = NULL; + OpenAPI_snssai_t *snssai_local_nonprim = NULL; + dnn = cJSON_GetObjectItemCaseSensitive(snssai_dnn_pairJSON, "dnn"); + if (!dnn) { + ogs_error("OpenAPI_snssai_dnn_pair_parseFromJSON() failed [dnn]"); + goto end; + } + if (!cJSON_IsString(dnn)) { + ogs_error("OpenAPI_snssai_dnn_pair_parseFromJSON() failed [dnn]"); + goto end; + } + + snssai = cJSON_GetObjectItemCaseSensitive(snssai_dnn_pairJSON, "snssai"); + if (!snssai) { + ogs_error("OpenAPI_snssai_dnn_pair_parseFromJSON() failed [snssai]"); + goto end; + } + snssai_local_nonprim = OpenAPI_snssai_parseFromJSON(snssai); + + snssai_dnn_pair_local_var = OpenAPI_snssai_dnn_pair_create ( + ogs_strdup(dnn->valuestring), + snssai_local_nonprim + ); + + return snssai_dnn_pair_local_var; +end: + if (snssai_local_nonprim) { + OpenAPI_snssai_free(snssai_local_nonprim); + snssai_local_nonprim = NULL; + } + return NULL; +} + +OpenAPI_snssai_dnn_pair_t *OpenAPI_snssai_dnn_pair_copy(OpenAPI_snssai_dnn_pair_t *dst, OpenAPI_snssai_dnn_pair_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_snssai_dnn_pair_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_snssai_dnn_pair_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_snssai_dnn_pair_free(dst); + dst = OpenAPI_snssai_dnn_pair_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/snssai_dnn_pair.h b/lib/sbi/openapi/model/snssai_dnn_pair.h new file mode 100644 index 000000000..8b12c893c --- /dev/null +++ b/lib/sbi/openapi/model/snssai_dnn_pair.h @@ -0,0 +1,41 @@ +/* + * snssai_dnn_pair.h + * + * Contains a S-NSSAI and DNN combination. + */ + +#ifndef _OpenAPI_snssai_dnn_pair_H_ +#define _OpenAPI_snssai_dnn_pair_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "snssai.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_snssai_dnn_pair_s OpenAPI_snssai_dnn_pair_t; +typedef struct OpenAPI_snssai_dnn_pair_s { + char *dnn; + struct OpenAPI_snssai_s *snssai; +} OpenAPI_snssai_dnn_pair_t; + +OpenAPI_snssai_dnn_pair_t *OpenAPI_snssai_dnn_pair_create( + char *dnn, + OpenAPI_snssai_t *snssai +); +void OpenAPI_snssai_dnn_pair_free(OpenAPI_snssai_dnn_pair_t *snssai_dnn_pair); +OpenAPI_snssai_dnn_pair_t *OpenAPI_snssai_dnn_pair_parseFromJSON(cJSON *snssai_dnn_pairJSON); +cJSON *OpenAPI_snssai_dnn_pair_convertToJSON(OpenAPI_snssai_dnn_pair_t *snssai_dnn_pair); +OpenAPI_snssai_dnn_pair_t *OpenAPI_snssai_dnn_pair_copy(OpenAPI_snssai_dnn_pair_t *dst, OpenAPI_snssai_dnn_pair_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_snssai_dnn_pair_H_ */ + diff --git a/lib/sbi/openapi/model/snssai_easdf_info_item.c b/lib/sbi/openapi/model/snssai_easdf_info_item.c new file mode 100644 index 000000000..d3a27dba7 --- /dev/null +++ b/lib/sbi/openapi/model/snssai_easdf_info_item.c @@ -0,0 +1,186 @@ + +#include +#include +#include +#include "snssai_easdf_info_item.h" + +OpenAPI_snssai_easdf_info_item_t *OpenAPI_snssai_easdf_info_item_create( + OpenAPI_ext_snssai_t *s_nssai, + OpenAPI_list_t *dnn_easdf_info_list +) +{ + OpenAPI_snssai_easdf_info_item_t *snssai_easdf_info_item_local_var = ogs_malloc(sizeof(OpenAPI_snssai_easdf_info_item_t)); + ogs_assert(snssai_easdf_info_item_local_var); + + snssai_easdf_info_item_local_var->s_nssai = s_nssai; + snssai_easdf_info_item_local_var->dnn_easdf_info_list = dnn_easdf_info_list; + + return snssai_easdf_info_item_local_var; +} + +void OpenAPI_snssai_easdf_info_item_free(OpenAPI_snssai_easdf_info_item_t *snssai_easdf_info_item) +{ + OpenAPI_lnode_t *node = NULL; + + if (NULL == snssai_easdf_info_item) { + return; + } + if (snssai_easdf_info_item->s_nssai) { + OpenAPI_ext_snssai_free(snssai_easdf_info_item->s_nssai); + snssai_easdf_info_item->s_nssai = NULL; + } + if (snssai_easdf_info_item->dnn_easdf_info_list) { + OpenAPI_list_for_each(snssai_easdf_info_item->dnn_easdf_info_list, node) { + OpenAPI_dnn_easdf_info_item_free(node->data); + } + OpenAPI_list_free(snssai_easdf_info_item->dnn_easdf_info_list); + snssai_easdf_info_item->dnn_easdf_info_list = NULL; + } + ogs_free(snssai_easdf_info_item); +} + +cJSON *OpenAPI_snssai_easdf_info_item_convertToJSON(OpenAPI_snssai_easdf_info_item_t *snssai_easdf_info_item) +{ + cJSON *item = NULL; + OpenAPI_lnode_t *node = NULL; + + if (snssai_easdf_info_item == NULL) { + ogs_error("OpenAPI_snssai_easdf_info_item_convertToJSON() failed [SnssaiEasdfInfoItem]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (!snssai_easdf_info_item->s_nssai) { + ogs_error("OpenAPI_snssai_easdf_info_item_convertToJSON() failed [s_nssai]"); + return NULL; + } + cJSON *s_nssai_local_JSON = OpenAPI_ext_snssai_convertToJSON(snssai_easdf_info_item->s_nssai); + if (s_nssai_local_JSON == NULL) { + ogs_error("OpenAPI_snssai_easdf_info_item_convertToJSON() failed [s_nssai]"); + goto end; + } + cJSON_AddItemToObject(item, "sNssai", s_nssai_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_snssai_easdf_info_item_convertToJSON() failed [s_nssai]"); + goto end; + } + + if (!snssai_easdf_info_item->dnn_easdf_info_list) { + ogs_error("OpenAPI_snssai_easdf_info_item_convertToJSON() failed [dnn_easdf_info_list]"); + return NULL; + } + cJSON *dnn_easdf_info_listList = cJSON_AddArrayToObject(item, "dnnEasdfInfoList"); + if (dnn_easdf_info_listList == NULL) { + ogs_error("OpenAPI_snssai_easdf_info_item_convertToJSON() failed [dnn_easdf_info_list]"); + goto end; + } + OpenAPI_list_for_each(snssai_easdf_info_item->dnn_easdf_info_list, node) { + cJSON *itemLocal = OpenAPI_dnn_easdf_info_item_convertToJSON(node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_snssai_easdf_info_item_convertToJSON() failed [dnn_easdf_info_list]"); + goto end; + } + cJSON_AddItemToArray(dnn_easdf_info_listList, itemLocal); + } + +end: + return item; +} + +OpenAPI_snssai_easdf_info_item_t *OpenAPI_snssai_easdf_info_item_parseFromJSON(cJSON *snssai_easdf_info_itemJSON) +{ + OpenAPI_snssai_easdf_info_item_t *snssai_easdf_info_item_local_var = NULL; + OpenAPI_lnode_t *node = NULL; + cJSON *s_nssai = NULL; + OpenAPI_ext_snssai_t *s_nssai_local_nonprim = NULL; + cJSON *dnn_easdf_info_list = NULL; + OpenAPI_list_t *dnn_easdf_info_listList = NULL; + s_nssai = cJSON_GetObjectItemCaseSensitive(snssai_easdf_info_itemJSON, "sNssai"); + if (!s_nssai) { + ogs_error("OpenAPI_snssai_easdf_info_item_parseFromJSON() failed [s_nssai]"); + goto end; + } + s_nssai_local_nonprim = OpenAPI_ext_snssai_parseFromJSON(s_nssai); + + dnn_easdf_info_list = cJSON_GetObjectItemCaseSensitive(snssai_easdf_info_itemJSON, "dnnEasdfInfoList"); + if (!dnn_easdf_info_list) { + ogs_error("OpenAPI_snssai_easdf_info_item_parseFromJSON() failed [dnn_easdf_info_list]"); + goto end; + } + cJSON *dnn_easdf_info_list_local = NULL; + if (!cJSON_IsArray(dnn_easdf_info_list)) { + ogs_error("OpenAPI_snssai_easdf_info_item_parseFromJSON() failed [dnn_easdf_info_list]"); + goto end; + } + + dnn_easdf_info_listList = OpenAPI_list_create(); + + cJSON_ArrayForEach(dnn_easdf_info_list_local, dnn_easdf_info_list) { + if (!cJSON_IsObject(dnn_easdf_info_list_local)) { + ogs_error("OpenAPI_snssai_easdf_info_item_parseFromJSON() failed [dnn_easdf_info_list]"); + goto end; + } + OpenAPI_dnn_easdf_info_item_t *dnn_easdf_info_listItem = OpenAPI_dnn_easdf_info_item_parseFromJSON(dnn_easdf_info_list_local); + if (!dnn_easdf_info_listItem) { + ogs_error("No dnn_easdf_info_listItem"); + OpenAPI_list_free(dnn_easdf_info_listList); + goto end; + } + OpenAPI_list_add(dnn_easdf_info_listList, dnn_easdf_info_listItem); + } + + snssai_easdf_info_item_local_var = OpenAPI_snssai_easdf_info_item_create ( + s_nssai_local_nonprim, + dnn_easdf_info_listList + ); + + return snssai_easdf_info_item_local_var; +end: + if (s_nssai_local_nonprim) { + OpenAPI_ext_snssai_free(s_nssai_local_nonprim); + s_nssai_local_nonprim = NULL; + } + if (dnn_easdf_info_listList) { + OpenAPI_list_for_each(dnn_easdf_info_listList, node) { + OpenAPI_dnn_easdf_info_item_free(node->data); + } + OpenAPI_list_free(dnn_easdf_info_listList); + dnn_easdf_info_listList = NULL; + } + return NULL; +} + +OpenAPI_snssai_easdf_info_item_t *OpenAPI_snssai_easdf_info_item_copy(OpenAPI_snssai_easdf_info_item_t *dst, OpenAPI_snssai_easdf_info_item_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_snssai_easdf_info_item_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_snssai_easdf_info_item_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_snssai_easdf_info_item_free(dst); + dst = OpenAPI_snssai_easdf_info_item_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/snssai_easdf_info_item.h b/lib/sbi/openapi/model/snssai_easdf_info_item.h new file mode 100644 index 000000000..e01d04f8a --- /dev/null +++ b/lib/sbi/openapi/model/snssai_easdf_info_item.h @@ -0,0 +1,42 @@ +/* + * snssai_easdf_info_item.h + * + * Set of parameters supported by EASDF for a given S-NSSAI + */ + +#ifndef _OpenAPI_snssai_easdf_info_item_H_ +#define _OpenAPI_snssai_easdf_info_item_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "dnn_easdf_info_item.h" +#include "ext_snssai.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_snssai_easdf_info_item_s OpenAPI_snssai_easdf_info_item_t; +typedef struct OpenAPI_snssai_easdf_info_item_s { + struct OpenAPI_ext_snssai_s *s_nssai; + OpenAPI_list_t *dnn_easdf_info_list; +} OpenAPI_snssai_easdf_info_item_t; + +OpenAPI_snssai_easdf_info_item_t *OpenAPI_snssai_easdf_info_item_create( + OpenAPI_ext_snssai_t *s_nssai, + OpenAPI_list_t *dnn_easdf_info_list +); +void OpenAPI_snssai_easdf_info_item_free(OpenAPI_snssai_easdf_info_item_t *snssai_easdf_info_item); +OpenAPI_snssai_easdf_info_item_t *OpenAPI_snssai_easdf_info_item_parseFromJSON(cJSON *snssai_easdf_info_itemJSON); +cJSON *OpenAPI_snssai_easdf_info_item_convertToJSON(OpenAPI_snssai_easdf_info_item_t *snssai_easdf_info_item); +OpenAPI_snssai_easdf_info_item_t *OpenAPI_snssai_easdf_info_item_copy(OpenAPI_snssai_easdf_info_item_t *dst, OpenAPI_snssai_easdf_info_item_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_snssai_easdf_info_item_H_ */ + diff --git a/lib/sbi/openapi/model/snssai_extension.c b/lib/sbi/openapi/model/snssai_extension.c index 134c6c4c1..687f3b6ee 100644 --- a/lib/sbi/openapi/model/snssai_extension.c +++ b/lib/sbi/openapi/model/snssai_extension.c @@ -4,17 +4,38 @@ #include #include "snssai_extension.h" +char *OpenAPI_wildcard_sdsnssai_extension_ToString(OpenAPI_snssai_extension_wildcard_sd_e wildcard_sd) +{ + const char *wildcard_sdArray[] = { "NULL", "true" }; + size_t sizeofArray = sizeof(wildcard_sdArray) / sizeof(wildcard_sdArray[0]); + if (wildcard_sd < sizeofArray) + return (char *)wildcard_sdArray[wildcard_sd]; + else + return (char *)"Unknown"; +} + +OpenAPI_snssai_extension_wildcard_sd_e OpenAPI_wildcard_sdsnssai_extension_FromString(char* wildcard_sd) +{ + int stringToReturn = 0; + const char *wildcard_sdArray[] = { "NULL", "true" }; + size_t sizeofArray = sizeof(wildcard_sdArray) / sizeof(wildcard_sdArray[0]); + while (stringToReturn < sizeofArray) { + if (strcmp(wildcard_sd, wildcard_sdArray[stringToReturn]) == 0) { + return stringToReturn; + } + stringToReturn++; + } + return 0; +} OpenAPI_snssai_extension_t *OpenAPI_snssai_extension_create( OpenAPI_list_t *sd_ranges, - bool is_wildcard_sd, - int wildcard_sd + OpenAPI_snssai_extension_wildcard_sd_e wildcard_sd ) { OpenAPI_snssai_extension_t *snssai_extension_local_var = ogs_malloc(sizeof(OpenAPI_snssai_extension_t)); ogs_assert(snssai_extension_local_var); snssai_extension_local_var->sd_ranges = sd_ranges; - snssai_extension_local_var->is_wildcard_sd = is_wildcard_sd; snssai_extension_local_var->wildcard_sd = wildcard_sd; return snssai_extension_local_var; @@ -64,8 +85,8 @@ cJSON *OpenAPI_snssai_extension_convertToJSON(OpenAPI_snssai_extension_t *snssai } } - if (snssai_extension->is_wildcard_sd) { - if (cJSON_AddBoolToObject(item, "wildcardSd", snssai_extension->wildcard_sd) == NULL) { + if (snssai_extension->wildcard_sd != OpenAPI_snssai_extension_WILDCARDSD_NULL) { + if (cJSON_AddStringToObject(item, "wildcardSd", OpenAPI_wildcard_sdsnssai_extension_ToString(snssai_extension->wildcard_sd)) == NULL) { ogs_error("OpenAPI_snssai_extension_convertToJSON() failed [wildcard_sd]"); goto end; } @@ -82,6 +103,7 @@ OpenAPI_snssai_extension_t *OpenAPI_snssai_extension_parseFromJSON(cJSON *snssai cJSON *sd_ranges = NULL; OpenAPI_list_t *sd_rangesList = NULL; cJSON *wildcard_sd = NULL; + OpenAPI_snssai_extension_wildcard_sd_e wildcard_sdVariable = 0; sd_ranges = cJSON_GetObjectItemCaseSensitive(snssai_extensionJSON, "sdRanges"); if (sd_ranges) { cJSON *sd_ranges_local = NULL; @@ -109,16 +131,16 @@ OpenAPI_snssai_extension_t *OpenAPI_snssai_extension_parseFromJSON(cJSON *snssai wildcard_sd = cJSON_GetObjectItemCaseSensitive(snssai_extensionJSON, "wildcardSd"); if (wildcard_sd) { - if (!cJSON_IsBool(wildcard_sd)) { + if (!cJSON_IsString(wildcard_sd)) { ogs_error("OpenAPI_snssai_extension_parseFromJSON() failed [wildcard_sd]"); goto end; } + wildcard_sdVariable = OpenAPI_wildcard_sdsnssai_extension_FromString(wildcard_sd->valuestring); } snssai_extension_local_var = OpenAPI_snssai_extension_create ( sd_ranges ? sd_rangesList : NULL, - wildcard_sd ? true : false, - wildcard_sd ? wildcard_sd->valueint : 0 + wildcard_sd ? wildcard_sdVariable : 0 ); return snssai_extension_local_var; diff --git a/lib/sbi/openapi/model/snssai_extension.h b/lib/sbi/openapi/model/snssai_extension.h index 130a45e69..219bf3d97 100644 --- a/lib/sbi/openapi/model/snssai_extension.h +++ b/lib/sbi/openapi/model/snssai_extension.h @@ -1,7 +1,7 @@ /* * snssai_extension.h * - * Extensions to the Snssai data type + * Extensions to the Snssai data type, sdRanges and wildcardSd shall not be present simultaneously */ #ifndef _OpenAPI_snssai_extension_H_ @@ -19,16 +19,19 @@ extern "C" { #endif typedef struct OpenAPI_snssai_extension_s OpenAPI_snssai_extension_t; +typedef enum { OpenAPI_snssai_extension_WILDCARDSD_NULL = 0, OpenAPI_snssai_extension_WILDCARDSD__true } OpenAPI_snssai_extension_wildcard_sd_e; + +char* OpenAPI_snssai_extension_wildcard_sd_ToString(OpenAPI_snssai_extension_wildcard_sd_e wildcard_sd); + +OpenAPI_snssai_extension_wildcard_sd_e OpenAPI_snssai_extension_wildcard_sd_FromString(char* wildcard_sd); typedef struct OpenAPI_snssai_extension_s { OpenAPI_list_t *sd_ranges; - bool is_wildcard_sd; - int wildcard_sd; + OpenAPI_snssai_extension_wildcard_sd_e wildcard_sd; } OpenAPI_snssai_extension_t; OpenAPI_snssai_extension_t *OpenAPI_snssai_extension_create( OpenAPI_list_t *sd_ranges, - bool is_wildcard_sd, - int wildcard_sd + OpenAPI_snssai_extension_wildcard_sd_e wildcard_sd ); void OpenAPI_snssai_extension_free(OpenAPI_snssai_extension_t *snssai_extension); OpenAPI_snssai_extension_t *OpenAPI_snssai_extension_parseFromJSON(cJSON *snssai_extensionJSON); diff --git a/lib/sbi/openapi/model/snssai_info_item.c b/lib/sbi/openapi/model/snssai_info_item.c new file mode 100644 index 000000000..7e503d0d0 --- /dev/null +++ b/lib/sbi/openapi/model/snssai_info_item.c @@ -0,0 +1,186 @@ + +#include +#include +#include +#include "snssai_info_item.h" + +OpenAPI_snssai_info_item_t *OpenAPI_snssai_info_item_create( + OpenAPI_ext_snssai_t *s_nssai, + OpenAPI_list_t *dnn_info_list +) +{ + OpenAPI_snssai_info_item_t *snssai_info_item_local_var = ogs_malloc(sizeof(OpenAPI_snssai_info_item_t)); + ogs_assert(snssai_info_item_local_var); + + snssai_info_item_local_var->s_nssai = s_nssai; + snssai_info_item_local_var->dnn_info_list = dnn_info_list; + + return snssai_info_item_local_var; +} + +void OpenAPI_snssai_info_item_free(OpenAPI_snssai_info_item_t *snssai_info_item) +{ + OpenAPI_lnode_t *node = NULL; + + if (NULL == snssai_info_item) { + return; + } + if (snssai_info_item->s_nssai) { + OpenAPI_ext_snssai_free(snssai_info_item->s_nssai); + snssai_info_item->s_nssai = NULL; + } + if (snssai_info_item->dnn_info_list) { + OpenAPI_list_for_each(snssai_info_item->dnn_info_list, node) { + OpenAPI_dnn_info_item_free(node->data); + } + OpenAPI_list_free(snssai_info_item->dnn_info_list); + snssai_info_item->dnn_info_list = NULL; + } + ogs_free(snssai_info_item); +} + +cJSON *OpenAPI_snssai_info_item_convertToJSON(OpenAPI_snssai_info_item_t *snssai_info_item) +{ + cJSON *item = NULL; + OpenAPI_lnode_t *node = NULL; + + if (snssai_info_item == NULL) { + ogs_error("OpenAPI_snssai_info_item_convertToJSON() failed [SnssaiInfoItem]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (!snssai_info_item->s_nssai) { + ogs_error("OpenAPI_snssai_info_item_convertToJSON() failed [s_nssai]"); + return NULL; + } + cJSON *s_nssai_local_JSON = OpenAPI_ext_snssai_convertToJSON(snssai_info_item->s_nssai); + if (s_nssai_local_JSON == NULL) { + ogs_error("OpenAPI_snssai_info_item_convertToJSON() failed [s_nssai]"); + goto end; + } + cJSON_AddItemToObject(item, "sNssai", s_nssai_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_snssai_info_item_convertToJSON() failed [s_nssai]"); + goto end; + } + + if (!snssai_info_item->dnn_info_list) { + ogs_error("OpenAPI_snssai_info_item_convertToJSON() failed [dnn_info_list]"); + return NULL; + } + cJSON *dnn_info_listList = cJSON_AddArrayToObject(item, "dnnInfoList"); + if (dnn_info_listList == NULL) { + ogs_error("OpenAPI_snssai_info_item_convertToJSON() failed [dnn_info_list]"); + goto end; + } + OpenAPI_list_for_each(snssai_info_item->dnn_info_list, node) { + cJSON *itemLocal = OpenAPI_dnn_info_item_convertToJSON(node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_snssai_info_item_convertToJSON() failed [dnn_info_list]"); + goto end; + } + cJSON_AddItemToArray(dnn_info_listList, itemLocal); + } + +end: + return item; +} + +OpenAPI_snssai_info_item_t *OpenAPI_snssai_info_item_parseFromJSON(cJSON *snssai_info_itemJSON) +{ + OpenAPI_snssai_info_item_t *snssai_info_item_local_var = NULL; + OpenAPI_lnode_t *node = NULL; + cJSON *s_nssai = NULL; + OpenAPI_ext_snssai_t *s_nssai_local_nonprim = NULL; + cJSON *dnn_info_list = NULL; + OpenAPI_list_t *dnn_info_listList = NULL; + s_nssai = cJSON_GetObjectItemCaseSensitive(snssai_info_itemJSON, "sNssai"); + if (!s_nssai) { + ogs_error("OpenAPI_snssai_info_item_parseFromJSON() failed [s_nssai]"); + goto end; + } + s_nssai_local_nonprim = OpenAPI_ext_snssai_parseFromJSON(s_nssai); + + dnn_info_list = cJSON_GetObjectItemCaseSensitive(snssai_info_itemJSON, "dnnInfoList"); + if (!dnn_info_list) { + ogs_error("OpenAPI_snssai_info_item_parseFromJSON() failed [dnn_info_list]"); + goto end; + } + cJSON *dnn_info_list_local = NULL; + if (!cJSON_IsArray(dnn_info_list)) { + ogs_error("OpenAPI_snssai_info_item_parseFromJSON() failed [dnn_info_list]"); + goto end; + } + + dnn_info_listList = OpenAPI_list_create(); + + cJSON_ArrayForEach(dnn_info_list_local, dnn_info_list) { + if (!cJSON_IsObject(dnn_info_list_local)) { + ogs_error("OpenAPI_snssai_info_item_parseFromJSON() failed [dnn_info_list]"); + goto end; + } + OpenAPI_dnn_info_item_t *dnn_info_listItem = OpenAPI_dnn_info_item_parseFromJSON(dnn_info_list_local); + if (!dnn_info_listItem) { + ogs_error("No dnn_info_listItem"); + OpenAPI_list_free(dnn_info_listList); + goto end; + } + OpenAPI_list_add(dnn_info_listList, dnn_info_listItem); + } + + snssai_info_item_local_var = OpenAPI_snssai_info_item_create ( + s_nssai_local_nonprim, + dnn_info_listList + ); + + return snssai_info_item_local_var; +end: + if (s_nssai_local_nonprim) { + OpenAPI_ext_snssai_free(s_nssai_local_nonprim); + s_nssai_local_nonprim = NULL; + } + if (dnn_info_listList) { + OpenAPI_list_for_each(dnn_info_listList, node) { + OpenAPI_dnn_info_item_free(node->data); + } + OpenAPI_list_free(dnn_info_listList); + dnn_info_listList = NULL; + } + return NULL; +} + +OpenAPI_snssai_info_item_t *OpenAPI_snssai_info_item_copy(OpenAPI_snssai_info_item_t *dst, OpenAPI_snssai_info_item_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_snssai_info_item_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_snssai_info_item_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_snssai_info_item_free(dst); + dst = OpenAPI_snssai_info_item_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/snssai_info_item.h b/lib/sbi/openapi/model/snssai_info_item.h new file mode 100644 index 000000000..ff11b7a5b --- /dev/null +++ b/lib/sbi/openapi/model/snssai_info_item.h @@ -0,0 +1,42 @@ +/* + * snssai_info_item.h + * + * Parameters supported by an NF for a given S-NSSAI Set of parameters supported by NF for a given S-NSSAI + */ + +#ifndef _OpenAPI_snssai_info_item_H_ +#define _OpenAPI_snssai_info_item_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "dnn_info_item.h" +#include "ext_snssai.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_snssai_info_item_s OpenAPI_snssai_info_item_t; +typedef struct OpenAPI_snssai_info_item_s { + struct OpenAPI_ext_snssai_s *s_nssai; + OpenAPI_list_t *dnn_info_list; +} OpenAPI_snssai_info_item_t; + +OpenAPI_snssai_info_item_t *OpenAPI_snssai_info_item_create( + OpenAPI_ext_snssai_t *s_nssai, + OpenAPI_list_t *dnn_info_list +); +void OpenAPI_snssai_info_item_free(OpenAPI_snssai_info_item_t *snssai_info_item); +OpenAPI_snssai_info_item_t *OpenAPI_snssai_info_item_parseFromJSON(cJSON *snssai_info_itemJSON); +cJSON *OpenAPI_snssai_info_item_convertToJSON(OpenAPI_snssai_info_item_t *snssai_info_item); +OpenAPI_snssai_info_item_t *OpenAPI_snssai_info_item_copy(OpenAPI_snssai_info_item_t *dst, OpenAPI_snssai_info_item_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_snssai_info_item_H_ */ + diff --git a/lib/sbi/openapi/model/snssai_mb_smf_info_item.c b/lib/sbi/openapi/model/snssai_mb_smf_info_item.c new file mode 100644 index 000000000..e91a721cb --- /dev/null +++ b/lib/sbi/openapi/model/snssai_mb_smf_info_item.c @@ -0,0 +1,186 @@ + +#include +#include +#include +#include "snssai_mb_smf_info_item.h" + +OpenAPI_snssai_mb_smf_info_item_t *OpenAPI_snssai_mb_smf_info_item_create( + OpenAPI_ext_snssai_t *s_nssai, + OpenAPI_list_t *dnn_info_list +) +{ + OpenAPI_snssai_mb_smf_info_item_t *snssai_mb_smf_info_item_local_var = ogs_malloc(sizeof(OpenAPI_snssai_mb_smf_info_item_t)); + ogs_assert(snssai_mb_smf_info_item_local_var); + + snssai_mb_smf_info_item_local_var->s_nssai = s_nssai; + snssai_mb_smf_info_item_local_var->dnn_info_list = dnn_info_list; + + return snssai_mb_smf_info_item_local_var; +} + +void OpenAPI_snssai_mb_smf_info_item_free(OpenAPI_snssai_mb_smf_info_item_t *snssai_mb_smf_info_item) +{ + OpenAPI_lnode_t *node = NULL; + + if (NULL == snssai_mb_smf_info_item) { + return; + } + if (snssai_mb_smf_info_item->s_nssai) { + OpenAPI_ext_snssai_free(snssai_mb_smf_info_item->s_nssai); + snssai_mb_smf_info_item->s_nssai = NULL; + } + if (snssai_mb_smf_info_item->dnn_info_list) { + OpenAPI_list_for_each(snssai_mb_smf_info_item->dnn_info_list, node) { + OpenAPI_dnn_mb_smf_info_item_free(node->data); + } + OpenAPI_list_free(snssai_mb_smf_info_item->dnn_info_list); + snssai_mb_smf_info_item->dnn_info_list = NULL; + } + ogs_free(snssai_mb_smf_info_item); +} + +cJSON *OpenAPI_snssai_mb_smf_info_item_convertToJSON(OpenAPI_snssai_mb_smf_info_item_t *snssai_mb_smf_info_item) +{ + cJSON *item = NULL; + OpenAPI_lnode_t *node = NULL; + + if (snssai_mb_smf_info_item == NULL) { + ogs_error("OpenAPI_snssai_mb_smf_info_item_convertToJSON() failed [SnssaiMbSmfInfoItem]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (!snssai_mb_smf_info_item->s_nssai) { + ogs_error("OpenAPI_snssai_mb_smf_info_item_convertToJSON() failed [s_nssai]"); + return NULL; + } + cJSON *s_nssai_local_JSON = OpenAPI_ext_snssai_convertToJSON(snssai_mb_smf_info_item->s_nssai); + if (s_nssai_local_JSON == NULL) { + ogs_error("OpenAPI_snssai_mb_smf_info_item_convertToJSON() failed [s_nssai]"); + goto end; + } + cJSON_AddItemToObject(item, "sNssai", s_nssai_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_snssai_mb_smf_info_item_convertToJSON() failed [s_nssai]"); + goto end; + } + + if (!snssai_mb_smf_info_item->dnn_info_list) { + ogs_error("OpenAPI_snssai_mb_smf_info_item_convertToJSON() failed [dnn_info_list]"); + return NULL; + } + cJSON *dnn_info_listList = cJSON_AddArrayToObject(item, "dnnInfoList"); + if (dnn_info_listList == NULL) { + ogs_error("OpenAPI_snssai_mb_smf_info_item_convertToJSON() failed [dnn_info_list]"); + goto end; + } + OpenAPI_list_for_each(snssai_mb_smf_info_item->dnn_info_list, node) { + cJSON *itemLocal = OpenAPI_dnn_mb_smf_info_item_convertToJSON(node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_snssai_mb_smf_info_item_convertToJSON() failed [dnn_info_list]"); + goto end; + } + cJSON_AddItemToArray(dnn_info_listList, itemLocal); + } + +end: + return item; +} + +OpenAPI_snssai_mb_smf_info_item_t *OpenAPI_snssai_mb_smf_info_item_parseFromJSON(cJSON *snssai_mb_smf_info_itemJSON) +{ + OpenAPI_snssai_mb_smf_info_item_t *snssai_mb_smf_info_item_local_var = NULL; + OpenAPI_lnode_t *node = NULL; + cJSON *s_nssai = NULL; + OpenAPI_ext_snssai_t *s_nssai_local_nonprim = NULL; + cJSON *dnn_info_list = NULL; + OpenAPI_list_t *dnn_info_listList = NULL; + s_nssai = cJSON_GetObjectItemCaseSensitive(snssai_mb_smf_info_itemJSON, "sNssai"); + if (!s_nssai) { + ogs_error("OpenAPI_snssai_mb_smf_info_item_parseFromJSON() failed [s_nssai]"); + goto end; + } + s_nssai_local_nonprim = OpenAPI_ext_snssai_parseFromJSON(s_nssai); + + dnn_info_list = cJSON_GetObjectItemCaseSensitive(snssai_mb_smf_info_itemJSON, "dnnInfoList"); + if (!dnn_info_list) { + ogs_error("OpenAPI_snssai_mb_smf_info_item_parseFromJSON() failed [dnn_info_list]"); + goto end; + } + cJSON *dnn_info_list_local = NULL; + if (!cJSON_IsArray(dnn_info_list)) { + ogs_error("OpenAPI_snssai_mb_smf_info_item_parseFromJSON() failed [dnn_info_list]"); + goto end; + } + + dnn_info_listList = OpenAPI_list_create(); + + cJSON_ArrayForEach(dnn_info_list_local, dnn_info_list) { + if (!cJSON_IsObject(dnn_info_list_local)) { + ogs_error("OpenAPI_snssai_mb_smf_info_item_parseFromJSON() failed [dnn_info_list]"); + goto end; + } + OpenAPI_dnn_mb_smf_info_item_t *dnn_info_listItem = OpenAPI_dnn_mb_smf_info_item_parseFromJSON(dnn_info_list_local); + if (!dnn_info_listItem) { + ogs_error("No dnn_info_listItem"); + OpenAPI_list_free(dnn_info_listList); + goto end; + } + OpenAPI_list_add(dnn_info_listList, dnn_info_listItem); + } + + snssai_mb_smf_info_item_local_var = OpenAPI_snssai_mb_smf_info_item_create ( + s_nssai_local_nonprim, + dnn_info_listList + ); + + return snssai_mb_smf_info_item_local_var; +end: + if (s_nssai_local_nonprim) { + OpenAPI_ext_snssai_free(s_nssai_local_nonprim); + s_nssai_local_nonprim = NULL; + } + if (dnn_info_listList) { + OpenAPI_list_for_each(dnn_info_listList, node) { + OpenAPI_dnn_mb_smf_info_item_free(node->data); + } + OpenAPI_list_free(dnn_info_listList); + dnn_info_listList = NULL; + } + return NULL; +} + +OpenAPI_snssai_mb_smf_info_item_t *OpenAPI_snssai_mb_smf_info_item_copy(OpenAPI_snssai_mb_smf_info_item_t *dst, OpenAPI_snssai_mb_smf_info_item_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_snssai_mb_smf_info_item_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_snssai_mb_smf_info_item_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_snssai_mb_smf_info_item_free(dst); + dst = OpenAPI_snssai_mb_smf_info_item_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/snssai_mb_smf_info_item.h b/lib/sbi/openapi/model/snssai_mb_smf_info_item.h new file mode 100644 index 000000000..bfc114888 --- /dev/null +++ b/lib/sbi/openapi/model/snssai_mb_smf_info_item.h @@ -0,0 +1,42 @@ +/* + * snssai_mb_smf_info_item.h + * + * Parameters supported by an MB-SMF for a given S-NSSAI + */ + +#ifndef _OpenAPI_snssai_mb_smf_info_item_H_ +#define _OpenAPI_snssai_mb_smf_info_item_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "dnn_mb_smf_info_item.h" +#include "ext_snssai.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_snssai_mb_smf_info_item_s OpenAPI_snssai_mb_smf_info_item_t; +typedef struct OpenAPI_snssai_mb_smf_info_item_s { + struct OpenAPI_ext_snssai_s *s_nssai; + OpenAPI_list_t *dnn_info_list; +} OpenAPI_snssai_mb_smf_info_item_t; + +OpenAPI_snssai_mb_smf_info_item_t *OpenAPI_snssai_mb_smf_info_item_create( + OpenAPI_ext_snssai_t *s_nssai, + OpenAPI_list_t *dnn_info_list +); +void OpenAPI_snssai_mb_smf_info_item_free(OpenAPI_snssai_mb_smf_info_item_t *snssai_mb_smf_info_item); +OpenAPI_snssai_mb_smf_info_item_t *OpenAPI_snssai_mb_smf_info_item_parseFromJSON(cJSON *snssai_mb_smf_info_itemJSON); +cJSON *OpenAPI_snssai_mb_smf_info_item_convertToJSON(OpenAPI_snssai_mb_smf_info_item_t *snssai_mb_smf_info_item); +OpenAPI_snssai_mb_smf_info_item_t *OpenAPI_snssai_mb_smf_info_item_copy(OpenAPI_snssai_mb_smf_info_item_t *dst, OpenAPI_snssai_mb_smf_info_item_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_snssai_mb_smf_info_item_H_ */ + diff --git a/lib/sbi/openapi/model/snssai_route_selection_descriptor.h b/lib/sbi/openapi/model/snssai_route_selection_descriptor.h index 302e37ffb..6b3aad5ca 100644 --- a/lib/sbi/openapi/model/snssai_route_selection_descriptor.h +++ b/lib/sbi/openapi/model/snssai_route_selection_descriptor.h @@ -1,7 +1,7 @@ /* * snssai_route_selection_descriptor.h * - * Contains the route selector parameters (DNNs, PDU session types, SSC modes and ATSSS information) per SNSSAI + * Contains the route selector parameters (DNNs, PDU session types, SSC modes and ATSSS information) per SNSSAI */ #ifndef _OpenAPI_snssai_route_selection_descriptor_H_ diff --git a/lib/sbi/openapi/model/snssai_smf_info_item.c b/lib/sbi/openapi/model/snssai_smf_info_item.c index 82ee02e85..886aa3f82 100644 --- a/lib/sbi/openapi/model/snssai_smf_info_item.c +++ b/lib/sbi/openapi/model/snssai_smf_info_item.c @@ -5,7 +5,7 @@ #include "snssai_smf_info_item.h" OpenAPI_snssai_smf_info_item_t *OpenAPI_snssai_smf_info_item_create( - OpenAPI_snssai_t *s_nssai, + OpenAPI_ext_snssai_t *s_nssai, OpenAPI_list_t *dnn_smf_info_list ) { @@ -26,7 +26,7 @@ void OpenAPI_snssai_smf_info_item_free(OpenAPI_snssai_smf_info_item_t *snssai_sm return; } if (snssai_smf_info_item->s_nssai) { - OpenAPI_snssai_free(snssai_smf_info_item->s_nssai); + OpenAPI_ext_snssai_free(snssai_smf_info_item->s_nssai); snssai_smf_info_item->s_nssai = NULL; } if (snssai_smf_info_item->dnn_smf_info_list) { @@ -54,7 +54,7 @@ cJSON *OpenAPI_snssai_smf_info_item_convertToJSON(OpenAPI_snssai_smf_info_item_t ogs_error("OpenAPI_snssai_smf_info_item_convertToJSON() failed [s_nssai]"); return NULL; } - cJSON *s_nssai_local_JSON = OpenAPI_snssai_convertToJSON(snssai_smf_info_item->s_nssai); + cJSON *s_nssai_local_JSON = OpenAPI_ext_snssai_convertToJSON(snssai_smf_info_item->s_nssai); if (s_nssai_local_JSON == NULL) { ogs_error("OpenAPI_snssai_smf_info_item_convertToJSON() failed [s_nssai]"); goto end; @@ -92,7 +92,7 @@ OpenAPI_snssai_smf_info_item_t *OpenAPI_snssai_smf_info_item_parseFromJSON(cJSON OpenAPI_snssai_smf_info_item_t *snssai_smf_info_item_local_var = NULL; OpenAPI_lnode_t *node = NULL; cJSON *s_nssai = NULL; - OpenAPI_snssai_t *s_nssai_local_nonprim = NULL; + OpenAPI_ext_snssai_t *s_nssai_local_nonprim = NULL; cJSON *dnn_smf_info_list = NULL; OpenAPI_list_t *dnn_smf_info_listList = NULL; s_nssai = cJSON_GetObjectItemCaseSensitive(snssai_smf_info_itemJSON, "sNssai"); @@ -100,7 +100,7 @@ OpenAPI_snssai_smf_info_item_t *OpenAPI_snssai_smf_info_item_parseFromJSON(cJSON ogs_error("OpenAPI_snssai_smf_info_item_parseFromJSON() failed [s_nssai]"); goto end; } - s_nssai_local_nonprim = OpenAPI_snssai_parseFromJSON(s_nssai); + s_nssai_local_nonprim = OpenAPI_ext_snssai_parseFromJSON(s_nssai); dnn_smf_info_list = cJSON_GetObjectItemCaseSensitive(snssai_smf_info_itemJSON, "dnnSmfInfoList"); if (!dnn_smf_info_list) { @@ -137,7 +137,7 @@ OpenAPI_snssai_smf_info_item_t *OpenAPI_snssai_smf_info_item_parseFromJSON(cJSON return snssai_smf_info_item_local_var; end: if (s_nssai_local_nonprim) { - OpenAPI_snssai_free(s_nssai_local_nonprim); + OpenAPI_ext_snssai_free(s_nssai_local_nonprim); s_nssai_local_nonprim = NULL; } if (dnn_smf_info_listList) { diff --git a/lib/sbi/openapi/model/snssai_smf_info_item.h b/lib/sbi/openapi/model/snssai_smf_info_item.h index 62443bddf..f45c4a242 100644 --- a/lib/sbi/openapi/model/snssai_smf_info_item.h +++ b/lib/sbi/openapi/model/snssai_smf_info_item.h @@ -13,7 +13,7 @@ #include "../include/keyValuePair.h" #include "../include/binary.h" #include "dnn_smf_info_item.h" -#include "snssai.h" +#include "ext_snssai.h" #ifdef __cplusplus extern "C" { @@ -21,12 +21,12 @@ extern "C" { typedef struct OpenAPI_snssai_smf_info_item_s OpenAPI_snssai_smf_info_item_t; typedef struct OpenAPI_snssai_smf_info_item_s { - struct OpenAPI_snssai_s *s_nssai; + struct OpenAPI_ext_snssai_s *s_nssai; OpenAPI_list_t *dnn_smf_info_list; } OpenAPI_snssai_smf_info_item_t; OpenAPI_snssai_smf_info_item_t *OpenAPI_snssai_smf_info_item_create( - OpenAPI_snssai_t *s_nssai, + OpenAPI_ext_snssai_t *s_nssai, OpenAPI_list_t *dnn_smf_info_list ); void OpenAPI_snssai_smf_info_item_free(OpenAPI_snssai_smf_info_item_t *snssai_smf_info_item); diff --git a/lib/sbi/openapi/model/snssai_tsctsf_info_item.c b/lib/sbi/openapi/model/snssai_tsctsf_info_item.c new file mode 100644 index 000000000..4f3a6384b --- /dev/null +++ b/lib/sbi/openapi/model/snssai_tsctsf_info_item.c @@ -0,0 +1,186 @@ + +#include +#include +#include +#include "snssai_tsctsf_info_item.h" + +OpenAPI_snssai_tsctsf_info_item_t *OpenAPI_snssai_tsctsf_info_item_create( + OpenAPI_ext_snssai_t *s_nssai, + OpenAPI_list_t *dnn_info_list +) +{ + OpenAPI_snssai_tsctsf_info_item_t *snssai_tsctsf_info_item_local_var = ogs_malloc(sizeof(OpenAPI_snssai_tsctsf_info_item_t)); + ogs_assert(snssai_tsctsf_info_item_local_var); + + snssai_tsctsf_info_item_local_var->s_nssai = s_nssai; + snssai_tsctsf_info_item_local_var->dnn_info_list = dnn_info_list; + + return snssai_tsctsf_info_item_local_var; +} + +void OpenAPI_snssai_tsctsf_info_item_free(OpenAPI_snssai_tsctsf_info_item_t *snssai_tsctsf_info_item) +{ + OpenAPI_lnode_t *node = NULL; + + if (NULL == snssai_tsctsf_info_item) { + return; + } + if (snssai_tsctsf_info_item->s_nssai) { + OpenAPI_ext_snssai_free(snssai_tsctsf_info_item->s_nssai); + snssai_tsctsf_info_item->s_nssai = NULL; + } + if (snssai_tsctsf_info_item->dnn_info_list) { + OpenAPI_list_for_each(snssai_tsctsf_info_item->dnn_info_list, node) { + OpenAPI_dnn_tsctsf_info_item_free(node->data); + } + OpenAPI_list_free(snssai_tsctsf_info_item->dnn_info_list); + snssai_tsctsf_info_item->dnn_info_list = NULL; + } + ogs_free(snssai_tsctsf_info_item); +} + +cJSON *OpenAPI_snssai_tsctsf_info_item_convertToJSON(OpenAPI_snssai_tsctsf_info_item_t *snssai_tsctsf_info_item) +{ + cJSON *item = NULL; + OpenAPI_lnode_t *node = NULL; + + if (snssai_tsctsf_info_item == NULL) { + ogs_error("OpenAPI_snssai_tsctsf_info_item_convertToJSON() failed [SnssaiTsctsfInfoItem]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (!snssai_tsctsf_info_item->s_nssai) { + ogs_error("OpenAPI_snssai_tsctsf_info_item_convertToJSON() failed [s_nssai]"); + return NULL; + } + cJSON *s_nssai_local_JSON = OpenAPI_ext_snssai_convertToJSON(snssai_tsctsf_info_item->s_nssai); + if (s_nssai_local_JSON == NULL) { + ogs_error("OpenAPI_snssai_tsctsf_info_item_convertToJSON() failed [s_nssai]"); + goto end; + } + cJSON_AddItemToObject(item, "sNssai", s_nssai_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_snssai_tsctsf_info_item_convertToJSON() failed [s_nssai]"); + goto end; + } + + if (!snssai_tsctsf_info_item->dnn_info_list) { + ogs_error("OpenAPI_snssai_tsctsf_info_item_convertToJSON() failed [dnn_info_list]"); + return NULL; + } + cJSON *dnn_info_listList = cJSON_AddArrayToObject(item, "dnnInfoList"); + if (dnn_info_listList == NULL) { + ogs_error("OpenAPI_snssai_tsctsf_info_item_convertToJSON() failed [dnn_info_list]"); + goto end; + } + OpenAPI_list_for_each(snssai_tsctsf_info_item->dnn_info_list, node) { + cJSON *itemLocal = OpenAPI_dnn_tsctsf_info_item_convertToJSON(node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_snssai_tsctsf_info_item_convertToJSON() failed [dnn_info_list]"); + goto end; + } + cJSON_AddItemToArray(dnn_info_listList, itemLocal); + } + +end: + return item; +} + +OpenAPI_snssai_tsctsf_info_item_t *OpenAPI_snssai_tsctsf_info_item_parseFromJSON(cJSON *snssai_tsctsf_info_itemJSON) +{ + OpenAPI_snssai_tsctsf_info_item_t *snssai_tsctsf_info_item_local_var = NULL; + OpenAPI_lnode_t *node = NULL; + cJSON *s_nssai = NULL; + OpenAPI_ext_snssai_t *s_nssai_local_nonprim = NULL; + cJSON *dnn_info_list = NULL; + OpenAPI_list_t *dnn_info_listList = NULL; + s_nssai = cJSON_GetObjectItemCaseSensitive(snssai_tsctsf_info_itemJSON, "sNssai"); + if (!s_nssai) { + ogs_error("OpenAPI_snssai_tsctsf_info_item_parseFromJSON() failed [s_nssai]"); + goto end; + } + s_nssai_local_nonprim = OpenAPI_ext_snssai_parseFromJSON(s_nssai); + + dnn_info_list = cJSON_GetObjectItemCaseSensitive(snssai_tsctsf_info_itemJSON, "dnnInfoList"); + if (!dnn_info_list) { + ogs_error("OpenAPI_snssai_tsctsf_info_item_parseFromJSON() failed [dnn_info_list]"); + goto end; + } + cJSON *dnn_info_list_local = NULL; + if (!cJSON_IsArray(dnn_info_list)) { + ogs_error("OpenAPI_snssai_tsctsf_info_item_parseFromJSON() failed [dnn_info_list]"); + goto end; + } + + dnn_info_listList = OpenAPI_list_create(); + + cJSON_ArrayForEach(dnn_info_list_local, dnn_info_list) { + if (!cJSON_IsObject(dnn_info_list_local)) { + ogs_error("OpenAPI_snssai_tsctsf_info_item_parseFromJSON() failed [dnn_info_list]"); + goto end; + } + OpenAPI_dnn_tsctsf_info_item_t *dnn_info_listItem = OpenAPI_dnn_tsctsf_info_item_parseFromJSON(dnn_info_list_local); + if (!dnn_info_listItem) { + ogs_error("No dnn_info_listItem"); + OpenAPI_list_free(dnn_info_listList); + goto end; + } + OpenAPI_list_add(dnn_info_listList, dnn_info_listItem); + } + + snssai_tsctsf_info_item_local_var = OpenAPI_snssai_tsctsf_info_item_create ( + s_nssai_local_nonprim, + dnn_info_listList + ); + + return snssai_tsctsf_info_item_local_var; +end: + if (s_nssai_local_nonprim) { + OpenAPI_ext_snssai_free(s_nssai_local_nonprim); + s_nssai_local_nonprim = NULL; + } + if (dnn_info_listList) { + OpenAPI_list_for_each(dnn_info_listList, node) { + OpenAPI_dnn_tsctsf_info_item_free(node->data); + } + OpenAPI_list_free(dnn_info_listList); + dnn_info_listList = NULL; + } + return NULL; +} + +OpenAPI_snssai_tsctsf_info_item_t *OpenAPI_snssai_tsctsf_info_item_copy(OpenAPI_snssai_tsctsf_info_item_t *dst, OpenAPI_snssai_tsctsf_info_item_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_snssai_tsctsf_info_item_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_snssai_tsctsf_info_item_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_snssai_tsctsf_info_item_free(dst); + dst = OpenAPI_snssai_tsctsf_info_item_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/snssai_tsctsf_info_item.h b/lib/sbi/openapi/model/snssai_tsctsf_info_item.h new file mode 100644 index 000000000..269018100 --- /dev/null +++ b/lib/sbi/openapi/model/snssai_tsctsf_info_item.h @@ -0,0 +1,42 @@ +/* + * snssai_tsctsf_info_item.h + * + * Set of parameters supported by TSCTSF for a given S-NSSAI + */ + +#ifndef _OpenAPI_snssai_tsctsf_info_item_H_ +#define _OpenAPI_snssai_tsctsf_info_item_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "dnn_tsctsf_info_item.h" +#include "ext_snssai.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_snssai_tsctsf_info_item_s OpenAPI_snssai_tsctsf_info_item_t; +typedef struct OpenAPI_snssai_tsctsf_info_item_s { + struct OpenAPI_ext_snssai_s *s_nssai; + OpenAPI_list_t *dnn_info_list; +} OpenAPI_snssai_tsctsf_info_item_t; + +OpenAPI_snssai_tsctsf_info_item_t *OpenAPI_snssai_tsctsf_info_item_create( + OpenAPI_ext_snssai_t *s_nssai, + OpenAPI_list_t *dnn_info_list +); +void OpenAPI_snssai_tsctsf_info_item_free(OpenAPI_snssai_tsctsf_info_item_t *snssai_tsctsf_info_item); +OpenAPI_snssai_tsctsf_info_item_t *OpenAPI_snssai_tsctsf_info_item_parseFromJSON(cJSON *snssai_tsctsf_info_itemJSON); +cJSON *OpenAPI_snssai_tsctsf_info_item_convertToJSON(OpenAPI_snssai_tsctsf_info_item_t *snssai_tsctsf_info_item); +OpenAPI_snssai_tsctsf_info_item_t *OpenAPI_snssai_tsctsf_info_item_copy(OpenAPI_snssai_tsctsf_info_item_t *dst, OpenAPI_snssai_tsctsf_info_item_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_snssai_tsctsf_info_item_H_ */ + diff --git a/lib/sbi/openapi/model/snssai_upf_info_item.c b/lib/sbi/openapi/model/snssai_upf_info_item.c index fda0234c5..6038e6cff 100644 --- a/lib/sbi/openapi/model/snssai_upf_info_item.c +++ b/lib/sbi/openapi/model/snssai_upf_info_item.c @@ -5,7 +5,7 @@ #include "snssai_upf_info_item.h" OpenAPI_snssai_upf_info_item_t *OpenAPI_snssai_upf_info_item_create( - OpenAPI_snssai_t *s_nssai, + OpenAPI_ext_snssai_t *s_nssai, OpenAPI_list_t *dnn_upf_info_list, bool is_redundant_transport, int redundant_transport @@ -30,7 +30,7 @@ void OpenAPI_snssai_upf_info_item_free(OpenAPI_snssai_upf_info_item_t *snssai_up return; } if (snssai_upf_info_item->s_nssai) { - OpenAPI_snssai_free(snssai_upf_info_item->s_nssai); + OpenAPI_ext_snssai_free(snssai_upf_info_item->s_nssai); snssai_upf_info_item->s_nssai = NULL; } if (snssai_upf_info_item->dnn_upf_info_list) { @@ -58,7 +58,7 @@ cJSON *OpenAPI_snssai_upf_info_item_convertToJSON(OpenAPI_snssai_upf_info_item_t ogs_error("OpenAPI_snssai_upf_info_item_convertToJSON() failed [s_nssai]"); return NULL; } - cJSON *s_nssai_local_JSON = OpenAPI_snssai_convertToJSON(snssai_upf_info_item->s_nssai); + cJSON *s_nssai_local_JSON = OpenAPI_ext_snssai_convertToJSON(snssai_upf_info_item->s_nssai); if (s_nssai_local_JSON == NULL) { ogs_error("OpenAPI_snssai_upf_info_item_convertToJSON() failed [s_nssai]"); goto end; @@ -103,7 +103,7 @@ OpenAPI_snssai_upf_info_item_t *OpenAPI_snssai_upf_info_item_parseFromJSON(cJSON OpenAPI_snssai_upf_info_item_t *snssai_upf_info_item_local_var = NULL; OpenAPI_lnode_t *node = NULL; cJSON *s_nssai = NULL; - OpenAPI_snssai_t *s_nssai_local_nonprim = NULL; + OpenAPI_ext_snssai_t *s_nssai_local_nonprim = NULL; cJSON *dnn_upf_info_list = NULL; OpenAPI_list_t *dnn_upf_info_listList = NULL; cJSON *redundant_transport = NULL; @@ -112,7 +112,7 @@ OpenAPI_snssai_upf_info_item_t *OpenAPI_snssai_upf_info_item_parseFromJSON(cJSON ogs_error("OpenAPI_snssai_upf_info_item_parseFromJSON() failed [s_nssai]"); goto end; } - s_nssai_local_nonprim = OpenAPI_snssai_parseFromJSON(s_nssai); + s_nssai_local_nonprim = OpenAPI_ext_snssai_parseFromJSON(s_nssai); dnn_upf_info_list = cJSON_GetObjectItemCaseSensitive(snssai_upf_info_itemJSON, "dnnUpfInfoList"); if (!dnn_upf_info_list) { @@ -159,7 +159,7 @@ OpenAPI_snssai_upf_info_item_t *OpenAPI_snssai_upf_info_item_parseFromJSON(cJSON return snssai_upf_info_item_local_var; end: if (s_nssai_local_nonprim) { - OpenAPI_snssai_free(s_nssai_local_nonprim); + OpenAPI_ext_snssai_free(s_nssai_local_nonprim); s_nssai_local_nonprim = NULL; } if (dnn_upf_info_listList) { diff --git a/lib/sbi/openapi/model/snssai_upf_info_item.h b/lib/sbi/openapi/model/snssai_upf_info_item.h index d85aa9271..fe9a8213a 100644 --- a/lib/sbi/openapi/model/snssai_upf_info_item.h +++ b/lib/sbi/openapi/model/snssai_upf_info_item.h @@ -13,7 +13,7 @@ #include "../include/keyValuePair.h" #include "../include/binary.h" #include "dnn_upf_info_item.h" -#include "snssai.h" +#include "ext_snssai.h" #ifdef __cplusplus extern "C" { @@ -21,14 +21,14 @@ extern "C" { typedef struct OpenAPI_snssai_upf_info_item_s OpenAPI_snssai_upf_info_item_t; typedef struct OpenAPI_snssai_upf_info_item_s { - struct OpenAPI_snssai_s *s_nssai; + struct OpenAPI_ext_snssai_s *s_nssai; OpenAPI_list_t *dnn_upf_info_list; bool is_redundant_transport; int redundant_transport; } OpenAPI_snssai_upf_info_item_t; OpenAPI_snssai_upf_info_item_t *OpenAPI_snssai_upf_info_item_create( - OpenAPI_snssai_t *s_nssai, + OpenAPI_ext_snssai_t *s_nssai, OpenAPI_list_t *dnn_upf_info_list, bool is_redundant_transport, int redundant_transport diff --git a/lib/sbi/openapi/model/sor_data.c b/lib/sbi/openapi/model/sor_data.c index 2f4cc5bbd..e590952f2 100644 --- a/lib/sbi/openapi/model/sor_data.c +++ b/lib/sbi/openapi/model/sor_data.c @@ -8,7 +8,9 @@ OpenAPI_sor_data_t *OpenAPI_sor_data_create( char *provisioning_time, OpenAPI_ue_update_status_e ue_update_status, char *sor_xmac_iue, - char *sor_mac_iue + char *sor_mac_iue, + bool is_me_support_of_sor_cmci, + int me_support_of_sor_cmci ) { OpenAPI_sor_data_t *sor_data_local_var = ogs_malloc(sizeof(OpenAPI_sor_data_t)); @@ -18,6 +20,8 @@ OpenAPI_sor_data_t *OpenAPI_sor_data_create( sor_data_local_var->ue_update_status = ue_update_status; sor_data_local_var->sor_xmac_iue = sor_xmac_iue; sor_data_local_var->sor_mac_iue = sor_mac_iue; + sor_data_local_var->is_me_support_of_sor_cmci = is_me_support_of_sor_cmci; + sor_data_local_var->me_support_of_sor_cmci = me_support_of_sor_cmci; return sor_data_local_var; } @@ -87,6 +91,13 @@ cJSON *OpenAPI_sor_data_convertToJSON(OpenAPI_sor_data_t *sor_data) } } + if (sor_data->is_me_support_of_sor_cmci) { + if (cJSON_AddBoolToObject(item, "meSupportOfSorCmci", sor_data->me_support_of_sor_cmci) == NULL) { + ogs_error("OpenAPI_sor_data_convertToJSON() failed [me_support_of_sor_cmci]"); + goto end; + } + } + end: return item; } @@ -100,6 +111,7 @@ OpenAPI_sor_data_t *OpenAPI_sor_data_parseFromJSON(cJSON *sor_dataJSON) OpenAPI_ue_update_status_e ue_update_statusVariable = 0; cJSON *sor_xmac_iue = NULL; cJSON *sor_mac_iue = NULL; + cJSON *me_support_of_sor_cmci = NULL; provisioning_time = cJSON_GetObjectItemCaseSensitive(sor_dataJSON, "provisioningTime"); if (!provisioning_time) { ogs_error("OpenAPI_sor_data_parseFromJSON() failed [provisioning_time]"); @@ -137,11 +149,21 @@ OpenAPI_sor_data_t *OpenAPI_sor_data_parseFromJSON(cJSON *sor_dataJSON) } } + me_support_of_sor_cmci = cJSON_GetObjectItemCaseSensitive(sor_dataJSON, "meSupportOfSorCmci"); + if (me_support_of_sor_cmci) { + if (!cJSON_IsBool(me_support_of_sor_cmci)) { + ogs_error("OpenAPI_sor_data_parseFromJSON() failed [me_support_of_sor_cmci]"); + goto end; + } + } + sor_data_local_var = OpenAPI_sor_data_create ( ogs_strdup(provisioning_time->valuestring), ue_update_statusVariable, sor_xmac_iue && !cJSON_IsNull(sor_xmac_iue) ? ogs_strdup(sor_xmac_iue->valuestring) : NULL, - sor_mac_iue && !cJSON_IsNull(sor_mac_iue) ? ogs_strdup(sor_mac_iue->valuestring) : NULL + sor_mac_iue && !cJSON_IsNull(sor_mac_iue) ? ogs_strdup(sor_mac_iue->valuestring) : NULL, + me_support_of_sor_cmci ? true : false, + me_support_of_sor_cmci ? me_support_of_sor_cmci->valueint : 0 ); return sor_data_local_var; diff --git a/lib/sbi/openapi/model/sor_data.h b/lib/sbi/openapi/model/sor_data.h index 722bcbe81..81b9f15e2 100644 --- a/lib/sbi/openapi/model/sor_data.h +++ b/lib/sbi/openapi/model/sor_data.h @@ -1,7 +1,7 @@ /* * sor_data.h * - * + * Used to store the status of the latest SOR data update. */ #ifndef _OpenAPI_sor_data_H_ @@ -24,13 +24,17 @@ typedef struct OpenAPI_sor_data_s { OpenAPI_ue_update_status_e ue_update_status; char *sor_xmac_iue; char *sor_mac_iue; + bool is_me_support_of_sor_cmci; + int me_support_of_sor_cmci; } OpenAPI_sor_data_t; OpenAPI_sor_data_t *OpenAPI_sor_data_create( char *provisioning_time, OpenAPI_ue_update_status_e ue_update_status, char *sor_xmac_iue, - char *sor_mac_iue + char *sor_mac_iue, + bool is_me_support_of_sor_cmci, + int me_support_of_sor_cmci ); void OpenAPI_sor_data_free(OpenAPI_sor_data_t *sor_data); OpenAPI_sor_data_t *OpenAPI_sor_data_parseFromJSON(cJSON *sor_dataJSON); diff --git a/lib/sbi/openapi/model/sor_info.c b/lib/sbi/openapi/model/sor_info.c index 37e4ca3f8..306b814b6 100644 --- a/lib/sbi/openapi/model/sor_info.c +++ b/lib/sbi/openapi/model/sor_info.c @@ -9,7 +9,13 @@ OpenAPI_sor_info_t *OpenAPI_sor_info_create( int ack_ind, char *sor_mac_iausf, char *countersor, - char *provisioning_time + char *provisioning_time, + char *sor_transparent_container, + char *sor_cmci, + bool is_store_sor_cmci_in_me, + int store_sor_cmci_in_me, + bool is_usim_support_of_sor_cmci, + int usim_support_of_sor_cmci ) { OpenAPI_sor_info_t *sor_info_local_var = ogs_malloc(sizeof(OpenAPI_sor_info_t)); @@ -20,6 +26,12 @@ OpenAPI_sor_info_t *OpenAPI_sor_info_create( sor_info_local_var->sor_mac_iausf = sor_mac_iausf; sor_info_local_var->countersor = countersor; sor_info_local_var->provisioning_time = provisioning_time; + sor_info_local_var->sor_transparent_container = sor_transparent_container; + sor_info_local_var->sor_cmci = sor_cmci; + sor_info_local_var->is_store_sor_cmci_in_me = is_store_sor_cmci_in_me; + sor_info_local_var->store_sor_cmci_in_me = store_sor_cmci_in_me; + sor_info_local_var->is_usim_support_of_sor_cmci = is_usim_support_of_sor_cmci; + sor_info_local_var->usim_support_of_sor_cmci = usim_support_of_sor_cmci; return sor_info_local_var; } @@ -47,6 +59,14 @@ void OpenAPI_sor_info_free(OpenAPI_sor_info_t *sor_info) ogs_free(sor_info->provisioning_time); sor_info->provisioning_time = NULL; } + if (sor_info->sor_transparent_container) { + ogs_free(sor_info->sor_transparent_container); + sor_info->sor_transparent_container = NULL; + } + if (sor_info->sor_cmci) { + ogs_free(sor_info->sor_cmci); + sor_info->sor_cmci = NULL; + } ogs_free(sor_info); } @@ -102,6 +122,34 @@ cJSON *OpenAPI_sor_info_convertToJSON(OpenAPI_sor_info_t *sor_info) goto end; } + if (sor_info->sor_transparent_container) { + if (cJSON_AddStringToObject(item, "sorTransparentContainer", sor_info->sor_transparent_container) == NULL) { + ogs_error("OpenAPI_sor_info_convertToJSON() failed [sor_transparent_container]"); + goto end; + } + } + + if (sor_info->sor_cmci) { + if (cJSON_AddStringToObject(item, "sorCmci", sor_info->sor_cmci) == NULL) { + ogs_error("OpenAPI_sor_info_convertToJSON() failed [sor_cmci]"); + goto end; + } + } + + if (sor_info->is_store_sor_cmci_in_me) { + if (cJSON_AddBoolToObject(item, "storeSorCmciInMe", sor_info->store_sor_cmci_in_me) == NULL) { + ogs_error("OpenAPI_sor_info_convertToJSON() failed [store_sor_cmci_in_me]"); + goto end; + } + } + + if (sor_info->is_usim_support_of_sor_cmci) { + if (cJSON_AddBoolToObject(item, "usimSupportOfSorCmci", sor_info->usim_support_of_sor_cmci) == NULL) { + ogs_error("OpenAPI_sor_info_convertToJSON() failed [usim_support_of_sor_cmci]"); + goto end; + } + } + end: return item; } @@ -116,6 +164,10 @@ OpenAPI_sor_info_t *OpenAPI_sor_info_parseFromJSON(cJSON *sor_infoJSON) cJSON *sor_mac_iausf = NULL; cJSON *countersor = NULL; cJSON *provisioning_time = NULL; + cJSON *sor_transparent_container = NULL; + cJSON *sor_cmci = NULL; + cJSON *store_sor_cmci_in_me = NULL; + cJSON *usim_support_of_sor_cmci = NULL; steering_container = cJSON_GetObjectItemCaseSensitive(sor_infoJSON, "steeringContainer"); if (steering_container) { steering_container_local_nonprim = OpenAPI_steering_container_parseFromJSON(steering_container); @@ -157,13 +209,51 @@ OpenAPI_sor_info_t *OpenAPI_sor_info_parseFromJSON(cJSON *sor_infoJSON) goto end; } + sor_transparent_container = cJSON_GetObjectItemCaseSensitive(sor_infoJSON, "sorTransparentContainer"); + if (sor_transparent_container) { + if (!cJSON_IsString(sor_transparent_container) && !cJSON_IsNull(sor_transparent_container)) { + ogs_error("OpenAPI_sor_info_parseFromJSON() failed [sor_transparent_container]"); + goto end; + } + } + + sor_cmci = cJSON_GetObjectItemCaseSensitive(sor_infoJSON, "sorCmci"); + if (sor_cmci) { + if (!cJSON_IsString(sor_cmci) && !cJSON_IsNull(sor_cmci)) { + ogs_error("OpenAPI_sor_info_parseFromJSON() failed [sor_cmci]"); + goto end; + } + } + + store_sor_cmci_in_me = cJSON_GetObjectItemCaseSensitive(sor_infoJSON, "storeSorCmciInMe"); + if (store_sor_cmci_in_me) { + if (!cJSON_IsBool(store_sor_cmci_in_me)) { + ogs_error("OpenAPI_sor_info_parseFromJSON() failed [store_sor_cmci_in_me]"); + goto end; + } + } + + usim_support_of_sor_cmci = cJSON_GetObjectItemCaseSensitive(sor_infoJSON, "usimSupportOfSorCmci"); + if (usim_support_of_sor_cmci) { + if (!cJSON_IsBool(usim_support_of_sor_cmci)) { + ogs_error("OpenAPI_sor_info_parseFromJSON() failed [usim_support_of_sor_cmci]"); + goto end; + } + } + sor_info_local_var = OpenAPI_sor_info_create ( steering_container ? steering_container_local_nonprim : NULL, ack_ind->valueint, sor_mac_iausf && !cJSON_IsNull(sor_mac_iausf) ? ogs_strdup(sor_mac_iausf->valuestring) : NULL, countersor && !cJSON_IsNull(countersor) ? ogs_strdup(countersor->valuestring) : NULL, - ogs_strdup(provisioning_time->valuestring) + ogs_strdup(provisioning_time->valuestring), + sor_transparent_container && !cJSON_IsNull(sor_transparent_container) ? ogs_strdup(sor_transparent_container->valuestring) : NULL, + sor_cmci && !cJSON_IsNull(sor_cmci) ? ogs_strdup(sor_cmci->valuestring) : NULL, + store_sor_cmci_in_me ? true : false, + store_sor_cmci_in_me ? store_sor_cmci_in_me->valueint : 0, + usim_support_of_sor_cmci ? true : false, + usim_support_of_sor_cmci ? usim_support_of_sor_cmci->valueint : 0 ); return sor_info_local_var; diff --git a/lib/sbi/openapi/model/sor_info.h b/lib/sbi/openapi/model/sor_info.h index b15d01e28..09c4c1bfb 100644 --- a/lib/sbi/openapi/model/sor_info.h +++ b/lib/sbi/openapi/model/sor_info.h @@ -25,6 +25,12 @@ typedef struct OpenAPI_sor_info_s { char *sor_mac_iausf; char *countersor; char *provisioning_time; + char *sor_transparent_container; + char *sor_cmci; + bool is_store_sor_cmci_in_me; + int store_sor_cmci_in_me; + bool is_usim_support_of_sor_cmci; + int usim_support_of_sor_cmci; } OpenAPI_sor_info_t; OpenAPI_sor_info_t *OpenAPI_sor_info_create( @@ -32,7 +38,13 @@ OpenAPI_sor_info_t *OpenAPI_sor_info_create( int ack_ind, char *sor_mac_iausf, char *countersor, - char *provisioning_time + char *provisioning_time, + char *sor_transparent_container, + char *sor_cmci, + bool is_store_sor_cmci_in_me, + int store_sor_cmci_in_me, + bool is_usim_support_of_sor_cmci, + int usim_support_of_sor_cmci ); void OpenAPI_sor_info_free(OpenAPI_sor_info_t *sor_info); OpenAPI_sor_info_t *OpenAPI_sor_info_parseFromJSON(cJSON *sor_infoJSON); diff --git a/lib/sbi/openapi/model/sor_info_1.c b/lib/sbi/openapi/model/sor_info_1.c index a8041df07..b6311b02a 100644 --- a/lib/sbi/openapi/model/sor_info_1.c +++ b/lib/sbi/openapi/model/sor_info_1.c @@ -9,7 +9,13 @@ OpenAPI_sor_info_1_t *OpenAPI_sor_info_1_create( int ack_ind, char *sor_mac_iausf, char *countersor, - char *provisioning_time + char *provisioning_time, + char *sor_transparent_container, + char *sor_cmci, + bool is_store_sor_cmci_in_me, + int store_sor_cmci_in_me, + bool is_usim_support_of_sor_cmci, + int usim_support_of_sor_cmci ) { OpenAPI_sor_info_1_t *sor_info_1_local_var = ogs_malloc(sizeof(OpenAPI_sor_info_1_t)); @@ -20,6 +26,12 @@ OpenAPI_sor_info_1_t *OpenAPI_sor_info_1_create( sor_info_1_local_var->sor_mac_iausf = sor_mac_iausf; sor_info_1_local_var->countersor = countersor; sor_info_1_local_var->provisioning_time = provisioning_time; + sor_info_1_local_var->sor_transparent_container = sor_transparent_container; + sor_info_1_local_var->sor_cmci = sor_cmci; + sor_info_1_local_var->is_store_sor_cmci_in_me = is_store_sor_cmci_in_me; + sor_info_1_local_var->store_sor_cmci_in_me = store_sor_cmci_in_me; + sor_info_1_local_var->is_usim_support_of_sor_cmci = is_usim_support_of_sor_cmci; + sor_info_1_local_var->usim_support_of_sor_cmci = usim_support_of_sor_cmci; return sor_info_1_local_var; } @@ -47,6 +59,14 @@ void OpenAPI_sor_info_1_free(OpenAPI_sor_info_1_t *sor_info_1) ogs_free(sor_info_1->provisioning_time); sor_info_1->provisioning_time = NULL; } + if (sor_info_1->sor_transparent_container) { + ogs_free(sor_info_1->sor_transparent_container); + sor_info_1->sor_transparent_container = NULL; + } + if (sor_info_1->sor_cmci) { + ogs_free(sor_info_1->sor_cmci); + sor_info_1->sor_cmci = NULL; + } ogs_free(sor_info_1); } @@ -102,6 +122,34 @@ cJSON *OpenAPI_sor_info_1_convertToJSON(OpenAPI_sor_info_1_t *sor_info_1) goto end; } + if (sor_info_1->sor_transparent_container) { + if (cJSON_AddStringToObject(item, "sorTransparentContainer", sor_info_1->sor_transparent_container) == NULL) { + ogs_error("OpenAPI_sor_info_1_convertToJSON() failed [sor_transparent_container]"); + goto end; + } + } + + if (sor_info_1->sor_cmci) { + if (cJSON_AddStringToObject(item, "sorCmci", sor_info_1->sor_cmci) == NULL) { + ogs_error("OpenAPI_sor_info_1_convertToJSON() failed [sor_cmci]"); + goto end; + } + } + + if (sor_info_1->is_store_sor_cmci_in_me) { + if (cJSON_AddBoolToObject(item, "storeSorCmciInMe", sor_info_1->store_sor_cmci_in_me) == NULL) { + ogs_error("OpenAPI_sor_info_1_convertToJSON() failed [store_sor_cmci_in_me]"); + goto end; + } + } + + if (sor_info_1->is_usim_support_of_sor_cmci) { + if (cJSON_AddBoolToObject(item, "usimSupportOfSorCmci", sor_info_1->usim_support_of_sor_cmci) == NULL) { + ogs_error("OpenAPI_sor_info_1_convertToJSON() failed [usim_support_of_sor_cmci]"); + goto end; + } + } + end: return item; } @@ -116,6 +164,10 @@ OpenAPI_sor_info_1_t *OpenAPI_sor_info_1_parseFromJSON(cJSON *sor_info_1JSON) cJSON *sor_mac_iausf = NULL; cJSON *countersor = NULL; cJSON *provisioning_time = NULL; + cJSON *sor_transparent_container = NULL; + cJSON *sor_cmci = NULL; + cJSON *store_sor_cmci_in_me = NULL; + cJSON *usim_support_of_sor_cmci = NULL; steering_container = cJSON_GetObjectItemCaseSensitive(sor_info_1JSON, "steeringContainer"); if (steering_container) { steering_container_local_nonprim = OpenAPI_steering_container_parseFromJSON(steering_container); @@ -157,13 +209,51 @@ OpenAPI_sor_info_1_t *OpenAPI_sor_info_1_parseFromJSON(cJSON *sor_info_1JSON) goto end; } + sor_transparent_container = cJSON_GetObjectItemCaseSensitive(sor_info_1JSON, "sorTransparentContainer"); + if (sor_transparent_container) { + if (!cJSON_IsString(sor_transparent_container) && !cJSON_IsNull(sor_transparent_container)) { + ogs_error("OpenAPI_sor_info_1_parseFromJSON() failed [sor_transparent_container]"); + goto end; + } + } + + sor_cmci = cJSON_GetObjectItemCaseSensitive(sor_info_1JSON, "sorCmci"); + if (sor_cmci) { + if (!cJSON_IsString(sor_cmci) && !cJSON_IsNull(sor_cmci)) { + ogs_error("OpenAPI_sor_info_1_parseFromJSON() failed [sor_cmci]"); + goto end; + } + } + + store_sor_cmci_in_me = cJSON_GetObjectItemCaseSensitive(sor_info_1JSON, "storeSorCmciInMe"); + if (store_sor_cmci_in_me) { + if (!cJSON_IsBool(store_sor_cmci_in_me)) { + ogs_error("OpenAPI_sor_info_1_parseFromJSON() failed [store_sor_cmci_in_me]"); + goto end; + } + } + + usim_support_of_sor_cmci = cJSON_GetObjectItemCaseSensitive(sor_info_1JSON, "usimSupportOfSorCmci"); + if (usim_support_of_sor_cmci) { + if (!cJSON_IsBool(usim_support_of_sor_cmci)) { + ogs_error("OpenAPI_sor_info_1_parseFromJSON() failed [usim_support_of_sor_cmci]"); + goto end; + } + } + sor_info_1_local_var = OpenAPI_sor_info_1_create ( steering_container ? steering_container_local_nonprim : NULL, ack_ind->valueint, sor_mac_iausf && !cJSON_IsNull(sor_mac_iausf) ? ogs_strdup(sor_mac_iausf->valuestring) : NULL, countersor && !cJSON_IsNull(countersor) ? ogs_strdup(countersor->valuestring) : NULL, - ogs_strdup(provisioning_time->valuestring) + ogs_strdup(provisioning_time->valuestring), + sor_transparent_container && !cJSON_IsNull(sor_transparent_container) ? ogs_strdup(sor_transparent_container->valuestring) : NULL, + sor_cmci && !cJSON_IsNull(sor_cmci) ? ogs_strdup(sor_cmci->valuestring) : NULL, + store_sor_cmci_in_me ? true : false, + store_sor_cmci_in_me ? store_sor_cmci_in_me->valueint : 0, + usim_support_of_sor_cmci ? true : false, + usim_support_of_sor_cmci ? usim_support_of_sor_cmci->valueint : 0 ); return sor_info_1_local_var; diff --git a/lib/sbi/openapi/model/sor_info_1.h b/lib/sbi/openapi/model/sor_info_1.h index 620388332..21a2ac73f 100644 --- a/lib/sbi/openapi/model/sor_info_1.h +++ b/lib/sbi/openapi/model/sor_info_1.h @@ -25,6 +25,12 @@ typedef struct OpenAPI_sor_info_1_s { char *sor_mac_iausf; char *countersor; char *provisioning_time; + char *sor_transparent_container; + char *sor_cmci; + bool is_store_sor_cmci_in_me; + int store_sor_cmci_in_me; + bool is_usim_support_of_sor_cmci; + int usim_support_of_sor_cmci; } OpenAPI_sor_info_1_t; OpenAPI_sor_info_1_t *OpenAPI_sor_info_1_create( @@ -32,7 +38,13 @@ OpenAPI_sor_info_1_t *OpenAPI_sor_info_1_create( int ack_ind, char *sor_mac_iausf, char *countersor, - char *provisioning_time + char *provisioning_time, + char *sor_transparent_container, + char *sor_cmci, + bool is_store_sor_cmci_in_me, + int store_sor_cmci_in_me, + bool is_usim_support_of_sor_cmci, + int usim_support_of_sor_cmci ); void OpenAPI_sor_info_1_free(OpenAPI_sor_info_1_t *sor_info_1); OpenAPI_sor_info_1_t *OpenAPI_sor_info_1_parseFromJSON(cJSON *sor_info_1JSON); diff --git a/lib/sbi/openapi/model/sor_update_info.c b/lib/sbi/openapi/model/sor_update_info.c index a1decdcd3..430cc43ad 100644 --- a/lib/sbi/openapi/model/sor_update_info.c +++ b/lib/sbi/openapi/model/sor_update_info.c @@ -5,13 +5,15 @@ #include "sor_update_info.h" OpenAPI_sor_update_info_t *OpenAPI_sor_update_info_create( - OpenAPI_plmn_id_t *vplmn_id + OpenAPI_plmn_id_t *vplmn_id, + char *supported_features ) { OpenAPI_sor_update_info_t *sor_update_info_local_var = ogs_malloc(sizeof(OpenAPI_sor_update_info_t)); ogs_assert(sor_update_info_local_var); sor_update_info_local_var->vplmn_id = vplmn_id; + sor_update_info_local_var->supported_features = supported_features; return sor_update_info_local_var; } @@ -27,6 +29,10 @@ void OpenAPI_sor_update_info_free(OpenAPI_sor_update_info_t *sor_update_info) OpenAPI_plmn_id_free(sor_update_info->vplmn_id); sor_update_info->vplmn_id = NULL; } + if (sor_update_info->supported_features) { + ogs_free(sor_update_info->supported_features); + sor_update_info->supported_features = NULL; + } ogs_free(sor_update_info); } @@ -56,6 +62,13 @@ cJSON *OpenAPI_sor_update_info_convertToJSON(OpenAPI_sor_update_info_t *sor_upda goto end; } + if (sor_update_info->supported_features) { + if (cJSON_AddStringToObject(item, "supportedFeatures", sor_update_info->supported_features) == NULL) { + ogs_error("OpenAPI_sor_update_info_convertToJSON() failed [supported_features]"); + goto end; + } + } + end: return item; } @@ -66,6 +79,7 @@ OpenAPI_sor_update_info_t *OpenAPI_sor_update_info_parseFromJSON(cJSON *sor_upda OpenAPI_lnode_t *node = NULL; cJSON *vplmn_id = NULL; OpenAPI_plmn_id_t *vplmn_id_local_nonprim = NULL; + cJSON *supported_features = NULL; vplmn_id = cJSON_GetObjectItemCaseSensitive(sor_update_infoJSON, "vplmnId"); if (!vplmn_id) { ogs_error("OpenAPI_sor_update_info_parseFromJSON() failed [vplmn_id]"); @@ -73,8 +87,17 @@ OpenAPI_sor_update_info_t *OpenAPI_sor_update_info_parseFromJSON(cJSON *sor_upda } vplmn_id_local_nonprim = OpenAPI_plmn_id_parseFromJSON(vplmn_id); + supported_features = cJSON_GetObjectItemCaseSensitive(sor_update_infoJSON, "supportedFeatures"); + if (supported_features) { + if (!cJSON_IsString(supported_features) && !cJSON_IsNull(supported_features)) { + ogs_error("OpenAPI_sor_update_info_parseFromJSON() failed [supported_features]"); + goto end; + } + } + sor_update_info_local_var = OpenAPI_sor_update_info_create ( - vplmn_id_local_nonprim + vplmn_id_local_nonprim, + supported_features && !cJSON_IsNull(supported_features) ? ogs_strdup(supported_features->valuestring) : NULL ); return sor_update_info_local_var; diff --git a/lib/sbi/openapi/model/sor_update_info.h b/lib/sbi/openapi/model/sor_update_info.h index 8ae4261b0..8ab76b605 100644 --- a/lib/sbi/openapi/model/sor_update_info.h +++ b/lib/sbi/openapi/model/sor_update_info.h @@ -21,10 +21,12 @@ extern "C" { typedef struct OpenAPI_sor_update_info_s OpenAPI_sor_update_info_t; typedef struct OpenAPI_sor_update_info_s { struct OpenAPI_plmn_id_s *vplmn_id; + char *supported_features; } OpenAPI_sor_update_info_t; OpenAPI_sor_update_info_t *OpenAPI_sor_update_info_create( - OpenAPI_plmn_id_t *vplmn_id + OpenAPI_plmn_id_t *vplmn_id, + char *supported_features ); void OpenAPI_sor_update_info_free(OpenAPI_sor_update_info_t *sor_update_info); OpenAPI_sor_update_info_t *OpenAPI_sor_update_info_parseFromJSON(cJSON *sor_update_infoJSON); diff --git a/lib/sbi/openapi/model/spatial_validity.h b/lib/sbi/openapi/model/spatial_validity.h index 28b20165d..6baf38f89 100644 --- a/lib/sbi/openapi/model/spatial_validity.h +++ b/lib/sbi/openapi/model/spatial_validity.h @@ -1,7 +1,7 @@ /* * spatial_validity.h * - * describes explicitly the route to an Application location + * Describes explicitly the route to an Application location. */ #ifndef _OpenAPI_spatial_validity_H_ diff --git a/lib/sbi/openapi/model/spatial_validity_cond.c b/lib/sbi/openapi/model/spatial_validity_cond.c new file mode 100644 index 000000000..79b2c85fd --- /dev/null +++ b/lib/sbi/openapi/model/spatial_validity_cond.c @@ -0,0 +1,232 @@ + +#include +#include +#include +#include "spatial_validity_cond.h" + +OpenAPI_spatial_validity_cond_t *OpenAPI_spatial_validity_cond_create( + OpenAPI_list_t *tracking_area_list, + OpenAPI_list_t *countries, + OpenAPI_geo_service_area_t *geographical_service_area +) +{ + OpenAPI_spatial_validity_cond_t *spatial_validity_cond_local_var = ogs_malloc(sizeof(OpenAPI_spatial_validity_cond_t)); + ogs_assert(spatial_validity_cond_local_var); + + spatial_validity_cond_local_var->tracking_area_list = tracking_area_list; + spatial_validity_cond_local_var->countries = countries; + spatial_validity_cond_local_var->geographical_service_area = geographical_service_area; + + return spatial_validity_cond_local_var; +} + +void OpenAPI_spatial_validity_cond_free(OpenAPI_spatial_validity_cond_t *spatial_validity_cond) +{ + OpenAPI_lnode_t *node = NULL; + + if (NULL == spatial_validity_cond) { + return; + } + if (spatial_validity_cond->tracking_area_list) { + OpenAPI_list_for_each(spatial_validity_cond->tracking_area_list, node) { + OpenAPI_tai_free(node->data); + } + OpenAPI_list_free(spatial_validity_cond->tracking_area_list); + spatial_validity_cond->tracking_area_list = NULL; + } + if (spatial_validity_cond->countries) { + OpenAPI_list_for_each(spatial_validity_cond->countries, node) { + ogs_free(node->data); + } + OpenAPI_list_free(spatial_validity_cond->countries); + spatial_validity_cond->countries = NULL; + } + if (spatial_validity_cond->geographical_service_area) { + OpenAPI_geo_service_area_free(spatial_validity_cond->geographical_service_area); + spatial_validity_cond->geographical_service_area = NULL; + } + ogs_free(spatial_validity_cond); +} + +cJSON *OpenAPI_spatial_validity_cond_convertToJSON(OpenAPI_spatial_validity_cond_t *spatial_validity_cond) +{ + cJSON *item = NULL; + OpenAPI_lnode_t *node = NULL; + + if (spatial_validity_cond == NULL) { + ogs_error("OpenAPI_spatial_validity_cond_convertToJSON() failed [SpatialValidityCond]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (spatial_validity_cond->tracking_area_list) { + cJSON *tracking_area_listList = cJSON_AddArrayToObject(item, "trackingAreaList"); + if (tracking_area_listList == NULL) { + ogs_error("OpenAPI_spatial_validity_cond_convertToJSON() failed [tracking_area_list]"); + goto end; + } + OpenAPI_list_for_each(spatial_validity_cond->tracking_area_list, node) { + cJSON *itemLocal = OpenAPI_tai_convertToJSON(node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_spatial_validity_cond_convertToJSON() failed [tracking_area_list]"); + goto end; + } + cJSON_AddItemToArray(tracking_area_listList, itemLocal); + } + } + + if (spatial_validity_cond->countries) { + cJSON *countriesList = cJSON_AddArrayToObject(item, "countries"); + if (countriesList == NULL) { + ogs_error("OpenAPI_spatial_validity_cond_convertToJSON() failed [countries]"); + goto end; + } + OpenAPI_list_for_each(spatial_validity_cond->countries, node) { + if (cJSON_AddStringToObject(countriesList, "", (char*)node->data) == NULL) { + ogs_error("OpenAPI_spatial_validity_cond_convertToJSON() failed [countries]"); + goto end; + } + } + } + + if (spatial_validity_cond->geographical_service_area) { + cJSON *geographical_service_area_local_JSON = OpenAPI_geo_service_area_convertToJSON(spatial_validity_cond->geographical_service_area); + if (geographical_service_area_local_JSON == NULL) { + ogs_error("OpenAPI_spatial_validity_cond_convertToJSON() failed [geographical_service_area]"); + goto end; + } + cJSON_AddItemToObject(item, "geographicalServiceArea", geographical_service_area_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_spatial_validity_cond_convertToJSON() failed [geographical_service_area]"); + goto end; + } + } + +end: + return item; +} + +OpenAPI_spatial_validity_cond_t *OpenAPI_spatial_validity_cond_parseFromJSON(cJSON *spatial_validity_condJSON) +{ + OpenAPI_spatial_validity_cond_t *spatial_validity_cond_local_var = NULL; + OpenAPI_lnode_t *node = NULL; + cJSON *tracking_area_list = NULL; + OpenAPI_list_t *tracking_area_listList = NULL; + cJSON *countries = NULL; + OpenAPI_list_t *countriesList = NULL; + cJSON *geographical_service_area = NULL; + OpenAPI_geo_service_area_t *geographical_service_area_local_nonprim = NULL; + tracking_area_list = cJSON_GetObjectItemCaseSensitive(spatial_validity_condJSON, "trackingAreaList"); + if (tracking_area_list) { + cJSON *tracking_area_list_local = NULL; + if (!cJSON_IsArray(tracking_area_list)) { + ogs_error("OpenAPI_spatial_validity_cond_parseFromJSON() failed [tracking_area_list]"); + goto end; + } + + tracking_area_listList = OpenAPI_list_create(); + + cJSON_ArrayForEach(tracking_area_list_local, tracking_area_list) { + if (!cJSON_IsObject(tracking_area_list_local)) { + ogs_error("OpenAPI_spatial_validity_cond_parseFromJSON() failed [tracking_area_list]"); + goto end; + } + OpenAPI_tai_t *tracking_area_listItem = OpenAPI_tai_parseFromJSON(tracking_area_list_local); + if (!tracking_area_listItem) { + ogs_error("No tracking_area_listItem"); + OpenAPI_list_free(tracking_area_listList); + goto end; + } + OpenAPI_list_add(tracking_area_listList, tracking_area_listItem); + } + } + + countries = cJSON_GetObjectItemCaseSensitive(spatial_validity_condJSON, "countries"); + if (countries) { + cJSON *countries_local = NULL; + if (!cJSON_IsArray(countries)) { + ogs_error("OpenAPI_spatial_validity_cond_parseFromJSON() failed [countries]"); + goto end; + } + + countriesList = OpenAPI_list_create(); + + cJSON_ArrayForEach(countries_local, countries) { + double *localDouble = NULL; + int *localInt = NULL; + if (!cJSON_IsString(countries_local)) { + ogs_error("OpenAPI_spatial_validity_cond_parseFromJSON() failed [countries]"); + goto end; + } + OpenAPI_list_add(countriesList, ogs_strdup(countries_local->valuestring)); + } + } + + geographical_service_area = cJSON_GetObjectItemCaseSensitive(spatial_validity_condJSON, "geographicalServiceArea"); + if (geographical_service_area) { + geographical_service_area_local_nonprim = OpenAPI_geo_service_area_parseFromJSON(geographical_service_area); + } + + spatial_validity_cond_local_var = OpenAPI_spatial_validity_cond_create ( + tracking_area_list ? tracking_area_listList : NULL, + countries ? countriesList : NULL, + geographical_service_area ? geographical_service_area_local_nonprim : NULL + ); + + return spatial_validity_cond_local_var; +end: + if (tracking_area_listList) { + OpenAPI_list_for_each(tracking_area_listList, node) { + OpenAPI_tai_free(node->data); + } + OpenAPI_list_free(tracking_area_listList); + tracking_area_listList = NULL; + } + if (countriesList) { + OpenAPI_list_for_each(countriesList, node) { + ogs_free(node->data); + } + OpenAPI_list_free(countriesList); + countriesList = NULL; + } + if (geographical_service_area_local_nonprim) { + OpenAPI_geo_service_area_free(geographical_service_area_local_nonprim); + geographical_service_area_local_nonprim = NULL; + } + return NULL; +} + +OpenAPI_spatial_validity_cond_t *OpenAPI_spatial_validity_cond_copy(OpenAPI_spatial_validity_cond_t *dst, OpenAPI_spatial_validity_cond_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_spatial_validity_cond_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_spatial_validity_cond_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_spatial_validity_cond_free(dst); + dst = OpenAPI_spatial_validity_cond_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/spatial_validity_cond.h b/lib/sbi/openapi/model/spatial_validity_cond.h new file mode 100644 index 000000000..b0ade521c --- /dev/null +++ b/lib/sbi/openapi/model/spatial_validity_cond.h @@ -0,0 +1,44 @@ +/* + * spatial_validity_cond.h + * + * Contains the Spatial Validity Condition. + */ + +#ifndef _OpenAPI_spatial_validity_cond_H_ +#define _OpenAPI_spatial_validity_cond_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "geo_service_area.h" +#include "tai.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_spatial_validity_cond_s OpenAPI_spatial_validity_cond_t; +typedef struct OpenAPI_spatial_validity_cond_s { + OpenAPI_list_t *tracking_area_list; + OpenAPI_list_t *countries; + struct OpenAPI_geo_service_area_s *geographical_service_area; +} OpenAPI_spatial_validity_cond_t; + +OpenAPI_spatial_validity_cond_t *OpenAPI_spatial_validity_cond_create( + OpenAPI_list_t *tracking_area_list, + OpenAPI_list_t *countries, + OpenAPI_geo_service_area_t *geographical_service_area +); +void OpenAPI_spatial_validity_cond_free(OpenAPI_spatial_validity_cond_t *spatial_validity_cond); +OpenAPI_spatial_validity_cond_t *OpenAPI_spatial_validity_cond_parseFromJSON(cJSON *spatial_validity_condJSON); +cJSON *OpenAPI_spatial_validity_cond_convertToJSON(OpenAPI_spatial_validity_cond_t *spatial_validity_cond); +OpenAPI_spatial_validity_cond_t *OpenAPI_spatial_validity_cond_copy(OpenAPI_spatial_validity_cond_t *dst, OpenAPI_spatial_validity_cond_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_spatial_validity_cond_H_ */ + diff --git a/lib/sbi/openapi/model/spatial_validity_cond_1.c b/lib/sbi/openapi/model/spatial_validity_cond_1.c new file mode 100644 index 000000000..479a76341 --- /dev/null +++ b/lib/sbi/openapi/model/spatial_validity_cond_1.c @@ -0,0 +1,232 @@ + +#include +#include +#include +#include "spatial_validity_cond_1.h" + +OpenAPI_spatial_validity_cond_1_t *OpenAPI_spatial_validity_cond_1_create( + OpenAPI_list_t *tracking_area_list, + OpenAPI_list_t *countries, + OpenAPI_geo_service_area_1_t *geographical_service_area +) +{ + OpenAPI_spatial_validity_cond_1_t *spatial_validity_cond_1_local_var = ogs_malloc(sizeof(OpenAPI_spatial_validity_cond_1_t)); + ogs_assert(spatial_validity_cond_1_local_var); + + spatial_validity_cond_1_local_var->tracking_area_list = tracking_area_list; + spatial_validity_cond_1_local_var->countries = countries; + spatial_validity_cond_1_local_var->geographical_service_area = geographical_service_area; + + return spatial_validity_cond_1_local_var; +} + +void OpenAPI_spatial_validity_cond_1_free(OpenAPI_spatial_validity_cond_1_t *spatial_validity_cond_1) +{ + OpenAPI_lnode_t *node = NULL; + + if (NULL == spatial_validity_cond_1) { + return; + } + if (spatial_validity_cond_1->tracking_area_list) { + OpenAPI_list_for_each(spatial_validity_cond_1->tracking_area_list, node) { + OpenAPI_tai_1_free(node->data); + } + OpenAPI_list_free(spatial_validity_cond_1->tracking_area_list); + spatial_validity_cond_1->tracking_area_list = NULL; + } + if (spatial_validity_cond_1->countries) { + OpenAPI_list_for_each(spatial_validity_cond_1->countries, node) { + ogs_free(node->data); + } + OpenAPI_list_free(spatial_validity_cond_1->countries); + spatial_validity_cond_1->countries = NULL; + } + if (spatial_validity_cond_1->geographical_service_area) { + OpenAPI_geo_service_area_1_free(spatial_validity_cond_1->geographical_service_area); + spatial_validity_cond_1->geographical_service_area = NULL; + } + ogs_free(spatial_validity_cond_1); +} + +cJSON *OpenAPI_spatial_validity_cond_1_convertToJSON(OpenAPI_spatial_validity_cond_1_t *spatial_validity_cond_1) +{ + cJSON *item = NULL; + OpenAPI_lnode_t *node = NULL; + + if (spatial_validity_cond_1 == NULL) { + ogs_error("OpenAPI_spatial_validity_cond_1_convertToJSON() failed [SpatialValidityCond_1]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (spatial_validity_cond_1->tracking_area_list) { + cJSON *tracking_area_listList = cJSON_AddArrayToObject(item, "trackingAreaList"); + if (tracking_area_listList == NULL) { + ogs_error("OpenAPI_spatial_validity_cond_1_convertToJSON() failed [tracking_area_list]"); + goto end; + } + OpenAPI_list_for_each(spatial_validity_cond_1->tracking_area_list, node) { + cJSON *itemLocal = OpenAPI_tai_1_convertToJSON(node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_spatial_validity_cond_1_convertToJSON() failed [tracking_area_list]"); + goto end; + } + cJSON_AddItemToArray(tracking_area_listList, itemLocal); + } + } + + if (spatial_validity_cond_1->countries) { + cJSON *countriesList = cJSON_AddArrayToObject(item, "countries"); + if (countriesList == NULL) { + ogs_error("OpenAPI_spatial_validity_cond_1_convertToJSON() failed [countries]"); + goto end; + } + OpenAPI_list_for_each(spatial_validity_cond_1->countries, node) { + if (cJSON_AddStringToObject(countriesList, "", (char*)node->data) == NULL) { + ogs_error("OpenAPI_spatial_validity_cond_1_convertToJSON() failed [countries]"); + goto end; + } + } + } + + if (spatial_validity_cond_1->geographical_service_area) { + cJSON *geographical_service_area_local_JSON = OpenAPI_geo_service_area_1_convertToJSON(spatial_validity_cond_1->geographical_service_area); + if (geographical_service_area_local_JSON == NULL) { + ogs_error("OpenAPI_spatial_validity_cond_1_convertToJSON() failed [geographical_service_area]"); + goto end; + } + cJSON_AddItemToObject(item, "geographicalServiceArea", geographical_service_area_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_spatial_validity_cond_1_convertToJSON() failed [geographical_service_area]"); + goto end; + } + } + +end: + return item; +} + +OpenAPI_spatial_validity_cond_1_t *OpenAPI_spatial_validity_cond_1_parseFromJSON(cJSON *spatial_validity_cond_1JSON) +{ + OpenAPI_spatial_validity_cond_1_t *spatial_validity_cond_1_local_var = NULL; + OpenAPI_lnode_t *node = NULL; + cJSON *tracking_area_list = NULL; + OpenAPI_list_t *tracking_area_listList = NULL; + cJSON *countries = NULL; + OpenAPI_list_t *countriesList = NULL; + cJSON *geographical_service_area = NULL; + OpenAPI_geo_service_area_1_t *geographical_service_area_local_nonprim = NULL; + tracking_area_list = cJSON_GetObjectItemCaseSensitive(spatial_validity_cond_1JSON, "trackingAreaList"); + if (tracking_area_list) { + cJSON *tracking_area_list_local = NULL; + if (!cJSON_IsArray(tracking_area_list)) { + ogs_error("OpenAPI_spatial_validity_cond_1_parseFromJSON() failed [tracking_area_list]"); + goto end; + } + + tracking_area_listList = OpenAPI_list_create(); + + cJSON_ArrayForEach(tracking_area_list_local, tracking_area_list) { + if (!cJSON_IsObject(tracking_area_list_local)) { + ogs_error("OpenAPI_spatial_validity_cond_1_parseFromJSON() failed [tracking_area_list]"); + goto end; + } + OpenAPI_tai_1_t *tracking_area_listItem = OpenAPI_tai_1_parseFromJSON(tracking_area_list_local); + if (!tracking_area_listItem) { + ogs_error("No tracking_area_listItem"); + OpenAPI_list_free(tracking_area_listList); + goto end; + } + OpenAPI_list_add(tracking_area_listList, tracking_area_listItem); + } + } + + countries = cJSON_GetObjectItemCaseSensitive(spatial_validity_cond_1JSON, "countries"); + if (countries) { + cJSON *countries_local = NULL; + if (!cJSON_IsArray(countries)) { + ogs_error("OpenAPI_spatial_validity_cond_1_parseFromJSON() failed [countries]"); + goto end; + } + + countriesList = OpenAPI_list_create(); + + cJSON_ArrayForEach(countries_local, countries) { + double *localDouble = NULL; + int *localInt = NULL; + if (!cJSON_IsString(countries_local)) { + ogs_error("OpenAPI_spatial_validity_cond_1_parseFromJSON() failed [countries]"); + goto end; + } + OpenAPI_list_add(countriesList, ogs_strdup(countries_local->valuestring)); + } + } + + geographical_service_area = cJSON_GetObjectItemCaseSensitive(spatial_validity_cond_1JSON, "geographicalServiceArea"); + if (geographical_service_area) { + geographical_service_area_local_nonprim = OpenAPI_geo_service_area_1_parseFromJSON(geographical_service_area); + } + + spatial_validity_cond_1_local_var = OpenAPI_spatial_validity_cond_1_create ( + tracking_area_list ? tracking_area_listList : NULL, + countries ? countriesList : NULL, + geographical_service_area ? geographical_service_area_local_nonprim : NULL + ); + + return spatial_validity_cond_1_local_var; +end: + if (tracking_area_listList) { + OpenAPI_list_for_each(tracking_area_listList, node) { + OpenAPI_tai_1_free(node->data); + } + OpenAPI_list_free(tracking_area_listList); + tracking_area_listList = NULL; + } + if (countriesList) { + OpenAPI_list_for_each(countriesList, node) { + ogs_free(node->data); + } + OpenAPI_list_free(countriesList); + countriesList = NULL; + } + if (geographical_service_area_local_nonprim) { + OpenAPI_geo_service_area_1_free(geographical_service_area_local_nonprim); + geographical_service_area_local_nonprim = NULL; + } + return NULL; +} + +OpenAPI_spatial_validity_cond_1_t *OpenAPI_spatial_validity_cond_1_copy(OpenAPI_spatial_validity_cond_1_t *dst, OpenAPI_spatial_validity_cond_1_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_spatial_validity_cond_1_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_spatial_validity_cond_1_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_spatial_validity_cond_1_free(dst); + dst = OpenAPI_spatial_validity_cond_1_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/spatial_validity_cond_1.h b/lib/sbi/openapi/model/spatial_validity_cond_1.h new file mode 100644 index 000000000..acbff9825 --- /dev/null +++ b/lib/sbi/openapi/model/spatial_validity_cond_1.h @@ -0,0 +1,44 @@ +/* + * spatial_validity_cond_1.h + * + * Contains the Spatial Validity Condition. + */ + +#ifndef _OpenAPI_spatial_validity_cond_1_H_ +#define _OpenAPI_spatial_validity_cond_1_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "geo_service_area_1.h" +#include "tai_1.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_spatial_validity_cond_1_s OpenAPI_spatial_validity_cond_1_t; +typedef struct OpenAPI_spatial_validity_cond_1_s { + OpenAPI_list_t *tracking_area_list; + OpenAPI_list_t *countries; + struct OpenAPI_geo_service_area_1_s *geographical_service_area; +} OpenAPI_spatial_validity_cond_1_t; + +OpenAPI_spatial_validity_cond_1_t *OpenAPI_spatial_validity_cond_1_create( + OpenAPI_list_t *tracking_area_list, + OpenAPI_list_t *countries, + OpenAPI_geo_service_area_1_t *geographical_service_area +); +void OpenAPI_spatial_validity_cond_1_free(OpenAPI_spatial_validity_cond_1_t *spatial_validity_cond_1); +OpenAPI_spatial_validity_cond_1_t *OpenAPI_spatial_validity_cond_1_parseFromJSON(cJSON *spatial_validity_cond_1JSON); +cJSON *OpenAPI_spatial_validity_cond_1_convertToJSON(OpenAPI_spatial_validity_cond_1_t *spatial_validity_cond_1); +OpenAPI_spatial_validity_cond_1_t *OpenAPI_spatial_validity_cond_1_copy(OpenAPI_spatial_validity_cond_1_t *dst, OpenAPI_spatial_validity_cond_1_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_spatial_validity_cond_1_H_ */ + diff --git a/lib/sbi/openapi/model/spatial_validity_rm.h b/lib/sbi/openapi/model/spatial_validity_rm.h index b78a1fd49..532fc237a 100644 --- a/lib/sbi/openapi/model/spatial_validity_rm.h +++ b/lib/sbi/openapi/model/spatial_validity_rm.h @@ -1,7 +1,7 @@ /* * spatial_validity_rm.h * - * this data type is defined in the same way as the SpatialValidity data type, but with the OpenAPI nullable property set to true + * This data type is defined in the same way as the SpatialValidity data type, but with the OpenAPI nullable property set to true. */ #ifndef _OpenAPI_spatial_validity_rm_H_ diff --git a/lib/sbi/openapi/model/sponsor_connectivity_data.h b/lib/sbi/openapi/model/sponsor_connectivity_data.h index ea25736e2..709e0f886 100644 --- a/lib/sbi/openapi/model/sponsor_connectivity_data.h +++ b/lib/sbi/openapi/model/sponsor_connectivity_data.h @@ -1,7 +1,7 @@ /* * sponsor_connectivity_data.h * - * Contains the sponsored data connectivity related information for a sponsor identifier. + * Contains the sponsored data connectivity related information for a sponsor identifier. */ #ifndef _OpenAPI_sponsor_connectivity_data_H_ diff --git a/lib/sbi/openapi/model/ssm.c b/lib/sbi/openapi/model/ssm.c new file mode 100644 index 000000000..a806d72ac --- /dev/null +++ b/lib/sbi/openapi/model/ssm.c @@ -0,0 +1,157 @@ + +#include +#include +#include +#include "ssm.h" + +OpenAPI_ssm_t *OpenAPI_ssm_create( + OpenAPI_ip_addr_t *source_ip_addr, + OpenAPI_ip_addr_t *dest_ip_addr +) +{ + OpenAPI_ssm_t *ssm_local_var = ogs_malloc(sizeof(OpenAPI_ssm_t)); + ogs_assert(ssm_local_var); + + ssm_local_var->source_ip_addr = source_ip_addr; + ssm_local_var->dest_ip_addr = dest_ip_addr; + + return ssm_local_var; +} + +void OpenAPI_ssm_free(OpenAPI_ssm_t *ssm) +{ + OpenAPI_lnode_t *node = NULL; + + if (NULL == ssm) { + return; + } + if (ssm->source_ip_addr) { + OpenAPI_ip_addr_free(ssm->source_ip_addr); + ssm->source_ip_addr = NULL; + } + if (ssm->dest_ip_addr) { + OpenAPI_ip_addr_free(ssm->dest_ip_addr); + ssm->dest_ip_addr = NULL; + } + ogs_free(ssm); +} + +cJSON *OpenAPI_ssm_convertToJSON(OpenAPI_ssm_t *ssm) +{ + cJSON *item = NULL; + OpenAPI_lnode_t *node = NULL; + + if (ssm == NULL) { + ogs_error("OpenAPI_ssm_convertToJSON() failed [Ssm]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (!ssm->source_ip_addr) { + ogs_error("OpenAPI_ssm_convertToJSON() failed [source_ip_addr]"); + return NULL; + } + cJSON *source_ip_addr_local_JSON = OpenAPI_ip_addr_convertToJSON(ssm->source_ip_addr); + if (source_ip_addr_local_JSON == NULL) { + ogs_error("OpenAPI_ssm_convertToJSON() failed [source_ip_addr]"); + goto end; + } + cJSON_AddItemToObject(item, "sourceIpAddr", source_ip_addr_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_ssm_convertToJSON() failed [source_ip_addr]"); + goto end; + } + + if (!ssm->dest_ip_addr) { + ogs_error("OpenAPI_ssm_convertToJSON() failed [dest_ip_addr]"); + return NULL; + } + cJSON *dest_ip_addr_local_JSON = OpenAPI_ip_addr_convertToJSON(ssm->dest_ip_addr); + if (dest_ip_addr_local_JSON == NULL) { + ogs_error("OpenAPI_ssm_convertToJSON() failed [dest_ip_addr]"); + goto end; + } + cJSON_AddItemToObject(item, "destIpAddr", dest_ip_addr_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_ssm_convertToJSON() failed [dest_ip_addr]"); + goto end; + } + +end: + return item; +} + +OpenAPI_ssm_t *OpenAPI_ssm_parseFromJSON(cJSON *ssmJSON) +{ + OpenAPI_ssm_t *ssm_local_var = NULL; + OpenAPI_lnode_t *node = NULL; + cJSON *source_ip_addr = NULL; + OpenAPI_ip_addr_t *source_ip_addr_local_nonprim = NULL; + cJSON *dest_ip_addr = NULL; + OpenAPI_ip_addr_t *dest_ip_addr_local_nonprim = NULL; + source_ip_addr = cJSON_GetObjectItemCaseSensitive(ssmJSON, "sourceIpAddr"); + if (!source_ip_addr) { + ogs_error("OpenAPI_ssm_parseFromJSON() failed [source_ip_addr]"); + goto end; + } + source_ip_addr_local_nonprim = OpenAPI_ip_addr_parseFromJSON(source_ip_addr); + + dest_ip_addr = cJSON_GetObjectItemCaseSensitive(ssmJSON, "destIpAddr"); + if (!dest_ip_addr) { + ogs_error("OpenAPI_ssm_parseFromJSON() failed [dest_ip_addr]"); + goto end; + } + dest_ip_addr_local_nonprim = OpenAPI_ip_addr_parseFromJSON(dest_ip_addr); + + ssm_local_var = OpenAPI_ssm_create ( + source_ip_addr_local_nonprim, + dest_ip_addr_local_nonprim + ); + + return ssm_local_var; +end: + if (source_ip_addr_local_nonprim) { + OpenAPI_ip_addr_free(source_ip_addr_local_nonprim); + source_ip_addr_local_nonprim = NULL; + } + if (dest_ip_addr_local_nonprim) { + OpenAPI_ip_addr_free(dest_ip_addr_local_nonprim); + dest_ip_addr_local_nonprim = NULL; + } + return NULL; +} + +OpenAPI_ssm_t *OpenAPI_ssm_copy(OpenAPI_ssm_t *dst, OpenAPI_ssm_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_ssm_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_ssm_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_ssm_free(dst); + dst = OpenAPI_ssm_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/ssm.h b/lib/sbi/openapi/model/ssm.h new file mode 100644 index 000000000..da33c832b --- /dev/null +++ b/lib/sbi/openapi/model/ssm.h @@ -0,0 +1,41 @@ +/* + * ssm.h + * + * Source specific IP multicast address + */ + +#ifndef _OpenAPI_ssm_H_ +#define _OpenAPI_ssm_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "ip_addr.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_ssm_s OpenAPI_ssm_t; +typedef struct OpenAPI_ssm_s { + struct OpenAPI_ip_addr_s *source_ip_addr; + struct OpenAPI_ip_addr_s *dest_ip_addr; +} OpenAPI_ssm_t; + +OpenAPI_ssm_t *OpenAPI_ssm_create( + OpenAPI_ip_addr_t *source_ip_addr, + OpenAPI_ip_addr_t *dest_ip_addr +); +void OpenAPI_ssm_free(OpenAPI_ssm_t *ssm); +OpenAPI_ssm_t *OpenAPI_ssm_parseFromJSON(cJSON *ssmJSON); +cJSON *OpenAPI_ssm_convertToJSON(OpenAPI_ssm_t *ssm); +OpenAPI_ssm_t *OpenAPI_ssm_copy(OpenAPI_ssm_t *dst, OpenAPI_ssm_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_ssm_H_ */ + diff --git a/lib/sbi/openapi/model/ssm_1.c b/lib/sbi/openapi/model/ssm_1.c new file mode 100644 index 000000000..ead6d784b --- /dev/null +++ b/lib/sbi/openapi/model/ssm_1.c @@ -0,0 +1,157 @@ + +#include +#include +#include +#include "ssm_1.h" + +OpenAPI_ssm_1_t *OpenAPI_ssm_1_create( + OpenAPI_ip_addr_1_t *source_ip_addr, + OpenAPI_ip_addr_1_t *dest_ip_addr +) +{ + OpenAPI_ssm_1_t *ssm_1_local_var = ogs_malloc(sizeof(OpenAPI_ssm_1_t)); + ogs_assert(ssm_1_local_var); + + ssm_1_local_var->source_ip_addr = source_ip_addr; + ssm_1_local_var->dest_ip_addr = dest_ip_addr; + + return ssm_1_local_var; +} + +void OpenAPI_ssm_1_free(OpenAPI_ssm_1_t *ssm_1) +{ + OpenAPI_lnode_t *node = NULL; + + if (NULL == ssm_1) { + return; + } + if (ssm_1->source_ip_addr) { + OpenAPI_ip_addr_1_free(ssm_1->source_ip_addr); + ssm_1->source_ip_addr = NULL; + } + if (ssm_1->dest_ip_addr) { + OpenAPI_ip_addr_1_free(ssm_1->dest_ip_addr); + ssm_1->dest_ip_addr = NULL; + } + ogs_free(ssm_1); +} + +cJSON *OpenAPI_ssm_1_convertToJSON(OpenAPI_ssm_1_t *ssm_1) +{ + cJSON *item = NULL; + OpenAPI_lnode_t *node = NULL; + + if (ssm_1 == NULL) { + ogs_error("OpenAPI_ssm_1_convertToJSON() failed [Ssm_1]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (!ssm_1->source_ip_addr) { + ogs_error("OpenAPI_ssm_1_convertToJSON() failed [source_ip_addr]"); + return NULL; + } + cJSON *source_ip_addr_local_JSON = OpenAPI_ip_addr_1_convertToJSON(ssm_1->source_ip_addr); + if (source_ip_addr_local_JSON == NULL) { + ogs_error("OpenAPI_ssm_1_convertToJSON() failed [source_ip_addr]"); + goto end; + } + cJSON_AddItemToObject(item, "sourceIpAddr", source_ip_addr_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_ssm_1_convertToJSON() failed [source_ip_addr]"); + goto end; + } + + if (!ssm_1->dest_ip_addr) { + ogs_error("OpenAPI_ssm_1_convertToJSON() failed [dest_ip_addr]"); + return NULL; + } + cJSON *dest_ip_addr_local_JSON = OpenAPI_ip_addr_1_convertToJSON(ssm_1->dest_ip_addr); + if (dest_ip_addr_local_JSON == NULL) { + ogs_error("OpenAPI_ssm_1_convertToJSON() failed [dest_ip_addr]"); + goto end; + } + cJSON_AddItemToObject(item, "destIpAddr", dest_ip_addr_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_ssm_1_convertToJSON() failed [dest_ip_addr]"); + goto end; + } + +end: + return item; +} + +OpenAPI_ssm_1_t *OpenAPI_ssm_1_parseFromJSON(cJSON *ssm_1JSON) +{ + OpenAPI_ssm_1_t *ssm_1_local_var = NULL; + OpenAPI_lnode_t *node = NULL; + cJSON *source_ip_addr = NULL; + OpenAPI_ip_addr_1_t *source_ip_addr_local_nonprim = NULL; + cJSON *dest_ip_addr = NULL; + OpenAPI_ip_addr_1_t *dest_ip_addr_local_nonprim = NULL; + source_ip_addr = cJSON_GetObjectItemCaseSensitive(ssm_1JSON, "sourceIpAddr"); + if (!source_ip_addr) { + ogs_error("OpenAPI_ssm_1_parseFromJSON() failed [source_ip_addr]"); + goto end; + } + source_ip_addr_local_nonprim = OpenAPI_ip_addr_1_parseFromJSON(source_ip_addr); + + dest_ip_addr = cJSON_GetObjectItemCaseSensitive(ssm_1JSON, "destIpAddr"); + if (!dest_ip_addr) { + ogs_error("OpenAPI_ssm_1_parseFromJSON() failed [dest_ip_addr]"); + goto end; + } + dest_ip_addr_local_nonprim = OpenAPI_ip_addr_1_parseFromJSON(dest_ip_addr); + + ssm_1_local_var = OpenAPI_ssm_1_create ( + source_ip_addr_local_nonprim, + dest_ip_addr_local_nonprim + ); + + return ssm_1_local_var; +end: + if (source_ip_addr_local_nonprim) { + OpenAPI_ip_addr_1_free(source_ip_addr_local_nonprim); + source_ip_addr_local_nonprim = NULL; + } + if (dest_ip_addr_local_nonprim) { + OpenAPI_ip_addr_1_free(dest_ip_addr_local_nonprim); + dest_ip_addr_local_nonprim = NULL; + } + return NULL; +} + +OpenAPI_ssm_1_t *OpenAPI_ssm_1_copy(OpenAPI_ssm_1_t *dst, OpenAPI_ssm_1_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_ssm_1_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_ssm_1_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_ssm_1_free(dst); + dst = OpenAPI_ssm_1_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/ssm_1.h b/lib/sbi/openapi/model/ssm_1.h new file mode 100644 index 000000000..9d051b9bb --- /dev/null +++ b/lib/sbi/openapi/model/ssm_1.h @@ -0,0 +1,41 @@ +/* + * ssm_1.h + * + * Source specific IP multicast address + */ + +#ifndef _OpenAPI_ssm_1_H_ +#define _OpenAPI_ssm_1_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "ip_addr_1.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_ssm_1_s OpenAPI_ssm_1_t; +typedef struct OpenAPI_ssm_1_s { + struct OpenAPI_ip_addr_1_s *source_ip_addr; + struct OpenAPI_ip_addr_1_s *dest_ip_addr; +} OpenAPI_ssm_1_t; + +OpenAPI_ssm_1_t *OpenAPI_ssm_1_create( + OpenAPI_ip_addr_1_t *source_ip_addr, + OpenAPI_ip_addr_1_t *dest_ip_addr +); +void OpenAPI_ssm_1_free(OpenAPI_ssm_1_t *ssm_1); +OpenAPI_ssm_1_t *OpenAPI_ssm_1_parseFromJSON(cJSON *ssm_1JSON); +cJSON *OpenAPI_ssm_1_convertToJSON(OpenAPI_ssm_1_t *ssm_1); +OpenAPI_ssm_1_t *OpenAPI_ssm_1_copy(OpenAPI_ssm_1_t *dst, OpenAPI_ssm_1_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_ssm_1_H_ */ + diff --git a/lib/sbi/openapi/model/stationary_indication_rm.h b/lib/sbi/openapi/model/stationary_indication_rm.h index 6235f4708..d7345aa48 100644 --- a/lib/sbi/openapi/model/stationary_indication_rm.h +++ b/lib/sbi/openapi/model/stationary_indication_rm.h @@ -1,7 +1,7 @@ /* * stationary_indication_rm.h * - * + * This enumeration is defined in the same way as the 'StationaryIndication' enumeration, but with the OpenAPI 'nullable: true' property.\" */ #ifndef _OpenAPI_stationary_indication_rm_H_ diff --git a/lib/sbi/openapi/model/status_info.h b/lib/sbi/openapi/model/status_info.h index b4fc0c689..1e8e7e62e 100644 --- a/lib/sbi/openapi/model/status_info.h +++ b/lib/sbi/openapi/model/status_info.h @@ -1,7 +1,7 @@ /* * status_info.h * - * + * Status of SM context or of PDU session */ #ifndef _OpenAPI_status_info_H_ diff --git a/lib/sbi/openapi/model/status_notification.c b/lib/sbi/openapi/model/status_notification.c index 2e3ffe90b..141e2682f 100644 --- a/lib/sbi/openapi/model/status_notification.c +++ b/lib/sbi/openapi/model/status_notification.c @@ -7,7 +7,13 @@ OpenAPI_status_notification_t *OpenAPI_status_notification_create( OpenAPI_status_info_t *status_info, OpenAPI_small_data_rate_status_t *small_data_rate_status, - OpenAPI_apn_rate_status_t *apn_rate_status + OpenAPI_apn_rate_status_t *apn_rate_status, + OpenAPI_target_dnai_info_t *target_dnai_info, + char *old_pdu_session_ref, + char *new_smf_id, + OpenAPI_eps_pdn_cnx_info_t *eps_pdn_cnx_info, + char *inter_plmn_api_root, + char *intra_plmn_api_root ) { OpenAPI_status_notification_t *status_notification_local_var = ogs_malloc(sizeof(OpenAPI_status_notification_t)); @@ -16,6 +22,12 @@ OpenAPI_status_notification_t *OpenAPI_status_notification_create( status_notification_local_var->status_info = status_info; status_notification_local_var->small_data_rate_status = small_data_rate_status; status_notification_local_var->apn_rate_status = apn_rate_status; + status_notification_local_var->target_dnai_info = target_dnai_info; + status_notification_local_var->old_pdu_session_ref = old_pdu_session_ref; + status_notification_local_var->new_smf_id = new_smf_id; + status_notification_local_var->eps_pdn_cnx_info = eps_pdn_cnx_info; + status_notification_local_var->inter_plmn_api_root = inter_plmn_api_root; + status_notification_local_var->intra_plmn_api_root = intra_plmn_api_root; return status_notification_local_var; } @@ -39,6 +51,30 @@ void OpenAPI_status_notification_free(OpenAPI_status_notification_t *status_noti OpenAPI_apn_rate_status_free(status_notification->apn_rate_status); status_notification->apn_rate_status = NULL; } + if (status_notification->target_dnai_info) { + OpenAPI_target_dnai_info_free(status_notification->target_dnai_info); + status_notification->target_dnai_info = NULL; + } + if (status_notification->old_pdu_session_ref) { + ogs_free(status_notification->old_pdu_session_ref); + status_notification->old_pdu_session_ref = NULL; + } + if (status_notification->new_smf_id) { + ogs_free(status_notification->new_smf_id); + status_notification->new_smf_id = NULL; + } + if (status_notification->eps_pdn_cnx_info) { + OpenAPI_eps_pdn_cnx_info_free(status_notification->eps_pdn_cnx_info); + status_notification->eps_pdn_cnx_info = NULL; + } + if (status_notification->inter_plmn_api_root) { + ogs_free(status_notification->inter_plmn_api_root); + status_notification->inter_plmn_api_root = NULL; + } + if (status_notification->intra_plmn_api_root) { + ogs_free(status_notification->intra_plmn_api_root); + status_notification->intra_plmn_api_root = NULL; + } ogs_free(status_notification); } @@ -94,6 +130,60 @@ cJSON *OpenAPI_status_notification_convertToJSON(OpenAPI_status_notification_t * } } + if (status_notification->target_dnai_info) { + cJSON *target_dnai_info_local_JSON = OpenAPI_target_dnai_info_convertToJSON(status_notification->target_dnai_info); + if (target_dnai_info_local_JSON == NULL) { + ogs_error("OpenAPI_status_notification_convertToJSON() failed [target_dnai_info]"); + goto end; + } + cJSON_AddItemToObject(item, "targetDnaiInfo", target_dnai_info_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_status_notification_convertToJSON() failed [target_dnai_info]"); + goto end; + } + } + + if (status_notification->old_pdu_session_ref) { + if (cJSON_AddStringToObject(item, "oldPduSessionRef", status_notification->old_pdu_session_ref) == NULL) { + ogs_error("OpenAPI_status_notification_convertToJSON() failed [old_pdu_session_ref]"); + goto end; + } + } + + if (status_notification->new_smf_id) { + if (cJSON_AddStringToObject(item, "newSmfId", status_notification->new_smf_id) == NULL) { + ogs_error("OpenAPI_status_notification_convertToJSON() failed [new_smf_id]"); + goto end; + } + } + + if (status_notification->eps_pdn_cnx_info) { + cJSON *eps_pdn_cnx_info_local_JSON = OpenAPI_eps_pdn_cnx_info_convertToJSON(status_notification->eps_pdn_cnx_info); + if (eps_pdn_cnx_info_local_JSON == NULL) { + ogs_error("OpenAPI_status_notification_convertToJSON() failed [eps_pdn_cnx_info]"); + goto end; + } + cJSON_AddItemToObject(item, "epsPdnCnxInfo", eps_pdn_cnx_info_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_status_notification_convertToJSON() failed [eps_pdn_cnx_info]"); + goto end; + } + } + + if (status_notification->inter_plmn_api_root) { + if (cJSON_AddStringToObject(item, "interPlmnApiRoot", status_notification->inter_plmn_api_root) == NULL) { + ogs_error("OpenAPI_status_notification_convertToJSON() failed [inter_plmn_api_root]"); + goto end; + } + } + + if (status_notification->intra_plmn_api_root) { + if (cJSON_AddStringToObject(item, "intraPlmnApiRoot", status_notification->intra_plmn_api_root) == NULL) { + ogs_error("OpenAPI_status_notification_convertToJSON() failed [intra_plmn_api_root]"); + goto end; + } + } + end: return item; } @@ -108,6 +198,14 @@ OpenAPI_status_notification_t *OpenAPI_status_notification_parseFromJSON(cJSON * OpenAPI_small_data_rate_status_t *small_data_rate_status_local_nonprim = NULL; cJSON *apn_rate_status = NULL; OpenAPI_apn_rate_status_t *apn_rate_status_local_nonprim = NULL; + cJSON *target_dnai_info = NULL; + OpenAPI_target_dnai_info_t *target_dnai_info_local_nonprim = NULL; + cJSON *old_pdu_session_ref = NULL; + cJSON *new_smf_id = NULL; + cJSON *eps_pdn_cnx_info = NULL; + OpenAPI_eps_pdn_cnx_info_t *eps_pdn_cnx_info_local_nonprim = NULL; + cJSON *inter_plmn_api_root = NULL; + cJSON *intra_plmn_api_root = NULL; status_info = cJSON_GetObjectItemCaseSensitive(status_notificationJSON, "statusInfo"); if (!status_info) { ogs_error("OpenAPI_status_notification_parseFromJSON() failed [status_info]"); @@ -125,10 +223,58 @@ OpenAPI_status_notification_t *OpenAPI_status_notification_parseFromJSON(cJSON * apn_rate_status_local_nonprim = OpenAPI_apn_rate_status_parseFromJSON(apn_rate_status); } + target_dnai_info = cJSON_GetObjectItemCaseSensitive(status_notificationJSON, "targetDnaiInfo"); + if (target_dnai_info) { + target_dnai_info_local_nonprim = OpenAPI_target_dnai_info_parseFromJSON(target_dnai_info); + } + + old_pdu_session_ref = cJSON_GetObjectItemCaseSensitive(status_notificationJSON, "oldPduSessionRef"); + if (old_pdu_session_ref) { + if (!cJSON_IsString(old_pdu_session_ref) && !cJSON_IsNull(old_pdu_session_ref)) { + ogs_error("OpenAPI_status_notification_parseFromJSON() failed [old_pdu_session_ref]"); + goto end; + } + } + + new_smf_id = cJSON_GetObjectItemCaseSensitive(status_notificationJSON, "newSmfId"); + if (new_smf_id) { + if (!cJSON_IsString(new_smf_id) && !cJSON_IsNull(new_smf_id)) { + ogs_error("OpenAPI_status_notification_parseFromJSON() failed [new_smf_id]"); + goto end; + } + } + + eps_pdn_cnx_info = cJSON_GetObjectItemCaseSensitive(status_notificationJSON, "epsPdnCnxInfo"); + if (eps_pdn_cnx_info) { + eps_pdn_cnx_info_local_nonprim = OpenAPI_eps_pdn_cnx_info_parseFromJSON(eps_pdn_cnx_info); + } + + inter_plmn_api_root = cJSON_GetObjectItemCaseSensitive(status_notificationJSON, "interPlmnApiRoot"); + if (inter_plmn_api_root) { + if (!cJSON_IsString(inter_plmn_api_root) && !cJSON_IsNull(inter_plmn_api_root)) { + ogs_error("OpenAPI_status_notification_parseFromJSON() failed [inter_plmn_api_root]"); + goto end; + } + } + + intra_plmn_api_root = cJSON_GetObjectItemCaseSensitive(status_notificationJSON, "intraPlmnApiRoot"); + if (intra_plmn_api_root) { + if (!cJSON_IsString(intra_plmn_api_root) && !cJSON_IsNull(intra_plmn_api_root)) { + ogs_error("OpenAPI_status_notification_parseFromJSON() failed [intra_plmn_api_root]"); + goto end; + } + } + status_notification_local_var = OpenAPI_status_notification_create ( status_info_local_nonprim, small_data_rate_status ? small_data_rate_status_local_nonprim : NULL, - apn_rate_status ? apn_rate_status_local_nonprim : NULL + apn_rate_status ? apn_rate_status_local_nonprim : NULL, + target_dnai_info ? target_dnai_info_local_nonprim : NULL, + old_pdu_session_ref && !cJSON_IsNull(old_pdu_session_ref) ? ogs_strdup(old_pdu_session_ref->valuestring) : NULL, + new_smf_id && !cJSON_IsNull(new_smf_id) ? ogs_strdup(new_smf_id->valuestring) : NULL, + eps_pdn_cnx_info ? eps_pdn_cnx_info_local_nonprim : NULL, + inter_plmn_api_root && !cJSON_IsNull(inter_plmn_api_root) ? ogs_strdup(inter_plmn_api_root->valuestring) : NULL, + intra_plmn_api_root && !cJSON_IsNull(intra_plmn_api_root) ? ogs_strdup(intra_plmn_api_root->valuestring) : NULL ); return status_notification_local_var; @@ -145,6 +291,14 @@ end: OpenAPI_apn_rate_status_free(apn_rate_status_local_nonprim); apn_rate_status_local_nonprim = NULL; } + if (target_dnai_info_local_nonprim) { + OpenAPI_target_dnai_info_free(target_dnai_info_local_nonprim); + target_dnai_info_local_nonprim = NULL; + } + if (eps_pdn_cnx_info_local_nonprim) { + OpenAPI_eps_pdn_cnx_info_free(eps_pdn_cnx_info_local_nonprim); + eps_pdn_cnx_info_local_nonprim = NULL; + } return NULL; } diff --git a/lib/sbi/openapi/model/status_notification.h b/lib/sbi/openapi/model/status_notification.h index 8a9127ac2..0341b61ca 100644 --- a/lib/sbi/openapi/model/status_notification.h +++ b/lib/sbi/openapi/model/status_notification.h @@ -1,7 +1,7 @@ /* * status_notification.h * - * + * Data within Notify Status Request */ #ifndef _OpenAPI_status_notification_H_ @@ -13,8 +13,10 @@ #include "../include/keyValuePair.h" #include "../include/binary.h" #include "apn_rate_status.h" +#include "eps_pdn_cnx_info.h" #include "small_data_rate_status.h" #include "status_info.h" +#include "target_dnai_info.h" #ifdef __cplusplus extern "C" { @@ -25,12 +27,24 @@ typedef struct OpenAPI_status_notification_s { struct OpenAPI_status_info_s *status_info; struct OpenAPI_small_data_rate_status_s *small_data_rate_status; struct OpenAPI_apn_rate_status_s *apn_rate_status; + struct OpenAPI_target_dnai_info_s *target_dnai_info; + char *old_pdu_session_ref; + char *new_smf_id; + struct OpenAPI_eps_pdn_cnx_info_s *eps_pdn_cnx_info; + char *inter_plmn_api_root; + char *intra_plmn_api_root; } OpenAPI_status_notification_t; OpenAPI_status_notification_t *OpenAPI_status_notification_create( OpenAPI_status_info_t *status_info, OpenAPI_small_data_rate_status_t *small_data_rate_status, - OpenAPI_apn_rate_status_t *apn_rate_status + OpenAPI_apn_rate_status_t *apn_rate_status, + OpenAPI_target_dnai_info_t *target_dnai_info, + char *old_pdu_session_ref, + char *new_smf_id, + OpenAPI_eps_pdn_cnx_info_t *eps_pdn_cnx_info, + char *inter_plmn_api_root, + char *intra_plmn_api_root ); void OpenAPI_status_notification_free(OpenAPI_status_notification_t *status_notification); OpenAPI_status_notification_t *OpenAPI_status_notification_parseFromJSON(cJSON *status_notificationJSON); diff --git a/lib/sbi/openapi/model/steer_mode_indicator.c b/lib/sbi/openapi/model/steer_mode_indicator.c new file mode 100644 index 000000000..f3161612a --- /dev/null +++ b/lib/sbi/openapi/model/steer_mode_indicator.c @@ -0,0 +1,30 @@ + +#include +#include +#include +#include "steer_mode_indicator.h" + +char* OpenAPI_steer_mode_indicator_ToString(OpenAPI_steer_mode_indicator_e steer_mode_indicator) +{ + const char *steer_mode_indicatorArray[] = { "NULL", "AUTO_LOAD_BALANCE", "UE_ASSISTANCE" }; + size_t sizeofArray = sizeof(steer_mode_indicatorArray) / sizeof(steer_mode_indicatorArray[0]); + if (steer_mode_indicator < sizeofArray) + return (char *)steer_mode_indicatorArray[steer_mode_indicator]; + else + return (char *)"Unknown"; +} + +OpenAPI_steer_mode_indicator_e OpenAPI_steer_mode_indicator_FromString(char* steer_mode_indicator) +{ + int stringToReturn = 0; + const char *steer_mode_indicatorArray[] = { "NULL", "AUTO_LOAD_BALANCE", "UE_ASSISTANCE" }; + size_t sizeofArray = sizeof(steer_mode_indicatorArray) / sizeof(steer_mode_indicatorArray[0]); + while (stringToReturn < sizeofArray) { + if (strcmp(steer_mode_indicator, steer_mode_indicatorArray[stringToReturn]) == 0) { + return stringToReturn; + } + stringToReturn++; + } + return 0; +} + diff --git a/lib/sbi/openapi/model/steer_mode_indicator.h b/lib/sbi/openapi/model/steer_mode_indicator.h new file mode 100644 index 000000000..f594c5b1e --- /dev/null +++ b/lib/sbi/openapi/model/steer_mode_indicator.h @@ -0,0 +1,31 @@ +/* + * steer_mode_indicator.h + * + * + */ + +#ifndef _OpenAPI_steer_mode_indicator_H_ +#define _OpenAPI_steer_mode_indicator_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef enum { OpenAPI_steer_mode_indicator_NULL = 0, OpenAPI_steer_mode_indicator_AUTO_LOAD_BALANCE, OpenAPI_steer_mode_indicator_UE_ASSISTANCE } OpenAPI_steer_mode_indicator_e; + +char* OpenAPI_steer_mode_indicator_ToString(OpenAPI_steer_mode_indicator_e steer_mode_indicator); + +OpenAPI_steer_mode_indicator_e OpenAPI_steer_mode_indicator_FromString(char* steer_mode_indicator); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_steer_mode_indicator_H_ */ + diff --git a/lib/sbi/openapi/model/steering_info.h b/lib/sbi/openapi/model/steering_info.h index befd2e228..7b6858d75 100644 --- a/lib/sbi/openapi/model/steering_info.h +++ b/lib/sbi/openapi/model/steering_info.h @@ -1,7 +1,7 @@ /* * steering_info.h * - * + * Contains a combination of one PLMN identity and zero or more access technologies. */ #ifndef _OpenAPI_steering_info_H_ diff --git a/lib/sbi/openapi/model/steering_mode.c b/lib/sbi/openapi/model/steering_mode.c index bb94d85f2..6e06aad9e 100644 --- a/lib/sbi/openapi/model/steering_mode.c +++ b/lib/sbi/openapi/model/steering_mode.c @@ -10,7 +10,9 @@ OpenAPI_steering_mode_t *OpenAPI_steering_mode_create( OpenAPI_access_type_rm_t *standby, bool is__3g_load, int _3g_load, - OpenAPI_access_type_e prio_acc + OpenAPI_access_type_e prio_acc, + OpenAPI_threshold_value_t *thres_value, + OpenAPI_steer_mode_indicator_e steer_mode_ind ) { OpenAPI_steering_mode_t *steering_mode_local_var = ogs_malloc(sizeof(OpenAPI_steering_mode_t)); @@ -22,6 +24,8 @@ OpenAPI_steering_mode_t *OpenAPI_steering_mode_create( steering_mode_local_var->is__3g_load = is__3g_load; steering_mode_local_var->_3g_load = _3g_load; steering_mode_local_var->prio_acc = prio_acc; + steering_mode_local_var->thres_value = thres_value; + steering_mode_local_var->steer_mode_ind = steer_mode_ind; return steering_mode_local_var; } @@ -37,6 +41,10 @@ void OpenAPI_steering_mode_free(OpenAPI_steering_mode_t *steering_mode) OpenAPI_access_type_rm_free(steering_mode->standby); steering_mode->standby = NULL; } + if (steering_mode->thres_value) { + OpenAPI_threshold_value_free(steering_mode->thres_value); + steering_mode->thres_value = NULL; + } ogs_free(steering_mode); } @@ -94,6 +102,26 @@ cJSON *OpenAPI_steering_mode_convertToJSON(OpenAPI_steering_mode_t *steering_mod } } + if (steering_mode->thres_value) { + cJSON *thres_value_local_JSON = OpenAPI_threshold_value_convertToJSON(steering_mode->thres_value); + if (thres_value_local_JSON == NULL) { + ogs_error("OpenAPI_steering_mode_convertToJSON() failed [thres_value]"); + goto end; + } + cJSON_AddItemToObject(item, "thresValue", thres_value_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_steering_mode_convertToJSON() failed [thres_value]"); + goto end; + } + } + + if (steering_mode->steer_mode_ind != OpenAPI_steer_mode_indicator_NULL) { + if (cJSON_AddStringToObject(item, "steerModeInd", OpenAPI_steer_mode_indicator_ToString(steering_mode->steer_mode_ind)) == NULL) { + ogs_error("OpenAPI_steering_mode_convertToJSON() failed [steer_mode_ind]"); + goto end; + } + } + end: return item; } @@ -111,6 +139,10 @@ OpenAPI_steering_mode_t *OpenAPI_steering_mode_parseFromJSON(cJSON *steering_mod cJSON *_3g_load = NULL; cJSON *prio_acc = NULL; OpenAPI_access_type_e prio_accVariable = 0; + cJSON *thres_value = NULL; + OpenAPI_threshold_value_t *thres_value_local_nonprim = NULL; + cJSON *steer_mode_ind = NULL; + OpenAPI_steer_mode_indicator_e steer_mode_indVariable = 0; steer_mode_value = cJSON_GetObjectItemCaseSensitive(steering_modeJSON, "steerModeValue"); if (!steer_mode_value) { ogs_error("OpenAPI_steering_mode_parseFromJSON() failed [steer_mode_value]"); @@ -153,13 +185,29 @@ OpenAPI_steering_mode_t *OpenAPI_steering_mode_parseFromJSON(cJSON *steering_mod prio_accVariable = OpenAPI_access_type_FromString(prio_acc->valuestring); } + thres_value = cJSON_GetObjectItemCaseSensitive(steering_modeJSON, "thresValue"); + if (thres_value) { + thres_value_local_nonprim = OpenAPI_threshold_value_parseFromJSON(thres_value); + } + + steer_mode_ind = cJSON_GetObjectItemCaseSensitive(steering_modeJSON, "steerModeInd"); + if (steer_mode_ind) { + if (!cJSON_IsString(steer_mode_ind)) { + ogs_error("OpenAPI_steering_mode_parseFromJSON() failed [steer_mode_ind]"); + goto end; + } + steer_mode_indVariable = OpenAPI_steer_mode_indicator_FromString(steer_mode_ind->valuestring); + } + steering_mode_local_var = OpenAPI_steering_mode_create ( steer_mode_valueVariable, active ? activeVariable : 0, standby ? standby_local_nonprim : NULL, _3g_load ? true : false, _3g_load ? _3g_load->valuedouble : 0, - prio_acc ? prio_accVariable : 0 + prio_acc ? prio_accVariable : 0, + thres_value ? thres_value_local_nonprim : NULL, + steer_mode_ind ? steer_mode_indVariable : 0 ); return steering_mode_local_var; @@ -168,6 +216,10 @@ end: OpenAPI_access_type_rm_free(standby_local_nonprim); standby_local_nonprim = NULL; } + if (thres_value_local_nonprim) { + OpenAPI_threshold_value_free(thres_value_local_nonprim); + thres_value_local_nonprim = NULL; + } return NULL; } diff --git a/lib/sbi/openapi/model/steering_mode.h b/lib/sbi/openapi/model/steering_mode.h index 750224250..d5c76ae97 100644 --- a/lib/sbi/openapi/model/steering_mode.h +++ b/lib/sbi/openapi/model/steering_mode.h @@ -1,7 +1,7 @@ /* * steering_mode.h * - * + * Contains the steering mode value and parameters determined by the PCF. */ #ifndef _OpenAPI_steering_mode_H_ @@ -14,7 +14,9 @@ #include "../include/binary.h" #include "access_type.h" #include "access_type_rm.h" +#include "steer_mode_indicator.h" #include "steer_mode_value.h" +#include "threshold_value.h" #ifdef __cplusplus extern "C" { @@ -28,6 +30,8 @@ typedef struct OpenAPI_steering_mode_s { bool is__3g_load; int _3g_load; OpenAPI_access_type_e prio_acc; + struct OpenAPI_threshold_value_s *thres_value; + OpenAPI_steer_mode_indicator_e steer_mode_ind; } OpenAPI_steering_mode_t; OpenAPI_steering_mode_t *OpenAPI_steering_mode_create( @@ -36,7 +40,9 @@ OpenAPI_steering_mode_t *OpenAPI_steering_mode_create( OpenAPI_access_type_rm_t *standby, bool is__3g_load, int _3g_load, - OpenAPI_access_type_e prio_acc + OpenAPI_access_type_e prio_acc, + OpenAPI_threshold_value_t *thres_value, + OpenAPI_steer_mode_indicator_e steer_mode_ind ); void OpenAPI_steering_mode_free(OpenAPI_steering_mode_t *steering_mode); OpenAPI_steering_mode_t *OpenAPI_steering_mode_parseFromJSON(cJSON *steering_modeJSON); diff --git a/lib/sbi/openapi/model/stored_search_result.h b/lib/sbi/openapi/model/stored_search_result.h index c7d43158b..7686d2af1 100644 --- a/lib/sbi/openapi/model/stored_search_result.h +++ b/lib/sbi/openapi/model/stored_search_result.h @@ -1,7 +1,7 @@ /* * stored_search_result.h * - * Contains a complete search result (i.e. a number of discovered NF Instances), stored by NRF as a consequence of a prior search result + * Contains a complete search result (i.e. a number of discovered NF Instances), stored by NRF as a consequence of a prior search result */ #ifndef _OpenAPI_stored_search_result_H_ diff --git a/lib/sbi/openapi/model/subscr_cond.c b/lib/sbi/openapi/model/subscr_cond.c new file mode 100644 index 000000000..d641fb351 --- /dev/null +++ b/lib/sbi/openapi/model/subscr_cond.c @@ -0,0 +1,665 @@ + +#include +#include +#include +#include "subscr_cond.h" + +OpenAPI_subscr_cond_t *OpenAPI_subscr_cond_create( + char *nf_instance_id, + OpenAPI_list_t *nf_instance_list, + OpenAPI_nf_type_e nf_type, + char *service_name, + OpenAPI_list_t *service_name_list, + char *amf_set_id, + char *amf_region_id, + OpenAPI_list_t *guami_list, + OpenAPI_list_t *snssai_list, + OpenAPI_list_t *nsi_list, + char *nf_group_id, + char *nf_set_id, + char *nf_service_set_id, + OpenAPI_list_t *smf_serving_area, + OpenAPI_list_t *tai_list +) +{ + OpenAPI_subscr_cond_t *subscr_cond_local_var = ogs_malloc(sizeof(OpenAPI_subscr_cond_t)); + ogs_assert(subscr_cond_local_var); + + subscr_cond_local_var->nf_instance_id = nf_instance_id; + subscr_cond_local_var->nf_instance_list = nf_instance_list; + subscr_cond_local_var->nf_type = nf_type; + subscr_cond_local_var->service_name = service_name; + subscr_cond_local_var->service_name_list = service_name_list; + subscr_cond_local_var->amf_set_id = amf_set_id; + subscr_cond_local_var->amf_region_id = amf_region_id; + subscr_cond_local_var->guami_list = guami_list; + subscr_cond_local_var->snssai_list = snssai_list; + subscr_cond_local_var->nsi_list = nsi_list; + subscr_cond_local_var->nf_group_id = nf_group_id; + subscr_cond_local_var->nf_set_id = nf_set_id; + subscr_cond_local_var->nf_service_set_id = nf_service_set_id; + subscr_cond_local_var->smf_serving_area = smf_serving_area; + subscr_cond_local_var->tai_list = tai_list; + + return subscr_cond_local_var; +} + +void OpenAPI_subscr_cond_free(OpenAPI_subscr_cond_t *subscr_cond) +{ + OpenAPI_lnode_t *node = NULL; + + if (NULL == subscr_cond) { + return; + } + if (subscr_cond->nf_instance_id) { + ogs_free(subscr_cond->nf_instance_id); + subscr_cond->nf_instance_id = NULL; + } + if (subscr_cond->nf_instance_list) { + OpenAPI_list_for_each(subscr_cond->nf_instance_list, node) { + ogs_free(node->data); + } + OpenAPI_list_free(subscr_cond->nf_instance_list); + subscr_cond->nf_instance_list = NULL; + } + if (subscr_cond->service_name) { + ogs_free(subscr_cond->service_name); + subscr_cond->service_name = NULL; + } + if (subscr_cond->service_name_list) { + OpenAPI_list_for_each(subscr_cond->service_name_list, node) { + ogs_free(node->data); + } + OpenAPI_list_free(subscr_cond->service_name_list); + subscr_cond->service_name_list = NULL; + } + if (subscr_cond->amf_set_id) { + ogs_free(subscr_cond->amf_set_id); + subscr_cond->amf_set_id = NULL; + } + if (subscr_cond->amf_region_id) { + ogs_free(subscr_cond->amf_region_id); + subscr_cond->amf_region_id = NULL; + } + if (subscr_cond->guami_list) { + OpenAPI_list_for_each(subscr_cond->guami_list, node) { + OpenAPI_guami_free(node->data); + } + OpenAPI_list_free(subscr_cond->guami_list); + subscr_cond->guami_list = NULL; + } + if (subscr_cond->snssai_list) { + OpenAPI_list_for_each(subscr_cond->snssai_list, node) { + OpenAPI_snssai_free(node->data); + } + OpenAPI_list_free(subscr_cond->snssai_list); + subscr_cond->snssai_list = NULL; + } + if (subscr_cond->nsi_list) { + OpenAPI_list_for_each(subscr_cond->nsi_list, node) { + ogs_free(node->data); + } + OpenAPI_list_free(subscr_cond->nsi_list); + subscr_cond->nsi_list = NULL; + } + if (subscr_cond->nf_group_id) { + ogs_free(subscr_cond->nf_group_id); + subscr_cond->nf_group_id = NULL; + } + if (subscr_cond->nf_set_id) { + ogs_free(subscr_cond->nf_set_id); + subscr_cond->nf_set_id = NULL; + } + if (subscr_cond->nf_service_set_id) { + ogs_free(subscr_cond->nf_service_set_id); + subscr_cond->nf_service_set_id = NULL; + } + if (subscr_cond->smf_serving_area) { + OpenAPI_list_for_each(subscr_cond->smf_serving_area, node) { + ogs_free(node->data); + } + OpenAPI_list_free(subscr_cond->smf_serving_area); + subscr_cond->smf_serving_area = NULL; + } + if (subscr_cond->tai_list) { + OpenAPI_list_for_each(subscr_cond->tai_list, node) { + OpenAPI_tai_free(node->data); + } + OpenAPI_list_free(subscr_cond->tai_list); + subscr_cond->tai_list = NULL; + } + ogs_free(subscr_cond); +} + +cJSON *OpenAPI_subscr_cond_convertToJSON(OpenAPI_subscr_cond_t *subscr_cond) +{ + cJSON *item = NULL; + OpenAPI_lnode_t *node = NULL; + + if (subscr_cond == NULL) { + ogs_error("OpenAPI_subscr_cond_convertToJSON() failed [SubscrCond]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (subscr_cond->nf_instance_id) { + if (cJSON_AddStringToObject(item, "nfInstanceId", subscr_cond->nf_instance_id) == NULL) { + ogs_error("OpenAPI_subscr_cond_convertToJSON() failed [nf_instance_id]"); + goto end; + } + } + + if (subscr_cond->nf_instance_list) { + cJSON *nf_instance_listList = cJSON_AddArrayToObject(item, "nfInstanceList"); + if (nf_instance_listList == NULL) { + ogs_error("OpenAPI_subscr_cond_convertToJSON() failed [nf_instance_list]"); + goto end; + } + OpenAPI_list_for_each(subscr_cond->nf_instance_list, node) { + if (cJSON_AddStringToObject(nf_instance_listList, "", (char*)node->data) == NULL) { + ogs_error("OpenAPI_subscr_cond_convertToJSON() failed [nf_instance_list]"); + goto end; + } + } + } + + if (subscr_cond->nf_type != OpenAPI_nf_type_NULL) { + if (cJSON_AddStringToObject(item, "nfType", OpenAPI_nf_type_ToString(subscr_cond->nf_type)) == NULL) { + ogs_error("OpenAPI_subscr_cond_convertToJSON() failed [nf_type]"); + goto end; + } + } + + if (subscr_cond->service_name) { + if (cJSON_AddStringToObject(item, "serviceName", subscr_cond->service_name) == NULL) { + ogs_error("OpenAPI_subscr_cond_convertToJSON() failed [service_name]"); + goto end; + } + } + + if (subscr_cond->service_name_list) { + cJSON *service_name_listList = cJSON_AddArrayToObject(item, "serviceNameList"); + if (service_name_listList == NULL) { + ogs_error("OpenAPI_subscr_cond_convertToJSON() failed [service_name_list]"); + goto end; + } + OpenAPI_list_for_each(subscr_cond->service_name_list, node) { + if (cJSON_AddStringToObject(service_name_listList, "", (char*)node->data) == NULL) { + ogs_error("OpenAPI_subscr_cond_convertToJSON() failed [service_name_list]"); + goto end; + } + } + } + + if (subscr_cond->amf_set_id) { + if (cJSON_AddStringToObject(item, "amfSetId", subscr_cond->amf_set_id) == NULL) { + ogs_error("OpenAPI_subscr_cond_convertToJSON() failed [amf_set_id]"); + goto end; + } + } + + if (subscr_cond->amf_region_id) { + if (cJSON_AddStringToObject(item, "amfRegionId", subscr_cond->amf_region_id) == NULL) { + ogs_error("OpenAPI_subscr_cond_convertToJSON() failed [amf_region_id]"); + goto end; + } + } + + if (subscr_cond->guami_list) { + cJSON *guami_listList = cJSON_AddArrayToObject(item, "guamiList"); + if (guami_listList == NULL) { + ogs_error("OpenAPI_subscr_cond_convertToJSON() failed [guami_list]"); + goto end; + } + OpenAPI_list_for_each(subscr_cond->guami_list, node) { + cJSON *itemLocal = OpenAPI_guami_convertToJSON(node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_subscr_cond_convertToJSON() failed [guami_list]"); + goto end; + } + cJSON_AddItemToArray(guami_listList, itemLocal); + } + } + + if (subscr_cond->snssai_list) { + cJSON *snssai_listList = cJSON_AddArrayToObject(item, "snssaiList"); + if (snssai_listList == NULL) { + ogs_error("OpenAPI_subscr_cond_convertToJSON() failed [snssai_list]"); + goto end; + } + OpenAPI_list_for_each(subscr_cond->snssai_list, node) { + cJSON *itemLocal = OpenAPI_snssai_convertToJSON(node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_subscr_cond_convertToJSON() failed [snssai_list]"); + goto end; + } + cJSON_AddItemToArray(snssai_listList, itemLocal); + } + } + + if (subscr_cond->nsi_list) { + cJSON *nsi_listList = cJSON_AddArrayToObject(item, "nsiList"); + if (nsi_listList == NULL) { + ogs_error("OpenAPI_subscr_cond_convertToJSON() failed [nsi_list]"); + goto end; + } + OpenAPI_list_for_each(subscr_cond->nsi_list, node) { + if (cJSON_AddStringToObject(nsi_listList, "", (char*)node->data) == NULL) { + ogs_error("OpenAPI_subscr_cond_convertToJSON() failed [nsi_list]"); + goto end; + } + } + } + + if (subscr_cond->nf_group_id) { + if (cJSON_AddStringToObject(item, "nfGroupId", subscr_cond->nf_group_id) == NULL) { + ogs_error("OpenAPI_subscr_cond_convertToJSON() failed [nf_group_id]"); + goto end; + } + } + + if (subscr_cond->nf_set_id) { + if (cJSON_AddStringToObject(item, "nfSetId", subscr_cond->nf_set_id) == NULL) { + ogs_error("OpenAPI_subscr_cond_convertToJSON() failed [nf_set_id]"); + goto end; + } + } + + if (subscr_cond->nf_service_set_id) { + if (cJSON_AddStringToObject(item, "nfServiceSetId", subscr_cond->nf_service_set_id) == NULL) { + ogs_error("OpenAPI_subscr_cond_convertToJSON() failed [nf_service_set_id]"); + goto end; + } + } + + if (subscr_cond->smf_serving_area) { + cJSON *smf_serving_areaList = cJSON_AddArrayToObject(item, "smfServingArea"); + if (smf_serving_areaList == NULL) { + ogs_error("OpenAPI_subscr_cond_convertToJSON() failed [smf_serving_area]"); + goto end; + } + OpenAPI_list_for_each(subscr_cond->smf_serving_area, node) { + if (cJSON_AddStringToObject(smf_serving_areaList, "", (char*)node->data) == NULL) { + ogs_error("OpenAPI_subscr_cond_convertToJSON() failed [smf_serving_area]"); + goto end; + } + } + } + + if (subscr_cond->tai_list) { + cJSON *tai_listList = cJSON_AddArrayToObject(item, "taiList"); + if (tai_listList == NULL) { + ogs_error("OpenAPI_subscr_cond_convertToJSON() failed [tai_list]"); + goto end; + } + OpenAPI_list_for_each(subscr_cond->tai_list, node) { + cJSON *itemLocal = OpenAPI_tai_convertToJSON(node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_subscr_cond_convertToJSON() failed [tai_list]"); + goto end; + } + cJSON_AddItemToArray(tai_listList, itemLocal); + } + } + +end: + return item; +} + +OpenAPI_subscr_cond_t *OpenAPI_subscr_cond_parseFromJSON(cJSON *subscr_condJSON) +{ + OpenAPI_subscr_cond_t *subscr_cond_local_var = NULL; + OpenAPI_lnode_t *node = NULL; + cJSON *nf_instance_id = NULL; + cJSON *nf_instance_list = NULL; + OpenAPI_list_t *nf_instance_listList = NULL; + cJSON *nf_type = NULL; + OpenAPI_nf_type_e nf_typeVariable = 0; + cJSON *service_name = NULL; + cJSON *service_name_list = NULL; + OpenAPI_list_t *service_name_listList = NULL; + cJSON *amf_set_id = NULL; + cJSON *amf_region_id = NULL; + cJSON *guami_list = NULL; + OpenAPI_list_t *guami_listList = NULL; + cJSON *snssai_list = NULL; + OpenAPI_list_t *snssai_listList = NULL; + cJSON *nsi_list = NULL; + OpenAPI_list_t *nsi_listList = NULL; + cJSON *nf_group_id = NULL; + cJSON *nf_set_id = NULL; + cJSON *nf_service_set_id = NULL; + cJSON *smf_serving_area = NULL; + OpenAPI_list_t *smf_serving_areaList = NULL; + cJSON *tai_list = NULL; + OpenAPI_list_t *tai_listList = NULL; + nf_instance_id = cJSON_GetObjectItemCaseSensitive(subscr_condJSON, "nfInstanceId"); + if (nf_instance_id) { + if (!cJSON_IsString(nf_instance_id) && !cJSON_IsNull(nf_instance_id)) { + ogs_error("OpenAPI_subscr_cond_parseFromJSON() failed [nf_instance_id]"); + goto end; + } + } + + nf_instance_list = cJSON_GetObjectItemCaseSensitive(subscr_condJSON, "nfInstanceList"); + if (nf_instance_list) { + cJSON *nf_instance_list_local = NULL; + if (!cJSON_IsArray(nf_instance_list)) { + ogs_error("OpenAPI_subscr_cond_parseFromJSON() failed [nf_instance_list]"); + goto end; + } + + nf_instance_listList = OpenAPI_list_create(); + + cJSON_ArrayForEach(nf_instance_list_local, nf_instance_list) { + double *localDouble = NULL; + int *localInt = NULL; + if (!cJSON_IsString(nf_instance_list_local)) { + ogs_error("OpenAPI_subscr_cond_parseFromJSON() failed [nf_instance_list]"); + goto end; + } + OpenAPI_list_add(nf_instance_listList, ogs_strdup(nf_instance_list_local->valuestring)); + } + } + + nf_type = cJSON_GetObjectItemCaseSensitive(subscr_condJSON, "nfType"); + if (nf_type) { + if (!cJSON_IsString(nf_type)) { + ogs_error("OpenAPI_subscr_cond_parseFromJSON() failed [nf_type]"); + goto end; + } + nf_typeVariable = OpenAPI_nf_type_FromString(nf_type->valuestring); + } + + service_name = cJSON_GetObjectItemCaseSensitive(subscr_condJSON, "serviceName"); + if (service_name) { + if (!cJSON_IsString(service_name) && !cJSON_IsNull(service_name)) { + ogs_error("OpenAPI_subscr_cond_parseFromJSON() failed [service_name]"); + goto end; + } + } + + service_name_list = cJSON_GetObjectItemCaseSensitive(subscr_condJSON, "serviceNameList"); + if (service_name_list) { + cJSON *service_name_list_local = NULL; + if (!cJSON_IsArray(service_name_list)) { + ogs_error("OpenAPI_subscr_cond_parseFromJSON() failed [service_name_list]"); + goto end; + } + + service_name_listList = OpenAPI_list_create(); + + cJSON_ArrayForEach(service_name_list_local, service_name_list) { + double *localDouble = NULL; + int *localInt = NULL; + if (!cJSON_IsString(service_name_list_local)) { + ogs_error("OpenAPI_subscr_cond_parseFromJSON() failed [service_name_list]"); + goto end; + } + OpenAPI_list_add(service_name_listList, ogs_strdup(service_name_list_local->valuestring)); + } + } + + amf_set_id = cJSON_GetObjectItemCaseSensitive(subscr_condJSON, "amfSetId"); + if (amf_set_id) { + if (!cJSON_IsString(amf_set_id) && !cJSON_IsNull(amf_set_id)) { + ogs_error("OpenAPI_subscr_cond_parseFromJSON() failed [amf_set_id]"); + goto end; + } + } + + amf_region_id = cJSON_GetObjectItemCaseSensitive(subscr_condJSON, "amfRegionId"); + if (amf_region_id) { + if (!cJSON_IsString(amf_region_id) && !cJSON_IsNull(amf_region_id)) { + ogs_error("OpenAPI_subscr_cond_parseFromJSON() failed [amf_region_id]"); + goto end; + } + } + + guami_list = cJSON_GetObjectItemCaseSensitive(subscr_condJSON, "guamiList"); + if (guami_list) { + cJSON *guami_list_local = NULL; + if (!cJSON_IsArray(guami_list)) { + ogs_error("OpenAPI_subscr_cond_parseFromJSON() failed [guami_list]"); + goto end; + } + + guami_listList = OpenAPI_list_create(); + + cJSON_ArrayForEach(guami_list_local, guami_list) { + if (!cJSON_IsObject(guami_list_local)) { + ogs_error("OpenAPI_subscr_cond_parseFromJSON() failed [guami_list]"); + goto end; + } + OpenAPI_guami_t *guami_listItem = OpenAPI_guami_parseFromJSON(guami_list_local); + if (!guami_listItem) { + ogs_error("No guami_listItem"); + OpenAPI_list_free(guami_listList); + goto end; + } + OpenAPI_list_add(guami_listList, guami_listItem); + } + } + + snssai_list = cJSON_GetObjectItemCaseSensitive(subscr_condJSON, "snssaiList"); + if (snssai_list) { + cJSON *snssai_list_local = NULL; + if (!cJSON_IsArray(snssai_list)) { + ogs_error("OpenAPI_subscr_cond_parseFromJSON() failed [snssai_list]"); + goto end; + } + + snssai_listList = OpenAPI_list_create(); + + cJSON_ArrayForEach(snssai_list_local, snssai_list) { + if (!cJSON_IsObject(snssai_list_local)) { + ogs_error("OpenAPI_subscr_cond_parseFromJSON() failed [snssai_list]"); + goto end; + } + OpenAPI_snssai_t *snssai_listItem = OpenAPI_snssai_parseFromJSON(snssai_list_local); + if (!snssai_listItem) { + ogs_error("No snssai_listItem"); + OpenAPI_list_free(snssai_listList); + goto end; + } + OpenAPI_list_add(snssai_listList, snssai_listItem); + } + } + + nsi_list = cJSON_GetObjectItemCaseSensitive(subscr_condJSON, "nsiList"); + if (nsi_list) { + cJSON *nsi_list_local = NULL; + if (!cJSON_IsArray(nsi_list)) { + ogs_error("OpenAPI_subscr_cond_parseFromJSON() failed [nsi_list]"); + goto end; + } + + nsi_listList = OpenAPI_list_create(); + + cJSON_ArrayForEach(nsi_list_local, nsi_list) { + double *localDouble = NULL; + int *localInt = NULL; + if (!cJSON_IsString(nsi_list_local)) { + ogs_error("OpenAPI_subscr_cond_parseFromJSON() failed [nsi_list]"); + goto end; + } + OpenAPI_list_add(nsi_listList, ogs_strdup(nsi_list_local->valuestring)); + } + } + + nf_group_id = cJSON_GetObjectItemCaseSensitive(subscr_condJSON, "nfGroupId"); + if (nf_group_id) { + if (!cJSON_IsString(nf_group_id) && !cJSON_IsNull(nf_group_id)) { + ogs_error("OpenAPI_subscr_cond_parseFromJSON() failed [nf_group_id]"); + goto end; + } + } + + nf_set_id = cJSON_GetObjectItemCaseSensitive(subscr_condJSON, "nfSetId"); + if (nf_set_id) { + if (!cJSON_IsString(nf_set_id) && !cJSON_IsNull(nf_set_id)) { + ogs_error("OpenAPI_subscr_cond_parseFromJSON() failed [nf_set_id]"); + goto end; + } + } + + nf_service_set_id = cJSON_GetObjectItemCaseSensitive(subscr_condJSON, "nfServiceSetId"); + if (nf_service_set_id) { + if (!cJSON_IsString(nf_service_set_id) && !cJSON_IsNull(nf_service_set_id)) { + ogs_error("OpenAPI_subscr_cond_parseFromJSON() failed [nf_service_set_id]"); + goto end; + } + } + + smf_serving_area = cJSON_GetObjectItemCaseSensitive(subscr_condJSON, "smfServingArea"); + if (smf_serving_area) { + cJSON *smf_serving_area_local = NULL; + if (!cJSON_IsArray(smf_serving_area)) { + ogs_error("OpenAPI_subscr_cond_parseFromJSON() failed [smf_serving_area]"); + goto end; + } + + smf_serving_areaList = OpenAPI_list_create(); + + cJSON_ArrayForEach(smf_serving_area_local, smf_serving_area) { + double *localDouble = NULL; + int *localInt = NULL; + if (!cJSON_IsString(smf_serving_area_local)) { + ogs_error("OpenAPI_subscr_cond_parseFromJSON() failed [smf_serving_area]"); + goto end; + } + OpenAPI_list_add(smf_serving_areaList, ogs_strdup(smf_serving_area_local->valuestring)); + } + } + + tai_list = cJSON_GetObjectItemCaseSensitive(subscr_condJSON, "taiList"); + if (tai_list) { + cJSON *tai_list_local = NULL; + if (!cJSON_IsArray(tai_list)) { + ogs_error("OpenAPI_subscr_cond_parseFromJSON() failed [tai_list]"); + goto end; + } + + tai_listList = OpenAPI_list_create(); + + cJSON_ArrayForEach(tai_list_local, tai_list) { + if (!cJSON_IsObject(tai_list_local)) { + ogs_error("OpenAPI_subscr_cond_parseFromJSON() failed [tai_list]"); + goto end; + } + OpenAPI_tai_t *tai_listItem = OpenAPI_tai_parseFromJSON(tai_list_local); + if (!tai_listItem) { + ogs_error("No tai_listItem"); + OpenAPI_list_free(tai_listList); + goto end; + } + OpenAPI_list_add(tai_listList, tai_listItem); + } + } + + subscr_cond_local_var = OpenAPI_subscr_cond_create ( + nf_instance_id && !cJSON_IsNull(nf_instance_id) ? ogs_strdup(nf_instance_id->valuestring) : NULL, + nf_instance_list ? nf_instance_listList : NULL, + nf_type ? nf_typeVariable : 0, + service_name && !cJSON_IsNull(service_name) ? ogs_strdup(service_name->valuestring) : NULL, + service_name_list ? service_name_listList : NULL, + amf_set_id && !cJSON_IsNull(amf_set_id) ? ogs_strdup(amf_set_id->valuestring) : NULL, + amf_region_id && !cJSON_IsNull(amf_region_id) ? ogs_strdup(amf_region_id->valuestring) : NULL, + guami_list ? guami_listList : NULL, + snssai_list ? snssai_listList : NULL, + nsi_list ? nsi_listList : NULL, + nf_group_id && !cJSON_IsNull(nf_group_id) ? ogs_strdup(nf_group_id->valuestring) : NULL, + nf_set_id && !cJSON_IsNull(nf_set_id) ? ogs_strdup(nf_set_id->valuestring) : NULL, + nf_service_set_id && !cJSON_IsNull(nf_service_set_id) ? ogs_strdup(nf_service_set_id->valuestring) : NULL, + smf_serving_area ? smf_serving_areaList : NULL, + tai_list ? tai_listList : NULL + ); + + return subscr_cond_local_var; +end: + if (nf_instance_listList) { + OpenAPI_list_for_each(nf_instance_listList, node) { + ogs_free(node->data); + } + OpenAPI_list_free(nf_instance_listList); + nf_instance_listList = NULL; + } + if (service_name_listList) { + OpenAPI_list_for_each(service_name_listList, node) { + ogs_free(node->data); + } + OpenAPI_list_free(service_name_listList); + service_name_listList = NULL; + } + if (guami_listList) { + OpenAPI_list_for_each(guami_listList, node) { + OpenAPI_guami_free(node->data); + } + OpenAPI_list_free(guami_listList); + guami_listList = NULL; + } + if (snssai_listList) { + OpenAPI_list_for_each(snssai_listList, node) { + OpenAPI_snssai_free(node->data); + } + OpenAPI_list_free(snssai_listList); + snssai_listList = NULL; + } + if (nsi_listList) { + OpenAPI_list_for_each(nsi_listList, node) { + ogs_free(node->data); + } + OpenAPI_list_free(nsi_listList); + nsi_listList = NULL; + } + if (smf_serving_areaList) { + OpenAPI_list_for_each(smf_serving_areaList, node) { + ogs_free(node->data); + } + OpenAPI_list_free(smf_serving_areaList); + smf_serving_areaList = NULL; + } + if (tai_listList) { + OpenAPI_list_for_each(tai_listList, node) { + OpenAPI_tai_free(node->data); + } + OpenAPI_list_free(tai_listList); + tai_listList = NULL; + } + return NULL; +} + +OpenAPI_subscr_cond_t *OpenAPI_subscr_cond_copy(OpenAPI_subscr_cond_t *dst, OpenAPI_subscr_cond_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_subscr_cond_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_subscr_cond_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_subscr_cond_free(dst); + dst = OpenAPI_subscr_cond_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/subscr_cond.h b/lib/sbi/openapi/model/subscr_cond.h new file mode 100644 index 000000000..9330f0dc6 --- /dev/null +++ b/lib/sbi/openapi/model/subscr_cond.h @@ -0,0 +1,70 @@ +/* + * subscr_cond.h + * + * Condition to determine the set of NFs to monitor under a certain subscription in NRF + */ + +#ifndef _OpenAPI_subscr_cond_H_ +#define _OpenAPI_subscr_cond_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "guami.h" +#include "nf_type.h" +#include "snssai.h" +#include "tai.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_subscr_cond_s OpenAPI_subscr_cond_t; +typedef struct OpenAPI_subscr_cond_s { + char *nf_instance_id; + OpenAPI_list_t *nf_instance_list; + OpenAPI_nf_type_e nf_type; + char *service_name; + OpenAPI_list_t *service_name_list; + char *amf_set_id; + char *amf_region_id; + OpenAPI_list_t *guami_list; + OpenAPI_list_t *snssai_list; + OpenAPI_list_t *nsi_list; + char *nf_group_id; + char *nf_set_id; + char *nf_service_set_id; + OpenAPI_list_t *smf_serving_area; + OpenAPI_list_t *tai_list; +} OpenAPI_subscr_cond_t; + +OpenAPI_subscr_cond_t *OpenAPI_subscr_cond_create( + char *nf_instance_id, + OpenAPI_list_t *nf_instance_list, + OpenAPI_nf_type_e nf_type, + char *service_name, + OpenAPI_list_t *service_name_list, + char *amf_set_id, + char *amf_region_id, + OpenAPI_list_t *guami_list, + OpenAPI_list_t *snssai_list, + OpenAPI_list_t *nsi_list, + char *nf_group_id, + char *nf_set_id, + char *nf_service_set_id, + OpenAPI_list_t *smf_serving_area, + OpenAPI_list_t *tai_list +); +void OpenAPI_subscr_cond_free(OpenAPI_subscr_cond_t *subscr_cond); +OpenAPI_subscr_cond_t *OpenAPI_subscr_cond_parseFromJSON(cJSON *subscr_condJSON); +cJSON *OpenAPI_subscr_cond_convertToJSON(OpenAPI_subscr_cond_t *subscr_cond); +OpenAPI_subscr_cond_t *OpenAPI_subscr_cond_copy(OpenAPI_subscr_cond_t *dst, OpenAPI_subscr_cond_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_subscr_cond_H_ */ + diff --git a/lib/sbi/openapi/model/subscribed_default_qos.h b/lib/sbi/openapi/model/subscribed_default_qos.h index e9fdb4d90..420adc085 100644 --- a/lib/sbi/openapi/model/subscribed_default_qos.h +++ b/lib/sbi/openapi/model/subscribed_default_qos.h @@ -1,7 +1,7 @@ /* * subscribed_default_qos.h * - * + * Provides the subsribed 5QI and the ARP, it may contain the priority level. */ #ifndef _OpenAPI_subscribed_default_qos_H_ diff --git a/lib/sbi/openapi/model/subscribed_default_qos_1.h b/lib/sbi/openapi/model/subscribed_default_qos_1.h index 2e28a3932..c5fd23b0f 100644 --- a/lib/sbi/openapi/model/subscribed_default_qos_1.h +++ b/lib/sbi/openapi/model/subscribed_default_qos_1.h @@ -1,7 +1,7 @@ /* * subscribed_default_qos_1.h * - * + * Provides the subsribed 5QI and the ARP, it may contain the priority level. */ #ifndef _OpenAPI_subscribed_default_qos_1_H_ diff --git a/lib/sbi/openapi/model/subscribed_event.h b/lib/sbi/openapi/model/subscribed_event.h index 573d20a37..34b75474f 100644 --- a/lib/sbi/openapi/model/subscribed_event.h +++ b/lib/sbi/openapi/model/subscribed_event.h @@ -1,7 +1,7 @@ /* * subscribed_event.h * - * Possible values are - UP_PATH_CHANGE: The AF requests to be notified when the UP path changes for the PDU session. + * Possible values are: - UP_PATH_CHANGE: The AF requests to be notified when the UP path changes for the PDU session. */ #ifndef _OpenAPI_subscribed_event_H_ diff --git a/lib/sbi/openapi/model/subscribed_snssai.c b/lib/sbi/openapi/model/subscribed_snssai.c index af4a338ed..39b61d5f5 100644 --- a/lib/sbi/openapi/model/subscribed_snssai.c +++ b/lib/sbi/openapi/model/subscribed_snssai.c @@ -7,7 +7,8 @@ OpenAPI_subscribed_snssai_t *OpenAPI_subscribed_snssai_create( OpenAPI_snssai_t *subscribed_snssai, bool is_default_indication, - int default_indication + int default_indication, + OpenAPI_list_t *subscribed_ns_srg_list ) { OpenAPI_subscribed_snssai_t *subscribed_snssai_local_var = ogs_malloc(sizeof(OpenAPI_subscribed_snssai_t)); @@ -16,6 +17,7 @@ OpenAPI_subscribed_snssai_t *OpenAPI_subscribed_snssai_create( subscribed_snssai_local_var->subscribed_snssai = subscribed_snssai; subscribed_snssai_local_var->is_default_indication = is_default_indication; subscribed_snssai_local_var->default_indication = default_indication; + subscribed_snssai_local_var->subscribed_ns_srg_list = subscribed_ns_srg_list; return subscribed_snssai_local_var; } @@ -31,6 +33,13 @@ void OpenAPI_subscribed_snssai_free(OpenAPI_subscribed_snssai_t *subscribed_snss OpenAPI_snssai_free(subscribed_snssai->subscribed_snssai); subscribed_snssai->subscribed_snssai = NULL; } + if (subscribed_snssai->subscribed_ns_srg_list) { + OpenAPI_list_for_each(subscribed_snssai->subscribed_ns_srg_list, node) { + ogs_free(node->data); + } + OpenAPI_list_free(subscribed_snssai->subscribed_ns_srg_list); + subscribed_snssai->subscribed_ns_srg_list = NULL; + } ogs_free(subscribed_snssai); } @@ -67,6 +76,20 @@ cJSON *OpenAPI_subscribed_snssai_convertToJSON(OpenAPI_subscribed_snssai_t *subs } } + if (subscribed_snssai->subscribed_ns_srg_list) { + cJSON *subscribed_ns_srg_listList = cJSON_AddArrayToObject(item, "subscribedNsSrgList"); + if (subscribed_ns_srg_listList == NULL) { + ogs_error("OpenAPI_subscribed_snssai_convertToJSON() failed [subscribed_ns_srg_list]"); + goto end; + } + OpenAPI_list_for_each(subscribed_snssai->subscribed_ns_srg_list, node) { + if (cJSON_AddStringToObject(subscribed_ns_srg_listList, "", (char*)node->data) == NULL) { + ogs_error("OpenAPI_subscribed_snssai_convertToJSON() failed [subscribed_ns_srg_list]"); + goto end; + } + } + } + end: return item; } @@ -78,6 +101,8 @@ OpenAPI_subscribed_snssai_t *OpenAPI_subscribed_snssai_parseFromJSON(cJSON *subs cJSON *subscribed_snssai = NULL; OpenAPI_snssai_t *subscribed_snssai_local_nonprim = NULL; cJSON *default_indication = NULL; + cJSON *subscribed_ns_srg_list = NULL; + OpenAPI_list_t *subscribed_ns_srg_listList = NULL; subscribed_snssai = cJSON_GetObjectItemCaseSensitive(subscribed_snssaiJSON, "subscribedSnssai"); if (!subscribed_snssai) { ogs_error("OpenAPI_subscribed_snssai_parseFromJSON() failed [subscribed_snssai]"); @@ -93,10 +118,32 @@ OpenAPI_subscribed_snssai_t *OpenAPI_subscribed_snssai_parseFromJSON(cJSON *subs } } + subscribed_ns_srg_list = cJSON_GetObjectItemCaseSensitive(subscribed_snssaiJSON, "subscribedNsSrgList"); + if (subscribed_ns_srg_list) { + cJSON *subscribed_ns_srg_list_local = NULL; + if (!cJSON_IsArray(subscribed_ns_srg_list)) { + ogs_error("OpenAPI_subscribed_snssai_parseFromJSON() failed [subscribed_ns_srg_list]"); + goto end; + } + + subscribed_ns_srg_listList = OpenAPI_list_create(); + + cJSON_ArrayForEach(subscribed_ns_srg_list_local, subscribed_ns_srg_list) { + double *localDouble = NULL; + int *localInt = NULL; + if (!cJSON_IsString(subscribed_ns_srg_list_local)) { + ogs_error("OpenAPI_subscribed_snssai_parseFromJSON() failed [subscribed_ns_srg_list]"); + goto end; + } + OpenAPI_list_add(subscribed_ns_srg_listList, ogs_strdup(subscribed_ns_srg_list_local->valuestring)); + } + } + subscribed_snssai_local_var = OpenAPI_subscribed_snssai_create ( subscribed_snssai_local_nonprim, default_indication ? true : false, - default_indication ? default_indication->valueint : 0 + default_indication ? default_indication->valueint : 0, + subscribed_ns_srg_list ? subscribed_ns_srg_listList : NULL ); return subscribed_snssai_local_var; @@ -105,6 +152,13 @@ end: OpenAPI_snssai_free(subscribed_snssai_local_nonprim); subscribed_snssai_local_nonprim = NULL; } + if (subscribed_ns_srg_listList) { + OpenAPI_list_for_each(subscribed_ns_srg_listList, node) { + ogs_free(node->data); + } + OpenAPI_list_free(subscribed_ns_srg_listList); + subscribed_ns_srg_listList = NULL; + } return NULL; } diff --git a/lib/sbi/openapi/model/subscribed_snssai.h b/lib/sbi/openapi/model/subscribed_snssai.h index 3faca05f7..fb503c24f 100644 --- a/lib/sbi/openapi/model/subscribed_snssai.h +++ b/lib/sbi/openapi/model/subscribed_snssai.h @@ -1,7 +1,7 @@ /* * subscribed_snssai.h * - * + * Contains the subscribed S-NSSAI */ #ifndef _OpenAPI_subscribed_snssai_H_ @@ -23,12 +23,14 @@ typedef struct OpenAPI_subscribed_snssai_s { struct OpenAPI_snssai_s *subscribed_snssai; bool is_default_indication; int default_indication; + OpenAPI_list_t *subscribed_ns_srg_list; } OpenAPI_subscribed_snssai_t; OpenAPI_subscribed_snssai_t *OpenAPI_subscribed_snssai_create( OpenAPI_snssai_t *subscribed_snssai, bool is_default_indication, - int default_indication + int default_indication, + OpenAPI_list_t *subscribed_ns_srg_list ); void OpenAPI_subscribed_snssai_free(OpenAPI_subscribed_snssai_t *subscribed_snssai); OpenAPI_subscribed_snssai_t *OpenAPI_subscribed_snssai_parseFromJSON(cJSON *subscribed_snssaiJSON); diff --git a/lib/sbi/openapi/model/subscription_context.c b/lib/sbi/openapi/model/subscription_context.c new file mode 100644 index 000000000..e87b1e052 --- /dev/null +++ b/lib/sbi/openapi/model/subscription_context.c @@ -0,0 +1,145 @@ + +#include +#include +#include +#include "subscription_context.h" + +OpenAPI_subscription_context_t *OpenAPI_subscription_context_create( + char *subscription_id, + OpenAPI_subscr_cond_t *subscr_cond +) +{ + OpenAPI_subscription_context_t *subscription_context_local_var = ogs_malloc(sizeof(OpenAPI_subscription_context_t)); + ogs_assert(subscription_context_local_var); + + subscription_context_local_var->subscription_id = subscription_id; + subscription_context_local_var->subscr_cond = subscr_cond; + + return subscription_context_local_var; +} + +void OpenAPI_subscription_context_free(OpenAPI_subscription_context_t *subscription_context) +{ + OpenAPI_lnode_t *node = NULL; + + if (NULL == subscription_context) { + return; + } + if (subscription_context->subscription_id) { + ogs_free(subscription_context->subscription_id); + subscription_context->subscription_id = NULL; + } + if (subscription_context->subscr_cond) { + OpenAPI_subscr_cond_free(subscription_context->subscr_cond); + subscription_context->subscr_cond = NULL; + } + ogs_free(subscription_context); +} + +cJSON *OpenAPI_subscription_context_convertToJSON(OpenAPI_subscription_context_t *subscription_context) +{ + cJSON *item = NULL; + OpenAPI_lnode_t *node = NULL; + + if (subscription_context == NULL) { + ogs_error("OpenAPI_subscription_context_convertToJSON() failed [SubscriptionContext]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (!subscription_context->subscription_id) { + ogs_error("OpenAPI_subscription_context_convertToJSON() failed [subscription_id]"); + return NULL; + } + if (cJSON_AddStringToObject(item, "subscriptionId", subscription_context->subscription_id) == NULL) { + ogs_error("OpenAPI_subscription_context_convertToJSON() failed [subscription_id]"); + goto end; + } + + if (subscription_context->subscr_cond) { + cJSON *subscr_cond_local_JSON = OpenAPI_subscr_cond_convertToJSON(subscription_context->subscr_cond); + if (subscr_cond_local_JSON == NULL) { + ogs_error("OpenAPI_subscription_context_convertToJSON() failed [subscr_cond]"); + goto end; + } + cJSON_AddItemToObject(item, "subscrCond", subscr_cond_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_subscription_context_convertToJSON() failed [subscr_cond]"); + goto end; + } + } + +end: + return item; +} + +OpenAPI_subscription_context_t *OpenAPI_subscription_context_parseFromJSON(cJSON *subscription_contextJSON) +{ + OpenAPI_subscription_context_t *subscription_context_local_var = NULL; + OpenAPI_lnode_t *node = NULL; + cJSON *subscription_id = NULL; + cJSON *subscr_cond = NULL; + OpenAPI_subscr_cond_t *subscr_cond_local_nonprim = NULL; + subscription_id = cJSON_GetObjectItemCaseSensitive(subscription_contextJSON, "subscriptionId"); + if (!subscription_id) { + ogs_error("OpenAPI_subscription_context_parseFromJSON() failed [subscription_id]"); + goto end; + } + if (!cJSON_IsString(subscription_id)) { + ogs_error("OpenAPI_subscription_context_parseFromJSON() failed [subscription_id]"); + goto end; + } + + subscr_cond = cJSON_GetObjectItemCaseSensitive(subscription_contextJSON, "subscrCond"); + if (subscr_cond) { + subscr_cond_local_nonprim = OpenAPI_subscr_cond_parseFromJSON(subscr_cond); + } + + subscription_context_local_var = OpenAPI_subscription_context_create ( + ogs_strdup(subscription_id->valuestring), + subscr_cond ? subscr_cond_local_nonprim : NULL + ); + + return subscription_context_local_var; +end: + if (subscr_cond_local_nonprim) { + OpenAPI_subscr_cond_free(subscr_cond_local_nonprim); + subscr_cond_local_nonprim = NULL; + } + return NULL; +} + +OpenAPI_subscription_context_t *OpenAPI_subscription_context_copy(OpenAPI_subscription_context_t *dst, OpenAPI_subscription_context_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_subscription_context_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_subscription_context_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_subscription_context_free(dst); + dst = OpenAPI_subscription_context_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/subscription_context.h b/lib/sbi/openapi/model/subscription_context.h new file mode 100644 index 000000000..9a264ac31 --- /dev/null +++ b/lib/sbi/openapi/model/subscription_context.h @@ -0,0 +1,41 @@ +/* + * subscription_context.h + * + * Context data related to a created subscription, to be included in notifications sent by NRF + */ + +#ifndef _OpenAPI_subscription_context_H_ +#define _OpenAPI_subscription_context_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "subscr_cond.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_subscription_context_s OpenAPI_subscription_context_t; +typedef struct OpenAPI_subscription_context_s { + char *subscription_id; + struct OpenAPI_subscr_cond_s *subscr_cond; +} OpenAPI_subscription_context_t; + +OpenAPI_subscription_context_t *OpenAPI_subscription_context_create( + char *subscription_id, + OpenAPI_subscr_cond_t *subscr_cond +); +void OpenAPI_subscription_context_free(OpenAPI_subscription_context_t *subscription_context); +OpenAPI_subscription_context_t *OpenAPI_subscription_context_parseFromJSON(cJSON *subscription_contextJSON); +cJSON *OpenAPI_subscription_context_convertToJSON(OpenAPI_subscription_context_t *subscription_context); +OpenAPI_subscription_context_t *OpenAPI_subscription_context_copy(OpenAPI_subscription_context_t *dst, OpenAPI_subscription_context_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_subscription_context_H_ */ + diff --git a/lib/sbi/openapi/model/subscription_data.c b/lib/sbi/openapi/model/subscription_data.c index afeb0c8d5..55abcd5a2 100644 --- a/lib/sbi/openapi/model/subscription_data.c +++ b/lib/sbi/openapi/model/subscription_data.c @@ -7,7 +7,7 @@ OpenAPI_subscription_data_t *OpenAPI_subscription_data_create( char *nf_status_notification_uri, char *req_nf_instance_id, - OpenAPI_subscription_data_subscr_cond_t *subscr_cond, + OpenAPI_subscr_cond_t *subscr_cond, char *subscription_id, char *validity_time, OpenAPI_list_t *req_notif_events, @@ -22,7 +22,12 @@ OpenAPI_subscription_data_t *OpenAPI_subscription_data_create( OpenAPI_list_t *req_snpn_list, OpenAPI_list_t *serving_scope, char *requester_features, - char *nrf_supported_features + char *nrf_supported_features, + char *hnrf_uri, + bool is_onboarding_capability, + int onboarding_capability, + char *target_hni, + char *preferred_locality ) { OpenAPI_subscription_data_t *subscription_data_local_var = ogs_malloc(sizeof(OpenAPI_subscription_data_t)); @@ -46,6 +51,11 @@ OpenAPI_subscription_data_t *OpenAPI_subscription_data_create( subscription_data_local_var->serving_scope = serving_scope; subscription_data_local_var->requester_features = requester_features; subscription_data_local_var->nrf_supported_features = nrf_supported_features; + subscription_data_local_var->hnrf_uri = hnrf_uri; + subscription_data_local_var->is_onboarding_capability = is_onboarding_capability; + subscription_data_local_var->onboarding_capability = onboarding_capability; + subscription_data_local_var->target_hni = target_hni; + subscription_data_local_var->preferred_locality = preferred_locality; return subscription_data_local_var; } @@ -66,7 +76,7 @@ void OpenAPI_subscription_data_free(OpenAPI_subscription_data_t *subscription_da subscription_data->req_nf_instance_id = NULL; } if (subscription_data->subscr_cond) { - OpenAPI_subscription_data_subscr_cond_free(subscription_data->subscr_cond); + OpenAPI_subscr_cond_free(subscription_data->subscr_cond); subscription_data->subscr_cond = NULL; } if (subscription_data->subscription_id) { @@ -99,7 +109,7 @@ void OpenAPI_subscription_data_free(OpenAPI_subscription_data_t *subscription_da } if (subscription_data->req_snssais) { OpenAPI_list_for_each(subscription_data->req_snssais, node) { - OpenAPI_snssai_free(node->data); + OpenAPI_ext_snssai_free(node->data); } OpenAPI_list_free(subscription_data->req_snssais); subscription_data->req_snssais = NULL; @@ -140,6 +150,18 @@ void OpenAPI_subscription_data_free(OpenAPI_subscription_data_t *subscription_da ogs_free(subscription_data->nrf_supported_features); subscription_data->nrf_supported_features = NULL; } + if (subscription_data->hnrf_uri) { + ogs_free(subscription_data->hnrf_uri); + subscription_data->hnrf_uri = NULL; + } + if (subscription_data->target_hni) { + ogs_free(subscription_data->target_hni); + subscription_data->target_hni = NULL; + } + if (subscription_data->preferred_locality) { + ogs_free(subscription_data->preferred_locality); + subscription_data->preferred_locality = NULL; + } ogs_free(subscription_data); } @@ -171,7 +193,7 @@ cJSON *OpenAPI_subscription_data_convertToJSON(OpenAPI_subscription_data_t *subs } if (subscription_data->subscr_cond) { - cJSON *subscr_cond_local_JSON = OpenAPI_subscription_data_subscr_cond_convertToJSON(subscription_data->subscr_cond); + cJSON *subscr_cond_local_JSON = OpenAPI_subscr_cond_convertToJSON(subscription_data->subscr_cond); if (subscr_cond_local_JSON == NULL) { ogs_error("OpenAPI_subscription_data_convertToJSON() failed [subscr_cond]"); goto end; @@ -265,7 +287,7 @@ cJSON *OpenAPI_subscription_data_convertToJSON(OpenAPI_subscription_data_t *subs goto end; } OpenAPI_list_for_each(subscription_data->req_snssais, node) { - cJSON *itemLocal = OpenAPI_snssai_convertToJSON(node->data); + cJSON *itemLocal = OpenAPI_ext_snssai_convertToJSON(node->data); if (itemLocal == NULL) { ogs_error("OpenAPI_subscription_data_convertToJSON() failed [req_snssais]"); goto end; @@ -350,6 +372,34 @@ cJSON *OpenAPI_subscription_data_convertToJSON(OpenAPI_subscription_data_t *subs } } + if (subscription_data->hnrf_uri) { + if (cJSON_AddStringToObject(item, "hnrfUri", subscription_data->hnrf_uri) == NULL) { + ogs_error("OpenAPI_subscription_data_convertToJSON() failed [hnrf_uri]"); + goto end; + } + } + + if (subscription_data->is_onboarding_capability) { + if (cJSON_AddBoolToObject(item, "onboardingCapability", subscription_data->onboarding_capability) == NULL) { + ogs_error("OpenAPI_subscription_data_convertToJSON() failed [onboarding_capability]"); + goto end; + } + } + + if (subscription_data->target_hni) { + if (cJSON_AddStringToObject(item, "targetHni", subscription_data->target_hni) == NULL) { + ogs_error("OpenAPI_subscription_data_convertToJSON() failed [target_hni]"); + goto end; + } + } + + if (subscription_data->preferred_locality) { + if (cJSON_AddStringToObject(item, "preferredLocality", subscription_data->preferred_locality) == NULL) { + ogs_error("OpenAPI_subscription_data_convertToJSON() failed [preferred_locality]"); + goto end; + } + } + end: return item; } @@ -361,7 +411,7 @@ OpenAPI_subscription_data_t *OpenAPI_subscription_data_parseFromJSON(cJSON *subs cJSON *nf_status_notification_uri = NULL; cJSON *req_nf_instance_id = NULL; cJSON *subscr_cond = NULL; - OpenAPI_subscription_data_subscr_cond_t *subscr_cond_local_nonprim = NULL; + OpenAPI_subscr_cond_t *subscr_cond_local_nonprim = NULL; cJSON *subscription_id = NULL; cJSON *validity_time = NULL; cJSON *req_notif_events = NULL; @@ -386,6 +436,10 @@ OpenAPI_subscription_data_t *OpenAPI_subscription_data_parseFromJSON(cJSON *subs OpenAPI_list_t *serving_scopeList = NULL; cJSON *requester_features = NULL; cJSON *nrf_supported_features = NULL; + cJSON *hnrf_uri = NULL; + cJSON *onboarding_capability = NULL; + cJSON *target_hni = NULL; + cJSON *preferred_locality = NULL; nf_status_notification_uri = cJSON_GetObjectItemCaseSensitive(subscription_dataJSON, "nfStatusNotificationUri"); if (!nf_status_notification_uri) { ogs_error("OpenAPI_subscription_data_parseFromJSON() failed [nf_status_notification_uri]"); @@ -406,7 +460,7 @@ OpenAPI_subscription_data_t *OpenAPI_subscription_data_parseFromJSON(cJSON *subs subscr_cond = cJSON_GetObjectItemCaseSensitive(subscription_dataJSON, "subscrCond"); if (subscr_cond) { - subscr_cond_local_nonprim = OpenAPI_subscription_data_subscr_cond_parseFromJSON(subscr_cond); + subscr_cond_local_nonprim = OpenAPI_subscr_cond_parseFromJSON(subscr_cond); } subscription_id = cJSON_GetObjectItemCaseSensitive(subscription_dataJSON, "subscriptionId"); @@ -494,7 +548,7 @@ OpenAPI_subscription_data_t *OpenAPI_subscription_data_parseFromJSON(cJSON *subs ogs_error("OpenAPI_subscription_data_parseFromJSON() failed [req_snssais]"); goto end; } - OpenAPI_snssai_t *req_snssaisItem = OpenAPI_snssai_parseFromJSON(req_snssais_local); + OpenAPI_ext_snssai_t *req_snssaisItem = OpenAPI_ext_snssai_parseFromJSON(req_snssais_local); if (!req_snssaisItem) { ogs_error("No req_snssaisItem"); OpenAPI_list_free(req_snssaisList); @@ -616,6 +670,38 @@ OpenAPI_subscription_data_t *OpenAPI_subscription_data_parseFromJSON(cJSON *subs } } + hnrf_uri = cJSON_GetObjectItemCaseSensitive(subscription_dataJSON, "hnrfUri"); + if (hnrf_uri) { + if (!cJSON_IsString(hnrf_uri) && !cJSON_IsNull(hnrf_uri)) { + ogs_error("OpenAPI_subscription_data_parseFromJSON() failed [hnrf_uri]"); + goto end; + } + } + + onboarding_capability = cJSON_GetObjectItemCaseSensitive(subscription_dataJSON, "onboardingCapability"); + if (onboarding_capability) { + if (!cJSON_IsBool(onboarding_capability)) { + ogs_error("OpenAPI_subscription_data_parseFromJSON() failed [onboarding_capability]"); + goto end; + } + } + + target_hni = cJSON_GetObjectItemCaseSensitive(subscription_dataJSON, "targetHni"); + if (target_hni) { + if (!cJSON_IsString(target_hni) && !cJSON_IsNull(target_hni)) { + ogs_error("OpenAPI_subscription_data_parseFromJSON() failed [target_hni]"); + goto end; + } + } + + preferred_locality = cJSON_GetObjectItemCaseSensitive(subscription_dataJSON, "preferredLocality"); + if (preferred_locality) { + if (!cJSON_IsString(preferred_locality) && !cJSON_IsNull(preferred_locality)) { + ogs_error("OpenAPI_subscription_data_parseFromJSON() failed [preferred_locality]"); + goto end; + } + } + subscription_data_local_var = OpenAPI_subscription_data_create ( ogs_strdup(nf_status_notification_uri->valuestring), req_nf_instance_id && !cJSON_IsNull(req_nf_instance_id) ? ogs_strdup(req_nf_instance_id->valuestring) : NULL, @@ -634,13 +720,18 @@ OpenAPI_subscription_data_t *OpenAPI_subscription_data_parseFromJSON(cJSON *subs req_snpn_list ? req_snpn_listList : NULL, serving_scope ? serving_scopeList : NULL, requester_features && !cJSON_IsNull(requester_features) ? ogs_strdup(requester_features->valuestring) : NULL, - nrf_supported_features && !cJSON_IsNull(nrf_supported_features) ? ogs_strdup(nrf_supported_features->valuestring) : NULL + nrf_supported_features && !cJSON_IsNull(nrf_supported_features) ? ogs_strdup(nrf_supported_features->valuestring) : NULL, + hnrf_uri && !cJSON_IsNull(hnrf_uri) ? ogs_strdup(hnrf_uri->valuestring) : NULL, + onboarding_capability ? true : false, + onboarding_capability ? onboarding_capability->valueint : 0, + target_hni && !cJSON_IsNull(target_hni) ? ogs_strdup(target_hni->valuestring) : NULL, + preferred_locality && !cJSON_IsNull(preferred_locality) ? ogs_strdup(preferred_locality->valuestring) : NULL ); return subscription_data_local_var; end: if (subscr_cond_local_nonprim) { - OpenAPI_subscription_data_subscr_cond_free(subscr_cond_local_nonprim); + OpenAPI_subscr_cond_free(subscr_cond_local_nonprim); subscr_cond_local_nonprim = NULL; } if (req_notif_eventsList) { @@ -657,7 +748,7 @@ end: } if (req_snssaisList) { OpenAPI_list_for_each(req_snssaisList, node) { - OpenAPI_snssai_free(node->data); + OpenAPI_ext_snssai_free(node->data); } OpenAPI_list_free(req_snssaisList); req_snssaisList = NULL; diff --git a/lib/sbi/openapi/model/subscription_data.h b/lib/sbi/openapi/model/subscription_data.h index ac5fd8f10..1440f54df 100644 --- a/lib/sbi/openapi/model/subscription_data.h +++ b/lib/sbi/openapi/model/subscription_data.h @@ -1,7 +1,7 @@ /* * subscription_data.h * - * Information of a subscription to notifications to NRF events, included in subscription requests and responses + * Information of a subscription to notifications to NRF events, included in subscription requests and responses */ #ifndef _OpenAPI_subscription_data_H_ @@ -12,14 +12,14 @@ #include "../include/list.h" #include "../include/keyValuePair.h" #include "../include/binary.h" +#include "ext_snssai.h" #include "nf_type.h" #include "notif_condition.h" #include "notification_event_type.h" #include "plmn_id.h" #include "plmn_id_nid.h" #include "plmn_snssai.h" -#include "snssai.h" -#include "subscription_data_subscr_cond.h" +#include "subscr_cond.h" #ifdef __cplusplus extern "C" { @@ -29,7 +29,7 @@ typedef struct OpenAPI_subscription_data_s OpenAPI_subscription_data_t; typedef struct OpenAPI_subscription_data_s { char *nf_status_notification_uri; char *req_nf_instance_id; - struct OpenAPI_subscription_data_subscr_cond_s *subscr_cond; + struct OpenAPI_subscr_cond_s *subscr_cond; char *subscription_id; char *validity_time; OpenAPI_list_t *req_notif_events; @@ -45,12 +45,17 @@ typedef struct OpenAPI_subscription_data_s { OpenAPI_list_t *serving_scope; char *requester_features; char *nrf_supported_features; + char *hnrf_uri; + bool is_onboarding_capability; + int onboarding_capability; + char *target_hni; + char *preferred_locality; } OpenAPI_subscription_data_t; OpenAPI_subscription_data_t *OpenAPI_subscription_data_create( char *nf_status_notification_uri, char *req_nf_instance_id, - OpenAPI_subscription_data_subscr_cond_t *subscr_cond, + OpenAPI_subscr_cond_t *subscr_cond, char *subscription_id, char *validity_time, OpenAPI_list_t *req_notif_events, @@ -65,7 +70,12 @@ OpenAPI_subscription_data_t *OpenAPI_subscription_data_create( OpenAPI_list_t *req_snpn_list, OpenAPI_list_t *serving_scope, char *requester_features, - char *nrf_supported_features + char *nrf_supported_features, + char *hnrf_uri, + bool is_onboarding_capability, + int onboarding_capability, + char *target_hni, + char *preferred_locality ); void OpenAPI_subscription_data_free(OpenAPI_subscription_data_t *subscription_data); OpenAPI_subscription_data_t *OpenAPI_subscription_data_parseFromJSON(cJSON *subscription_dataJSON); diff --git a/lib/sbi/openapi/model/subscription_data_sets.c b/lib/sbi/openapi/model/subscription_data_sets.c index d959954d4..e8850963e 100644 --- a/lib/sbi/openapi/model/subscription_data_sets.c +++ b/lib/sbi/openapi/model/subscription_data_sets.c @@ -11,13 +11,16 @@ OpenAPI_subscription_data_sets_t *OpenAPI_subscription_data_sets_create( OpenAPI_ue_context_in_smf_data_t *uec_smf_data, OpenAPI_ue_context_in_smsf_data_t *uec_smsf_data, OpenAPI_sms_subscription_data_t *sms_subs_data, - OpenAPI_list_t *sm_data, + OpenAPI_sm_subs_data_t *sm_data, OpenAPI_trace_data_t *trace_data, OpenAPI_sms_management_subscription_data_t *sms_mng_data, OpenAPI_lcs_privacy_data_t *lcs_privacy_data, OpenAPI_lcs_mo_data_t *lcs_mo_data, OpenAPI_v2x_subscription_data_t *v2x_data, - OpenAPI_lcs_broadcast_assistance_types_data_t *lcs_broadcast_assistance_types_data + OpenAPI_lcs_broadcast_assistance_types_data_t *lcs_broadcast_assistance_types_data, + OpenAPI_prose_subscription_data_t *prose_data, + OpenAPI_mbs_subscription_data_t *mbs_data, + OpenAPI_uc_subscription_data_t *uc_data ) { OpenAPI_subscription_data_sets_t *subscription_data_sets_local_var = ogs_malloc(sizeof(OpenAPI_subscription_data_sets_t)); @@ -36,6 +39,9 @@ OpenAPI_subscription_data_sets_t *OpenAPI_subscription_data_sets_create( subscription_data_sets_local_var->lcs_mo_data = lcs_mo_data; subscription_data_sets_local_var->v2x_data = v2x_data; subscription_data_sets_local_var->lcs_broadcast_assistance_types_data = lcs_broadcast_assistance_types_data; + subscription_data_sets_local_var->prose_data = prose_data; + subscription_data_sets_local_var->mbs_data = mbs_data; + subscription_data_sets_local_var->uc_data = uc_data; return subscription_data_sets_local_var; } @@ -72,10 +78,7 @@ void OpenAPI_subscription_data_sets_free(OpenAPI_subscription_data_sets_t *subsc subscription_data_sets->sms_subs_data = NULL; } if (subscription_data_sets->sm_data) { - OpenAPI_list_for_each(subscription_data_sets->sm_data, node) { - OpenAPI_session_management_subscription_data_free(node->data); - } - OpenAPI_list_free(subscription_data_sets->sm_data); + OpenAPI_sm_subs_data_free(subscription_data_sets->sm_data); subscription_data_sets->sm_data = NULL; } if (subscription_data_sets->trace_data) { @@ -102,6 +105,18 @@ void OpenAPI_subscription_data_sets_free(OpenAPI_subscription_data_sets_t *subsc OpenAPI_lcs_broadcast_assistance_types_data_free(subscription_data_sets->lcs_broadcast_assistance_types_data); subscription_data_sets->lcs_broadcast_assistance_types_data = NULL; } + if (subscription_data_sets->prose_data) { + OpenAPI_prose_subscription_data_free(subscription_data_sets->prose_data); + subscription_data_sets->prose_data = NULL; + } + if (subscription_data_sets->mbs_data) { + OpenAPI_mbs_subscription_data_free(subscription_data_sets->mbs_data); + subscription_data_sets->mbs_data = NULL; + } + if (subscription_data_sets->uc_data) { + OpenAPI_uc_subscription_data_free(subscription_data_sets->uc_data); + subscription_data_sets->uc_data = NULL; + } ogs_free(subscription_data_sets); } @@ -195,18 +210,15 @@ cJSON *OpenAPI_subscription_data_sets_convertToJSON(OpenAPI_subscription_data_se } if (subscription_data_sets->sm_data) { - cJSON *sm_dataList = cJSON_AddArrayToObject(item, "smData"); - if (sm_dataList == NULL) { + cJSON *sm_data_local_JSON = OpenAPI_sm_subs_data_convertToJSON(subscription_data_sets->sm_data); + if (sm_data_local_JSON == NULL) { ogs_error("OpenAPI_subscription_data_sets_convertToJSON() failed [sm_data]"); goto end; } - OpenAPI_list_for_each(subscription_data_sets->sm_data, node) { - cJSON *itemLocal = OpenAPI_session_management_subscription_data_convertToJSON(node->data); - if (itemLocal == NULL) { - ogs_error("OpenAPI_subscription_data_sets_convertToJSON() failed [sm_data]"); - goto end; - } - cJSON_AddItemToArray(sm_dataList, itemLocal); + cJSON_AddItemToObject(item, "smData", sm_data_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_subscription_data_sets_convertToJSON() failed [sm_data]"); + goto end; } } @@ -288,6 +300,45 @@ cJSON *OpenAPI_subscription_data_sets_convertToJSON(OpenAPI_subscription_data_se } } + if (subscription_data_sets->prose_data) { + cJSON *prose_data_local_JSON = OpenAPI_prose_subscription_data_convertToJSON(subscription_data_sets->prose_data); + if (prose_data_local_JSON == NULL) { + ogs_error("OpenAPI_subscription_data_sets_convertToJSON() failed [prose_data]"); + goto end; + } + cJSON_AddItemToObject(item, "proseData", prose_data_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_subscription_data_sets_convertToJSON() failed [prose_data]"); + goto end; + } + } + + if (subscription_data_sets->mbs_data) { + cJSON *mbs_data_local_JSON = OpenAPI_mbs_subscription_data_convertToJSON(subscription_data_sets->mbs_data); + if (mbs_data_local_JSON == NULL) { + ogs_error("OpenAPI_subscription_data_sets_convertToJSON() failed [mbs_data]"); + goto end; + } + cJSON_AddItemToObject(item, "mbsData", mbs_data_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_subscription_data_sets_convertToJSON() failed [mbs_data]"); + goto end; + } + } + + if (subscription_data_sets->uc_data) { + cJSON *uc_data_local_JSON = OpenAPI_uc_subscription_data_convertToJSON(subscription_data_sets->uc_data); + if (uc_data_local_JSON == NULL) { + ogs_error("OpenAPI_subscription_data_sets_convertToJSON() failed [uc_data]"); + goto end; + } + cJSON_AddItemToObject(item, "ucData", uc_data_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_subscription_data_sets_convertToJSON() failed [uc_data]"); + goto end; + } + } + end: return item; } @@ -309,7 +360,7 @@ OpenAPI_subscription_data_sets_t *OpenAPI_subscription_data_sets_parseFromJSON(c cJSON *sms_subs_data = NULL; OpenAPI_sms_subscription_data_t *sms_subs_data_local_nonprim = NULL; cJSON *sm_data = NULL; - OpenAPI_list_t *sm_dataList = NULL; + OpenAPI_sm_subs_data_t *sm_data_local_nonprim = NULL; cJSON *trace_data = NULL; OpenAPI_trace_data_t *trace_data_local_nonprim = NULL; cJSON *sms_mng_data = NULL; @@ -322,6 +373,12 @@ OpenAPI_subscription_data_sets_t *OpenAPI_subscription_data_sets_parseFromJSON(c OpenAPI_v2x_subscription_data_t *v2x_data_local_nonprim = NULL; cJSON *lcs_broadcast_assistance_types_data = NULL; OpenAPI_lcs_broadcast_assistance_types_data_t *lcs_broadcast_assistance_types_data_local_nonprim = NULL; + cJSON *prose_data = NULL; + OpenAPI_prose_subscription_data_t *prose_data_local_nonprim = NULL; + cJSON *mbs_data = NULL; + OpenAPI_mbs_subscription_data_t *mbs_data_local_nonprim = NULL; + cJSON *uc_data = NULL; + OpenAPI_uc_subscription_data_t *uc_data_local_nonprim = NULL; am_data = cJSON_GetObjectItemCaseSensitive(subscription_data_setsJSON, "amData"); if (am_data) { am_data_local_nonprim = OpenAPI_access_and_mobility_subscription_data_parseFromJSON(am_data); @@ -354,27 +411,7 @@ OpenAPI_subscription_data_sets_t *OpenAPI_subscription_data_sets_parseFromJSON(c sm_data = cJSON_GetObjectItemCaseSensitive(subscription_data_setsJSON, "smData"); if (sm_data) { - cJSON *sm_data_local = NULL; - if (!cJSON_IsArray(sm_data)) { - ogs_error("OpenAPI_subscription_data_sets_parseFromJSON() failed [sm_data]"); - goto end; - } - - sm_dataList = OpenAPI_list_create(); - - cJSON_ArrayForEach(sm_data_local, sm_data) { - if (!cJSON_IsObject(sm_data_local)) { - ogs_error("OpenAPI_subscription_data_sets_parseFromJSON() failed [sm_data]"); - goto end; - } - OpenAPI_session_management_subscription_data_t *sm_dataItem = OpenAPI_session_management_subscription_data_parseFromJSON(sm_data_local); - if (!sm_dataItem) { - ogs_error("No sm_dataItem"); - OpenAPI_list_free(sm_dataList); - goto end; - } - OpenAPI_list_add(sm_dataList, sm_dataItem); - } + sm_data_local_nonprim = OpenAPI_sm_subs_data_parseFromJSON(sm_data); } trace_data = cJSON_GetObjectItemCaseSensitive(subscription_data_setsJSON, "traceData"); @@ -407,6 +444,21 @@ OpenAPI_subscription_data_sets_t *OpenAPI_subscription_data_sets_parseFromJSON(c lcs_broadcast_assistance_types_data_local_nonprim = OpenAPI_lcs_broadcast_assistance_types_data_parseFromJSON(lcs_broadcast_assistance_types_data); } + prose_data = cJSON_GetObjectItemCaseSensitive(subscription_data_setsJSON, "proseData"); + if (prose_data) { + prose_data_local_nonprim = OpenAPI_prose_subscription_data_parseFromJSON(prose_data); + } + + mbs_data = cJSON_GetObjectItemCaseSensitive(subscription_data_setsJSON, "mbsData"); + if (mbs_data) { + mbs_data_local_nonprim = OpenAPI_mbs_subscription_data_parseFromJSON(mbs_data); + } + + uc_data = cJSON_GetObjectItemCaseSensitive(subscription_data_setsJSON, "ucData"); + if (uc_data) { + uc_data_local_nonprim = OpenAPI_uc_subscription_data_parseFromJSON(uc_data); + } + subscription_data_sets_local_var = OpenAPI_subscription_data_sets_create ( am_data ? am_data_local_nonprim : NULL, smf_sel_data ? smf_sel_data_local_nonprim : NULL, @@ -414,13 +466,16 @@ OpenAPI_subscription_data_sets_t *OpenAPI_subscription_data_sets_parseFromJSON(c uec_smf_data ? uec_smf_data_local_nonprim : NULL, uec_smsf_data ? uec_smsf_data_local_nonprim : NULL, sms_subs_data ? sms_subs_data_local_nonprim : NULL, - sm_data ? sm_dataList : NULL, + sm_data ? sm_data_local_nonprim : NULL, trace_data ? trace_data_local_nonprim : NULL, sms_mng_data ? sms_mng_data_local_nonprim : NULL, lcs_privacy_data ? lcs_privacy_data_local_nonprim : NULL, lcs_mo_data ? lcs_mo_data_local_nonprim : NULL, v2x_data ? v2x_data_local_nonprim : NULL, - lcs_broadcast_assistance_types_data ? lcs_broadcast_assistance_types_data_local_nonprim : NULL + lcs_broadcast_assistance_types_data ? lcs_broadcast_assistance_types_data_local_nonprim : NULL, + prose_data ? prose_data_local_nonprim : NULL, + mbs_data ? mbs_data_local_nonprim : NULL, + uc_data ? uc_data_local_nonprim : NULL ); return subscription_data_sets_local_var; @@ -449,12 +504,9 @@ end: OpenAPI_sms_subscription_data_free(sms_subs_data_local_nonprim); sms_subs_data_local_nonprim = NULL; } - if (sm_dataList) { - OpenAPI_list_for_each(sm_dataList, node) { - OpenAPI_session_management_subscription_data_free(node->data); - } - OpenAPI_list_free(sm_dataList); - sm_dataList = NULL; + if (sm_data_local_nonprim) { + OpenAPI_sm_subs_data_free(sm_data_local_nonprim); + sm_data_local_nonprim = NULL; } if (trace_data_local_nonprim) { OpenAPI_trace_data_free(trace_data_local_nonprim); @@ -480,6 +532,18 @@ end: OpenAPI_lcs_broadcast_assistance_types_data_free(lcs_broadcast_assistance_types_data_local_nonprim); lcs_broadcast_assistance_types_data_local_nonprim = NULL; } + if (prose_data_local_nonprim) { + OpenAPI_prose_subscription_data_free(prose_data_local_nonprim); + prose_data_local_nonprim = NULL; + } + if (mbs_data_local_nonprim) { + OpenAPI_mbs_subscription_data_free(mbs_data_local_nonprim); + mbs_data_local_nonprim = NULL; + } + if (uc_data_local_nonprim) { + OpenAPI_uc_subscription_data_free(uc_data_local_nonprim); + uc_data_local_nonprim = NULL; + } return NULL; } diff --git a/lib/sbi/openapi/model/subscription_data_sets.h b/lib/sbi/openapi/model/subscription_data_sets.h index fe563ec25..a6db5f36c 100644 --- a/lib/sbi/openapi/model/subscription_data_sets.h +++ b/lib/sbi/openapi/model/subscription_data_sets.h @@ -16,11 +16,14 @@ #include "lcs_broadcast_assistance_types_data.h" #include "lcs_mo_data.h" #include "lcs_privacy_data.h" -#include "session_management_subscription_data.h" +#include "mbs_subscription_data.h" +#include "prose_subscription_data.h" +#include "sm_subs_data.h" #include "smf_selection_subscription_data.h" #include "sms_management_subscription_data.h" #include "sms_subscription_data.h" #include "trace_data.h" +#include "uc_subscription_data.h" #include "ue_context_in_amf_data.h" #include "ue_context_in_smf_data.h" #include "ue_context_in_smsf_data.h" @@ -38,13 +41,16 @@ typedef struct OpenAPI_subscription_data_sets_s { struct OpenAPI_ue_context_in_smf_data_s *uec_smf_data; struct OpenAPI_ue_context_in_smsf_data_s *uec_smsf_data; struct OpenAPI_sms_subscription_data_s *sms_subs_data; - OpenAPI_list_t *sm_data; + struct OpenAPI_sm_subs_data_s *sm_data; struct OpenAPI_trace_data_s *trace_data; struct OpenAPI_sms_management_subscription_data_s *sms_mng_data; struct OpenAPI_lcs_privacy_data_s *lcs_privacy_data; struct OpenAPI_lcs_mo_data_s *lcs_mo_data; struct OpenAPI_v2x_subscription_data_s *v2x_data; struct OpenAPI_lcs_broadcast_assistance_types_data_s *lcs_broadcast_assistance_types_data; + struct OpenAPI_prose_subscription_data_s *prose_data; + struct OpenAPI_mbs_subscription_data_s *mbs_data; + struct OpenAPI_uc_subscription_data_s *uc_data; } OpenAPI_subscription_data_sets_t; OpenAPI_subscription_data_sets_t *OpenAPI_subscription_data_sets_create( @@ -54,13 +60,16 @@ OpenAPI_subscription_data_sets_t *OpenAPI_subscription_data_sets_create( OpenAPI_ue_context_in_smf_data_t *uec_smf_data, OpenAPI_ue_context_in_smsf_data_t *uec_smsf_data, OpenAPI_sms_subscription_data_t *sms_subs_data, - OpenAPI_list_t *sm_data, + OpenAPI_sm_subs_data_t *sm_data, OpenAPI_trace_data_t *trace_data, OpenAPI_sms_management_subscription_data_t *sms_mng_data, OpenAPI_lcs_privacy_data_t *lcs_privacy_data, OpenAPI_lcs_mo_data_t *lcs_mo_data, OpenAPI_v2x_subscription_data_t *v2x_data, - OpenAPI_lcs_broadcast_assistance_types_data_t *lcs_broadcast_assistance_types_data + OpenAPI_lcs_broadcast_assistance_types_data_t *lcs_broadcast_assistance_types_data, + OpenAPI_prose_subscription_data_t *prose_data, + OpenAPI_mbs_subscription_data_t *mbs_data, + OpenAPI_uc_subscription_data_t *uc_data ); void OpenAPI_subscription_data_sets_free(OpenAPI_subscription_data_sets_t *subscription_data_sets); OpenAPI_subscription_data_sets_t *OpenAPI_subscription_data_sets_parseFromJSON(cJSON *subscription_data_setsJSON); diff --git a/lib/sbi/openapi/model/subscription_data_sets_1.c b/lib/sbi/openapi/model/subscription_data_sets_1.c deleted file mode 100644 index 47752c58f..000000000 --- a/lib/sbi/openapi/model/subscription_data_sets_1.c +++ /dev/null @@ -1,519 +0,0 @@ - -#include -#include -#include -#include "subscription_data_sets_1.h" - -OpenAPI_subscription_data_sets_1_t *OpenAPI_subscription_data_sets_1_create( - OpenAPI_access_and_mobility_subscription_data_1_t *am_data, - OpenAPI_smf_selection_subscription_data_1_t *smf_sel_data, - OpenAPI_ue_context_in_amf_data_1_t *uec_amf_data, - OpenAPI_ue_context_in_smf_data_1_t *uec_smf_data, - OpenAPI_ue_context_in_smsf_data_1_t *uec_smsf_data, - OpenAPI_sms_subscription_data_1_t *sms_subs_data, - OpenAPI_list_t *sm_data, - OpenAPI_trace_data_t *trace_data, - OpenAPI_sms_management_subscription_data_1_t *sms_mng_data, - OpenAPI_lcs_privacy_data_1_t *lcs_privacy_data, - OpenAPI_lcs_mo_data_t *lcs_mo_data, - OpenAPI_v2x_subscription_data_1_t *v2x_data, - OpenAPI_lcs_broadcast_assistance_types_data_1_t *lcs_broadcast_assistance_types_data -) -{ - OpenAPI_subscription_data_sets_1_t *subscription_data_sets_1_local_var = ogs_malloc(sizeof(OpenAPI_subscription_data_sets_1_t)); - ogs_assert(subscription_data_sets_1_local_var); - - subscription_data_sets_1_local_var->am_data = am_data; - subscription_data_sets_1_local_var->smf_sel_data = smf_sel_data; - subscription_data_sets_1_local_var->uec_amf_data = uec_amf_data; - subscription_data_sets_1_local_var->uec_smf_data = uec_smf_data; - subscription_data_sets_1_local_var->uec_smsf_data = uec_smsf_data; - subscription_data_sets_1_local_var->sms_subs_data = sms_subs_data; - subscription_data_sets_1_local_var->sm_data = sm_data; - subscription_data_sets_1_local_var->trace_data = trace_data; - subscription_data_sets_1_local_var->sms_mng_data = sms_mng_data; - subscription_data_sets_1_local_var->lcs_privacy_data = lcs_privacy_data; - subscription_data_sets_1_local_var->lcs_mo_data = lcs_mo_data; - subscription_data_sets_1_local_var->v2x_data = v2x_data; - subscription_data_sets_1_local_var->lcs_broadcast_assistance_types_data = lcs_broadcast_assistance_types_data; - - return subscription_data_sets_1_local_var; -} - -void OpenAPI_subscription_data_sets_1_free(OpenAPI_subscription_data_sets_1_t *subscription_data_sets_1) -{ - OpenAPI_lnode_t *node = NULL; - - if (NULL == subscription_data_sets_1) { - return; - } - if (subscription_data_sets_1->am_data) { - OpenAPI_access_and_mobility_subscription_data_1_free(subscription_data_sets_1->am_data); - subscription_data_sets_1->am_data = NULL; - } - if (subscription_data_sets_1->smf_sel_data) { - OpenAPI_smf_selection_subscription_data_1_free(subscription_data_sets_1->smf_sel_data); - subscription_data_sets_1->smf_sel_data = NULL; - } - if (subscription_data_sets_1->uec_amf_data) { - OpenAPI_ue_context_in_amf_data_1_free(subscription_data_sets_1->uec_amf_data); - subscription_data_sets_1->uec_amf_data = NULL; - } - if (subscription_data_sets_1->uec_smf_data) { - OpenAPI_ue_context_in_smf_data_1_free(subscription_data_sets_1->uec_smf_data); - subscription_data_sets_1->uec_smf_data = NULL; - } - if (subscription_data_sets_1->uec_smsf_data) { - OpenAPI_ue_context_in_smsf_data_1_free(subscription_data_sets_1->uec_smsf_data); - subscription_data_sets_1->uec_smsf_data = NULL; - } - if (subscription_data_sets_1->sms_subs_data) { - OpenAPI_sms_subscription_data_1_free(subscription_data_sets_1->sms_subs_data); - subscription_data_sets_1->sms_subs_data = NULL; - } - if (subscription_data_sets_1->sm_data) { - OpenAPI_list_for_each(subscription_data_sets_1->sm_data, node) { - OpenAPI_session_management_subscription_data_1_free(node->data); - } - OpenAPI_list_free(subscription_data_sets_1->sm_data); - subscription_data_sets_1->sm_data = NULL; - } - if (subscription_data_sets_1->trace_data) { - OpenAPI_trace_data_free(subscription_data_sets_1->trace_data); - subscription_data_sets_1->trace_data = NULL; - } - if (subscription_data_sets_1->sms_mng_data) { - OpenAPI_sms_management_subscription_data_1_free(subscription_data_sets_1->sms_mng_data); - subscription_data_sets_1->sms_mng_data = NULL; - } - if (subscription_data_sets_1->lcs_privacy_data) { - OpenAPI_lcs_privacy_data_1_free(subscription_data_sets_1->lcs_privacy_data); - subscription_data_sets_1->lcs_privacy_data = NULL; - } - if (subscription_data_sets_1->lcs_mo_data) { - OpenAPI_lcs_mo_data_free(subscription_data_sets_1->lcs_mo_data); - subscription_data_sets_1->lcs_mo_data = NULL; - } - if (subscription_data_sets_1->v2x_data) { - OpenAPI_v2x_subscription_data_1_free(subscription_data_sets_1->v2x_data); - subscription_data_sets_1->v2x_data = NULL; - } - if (subscription_data_sets_1->lcs_broadcast_assistance_types_data) { - OpenAPI_lcs_broadcast_assistance_types_data_1_free(subscription_data_sets_1->lcs_broadcast_assistance_types_data); - subscription_data_sets_1->lcs_broadcast_assistance_types_data = NULL; - } - ogs_free(subscription_data_sets_1); -} - -cJSON *OpenAPI_subscription_data_sets_1_convertToJSON(OpenAPI_subscription_data_sets_1_t *subscription_data_sets_1) -{ - cJSON *item = NULL; - OpenAPI_lnode_t *node = NULL; - - if (subscription_data_sets_1 == NULL) { - ogs_error("OpenAPI_subscription_data_sets_1_convertToJSON() failed [SubscriptionDataSets_1]"); - return NULL; - } - - item = cJSON_CreateObject(); - if (subscription_data_sets_1->am_data) { - cJSON *am_data_local_JSON = OpenAPI_access_and_mobility_subscription_data_1_convertToJSON(subscription_data_sets_1->am_data); - if (am_data_local_JSON == NULL) { - ogs_error("OpenAPI_subscription_data_sets_1_convertToJSON() failed [am_data]"); - goto end; - } - cJSON_AddItemToObject(item, "amData", am_data_local_JSON); - if (item->child == NULL) { - ogs_error("OpenAPI_subscription_data_sets_1_convertToJSON() failed [am_data]"); - goto end; - } - } - - if (subscription_data_sets_1->smf_sel_data) { - cJSON *smf_sel_data_local_JSON = OpenAPI_smf_selection_subscription_data_1_convertToJSON(subscription_data_sets_1->smf_sel_data); - if (smf_sel_data_local_JSON == NULL) { - ogs_error("OpenAPI_subscription_data_sets_1_convertToJSON() failed [smf_sel_data]"); - goto end; - } - cJSON_AddItemToObject(item, "smfSelData", smf_sel_data_local_JSON); - if (item->child == NULL) { - ogs_error("OpenAPI_subscription_data_sets_1_convertToJSON() failed [smf_sel_data]"); - goto end; - } - } - - if (subscription_data_sets_1->uec_amf_data) { - cJSON *uec_amf_data_local_JSON = OpenAPI_ue_context_in_amf_data_1_convertToJSON(subscription_data_sets_1->uec_amf_data); - if (uec_amf_data_local_JSON == NULL) { - ogs_error("OpenAPI_subscription_data_sets_1_convertToJSON() failed [uec_amf_data]"); - goto end; - } - cJSON_AddItemToObject(item, "uecAmfData", uec_amf_data_local_JSON); - if (item->child == NULL) { - ogs_error("OpenAPI_subscription_data_sets_1_convertToJSON() failed [uec_amf_data]"); - goto end; - } - } - - if (subscription_data_sets_1->uec_smf_data) { - cJSON *uec_smf_data_local_JSON = OpenAPI_ue_context_in_smf_data_1_convertToJSON(subscription_data_sets_1->uec_smf_data); - if (uec_smf_data_local_JSON == NULL) { - ogs_error("OpenAPI_subscription_data_sets_1_convertToJSON() failed [uec_smf_data]"); - goto end; - } - cJSON_AddItemToObject(item, "uecSmfData", uec_smf_data_local_JSON); - if (item->child == NULL) { - ogs_error("OpenAPI_subscription_data_sets_1_convertToJSON() failed [uec_smf_data]"); - goto end; - } - } - - if (subscription_data_sets_1->uec_smsf_data) { - cJSON *uec_smsf_data_local_JSON = OpenAPI_ue_context_in_smsf_data_1_convertToJSON(subscription_data_sets_1->uec_smsf_data); - if (uec_smsf_data_local_JSON == NULL) { - ogs_error("OpenAPI_subscription_data_sets_1_convertToJSON() failed [uec_smsf_data]"); - goto end; - } - cJSON_AddItemToObject(item, "uecSmsfData", uec_smsf_data_local_JSON); - if (item->child == NULL) { - ogs_error("OpenAPI_subscription_data_sets_1_convertToJSON() failed [uec_smsf_data]"); - goto end; - } - } - - if (subscription_data_sets_1->sms_subs_data) { - cJSON *sms_subs_data_local_JSON = OpenAPI_sms_subscription_data_1_convertToJSON(subscription_data_sets_1->sms_subs_data); - if (sms_subs_data_local_JSON == NULL) { - ogs_error("OpenAPI_subscription_data_sets_1_convertToJSON() failed [sms_subs_data]"); - goto end; - } - cJSON_AddItemToObject(item, "smsSubsData", sms_subs_data_local_JSON); - if (item->child == NULL) { - ogs_error("OpenAPI_subscription_data_sets_1_convertToJSON() failed [sms_subs_data]"); - goto end; - } - } - - if (subscription_data_sets_1->sm_data) { - cJSON *sm_dataList = cJSON_AddArrayToObject(item, "smData"); - if (sm_dataList == NULL) { - ogs_error("OpenAPI_subscription_data_sets_1_convertToJSON() failed [sm_data]"); - goto end; - } - OpenAPI_list_for_each(subscription_data_sets_1->sm_data, node) { - cJSON *itemLocal = OpenAPI_session_management_subscription_data_1_convertToJSON(node->data); - if (itemLocal == NULL) { - ogs_error("OpenAPI_subscription_data_sets_1_convertToJSON() failed [sm_data]"); - goto end; - } - cJSON_AddItemToArray(sm_dataList, itemLocal); - } - } - - if (subscription_data_sets_1->trace_data) { - cJSON *trace_data_local_JSON = OpenAPI_trace_data_convertToJSON(subscription_data_sets_1->trace_data); - if (trace_data_local_JSON == NULL) { - ogs_error("OpenAPI_subscription_data_sets_1_convertToJSON() failed [trace_data]"); - goto end; - } - cJSON_AddItemToObject(item, "traceData", trace_data_local_JSON); - if (item->child == NULL) { - ogs_error("OpenAPI_subscription_data_sets_1_convertToJSON() failed [trace_data]"); - goto end; - } - } - - if (subscription_data_sets_1->sms_mng_data) { - cJSON *sms_mng_data_local_JSON = OpenAPI_sms_management_subscription_data_1_convertToJSON(subscription_data_sets_1->sms_mng_data); - if (sms_mng_data_local_JSON == NULL) { - ogs_error("OpenAPI_subscription_data_sets_1_convertToJSON() failed [sms_mng_data]"); - goto end; - } - cJSON_AddItemToObject(item, "smsMngData", sms_mng_data_local_JSON); - if (item->child == NULL) { - ogs_error("OpenAPI_subscription_data_sets_1_convertToJSON() failed [sms_mng_data]"); - goto end; - } - } - - if (subscription_data_sets_1->lcs_privacy_data) { - cJSON *lcs_privacy_data_local_JSON = OpenAPI_lcs_privacy_data_1_convertToJSON(subscription_data_sets_1->lcs_privacy_data); - if (lcs_privacy_data_local_JSON == NULL) { - ogs_error("OpenAPI_subscription_data_sets_1_convertToJSON() failed [lcs_privacy_data]"); - goto end; - } - cJSON_AddItemToObject(item, "lcsPrivacyData", lcs_privacy_data_local_JSON); - if (item->child == NULL) { - ogs_error("OpenAPI_subscription_data_sets_1_convertToJSON() failed [lcs_privacy_data]"); - goto end; - } - } - - if (subscription_data_sets_1->lcs_mo_data) { - cJSON *lcs_mo_data_local_JSON = OpenAPI_lcs_mo_data_convertToJSON(subscription_data_sets_1->lcs_mo_data); - if (lcs_mo_data_local_JSON == NULL) { - ogs_error("OpenAPI_subscription_data_sets_1_convertToJSON() failed [lcs_mo_data]"); - goto end; - } - cJSON_AddItemToObject(item, "lcsMoData", lcs_mo_data_local_JSON); - if (item->child == NULL) { - ogs_error("OpenAPI_subscription_data_sets_1_convertToJSON() failed [lcs_mo_data]"); - goto end; - } - } - - if (subscription_data_sets_1->v2x_data) { - cJSON *v2x_data_local_JSON = OpenAPI_v2x_subscription_data_1_convertToJSON(subscription_data_sets_1->v2x_data); - if (v2x_data_local_JSON == NULL) { - ogs_error("OpenAPI_subscription_data_sets_1_convertToJSON() failed [v2x_data]"); - goto end; - } - cJSON_AddItemToObject(item, "v2xData", v2x_data_local_JSON); - if (item->child == NULL) { - ogs_error("OpenAPI_subscription_data_sets_1_convertToJSON() failed [v2x_data]"); - goto end; - } - } - - if (subscription_data_sets_1->lcs_broadcast_assistance_types_data) { - cJSON *lcs_broadcast_assistance_types_data_local_JSON = OpenAPI_lcs_broadcast_assistance_types_data_1_convertToJSON(subscription_data_sets_1->lcs_broadcast_assistance_types_data); - if (lcs_broadcast_assistance_types_data_local_JSON == NULL) { - ogs_error("OpenAPI_subscription_data_sets_1_convertToJSON() failed [lcs_broadcast_assistance_types_data]"); - goto end; - } - cJSON_AddItemToObject(item, "lcsBroadcastAssistanceTypesData", lcs_broadcast_assistance_types_data_local_JSON); - if (item->child == NULL) { - ogs_error("OpenAPI_subscription_data_sets_1_convertToJSON() failed [lcs_broadcast_assistance_types_data]"); - goto end; - } - } - -end: - return item; -} - -OpenAPI_subscription_data_sets_1_t *OpenAPI_subscription_data_sets_1_parseFromJSON(cJSON *subscription_data_sets_1JSON) -{ - OpenAPI_subscription_data_sets_1_t *subscription_data_sets_1_local_var = NULL; - OpenAPI_lnode_t *node = NULL; - cJSON *am_data = NULL; - OpenAPI_access_and_mobility_subscription_data_1_t *am_data_local_nonprim = NULL; - cJSON *smf_sel_data = NULL; - OpenAPI_smf_selection_subscription_data_1_t *smf_sel_data_local_nonprim = NULL; - cJSON *uec_amf_data = NULL; - OpenAPI_ue_context_in_amf_data_1_t *uec_amf_data_local_nonprim = NULL; - cJSON *uec_smf_data = NULL; - OpenAPI_ue_context_in_smf_data_1_t *uec_smf_data_local_nonprim = NULL; - cJSON *uec_smsf_data = NULL; - OpenAPI_ue_context_in_smsf_data_1_t *uec_smsf_data_local_nonprim = NULL; - cJSON *sms_subs_data = NULL; - OpenAPI_sms_subscription_data_1_t *sms_subs_data_local_nonprim = NULL; - cJSON *sm_data = NULL; - OpenAPI_list_t *sm_dataList = NULL; - cJSON *trace_data = NULL; - OpenAPI_trace_data_t *trace_data_local_nonprim = NULL; - cJSON *sms_mng_data = NULL; - OpenAPI_sms_management_subscription_data_1_t *sms_mng_data_local_nonprim = NULL; - cJSON *lcs_privacy_data = NULL; - OpenAPI_lcs_privacy_data_1_t *lcs_privacy_data_local_nonprim = NULL; - cJSON *lcs_mo_data = NULL; - OpenAPI_lcs_mo_data_t *lcs_mo_data_local_nonprim = NULL; - cJSON *v2x_data = NULL; - OpenAPI_v2x_subscription_data_1_t *v2x_data_local_nonprim = NULL; - cJSON *lcs_broadcast_assistance_types_data = NULL; - OpenAPI_lcs_broadcast_assistance_types_data_1_t *lcs_broadcast_assistance_types_data_local_nonprim = NULL; - am_data = cJSON_GetObjectItemCaseSensitive(subscription_data_sets_1JSON, "amData"); - if (am_data) { - am_data_local_nonprim = OpenAPI_access_and_mobility_subscription_data_1_parseFromJSON(am_data); - } - - smf_sel_data = cJSON_GetObjectItemCaseSensitive(subscription_data_sets_1JSON, "smfSelData"); - if (smf_sel_data) { - smf_sel_data_local_nonprim = OpenAPI_smf_selection_subscription_data_1_parseFromJSON(smf_sel_data); - } - - uec_amf_data = cJSON_GetObjectItemCaseSensitive(subscription_data_sets_1JSON, "uecAmfData"); - if (uec_amf_data) { - uec_amf_data_local_nonprim = OpenAPI_ue_context_in_amf_data_1_parseFromJSON(uec_amf_data); - } - - uec_smf_data = cJSON_GetObjectItemCaseSensitive(subscription_data_sets_1JSON, "uecSmfData"); - if (uec_smf_data) { - uec_smf_data_local_nonprim = OpenAPI_ue_context_in_smf_data_1_parseFromJSON(uec_smf_data); - } - - uec_smsf_data = cJSON_GetObjectItemCaseSensitive(subscription_data_sets_1JSON, "uecSmsfData"); - if (uec_smsf_data) { - uec_smsf_data_local_nonprim = OpenAPI_ue_context_in_smsf_data_1_parseFromJSON(uec_smsf_data); - } - - sms_subs_data = cJSON_GetObjectItemCaseSensitive(subscription_data_sets_1JSON, "smsSubsData"); - if (sms_subs_data) { - sms_subs_data_local_nonprim = OpenAPI_sms_subscription_data_1_parseFromJSON(sms_subs_data); - } - - sm_data = cJSON_GetObjectItemCaseSensitive(subscription_data_sets_1JSON, "smData"); - if (sm_data) { - cJSON *sm_data_local = NULL; - if (!cJSON_IsArray(sm_data)) { - ogs_error("OpenAPI_subscription_data_sets_1_parseFromJSON() failed [sm_data]"); - goto end; - } - - sm_dataList = OpenAPI_list_create(); - - cJSON_ArrayForEach(sm_data_local, sm_data) { - if (!cJSON_IsObject(sm_data_local)) { - ogs_error("OpenAPI_subscription_data_sets_1_parseFromJSON() failed [sm_data]"); - goto end; - } - OpenAPI_session_management_subscription_data_1_t *sm_dataItem = OpenAPI_session_management_subscription_data_1_parseFromJSON(sm_data_local); - if (!sm_dataItem) { - ogs_error("No sm_dataItem"); - OpenAPI_list_free(sm_dataList); - goto end; - } - OpenAPI_list_add(sm_dataList, sm_dataItem); - } - } - - trace_data = cJSON_GetObjectItemCaseSensitive(subscription_data_sets_1JSON, "traceData"); - if (trace_data) { - trace_data_local_nonprim = OpenAPI_trace_data_parseFromJSON(trace_data); - } - - sms_mng_data = cJSON_GetObjectItemCaseSensitive(subscription_data_sets_1JSON, "smsMngData"); - if (sms_mng_data) { - sms_mng_data_local_nonprim = OpenAPI_sms_management_subscription_data_1_parseFromJSON(sms_mng_data); - } - - lcs_privacy_data = cJSON_GetObjectItemCaseSensitive(subscription_data_sets_1JSON, "lcsPrivacyData"); - if (lcs_privacy_data) { - lcs_privacy_data_local_nonprim = OpenAPI_lcs_privacy_data_1_parseFromJSON(lcs_privacy_data); - } - - lcs_mo_data = cJSON_GetObjectItemCaseSensitive(subscription_data_sets_1JSON, "lcsMoData"); - if (lcs_mo_data) { - lcs_mo_data_local_nonprim = OpenAPI_lcs_mo_data_parseFromJSON(lcs_mo_data); - } - - v2x_data = cJSON_GetObjectItemCaseSensitive(subscription_data_sets_1JSON, "v2xData"); - if (v2x_data) { - v2x_data_local_nonprim = OpenAPI_v2x_subscription_data_1_parseFromJSON(v2x_data); - } - - lcs_broadcast_assistance_types_data = cJSON_GetObjectItemCaseSensitive(subscription_data_sets_1JSON, "lcsBroadcastAssistanceTypesData"); - if (lcs_broadcast_assistance_types_data) { - lcs_broadcast_assistance_types_data_local_nonprim = OpenAPI_lcs_broadcast_assistance_types_data_1_parseFromJSON(lcs_broadcast_assistance_types_data); - } - - subscription_data_sets_1_local_var = OpenAPI_subscription_data_sets_1_create ( - am_data ? am_data_local_nonprim : NULL, - smf_sel_data ? smf_sel_data_local_nonprim : NULL, - uec_amf_data ? uec_amf_data_local_nonprim : NULL, - uec_smf_data ? uec_smf_data_local_nonprim : NULL, - uec_smsf_data ? uec_smsf_data_local_nonprim : NULL, - sms_subs_data ? sms_subs_data_local_nonprim : NULL, - sm_data ? sm_dataList : NULL, - trace_data ? trace_data_local_nonprim : NULL, - sms_mng_data ? sms_mng_data_local_nonprim : NULL, - lcs_privacy_data ? lcs_privacy_data_local_nonprim : NULL, - lcs_mo_data ? lcs_mo_data_local_nonprim : NULL, - v2x_data ? v2x_data_local_nonprim : NULL, - lcs_broadcast_assistance_types_data ? lcs_broadcast_assistance_types_data_local_nonprim : NULL - ); - - return subscription_data_sets_1_local_var; -end: - if (am_data_local_nonprim) { - OpenAPI_access_and_mobility_subscription_data_1_free(am_data_local_nonprim); - am_data_local_nonprim = NULL; - } - if (smf_sel_data_local_nonprim) { - OpenAPI_smf_selection_subscription_data_1_free(smf_sel_data_local_nonprim); - smf_sel_data_local_nonprim = NULL; - } - if (uec_amf_data_local_nonprim) { - OpenAPI_ue_context_in_amf_data_1_free(uec_amf_data_local_nonprim); - uec_amf_data_local_nonprim = NULL; - } - if (uec_smf_data_local_nonprim) { - OpenAPI_ue_context_in_smf_data_1_free(uec_smf_data_local_nonprim); - uec_smf_data_local_nonprim = NULL; - } - if (uec_smsf_data_local_nonprim) { - OpenAPI_ue_context_in_smsf_data_1_free(uec_smsf_data_local_nonprim); - uec_smsf_data_local_nonprim = NULL; - } - if (sms_subs_data_local_nonprim) { - OpenAPI_sms_subscription_data_1_free(sms_subs_data_local_nonprim); - sms_subs_data_local_nonprim = NULL; - } - if (sm_dataList) { - OpenAPI_list_for_each(sm_dataList, node) { - OpenAPI_session_management_subscription_data_1_free(node->data); - } - OpenAPI_list_free(sm_dataList); - sm_dataList = NULL; - } - if (trace_data_local_nonprim) { - OpenAPI_trace_data_free(trace_data_local_nonprim); - trace_data_local_nonprim = NULL; - } - if (sms_mng_data_local_nonprim) { - OpenAPI_sms_management_subscription_data_1_free(sms_mng_data_local_nonprim); - sms_mng_data_local_nonprim = NULL; - } - if (lcs_privacy_data_local_nonprim) { - OpenAPI_lcs_privacy_data_1_free(lcs_privacy_data_local_nonprim); - lcs_privacy_data_local_nonprim = NULL; - } - if (lcs_mo_data_local_nonprim) { - OpenAPI_lcs_mo_data_free(lcs_mo_data_local_nonprim); - lcs_mo_data_local_nonprim = NULL; - } - if (v2x_data_local_nonprim) { - OpenAPI_v2x_subscription_data_1_free(v2x_data_local_nonprim); - v2x_data_local_nonprim = NULL; - } - if (lcs_broadcast_assistance_types_data_local_nonprim) { - OpenAPI_lcs_broadcast_assistance_types_data_1_free(lcs_broadcast_assistance_types_data_local_nonprim); - lcs_broadcast_assistance_types_data_local_nonprim = NULL; - } - return NULL; -} - -OpenAPI_subscription_data_sets_1_t *OpenAPI_subscription_data_sets_1_copy(OpenAPI_subscription_data_sets_1_t *dst, OpenAPI_subscription_data_sets_1_t *src) -{ - cJSON *item = NULL; - char *content = NULL; - - ogs_assert(src); - item = OpenAPI_subscription_data_sets_1_convertToJSON(src); - if (!item) { - ogs_error("OpenAPI_subscription_data_sets_1_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_subscription_data_sets_1_free(dst); - dst = OpenAPI_subscription_data_sets_1_parseFromJSON(item); - cJSON_Delete(item); - - return dst; -} - diff --git a/lib/sbi/openapi/model/subscription_data_sets_1.h b/lib/sbi/openapi/model/subscription_data_sets_1.h deleted file mode 100644 index 579c490bb..000000000 --- a/lib/sbi/openapi/model/subscription_data_sets_1.h +++ /dev/null @@ -1,75 +0,0 @@ -/* - * subscription_data_sets_1.h - * - * - */ - -#ifndef _OpenAPI_subscription_data_sets_1_H_ -#define _OpenAPI_subscription_data_sets_1_H_ - -#include -#include "../external/cJSON.h" -#include "../include/list.h" -#include "../include/keyValuePair.h" -#include "../include/binary.h" -#include "access_and_mobility_subscription_data_1.h" -#include "lcs_broadcast_assistance_types_data_1.h" -#include "lcs_mo_data.h" -#include "lcs_privacy_data_1.h" -#include "session_management_subscription_data_1.h" -#include "smf_selection_subscription_data_1.h" -#include "sms_management_subscription_data_1.h" -#include "sms_subscription_data_1.h" -#include "trace_data.h" -#include "ue_context_in_amf_data_1.h" -#include "ue_context_in_smf_data_1.h" -#include "ue_context_in_smsf_data_1.h" -#include "v2x_subscription_data_1.h" - -#ifdef __cplusplus -extern "C" { -#endif - -typedef struct OpenAPI_subscription_data_sets_1_s OpenAPI_subscription_data_sets_1_t; -typedef struct OpenAPI_subscription_data_sets_1_s { - struct OpenAPI_access_and_mobility_subscription_data_1_s *am_data; - struct OpenAPI_smf_selection_subscription_data_1_s *smf_sel_data; - struct OpenAPI_ue_context_in_amf_data_1_s *uec_amf_data; - struct OpenAPI_ue_context_in_smf_data_1_s *uec_smf_data; - struct OpenAPI_ue_context_in_smsf_data_1_s *uec_smsf_data; - struct OpenAPI_sms_subscription_data_1_s *sms_subs_data; - OpenAPI_list_t *sm_data; - struct OpenAPI_trace_data_s *trace_data; - struct OpenAPI_sms_management_subscription_data_1_s *sms_mng_data; - struct OpenAPI_lcs_privacy_data_1_s *lcs_privacy_data; - struct OpenAPI_lcs_mo_data_s *lcs_mo_data; - struct OpenAPI_v2x_subscription_data_1_s *v2x_data; - struct OpenAPI_lcs_broadcast_assistance_types_data_1_s *lcs_broadcast_assistance_types_data; -} OpenAPI_subscription_data_sets_1_t; - -OpenAPI_subscription_data_sets_1_t *OpenAPI_subscription_data_sets_1_create( - OpenAPI_access_and_mobility_subscription_data_1_t *am_data, - OpenAPI_smf_selection_subscription_data_1_t *smf_sel_data, - OpenAPI_ue_context_in_amf_data_1_t *uec_amf_data, - OpenAPI_ue_context_in_smf_data_1_t *uec_smf_data, - OpenAPI_ue_context_in_smsf_data_1_t *uec_smsf_data, - OpenAPI_sms_subscription_data_1_t *sms_subs_data, - OpenAPI_list_t *sm_data, - OpenAPI_trace_data_t *trace_data, - OpenAPI_sms_management_subscription_data_1_t *sms_mng_data, - OpenAPI_lcs_privacy_data_1_t *lcs_privacy_data, - OpenAPI_lcs_mo_data_t *lcs_mo_data, - OpenAPI_v2x_subscription_data_1_t *v2x_data, - OpenAPI_lcs_broadcast_assistance_types_data_1_t *lcs_broadcast_assistance_types_data -); -void OpenAPI_subscription_data_sets_1_free(OpenAPI_subscription_data_sets_1_t *subscription_data_sets_1); -OpenAPI_subscription_data_sets_1_t *OpenAPI_subscription_data_sets_1_parseFromJSON(cJSON *subscription_data_sets_1JSON); -cJSON *OpenAPI_subscription_data_sets_1_convertToJSON(OpenAPI_subscription_data_sets_1_t *subscription_data_sets_1); -OpenAPI_subscription_data_sets_1_t *OpenAPI_subscription_data_sets_1_copy(OpenAPI_subscription_data_sets_1_t *dst, OpenAPI_subscription_data_sets_1_t *src); - -#ifdef __cplusplus -} -#endif - -#endif /* _OpenAPI_subscription_data_sets_1_H_ */ - diff --git a/lib/sbi/openapi/model/subscription_data_subscr_cond.c b/lib/sbi/openapi/model/subscription_data_subscr_cond.c deleted file mode 100644 index c7f774db4..000000000 --- a/lib/sbi/openapi/model/subscription_data_subscr_cond.c +++ /dev/null @@ -1,557 +0,0 @@ - -#include -#include -#include -#include "subscription_data_subscr_cond.h" - -OpenAPI_subscription_data_subscr_cond_t *OpenAPI_subscription_data_subscr_cond_create( - char *nf_instance_id, - OpenAPI_nf_type_e nf_type, - char *service_name, - char *amf_set_id, - char *amf_region_id, - OpenAPI_list_t *guami_list, - OpenAPI_list_t *snssai_list, - OpenAPI_list_t *nsi_list, - char *nf_group_id, - char *nf_set_id, - char *nf_service_set_id, - OpenAPI_list_t *smf_serving_area, - OpenAPI_list_t *tai_list -) -{ - OpenAPI_subscription_data_subscr_cond_t *subscription_data_subscr_cond_local_var = ogs_malloc(sizeof(OpenAPI_subscription_data_subscr_cond_t)); - ogs_assert(subscription_data_subscr_cond_local_var); - - subscription_data_subscr_cond_local_var->nf_instance_id = nf_instance_id; - subscription_data_subscr_cond_local_var->nf_type = nf_type; - subscription_data_subscr_cond_local_var->service_name = service_name; - subscription_data_subscr_cond_local_var->amf_set_id = amf_set_id; - subscription_data_subscr_cond_local_var->amf_region_id = amf_region_id; - subscription_data_subscr_cond_local_var->guami_list = guami_list; - subscription_data_subscr_cond_local_var->snssai_list = snssai_list; - subscription_data_subscr_cond_local_var->nsi_list = nsi_list; - subscription_data_subscr_cond_local_var->nf_group_id = nf_group_id; - subscription_data_subscr_cond_local_var->nf_set_id = nf_set_id; - subscription_data_subscr_cond_local_var->nf_service_set_id = nf_service_set_id; - subscription_data_subscr_cond_local_var->smf_serving_area = smf_serving_area; - subscription_data_subscr_cond_local_var->tai_list = tai_list; - - return subscription_data_subscr_cond_local_var; -} - -void OpenAPI_subscription_data_subscr_cond_free(OpenAPI_subscription_data_subscr_cond_t *subscription_data_subscr_cond) -{ - OpenAPI_lnode_t *node = NULL; - - if (NULL == subscription_data_subscr_cond) { - return; - } - if (subscription_data_subscr_cond->nf_instance_id) { - ogs_free(subscription_data_subscr_cond->nf_instance_id); - subscription_data_subscr_cond->nf_instance_id = NULL; - } - if (subscription_data_subscr_cond->service_name) { - ogs_free(subscription_data_subscr_cond->service_name); - subscription_data_subscr_cond->service_name = NULL; - } - if (subscription_data_subscr_cond->amf_set_id) { - ogs_free(subscription_data_subscr_cond->amf_set_id); - subscription_data_subscr_cond->amf_set_id = NULL; - } - if (subscription_data_subscr_cond->amf_region_id) { - ogs_free(subscription_data_subscr_cond->amf_region_id); - subscription_data_subscr_cond->amf_region_id = NULL; - } - if (subscription_data_subscr_cond->guami_list) { - OpenAPI_list_for_each(subscription_data_subscr_cond->guami_list, node) { - OpenAPI_guami_free(node->data); - } - OpenAPI_list_free(subscription_data_subscr_cond->guami_list); - subscription_data_subscr_cond->guami_list = NULL; - } - if (subscription_data_subscr_cond->snssai_list) { - OpenAPI_list_for_each(subscription_data_subscr_cond->snssai_list, node) { - OpenAPI_snssai_free(node->data); - } - OpenAPI_list_free(subscription_data_subscr_cond->snssai_list); - subscription_data_subscr_cond->snssai_list = NULL; - } - if (subscription_data_subscr_cond->nsi_list) { - OpenAPI_list_for_each(subscription_data_subscr_cond->nsi_list, node) { - ogs_free(node->data); - } - OpenAPI_list_free(subscription_data_subscr_cond->nsi_list); - subscription_data_subscr_cond->nsi_list = NULL; - } - if (subscription_data_subscr_cond->nf_group_id) { - ogs_free(subscription_data_subscr_cond->nf_group_id); - subscription_data_subscr_cond->nf_group_id = NULL; - } - if (subscription_data_subscr_cond->nf_set_id) { - ogs_free(subscription_data_subscr_cond->nf_set_id); - subscription_data_subscr_cond->nf_set_id = NULL; - } - if (subscription_data_subscr_cond->nf_service_set_id) { - ogs_free(subscription_data_subscr_cond->nf_service_set_id); - subscription_data_subscr_cond->nf_service_set_id = NULL; - } - if (subscription_data_subscr_cond->smf_serving_area) { - OpenAPI_list_for_each(subscription_data_subscr_cond->smf_serving_area, node) { - ogs_free(node->data); - } - OpenAPI_list_free(subscription_data_subscr_cond->smf_serving_area); - subscription_data_subscr_cond->smf_serving_area = NULL; - } - if (subscription_data_subscr_cond->tai_list) { - OpenAPI_list_for_each(subscription_data_subscr_cond->tai_list, node) { - OpenAPI_tai_free(node->data); - } - OpenAPI_list_free(subscription_data_subscr_cond->tai_list); - subscription_data_subscr_cond->tai_list = NULL; - } - ogs_free(subscription_data_subscr_cond); -} - -cJSON *OpenAPI_subscription_data_subscr_cond_convertToJSON(OpenAPI_subscription_data_subscr_cond_t *subscription_data_subscr_cond) -{ - cJSON *item = NULL; - OpenAPI_lnode_t *node = NULL; - - if (subscription_data_subscr_cond == NULL) { - ogs_error("OpenAPI_subscription_data_subscr_cond_convertToJSON() failed [SubscriptionData_subscrCond]"); - return NULL; - } - - item = cJSON_CreateObject(); - if (subscription_data_subscr_cond->nf_instance_id) { - if (cJSON_AddStringToObject(item, "nfInstanceId", subscription_data_subscr_cond->nf_instance_id) == NULL) { - ogs_error("OpenAPI_subscription_data_subscr_cond_convertToJSON() failed [nf_instance_id]"); - goto end; - } - } - - if (subscription_data_subscr_cond->nf_type != OpenAPI_nf_type_NULL) { - if (cJSON_AddStringToObject(item, "nfType", OpenAPI_nf_type_ToString(subscription_data_subscr_cond->nf_type)) == NULL) { - ogs_error("OpenAPI_subscription_data_subscr_cond_convertToJSON() failed [nf_type]"); - goto end; - } - } - - if (subscription_data_subscr_cond->service_name) { - if (cJSON_AddStringToObject(item, "serviceName", subscription_data_subscr_cond->service_name) == NULL) { - ogs_error("OpenAPI_subscription_data_subscr_cond_convertToJSON() failed [service_name]"); - goto end; - } - } - - if (subscription_data_subscr_cond->amf_set_id) { - if (cJSON_AddStringToObject(item, "amfSetId", subscription_data_subscr_cond->amf_set_id) == NULL) { - ogs_error("OpenAPI_subscription_data_subscr_cond_convertToJSON() failed [amf_set_id]"); - goto end; - } - } - - if (subscription_data_subscr_cond->amf_region_id) { - if (cJSON_AddStringToObject(item, "amfRegionId", subscription_data_subscr_cond->amf_region_id) == NULL) { - ogs_error("OpenAPI_subscription_data_subscr_cond_convertToJSON() failed [amf_region_id]"); - goto end; - } - } - - if (subscription_data_subscr_cond->guami_list) { - cJSON *guami_listList = cJSON_AddArrayToObject(item, "guamiList"); - if (guami_listList == NULL) { - ogs_error("OpenAPI_subscription_data_subscr_cond_convertToJSON() failed [guami_list]"); - goto end; - } - OpenAPI_list_for_each(subscription_data_subscr_cond->guami_list, node) { - cJSON *itemLocal = OpenAPI_guami_convertToJSON(node->data); - if (itemLocal == NULL) { - ogs_error("OpenAPI_subscription_data_subscr_cond_convertToJSON() failed [guami_list]"); - goto end; - } - cJSON_AddItemToArray(guami_listList, itemLocal); - } - } - - if (subscription_data_subscr_cond->snssai_list) { - cJSON *snssai_listList = cJSON_AddArrayToObject(item, "snssaiList"); - if (snssai_listList == NULL) { - ogs_error("OpenAPI_subscription_data_subscr_cond_convertToJSON() failed [snssai_list]"); - goto end; - } - OpenAPI_list_for_each(subscription_data_subscr_cond->snssai_list, node) { - cJSON *itemLocal = OpenAPI_snssai_convertToJSON(node->data); - if (itemLocal == NULL) { - ogs_error("OpenAPI_subscription_data_subscr_cond_convertToJSON() failed [snssai_list]"); - goto end; - } - cJSON_AddItemToArray(snssai_listList, itemLocal); - } - } - - if (subscription_data_subscr_cond->nsi_list) { - cJSON *nsi_listList = cJSON_AddArrayToObject(item, "nsiList"); - if (nsi_listList == NULL) { - ogs_error("OpenAPI_subscription_data_subscr_cond_convertToJSON() failed [nsi_list]"); - goto end; - } - OpenAPI_list_for_each(subscription_data_subscr_cond->nsi_list, node) { - if (cJSON_AddStringToObject(nsi_listList, "", (char*)node->data) == NULL) { - ogs_error("OpenAPI_subscription_data_subscr_cond_convertToJSON() failed [nsi_list]"); - goto end; - } - } - } - - if (subscription_data_subscr_cond->nf_group_id) { - if (cJSON_AddStringToObject(item, "nfGroupId", subscription_data_subscr_cond->nf_group_id) == NULL) { - ogs_error("OpenAPI_subscription_data_subscr_cond_convertToJSON() failed [nf_group_id]"); - goto end; - } - } - - if (subscription_data_subscr_cond->nf_set_id) { - if (cJSON_AddStringToObject(item, "nfSetId", subscription_data_subscr_cond->nf_set_id) == NULL) { - ogs_error("OpenAPI_subscription_data_subscr_cond_convertToJSON() failed [nf_set_id]"); - goto end; - } - } - - if (subscription_data_subscr_cond->nf_service_set_id) { - if (cJSON_AddStringToObject(item, "nfServiceSetId", subscription_data_subscr_cond->nf_service_set_id) == NULL) { - ogs_error("OpenAPI_subscription_data_subscr_cond_convertToJSON() failed [nf_service_set_id]"); - goto end; - } - } - - if (subscription_data_subscr_cond->smf_serving_area) { - cJSON *smf_serving_areaList = cJSON_AddArrayToObject(item, "smfServingArea"); - if (smf_serving_areaList == NULL) { - ogs_error("OpenAPI_subscription_data_subscr_cond_convertToJSON() failed [smf_serving_area]"); - goto end; - } - OpenAPI_list_for_each(subscription_data_subscr_cond->smf_serving_area, node) { - if (cJSON_AddStringToObject(smf_serving_areaList, "", (char*)node->data) == NULL) { - ogs_error("OpenAPI_subscription_data_subscr_cond_convertToJSON() failed [smf_serving_area]"); - goto end; - } - } - } - - if (subscription_data_subscr_cond->tai_list) { - cJSON *tai_listList = cJSON_AddArrayToObject(item, "taiList"); - if (tai_listList == NULL) { - ogs_error("OpenAPI_subscription_data_subscr_cond_convertToJSON() failed [tai_list]"); - goto end; - } - OpenAPI_list_for_each(subscription_data_subscr_cond->tai_list, node) { - cJSON *itemLocal = OpenAPI_tai_convertToJSON(node->data); - if (itemLocal == NULL) { - ogs_error("OpenAPI_subscription_data_subscr_cond_convertToJSON() failed [tai_list]"); - goto end; - } - cJSON_AddItemToArray(tai_listList, itemLocal); - } - } - -end: - return item; -} - -OpenAPI_subscription_data_subscr_cond_t *OpenAPI_subscription_data_subscr_cond_parseFromJSON(cJSON *subscription_data_subscr_condJSON) -{ - OpenAPI_subscription_data_subscr_cond_t *subscription_data_subscr_cond_local_var = NULL; - OpenAPI_lnode_t *node = NULL; - cJSON *nf_instance_id = NULL; - cJSON *nf_type = NULL; - OpenAPI_nf_type_e nf_typeVariable = 0; - cJSON *service_name = NULL; - cJSON *amf_set_id = NULL; - cJSON *amf_region_id = NULL; - cJSON *guami_list = NULL; - OpenAPI_list_t *guami_listList = NULL; - cJSON *snssai_list = NULL; - OpenAPI_list_t *snssai_listList = NULL; - cJSON *nsi_list = NULL; - OpenAPI_list_t *nsi_listList = NULL; - cJSON *nf_group_id = NULL; - cJSON *nf_set_id = NULL; - cJSON *nf_service_set_id = NULL; - cJSON *smf_serving_area = NULL; - OpenAPI_list_t *smf_serving_areaList = NULL; - cJSON *tai_list = NULL; - OpenAPI_list_t *tai_listList = NULL; - nf_instance_id = cJSON_GetObjectItemCaseSensitive(subscription_data_subscr_condJSON, "nfInstanceId"); - if (nf_instance_id) { - if (!cJSON_IsString(nf_instance_id) && !cJSON_IsNull(nf_instance_id)) { - ogs_error("OpenAPI_subscription_data_subscr_cond_parseFromJSON() failed [nf_instance_id]"); - goto end; - } - } - - nf_type = cJSON_GetObjectItemCaseSensitive(subscription_data_subscr_condJSON, "nfType"); - if (nf_type) { - if (!cJSON_IsString(nf_type)) { - ogs_error("OpenAPI_subscription_data_subscr_cond_parseFromJSON() failed [nf_type]"); - goto end; - } - nf_typeVariable = OpenAPI_nf_type_FromString(nf_type->valuestring); - } - - service_name = cJSON_GetObjectItemCaseSensitive(subscription_data_subscr_condJSON, "serviceName"); - if (service_name) { - if (!cJSON_IsString(service_name) && !cJSON_IsNull(service_name)) { - ogs_error("OpenAPI_subscription_data_subscr_cond_parseFromJSON() failed [service_name]"); - goto end; - } - } - - amf_set_id = cJSON_GetObjectItemCaseSensitive(subscription_data_subscr_condJSON, "amfSetId"); - if (amf_set_id) { - if (!cJSON_IsString(amf_set_id) && !cJSON_IsNull(amf_set_id)) { - ogs_error("OpenAPI_subscription_data_subscr_cond_parseFromJSON() failed [amf_set_id]"); - goto end; - } - } - - amf_region_id = cJSON_GetObjectItemCaseSensitive(subscription_data_subscr_condJSON, "amfRegionId"); - if (amf_region_id) { - if (!cJSON_IsString(amf_region_id) && !cJSON_IsNull(amf_region_id)) { - ogs_error("OpenAPI_subscription_data_subscr_cond_parseFromJSON() failed [amf_region_id]"); - goto end; - } - } - - guami_list = cJSON_GetObjectItemCaseSensitive(subscription_data_subscr_condJSON, "guamiList"); - if (guami_list) { - cJSON *guami_list_local = NULL; - if (!cJSON_IsArray(guami_list)) { - ogs_error("OpenAPI_subscription_data_subscr_cond_parseFromJSON() failed [guami_list]"); - goto end; - } - - guami_listList = OpenAPI_list_create(); - - cJSON_ArrayForEach(guami_list_local, guami_list) { - if (!cJSON_IsObject(guami_list_local)) { - ogs_error("OpenAPI_subscription_data_subscr_cond_parseFromJSON() failed [guami_list]"); - goto end; - } - OpenAPI_guami_t *guami_listItem = OpenAPI_guami_parseFromJSON(guami_list_local); - if (!guami_listItem) { - ogs_error("No guami_listItem"); - OpenAPI_list_free(guami_listList); - goto end; - } - OpenAPI_list_add(guami_listList, guami_listItem); - } - } - - snssai_list = cJSON_GetObjectItemCaseSensitive(subscription_data_subscr_condJSON, "snssaiList"); - if (snssai_list) { - cJSON *snssai_list_local = NULL; - if (!cJSON_IsArray(snssai_list)) { - ogs_error("OpenAPI_subscription_data_subscr_cond_parseFromJSON() failed [snssai_list]"); - goto end; - } - - snssai_listList = OpenAPI_list_create(); - - cJSON_ArrayForEach(snssai_list_local, snssai_list) { - if (!cJSON_IsObject(snssai_list_local)) { - ogs_error("OpenAPI_subscription_data_subscr_cond_parseFromJSON() failed [snssai_list]"); - goto end; - } - OpenAPI_snssai_t *snssai_listItem = OpenAPI_snssai_parseFromJSON(snssai_list_local); - if (!snssai_listItem) { - ogs_error("No snssai_listItem"); - OpenAPI_list_free(snssai_listList); - goto end; - } - OpenAPI_list_add(snssai_listList, snssai_listItem); - } - } - - nsi_list = cJSON_GetObjectItemCaseSensitive(subscription_data_subscr_condJSON, "nsiList"); - if (nsi_list) { - cJSON *nsi_list_local = NULL; - if (!cJSON_IsArray(nsi_list)) { - ogs_error("OpenAPI_subscription_data_subscr_cond_parseFromJSON() failed [nsi_list]"); - goto end; - } - - nsi_listList = OpenAPI_list_create(); - - cJSON_ArrayForEach(nsi_list_local, nsi_list) { - double *localDouble = NULL; - int *localInt = NULL; - if (!cJSON_IsString(nsi_list_local)) { - ogs_error("OpenAPI_subscription_data_subscr_cond_parseFromJSON() failed [nsi_list]"); - goto end; - } - OpenAPI_list_add(nsi_listList, ogs_strdup(nsi_list_local->valuestring)); - } - } - - nf_group_id = cJSON_GetObjectItemCaseSensitive(subscription_data_subscr_condJSON, "nfGroupId"); - if (nf_group_id) { - if (!cJSON_IsString(nf_group_id) && !cJSON_IsNull(nf_group_id)) { - ogs_error("OpenAPI_subscription_data_subscr_cond_parseFromJSON() failed [nf_group_id]"); - goto end; - } - } - - nf_set_id = cJSON_GetObjectItemCaseSensitive(subscription_data_subscr_condJSON, "nfSetId"); - if (nf_set_id) { - if (!cJSON_IsString(nf_set_id) && !cJSON_IsNull(nf_set_id)) { - ogs_error("OpenAPI_subscription_data_subscr_cond_parseFromJSON() failed [nf_set_id]"); - goto end; - } - } - - nf_service_set_id = cJSON_GetObjectItemCaseSensitive(subscription_data_subscr_condJSON, "nfServiceSetId"); - if (nf_service_set_id) { - if (!cJSON_IsString(nf_service_set_id) && !cJSON_IsNull(nf_service_set_id)) { - ogs_error("OpenAPI_subscription_data_subscr_cond_parseFromJSON() failed [nf_service_set_id]"); - goto end; - } - } - - smf_serving_area = cJSON_GetObjectItemCaseSensitive(subscription_data_subscr_condJSON, "smfServingArea"); - if (smf_serving_area) { - cJSON *smf_serving_area_local = NULL; - if (!cJSON_IsArray(smf_serving_area)) { - ogs_error("OpenAPI_subscription_data_subscr_cond_parseFromJSON() failed [smf_serving_area]"); - goto end; - } - - smf_serving_areaList = OpenAPI_list_create(); - - cJSON_ArrayForEach(smf_serving_area_local, smf_serving_area) { - double *localDouble = NULL; - int *localInt = NULL; - if (!cJSON_IsString(smf_serving_area_local)) { - ogs_error("OpenAPI_subscription_data_subscr_cond_parseFromJSON() failed [smf_serving_area]"); - goto end; - } - OpenAPI_list_add(smf_serving_areaList, ogs_strdup(smf_serving_area_local->valuestring)); - } - } - - tai_list = cJSON_GetObjectItemCaseSensitive(subscription_data_subscr_condJSON, "taiList"); - if (tai_list) { - cJSON *tai_list_local = NULL; - if (!cJSON_IsArray(tai_list)) { - ogs_error("OpenAPI_subscription_data_subscr_cond_parseFromJSON() failed [tai_list]"); - goto end; - } - - tai_listList = OpenAPI_list_create(); - - cJSON_ArrayForEach(tai_list_local, tai_list) { - if (!cJSON_IsObject(tai_list_local)) { - ogs_error("OpenAPI_subscription_data_subscr_cond_parseFromJSON() failed [tai_list]"); - goto end; - } - OpenAPI_tai_t *tai_listItem = OpenAPI_tai_parseFromJSON(tai_list_local); - if (!tai_listItem) { - ogs_error("No tai_listItem"); - OpenAPI_list_free(tai_listList); - goto end; - } - OpenAPI_list_add(tai_listList, tai_listItem); - } - } - - subscription_data_subscr_cond_local_var = OpenAPI_subscription_data_subscr_cond_create ( - nf_instance_id && !cJSON_IsNull(nf_instance_id) ? ogs_strdup(nf_instance_id->valuestring) : NULL, - nf_type ? nf_typeVariable : 0, - service_name && !cJSON_IsNull(service_name) ? ogs_strdup(service_name->valuestring) : NULL, - amf_set_id && !cJSON_IsNull(amf_set_id) ? ogs_strdup(amf_set_id->valuestring) : NULL, - amf_region_id && !cJSON_IsNull(amf_region_id) ? ogs_strdup(amf_region_id->valuestring) : NULL, - guami_list ? guami_listList : NULL, - snssai_list ? snssai_listList : NULL, - nsi_list ? nsi_listList : NULL, - nf_group_id && !cJSON_IsNull(nf_group_id) ? ogs_strdup(nf_group_id->valuestring) : NULL, - nf_set_id && !cJSON_IsNull(nf_set_id) ? ogs_strdup(nf_set_id->valuestring) : NULL, - nf_service_set_id && !cJSON_IsNull(nf_service_set_id) ? ogs_strdup(nf_service_set_id->valuestring) : NULL, - smf_serving_area ? smf_serving_areaList : NULL, - tai_list ? tai_listList : NULL - ); - - return subscription_data_subscr_cond_local_var; -end: - if (guami_listList) { - OpenAPI_list_for_each(guami_listList, node) { - OpenAPI_guami_free(node->data); - } - OpenAPI_list_free(guami_listList); - guami_listList = NULL; - } - if (snssai_listList) { - OpenAPI_list_for_each(snssai_listList, node) { - OpenAPI_snssai_free(node->data); - } - OpenAPI_list_free(snssai_listList); - snssai_listList = NULL; - } - if (nsi_listList) { - OpenAPI_list_for_each(nsi_listList, node) { - ogs_free(node->data); - } - OpenAPI_list_free(nsi_listList); - nsi_listList = NULL; - } - if (smf_serving_areaList) { - OpenAPI_list_for_each(smf_serving_areaList, node) { - ogs_free(node->data); - } - OpenAPI_list_free(smf_serving_areaList); - smf_serving_areaList = NULL; - } - if (tai_listList) { - OpenAPI_list_for_each(tai_listList, node) { - OpenAPI_tai_free(node->data); - } - OpenAPI_list_free(tai_listList); - tai_listList = NULL; - } - return NULL; -} - -OpenAPI_subscription_data_subscr_cond_t *OpenAPI_subscription_data_subscr_cond_copy(OpenAPI_subscription_data_subscr_cond_t *dst, OpenAPI_subscription_data_subscr_cond_t *src) -{ - cJSON *item = NULL; - char *content = NULL; - - ogs_assert(src); - item = OpenAPI_subscription_data_subscr_cond_convertToJSON(src); - if (!item) { - ogs_error("OpenAPI_subscription_data_subscr_cond_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_subscription_data_subscr_cond_free(dst); - dst = OpenAPI_subscription_data_subscr_cond_parseFromJSON(item); - cJSON_Delete(item); - - return dst; -} - diff --git a/lib/sbi/openapi/model/subscription_data_subscr_cond.h b/lib/sbi/openapi/model/subscription_data_subscr_cond.h deleted file mode 100644 index d21591b3d..000000000 --- a/lib/sbi/openapi/model/subscription_data_subscr_cond.h +++ /dev/null @@ -1,66 +0,0 @@ -/* - * subscription_data_subscr_cond.h - * - * - */ - -#ifndef _OpenAPI_subscription_data_subscr_cond_H_ -#define _OpenAPI_subscription_data_subscr_cond_H_ - -#include -#include "../external/cJSON.h" -#include "../include/list.h" -#include "../include/keyValuePair.h" -#include "../include/binary.h" -#include "guami.h" -#include "nf_type.h" -#include "snssai.h" -#include "tai.h" - -#ifdef __cplusplus -extern "C" { -#endif - -typedef struct OpenAPI_subscription_data_subscr_cond_s OpenAPI_subscription_data_subscr_cond_t; -typedef struct OpenAPI_subscription_data_subscr_cond_s { - char *nf_instance_id; - OpenAPI_nf_type_e nf_type; - char *service_name; - char *amf_set_id; - char *amf_region_id; - OpenAPI_list_t *guami_list; - OpenAPI_list_t *snssai_list; - OpenAPI_list_t *nsi_list; - char *nf_group_id; - char *nf_set_id; - char *nf_service_set_id; - OpenAPI_list_t *smf_serving_area; - OpenAPI_list_t *tai_list; -} OpenAPI_subscription_data_subscr_cond_t; - -OpenAPI_subscription_data_subscr_cond_t *OpenAPI_subscription_data_subscr_cond_create( - char *nf_instance_id, - OpenAPI_nf_type_e nf_type, - char *service_name, - char *amf_set_id, - char *amf_region_id, - OpenAPI_list_t *guami_list, - OpenAPI_list_t *snssai_list, - OpenAPI_list_t *nsi_list, - char *nf_group_id, - char *nf_set_id, - char *nf_service_set_id, - OpenAPI_list_t *smf_serving_area, - OpenAPI_list_t *tai_list -); -void OpenAPI_subscription_data_subscr_cond_free(OpenAPI_subscription_data_subscr_cond_t *subscription_data_subscr_cond); -OpenAPI_subscription_data_subscr_cond_t *OpenAPI_subscription_data_subscr_cond_parseFromJSON(cJSON *subscription_data_subscr_condJSON); -cJSON *OpenAPI_subscription_data_subscr_cond_convertToJSON(OpenAPI_subscription_data_subscr_cond_t *subscription_data_subscr_cond); -OpenAPI_subscription_data_subscr_cond_t *OpenAPI_subscription_data_subscr_cond_copy(OpenAPI_subscription_data_subscr_cond_t *dst, OpenAPI_subscription_data_subscr_cond_t *src); - -#ifdef __cplusplus -} -#endif - -#endif /* _OpenAPI_subscription_data_subscr_cond_H_ */ - diff --git a/lib/sbi/openapi/model/subscription_data_subscriptions.c b/lib/sbi/openapi/model/subscription_data_subscriptions.c index bd863217d..fcdbd0734 100644 --- a/lib/sbi/openapi/model/subscription_data_subscriptions.c +++ b/lib/sbi/openapi/model/subscription_data_subscriptions.c @@ -11,7 +11,10 @@ OpenAPI_subscription_data_subscriptions_t *OpenAPI_subscription_data_subscriptio OpenAPI_list_t *monitored_resource_uris, char *expiry, OpenAPI_sdm_subscription_1_t *sdm_subscription, + OpenAPI_hss_subscription_info_t *hss_subscription_info, char *subscription_id, + bool is_unique_subscription, + int unique_subscription, char *supported_features ) { @@ -24,7 +27,10 @@ OpenAPI_subscription_data_subscriptions_t *OpenAPI_subscription_data_subscriptio subscription_data_subscriptions_local_var->monitored_resource_uris = monitored_resource_uris; subscription_data_subscriptions_local_var->expiry = expiry; subscription_data_subscriptions_local_var->sdm_subscription = sdm_subscription; + subscription_data_subscriptions_local_var->hss_subscription_info = hss_subscription_info; subscription_data_subscriptions_local_var->subscription_id = subscription_id; + subscription_data_subscriptions_local_var->is_unique_subscription = is_unique_subscription; + subscription_data_subscriptions_local_var->unique_subscription = unique_subscription; subscription_data_subscriptions_local_var->supported_features = supported_features; return subscription_data_subscriptions_local_var; @@ -64,6 +70,10 @@ void OpenAPI_subscription_data_subscriptions_free(OpenAPI_subscription_data_subs OpenAPI_sdm_subscription_1_free(subscription_data_subscriptions->sdm_subscription); subscription_data_subscriptions->sdm_subscription = NULL; } + if (subscription_data_subscriptions->hss_subscription_info) { + OpenAPI_hss_subscription_info_free(subscription_data_subscriptions->hss_subscription_info); + subscription_data_subscriptions->hss_subscription_info = NULL; + } if (subscription_data_subscriptions->subscription_id) { ogs_free(subscription_data_subscriptions->subscription_id); subscription_data_subscriptions->subscription_id = NULL; @@ -145,6 +155,19 @@ cJSON *OpenAPI_subscription_data_subscriptions_convertToJSON(OpenAPI_subscriptio } } + if (subscription_data_subscriptions->hss_subscription_info) { + cJSON *hss_subscription_info_local_JSON = OpenAPI_hss_subscription_info_convertToJSON(subscription_data_subscriptions->hss_subscription_info); + if (hss_subscription_info_local_JSON == NULL) { + ogs_error("OpenAPI_subscription_data_subscriptions_convertToJSON() failed [hss_subscription_info]"); + goto end; + } + cJSON_AddItemToObject(item, "hssSubscriptionInfo", hss_subscription_info_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_subscription_data_subscriptions_convertToJSON() failed [hss_subscription_info]"); + goto end; + } + } + if (subscription_data_subscriptions->subscription_id) { if (cJSON_AddStringToObject(item, "subscriptionId", subscription_data_subscriptions->subscription_id) == NULL) { ogs_error("OpenAPI_subscription_data_subscriptions_convertToJSON() failed [subscription_id]"); @@ -152,8 +175,15 @@ cJSON *OpenAPI_subscription_data_subscriptions_convertToJSON(OpenAPI_subscriptio } } + if (subscription_data_subscriptions->is_unique_subscription) { + if (cJSON_AddBoolToObject(item, "uniqueSubscription", subscription_data_subscriptions->unique_subscription) == NULL) { + ogs_error("OpenAPI_subscription_data_subscriptions_convertToJSON() failed [unique_subscription]"); + goto end; + } + } + if (subscription_data_subscriptions->supported_features) { - if (cJSON_AddStringToObject(item, "supported-features", subscription_data_subscriptions->supported_features) == NULL) { + if (cJSON_AddStringToObject(item, "supportedFeatures", subscription_data_subscriptions->supported_features) == NULL) { ogs_error("OpenAPI_subscription_data_subscriptions_convertToJSON() failed [supported_features]"); goto end; } @@ -175,7 +205,10 @@ OpenAPI_subscription_data_subscriptions_t *OpenAPI_subscription_data_subscriptio cJSON *expiry = NULL; cJSON *sdm_subscription = NULL; OpenAPI_sdm_subscription_1_t *sdm_subscription_local_nonprim = NULL; + cJSON *hss_subscription_info = NULL; + OpenAPI_hss_subscription_info_t *hss_subscription_info_local_nonprim = NULL; cJSON *subscription_id = NULL; + cJSON *unique_subscription = NULL; cJSON *supported_features = NULL; ue_id = cJSON_GetObjectItemCaseSensitive(subscription_data_subscriptionsJSON, "ueId"); if (ue_id) { @@ -239,6 +272,11 @@ OpenAPI_subscription_data_subscriptions_t *OpenAPI_subscription_data_subscriptio sdm_subscription_local_nonprim = OpenAPI_sdm_subscription_1_parseFromJSON(sdm_subscription); } + hss_subscription_info = cJSON_GetObjectItemCaseSensitive(subscription_data_subscriptionsJSON, "hssSubscriptionInfo"); + if (hss_subscription_info) { + hss_subscription_info_local_nonprim = OpenAPI_hss_subscription_info_parseFromJSON(hss_subscription_info); + } + subscription_id = cJSON_GetObjectItemCaseSensitive(subscription_data_subscriptionsJSON, "subscriptionId"); if (subscription_id) { if (!cJSON_IsString(subscription_id) && !cJSON_IsNull(subscription_id)) { @@ -247,7 +285,15 @@ OpenAPI_subscription_data_subscriptions_t *OpenAPI_subscription_data_subscriptio } } - supported_features = cJSON_GetObjectItemCaseSensitive(subscription_data_subscriptionsJSON, "supported-features"); + unique_subscription = cJSON_GetObjectItemCaseSensitive(subscription_data_subscriptionsJSON, "uniqueSubscription"); + if (unique_subscription) { + if (!cJSON_IsBool(unique_subscription)) { + ogs_error("OpenAPI_subscription_data_subscriptions_parseFromJSON() failed [unique_subscription]"); + goto end; + } + } + + supported_features = cJSON_GetObjectItemCaseSensitive(subscription_data_subscriptionsJSON, "supportedFeatures"); if (supported_features) { if (!cJSON_IsString(supported_features) && !cJSON_IsNull(supported_features)) { ogs_error("OpenAPI_subscription_data_subscriptions_parseFromJSON() failed [supported_features]"); @@ -262,7 +308,10 @@ OpenAPI_subscription_data_subscriptions_t *OpenAPI_subscription_data_subscriptio monitored_resource_urisList, expiry && !cJSON_IsNull(expiry) ? ogs_strdup(expiry->valuestring) : NULL, sdm_subscription ? sdm_subscription_local_nonprim : NULL, + hss_subscription_info ? hss_subscription_info_local_nonprim : NULL, subscription_id && !cJSON_IsNull(subscription_id) ? ogs_strdup(subscription_id->valuestring) : NULL, + unique_subscription ? true : false, + unique_subscription ? unique_subscription->valueint : 0, supported_features && !cJSON_IsNull(supported_features) ? ogs_strdup(supported_features->valuestring) : NULL ); @@ -279,6 +328,10 @@ end: OpenAPI_sdm_subscription_1_free(sdm_subscription_local_nonprim); sdm_subscription_local_nonprim = NULL; } + if (hss_subscription_info_local_nonprim) { + OpenAPI_hss_subscription_info_free(hss_subscription_info_local_nonprim); + hss_subscription_info_local_nonprim = NULL; + } return NULL; } diff --git a/lib/sbi/openapi/model/subscription_data_subscriptions.h b/lib/sbi/openapi/model/subscription_data_subscriptions.h index ac0118c04..01f2e8c57 100644 --- a/lib/sbi/openapi/model/subscription_data_subscriptions.h +++ b/lib/sbi/openapi/model/subscription_data_subscriptions.h @@ -1,7 +1,7 @@ /* * subscription_data_subscriptions.h * - * + * A subscription to notifications. */ #ifndef _OpenAPI_subscription_data_subscriptions_H_ @@ -12,6 +12,7 @@ #include "../include/list.h" #include "../include/keyValuePair.h" #include "../include/binary.h" +#include "hss_subscription_info.h" #include "sdm_subscription_1.h" #ifdef __cplusplus @@ -26,7 +27,10 @@ typedef struct OpenAPI_subscription_data_subscriptions_s { OpenAPI_list_t *monitored_resource_uris; char *expiry; struct OpenAPI_sdm_subscription_1_s *sdm_subscription; + struct OpenAPI_hss_subscription_info_s *hss_subscription_info; char *subscription_id; + bool is_unique_subscription; + int unique_subscription; char *supported_features; } OpenAPI_subscription_data_subscriptions_t; @@ -37,7 +41,10 @@ OpenAPI_subscription_data_subscriptions_t *OpenAPI_subscription_data_subscriptio OpenAPI_list_t *monitored_resource_uris, char *expiry, OpenAPI_sdm_subscription_1_t *sdm_subscription, + OpenAPI_hss_subscription_info_t *hss_subscription_info, char *subscription_id, + bool is_unique_subscription, + int unique_subscription, char *supported_features ); void OpenAPI_subscription_data_subscriptions_free(OpenAPI_subscription_data_subscriptions_t *subscription_data_subscriptions); diff --git a/lib/sbi/openapi/model/suci_info.c b/lib/sbi/openapi/model/suci_info.c new file mode 100644 index 000000000..61d6e5b9e --- /dev/null +++ b/lib/sbi/openapi/model/suci_info.c @@ -0,0 +1,201 @@ + +#include +#include +#include +#include "suci_info.h" + +OpenAPI_suci_info_t *OpenAPI_suci_info_create( + OpenAPI_list_t *routing_inds, + OpenAPI_list_t *h_nw_pub_key_ids +) +{ + OpenAPI_suci_info_t *suci_info_local_var = ogs_malloc(sizeof(OpenAPI_suci_info_t)); + ogs_assert(suci_info_local_var); + + suci_info_local_var->routing_inds = routing_inds; + suci_info_local_var->h_nw_pub_key_ids = h_nw_pub_key_ids; + + return suci_info_local_var; +} + +void OpenAPI_suci_info_free(OpenAPI_suci_info_t *suci_info) +{ + OpenAPI_lnode_t *node = NULL; + + if (NULL == suci_info) { + return; + } + if (suci_info->routing_inds) { + OpenAPI_list_for_each(suci_info->routing_inds, node) { + ogs_free(node->data); + } + OpenAPI_list_free(suci_info->routing_inds); + suci_info->routing_inds = NULL; + } + if (suci_info->h_nw_pub_key_ids) { + OpenAPI_list_for_each(suci_info->h_nw_pub_key_ids, node) { + ogs_free(node->data); + } + OpenAPI_list_free(suci_info->h_nw_pub_key_ids); + suci_info->h_nw_pub_key_ids = NULL; + } + ogs_free(suci_info); +} + +cJSON *OpenAPI_suci_info_convertToJSON(OpenAPI_suci_info_t *suci_info) +{ + cJSON *item = NULL; + OpenAPI_lnode_t *node = NULL; + + if (suci_info == NULL) { + ogs_error("OpenAPI_suci_info_convertToJSON() failed [SuciInfo]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (suci_info->routing_inds) { + cJSON *routing_indsList = cJSON_AddArrayToObject(item, "routingInds"); + if (routing_indsList == NULL) { + ogs_error("OpenAPI_suci_info_convertToJSON() failed [routing_inds]"); + goto end; + } + OpenAPI_list_for_each(suci_info->routing_inds, node) { + if (cJSON_AddStringToObject(routing_indsList, "", (char*)node->data) == NULL) { + ogs_error("OpenAPI_suci_info_convertToJSON() failed [routing_inds]"); + goto end; + } + } + } + + if (suci_info->h_nw_pub_key_ids) { + cJSON *h_nw_pub_key_idsList = cJSON_AddArrayToObject(item, "hNwPubKeyIds"); + if (h_nw_pub_key_idsList == NULL) { + ogs_error("OpenAPI_suci_info_convertToJSON() failed [h_nw_pub_key_ids]"); + goto end; + } + OpenAPI_list_for_each(suci_info->h_nw_pub_key_ids, node) { + if (cJSON_AddNumberToObject(h_nw_pub_key_idsList, "", (uintptr_t)node->data) == NULL) { + ogs_error("OpenAPI_suci_info_convertToJSON() failed [h_nw_pub_key_ids]"); + goto end; + } + } + } + +end: + return item; +} + +OpenAPI_suci_info_t *OpenAPI_suci_info_parseFromJSON(cJSON *suci_infoJSON) +{ + OpenAPI_suci_info_t *suci_info_local_var = NULL; + OpenAPI_lnode_t *node = NULL; + cJSON *routing_inds = NULL; + OpenAPI_list_t *routing_indsList = NULL; + cJSON *h_nw_pub_key_ids = NULL; + OpenAPI_list_t *h_nw_pub_key_idsList = NULL; + routing_inds = cJSON_GetObjectItemCaseSensitive(suci_infoJSON, "routingInds"); + if (routing_inds) { + cJSON *routing_inds_local = NULL; + if (!cJSON_IsArray(routing_inds)) { + ogs_error("OpenAPI_suci_info_parseFromJSON() failed [routing_inds]"); + goto end; + } + + routing_indsList = OpenAPI_list_create(); + + cJSON_ArrayForEach(routing_inds_local, routing_inds) { + double *localDouble = NULL; + int *localInt = NULL; + if (!cJSON_IsString(routing_inds_local)) { + ogs_error("OpenAPI_suci_info_parseFromJSON() failed [routing_inds]"); + goto end; + } + OpenAPI_list_add(routing_indsList, ogs_strdup(routing_inds_local->valuestring)); + } + } + + h_nw_pub_key_ids = cJSON_GetObjectItemCaseSensitive(suci_infoJSON, "hNwPubKeyIds"); + if (h_nw_pub_key_ids) { + cJSON *h_nw_pub_key_ids_local = NULL; + if (!cJSON_IsArray(h_nw_pub_key_ids)) { + ogs_error("OpenAPI_suci_info_parseFromJSON() failed [h_nw_pub_key_ids]"); + goto end; + } + + h_nw_pub_key_idsList = OpenAPI_list_create(); + + cJSON_ArrayForEach(h_nw_pub_key_ids_local, h_nw_pub_key_ids) { + double *localDouble = NULL; + int *localInt = NULL; + if (!cJSON_IsNumber(h_nw_pub_key_ids_local)) { + ogs_error("OpenAPI_suci_info_parseFromJSON() failed [h_nw_pub_key_ids]"); + goto end; + } + localDouble = (double *)ogs_calloc(1, sizeof(double)); + if (!localDouble) { + ogs_error("OpenAPI_suci_info_parseFromJSON() failed [h_nw_pub_key_ids]"); + goto end; + } + *localDouble = h_nw_pub_key_ids_local->valuedouble; + OpenAPI_list_add(h_nw_pub_key_idsList, localDouble); + } + } + + suci_info_local_var = OpenAPI_suci_info_create ( + routing_inds ? routing_indsList : NULL, + h_nw_pub_key_ids ? h_nw_pub_key_idsList : NULL + ); + + return suci_info_local_var; +end: + if (routing_indsList) { + OpenAPI_list_for_each(routing_indsList, node) { + ogs_free(node->data); + } + OpenAPI_list_free(routing_indsList); + routing_indsList = NULL; + } + if (h_nw_pub_key_idsList) { + OpenAPI_list_for_each(h_nw_pub_key_idsList, node) { + ogs_free(node->data); + } + OpenAPI_list_free(h_nw_pub_key_idsList); + h_nw_pub_key_idsList = NULL; + } + return NULL; +} + +OpenAPI_suci_info_t *OpenAPI_suci_info_copy(OpenAPI_suci_info_t *dst, OpenAPI_suci_info_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_suci_info_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_suci_info_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_suci_info_free(dst); + dst = OpenAPI_suci_info_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/suci_info.h b/lib/sbi/openapi/model/suci_info.h new file mode 100644 index 000000000..87107e48f --- /dev/null +++ b/lib/sbi/openapi/model/suci_info.h @@ -0,0 +1,40 @@ +/* + * suci_info.h + * + * SUCI information containing Routing Indicator and Home Network Public Key ID + */ + +#ifndef _OpenAPI_suci_info_H_ +#define _OpenAPI_suci_info_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_suci_info_s OpenAPI_suci_info_t; +typedef struct OpenAPI_suci_info_s { + OpenAPI_list_t *routing_inds; + OpenAPI_list_t *h_nw_pub_key_ids; +} OpenAPI_suci_info_t; + +OpenAPI_suci_info_t *OpenAPI_suci_info_create( + OpenAPI_list_t *routing_inds, + OpenAPI_list_t *h_nw_pub_key_ids +); +void OpenAPI_suci_info_free(OpenAPI_suci_info_t *suci_info); +OpenAPI_suci_info_t *OpenAPI_suci_info_parseFromJSON(cJSON *suci_infoJSON); +cJSON *OpenAPI_suci_info_convertToJSON(OpenAPI_suci_info_t *suci_info); +OpenAPI_suci_info_t *OpenAPI_suci_info_copy(OpenAPI_suci_info_t *dst, OpenAPI_suci_info_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_suci_info_H_ */ + diff --git a/lib/sbi/openapi/model/supi_info.c b/lib/sbi/openapi/model/supi_info.c new file mode 100644 index 000000000..0d0abece4 --- /dev/null +++ b/lib/sbi/openapi/model/supi_info.c @@ -0,0 +1,145 @@ + +#include +#include +#include +#include "supi_info.h" + +OpenAPI_supi_info_t *OpenAPI_supi_info_create( + OpenAPI_list_t *supi_list +) +{ + OpenAPI_supi_info_t *supi_info_local_var = ogs_malloc(sizeof(OpenAPI_supi_info_t)); + ogs_assert(supi_info_local_var); + + supi_info_local_var->supi_list = supi_list; + + return supi_info_local_var; +} + +void OpenAPI_supi_info_free(OpenAPI_supi_info_t *supi_info) +{ + OpenAPI_lnode_t *node = NULL; + + if (NULL == supi_info) { + return; + } + if (supi_info->supi_list) { + OpenAPI_list_for_each(supi_info->supi_list, node) { + ogs_free(node->data); + } + OpenAPI_list_free(supi_info->supi_list); + supi_info->supi_list = NULL; + } + ogs_free(supi_info); +} + +cJSON *OpenAPI_supi_info_convertToJSON(OpenAPI_supi_info_t *supi_info) +{ + cJSON *item = NULL; + OpenAPI_lnode_t *node = NULL; + + if (supi_info == NULL) { + ogs_error("OpenAPI_supi_info_convertToJSON() failed [SupiInfo]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (!supi_info->supi_list) { + ogs_error("OpenAPI_supi_info_convertToJSON() failed [supi_list]"); + return NULL; + } + cJSON *supi_listList = cJSON_AddArrayToObject(item, "supiList"); + if (supi_listList == NULL) { + ogs_error("OpenAPI_supi_info_convertToJSON() failed [supi_list]"); + goto end; + } + OpenAPI_list_for_each(supi_info->supi_list, node) { + if (cJSON_AddStringToObject(supi_listList, "", (char*)node->data) == NULL) { + ogs_error("OpenAPI_supi_info_convertToJSON() failed [supi_list]"); + goto end; + } + } + +end: + return item; +} + +OpenAPI_supi_info_t *OpenAPI_supi_info_parseFromJSON(cJSON *supi_infoJSON) +{ + OpenAPI_supi_info_t *supi_info_local_var = NULL; + OpenAPI_lnode_t *node = NULL; + cJSON *supi_list = NULL; + OpenAPI_list_t *supi_listList = NULL; + supi_list = cJSON_GetObjectItemCaseSensitive(supi_infoJSON, "supiList"); + if (!supi_list) { + ogs_error("OpenAPI_supi_info_parseFromJSON() failed [supi_list]"); + goto end; + } + cJSON *supi_list_local = NULL; + if (!cJSON_IsArray(supi_list)) { + ogs_error("OpenAPI_supi_info_parseFromJSON() failed [supi_list]"); + goto end; + } + + supi_listList = OpenAPI_list_create(); + + cJSON_ArrayForEach(supi_list_local, supi_list) { + double *localDouble = NULL; + int *localInt = NULL; + if (!cJSON_IsString(supi_list_local)) { + ogs_error("OpenAPI_supi_info_parseFromJSON() failed [supi_list]"); + goto end; + } + OpenAPI_list_add(supi_listList, ogs_strdup(supi_list_local->valuestring)); + } + + supi_info_local_var = OpenAPI_supi_info_create ( + supi_listList + ); + + return supi_info_local_var; +end: + if (supi_listList) { + OpenAPI_list_for_each(supi_listList, node) { + ogs_free(node->data); + } + OpenAPI_list_free(supi_listList); + supi_listList = NULL; + } + return NULL; +} + +OpenAPI_supi_info_t *OpenAPI_supi_info_copy(OpenAPI_supi_info_t *dst, OpenAPI_supi_info_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_supi_info_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_supi_info_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_supi_info_free(dst); + dst = OpenAPI_supi_info_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/supi_info.h b/lib/sbi/openapi/model/supi_info.h new file mode 100644 index 000000000..b50c34673 --- /dev/null +++ b/lib/sbi/openapi/model/supi_info.h @@ -0,0 +1,38 @@ +/* + * supi_info.h + * + * List of Supis. + */ + +#ifndef _OpenAPI_supi_info_H_ +#define _OpenAPI_supi_info_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_supi_info_s OpenAPI_supi_info_t; +typedef struct OpenAPI_supi_info_s { + OpenAPI_list_t *supi_list; +} OpenAPI_supi_info_t; + +OpenAPI_supi_info_t *OpenAPI_supi_info_create( + OpenAPI_list_t *supi_list +); +void OpenAPI_supi_info_free(OpenAPI_supi_info_t *supi_info); +OpenAPI_supi_info_t *OpenAPI_supi_info_parseFromJSON(cJSON *supi_infoJSON); +cJSON *OpenAPI_supi_info_convertToJSON(OpenAPI_supi_info_t *supi_info); +OpenAPI_supi_info_t *OpenAPI_supi_info_copy(OpenAPI_supi_info_t *dst, OpenAPI_supi_info_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_supi_info_H_ */ + diff --git a/lib/sbi/openapi/model/supi_range.h b/lib/sbi/openapi/model/supi_range.h index dc9c7144d..d0c9b94ce 100644 --- a/lib/sbi/openapi/model/supi_range.h +++ b/lib/sbi/openapi/model/supi_range.h @@ -1,7 +1,7 @@ /* * supi_range.h * - * A range of SUPIs (subscriber identities), either based on a numeric range, or based on regular-expression matching + * A range of SUPIs (subscriber identities), either based on a numeric range, or based on regular-expression matching */ #ifndef _OpenAPI_supi_range_H_ diff --git a/lib/sbi/openapi/model/supported_gad_shapes.h b/lib/sbi/openapi/model/supported_gad_shapes.h index fe439dae4..7f239eb4e 100644 --- a/lib/sbi/openapi/model/supported_gad_shapes.h +++ b/lib/sbi/openapi/model/supported_gad_shapes.h @@ -1,7 +1,7 @@ /* * supported_gad_shapes.h * - * + * Indicates supported GAD shapes. */ #ifndef _OpenAPI_supported_gad_shapes_H_ diff --git a/lib/sbi/openapi/model/supported_gad_shapes_any_of.c b/lib/sbi/openapi/model/supported_gad_shapes_any_of.c index b1d5a9909..b27560ea0 100644 --- a/lib/sbi/openapi/model/supported_gad_shapes_any_of.c +++ b/lib/sbi/openapi/model/supported_gad_shapes_any_of.c @@ -6,7 +6,7 @@ char* OpenAPI_supported_gad_shapes_any_of_ToString(OpenAPI_supported_gad_shapes_any_of_e supported_gad_shapes_any_of) { - const char *supported_gad_shapes_any_ofArray[] = { "NULL", "POINT", "POINT_UNCERTAINTY_CIRCLE", "POINT_UNCERTAINTY_ELLIPSE", "POLYGON", "POINT_ALTITUDE", "POINT_ALTITUDE_UNCERTAINTY", "ELLIPSOID_ARC" }; + const char *supported_gad_shapes_any_ofArray[] = { "NULL", "POINT", "POINT_UNCERTAINTY_CIRCLE", "POINT_UNCERTAINTY_ELLIPSE", "POLYGON", "POINT_ALTITUDE", "POINT_ALTITUDE_UNCERTAINTY", "ELLIPSOID_ARC", "LOCAL_2D_POINT_UNCERTAINTY_ELLIPSE", "LOCAL_3D_POINT_UNCERTAINTY_ELLIPSOID" }; size_t sizeofArray = sizeof(supported_gad_shapes_any_ofArray) / sizeof(supported_gad_shapes_any_ofArray[0]); if (supported_gad_shapes_any_of < sizeofArray) return (char *)supported_gad_shapes_any_ofArray[supported_gad_shapes_any_of]; @@ -17,7 +17,7 @@ char* OpenAPI_supported_gad_shapes_any_of_ToString(OpenAPI_supported_gad_shapes_ OpenAPI_supported_gad_shapes_any_of_e OpenAPI_supported_gad_shapes_any_of_FromString(char* supported_gad_shapes_any_of) { int stringToReturn = 0; - const char *supported_gad_shapes_any_ofArray[] = { "NULL", "POINT", "POINT_UNCERTAINTY_CIRCLE", "POINT_UNCERTAINTY_ELLIPSE", "POLYGON", "POINT_ALTITUDE", "POINT_ALTITUDE_UNCERTAINTY", "ELLIPSOID_ARC" }; + const char *supported_gad_shapes_any_ofArray[] = { "NULL", "POINT", "POINT_UNCERTAINTY_CIRCLE", "POINT_UNCERTAINTY_ELLIPSE", "POLYGON", "POINT_ALTITUDE", "POINT_ALTITUDE_UNCERTAINTY", "ELLIPSOID_ARC", "LOCAL_2D_POINT_UNCERTAINTY_ELLIPSE", "LOCAL_3D_POINT_UNCERTAINTY_ELLIPSOID" }; size_t sizeofArray = sizeof(supported_gad_shapes_any_ofArray) / sizeof(supported_gad_shapes_any_ofArray[0]); while (stringToReturn < sizeofArray) { if (strcmp(supported_gad_shapes_any_of, supported_gad_shapes_any_ofArray[stringToReturn]) == 0) { diff --git a/lib/sbi/openapi/model/supported_gad_shapes_any_of.h b/lib/sbi/openapi/model/supported_gad_shapes_any_of.h index e60984b71..7850255cc 100644 --- a/lib/sbi/openapi/model/supported_gad_shapes_any_of.h +++ b/lib/sbi/openapi/model/supported_gad_shapes_any_of.h @@ -17,7 +17,7 @@ extern "C" { #endif -typedef enum { OpenAPI_supported_gad_shapes_any_of_NULL = 0, OpenAPI_supported_gad_shapes_any_of_POINT, OpenAPI_supported_gad_shapes_any_of_POINT_UNCERTAINTY_CIRCLE, OpenAPI_supported_gad_shapes_any_of_POINT_UNCERTAINTY_ELLIPSE, OpenAPI_supported_gad_shapes_any_of_POLYGON, OpenAPI_supported_gad_shapes_any_of_POINT_ALTITUDE, OpenAPI_supported_gad_shapes_any_of_POINT_ALTITUDE_UNCERTAINTY, OpenAPI_supported_gad_shapes_any_of_ELLIPSOID_ARC } OpenAPI_supported_gad_shapes_any_of_e; +typedef enum { OpenAPI_supported_gad_shapes_any_of_NULL = 0, OpenAPI_supported_gad_shapes_any_of_POINT, OpenAPI_supported_gad_shapes_any_of_POINT_UNCERTAINTY_CIRCLE, OpenAPI_supported_gad_shapes_any_of_POINT_UNCERTAINTY_ELLIPSE, OpenAPI_supported_gad_shapes_any_of_POLYGON, OpenAPI_supported_gad_shapes_any_of_POINT_ALTITUDE, OpenAPI_supported_gad_shapes_any_of_POINT_ALTITUDE_UNCERTAINTY, OpenAPI_supported_gad_shapes_any_of_ELLIPSOID_ARC, OpenAPI_supported_gad_shapes_any_of_LOCAL_2D_POINT_UNCERTAINTY_ELLIPSE, OpenAPI_supported_gad_shapes_any_of_LOCAL_3D_POINT_UNCERTAINTY_ELLIPSOID } OpenAPI_supported_gad_shapes_any_of_e; char* OpenAPI_supported_gad_shapes_any_of_ToString(OpenAPI_supported_gad_shapes_any_of_e supported_gad_shapes_any_of); diff --git a/lib/sbi/openapi/model/svc_experience.c b/lib/sbi/openapi/model/svc_experience.c new file mode 100644 index 000000000..98d29cd0d --- /dev/null +++ b/lib/sbi/openapi/model/svc_experience.c @@ -0,0 +1,153 @@ + +#include +#include +#include +#include "svc_experience.h" + +OpenAPI_svc_experience_t *OpenAPI_svc_experience_create( + bool is_mos, + float mos, + bool is_upper_range, + float upper_range, + bool is_lower_range, + float lower_range +) +{ + OpenAPI_svc_experience_t *svc_experience_local_var = ogs_malloc(sizeof(OpenAPI_svc_experience_t)); + ogs_assert(svc_experience_local_var); + + svc_experience_local_var->is_mos = is_mos; + svc_experience_local_var->mos = mos; + svc_experience_local_var->is_upper_range = is_upper_range; + svc_experience_local_var->upper_range = upper_range; + svc_experience_local_var->is_lower_range = is_lower_range; + svc_experience_local_var->lower_range = lower_range; + + return svc_experience_local_var; +} + +void OpenAPI_svc_experience_free(OpenAPI_svc_experience_t *svc_experience) +{ + OpenAPI_lnode_t *node = NULL; + + if (NULL == svc_experience) { + return; + } + ogs_free(svc_experience); +} + +cJSON *OpenAPI_svc_experience_convertToJSON(OpenAPI_svc_experience_t *svc_experience) +{ + cJSON *item = NULL; + OpenAPI_lnode_t *node = NULL; + + if (svc_experience == NULL) { + ogs_error("OpenAPI_svc_experience_convertToJSON() failed [SvcExperience]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (svc_experience->is_mos) { + if (cJSON_AddNumberToObject(item, "mos", svc_experience->mos) == NULL) { + ogs_error("OpenAPI_svc_experience_convertToJSON() failed [mos]"); + goto end; + } + } + + if (svc_experience->is_upper_range) { + if (cJSON_AddNumberToObject(item, "upperRange", svc_experience->upper_range) == NULL) { + ogs_error("OpenAPI_svc_experience_convertToJSON() failed [upper_range]"); + goto end; + } + } + + if (svc_experience->is_lower_range) { + if (cJSON_AddNumberToObject(item, "lowerRange", svc_experience->lower_range) == NULL) { + ogs_error("OpenAPI_svc_experience_convertToJSON() failed [lower_range]"); + goto end; + } + } + +end: + return item; +} + +OpenAPI_svc_experience_t *OpenAPI_svc_experience_parseFromJSON(cJSON *svc_experienceJSON) +{ + OpenAPI_svc_experience_t *svc_experience_local_var = NULL; + OpenAPI_lnode_t *node = NULL; + cJSON *mos = NULL; + cJSON *upper_range = NULL; + cJSON *lower_range = NULL; + mos = cJSON_GetObjectItemCaseSensitive(svc_experienceJSON, "mos"); + if (mos) { + if (!cJSON_IsNumber(mos)) { + ogs_error("OpenAPI_svc_experience_parseFromJSON() failed [mos]"); + goto end; + } + } + + upper_range = cJSON_GetObjectItemCaseSensitive(svc_experienceJSON, "upperRange"); + if (upper_range) { + if (!cJSON_IsNumber(upper_range)) { + ogs_error("OpenAPI_svc_experience_parseFromJSON() failed [upper_range]"); + goto end; + } + } + + lower_range = cJSON_GetObjectItemCaseSensitive(svc_experienceJSON, "lowerRange"); + if (lower_range) { + if (!cJSON_IsNumber(lower_range)) { + ogs_error("OpenAPI_svc_experience_parseFromJSON() failed [lower_range]"); + goto end; + } + } + + svc_experience_local_var = OpenAPI_svc_experience_create ( + mos ? true : false, + mos ? mos->valuedouble : 0, + upper_range ? true : false, + upper_range ? upper_range->valuedouble : 0, + lower_range ? true : false, + lower_range ? lower_range->valuedouble : 0 + ); + + return svc_experience_local_var; +end: + return NULL; +} + +OpenAPI_svc_experience_t *OpenAPI_svc_experience_copy(OpenAPI_svc_experience_t *dst, OpenAPI_svc_experience_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_svc_experience_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_svc_experience_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_svc_experience_free(dst); + dst = OpenAPI_svc_experience_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/svc_experience.h b/lib/sbi/openapi/model/svc_experience.h new file mode 100644 index 000000000..1baf31ec5 --- /dev/null +++ b/lib/sbi/openapi/model/svc_experience.h @@ -0,0 +1,48 @@ +/* + * svc_experience.h + * + * Contains a mean opinion score with the customized range. + */ + +#ifndef _OpenAPI_svc_experience_H_ +#define _OpenAPI_svc_experience_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_svc_experience_s OpenAPI_svc_experience_t; +typedef struct OpenAPI_svc_experience_s { + bool is_mos; + float mos; + bool is_upper_range; + float upper_range; + bool is_lower_range; + float lower_range; +} OpenAPI_svc_experience_t; + +OpenAPI_svc_experience_t *OpenAPI_svc_experience_create( + bool is_mos, + float mos, + bool is_upper_range, + float upper_range, + bool is_lower_range, + float lower_range +); +void OpenAPI_svc_experience_free(OpenAPI_svc_experience_t *svc_experience); +OpenAPI_svc_experience_t *OpenAPI_svc_experience_parseFromJSON(cJSON *svc_experienceJSON); +cJSON *OpenAPI_svc_experience_convertToJSON(OpenAPI_svc_experience_t *svc_experience); +OpenAPI_svc_experience_t *OpenAPI_svc_experience_copy(OpenAPI_svc_experience_t *dst, OpenAPI_svc_experience_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_svc_experience_H_ */ + diff --git a/lib/sbi/openapi/model/tac_info.h b/lib/sbi/openapi/model/tac_info.h index 95905b3ac..0b202485c 100644 --- a/lib/sbi/openapi/model/tac_info.h +++ b/lib/sbi/openapi/model/tac_info.h @@ -1,7 +1,7 @@ /* * tac_info.h * - * + * contains tracking area information (tracking area codes). */ #ifndef _OpenAPI_tac_info_H_ diff --git a/lib/sbi/openapi/model/tai.h b/lib/sbi/openapi/model/tai.h index 689aa6d66..0f97f11f6 100644 --- a/lib/sbi/openapi/model/tai.h +++ b/lib/sbi/openapi/model/tai.h @@ -1,7 +1,7 @@ /* * tai.h * - * + * Contains the tracking area identity as described in 3GPP 23.003 */ #ifndef _OpenAPI_tai_H_ diff --git a/lib/sbi/openapi/model/tai_1.h b/lib/sbi/openapi/model/tai_1.h index 340ea5168..a446f0416 100644 --- a/lib/sbi/openapi/model/tai_1.h +++ b/lib/sbi/openapi/model/tai_1.h @@ -1,7 +1,7 @@ /* * tai_1.h * - * + * Contains the tracking area identity as described in 3GPP 23.003 */ #ifndef _OpenAPI_tai_1_H_ diff --git a/lib/sbi/openapi/model/target_area.c b/lib/sbi/openapi/model/target_area.c new file mode 100644 index 000000000..3780f2dbd --- /dev/null +++ b/lib/sbi/openapi/model/target_area.c @@ -0,0 +1,229 @@ + +#include +#include +#include +#include "target_area.h" + +OpenAPI_target_area_t *OpenAPI_target_area_create( + OpenAPI_list_t *ta_list, + OpenAPI_list_t *tai_range_list, + bool is_any_ta, + int any_ta +) +{ + OpenAPI_target_area_t *target_area_local_var = ogs_malloc(sizeof(OpenAPI_target_area_t)); + ogs_assert(target_area_local_var); + + target_area_local_var->ta_list = ta_list; + target_area_local_var->tai_range_list = tai_range_list; + target_area_local_var->is_any_ta = is_any_ta; + target_area_local_var->any_ta = any_ta; + + return target_area_local_var; +} + +void OpenAPI_target_area_free(OpenAPI_target_area_t *target_area) +{ + OpenAPI_lnode_t *node = NULL; + + if (NULL == target_area) { + return; + } + if (target_area->ta_list) { + OpenAPI_list_for_each(target_area->ta_list, node) { + OpenAPI_tai_free(node->data); + } + OpenAPI_list_free(target_area->ta_list); + target_area->ta_list = NULL; + } + if (target_area->tai_range_list) { + OpenAPI_list_for_each(target_area->tai_range_list, node) { + OpenAPI_tai_range_free(node->data); + } + OpenAPI_list_free(target_area->tai_range_list); + target_area->tai_range_list = NULL; + } + ogs_free(target_area); +} + +cJSON *OpenAPI_target_area_convertToJSON(OpenAPI_target_area_t *target_area) +{ + cJSON *item = NULL; + OpenAPI_lnode_t *node = NULL; + + if (target_area == NULL) { + ogs_error("OpenAPI_target_area_convertToJSON() failed [TargetArea]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (target_area->ta_list) { + cJSON *ta_listList = cJSON_AddArrayToObject(item, "taList"); + if (ta_listList == NULL) { + ogs_error("OpenAPI_target_area_convertToJSON() failed [ta_list]"); + goto end; + } + OpenAPI_list_for_each(target_area->ta_list, node) { + cJSON *itemLocal = OpenAPI_tai_convertToJSON(node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_target_area_convertToJSON() failed [ta_list]"); + goto end; + } + cJSON_AddItemToArray(ta_listList, itemLocal); + } + } + + if (target_area->tai_range_list) { + cJSON *tai_range_listList = cJSON_AddArrayToObject(item, "taiRangeList"); + if (tai_range_listList == NULL) { + ogs_error("OpenAPI_target_area_convertToJSON() failed [tai_range_list]"); + goto end; + } + OpenAPI_list_for_each(target_area->tai_range_list, node) { + cJSON *itemLocal = OpenAPI_tai_range_convertToJSON(node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_target_area_convertToJSON() failed [tai_range_list]"); + goto end; + } + cJSON_AddItemToArray(tai_range_listList, itemLocal); + } + } + + if (target_area->is_any_ta) { + if (cJSON_AddBoolToObject(item, "anyTa", target_area->any_ta) == NULL) { + ogs_error("OpenAPI_target_area_convertToJSON() failed [any_ta]"); + goto end; + } + } + +end: + return item; +} + +OpenAPI_target_area_t *OpenAPI_target_area_parseFromJSON(cJSON *target_areaJSON) +{ + OpenAPI_target_area_t *target_area_local_var = NULL; + OpenAPI_lnode_t *node = NULL; + cJSON *ta_list = NULL; + OpenAPI_list_t *ta_listList = NULL; + cJSON *tai_range_list = NULL; + OpenAPI_list_t *tai_range_listList = NULL; + cJSON *any_ta = NULL; + ta_list = cJSON_GetObjectItemCaseSensitive(target_areaJSON, "taList"); + if (ta_list) { + cJSON *ta_list_local = NULL; + if (!cJSON_IsArray(ta_list)) { + ogs_error("OpenAPI_target_area_parseFromJSON() failed [ta_list]"); + goto end; + } + + ta_listList = OpenAPI_list_create(); + + cJSON_ArrayForEach(ta_list_local, ta_list) { + if (!cJSON_IsObject(ta_list_local)) { + ogs_error("OpenAPI_target_area_parseFromJSON() failed [ta_list]"); + goto end; + } + OpenAPI_tai_t *ta_listItem = OpenAPI_tai_parseFromJSON(ta_list_local); + if (!ta_listItem) { + ogs_error("No ta_listItem"); + OpenAPI_list_free(ta_listList); + goto end; + } + OpenAPI_list_add(ta_listList, ta_listItem); + } + } + + tai_range_list = cJSON_GetObjectItemCaseSensitive(target_areaJSON, "taiRangeList"); + if (tai_range_list) { + cJSON *tai_range_list_local = NULL; + if (!cJSON_IsArray(tai_range_list)) { + ogs_error("OpenAPI_target_area_parseFromJSON() failed [tai_range_list]"); + goto end; + } + + tai_range_listList = OpenAPI_list_create(); + + cJSON_ArrayForEach(tai_range_list_local, tai_range_list) { + if (!cJSON_IsObject(tai_range_list_local)) { + ogs_error("OpenAPI_target_area_parseFromJSON() failed [tai_range_list]"); + goto end; + } + OpenAPI_tai_range_t *tai_range_listItem = OpenAPI_tai_range_parseFromJSON(tai_range_list_local); + if (!tai_range_listItem) { + ogs_error("No tai_range_listItem"); + OpenAPI_list_free(tai_range_listList); + goto end; + } + OpenAPI_list_add(tai_range_listList, tai_range_listItem); + } + } + + any_ta = cJSON_GetObjectItemCaseSensitive(target_areaJSON, "anyTa"); + if (any_ta) { + if (!cJSON_IsBool(any_ta)) { + ogs_error("OpenAPI_target_area_parseFromJSON() failed [any_ta]"); + goto end; + } + } + + target_area_local_var = OpenAPI_target_area_create ( + ta_list ? ta_listList : NULL, + tai_range_list ? tai_range_listList : NULL, + any_ta ? true : false, + any_ta ? any_ta->valueint : 0 + ); + + return target_area_local_var; +end: + if (ta_listList) { + OpenAPI_list_for_each(ta_listList, node) { + OpenAPI_tai_free(node->data); + } + OpenAPI_list_free(ta_listList); + ta_listList = NULL; + } + if (tai_range_listList) { + OpenAPI_list_for_each(tai_range_listList, node) { + OpenAPI_tai_range_free(node->data); + } + OpenAPI_list_free(tai_range_listList); + tai_range_listList = NULL; + } + return NULL; +} + +OpenAPI_target_area_t *OpenAPI_target_area_copy(OpenAPI_target_area_t *dst, OpenAPI_target_area_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_target_area_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_target_area_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_target_area_free(dst); + dst = OpenAPI_target_area_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/target_area.h b/lib/sbi/openapi/model/target_area.h new file mode 100644 index 000000000..5b6be2986 --- /dev/null +++ b/lib/sbi/openapi/model/target_area.h @@ -0,0 +1,46 @@ +/* + * target_area.h + * + * TA list or TAI range list or any TA + */ + +#ifndef _OpenAPI_target_area_H_ +#define _OpenAPI_target_area_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "tai.h" +#include "tai_range.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_target_area_s OpenAPI_target_area_t; +typedef struct OpenAPI_target_area_s { + OpenAPI_list_t *ta_list; + OpenAPI_list_t *tai_range_list; + bool is_any_ta; + int any_ta; +} OpenAPI_target_area_t; + +OpenAPI_target_area_t *OpenAPI_target_area_create( + OpenAPI_list_t *ta_list, + OpenAPI_list_t *tai_range_list, + bool is_any_ta, + int any_ta +); +void OpenAPI_target_area_free(OpenAPI_target_area_t *target_area); +OpenAPI_target_area_t *OpenAPI_target_area_parseFromJSON(cJSON *target_areaJSON); +cJSON *OpenAPI_target_area_convertToJSON(OpenAPI_target_area_t *target_area); +OpenAPI_target_area_t *OpenAPI_target_area_copy(OpenAPI_target_area_t *dst, OpenAPI_target_area_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_target_area_H_ */ + diff --git a/lib/sbi/openapi/model/target_dnai_info.c b/lib/sbi/openapi/model/target_dnai_info.c new file mode 100644 index 000000000..e8b8526e9 --- /dev/null +++ b/lib/sbi/openapi/model/target_dnai_info.c @@ -0,0 +1,135 @@ + +#include +#include +#include +#include "target_dnai_info.h" + +OpenAPI_target_dnai_info_t *OpenAPI_target_dnai_info_create( + char *target_dnai, + OpenAPI_smf_selection_type_e smf_selection_type +) +{ + OpenAPI_target_dnai_info_t *target_dnai_info_local_var = ogs_malloc(sizeof(OpenAPI_target_dnai_info_t)); + ogs_assert(target_dnai_info_local_var); + + target_dnai_info_local_var->target_dnai = target_dnai; + target_dnai_info_local_var->smf_selection_type = smf_selection_type; + + return target_dnai_info_local_var; +} + +void OpenAPI_target_dnai_info_free(OpenAPI_target_dnai_info_t *target_dnai_info) +{ + OpenAPI_lnode_t *node = NULL; + + if (NULL == target_dnai_info) { + return; + } + if (target_dnai_info->target_dnai) { + ogs_free(target_dnai_info->target_dnai); + target_dnai_info->target_dnai = NULL; + } + ogs_free(target_dnai_info); +} + +cJSON *OpenAPI_target_dnai_info_convertToJSON(OpenAPI_target_dnai_info_t *target_dnai_info) +{ + cJSON *item = NULL; + OpenAPI_lnode_t *node = NULL; + + if (target_dnai_info == NULL) { + ogs_error("OpenAPI_target_dnai_info_convertToJSON() failed [TargetDnaiInfo]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (target_dnai_info->target_dnai) { + if (cJSON_AddStringToObject(item, "targetDnai", target_dnai_info->target_dnai) == NULL) { + ogs_error("OpenAPI_target_dnai_info_convertToJSON() failed [target_dnai]"); + goto end; + } + } + + if (target_dnai_info->smf_selection_type == OpenAPI_smf_selection_type_NULL) { + ogs_error("OpenAPI_target_dnai_info_convertToJSON() failed [smf_selection_type]"); + return NULL; + } + if (cJSON_AddStringToObject(item, "smfSelectionType", OpenAPI_smf_selection_type_ToString(target_dnai_info->smf_selection_type)) == NULL) { + ogs_error("OpenAPI_target_dnai_info_convertToJSON() failed [smf_selection_type]"); + goto end; + } + +end: + return item; +} + +OpenAPI_target_dnai_info_t *OpenAPI_target_dnai_info_parseFromJSON(cJSON *target_dnai_infoJSON) +{ + OpenAPI_target_dnai_info_t *target_dnai_info_local_var = NULL; + OpenAPI_lnode_t *node = NULL; + cJSON *target_dnai = NULL; + cJSON *smf_selection_type = NULL; + OpenAPI_smf_selection_type_e smf_selection_typeVariable = 0; + target_dnai = cJSON_GetObjectItemCaseSensitive(target_dnai_infoJSON, "targetDnai"); + if (target_dnai) { + if (!cJSON_IsString(target_dnai) && !cJSON_IsNull(target_dnai)) { + ogs_error("OpenAPI_target_dnai_info_parseFromJSON() failed [target_dnai]"); + goto end; + } + } + + smf_selection_type = cJSON_GetObjectItemCaseSensitive(target_dnai_infoJSON, "smfSelectionType"); + if (!smf_selection_type) { + ogs_error("OpenAPI_target_dnai_info_parseFromJSON() failed [smf_selection_type]"); + goto end; + } + if (!cJSON_IsString(smf_selection_type)) { + ogs_error("OpenAPI_target_dnai_info_parseFromJSON() failed [smf_selection_type]"); + goto end; + } + smf_selection_typeVariable = OpenAPI_smf_selection_type_FromString(smf_selection_type->valuestring); + + target_dnai_info_local_var = OpenAPI_target_dnai_info_create ( + target_dnai && !cJSON_IsNull(target_dnai) ? ogs_strdup(target_dnai->valuestring) : NULL, + smf_selection_typeVariable + ); + + return target_dnai_info_local_var; +end: + return NULL; +} + +OpenAPI_target_dnai_info_t *OpenAPI_target_dnai_info_copy(OpenAPI_target_dnai_info_t *dst, OpenAPI_target_dnai_info_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_target_dnai_info_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_target_dnai_info_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_target_dnai_info_free(dst); + dst = OpenAPI_target_dnai_info_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/target_dnai_info.h b/lib/sbi/openapi/model/target_dnai_info.h new file mode 100644 index 000000000..ba7db7aa0 --- /dev/null +++ b/lib/sbi/openapi/model/target_dnai_info.h @@ -0,0 +1,41 @@ +/* + * target_dnai_info.h + * + * Target DNAI Information + */ + +#ifndef _OpenAPI_target_dnai_info_H_ +#define _OpenAPI_target_dnai_info_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "smf_selection_type.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_target_dnai_info_s OpenAPI_target_dnai_info_t; +typedef struct OpenAPI_target_dnai_info_s { + char *target_dnai; + OpenAPI_smf_selection_type_e smf_selection_type; +} OpenAPI_target_dnai_info_t; + +OpenAPI_target_dnai_info_t *OpenAPI_target_dnai_info_create( + char *target_dnai, + OpenAPI_smf_selection_type_e smf_selection_type +); +void OpenAPI_target_dnai_info_free(OpenAPI_target_dnai_info_t *target_dnai_info); +OpenAPI_target_dnai_info_t *OpenAPI_target_dnai_info_parseFromJSON(cJSON *target_dnai_infoJSON); +cJSON *OpenAPI_target_dnai_info_convertToJSON(OpenAPI_target_dnai_info_t *target_dnai_info); +OpenAPI_target_dnai_info_t *OpenAPI_target_dnai_info_copy(OpenAPI_target_dnai_info_t *dst, OpenAPI_target_dnai_info_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_target_dnai_info_H_ */ + diff --git a/lib/sbi/openapi/model/target_ue_information.c b/lib/sbi/openapi/model/target_ue_information.c new file mode 100644 index 000000000..b4c9ddfa9 --- /dev/null +++ b/lib/sbi/openapi/model/target_ue_information.c @@ -0,0 +1,271 @@ + +#include +#include +#include +#include "target_ue_information.h" + +OpenAPI_target_ue_information_t *OpenAPI_target_ue_information_create( + bool is_any_ue, + int any_ue, + OpenAPI_list_t *supis, + OpenAPI_list_t *gpsis, + OpenAPI_list_t *int_group_ids +) +{ + OpenAPI_target_ue_information_t *target_ue_information_local_var = ogs_malloc(sizeof(OpenAPI_target_ue_information_t)); + ogs_assert(target_ue_information_local_var); + + target_ue_information_local_var->is_any_ue = is_any_ue; + target_ue_information_local_var->any_ue = any_ue; + target_ue_information_local_var->supis = supis; + target_ue_information_local_var->gpsis = gpsis; + target_ue_information_local_var->int_group_ids = int_group_ids; + + return target_ue_information_local_var; +} + +void OpenAPI_target_ue_information_free(OpenAPI_target_ue_information_t *target_ue_information) +{ + OpenAPI_lnode_t *node = NULL; + + if (NULL == target_ue_information) { + return; + } + if (target_ue_information->supis) { + OpenAPI_list_for_each(target_ue_information->supis, node) { + ogs_free(node->data); + } + OpenAPI_list_free(target_ue_information->supis); + target_ue_information->supis = NULL; + } + if (target_ue_information->gpsis) { + OpenAPI_list_for_each(target_ue_information->gpsis, node) { + ogs_free(node->data); + } + OpenAPI_list_free(target_ue_information->gpsis); + target_ue_information->gpsis = NULL; + } + if (target_ue_information->int_group_ids) { + OpenAPI_list_for_each(target_ue_information->int_group_ids, node) { + ogs_free(node->data); + } + OpenAPI_list_free(target_ue_information->int_group_ids); + target_ue_information->int_group_ids = NULL; + } + ogs_free(target_ue_information); +} + +cJSON *OpenAPI_target_ue_information_convertToJSON(OpenAPI_target_ue_information_t *target_ue_information) +{ + cJSON *item = NULL; + OpenAPI_lnode_t *node = NULL; + + if (target_ue_information == NULL) { + ogs_error("OpenAPI_target_ue_information_convertToJSON() failed [TargetUeInformation]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (target_ue_information->is_any_ue) { + if (cJSON_AddBoolToObject(item, "anyUe", target_ue_information->any_ue) == NULL) { + ogs_error("OpenAPI_target_ue_information_convertToJSON() failed [any_ue]"); + goto end; + } + } + + if (target_ue_information->supis) { + cJSON *supisList = cJSON_AddArrayToObject(item, "supis"); + if (supisList == NULL) { + ogs_error("OpenAPI_target_ue_information_convertToJSON() failed [supis]"); + goto end; + } + OpenAPI_list_for_each(target_ue_information->supis, node) { + if (cJSON_AddStringToObject(supisList, "", (char*)node->data) == NULL) { + ogs_error("OpenAPI_target_ue_information_convertToJSON() failed [supis]"); + goto end; + } + } + } + + if (target_ue_information->gpsis) { + cJSON *gpsisList = cJSON_AddArrayToObject(item, "gpsis"); + if (gpsisList == NULL) { + ogs_error("OpenAPI_target_ue_information_convertToJSON() failed [gpsis]"); + goto end; + } + OpenAPI_list_for_each(target_ue_information->gpsis, node) { + if (cJSON_AddStringToObject(gpsisList, "", (char*)node->data) == NULL) { + ogs_error("OpenAPI_target_ue_information_convertToJSON() failed [gpsis]"); + goto end; + } + } + } + + if (target_ue_information->int_group_ids) { + cJSON *int_group_idsList = cJSON_AddArrayToObject(item, "intGroupIds"); + if (int_group_idsList == NULL) { + ogs_error("OpenAPI_target_ue_information_convertToJSON() failed [int_group_ids]"); + goto end; + } + OpenAPI_list_for_each(target_ue_information->int_group_ids, node) { + if (cJSON_AddStringToObject(int_group_idsList, "", (char*)node->data) == NULL) { + ogs_error("OpenAPI_target_ue_information_convertToJSON() failed [int_group_ids]"); + goto end; + } + } + } + +end: + return item; +} + +OpenAPI_target_ue_information_t *OpenAPI_target_ue_information_parseFromJSON(cJSON *target_ue_informationJSON) +{ + OpenAPI_target_ue_information_t *target_ue_information_local_var = NULL; + OpenAPI_lnode_t *node = NULL; + cJSON *any_ue = NULL; + cJSON *supis = NULL; + OpenAPI_list_t *supisList = NULL; + cJSON *gpsis = NULL; + OpenAPI_list_t *gpsisList = NULL; + cJSON *int_group_ids = NULL; + OpenAPI_list_t *int_group_idsList = NULL; + any_ue = cJSON_GetObjectItemCaseSensitive(target_ue_informationJSON, "anyUe"); + if (any_ue) { + if (!cJSON_IsBool(any_ue)) { + ogs_error("OpenAPI_target_ue_information_parseFromJSON() failed [any_ue]"); + goto end; + } + } + + supis = cJSON_GetObjectItemCaseSensitive(target_ue_informationJSON, "supis"); + if (supis) { + cJSON *supis_local = NULL; + if (!cJSON_IsArray(supis)) { + ogs_error("OpenAPI_target_ue_information_parseFromJSON() failed [supis]"); + goto end; + } + + supisList = OpenAPI_list_create(); + + cJSON_ArrayForEach(supis_local, supis) { + double *localDouble = NULL; + int *localInt = NULL; + if (!cJSON_IsString(supis_local)) { + ogs_error("OpenAPI_target_ue_information_parseFromJSON() failed [supis]"); + goto end; + } + OpenAPI_list_add(supisList, ogs_strdup(supis_local->valuestring)); + } + } + + gpsis = cJSON_GetObjectItemCaseSensitive(target_ue_informationJSON, "gpsis"); + if (gpsis) { + cJSON *gpsis_local = NULL; + if (!cJSON_IsArray(gpsis)) { + ogs_error("OpenAPI_target_ue_information_parseFromJSON() failed [gpsis]"); + goto end; + } + + gpsisList = OpenAPI_list_create(); + + cJSON_ArrayForEach(gpsis_local, gpsis) { + double *localDouble = NULL; + int *localInt = NULL; + if (!cJSON_IsString(gpsis_local)) { + ogs_error("OpenAPI_target_ue_information_parseFromJSON() failed [gpsis]"); + goto end; + } + OpenAPI_list_add(gpsisList, ogs_strdup(gpsis_local->valuestring)); + } + } + + int_group_ids = cJSON_GetObjectItemCaseSensitive(target_ue_informationJSON, "intGroupIds"); + if (int_group_ids) { + cJSON *int_group_ids_local = NULL; + if (!cJSON_IsArray(int_group_ids)) { + ogs_error("OpenAPI_target_ue_information_parseFromJSON() failed [int_group_ids]"); + goto end; + } + + int_group_idsList = OpenAPI_list_create(); + + cJSON_ArrayForEach(int_group_ids_local, int_group_ids) { + double *localDouble = NULL; + int *localInt = NULL; + if (!cJSON_IsString(int_group_ids_local)) { + ogs_error("OpenAPI_target_ue_information_parseFromJSON() failed [int_group_ids]"); + goto end; + } + OpenAPI_list_add(int_group_idsList, ogs_strdup(int_group_ids_local->valuestring)); + } + } + + target_ue_information_local_var = OpenAPI_target_ue_information_create ( + any_ue ? true : false, + any_ue ? any_ue->valueint : 0, + supis ? supisList : NULL, + gpsis ? gpsisList : NULL, + int_group_ids ? int_group_idsList : NULL + ); + + return target_ue_information_local_var; +end: + if (supisList) { + OpenAPI_list_for_each(supisList, node) { + ogs_free(node->data); + } + OpenAPI_list_free(supisList); + supisList = NULL; + } + if (gpsisList) { + OpenAPI_list_for_each(gpsisList, node) { + ogs_free(node->data); + } + OpenAPI_list_free(gpsisList); + gpsisList = NULL; + } + if (int_group_idsList) { + OpenAPI_list_for_each(int_group_idsList, node) { + ogs_free(node->data); + } + OpenAPI_list_free(int_group_idsList); + int_group_idsList = NULL; + } + return NULL; +} + +OpenAPI_target_ue_information_t *OpenAPI_target_ue_information_copy(OpenAPI_target_ue_information_t *dst, OpenAPI_target_ue_information_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_target_ue_information_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_target_ue_information_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_target_ue_information_free(dst); + dst = OpenAPI_target_ue_information_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/target_ue_information.h b/lib/sbi/openapi/model/target_ue_information.h new file mode 100644 index 000000000..8d587da10 --- /dev/null +++ b/lib/sbi/openapi/model/target_ue_information.h @@ -0,0 +1,46 @@ +/* + * target_ue_information.h + * + * Identifies the target UE information. + */ + +#ifndef _OpenAPI_target_ue_information_H_ +#define _OpenAPI_target_ue_information_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_target_ue_information_s OpenAPI_target_ue_information_t; +typedef struct OpenAPI_target_ue_information_s { + bool is_any_ue; + int any_ue; + OpenAPI_list_t *supis; + OpenAPI_list_t *gpsis; + OpenAPI_list_t *int_group_ids; +} OpenAPI_target_ue_information_t; + +OpenAPI_target_ue_information_t *OpenAPI_target_ue_information_create( + bool is_any_ue, + int any_ue, + OpenAPI_list_t *supis, + OpenAPI_list_t *gpsis, + OpenAPI_list_t *int_group_ids +); +void OpenAPI_target_ue_information_free(OpenAPI_target_ue_information_t *target_ue_information); +OpenAPI_target_ue_information_t *OpenAPI_target_ue_information_parseFromJSON(cJSON *target_ue_informationJSON); +cJSON *OpenAPI_target_ue_information_convertToJSON(OpenAPI_target_ue_information_t *target_ue_information); +OpenAPI_target_ue_information_t *OpenAPI_target_ue_information_copy(OpenAPI_target_ue_information_t *dst, OpenAPI_target_ue_information_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_target_ue_information_H_ */ + diff --git a/lib/sbi/openapi/model/temporal_validity.h b/lib/sbi/openapi/model/temporal_validity.h index 410e63579..42fb50435 100644 --- a/lib/sbi/openapi/model/temporal_validity.h +++ b/lib/sbi/openapi/model/temporal_validity.h @@ -1,7 +1,7 @@ /* * temporal_validity.h * - * Indicates the time interval(s) during which the AF request is to be applied + * Indicates the time interval(s) during which the AF request is to be applied. */ #ifndef _OpenAPI_temporal_validity_H_ diff --git a/lib/sbi/openapi/model/termination_cause.c b/lib/sbi/openapi/model/termination_cause.c index abfb0e1f2..f591a9f86 100644 --- a/lib/sbi/openapi/model/termination_cause.c +++ b/lib/sbi/openapi/model/termination_cause.c @@ -6,7 +6,7 @@ char* OpenAPI_termination_cause_ToString(OpenAPI_termination_cause_e termination_cause) { - const char *termination_causeArray[] = { "NULL", "ALL_SDF_DEACTIVATION", "PDU_SESSION_TERMINATION", "PS_TO_CS_HO" }; + const char *termination_causeArray[] = { "NULL", "ALL_SDF_DEACTIVATION", "PDU_SESSION_TERMINATION", "PS_TO_CS_HO", "INSUFFICIENT_SERVER_RESOURCES", "INSUFFICIENT_QOS_FLOW_RESOURCES", "SPONSORED_DATA_CONNECTIVITY_DISALLOWED" }; size_t sizeofArray = sizeof(termination_causeArray) / sizeof(termination_causeArray[0]); if (termination_cause < sizeofArray) return (char *)termination_causeArray[termination_cause]; @@ -17,7 +17,7 @@ char* OpenAPI_termination_cause_ToString(OpenAPI_termination_cause_e termination OpenAPI_termination_cause_e OpenAPI_termination_cause_FromString(char* termination_cause) { int stringToReturn = 0; - const char *termination_causeArray[] = { "NULL", "ALL_SDF_DEACTIVATION", "PDU_SESSION_TERMINATION", "PS_TO_CS_HO" }; + const char *termination_causeArray[] = { "NULL", "ALL_SDF_DEACTIVATION", "PDU_SESSION_TERMINATION", "PS_TO_CS_HO", "INSUFFICIENT_SERVER_RESOURCES", "INSUFFICIENT_QOS_FLOW_RESOURCES", "SPONSORED_DATA_CONNECTIVITY_DISALLOWED" }; size_t sizeofArray = sizeof(termination_causeArray) / sizeof(termination_causeArray[0]); while (stringToReturn < sizeofArray) { if (strcmp(termination_cause, termination_causeArray[stringToReturn]) == 0) { diff --git a/lib/sbi/openapi/model/termination_cause.h b/lib/sbi/openapi/model/termination_cause.h index f5b8d9da4..41f2519c8 100644 --- a/lib/sbi/openapi/model/termination_cause.h +++ b/lib/sbi/openapi/model/termination_cause.h @@ -17,7 +17,7 @@ extern "C" { #endif -typedef enum { OpenAPI_termination_cause_NULL = 0, OpenAPI_termination_cause_ALL_SDF_DEACTIVATION, OpenAPI_termination_cause_PDU_SESSION_TERMINATION, OpenAPI_termination_cause_PS_TO_CS_HO } OpenAPI_termination_cause_e; +typedef enum { OpenAPI_termination_cause_NULL = 0, OpenAPI_termination_cause_ALL_SDF_DEACTIVATION, OpenAPI_termination_cause_PDU_SESSION_TERMINATION, OpenAPI_termination_cause_PS_TO_CS_HO, OpenAPI_termination_cause_INSUFFICIENT_SERVER_RESOURCES, OpenAPI_termination_cause_INSUFFICIENT_QOS_FLOW_RESOURCES, OpenAPI_termination_cause_SPONSORED_DATA_CONNECTIVITY_DISALLOWED } OpenAPI_termination_cause_e; char* OpenAPI_termination_cause_ToString(OpenAPI_termination_cause_e termination_cause); diff --git a/lib/sbi/openapi/model/termination_info.h b/lib/sbi/openapi/model/termination_info.h index bb78de1dc..d9a49ffe4 100644 --- a/lib/sbi/openapi/model/termination_info.h +++ b/lib/sbi/openapi/model/termination_info.h @@ -1,7 +1,7 @@ /* * termination_info.h * - * indicates the cause for requesting the deletion of the Individual Application Session Context resource + * Indicates the cause for requesting the deletion of the Individual Application Session Context resource. */ #ifndef _OpenAPI_termination_info_H_ diff --git a/lib/sbi/openapi/model/termination_notification.h b/lib/sbi/openapi/model/termination_notification.h index 67253f7d5..82c602d6a 100644 --- a/lib/sbi/openapi/model/termination_notification.h +++ b/lib/sbi/openapi/model/termination_notification.h @@ -1,7 +1,7 @@ /* * termination_notification.h * - * + * Represents a Termination Notification. */ #ifndef _OpenAPI_termination_notification_H_ diff --git a/lib/sbi/openapi/model/threshold_level.c b/lib/sbi/openapi/model/threshold_level.c new file mode 100644 index 000000000..a086497e2 --- /dev/null +++ b/lib/sbi/openapi/model/threshold_level.c @@ -0,0 +1,331 @@ + +#include +#include +#include +#include "threshold_level.h" + +OpenAPI_threshold_level_t *OpenAPI_threshold_level_create( + bool is_cong_level, + int cong_level, + bool is_nf_load_level, + int nf_load_level, + bool is_nf_cpu_usage, + int nf_cpu_usage, + bool is_nf_memory_usage, + int nf_memory_usage, + bool is_nf_storage_usage, + int nf_storage_usage, + char *avg_traffic_rate, + char *max_traffic_rate, + bool is_avg_packet_delay, + int avg_packet_delay, + bool is_max_packet_delay, + int max_packet_delay, + bool is_avg_packet_loss_rate, + int avg_packet_loss_rate, + bool is_svc_exp_level, + float svc_exp_level +) +{ + OpenAPI_threshold_level_t *threshold_level_local_var = ogs_malloc(sizeof(OpenAPI_threshold_level_t)); + ogs_assert(threshold_level_local_var); + + threshold_level_local_var->is_cong_level = is_cong_level; + threshold_level_local_var->cong_level = cong_level; + threshold_level_local_var->is_nf_load_level = is_nf_load_level; + threshold_level_local_var->nf_load_level = nf_load_level; + threshold_level_local_var->is_nf_cpu_usage = is_nf_cpu_usage; + threshold_level_local_var->nf_cpu_usage = nf_cpu_usage; + threshold_level_local_var->is_nf_memory_usage = is_nf_memory_usage; + threshold_level_local_var->nf_memory_usage = nf_memory_usage; + threshold_level_local_var->is_nf_storage_usage = is_nf_storage_usage; + threshold_level_local_var->nf_storage_usage = nf_storage_usage; + threshold_level_local_var->avg_traffic_rate = avg_traffic_rate; + threshold_level_local_var->max_traffic_rate = max_traffic_rate; + threshold_level_local_var->is_avg_packet_delay = is_avg_packet_delay; + threshold_level_local_var->avg_packet_delay = avg_packet_delay; + threshold_level_local_var->is_max_packet_delay = is_max_packet_delay; + threshold_level_local_var->max_packet_delay = max_packet_delay; + threshold_level_local_var->is_avg_packet_loss_rate = is_avg_packet_loss_rate; + threshold_level_local_var->avg_packet_loss_rate = avg_packet_loss_rate; + threshold_level_local_var->is_svc_exp_level = is_svc_exp_level; + threshold_level_local_var->svc_exp_level = svc_exp_level; + + return threshold_level_local_var; +} + +void OpenAPI_threshold_level_free(OpenAPI_threshold_level_t *threshold_level) +{ + OpenAPI_lnode_t *node = NULL; + + if (NULL == threshold_level) { + return; + } + if (threshold_level->avg_traffic_rate) { + ogs_free(threshold_level->avg_traffic_rate); + threshold_level->avg_traffic_rate = NULL; + } + if (threshold_level->max_traffic_rate) { + ogs_free(threshold_level->max_traffic_rate); + threshold_level->max_traffic_rate = NULL; + } + ogs_free(threshold_level); +} + +cJSON *OpenAPI_threshold_level_convertToJSON(OpenAPI_threshold_level_t *threshold_level) +{ + cJSON *item = NULL; + OpenAPI_lnode_t *node = NULL; + + if (threshold_level == NULL) { + ogs_error("OpenAPI_threshold_level_convertToJSON() failed [ThresholdLevel]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (threshold_level->is_cong_level) { + if (cJSON_AddNumberToObject(item, "congLevel", threshold_level->cong_level) == NULL) { + ogs_error("OpenAPI_threshold_level_convertToJSON() failed [cong_level]"); + goto end; + } + } + + if (threshold_level->is_nf_load_level) { + if (cJSON_AddNumberToObject(item, "nfLoadLevel", threshold_level->nf_load_level) == NULL) { + ogs_error("OpenAPI_threshold_level_convertToJSON() failed [nf_load_level]"); + goto end; + } + } + + if (threshold_level->is_nf_cpu_usage) { + if (cJSON_AddNumberToObject(item, "nfCpuUsage", threshold_level->nf_cpu_usage) == NULL) { + ogs_error("OpenAPI_threshold_level_convertToJSON() failed [nf_cpu_usage]"); + goto end; + } + } + + if (threshold_level->is_nf_memory_usage) { + if (cJSON_AddNumberToObject(item, "nfMemoryUsage", threshold_level->nf_memory_usage) == NULL) { + ogs_error("OpenAPI_threshold_level_convertToJSON() failed [nf_memory_usage]"); + goto end; + } + } + + if (threshold_level->is_nf_storage_usage) { + if (cJSON_AddNumberToObject(item, "nfStorageUsage", threshold_level->nf_storage_usage) == NULL) { + ogs_error("OpenAPI_threshold_level_convertToJSON() failed [nf_storage_usage]"); + goto end; + } + } + + if (threshold_level->avg_traffic_rate) { + if (cJSON_AddStringToObject(item, "avgTrafficRate", threshold_level->avg_traffic_rate) == NULL) { + ogs_error("OpenAPI_threshold_level_convertToJSON() failed [avg_traffic_rate]"); + goto end; + } + } + + if (threshold_level->max_traffic_rate) { + if (cJSON_AddStringToObject(item, "maxTrafficRate", threshold_level->max_traffic_rate) == NULL) { + ogs_error("OpenAPI_threshold_level_convertToJSON() failed [max_traffic_rate]"); + goto end; + } + } + + if (threshold_level->is_avg_packet_delay) { + if (cJSON_AddNumberToObject(item, "avgPacketDelay", threshold_level->avg_packet_delay) == NULL) { + ogs_error("OpenAPI_threshold_level_convertToJSON() failed [avg_packet_delay]"); + goto end; + } + } + + if (threshold_level->is_max_packet_delay) { + if (cJSON_AddNumberToObject(item, "maxPacketDelay", threshold_level->max_packet_delay) == NULL) { + ogs_error("OpenAPI_threshold_level_convertToJSON() failed [max_packet_delay]"); + goto end; + } + } + + if (threshold_level->is_avg_packet_loss_rate) { + if (cJSON_AddNumberToObject(item, "avgPacketLossRate", threshold_level->avg_packet_loss_rate) == NULL) { + ogs_error("OpenAPI_threshold_level_convertToJSON() failed [avg_packet_loss_rate]"); + goto end; + } + } + + if (threshold_level->is_svc_exp_level) { + if (cJSON_AddNumberToObject(item, "svcExpLevel", threshold_level->svc_exp_level) == NULL) { + ogs_error("OpenAPI_threshold_level_convertToJSON() failed [svc_exp_level]"); + goto end; + } + } + +end: + return item; +} + +OpenAPI_threshold_level_t *OpenAPI_threshold_level_parseFromJSON(cJSON *threshold_levelJSON) +{ + OpenAPI_threshold_level_t *threshold_level_local_var = NULL; + OpenAPI_lnode_t *node = NULL; + cJSON *cong_level = NULL; + cJSON *nf_load_level = NULL; + cJSON *nf_cpu_usage = NULL; + cJSON *nf_memory_usage = NULL; + cJSON *nf_storage_usage = NULL; + cJSON *avg_traffic_rate = NULL; + cJSON *max_traffic_rate = NULL; + cJSON *avg_packet_delay = NULL; + cJSON *max_packet_delay = NULL; + cJSON *avg_packet_loss_rate = NULL; + cJSON *svc_exp_level = NULL; + cong_level = cJSON_GetObjectItemCaseSensitive(threshold_levelJSON, "congLevel"); + if (cong_level) { + if (!cJSON_IsNumber(cong_level)) { + ogs_error("OpenAPI_threshold_level_parseFromJSON() failed [cong_level]"); + goto end; + } + } + + nf_load_level = cJSON_GetObjectItemCaseSensitive(threshold_levelJSON, "nfLoadLevel"); + if (nf_load_level) { + if (!cJSON_IsNumber(nf_load_level)) { + ogs_error("OpenAPI_threshold_level_parseFromJSON() failed [nf_load_level]"); + goto end; + } + } + + nf_cpu_usage = cJSON_GetObjectItemCaseSensitive(threshold_levelJSON, "nfCpuUsage"); + if (nf_cpu_usage) { + if (!cJSON_IsNumber(nf_cpu_usage)) { + ogs_error("OpenAPI_threshold_level_parseFromJSON() failed [nf_cpu_usage]"); + goto end; + } + } + + nf_memory_usage = cJSON_GetObjectItemCaseSensitive(threshold_levelJSON, "nfMemoryUsage"); + if (nf_memory_usage) { + if (!cJSON_IsNumber(nf_memory_usage)) { + ogs_error("OpenAPI_threshold_level_parseFromJSON() failed [nf_memory_usage]"); + goto end; + } + } + + nf_storage_usage = cJSON_GetObjectItemCaseSensitive(threshold_levelJSON, "nfStorageUsage"); + if (nf_storage_usage) { + if (!cJSON_IsNumber(nf_storage_usage)) { + ogs_error("OpenAPI_threshold_level_parseFromJSON() failed [nf_storage_usage]"); + goto end; + } + } + + avg_traffic_rate = cJSON_GetObjectItemCaseSensitive(threshold_levelJSON, "avgTrafficRate"); + if (avg_traffic_rate) { + if (!cJSON_IsString(avg_traffic_rate) && !cJSON_IsNull(avg_traffic_rate)) { + ogs_error("OpenAPI_threshold_level_parseFromJSON() failed [avg_traffic_rate]"); + goto end; + } + } + + max_traffic_rate = cJSON_GetObjectItemCaseSensitive(threshold_levelJSON, "maxTrafficRate"); + if (max_traffic_rate) { + if (!cJSON_IsString(max_traffic_rate) && !cJSON_IsNull(max_traffic_rate)) { + ogs_error("OpenAPI_threshold_level_parseFromJSON() failed [max_traffic_rate]"); + goto end; + } + } + + avg_packet_delay = cJSON_GetObjectItemCaseSensitive(threshold_levelJSON, "avgPacketDelay"); + if (avg_packet_delay) { + if (!cJSON_IsNumber(avg_packet_delay)) { + ogs_error("OpenAPI_threshold_level_parseFromJSON() failed [avg_packet_delay]"); + goto end; + } + } + + max_packet_delay = cJSON_GetObjectItemCaseSensitive(threshold_levelJSON, "maxPacketDelay"); + if (max_packet_delay) { + if (!cJSON_IsNumber(max_packet_delay)) { + ogs_error("OpenAPI_threshold_level_parseFromJSON() failed [max_packet_delay]"); + goto end; + } + } + + avg_packet_loss_rate = cJSON_GetObjectItemCaseSensitive(threshold_levelJSON, "avgPacketLossRate"); + if (avg_packet_loss_rate) { + if (!cJSON_IsNumber(avg_packet_loss_rate)) { + ogs_error("OpenAPI_threshold_level_parseFromJSON() failed [avg_packet_loss_rate]"); + goto end; + } + } + + svc_exp_level = cJSON_GetObjectItemCaseSensitive(threshold_levelJSON, "svcExpLevel"); + if (svc_exp_level) { + if (!cJSON_IsNumber(svc_exp_level)) { + ogs_error("OpenAPI_threshold_level_parseFromJSON() failed [svc_exp_level]"); + goto end; + } + } + + threshold_level_local_var = OpenAPI_threshold_level_create ( + cong_level ? true : false, + cong_level ? cong_level->valuedouble : 0, + nf_load_level ? true : false, + nf_load_level ? nf_load_level->valuedouble : 0, + nf_cpu_usage ? true : false, + nf_cpu_usage ? nf_cpu_usage->valuedouble : 0, + nf_memory_usage ? true : false, + nf_memory_usage ? nf_memory_usage->valuedouble : 0, + nf_storage_usage ? true : false, + nf_storage_usage ? nf_storage_usage->valuedouble : 0, + avg_traffic_rate && !cJSON_IsNull(avg_traffic_rate) ? ogs_strdup(avg_traffic_rate->valuestring) : NULL, + max_traffic_rate && !cJSON_IsNull(max_traffic_rate) ? ogs_strdup(max_traffic_rate->valuestring) : NULL, + avg_packet_delay ? true : false, + avg_packet_delay ? avg_packet_delay->valuedouble : 0, + max_packet_delay ? true : false, + max_packet_delay ? max_packet_delay->valuedouble : 0, + avg_packet_loss_rate ? true : false, + avg_packet_loss_rate ? avg_packet_loss_rate->valuedouble : 0, + svc_exp_level ? true : false, + svc_exp_level ? svc_exp_level->valuedouble : 0 + ); + + return threshold_level_local_var; +end: + return NULL; +} + +OpenAPI_threshold_level_t *OpenAPI_threshold_level_copy(OpenAPI_threshold_level_t *dst, OpenAPI_threshold_level_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_threshold_level_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_threshold_level_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_threshold_level_free(dst); + dst = OpenAPI_threshold_level_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/threshold_level.h b/lib/sbi/openapi/model/threshold_level.h new file mode 100644 index 000000000..1a568ec64 --- /dev/null +++ b/lib/sbi/openapi/model/threshold_level.h @@ -0,0 +1,76 @@ +/* + * threshold_level.h + * + * Represents a threshold level. + */ + +#ifndef _OpenAPI_threshold_level_H_ +#define _OpenAPI_threshold_level_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_threshold_level_s OpenAPI_threshold_level_t; +typedef struct OpenAPI_threshold_level_s { + bool is_cong_level; + int cong_level; + bool is_nf_load_level; + int nf_load_level; + bool is_nf_cpu_usage; + int nf_cpu_usage; + bool is_nf_memory_usage; + int nf_memory_usage; + bool is_nf_storage_usage; + int nf_storage_usage; + char *avg_traffic_rate; + char *max_traffic_rate; + bool is_avg_packet_delay; + int avg_packet_delay; + bool is_max_packet_delay; + int max_packet_delay; + bool is_avg_packet_loss_rate; + int avg_packet_loss_rate; + bool is_svc_exp_level; + float svc_exp_level; +} OpenAPI_threshold_level_t; + +OpenAPI_threshold_level_t *OpenAPI_threshold_level_create( + bool is_cong_level, + int cong_level, + bool is_nf_load_level, + int nf_load_level, + bool is_nf_cpu_usage, + int nf_cpu_usage, + bool is_nf_memory_usage, + int nf_memory_usage, + bool is_nf_storage_usage, + int nf_storage_usage, + char *avg_traffic_rate, + char *max_traffic_rate, + bool is_avg_packet_delay, + int avg_packet_delay, + bool is_max_packet_delay, + int max_packet_delay, + bool is_avg_packet_loss_rate, + int avg_packet_loss_rate, + bool is_svc_exp_level, + float svc_exp_level +); +void OpenAPI_threshold_level_free(OpenAPI_threshold_level_t *threshold_level); +OpenAPI_threshold_level_t *OpenAPI_threshold_level_parseFromJSON(cJSON *threshold_levelJSON); +cJSON *OpenAPI_threshold_level_convertToJSON(OpenAPI_threshold_level_t *threshold_level); +OpenAPI_threshold_level_t *OpenAPI_threshold_level_copy(OpenAPI_threshold_level_t *dst, OpenAPI_threshold_level_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_threshold_level_H_ */ + diff --git a/lib/sbi/openapi/model/threshold_value.c b/lib/sbi/openapi/model/threshold_value.c new file mode 100644 index 000000000..2173b98ad --- /dev/null +++ b/lib/sbi/openapi/model/threshold_value.c @@ -0,0 +1,131 @@ + +#include +#include +#include +#include "threshold_value.h" + +OpenAPI_threshold_value_t *OpenAPI_threshold_value_create( + bool is_rtt_thres, + int rtt_thres, + bool is_plr_thres, + int plr_thres +) +{ + OpenAPI_threshold_value_t *threshold_value_local_var = ogs_malloc(sizeof(OpenAPI_threshold_value_t)); + ogs_assert(threshold_value_local_var); + + threshold_value_local_var->is_rtt_thres = is_rtt_thres; + threshold_value_local_var->rtt_thres = rtt_thres; + threshold_value_local_var->is_plr_thres = is_plr_thres; + threshold_value_local_var->plr_thres = plr_thres; + + return threshold_value_local_var; +} + +void OpenAPI_threshold_value_free(OpenAPI_threshold_value_t *threshold_value) +{ + OpenAPI_lnode_t *node = NULL; + + if (NULL == threshold_value) { + return; + } + ogs_free(threshold_value); +} + +cJSON *OpenAPI_threshold_value_convertToJSON(OpenAPI_threshold_value_t *threshold_value) +{ + cJSON *item = NULL; + OpenAPI_lnode_t *node = NULL; + + if (threshold_value == NULL) { + ogs_error("OpenAPI_threshold_value_convertToJSON() failed [ThresholdValue]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (threshold_value->is_rtt_thres) { + if (cJSON_AddNumberToObject(item, "rttThres", threshold_value->rtt_thres) == NULL) { + ogs_error("OpenAPI_threshold_value_convertToJSON() failed [rtt_thres]"); + goto end; + } + } + + if (threshold_value->is_plr_thres) { + if (cJSON_AddNumberToObject(item, "plrThres", threshold_value->plr_thres) == NULL) { + ogs_error("OpenAPI_threshold_value_convertToJSON() failed [plr_thres]"); + goto end; + } + } + +end: + return item; +} + +OpenAPI_threshold_value_t *OpenAPI_threshold_value_parseFromJSON(cJSON *threshold_valueJSON) +{ + OpenAPI_threshold_value_t *threshold_value_local_var = NULL; + OpenAPI_lnode_t *node = NULL; + cJSON *rtt_thres = NULL; + cJSON *plr_thres = NULL; + rtt_thres = cJSON_GetObjectItemCaseSensitive(threshold_valueJSON, "rttThres"); + if (rtt_thres) { + if (!cJSON_IsNumber(rtt_thres)) { + ogs_error("OpenAPI_threshold_value_parseFromJSON() failed [rtt_thres]"); + goto end; + } + } + + plr_thres = cJSON_GetObjectItemCaseSensitive(threshold_valueJSON, "plrThres"); + if (plr_thres) { + if (!cJSON_IsNumber(plr_thres)) { + ogs_error("OpenAPI_threshold_value_parseFromJSON() failed [plr_thres]"); + goto end; + } + } + + threshold_value_local_var = OpenAPI_threshold_value_create ( + rtt_thres ? true : false, + rtt_thres ? rtt_thres->valuedouble : 0, + plr_thres ? true : false, + plr_thres ? plr_thres->valuedouble : 0 + ); + + return threshold_value_local_var; +end: + return NULL; +} + +OpenAPI_threshold_value_t *OpenAPI_threshold_value_copy(OpenAPI_threshold_value_t *dst, OpenAPI_threshold_value_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_threshold_value_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_threshold_value_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_threshold_value_free(dst); + dst = OpenAPI_threshold_value_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/threshold_value.h b/lib/sbi/openapi/model/threshold_value.h new file mode 100644 index 000000000..afce3626e --- /dev/null +++ b/lib/sbi/openapi/model/threshold_value.h @@ -0,0 +1,44 @@ +/* + * threshold_value.h + * + * Indicates the threshold value(s) for RTT and/or Packet Loss Rate. + */ + +#ifndef _OpenAPI_threshold_value_H_ +#define _OpenAPI_threshold_value_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_threshold_value_s OpenAPI_threshold_value_t; +typedef struct OpenAPI_threshold_value_s { + bool is_rtt_thres; + int rtt_thres; + bool is_plr_thres; + int plr_thres; +} OpenAPI_threshold_value_t; + +OpenAPI_threshold_value_t *OpenAPI_threshold_value_create( + bool is_rtt_thres, + int rtt_thres, + bool is_plr_thres, + int plr_thres +); +void OpenAPI_threshold_value_free(OpenAPI_threshold_value_t *threshold_value); +OpenAPI_threshold_value_t *OpenAPI_threshold_value_parseFromJSON(cJSON *threshold_valueJSON); +cJSON *OpenAPI_threshold_value_convertToJSON(OpenAPI_threshold_value_t *threshold_value); +OpenAPI_threshold_value_t *OpenAPI_threshold_value_copy(OpenAPI_threshold_value_t *dst, OpenAPI_threshold_value_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_threshold_value_H_ */ + diff --git a/lib/sbi/openapi/model/time_unit.c b/lib/sbi/openapi/model/time_unit.c new file mode 100644 index 000000000..15e434c2c --- /dev/null +++ b/lib/sbi/openapi/model/time_unit.c @@ -0,0 +1,87 @@ + +#include +#include +#include +#include "time_unit.h" + +OpenAPI_time_unit_t *OpenAPI_time_unit_create( +) +{ + OpenAPI_time_unit_t *time_unit_local_var = ogs_malloc(sizeof(OpenAPI_time_unit_t)); + ogs_assert(time_unit_local_var); + + + return time_unit_local_var; +} + +void OpenAPI_time_unit_free(OpenAPI_time_unit_t *time_unit) +{ + OpenAPI_lnode_t *node = NULL; + + if (NULL == time_unit) { + return; + } + ogs_free(time_unit); +} + +cJSON *OpenAPI_time_unit_convertToJSON(OpenAPI_time_unit_t *time_unit) +{ + cJSON *item = NULL; + OpenAPI_lnode_t *node = NULL; + + if (time_unit == NULL) { + ogs_error("OpenAPI_time_unit_convertToJSON() failed [TimeUnit]"); + return NULL; + } + + item = cJSON_CreateObject(); +end: + return item; +} + +OpenAPI_time_unit_t *OpenAPI_time_unit_parseFromJSON(cJSON *time_unitJSON) +{ + OpenAPI_time_unit_t *time_unit_local_var = NULL; + OpenAPI_lnode_t *node = NULL; + time_unit_local_var = OpenAPI_time_unit_create ( + ); + + return time_unit_local_var; +end: + return NULL; +} + +OpenAPI_time_unit_t *OpenAPI_time_unit_copy(OpenAPI_time_unit_t *dst, OpenAPI_time_unit_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_time_unit_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_time_unit_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_time_unit_free(dst); + dst = OpenAPI_time_unit_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/time_unit.h b/lib/sbi/openapi/model/time_unit.h new file mode 100644 index 000000000..bdfb39224 --- /dev/null +++ b/lib/sbi/openapi/model/time_unit.h @@ -0,0 +1,37 @@ +/* + * time_unit.h + * + * Possible values are: - MINUTE: Time unit is per minute. - HOUR: Time unit is per hour. - DAY: Time unit is per day. + */ + +#ifndef _OpenAPI_time_unit_H_ +#define _OpenAPI_time_unit_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "time_unit_any_of.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_time_unit_s OpenAPI_time_unit_t; +typedef struct OpenAPI_time_unit_s { +} OpenAPI_time_unit_t; + +OpenAPI_time_unit_t *OpenAPI_time_unit_create( +); +void OpenAPI_time_unit_free(OpenAPI_time_unit_t *time_unit); +OpenAPI_time_unit_t *OpenAPI_time_unit_parseFromJSON(cJSON *time_unitJSON); +cJSON *OpenAPI_time_unit_convertToJSON(OpenAPI_time_unit_t *time_unit); +OpenAPI_time_unit_t *OpenAPI_time_unit_copy(OpenAPI_time_unit_t *dst, OpenAPI_time_unit_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_time_unit_H_ */ + diff --git a/lib/sbi/openapi/model/time_unit_any_of.c b/lib/sbi/openapi/model/time_unit_any_of.c new file mode 100644 index 000000000..258f421d6 --- /dev/null +++ b/lib/sbi/openapi/model/time_unit_any_of.c @@ -0,0 +1,30 @@ + +#include +#include +#include +#include "time_unit_any_of.h" + +char* OpenAPI_time_unit_any_of_ToString(OpenAPI_time_unit_any_of_e time_unit_any_of) +{ + const char *time_unit_any_ofArray[] = { "NULL", "MINUTE", "HOUR", "DAY" }; + size_t sizeofArray = sizeof(time_unit_any_ofArray) / sizeof(time_unit_any_ofArray[0]); + if (time_unit_any_of < sizeofArray) + return (char *)time_unit_any_ofArray[time_unit_any_of]; + else + return (char *)"Unknown"; +} + +OpenAPI_time_unit_any_of_e OpenAPI_time_unit_any_of_FromString(char* time_unit_any_of) +{ + int stringToReturn = 0; + const char *time_unit_any_ofArray[] = { "NULL", "MINUTE", "HOUR", "DAY" }; + size_t sizeofArray = sizeof(time_unit_any_ofArray) / sizeof(time_unit_any_ofArray[0]); + while (stringToReturn < sizeofArray) { + if (strcmp(time_unit_any_of, time_unit_any_ofArray[stringToReturn]) == 0) { + return stringToReturn; + } + stringToReturn++; + } + return 0; +} + diff --git a/lib/sbi/openapi/model/time_unit_any_of.h b/lib/sbi/openapi/model/time_unit_any_of.h new file mode 100644 index 000000000..f09305eb4 --- /dev/null +++ b/lib/sbi/openapi/model/time_unit_any_of.h @@ -0,0 +1,31 @@ +/* + * time_unit_any_of.h + * + * + */ + +#ifndef _OpenAPI_time_unit_any_of_H_ +#define _OpenAPI_time_unit_any_of_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef enum { OpenAPI_time_unit_any_of_NULL = 0, OpenAPI_time_unit_any_of_MINUTE, OpenAPI_time_unit_any_of_HOUR, OpenAPI_time_unit_any_of_DAY } OpenAPI_time_unit_any_of_e; + +char* OpenAPI_time_unit_any_of_ToString(OpenAPI_time_unit_any_of_e time_unit_any_of); + +OpenAPI_time_unit_any_of_e OpenAPI_time_unit_any_of_FromString(char* time_unit_any_of); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_time_unit_any_of_H_ */ + diff --git a/lib/sbi/openapi/model/time_window.c b/lib/sbi/openapi/model/time_window.c index d86a479a2..9493ca53e 100644 --- a/lib/sbi/openapi/model/time_window.c +++ b/lib/sbi/openapi/model/time_window.c @@ -80,7 +80,7 @@ OpenAPI_time_window_t *OpenAPI_time_window_parseFromJSON(cJSON *time_windowJSON) ogs_error("OpenAPI_time_window_parseFromJSON() failed [start_time]"); goto end; } - if (!cJSON_IsString(start_time)) { + if (!cJSON_IsString(start_time) && !cJSON_IsNull(start_time)) { ogs_error("OpenAPI_time_window_parseFromJSON() failed [start_time]"); goto end; } @@ -90,7 +90,7 @@ OpenAPI_time_window_t *OpenAPI_time_window_parseFromJSON(cJSON *time_windowJSON) ogs_error("OpenAPI_time_window_parseFromJSON() failed [stop_time]"); goto end; } - if (!cJSON_IsString(stop_time)) { + if (!cJSON_IsString(stop_time) && !cJSON_IsNull(stop_time)) { ogs_error("OpenAPI_time_window_parseFromJSON() failed [stop_time]"); goto end; } diff --git a/lib/sbi/openapi/model/time_window.h b/lib/sbi/openapi/model/time_window.h index 81933ed5f..234ab6858 100644 --- a/lib/sbi/openapi/model/time_window.h +++ b/lib/sbi/openapi/model/time_window.h @@ -1,7 +1,7 @@ /* * time_window.h * - * + * Represents a time window identified by a start time and a stop time. */ #ifndef _OpenAPI_time_window_H_ diff --git a/lib/sbi/openapi/model/tmgi.c b/lib/sbi/openapi/model/tmgi.c new file mode 100644 index 000000000..8386d29b4 --- /dev/null +++ b/lib/sbi/openapi/model/tmgi.c @@ -0,0 +1,149 @@ + +#include +#include +#include +#include "tmgi.h" + +OpenAPI_tmgi_t *OpenAPI_tmgi_create( + char *mbs_service_id, + OpenAPI_plmn_id_t *plmn_id +) +{ + OpenAPI_tmgi_t *tmgi_local_var = ogs_malloc(sizeof(OpenAPI_tmgi_t)); + ogs_assert(tmgi_local_var); + + tmgi_local_var->mbs_service_id = mbs_service_id; + tmgi_local_var->plmn_id = plmn_id; + + return tmgi_local_var; +} + +void OpenAPI_tmgi_free(OpenAPI_tmgi_t *tmgi) +{ + OpenAPI_lnode_t *node = NULL; + + if (NULL == tmgi) { + return; + } + if (tmgi->mbs_service_id) { + ogs_free(tmgi->mbs_service_id); + tmgi->mbs_service_id = NULL; + } + if (tmgi->plmn_id) { + OpenAPI_plmn_id_free(tmgi->plmn_id); + tmgi->plmn_id = NULL; + } + ogs_free(tmgi); +} + +cJSON *OpenAPI_tmgi_convertToJSON(OpenAPI_tmgi_t *tmgi) +{ + cJSON *item = NULL; + OpenAPI_lnode_t *node = NULL; + + if (tmgi == NULL) { + ogs_error("OpenAPI_tmgi_convertToJSON() failed [Tmgi]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (!tmgi->mbs_service_id) { + ogs_error("OpenAPI_tmgi_convertToJSON() failed [mbs_service_id]"); + return NULL; + } + if (cJSON_AddStringToObject(item, "mbsServiceId", tmgi->mbs_service_id) == NULL) { + ogs_error("OpenAPI_tmgi_convertToJSON() failed [mbs_service_id]"); + goto end; + } + + if (!tmgi->plmn_id) { + ogs_error("OpenAPI_tmgi_convertToJSON() failed [plmn_id]"); + return NULL; + } + cJSON *plmn_id_local_JSON = OpenAPI_plmn_id_convertToJSON(tmgi->plmn_id); + if (plmn_id_local_JSON == NULL) { + ogs_error("OpenAPI_tmgi_convertToJSON() failed [plmn_id]"); + goto end; + } + cJSON_AddItemToObject(item, "plmnId", plmn_id_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_tmgi_convertToJSON() failed [plmn_id]"); + goto end; + } + +end: + return item; +} + +OpenAPI_tmgi_t *OpenAPI_tmgi_parseFromJSON(cJSON *tmgiJSON) +{ + OpenAPI_tmgi_t *tmgi_local_var = NULL; + OpenAPI_lnode_t *node = NULL; + cJSON *mbs_service_id = NULL; + cJSON *plmn_id = NULL; + OpenAPI_plmn_id_t *plmn_id_local_nonprim = NULL; + mbs_service_id = cJSON_GetObjectItemCaseSensitive(tmgiJSON, "mbsServiceId"); + if (!mbs_service_id) { + ogs_error("OpenAPI_tmgi_parseFromJSON() failed [mbs_service_id]"); + goto end; + } + if (!cJSON_IsString(mbs_service_id)) { + ogs_error("OpenAPI_tmgi_parseFromJSON() failed [mbs_service_id]"); + goto end; + } + + plmn_id = cJSON_GetObjectItemCaseSensitive(tmgiJSON, "plmnId"); + if (!plmn_id) { + ogs_error("OpenAPI_tmgi_parseFromJSON() failed [plmn_id]"); + goto end; + } + plmn_id_local_nonprim = OpenAPI_plmn_id_parseFromJSON(plmn_id); + + tmgi_local_var = OpenAPI_tmgi_create ( + ogs_strdup(mbs_service_id->valuestring), + plmn_id_local_nonprim + ); + + return tmgi_local_var; +end: + if (plmn_id_local_nonprim) { + OpenAPI_plmn_id_free(plmn_id_local_nonprim); + plmn_id_local_nonprim = NULL; + } + return NULL; +} + +OpenAPI_tmgi_t *OpenAPI_tmgi_copy(OpenAPI_tmgi_t *dst, OpenAPI_tmgi_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_tmgi_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_tmgi_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_tmgi_free(dst); + dst = OpenAPI_tmgi_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/tmgi.h b/lib/sbi/openapi/model/tmgi.h new file mode 100644 index 000000000..0183e4e62 --- /dev/null +++ b/lib/sbi/openapi/model/tmgi.h @@ -0,0 +1,41 @@ +/* + * tmgi.h + * + * Temporary Mobile Group Identity + */ + +#ifndef _OpenAPI_tmgi_H_ +#define _OpenAPI_tmgi_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "plmn_id.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_tmgi_s OpenAPI_tmgi_t; +typedef struct OpenAPI_tmgi_s { + char *mbs_service_id; + struct OpenAPI_plmn_id_s *plmn_id; +} OpenAPI_tmgi_t; + +OpenAPI_tmgi_t *OpenAPI_tmgi_create( + char *mbs_service_id, + OpenAPI_plmn_id_t *plmn_id +); +void OpenAPI_tmgi_free(OpenAPI_tmgi_t *tmgi); +OpenAPI_tmgi_t *OpenAPI_tmgi_parseFromJSON(cJSON *tmgiJSON); +cJSON *OpenAPI_tmgi_convertToJSON(OpenAPI_tmgi_t *tmgi); +OpenAPI_tmgi_t *OpenAPI_tmgi_copy(OpenAPI_tmgi_t *dst, OpenAPI_tmgi_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_tmgi_H_ */ + diff --git a/lib/sbi/openapi/model/tmgi_1.c b/lib/sbi/openapi/model/tmgi_1.c new file mode 100644 index 000000000..941b3a571 --- /dev/null +++ b/lib/sbi/openapi/model/tmgi_1.c @@ -0,0 +1,149 @@ + +#include +#include +#include +#include "tmgi_1.h" + +OpenAPI_tmgi_1_t *OpenAPI_tmgi_1_create( + char *mbs_service_id, + OpenAPI_plmn_id_1_t *plmn_id +) +{ + OpenAPI_tmgi_1_t *tmgi_1_local_var = ogs_malloc(sizeof(OpenAPI_tmgi_1_t)); + ogs_assert(tmgi_1_local_var); + + tmgi_1_local_var->mbs_service_id = mbs_service_id; + tmgi_1_local_var->plmn_id = plmn_id; + + return tmgi_1_local_var; +} + +void OpenAPI_tmgi_1_free(OpenAPI_tmgi_1_t *tmgi_1) +{ + OpenAPI_lnode_t *node = NULL; + + if (NULL == tmgi_1) { + return; + } + if (tmgi_1->mbs_service_id) { + ogs_free(tmgi_1->mbs_service_id); + tmgi_1->mbs_service_id = NULL; + } + if (tmgi_1->plmn_id) { + OpenAPI_plmn_id_1_free(tmgi_1->plmn_id); + tmgi_1->plmn_id = NULL; + } + ogs_free(tmgi_1); +} + +cJSON *OpenAPI_tmgi_1_convertToJSON(OpenAPI_tmgi_1_t *tmgi_1) +{ + cJSON *item = NULL; + OpenAPI_lnode_t *node = NULL; + + if (tmgi_1 == NULL) { + ogs_error("OpenAPI_tmgi_1_convertToJSON() failed [Tmgi_1]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (!tmgi_1->mbs_service_id) { + ogs_error("OpenAPI_tmgi_1_convertToJSON() failed [mbs_service_id]"); + return NULL; + } + if (cJSON_AddStringToObject(item, "mbsServiceId", tmgi_1->mbs_service_id) == NULL) { + ogs_error("OpenAPI_tmgi_1_convertToJSON() failed [mbs_service_id]"); + goto end; + } + + if (!tmgi_1->plmn_id) { + ogs_error("OpenAPI_tmgi_1_convertToJSON() failed [plmn_id]"); + return NULL; + } + cJSON *plmn_id_local_JSON = OpenAPI_plmn_id_1_convertToJSON(tmgi_1->plmn_id); + if (plmn_id_local_JSON == NULL) { + ogs_error("OpenAPI_tmgi_1_convertToJSON() failed [plmn_id]"); + goto end; + } + cJSON_AddItemToObject(item, "plmnId", plmn_id_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_tmgi_1_convertToJSON() failed [plmn_id]"); + goto end; + } + +end: + return item; +} + +OpenAPI_tmgi_1_t *OpenAPI_tmgi_1_parseFromJSON(cJSON *tmgi_1JSON) +{ + OpenAPI_tmgi_1_t *tmgi_1_local_var = NULL; + OpenAPI_lnode_t *node = NULL; + cJSON *mbs_service_id = NULL; + cJSON *plmn_id = NULL; + OpenAPI_plmn_id_1_t *plmn_id_local_nonprim = NULL; + mbs_service_id = cJSON_GetObjectItemCaseSensitive(tmgi_1JSON, "mbsServiceId"); + if (!mbs_service_id) { + ogs_error("OpenAPI_tmgi_1_parseFromJSON() failed [mbs_service_id]"); + goto end; + } + if (!cJSON_IsString(mbs_service_id)) { + ogs_error("OpenAPI_tmgi_1_parseFromJSON() failed [mbs_service_id]"); + goto end; + } + + plmn_id = cJSON_GetObjectItemCaseSensitive(tmgi_1JSON, "plmnId"); + if (!plmn_id) { + ogs_error("OpenAPI_tmgi_1_parseFromJSON() failed [plmn_id]"); + goto end; + } + plmn_id_local_nonprim = OpenAPI_plmn_id_1_parseFromJSON(plmn_id); + + tmgi_1_local_var = OpenAPI_tmgi_1_create ( + ogs_strdup(mbs_service_id->valuestring), + plmn_id_local_nonprim + ); + + return tmgi_1_local_var; +end: + if (plmn_id_local_nonprim) { + OpenAPI_plmn_id_1_free(plmn_id_local_nonprim); + plmn_id_local_nonprim = NULL; + } + return NULL; +} + +OpenAPI_tmgi_1_t *OpenAPI_tmgi_1_copy(OpenAPI_tmgi_1_t *dst, OpenAPI_tmgi_1_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_tmgi_1_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_tmgi_1_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_tmgi_1_free(dst); + dst = OpenAPI_tmgi_1_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/tmgi_1.h b/lib/sbi/openapi/model/tmgi_1.h new file mode 100644 index 000000000..478e02f6f --- /dev/null +++ b/lib/sbi/openapi/model/tmgi_1.h @@ -0,0 +1,41 @@ +/* + * tmgi_1.h + * + * Temporary Mobile Group Identity + */ + +#ifndef _OpenAPI_tmgi_1_H_ +#define _OpenAPI_tmgi_1_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "plmn_id_1.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_tmgi_1_s OpenAPI_tmgi_1_t; +typedef struct OpenAPI_tmgi_1_s { + char *mbs_service_id; + struct OpenAPI_plmn_id_1_s *plmn_id; +} OpenAPI_tmgi_1_t; + +OpenAPI_tmgi_1_t *OpenAPI_tmgi_1_create( + char *mbs_service_id, + OpenAPI_plmn_id_1_t *plmn_id +); +void OpenAPI_tmgi_1_free(OpenAPI_tmgi_1_t *tmgi_1); +OpenAPI_tmgi_1_t *OpenAPI_tmgi_1_parseFromJSON(cJSON *tmgi_1JSON); +cJSON *OpenAPI_tmgi_1_convertToJSON(OpenAPI_tmgi_1_t *tmgi_1); +OpenAPI_tmgi_1_t *OpenAPI_tmgi_1_copy(OpenAPI_tmgi_1_t *dst, OpenAPI_tmgi_1_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_tmgi_1_H_ */ + diff --git a/lib/sbi/openapi/model/tmgi_range.c b/lib/sbi/openapi/model/tmgi_range.c new file mode 100644 index 000000000..e608e6f1f --- /dev/null +++ b/lib/sbi/openapi/model/tmgi_range.c @@ -0,0 +1,199 @@ + +#include +#include +#include +#include "tmgi_range.h" + +OpenAPI_tmgi_range_t *OpenAPI_tmgi_range_create( + char *mbs_service_id_start, + char *mbs_service_id_end, + OpenAPI_plmn_id_t *plmn_id, + char *nid +) +{ + OpenAPI_tmgi_range_t *tmgi_range_local_var = ogs_malloc(sizeof(OpenAPI_tmgi_range_t)); + ogs_assert(tmgi_range_local_var); + + tmgi_range_local_var->mbs_service_id_start = mbs_service_id_start; + tmgi_range_local_var->mbs_service_id_end = mbs_service_id_end; + tmgi_range_local_var->plmn_id = plmn_id; + tmgi_range_local_var->nid = nid; + + return tmgi_range_local_var; +} + +void OpenAPI_tmgi_range_free(OpenAPI_tmgi_range_t *tmgi_range) +{ + OpenAPI_lnode_t *node = NULL; + + if (NULL == tmgi_range) { + return; + } + if (tmgi_range->mbs_service_id_start) { + ogs_free(tmgi_range->mbs_service_id_start); + tmgi_range->mbs_service_id_start = NULL; + } + if (tmgi_range->mbs_service_id_end) { + ogs_free(tmgi_range->mbs_service_id_end); + tmgi_range->mbs_service_id_end = NULL; + } + if (tmgi_range->plmn_id) { + OpenAPI_plmn_id_free(tmgi_range->plmn_id); + tmgi_range->plmn_id = NULL; + } + if (tmgi_range->nid) { + ogs_free(tmgi_range->nid); + tmgi_range->nid = NULL; + } + ogs_free(tmgi_range); +} + +cJSON *OpenAPI_tmgi_range_convertToJSON(OpenAPI_tmgi_range_t *tmgi_range) +{ + cJSON *item = NULL; + OpenAPI_lnode_t *node = NULL; + + if (tmgi_range == NULL) { + ogs_error("OpenAPI_tmgi_range_convertToJSON() failed [TmgiRange]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (!tmgi_range->mbs_service_id_start) { + ogs_error("OpenAPI_tmgi_range_convertToJSON() failed [mbs_service_id_start]"); + return NULL; + } + if (cJSON_AddStringToObject(item, "mbsServiceIdStart", tmgi_range->mbs_service_id_start) == NULL) { + ogs_error("OpenAPI_tmgi_range_convertToJSON() failed [mbs_service_id_start]"); + goto end; + } + + if (!tmgi_range->mbs_service_id_end) { + ogs_error("OpenAPI_tmgi_range_convertToJSON() failed [mbs_service_id_end]"); + return NULL; + } + if (cJSON_AddStringToObject(item, "mbsServiceIdEnd", tmgi_range->mbs_service_id_end) == NULL) { + ogs_error("OpenAPI_tmgi_range_convertToJSON() failed [mbs_service_id_end]"); + goto end; + } + + if (!tmgi_range->plmn_id) { + ogs_error("OpenAPI_tmgi_range_convertToJSON() failed [plmn_id]"); + return NULL; + } + cJSON *plmn_id_local_JSON = OpenAPI_plmn_id_convertToJSON(tmgi_range->plmn_id); + if (plmn_id_local_JSON == NULL) { + ogs_error("OpenAPI_tmgi_range_convertToJSON() failed [plmn_id]"); + goto end; + } + cJSON_AddItemToObject(item, "plmnId", plmn_id_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_tmgi_range_convertToJSON() failed [plmn_id]"); + goto end; + } + + if (tmgi_range->nid) { + if (cJSON_AddStringToObject(item, "nid", tmgi_range->nid) == NULL) { + ogs_error("OpenAPI_tmgi_range_convertToJSON() failed [nid]"); + goto end; + } + } + +end: + return item; +} + +OpenAPI_tmgi_range_t *OpenAPI_tmgi_range_parseFromJSON(cJSON *tmgi_rangeJSON) +{ + OpenAPI_tmgi_range_t *tmgi_range_local_var = NULL; + OpenAPI_lnode_t *node = NULL; + cJSON *mbs_service_id_start = NULL; + cJSON *mbs_service_id_end = NULL; + cJSON *plmn_id = NULL; + OpenAPI_plmn_id_t *plmn_id_local_nonprim = NULL; + cJSON *nid = NULL; + mbs_service_id_start = cJSON_GetObjectItemCaseSensitive(tmgi_rangeJSON, "mbsServiceIdStart"); + if (!mbs_service_id_start) { + ogs_error("OpenAPI_tmgi_range_parseFromJSON() failed [mbs_service_id_start]"); + goto end; + } + if (!cJSON_IsString(mbs_service_id_start)) { + ogs_error("OpenAPI_tmgi_range_parseFromJSON() failed [mbs_service_id_start]"); + goto end; + } + + mbs_service_id_end = cJSON_GetObjectItemCaseSensitive(tmgi_rangeJSON, "mbsServiceIdEnd"); + if (!mbs_service_id_end) { + ogs_error("OpenAPI_tmgi_range_parseFromJSON() failed [mbs_service_id_end]"); + goto end; + } + if (!cJSON_IsString(mbs_service_id_end)) { + ogs_error("OpenAPI_tmgi_range_parseFromJSON() failed [mbs_service_id_end]"); + goto end; + } + + plmn_id = cJSON_GetObjectItemCaseSensitive(tmgi_rangeJSON, "plmnId"); + if (!plmn_id) { + ogs_error("OpenAPI_tmgi_range_parseFromJSON() failed [plmn_id]"); + goto end; + } + plmn_id_local_nonprim = OpenAPI_plmn_id_parseFromJSON(plmn_id); + + nid = cJSON_GetObjectItemCaseSensitive(tmgi_rangeJSON, "nid"); + if (nid) { + if (!cJSON_IsString(nid) && !cJSON_IsNull(nid)) { + ogs_error("OpenAPI_tmgi_range_parseFromJSON() failed [nid]"); + goto end; + } + } + + tmgi_range_local_var = OpenAPI_tmgi_range_create ( + ogs_strdup(mbs_service_id_start->valuestring), + ogs_strdup(mbs_service_id_end->valuestring), + plmn_id_local_nonprim, + nid && !cJSON_IsNull(nid) ? ogs_strdup(nid->valuestring) : NULL + ); + + return tmgi_range_local_var; +end: + if (plmn_id_local_nonprim) { + OpenAPI_plmn_id_free(plmn_id_local_nonprim); + plmn_id_local_nonprim = NULL; + } + return NULL; +} + +OpenAPI_tmgi_range_t *OpenAPI_tmgi_range_copy(OpenAPI_tmgi_range_t *dst, OpenAPI_tmgi_range_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_tmgi_range_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_tmgi_range_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_tmgi_range_free(dst); + dst = OpenAPI_tmgi_range_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/tmgi_range.h b/lib/sbi/openapi/model/tmgi_range.h new file mode 100644 index 000000000..eab870608 --- /dev/null +++ b/lib/sbi/openapi/model/tmgi_range.h @@ -0,0 +1,45 @@ +/* + * tmgi_range.h + * + * Range of TMGIs + */ + +#ifndef _OpenAPI_tmgi_range_H_ +#define _OpenAPI_tmgi_range_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "plmn_id.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_tmgi_range_s OpenAPI_tmgi_range_t; +typedef struct OpenAPI_tmgi_range_s { + char *mbs_service_id_start; + char *mbs_service_id_end; + struct OpenAPI_plmn_id_s *plmn_id; + char *nid; +} OpenAPI_tmgi_range_t; + +OpenAPI_tmgi_range_t *OpenAPI_tmgi_range_create( + char *mbs_service_id_start, + char *mbs_service_id_end, + OpenAPI_plmn_id_t *plmn_id, + char *nid +); +void OpenAPI_tmgi_range_free(OpenAPI_tmgi_range_t *tmgi_range); +OpenAPI_tmgi_range_t *OpenAPI_tmgi_range_parseFromJSON(cJSON *tmgi_rangeJSON); +cJSON *OpenAPI_tmgi_range_convertToJSON(OpenAPI_tmgi_range_t *tmgi_range); +OpenAPI_tmgi_range_t *OpenAPI_tmgi_range_copy(OpenAPI_tmgi_range_t *dst, OpenAPI_tmgi_range_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_tmgi_range_H_ */ + diff --git a/lib/sbi/openapi/model/tnap_id.h b/lib/sbi/openapi/model/tnap_id.h index 55e773da5..ff29b1936 100644 --- a/lib/sbi/openapi/model/tnap_id.h +++ b/lib/sbi/openapi/model/tnap_id.h @@ -1,7 +1,7 @@ /* * tnap_id.h * - * + * Contain the TNAP Identifier see clause5.6.2 of 3GPP TS 23.501. */ #ifndef _OpenAPI_tnap_id_H_ diff --git a/lib/sbi/openapi/model/top_application.c b/lib/sbi/openapi/model/top_application.c new file mode 100644 index 000000000..5106c0608 --- /dev/null +++ b/lib/sbi/openapi/model/top_application.c @@ -0,0 +1,163 @@ + +#include +#include +#include +#include "top_application.h" + +OpenAPI_top_application_t *OpenAPI_top_application_create( + char *app_id, + OpenAPI_flow_info_t *ip_traffic_filter, + bool is_ratio, + int ratio +) +{ + OpenAPI_top_application_t *top_application_local_var = ogs_malloc(sizeof(OpenAPI_top_application_t)); + ogs_assert(top_application_local_var); + + top_application_local_var->app_id = app_id; + top_application_local_var->ip_traffic_filter = ip_traffic_filter; + top_application_local_var->is_ratio = is_ratio; + top_application_local_var->ratio = ratio; + + return top_application_local_var; +} + +void OpenAPI_top_application_free(OpenAPI_top_application_t *top_application) +{ + OpenAPI_lnode_t *node = NULL; + + if (NULL == top_application) { + return; + } + if (top_application->app_id) { + ogs_free(top_application->app_id); + top_application->app_id = NULL; + } + if (top_application->ip_traffic_filter) { + OpenAPI_flow_info_free(top_application->ip_traffic_filter); + top_application->ip_traffic_filter = NULL; + } + ogs_free(top_application); +} + +cJSON *OpenAPI_top_application_convertToJSON(OpenAPI_top_application_t *top_application) +{ + cJSON *item = NULL; + OpenAPI_lnode_t *node = NULL; + + if (top_application == NULL) { + ogs_error("OpenAPI_top_application_convertToJSON() failed [TopApplication]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (top_application->app_id) { + if (cJSON_AddStringToObject(item, "appId", top_application->app_id) == NULL) { + ogs_error("OpenAPI_top_application_convertToJSON() failed [app_id]"); + goto end; + } + } + + if (top_application->ip_traffic_filter) { + cJSON *ip_traffic_filter_local_JSON = OpenAPI_flow_info_convertToJSON(top_application->ip_traffic_filter); + if (ip_traffic_filter_local_JSON == NULL) { + ogs_error("OpenAPI_top_application_convertToJSON() failed [ip_traffic_filter]"); + goto end; + } + cJSON_AddItemToObject(item, "ipTrafficFilter", ip_traffic_filter_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_top_application_convertToJSON() failed [ip_traffic_filter]"); + goto end; + } + } + + if (top_application->is_ratio) { + if (cJSON_AddNumberToObject(item, "ratio", top_application->ratio) == NULL) { + ogs_error("OpenAPI_top_application_convertToJSON() failed [ratio]"); + goto end; + } + } + +end: + return item; +} + +OpenAPI_top_application_t *OpenAPI_top_application_parseFromJSON(cJSON *top_applicationJSON) +{ + OpenAPI_top_application_t *top_application_local_var = NULL; + OpenAPI_lnode_t *node = NULL; + cJSON *app_id = NULL; + cJSON *ip_traffic_filter = NULL; + OpenAPI_flow_info_t *ip_traffic_filter_local_nonprim = NULL; + cJSON *ratio = NULL; + app_id = cJSON_GetObjectItemCaseSensitive(top_applicationJSON, "appId"); + if (app_id) { + if (!cJSON_IsString(app_id) && !cJSON_IsNull(app_id)) { + ogs_error("OpenAPI_top_application_parseFromJSON() failed [app_id]"); + goto end; + } + } + + ip_traffic_filter = cJSON_GetObjectItemCaseSensitive(top_applicationJSON, "ipTrafficFilter"); + if (ip_traffic_filter) { + ip_traffic_filter_local_nonprim = OpenAPI_flow_info_parseFromJSON(ip_traffic_filter); + } + + ratio = cJSON_GetObjectItemCaseSensitive(top_applicationJSON, "ratio"); + if (ratio) { + if (!cJSON_IsNumber(ratio)) { + ogs_error("OpenAPI_top_application_parseFromJSON() failed [ratio]"); + goto end; + } + } + + top_application_local_var = OpenAPI_top_application_create ( + app_id && !cJSON_IsNull(app_id) ? ogs_strdup(app_id->valuestring) : NULL, + ip_traffic_filter ? ip_traffic_filter_local_nonprim : NULL, + ratio ? true : false, + ratio ? ratio->valuedouble : 0 + ); + + return top_application_local_var; +end: + if (ip_traffic_filter_local_nonprim) { + OpenAPI_flow_info_free(ip_traffic_filter_local_nonprim); + ip_traffic_filter_local_nonprim = NULL; + } + return NULL; +} + +OpenAPI_top_application_t *OpenAPI_top_application_copy(OpenAPI_top_application_t *dst, OpenAPI_top_application_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_top_application_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_top_application_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_top_application_free(dst); + dst = OpenAPI_top_application_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/top_application.h b/lib/sbi/openapi/model/top_application.h new file mode 100644 index 000000000..eae59e4d8 --- /dev/null +++ b/lib/sbi/openapi/model/top_application.h @@ -0,0 +1,45 @@ +/* + * top_application.h + * + * Top application that contributes the most to the traffic. + */ + +#ifndef _OpenAPI_top_application_H_ +#define _OpenAPI_top_application_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "flow_info.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_top_application_s OpenAPI_top_application_t; +typedef struct OpenAPI_top_application_s { + char *app_id; + struct OpenAPI_flow_info_s *ip_traffic_filter; + bool is_ratio; + int ratio; +} OpenAPI_top_application_t; + +OpenAPI_top_application_t *OpenAPI_top_application_create( + char *app_id, + OpenAPI_flow_info_t *ip_traffic_filter, + bool is_ratio, + int ratio +); +void OpenAPI_top_application_free(OpenAPI_top_application_t *top_application); +OpenAPI_top_application_t *OpenAPI_top_application_parseFromJSON(cJSON *top_applicationJSON); +cJSON *OpenAPI_top_application_convertToJSON(OpenAPI_top_application_t *top_application); +OpenAPI_top_application_t *OpenAPI_top_application_copy(OpenAPI_top_application_t *dst, OpenAPI_top_application_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_top_application_H_ */ + diff --git a/lib/sbi/openapi/model/trace_data.h b/lib/sbi/openapi/model/trace_data.h index 605f9bf63..c1e8b6bdf 100644 --- a/lib/sbi/openapi/model/trace_data.h +++ b/lib/sbi/openapi/model/trace_data.h @@ -1,7 +1,7 @@ /* * trace_data.h * - * + * contains Trace control and configuration parameters. */ #ifndef _OpenAPI_trace_data_H_ diff --git a/lib/sbi/openapi/model/trace_data_1.h b/lib/sbi/openapi/model/trace_data_1.h index 24fb9adcb..fba3278be 100644 --- a/lib/sbi/openapi/model/trace_data_1.h +++ b/lib/sbi/openapi/model/trace_data_1.h @@ -1,7 +1,7 @@ /* * trace_data_1.h * - * + * contains Trace control and configuration parameters. */ #ifndef _OpenAPI_trace_data_1_H_ diff --git a/lib/sbi/openapi/model/traffic_characterization.c b/lib/sbi/openapi/model/traffic_characterization.c new file mode 100644 index 000000000..c9f180cf8 --- /dev/null +++ b/lib/sbi/openapi/model/traffic_characterization.c @@ -0,0 +1,312 @@ + +#include +#include +#include +#include "traffic_characterization.h" + +OpenAPI_traffic_characterization_t *OpenAPI_traffic_characterization_create( + char *dnn, + OpenAPI_snssai_t *snssai, + char *app_id, + OpenAPI_list_t *f_descs, + bool is_ul_vol, + long ul_vol, + bool is_ul_vol_variance, + float ul_vol_variance, + bool is_dl_vol, + long dl_vol, + bool is_dl_vol_variance, + float dl_vol_variance +) +{ + OpenAPI_traffic_characterization_t *traffic_characterization_local_var = ogs_malloc(sizeof(OpenAPI_traffic_characterization_t)); + ogs_assert(traffic_characterization_local_var); + + traffic_characterization_local_var->dnn = dnn; + traffic_characterization_local_var->snssai = snssai; + traffic_characterization_local_var->app_id = app_id; + traffic_characterization_local_var->f_descs = f_descs; + traffic_characterization_local_var->is_ul_vol = is_ul_vol; + traffic_characterization_local_var->ul_vol = ul_vol; + traffic_characterization_local_var->is_ul_vol_variance = is_ul_vol_variance; + traffic_characterization_local_var->ul_vol_variance = ul_vol_variance; + traffic_characterization_local_var->is_dl_vol = is_dl_vol; + traffic_characterization_local_var->dl_vol = dl_vol; + traffic_characterization_local_var->is_dl_vol_variance = is_dl_vol_variance; + traffic_characterization_local_var->dl_vol_variance = dl_vol_variance; + + return traffic_characterization_local_var; +} + +void OpenAPI_traffic_characterization_free(OpenAPI_traffic_characterization_t *traffic_characterization) +{ + OpenAPI_lnode_t *node = NULL; + + if (NULL == traffic_characterization) { + return; + } + if (traffic_characterization->dnn) { + ogs_free(traffic_characterization->dnn); + traffic_characterization->dnn = NULL; + } + if (traffic_characterization->snssai) { + OpenAPI_snssai_free(traffic_characterization->snssai); + traffic_characterization->snssai = NULL; + } + if (traffic_characterization->app_id) { + ogs_free(traffic_characterization->app_id); + traffic_characterization->app_id = NULL; + } + if (traffic_characterization->f_descs) { + OpenAPI_list_for_each(traffic_characterization->f_descs, node) { + OpenAPI_ip_eth_flow_description_free(node->data); + } + OpenAPI_list_free(traffic_characterization->f_descs); + traffic_characterization->f_descs = NULL; + } + ogs_free(traffic_characterization); +} + +cJSON *OpenAPI_traffic_characterization_convertToJSON(OpenAPI_traffic_characterization_t *traffic_characterization) +{ + cJSON *item = NULL; + OpenAPI_lnode_t *node = NULL; + + if (traffic_characterization == NULL) { + ogs_error("OpenAPI_traffic_characterization_convertToJSON() failed [TrafficCharacterization]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (traffic_characterization->dnn) { + if (cJSON_AddStringToObject(item, "dnn", traffic_characterization->dnn) == NULL) { + ogs_error("OpenAPI_traffic_characterization_convertToJSON() failed [dnn]"); + goto end; + } + } + + if (traffic_characterization->snssai) { + cJSON *snssai_local_JSON = OpenAPI_snssai_convertToJSON(traffic_characterization->snssai); + if (snssai_local_JSON == NULL) { + ogs_error("OpenAPI_traffic_characterization_convertToJSON() failed [snssai]"); + goto end; + } + cJSON_AddItemToObject(item, "snssai", snssai_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_traffic_characterization_convertToJSON() failed [snssai]"); + goto end; + } + } + + if (traffic_characterization->app_id) { + if (cJSON_AddStringToObject(item, "appId", traffic_characterization->app_id) == NULL) { + ogs_error("OpenAPI_traffic_characterization_convertToJSON() failed [app_id]"); + goto end; + } + } + + if (traffic_characterization->f_descs) { + cJSON *f_descsList = cJSON_AddArrayToObject(item, "fDescs"); + if (f_descsList == NULL) { + ogs_error("OpenAPI_traffic_characterization_convertToJSON() failed [f_descs]"); + goto end; + } + OpenAPI_list_for_each(traffic_characterization->f_descs, node) { + cJSON *itemLocal = OpenAPI_ip_eth_flow_description_convertToJSON(node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_traffic_characterization_convertToJSON() failed [f_descs]"); + goto end; + } + cJSON_AddItemToArray(f_descsList, itemLocal); + } + } + + if (traffic_characterization->is_ul_vol) { + if (cJSON_AddNumberToObject(item, "ulVol", traffic_characterization->ul_vol) == NULL) { + ogs_error("OpenAPI_traffic_characterization_convertToJSON() failed [ul_vol]"); + goto end; + } + } + + if (traffic_characterization->is_ul_vol_variance) { + if (cJSON_AddNumberToObject(item, "ulVolVariance", traffic_characterization->ul_vol_variance) == NULL) { + ogs_error("OpenAPI_traffic_characterization_convertToJSON() failed [ul_vol_variance]"); + goto end; + } + } + + if (traffic_characterization->is_dl_vol) { + if (cJSON_AddNumberToObject(item, "dlVol", traffic_characterization->dl_vol) == NULL) { + ogs_error("OpenAPI_traffic_characterization_convertToJSON() failed [dl_vol]"); + goto end; + } + } + + if (traffic_characterization->is_dl_vol_variance) { + if (cJSON_AddNumberToObject(item, "dlVolVariance", traffic_characterization->dl_vol_variance) == NULL) { + ogs_error("OpenAPI_traffic_characterization_convertToJSON() failed [dl_vol_variance]"); + goto end; + } + } + +end: + return item; +} + +OpenAPI_traffic_characterization_t *OpenAPI_traffic_characterization_parseFromJSON(cJSON *traffic_characterizationJSON) +{ + OpenAPI_traffic_characterization_t *traffic_characterization_local_var = NULL; + OpenAPI_lnode_t *node = NULL; + cJSON *dnn = NULL; + cJSON *snssai = NULL; + OpenAPI_snssai_t *snssai_local_nonprim = NULL; + cJSON *app_id = NULL; + cJSON *f_descs = NULL; + OpenAPI_list_t *f_descsList = NULL; + cJSON *ul_vol = NULL; + cJSON *ul_vol_variance = NULL; + cJSON *dl_vol = NULL; + cJSON *dl_vol_variance = NULL; + dnn = cJSON_GetObjectItemCaseSensitive(traffic_characterizationJSON, "dnn"); + if (dnn) { + if (!cJSON_IsString(dnn) && !cJSON_IsNull(dnn)) { + ogs_error("OpenAPI_traffic_characterization_parseFromJSON() failed [dnn]"); + goto end; + } + } + + snssai = cJSON_GetObjectItemCaseSensitive(traffic_characterizationJSON, "snssai"); + if (snssai) { + snssai_local_nonprim = OpenAPI_snssai_parseFromJSON(snssai); + } + + app_id = cJSON_GetObjectItemCaseSensitive(traffic_characterizationJSON, "appId"); + if (app_id) { + if (!cJSON_IsString(app_id) && !cJSON_IsNull(app_id)) { + ogs_error("OpenAPI_traffic_characterization_parseFromJSON() failed [app_id]"); + goto end; + } + } + + f_descs = cJSON_GetObjectItemCaseSensitive(traffic_characterizationJSON, "fDescs"); + if (f_descs) { + cJSON *f_descs_local = NULL; + if (!cJSON_IsArray(f_descs)) { + ogs_error("OpenAPI_traffic_characterization_parseFromJSON() failed [f_descs]"); + goto end; + } + + f_descsList = OpenAPI_list_create(); + + cJSON_ArrayForEach(f_descs_local, f_descs) { + if (!cJSON_IsObject(f_descs_local)) { + ogs_error("OpenAPI_traffic_characterization_parseFromJSON() failed [f_descs]"); + goto end; + } + OpenAPI_ip_eth_flow_description_t *f_descsItem = OpenAPI_ip_eth_flow_description_parseFromJSON(f_descs_local); + if (!f_descsItem) { + ogs_error("No f_descsItem"); + OpenAPI_list_free(f_descsList); + goto end; + } + OpenAPI_list_add(f_descsList, f_descsItem); + } + } + + ul_vol = cJSON_GetObjectItemCaseSensitive(traffic_characterizationJSON, "ulVol"); + if (ul_vol) { + if (!cJSON_IsNumber(ul_vol)) { + ogs_error("OpenAPI_traffic_characterization_parseFromJSON() failed [ul_vol]"); + goto end; + } + } + + ul_vol_variance = cJSON_GetObjectItemCaseSensitive(traffic_characterizationJSON, "ulVolVariance"); + if (ul_vol_variance) { + if (!cJSON_IsNumber(ul_vol_variance)) { + ogs_error("OpenAPI_traffic_characterization_parseFromJSON() failed [ul_vol_variance]"); + goto end; + } + } + + dl_vol = cJSON_GetObjectItemCaseSensitive(traffic_characterizationJSON, "dlVol"); + if (dl_vol) { + if (!cJSON_IsNumber(dl_vol)) { + ogs_error("OpenAPI_traffic_characterization_parseFromJSON() failed [dl_vol]"); + goto end; + } + } + + dl_vol_variance = cJSON_GetObjectItemCaseSensitive(traffic_characterizationJSON, "dlVolVariance"); + if (dl_vol_variance) { + if (!cJSON_IsNumber(dl_vol_variance)) { + ogs_error("OpenAPI_traffic_characterization_parseFromJSON() failed [dl_vol_variance]"); + goto end; + } + } + + traffic_characterization_local_var = OpenAPI_traffic_characterization_create ( + dnn && !cJSON_IsNull(dnn) ? ogs_strdup(dnn->valuestring) : NULL, + snssai ? snssai_local_nonprim : NULL, + app_id && !cJSON_IsNull(app_id) ? ogs_strdup(app_id->valuestring) : NULL, + f_descs ? f_descsList : NULL, + ul_vol ? true : false, + ul_vol ? ul_vol->valuedouble : 0, + ul_vol_variance ? true : false, + ul_vol_variance ? ul_vol_variance->valuedouble : 0, + dl_vol ? true : false, + dl_vol ? dl_vol->valuedouble : 0, + dl_vol_variance ? true : false, + dl_vol_variance ? dl_vol_variance->valuedouble : 0 + ); + + return traffic_characterization_local_var; +end: + if (snssai_local_nonprim) { + OpenAPI_snssai_free(snssai_local_nonprim); + snssai_local_nonprim = NULL; + } + if (f_descsList) { + OpenAPI_list_for_each(f_descsList, node) { + OpenAPI_ip_eth_flow_description_free(node->data); + } + OpenAPI_list_free(f_descsList); + f_descsList = NULL; + } + return NULL; +} + +OpenAPI_traffic_characterization_t *OpenAPI_traffic_characterization_copy(OpenAPI_traffic_characterization_t *dst, OpenAPI_traffic_characterization_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_traffic_characterization_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_traffic_characterization_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_traffic_characterization_free(dst); + dst = OpenAPI_traffic_characterization_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/traffic_characterization.h b/lib/sbi/openapi/model/traffic_characterization.h new file mode 100644 index 000000000..a15f69931 --- /dev/null +++ b/lib/sbi/openapi/model/traffic_characterization.h @@ -0,0 +1,62 @@ +/* + * traffic_characterization.h + * + * Identifies the detailed traffic characterization. + */ + +#ifndef _OpenAPI_traffic_characterization_H_ +#define _OpenAPI_traffic_characterization_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "ip_eth_flow_description.h" +#include "snssai.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_traffic_characterization_s OpenAPI_traffic_characterization_t; +typedef struct OpenAPI_traffic_characterization_s { + char *dnn; + struct OpenAPI_snssai_s *snssai; + char *app_id; + OpenAPI_list_t *f_descs; + bool is_ul_vol; + long ul_vol; + bool is_ul_vol_variance; + float ul_vol_variance; + bool is_dl_vol; + long dl_vol; + bool is_dl_vol_variance; + float dl_vol_variance; +} OpenAPI_traffic_characterization_t; + +OpenAPI_traffic_characterization_t *OpenAPI_traffic_characterization_create( + char *dnn, + OpenAPI_snssai_t *snssai, + char *app_id, + OpenAPI_list_t *f_descs, + bool is_ul_vol, + long ul_vol, + bool is_ul_vol_variance, + float ul_vol_variance, + bool is_dl_vol, + long dl_vol, + bool is_dl_vol_variance, + float dl_vol_variance +); +void OpenAPI_traffic_characterization_free(OpenAPI_traffic_characterization_t *traffic_characterization); +OpenAPI_traffic_characterization_t *OpenAPI_traffic_characterization_parseFromJSON(cJSON *traffic_characterizationJSON); +cJSON *OpenAPI_traffic_characterization_convertToJSON(OpenAPI_traffic_characterization_t *traffic_characterization); +OpenAPI_traffic_characterization_t *OpenAPI_traffic_characterization_copy(OpenAPI_traffic_characterization_t *dst, OpenAPI_traffic_characterization_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_traffic_characterization_H_ */ + diff --git a/lib/sbi/openapi/model/traffic_control_data.c b/lib/sbi/openapi/model/traffic_control_data.c index b2cfa9f96..cc44a3136 100644 --- a/lib/sbi/openapi/model/traffic_control_data.c +++ b/lib/sbi/openapi/model/traffic_control_data.c @@ -14,13 +14,20 @@ OpenAPI_traffic_control_data_t *OpenAPI_traffic_control_data_create( char *traffic_steering_pol_id_dl, char *traffic_steering_pol_id_ul, OpenAPI_list_t *route_to_locs, + bool is_max_allowed_up_lat, + int max_allowed_up_lat, + OpenAPI_list_t *eas_ip_replace_infos, bool is_traff_corre_ind, int traff_corre_ind, + bool is_sim_conn_ind, + int sim_conn_ind, + bool is_sim_conn_term, + int sim_conn_term, OpenAPI_up_path_chg_event_t *up_path_chg_event, OpenAPI_steering_functionality_e steer_fun, OpenAPI_steering_mode_t *steer_mode_dl, OpenAPI_steering_mode_t *steer_mode_ul, - OpenAPI_multicast_access_control_t *mul_acc_ctrl + OpenAPI_npcf_multicast_access_control_e mul_acc_ctrl ) { OpenAPI_traffic_control_data_t *traffic_control_data_local_var = ogs_malloc(sizeof(OpenAPI_traffic_control_data_t)); @@ -35,8 +42,15 @@ OpenAPI_traffic_control_data_t *OpenAPI_traffic_control_data_create( traffic_control_data_local_var->traffic_steering_pol_id_dl = traffic_steering_pol_id_dl; traffic_control_data_local_var->traffic_steering_pol_id_ul = traffic_steering_pol_id_ul; traffic_control_data_local_var->route_to_locs = route_to_locs; + traffic_control_data_local_var->is_max_allowed_up_lat = is_max_allowed_up_lat; + traffic_control_data_local_var->max_allowed_up_lat = max_allowed_up_lat; + traffic_control_data_local_var->eas_ip_replace_infos = eas_ip_replace_infos; traffic_control_data_local_var->is_traff_corre_ind = is_traff_corre_ind; traffic_control_data_local_var->traff_corre_ind = traff_corre_ind; + traffic_control_data_local_var->is_sim_conn_ind = is_sim_conn_ind; + traffic_control_data_local_var->sim_conn_ind = sim_conn_ind; + traffic_control_data_local_var->is_sim_conn_term = is_sim_conn_term; + traffic_control_data_local_var->sim_conn_term = sim_conn_term; traffic_control_data_local_var->up_path_chg_event = up_path_chg_event; traffic_control_data_local_var->steer_fun = steer_fun; traffic_control_data_local_var->steer_mode_dl = steer_mode_dl; @@ -83,6 +97,13 @@ void OpenAPI_traffic_control_data_free(OpenAPI_traffic_control_data_t *traffic_c OpenAPI_list_free(traffic_control_data->route_to_locs); traffic_control_data->route_to_locs = NULL; } + if (traffic_control_data->eas_ip_replace_infos) { + OpenAPI_list_for_each(traffic_control_data->eas_ip_replace_infos, node) { + OpenAPI_eas_ip_replacement_info_free(node->data); + } + OpenAPI_list_free(traffic_control_data->eas_ip_replace_infos); + traffic_control_data->eas_ip_replace_infos = NULL; + } if (traffic_control_data->up_path_chg_event) { OpenAPI_up_path_chg_event_free(traffic_control_data->up_path_chg_event); traffic_control_data->up_path_chg_event = NULL; @@ -95,10 +116,6 @@ void OpenAPI_traffic_control_data_free(OpenAPI_traffic_control_data_t *traffic_c OpenAPI_steering_mode_free(traffic_control_data->steer_mode_ul); traffic_control_data->steer_mode_ul = NULL; } - if (traffic_control_data->mul_acc_ctrl) { - OpenAPI_multicast_access_control_free(traffic_control_data->mul_acc_ctrl); - traffic_control_data->mul_acc_ctrl = NULL; - } ogs_free(traffic_control_data); } @@ -195,6 +212,29 @@ cJSON *OpenAPI_traffic_control_data_convertToJSON(OpenAPI_traffic_control_data_t } } + if (traffic_control_data->is_max_allowed_up_lat) { + if (cJSON_AddNumberToObject(item, "maxAllowedUpLat", traffic_control_data->max_allowed_up_lat) == NULL) { + ogs_error("OpenAPI_traffic_control_data_convertToJSON() failed [max_allowed_up_lat]"); + goto end; + } + } + + if (traffic_control_data->eas_ip_replace_infos) { + cJSON *eas_ip_replace_infosList = cJSON_AddArrayToObject(item, "easIpReplaceInfos"); + if (eas_ip_replace_infosList == NULL) { + ogs_error("OpenAPI_traffic_control_data_convertToJSON() failed [eas_ip_replace_infos]"); + goto end; + } + OpenAPI_list_for_each(traffic_control_data->eas_ip_replace_infos, node) { + cJSON *itemLocal = OpenAPI_eas_ip_replacement_info_convertToJSON(node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_traffic_control_data_convertToJSON() failed [eas_ip_replace_infos]"); + goto end; + } + cJSON_AddItemToArray(eas_ip_replace_infosList, itemLocal); + } + } + if (traffic_control_data->is_traff_corre_ind) { if (cJSON_AddBoolToObject(item, "traffCorreInd", traffic_control_data->traff_corre_ind) == NULL) { ogs_error("OpenAPI_traffic_control_data_convertToJSON() failed [traff_corre_ind]"); @@ -202,6 +242,20 @@ cJSON *OpenAPI_traffic_control_data_convertToJSON(OpenAPI_traffic_control_data_t } } + if (traffic_control_data->is_sim_conn_ind) { + if (cJSON_AddBoolToObject(item, "simConnInd", traffic_control_data->sim_conn_ind) == NULL) { + ogs_error("OpenAPI_traffic_control_data_convertToJSON() failed [sim_conn_ind]"); + goto end; + } + } + + if (traffic_control_data->is_sim_conn_term) { + if (cJSON_AddNumberToObject(item, "simConnTerm", traffic_control_data->sim_conn_term) == NULL) { + ogs_error("OpenAPI_traffic_control_data_convertToJSON() failed [sim_conn_term]"); + goto end; + } + } + if (traffic_control_data->up_path_chg_event) { cJSON *up_path_chg_event_local_JSON = OpenAPI_up_path_chg_event_convertToJSON(traffic_control_data->up_path_chg_event); if (up_path_chg_event_local_JSON == NULL) { @@ -248,14 +302,8 @@ cJSON *OpenAPI_traffic_control_data_convertToJSON(OpenAPI_traffic_control_data_t } } - if (traffic_control_data->mul_acc_ctrl) { - cJSON *mul_acc_ctrl_local_JSON = OpenAPI_multicast_access_control_convertToJSON(traffic_control_data->mul_acc_ctrl); - if (mul_acc_ctrl_local_JSON == NULL) { - ogs_error("OpenAPI_traffic_control_data_convertToJSON() failed [mul_acc_ctrl]"); - goto end; - } - cJSON_AddItemToObject(item, "mulAccCtrl", mul_acc_ctrl_local_JSON); - if (item->child == NULL) { + if (traffic_control_data->mul_acc_ctrl != OpenAPI_npcf_multicast_access_control_NULL) { + if (cJSON_AddStringToObject(item, "mulAccCtrl", OpenAPI_npcf_multicast_access_control_ToString(traffic_control_data->mul_acc_ctrl)) == NULL) { ogs_error("OpenAPI_traffic_control_data_convertToJSON() failed [mul_acc_ctrl]"); goto end; } @@ -281,7 +329,12 @@ OpenAPI_traffic_control_data_t *OpenAPI_traffic_control_data_parseFromJSON(cJSON cJSON *traffic_steering_pol_id_ul = NULL; cJSON *route_to_locs = NULL; OpenAPI_list_t *route_to_locsList = NULL; + cJSON *max_allowed_up_lat = NULL; + cJSON *eas_ip_replace_infos = NULL; + OpenAPI_list_t *eas_ip_replace_infosList = NULL; cJSON *traff_corre_ind = NULL; + cJSON *sim_conn_ind = NULL; + cJSON *sim_conn_term = NULL; cJSON *up_path_chg_event = NULL; OpenAPI_up_path_chg_event_t *up_path_chg_event_local_nonprim = NULL; cJSON *steer_fun = NULL; @@ -291,7 +344,7 @@ OpenAPI_traffic_control_data_t *OpenAPI_traffic_control_data_parseFromJSON(cJSON cJSON *steer_mode_ul = NULL; OpenAPI_steering_mode_t *steer_mode_ul_local_nonprim = NULL; cJSON *mul_acc_ctrl = NULL; - OpenAPI_multicast_access_control_t *mul_acc_ctrl_local_nonprim = NULL; + OpenAPI_npcf_multicast_access_control_e mul_acc_ctrlVariable = 0; tc_id = cJSON_GetObjectItemCaseSensitive(traffic_control_dataJSON, "tcId"); if (!tc_id) { ogs_error("OpenAPI_traffic_control_data_parseFromJSON() failed [tc_id]"); @@ -390,6 +443,39 @@ OpenAPI_traffic_control_data_t *OpenAPI_traffic_control_data_parseFromJSON(cJSON } } + max_allowed_up_lat = cJSON_GetObjectItemCaseSensitive(traffic_control_dataJSON, "maxAllowedUpLat"); + if (max_allowed_up_lat) { + if (!cJSON_IsNumber(max_allowed_up_lat)) { + ogs_error("OpenAPI_traffic_control_data_parseFromJSON() failed [max_allowed_up_lat]"); + goto end; + } + } + + eas_ip_replace_infos = cJSON_GetObjectItemCaseSensitive(traffic_control_dataJSON, "easIpReplaceInfos"); + if (eas_ip_replace_infos) { + cJSON *eas_ip_replace_infos_local = NULL; + if (!cJSON_IsArray(eas_ip_replace_infos)) { + ogs_error("OpenAPI_traffic_control_data_parseFromJSON() failed [eas_ip_replace_infos]"); + goto end; + } + + eas_ip_replace_infosList = OpenAPI_list_create(); + + cJSON_ArrayForEach(eas_ip_replace_infos_local, eas_ip_replace_infos) { + if (!cJSON_IsObject(eas_ip_replace_infos_local)) { + ogs_error("OpenAPI_traffic_control_data_parseFromJSON() failed [eas_ip_replace_infos]"); + goto end; + } + OpenAPI_eas_ip_replacement_info_t *eas_ip_replace_infosItem = OpenAPI_eas_ip_replacement_info_parseFromJSON(eas_ip_replace_infos_local); + if (!eas_ip_replace_infosItem) { + ogs_error("No eas_ip_replace_infosItem"); + OpenAPI_list_free(eas_ip_replace_infosList); + goto end; + } + OpenAPI_list_add(eas_ip_replace_infosList, eas_ip_replace_infosItem); + } + } + traff_corre_ind = cJSON_GetObjectItemCaseSensitive(traffic_control_dataJSON, "traffCorreInd"); if (traff_corre_ind) { if (!cJSON_IsBool(traff_corre_ind)) { @@ -398,6 +484,22 @@ OpenAPI_traffic_control_data_t *OpenAPI_traffic_control_data_parseFromJSON(cJSON } } + sim_conn_ind = cJSON_GetObjectItemCaseSensitive(traffic_control_dataJSON, "simConnInd"); + if (sim_conn_ind) { + if (!cJSON_IsBool(sim_conn_ind)) { + ogs_error("OpenAPI_traffic_control_data_parseFromJSON() failed [sim_conn_ind]"); + goto end; + } + } + + sim_conn_term = cJSON_GetObjectItemCaseSensitive(traffic_control_dataJSON, "simConnTerm"); + if (sim_conn_term) { + if (!cJSON_IsNumber(sim_conn_term)) { + ogs_error("OpenAPI_traffic_control_data_parseFromJSON() failed [sim_conn_term]"); + goto end; + } + } + up_path_chg_event = cJSON_GetObjectItemCaseSensitive(traffic_control_dataJSON, "upPathChgEvent"); if (up_path_chg_event) { up_path_chg_event_local_nonprim = OpenAPI_up_path_chg_event_parseFromJSON(up_path_chg_event); @@ -424,7 +526,11 @@ OpenAPI_traffic_control_data_t *OpenAPI_traffic_control_data_parseFromJSON(cJSON mul_acc_ctrl = cJSON_GetObjectItemCaseSensitive(traffic_control_dataJSON, "mulAccCtrl"); if (mul_acc_ctrl) { - mul_acc_ctrl_local_nonprim = OpenAPI_multicast_access_control_parseFromJSON(mul_acc_ctrl); + if (!cJSON_IsString(mul_acc_ctrl)) { + ogs_error("OpenAPI_traffic_control_data_parseFromJSON() failed [mul_acc_ctrl]"); + goto end; + } + mul_acc_ctrlVariable = OpenAPI_npcf_multicast_access_control_FromString(mul_acc_ctrl->valuestring); } traffic_control_data_local_var = OpenAPI_traffic_control_data_create ( @@ -437,13 +543,20 @@ OpenAPI_traffic_control_data_t *OpenAPI_traffic_control_data_parseFromJSON(cJSON traffic_steering_pol_id_dl && !cJSON_IsNull(traffic_steering_pol_id_dl) ? ogs_strdup(traffic_steering_pol_id_dl->valuestring) : NULL, traffic_steering_pol_id_ul && !cJSON_IsNull(traffic_steering_pol_id_ul) ? ogs_strdup(traffic_steering_pol_id_ul->valuestring) : NULL, route_to_locs ? route_to_locsList : NULL, + max_allowed_up_lat ? true : false, + max_allowed_up_lat ? max_allowed_up_lat->valuedouble : 0, + eas_ip_replace_infos ? eas_ip_replace_infosList : NULL, traff_corre_ind ? true : false, traff_corre_ind ? traff_corre_ind->valueint : 0, + sim_conn_ind ? true : false, + sim_conn_ind ? sim_conn_ind->valueint : 0, + sim_conn_term ? true : false, + sim_conn_term ? sim_conn_term->valuedouble : 0, up_path_chg_event ? up_path_chg_event_local_nonprim : NULL, steer_fun ? steer_funVariable : 0, steer_mode_dl ? steer_mode_dl_local_nonprim : NULL, steer_mode_ul ? steer_mode_ul_local_nonprim : NULL, - mul_acc_ctrl ? mul_acc_ctrl_local_nonprim : NULL + mul_acc_ctrl ? mul_acc_ctrlVariable : 0 ); return traffic_control_data_local_var; @@ -466,6 +579,13 @@ end: OpenAPI_list_free(route_to_locsList); route_to_locsList = NULL; } + if (eas_ip_replace_infosList) { + OpenAPI_list_for_each(eas_ip_replace_infosList, node) { + OpenAPI_eas_ip_replacement_info_free(node->data); + } + OpenAPI_list_free(eas_ip_replace_infosList); + eas_ip_replace_infosList = NULL; + } if (up_path_chg_event_local_nonprim) { OpenAPI_up_path_chg_event_free(up_path_chg_event_local_nonprim); up_path_chg_event_local_nonprim = NULL; @@ -478,10 +598,6 @@ end: OpenAPI_steering_mode_free(steer_mode_ul_local_nonprim); steer_mode_ul_local_nonprim = NULL; } - if (mul_acc_ctrl_local_nonprim) { - OpenAPI_multicast_access_control_free(mul_acc_ctrl_local_nonprim); - mul_acc_ctrl_local_nonprim = NULL; - } return NULL; } diff --git a/lib/sbi/openapi/model/traffic_control_data.h b/lib/sbi/openapi/model/traffic_control_data.h index a4d34d722..8e18ab2ce 100644 --- a/lib/sbi/openapi/model/traffic_control_data.h +++ b/lib/sbi/openapi/model/traffic_control_data.h @@ -1,7 +1,7 @@ /* * traffic_control_data.h * - * + * Contains parameters determining how flows associated with a PCC Rule are treated (e.g. blocked, redirected, etc). */ #ifndef _OpenAPI_traffic_control_data_H_ @@ -12,8 +12,9 @@ #include "../include/list.h" #include "../include/keyValuePair.h" #include "../include/binary.h" +#include "eas_ip_replacement_info.h" #include "flow_status.h" -#include "multicast_access_control.h" +#include "npcf_multicast_access_control.h" #include "redirect_information.h" #include "route_to_location.h" #include "steering_functionality.h" @@ -35,13 +36,20 @@ typedef struct OpenAPI_traffic_control_data_s { char *traffic_steering_pol_id_dl; char *traffic_steering_pol_id_ul; OpenAPI_list_t *route_to_locs; + bool is_max_allowed_up_lat; + int max_allowed_up_lat; + OpenAPI_list_t *eas_ip_replace_infos; bool is_traff_corre_ind; int traff_corre_ind; + bool is_sim_conn_ind; + int sim_conn_ind; + bool is_sim_conn_term; + int sim_conn_term; struct OpenAPI_up_path_chg_event_s *up_path_chg_event; OpenAPI_steering_functionality_e steer_fun; struct OpenAPI_steering_mode_s *steer_mode_dl; struct OpenAPI_steering_mode_s *steer_mode_ul; - struct OpenAPI_multicast_access_control_s *mul_acc_ctrl; + OpenAPI_npcf_multicast_access_control_e mul_acc_ctrl; } OpenAPI_traffic_control_data_t; OpenAPI_traffic_control_data_t *OpenAPI_traffic_control_data_create( @@ -54,13 +62,20 @@ OpenAPI_traffic_control_data_t *OpenAPI_traffic_control_data_create( char *traffic_steering_pol_id_dl, char *traffic_steering_pol_id_ul, OpenAPI_list_t *route_to_locs, + bool is_max_allowed_up_lat, + int max_allowed_up_lat, + OpenAPI_list_t *eas_ip_replace_infos, bool is_traff_corre_ind, int traff_corre_ind, + bool is_sim_conn_ind, + int sim_conn_ind, + bool is_sim_conn_term, + int sim_conn_term, OpenAPI_up_path_chg_event_t *up_path_chg_event, OpenAPI_steering_functionality_e steer_fun, OpenAPI_steering_mode_t *steer_mode_dl, OpenAPI_steering_mode_t *steer_mode_ul, - OpenAPI_multicast_access_control_t *mul_acc_ctrl + OpenAPI_npcf_multicast_access_control_e mul_acc_ctrl ); void OpenAPI_traffic_control_data_free(OpenAPI_traffic_control_data_t *traffic_control_data); OpenAPI_traffic_control_data_t *OpenAPI_traffic_control_data_parseFromJSON(cJSON *traffic_control_dataJSON); diff --git a/lib/sbi/openapi/model/traffic_descriptor.h b/lib/sbi/openapi/model/traffic_descriptor.h index 0b96890f2..5cc10a342 100644 --- a/lib/sbi/openapi/model/traffic_descriptor.h +++ b/lib/sbi/openapi/model/traffic_descriptor.h @@ -1,7 +1,7 @@ /* * traffic_descriptor.h * - * + * Represents the Traffic Descriptor */ #ifndef _OpenAPI_traffic_descriptor_H_ diff --git a/lib/sbi/openapi/model/traffic_descriptor_components.c b/lib/sbi/openapi/model/traffic_descriptor_components.c new file mode 100644 index 000000000..9d0c3e519 --- /dev/null +++ b/lib/sbi/openapi/model/traffic_descriptor_components.c @@ -0,0 +1,442 @@ + +#include +#include +#include +#include "traffic_descriptor_components.h" + +OpenAPI_traffic_descriptor_components_t *OpenAPI_traffic_descriptor_components_create( + OpenAPI_list_t* app_descs, + OpenAPI_list_t *flow_descs, + OpenAPI_list_t *domain_descs, + OpenAPI_list_t *eth_flow_descs, + OpenAPI_list_t *dnns, + OpenAPI_list_t *conn_caps +) +{ + OpenAPI_traffic_descriptor_components_t *traffic_descriptor_components_local_var = ogs_malloc(sizeof(OpenAPI_traffic_descriptor_components_t)); + ogs_assert(traffic_descriptor_components_local_var); + + traffic_descriptor_components_local_var->app_descs = app_descs; + traffic_descriptor_components_local_var->flow_descs = flow_descs; + traffic_descriptor_components_local_var->domain_descs = domain_descs; + traffic_descriptor_components_local_var->eth_flow_descs = eth_flow_descs; + traffic_descriptor_components_local_var->dnns = dnns; + traffic_descriptor_components_local_var->conn_caps = conn_caps; + + return traffic_descriptor_components_local_var; +} + +void OpenAPI_traffic_descriptor_components_free(OpenAPI_traffic_descriptor_components_t *traffic_descriptor_components) +{ + OpenAPI_lnode_t *node = NULL; + + if (NULL == traffic_descriptor_components) { + return; + } + if (traffic_descriptor_components->app_descs) { + OpenAPI_list_for_each(traffic_descriptor_components->app_descs, node) { + OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*)node->data; + ogs_free(localKeyValue->key); + OpenAPI_app_descriptor_1_free(localKeyValue->value); + OpenAPI_map_free(localKeyValue); + } + OpenAPI_list_free(traffic_descriptor_components->app_descs); + traffic_descriptor_components->app_descs = NULL; + } + if (traffic_descriptor_components->flow_descs) { + OpenAPI_list_for_each(traffic_descriptor_components->flow_descs, node) { + ogs_free(node->data); + } + OpenAPI_list_free(traffic_descriptor_components->flow_descs); + traffic_descriptor_components->flow_descs = NULL; + } + if (traffic_descriptor_components->domain_descs) { + OpenAPI_list_for_each(traffic_descriptor_components->domain_descs, node) { + ogs_free(node->data); + } + OpenAPI_list_free(traffic_descriptor_components->domain_descs); + traffic_descriptor_components->domain_descs = NULL; + } + if (traffic_descriptor_components->eth_flow_descs) { + OpenAPI_list_for_each(traffic_descriptor_components->eth_flow_descs, node) { + OpenAPI_eth_flow_description_free(node->data); + } + OpenAPI_list_free(traffic_descriptor_components->eth_flow_descs); + traffic_descriptor_components->eth_flow_descs = NULL; + } + if (traffic_descriptor_components->dnns) { + OpenAPI_list_for_each(traffic_descriptor_components->dnns, node) { + ogs_free(node->data); + } + OpenAPI_list_free(traffic_descriptor_components->dnns); + traffic_descriptor_components->dnns = NULL; + } + if (traffic_descriptor_components->conn_caps) { + OpenAPI_list_for_each(traffic_descriptor_components->conn_caps, node) { + OpenAPI_connection_capabilities_free(node->data); + } + OpenAPI_list_free(traffic_descriptor_components->conn_caps); + traffic_descriptor_components->conn_caps = NULL; + } + ogs_free(traffic_descriptor_components); +} + +cJSON *OpenAPI_traffic_descriptor_components_convertToJSON(OpenAPI_traffic_descriptor_components_t *traffic_descriptor_components) +{ + cJSON *item = NULL; + OpenAPI_lnode_t *node = NULL; + + if (traffic_descriptor_components == NULL) { + ogs_error("OpenAPI_traffic_descriptor_components_convertToJSON() failed [TrafficDescriptorComponents]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (traffic_descriptor_components->app_descs) { + cJSON *app_descs = cJSON_AddObjectToObject(item, "appDescs"); + if (app_descs == NULL) { + ogs_error("OpenAPI_traffic_descriptor_components_convertToJSON() failed [app_descs]"); + goto end; + } + cJSON *localMapObject = app_descs; + if (traffic_descriptor_components->app_descs) { + OpenAPI_list_for_each(traffic_descriptor_components->app_descs, node) { + OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*)node->data; + cJSON *itemLocal = localKeyValue->value ? + OpenAPI_app_descriptor_1_convertToJSON(localKeyValue->value) : + cJSON_CreateNull(); + if (itemLocal == NULL) { + ogs_error("OpenAPI_traffic_descriptor_components_convertToJSON() failed [inner]"); + goto end; + } + cJSON_AddItemToObject(localMapObject, localKeyValue->key, itemLocal); + } + } + } + + if (traffic_descriptor_components->flow_descs) { + cJSON *flow_descsList = cJSON_AddArrayToObject(item, "flowDescs"); + if (flow_descsList == NULL) { + ogs_error("OpenAPI_traffic_descriptor_components_convertToJSON() failed [flow_descs]"); + goto end; + } + OpenAPI_list_for_each(traffic_descriptor_components->flow_descs, node) { + if (cJSON_AddStringToObject(flow_descsList, "", (char*)node->data) == NULL) { + ogs_error("OpenAPI_traffic_descriptor_components_convertToJSON() failed [flow_descs]"); + goto end; + } + } + } + + if (traffic_descriptor_components->domain_descs) { + cJSON *domain_descsList = cJSON_AddArrayToObject(item, "domainDescs"); + if (domain_descsList == NULL) { + ogs_error("OpenAPI_traffic_descriptor_components_convertToJSON() failed [domain_descs]"); + goto end; + } + OpenAPI_list_for_each(traffic_descriptor_components->domain_descs, node) { + if (cJSON_AddStringToObject(domain_descsList, "", (char*)node->data) == NULL) { + ogs_error("OpenAPI_traffic_descriptor_components_convertToJSON() failed [domain_descs]"); + goto end; + } + } + } + + if (traffic_descriptor_components->eth_flow_descs) { + cJSON *eth_flow_descsList = cJSON_AddArrayToObject(item, "ethFlowDescs"); + if (eth_flow_descsList == NULL) { + ogs_error("OpenAPI_traffic_descriptor_components_convertToJSON() failed [eth_flow_descs]"); + goto end; + } + OpenAPI_list_for_each(traffic_descriptor_components->eth_flow_descs, node) { + cJSON *itemLocal = OpenAPI_eth_flow_description_convertToJSON(node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_traffic_descriptor_components_convertToJSON() failed [eth_flow_descs]"); + goto end; + } + cJSON_AddItemToArray(eth_flow_descsList, itemLocal); + } + } + + if (traffic_descriptor_components->dnns) { + cJSON *dnnsList = cJSON_AddArrayToObject(item, "dnns"); + if (dnnsList == NULL) { + ogs_error("OpenAPI_traffic_descriptor_components_convertToJSON() failed [dnns]"); + goto end; + } + OpenAPI_list_for_each(traffic_descriptor_components->dnns, node) { + if (cJSON_AddStringToObject(dnnsList, "", (char*)node->data) == NULL) { + ogs_error("OpenAPI_traffic_descriptor_components_convertToJSON() failed [dnns]"); + goto end; + } + } + } + + if (traffic_descriptor_components->conn_caps) { + cJSON *conn_capsList = cJSON_AddArrayToObject(item, "connCaps"); + if (conn_capsList == NULL) { + ogs_error("OpenAPI_traffic_descriptor_components_convertToJSON() failed [conn_caps]"); + goto end; + } + OpenAPI_list_for_each(traffic_descriptor_components->conn_caps, node) { + cJSON *itemLocal = OpenAPI_connection_capabilities_convertToJSON(node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_traffic_descriptor_components_convertToJSON() failed [conn_caps]"); + goto end; + } + cJSON_AddItemToArray(conn_capsList, itemLocal); + } + } + +end: + return item; +} + +OpenAPI_traffic_descriptor_components_t *OpenAPI_traffic_descriptor_components_parseFromJSON(cJSON *traffic_descriptor_componentsJSON) +{ + OpenAPI_traffic_descriptor_components_t *traffic_descriptor_components_local_var = NULL; + OpenAPI_lnode_t *node = NULL; + cJSON *app_descs = NULL; + OpenAPI_list_t *app_descsList = NULL; + cJSON *flow_descs = NULL; + OpenAPI_list_t *flow_descsList = NULL; + cJSON *domain_descs = NULL; + OpenAPI_list_t *domain_descsList = NULL; + cJSON *eth_flow_descs = NULL; + OpenAPI_list_t *eth_flow_descsList = NULL; + cJSON *dnns = NULL; + OpenAPI_list_t *dnnsList = NULL; + cJSON *conn_caps = NULL; + OpenAPI_list_t *conn_capsList = NULL; + app_descs = cJSON_GetObjectItemCaseSensitive(traffic_descriptor_componentsJSON, "appDescs"); + if (app_descs) { + cJSON *app_descs_local_map = NULL; + if (!cJSON_IsObject(app_descs) && !cJSON_IsNull(app_descs)) { + ogs_error("OpenAPI_traffic_descriptor_components_parseFromJSON() failed [app_descs]"); + goto end; + } + if (cJSON_IsObject(app_descs)) { + app_descsList = OpenAPI_list_create(); + OpenAPI_map_t *localMapKeyPair = NULL; + cJSON_ArrayForEach(app_descs_local_map, app_descs) { + cJSON *localMapObject = app_descs_local_map; + if (cJSON_IsObject(localMapObject)) { + localMapKeyPair = OpenAPI_map_create( + ogs_strdup(localMapObject->string), OpenAPI_app_descriptor_1_parseFromJSON(localMapObject)); + } else if (cJSON_IsNull(localMapObject)) { + localMapKeyPair = OpenAPI_map_create(ogs_strdup(localMapObject->string), NULL); + } else { + ogs_error("OpenAPI_traffic_descriptor_components_parseFromJSON() failed [inner]"); + goto end; + } + OpenAPI_list_add(app_descsList, localMapKeyPair); + } + } + } + + flow_descs = cJSON_GetObjectItemCaseSensitive(traffic_descriptor_componentsJSON, "flowDescs"); + if (flow_descs) { + cJSON *flow_descs_local = NULL; + if (!cJSON_IsArray(flow_descs)) { + ogs_error("OpenAPI_traffic_descriptor_components_parseFromJSON() failed [flow_descs]"); + goto end; + } + + flow_descsList = OpenAPI_list_create(); + + cJSON_ArrayForEach(flow_descs_local, flow_descs) { + double *localDouble = NULL; + int *localInt = NULL; + if (!cJSON_IsString(flow_descs_local)) { + ogs_error("OpenAPI_traffic_descriptor_components_parseFromJSON() failed [flow_descs]"); + goto end; + } + OpenAPI_list_add(flow_descsList, ogs_strdup(flow_descs_local->valuestring)); + } + } + + domain_descs = cJSON_GetObjectItemCaseSensitive(traffic_descriptor_componentsJSON, "domainDescs"); + if (domain_descs) { + cJSON *domain_descs_local = NULL; + if (!cJSON_IsArray(domain_descs)) { + ogs_error("OpenAPI_traffic_descriptor_components_parseFromJSON() failed [domain_descs]"); + goto end; + } + + domain_descsList = OpenAPI_list_create(); + + cJSON_ArrayForEach(domain_descs_local, domain_descs) { + double *localDouble = NULL; + int *localInt = NULL; + if (!cJSON_IsString(domain_descs_local)) { + ogs_error("OpenAPI_traffic_descriptor_components_parseFromJSON() failed [domain_descs]"); + goto end; + } + OpenAPI_list_add(domain_descsList, ogs_strdup(domain_descs_local->valuestring)); + } + } + + eth_flow_descs = cJSON_GetObjectItemCaseSensitive(traffic_descriptor_componentsJSON, "ethFlowDescs"); + if (eth_flow_descs) { + cJSON *eth_flow_descs_local = NULL; + if (!cJSON_IsArray(eth_flow_descs)) { + ogs_error("OpenAPI_traffic_descriptor_components_parseFromJSON() failed [eth_flow_descs]"); + goto end; + } + + eth_flow_descsList = OpenAPI_list_create(); + + cJSON_ArrayForEach(eth_flow_descs_local, eth_flow_descs) { + if (!cJSON_IsObject(eth_flow_descs_local)) { + ogs_error("OpenAPI_traffic_descriptor_components_parseFromJSON() failed [eth_flow_descs]"); + goto end; + } + OpenAPI_eth_flow_description_t *eth_flow_descsItem = OpenAPI_eth_flow_description_parseFromJSON(eth_flow_descs_local); + if (!eth_flow_descsItem) { + ogs_error("No eth_flow_descsItem"); + OpenAPI_list_free(eth_flow_descsList); + goto end; + } + OpenAPI_list_add(eth_flow_descsList, eth_flow_descsItem); + } + } + + dnns = cJSON_GetObjectItemCaseSensitive(traffic_descriptor_componentsJSON, "dnns"); + if (dnns) { + cJSON *dnns_local = NULL; + if (!cJSON_IsArray(dnns)) { + ogs_error("OpenAPI_traffic_descriptor_components_parseFromJSON() failed [dnns]"); + goto end; + } + + dnnsList = OpenAPI_list_create(); + + cJSON_ArrayForEach(dnns_local, dnns) { + double *localDouble = NULL; + int *localInt = NULL; + if (!cJSON_IsString(dnns_local)) { + ogs_error("OpenAPI_traffic_descriptor_components_parseFromJSON() failed [dnns]"); + goto end; + } + OpenAPI_list_add(dnnsList, ogs_strdup(dnns_local->valuestring)); + } + } + + conn_caps = cJSON_GetObjectItemCaseSensitive(traffic_descriptor_componentsJSON, "connCaps"); + if (conn_caps) { + cJSON *conn_caps_local = NULL; + if (!cJSON_IsArray(conn_caps)) { + ogs_error("OpenAPI_traffic_descriptor_components_parseFromJSON() failed [conn_caps]"); + goto end; + } + + conn_capsList = OpenAPI_list_create(); + + cJSON_ArrayForEach(conn_caps_local, conn_caps) { + if (!cJSON_IsObject(conn_caps_local)) { + ogs_error("OpenAPI_traffic_descriptor_components_parseFromJSON() failed [conn_caps]"); + goto end; + } + OpenAPI_connection_capabilities_t *conn_capsItem = OpenAPI_connection_capabilities_parseFromJSON(conn_caps_local); + if (!conn_capsItem) { + ogs_error("No conn_capsItem"); + OpenAPI_list_free(conn_capsList); + goto end; + } + OpenAPI_list_add(conn_capsList, conn_capsItem); + } + } + + traffic_descriptor_components_local_var = OpenAPI_traffic_descriptor_components_create ( + app_descs ? app_descsList : NULL, + flow_descs ? flow_descsList : NULL, + domain_descs ? domain_descsList : NULL, + eth_flow_descs ? eth_flow_descsList : NULL, + dnns ? dnnsList : NULL, + conn_caps ? conn_capsList : NULL + ); + + return traffic_descriptor_components_local_var; +end: + if (app_descsList) { + OpenAPI_list_for_each(app_descsList, node) { + OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*) node->data; + ogs_free(localKeyValue->key); + OpenAPI_app_descriptor_1_free(localKeyValue->value); + OpenAPI_map_free(localKeyValue); + } + OpenAPI_list_free(app_descsList); + app_descsList = NULL; + } + if (flow_descsList) { + OpenAPI_list_for_each(flow_descsList, node) { + ogs_free(node->data); + } + OpenAPI_list_free(flow_descsList); + flow_descsList = NULL; + } + if (domain_descsList) { + OpenAPI_list_for_each(domain_descsList, node) { + ogs_free(node->data); + } + OpenAPI_list_free(domain_descsList); + domain_descsList = NULL; + } + if (eth_flow_descsList) { + OpenAPI_list_for_each(eth_flow_descsList, node) { + OpenAPI_eth_flow_description_free(node->data); + } + OpenAPI_list_free(eth_flow_descsList); + eth_flow_descsList = NULL; + } + if (dnnsList) { + OpenAPI_list_for_each(dnnsList, node) { + ogs_free(node->data); + } + OpenAPI_list_free(dnnsList); + dnnsList = NULL; + } + if (conn_capsList) { + OpenAPI_list_for_each(conn_capsList, node) { + OpenAPI_connection_capabilities_free(node->data); + } + OpenAPI_list_free(conn_capsList); + conn_capsList = NULL; + } + return NULL; +} + +OpenAPI_traffic_descriptor_components_t *OpenAPI_traffic_descriptor_components_copy(OpenAPI_traffic_descriptor_components_t *dst, OpenAPI_traffic_descriptor_components_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_traffic_descriptor_components_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_traffic_descriptor_components_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_traffic_descriptor_components_free(dst); + dst = OpenAPI_traffic_descriptor_components_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/traffic_descriptor_components.h b/lib/sbi/openapi/model/traffic_descriptor_components.h new file mode 100644 index 000000000..176c828f9 --- /dev/null +++ b/lib/sbi/openapi/model/traffic_descriptor_components.h @@ -0,0 +1,51 @@ +/* + * traffic_descriptor_components.h + * + * Traffic descriptor components for the requested URSP. + */ + +#ifndef _OpenAPI_traffic_descriptor_components_H_ +#define _OpenAPI_traffic_descriptor_components_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "app_descriptor_1.h" +#include "connection_capabilities.h" +#include "eth_flow_description.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_traffic_descriptor_components_s OpenAPI_traffic_descriptor_components_t; +typedef struct OpenAPI_traffic_descriptor_components_s { + OpenAPI_list_t* app_descs; + OpenAPI_list_t *flow_descs; + OpenAPI_list_t *domain_descs; + OpenAPI_list_t *eth_flow_descs; + OpenAPI_list_t *dnns; + OpenAPI_list_t *conn_caps; +} OpenAPI_traffic_descriptor_components_t; + +OpenAPI_traffic_descriptor_components_t *OpenAPI_traffic_descriptor_components_create( + OpenAPI_list_t* app_descs, + OpenAPI_list_t *flow_descs, + OpenAPI_list_t *domain_descs, + OpenAPI_list_t *eth_flow_descs, + OpenAPI_list_t *dnns, + OpenAPI_list_t *conn_caps +); +void OpenAPI_traffic_descriptor_components_free(OpenAPI_traffic_descriptor_components_t *traffic_descriptor_components); +OpenAPI_traffic_descriptor_components_t *OpenAPI_traffic_descriptor_components_parseFromJSON(cJSON *traffic_descriptor_componentsJSON); +cJSON *OpenAPI_traffic_descriptor_components_convertToJSON(OpenAPI_traffic_descriptor_components_t *traffic_descriptor_components); +OpenAPI_traffic_descriptor_components_t *OpenAPI_traffic_descriptor_components_copy(OpenAPI_traffic_descriptor_components_t *dst, OpenAPI_traffic_descriptor_components_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_traffic_descriptor_components_H_ */ + diff --git a/lib/sbi/openapi/model/traffic_influ_data.c b/lib/sbi/openapi/model/traffic_influ_data.c index 0ccef378b..b6ced012f 100644 --- a/lib/sbi/openapi/model/traffic_influ_data.c +++ b/lib/sbi/openapi/model/traffic_influ_data.c @@ -21,7 +21,7 @@ OpenAPI_traffic_influ_data_t *OpenAPI_traffic_influ_data_create( char *valid_start_time, char *valid_end_time, OpenAPI_list_t *temp_validities, - OpenAPI_network_area_info_1_t *nw_area_info, + OpenAPI_network_area_info_2_t *nw_area_info, char *up_path_chg_notif_uri, OpenAPI_list_t *headers, OpenAPI_list_t *subscribed_events, @@ -30,8 +30,15 @@ OpenAPI_traffic_influ_data_t *OpenAPI_traffic_influ_data_create( int af_ack_ind, bool is_addr_preser_ind, int addr_preser_ind, + bool is_max_allowed_up_lat, + int max_allowed_up_lat, + bool is_sim_conn_ind, + int sim_conn_ind, + bool is_sim_conn_term, + int sim_conn_term, char *supported_features, - char *res_uri + char *res_uri, + OpenAPI_list_t *reset_ids ) { OpenAPI_traffic_influ_data_t *traffic_influ_data_local_var = ogs_malloc(sizeof(OpenAPI_traffic_influ_data_t)); @@ -62,8 +69,15 @@ OpenAPI_traffic_influ_data_t *OpenAPI_traffic_influ_data_create( traffic_influ_data_local_var->af_ack_ind = af_ack_ind; traffic_influ_data_local_var->is_addr_preser_ind = is_addr_preser_ind; traffic_influ_data_local_var->addr_preser_ind = addr_preser_ind; + traffic_influ_data_local_var->is_max_allowed_up_lat = is_max_allowed_up_lat; + traffic_influ_data_local_var->max_allowed_up_lat = max_allowed_up_lat; + traffic_influ_data_local_var->is_sim_conn_ind = is_sim_conn_ind; + traffic_influ_data_local_var->sim_conn_ind = sim_conn_ind; + traffic_influ_data_local_var->is_sim_conn_term = is_sim_conn_term; + traffic_influ_data_local_var->sim_conn_term = sim_conn_term; traffic_influ_data_local_var->supported_features = supported_features; traffic_influ_data_local_var->res_uri = res_uri; + traffic_influ_data_local_var->reset_ids = reset_ids; return traffic_influ_data_local_var; } @@ -136,7 +150,7 @@ void OpenAPI_traffic_influ_data_free(OpenAPI_traffic_influ_data_t *traffic_influ traffic_influ_data->temp_validities = NULL; } if (traffic_influ_data->nw_area_info) { - OpenAPI_network_area_info_1_free(traffic_influ_data->nw_area_info); + OpenAPI_network_area_info_2_free(traffic_influ_data->nw_area_info); traffic_influ_data->nw_area_info = NULL; } if (traffic_influ_data->up_path_chg_notif_uri) { @@ -165,6 +179,13 @@ void OpenAPI_traffic_influ_data_free(OpenAPI_traffic_influ_data_t *traffic_influ ogs_free(traffic_influ_data->res_uri); traffic_influ_data->res_uri = NULL; } + if (traffic_influ_data->reset_ids) { + OpenAPI_list_for_each(traffic_influ_data->reset_ids, node) { + ogs_free(node->data); + } + OpenAPI_list_free(traffic_influ_data->reset_ids); + traffic_influ_data->reset_ids = NULL; + } ogs_free(traffic_influ_data); } @@ -320,7 +341,7 @@ cJSON *OpenAPI_traffic_influ_data_convertToJSON(OpenAPI_traffic_influ_data_t *tr } if (traffic_influ_data->nw_area_info) { - cJSON *nw_area_info_local_JSON = OpenAPI_network_area_info_1_convertToJSON(traffic_influ_data->nw_area_info); + cJSON *nw_area_info_local_JSON = OpenAPI_network_area_info_2_convertToJSON(traffic_influ_data->nw_area_info); if (nw_area_info_local_JSON == NULL) { ogs_error("OpenAPI_traffic_influ_data_convertToJSON() failed [nw_area_info]"); goto end; @@ -390,6 +411,27 @@ cJSON *OpenAPI_traffic_influ_data_convertToJSON(OpenAPI_traffic_influ_data_t *tr } } + if (traffic_influ_data->is_max_allowed_up_lat) { + if (cJSON_AddNumberToObject(item, "maxAllowedUpLat", traffic_influ_data->max_allowed_up_lat) == NULL) { + ogs_error("OpenAPI_traffic_influ_data_convertToJSON() failed [max_allowed_up_lat]"); + goto end; + } + } + + if (traffic_influ_data->is_sim_conn_ind) { + if (cJSON_AddBoolToObject(item, "simConnInd", traffic_influ_data->sim_conn_ind) == NULL) { + ogs_error("OpenAPI_traffic_influ_data_convertToJSON() failed [sim_conn_ind]"); + goto end; + } + } + + if (traffic_influ_data->is_sim_conn_term) { + if (cJSON_AddNumberToObject(item, "simConnTerm", traffic_influ_data->sim_conn_term) == NULL) { + ogs_error("OpenAPI_traffic_influ_data_convertToJSON() failed [sim_conn_term]"); + goto end; + } + } + if (traffic_influ_data->supported_features) { if (cJSON_AddStringToObject(item, "supportedFeatures", traffic_influ_data->supported_features) == NULL) { ogs_error("OpenAPI_traffic_influ_data_convertToJSON() failed [supported_features]"); @@ -404,6 +446,20 @@ cJSON *OpenAPI_traffic_influ_data_convertToJSON(OpenAPI_traffic_influ_data_t *tr } } + if (traffic_influ_data->reset_ids) { + cJSON *reset_idsList = cJSON_AddArrayToObject(item, "resetIds"); + if (reset_idsList == NULL) { + ogs_error("OpenAPI_traffic_influ_data_convertToJSON() failed [reset_ids]"); + goto end; + } + OpenAPI_list_for_each(traffic_influ_data->reset_ids, node) { + if (cJSON_AddStringToObject(reset_idsList, "", (char*)node->data) == NULL) { + ogs_error("OpenAPI_traffic_influ_data_convertToJSON() failed [reset_ids]"); + goto end; + } + } + } + end: return item; } @@ -432,7 +488,7 @@ OpenAPI_traffic_influ_data_t *OpenAPI_traffic_influ_data_parseFromJSON(cJSON *tr cJSON *temp_validities = NULL; OpenAPI_list_t *temp_validitiesList = NULL; cJSON *nw_area_info = NULL; - OpenAPI_network_area_info_1_t *nw_area_info_local_nonprim = NULL; + OpenAPI_network_area_info_2_t *nw_area_info_local_nonprim = NULL; cJSON *up_path_chg_notif_uri = NULL; cJSON *headers = NULL; OpenAPI_list_t *headersList = NULL; @@ -442,8 +498,13 @@ OpenAPI_traffic_influ_data_t *OpenAPI_traffic_influ_data_parseFromJSON(cJSON *tr OpenAPI_dnai_change_type_e dnai_chg_typeVariable = 0; cJSON *af_ack_ind = NULL; cJSON *addr_preser_ind = NULL; + cJSON *max_allowed_up_lat = NULL; + cJSON *sim_conn_ind = NULL; + cJSON *sim_conn_term = NULL; cJSON *supported_features = NULL; cJSON *res_uri = NULL; + cJSON *reset_ids = NULL; + OpenAPI_list_t *reset_idsList = NULL; up_path_chg_notif_corre_id = cJSON_GetObjectItemCaseSensitive(traffic_influ_dataJSON, "upPathChgNotifCorreId"); if (up_path_chg_notif_corre_id) { if (!cJSON_IsString(up_path_chg_notif_corre_id) && !cJSON_IsNull(up_path_chg_notif_corre_id)) { @@ -623,7 +684,7 @@ OpenAPI_traffic_influ_data_t *OpenAPI_traffic_influ_data_parseFromJSON(cJSON *tr nw_area_info = cJSON_GetObjectItemCaseSensitive(traffic_influ_dataJSON, "nwAreaInfo"); if (nw_area_info) { - nw_area_info_local_nonprim = OpenAPI_network_area_info_1_parseFromJSON(nw_area_info); + nw_area_info_local_nonprim = OpenAPI_network_area_info_2_parseFromJSON(nw_area_info); } up_path_chg_notif_uri = cJSON_GetObjectItemCaseSensitive(traffic_influ_dataJSON, "upPathChgNotifUri"); @@ -705,6 +766,30 @@ OpenAPI_traffic_influ_data_t *OpenAPI_traffic_influ_data_parseFromJSON(cJSON *tr } } + max_allowed_up_lat = cJSON_GetObjectItemCaseSensitive(traffic_influ_dataJSON, "maxAllowedUpLat"); + if (max_allowed_up_lat) { + if (!cJSON_IsNumber(max_allowed_up_lat)) { + ogs_error("OpenAPI_traffic_influ_data_parseFromJSON() failed [max_allowed_up_lat]"); + goto end; + } + } + + sim_conn_ind = cJSON_GetObjectItemCaseSensitive(traffic_influ_dataJSON, "simConnInd"); + if (sim_conn_ind) { + if (!cJSON_IsBool(sim_conn_ind)) { + ogs_error("OpenAPI_traffic_influ_data_parseFromJSON() failed [sim_conn_ind]"); + goto end; + } + } + + sim_conn_term = cJSON_GetObjectItemCaseSensitive(traffic_influ_dataJSON, "simConnTerm"); + if (sim_conn_term) { + if (!cJSON_IsNumber(sim_conn_term)) { + ogs_error("OpenAPI_traffic_influ_data_parseFromJSON() failed [sim_conn_term]"); + goto end; + } + } + supported_features = cJSON_GetObjectItemCaseSensitive(traffic_influ_dataJSON, "supportedFeatures"); if (supported_features) { if (!cJSON_IsString(supported_features) && !cJSON_IsNull(supported_features)) { @@ -721,6 +806,27 @@ OpenAPI_traffic_influ_data_t *OpenAPI_traffic_influ_data_parseFromJSON(cJSON *tr } } + reset_ids = cJSON_GetObjectItemCaseSensitive(traffic_influ_dataJSON, "resetIds"); + if (reset_ids) { + cJSON *reset_ids_local = NULL; + if (!cJSON_IsArray(reset_ids)) { + ogs_error("OpenAPI_traffic_influ_data_parseFromJSON() failed [reset_ids]"); + goto end; + } + + reset_idsList = OpenAPI_list_create(); + + cJSON_ArrayForEach(reset_ids_local, reset_ids) { + double *localDouble = NULL; + int *localInt = NULL; + if (!cJSON_IsString(reset_ids_local)) { + ogs_error("OpenAPI_traffic_influ_data_parseFromJSON() failed [reset_ids]"); + goto end; + } + OpenAPI_list_add(reset_idsList, ogs_strdup(reset_ids_local->valuestring)); + } + } + traffic_influ_data_local_var = OpenAPI_traffic_influ_data_create ( up_path_chg_notif_corre_id && !cJSON_IsNull(up_path_chg_notif_corre_id) ? ogs_strdup(up_path_chg_notif_corre_id->valuestring) : NULL, app_relo_ind ? true : false, @@ -747,8 +853,15 @@ OpenAPI_traffic_influ_data_t *OpenAPI_traffic_influ_data_parseFromJSON(cJSON *tr af_ack_ind ? af_ack_ind->valueint : 0, addr_preser_ind ? true : false, addr_preser_ind ? addr_preser_ind->valueint : 0, + max_allowed_up_lat ? true : false, + max_allowed_up_lat ? max_allowed_up_lat->valuedouble : 0, + sim_conn_ind ? true : false, + sim_conn_ind ? sim_conn_ind->valueint : 0, + sim_conn_term ? true : false, + sim_conn_term ? sim_conn_term->valuedouble : 0, supported_features && !cJSON_IsNull(supported_features) ? ogs_strdup(supported_features->valuestring) : NULL, - res_uri && !cJSON_IsNull(res_uri) ? ogs_strdup(res_uri->valuestring) : NULL + res_uri && !cJSON_IsNull(res_uri) ? ogs_strdup(res_uri->valuestring) : NULL, + reset_ids ? reset_idsList : NULL ); return traffic_influ_data_local_var; @@ -786,7 +899,7 @@ end: temp_validitiesList = NULL; } if (nw_area_info_local_nonprim) { - OpenAPI_network_area_info_1_free(nw_area_info_local_nonprim); + OpenAPI_network_area_info_2_free(nw_area_info_local_nonprim); nw_area_info_local_nonprim = NULL; } if (headersList) { @@ -803,6 +916,13 @@ end: OpenAPI_list_free(subscribed_eventsList); subscribed_eventsList = NULL; } + if (reset_idsList) { + OpenAPI_list_for_each(reset_idsList, node) { + ogs_free(node->data); + } + OpenAPI_list_free(reset_idsList); + reset_idsList = NULL; + } return NULL; } diff --git a/lib/sbi/openapi/model/traffic_influ_data.h b/lib/sbi/openapi/model/traffic_influ_data.h index 30d047e71..37639ea77 100644 --- a/lib/sbi/openapi/model/traffic_influ_data.h +++ b/lib/sbi/openapi/model/traffic_influ_data.h @@ -1,7 +1,7 @@ /* * traffic_influ_data.h * - * + * Represents the Traffic Influence Data. */ #ifndef _OpenAPI_traffic_influ_data_H_ @@ -15,7 +15,7 @@ #include "dnai_change_type.h" #include "eth_flow_description.h" #include "flow_info.h" -#include "network_area_info_1.h" +#include "network_area_info_2.h" #include "route_to_location.h" #include "snssai.h" #include "subscribed_event.h" @@ -43,7 +43,7 @@ typedef struct OpenAPI_traffic_influ_data_s { char *valid_start_time; char *valid_end_time; OpenAPI_list_t *temp_validities; - struct OpenAPI_network_area_info_1_s *nw_area_info; + struct OpenAPI_network_area_info_2_s *nw_area_info; char *up_path_chg_notif_uri; OpenAPI_list_t *headers; OpenAPI_list_t *subscribed_events; @@ -52,8 +52,15 @@ typedef struct OpenAPI_traffic_influ_data_s { int af_ack_ind; bool is_addr_preser_ind; int addr_preser_ind; + bool is_max_allowed_up_lat; + int max_allowed_up_lat; + bool is_sim_conn_ind; + int sim_conn_ind; + bool is_sim_conn_term; + int sim_conn_term; char *supported_features; char *res_uri; + OpenAPI_list_t *reset_ids; } OpenAPI_traffic_influ_data_t; OpenAPI_traffic_influ_data_t *OpenAPI_traffic_influ_data_create( @@ -73,7 +80,7 @@ OpenAPI_traffic_influ_data_t *OpenAPI_traffic_influ_data_create( char *valid_start_time, char *valid_end_time, OpenAPI_list_t *temp_validities, - OpenAPI_network_area_info_1_t *nw_area_info, + OpenAPI_network_area_info_2_t *nw_area_info, char *up_path_chg_notif_uri, OpenAPI_list_t *headers, OpenAPI_list_t *subscribed_events, @@ -82,8 +89,15 @@ OpenAPI_traffic_influ_data_t *OpenAPI_traffic_influ_data_create( int af_ack_ind, bool is_addr_preser_ind, int addr_preser_ind, + bool is_max_allowed_up_lat, + int max_allowed_up_lat, + bool is_sim_conn_ind, + int sim_conn_ind, + bool is_sim_conn_term, + int sim_conn_term, char *supported_features, - char *res_uri + char *res_uri, + OpenAPI_list_t *reset_ids ); void OpenAPI_traffic_influ_data_free(OpenAPI_traffic_influ_data_t *traffic_influ_data); OpenAPI_traffic_influ_data_t *OpenAPI_traffic_influ_data_parseFromJSON(cJSON *traffic_influ_dataJSON); diff --git a/lib/sbi/openapi/model/traffic_influ_data_notif.h b/lib/sbi/openapi/model/traffic_influ_data_notif.h index 4445e7f3e..e9901cec1 100644 --- a/lib/sbi/openapi/model/traffic_influ_data_notif.h +++ b/lib/sbi/openapi/model/traffic_influ_data_notif.h @@ -1,7 +1,7 @@ /* * traffic_influ_data_notif.h * - * + * Represents traffic influence data for notification. */ #ifndef _OpenAPI_traffic_influ_data_notif_H_ diff --git a/lib/sbi/openapi/model/traffic_influ_data_patch.c b/lib/sbi/openapi/model/traffic_influ_data_patch.c index 8b67f573a..96f852c93 100644 --- a/lib/sbi/openapi/model/traffic_influ_data_patch.c +++ b/lib/sbi/openapi/model/traffic_influ_data_patch.c @@ -8,11 +8,7 @@ OpenAPI_traffic_influ_data_patch_t *OpenAPI_traffic_influ_data_patch_create( char *up_path_chg_notif_corre_id, bool is_app_relo_ind, int app_relo_ind, - char *dnn, OpenAPI_list_t *eth_traffic_filters, - OpenAPI_snssai_t *snssai, - char *internal_group_id, - char *supi, OpenAPI_list_t *traffic_filters, OpenAPI_list_t *traffic_routes, bool is_traff_corre_ind, @@ -20,13 +16,19 @@ OpenAPI_traffic_influ_data_patch_t *OpenAPI_traffic_influ_data_patch_create( char *valid_start_time, char *valid_end_time, OpenAPI_list_t *temp_validities, - OpenAPI_network_area_info_1_t *nw_area_info, + OpenAPI_network_area_info_2_t *nw_area_info, char *up_path_chg_notif_uri, OpenAPI_list_t *headers, bool is_af_ack_ind, int af_ack_ind, bool is_addr_preser_ind, - int addr_preser_ind + int addr_preser_ind, + bool is_max_allowed_up_lat, + int max_allowed_up_lat, + bool is_sim_conn_ind, + int sim_conn_ind, + bool is_sim_conn_term, + int sim_conn_term ) { OpenAPI_traffic_influ_data_patch_t *traffic_influ_data_patch_local_var = ogs_malloc(sizeof(OpenAPI_traffic_influ_data_patch_t)); @@ -35,11 +37,7 @@ OpenAPI_traffic_influ_data_patch_t *OpenAPI_traffic_influ_data_patch_create( traffic_influ_data_patch_local_var->up_path_chg_notif_corre_id = up_path_chg_notif_corre_id; traffic_influ_data_patch_local_var->is_app_relo_ind = is_app_relo_ind; traffic_influ_data_patch_local_var->app_relo_ind = app_relo_ind; - traffic_influ_data_patch_local_var->dnn = dnn; traffic_influ_data_patch_local_var->eth_traffic_filters = eth_traffic_filters; - traffic_influ_data_patch_local_var->snssai = snssai; - traffic_influ_data_patch_local_var->internal_group_id = internal_group_id; - traffic_influ_data_patch_local_var->supi = supi; traffic_influ_data_patch_local_var->traffic_filters = traffic_filters; traffic_influ_data_patch_local_var->traffic_routes = traffic_routes; traffic_influ_data_patch_local_var->is_traff_corre_ind = is_traff_corre_ind; @@ -54,6 +52,12 @@ OpenAPI_traffic_influ_data_patch_t *OpenAPI_traffic_influ_data_patch_create( traffic_influ_data_patch_local_var->af_ack_ind = af_ack_ind; traffic_influ_data_patch_local_var->is_addr_preser_ind = is_addr_preser_ind; traffic_influ_data_patch_local_var->addr_preser_ind = addr_preser_ind; + traffic_influ_data_patch_local_var->is_max_allowed_up_lat = is_max_allowed_up_lat; + traffic_influ_data_patch_local_var->max_allowed_up_lat = max_allowed_up_lat; + traffic_influ_data_patch_local_var->is_sim_conn_ind = is_sim_conn_ind; + traffic_influ_data_patch_local_var->sim_conn_ind = sim_conn_ind; + traffic_influ_data_patch_local_var->is_sim_conn_term = is_sim_conn_term; + traffic_influ_data_patch_local_var->sim_conn_term = sim_conn_term; return traffic_influ_data_patch_local_var; } @@ -69,10 +73,6 @@ void OpenAPI_traffic_influ_data_patch_free(OpenAPI_traffic_influ_data_patch_t *t ogs_free(traffic_influ_data_patch->up_path_chg_notif_corre_id); traffic_influ_data_patch->up_path_chg_notif_corre_id = NULL; } - if (traffic_influ_data_patch->dnn) { - ogs_free(traffic_influ_data_patch->dnn); - traffic_influ_data_patch->dnn = NULL; - } if (traffic_influ_data_patch->eth_traffic_filters) { OpenAPI_list_for_each(traffic_influ_data_patch->eth_traffic_filters, node) { OpenAPI_eth_flow_description_free(node->data); @@ -80,18 +80,6 @@ void OpenAPI_traffic_influ_data_patch_free(OpenAPI_traffic_influ_data_patch_t *t OpenAPI_list_free(traffic_influ_data_patch->eth_traffic_filters); traffic_influ_data_patch->eth_traffic_filters = NULL; } - if (traffic_influ_data_patch->snssai) { - OpenAPI_snssai_free(traffic_influ_data_patch->snssai); - traffic_influ_data_patch->snssai = NULL; - } - if (traffic_influ_data_patch->internal_group_id) { - ogs_free(traffic_influ_data_patch->internal_group_id); - traffic_influ_data_patch->internal_group_id = NULL; - } - if (traffic_influ_data_patch->supi) { - ogs_free(traffic_influ_data_patch->supi); - traffic_influ_data_patch->supi = NULL; - } if (traffic_influ_data_patch->traffic_filters) { OpenAPI_list_for_each(traffic_influ_data_patch->traffic_filters, node) { OpenAPI_flow_info_free(node->data); @@ -122,7 +110,7 @@ void OpenAPI_traffic_influ_data_patch_free(OpenAPI_traffic_influ_data_patch_t *t traffic_influ_data_patch->temp_validities = NULL; } if (traffic_influ_data_patch->nw_area_info) { - OpenAPI_network_area_info_1_free(traffic_influ_data_patch->nw_area_info); + OpenAPI_network_area_info_2_free(traffic_influ_data_patch->nw_area_info); traffic_influ_data_patch->nw_area_info = NULL; } if (traffic_influ_data_patch->up_path_chg_notif_uri) { @@ -164,13 +152,6 @@ cJSON *OpenAPI_traffic_influ_data_patch_convertToJSON(OpenAPI_traffic_influ_data } } - if (traffic_influ_data_patch->dnn) { - if (cJSON_AddStringToObject(item, "dnn", traffic_influ_data_patch->dnn) == NULL) { - ogs_error("OpenAPI_traffic_influ_data_patch_convertToJSON() failed [dnn]"); - goto end; - } - } - if (traffic_influ_data_patch->eth_traffic_filters) { cJSON *eth_traffic_filtersList = cJSON_AddArrayToObject(item, "ethTrafficFilters"); if (eth_traffic_filtersList == NULL) { @@ -187,33 +168,6 @@ cJSON *OpenAPI_traffic_influ_data_patch_convertToJSON(OpenAPI_traffic_influ_data } } - if (traffic_influ_data_patch->snssai) { - cJSON *snssai_local_JSON = OpenAPI_snssai_convertToJSON(traffic_influ_data_patch->snssai); - if (snssai_local_JSON == NULL) { - ogs_error("OpenAPI_traffic_influ_data_patch_convertToJSON() failed [snssai]"); - goto end; - } - cJSON_AddItemToObject(item, "snssai", snssai_local_JSON); - if (item->child == NULL) { - ogs_error("OpenAPI_traffic_influ_data_patch_convertToJSON() failed [snssai]"); - goto end; - } - } - - if (traffic_influ_data_patch->internal_group_id) { - if (cJSON_AddStringToObject(item, "internalGroupId", traffic_influ_data_patch->internal_group_id) == NULL) { - ogs_error("OpenAPI_traffic_influ_data_patch_convertToJSON() failed [internal_group_id]"); - goto end; - } - } - - if (traffic_influ_data_patch->supi) { - if (cJSON_AddStringToObject(item, "supi", traffic_influ_data_patch->supi) == NULL) { - ogs_error("OpenAPI_traffic_influ_data_patch_convertToJSON() failed [supi]"); - goto end; - } - } - if (traffic_influ_data_patch->traffic_filters) { cJSON *traffic_filtersList = cJSON_AddArrayToObject(item, "trafficFilters"); if (traffic_filtersList == NULL) { @@ -284,7 +238,7 @@ cJSON *OpenAPI_traffic_influ_data_patch_convertToJSON(OpenAPI_traffic_influ_data } if (traffic_influ_data_patch->nw_area_info) { - cJSON *nw_area_info_local_JSON = OpenAPI_network_area_info_1_convertToJSON(traffic_influ_data_patch->nw_area_info); + cJSON *nw_area_info_local_JSON = OpenAPI_network_area_info_2_convertToJSON(traffic_influ_data_patch->nw_area_info); if (nw_area_info_local_JSON == NULL) { ogs_error("OpenAPI_traffic_influ_data_patch_convertToJSON() failed [nw_area_info]"); goto end; @@ -331,6 +285,27 @@ cJSON *OpenAPI_traffic_influ_data_patch_convertToJSON(OpenAPI_traffic_influ_data } } + if (traffic_influ_data_patch->is_max_allowed_up_lat) { + if (cJSON_AddNumberToObject(item, "maxAllowedUpLat", traffic_influ_data_patch->max_allowed_up_lat) == NULL) { + ogs_error("OpenAPI_traffic_influ_data_patch_convertToJSON() failed [max_allowed_up_lat]"); + goto end; + } + } + + if (traffic_influ_data_patch->is_sim_conn_ind) { + if (cJSON_AddBoolToObject(item, "simConnInd", traffic_influ_data_patch->sim_conn_ind) == NULL) { + ogs_error("OpenAPI_traffic_influ_data_patch_convertToJSON() failed [sim_conn_ind]"); + goto end; + } + } + + if (traffic_influ_data_patch->is_sim_conn_term) { + if (cJSON_AddNumberToObject(item, "simConnTerm", traffic_influ_data_patch->sim_conn_term) == NULL) { + ogs_error("OpenAPI_traffic_influ_data_patch_convertToJSON() failed [sim_conn_term]"); + goto end; + } + } + end: return item; } @@ -341,13 +316,8 @@ OpenAPI_traffic_influ_data_patch_t *OpenAPI_traffic_influ_data_patch_parseFromJS OpenAPI_lnode_t *node = NULL; cJSON *up_path_chg_notif_corre_id = NULL; cJSON *app_relo_ind = NULL; - cJSON *dnn = NULL; cJSON *eth_traffic_filters = NULL; OpenAPI_list_t *eth_traffic_filtersList = NULL; - cJSON *snssai = NULL; - OpenAPI_snssai_t *snssai_local_nonprim = NULL; - cJSON *internal_group_id = NULL; - cJSON *supi = NULL; cJSON *traffic_filters = NULL; OpenAPI_list_t *traffic_filtersList = NULL; cJSON *traffic_routes = NULL; @@ -358,12 +328,15 @@ OpenAPI_traffic_influ_data_patch_t *OpenAPI_traffic_influ_data_patch_parseFromJS cJSON *temp_validities = NULL; OpenAPI_list_t *temp_validitiesList = NULL; cJSON *nw_area_info = NULL; - OpenAPI_network_area_info_1_t *nw_area_info_local_nonprim = NULL; + OpenAPI_network_area_info_2_t *nw_area_info_local_nonprim = NULL; cJSON *up_path_chg_notif_uri = NULL; cJSON *headers = NULL; OpenAPI_list_t *headersList = NULL; cJSON *af_ack_ind = NULL; cJSON *addr_preser_ind = NULL; + cJSON *max_allowed_up_lat = NULL; + cJSON *sim_conn_ind = NULL; + cJSON *sim_conn_term = NULL; up_path_chg_notif_corre_id = cJSON_GetObjectItemCaseSensitive(traffic_influ_data_patchJSON, "upPathChgNotifCorreId"); if (up_path_chg_notif_corre_id) { if (!cJSON_IsString(up_path_chg_notif_corre_id) && !cJSON_IsNull(up_path_chg_notif_corre_id)) { @@ -380,14 +353,6 @@ OpenAPI_traffic_influ_data_patch_t *OpenAPI_traffic_influ_data_patch_parseFromJS } } - dnn = cJSON_GetObjectItemCaseSensitive(traffic_influ_data_patchJSON, "dnn"); - if (dnn) { - if (!cJSON_IsString(dnn) && !cJSON_IsNull(dnn)) { - ogs_error("OpenAPI_traffic_influ_data_patch_parseFromJSON() failed [dnn]"); - goto end; - } - } - eth_traffic_filters = cJSON_GetObjectItemCaseSensitive(traffic_influ_data_patchJSON, "ethTrafficFilters"); if (eth_traffic_filters) { cJSON *eth_traffic_filters_local = NULL; @@ -413,27 +378,6 @@ OpenAPI_traffic_influ_data_patch_t *OpenAPI_traffic_influ_data_patch_parseFromJS } } - snssai = cJSON_GetObjectItemCaseSensitive(traffic_influ_data_patchJSON, "snssai"); - if (snssai) { - snssai_local_nonprim = OpenAPI_snssai_parseFromJSON(snssai); - } - - internal_group_id = cJSON_GetObjectItemCaseSensitive(traffic_influ_data_patchJSON, "internalGroupId"); - if (internal_group_id) { - if (!cJSON_IsString(internal_group_id) && !cJSON_IsNull(internal_group_id)) { - ogs_error("OpenAPI_traffic_influ_data_patch_parseFromJSON() failed [internal_group_id]"); - goto end; - } - } - - supi = cJSON_GetObjectItemCaseSensitive(traffic_influ_data_patchJSON, "supi"); - if (supi) { - if (!cJSON_IsString(supi) && !cJSON_IsNull(supi)) { - ogs_error("OpenAPI_traffic_influ_data_patch_parseFromJSON() failed [supi]"); - goto end; - } - } - traffic_filters = cJSON_GetObjectItemCaseSensitive(traffic_influ_data_patchJSON, "trafficFilters"); if (traffic_filters) { cJSON *traffic_filters_local = NULL; @@ -535,7 +479,7 @@ OpenAPI_traffic_influ_data_patch_t *OpenAPI_traffic_influ_data_patch_parseFromJS nw_area_info = cJSON_GetObjectItemCaseSensitive(traffic_influ_data_patchJSON, "nwAreaInfo"); if (nw_area_info) { - nw_area_info_local_nonprim = OpenAPI_network_area_info_1_parseFromJSON(nw_area_info); + nw_area_info_local_nonprim = OpenAPI_network_area_info_2_parseFromJSON(nw_area_info); } up_path_chg_notif_uri = cJSON_GetObjectItemCaseSensitive(traffic_influ_data_patchJSON, "upPathChgNotifUri"); @@ -583,15 +527,35 @@ OpenAPI_traffic_influ_data_patch_t *OpenAPI_traffic_influ_data_patch_parseFromJS } } + max_allowed_up_lat = cJSON_GetObjectItemCaseSensitive(traffic_influ_data_patchJSON, "maxAllowedUpLat"); + if (max_allowed_up_lat) { + if (!cJSON_IsNumber(max_allowed_up_lat)) { + ogs_error("OpenAPI_traffic_influ_data_patch_parseFromJSON() failed [max_allowed_up_lat]"); + goto end; + } + } + + sim_conn_ind = cJSON_GetObjectItemCaseSensitive(traffic_influ_data_patchJSON, "simConnInd"); + if (sim_conn_ind) { + if (!cJSON_IsBool(sim_conn_ind)) { + ogs_error("OpenAPI_traffic_influ_data_patch_parseFromJSON() failed [sim_conn_ind]"); + goto end; + } + } + + sim_conn_term = cJSON_GetObjectItemCaseSensitive(traffic_influ_data_patchJSON, "simConnTerm"); + if (sim_conn_term) { + if (!cJSON_IsNumber(sim_conn_term)) { + ogs_error("OpenAPI_traffic_influ_data_patch_parseFromJSON() failed [sim_conn_term]"); + goto end; + } + } + traffic_influ_data_patch_local_var = OpenAPI_traffic_influ_data_patch_create ( up_path_chg_notif_corre_id && !cJSON_IsNull(up_path_chg_notif_corre_id) ? ogs_strdup(up_path_chg_notif_corre_id->valuestring) : NULL, app_relo_ind ? true : false, app_relo_ind ? app_relo_ind->valueint : 0, - dnn && !cJSON_IsNull(dnn) ? ogs_strdup(dnn->valuestring) : NULL, eth_traffic_filters ? eth_traffic_filtersList : NULL, - snssai ? snssai_local_nonprim : NULL, - internal_group_id && !cJSON_IsNull(internal_group_id) ? ogs_strdup(internal_group_id->valuestring) : NULL, - supi && !cJSON_IsNull(supi) ? ogs_strdup(supi->valuestring) : NULL, traffic_filters ? traffic_filtersList : NULL, traffic_routes ? traffic_routesList : NULL, traff_corre_ind ? true : false, @@ -605,7 +569,13 @@ OpenAPI_traffic_influ_data_patch_t *OpenAPI_traffic_influ_data_patch_parseFromJS af_ack_ind ? true : false, af_ack_ind ? af_ack_ind->valueint : 0, addr_preser_ind ? true : false, - addr_preser_ind ? addr_preser_ind->valueint : 0 + addr_preser_ind ? addr_preser_ind->valueint : 0, + max_allowed_up_lat ? true : false, + max_allowed_up_lat ? max_allowed_up_lat->valuedouble : 0, + sim_conn_ind ? true : false, + sim_conn_ind ? sim_conn_ind->valueint : 0, + sim_conn_term ? true : false, + sim_conn_term ? sim_conn_term->valuedouble : 0 ); return traffic_influ_data_patch_local_var; @@ -617,10 +587,6 @@ end: OpenAPI_list_free(eth_traffic_filtersList); eth_traffic_filtersList = NULL; } - if (snssai_local_nonprim) { - OpenAPI_snssai_free(snssai_local_nonprim); - snssai_local_nonprim = NULL; - } if (traffic_filtersList) { OpenAPI_list_for_each(traffic_filtersList, node) { OpenAPI_flow_info_free(node->data); @@ -643,7 +609,7 @@ end: temp_validitiesList = NULL; } if (nw_area_info_local_nonprim) { - OpenAPI_network_area_info_1_free(nw_area_info_local_nonprim); + OpenAPI_network_area_info_2_free(nw_area_info_local_nonprim); nw_area_info_local_nonprim = NULL; } if (headersList) { diff --git a/lib/sbi/openapi/model/traffic_influ_data_patch.h b/lib/sbi/openapi/model/traffic_influ_data_patch.h index b5b513622..8aa1c1485 100644 --- a/lib/sbi/openapi/model/traffic_influ_data_patch.h +++ b/lib/sbi/openapi/model/traffic_influ_data_patch.h @@ -1,7 +1,7 @@ /* * traffic_influ_data_patch.h * - * + * Represents the Traffic Influence Data to be updated in the UDR. */ #ifndef _OpenAPI_traffic_influ_data_patch_H_ @@ -14,9 +14,8 @@ #include "../include/binary.h" #include "eth_flow_description.h" #include "flow_info.h" -#include "network_area_info_1.h" +#include "network_area_info_2.h" #include "route_to_location.h" -#include "snssai.h" #include "temporal_validity.h" #ifdef __cplusplus @@ -28,11 +27,7 @@ typedef struct OpenAPI_traffic_influ_data_patch_s { char *up_path_chg_notif_corre_id; bool is_app_relo_ind; int app_relo_ind; - char *dnn; OpenAPI_list_t *eth_traffic_filters; - struct OpenAPI_snssai_s *snssai; - char *internal_group_id; - char *supi; OpenAPI_list_t *traffic_filters; OpenAPI_list_t *traffic_routes; bool is_traff_corre_ind; @@ -40,24 +35,26 @@ typedef struct OpenAPI_traffic_influ_data_patch_s { char *valid_start_time; char *valid_end_time; OpenAPI_list_t *temp_validities; - struct OpenAPI_network_area_info_1_s *nw_area_info; + struct OpenAPI_network_area_info_2_s *nw_area_info; char *up_path_chg_notif_uri; OpenAPI_list_t *headers; bool is_af_ack_ind; int af_ack_ind; bool is_addr_preser_ind; int addr_preser_ind; + bool is_max_allowed_up_lat; + int max_allowed_up_lat; + bool is_sim_conn_ind; + int sim_conn_ind; + bool is_sim_conn_term; + int sim_conn_term; } OpenAPI_traffic_influ_data_patch_t; OpenAPI_traffic_influ_data_patch_t *OpenAPI_traffic_influ_data_patch_create( char *up_path_chg_notif_corre_id, bool is_app_relo_ind, int app_relo_ind, - char *dnn, OpenAPI_list_t *eth_traffic_filters, - OpenAPI_snssai_t *snssai, - char *internal_group_id, - char *supi, OpenAPI_list_t *traffic_filters, OpenAPI_list_t *traffic_routes, bool is_traff_corre_ind, @@ -65,13 +62,19 @@ OpenAPI_traffic_influ_data_patch_t *OpenAPI_traffic_influ_data_patch_create( char *valid_start_time, char *valid_end_time, OpenAPI_list_t *temp_validities, - OpenAPI_network_area_info_1_t *nw_area_info, + OpenAPI_network_area_info_2_t *nw_area_info, char *up_path_chg_notif_uri, OpenAPI_list_t *headers, bool is_af_ack_ind, int af_ack_ind, bool is_addr_preser_ind, - int addr_preser_ind + int addr_preser_ind, + bool is_max_allowed_up_lat, + int max_allowed_up_lat, + bool is_sim_conn_ind, + int sim_conn_ind, + bool is_sim_conn_term, + int sim_conn_term ); void OpenAPI_traffic_influ_data_patch_free(OpenAPI_traffic_influ_data_patch_t *traffic_influ_data_patch); OpenAPI_traffic_influ_data_patch_t *OpenAPI_traffic_influ_data_patch_parseFromJSON(cJSON *traffic_influ_data_patchJSON); diff --git a/lib/sbi/openapi/model/traffic_influ_sub.c b/lib/sbi/openapi/model/traffic_influ_sub.c index b442ac0b5..84c153023 100644 --- a/lib/sbi/openapi/model/traffic_influ_sub.c +++ b/lib/sbi/openapi/model/traffic_influ_sub.c @@ -11,7 +11,8 @@ OpenAPI_traffic_influ_sub_t *OpenAPI_traffic_influ_sub_create( OpenAPI_list_t *supis, char *notification_uri, char *expiry, - char *supported_features + char *supported_features, + OpenAPI_list_t *reset_ids ) { OpenAPI_traffic_influ_sub_t *traffic_influ_sub_local_var = ogs_malloc(sizeof(OpenAPI_traffic_influ_sub_t)); @@ -24,6 +25,7 @@ OpenAPI_traffic_influ_sub_t *OpenAPI_traffic_influ_sub_create( traffic_influ_sub_local_var->notification_uri = notification_uri; traffic_influ_sub_local_var->expiry = expiry; traffic_influ_sub_local_var->supported_features = supported_features; + traffic_influ_sub_local_var->reset_ids = reset_ids; return traffic_influ_sub_local_var; } @@ -75,6 +77,13 @@ void OpenAPI_traffic_influ_sub_free(OpenAPI_traffic_influ_sub_t *traffic_influ_s ogs_free(traffic_influ_sub->supported_features); traffic_influ_sub->supported_features = NULL; } + if (traffic_influ_sub->reset_ids) { + OpenAPI_list_for_each(traffic_influ_sub->reset_ids, node) { + ogs_free(node->data); + } + OpenAPI_list_free(traffic_influ_sub->reset_ids); + traffic_influ_sub->reset_ids = NULL; + } ogs_free(traffic_influ_sub); } @@ -170,6 +179,20 @@ cJSON *OpenAPI_traffic_influ_sub_convertToJSON(OpenAPI_traffic_influ_sub_t *traf } } + if (traffic_influ_sub->reset_ids) { + cJSON *reset_idsList = cJSON_AddArrayToObject(item, "resetIds"); + if (reset_idsList == NULL) { + ogs_error("OpenAPI_traffic_influ_sub_convertToJSON() failed [reset_ids]"); + goto end; + } + OpenAPI_list_for_each(traffic_influ_sub->reset_ids, node) { + if (cJSON_AddStringToObject(reset_idsList, "", (char*)node->data) == NULL) { + ogs_error("OpenAPI_traffic_influ_sub_convertToJSON() failed [reset_ids]"); + goto end; + } + } + } + end: return item; } @@ -189,6 +212,8 @@ OpenAPI_traffic_influ_sub_t *OpenAPI_traffic_influ_sub_parseFromJSON(cJSON *traf cJSON *notification_uri = NULL; cJSON *expiry = NULL; cJSON *supported_features = NULL; + cJSON *reset_ids = NULL; + OpenAPI_list_t *reset_idsList = NULL; dnns = cJSON_GetObjectItemCaseSensitive(traffic_influ_subJSON, "dnns"); if (dnns) { cJSON *dnns_local = NULL; @@ -303,6 +328,27 @@ OpenAPI_traffic_influ_sub_t *OpenAPI_traffic_influ_sub_parseFromJSON(cJSON *traf } } + reset_ids = cJSON_GetObjectItemCaseSensitive(traffic_influ_subJSON, "resetIds"); + if (reset_ids) { + cJSON *reset_ids_local = NULL; + if (!cJSON_IsArray(reset_ids)) { + ogs_error("OpenAPI_traffic_influ_sub_parseFromJSON() failed [reset_ids]"); + goto end; + } + + reset_idsList = OpenAPI_list_create(); + + cJSON_ArrayForEach(reset_ids_local, reset_ids) { + double *localDouble = NULL; + int *localInt = NULL; + if (!cJSON_IsString(reset_ids_local)) { + ogs_error("OpenAPI_traffic_influ_sub_parseFromJSON() failed [reset_ids]"); + goto end; + } + OpenAPI_list_add(reset_idsList, ogs_strdup(reset_ids_local->valuestring)); + } + } + traffic_influ_sub_local_var = OpenAPI_traffic_influ_sub_create ( dnns ? dnnsList : NULL, snssais ? snssaisList : NULL, @@ -310,7 +356,8 @@ OpenAPI_traffic_influ_sub_t *OpenAPI_traffic_influ_sub_parseFromJSON(cJSON *traf supis ? supisList : NULL, ogs_strdup(notification_uri->valuestring), expiry && !cJSON_IsNull(expiry) ? ogs_strdup(expiry->valuestring) : NULL, - supported_features && !cJSON_IsNull(supported_features) ? ogs_strdup(supported_features->valuestring) : NULL + supported_features && !cJSON_IsNull(supported_features) ? ogs_strdup(supported_features->valuestring) : NULL, + reset_ids ? reset_idsList : NULL ); return traffic_influ_sub_local_var; @@ -343,6 +390,13 @@ end: OpenAPI_list_free(supisList); supisList = NULL; } + if (reset_idsList) { + OpenAPI_list_for_each(reset_idsList, node) { + ogs_free(node->data); + } + OpenAPI_list_free(reset_idsList); + reset_idsList = NULL; + } return NULL; } diff --git a/lib/sbi/openapi/model/traffic_influ_sub.h b/lib/sbi/openapi/model/traffic_influ_sub.h index 0621e23bf..c5a795cc9 100644 --- a/lib/sbi/openapi/model/traffic_influ_sub.h +++ b/lib/sbi/openapi/model/traffic_influ_sub.h @@ -1,7 +1,7 @@ /* * traffic_influ_sub.h * - * + * Represents traffic influence subscription data. */ #ifndef _OpenAPI_traffic_influ_sub_H_ @@ -27,6 +27,7 @@ typedef struct OpenAPI_traffic_influ_sub_s { char *notification_uri; char *expiry; char *supported_features; + OpenAPI_list_t *reset_ids; } OpenAPI_traffic_influ_sub_t; OpenAPI_traffic_influ_sub_t *OpenAPI_traffic_influ_sub_create( @@ -36,7 +37,8 @@ OpenAPI_traffic_influ_sub_t *OpenAPI_traffic_influ_sub_create( OpenAPI_list_t *supis, char *notification_uri, char *expiry, - char *supported_features + char *supported_features, + OpenAPI_list_t *reset_ids ); void OpenAPI_traffic_influ_sub_free(OpenAPI_traffic_influ_sub_t *traffic_influ_sub); OpenAPI_traffic_influ_sub_t *OpenAPI_traffic_influ_sub_parseFromJSON(cJSON *traffic_influ_subJSON); diff --git a/lib/sbi/openapi/model/traffic_information.c b/lib/sbi/openapi/model/traffic_information.c new file mode 100644 index 000000000..e7cf17bf9 --- /dev/null +++ b/lib/sbi/openapi/model/traffic_information.c @@ -0,0 +1,199 @@ + +#include +#include +#include +#include "traffic_information.h" + +OpenAPI_traffic_information_t *OpenAPI_traffic_information_create( + char *uplink_rate, + char *downlink_rate, + bool is_uplink_volume, + long uplink_volume, + bool is_downlink_volume, + long downlink_volume, + bool is_total_volume, + long total_volume +) +{ + OpenAPI_traffic_information_t *traffic_information_local_var = ogs_malloc(sizeof(OpenAPI_traffic_information_t)); + ogs_assert(traffic_information_local_var); + + traffic_information_local_var->uplink_rate = uplink_rate; + traffic_information_local_var->downlink_rate = downlink_rate; + traffic_information_local_var->is_uplink_volume = is_uplink_volume; + traffic_information_local_var->uplink_volume = uplink_volume; + traffic_information_local_var->is_downlink_volume = is_downlink_volume; + traffic_information_local_var->downlink_volume = downlink_volume; + traffic_information_local_var->is_total_volume = is_total_volume; + traffic_information_local_var->total_volume = total_volume; + + return traffic_information_local_var; +} + +void OpenAPI_traffic_information_free(OpenAPI_traffic_information_t *traffic_information) +{ + OpenAPI_lnode_t *node = NULL; + + if (NULL == traffic_information) { + return; + } + if (traffic_information->uplink_rate) { + ogs_free(traffic_information->uplink_rate); + traffic_information->uplink_rate = NULL; + } + if (traffic_information->downlink_rate) { + ogs_free(traffic_information->downlink_rate); + traffic_information->downlink_rate = NULL; + } + ogs_free(traffic_information); +} + +cJSON *OpenAPI_traffic_information_convertToJSON(OpenAPI_traffic_information_t *traffic_information) +{ + cJSON *item = NULL; + OpenAPI_lnode_t *node = NULL; + + if (traffic_information == NULL) { + ogs_error("OpenAPI_traffic_information_convertToJSON() failed [TrafficInformation]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (traffic_information->uplink_rate) { + if (cJSON_AddStringToObject(item, "uplinkRate", traffic_information->uplink_rate) == NULL) { + ogs_error("OpenAPI_traffic_information_convertToJSON() failed [uplink_rate]"); + goto end; + } + } + + if (traffic_information->downlink_rate) { + if (cJSON_AddStringToObject(item, "downlinkRate", traffic_information->downlink_rate) == NULL) { + ogs_error("OpenAPI_traffic_information_convertToJSON() failed [downlink_rate]"); + goto end; + } + } + + if (traffic_information->is_uplink_volume) { + if (cJSON_AddNumberToObject(item, "uplinkVolume", traffic_information->uplink_volume) == NULL) { + ogs_error("OpenAPI_traffic_information_convertToJSON() failed [uplink_volume]"); + goto end; + } + } + + if (traffic_information->is_downlink_volume) { + if (cJSON_AddNumberToObject(item, "downlinkVolume", traffic_information->downlink_volume) == NULL) { + ogs_error("OpenAPI_traffic_information_convertToJSON() failed [downlink_volume]"); + goto end; + } + } + + if (traffic_information->is_total_volume) { + if (cJSON_AddNumberToObject(item, "totalVolume", traffic_information->total_volume) == NULL) { + ogs_error("OpenAPI_traffic_information_convertToJSON() failed [total_volume]"); + goto end; + } + } + +end: + return item; +} + +OpenAPI_traffic_information_t *OpenAPI_traffic_information_parseFromJSON(cJSON *traffic_informationJSON) +{ + OpenAPI_traffic_information_t *traffic_information_local_var = NULL; + OpenAPI_lnode_t *node = NULL; + cJSON *uplink_rate = NULL; + cJSON *downlink_rate = NULL; + cJSON *uplink_volume = NULL; + cJSON *downlink_volume = NULL; + cJSON *total_volume = NULL; + uplink_rate = cJSON_GetObjectItemCaseSensitive(traffic_informationJSON, "uplinkRate"); + if (uplink_rate) { + if (!cJSON_IsString(uplink_rate) && !cJSON_IsNull(uplink_rate)) { + ogs_error("OpenAPI_traffic_information_parseFromJSON() failed [uplink_rate]"); + goto end; + } + } + + downlink_rate = cJSON_GetObjectItemCaseSensitive(traffic_informationJSON, "downlinkRate"); + if (downlink_rate) { + if (!cJSON_IsString(downlink_rate) && !cJSON_IsNull(downlink_rate)) { + ogs_error("OpenAPI_traffic_information_parseFromJSON() failed [downlink_rate]"); + goto end; + } + } + + uplink_volume = cJSON_GetObjectItemCaseSensitive(traffic_informationJSON, "uplinkVolume"); + if (uplink_volume) { + if (!cJSON_IsNumber(uplink_volume)) { + ogs_error("OpenAPI_traffic_information_parseFromJSON() failed [uplink_volume]"); + goto end; + } + } + + downlink_volume = cJSON_GetObjectItemCaseSensitive(traffic_informationJSON, "downlinkVolume"); + if (downlink_volume) { + if (!cJSON_IsNumber(downlink_volume)) { + ogs_error("OpenAPI_traffic_information_parseFromJSON() failed [downlink_volume]"); + goto end; + } + } + + total_volume = cJSON_GetObjectItemCaseSensitive(traffic_informationJSON, "totalVolume"); + if (total_volume) { + if (!cJSON_IsNumber(total_volume)) { + ogs_error("OpenAPI_traffic_information_parseFromJSON() failed [total_volume]"); + goto end; + } + } + + traffic_information_local_var = OpenAPI_traffic_information_create ( + uplink_rate && !cJSON_IsNull(uplink_rate) ? ogs_strdup(uplink_rate->valuestring) : NULL, + downlink_rate && !cJSON_IsNull(downlink_rate) ? ogs_strdup(downlink_rate->valuestring) : NULL, + uplink_volume ? true : false, + uplink_volume ? uplink_volume->valuedouble : 0, + downlink_volume ? true : false, + downlink_volume ? downlink_volume->valuedouble : 0, + total_volume ? true : false, + total_volume ? total_volume->valuedouble : 0 + ); + + return traffic_information_local_var; +end: + return NULL; +} + +OpenAPI_traffic_information_t *OpenAPI_traffic_information_copy(OpenAPI_traffic_information_t *dst, OpenAPI_traffic_information_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_traffic_information_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_traffic_information_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_traffic_information_free(dst); + dst = OpenAPI_traffic_information_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/traffic_information.h b/lib/sbi/openapi/model/traffic_information.h new file mode 100644 index 000000000..f40b86fb3 --- /dev/null +++ b/lib/sbi/openapi/model/traffic_information.h @@ -0,0 +1,52 @@ +/* + * traffic_information.h + * + * Traffic information including UL/DL data rate and/or Traffic volume. + */ + +#ifndef _OpenAPI_traffic_information_H_ +#define _OpenAPI_traffic_information_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_traffic_information_s OpenAPI_traffic_information_t; +typedef struct OpenAPI_traffic_information_s { + char *uplink_rate; + char *downlink_rate; + bool is_uplink_volume; + long uplink_volume; + bool is_downlink_volume; + long downlink_volume; + bool is_total_volume; + long total_volume; +} OpenAPI_traffic_information_t; + +OpenAPI_traffic_information_t *OpenAPI_traffic_information_create( + char *uplink_rate, + char *downlink_rate, + bool is_uplink_volume, + long uplink_volume, + bool is_downlink_volume, + long downlink_volume, + bool is_total_volume, + long total_volume +); +void OpenAPI_traffic_information_free(OpenAPI_traffic_information_t *traffic_information); +OpenAPI_traffic_information_t *OpenAPI_traffic_information_parseFromJSON(cJSON *traffic_informationJSON); +cJSON *OpenAPI_traffic_information_convertToJSON(OpenAPI_traffic_information_t *traffic_information); +OpenAPI_traffic_information_t *OpenAPI_traffic_information_copy(OpenAPI_traffic_information_t *dst, OpenAPI_traffic_information_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_traffic_information_H_ */ + diff --git a/lib/sbi/openapi/model/traffic_profile_rm.h b/lib/sbi/openapi/model/traffic_profile_rm.h index 71d856918..649c1d881 100644 --- a/lib/sbi/openapi/model/traffic_profile_rm.h +++ b/lib/sbi/openapi/model/traffic_profile_rm.h @@ -1,7 +1,7 @@ /* * traffic_profile_rm.h * - * + * This enumeration is defined in the same way as the 'TrafficProfile' enumeration, but with the OpenAPI 'nullable: true' property. */ #ifndef _OpenAPI_traffic_profile_rm_H_ diff --git a/lib/sbi/openapi/model/transfer_mo_data_req_data.h b/lib/sbi/openapi/model/transfer_mo_data_req_data.h index 6f43616e0..af0226d32 100644 --- a/lib/sbi/openapi/model/transfer_mo_data_req_data.h +++ b/lib/sbi/openapi/model/transfer_mo_data_req_data.h @@ -1,7 +1,7 @@ /* * transfer_mo_data_req_data.h * - * + * Data within Transfer MO Data Request */ #ifndef _OpenAPI_transfer_mo_data_req_data_H_ diff --git a/lib/sbi/openapi/model/transfer_mt_data_add_info.h b/lib/sbi/openapi/model/transfer_mt_data_add_info.h index 73cfa4d61..5d9c6a1c1 100644 --- a/lib/sbi/openapi/model/transfer_mt_data_add_info.h +++ b/lib/sbi/openapi/model/transfer_mt_data_add_info.h @@ -1,7 +1,7 @@ /* * transfer_mt_data_add_info.h * - * + * Transfer MT Data Error Response Additional Information */ #ifndef _OpenAPI_transfer_mt_data_add_info_H_ diff --git a/lib/sbi/openapi/model/transfer_mt_data_error.c b/lib/sbi/openapi/model/transfer_mt_data_error.c index 3d2307246..1824f9385 100644 --- a/lib/sbi/openapi/model/transfer_mt_data_error.c +++ b/lib/sbi/openapi/model/transfer_mt_data_error.c @@ -17,6 +17,8 @@ OpenAPI_transfer_mt_data_error_t *OpenAPI_transfer_mt_data_error_create( OpenAPI_access_token_err_t *access_token_error, OpenAPI_access_token_req_t *access_token_request, char *nrf_id, + bool is_remote_error, + int remote_error, bool is_max_waiting_time, int max_waiting_time ) @@ -36,6 +38,8 @@ OpenAPI_transfer_mt_data_error_t *OpenAPI_transfer_mt_data_error_create( transfer_mt_data_error_local_var->access_token_error = access_token_error; transfer_mt_data_error_local_var->access_token_request = access_token_request; transfer_mt_data_error_local_var->nrf_id = nrf_id; + transfer_mt_data_error_local_var->is_remote_error = is_remote_error; + transfer_mt_data_error_local_var->remote_error = remote_error; transfer_mt_data_error_local_var->is_max_waiting_time = is_max_waiting_time; transfer_mt_data_error_local_var->max_waiting_time = max_waiting_time; @@ -204,6 +208,13 @@ cJSON *OpenAPI_transfer_mt_data_error_convertToJSON(OpenAPI_transfer_mt_data_err } } + if (transfer_mt_data_error->is_remote_error) { + if (cJSON_AddBoolToObject(item, "remoteError", transfer_mt_data_error->remote_error) == NULL) { + ogs_error("OpenAPI_transfer_mt_data_error_convertToJSON() failed [remote_error]"); + goto end; + } + } + if (transfer_mt_data_error->is_max_waiting_time) { if (cJSON_AddNumberToObject(item, "maxWaitingTime", transfer_mt_data_error->max_waiting_time) == NULL) { ogs_error("OpenAPI_transfer_mt_data_error_convertToJSON() failed [max_waiting_time]"); @@ -233,6 +244,7 @@ OpenAPI_transfer_mt_data_error_t *OpenAPI_transfer_mt_data_error_parseFromJSON(c cJSON *access_token_request = NULL; OpenAPI_access_token_req_t *access_token_request_local_nonprim = NULL; cJSON *nrf_id = NULL; + cJSON *remote_error = NULL; cJSON *max_waiting_time = NULL; type = cJSON_GetObjectItemCaseSensitive(transfer_mt_data_errorJSON, "type"); if (type) { @@ -333,6 +345,14 @@ OpenAPI_transfer_mt_data_error_t *OpenAPI_transfer_mt_data_error_parseFromJSON(c } } + remote_error = cJSON_GetObjectItemCaseSensitive(transfer_mt_data_errorJSON, "remoteError"); + if (remote_error) { + if (!cJSON_IsBool(remote_error)) { + ogs_error("OpenAPI_transfer_mt_data_error_parseFromJSON() failed [remote_error]"); + goto end; + } + } + max_waiting_time = cJSON_GetObjectItemCaseSensitive(transfer_mt_data_errorJSON, "maxWaitingTime"); if (max_waiting_time) { if (!cJSON_IsNumber(max_waiting_time)) { @@ -354,6 +374,8 @@ OpenAPI_transfer_mt_data_error_t *OpenAPI_transfer_mt_data_error_parseFromJSON(c access_token_error ? access_token_error_local_nonprim : NULL, access_token_request ? access_token_request_local_nonprim : NULL, nrf_id && !cJSON_IsNull(nrf_id) ? ogs_strdup(nrf_id->valuestring) : NULL, + remote_error ? true : false, + remote_error ? remote_error->valueint : 0, max_waiting_time ? true : false, max_waiting_time ? max_waiting_time->valuedouble : 0 ); diff --git a/lib/sbi/openapi/model/transfer_mt_data_error.h b/lib/sbi/openapi/model/transfer_mt_data_error.h index c8440e5a3..2411268f3 100644 --- a/lib/sbi/openapi/model/transfer_mt_data_error.h +++ b/lib/sbi/openapi/model/transfer_mt_data_error.h @@ -1,7 +1,7 @@ /* * transfer_mt_data_error.h * - * + * Transfer MT Data Error Response */ #ifndef _OpenAPI_transfer_mt_data_error_H_ @@ -34,6 +34,8 @@ typedef struct OpenAPI_transfer_mt_data_error_s { struct OpenAPI_access_token_err_s *access_token_error; struct OpenAPI_access_token_req_s *access_token_request; char *nrf_id; + bool is_remote_error; + int remote_error; bool is_max_waiting_time; int max_waiting_time; } OpenAPI_transfer_mt_data_error_t; @@ -51,6 +53,8 @@ OpenAPI_transfer_mt_data_error_t *OpenAPI_transfer_mt_data_error_create( OpenAPI_access_token_err_t *access_token_error, OpenAPI_access_token_req_t *access_token_request, char *nrf_id, + bool is_remote_error, + int remote_error, bool is_max_waiting_time, int max_waiting_time ); diff --git a/lib/sbi/openapi/model/transfer_mt_data_req_data.h b/lib/sbi/openapi/model/transfer_mt_data_req_data.h index bdfe7b0a8..46fa18547 100644 --- a/lib/sbi/openapi/model/transfer_mt_data_req_data.h +++ b/lib/sbi/openapi/model/transfer_mt_data_req_data.h @@ -1,7 +1,7 @@ /* * transfer_mt_data_req_data.h * - * + * Data within Transfer MT Data Request */ #ifndef _OpenAPI_transfer_mt_data_req_data_H_ diff --git a/lib/sbi/openapi/model/transport_protocol_1.c b/lib/sbi/openapi/model/transport_protocol_1.c new file mode 100644 index 000000000..8a4725471 --- /dev/null +++ b/lib/sbi/openapi/model/transport_protocol_1.c @@ -0,0 +1,30 @@ + +#include +#include +#include +#include "transport_protocol_1.h" + +char* OpenAPI_transport_protocol_1_ToString(OpenAPI_transport_protocol_1_e transport_protocol_1) +{ + const char *transport_protocol_1Array[] = { "NULL", "TCP" }; + size_t sizeofArray = sizeof(transport_protocol_1Array) / sizeof(transport_protocol_1Array[0]); + if (transport_protocol_1 < sizeofArray) + return (char *)transport_protocol_1Array[transport_protocol_1]; + else + return (char *)"Unknown"; +} + +OpenAPI_transport_protocol_1_e OpenAPI_transport_protocol_1_FromString(char* transport_protocol_1) +{ + int stringToReturn = 0; + const char *transport_protocol_1Array[] = { "NULL", "TCP" }; + size_t sizeofArray = sizeof(transport_protocol_1Array) / sizeof(transport_protocol_1Array[0]); + while (stringToReturn < sizeofArray) { + if (strcmp(transport_protocol_1, transport_protocol_1Array[stringToReturn]) == 0) { + return stringToReturn; + } + stringToReturn++; + } + return 0; +} + diff --git a/lib/sbi/openapi/model/transport_protocol_1.h b/lib/sbi/openapi/model/transport_protocol_1.h new file mode 100644 index 000000000..e93c706c3 --- /dev/null +++ b/lib/sbi/openapi/model/transport_protocol_1.h @@ -0,0 +1,31 @@ +/* + * transport_protocol_1.h + * + * + */ + +#ifndef _OpenAPI_transport_protocol_1_H_ +#define _OpenAPI_transport_protocol_1_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef enum { OpenAPI_transport_protocol_1_NULL = 0, OpenAPI_transport_protocol_1_TCP } OpenAPI_transport_protocol_1_e; + +char* OpenAPI_transport_protocol_1_ToString(OpenAPI_transport_protocol_1_e transport_protocol_1); + +OpenAPI_transport_protocol_1_e OpenAPI_transport_protocol_1_FromString(char* transport_protocol_1); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_transport_protocol_1_H_ */ + diff --git a/lib/sbi/openapi/model/trigger_request.c b/lib/sbi/openapi/model/trigger_request.c index 96c610333..9a252eb2b 100644 --- a/lib/sbi/openapi/model/trigger_request.c +++ b/lib/sbi/openapi/model/trigger_request.c @@ -5,13 +5,15 @@ #include "trigger_request.h" OpenAPI_trigger_request_t *OpenAPI_trigger_request_create( - char *supi + char *supi, + OpenAPI_pcscf_address_t *failed_pcscf ) { OpenAPI_trigger_request_t *trigger_request_local_var = ogs_malloc(sizeof(OpenAPI_trigger_request_t)); ogs_assert(trigger_request_local_var); trigger_request_local_var->supi = supi; + trigger_request_local_var->failed_pcscf = failed_pcscf; return trigger_request_local_var; } @@ -27,6 +29,10 @@ void OpenAPI_trigger_request_free(OpenAPI_trigger_request_t *trigger_request) ogs_free(trigger_request->supi); trigger_request->supi = NULL; } + if (trigger_request->failed_pcscf) { + OpenAPI_pcscf_address_free(trigger_request->failed_pcscf); + trigger_request->failed_pcscf = NULL; + } ogs_free(trigger_request); } @@ -50,6 +56,19 @@ cJSON *OpenAPI_trigger_request_convertToJSON(OpenAPI_trigger_request_t *trigger_ goto end; } + if (trigger_request->failed_pcscf) { + cJSON *failed_pcscf_local_JSON = OpenAPI_pcscf_address_convertToJSON(trigger_request->failed_pcscf); + if (failed_pcscf_local_JSON == NULL) { + ogs_error("OpenAPI_trigger_request_convertToJSON() failed [failed_pcscf]"); + goto end; + } + cJSON_AddItemToObject(item, "failedPcscf", failed_pcscf_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_trigger_request_convertToJSON() failed [failed_pcscf]"); + goto end; + } + } + end: return item; } @@ -59,6 +78,8 @@ OpenAPI_trigger_request_t *OpenAPI_trigger_request_parseFromJSON(cJSON *trigger_ OpenAPI_trigger_request_t *trigger_request_local_var = NULL; OpenAPI_lnode_t *node = NULL; cJSON *supi = NULL; + cJSON *failed_pcscf = NULL; + OpenAPI_pcscf_address_t *failed_pcscf_local_nonprim = NULL; supi = cJSON_GetObjectItemCaseSensitive(trigger_requestJSON, "supi"); if (!supi) { ogs_error("OpenAPI_trigger_request_parseFromJSON() failed [supi]"); @@ -69,12 +90,22 @@ OpenAPI_trigger_request_t *OpenAPI_trigger_request_parseFromJSON(cJSON *trigger_ goto end; } + failed_pcscf = cJSON_GetObjectItemCaseSensitive(trigger_requestJSON, "failedPcscf"); + if (failed_pcscf) { + failed_pcscf_local_nonprim = OpenAPI_pcscf_address_parseFromJSON(failed_pcscf); + } + trigger_request_local_var = OpenAPI_trigger_request_create ( - ogs_strdup(supi->valuestring) + ogs_strdup(supi->valuestring), + failed_pcscf ? failed_pcscf_local_nonprim : NULL ); return trigger_request_local_var; end: + if (failed_pcscf_local_nonprim) { + OpenAPI_pcscf_address_free(failed_pcscf_local_nonprim); + failed_pcscf_local_nonprim = NULL; + } return NULL; } diff --git a/lib/sbi/openapi/model/trigger_request.h b/lib/sbi/openapi/model/trigger_request.h index c592e0e01..8a72c68cd 100644 --- a/lib/sbi/openapi/model/trigger_request.h +++ b/lib/sbi/openapi/model/trigger_request.h @@ -12,6 +12,7 @@ #include "../include/list.h" #include "../include/keyValuePair.h" #include "../include/binary.h" +#include "pcscf_address.h" #ifdef __cplusplus extern "C" { @@ -20,10 +21,12 @@ extern "C" { typedef struct OpenAPI_trigger_request_s OpenAPI_trigger_request_t; typedef struct OpenAPI_trigger_request_s { char *supi; + struct OpenAPI_pcscf_address_s *failed_pcscf; } OpenAPI_trigger_request_t; OpenAPI_trigger_request_t *OpenAPI_trigger_request_create( - char *supi + char *supi, + OpenAPI_pcscf_address_t *failed_pcscf ); void OpenAPI_trigger_request_free(OpenAPI_trigger_request_t *trigger_request); OpenAPI_trigger_request_t *OpenAPI_trigger_request_parseFromJSON(cJSON *trigger_requestJSON); diff --git a/lib/sbi/openapi/model/trigger_type_any_of.c b/lib/sbi/openapi/model/trigger_type_any_of.c index 80bba8872..6b458c5a4 100644 --- a/lib/sbi/openapi/model/trigger_type_any_of.c +++ b/lib/sbi/openapi/model/trigger_type_any_of.c @@ -6,7 +6,7 @@ char* OpenAPI_trigger_type_any_of_ToString(OpenAPI_trigger_type_any_of_e trigger_type_any_of) { - const char *trigger_type_any_ofArray[] = { "NULL", "QUOTA_THRESHOLD", "QHT", "FINAL", "QUOTA_EXHAUSTED", "VALIDITY_TIME", "OTHER_QUOTA_TYPE", "FORCED_REAUTHORISATION", "UNUSED_QUOTA_TIMER", "UNIT_COUNT_INACTIVITY_TIMER", "ABNORMAL_RELEASE", "QOS_CHANGE", "VOLUME_LIMIT", "TIME_LIMIT", "EVENT_LIMIT", "PLMN_CHANGE", "USER_LOCATION_CHANGE", "RAT_CHANGE", "SESSION_AMBR_CHANGE", "UE_TIMEZONE_CHANGE", "TARIFF_TIME_CHANGE", "MAX_NUMBER_OF_CHANGES_IN_CHARGING_CONDITIONS", "MANAGEMENT_INTERVENTION", "CHANGE_OF_UE_PRESENCE_IN_PRESENCE_REPORTING_AREA", "CHANGE_OF_3GPP_PS_DATA_OFF_STATUS", "SERVING_NODE_CHANGE", "REMOVAL_OF_UPF", "ADDITION_OF_UPF", "INSERTION_OF_ISMF", "REMOVAL_OF_ISMF", "CHANGE_OF_ISMF", "START_OF_SERVICE_DATA_FLOW", "ECGI_CHANGE", "TAI_CHANGE", "HANDOVER_CANCEL", "HANDOVER_START", "HANDOVER_COMPLETE", "GFBR_GUARANTEED_STATUS_CHANGE", "ADDITION_OF_ACCESS", "REMOVAL_OF_ACCESS", "START_OF_SDF_ADDITIONAL_ACCESS" }; + const char *trigger_type_any_ofArray[] = { "NULL", "QUOTA_THRESHOLD", "QHT", "FINAL", "QUOTA_EXHAUSTED", "VALIDITY_TIME", "OTHER_QUOTA_TYPE", "FORCED_REAUTHORISATION", "UNUSED_QUOTA_TIMER", "UNIT_COUNT_INACTIVITY_TIMER", "ABNORMAL_RELEASE", "QOS_CHANGE", "VOLUME_LIMIT", "TIME_LIMIT", "EVENT_LIMIT", "PLMN_CHANGE", "USER_LOCATION_CHANGE", "RAT_CHANGE", "SESSION_AMBR_CHANGE", "UE_TIMEZONE_CHANGE", "TARIFF_TIME_CHANGE", "MAX_NUMBER_OF_CHANGES_IN_CHARGING_CONDITIONS", "MANAGEMENT_INTERVENTION", "CHANGE_OF_UE_PRESENCE_IN_PRESENCE_REPORTING_AREA", "CHANGE_OF_3GPP_PS_DATA_OFF_STATUS", "SERVING_NODE_CHANGE", "REMOVAL_OF_UPF", "ADDITION_OF_UPF", "INSERTION_OF_ISMF", "REMOVAL_OF_ISMF", "CHANGE_OF_ISMF", "START_OF_SERVICE_DATA_FLOW", "ECGI_CHANGE", "TAI_CHANGE", "HANDOVER_CANCEL", "HANDOVER_START", "HANDOVER_COMPLETE", "GFBR_GUARANTEED_STATUS_CHANGE", "ADDITION_OF_ACCESS", "REMOVAL_OF_ACCESS", "START_OF_SDF_ADDITIONAL_ACCESS", "REDUNDANT_TRANSMISSION_CHANGE", "CGI_SAI_CHANGE", "RAI_CHANGE" }; size_t sizeofArray = sizeof(trigger_type_any_ofArray) / sizeof(trigger_type_any_ofArray[0]); if (trigger_type_any_of < sizeofArray) return (char *)trigger_type_any_ofArray[trigger_type_any_of]; @@ -17,7 +17,7 @@ char* OpenAPI_trigger_type_any_of_ToString(OpenAPI_trigger_type_any_of_e trigger OpenAPI_trigger_type_any_of_e OpenAPI_trigger_type_any_of_FromString(char* trigger_type_any_of) { int stringToReturn = 0; - const char *trigger_type_any_ofArray[] = { "NULL", "QUOTA_THRESHOLD", "QHT", "FINAL", "QUOTA_EXHAUSTED", "VALIDITY_TIME", "OTHER_QUOTA_TYPE", "FORCED_REAUTHORISATION", "UNUSED_QUOTA_TIMER", "UNIT_COUNT_INACTIVITY_TIMER", "ABNORMAL_RELEASE", "QOS_CHANGE", "VOLUME_LIMIT", "TIME_LIMIT", "EVENT_LIMIT", "PLMN_CHANGE", "USER_LOCATION_CHANGE", "RAT_CHANGE", "SESSION_AMBR_CHANGE", "UE_TIMEZONE_CHANGE", "TARIFF_TIME_CHANGE", "MAX_NUMBER_OF_CHANGES_IN_CHARGING_CONDITIONS", "MANAGEMENT_INTERVENTION", "CHANGE_OF_UE_PRESENCE_IN_PRESENCE_REPORTING_AREA", "CHANGE_OF_3GPP_PS_DATA_OFF_STATUS", "SERVING_NODE_CHANGE", "REMOVAL_OF_UPF", "ADDITION_OF_UPF", "INSERTION_OF_ISMF", "REMOVAL_OF_ISMF", "CHANGE_OF_ISMF", "START_OF_SERVICE_DATA_FLOW", "ECGI_CHANGE", "TAI_CHANGE", "HANDOVER_CANCEL", "HANDOVER_START", "HANDOVER_COMPLETE", "GFBR_GUARANTEED_STATUS_CHANGE", "ADDITION_OF_ACCESS", "REMOVAL_OF_ACCESS", "START_OF_SDF_ADDITIONAL_ACCESS" }; + const char *trigger_type_any_ofArray[] = { "NULL", "QUOTA_THRESHOLD", "QHT", "FINAL", "QUOTA_EXHAUSTED", "VALIDITY_TIME", "OTHER_QUOTA_TYPE", "FORCED_REAUTHORISATION", "UNUSED_QUOTA_TIMER", "UNIT_COUNT_INACTIVITY_TIMER", "ABNORMAL_RELEASE", "QOS_CHANGE", "VOLUME_LIMIT", "TIME_LIMIT", "EVENT_LIMIT", "PLMN_CHANGE", "USER_LOCATION_CHANGE", "RAT_CHANGE", "SESSION_AMBR_CHANGE", "UE_TIMEZONE_CHANGE", "TARIFF_TIME_CHANGE", "MAX_NUMBER_OF_CHANGES_IN_CHARGING_CONDITIONS", "MANAGEMENT_INTERVENTION", "CHANGE_OF_UE_PRESENCE_IN_PRESENCE_REPORTING_AREA", "CHANGE_OF_3GPP_PS_DATA_OFF_STATUS", "SERVING_NODE_CHANGE", "REMOVAL_OF_UPF", "ADDITION_OF_UPF", "INSERTION_OF_ISMF", "REMOVAL_OF_ISMF", "CHANGE_OF_ISMF", "START_OF_SERVICE_DATA_FLOW", "ECGI_CHANGE", "TAI_CHANGE", "HANDOVER_CANCEL", "HANDOVER_START", "HANDOVER_COMPLETE", "GFBR_GUARANTEED_STATUS_CHANGE", "ADDITION_OF_ACCESS", "REMOVAL_OF_ACCESS", "START_OF_SDF_ADDITIONAL_ACCESS", "REDUNDANT_TRANSMISSION_CHANGE", "CGI_SAI_CHANGE", "RAI_CHANGE" }; size_t sizeofArray = sizeof(trigger_type_any_ofArray) / sizeof(trigger_type_any_ofArray[0]); while (stringToReturn < sizeofArray) { if (strcmp(trigger_type_any_of, trigger_type_any_ofArray[stringToReturn]) == 0) { diff --git a/lib/sbi/openapi/model/trigger_type_any_of.h b/lib/sbi/openapi/model/trigger_type_any_of.h index a8a702301..663dc3781 100644 --- a/lib/sbi/openapi/model/trigger_type_any_of.h +++ b/lib/sbi/openapi/model/trigger_type_any_of.h @@ -17,7 +17,7 @@ extern "C" { #endif -typedef enum { OpenAPI_trigger_type_any_of_NULL = 0, OpenAPI_trigger_type_any_of_QUOTA_THRESHOLD, OpenAPI_trigger_type_any_of_QHT, OpenAPI_trigger_type_any_of__FINAL, OpenAPI_trigger_type_any_of_QUOTA_EXHAUSTED, OpenAPI_trigger_type_any_of_VALIDITY_TIME, OpenAPI_trigger_type_any_of_OTHER_QUOTA_TYPE, OpenAPI_trigger_type_any_of_FORCED_REAUTHORISATION, OpenAPI_trigger_type_any_of_UNUSED_QUOTA_TIMER, OpenAPI_trigger_type_any_of_UNIT_COUNT_INACTIVITY_TIMER, OpenAPI_trigger_type_any_of_ABNORMAL_RELEASE, OpenAPI_trigger_type_any_of_QOS_CHANGE, OpenAPI_trigger_type_any_of_VOLUME_LIMIT, OpenAPI_trigger_type_any_of_TIME_LIMIT, OpenAPI_trigger_type_any_of_EVENT_LIMIT, OpenAPI_trigger_type_any_of_PLMN_CHANGE, OpenAPI_trigger_type_any_of_USER_LOCATION_CHANGE, OpenAPI_trigger_type_any_of_RAT_CHANGE, OpenAPI_trigger_type_any_of_SESSION_AMBR_CHANGE, OpenAPI_trigger_type_any_of_UE_TIMEZONE_CHANGE, OpenAPI_trigger_type_any_of_TARIFF_TIME_CHANGE, OpenAPI_trigger_type_any_of_MAX_NUMBER_OF_CHANGES_IN_CHARGING_CONDITIONS, OpenAPI_trigger_type_any_of_MANAGEMENT_INTERVENTION, OpenAPI_trigger_type_any_of_CHANGE_OF_UE_PRESENCE_IN_PRESENCE_REPORTING_AREA, OpenAPI_trigger_type_any_of_CHANGE_OF_3GPP_PS_DATA_OFF_STATUS, OpenAPI_trigger_type_any_of_SERVING_NODE_CHANGE, OpenAPI_trigger_type_any_of_REMOVAL_OF_UPF, OpenAPI_trigger_type_any_of_ADDITION_OF_UPF, OpenAPI_trigger_type_any_of_INSERTION_OF_ISMF, OpenAPI_trigger_type_any_of_REMOVAL_OF_ISMF, OpenAPI_trigger_type_any_of_CHANGE_OF_ISMF, OpenAPI_trigger_type_any_of_START_OF_SERVICE_DATA_FLOW, OpenAPI_trigger_type_any_of_ECGI_CHANGE, OpenAPI_trigger_type_any_of_TAI_CHANGE, OpenAPI_trigger_type_any_of_HANDOVER_CANCEL, OpenAPI_trigger_type_any_of_HANDOVER_START, OpenAPI_trigger_type_any_of_HANDOVER_COMPLETE, OpenAPI_trigger_type_any_of_GFBR_GUARANTEED_STATUS_CHANGE, OpenAPI_trigger_type_any_of_ADDITION_OF_ACCESS, OpenAPI_trigger_type_any_of_REMOVAL_OF_ACCESS, OpenAPI_trigger_type_any_of_START_OF_SDF_ADDITIONAL_ACCESS } OpenAPI_trigger_type_any_of_e; +typedef enum { OpenAPI_trigger_type_any_of_NULL = 0, OpenAPI_trigger_type_any_of_QUOTA_THRESHOLD, OpenAPI_trigger_type_any_of_QHT, OpenAPI_trigger_type_any_of__FINAL, OpenAPI_trigger_type_any_of_QUOTA_EXHAUSTED, OpenAPI_trigger_type_any_of_VALIDITY_TIME, OpenAPI_trigger_type_any_of_OTHER_QUOTA_TYPE, OpenAPI_trigger_type_any_of_FORCED_REAUTHORISATION, OpenAPI_trigger_type_any_of_UNUSED_QUOTA_TIMER, OpenAPI_trigger_type_any_of_UNIT_COUNT_INACTIVITY_TIMER, OpenAPI_trigger_type_any_of_ABNORMAL_RELEASE, OpenAPI_trigger_type_any_of_QOS_CHANGE, OpenAPI_trigger_type_any_of_VOLUME_LIMIT, OpenAPI_trigger_type_any_of_TIME_LIMIT, OpenAPI_trigger_type_any_of_EVENT_LIMIT, OpenAPI_trigger_type_any_of_PLMN_CHANGE, OpenAPI_trigger_type_any_of_USER_LOCATION_CHANGE, OpenAPI_trigger_type_any_of_RAT_CHANGE, OpenAPI_trigger_type_any_of_SESSION_AMBR_CHANGE, OpenAPI_trigger_type_any_of_UE_TIMEZONE_CHANGE, OpenAPI_trigger_type_any_of_TARIFF_TIME_CHANGE, OpenAPI_trigger_type_any_of_MAX_NUMBER_OF_CHANGES_IN_CHARGING_CONDITIONS, OpenAPI_trigger_type_any_of_MANAGEMENT_INTERVENTION, OpenAPI_trigger_type_any_of_CHANGE_OF_UE_PRESENCE_IN_PRESENCE_REPORTING_AREA, OpenAPI_trigger_type_any_of_CHANGE_OF_3GPP_PS_DATA_OFF_STATUS, OpenAPI_trigger_type_any_of_SERVING_NODE_CHANGE, OpenAPI_trigger_type_any_of_REMOVAL_OF_UPF, OpenAPI_trigger_type_any_of_ADDITION_OF_UPF, OpenAPI_trigger_type_any_of_INSERTION_OF_ISMF, OpenAPI_trigger_type_any_of_REMOVAL_OF_ISMF, OpenAPI_trigger_type_any_of_CHANGE_OF_ISMF, OpenAPI_trigger_type_any_of_START_OF_SERVICE_DATA_FLOW, OpenAPI_trigger_type_any_of_ECGI_CHANGE, OpenAPI_trigger_type_any_of_TAI_CHANGE, OpenAPI_trigger_type_any_of_HANDOVER_CANCEL, OpenAPI_trigger_type_any_of_HANDOVER_START, OpenAPI_trigger_type_any_of_HANDOVER_COMPLETE, OpenAPI_trigger_type_any_of_GFBR_GUARANTEED_STATUS_CHANGE, OpenAPI_trigger_type_any_of_ADDITION_OF_ACCESS, OpenAPI_trigger_type_any_of_REMOVAL_OF_ACCESS, OpenAPI_trigger_type_any_of_START_OF_SDF_ADDITIONAL_ACCESS, OpenAPI_trigger_type_any_of_REDUNDANT_TRANSMISSION_CHANGE, OpenAPI_trigger_type_any_of_CGI_SAI_CHANGE, OpenAPI_trigger_type_any_of_RAI_CHANGE } OpenAPI_trigger_type_any_of_e; char* OpenAPI_trigger_type_any_of_ToString(OpenAPI_trigger_type_any_of_e trigger_type_any_of); diff --git a/lib/sbi/openapi/model/trust_af_info.c b/lib/sbi/openapi/model/trust_af_info.c new file mode 100644 index 000000000..a3d92c797 --- /dev/null +++ b/lib/sbi/openapi/model/trust_af_info.c @@ -0,0 +1,323 @@ + +#include +#include +#include +#include "trust_af_info.h" + +OpenAPI_trust_af_info_t *OpenAPI_trust_af_info_create( + OpenAPI_list_t *s_nssai_info_list, + OpenAPI_list_t *af_events, + OpenAPI_list_t *app_ids, + OpenAPI_list_t *internal_group_id, + bool is_mapping_ind, + int mapping_ind +) +{ + OpenAPI_trust_af_info_t *trust_af_info_local_var = ogs_malloc(sizeof(OpenAPI_trust_af_info_t)); + ogs_assert(trust_af_info_local_var); + + trust_af_info_local_var->s_nssai_info_list = s_nssai_info_list; + trust_af_info_local_var->af_events = af_events; + trust_af_info_local_var->app_ids = app_ids; + trust_af_info_local_var->internal_group_id = internal_group_id; + trust_af_info_local_var->is_mapping_ind = is_mapping_ind; + trust_af_info_local_var->mapping_ind = mapping_ind; + + return trust_af_info_local_var; +} + +void OpenAPI_trust_af_info_free(OpenAPI_trust_af_info_t *trust_af_info) +{ + OpenAPI_lnode_t *node = NULL; + + if (NULL == trust_af_info) { + return; + } + if (trust_af_info->s_nssai_info_list) { + OpenAPI_list_for_each(trust_af_info->s_nssai_info_list, node) { + OpenAPI_snssai_info_item_free(node->data); + } + OpenAPI_list_free(trust_af_info->s_nssai_info_list); + trust_af_info->s_nssai_info_list = NULL; + } + if (trust_af_info->af_events) { + OpenAPI_list_free(trust_af_info->af_events); + trust_af_info->af_events = NULL; + } + if (trust_af_info->app_ids) { + OpenAPI_list_for_each(trust_af_info->app_ids, node) { + ogs_free(node->data); + } + OpenAPI_list_free(trust_af_info->app_ids); + trust_af_info->app_ids = NULL; + } + if (trust_af_info->internal_group_id) { + OpenAPI_list_for_each(trust_af_info->internal_group_id, node) { + ogs_free(node->data); + } + OpenAPI_list_free(trust_af_info->internal_group_id); + trust_af_info->internal_group_id = NULL; + } + ogs_free(trust_af_info); +} + +cJSON *OpenAPI_trust_af_info_convertToJSON(OpenAPI_trust_af_info_t *trust_af_info) +{ + cJSON *item = NULL; + OpenAPI_lnode_t *node = NULL; + + if (trust_af_info == NULL) { + ogs_error("OpenAPI_trust_af_info_convertToJSON() failed [TrustAfInfo]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (trust_af_info->s_nssai_info_list) { + cJSON *s_nssai_info_listList = cJSON_AddArrayToObject(item, "sNssaiInfoList"); + if (s_nssai_info_listList == NULL) { + ogs_error("OpenAPI_trust_af_info_convertToJSON() failed [s_nssai_info_list]"); + goto end; + } + OpenAPI_list_for_each(trust_af_info->s_nssai_info_list, node) { + cJSON *itemLocal = OpenAPI_snssai_info_item_convertToJSON(node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_trust_af_info_convertToJSON() failed [s_nssai_info_list]"); + goto end; + } + cJSON_AddItemToArray(s_nssai_info_listList, itemLocal); + } + } + + if (trust_af_info->af_events != OpenAPI_af_event_NULL) { + cJSON *af_eventsList = cJSON_AddArrayToObject(item, "afEvents"); + if (af_eventsList == NULL) { + ogs_error("OpenAPI_trust_af_info_convertToJSON() failed [af_events]"); + goto end; + } + OpenAPI_list_for_each(trust_af_info->af_events, node) { + if (cJSON_AddStringToObject(af_eventsList, "", OpenAPI_af_event_ToString((intptr_t)node->data)) == NULL) { + ogs_error("OpenAPI_trust_af_info_convertToJSON() failed [af_events]"); + goto end; + } + } + } + + if (trust_af_info->app_ids) { + cJSON *app_idsList = cJSON_AddArrayToObject(item, "appIds"); + if (app_idsList == NULL) { + ogs_error("OpenAPI_trust_af_info_convertToJSON() failed [app_ids]"); + goto end; + } + OpenAPI_list_for_each(trust_af_info->app_ids, node) { + if (cJSON_AddStringToObject(app_idsList, "", (char*)node->data) == NULL) { + ogs_error("OpenAPI_trust_af_info_convertToJSON() failed [app_ids]"); + goto end; + } + } + } + + if (trust_af_info->internal_group_id) { + cJSON *internal_group_idList = cJSON_AddArrayToObject(item, "internalGroupId"); + if (internal_group_idList == NULL) { + ogs_error("OpenAPI_trust_af_info_convertToJSON() failed [internal_group_id]"); + goto end; + } + OpenAPI_list_for_each(trust_af_info->internal_group_id, node) { + if (cJSON_AddStringToObject(internal_group_idList, "", (char*)node->data) == NULL) { + ogs_error("OpenAPI_trust_af_info_convertToJSON() failed [internal_group_id]"); + goto end; + } + } + } + + if (trust_af_info->is_mapping_ind) { + if (cJSON_AddBoolToObject(item, "mappingInd", trust_af_info->mapping_ind) == NULL) { + ogs_error("OpenAPI_trust_af_info_convertToJSON() failed [mapping_ind]"); + goto end; + } + } + +end: + return item; +} + +OpenAPI_trust_af_info_t *OpenAPI_trust_af_info_parseFromJSON(cJSON *trust_af_infoJSON) +{ + OpenAPI_trust_af_info_t *trust_af_info_local_var = NULL; + OpenAPI_lnode_t *node = NULL; + cJSON *s_nssai_info_list = NULL; + OpenAPI_list_t *s_nssai_info_listList = NULL; + cJSON *af_events = NULL; + OpenAPI_list_t *af_eventsList = NULL; + cJSON *app_ids = NULL; + OpenAPI_list_t *app_idsList = NULL; + cJSON *internal_group_id = NULL; + OpenAPI_list_t *internal_group_idList = NULL; + cJSON *mapping_ind = NULL; + s_nssai_info_list = cJSON_GetObjectItemCaseSensitive(trust_af_infoJSON, "sNssaiInfoList"); + if (s_nssai_info_list) { + cJSON *s_nssai_info_list_local = NULL; + if (!cJSON_IsArray(s_nssai_info_list)) { + ogs_error("OpenAPI_trust_af_info_parseFromJSON() failed [s_nssai_info_list]"); + goto end; + } + + s_nssai_info_listList = OpenAPI_list_create(); + + cJSON_ArrayForEach(s_nssai_info_list_local, s_nssai_info_list) { + if (!cJSON_IsObject(s_nssai_info_list_local)) { + ogs_error("OpenAPI_trust_af_info_parseFromJSON() failed [s_nssai_info_list]"); + goto end; + } + OpenAPI_snssai_info_item_t *s_nssai_info_listItem = OpenAPI_snssai_info_item_parseFromJSON(s_nssai_info_list_local); + if (!s_nssai_info_listItem) { + ogs_error("No s_nssai_info_listItem"); + OpenAPI_list_free(s_nssai_info_listList); + goto end; + } + OpenAPI_list_add(s_nssai_info_listList, s_nssai_info_listItem); + } + } + + af_events = cJSON_GetObjectItemCaseSensitive(trust_af_infoJSON, "afEvents"); + if (af_events) { + cJSON *af_events_local = NULL; + if (!cJSON_IsArray(af_events)) { + ogs_error("OpenAPI_trust_af_info_parseFromJSON() failed [af_events]"); + goto end; + } + + af_eventsList = OpenAPI_list_create(); + + cJSON_ArrayForEach(af_events_local, af_events) { + if (!cJSON_IsString(af_events_local)) { + ogs_error("OpenAPI_trust_af_info_parseFromJSON() failed [af_events]"); + goto end; + } + OpenAPI_list_add(af_eventsList, (void *)OpenAPI_af_event_FromString(af_events_local->valuestring)); + } + } + + app_ids = cJSON_GetObjectItemCaseSensitive(trust_af_infoJSON, "appIds"); + if (app_ids) { + cJSON *app_ids_local = NULL; + if (!cJSON_IsArray(app_ids)) { + ogs_error("OpenAPI_trust_af_info_parseFromJSON() failed [app_ids]"); + goto end; + } + + app_idsList = OpenAPI_list_create(); + + cJSON_ArrayForEach(app_ids_local, app_ids) { + double *localDouble = NULL; + int *localInt = NULL; + if (!cJSON_IsString(app_ids_local)) { + ogs_error("OpenAPI_trust_af_info_parseFromJSON() failed [app_ids]"); + goto end; + } + OpenAPI_list_add(app_idsList, ogs_strdup(app_ids_local->valuestring)); + } + } + + internal_group_id = cJSON_GetObjectItemCaseSensitive(trust_af_infoJSON, "internalGroupId"); + if (internal_group_id) { + cJSON *internal_group_id_local = NULL; + if (!cJSON_IsArray(internal_group_id)) { + ogs_error("OpenAPI_trust_af_info_parseFromJSON() failed [internal_group_id]"); + goto end; + } + + internal_group_idList = OpenAPI_list_create(); + + cJSON_ArrayForEach(internal_group_id_local, internal_group_id) { + double *localDouble = NULL; + int *localInt = NULL; + if (!cJSON_IsString(internal_group_id_local)) { + ogs_error("OpenAPI_trust_af_info_parseFromJSON() failed [internal_group_id]"); + goto end; + } + OpenAPI_list_add(internal_group_idList, ogs_strdup(internal_group_id_local->valuestring)); + } + } + + mapping_ind = cJSON_GetObjectItemCaseSensitive(trust_af_infoJSON, "mappingInd"); + if (mapping_ind) { + if (!cJSON_IsBool(mapping_ind)) { + ogs_error("OpenAPI_trust_af_info_parseFromJSON() failed [mapping_ind]"); + goto end; + } + } + + trust_af_info_local_var = OpenAPI_trust_af_info_create ( + s_nssai_info_list ? s_nssai_info_listList : NULL, + af_events ? af_eventsList : NULL, + app_ids ? app_idsList : NULL, + internal_group_id ? internal_group_idList : NULL, + mapping_ind ? true : false, + mapping_ind ? mapping_ind->valueint : 0 + ); + + return trust_af_info_local_var; +end: + if (s_nssai_info_listList) { + OpenAPI_list_for_each(s_nssai_info_listList, node) { + OpenAPI_snssai_info_item_free(node->data); + } + OpenAPI_list_free(s_nssai_info_listList); + s_nssai_info_listList = NULL; + } + if (af_eventsList) { + OpenAPI_list_free(af_eventsList); + af_eventsList = NULL; + } + if (app_idsList) { + OpenAPI_list_for_each(app_idsList, node) { + ogs_free(node->data); + } + OpenAPI_list_free(app_idsList); + app_idsList = NULL; + } + if (internal_group_idList) { + OpenAPI_list_for_each(internal_group_idList, node) { + ogs_free(node->data); + } + OpenAPI_list_free(internal_group_idList); + internal_group_idList = NULL; + } + return NULL; +} + +OpenAPI_trust_af_info_t *OpenAPI_trust_af_info_copy(OpenAPI_trust_af_info_t *dst, OpenAPI_trust_af_info_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_trust_af_info_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_trust_af_info_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_trust_af_info_free(dst); + dst = OpenAPI_trust_af_info_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/trust_af_info.h b/lib/sbi/openapi/model/trust_af_info.h new file mode 100644 index 000000000..06cd24d6a --- /dev/null +++ b/lib/sbi/openapi/model/trust_af_info.h @@ -0,0 +1,50 @@ +/* + * trust_af_info.h + * + * Information of a trusted AF Instance + */ + +#ifndef _OpenAPI_trust_af_info_H_ +#define _OpenAPI_trust_af_info_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "af_event.h" +#include "snssai_info_item.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_trust_af_info_s OpenAPI_trust_af_info_t; +typedef struct OpenAPI_trust_af_info_s { + OpenAPI_list_t *s_nssai_info_list; + OpenAPI_list_t *af_events; + OpenAPI_list_t *app_ids; + OpenAPI_list_t *internal_group_id; + bool is_mapping_ind; + int mapping_ind; +} OpenAPI_trust_af_info_t; + +OpenAPI_trust_af_info_t *OpenAPI_trust_af_info_create( + OpenAPI_list_t *s_nssai_info_list, + OpenAPI_list_t *af_events, + OpenAPI_list_t *app_ids, + OpenAPI_list_t *internal_group_id, + bool is_mapping_ind, + int mapping_ind +); +void OpenAPI_trust_af_info_free(OpenAPI_trust_af_info_t *trust_af_info); +OpenAPI_trust_af_info_t *OpenAPI_trust_af_info_parseFromJSON(cJSON *trust_af_infoJSON); +cJSON *OpenAPI_trust_af_info_convertToJSON(OpenAPI_trust_af_info_t *trust_af_info); +OpenAPI_trust_af_info_t *OpenAPI_trust_af_info_copy(OpenAPI_trust_af_info_t *dst, OpenAPI_trust_af_info_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_trust_af_info_H_ */ + diff --git a/lib/sbi/openapi/model/tscai_input_container.c b/lib/sbi/openapi/model/tscai_input_container.c index d969e5611..dd996277d 100644 --- a/lib/sbi/openapi/model/tscai_input_container.c +++ b/lib/sbi/openapi/model/tscai_input_container.c @@ -7,7 +7,11 @@ OpenAPI_tscai_input_container_t *OpenAPI_tscai_input_container_create( bool is_periodicity, int periodicity, - char *burst_arrival_time + char *burst_arrival_time, + bool is_sur_time_in_num_msg, + int sur_time_in_num_msg, + bool is_sur_time_in_time, + int sur_time_in_time ) { OpenAPI_tscai_input_container_t *tscai_input_container_local_var = ogs_malloc(sizeof(OpenAPI_tscai_input_container_t)); @@ -16,6 +20,10 @@ OpenAPI_tscai_input_container_t *OpenAPI_tscai_input_container_create( tscai_input_container_local_var->is_periodicity = is_periodicity; tscai_input_container_local_var->periodicity = periodicity; tscai_input_container_local_var->burst_arrival_time = burst_arrival_time; + tscai_input_container_local_var->is_sur_time_in_num_msg = is_sur_time_in_num_msg; + tscai_input_container_local_var->sur_time_in_num_msg = sur_time_in_num_msg; + tscai_input_container_local_var->is_sur_time_in_time = is_sur_time_in_time; + tscai_input_container_local_var->sur_time_in_time = sur_time_in_time; return tscai_input_container_local_var; } @@ -59,6 +67,20 @@ cJSON *OpenAPI_tscai_input_container_convertToJSON(OpenAPI_tscai_input_container } } + if (tscai_input_container->is_sur_time_in_num_msg) { + if (cJSON_AddNumberToObject(item, "surTimeInNumMsg", tscai_input_container->sur_time_in_num_msg) == NULL) { + ogs_error("OpenAPI_tscai_input_container_convertToJSON() failed [sur_time_in_num_msg]"); + goto end; + } + } + + if (tscai_input_container->is_sur_time_in_time) { + if (cJSON_AddNumberToObject(item, "surTimeInTime", tscai_input_container->sur_time_in_time) == NULL) { + ogs_error("OpenAPI_tscai_input_container_convertToJSON() failed [sur_time_in_time]"); + goto end; + } + } + end: return item; } @@ -69,6 +91,8 @@ OpenAPI_tscai_input_container_t *OpenAPI_tscai_input_container_parseFromJSON(cJS OpenAPI_lnode_t *node = NULL; cJSON *periodicity = NULL; cJSON *burst_arrival_time = NULL; + cJSON *sur_time_in_num_msg = NULL; + cJSON *sur_time_in_time = NULL; periodicity = cJSON_GetObjectItemCaseSensitive(tscai_input_containerJSON, "periodicity"); if (periodicity) { if (!cJSON_IsNumber(periodicity)) { @@ -85,10 +109,30 @@ OpenAPI_tscai_input_container_t *OpenAPI_tscai_input_container_parseFromJSON(cJS } } + sur_time_in_num_msg = cJSON_GetObjectItemCaseSensitive(tscai_input_containerJSON, "surTimeInNumMsg"); + if (sur_time_in_num_msg) { + if (!cJSON_IsNumber(sur_time_in_num_msg)) { + ogs_error("OpenAPI_tscai_input_container_parseFromJSON() failed [sur_time_in_num_msg]"); + goto end; + } + } + + sur_time_in_time = cJSON_GetObjectItemCaseSensitive(tscai_input_containerJSON, "surTimeInTime"); + if (sur_time_in_time) { + if (!cJSON_IsNumber(sur_time_in_time)) { + ogs_error("OpenAPI_tscai_input_container_parseFromJSON() failed [sur_time_in_time]"); + goto end; + } + } + tscai_input_container_local_var = OpenAPI_tscai_input_container_create ( periodicity ? true : false, periodicity ? periodicity->valuedouble : 0, - burst_arrival_time && !cJSON_IsNull(burst_arrival_time) ? ogs_strdup(burst_arrival_time->valuestring) : NULL + burst_arrival_time && !cJSON_IsNull(burst_arrival_time) ? ogs_strdup(burst_arrival_time->valuestring) : NULL, + sur_time_in_num_msg ? true : false, + sur_time_in_num_msg ? sur_time_in_num_msg->valuedouble : 0, + sur_time_in_time ? true : false, + sur_time_in_time ? sur_time_in_time->valuedouble : 0 ); return tscai_input_container_local_var; diff --git a/lib/sbi/openapi/model/tscai_input_container.h b/lib/sbi/openapi/model/tscai_input_container.h index 0ccbf4cf7..1ee1802c8 100644 --- a/lib/sbi/openapi/model/tscai_input_container.h +++ b/lib/sbi/openapi/model/tscai_input_container.h @@ -22,12 +22,20 @@ typedef struct OpenAPI_tscai_input_container_s { bool is_periodicity; int periodicity; char *burst_arrival_time; + bool is_sur_time_in_num_msg; + int sur_time_in_num_msg; + bool is_sur_time_in_time; + int sur_time_in_time; } OpenAPI_tscai_input_container_t; OpenAPI_tscai_input_container_t *OpenAPI_tscai_input_container_create( bool is_periodicity, int periodicity, - char *burst_arrival_time + char *burst_arrival_time, + bool is_sur_time_in_num_msg, + int sur_time_in_num_msg, + bool is_sur_time_in_time, + int sur_time_in_time ); void OpenAPI_tscai_input_container_free(OpenAPI_tscai_input_container_t *tscai_input_container); OpenAPI_tscai_input_container_t *OpenAPI_tscai_input_container_parseFromJSON(cJSON *tscai_input_containerJSON); diff --git a/lib/sbi/openapi/model/tsctsf_info.c b/lib/sbi/openapi/model/tsctsf_info.c new file mode 100644 index 000000000..59c1bd3e7 --- /dev/null +++ b/lib/sbi/openapi/model/tsctsf_info.c @@ -0,0 +1,400 @@ + +#include +#include +#include +#include "tsctsf_info.h" + +OpenAPI_tsctsf_info_t *OpenAPI_tsctsf_info_create( + OpenAPI_list_t* s_nssai_info_list, + OpenAPI_list_t *external_group_identifiers_ranges, + OpenAPI_list_t *supi_ranges, + OpenAPI_list_t *gpsi_ranges, + OpenAPI_list_t *internal_group_identifiers_ranges +) +{ + OpenAPI_tsctsf_info_t *tsctsf_info_local_var = ogs_malloc(sizeof(OpenAPI_tsctsf_info_t)); + ogs_assert(tsctsf_info_local_var); + + tsctsf_info_local_var->s_nssai_info_list = s_nssai_info_list; + tsctsf_info_local_var->external_group_identifiers_ranges = external_group_identifiers_ranges; + tsctsf_info_local_var->supi_ranges = supi_ranges; + tsctsf_info_local_var->gpsi_ranges = gpsi_ranges; + tsctsf_info_local_var->internal_group_identifiers_ranges = internal_group_identifiers_ranges; + + return tsctsf_info_local_var; +} + +void OpenAPI_tsctsf_info_free(OpenAPI_tsctsf_info_t *tsctsf_info) +{ + OpenAPI_lnode_t *node = NULL; + + if (NULL == tsctsf_info) { + return; + } + if (tsctsf_info->s_nssai_info_list) { + OpenAPI_list_for_each(tsctsf_info->s_nssai_info_list, node) { + OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*)node->data; + ogs_free(localKeyValue->key); + OpenAPI_snssai_tsctsf_info_item_free(localKeyValue->value); + OpenAPI_map_free(localKeyValue); + } + OpenAPI_list_free(tsctsf_info->s_nssai_info_list); + tsctsf_info->s_nssai_info_list = NULL; + } + if (tsctsf_info->external_group_identifiers_ranges) { + OpenAPI_list_for_each(tsctsf_info->external_group_identifiers_ranges, node) { + OpenAPI_identity_range_free(node->data); + } + OpenAPI_list_free(tsctsf_info->external_group_identifiers_ranges); + tsctsf_info->external_group_identifiers_ranges = NULL; + } + if (tsctsf_info->supi_ranges) { + OpenAPI_list_for_each(tsctsf_info->supi_ranges, node) { + OpenAPI_supi_range_free(node->data); + } + OpenAPI_list_free(tsctsf_info->supi_ranges); + tsctsf_info->supi_ranges = NULL; + } + if (tsctsf_info->gpsi_ranges) { + OpenAPI_list_for_each(tsctsf_info->gpsi_ranges, node) { + OpenAPI_identity_range_free(node->data); + } + OpenAPI_list_free(tsctsf_info->gpsi_ranges); + tsctsf_info->gpsi_ranges = NULL; + } + if (tsctsf_info->internal_group_identifiers_ranges) { + OpenAPI_list_for_each(tsctsf_info->internal_group_identifiers_ranges, node) { + OpenAPI_internal_group_id_range_free(node->data); + } + OpenAPI_list_free(tsctsf_info->internal_group_identifiers_ranges); + tsctsf_info->internal_group_identifiers_ranges = NULL; + } + ogs_free(tsctsf_info); +} + +cJSON *OpenAPI_tsctsf_info_convertToJSON(OpenAPI_tsctsf_info_t *tsctsf_info) +{ + cJSON *item = NULL; + OpenAPI_lnode_t *node = NULL; + + if (tsctsf_info == NULL) { + ogs_error("OpenAPI_tsctsf_info_convertToJSON() failed [TsctsfInfo]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (tsctsf_info->s_nssai_info_list) { + cJSON *s_nssai_info_list = cJSON_AddObjectToObject(item, "sNssaiInfoList"); + if (s_nssai_info_list == NULL) { + ogs_error("OpenAPI_tsctsf_info_convertToJSON() failed [s_nssai_info_list]"); + goto end; + } + cJSON *localMapObject = s_nssai_info_list; + if (tsctsf_info->s_nssai_info_list) { + OpenAPI_list_for_each(tsctsf_info->s_nssai_info_list, node) { + OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*)node->data; + cJSON *itemLocal = localKeyValue->value ? + OpenAPI_snssai_tsctsf_info_item_convertToJSON(localKeyValue->value) : + cJSON_CreateNull(); + if (itemLocal == NULL) { + ogs_error("OpenAPI_tsctsf_info_convertToJSON() failed [inner]"); + goto end; + } + cJSON_AddItemToObject(localMapObject, localKeyValue->key, itemLocal); + } + } + } + + if (tsctsf_info->external_group_identifiers_ranges) { + cJSON *external_group_identifiers_rangesList = cJSON_AddArrayToObject(item, "externalGroupIdentifiersRanges"); + if (external_group_identifiers_rangesList == NULL) { + ogs_error("OpenAPI_tsctsf_info_convertToJSON() failed [external_group_identifiers_ranges]"); + goto end; + } + OpenAPI_list_for_each(tsctsf_info->external_group_identifiers_ranges, node) { + cJSON *itemLocal = OpenAPI_identity_range_convertToJSON(node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_tsctsf_info_convertToJSON() failed [external_group_identifiers_ranges]"); + goto end; + } + cJSON_AddItemToArray(external_group_identifiers_rangesList, itemLocal); + } + } + + if (tsctsf_info->supi_ranges) { + cJSON *supi_rangesList = cJSON_AddArrayToObject(item, "supiRanges"); + if (supi_rangesList == NULL) { + ogs_error("OpenAPI_tsctsf_info_convertToJSON() failed [supi_ranges]"); + goto end; + } + OpenAPI_list_for_each(tsctsf_info->supi_ranges, node) { + cJSON *itemLocal = OpenAPI_supi_range_convertToJSON(node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_tsctsf_info_convertToJSON() failed [supi_ranges]"); + goto end; + } + cJSON_AddItemToArray(supi_rangesList, itemLocal); + } + } + + if (tsctsf_info->gpsi_ranges) { + cJSON *gpsi_rangesList = cJSON_AddArrayToObject(item, "gpsiRanges"); + if (gpsi_rangesList == NULL) { + ogs_error("OpenAPI_tsctsf_info_convertToJSON() failed [gpsi_ranges]"); + goto end; + } + OpenAPI_list_for_each(tsctsf_info->gpsi_ranges, node) { + cJSON *itemLocal = OpenAPI_identity_range_convertToJSON(node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_tsctsf_info_convertToJSON() failed [gpsi_ranges]"); + goto end; + } + cJSON_AddItemToArray(gpsi_rangesList, itemLocal); + } + } + + if (tsctsf_info->internal_group_identifiers_ranges) { + cJSON *internal_group_identifiers_rangesList = cJSON_AddArrayToObject(item, "internalGroupIdentifiersRanges"); + if (internal_group_identifiers_rangesList == NULL) { + ogs_error("OpenAPI_tsctsf_info_convertToJSON() failed [internal_group_identifiers_ranges]"); + goto end; + } + OpenAPI_list_for_each(tsctsf_info->internal_group_identifiers_ranges, node) { + cJSON *itemLocal = OpenAPI_internal_group_id_range_convertToJSON(node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_tsctsf_info_convertToJSON() failed [internal_group_identifiers_ranges]"); + goto end; + } + cJSON_AddItemToArray(internal_group_identifiers_rangesList, itemLocal); + } + } + +end: + return item; +} + +OpenAPI_tsctsf_info_t *OpenAPI_tsctsf_info_parseFromJSON(cJSON *tsctsf_infoJSON) +{ + OpenAPI_tsctsf_info_t *tsctsf_info_local_var = NULL; + OpenAPI_lnode_t *node = NULL; + cJSON *s_nssai_info_list = NULL; + OpenAPI_list_t *s_nssai_info_listList = NULL; + cJSON *external_group_identifiers_ranges = NULL; + OpenAPI_list_t *external_group_identifiers_rangesList = NULL; + cJSON *supi_ranges = NULL; + OpenAPI_list_t *supi_rangesList = NULL; + cJSON *gpsi_ranges = NULL; + OpenAPI_list_t *gpsi_rangesList = NULL; + cJSON *internal_group_identifiers_ranges = NULL; + OpenAPI_list_t *internal_group_identifiers_rangesList = NULL; + s_nssai_info_list = cJSON_GetObjectItemCaseSensitive(tsctsf_infoJSON, "sNssaiInfoList"); + if (s_nssai_info_list) { + cJSON *s_nssai_info_list_local_map = NULL; + if (!cJSON_IsObject(s_nssai_info_list) && !cJSON_IsNull(s_nssai_info_list)) { + ogs_error("OpenAPI_tsctsf_info_parseFromJSON() failed [s_nssai_info_list]"); + goto end; + } + if (cJSON_IsObject(s_nssai_info_list)) { + s_nssai_info_listList = OpenAPI_list_create(); + OpenAPI_map_t *localMapKeyPair = NULL; + cJSON_ArrayForEach(s_nssai_info_list_local_map, s_nssai_info_list) { + cJSON *localMapObject = s_nssai_info_list_local_map; + if (cJSON_IsObject(localMapObject)) { + localMapKeyPair = OpenAPI_map_create( + ogs_strdup(localMapObject->string), OpenAPI_snssai_tsctsf_info_item_parseFromJSON(localMapObject)); + } else if (cJSON_IsNull(localMapObject)) { + localMapKeyPair = OpenAPI_map_create(ogs_strdup(localMapObject->string), NULL); + } else { + ogs_error("OpenAPI_tsctsf_info_parseFromJSON() failed [inner]"); + goto end; + } + OpenAPI_list_add(s_nssai_info_listList, localMapKeyPair); + } + } + } + + external_group_identifiers_ranges = cJSON_GetObjectItemCaseSensitive(tsctsf_infoJSON, "externalGroupIdentifiersRanges"); + if (external_group_identifiers_ranges) { + cJSON *external_group_identifiers_ranges_local = NULL; + if (!cJSON_IsArray(external_group_identifiers_ranges)) { + ogs_error("OpenAPI_tsctsf_info_parseFromJSON() failed [external_group_identifiers_ranges]"); + goto end; + } + + external_group_identifiers_rangesList = OpenAPI_list_create(); + + cJSON_ArrayForEach(external_group_identifiers_ranges_local, external_group_identifiers_ranges) { + if (!cJSON_IsObject(external_group_identifiers_ranges_local)) { + ogs_error("OpenAPI_tsctsf_info_parseFromJSON() failed [external_group_identifiers_ranges]"); + goto end; + } + OpenAPI_identity_range_t *external_group_identifiers_rangesItem = OpenAPI_identity_range_parseFromJSON(external_group_identifiers_ranges_local); + if (!external_group_identifiers_rangesItem) { + ogs_error("No external_group_identifiers_rangesItem"); + OpenAPI_list_free(external_group_identifiers_rangesList); + goto end; + } + OpenAPI_list_add(external_group_identifiers_rangesList, external_group_identifiers_rangesItem); + } + } + + supi_ranges = cJSON_GetObjectItemCaseSensitive(tsctsf_infoJSON, "supiRanges"); + if (supi_ranges) { + cJSON *supi_ranges_local = NULL; + if (!cJSON_IsArray(supi_ranges)) { + ogs_error("OpenAPI_tsctsf_info_parseFromJSON() failed [supi_ranges]"); + goto end; + } + + supi_rangesList = OpenAPI_list_create(); + + cJSON_ArrayForEach(supi_ranges_local, supi_ranges) { + if (!cJSON_IsObject(supi_ranges_local)) { + ogs_error("OpenAPI_tsctsf_info_parseFromJSON() failed [supi_ranges]"); + goto end; + } + OpenAPI_supi_range_t *supi_rangesItem = OpenAPI_supi_range_parseFromJSON(supi_ranges_local); + if (!supi_rangesItem) { + ogs_error("No supi_rangesItem"); + OpenAPI_list_free(supi_rangesList); + goto end; + } + OpenAPI_list_add(supi_rangesList, supi_rangesItem); + } + } + + gpsi_ranges = cJSON_GetObjectItemCaseSensitive(tsctsf_infoJSON, "gpsiRanges"); + if (gpsi_ranges) { + cJSON *gpsi_ranges_local = NULL; + if (!cJSON_IsArray(gpsi_ranges)) { + ogs_error("OpenAPI_tsctsf_info_parseFromJSON() failed [gpsi_ranges]"); + goto end; + } + + gpsi_rangesList = OpenAPI_list_create(); + + cJSON_ArrayForEach(gpsi_ranges_local, gpsi_ranges) { + if (!cJSON_IsObject(gpsi_ranges_local)) { + ogs_error("OpenAPI_tsctsf_info_parseFromJSON() failed [gpsi_ranges]"); + goto end; + } + OpenAPI_identity_range_t *gpsi_rangesItem = OpenAPI_identity_range_parseFromJSON(gpsi_ranges_local); + if (!gpsi_rangesItem) { + ogs_error("No gpsi_rangesItem"); + OpenAPI_list_free(gpsi_rangesList); + goto end; + } + OpenAPI_list_add(gpsi_rangesList, gpsi_rangesItem); + } + } + + internal_group_identifiers_ranges = cJSON_GetObjectItemCaseSensitive(tsctsf_infoJSON, "internalGroupIdentifiersRanges"); + if (internal_group_identifiers_ranges) { + cJSON *internal_group_identifiers_ranges_local = NULL; + if (!cJSON_IsArray(internal_group_identifiers_ranges)) { + ogs_error("OpenAPI_tsctsf_info_parseFromJSON() failed [internal_group_identifiers_ranges]"); + goto end; + } + + internal_group_identifiers_rangesList = OpenAPI_list_create(); + + cJSON_ArrayForEach(internal_group_identifiers_ranges_local, internal_group_identifiers_ranges) { + if (!cJSON_IsObject(internal_group_identifiers_ranges_local)) { + ogs_error("OpenAPI_tsctsf_info_parseFromJSON() failed [internal_group_identifiers_ranges]"); + goto end; + } + OpenAPI_internal_group_id_range_t *internal_group_identifiers_rangesItem = OpenAPI_internal_group_id_range_parseFromJSON(internal_group_identifiers_ranges_local); + if (!internal_group_identifiers_rangesItem) { + ogs_error("No internal_group_identifiers_rangesItem"); + OpenAPI_list_free(internal_group_identifiers_rangesList); + goto end; + } + OpenAPI_list_add(internal_group_identifiers_rangesList, internal_group_identifiers_rangesItem); + } + } + + tsctsf_info_local_var = OpenAPI_tsctsf_info_create ( + s_nssai_info_list ? s_nssai_info_listList : NULL, + external_group_identifiers_ranges ? external_group_identifiers_rangesList : NULL, + supi_ranges ? supi_rangesList : NULL, + gpsi_ranges ? gpsi_rangesList : NULL, + internal_group_identifiers_ranges ? internal_group_identifiers_rangesList : NULL + ); + + return tsctsf_info_local_var; +end: + if (s_nssai_info_listList) { + OpenAPI_list_for_each(s_nssai_info_listList, node) { + OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*) node->data; + ogs_free(localKeyValue->key); + OpenAPI_snssai_tsctsf_info_item_free(localKeyValue->value); + OpenAPI_map_free(localKeyValue); + } + OpenAPI_list_free(s_nssai_info_listList); + s_nssai_info_listList = NULL; + } + if (external_group_identifiers_rangesList) { + OpenAPI_list_for_each(external_group_identifiers_rangesList, node) { + OpenAPI_identity_range_free(node->data); + } + OpenAPI_list_free(external_group_identifiers_rangesList); + external_group_identifiers_rangesList = NULL; + } + if (supi_rangesList) { + OpenAPI_list_for_each(supi_rangesList, node) { + OpenAPI_supi_range_free(node->data); + } + OpenAPI_list_free(supi_rangesList); + supi_rangesList = NULL; + } + if (gpsi_rangesList) { + OpenAPI_list_for_each(gpsi_rangesList, node) { + OpenAPI_identity_range_free(node->data); + } + OpenAPI_list_free(gpsi_rangesList); + gpsi_rangesList = NULL; + } + if (internal_group_identifiers_rangesList) { + OpenAPI_list_for_each(internal_group_identifiers_rangesList, node) { + OpenAPI_internal_group_id_range_free(node->data); + } + OpenAPI_list_free(internal_group_identifiers_rangesList); + internal_group_identifiers_rangesList = NULL; + } + return NULL; +} + +OpenAPI_tsctsf_info_t *OpenAPI_tsctsf_info_copy(OpenAPI_tsctsf_info_t *dst, OpenAPI_tsctsf_info_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_tsctsf_info_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_tsctsf_info_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_tsctsf_info_free(dst); + dst = OpenAPI_tsctsf_info_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/tsctsf_info.h b/lib/sbi/openapi/model/tsctsf_info.h new file mode 100644 index 000000000..d84ea8d55 --- /dev/null +++ b/lib/sbi/openapi/model/tsctsf_info.h @@ -0,0 +1,50 @@ +/* + * tsctsf_info.h + * + * Information of a TSCTSF NF Instance + */ + +#ifndef _OpenAPI_tsctsf_info_H_ +#define _OpenAPI_tsctsf_info_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "identity_range.h" +#include "internal_group_id_range.h" +#include "snssai_tsctsf_info_item.h" +#include "supi_range.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_tsctsf_info_s OpenAPI_tsctsf_info_t; +typedef struct OpenAPI_tsctsf_info_s { + OpenAPI_list_t* s_nssai_info_list; + OpenAPI_list_t *external_group_identifiers_ranges; + OpenAPI_list_t *supi_ranges; + OpenAPI_list_t *gpsi_ranges; + OpenAPI_list_t *internal_group_identifiers_ranges; +} OpenAPI_tsctsf_info_t; + +OpenAPI_tsctsf_info_t *OpenAPI_tsctsf_info_create( + OpenAPI_list_t* s_nssai_info_list, + OpenAPI_list_t *external_group_identifiers_ranges, + OpenAPI_list_t *supi_ranges, + OpenAPI_list_t *gpsi_ranges, + OpenAPI_list_t *internal_group_identifiers_ranges +); +void OpenAPI_tsctsf_info_free(OpenAPI_tsctsf_info_t *tsctsf_info); +OpenAPI_tsctsf_info_t *OpenAPI_tsctsf_info_parseFromJSON(cJSON *tsctsf_infoJSON); +cJSON *OpenAPI_tsctsf_info_convertToJSON(OpenAPI_tsctsf_info_t *tsctsf_info); +OpenAPI_tsctsf_info_t *OpenAPI_tsctsf_info_copy(OpenAPI_tsctsf_info_t *dst, OpenAPI_tsctsf_info_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_tsctsf_info_H_ */ + diff --git a/lib/sbi/openapi/model/tsn_bridge_info.h b/lib/sbi/openapi/model/tsn_bridge_info.h index 2bc4a385b..e95a1a36d 100644 --- a/lib/sbi/openapi/model/tsn_bridge_info.h +++ b/lib/sbi/openapi/model/tsn_bridge_info.h @@ -1,7 +1,7 @@ /* * tsn_bridge_info.h * - * + * Contains parameters that describe and identify the TSC user plane node. */ #ifndef _OpenAPI_tsn_bridge_info_H_ diff --git a/lib/sbi/openapi/model/tunnel_info.h b/lib/sbi/openapi/model/tunnel_info.h index 1dbb5e385..30649d60e 100644 --- a/lib/sbi/openapi/model/tunnel_info.h +++ b/lib/sbi/openapi/model/tunnel_info.h @@ -1,7 +1,7 @@ /* * tunnel_info.h * - * + * Tunnel Information */ #ifndef _OpenAPI_tunnel_info_H_ diff --git a/lib/sbi/openapi/model/twap_id.h b/lib/sbi/openapi/model/twap_id.h index ea91a4572..beb751482 100644 --- a/lib/sbi/openapi/model/twap_id.h +++ b/lib/sbi/openapi/model/twap_id.h @@ -1,7 +1,7 @@ /* * twap_id.h * - * + * Contain the TWAP Identifier as defined in clause 4.2.8.5.3 of 3GPP TS 23.501 or the WLAN location information as defined in clause 4.5.7.2.8 of 3GPP TS 23.402. */ #ifndef _OpenAPI_twap_id_H_ diff --git a/lib/sbi/openapi/model/uc_purpose.c b/lib/sbi/openapi/model/uc_purpose.c new file mode 100644 index 000000000..140344d58 --- /dev/null +++ b/lib/sbi/openapi/model/uc_purpose.c @@ -0,0 +1,30 @@ + +#include +#include +#include +#include "uc_purpose.h" + +char* OpenAPI_uc_purpose_ToString(OpenAPI_uc_purpose_e uc_purpose) +{ + const char *uc_purposeArray[] = { "NULL", "ANALYTICS", "MODEL_TRAINING", "NW_CAP_EXPOSURE", "EDGEAPP_UE_LOCATION" }; + size_t sizeofArray = sizeof(uc_purposeArray) / sizeof(uc_purposeArray[0]); + if (uc_purpose < sizeofArray) + return (char *)uc_purposeArray[uc_purpose]; + else + return (char *)"Unknown"; +} + +OpenAPI_uc_purpose_e OpenAPI_uc_purpose_FromString(char* uc_purpose) +{ + int stringToReturn = 0; + const char *uc_purposeArray[] = { "NULL", "ANALYTICS", "MODEL_TRAINING", "NW_CAP_EXPOSURE", "EDGEAPP_UE_LOCATION" }; + size_t sizeofArray = sizeof(uc_purposeArray) / sizeof(uc_purposeArray[0]); + while (stringToReturn < sizeofArray) { + if (strcmp(uc_purpose, uc_purposeArray[stringToReturn]) == 0) { + return stringToReturn; + } + stringToReturn++; + } + return 0; +} + diff --git a/lib/sbi/openapi/model/uc_purpose.h b/lib/sbi/openapi/model/uc_purpose.h new file mode 100644 index 000000000..4d6885161 --- /dev/null +++ b/lib/sbi/openapi/model/uc_purpose.h @@ -0,0 +1,31 @@ +/* + * uc_purpose.h + * + * + */ + +#ifndef _OpenAPI_uc_purpose_H_ +#define _OpenAPI_uc_purpose_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef enum { OpenAPI_uc_purpose_NULL = 0, OpenAPI_uc_purpose_ANALYTICS, OpenAPI_uc_purpose_MODEL_TRAINING, OpenAPI_uc_purpose_NW_CAP_EXPOSURE, OpenAPI_uc_purpose_EDGEAPP_UE_LOCATION } OpenAPI_uc_purpose_e; + +char* OpenAPI_uc_purpose_ToString(OpenAPI_uc_purpose_e uc_purpose); + +OpenAPI_uc_purpose_e OpenAPI_uc_purpose_FromString(char* uc_purpose); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_uc_purpose_H_ */ + diff --git a/lib/sbi/openapi/model/uc_subscription_data.c b/lib/sbi/openapi/model/uc_subscription_data.c new file mode 100644 index 000000000..e0fb2d3d9 --- /dev/null +++ b/lib/sbi/openapi/model/uc_subscription_data.c @@ -0,0 +1,150 @@ + +#include +#include +#include +#include "uc_subscription_data.h" + +OpenAPI_uc_subscription_data_t *OpenAPI_uc_subscription_data_create( + OpenAPI_list_t* user_consent_per_purpose_list +) +{ + OpenAPI_uc_subscription_data_t *uc_subscription_data_local_var = ogs_malloc(sizeof(OpenAPI_uc_subscription_data_t)); + ogs_assert(uc_subscription_data_local_var); + + uc_subscription_data_local_var->user_consent_per_purpose_list = user_consent_per_purpose_list; + + return uc_subscription_data_local_var; +} + +void OpenAPI_uc_subscription_data_free(OpenAPI_uc_subscription_data_t *uc_subscription_data) +{ + OpenAPI_lnode_t *node = NULL; + + if (NULL == uc_subscription_data) { + return; + } + if (uc_subscription_data->user_consent_per_purpose_list) { + OpenAPI_list_for_each(uc_subscription_data->user_consent_per_purpose_list, node) { + OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*)node->data; + ogs_free(localKeyValue->key); + OpenAPI_map_free(localKeyValue); + } + OpenAPI_list_free(uc_subscription_data->user_consent_per_purpose_list); + uc_subscription_data->user_consent_per_purpose_list = NULL; + } + ogs_free(uc_subscription_data); +} + +cJSON *OpenAPI_uc_subscription_data_convertToJSON(OpenAPI_uc_subscription_data_t *uc_subscription_data) +{ + cJSON *item = NULL; + OpenAPI_lnode_t *node = NULL; + + if (uc_subscription_data == NULL) { + ogs_error("OpenAPI_uc_subscription_data_convertToJSON() failed [UcSubscriptionData]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (uc_subscription_data->user_consent_per_purpose_list != OpenAPI_user_consent_NULL) { + cJSON *user_consent_per_purpose_list = cJSON_AddObjectToObject(item, "userConsentPerPurposeList"); + if (user_consent_per_purpose_list == NULL) { + ogs_error("OpenAPI_uc_subscription_data_convertToJSON() failed [user_consent_per_purpose_list]"); + goto end; + } + cJSON *localMapObject = user_consent_per_purpose_list; + if (uc_subscription_data->user_consent_per_purpose_list) { + OpenAPI_list_for_each(uc_subscription_data->user_consent_per_purpose_list, node) { + OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*)node->data; + if (cJSON_AddStringToObject(localMapObject, localKeyValue->key, OpenAPI_user_consent_ToString((intptr_t)localKeyValue->value)) == NULL) { + ogs_error("OpenAPI_uc_subscription_data_convertToJSON() failed [user_consent_per_purpose_list]"); + goto end; + } + } + } + } + +end: + return item; +} + +OpenAPI_uc_subscription_data_t *OpenAPI_uc_subscription_data_parseFromJSON(cJSON *uc_subscription_dataJSON) +{ + OpenAPI_uc_subscription_data_t *uc_subscription_data_local_var = NULL; + OpenAPI_lnode_t *node = NULL; + cJSON *user_consent_per_purpose_list = NULL; + OpenAPI_list_t *user_consent_per_purpose_listList = NULL; + user_consent_per_purpose_list = cJSON_GetObjectItemCaseSensitive(uc_subscription_dataJSON, "userConsentPerPurposeList"); + if (user_consent_per_purpose_list) { + cJSON *user_consent_per_purpose_list_local_map = NULL; + if (!cJSON_IsObject(user_consent_per_purpose_list) && !cJSON_IsNull(user_consent_per_purpose_list)) { + ogs_error("OpenAPI_uc_subscription_data_parseFromJSON() failed [user_consent_per_purpose_list]"); + goto end; + } + if (cJSON_IsObject(user_consent_per_purpose_list)) { + user_consent_per_purpose_listList = OpenAPI_list_create(); + OpenAPI_map_t *localMapKeyPair = NULL; + cJSON_ArrayForEach(user_consent_per_purpose_list_local_map, user_consent_per_purpose_list) { + cJSON *localMapObject = user_consent_per_purpose_list_local_map; + if (!cJSON_IsString(localMapObject)) { + ogs_error("OpenAPI_uc_subscription_data_parseFromJSON() failed [user_consent_per_purpose_list]"); + goto end; + } + localMapKeyPair = OpenAPI_map_create(ogs_strdup(localMapObject->string), (void *)OpenAPI_user_consent_FromString(localMapObject->string)); + OpenAPI_list_add(user_consent_per_purpose_listList, localMapKeyPair); + } + } + } + + uc_subscription_data_local_var = OpenAPI_uc_subscription_data_create ( + user_consent_per_purpose_list ? user_consent_per_purpose_listList : NULL + ); + + return uc_subscription_data_local_var; +end: + if (user_consent_per_purpose_listList) { + OpenAPI_list_for_each(user_consent_per_purpose_listList, node) { + OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*) node->data; + ogs_free(localKeyValue->key); + OpenAPI_map_free(localKeyValue); + } + OpenAPI_list_free(user_consent_per_purpose_listList); + user_consent_per_purpose_listList = NULL; + } + return NULL; +} + +OpenAPI_uc_subscription_data_t *OpenAPI_uc_subscription_data_copy(OpenAPI_uc_subscription_data_t *dst, OpenAPI_uc_subscription_data_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_uc_subscription_data_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_uc_subscription_data_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_uc_subscription_data_free(dst); + dst = OpenAPI_uc_subscription_data_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/uc_subscription_data.h b/lib/sbi/openapi/model/uc_subscription_data.h new file mode 100644 index 000000000..af759d622 --- /dev/null +++ b/lib/sbi/openapi/model/uc_subscription_data.h @@ -0,0 +1,39 @@ +/* + * uc_subscription_data.h + * + * Contains the User Consent Subscription Data. + */ + +#ifndef _OpenAPI_uc_subscription_data_H_ +#define _OpenAPI_uc_subscription_data_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "user_consent.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_uc_subscription_data_s OpenAPI_uc_subscription_data_t; +typedef struct OpenAPI_uc_subscription_data_s { + OpenAPI_list_t* user_consent_per_purpose_list; +} OpenAPI_uc_subscription_data_t; + +OpenAPI_uc_subscription_data_t *OpenAPI_uc_subscription_data_create( + OpenAPI_list_t* user_consent_per_purpose_list +); +void OpenAPI_uc_subscription_data_free(OpenAPI_uc_subscription_data_t *uc_subscription_data); +OpenAPI_uc_subscription_data_t *OpenAPI_uc_subscription_data_parseFromJSON(cJSON *uc_subscription_dataJSON); +cJSON *OpenAPI_uc_subscription_data_convertToJSON(OpenAPI_uc_subscription_data_t *uc_subscription_data); +OpenAPI_uc_subscription_data_t *OpenAPI_uc_subscription_data_copy(OpenAPI_uc_subscription_data_t *dst, OpenAPI_uc_subscription_data_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_uc_subscription_data_H_ */ + diff --git a/lib/sbi/openapi/model/udm_info.c b/lib/sbi/openapi/model/udm_info.c index df702257b..965823403 100644 --- a/lib/sbi/openapi/model/udm_info.c +++ b/lib/sbi/openapi/model/udm_info.c @@ -10,7 +10,8 @@ OpenAPI_udm_info_t *OpenAPI_udm_info_create( OpenAPI_list_t *gpsi_ranges, OpenAPI_list_t *external_group_identifiers_ranges, OpenAPI_list_t *routing_indicators, - OpenAPI_list_t *internal_group_identifiers_ranges + OpenAPI_list_t *internal_group_identifiers_ranges, + OpenAPI_list_t *suci_infos ) { OpenAPI_udm_info_t *udm_info_local_var = ogs_malloc(sizeof(OpenAPI_udm_info_t)); @@ -22,6 +23,7 @@ OpenAPI_udm_info_t *OpenAPI_udm_info_create( udm_info_local_var->external_group_identifiers_ranges = external_group_identifiers_ranges; udm_info_local_var->routing_indicators = routing_indicators; udm_info_local_var->internal_group_identifiers_ranges = internal_group_identifiers_ranges; + udm_info_local_var->suci_infos = suci_infos; return udm_info_local_var; } @@ -72,6 +74,13 @@ void OpenAPI_udm_info_free(OpenAPI_udm_info_t *udm_info) OpenAPI_list_free(udm_info->internal_group_identifiers_ranges); udm_info->internal_group_identifiers_ranges = NULL; } + if (udm_info->suci_infos) { + OpenAPI_list_for_each(udm_info->suci_infos, node) { + OpenAPI_suci_info_free(node->data); + } + OpenAPI_list_free(udm_info->suci_infos); + udm_info->suci_infos = NULL; + } ogs_free(udm_info); } @@ -171,6 +180,22 @@ cJSON *OpenAPI_udm_info_convertToJSON(OpenAPI_udm_info_t *udm_info) } } + if (udm_info->suci_infos) { + cJSON *suci_infosList = cJSON_AddArrayToObject(item, "suciInfos"); + if (suci_infosList == NULL) { + ogs_error("OpenAPI_udm_info_convertToJSON() failed [suci_infos]"); + goto end; + } + OpenAPI_list_for_each(udm_info->suci_infos, node) { + cJSON *itemLocal = OpenAPI_suci_info_convertToJSON(node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_udm_info_convertToJSON() failed [suci_infos]"); + goto end; + } + cJSON_AddItemToArray(suci_infosList, itemLocal); + } + } + end: return item; } @@ -190,6 +215,8 @@ OpenAPI_udm_info_t *OpenAPI_udm_info_parseFromJSON(cJSON *udm_infoJSON) OpenAPI_list_t *routing_indicatorsList = NULL; cJSON *internal_group_identifiers_ranges = NULL; OpenAPI_list_t *internal_group_identifiers_rangesList = NULL; + cJSON *suci_infos = NULL; + OpenAPI_list_t *suci_infosList = NULL; group_id = cJSON_GetObjectItemCaseSensitive(udm_infoJSON, "groupId"); if (group_id) { if (!cJSON_IsString(group_id) && !cJSON_IsNull(group_id)) { @@ -319,13 +346,39 @@ OpenAPI_udm_info_t *OpenAPI_udm_info_parseFromJSON(cJSON *udm_infoJSON) } } + suci_infos = cJSON_GetObjectItemCaseSensitive(udm_infoJSON, "suciInfos"); + if (suci_infos) { + cJSON *suci_infos_local = NULL; + if (!cJSON_IsArray(suci_infos)) { + ogs_error("OpenAPI_udm_info_parseFromJSON() failed [suci_infos]"); + goto end; + } + + suci_infosList = OpenAPI_list_create(); + + cJSON_ArrayForEach(suci_infos_local, suci_infos) { + if (!cJSON_IsObject(suci_infos_local)) { + ogs_error("OpenAPI_udm_info_parseFromJSON() failed [suci_infos]"); + goto end; + } + OpenAPI_suci_info_t *suci_infosItem = OpenAPI_suci_info_parseFromJSON(suci_infos_local); + if (!suci_infosItem) { + ogs_error("No suci_infosItem"); + OpenAPI_list_free(suci_infosList); + goto end; + } + OpenAPI_list_add(suci_infosList, suci_infosItem); + } + } + udm_info_local_var = OpenAPI_udm_info_create ( group_id && !cJSON_IsNull(group_id) ? ogs_strdup(group_id->valuestring) : NULL, supi_ranges ? supi_rangesList : NULL, gpsi_ranges ? gpsi_rangesList : NULL, external_group_identifiers_ranges ? external_group_identifiers_rangesList : NULL, routing_indicators ? routing_indicatorsList : NULL, - internal_group_identifiers_ranges ? internal_group_identifiers_rangesList : NULL + internal_group_identifiers_ranges ? internal_group_identifiers_rangesList : NULL, + suci_infos ? suci_infosList : NULL ); return udm_info_local_var; @@ -365,6 +418,13 @@ end: OpenAPI_list_free(internal_group_identifiers_rangesList); internal_group_identifiers_rangesList = NULL; } + if (suci_infosList) { + OpenAPI_list_for_each(suci_infosList, node) { + OpenAPI_suci_info_free(node->data); + } + OpenAPI_list_free(suci_infosList); + suci_infosList = NULL; + } return NULL; } diff --git a/lib/sbi/openapi/model/udm_info.h b/lib/sbi/openapi/model/udm_info.h index 2f377be79..9fdf7408e 100644 --- a/lib/sbi/openapi/model/udm_info.h +++ b/lib/sbi/openapi/model/udm_info.h @@ -14,6 +14,7 @@ #include "../include/binary.h" #include "identity_range.h" #include "internal_group_id_range.h" +#include "suci_info.h" #include "supi_range.h" #ifdef __cplusplus @@ -28,6 +29,7 @@ typedef struct OpenAPI_udm_info_s { OpenAPI_list_t *external_group_identifiers_ranges; OpenAPI_list_t *routing_indicators; OpenAPI_list_t *internal_group_identifiers_ranges; + OpenAPI_list_t *suci_infos; } OpenAPI_udm_info_t; OpenAPI_udm_info_t *OpenAPI_udm_info_create( @@ -36,7 +38,8 @@ OpenAPI_udm_info_t *OpenAPI_udm_info_create( OpenAPI_list_t *gpsi_ranges, OpenAPI_list_t *external_group_identifiers_ranges, OpenAPI_list_t *routing_indicators, - OpenAPI_list_t *internal_group_identifiers_ranges + OpenAPI_list_t *internal_group_identifiers_ranges, + OpenAPI_list_t *suci_infos ); void OpenAPI_udm_info_free(OpenAPI_udm_info_t *udm_info); OpenAPI_udm_info_t *OpenAPI_udm_info_parseFromJSON(cJSON *udm_infoJSON); diff --git a/lib/sbi/openapi/model/udr_info.c b/lib/sbi/openapi/model/udr_info.c index a21303da2..7e6fe0200 100644 --- a/lib/sbi/openapi/model/udr_info.c +++ b/lib/sbi/openapi/model/udr_info.c @@ -9,7 +9,8 @@ OpenAPI_udr_info_t *OpenAPI_udr_info_create( OpenAPI_list_t *supi_ranges, OpenAPI_list_t *gpsi_ranges, OpenAPI_list_t *external_group_identifiers_ranges, - OpenAPI_list_t *supported_data_sets + OpenAPI_list_t *supported_data_sets, + OpenAPI_list_t *shared_data_id_ranges ) { OpenAPI_udr_info_t *udr_info_local_var = ogs_malloc(sizeof(OpenAPI_udr_info_t)); @@ -20,6 +21,7 @@ OpenAPI_udr_info_t *OpenAPI_udr_info_create( udr_info_local_var->gpsi_ranges = gpsi_ranges; udr_info_local_var->external_group_identifiers_ranges = external_group_identifiers_ranges; udr_info_local_var->supported_data_sets = supported_data_sets; + udr_info_local_var->shared_data_id_ranges = shared_data_id_ranges; return udr_info_local_var; } @@ -60,6 +62,13 @@ void OpenAPI_udr_info_free(OpenAPI_udr_info_t *udr_info) OpenAPI_list_free(udr_info->supported_data_sets); udr_info->supported_data_sets = NULL; } + if (udr_info->shared_data_id_ranges) { + OpenAPI_list_for_each(udr_info->shared_data_id_ranges, node) { + OpenAPI_shared_data_id_range_free(node->data); + } + OpenAPI_list_free(udr_info->shared_data_id_ranges); + udr_info->shared_data_id_ranges = NULL; + } ogs_free(udr_info); } @@ -143,6 +152,22 @@ cJSON *OpenAPI_udr_info_convertToJSON(OpenAPI_udr_info_t *udr_info) } } + if (udr_info->shared_data_id_ranges) { + cJSON *shared_data_id_rangesList = cJSON_AddArrayToObject(item, "sharedDataIdRanges"); + if (shared_data_id_rangesList == NULL) { + ogs_error("OpenAPI_udr_info_convertToJSON() failed [shared_data_id_ranges]"); + goto end; + } + OpenAPI_list_for_each(udr_info->shared_data_id_ranges, node) { + cJSON *itemLocal = OpenAPI_shared_data_id_range_convertToJSON(node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_udr_info_convertToJSON() failed [shared_data_id_ranges]"); + goto end; + } + cJSON_AddItemToArray(shared_data_id_rangesList, itemLocal); + } + } + end: return item; } @@ -160,6 +185,8 @@ OpenAPI_udr_info_t *OpenAPI_udr_info_parseFromJSON(cJSON *udr_infoJSON) OpenAPI_list_t *external_group_identifiers_rangesList = NULL; cJSON *supported_data_sets = NULL; OpenAPI_list_t *supported_data_setsList = NULL; + cJSON *shared_data_id_ranges = NULL; + OpenAPI_list_t *shared_data_id_rangesList = NULL; group_id = cJSON_GetObjectItemCaseSensitive(udr_infoJSON, "groupId"); if (group_id) { if (!cJSON_IsString(group_id) && !cJSON_IsNull(group_id)) { @@ -262,12 +289,38 @@ OpenAPI_udr_info_t *OpenAPI_udr_info_parseFromJSON(cJSON *udr_infoJSON) } } + shared_data_id_ranges = cJSON_GetObjectItemCaseSensitive(udr_infoJSON, "sharedDataIdRanges"); + if (shared_data_id_ranges) { + cJSON *shared_data_id_ranges_local = NULL; + if (!cJSON_IsArray(shared_data_id_ranges)) { + ogs_error("OpenAPI_udr_info_parseFromJSON() failed [shared_data_id_ranges]"); + goto end; + } + + shared_data_id_rangesList = OpenAPI_list_create(); + + cJSON_ArrayForEach(shared_data_id_ranges_local, shared_data_id_ranges) { + if (!cJSON_IsObject(shared_data_id_ranges_local)) { + ogs_error("OpenAPI_udr_info_parseFromJSON() failed [shared_data_id_ranges]"); + goto end; + } + OpenAPI_shared_data_id_range_t *shared_data_id_rangesItem = OpenAPI_shared_data_id_range_parseFromJSON(shared_data_id_ranges_local); + if (!shared_data_id_rangesItem) { + ogs_error("No shared_data_id_rangesItem"); + OpenAPI_list_free(shared_data_id_rangesList); + goto end; + } + OpenAPI_list_add(shared_data_id_rangesList, shared_data_id_rangesItem); + } + } + udr_info_local_var = OpenAPI_udr_info_create ( group_id && !cJSON_IsNull(group_id) ? ogs_strdup(group_id->valuestring) : NULL, supi_ranges ? supi_rangesList : NULL, gpsi_ranges ? gpsi_rangesList : NULL, external_group_identifiers_ranges ? external_group_identifiers_rangesList : NULL, - supported_data_sets ? supported_data_setsList : NULL + supported_data_sets ? supported_data_setsList : NULL, + shared_data_id_ranges ? shared_data_id_rangesList : NULL ); return udr_info_local_var; @@ -297,6 +350,13 @@ end: OpenAPI_list_free(supported_data_setsList); supported_data_setsList = NULL; } + if (shared_data_id_rangesList) { + OpenAPI_list_for_each(shared_data_id_rangesList, node) { + OpenAPI_shared_data_id_range_free(node->data); + } + OpenAPI_list_free(shared_data_id_rangesList); + shared_data_id_rangesList = NULL; + } return NULL; } diff --git a/lib/sbi/openapi/model/udr_info.h b/lib/sbi/openapi/model/udr_info.h index 8dd9b6b51..64a854b93 100644 --- a/lib/sbi/openapi/model/udr_info.h +++ b/lib/sbi/openapi/model/udr_info.h @@ -14,6 +14,7 @@ #include "../include/binary.h" #include "data_set_id.h" #include "identity_range.h" +#include "shared_data_id_range.h" #include "supi_range.h" #ifdef __cplusplus @@ -27,6 +28,7 @@ typedef struct OpenAPI_udr_info_s { OpenAPI_list_t *gpsi_ranges; OpenAPI_list_t *external_group_identifiers_ranges; OpenAPI_list_t *supported_data_sets; + OpenAPI_list_t *shared_data_id_ranges; } OpenAPI_udr_info_t; OpenAPI_udr_info_t *OpenAPI_udr_info_create( @@ -34,7 +36,8 @@ OpenAPI_udr_info_t *OpenAPI_udr_info_create( OpenAPI_list_t *supi_ranges, OpenAPI_list_t *gpsi_ranges, OpenAPI_list_t *external_group_identifiers_ranges, - OpenAPI_list_t *supported_data_sets + OpenAPI_list_t *supported_data_sets, + OpenAPI_list_t *shared_data_id_ranges ); void OpenAPI_udr_info_free(OpenAPI_udr_info_t *udr_info); OpenAPI_udr_info_t *OpenAPI_udr_info_parseFromJSON(cJSON *udr_infoJSON); diff --git a/lib/sbi/openapi/model/ue_analytics_context_descriptor.c b/lib/sbi/openapi/model/ue_analytics_context_descriptor.c new file mode 100644 index 000000000..83be5cfb7 --- /dev/null +++ b/lib/sbi/openapi/model/ue_analytics_context_descriptor.c @@ -0,0 +1,178 @@ + +#include +#include +#include +#include "ue_analytics_context_descriptor.h" + +OpenAPI_ue_analytics_context_descriptor_t *OpenAPI_ue_analytics_context_descriptor_create( + char *supi, + OpenAPI_list_t *ana_types +) +{ + OpenAPI_ue_analytics_context_descriptor_t *ue_analytics_context_descriptor_local_var = ogs_malloc(sizeof(OpenAPI_ue_analytics_context_descriptor_t)); + ogs_assert(ue_analytics_context_descriptor_local_var); + + ue_analytics_context_descriptor_local_var->supi = supi; + ue_analytics_context_descriptor_local_var->ana_types = ana_types; + + return ue_analytics_context_descriptor_local_var; +} + +void OpenAPI_ue_analytics_context_descriptor_free(OpenAPI_ue_analytics_context_descriptor_t *ue_analytics_context_descriptor) +{ + OpenAPI_lnode_t *node = NULL; + + if (NULL == ue_analytics_context_descriptor) { + return; + } + if (ue_analytics_context_descriptor->supi) { + ogs_free(ue_analytics_context_descriptor->supi); + ue_analytics_context_descriptor->supi = NULL; + } + if (ue_analytics_context_descriptor->ana_types) { + OpenAPI_list_for_each(ue_analytics_context_descriptor->ana_types, node) { + OpenAPI_nwdaf_event_free(node->data); + } + OpenAPI_list_free(ue_analytics_context_descriptor->ana_types); + ue_analytics_context_descriptor->ana_types = NULL; + } + ogs_free(ue_analytics_context_descriptor); +} + +cJSON *OpenAPI_ue_analytics_context_descriptor_convertToJSON(OpenAPI_ue_analytics_context_descriptor_t *ue_analytics_context_descriptor) +{ + cJSON *item = NULL; + OpenAPI_lnode_t *node = NULL; + + if (ue_analytics_context_descriptor == NULL) { + ogs_error("OpenAPI_ue_analytics_context_descriptor_convertToJSON() failed [UeAnalyticsContextDescriptor]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (!ue_analytics_context_descriptor->supi) { + ogs_error("OpenAPI_ue_analytics_context_descriptor_convertToJSON() failed [supi]"); + return NULL; + } + if (cJSON_AddStringToObject(item, "supi", ue_analytics_context_descriptor->supi) == NULL) { + ogs_error("OpenAPI_ue_analytics_context_descriptor_convertToJSON() failed [supi]"); + goto end; + } + + if (!ue_analytics_context_descriptor->ana_types) { + ogs_error("OpenAPI_ue_analytics_context_descriptor_convertToJSON() failed [ana_types]"); + return NULL; + } + cJSON *ana_typesList = cJSON_AddArrayToObject(item, "anaTypes"); + if (ana_typesList == NULL) { + ogs_error("OpenAPI_ue_analytics_context_descriptor_convertToJSON() failed [ana_types]"); + goto end; + } + OpenAPI_list_for_each(ue_analytics_context_descriptor->ana_types, node) { + cJSON *itemLocal = OpenAPI_nwdaf_event_convertToJSON(node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_ue_analytics_context_descriptor_convertToJSON() failed [ana_types]"); + goto end; + } + cJSON_AddItemToArray(ana_typesList, itemLocal); + } + +end: + return item; +} + +OpenAPI_ue_analytics_context_descriptor_t *OpenAPI_ue_analytics_context_descriptor_parseFromJSON(cJSON *ue_analytics_context_descriptorJSON) +{ + OpenAPI_ue_analytics_context_descriptor_t *ue_analytics_context_descriptor_local_var = NULL; + OpenAPI_lnode_t *node = NULL; + cJSON *supi = NULL; + cJSON *ana_types = NULL; + OpenAPI_list_t *ana_typesList = NULL; + supi = cJSON_GetObjectItemCaseSensitive(ue_analytics_context_descriptorJSON, "supi"); + if (!supi) { + ogs_error("OpenAPI_ue_analytics_context_descriptor_parseFromJSON() failed [supi]"); + goto end; + } + if (!cJSON_IsString(supi)) { + ogs_error("OpenAPI_ue_analytics_context_descriptor_parseFromJSON() failed [supi]"); + goto end; + } + + ana_types = cJSON_GetObjectItemCaseSensitive(ue_analytics_context_descriptorJSON, "anaTypes"); + if (!ana_types) { + ogs_error("OpenAPI_ue_analytics_context_descriptor_parseFromJSON() failed [ana_types]"); + goto end; + } + cJSON *ana_types_local = NULL; + if (!cJSON_IsArray(ana_types)) { + ogs_error("OpenAPI_ue_analytics_context_descriptor_parseFromJSON() failed [ana_types]"); + goto end; + } + + ana_typesList = OpenAPI_list_create(); + + cJSON_ArrayForEach(ana_types_local, ana_types) { + if (!cJSON_IsObject(ana_types_local)) { + ogs_error("OpenAPI_ue_analytics_context_descriptor_parseFromJSON() failed [ana_types]"); + goto end; + } + OpenAPI_nwdaf_event_t *ana_typesItem = OpenAPI_nwdaf_event_parseFromJSON(ana_types_local); + if (!ana_typesItem) { + ogs_error("No ana_typesItem"); + OpenAPI_list_free(ana_typesList); + goto end; + } + OpenAPI_list_add(ana_typesList, ana_typesItem); + } + + ue_analytics_context_descriptor_local_var = OpenAPI_ue_analytics_context_descriptor_create ( + ogs_strdup(supi->valuestring), + ana_typesList + ); + + return ue_analytics_context_descriptor_local_var; +end: + if (ana_typesList) { + OpenAPI_list_for_each(ana_typesList, node) { + OpenAPI_nwdaf_event_free(node->data); + } + OpenAPI_list_free(ana_typesList); + ana_typesList = NULL; + } + return NULL; +} + +OpenAPI_ue_analytics_context_descriptor_t *OpenAPI_ue_analytics_context_descriptor_copy(OpenAPI_ue_analytics_context_descriptor_t *dst, OpenAPI_ue_analytics_context_descriptor_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_ue_analytics_context_descriptor_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_ue_analytics_context_descriptor_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_ue_analytics_context_descriptor_free(dst); + dst = OpenAPI_ue_analytics_context_descriptor_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/ue_analytics_context_descriptor.h b/lib/sbi/openapi/model/ue_analytics_context_descriptor.h new file mode 100644 index 000000000..aa3e4f75f --- /dev/null +++ b/lib/sbi/openapi/model/ue_analytics_context_descriptor.h @@ -0,0 +1,41 @@ +/* + * ue_analytics_context_descriptor.h + * + * Contains information about available UE related analytics contexts. + */ + +#ifndef _OpenAPI_ue_analytics_context_descriptor_H_ +#define _OpenAPI_ue_analytics_context_descriptor_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "nwdaf_event.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_ue_analytics_context_descriptor_s OpenAPI_ue_analytics_context_descriptor_t; +typedef struct OpenAPI_ue_analytics_context_descriptor_s { + char *supi; + OpenAPI_list_t *ana_types; +} OpenAPI_ue_analytics_context_descriptor_t; + +OpenAPI_ue_analytics_context_descriptor_t *OpenAPI_ue_analytics_context_descriptor_create( + char *supi, + OpenAPI_list_t *ana_types +); +void OpenAPI_ue_analytics_context_descriptor_free(OpenAPI_ue_analytics_context_descriptor_t *ue_analytics_context_descriptor); +OpenAPI_ue_analytics_context_descriptor_t *OpenAPI_ue_analytics_context_descriptor_parseFromJSON(cJSON *ue_analytics_context_descriptorJSON); +cJSON *OpenAPI_ue_analytics_context_descriptor_convertToJSON(OpenAPI_ue_analytics_context_descriptor_t *ue_analytics_context_descriptor); +OpenAPI_ue_analytics_context_descriptor_t *OpenAPI_ue_analytics_context_descriptor_copy(OpenAPI_ue_analytics_context_descriptor_t *dst, OpenAPI_ue_analytics_context_descriptor_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_ue_analytics_context_descriptor_H_ */ + diff --git a/lib/sbi/openapi/model/ue_authentication_ctx.h b/lib/sbi/openapi/model/ue_authentication_ctx.h index 0a552871c..4c756acf3 100644 --- a/lib/sbi/openapi/model/ue_authentication_ctx.h +++ b/lib/sbi/openapi/model/ue_authentication_ctx.h @@ -1,7 +1,7 @@ /* * ue_authentication_ctx.h * - * + * Contains the information related to the resource generated to handle the UE authentication. It contains at least the UE id, Serving Network, the Authentication Method and related EAP information or related 5G-AKA information. */ #ifndef _OpenAPI_ue_authentication_ctx_H_ diff --git a/lib/sbi/openapi/model/ue_camping_rep.c b/lib/sbi/openapi/model/ue_camping_rep.c index 3fb67e324..2a938a774 100644 --- a/lib/sbi/openapi/model/ue_camping_rep.c +++ b/lib/sbi/openapi/model/ue_camping_rep.c @@ -11,7 +11,8 @@ OpenAPI_ue_camping_rep_t *OpenAPI_ue_camping_rep_create( OpenAPI_plmn_id_nid_t *serving_network, OpenAPI_user_location_t *user_location_info, char *ue_time_zone, - OpenAPI_net_loc_access_support_e net_loc_acc_supp + OpenAPI_net_loc_access_support_e net_loc_acc_supp, + OpenAPI_satellite_backhaul_category_e sat_backhaul_category ) { OpenAPI_ue_camping_rep_t *ue_camping_rep_local_var = ogs_malloc(sizeof(OpenAPI_ue_camping_rep_t)); @@ -24,6 +25,7 @@ OpenAPI_ue_camping_rep_t *OpenAPI_ue_camping_rep_create( ue_camping_rep_local_var->user_location_info = user_location_info; ue_camping_rep_local_var->ue_time_zone = ue_time_zone; ue_camping_rep_local_var->net_loc_acc_supp = net_loc_acc_supp; + ue_camping_rep_local_var->sat_backhaul_category = sat_backhaul_category; return ue_camping_rep_local_var; } @@ -132,6 +134,13 @@ cJSON *OpenAPI_ue_camping_rep_convertToJSON(OpenAPI_ue_camping_rep_t *ue_camping } } + if (ue_camping_rep->sat_backhaul_category != OpenAPI_satellite_backhaul_category_NULL) { + if (cJSON_AddStringToObject(item, "satBackhaulCategory", OpenAPI_satellite_backhaul_category_ToString(ue_camping_rep->sat_backhaul_category)) == NULL) { + ogs_error("OpenAPI_ue_camping_rep_convertToJSON() failed [sat_backhaul_category]"); + goto end; + } + } + end: return item; } @@ -153,6 +162,8 @@ OpenAPI_ue_camping_rep_t *OpenAPI_ue_camping_rep_parseFromJSON(cJSON *ue_camping cJSON *ue_time_zone = NULL; cJSON *net_loc_acc_supp = NULL; OpenAPI_net_loc_access_support_e net_loc_acc_suppVariable = 0; + cJSON *sat_backhaul_category = NULL; + OpenAPI_satellite_backhaul_category_e sat_backhaul_categoryVariable = 0; access_type = cJSON_GetObjectItemCaseSensitive(ue_camping_repJSON, "accessType"); if (access_type) { if (!cJSON_IsString(access_type)) { @@ -203,6 +214,15 @@ OpenAPI_ue_camping_rep_t *OpenAPI_ue_camping_rep_parseFromJSON(cJSON *ue_camping net_loc_acc_suppVariable = OpenAPI_net_loc_access_support_FromString(net_loc_acc_supp->valuestring); } + sat_backhaul_category = cJSON_GetObjectItemCaseSensitive(ue_camping_repJSON, "satBackhaulCategory"); + if (sat_backhaul_category) { + if (!cJSON_IsString(sat_backhaul_category)) { + ogs_error("OpenAPI_ue_camping_rep_parseFromJSON() failed [sat_backhaul_category]"); + goto end; + } + sat_backhaul_categoryVariable = OpenAPI_satellite_backhaul_category_FromString(sat_backhaul_category->valuestring); + } + ue_camping_rep_local_var = OpenAPI_ue_camping_rep_create ( access_type ? access_typeVariable : 0, rat_type ? rat_typeVariable : 0, @@ -210,7 +230,8 @@ OpenAPI_ue_camping_rep_t *OpenAPI_ue_camping_rep_parseFromJSON(cJSON *ue_camping serving_network ? serving_network_local_nonprim : NULL, user_location_info ? user_location_info_local_nonprim : NULL, ue_time_zone && !cJSON_IsNull(ue_time_zone) ? ogs_strdup(ue_time_zone->valuestring) : NULL, - net_loc_acc_supp ? net_loc_acc_suppVariable : 0 + net_loc_acc_supp ? net_loc_acc_suppVariable : 0, + sat_backhaul_category ? sat_backhaul_categoryVariable : 0 ); return ue_camping_rep_local_var; diff --git a/lib/sbi/openapi/model/ue_camping_rep.h b/lib/sbi/openapi/model/ue_camping_rep.h index 4c51aeb4a..7b309f6d0 100644 --- a/lib/sbi/openapi/model/ue_camping_rep.h +++ b/lib/sbi/openapi/model/ue_camping_rep.h @@ -1,7 +1,7 @@ /* * ue_camping_rep.h * - * + * Contains the current applicable values corresponding to the policy control request triggers. */ #ifndef _OpenAPI_ue_camping_rep_H_ @@ -16,6 +16,7 @@ #include "net_loc_access_support.h" #include "plmn_id_nid.h" #include "rat_type.h" +#include "satellite_backhaul_category.h" #include "serving_nf_identity.h" #include "user_location.h" @@ -32,6 +33,7 @@ typedef struct OpenAPI_ue_camping_rep_s { struct OpenAPI_user_location_s *user_location_info; char *ue_time_zone; OpenAPI_net_loc_access_support_e net_loc_acc_supp; + OpenAPI_satellite_backhaul_category_e sat_backhaul_category; } OpenAPI_ue_camping_rep_t; OpenAPI_ue_camping_rep_t *OpenAPI_ue_camping_rep_create( @@ -41,7 +43,8 @@ OpenAPI_ue_camping_rep_t *OpenAPI_ue_camping_rep_create( OpenAPI_plmn_id_nid_t *serving_network, OpenAPI_user_location_t *user_location_info, char *ue_time_zone, - OpenAPI_net_loc_access_support_e net_loc_acc_supp + OpenAPI_net_loc_access_support_e net_loc_acc_supp, + OpenAPI_satellite_backhaul_category_e sat_backhaul_category ); void OpenAPI_ue_camping_rep_free(OpenAPI_ue_camping_rep_t *ue_camping_rep); OpenAPI_ue_camping_rep_t *OpenAPI_ue_camping_rep_parseFromJSON(cJSON *ue_camping_repJSON); diff --git a/lib/sbi/openapi/model/ue_communication.c b/lib/sbi/openapi/model/ue_communication.c new file mode 100644 index 000000000..582b549a7 --- /dev/null +++ b/lib/sbi/openapi/model/ue_communication.c @@ -0,0 +1,410 @@ + +#include +#include +#include +#include "ue_communication.h" + +OpenAPI_ue_communication_t *OpenAPI_ue_communication_create( + bool is_comm_dur, + int comm_dur, + bool is_comm_dur_variance, + float comm_dur_variance, + bool is_perio_time, + int perio_time, + bool is_perio_time_variance, + float perio_time_variance, + char *ts, + bool is_ts_variance, + float ts_variance, + OpenAPI_scheduled_communication_time_1_t *recurring_time, + OpenAPI_traffic_characterization_t *traf_char, + bool is_ratio, + int ratio, + bool is_perio_comm_ind, + int perio_comm_ind, + bool is_confidence, + int confidence, + OpenAPI_app_list_for_ue_comm_t *ana_of_app_list, + OpenAPI_sess_inact_timer_for_ue_comm_t *sess_inact_timer +) +{ + OpenAPI_ue_communication_t *ue_communication_local_var = ogs_malloc(sizeof(OpenAPI_ue_communication_t)); + ogs_assert(ue_communication_local_var); + + ue_communication_local_var->is_comm_dur = is_comm_dur; + ue_communication_local_var->comm_dur = comm_dur; + ue_communication_local_var->is_comm_dur_variance = is_comm_dur_variance; + ue_communication_local_var->comm_dur_variance = comm_dur_variance; + ue_communication_local_var->is_perio_time = is_perio_time; + ue_communication_local_var->perio_time = perio_time; + ue_communication_local_var->is_perio_time_variance = is_perio_time_variance; + ue_communication_local_var->perio_time_variance = perio_time_variance; + ue_communication_local_var->ts = ts; + ue_communication_local_var->is_ts_variance = is_ts_variance; + ue_communication_local_var->ts_variance = ts_variance; + ue_communication_local_var->recurring_time = recurring_time; + ue_communication_local_var->traf_char = traf_char; + ue_communication_local_var->is_ratio = is_ratio; + ue_communication_local_var->ratio = ratio; + ue_communication_local_var->is_perio_comm_ind = is_perio_comm_ind; + ue_communication_local_var->perio_comm_ind = perio_comm_ind; + ue_communication_local_var->is_confidence = is_confidence; + ue_communication_local_var->confidence = confidence; + ue_communication_local_var->ana_of_app_list = ana_of_app_list; + ue_communication_local_var->sess_inact_timer = sess_inact_timer; + + return ue_communication_local_var; +} + +void OpenAPI_ue_communication_free(OpenAPI_ue_communication_t *ue_communication) +{ + OpenAPI_lnode_t *node = NULL; + + if (NULL == ue_communication) { + return; + } + if (ue_communication->ts) { + ogs_free(ue_communication->ts); + ue_communication->ts = NULL; + } + if (ue_communication->recurring_time) { + OpenAPI_scheduled_communication_time_1_free(ue_communication->recurring_time); + ue_communication->recurring_time = NULL; + } + if (ue_communication->traf_char) { + OpenAPI_traffic_characterization_free(ue_communication->traf_char); + ue_communication->traf_char = NULL; + } + if (ue_communication->ana_of_app_list) { + OpenAPI_app_list_for_ue_comm_free(ue_communication->ana_of_app_list); + ue_communication->ana_of_app_list = NULL; + } + if (ue_communication->sess_inact_timer) { + OpenAPI_sess_inact_timer_for_ue_comm_free(ue_communication->sess_inact_timer); + ue_communication->sess_inact_timer = NULL; + } + ogs_free(ue_communication); +} + +cJSON *OpenAPI_ue_communication_convertToJSON(OpenAPI_ue_communication_t *ue_communication) +{ + cJSON *item = NULL; + OpenAPI_lnode_t *node = NULL; + + if (ue_communication == NULL) { + ogs_error("OpenAPI_ue_communication_convertToJSON() failed [UeCommunication]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (ue_communication->is_comm_dur) { + if (cJSON_AddNumberToObject(item, "commDur", ue_communication->comm_dur) == NULL) { + ogs_error("OpenAPI_ue_communication_convertToJSON() failed [comm_dur]"); + goto end; + } + } + + if (ue_communication->is_comm_dur_variance) { + if (cJSON_AddNumberToObject(item, "commDurVariance", ue_communication->comm_dur_variance) == NULL) { + ogs_error("OpenAPI_ue_communication_convertToJSON() failed [comm_dur_variance]"); + goto end; + } + } + + if (ue_communication->is_perio_time) { + if (cJSON_AddNumberToObject(item, "perioTime", ue_communication->perio_time) == NULL) { + ogs_error("OpenAPI_ue_communication_convertToJSON() failed [perio_time]"); + goto end; + } + } + + if (ue_communication->is_perio_time_variance) { + if (cJSON_AddNumberToObject(item, "perioTimeVariance", ue_communication->perio_time_variance) == NULL) { + ogs_error("OpenAPI_ue_communication_convertToJSON() failed [perio_time_variance]"); + goto end; + } + } + + if (ue_communication->ts) { + if (cJSON_AddStringToObject(item, "ts", ue_communication->ts) == NULL) { + ogs_error("OpenAPI_ue_communication_convertToJSON() failed [ts]"); + goto end; + } + } + + if (ue_communication->is_ts_variance) { + if (cJSON_AddNumberToObject(item, "tsVariance", ue_communication->ts_variance) == NULL) { + ogs_error("OpenAPI_ue_communication_convertToJSON() failed [ts_variance]"); + goto end; + } + } + + if (ue_communication->recurring_time) { + cJSON *recurring_time_local_JSON = OpenAPI_scheduled_communication_time_1_convertToJSON(ue_communication->recurring_time); + if (recurring_time_local_JSON == NULL) { + ogs_error("OpenAPI_ue_communication_convertToJSON() failed [recurring_time]"); + goto end; + } + cJSON_AddItemToObject(item, "recurringTime", recurring_time_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_ue_communication_convertToJSON() failed [recurring_time]"); + goto end; + } + } + + if (ue_communication->traf_char) { + cJSON *traf_char_local_JSON = OpenAPI_traffic_characterization_convertToJSON(ue_communication->traf_char); + if (traf_char_local_JSON == NULL) { + ogs_error("OpenAPI_ue_communication_convertToJSON() failed [traf_char]"); + goto end; + } + cJSON_AddItemToObject(item, "trafChar", traf_char_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_ue_communication_convertToJSON() failed [traf_char]"); + goto end; + } + } + + if (ue_communication->is_ratio) { + if (cJSON_AddNumberToObject(item, "ratio", ue_communication->ratio) == NULL) { + ogs_error("OpenAPI_ue_communication_convertToJSON() failed [ratio]"); + goto end; + } + } + + if (ue_communication->is_perio_comm_ind) { + if (cJSON_AddBoolToObject(item, "perioCommInd", ue_communication->perio_comm_ind) == NULL) { + ogs_error("OpenAPI_ue_communication_convertToJSON() failed [perio_comm_ind]"); + goto end; + } + } + + if (ue_communication->is_confidence) { + if (cJSON_AddNumberToObject(item, "confidence", ue_communication->confidence) == NULL) { + ogs_error("OpenAPI_ue_communication_convertToJSON() failed [confidence]"); + goto end; + } + } + + if (ue_communication->ana_of_app_list) { + cJSON *ana_of_app_list_local_JSON = OpenAPI_app_list_for_ue_comm_convertToJSON(ue_communication->ana_of_app_list); + if (ana_of_app_list_local_JSON == NULL) { + ogs_error("OpenAPI_ue_communication_convertToJSON() failed [ana_of_app_list]"); + goto end; + } + cJSON_AddItemToObject(item, "anaOfAppList", ana_of_app_list_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_ue_communication_convertToJSON() failed [ana_of_app_list]"); + goto end; + } + } + + if (ue_communication->sess_inact_timer) { + cJSON *sess_inact_timer_local_JSON = OpenAPI_sess_inact_timer_for_ue_comm_convertToJSON(ue_communication->sess_inact_timer); + if (sess_inact_timer_local_JSON == NULL) { + ogs_error("OpenAPI_ue_communication_convertToJSON() failed [sess_inact_timer]"); + goto end; + } + cJSON_AddItemToObject(item, "sessInactTimer", sess_inact_timer_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_ue_communication_convertToJSON() failed [sess_inact_timer]"); + goto end; + } + } + +end: + return item; +} + +OpenAPI_ue_communication_t *OpenAPI_ue_communication_parseFromJSON(cJSON *ue_communicationJSON) +{ + OpenAPI_ue_communication_t *ue_communication_local_var = NULL; + OpenAPI_lnode_t *node = NULL; + cJSON *comm_dur = NULL; + cJSON *comm_dur_variance = NULL; + cJSON *perio_time = NULL; + cJSON *perio_time_variance = NULL; + cJSON *ts = NULL; + cJSON *ts_variance = NULL; + cJSON *recurring_time = NULL; + OpenAPI_scheduled_communication_time_1_t *recurring_time_local_nonprim = NULL; + cJSON *traf_char = NULL; + OpenAPI_traffic_characterization_t *traf_char_local_nonprim = NULL; + cJSON *ratio = NULL; + cJSON *perio_comm_ind = NULL; + cJSON *confidence = NULL; + cJSON *ana_of_app_list = NULL; + OpenAPI_app_list_for_ue_comm_t *ana_of_app_list_local_nonprim = NULL; + cJSON *sess_inact_timer = NULL; + OpenAPI_sess_inact_timer_for_ue_comm_t *sess_inact_timer_local_nonprim = NULL; + comm_dur = cJSON_GetObjectItemCaseSensitive(ue_communicationJSON, "commDur"); + if (comm_dur) { + if (!cJSON_IsNumber(comm_dur)) { + ogs_error("OpenAPI_ue_communication_parseFromJSON() failed [comm_dur]"); + goto end; + } + } + + comm_dur_variance = cJSON_GetObjectItemCaseSensitive(ue_communicationJSON, "commDurVariance"); + if (comm_dur_variance) { + if (!cJSON_IsNumber(comm_dur_variance)) { + ogs_error("OpenAPI_ue_communication_parseFromJSON() failed [comm_dur_variance]"); + goto end; + } + } + + perio_time = cJSON_GetObjectItemCaseSensitive(ue_communicationJSON, "perioTime"); + if (perio_time) { + if (!cJSON_IsNumber(perio_time)) { + ogs_error("OpenAPI_ue_communication_parseFromJSON() failed [perio_time]"); + goto end; + } + } + + perio_time_variance = cJSON_GetObjectItemCaseSensitive(ue_communicationJSON, "perioTimeVariance"); + if (perio_time_variance) { + if (!cJSON_IsNumber(perio_time_variance)) { + ogs_error("OpenAPI_ue_communication_parseFromJSON() failed [perio_time_variance]"); + goto end; + } + } + + ts = cJSON_GetObjectItemCaseSensitive(ue_communicationJSON, "ts"); + if (ts) { + if (!cJSON_IsString(ts) && !cJSON_IsNull(ts)) { + ogs_error("OpenAPI_ue_communication_parseFromJSON() failed [ts]"); + goto end; + } + } + + ts_variance = cJSON_GetObjectItemCaseSensitive(ue_communicationJSON, "tsVariance"); + if (ts_variance) { + if (!cJSON_IsNumber(ts_variance)) { + ogs_error("OpenAPI_ue_communication_parseFromJSON() failed [ts_variance]"); + goto end; + } + } + + recurring_time = cJSON_GetObjectItemCaseSensitive(ue_communicationJSON, "recurringTime"); + if (recurring_time) { + recurring_time_local_nonprim = OpenAPI_scheduled_communication_time_1_parseFromJSON(recurring_time); + } + + traf_char = cJSON_GetObjectItemCaseSensitive(ue_communicationJSON, "trafChar"); + if (traf_char) { + traf_char_local_nonprim = OpenAPI_traffic_characterization_parseFromJSON(traf_char); + } + + ratio = cJSON_GetObjectItemCaseSensitive(ue_communicationJSON, "ratio"); + if (ratio) { + if (!cJSON_IsNumber(ratio)) { + ogs_error("OpenAPI_ue_communication_parseFromJSON() failed [ratio]"); + goto end; + } + } + + perio_comm_ind = cJSON_GetObjectItemCaseSensitive(ue_communicationJSON, "perioCommInd"); + if (perio_comm_ind) { + if (!cJSON_IsBool(perio_comm_ind)) { + ogs_error("OpenAPI_ue_communication_parseFromJSON() failed [perio_comm_ind]"); + goto end; + } + } + + confidence = cJSON_GetObjectItemCaseSensitive(ue_communicationJSON, "confidence"); + if (confidence) { + if (!cJSON_IsNumber(confidence)) { + ogs_error("OpenAPI_ue_communication_parseFromJSON() failed [confidence]"); + goto end; + } + } + + ana_of_app_list = cJSON_GetObjectItemCaseSensitive(ue_communicationJSON, "anaOfAppList"); + if (ana_of_app_list) { + ana_of_app_list_local_nonprim = OpenAPI_app_list_for_ue_comm_parseFromJSON(ana_of_app_list); + } + + sess_inact_timer = cJSON_GetObjectItemCaseSensitive(ue_communicationJSON, "sessInactTimer"); + if (sess_inact_timer) { + sess_inact_timer_local_nonprim = OpenAPI_sess_inact_timer_for_ue_comm_parseFromJSON(sess_inact_timer); + } + + ue_communication_local_var = OpenAPI_ue_communication_create ( + comm_dur ? true : false, + comm_dur ? comm_dur->valuedouble : 0, + comm_dur_variance ? true : false, + comm_dur_variance ? comm_dur_variance->valuedouble : 0, + perio_time ? true : false, + perio_time ? perio_time->valuedouble : 0, + perio_time_variance ? true : false, + perio_time_variance ? perio_time_variance->valuedouble : 0, + ts && !cJSON_IsNull(ts) ? ogs_strdup(ts->valuestring) : NULL, + ts_variance ? true : false, + ts_variance ? ts_variance->valuedouble : 0, + recurring_time ? recurring_time_local_nonprim : NULL, + traf_char ? traf_char_local_nonprim : NULL, + ratio ? true : false, + ratio ? ratio->valuedouble : 0, + perio_comm_ind ? true : false, + perio_comm_ind ? perio_comm_ind->valueint : 0, + confidence ? true : false, + confidence ? confidence->valuedouble : 0, + ana_of_app_list ? ana_of_app_list_local_nonprim : NULL, + sess_inact_timer ? sess_inact_timer_local_nonprim : NULL + ); + + return ue_communication_local_var; +end: + if (recurring_time_local_nonprim) { + OpenAPI_scheduled_communication_time_1_free(recurring_time_local_nonprim); + recurring_time_local_nonprim = NULL; + } + if (traf_char_local_nonprim) { + OpenAPI_traffic_characterization_free(traf_char_local_nonprim); + traf_char_local_nonprim = NULL; + } + if (ana_of_app_list_local_nonprim) { + OpenAPI_app_list_for_ue_comm_free(ana_of_app_list_local_nonprim); + ana_of_app_list_local_nonprim = NULL; + } + if (sess_inact_timer_local_nonprim) { + OpenAPI_sess_inact_timer_for_ue_comm_free(sess_inact_timer_local_nonprim); + sess_inact_timer_local_nonprim = NULL; + } + return NULL; +} + +OpenAPI_ue_communication_t *OpenAPI_ue_communication_copy(OpenAPI_ue_communication_t *dst, OpenAPI_ue_communication_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_ue_communication_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_ue_communication_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_ue_communication_free(dst); + dst = OpenAPI_ue_communication_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/ue_communication.h b/lib/sbi/openapi/model/ue_communication.h new file mode 100644 index 000000000..4da3a399b --- /dev/null +++ b/lib/sbi/openapi/model/ue_communication.h @@ -0,0 +1,82 @@ +/* + * ue_communication.h + * + * Represents UE communication information. + */ + +#ifndef _OpenAPI_ue_communication_H_ +#define _OpenAPI_ue_communication_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "app_list_for_ue_comm.h" +#include "scheduled_communication_time_1.h" +#include "sess_inact_timer_for_ue_comm.h" +#include "traffic_characterization.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_ue_communication_s OpenAPI_ue_communication_t; +typedef struct OpenAPI_ue_communication_s { + bool is_comm_dur; + int comm_dur; + bool is_comm_dur_variance; + float comm_dur_variance; + bool is_perio_time; + int perio_time; + bool is_perio_time_variance; + float perio_time_variance; + char *ts; + bool is_ts_variance; + float ts_variance; + struct OpenAPI_scheduled_communication_time_1_s *recurring_time; + struct OpenAPI_traffic_characterization_s *traf_char; + bool is_ratio; + int ratio; + bool is_perio_comm_ind; + int perio_comm_ind; + bool is_confidence; + int confidence; + struct OpenAPI_app_list_for_ue_comm_s *ana_of_app_list; + struct OpenAPI_sess_inact_timer_for_ue_comm_s *sess_inact_timer; +} OpenAPI_ue_communication_t; + +OpenAPI_ue_communication_t *OpenAPI_ue_communication_create( + bool is_comm_dur, + int comm_dur, + bool is_comm_dur_variance, + float comm_dur_variance, + bool is_perio_time, + int perio_time, + bool is_perio_time_variance, + float perio_time_variance, + char *ts, + bool is_ts_variance, + float ts_variance, + OpenAPI_scheduled_communication_time_1_t *recurring_time, + OpenAPI_traffic_characterization_t *traf_char, + bool is_ratio, + int ratio, + bool is_perio_comm_ind, + int perio_comm_ind, + bool is_confidence, + int confidence, + OpenAPI_app_list_for_ue_comm_t *ana_of_app_list, + OpenAPI_sess_inact_timer_for_ue_comm_t *sess_inact_timer +); +void OpenAPI_ue_communication_free(OpenAPI_ue_communication_t *ue_communication); +OpenAPI_ue_communication_t *OpenAPI_ue_communication_parseFromJSON(cJSON *ue_communicationJSON); +cJSON *OpenAPI_ue_communication_convertToJSON(OpenAPI_ue_communication_t *ue_communication); +OpenAPI_ue_communication_t *OpenAPI_ue_communication_copy(OpenAPI_ue_communication_t *dst, OpenAPI_ue_communication_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_ue_communication_H_ */ + diff --git a/lib/sbi/openapi/model/ue_context.c b/lib/sbi/openapi/model/ue_context.c index a502269dd..0e42fb01b 100644 --- a/lib/sbi/openapi/model/ue_context.c +++ b/lib/sbi/openapi/model/ue_context.c @@ -14,6 +14,8 @@ OpenAPI_ue_context_t *OpenAPI_ue_context_create( char *ausf_group_id, char *pcf_group_id, char *routing_indicator, + bool is_h_nw_pub_key_id, + int h_nw_pub_key_id, OpenAPI_list_t *group_list, char *drx_parameter, bool is_sub_rfsp, @@ -21,6 +23,7 @@ OpenAPI_ue_context_t *OpenAPI_ue_context_create( bool is_used_rfsp, int used_rfsp, OpenAPI_ambr_t *sub_ue_ambr, + OpenAPI_list_t* sub_ue_slice_mbr_list, char *smsf_id, OpenAPI_seaf_data_t *seaf_data, char *_5g_mm_capability, @@ -42,6 +45,7 @@ OpenAPI_ue_context_t *OpenAPI_ue_context_create( OpenAPI_list_t *event_subscription_list, OpenAPI_list_t *mm_context_list, OpenAPI_list_t *session_context_list, + OpenAPI_eps_interworking_info_t *eps_interworking_info, OpenAPI_trace_data_t *trace_data, char *service_gap_expiry_time, char *stn_sr, @@ -54,6 +58,8 @@ OpenAPI_ue_context_t *OpenAPI_ue_context_create( OpenAPI_v2x_context_t *v2x_context, bool is_lte_cat_m_ind, int lte_cat_m_ind, + bool is_red_cap_ind, + int red_cap_ind, OpenAPI_mo_exp_data_counter_t *mo_exp_data_counter, OpenAPI_cag_data_t *cag_data, bool is_management_mdt_ind, @@ -63,7 +69,32 @@ OpenAPI_ue_context_t *OpenAPI_ue_context_create( bool is_ec_restriction_data_nb, int ec_restriction_data_nb, bool is_iab_operation_allowed, - int iab_operation_allowed + int iab_operation_allowed, + OpenAPI_prose_context_t *prose_context, + OpenAPI_list_t *analytics_subscription_list, + char *pcf_amp_binding_info, + char *pcf_uep_binding_info, + OpenAPI_service_area_restriction_t *used_service_area_restriction, + OpenAPI_list_t* pra_in_am_policy, + OpenAPI_list_t* pra_in_ue_policy, + OpenAPI_updp_subscription_data_t *updp_subscription_data, + OpenAPI_list_t *sm_policy_notify_pdu_list, + OpenAPI_pcf_ue_callback_info_t *pcf_ue_callback_info, + char *ue_positioning_cap, + bool is_asti_distribution_indication, + int asti_distribution_indication, + bool is_ts_error_budget, + int ts_error_budget, + bool is_snpn_onboard_ind, + int snpn_onboard_ind, + OpenAPI_smf_selection_data_t *smf_sel_info, + OpenAPI_list_t* pcf_ue_slice_mbr_list, + char *smsf_set_id, + char *smsf_service_set_id, + char *smsf_binding_info, + bool is_disaster_roaming_ind, + int disaster_roaming_ind, + OpenAPI_plmn_id_t *disaster_plmn ) { OpenAPI_ue_context_t *ue_context_local_var = ogs_malloc(sizeof(OpenAPI_ue_context_t)); @@ -78,6 +109,8 @@ OpenAPI_ue_context_t *OpenAPI_ue_context_create( ue_context_local_var->ausf_group_id = ausf_group_id; ue_context_local_var->pcf_group_id = pcf_group_id; ue_context_local_var->routing_indicator = routing_indicator; + ue_context_local_var->is_h_nw_pub_key_id = is_h_nw_pub_key_id; + ue_context_local_var->h_nw_pub_key_id = h_nw_pub_key_id; ue_context_local_var->group_list = group_list; ue_context_local_var->drx_parameter = drx_parameter; ue_context_local_var->is_sub_rfsp = is_sub_rfsp; @@ -85,6 +118,7 @@ OpenAPI_ue_context_t *OpenAPI_ue_context_create( ue_context_local_var->is_used_rfsp = is_used_rfsp; ue_context_local_var->used_rfsp = used_rfsp; ue_context_local_var->sub_ue_ambr = sub_ue_ambr; + ue_context_local_var->sub_ue_slice_mbr_list = sub_ue_slice_mbr_list; ue_context_local_var->smsf_id = smsf_id; ue_context_local_var->seaf_data = seaf_data; ue_context_local_var->_5g_mm_capability = _5g_mm_capability; @@ -106,6 +140,7 @@ OpenAPI_ue_context_t *OpenAPI_ue_context_create( ue_context_local_var->event_subscription_list = event_subscription_list; ue_context_local_var->mm_context_list = mm_context_list; ue_context_local_var->session_context_list = session_context_list; + ue_context_local_var->eps_interworking_info = eps_interworking_info; ue_context_local_var->trace_data = trace_data; ue_context_local_var->service_gap_expiry_time = service_gap_expiry_time; ue_context_local_var->stn_sr = stn_sr; @@ -118,6 +153,8 @@ OpenAPI_ue_context_t *OpenAPI_ue_context_create( ue_context_local_var->v2x_context = v2x_context; ue_context_local_var->is_lte_cat_m_ind = is_lte_cat_m_ind; ue_context_local_var->lte_cat_m_ind = lte_cat_m_ind; + ue_context_local_var->is_red_cap_ind = is_red_cap_ind; + ue_context_local_var->red_cap_ind = red_cap_ind; ue_context_local_var->mo_exp_data_counter = mo_exp_data_counter; ue_context_local_var->cag_data = cag_data; ue_context_local_var->is_management_mdt_ind = is_management_mdt_ind; @@ -128,6 +165,31 @@ OpenAPI_ue_context_t *OpenAPI_ue_context_create( ue_context_local_var->ec_restriction_data_nb = ec_restriction_data_nb; ue_context_local_var->is_iab_operation_allowed = is_iab_operation_allowed; ue_context_local_var->iab_operation_allowed = iab_operation_allowed; + ue_context_local_var->prose_context = prose_context; + ue_context_local_var->analytics_subscription_list = analytics_subscription_list; + ue_context_local_var->pcf_amp_binding_info = pcf_amp_binding_info; + ue_context_local_var->pcf_uep_binding_info = pcf_uep_binding_info; + ue_context_local_var->used_service_area_restriction = used_service_area_restriction; + ue_context_local_var->pra_in_am_policy = pra_in_am_policy; + ue_context_local_var->pra_in_ue_policy = pra_in_ue_policy; + ue_context_local_var->updp_subscription_data = updp_subscription_data; + ue_context_local_var->sm_policy_notify_pdu_list = sm_policy_notify_pdu_list; + ue_context_local_var->pcf_ue_callback_info = pcf_ue_callback_info; + ue_context_local_var->ue_positioning_cap = ue_positioning_cap; + ue_context_local_var->is_asti_distribution_indication = is_asti_distribution_indication; + ue_context_local_var->asti_distribution_indication = asti_distribution_indication; + ue_context_local_var->is_ts_error_budget = is_ts_error_budget; + ue_context_local_var->ts_error_budget = ts_error_budget; + ue_context_local_var->is_snpn_onboard_ind = is_snpn_onboard_ind; + ue_context_local_var->snpn_onboard_ind = snpn_onboard_ind; + ue_context_local_var->smf_sel_info = smf_sel_info; + ue_context_local_var->pcf_ue_slice_mbr_list = pcf_ue_slice_mbr_list; + ue_context_local_var->smsf_set_id = smsf_set_id; + ue_context_local_var->smsf_service_set_id = smsf_service_set_id; + ue_context_local_var->smsf_binding_info = smsf_binding_info; + ue_context_local_var->is_disaster_roaming_ind = is_disaster_roaming_ind; + ue_context_local_var->disaster_roaming_ind = disaster_roaming_ind; + ue_context_local_var->disaster_plmn = disaster_plmn; return ue_context_local_var; } @@ -185,6 +247,16 @@ void OpenAPI_ue_context_free(OpenAPI_ue_context_t *ue_context) OpenAPI_ambr_free(ue_context->sub_ue_ambr); ue_context->sub_ue_ambr = NULL; } + if (ue_context->sub_ue_slice_mbr_list) { + OpenAPI_list_for_each(ue_context->sub_ue_slice_mbr_list, node) { + OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*)node->data; + ogs_free(localKeyValue->key); + OpenAPI_slice_mbr_free(localKeyValue->value); + OpenAPI_map_free(localKeyValue); + } + OpenAPI_list_free(ue_context->sub_ue_slice_mbr_list); + ue_context->sub_ue_slice_mbr_list = NULL; + } if (ue_context->smsf_id) { ogs_free(ue_context->smsf_id); ue_context->smsf_id = NULL; @@ -277,6 +349,10 @@ void OpenAPI_ue_context_free(OpenAPI_ue_context_t *ue_context) OpenAPI_list_free(ue_context->session_context_list); ue_context->session_context_list = NULL; } + if (ue_context->eps_interworking_info) { + OpenAPI_eps_interworking_info_free(ue_context->eps_interworking_info); + ue_context->eps_interworking_info = NULL; + } if (ue_context->trace_data) { OpenAPI_trace_data_free(ue_context->trace_data); ue_context->trace_data = NULL; @@ -339,6 +415,98 @@ void OpenAPI_ue_context_free(OpenAPI_ue_context_t *ue_context) OpenAPI_ec_restriction_data_wb_free(ue_context->ec_restriction_data_wb); ue_context->ec_restriction_data_wb = NULL; } + if (ue_context->prose_context) { + OpenAPI_prose_context_free(ue_context->prose_context); + ue_context->prose_context = NULL; + } + if (ue_context->analytics_subscription_list) { + OpenAPI_list_for_each(ue_context->analytics_subscription_list, node) { + OpenAPI_analytics_subscription_free(node->data); + } + OpenAPI_list_free(ue_context->analytics_subscription_list); + ue_context->analytics_subscription_list = NULL; + } + if (ue_context->pcf_amp_binding_info) { + ogs_free(ue_context->pcf_amp_binding_info); + ue_context->pcf_amp_binding_info = NULL; + } + if (ue_context->pcf_uep_binding_info) { + ogs_free(ue_context->pcf_uep_binding_info); + ue_context->pcf_uep_binding_info = NULL; + } + if (ue_context->used_service_area_restriction) { + OpenAPI_service_area_restriction_free(ue_context->used_service_area_restriction); + ue_context->used_service_area_restriction = NULL; + } + if (ue_context->pra_in_am_policy) { + OpenAPI_list_for_each(ue_context->pra_in_am_policy, node) { + OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*)node->data; + ogs_free(localKeyValue->key); + OpenAPI_presence_info_free(localKeyValue->value); + OpenAPI_map_free(localKeyValue); + } + OpenAPI_list_free(ue_context->pra_in_am_policy); + ue_context->pra_in_am_policy = NULL; + } + if (ue_context->pra_in_ue_policy) { + OpenAPI_list_for_each(ue_context->pra_in_ue_policy, node) { + OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*)node->data; + ogs_free(localKeyValue->key); + OpenAPI_presence_info_free(localKeyValue->value); + OpenAPI_map_free(localKeyValue); + } + OpenAPI_list_free(ue_context->pra_in_ue_policy); + ue_context->pra_in_ue_policy = NULL; + } + if (ue_context->updp_subscription_data) { + OpenAPI_updp_subscription_data_free(ue_context->updp_subscription_data); + ue_context->updp_subscription_data = NULL; + } + if (ue_context->sm_policy_notify_pdu_list) { + OpenAPI_list_for_each(ue_context->sm_policy_notify_pdu_list, node) { + OpenAPI_pdu_session_info_free(node->data); + } + OpenAPI_list_free(ue_context->sm_policy_notify_pdu_list); + ue_context->sm_policy_notify_pdu_list = NULL; + } + if (ue_context->pcf_ue_callback_info) { + OpenAPI_pcf_ue_callback_info_free(ue_context->pcf_ue_callback_info); + ue_context->pcf_ue_callback_info = NULL; + } + if (ue_context->ue_positioning_cap) { + ogs_free(ue_context->ue_positioning_cap); + ue_context->ue_positioning_cap = NULL; + } + if (ue_context->smf_sel_info) { + OpenAPI_smf_selection_data_free(ue_context->smf_sel_info); + ue_context->smf_sel_info = NULL; + } + if (ue_context->pcf_ue_slice_mbr_list) { + OpenAPI_list_for_each(ue_context->pcf_ue_slice_mbr_list, node) { + OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*)node->data; + ogs_free(localKeyValue->key); + OpenAPI_slice_mbr_free(localKeyValue->value); + OpenAPI_map_free(localKeyValue); + } + OpenAPI_list_free(ue_context->pcf_ue_slice_mbr_list); + ue_context->pcf_ue_slice_mbr_list = NULL; + } + if (ue_context->smsf_set_id) { + ogs_free(ue_context->smsf_set_id); + ue_context->smsf_set_id = NULL; + } + if (ue_context->smsf_service_set_id) { + ogs_free(ue_context->smsf_service_set_id); + ue_context->smsf_service_set_id = NULL; + } + if (ue_context->smsf_binding_info) { + ogs_free(ue_context->smsf_binding_info); + ue_context->smsf_binding_info = NULL; + } + if (ue_context->disaster_plmn) { + OpenAPI_plmn_id_free(ue_context->disaster_plmn); + ue_context->disaster_plmn = NULL; + } ogs_free(ue_context); } @@ -416,6 +584,13 @@ cJSON *OpenAPI_ue_context_convertToJSON(OpenAPI_ue_context_t *ue_context) } } + if (ue_context->is_h_nw_pub_key_id) { + if (cJSON_AddNumberToObject(item, "hNwPubKeyId", ue_context->h_nw_pub_key_id) == NULL) { + ogs_error("OpenAPI_ue_context_convertToJSON() failed [h_nw_pub_key_id]"); + goto end; + } + } + if (ue_context->group_list) { cJSON *group_listList = cJSON_AddArrayToObject(item, "groupList"); if (group_listList == NULL) { @@ -464,6 +639,28 @@ cJSON *OpenAPI_ue_context_convertToJSON(OpenAPI_ue_context_t *ue_context) } } + if (ue_context->sub_ue_slice_mbr_list) { + cJSON *sub_ue_slice_mbr_list = cJSON_AddObjectToObject(item, "subUeSliceMbrList"); + if (sub_ue_slice_mbr_list == NULL) { + ogs_error("OpenAPI_ue_context_convertToJSON() failed [sub_ue_slice_mbr_list]"); + goto end; + } + cJSON *localMapObject = sub_ue_slice_mbr_list; + if (ue_context->sub_ue_slice_mbr_list) { + OpenAPI_list_for_each(ue_context->sub_ue_slice_mbr_list, node) { + OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*)node->data; + cJSON *itemLocal = localKeyValue->value ? + OpenAPI_slice_mbr_convertToJSON(localKeyValue->value) : + cJSON_CreateNull(); + if (itemLocal == NULL) { + ogs_error("OpenAPI_ue_context_convertToJSON() failed [inner]"); + goto end; + } + cJSON_AddItemToObject(localMapObject, localKeyValue->key, itemLocal); + } + } + } + if (ue_context->smsf_id) { if (cJSON_AddStringToObject(item, "smsfId", ue_context->smsf_id) == NULL) { ogs_error("OpenAPI_ue_context_convertToJSON() failed [smsf_id]"); @@ -687,6 +884,19 @@ cJSON *OpenAPI_ue_context_convertToJSON(OpenAPI_ue_context_t *ue_context) } } + if (ue_context->eps_interworking_info) { + cJSON *eps_interworking_info_local_JSON = OpenAPI_eps_interworking_info_convertToJSON(ue_context->eps_interworking_info); + if (eps_interworking_info_local_JSON == NULL) { + ogs_error("OpenAPI_ue_context_convertToJSON() failed [eps_interworking_info]"); + goto end; + } + cJSON_AddItemToObject(item, "epsInterworkingInfo", eps_interworking_info_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_ue_context_convertToJSON() failed [eps_interworking_info]"); + goto end; + } + } + if (ue_context->trace_data) { cJSON *trace_data_local_JSON = OpenAPI_trace_data_convertToJSON(ue_context->trace_data); if (trace_data_local_JSON == NULL) { @@ -806,6 +1016,13 @@ cJSON *OpenAPI_ue_context_convertToJSON(OpenAPI_ue_context_t *ue_context) } } + if (ue_context->is_red_cap_ind) { + if (cJSON_AddBoolToObject(item, "redCapInd", ue_context->red_cap_ind) == NULL) { + ogs_error("OpenAPI_ue_context_convertToJSON() failed [red_cap_ind]"); + goto end; + } + } + if (ue_context->mo_exp_data_counter) { cJSON *mo_exp_data_counter_local_JSON = OpenAPI_mo_exp_data_counter_convertToJSON(ue_context->mo_exp_data_counter); if (mo_exp_data_counter_local_JSON == NULL) { @@ -879,6 +1096,252 @@ cJSON *OpenAPI_ue_context_convertToJSON(OpenAPI_ue_context_t *ue_context) } } + if (ue_context->prose_context) { + cJSON *prose_context_local_JSON = OpenAPI_prose_context_convertToJSON(ue_context->prose_context); + if (prose_context_local_JSON == NULL) { + ogs_error("OpenAPI_ue_context_convertToJSON() failed [prose_context]"); + goto end; + } + cJSON_AddItemToObject(item, "proseContext", prose_context_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_ue_context_convertToJSON() failed [prose_context]"); + goto end; + } + } + + if (ue_context->analytics_subscription_list) { + cJSON *analytics_subscription_listList = cJSON_AddArrayToObject(item, "analyticsSubscriptionList"); + if (analytics_subscription_listList == NULL) { + ogs_error("OpenAPI_ue_context_convertToJSON() failed [analytics_subscription_list]"); + goto end; + } + OpenAPI_list_for_each(ue_context->analytics_subscription_list, node) { + cJSON *itemLocal = OpenAPI_analytics_subscription_convertToJSON(node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_ue_context_convertToJSON() failed [analytics_subscription_list]"); + goto end; + } + cJSON_AddItemToArray(analytics_subscription_listList, itemLocal); + } + } + + if (ue_context->pcf_amp_binding_info) { + if (cJSON_AddStringToObject(item, "pcfAmpBindingInfo", ue_context->pcf_amp_binding_info) == NULL) { + ogs_error("OpenAPI_ue_context_convertToJSON() failed [pcf_amp_binding_info]"); + goto end; + } + } + + if (ue_context->pcf_uep_binding_info) { + if (cJSON_AddStringToObject(item, "pcfUepBindingInfo", ue_context->pcf_uep_binding_info) == NULL) { + ogs_error("OpenAPI_ue_context_convertToJSON() failed [pcf_uep_binding_info]"); + goto end; + } + } + + if (ue_context->used_service_area_restriction) { + cJSON *used_service_area_restriction_local_JSON = OpenAPI_service_area_restriction_convertToJSON(ue_context->used_service_area_restriction); + if (used_service_area_restriction_local_JSON == NULL) { + ogs_error("OpenAPI_ue_context_convertToJSON() failed [used_service_area_restriction]"); + goto end; + } + cJSON_AddItemToObject(item, "usedServiceAreaRestriction", used_service_area_restriction_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_ue_context_convertToJSON() failed [used_service_area_restriction]"); + goto end; + } + } + + if (ue_context->pra_in_am_policy) { + cJSON *pra_in_am_policy = cJSON_AddObjectToObject(item, "praInAmPolicy"); + if (pra_in_am_policy == NULL) { + ogs_error("OpenAPI_ue_context_convertToJSON() failed [pra_in_am_policy]"); + goto end; + } + cJSON *localMapObject = pra_in_am_policy; + if (ue_context->pra_in_am_policy) { + OpenAPI_list_for_each(ue_context->pra_in_am_policy, node) { + OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*)node->data; + cJSON *itemLocal = localKeyValue->value ? + OpenAPI_presence_info_convertToJSON(localKeyValue->value) : + cJSON_CreateNull(); + if (itemLocal == NULL) { + ogs_error("OpenAPI_ue_context_convertToJSON() failed [inner]"); + goto end; + } + cJSON_AddItemToObject(localMapObject, localKeyValue->key, itemLocal); + } + } + } + + if (ue_context->pra_in_ue_policy) { + cJSON *pra_in_ue_policy = cJSON_AddObjectToObject(item, "praInUePolicy"); + if (pra_in_ue_policy == NULL) { + ogs_error("OpenAPI_ue_context_convertToJSON() failed [pra_in_ue_policy]"); + goto end; + } + cJSON *localMapObject = pra_in_ue_policy; + if (ue_context->pra_in_ue_policy) { + OpenAPI_list_for_each(ue_context->pra_in_ue_policy, node) { + OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*)node->data; + cJSON *itemLocal = localKeyValue->value ? + OpenAPI_presence_info_convertToJSON(localKeyValue->value) : + cJSON_CreateNull(); + if (itemLocal == NULL) { + ogs_error("OpenAPI_ue_context_convertToJSON() failed [inner]"); + goto end; + } + cJSON_AddItemToObject(localMapObject, localKeyValue->key, itemLocal); + } + } + } + + if (ue_context->updp_subscription_data) { + cJSON *updp_subscription_data_local_JSON = OpenAPI_updp_subscription_data_convertToJSON(ue_context->updp_subscription_data); + if (updp_subscription_data_local_JSON == NULL) { + ogs_error("OpenAPI_ue_context_convertToJSON() failed [updp_subscription_data]"); + goto end; + } + cJSON_AddItemToObject(item, "updpSubscriptionData", updp_subscription_data_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_ue_context_convertToJSON() failed [updp_subscription_data]"); + goto end; + } + } + + if (ue_context->sm_policy_notify_pdu_list) { + cJSON *sm_policy_notify_pdu_listList = cJSON_AddArrayToObject(item, "smPolicyNotifyPduList"); + if (sm_policy_notify_pdu_listList == NULL) { + ogs_error("OpenAPI_ue_context_convertToJSON() failed [sm_policy_notify_pdu_list]"); + goto end; + } + OpenAPI_list_for_each(ue_context->sm_policy_notify_pdu_list, node) { + cJSON *itemLocal = OpenAPI_pdu_session_info_convertToJSON(node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_ue_context_convertToJSON() failed [sm_policy_notify_pdu_list]"); + goto end; + } + cJSON_AddItemToArray(sm_policy_notify_pdu_listList, itemLocal); + } + } + + if (ue_context->pcf_ue_callback_info) { + cJSON *pcf_ue_callback_info_local_JSON = OpenAPI_pcf_ue_callback_info_convertToJSON(ue_context->pcf_ue_callback_info); + if (pcf_ue_callback_info_local_JSON == NULL) { + ogs_error("OpenAPI_ue_context_convertToJSON() failed [pcf_ue_callback_info]"); + goto end; + } + cJSON_AddItemToObject(item, "pcfUeCallbackInfo", pcf_ue_callback_info_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_ue_context_convertToJSON() failed [pcf_ue_callback_info]"); + goto end; + } + } + + if (ue_context->ue_positioning_cap) { + if (cJSON_AddStringToObject(item, "uePositioningCap", ue_context->ue_positioning_cap) == NULL) { + ogs_error("OpenAPI_ue_context_convertToJSON() failed [ue_positioning_cap]"); + goto end; + } + } + + if (ue_context->is_asti_distribution_indication) { + if (cJSON_AddBoolToObject(item, "astiDistributionIndication", ue_context->asti_distribution_indication) == NULL) { + ogs_error("OpenAPI_ue_context_convertToJSON() failed [asti_distribution_indication]"); + goto end; + } + } + + if (ue_context->is_ts_error_budget) { + if (cJSON_AddNumberToObject(item, "tsErrorBudget", ue_context->ts_error_budget) == NULL) { + ogs_error("OpenAPI_ue_context_convertToJSON() failed [ts_error_budget]"); + goto end; + } + } + + if (ue_context->is_snpn_onboard_ind) { + if (cJSON_AddBoolToObject(item, "snpnOnboardInd", ue_context->snpn_onboard_ind) == NULL) { + ogs_error("OpenAPI_ue_context_convertToJSON() failed [snpn_onboard_ind]"); + goto end; + } + } + + if (ue_context->smf_sel_info) { + cJSON *smf_sel_info_local_JSON = OpenAPI_smf_selection_data_convertToJSON(ue_context->smf_sel_info); + if (smf_sel_info_local_JSON == NULL) { + ogs_error("OpenAPI_ue_context_convertToJSON() failed [smf_sel_info]"); + goto end; + } + cJSON_AddItemToObject(item, "smfSelInfo", smf_sel_info_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_ue_context_convertToJSON() failed [smf_sel_info]"); + goto end; + } + } + + if (ue_context->pcf_ue_slice_mbr_list) { + cJSON *pcf_ue_slice_mbr_list = cJSON_AddObjectToObject(item, "pcfUeSliceMbrList"); + if (pcf_ue_slice_mbr_list == NULL) { + ogs_error("OpenAPI_ue_context_convertToJSON() failed [pcf_ue_slice_mbr_list]"); + goto end; + } + cJSON *localMapObject = pcf_ue_slice_mbr_list; + if (ue_context->pcf_ue_slice_mbr_list) { + OpenAPI_list_for_each(ue_context->pcf_ue_slice_mbr_list, node) { + OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*)node->data; + cJSON *itemLocal = localKeyValue->value ? + OpenAPI_slice_mbr_convertToJSON(localKeyValue->value) : + cJSON_CreateNull(); + if (itemLocal == NULL) { + ogs_error("OpenAPI_ue_context_convertToJSON() failed [inner]"); + goto end; + } + cJSON_AddItemToObject(localMapObject, localKeyValue->key, itemLocal); + } + } + } + + if (ue_context->smsf_set_id) { + if (cJSON_AddStringToObject(item, "smsfSetId", ue_context->smsf_set_id) == NULL) { + ogs_error("OpenAPI_ue_context_convertToJSON() failed [smsf_set_id]"); + goto end; + } + } + + if (ue_context->smsf_service_set_id) { + if (cJSON_AddStringToObject(item, "smsfServiceSetId", ue_context->smsf_service_set_id) == NULL) { + ogs_error("OpenAPI_ue_context_convertToJSON() failed [smsf_service_set_id]"); + goto end; + } + } + + if (ue_context->smsf_binding_info) { + if (cJSON_AddStringToObject(item, "smsfBindingInfo", ue_context->smsf_binding_info) == NULL) { + ogs_error("OpenAPI_ue_context_convertToJSON() failed [smsf_binding_info]"); + goto end; + } + } + + if (ue_context->is_disaster_roaming_ind) { + if (cJSON_AddBoolToObject(item, "disasterRoamingInd", ue_context->disaster_roaming_ind) == NULL) { + ogs_error("OpenAPI_ue_context_convertToJSON() failed [disaster_roaming_ind]"); + goto end; + } + } + + if (ue_context->disaster_plmn) { + cJSON *disaster_plmn_local_JSON = OpenAPI_plmn_id_convertToJSON(ue_context->disaster_plmn); + if (disaster_plmn_local_JSON == NULL) { + ogs_error("OpenAPI_ue_context_convertToJSON() failed [disaster_plmn]"); + goto end; + } + cJSON_AddItemToObject(item, "disasterPlmn", disaster_plmn_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_ue_context_convertToJSON() failed [disaster_plmn]"); + goto end; + } + } + end: return item; } @@ -896,6 +1359,7 @@ OpenAPI_ue_context_t *OpenAPI_ue_context_parseFromJSON(cJSON *ue_contextJSON) cJSON *ausf_group_id = NULL; cJSON *pcf_group_id = NULL; cJSON *routing_indicator = NULL; + cJSON *h_nw_pub_key_id = NULL; cJSON *group_list = NULL; OpenAPI_list_t *group_listList = NULL; cJSON *drx_parameter = NULL; @@ -903,6 +1367,8 @@ OpenAPI_ue_context_t *OpenAPI_ue_context_parseFromJSON(cJSON *ue_contextJSON) cJSON *used_rfsp = NULL; cJSON *sub_ue_ambr = NULL; OpenAPI_ambr_t *sub_ue_ambr_local_nonprim = NULL; + cJSON *sub_ue_slice_mbr_list = NULL; + OpenAPI_list_t *sub_ue_slice_mbr_listList = NULL; cJSON *smsf_id = NULL; cJSON *seaf_data = NULL; OpenAPI_seaf_data_t *seaf_data_local_nonprim = NULL; @@ -935,6 +1401,8 @@ OpenAPI_ue_context_t *OpenAPI_ue_context_parseFromJSON(cJSON *ue_contextJSON) OpenAPI_list_t *mm_context_listList = NULL; cJSON *session_context_list = NULL; OpenAPI_list_t *session_context_listList = NULL; + cJSON *eps_interworking_info = NULL; + OpenAPI_eps_interworking_info_t *eps_interworking_info_local_nonprim = NULL; cJSON *trace_data = NULL; OpenAPI_trace_data_t *trace_data_local_nonprim = NULL; cJSON *service_gap_expiry_time = NULL; @@ -952,6 +1420,7 @@ OpenAPI_ue_context_t *OpenAPI_ue_context_parseFromJSON(cJSON *ue_contextJSON) cJSON *v2x_context = NULL; OpenAPI_v2x_context_t *v2x_context_local_nonprim = NULL; cJSON *lte_cat_m_ind = NULL; + cJSON *red_cap_ind = NULL; cJSON *mo_exp_data_counter = NULL; OpenAPI_mo_exp_data_counter_t *mo_exp_data_counter_local_nonprim = NULL; cJSON *cag_data = NULL; @@ -963,6 +1432,38 @@ OpenAPI_ue_context_t *OpenAPI_ue_context_parseFromJSON(cJSON *ue_contextJSON) OpenAPI_ec_restriction_data_wb_t *ec_restriction_data_wb_local_nonprim = NULL; cJSON *ec_restriction_data_nb = NULL; cJSON *iab_operation_allowed = NULL; + cJSON *prose_context = NULL; + OpenAPI_prose_context_t *prose_context_local_nonprim = NULL; + cJSON *analytics_subscription_list = NULL; + OpenAPI_list_t *analytics_subscription_listList = NULL; + cJSON *pcf_amp_binding_info = NULL; + cJSON *pcf_uep_binding_info = NULL; + cJSON *used_service_area_restriction = NULL; + OpenAPI_service_area_restriction_t *used_service_area_restriction_local_nonprim = NULL; + cJSON *pra_in_am_policy = NULL; + OpenAPI_list_t *pra_in_am_policyList = NULL; + cJSON *pra_in_ue_policy = NULL; + OpenAPI_list_t *pra_in_ue_policyList = NULL; + cJSON *updp_subscription_data = NULL; + OpenAPI_updp_subscription_data_t *updp_subscription_data_local_nonprim = NULL; + cJSON *sm_policy_notify_pdu_list = NULL; + OpenAPI_list_t *sm_policy_notify_pdu_listList = NULL; + cJSON *pcf_ue_callback_info = NULL; + OpenAPI_pcf_ue_callback_info_t *pcf_ue_callback_info_local_nonprim = NULL; + cJSON *ue_positioning_cap = NULL; + cJSON *asti_distribution_indication = NULL; + cJSON *ts_error_budget = NULL; + cJSON *snpn_onboard_ind = NULL; + cJSON *smf_sel_info = NULL; + OpenAPI_smf_selection_data_t *smf_sel_info_local_nonprim = NULL; + cJSON *pcf_ue_slice_mbr_list = NULL; + OpenAPI_list_t *pcf_ue_slice_mbr_listList = NULL; + cJSON *smsf_set_id = NULL; + cJSON *smsf_service_set_id = NULL; + cJSON *smsf_binding_info = NULL; + cJSON *disaster_roaming_ind = NULL; + cJSON *disaster_plmn = NULL; + OpenAPI_plmn_id_t *disaster_plmn_local_nonprim = NULL; supi = cJSON_GetObjectItemCaseSensitive(ue_contextJSON, "supi"); if (supi) { if (!cJSON_IsString(supi) && !cJSON_IsNull(supi)) { @@ -1040,6 +1541,14 @@ OpenAPI_ue_context_t *OpenAPI_ue_context_parseFromJSON(cJSON *ue_contextJSON) } } + h_nw_pub_key_id = cJSON_GetObjectItemCaseSensitive(ue_contextJSON, "hNwPubKeyId"); + if (h_nw_pub_key_id) { + if (!cJSON_IsNumber(h_nw_pub_key_id)) { + ogs_error("OpenAPI_ue_context_parseFromJSON() failed [h_nw_pub_key_id]"); + goto end; + } + } + group_list = cJSON_GetObjectItemCaseSensitive(ue_contextJSON, "groupList"); if (group_list) { cJSON *group_list_local = NULL; @@ -1090,6 +1599,32 @@ OpenAPI_ue_context_t *OpenAPI_ue_context_parseFromJSON(cJSON *ue_contextJSON) sub_ue_ambr_local_nonprim = OpenAPI_ambr_parseFromJSON(sub_ue_ambr); } + sub_ue_slice_mbr_list = cJSON_GetObjectItemCaseSensitive(ue_contextJSON, "subUeSliceMbrList"); + if (sub_ue_slice_mbr_list) { + cJSON *sub_ue_slice_mbr_list_local_map = NULL; + if (!cJSON_IsObject(sub_ue_slice_mbr_list) && !cJSON_IsNull(sub_ue_slice_mbr_list)) { + ogs_error("OpenAPI_ue_context_parseFromJSON() failed [sub_ue_slice_mbr_list]"); + goto end; + } + if (cJSON_IsObject(sub_ue_slice_mbr_list)) { + sub_ue_slice_mbr_listList = OpenAPI_list_create(); + OpenAPI_map_t *localMapKeyPair = NULL; + cJSON_ArrayForEach(sub_ue_slice_mbr_list_local_map, sub_ue_slice_mbr_list) { + cJSON *localMapObject = sub_ue_slice_mbr_list_local_map; + if (cJSON_IsObject(localMapObject)) { + localMapKeyPair = OpenAPI_map_create( + ogs_strdup(localMapObject->string), OpenAPI_slice_mbr_parseFromJSON(localMapObject)); + } else if (cJSON_IsNull(localMapObject)) { + localMapKeyPair = OpenAPI_map_create(ogs_strdup(localMapObject->string), NULL); + } else { + ogs_error("OpenAPI_ue_context_parseFromJSON() failed [inner]"); + goto end; + } + OpenAPI_list_add(sub_ue_slice_mbr_listList, localMapKeyPair); + } + } + } + smsf_id = cJSON_GetObjectItemCaseSensitive(ue_contextJSON, "smsfId"); if (smsf_id) { if (!cJSON_IsString(smsf_id) && !cJSON_IsNull(smsf_id)) { @@ -1365,6 +1900,11 @@ OpenAPI_ue_context_t *OpenAPI_ue_context_parseFromJSON(cJSON *ue_contextJSON) } } + eps_interworking_info = cJSON_GetObjectItemCaseSensitive(ue_contextJSON, "epsInterworkingInfo"); + if (eps_interworking_info) { + eps_interworking_info_local_nonprim = OpenAPI_eps_interworking_info_parseFromJSON(eps_interworking_info); + } + trace_data = cJSON_GetObjectItemCaseSensitive(ue_contextJSON, "traceData"); if (trace_data) { trace_data_local_nonprim = OpenAPI_trace_data_parseFromJSON(trace_data); @@ -1499,6 +2039,14 @@ OpenAPI_ue_context_t *OpenAPI_ue_context_parseFromJSON(cJSON *ue_contextJSON) } } + red_cap_ind = cJSON_GetObjectItemCaseSensitive(ue_contextJSON, "redCapInd"); + if (red_cap_ind) { + if (!cJSON_IsBool(red_cap_ind)) { + ogs_error("OpenAPI_ue_context_parseFromJSON() failed [red_cap_ind]"); + goto end; + } + } + mo_exp_data_counter = cJSON_GetObjectItemCaseSensitive(ue_contextJSON, "moExpDataCounter"); if (mo_exp_data_counter) { mo_exp_data_counter_local_nonprim = OpenAPI_mo_exp_data_counter_parseFromJSON(mo_exp_data_counter); @@ -1543,6 +2091,244 @@ OpenAPI_ue_context_t *OpenAPI_ue_context_parseFromJSON(cJSON *ue_contextJSON) } } + prose_context = cJSON_GetObjectItemCaseSensitive(ue_contextJSON, "proseContext"); + if (prose_context) { + prose_context_local_nonprim = OpenAPI_prose_context_parseFromJSON(prose_context); + } + + analytics_subscription_list = cJSON_GetObjectItemCaseSensitive(ue_contextJSON, "analyticsSubscriptionList"); + if (analytics_subscription_list) { + cJSON *analytics_subscription_list_local = NULL; + if (!cJSON_IsArray(analytics_subscription_list)) { + ogs_error("OpenAPI_ue_context_parseFromJSON() failed [analytics_subscription_list]"); + goto end; + } + + analytics_subscription_listList = OpenAPI_list_create(); + + cJSON_ArrayForEach(analytics_subscription_list_local, analytics_subscription_list) { + if (!cJSON_IsObject(analytics_subscription_list_local)) { + ogs_error("OpenAPI_ue_context_parseFromJSON() failed [analytics_subscription_list]"); + goto end; + } + OpenAPI_analytics_subscription_t *analytics_subscription_listItem = OpenAPI_analytics_subscription_parseFromJSON(analytics_subscription_list_local); + if (!analytics_subscription_listItem) { + ogs_error("No analytics_subscription_listItem"); + OpenAPI_list_free(analytics_subscription_listList); + goto end; + } + OpenAPI_list_add(analytics_subscription_listList, analytics_subscription_listItem); + } + } + + pcf_amp_binding_info = cJSON_GetObjectItemCaseSensitive(ue_contextJSON, "pcfAmpBindingInfo"); + if (pcf_amp_binding_info) { + if (!cJSON_IsString(pcf_amp_binding_info) && !cJSON_IsNull(pcf_amp_binding_info)) { + ogs_error("OpenAPI_ue_context_parseFromJSON() failed [pcf_amp_binding_info]"); + goto end; + } + } + + pcf_uep_binding_info = cJSON_GetObjectItemCaseSensitive(ue_contextJSON, "pcfUepBindingInfo"); + if (pcf_uep_binding_info) { + if (!cJSON_IsString(pcf_uep_binding_info) && !cJSON_IsNull(pcf_uep_binding_info)) { + ogs_error("OpenAPI_ue_context_parseFromJSON() failed [pcf_uep_binding_info]"); + goto end; + } + } + + used_service_area_restriction = cJSON_GetObjectItemCaseSensitive(ue_contextJSON, "usedServiceAreaRestriction"); + if (used_service_area_restriction) { + used_service_area_restriction_local_nonprim = OpenAPI_service_area_restriction_parseFromJSON(used_service_area_restriction); + } + + pra_in_am_policy = cJSON_GetObjectItemCaseSensitive(ue_contextJSON, "praInAmPolicy"); + if (pra_in_am_policy) { + cJSON *pra_in_am_policy_local_map = NULL; + if (!cJSON_IsObject(pra_in_am_policy) && !cJSON_IsNull(pra_in_am_policy)) { + ogs_error("OpenAPI_ue_context_parseFromJSON() failed [pra_in_am_policy]"); + goto end; + } + if (cJSON_IsObject(pra_in_am_policy)) { + pra_in_am_policyList = OpenAPI_list_create(); + OpenAPI_map_t *localMapKeyPair = NULL; + cJSON_ArrayForEach(pra_in_am_policy_local_map, pra_in_am_policy) { + cJSON *localMapObject = pra_in_am_policy_local_map; + if (cJSON_IsObject(localMapObject)) { + localMapKeyPair = OpenAPI_map_create( + ogs_strdup(localMapObject->string), OpenAPI_presence_info_parseFromJSON(localMapObject)); + } else if (cJSON_IsNull(localMapObject)) { + localMapKeyPair = OpenAPI_map_create(ogs_strdup(localMapObject->string), NULL); + } else { + ogs_error("OpenAPI_ue_context_parseFromJSON() failed [inner]"); + goto end; + } + OpenAPI_list_add(pra_in_am_policyList, localMapKeyPair); + } + } + } + + pra_in_ue_policy = cJSON_GetObjectItemCaseSensitive(ue_contextJSON, "praInUePolicy"); + if (pra_in_ue_policy) { + cJSON *pra_in_ue_policy_local_map = NULL; + if (!cJSON_IsObject(pra_in_ue_policy) && !cJSON_IsNull(pra_in_ue_policy)) { + ogs_error("OpenAPI_ue_context_parseFromJSON() failed [pra_in_ue_policy]"); + goto end; + } + if (cJSON_IsObject(pra_in_ue_policy)) { + pra_in_ue_policyList = OpenAPI_list_create(); + OpenAPI_map_t *localMapKeyPair = NULL; + cJSON_ArrayForEach(pra_in_ue_policy_local_map, pra_in_ue_policy) { + cJSON *localMapObject = pra_in_ue_policy_local_map; + if (cJSON_IsObject(localMapObject)) { + localMapKeyPair = OpenAPI_map_create( + ogs_strdup(localMapObject->string), OpenAPI_presence_info_parseFromJSON(localMapObject)); + } else if (cJSON_IsNull(localMapObject)) { + localMapKeyPair = OpenAPI_map_create(ogs_strdup(localMapObject->string), NULL); + } else { + ogs_error("OpenAPI_ue_context_parseFromJSON() failed [inner]"); + goto end; + } + OpenAPI_list_add(pra_in_ue_policyList, localMapKeyPair); + } + } + } + + updp_subscription_data = cJSON_GetObjectItemCaseSensitive(ue_contextJSON, "updpSubscriptionData"); + if (updp_subscription_data) { + updp_subscription_data_local_nonprim = OpenAPI_updp_subscription_data_parseFromJSON(updp_subscription_data); + } + + sm_policy_notify_pdu_list = cJSON_GetObjectItemCaseSensitive(ue_contextJSON, "smPolicyNotifyPduList"); + if (sm_policy_notify_pdu_list) { + cJSON *sm_policy_notify_pdu_list_local = NULL; + if (!cJSON_IsArray(sm_policy_notify_pdu_list)) { + ogs_error("OpenAPI_ue_context_parseFromJSON() failed [sm_policy_notify_pdu_list]"); + goto end; + } + + sm_policy_notify_pdu_listList = OpenAPI_list_create(); + + cJSON_ArrayForEach(sm_policy_notify_pdu_list_local, sm_policy_notify_pdu_list) { + if (!cJSON_IsObject(sm_policy_notify_pdu_list_local)) { + ogs_error("OpenAPI_ue_context_parseFromJSON() failed [sm_policy_notify_pdu_list]"); + goto end; + } + OpenAPI_pdu_session_info_t *sm_policy_notify_pdu_listItem = OpenAPI_pdu_session_info_parseFromJSON(sm_policy_notify_pdu_list_local); + if (!sm_policy_notify_pdu_listItem) { + ogs_error("No sm_policy_notify_pdu_listItem"); + OpenAPI_list_free(sm_policy_notify_pdu_listList); + goto end; + } + OpenAPI_list_add(sm_policy_notify_pdu_listList, sm_policy_notify_pdu_listItem); + } + } + + pcf_ue_callback_info = cJSON_GetObjectItemCaseSensitive(ue_contextJSON, "pcfUeCallbackInfo"); + if (pcf_ue_callback_info) { + pcf_ue_callback_info_local_nonprim = OpenAPI_pcf_ue_callback_info_parseFromJSON(pcf_ue_callback_info); + } + + ue_positioning_cap = cJSON_GetObjectItemCaseSensitive(ue_contextJSON, "uePositioningCap"); + if (ue_positioning_cap) { + if (!cJSON_IsString(ue_positioning_cap) && !cJSON_IsNull(ue_positioning_cap)) { + ogs_error("OpenAPI_ue_context_parseFromJSON() failed [ue_positioning_cap]"); + goto end; + } + } + + asti_distribution_indication = cJSON_GetObjectItemCaseSensitive(ue_contextJSON, "astiDistributionIndication"); + if (asti_distribution_indication) { + if (!cJSON_IsBool(asti_distribution_indication)) { + ogs_error("OpenAPI_ue_context_parseFromJSON() failed [asti_distribution_indication]"); + goto end; + } + } + + ts_error_budget = cJSON_GetObjectItemCaseSensitive(ue_contextJSON, "tsErrorBudget"); + if (ts_error_budget) { + if (!cJSON_IsNumber(ts_error_budget)) { + ogs_error("OpenAPI_ue_context_parseFromJSON() failed [ts_error_budget]"); + goto end; + } + } + + snpn_onboard_ind = cJSON_GetObjectItemCaseSensitive(ue_contextJSON, "snpnOnboardInd"); + if (snpn_onboard_ind) { + if (!cJSON_IsBool(snpn_onboard_ind)) { + ogs_error("OpenAPI_ue_context_parseFromJSON() failed [snpn_onboard_ind]"); + goto end; + } + } + + smf_sel_info = cJSON_GetObjectItemCaseSensitive(ue_contextJSON, "smfSelInfo"); + if (smf_sel_info) { + smf_sel_info_local_nonprim = OpenAPI_smf_selection_data_parseFromJSON(smf_sel_info); + } + + pcf_ue_slice_mbr_list = cJSON_GetObjectItemCaseSensitive(ue_contextJSON, "pcfUeSliceMbrList"); + if (pcf_ue_slice_mbr_list) { + cJSON *pcf_ue_slice_mbr_list_local_map = NULL; + if (!cJSON_IsObject(pcf_ue_slice_mbr_list) && !cJSON_IsNull(pcf_ue_slice_mbr_list)) { + ogs_error("OpenAPI_ue_context_parseFromJSON() failed [pcf_ue_slice_mbr_list]"); + goto end; + } + if (cJSON_IsObject(pcf_ue_slice_mbr_list)) { + pcf_ue_slice_mbr_listList = OpenAPI_list_create(); + OpenAPI_map_t *localMapKeyPair = NULL; + cJSON_ArrayForEach(pcf_ue_slice_mbr_list_local_map, pcf_ue_slice_mbr_list) { + cJSON *localMapObject = pcf_ue_slice_mbr_list_local_map; + if (cJSON_IsObject(localMapObject)) { + localMapKeyPair = OpenAPI_map_create( + ogs_strdup(localMapObject->string), OpenAPI_slice_mbr_parseFromJSON(localMapObject)); + } else if (cJSON_IsNull(localMapObject)) { + localMapKeyPair = OpenAPI_map_create(ogs_strdup(localMapObject->string), NULL); + } else { + ogs_error("OpenAPI_ue_context_parseFromJSON() failed [inner]"); + goto end; + } + OpenAPI_list_add(pcf_ue_slice_mbr_listList, localMapKeyPair); + } + } + } + + smsf_set_id = cJSON_GetObjectItemCaseSensitive(ue_contextJSON, "smsfSetId"); + if (smsf_set_id) { + if (!cJSON_IsString(smsf_set_id) && !cJSON_IsNull(smsf_set_id)) { + ogs_error("OpenAPI_ue_context_parseFromJSON() failed [smsf_set_id]"); + goto end; + } + } + + smsf_service_set_id = cJSON_GetObjectItemCaseSensitive(ue_contextJSON, "smsfServiceSetId"); + if (smsf_service_set_id) { + if (!cJSON_IsString(smsf_service_set_id) && !cJSON_IsNull(smsf_service_set_id)) { + ogs_error("OpenAPI_ue_context_parseFromJSON() failed [smsf_service_set_id]"); + goto end; + } + } + + smsf_binding_info = cJSON_GetObjectItemCaseSensitive(ue_contextJSON, "smsfBindingInfo"); + if (smsf_binding_info) { + if (!cJSON_IsString(smsf_binding_info) && !cJSON_IsNull(smsf_binding_info)) { + ogs_error("OpenAPI_ue_context_parseFromJSON() failed [smsf_binding_info]"); + goto end; + } + } + + disaster_roaming_ind = cJSON_GetObjectItemCaseSensitive(ue_contextJSON, "disasterRoamingInd"); + if (disaster_roaming_ind) { + if (!cJSON_IsBool(disaster_roaming_ind)) { + ogs_error("OpenAPI_ue_context_parseFromJSON() failed [disaster_roaming_ind]"); + goto end; + } + } + + disaster_plmn = cJSON_GetObjectItemCaseSensitive(ue_contextJSON, "disasterPlmn"); + if (disaster_plmn) { + disaster_plmn_local_nonprim = OpenAPI_plmn_id_parseFromJSON(disaster_plmn); + } + ue_context_local_var = OpenAPI_ue_context_create ( supi && !cJSON_IsNull(supi) ? ogs_strdup(supi->valuestring) : NULL, supi_unauth_ind ? true : false, @@ -1553,6 +2339,8 @@ OpenAPI_ue_context_t *OpenAPI_ue_context_parseFromJSON(cJSON *ue_contextJSON) ausf_group_id && !cJSON_IsNull(ausf_group_id) ? ogs_strdup(ausf_group_id->valuestring) : NULL, pcf_group_id && !cJSON_IsNull(pcf_group_id) ? ogs_strdup(pcf_group_id->valuestring) : NULL, routing_indicator && !cJSON_IsNull(routing_indicator) ? ogs_strdup(routing_indicator->valuestring) : NULL, + h_nw_pub_key_id ? true : false, + h_nw_pub_key_id ? h_nw_pub_key_id->valuedouble : 0, group_list ? group_listList : NULL, drx_parameter && !cJSON_IsNull(drx_parameter) ? ogs_strdup(drx_parameter->valuestring) : NULL, sub_rfsp ? true : false, @@ -1560,6 +2348,7 @@ OpenAPI_ue_context_t *OpenAPI_ue_context_parseFromJSON(cJSON *ue_contextJSON) used_rfsp ? true : false, used_rfsp ? used_rfsp->valuedouble : 0, sub_ue_ambr ? sub_ue_ambr_local_nonprim : NULL, + sub_ue_slice_mbr_list ? sub_ue_slice_mbr_listList : NULL, smsf_id && !cJSON_IsNull(smsf_id) ? ogs_strdup(smsf_id->valuestring) : NULL, seaf_data ? seaf_data_local_nonprim : NULL, _5g_mm_capability && !cJSON_IsNull(_5g_mm_capability) ? ogs_strdup(_5g_mm_capability->valuestring) : NULL, @@ -1581,6 +2370,7 @@ OpenAPI_ue_context_t *OpenAPI_ue_context_parseFromJSON(cJSON *ue_contextJSON) event_subscription_list ? event_subscription_listList : NULL, mm_context_list ? mm_context_listList : NULL, session_context_list ? session_context_listList : NULL, + eps_interworking_info ? eps_interworking_info_local_nonprim : NULL, trace_data ? trace_data_local_nonprim : NULL, service_gap_expiry_time && !cJSON_IsNull(service_gap_expiry_time) ? ogs_strdup(service_gap_expiry_time->valuestring) : NULL, stn_sr && !cJSON_IsNull(stn_sr) ? ogs_strdup(stn_sr->valuestring) : NULL, @@ -1593,6 +2383,8 @@ OpenAPI_ue_context_t *OpenAPI_ue_context_parseFromJSON(cJSON *ue_contextJSON) v2x_context ? v2x_context_local_nonprim : NULL, lte_cat_m_ind ? true : false, lte_cat_m_ind ? lte_cat_m_ind->valueint : 0, + red_cap_ind ? true : false, + red_cap_ind ? red_cap_ind->valueint : 0, mo_exp_data_counter ? mo_exp_data_counter_local_nonprim : NULL, cag_data ? cag_data_local_nonprim : NULL, management_mdt_ind ? true : false, @@ -1602,7 +2394,32 @@ OpenAPI_ue_context_t *OpenAPI_ue_context_parseFromJSON(cJSON *ue_contextJSON) ec_restriction_data_nb ? true : false, ec_restriction_data_nb ? ec_restriction_data_nb->valueint : 0, iab_operation_allowed ? true : false, - iab_operation_allowed ? iab_operation_allowed->valueint : 0 + iab_operation_allowed ? iab_operation_allowed->valueint : 0, + prose_context ? prose_context_local_nonprim : NULL, + analytics_subscription_list ? analytics_subscription_listList : NULL, + pcf_amp_binding_info && !cJSON_IsNull(pcf_amp_binding_info) ? ogs_strdup(pcf_amp_binding_info->valuestring) : NULL, + pcf_uep_binding_info && !cJSON_IsNull(pcf_uep_binding_info) ? ogs_strdup(pcf_uep_binding_info->valuestring) : NULL, + used_service_area_restriction ? used_service_area_restriction_local_nonprim : NULL, + pra_in_am_policy ? pra_in_am_policyList : NULL, + pra_in_ue_policy ? pra_in_ue_policyList : NULL, + updp_subscription_data ? updp_subscription_data_local_nonprim : NULL, + sm_policy_notify_pdu_list ? sm_policy_notify_pdu_listList : NULL, + pcf_ue_callback_info ? pcf_ue_callback_info_local_nonprim : NULL, + ue_positioning_cap && !cJSON_IsNull(ue_positioning_cap) ? ogs_strdup(ue_positioning_cap->valuestring) : NULL, + asti_distribution_indication ? true : false, + asti_distribution_indication ? asti_distribution_indication->valueint : 0, + ts_error_budget ? true : false, + ts_error_budget ? ts_error_budget->valuedouble : 0, + snpn_onboard_ind ? true : false, + snpn_onboard_ind ? snpn_onboard_ind->valueint : 0, + smf_sel_info ? smf_sel_info_local_nonprim : NULL, + pcf_ue_slice_mbr_list ? pcf_ue_slice_mbr_listList : NULL, + smsf_set_id && !cJSON_IsNull(smsf_set_id) ? ogs_strdup(smsf_set_id->valuestring) : NULL, + smsf_service_set_id && !cJSON_IsNull(smsf_service_set_id) ? ogs_strdup(smsf_service_set_id->valuestring) : NULL, + smsf_binding_info && !cJSON_IsNull(smsf_binding_info) ? ogs_strdup(smsf_binding_info->valuestring) : NULL, + disaster_roaming_ind ? true : false, + disaster_roaming_ind ? disaster_roaming_ind->valueint : 0, + disaster_plmn ? disaster_plmn_local_nonprim : NULL ); return ue_context_local_var; @@ -1625,6 +2442,16 @@ end: OpenAPI_ambr_free(sub_ue_ambr_local_nonprim); sub_ue_ambr_local_nonprim = NULL; } + if (sub_ue_slice_mbr_listList) { + OpenAPI_list_for_each(sub_ue_slice_mbr_listList, node) { + OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*) node->data; + ogs_free(localKeyValue->key); + OpenAPI_slice_mbr_free(localKeyValue->value); + OpenAPI_map_free(localKeyValue); + } + OpenAPI_list_free(sub_ue_slice_mbr_listList); + sub_ue_slice_mbr_listList = NULL; + } if (seaf_data_local_nonprim) { OpenAPI_seaf_data_free(seaf_data_local_nonprim); seaf_data_local_nonprim = NULL; @@ -1677,6 +2504,10 @@ end: OpenAPI_list_free(session_context_listList); session_context_listList = NULL; } + if (eps_interworking_info_local_nonprim) { + OpenAPI_eps_interworking_info_free(eps_interworking_info_local_nonprim); + eps_interworking_info_local_nonprim = NULL; + } if (trace_data_local_nonprim) { OpenAPI_trace_data_free(trace_data_local_nonprim); trace_data_local_nonprim = NULL; @@ -1723,6 +2554,74 @@ end: OpenAPI_ec_restriction_data_wb_free(ec_restriction_data_wb_local_nonprim); ec_restriction_data_wb_local_nonprim = NULL; } + if (prose_context_local_nonprim) { + OpenAPI_prose_context_free(prose_context_local_nonprim); + prose_context_local_nonprim = NULL; + } + if (analytics_subscription_listList) { + OpenAPI_list_for_each(analytics_subscription_listList, node) { + OpenAPI_analytics_subscription_free(node->data); + } + OpenAPI_list_free(analytics_subscription_listList); + analytics_subscription_listList = NULL; + } + if (used_service_area_restriction_local_nonprim) { + OpenAPI_service_area_restriction_free(used_service_area_restriction_local_nonprim); + used_service_area_restriction_local_nonprim = NULL; + } + if (pra_in_am_policyList) { + OpenAPI_list_for_each(pra_in_am_policyList, node) { + OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*) node->data; + ogs_free(localKeyValue->key); + OpenAPI_presence_info_free(localKeyValue->value); + OpenAPI_map_free(localKeyValue); + } + OpenAPI_list_free(pra_in_am_policyList); + pra_in_am_policyList = NULL; + } + if (pra_in_ue_policyList) { + OpenAPI_list_for_each(pra_in_ue_policyList, node) { + OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*) node->data; + ogs_free(localKeyValue->key); + OpenAPI_presence_info_free(localKeyValue->value); + OpenAPI_map_free(localKeyValue); + } + OpenAPI_list_free(pra_in_ue_policyList); + pra_in_ue_policyList = NULL; + } + if (updp_subscription_data_local_nonprim) { + OpenAPI_updp_subscription_data_free(updp_subscription_data_local_nonprim); + updp_subscription_data_local_nonprim = NULL; + } + if (sm_policy_notify_pdu_listList) { + OpenAPI_list_for_each(sm_policy_notify_pdu_listList, node) { + OpenAPI_pdu_session_info_free(node->data); + } + OpenAPI_list_free(sm_policy_notify_pdu_listList); + sm_policy_notify_pdu_listList = NULL; + } + if (pcf_ue_callback_info_local_nonprim) { + OpenAPI_pcf_ue_callback_info_free(pcf_ue_callback_info_local_nonprim); + pcf_ue_callback_info_local_nonprim = NULL; + } + if (smf_sel_info_local_nonprim) { + OpenAPI_smf_selection_data_free(smf_sel_info_local_nonprim); + smf_sel_info_local_nonprim = NULL; + } + if (pcf_ue_slice_mbr_listList) { + OpenAPI_list_for_each(pcf_ue_slice_mbr_listList, node) { + OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*) node->data; + ogs_free(localKeyValue->key); + OpenAPI_slice_mbr_free(localKeyValue->value); + OpenAPI_map_free(localKeyValue); + } + OpenAPI_list_free(pcf_ue_slice_mbr_listList); + pcf_ue_slice_mbr_listList = NULL; + } + if (disaster_plmn_local_nonprim) { + OpenAPI_plmn_id_free(disaster_plmn_local_nonprim); + disaster_plmn_local_nonprim = NULL; + } return NULL; } diff --git a/lib/sbi/openapi/model/ue_context.h b/lib/sbi/openapi/model/ue_context.h index 53429ab27..8aa6d235d 100644 --- a/lib/sbi/openapi/model/ue_context.h +++ b/lib/sbi/openapi/model/ue_context.h @@ -1,7 +1,7 @@ /* * ue_context.h * - * + * Represents an individual ueContext resource */ #ifndef _OpenAPI_ue_context_H_ @@ -13,22 +13,32 @@ #include "../include/keyValuePair.h" #include "../include/binary.h" #include "ambr.h" +#include "analytics_subscription.h" #include "area.h" #include "cag_data.h" #include "core_network_type.h" #include "ec_restriction_data_wb.h" +#include "eps_interworking_info.h" #include "ext_amf_event_subscription.h" #include "immediate_mdt_conf.h" #include "mm_context.h" #include "mo_exp_data_counter.h" +#include "pcf_ue_callback_info.h" #include "pdu_session_context.h" +#include "pdu_session_info.h" +#include "plmn_id.h" #include "policy_req_trigger.h" +#include "presence_info.h" +#include "prose_context.h" #include "rat_type.h" #include "sbi_binding_level.h" #include "seaf_data.h" #include "service_area_restriction.h" +#include "slice_mbr.h" #include "small_data_rate_status_info.h" +#include "smf_selection_data.h" #include "trace_data.h" +#include "updp_subscription_data.h" #include "v2x_context.h" #ifdef __cplusplus @@ -46,6 +56,8 @@ typedef struct OpenAPI_ue_context_s { char *ausf_group_id; char *pcf_group_id; char *routing_indicator; + bool is_h_nw_pub_key_id; + int h_nw_pub_key_id; OpenAPI_list_t *group_list; char *drx_parameter; bool is_sub_rfsp; @@ -53,6 +65,7 @@ typedef struct OpenAPI_ue_context_s { bool is_used_rfsp; int used_rfsp; struct OpenAPI_ambr_s *sub_ue_ambr; + OpenAPI_list_t* sub_ue_slice_mbr_list; char *smsf_id; struct OpenAPI_seaf_data_s *seaf_data; char *_5g_mm_capability; @@ -74,6 +87,7 @@ typedef struct OpenAPI_ue_context_s { OpenAPI_list_t *event_subscription_list; OpenAPI_list_t *mm_context_list; OpenAPI_list_t *session_context_list; + struct OpenAPI_eps_interworking_info_s *eps_interworking_info; struct OpenAPI_trace_data_s *trace_data; char *service_gap_expiry_time; char *stn_sr; @@ -86,6 +100,8 @@ typedef struct OpenAPI_ue_context_s { struct OpenAPI_v2x_context_s *v2x_context; bool is_lte_cat_m_ind; int lte_cat_m_ind; + bool is_red_cap_ind; + int red_cap_ind; struct OpenAPI_mo_exp_data_counter_s *mo_exp_data_counter; struct OpenAPI_cag_data_s *cag_data; bool is_management_mdt_ind; @@ -96,6 +112,31 @@ typedef struct OpenAPI_ue_context_s { int ec_restriction_data_nb; bool is_iab_operation_allowed; int iab_operation_allowed; + struct OpenAPI_prose_context_s *prose_context; + OpenAPI_list_t *analytics_subscription_list; + char *pcf_amp_binding_info; + char *pcf_uep_binding_info; + struct OpenAPI_service_area_restriction_s *used_service_area_restriction; + OpenAPI_list_t* pra_in_am_policy; + OpenAPI_list_t* pra_in_ue_policy; + struct OpenAPI_updp_subscription_data_s *updp_subscription_data; + OpenAPI_list_t *sm_policy_notify_pdu_list; + struct OpenAPI_pcf_ue_callback_info_s *pcf_ue_callback_info; + char *ue_positioning_cap; + bool is_asti_distribution_indication; + int asti_distribution_indication; + bool is_ts_error_budget; + int ts_error_budget; + bool is_snpn_onboard_ind; + int snpn_onboard_ind; + struct OpenAPI_smf_selection_data_s *smf_sel_info; + OpenAPI_list_t* pcf_ue_slice_mbr_list; + char *smsf_set_id; + char *smsf_service_set_id; + char *smsf_binding_info; + bool is_disaster_roaming_ind; + int disaster_roaming_ind; + struct OpenAPI_plmn_id_s *disaster_plmn; } OpenAPI_ue_context_t; OpenAPI_ue_context_t *OpenAPI_ue_context_create( @@ -108,6 +149,8 @@ OpenAPI_ue_context_t *OpenAPI_ue_context_create( char *ausf_group_id, char *pcf_group_id, char *routing_indicator, + bool is_h_nw_pub_key_id, + int h_nw_pub_key_id, OpenAPI_list_t *group_list, char *drx_parameter, bool is_sub_rfsp, @@ -115,6 +158,7 @@ OpenAPI_ue_context_t *OpenAPI_ue_context_create( bool is_used_rfsp, int used_rfsp, OpenAPI_ambr_t *sub_ue_ambr, + OpenAPI_list_t* sub_ue_slice_mbr_list, char *smsf_id, OpenAPI_seaf_data_t *seaf_data, char *_5g_mm_capability, @@ -136,6 +180,7 @@ OpenAPI_ue_context_t *OpenAPI_ue_context_create( OpenAPI_list_t *event_subscription_list, OpenAPI_list_t *mm_context_list, OpenAPI_list_t *session_context_list, + OpenAPI_eps_interworking_info_t *eps_interworking_info, OpenAPI_trace_data_t *trace_data, char *service_gap_expiry_time, char *stn_sr, @@ -148,6 +193,8 @@ OpenAPI_ue_context_t *OpenAPI_ue_context_create( OpenAPI_v2x_context_t *v2x_context, bool is_lte_cat_m_ind, int lte_cat_m_ind, + bool is_red_cap_ind, + int red_cap_ind, OpenAPI_mo_exp_data_counter_t *mo_exp_data_counter, OpenAPI_cag_data_t *cag_data, bool is_management_mdt_ind, @@ -157,7 +204,32 @@ OpenAPI_ue_context_t *OpenAPI_ue_context_create( bool is_ec_restriction_data_nb, int ec_restriction_data_nb, bool is_iab_operation_allowed, - int iab_operation_allowed + int iab_operation_allowed, + OpenAPI_prose_context_t *prose_context, + OpenAPI_list_t *analytics_subscription_list, + char *pcf_amp_binding_info, + char *pcf_uep_binding_info, + OpenAPI_service_area_restriction_t *used_service_area_restriction, + OpenAPI_list_t* pra_in_am_policy, + OpenAPI_list_t* pra_in_ue_policy, + OpenAPI_updp_subscription_data_t *updp_subscription_data, + OpenAPI_list_t *sm_policy_notify_pdu_list, + OpenAPI_pcf_ue_callback_info_t *pcf_ue_callback_info, + char *ue_positioning_cap, + bool is_asti_distribution_indication, + int asti_distribution_indication, + bool is_ts_error_budget, + int ts_error_budget, + bool is_snpn_onboard_ind, + int snpn_onboard_ind, + OpenAPI_smf_selection_data_t *smf_sel_info, + OpenAPI_list_t* pcf_ue_slice_mbr_list, + char *smsf_set_id, + char *smsf_service_set_id, + char *smsf_binding_info, + bool is_disaster_roaming_ind, + int disaster_roaming_ind, + OpenAPI_plmn_id_t *disaster_plmn ); void OpenAPI_ue_context_free(OpenAPI_ue_context_t *ue_context); OpenAPI_ue_context_t *OpenAPI_ue_context_parseFromJSON(cJSON *ue_contextJSON); diff --git a/lib/sbi/openapi/model/ue_context_cancel_relocate_data.h b/lib/sbi/openapi/model/ue_context_cancel_relocate_data.h index 9975ed7c8..b0ccc5927 100644 --- a/lib/sbi/openapi/model/ue_context_cancel_relocate_data.h +++ b/lib/sbi/openapi/model/ue_context_cancel_relocate_data.h @@ -1,7 +1,7 @@ /* * ue_context_cancel_relocate_data.h * - * + * Data structure used for cancellation of UE Context Relocation */ #ifndef _OpenAPI_ue_context_cancel_relocate_data_H_ diff --git a/lib/sbi/openapi/model/ue_context_create_data.c b/lib/sbi/openapi/model/ue_context_create_data.c index a4593171c..b91b97b05 100644 --- a/lib/sbi/openapi/model/ue_context_create_data.c +++ b/lib/sbi/openapi/model/ue_context_create_data.c @@ -11,6 +11,7 @@ OpenAPI_ue_context_create_data_t *OpenAPI_ue_context_create_data_create( OpenAPI_list_t *pdu_session_list, char *n2_notify_uri, OpenAPI_n2_info_content_t *ue_radio_capability, + OpenAPI_n2_info_content_t *ue_radio_capability_for_paging, OpenAPI_ng_ap_cause_t *ngap_cause, char *supported_features, OpenAPI_plmn_id_nid_t *serving_network @@ -25,6 +26,7 @@ OpenAPI_ue_context_create_data_t *OpenAPI_ue_context_create_data_create( ue_context_create_data_local_var->pdu_session_list = pdu_session_list; ue_context_create_data_local_var->n2_notify_uri = n2_notify_uri; ue_context_create_data_local_var->ue_radio_capability = ue_radio_capability; + ue_context_create_data_local_var->ue_radio_capability_for_paging = ue_radio_capability_for_paging; ue_context_create_data_local_var->ngap_cause = ngap_cause; ue_context_create_data_local_var->supported_features = supported_features; ue_context_create_data_local_var->serving_network = serving_network; @@ -66,6 +68,10 @@ void OpenAPI_ue_context_create_data_free(OpenAPI_ue_context_create_data_t *ue_co OpenAPI_n2_info_content_free(ue_context_create_data->ue_radio_capability); ue_context_create_data->ue_radio_capability = NULL; } + if (ue_context_create_data->ue_radio_capability_for_paging) { + OpenAPI_n2_info_content_free(ue_context_create_data->ue_radio_capability_for_paging); + ue_context_create_data->ue_radio_capability_for_paging = NULL; + } if (ue_context_create_data->ngap_cause) { OpenAPI_ng_ap_cause_free(ue_context_create_data->ngap_cause); ue_context_create_data->ngap_cause = NULL; @@ -175,6 +181,19 @@ cJSON *OpenAPI_ue_context_create_data_convertToJSON(OpenAPI_ue_context_create_da } } + if (ue_context_create_data->ue_radio_capability_for_paging) { + cJSON *ue_radio_capability_for_paging_local_JSON = OpenAPI_n2_info_content_convertToJSON(ue_context_create_data->ue_radio_capability_for_paging); + if (ue_radio_capability_for_paging_local_JSON == NULL) { + ogs_error("OpenAPI_ue_context_create_data_convertToJSON() failed [ue_radio_capability_for_paging]"); + goto end; + } + cJSON_AddItemToObject(item, "ueRadioCapabilityForPaging", ue_radio_capability_for_paging_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_ue_context_create_data_convertToJSON() failed [ue_radio_capability_for_paging]"); + goto end; + } + } + if (ue_context_create_data->ngap_cause) { cJSON *ngap_cause_local_JSON = OpenAPI_ng_ap_cause_convertToJSON(ue_context_create_data->ngap_cause); if (ngap_cause_local_JSON == NULL) { @@ -227,6 +246,8 @@ OpenAPI_ue_context_create_data_t *OpenAPI_ue_context_create_data_parseFromJSON(c cJSON *n2_notify_uri = NULL; cJSON *ue_radio_capability = NULL; OpenAPI_n2_info_content_t *ue_radio_capability_local_nonprim = NULL; + cJSON *ue_radio_capability_for_paging = NULL; + OpenAPI_n2_info_content_t *ue_radio_capability_for_paging_local_nonprim = NULL; cJSON *ngap_cause = NULL; OpenAPI_ng_ap_cause_t *ngap_cause_local_nonprim = NULL; cJSON *supported_features = NULL; @@ -293,6 +314,11 @@ OpenAPI_ue_context_create_data_t *OpenAPI_ue_context_create_data_parseFromJSON(c ue_radio_capability_local_nonprim = OpenAPI_n2_info_content_parseFromJSON(ue_radio_capability); } + ue_radio_capability_for_paging = cJSON_GetObjectItemCaseSensitive(ue_context_create_dataJSON, "ueRadioCapabilityForPaging"); + if (ue_radio_capability_for_paging) { + ue_radio_capability_for_paging_local_nonprim = OpenAPI_n2_info_content_parseFromJSON(ue_radio_capability_for_paging); + } + ngap_cause = cJSON_GetObjectItemCaseSensitive(ue_context_create_dataJSON, "ngapCause"); if (ngap_cause) { ngap_cause_local_nonprim = OpenAPI_ng_ap_cause_parseFromJSON(ngap_cause); @@ -318,6 +344,7 @@ OpenAPI_ue_context_create_data_t *OpenAPI_ue_context_create_data_parseFromJSON(c pdu_session_listList, n2_notify_uri && !cJSON_IsNull(n2_notify_uri) ? ogs_strdup(n2_notify_uri->valuestring) : NULL, ue_radio_capability ? ue_radio_capability_local_nonprim : NULL, + ue_radio_capability_for_paging ? ue_radio_capability_for_paging_local_nonprim : NULL, ngap_cause ? ngap_cause_local_nonprim : NULL, supported_features && !cJSON_IsNull(supported_features) ? ogs_strdup(supported_features->valuestring) : NULL, serving_network ? serving_network_local_nonprim : NULL @@ -348,6 +375,10 @@ end: OpenAPI_n2_info_content_free(ue_radio_capability_local_nonprim); ue_radio_capability_local_nonprim = NULL; } + if (ue_radio_capability_for_paging_local_nonprim) { + OpenAPI_n2_info_content_free(ue_radio_capability_for_paging_local_nonprim); + ue_radio_capability_for_paging_local_nonprim = NULL; + } if (ngap_cause_local_nonprim) { OpenAPI_ng_ap_cause_free(ngap_cause_local_nonprim); ngap_cause_local_nonprim = NULL; diff --git a/lib/sbi/openapi/model/ue_context_create_data.h b/lib/sbi/openapi/model/ue_context_create_data.h index 2a70e62cc..abe9109fa 100644 --- a/lib/sbi/openapi/model/ue_context_create_data.h +++ b/lib/sbi/openapi/model/ue_context_create_data.h @@ -1,7 +1,7 @@ /* * ue_context_create_data.h * - * + * Data within a request to create an individual ueContext resource */ #ifndef _OpenAPI_ue_context_create_data_H_ @@ -31,6 +31,7 @@ typedef struct OpenAPI_ue_context_create_data_s { OpenAPI_list_t *pdu_session_list; char *n2_notify_uri; struct OpenAPI_n2_info_content_s *ue_radio_capability; + struct OpenAPI_n2_info_content_s *ue_radio_capability_for_paging; struct OpenAPI_ng_ap_cause_s *ngap_cause; char *supported_features; struct OpenAPI_plmn_id_nid_s *serving_network; @@ -43,6 +44,7 @@ OpenAPI_ue_context_create_data_t *OpenAPI_ue_context_create_data_create( OpenAPI_list_t *pdu_session_list, char *n2_notify_uri, OpenAPI_n2_info_content_t *ue_radio_capability, + OpenAPI_n2_info_content_t *ue_radio_capability_for_paging, OpenAPI_ng_ap_cause_t *ngap_cause, char *supported_features, OpenAPI_plmn_id_nid_t *serving_network diff --git a/lib/sbi/openapi/model/ue_context_create_error.h b/lib/sbi/openapi/model/ue_context_create_error.h index d10841064..26bc39e68 100644 --- a/lib/sbi/openapi/model/ue_context_create_error.h +++ b/lib/sbi/openapi/model/ue_context_create_error.h @@ -1,7 +1,7 @@ /* * ue_context_create_error.h * - * + * Data within a failure response for creating a UE context */ #ifndef _OpenAPI_ue_context_create_error_H_ diff --git a/lib/sbi/openapi/model/ue_context_created_data.c b/lib/sbi/openapi/model/ue_context_created_data.c index 97ba37a58..d30f7eebb 100644 --- a/lib/sbi/openapi/model/ue_context_created_data.c +++ b/lib/sbi/openapi/model/ue_context_created_data.c @@ -11,7 +11,8 @@ OpenAPI_ue_context_created_data_t *OpenAPI_ue_context_created_data_create( OpenAPI_list_t *failed_session_list, char *supported_features, bool is_pcf_reselected_ind, - int pcf_reselected_ind + int pcf_reselected_ind, + OpenAPI_list_t *analytics_not_used_list ) { OpenAPI_ue_context_created_data_t *ue_context_created_data_local_var = ogs_malloc(sizeof(OpenAPI_ue_context_created_data_t)); @@ -24,6 +25,7 @@ OpenAPI_ue_context_created_data_t *OpenAPI_ue_context_created_data_create( ue_context_created_data_local_var->supported_features = supported_features; ue_context_created_data_local_var->is_pcf_reselected_ind = is_pcf_reselected_ind; ue_context_created_data_local_var->pcf_reselected_ind = pcf_reselected_ind; + ue_context_created_data_local_var->analytics_not_used_list = analytics_not_used_list; return ue_context_created_data_local_var; } @@ -61,6 +63,13 @@ void OpenAPI_ue_context_created_data_free(OpenAPI_ue_context_created_data_t *ue_ ogs_free(ue_context_created_data->supported_features); ue_context_created_data->supported_features = NULL; } + if (ue_context_created_data->analytics_not_used_list) { + OpenAPI_list_for_each(ue_context_created_data->analytics_not_used_list, node) { + ogs_free(node->data); + } + OpenAPI_list_free(ue_context_created_data->analytics_not_used_list); + ue_context_created_data->analytics_not_used_list = NULL; + } ogs_free(ue_context_created_data); } @@ -153,6 +162,20 @@ cJSON *OpenAPI_ue_context_created_data_convertToJSON(OpenAPI_ue_context_created_ } } + if (ue_context_created_data->analytics_not_used_list) { + cJSON *analytics_not_used_listList = cJSON_AddArrayToObject(item, "analyticsNotUsedList"); + if (analytics_not_used_listList == NULL) { + ogs_error("OpenAPI_ue_context_created_data_convertToJSON() failed [analytics_not_used_list]"); + goto end; + } + OpenAPI_list_for_each(ue_context_created_data->analytics_not_used_list, node) { + if (cJSON_AddStringToObject(analytics_not_used_listList, "", (char*)node->data) == NULL) { + ogs_error("OpenAPI_ue_context_created_data_convertToJSON() failed [analytics_not_used_list]"); + goto end; + } + } + } + end: return item; } @@ -171,6 +194,8 @@ OpenAPI_ue_context_created_data_t *OpenAPI_ue_context_created_data_parseFromJSON OpenAPI_list_t *failed_session_listList = NULL; cJSON *supported_features = NULL; cJSON *pcf_reselected_ind = NULL; + cJSON *analytics_not_used_list = NULL; + OpenAPI_list_t *analytics_not_used_listList = NULL; ue_context = cJSON_GetObjectItemCaseSensitive(ue_context_created_dataJSON, "ueContext"); if (!ue_context) { ogs_error("OpenAPI_ue_context_created_data_parseFromJSON() failed [ue_context]"); @@ -253,6 +278,27 @@ OpenAPI_ue_context_created_data_t *OpenAPI_ue_context_created_data_parseFromJSON } } + analytics_not_used_list = cJSON_GetObjectItemCaseSensitive(ue_context_created_dataJSON, "analyticsNotUsedList"); + if (analytics_not_used_list) { + cJSON *analytics_not_used_list_local = NULL; + if (!cJSON_IsArray(analytics_not_used_list)) { + ogs_error("OpenAPI_ue_context_created_data_parseFromJSON() failed [analytics_not_used_list]"); + goto end; + } + + analytics_not_used_listList = OpenAPI_list_create(); + + cJSON_ArrayForEach(analytics_not_used_list_local, analytics_not_used_list) { + double *localDouble = NULL; + int *localInt = NULL; + if (!cJSON_IsString(analytics_not_used_list_local)) { + ogs_error("OpenAPI_ue_context_created_data_parseFromJSON() failed [analytics_not_used_list]"); + goto end; + } + OpenAPI_list_add(analytics_not_used_listList, ogs_strdup(analytics_not_used_list_local->valuestring)); + } + } + ue_context_created_data_local_var = OpenAPI_ue_context_created_data_create ( ue_context_local_nonprim, target_to_source_data_local_nonprim, @@ -260,7 +306,8 @@ OpenAPI_ue_context_created_data_t *OpenAPI_ue_context_created_data_parseFromJSON failed_session_list ? failed_session_listList : NULL, supported_features && !cJSON_IsNull(supported_features) ? ogs_strdup(supported_features->valuestring) : NULL, pcf_reselected_ind ? true : false, - pcf_reselected_ind ? pcf_reselected_ind->valueint : 0 + pcf_reselected_ind ? pcf_reselected_ind->valueint : 0, + analytics_not_used_list ? analytics_not_used_listList : NULL ); return ue_context_created_data_local_var; @@ -287,6 +334,13 @@ end: OpenAPI_list_free(failed_session_listList); failed_session_listList = NULL; } + if (analytics_not_used_listList) { + OpenAPI_list_for_each(analytics_not_used_listList, node) { + ogs_free(node->data); + } + OpenAPI_list_free(analytics_not_used_listList); + analytics_not_used_listList = NULL; + } return NULL; } diff --git a/lib/sbi/openapi/model/ue_context_created_data.h b/lib/sbi/openapi/model/ue_context_created_data.h index 5ddd3004b..2d5a502da 100644 --- a/lib/sbi/openapi/model/ue_context_created_data.h +++ b/lib/sbi/openapi/model/ue_context_created_data.h @@ -1,7 +1,7 @@ /* * ue_context_created_data.h * - * + * Data within a successful response for creating an individual ueContext resource */ #ifndef _OpenAPI_ue_context_created_data_H_ @@ -29,6 +29,7 @@ typedef struct OpenAPI_ue_context_created_data_s { char *supported_features; bool is_pcf_reselected_ind; int pcf_reselected_ind; + OpenAPI_list_t *analytics_not_used_list; } OpenAPI_ue_context_created_data_t; OpenAPI_ue_context_created_data_t *OpenAPI_ue_context_created_data_create( @@ -38,7 +39,8 @@ OpenAPI_ue_context_created_data_t *OpenAPI_ue_context_created_data_create( OpenAPI_list_t *failed_session_list, char *supported_features, bool is_pcf_reselected_ind, - int pcf_reselected_ind + int pcf_reselected_ind, + OpenAPI_list_t *analytics_not_used_list ); void OpenAPI_ue_context_created_data_free(OpenAPI_ue_context_created_data_t *ue_context_created_data); OpenAPI_ue_context_created_data_t *OpenAPI_ue_context_created_data_parseFromJSON(cJSON *ue_context_created_dataJSON); diff --git a/lib/sbi/openapi/model/ue_context_in_amf_data.c b/lib/sbi/openapi/model/ue_context_in_amf_data.c index 2ba91dc42..434e98a65 100644 --- a/lib/sbi/openapi/model/ue_context_in_amf_data.c +++ b/lib/sbi/openapi/model/ue_context_in_amf_data.c @@ -5,13 +5,15 @@ #include "ue_context_in_amf_data.h" OpenAPI_ue_context_in_amf_data_t *OpenAPI_ue_context_in_amf_data_create( - OpenAPI_eps_interworking_info_t *eps_interworking_info + OpenAPI_eps_interworking_info_t *eps_interworking_info, + OpenAPI_list_t *amf_info ) { OpenAPI_ue_context_in_amf_data_t *ue_context_in_amf_data_local_var = ogs_malloc(sizeof(OpenAPI_ue_context_in_amf_data_t)); ogs_assert(ue_context_in_amf_data_local_var); ue_context_in_amf_data_local_var->eps_interworking_info = eps_interworking_info; + ue_context_in_amf_data_local_var->amf_info = amf_info; return ue_context_in_amf_data_local_var; } @@ -27,6 +29,13 @@ void OpenAPI_ue_context_in_amf_data_free(OpenAPI_ue_context_in_amf_data_t *ue_co OpenAPI_eps_interworking_info_free(ue_context_in_amf_data->eps_interworking_info); ue_context_in_amf_data->eps_interworking_info = NULL; } + if (ue_context_in_amf_data->amf_info) { + OpenAPI_list_for_each(ue_context_in_amf_data->amf_info, node) { + OpenAPI_nudm_amf_info_free(node->data); + } + OpenAPI_list_free(ue_context_in_amf_data->amf_info); + ue_context_in_amf_data->amf_info = NULL; + } ogs_free(ue_context_in_amf_data); } @@ -54,6 +63,22 @@ cJSON *OpenAPI_ue_context_in_amf_data_convertToJSON(OpenAPI_ue_context_in_amf_da } } + if (ue_context_in_amf_data->amf_info) { + cJSON *amf_infoList = cJSON_AddArrayToObject(item, "amfInfo"); + if (amf_infoList == NULL) { + ogs_error("OpenAPI_ue_context_in_amf_data_convertToJSON() failed [amf_info]"); + goto end; + } + OpenAPI_list_for_each(ue_context_in_amf_data->amf_info, node) { + cJSON *itemLocal = OpenAPI_nudm_amf_info_convertToJSON(node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_ue_context_in_amf_data_convertToJSON() failed [amf_info]"); + goto end; + } + cJSON_AddItemToArray(amf_infoList, itemLocal); + } + } + end: return item; } @@ -64,13 +89,41 @@ OpenAPI_ue_context_in_amf_data_t *OpenAPI_ue_context_in_amf_data_parseFromJSON(c OpenAPI_lnode_t *node = NULL; cJSON *eps_interworking_info = NULL; OpenAPI_eps_interworking_info_t *eps_interworking_info_local_nonprim = NULL; + cJSON *amf_info = NULL; + OpenAPI_list_t *amf_infoList = NULL; eps_interworking_info = cJSON_GetObjectItemCaseSensitive(ue_context_in_amf_dataJSON, "epsInterworkingInfo"); if (eps_interworking_info) { eps_interworking_info_local_nonprim = OpenAPI_eps_interworking_info_parseFromJSON(eps_interworking_info); } + amf_info = cJSON_GetObjectItemCaseSensitive(ue_context_in_amf_dataJSON, "amfInfo"); + if (amf_info) { + cJSON *amf_info_local = NULL; + if (!cJSON_IsArray(amf_info)) { + ogs_error("OpenAPI_ue_context_in_amf_data_parseFromJSON() failed [amf_info]"); + goto end; + } + + amf_infoList = OpenAPI_list_create(); + + cJSON_ArrayForEach(amf_info_local, amf_info) { + if (!cJSON_IsObject(amf_info_local)) { + ogs_error("OpenAPI_ue_context_in_amf_data_parseFromJSON() failed [amf_info]"); + goto end; + } + OpenAPI_nudm_amf_info_t *amf_infoItem = OpenAPI_nudm_amf_info_parseFromJSON(amf_info_local); + if (!amf_infoItem) { + ogs_error("No amf_infoItem"); + OpenAPI_list_free(amf_infoList); + goto end; + } + OpenAPI_list_add(amf_infoList, amf_infoItem); + } + } + ue_context_in_amf_data_local_var = OpenAPI_ue_context_in_amf_data_create ( - eps_interworking_info ? eps_interworking_info_local_nonprim : NULL + eps_interworking_info ? eps_interworking_info_local_nonprim : NULL, + amf_info ? amf_infoList : NULL ); return ue_context_in_amf_data_local_var; @@ -79,6 +132,13 @@ end: OpenAPI_eps_interworking_info_free(eps_interworking_info_local_nonprim); eps_interworking_info_local_nonprim = NULL; } + if (amf_infoList) { + OpenAPI_list_for_each(amf_infoList, node) { + OpenAPI_nudm_amf_info_free(node->data); + } + OpenAPI_list_free(amf_infoList); + amf_infoList = NULL; + } return NULL; } diff --git a/lib/sbi/openapi/model/ue_context_in_amf_data.h b/lib/sbi/openapi/model/ue_context_in_amf_data.h index 195116ea5..6cd45aaca 100644 --- a/lib/sbi/openapi/model/ue_context_in_amf_data.h +++ b/lib/sbi/openapi/model/ue_context_in_amf_data.h @@ -13,6 +13,7 @@ #include "../include/keyValuePair.h" #include "../include/binary.h" #include "eps_interworking_info.h" +#include "nudm_amf_info.h" #ifdef __cplusplus extern "C" { @@ -21,10 +22,12 @@ extern "C" { typedef struct OpenAPI_ue_context_in_amf_data_s OpenAPI_ue_context_in_amf_data_t; typedef struct OpenAPI_ue_context_in_amf_data_s { struct OpenAPI_eps_interworking_info_s *eps_interworking_info; + OpenAPI_list_t *amf_info; } OpenAPI_ue_context_in_amf_data_t; OpenAPI_ue_context_in_amf_data_t *OpenAPI_ue_context_in_amf_data_create( - OpenAPI_eps_interworking_info_t *eps_interworking_info + OpenAPI_eps_interworking_info_t *eps_interworking_info, + OpenAPI_list_t *amf_info ); void OpenAPI_ue_context_in_amf_data_free(OpenAPI_ue_context_in_amf_data_t *ue_context_in_amf_data); OpenAPI_ue_context_in_amf_data_t *OpenAPI_ue_context_in_amf_data_parseFromJSON(cJSON *ue_context_in_amf_dataJSON); diff --git a/lib/sbi/openapi/model/ue_context_in_amf_data_1.c b/lib/sbi/openapi/model/ue_context_in_amf_data_1.c deleted file mode 100644 index 7813dbe47..000000000 --- a/lib/sbi/openapi/model/ue_context_in_amf_data_1.c +++ /dev/null @@ -1,118 +0,0 @@ - -#include -#include -#include -#include "ue_context_in_amf_data_1.h" - -OpenAPI_ue_context_in_amf_data_1_t *OpenAPI_ue_context_in_amf_data_1_create( - OpenAPI_eps_interworking_info_t *eps_interworking_info -) -{ - OpenAPI_ue_context_in_amf_data_1_t *ue_context_in_amf_data_1_local_var = ogs_malloc(sizeof(OpenAPI_ue_context_in_amf_data_1_t)); - ogs_assert(ue_context_in_amf_data_1_local_var); - - ue_context_in_amf_data_1_local_var->eps_interworking_info = eps_interworking_info; - - return ue_context_in_amf_data_1_local_var; -} - -void OpenAPI_ue_context_in_amf_data_1_free(OpenAPI_ue_context_in_amf_data_1_t *ue_context_in_amf_data_1) -{ - OpenAPI_lnode_t *node = NULL; - - if (NULL == ue_context_in_amf_data_1) { - return; - } - if (ue_context_in_amf_data_1->eps_interworking_info) { - OpenAPI_eps_interworking_info_free(ue_context_in_amf_data_1->eps_interworking_info); - ue_context_in_amf_data_1->eps_interworking_info = NULL; - } - ogs_free(ue_context_in_amf_data_1); -} - -cJSON *OpenAPI_ue_context_in_amf_data_1_convertToJSON(OpenAPI_ue_context_in_amf_data_1_t *ue_context_in_amf_data_1) -{ - cJSON *item = NULL; - OpenAPI_lnode_t *node = NULL; - - if (ue_context_in_amf_data_1 == NULL) { - ogs_error("OpenAPI_ue_context_in_amf_data_1_convertToJSON() failed [UeContextInAmfData_1]"); - return NULL; - } - - item = cJSON_CreateObject(); - if (ue_context_in_amf_data_1->eps_interworking_info) { - cJSON *eps_interworking_info_local_JSON = OpenAPI_eps_interworking_info_convertToJSON(ue_context_in_amf_data_1->eps_interworking_info); - if (eps_interworking_info_local_JSON == NULL) { - ogs_error("OpenAPI_ue_context_in_amf_data_1_convertToJSON() failed [eps_interworking_info]"); - goto end; - } - cJSON_AddItemToObject(item, "epsInterworkingInfo", eps_interworking_info_local_JSON); - if (item->child == NULL) { - ogs_error("OpenAPI_ue_context_in_amf_data_1_convertToJSON() failed [eps_interworking_info]"); - goto end; - } - } - -end: - return item; -} - -OpenAPI_ue_context_in_amf_data_1_t *OpenAPI_ue_context_in_amf_data_1_parseFromJSON(cJSON *ue_context_in_amf_data_1JSON) -{ - OpenAPI_ue_context_in_amf_data_1_t *ue_context_in_amf_data_1_local_var = NULL; - OpenAPI_lnode_t *node = NULL; - cJSON *eps_interworking_info = NULL; - OpenAPI_eps_interworking_info_t *eps_interworking_info_local_nonprim = NULL; - eps_interworking_info = cJSON_GetObjectItemCaseSensitive(ue_context_in_amf_data_1JSON, "epsInterworkingInfo"); - if (eps_interworking_info) { - eps_interworking_info_local_nonprim = OpenAPI_eps_interworking_info_parseFromJSON(eps_interworking_info); - } - - ue_context_in_amf_data_1_local_var = OpenAPI_ue_context_in_amf_data_1_create ( - eps_interworking_info ? eps_interworking_info_local_nonprim : NULL - ); - - return ue_context_in_amf_data_1_local_var; -end: - if (eps_interworking_info_local_nonprim) { - OpenAPI_eps_interworking_info_free(eps_interworking_info_local_nonprim); - eps_interworking_info_local_nonprim = NULL; - } - return NULL; -} - -OpenAPI_ue_context_in_amf_data_1_t *OpenAPI_ue_context_in_amf_data_1_copy(OpenAPI_ue_context_in_amf_data_1_t *dst, OpenAPI_ue_context_in_amf_data_1_t *src) -{ - cJSON *item = NULL; - char *content = NULL; - - ogs_assert(src); - item = OpenAPI_ue_context_in_amf_data_1_convertToJSON(src); - if (!item) { - ogs_error("OpenAPI_ue_context_in_amf_data_1_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_ue_context_in_amf_data_1_free(dst); - dst = OpenAPI_ue_context_in_amf_data_1_parseFromJSON(item); - cJSON_Delete(item); - - return dst; -} - diff --git a/lib/sbi/openapi/model/ue_context_in_amf_data_1.h b/lib/sbi/openapi/model/ue_context_in_amf_data_1.h deleted file mode 100644 index f0cb27140..000000000 --- a/lib/sbi/openapi/model/ue_context_in_amf_data_1.h +++ /dev/null @@ -1,39 +0,0 @@ -/* - * ue_context_in_amf_data_1.h - * - * - */ - -#ifndef _OpenAPI_ue_context_in_amf_data_1_H_ -#define _OpenAPI_ue_context_in_amf_data_1_H_ - -#include -#include "../external/cJSON.h" -#include "../include/list.h" -#include "../include/keyValuePair.h" -#include "../include/binary.h" -#include "eps_interworking_info.h" - -#ifdef __cplusplus -extern "C" { -#endif - -typedef struct OpenAPI_ue_context_in_amf_data_1_s OpenAPI_ue_context_in_amf_data_1_t; -typedef struct OpenAPI_ue_context_in_amf_data_1_s { - struct OpenAPI_eps_interworking_info_s *eps_interworking_info; -} OpenAPI_ue_context_in_amf_data_1_t; - -OpenAPI_ue_context_in_amf_data_1_t *OpenAPI_ue_context_in_amf_data_1_create( - OpenAPI_eps_interworking_info_t *eps_interworking_info -); -void OpenAPI_ue_context_in_amf_data_1_free(OpenAPI_ue_context_in_amf_data_1_t *ue_context_in_amf_data_1); -OpenAPI_ue_context_in_amf_data_1_t *OpenAPI_ue_context_in_amf_data_1_parseFromJSON(cJSON *ue_context_in_amf_data_1JSON); -cJSON *OpenAPI_ue_context_in_amf_data_1_convertToJSON(OpenAPI_ue_context_in_amf_data_1_t *ue_context_in_amf_data_1); -OpenAPI_ue_context_in_amf_data_1_t *OpenAPI_ue_context_in_amf_data_1_copy(OpenAPI_ue_context_in_amf_data_1_t *dst, OpenAPI_ue_context_in_amf_data_1_t *src); - -#ifdef __cplusplus -} -#endif - -#endif /* _OpenAPI_ue_context_in_amf_data_1_H_ */ - diff --git a/lib/sbi/openapi/model/ue_context_in_smf_data_1.c b/lib/sbi/openapi/model/ue_context_in_smf_data_1.c deleted file mode 100644 index c7c77a2ff..000000000 --- a/lib/sbi/openapi/model/ue_context_in_smf_data_1.c +++ /dev/null @@ -1,251 +0,0 @@ - -#include -#include -#include -#include "ue_context_in_smf_data_1.h" - -OpenAPI_ue_context_in_smf_data_1_t *OpenAPI_ue_context_in_smf_data_1_create( - OpenAPI_list_t* pdu_sessions, - OpenAPI_list_t *pgw_info, - OpenAPI_emergency_info_1_t *emergency_info -) -{ - OpenAPI_ue_context_in_smf_data_1_t *ue_context_in_smf_data_1_local_var = ogs_malloc(sizeof(OpenAPI_ue_context_in_smf_data_1_t)); - ogs_assert(ue_context_in_smf_data_1_local_var); - - ue_context_in_smf_data_1_local_var->pdu_sessions = pdu_sessions; - ue_context_in_smf_data_1_local_var->pgw_info = pgw_info; - ue_context_in_smf_data_1_local_var->emergency_info = emergency_info; - - return ue_context_in_smf_data_1_local_var; -} - -void OpenAPI_ue_context_in_smf_data_1_free(OpenAPI_ue_context_in_smf_data_1_t *ue_context_in_smf_data_1) -{ - OpenAPI_lnode_t *node = NULL; - - if (NULL == ue_context_in_smf_data_1) { - return; - } - if (ue_context_in_smf_data_1->pdu_sessions) { - OpenAPI_list_for_each(ue_context_in_smf_data_1->pdu_sessions, node) { - OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*)node->data; - ogs_free(localKeyValue->key); - OpenAPI_pdu_session_1_free(localKeyValue->value); - OpenAPI_map_free(localKeyValue); - } - OpenAPI_list_free(ue_context_in_smf_data_1->pdu_sessions); - ue_context_in_smf_data_1->pdu_sessions = NULL; - } - if (ue_context_in_smf_data_1->pgw_info) { - OpenAPI_list_for_each(ue_context_in_smf_data_1->pgw_info, node) { - OpenAPI_pgw_info_1_free(node->data); - } - OpenAPI_list_free(ue_context_in_smf_data_1->pgw_info); - ue_context_in_smf_data_1->pgw_info = NULL; - } - if (ue_context_in_smf_data_1->emergency_info) { - OpenAPI_emergency_info_1_free(ue_context_in_smf_data_1->emergency_info); - ue_context_in_smf_data_1->emergency_info = NULL; - } - ogs_free(ue_context_in_smf_data_1); -} - -cJSON *OpenAPI_ue_context_in_smf_data_1_convertToJSON(OpenAPI_ue_context_in_smf_data_1_t *ue_context_in_smf_data_1) -{ - cJSON *item = NULL; - OpenAPI_lnode_t *node = NULL; - - if (ue_context_in_smf_data_1 == NULL) { - ogs_error("OpenAPI_ue_context_in_smf_data_1_convertToJSON() failed [UeContextInSmfData_1]"); - return NULL; - } - - item = cJSON_CreateObject(); - if (ue_context_in_smf_data_1->pdu_sessions) { - cJSON *pdu_sessions = cJSON_AddObjectToObject(item, "pduSessions"); - if (pdu_sessions == NULL) { - ogs_error("OpenAPI_ue_context_in_smf_data_1_convertToJSON() failed [pdu_sessions]"); - goto end; - } - cJSON *localMapObject = pdu_sessions; - if (ue_context_in_smf_data_1->pdu_sessions) { - OpenAPI_list_for_each(ue_context_in_smf_data_1->pdu_sessions, node) { - OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*)node->data; - cJSON *itemLocal = localKeyValue->value ? - OpenAPI_pdu_session_1_convertToJSON(localKeyValue->value) : - cJSON_CreateNull(); - if (itemLocal == NULL) { - ogs_error("OpenAPI_ue_context_in_smf_data_1_convertToJSON() failed [inner]"); - goto end; - } - cJSON_AddItemToObject(localMapObject, localKeyValue->key, itemLocal); - } - } - } - - if (ue_context_in_smf_data_1->pgw_info) { - cJSON *pgw_infoList = cJSON_AddArrayToObject(item, "pgwInfo"); - if (pgw_infoList == NULL) { - ogs_error("OpenAPI_ue_context_in_smf_data_1_convertToJSON() failed [pgw_info]"); - goto end; - } - OpenAPI_list_for_each(ue_context_in_smf_data_1->pgw_info, node) { - cJSON *itemLocal = OpenAPI_pgw_info_1_convertToJSON(node->data); - if (itemLocal == NULL) { - ogs_error("OpenAPI_ue_context_in_smf_data_1_convertToJSON() failed [pgw_info]"); - goto end; - } - cJSON_AddItemToArray(pgw_infoList, itemLocal); - } - } - - if (ue_context_in_smf_data_1->emergency_info) { - cJSON *emergency_info_local_JSON = OpenAPI_emergency_info_1_convertToJSON(ue_context_in_smf_data_1->emergency_info); - if (emergency_info_local_JSON == NULL) { - ogs_error("OpenAPI_ue_context_in_smf_data_1_convertToJSON() failed [emergency_info]"); - goto end; - } - cJSON_AddItemToObject(item, "emergencyInfo", emergency_info_local_JSON); - if (item->child == NULL) { - ogs_error("OpenAPI_ue_context_in_smf_data_1_convertToJSON() failed [emergency_info]"); - goto end; - } - } - -end: - return item; -} - -OpenAPI_ue_context_in_smf_data_1_t *OpenAPI_ue_context_in_smf_data_1_parseFromJSON(cJSON *ue_context_in_smf_data_1JSON) -{ - OpenAPI_ue_context_in_smf_data_1_t *ue_context_in_smf_data_1_local_var = NULL; - OpenAPI_lnode_t *node = NULL; - cJSON *pdu_sessions = NULL; - OpenAPI_list_t *pdu_sessionsList = NULL; - cJSON *pgw_info = NULL; - OpenAPI_list_t *pgw_infoList = NULL; - cJSON *emergency_info = NULL; - OpenAPI_emergency_info_1_t *emergency_info_local_nonprim = NULL; - pdu_sessions = cJSON_GetObjectItemCaseSensitive(ue_context_in_smf_data_1JSON, "pduSessions"); - if (pdu_sessions) { - cJSON *pdu_sessions_local_map = NULL; - if (!cJSON_IsObject(pdu_sessions) && !cJSON_IsNull(pdu_sessions)) { - ogs_error("OpenAPI_ue_context_in_smf_data_1_parseFromJSON() failed [pdu_sessions]"); - goto end; - } - if (cJSON_IsObject(pdu_sessions)) { - pdu_sessionsList = OpenAPI_list_create(); - OpenAPI_map_t *localMapKeyPair = NULL; - cJSON_ArrayForEach(pdu_sessions_local_map, pdu_sessions) { - cJSON *localMapObject = pdu_sessions_local_map; - if (cJSON_IsObject(localMapObject)) { - localMapKeyPair = OpenAPI_map_create( - ogs_strdup(localMapObject->string), OpenAPI_pdu_session_1_parseFromJSON(localMapObject)); - } else if (cJSON_IsNull(localMapObject)) { - localMapKeyPair = OpenAPI_map_create(ogs_strdup(localMapObject->string), NULL); - } else { - ogs_error("OpenAPI_ue_context_in_smf_data_1_parseFromJSON() failed [inner]"); - goto end; - } - OpenAPI_list_add(pdu_sessionsList, localMapKeyPair); - } - } - } - - pgw_info = cJSON_GetObjectItemCaseSensitive(ue_context_in_smf_data_1JSON, "pgwInfo"); - if (pgw_info) { - cJSON *pgw_info_local = NULL; - if (!cJSON_IsArray(pgw_info)) { - ogs_error("OpenAPI_ue_context_in_smf_data_1_parseFromJSON() failed [pgw_info]"); - goto end; - } - - pgw_infoList = OpenAPI_list_create(); - - cJSON_ArrayForEach(pgw_info_local, pgw_info) { - if (!cJSON_IsObject(pgw_info_local)) { - ogs_error("OpenAPI_ue_context_in_smf_data_1_parseFromJSON() failed [pgw_info]"); - goto end; - } - OpenAPI_pgw_info_1_t *pgw_infoItem = OpenAPI_pgw_info_1_parseFromJSON(pgw_info_local); - if (!pgw_infoItem) { - ogs_error("No pgw_infoItem"); - OpenAPI_list_free(pgw_infoList); - goto end; - } - OpenAPI_list_add(pgw_infoList, pgw_infoItem); - } - } - - emergency_info = cJSON_GetObjectItemCaseSensitive(ue_context_in_smf_data_1JSON, "emergencyInfo"); - if (emergency_info) { - emergency_info_local_nonprim = OpenAPI_emergency_info_1_parseFromJSON(emergency_info); - } - - ue_context_in_smf_data_1_local_var = OpenAPI_ue_context_in_smf_data_1_create ( - pdu_sessions ? pdu_sessionsList : NULL, - pgw_info ? pgw_infoList : NULL, - emergency_info ? emergency_info_local_nonprim : NULL - ); - - return ue_context_in_smf_data_1_local_var; -end: - if (pdu_sessionsList) { - OpenAPI_list_for_each(pdu_sessionsList, node) { - OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*) node->data; - ogs_free(localKeyValue->key); - OpenAPI_pdu_session_1_free(localKeyValue->value); - OpenAPI_map_free(localKeyValue); - } - OpenAPI_list_free(pdu_sessionsList); - pdu_sessionsList = NULL; - } - if (pgw_infoList) { - OpenAPI_list_for_each(pgw_infoList, node) { - OpenAPI_pgw_info_1_free(node->data); - } - OpenAPI_list_free(pgw_infoList); - pgw_infoList = NULL; - } - if (emergency_info_local_nonprim) { - OpenAPI_emergency_info_1_free(emergency_info_local_nonprim); - emergency_info_local_nonprim = NULL; - } - return NULL; -} - -OpenAPI_ue_context_in_smf_data_1_t *OpenAPI_ue_context_in_smf_data_1_copy(OpenAPI_ue_context_in_smf_data_1_t *dst, OpenAPI_ue_context_in_smf_data_1_t *src) -{ - cJSON *item = NULL; - char *content = NULL; - - ogs_assert(src); - item = OpenAPI_ue_context_in_smf_data_1_convertToJSON(src); - if (!item) { - ogs_error("OpenAPI_ue_context_in_smf_data_1_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_ue_context_in_smf_data_1_free(dst); - dst = OpenAPI_ue_context_in_smf_data_1_parseFromJSON(item); - cJSON_Delete(item); - - return dst; -} - diff --git a/lib/sbi/openapi/model/ue_context_in_smf_data_1.h b/lib/sbi/openapi/model/ue_context_in_smf_data_1.h deleted file mode 100644 index a1db5e8c8..000000000 --- a/lib/sbi/openapi/model/ue_context_in_smf_data_1.h +++ /dev/null @@ -1,45 +0,0 @@ -/* - * ue_context_in_smf_data_1.h - * - * - */ - -#ifndef _OpenAPI_ue_context_in_smf_data_1_H_ -#define _OpenAPI_ue_context_in_smf_data_1_H_ - -#include -#include "../external/cJSON.h" -#include "../include/list.h" -#include "../include/keyValuePair.h" -#include "../include/binary.h" -#include "emergency_info_1.h" -#include "pdu_session_1.h" -#include "pgw_info_1.h" - -#ifdef __cplusplus -extern "C" { -#endif - -typedef struct OpenAPI_ue_context_in_smf_data_1_s OpenAPI_ue_context_in_smf_data_1_t; -typedef struct OpenAPI_ue_context_in_smf_data_1_s { - OpenAPI_list_t* pdu_sessions; - OpenAPI_list_t *pgw_info; - struct OpenAPI_emergency_info_1_s *emergency_info; -} OpenAPI_ue_context_in_smf_data_1_t; - -OpenAPI_ue_context_in_smf_data_1_t *OpenAPI_ue_context_in_smf_data_1_create( - OpenAPI_list_t* pdu_sessions, - OpenAPI_list_t *pgw_info, - OpenAPI_emergency_info_1_t *emergency_info -); -void OpenAPI_ue_context_in_smf_data_1_free(OpenAPI_ue_context_in_smf_data_1_t *ue_context_in_smf_data_1); -OpenAPI_ue_context_in_smf_data_1_t *OpenAPI_ue_context_in_smf_data_1_parseFromJSON(cJSON *ue_context_in_smf_data_1JSON); -cJSON *OpenAPI_ue_context_in_smf_data_1_convertToJSON(OpenAPI_ue_context_in_smf_data_1_t *ue_context_in_smf_data_1); -OpenAPI_ue_context_in_smf_data_1_t *OpenAPI_ue_context_in_smf_data_1_copy(OpenAPI_ue_context_in_smf_data_1_t *dst, OpenAPI_ue_context_in_smf_data_1_t *src); - -#ifdef __cplusplus -} -#endif - -#endif /* _OpenAPI_ue_context_in_smf_data_1_H_ */ - diff --git a/lib/sbi/openapi/model/ue_context_in_smf_data_sub_filter.c b/lib/sbi/openapi/model/ue_context_in_smf_data_sub_filter.c new file mode 100644 index 000000000..88f777455 --- /dev/null +++ b/lib/sbi/openapi/model/ue_context_in_smf_data_sub_filter.c @@ -0,0 +1,223 @@ + +#include +#include +#include +#include "ue_context_in_smf_data_sub_filter.h" + +OpenAPI_ue_context_in_smf_data_sub_filter_t *OpenAPI_ue_context_in_smf_data_sub_filter_create( + OpenAPI_list_t *dnn_list, + OpenAPI_list_t *snssai_list, + bool is_emergency_ind, + int emergency_ind +) +{ + OpenAPI_ue_context_in_smf_data_sub_filter_t *ue_context_in_smf_data_sub_filter_local_var = ogs_malloc(sizeof(OpenAPI_ue_context_in_smf_data_sub_filter_t)); + ogs_assert(ue_context_in_smf_data_sub_filter_local_var); + + ue_context_in_smf_data_sub_filter_local_var->dnn_list = dnn_list; + ue_context_in_smf_data_sub_filter_local_var->snssai_list = snssai_list; + ue_context_in_smf_data_sub_filter_local_var->is_emergency_ind = is_emergency_ind; + ue_context_in_smf_data_sub_filter_local_var->emergency_ind = emergency_ind; + + return ue_context_in_smf_data_sub_filter_local_var; +} + +void OpenAPI_ue_context_in_smf_data_sub_filter_free(OpenAPI_ue_context_in_smf_data_sub_filter_t *ue_context_in_smf_data_sub_filter) +{ + OpenAPI_lnode_t *node = NULL; + + if (NULL == ue_context_in_smf_data_sub_filter) { + return; + } + if (ue_context_in_smf_data_sub_filter->dnn_list) { + OpenAPI_list_for_each(ue_context_in_smf_data_sub_filter->dnn_list, node) { + ogs_free(node->data); + } + OpenAPI_list_free(ue_context_in_smf_data_sub_filter->dnn_list); + ue_context_in_smf_data_sub_filter->dnn_list = NULL; + } + if (ue_context_in_smf_data_sub_filter->snssai_list) { + OpenAPI_list_for_each(ue_context_in_smf_data_sub_filter->snssai_list, node) { + OpenAPI_snssai_free(node->data); + } + OpenAPI_list_free(ue_context_in_smf_data_sub_filter->snssai_list); + ue_context_in_smf_data_sub_filter->snssai_list = NULL; + } + ogs_free(ue_context_in_smf_data_sub_filter); +} + +cJSON *OpenAPI_ue_context_in_smf_data_sub_filter_convertToJSON(OpenAPI_ue_context_in_smf_data_sub_filter_t *ue_context_in_smf_data_sub_filter) +{ + cJSON *item = NULL; + OpenAPI_lnode_t *node = NULL; + + if (ue_context_in_smf_data_sub_filter == NULL) { + ogs_error("OpenAPI_ue_context_in_smf_data_sub_filter_convertToJSON() failed [UeContextInSmfDataSubFilter]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (ue_context_in_smf_data_sub_filter->dnn_list) { + cJSON *dnn_listList = cJSON_AddArrayToObject(item, "dnnList"); + if (dnn_listList == NULL) { + ogs_error("OpenAPI_ue_context_in_smf_data_sub_filter_convertToJSON() failed [dnn_list]"); + goto end; + } + OpenAPI_list_for_each(ue_context_in_smf_data_sub_filter->dnn_list, node) { + if (cJSON_AddStringToObject(dnn_listList, "", (char*)node->data) == NULL) { + ogs_error("OpenAPI_ue_context_in_smf_data_sub_filter_convertToJSON() failed [dnn_list]"); + goto end; + } + } + } + + if (ue_context_in_smf_data_sub_filter->snssai_list) { + cJSON *snssai_listList = cJSON_AddArrayToObject(item, "snssaiList"); + if (snssai_listList == NULL) { + ogs_error("OpenAPI_ue_context_in_smf_data_sub_filter_convertToJSON() failed [snssai_list]"); + goto end; + } + OpenAPI_list_for_each(ue_context_in_smf_data_sub_filter->snssai_list, node) { + cJSON *itemLocal = OpenAPI_snssai_convertToJSON(node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_ue_context_in_smf_data_sub_filter_convertToJSON() failed [snssai_list]"); + goto end; + } + cJSON_AddItemToArray(snssai_listList, itemLocal); + } + } + + if (ue_context_in_smf_data_sub_filter->is_emergency_ind) { + if (cJSON_AddBoolToObject(item, "emergencyInd", ue_context_in_smf_data_sub_filter->emergency_ind) == NULL) { + ogs_error("OpenAPI_ue_context_in_smf_data_sub_filter_convertToJSON() failed [emergency_ind]"); + goto end; + } + } + +end: + return item; +} + +OpenAPI_ue_context_in_smf_data_sub_filter_t *OpenAPI_ue_context_in_smf_data_sub_filter_parseFromJSON(cJSON *ue_context_in_smf_data_sub_filterJSON) +{ + OpenAPI_ue_context_in_smf_data_sub_filter_t *ue_context_in_smf_data_sub_filter_local_var = NULL; + OpenAPI_lnode_t *node = NULL; + cJSON *dnn_list = NULL; + OpenAPI_list_t *dnn_listList = NULL; + cJSON *snssai_list = NULL; + OpenAPI_list_t *snssai_listList = NULL; + cJSON *emergency_ind = NULL; + dnn_list = cJSON_GetObjectItemCaseSensitive(ue_context_in_smf_data_sub_filterJSON, "dnnList"); + if (dnn_list) { + cJSON *dnn_list_local = NULL; + if (!cJSON_IsArray(dnn_list)) { + ogs_error("OpenAPI_ue_context_in_smf_data_sub_filter_parseFromJSON() failed [dnn_list]"); + goto end; + } + + dnn_listList = OpenAPI_list_create(); + + cJSON_ArrayForEach(dnn_list_local, dnn_list) { + double *localDouble = NULL; + int *localInt = NULL; + if (!cJSON_IsString(dnn_list_local)) { + ogs_error("OpenAPI_ue_context_in_smf_data_sub_filter_parseFromJSON() failed [dnn_list]"); + goto end; + } + OpenAPI_list_add(dnn_listList, ogs_strdup(dnn_list_local->valuestring)); + } + } + + snssai_list = cJSON_GetObjectItemCaseSensitive(ue_context_in_smf_data_sub_filterJSON, "snssaiList"); + if (snssai_list) { + cJSON *snssai_list_local = NULL; + if (!cJSON_IsArray(snssai_list)) { + ogs_error("OpenAPI_ue_context_in_smf_data_sub_filter_parseFromJSON() failed [snssai_list]"); + goto end; + } + + snssai_listList = OpenAPI_list_create(); + + cJSON_ArrayForEach(snssai_list_local, snssai_list) { + if (!cJSON_IsObject(snssai_list_local)) { + ogs_error("OpenAPI_ue_context_in_smf_data_sub_filter_parseFromJSON() failed [snssai_list]"); + goto end; + } + OpenAPI_snssai_t *snssai_listItem = OpenAPI_snssai_parseFromJSON(snssai_list_local); + if (!snssai_listItem) { + ogs_error("No snssai_listItem"); + OpenAPI_list_free(snssai_listList); + goto end; + } + OpenAPI_list_add(snssai_listList, snssai_listItem); + } + } + + emergency_ind = cJSON_GetObjectItemCaseSensitive(ue_context_in_smf_data_sub_filterJSON, "emergencyInd"); + if (emergency_ind) { + if (!cJSON_IsBool(emergency_ind)) { + ogs_error("OpenAPI_ue_context_in_smf_data_sub_filter_parseFromJSON() failed [emergency_ind]"); + goto end; + } + } + + ue_context_in_smf_data_sub_filter_local_var = OpenAPI_ue_context_in_smf_data_sub_filter_create ( + dnn_list ? dnn_listList : NULL, + snssai_list ? snssai_listList : NULL, + emergency_ind ? true : false, + emergency_ind ? emergency_ind->valueint : 0 + ); + + return ue_context_in_smf_data_sub_filter_local_var; +end: + if (dnn_listList) { + OpenAPI_list_for_each(dnn_listList, node) { + ogs_free(node->data); + } + OpenAPI_list_free(dnn_listList); + dnn_listList = NULL; + } + if (snssai_listList) { + OpenAPI_list_for_each(snssai_listList, node) { + OpenAPI_snssai_free(node->data); + } + OpenAPI_list_free(snssai_listList); + snssai_listList = NULL; + } + return NULL; +} + +OpenAPI_ue_context_in_smf_data_sub_filter_t *OpenAPI_ue_context_in_smf_data_sub_filter_copy(OpenAPI_ue_context_in_smf_data_sub_filter_t *dst, OpenAPI_ue_context_in_smf_data_sub_filter_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_ue_context_in_smf_data_sub_filter_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_ue_context_in_smf_data_sub_filter_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_ue_context_in_smf_data_sub_filter_free(dst); + dst = OpenAPI_ue_context_in_smf_data_sub_filter_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/ue_context_in_smf_data_sub_filter.h b/lib/sbi/openapi/model/ue_context_in_smf_data_sub_filter.h new file mode 100644 index 000000000..b7db86686 --- /dev/null +++ b/lib/sbi/openapi/model/ue_context_in_smf_data_sub_filter.h @@ -0,0 +1,45 @@ +/* + * ue_context_in_smf_data_sub_filter.h + * + * UE Context In Smf Data Subscription Filter. + */ + +#ifndef _OpenAPI_ue_context_in_smf_data_sub_filter_H_ +#define _OpenAPI_ue_context_in_smf_data_sub_filter_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "snssai.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_ue_context_in_smf_data_sub_filter_s OpenAPI_ue_context_in_smf_data_sub_filter_t; +typedef struct OpenAPI_ue_context_in_smf_data_sub_filter_s { + OpenAPI_list_t *dnn_list; + OpenAPI_list_t *snssai_list; + bool is_emergency_ind; + int emergency_ind; +} OpenAPI_ue_context_in_smf_data_sub_filter_t; + +OpenAPI_ue_context_in_smf_data_sub_filter_t *OpenAPI_ue_context_in_smf_data_sub_filter_create( + OpenAPI_list_t *dnn_list, + OpenAPI_list_t *snssai_list, + bool is_emergency_ind, + int emergency_ind +); +void OpenAPI_ue_context_in_smf_data_sub_filter_free(OpenAPI_ue_context_in_smf_data_sub_filter_t *ue_context_in_smf_data_sub_filter); +OpenAPI_ue_context_in_smf_data_sub_filter_t *OpenAPI_ue_context_in_smf_data_sub_filter_parseFromJSON(cJSON *ue_context_in_smf_data_sub_filterJSON); +cJSON *OpenAPI_ue_context_in_smf_data_sub_filter_convertToJSON(OpenAPI_ue_context_in_smf_data_sub_filter_t *ue_context_in_smf_data_sub_filter); +OpenAPI_ue_context_in_smf_data_sub_filter_t *OpenAPI_ue_context_in_smf_data_sub_filter_copy(OpenAPI_ue_context_in_smf_data_sub_filter_t *dst, OpenAPI_ue_context_in_smf_data_sub_filter_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_ue_context_in_smf_data_sub_filter_H_ */ + diff --git a/lib/sbi/openapi/model/ue_context_in_smf_data_sub_filter_1.c b/lib/sbi/openapi/model/ue_context_in_smf_data_sub_filter_1.c new file mode 100644 index 000000000..894d36312 --- /dev/null +++ b/lib/sbi/openapi/model/ue_context_in_smf_data_sub_filter_1.c @@ -0,0 +1,223 @@ + +#include +#include +#include +#include "ue_context_in_smf_data_sub_filter_1.h" + +OpenAPI_ue_context_in_smf_data_sub_filter_1_t *OpenAPI_ue_context_in_smf_data_sub_filter_1_create( + OpenAPI_list_t *dnn_list, + OpenAPI_list_t *snssai_list, + bool is_emergency_ind, + int emergency_ind +) +{ + OpenAPI_ue_context_in_smf_data_sub_filter_1_t *ue_context_in_smf_data_sub_filter_1_local_var = ogs_malloc(sizeof(OpenAPI_ue_context_in_smf_data_sub_filter_1_t)); + ogs_assert(ue_context_in_smf_data_sub_filter_1_local_var); + + ue_context_in_smf_data_sub_filter_1_local_var->dnn_list = dnn_list; + ue_context_in_smf_data_sub_filter_1_local_var->snssai_list = snssai_list; + ue_context_in_smf_data_sub_filter_1_local_var->is_emergency_ind = is_emergency_ind; + ue_context_in_smf_data_sub_filter_1_local_var->emergency_ind = emergency_ind; + + return ue_context_in_smf_data_sub_filter_1_local_var; +} + +void OpenAPI_ue_context_in_smf_data_sub_filter_1_free(OpenAPI_ue_context_in_smf_data_sub_filter_1_t *ue_context_in_smf_data_sub_filter_1) +{ + OpenAPI_lnode_t *node = NULL; + + if (NULL == ue_context_in_smf_data_sub_filter_1) { + return; + } + if (ue_context_in_smf_data_sub_filter_1->dnn_list) { + OpenAPI_list_for_each(ue_context_in_smf_data_sub_filter_1->dnn_list, node) { + ogs_free(node->data); + } + OpenAPI_list_free(ue_context_in_smf_data_sub_filter_1->dnn_list); + ue_context_in_smf_data_sub_filter_1->dnn_list = NULL; + } + if (ue_context_in_smf_data_sub_filter_1->snssai_list) { + OpenAPI_list_for_each(ue_context_in_smf_data_sub_filter_1->snssai_list, node) { + OpenAPI_snssai_free(node->data); + } + OpenAPI_list_free(ue_context_in_smf_data_sub_filter_1->snssai_list); + ue_context_in_smf_data_sub_filter_1->snssai_list = NULL; + } + ogs_free(ue_context_in_smf_data_sub_filter_1); +} + +cJSON *OpenAPI_ue_context_in_smf_data_sub_filter_1_convertToJSON(OpenAPI_ue_context_in_smf_data_sub_filter_1_t *ue_context_in_smf_data_sub_filter_1) +{ + cJSON *item = NULL; + OpenAPI_lnode_t *node = NULL; + + if (ue_context_in_smf_data_sub_filter_1 == NULL) { + ogs_error("OpenAPI_ue_context_in_smf_data_sub_filter_1_convertToJSON() failed [UeContextInSmfDataSubFilter_1]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (ue_context_in_smf_data_sub_filter_1->dnn_list) { + cJSON *dnn_listList = cJSON_AddArrayToObject(item, "dnnList"); + if (dnn_listList == NULL) { + ogs_error("OpenAPI_ue_context_in_smf_data_sub_filter_1_convertToJSON() failed [dnn_list]"); + goto end; + } + OpenAPI_list_for_each(ue_context_in_smf_data_sub_filter_1->dnn_list, node) { + if (cJSON_AddStringToObject(dnn_listList, "", (char*)node->data) == NULL) { + ogs_error("OpenAPI_ue_context_in_smf_data_sub_filter_1_convertToJSON() failed [dnn_list]"); + goto end; + } + } + } + + if (ue_context_in_smf_data_sub_filter_1->snssai_list) { + cJSON *snssai_listList = cJSON_AddArrayToObject(item, "snssaiList"); + if (snssai_listList == NULL) { + ogs_error("OpenAPI_ue_context_in_smf_data_sub_filter_1_convertToJSON() failed [snssai_list]"); + goto end; + } + OpenAPI_list_for_each(ue_context_in_smf_data_sub_filter_1->snssai_list, node) { + cJSON *itemLocal = OpenAPI_snssai_convertToJSON(node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_ue_context_in_smf_data_sub_filter_1_convertToJSON() failed [snssai_list]"); + goto end; + } + cJSON_AddItemToArray(snssai_listList, itemLocal); + } + } + + if (ue_context_in_smf_data_sub_filter_1->is_emergency_ind) { + if (cJSON_AddBoolToObject(item, "emergencyInd", ue_context_in_smf_data_sub_filter_1->emergency_ind) == NULL) { + ogs_error("OpenAPI_ue_context_in_smf_data_sub_filter_1_convertToJSON() failed [emergency_ind]"); + goto end; + } + } + +end: + return item; +} + +OpenAPI_ue_context_in_smf_data_sub_filter_1_t *OpenAPI_ue_context_in_smf_data_sub_filter_1_parseFromJSON(cJSON *ue_context_in_smf_data_sub_filter_1JSON) +{ + OpenAPI_ue_context_in_smf_data_sub_filter_1_t *ue_context_in_smf_data_sub_filter_1_local_var = NULL; + OpenAPI_lnode_t *node = NULL; + cJSON *dnn_list = NULL; + OpenAPI_list_t *dnn_listList = NULL; + cJSON *snssai_list = NULL; + OpenAPI_list_t *snssai_listList = NULL; + cJSON *emergency_ind = NULL; + dnn_list = cJSON_GetObjectItemCaseSensitive(ue_context_in_smf_data_sub_filter_1JSON, "dnnList"); + if (dnn_list) { + cJSON *dnn_list_local = NULL; + if (!cJSON_IsArray(dnn_list)) { + ogs_error("OpenAPI_ue_context_in_smf_data_sub_filter_1_parseFromJSON() failed [dnn_list]"); + goto end; + } + + dnn_listList = OpenAPI_list_create(); + + cJSON_ArrayForEach(dnn_list_local, dnn_list) { + double *localDouble = NULL; + int *localInt = NULL; + if (!cJSON_IsString(dnn_list_local)) { + ogs_error("OpenAPI_ue_context_in_smf_data_sub_filter_1_parseFromJSON() failed [dnn_list]"); + goto end; + } + OpenAPI_list_add(dnn_listList, ogs_strdup(dnn_list_local->valuestring)); + } + } + + snssai_list = cJSON_GetObjectItemCaseSensitive(ue_context_in_smf_data_sub_filter_1JSON, "snssaiList"); + if (snssai_list) { + cJSON *snssai_list_local = NULL; + if (!cJSON_IsArray(snssai_list)) { + ogs_error("OpenAPI_ue_context_in_smf_data_sub_filter_1_parseFromJSON() failed [snssai_list]"); + goto end; + } + + snssai_listList = OpenAPI_list_create(); + + cJSON_ArrayForEach(snssai_list_local, snssai_list) { + if (!cJSON_IsObject(snssai_list_local)) { + ogs_error("OpenAPI_ue_context_in_smf_data_sub_filter_1_parseFromJSON() failed [snssai_list]"); + goto end; + } + OpenAPI_snssai_t *snssai_listItem = OpenAPI_snssai_parseFromJSON(snssai_list_local); + if (!snssai_listItem) { + ogs_error("No snssai_listItem"); + OpenAPI_list_free(snssai_listList); + goto end; + } + OpenAPI_list_add(snssai_listList, snssai_listItem); + } + } + + emergency_ind = cJSON_GetObjectItemCaseSensitive(ue_context_in_smf_data_sub_filter_1JSON, "emergencyInd"); + if (emergency_ind) { + if (!cJSON_IsBool(emergency_ind)) { + ogs_error("OpenAPI_ue_context_in_smf_data_sub_filter_1_parseFromJSON() failed [emergency_ind]"); + goto end; + } + } + + ue_context_in_smf_data_sub_filter_1_local_var = OpenAPI_ue_context_in_smf_data_sub_filter_1_create ( + dnn_list ? dnn_listList : NULL, + snssai_list ? snssai_listList : NULL, + emergency_ind ? true : false, + emergency_ind ? emergency_ind->valueint : 0 + ); + + return ue_context_in_smf_data_sub_filter_1_local_var; +end: + if (dnn_listList) { + OpenAPI_list_for_each(dnn_listList, node) { + ogs_free(node->data); + } + OpenAPI_list_free(dnn_listList); + dnn_listList = NULL; + } + if (snssai_listList) { + OpenAPI_list_for_each(snssai_listList, node) { + OpenAPI_snssai_free(node->data); + } + OpenAPI_list_free(snssai_listList); + snssai_listList = NULL; + } + return NULL; +} + +OpenAPI_ue_context_in_smf_data_sub_filter_1_t *OpenAPI_ue_context_in_smf_data_sub_filter_1_copy(OpenAPI_ue_context_in_smf_data_sub_filter_1_t *dst, OpenAPI_ue_context_in_smf_data_sub_filter_1_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_ue_context_in_smf_data_sub_filter_1_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_ue_context_in_smf_data_sub_filter_1_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_ue_context_in_smf_data_sub_filter_1_free(dst); + dst = OpenAPI_ue_context_in_smf_data_sub_filter_1_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/ue_context_in_smf_data_sub_filter_1.h b/lib/sbi/openapi/model/ue_context_in_smf_data_sub_filter_1.h new file mode 100644 index 000000000..42c126a0b --- /dev/null +++ b/lib/sbi/openapi/model/ue_context_in_smf_data_sub_filter_1.h @@ -0,0 +1,45 @@ +/* + * ue_context_in_smf_data_sub_filter_1.h + * + * UE Context In Smf Data Subscription Filter. + */ + +#ifndef _OpenAPI_ue_context_in_smf_data_sub_filter_1_H_ +#define _OpenAPI_ue_context_in_smf_data_sub_filter_1_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "snssai.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_ue_context_in_smf_data_sub_filter_1_s OpenAPI_ue_context_in_smf_data_sub_filter_1_t; +typedef struct OpenAPI_ue_context_in_smf_data_sub_filter_1_s { + OpenAPI_list_t *dnn_list; + OpenAPI_list_t *snssai_list; + bool is_emergency_ind; + int emergency_ind; +} OpenAPI_ue_context_in_smf_data_sub_filter_1_t; + +OpenAPI_ue_context_in_smf_data_sub_filter_1_t *OpenAPI_ue_context_in_smf_data_sub_filter_1_create( + OpenAPI_list_t *dnn_list, + OpenAPI_list_t *snssai_list, + bool is_emergency_ind, + int emergency_ind +); +void OpenAPI_ue_context_in_smf_data_sub_filter_1_free(OpenAPI_ue_context_in_smf_data_sub_filter_1_t *ue_context_in_smf_data_sub_filter_1); +OpenAPI_ue_context_in_smf_data_sub_filter_1_t *OpenAPI_ue_context_in_smf_data_sub_filter_1_parseFromJSON(cJSON *ue_context_in_smf_data_sub_filter_1JSON); +cJSON *OpenAPI_ue_context_in_smf_data_sub_filter_1_convertToJSON(OpenAPI_ue_context_in_smf_data_sub_filter_1_t *ue_context_in_smf_data_sub_filter_1); +OpenAPI_ue_context_in_smf_data_sub_filter_1_t *OpenAPI_ue_context_in_smf_data_sub_filter_1_copy(OpenAPI_ue_context_in_smf_data_sub_filter_1_t *dst, OpenAPI_ue_context_in_smf_data_sub_filter_1_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_ue_context_in_smf_data_sub_filter_1_H_ */ + diff --git a/lib/sbi/openapi/model/ue_context_in_smsf_data_1.c b/lib/sbi/openapi/model/ue_context_in_smsf_data_1.c deleted file mode 100644 index 08b18cfbd..000000000 --- a/lib/sbi/openapi/model/ue_context_in_smsf_data_1.c +++ /dev/null @@ -1,149 +0,0 @@ - -#include -#include -#include -#include "ue_context_in_smsf_data_1.h" - -OpenAPI_ue_context_in_smsf_data_1_t *OpenAPI_ue_context_in_smsf_data_1_create( - OpenAPI_smsf_info_1_t *smsf_info3_gpp_access, - OpenAPI_smsf_info_1_t *smsf_info_non3_gpp_access -) -{ - OpenAPI_ue_context_in_smsf_data_1_t *ue_context_in_smsf_data_1_local_var = ogs_malloc(sizeof(OpenAPI_ue_context_in_smsf_data_1_t)); - ogs_assert(ue_context_in_smsf_data_1_local_var); - - ue_context_in_smsf_data_1_local_var->smsf_info3_gpp_access = smsf_info3_gpp_access; - ue_context_in_smsf_data_1_local_var->smsf_info_non3_gpp_access = smsf_info_non3_gpp_access; - - return ue_context_in_smsf_data_1_local_var; -} - -void OpenAPI_ue_context_in_smsf_data_1_free(OpenAPI_ue_context_in_smsf_data_1_t *ue_context_in_smsf_data_1) -{ - OpenAPI_lnode_t *node = NULL; - - if (NULL == ue_context_in_smsf_data_1) { - return; - } - if (ue_context_in_smsf_data_1->smsf_info3_gpp_access) { - OpenAPI_smsf_info_1_free(ue_context_in_smsf_data_1->smsf_info3_gpp_access); - ue_context_in_smsf_data_1->smsf_info3_gpp_access = NULL; - } - if (ue_context_in_smsf_data_1->smsf_info_non3_gpp_access) { - OpenAPI_smsf_info_1_free(ue_context_in_smsf_data_1->smsf_info_non3_gpp_access); - ue_context_in_smsf_data_1->smsf_info_non3_gpp_access = NULL; - } - ogs_free(ue_context_in_smsf_data_1); -} - -cJSON *OpenAPI_ue_context_in_smsf_data_1_convertToJSON(OpenAPI_ue_context_in_smsf_data_1_t *ue_context_in_smsf_data_1) -{ - cJSON *item = NULL; - OpenAPI_lnode_t *node = NULL; - - if (ue_context_in_smsf_data_1 == NULL) { - ogs_error("OpenAPI_ue_context_in_smsf_data_1_convertToJSON() failed [UeContextInSmsfData_1]"); - return NULL; - } - - item = cJSON_CreateObject(); - if (ue_context_in_smsf_data_1->smsf_info3_gpp_access) { - cJSON *smsf_info3_gpp_access_local_JSON = OpenAPI_smsf_info_1_convertToJSON(ue_context_in_smsf_data_1->smsf_info3_gpp_access); - if (smsf_info3_gpp_access_local_JSON == NULL) { - ogs_error("OpenAPI_ue_context_in_smsf_data_1_convertToJSON() failed [smsf_info3_gpp_access]"); - goto end; - } - cJSON_AddItemToObject(item, "smsfInfo3GppAccess", smsf_info3_gpp_access_local_JSON); - if (item->child == NULL) { - ogs_error("OpenAPI_ue_context_in_smsf_data_1_convertToJSON() failed [smsf_info3_gpp_access]"); - goto end; - } - } - - if (ue_context_in_smsf_data_1->smsf_info_non3_gpp_access) { - cJSON *smsf_info_non3_gpp_access_local_JSON = OpenAPI_smsf_info_1_convertToJSON(ue_context_in_smsf_data_1->smsf_info_non3_gpp_access); - if (smsf_info_non3_gpp_access_local_JSON == NULL) { - ogs_error("OpenAPI_ue_context_in_smsf_data_1_convertToJSON() failed [smsf_info_non3_gpp_access]"); - goto end; - } - cJSON_AddItemToObject(item, "smsfInfoNon3GppAccess", smsf_info_non3_gpp_access_local_JSON); - if (item->child == NULL) { - ogs_error("OpenAPI_ue_context_in_smsf_data_1_convertToJSON() failed [smsf_info_non3_gpp_access]"); - goto end; - } - } - -end: - return item; -} - -OpenAPI_ue_context_in_smsf_data_1_t *OpenAPI_ue_context_in_smsf_data_1_parseFromJSON(cJSON *ue_context_in_smsf_data_1JSON) -{ - OpenAPI_ue_context_in_smsf_data_1_t *ue_context_in_smsf_data_1_local_var = NULL; - OpenAPI_lnode_t *node = NULL; - cJSON *smsf_info3_gpp_access = NULL; - OpenAPI_smsf_info_1_t *smsf_info3_gpp_access_local_nonprim = NULL; - cJSON *smsf_info_non3_gpp_access = NULL; - OpenAPI_smsf_info_1_t *smsf_info_non3_gpp_access_local_nonprim = NULL; - smsf_info3_gpp_access = cJSON_GetObjectItemCaseSensitive(ue_context_in_smsf_data_1JSON, "smsfInfo3GppAccess"); - if (smsf_info3_gpp_access) { - smsf_info3_gpp_access_local_nonprim = OpenAPI_smsf_info_1_parseFromJSON(smsf_info3_gpp_access); - } - - smsf_info_non3_gpp_access = cJSON_GetObjectItemCaseSensitive(ue_context_in_smsf_data_1JSON, "smsfInfoNon3GppAccess"); - if (smsf_info_non3_gpp_access) { - smsf_info_non3_gpp_access_local_nonprim = OpenAPI_smsf_info_1_parseFromJSON(smsf_info_non3_gpp_access); - } - - ue_context_in_smsf_data_1_local_var = OpenAPI_ue_context_in_smsf_data_1_create ( - smsf_info3_gpp_access ? smsf_info3_gpp_access_local_nonprim : NULL, - smsf_info_non3_gpp_access ? smsf_info_non3_gpp_access_local_nonprim : NULL - ); - - return ue_context_in_smsf_data_1_local_var; -end: - if (smsf_info3_gpp_access_local_nonprim) { - OpenAPI_smsf_info_1_free(smsf_info3_gpp_access_local_nonprim); - smsf_info3_gpp_access_local_nonprim = NULL; - } - if (smsf_info_non3_gpp_access_local_nonprim) { - OpenAPI_smsf_info_1_free(smsf_info_non3_gpp_access_local_nonprim); - smsf_info_non3_gpp_access_local_nonprim = NULL; - } - return NULL; -} - -OpenAPI_ue_context_in_smsf_data_1_t *OpenAPI_ue_context_in_smsf_data_1_copy(OpenAPI_ue_context_in_smsf_data_1_t *dst, OpenAPI_ue_context_in_smsf_data_1_t *src) -{ - cJSON *item = NULL; - char *content = NULL; - - ogs_assert(src); - item = OpenAPI_ue_context_in_smsf_data_1_convertToJSON(src); - if (!item) { - ogs_error("OpenAPI_ue_context_in_smsf_data_1_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_ue_context_in_smsf_data_1_free(dst); - dst = OpenAPI_ue_context_in_smsf_data_1_parseFromJSON(item); - cJSON_Delete(item); - - return dst; -} - diff --git a/lib/sbi/openapi/model/ue_context_in_smsf_data_1.h b/lib/sbi/openapi/model/ue_context_in_smsf_data_1.h deleted file mode 100644 index 6b6ef03ae..000000000 --- a/lib/sbi/openapi/model/ue_context_in_smsf_data_1.h +++ /dev/null @@ -1,41 +0,0 @@ -/* - * ue_context_in_smsf_data_1.h - * - * - */ - -#ifndef _OpenAPI_ue_context_in_smsf_data_1_H_ -#define _OpenAPI_ue_context_in_smsf_data_1_H_ - -#include -#include "../external/cJSON.h" -#include "../include/list.h" -#include "../include/keyValuePair.h" -#include "../include/binary.h" -#include "smsf_info_1.h" - -#ifdef __cplusplus -extern "C" { -#endif - -typedef struct OpenAPI_ue_context_in_smsf_data_1_s OpenAPI_ue_context_in_smsf_data_1_t; -typedef struct OpenAPI_ue_context_in_smsf_data_1_s { - struct OpenAPI_smsf_info_1_s *smsf_info3_gpp_access; - struct OpenAPI_smsf_info_1_s *smsf_info_non3_gpp_access; -} OpenAPI_ue_context_in_smsf_data_1_t; - -OpenAPI_ue_context_in_smsf_data_1_t *OpenAPI_ue_context_in_smsf_data_1_create( - OpenAPI_smsf_info_1_t *smsf_info3_gpp_access, - OpenAPI_smsf_info_1_t *smsf_info_non3_gpp_access -); -void OpenAPI_ue_context_in_smsf_data_1_free(OpenAPI_ue_context_in_smsf_data_1_t *ue_context_in_smsf_data_1); -OpenAPI_ue_context_in_smsf_data_1_t *OpenAPI_ue_context_in_smsf_data_1_parseFromJSON(cJSON *ue_context_in_smsf_data_1JSON); -cJSON *OpenAPI_ue_context_in_smsf_data_1_convertToJSON(OpenAPI_ue_context_in_smsf_data_1_t *ue_context_in_smsf_data_1); -OpenAPI_ue_context_in_smsf_data_1_t *OpenAPI_ue_context_in_smsf_data_1_copy(OpenAPI_ue_context_in_smsf_data_1_t *dst, OpenAPI_ue_context_in_smsf_data_1_t *src); - -#ifdef __cplusplus -} -#endif - -#endif /* _OpenAPI_ue_context_in_smsf_data_1_H_ */ - diff --git a/lib/sbi/openapi/model/ue_context_release.h b/lib/sbi/openapi/model/ue_context_release.h index ec0ea09a4..14427e9b8 100644 --- a/lib/sbi/openapi/model/ue_context_release.h +++ b/lib/sbi/openapi/model/ue_context_release.h @@ -1,7 +1,7 @@ /* * ue_context_release.h * - * + * Data within a Release UE Context request */ #ifndef _OpenAPI_ue_context_release_H_ diff --git a/lib/sbi/openapi/model/ue_context_relocate_data.h b/lib/sbi/openapi/model/ue_context_relocate_data.h index b6e923196..8f0597bb6 100644 --- a/lib/sbi/openapi/model/ue_context_relocate_data.h +++ b/lib/sbi/openapi/model/ue_context_relocate_data.h @@ -1,7 +1,7 @@ /* * ue_context_relocate_data.h * - * + * Data within a Relocate UE Context request */ #ifndef _OpenAPI_ue_context_relocate_data_H_ diff --git a/lib/sbi/openapi/model/ue_context_relocated_data.c b/lib/sbi/openapi/model/ue_context_relocated_data.c index 0483a19de..ffb26280b 100644 --- a/lib/sbi/openapi/model/ue_context_relocated_data.c +++ b/lib/sbi/openapi/model/ue_context_relocated_data.c @@ -41,7 +41,10 @@ cJSON *OpenAPI_ue_context_relocated_data_convertToJSON(OpenAPI_ue_context_reloca } item = cJSON_CreateObject(); - if (ue_context_relocated_data->ue_context) { + if (!ue_context_relocated_data->ue_context) { + ogs_error("OpenAPI_ue_context_relocated_data_convertToJSON() failed [ue_context]"); + return NULL; + } cJSON *ue_context_local_JSON = OpenAPI_ue_context_convertToJSON(ue_context_relocated_data->ue_context); if (ue_context_local_JSON == NULL) { ogs_error("OpenAPI_ue_context_relocated_data_convertToJSON() failed [ue_context]"); @@ -52,7 +55,6 @@ cJSON *OpenAPI_ue_context_relocated_data_convertToJSON(OpenAPI_ue_context_reloca ogs_error("OpenAPI_ue_context_relocated_data_convertToJSON() failed [ue_context]"); goto end; } - } end: return item; @@ -65,12 +67,14 @@ OpenAPI_ue_context_relocated_data_t *OpenAPI_ue_context_relocated_data_parseFrom cJSON *ue_context = NULL; OpenAPI_ue_context_t *ue_context_local_nonprim = NULL; ue_context = cJSON_GetObjectItemCaseSensitive(ue_context_relocated_dataJSON, "ueContext"); - if (ue_context) { - ue_context_local_nonprim = OpenAPI_ue_context_parseFromJSON(ue_context); + if (!ue_context) { + ogs_error("OpenAPI_ue_context_relocated_data_parseFromJSON() failed [ue_context]"); + goto end; } + ue_context_local_nonprim = OpenAPI_ue_context_parseFromJSON(ue_context); ue_context_relocated_data_local_var = OpenAPI_ue_context_relocated_data_create ( - ue_context ? ue_context_local_nonprim : NULL + ue_context_local_nonprim ); return ue_context_relocated_data_local_var; diff --git a/lib/sbi/openapi/model/ue_context_relocated_data.h b/lib/sbi/openapi/model/ue_context_relocated_data.h index 52eedcd01..d628f34df 100644 --- a/lib/sbi/openapi/model/ue_context_relocated_data.h +++ b/lib/sbi/openapi/model/ue_context_relocated_data.h @@ -1,7 +1,7 @@ /* * ue_context_relocated_data.h * - * + * Data within a Relocate UE Context response */ #ifndef _OpenAPI_ue_context_relocated_data_H_ diff --git a/lib/sbi/openapi/model/ue_context_transfer_200_response.c b/lib/sbi/openapi/model/ue_context_transfer_200_response.c index e62c2e9e9..d2c20737c 100644 --- a/lib/sbi/openapi/model/ue_context_transfer_200_response.c +++ b/lib/sbi/openapi/model/ue_context_transfer_200_response.c @@ -7,7 +7,8 @@ OpenAPI_ue_context_transfer_200_response_t *OpenAPI_ue_context_transfer_200_response_create( OpenAPI_ue_context_transfer_rsp_data_t *json_data, OpenAPI_binary_t* binary_data_n2_information, - OpenAPI_binary_t* binary_data_n2_information_ext1 + OpenAPI_binary_t* binary_data_n2_information_ext1, + OpenAPI_binary_t* binary_data_n2_information_ext2 ) { OpenAPI_ue_context_transfer_200_response_t *ue_context_transfer_200_response_local_var = ogs_malloc(sizeof(OpenAPI_ue_context_transfer_200_response_t)); @@ -16,6 +17,7 @@ OpenAPI_ue_context_transfer_200_response_t *OpenAPI_ue_context_transfer_200_resp ue_context_transfer_200_response_local_var->json_data = json_data; ue_context_transfer_200_response_local_var->binary_data_n2_information = binary_data_n2_information; ue_context_transfer_200_response_local_var->binary_data_n2_information_ext1 = binary_data_n2_information_ext1; + ue_context_transfer_200_response_local_var->binary_data_n2_information_ext2 = binary_data_n2_information_ext2; return ue_context_transfer_200_response_local_var; } @@ -39,6 +41,10 @@ void OpenAPI_ue_context_transfer_200_response_free(OpenAPI_ue_context_transfer_2 ogs_free(ue_context_transfer_200_response->binary_data_n2_information_ext1->data); ue_context_transfer_200_response->binary_data_n2_information_ext1 = NULL; } + if (ue_context_transfer_200_response->binary_data_n2_information_ext2) { + ogs_free(ue_context_transfer_200_response->binary_data_n2_information_ext2->data); + ue_context_transfer_200_response->binary_data_n2_information_ext2 = NULL; + } ogs_free(ue_context_transfer_200_response); } @@ -84,6 +90,15 @@ cJSON *OpenAPI_ue_context_transfer_200_response_convertToJSON(OpenAPI_ue_context ogs_free(encoded_str_binary_data_n2_information_ext1); } + if (ue_context_transfer_200_response->binary_data_n2_information_ext2) { + char* encoded_str_binary_data_n2_information_ext2 = OpenAPI_base64encode(ue_context_transfer_200_response->binary_data_n2_information_ext2->data,ue_context_transfer_200_response->binary_data_n2_information_ext2->len); + if (cJSON_AddStringToObject(item, "binaryDataN2InformationExt2", encoded_str_binary_data_n2_information_ext2) == NULL) { + ogs_error("OpenAPI_ue_context_transfer_200_response_convertToJSON() failed [binary_data_n2_information_ext2]"); + goto end; + } + ogs_free(encoded_str_binary_data_n2_information_ext2); + } + end: return item; } @@ -98,6 +113,8 @@ OpenAPI_ue_context_transfer_200_response_t *OpenAPI_ue_context_transfer_200_resp OpenAPI_binary_t *decoded_str_binary_data_n2_information = NULL; cJSON *binary_data_n2_information_ext1 = NULL; OpenAPI_binary_t *decoded_str_binary_data_n2_information_ext1 = NULL; + cJSON *binary_data_n2_information_ext2 = NULL; + OpenAPI_binary_t *decoded_str_binary_data_n2_information_ext2 = NULL; json_data = cJSON_GetObjectItemCaseSensitive(ue_context_transfer_200_responseJSON, "jsonData"); if (json_data) { json_data_local_nonprim = OpenAPI_ue_context_transfer_rsp_data_parseFromJSON(json_data); @@ -133,10 +150,26 @@ OpenAPI_ue_context_transfer_200_response_t *OpenAPI_ue_context_transfer_200_resp } } + binary_data_n2_information_ext2 = cJSON_GetObjectItemCaseSensitive(ue_context_transfer_200_responseJSON, "binaryDataN2InformationExt2"); + if (binary_data_n2_information_ext2) { + decoded_str_binary_data_n2_information_ext2 = ogs_malloc(sizeof(OpenAPI_binary_t)); + ogs_assert(decoded_str_binary_data_n2_information_ext2); + if (!cJSON_IsString(binary_data_n2_information_ext2)) { + ogs_error("OpenAPI_ue_context_transfer_200_response_parseFromJSON() failed [binary_data_n2_information_ext2]"); + goto end; + } + decoded_str_binary_data_n2_information_ext2->data = OpenAPI_base64decode(binary_data_n2_information_ext2->valuestring, strlen(binary_data_n2_information_ext2->valuestring), &decoded_str_binary_data_n2_information_ext2->len); + if (!decoded_str_binary_data_n2_information_ext2->data) { + ogs_error("OpenAPI_ue_context_transfer_200_response_parseFromJSON() failed [binary_data_n2_information_ext2]"); + goto end; + } + } + ue_context_transfer_200_response_local_var = OpenAPI_ue_context_transfer_200_response_create ( json_data ? json_data_local_nonprim : NULL, binary_data_n2_information ? decoded_str_binary_data_n2_information : NULL, - binary_data_n2_information_ext1 ? decoded_str_binary_data_n2_information_ext1 : NULL + binary_data_n2_information_ext1 ? decoded_str_binary_data_n2_information_ext1 : NULL, + binary_data_n2_information_ext2 ? decoded_str_binary_data_n2_information_ext2 : NULL ); return ue_context_transfer_200_response_local_var; diff --git a/lib/sbi/openapi/model/ue_context_transfer_200_response.h b/lib/sbi/openapi/model/ue_context_transfer_200_response.h index a20ad9ba3..35ceb0da1 100644 --- a/lib/sbi/openapi/model/ue_context_transfer_200_response.h +++ b/lib/sbi/openapi/model/ue_context_transfer_200_response.h @@ -23,12 +23,14 @@ typedef struct OpenAPI_ue_context_transfer_200_response_s { struct OpenAPI_ue_context_transfer_rsp_data_s *json_data; OpenAPI_binary_t* binary_data_n2_information; OpenAPI_binary_t* binary_data_n2_information_ext1; + OpenAPI_binary_t* binary_data_n2_information_ext2; } OpenAPI_ue_context_transfer_200_response_t; OpenAPI_ue_context_transfer_200_response_t *OpenAPI_ue_context_transfer_200_response_create( OpenAPI_ue_context_transfer_rsp_data_t *json_data, OpenAPI_binary_t* binary_data_n2_information, - OpenAPI_binary_t* binary_data_n2_information_ext1 + OpenAPI_binary_t* binary_data_n2_information_ext1, + OpenAPI_binary_t* binary_data_n2_information_ext2 ); void OpenAPI_ue_context_transfer_200_response_free(OpenAPI_ue_context_transfer_200_response_t *ue_context_transfer_200_response); OpenAPI_ue_context_transfer_200_response_t *OpenAPI_ue_context_transfer_200_response_parseFromJSON(cJSON *ue_context_transfer_200_responseJSON); diff --git a/lib/sbi/openapi/model/ue_context_transfer_req_data.h b/lib/sbi/openapi/model/ue_context_transfer_req_data.h index 2975cc91c..0877bef9c 100644 --- a/lib/sbi/openapi/model/ue_context_transfer_req_data.h +++ b/lib/sbi/openapi/model/ue_context_transfer_req_data.h @@ -1,7 +1,7 @@ /* * ue_context_transfer_req_data.h * - * + * Data within a UE Context Transfer Request to start transferring of an individual ueContext resource from old AMF to new AMF */ #ifndef _OpenAPI_ue_context_transfer_req_data_H_ diff --git a/lib/sbi/openapi/model/ue_context_transfer_rsp_data.c b/lib/sbi/openapi/model/ue_context_transfer_rsp_data.c index 3cdafacef..994776a0e 100644 --- a/lib/sbi/openapi/model/ue_context_transfer_rsp_data.c +++ b/lib/sbi/openapi/model/ue_context_transfer_rsp_data.c @@ -7,6 +7,7 @@ OpenAPI_ue_context_transfer_rsp_data_t *OpenAPI_ue_context_transfer_rsp_data_create( OpenAPI_ue_context_t *ue_context, OpenAPI_n2_info_content_t *ue_radio_capability, + OpenAPI_n2_info_content_t *ue_radio_capability_for_paging, OpenAPI_n2_info_content_t *ue_nbiot_radio_capability, char *supported_features ) @@ -16,6 +17,7 @@ OpenAPI_ue_context_transfer_rsp_data_t *OpenAPI_ue_context_transfer_rsp_data_cre ue_context_transfer_rsp_data_local_var->ue_context = ue_context; ue_context_transfer_rsp_data_local_var->ue_radio_capability = ue_radio_capability; + ue_context_transfer_rsp_data_local_var->ue_radio_capability_for_paging = ue_radio_capability_for_paging; ue_context_transfer_rsp_data_local_var->ue_nbiot_radio_capability = ue_nbiot_radio_capability; ue_context_transfer_rsp_data_local_var->supported_features = supported_features; @@ -37,6 +39,10 @@ void OpenAPI_ue_context_transfer_rsp_data_free(OpenAPI_ue_context_transfer_rsp_d OpenAPI_n2_info_content_free(ue_context_transfer_rsp_data->ue_radio_capability); ue_context_transfer_rsp_data->ue_radio_capability = NULL; } + if (ue_context_transfer_rsp_data->ue_radio_capability_for_paging) { + OpenAPI_n2_info_content_free(ue_context_transfer_rsp_data->ue_radio_capability_for_paging); + ue_context_transfer_rsp_data->ue_radio_capability_for_paging = NULL; + } if (ue_context_transfer_rsp_data->ue_nbiot_radio_capability) { OpenAPI_n2_info_content_free(ue_context_transfer_rsp_data->ue_nbiot_radio_capability); ue_context_transfer_rsp_data->ue_nbiot_radio_capability = NULL; @@ -87,6 +93,19 @@ cJSON *OpenAPI_ue_context_transfer_rsp_data_convertToJSON(OpenAPI_ue_context_tra } } + if (ue_context_transfer_rsp_data->ue_radio_capability_for_paging) { + cJSON *ue_radio_capability_for_paging_local_JSON = OpenAPI_n2_info_content_convertToJSON(ue_context_transfer_rsp_data->ue_radio_capability_for_paging); + if (ue_radio_capability_for_paging_local_JSON == NULL) { + ogs_error("OpenAPI_ue_context_transfer_rsp_data_convertToJSON() failed [ue_radio_capability_for_paging]"); + goto end; + } + cJSON_AddItemToObject(item, "ueRadioCapabilityForPaging", ue_radio_capability_for_paging_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_ue_context_transfer_rsp_data_convertToJSON() failed [ue_radio_capability_for_paging]"); + goto end; + } + } + if (ue_context_transfer_rsp_data->ue_nbiot_radio_capability) { cJSON *ue_nbiot_radio_capability_local_JSON = OpenAPI_n2_info_content_convertToJSON(ue_context_transfer_rsp_data->ue_nbiot_radio_capability); if (ue_nbiot_radio_capability_local_JSON == NULL) { @@ -119,6 +138,8 @@ OpenAPI_ue_context_transfer_rsp_data_t *OpenAPI_ue_context_transfer_rsp_data_par OpenAPI_ue_context_t *ue_context_local_nonprim = NULL; cJSON *ue_radio_capability = NULL; OpenAPI_n2_info_content_t *ue_radio_capability_local_nonprim = NULL; + cJSON *ue_radio_capability_for_paging = NULL; + OpenAPI_n2_info_content_t *ue_radio_capability_for_paging_local_nonprim = NULL; cJSON *ue_nbiot_radio_capability = NULL; OpenAPI_n2_info_content_t *ue_nbiot_radio_capability_local_nonprim = NULL; cJSON *supported_features = NULL; @@ -134,6 +155,11 @@ OpenAPI_ue_context_transfer_rsp_data_t *OpenAPI_ue_context_transfer_rsp_data_par ue_radio_capability_local_nonprim = OpenAPI_n2_info_content_parseFromJSON(ue_radio_capability); } + ue_radio_capability_for_paging = cJSON_GetObjectItemCaseSensitive(ue_context_transfer_rsp_dataJSON, "ueRadioCapabilityForPaging"); + if (ue_radio_capability_for_paging) { + ue_radio_capability_for_paging_local_nonprim = OpenAPI_n2_info_content_parseFromJSON(ue_radio_capability_for_paging); + } + ue_nbiot_radio_capability = cJSON_GetObjectItemCaseSensitive(ue_context_transfer_rsp_dataJSON, "ueNbiotRadioCapability"); if (ue_nbiot_radio_capability) { ue_nbiot_radio_capability_local_nonprim = OpenAPI_n2_info_content_parseFromJSON(ue_nbiot_radio_capability); @@ -150,6 +176,7 @@ OpenAPI_ue_context_transfer_rsp_data_t *OpenAPI_ue_context_transfer_rsp_data_par ue_context_transfer_rsp_data_local_var = OpenAPI_ue_context_transfer_rsp_data_create ( ue_context_local_nonprim, ue_radio_capability ? ue_radio_capability_local_nonprim : NULL, + ue_radio_capability_for_paging ? ue_radio_capability_for_paging_local_nonprim : NULL, ue_nbiot_radio_capability ? ue_nbiot_radio_capability_local_nonprim : NULL, supported_features && !cJSON_IsNull(supported_features) ? ogs_strdup(supported_features->valuestring) : NULL ); @@ -164,6 +191,10 @@ end: OpenAPI_n2_info_content_free(ue_radio_capability_local_nonprim); ue_radio_capability_local_nonprim = NULL; } + if (ue_radio_capability_for_paging_local_nonprim) { + OpenAPI_n2_info_content_free(ue_radio_capability_for_paging_local_nonprim); + ue_radio_capability_for_paging_local_nonprim = NULL; + } if (ue_nbiot_radio_capability_local_nonprim) { OpenAPI_n2_info_content_free(ue_nbiot_radio_capability_local_nonprim); ue_nbiot_radio_capability_local_nonprim = NULL; diff --git a/lib/sbi/openapi/model/ue_context_transfer_rsp_data.h b/lib/sbi/openapi/model/ue_context_transfer_rsp_data.h index 215528d78..cf62a2b67 100644 --- a/lib/sbi/openapi/model/ue_context_transfer_rsp_data.h +++ b/lib/sbi/openapi/model/ue_context_transfer_rsp_data.h @@ -1,7 +1,7 @@ /* * ue_context_transfer_rsp_data.h * - * + * Data within a successful response to the UE Context Transfer request */ #ifndef _OpenAPI_ue_context_transfer_rsp_data_H_ @@ -23,6 +23,7 @@ typedef struct OpenAPI_ue_context_transfer_rsp_data_s OpenAPI_ue_context_transfe typedef struct OpenAPI_ue_context_transfer_rsp_data_s { struct OpenAPI_ue_context_s *ue_context; struct OpenAPI_n2_info_content_s *ue_radio_capability; + struct OpenAPI_n2_info_content_s *ue_radio_capability_for_paging; struct OpenAPI_n2_info_content_s *ue_nbiot_radio_capability; char *supported_features; } OpenAPI_ue_context_transfer_rsp_data_t; @@ -30,6 +31,7 @@ typedef struct OpenAPI_ue_context_transfer_rsp_data_s { OpenAPI_ue_context_transfer_rsp_data_t *OpenAPI_ue_context_transfer_rsp_data_create( OpenAPI_ue_context_t *ue_context, OpenAPI_n2_info_content_t *ue_radio_capability, + OpenAPI_n2_info_content_t *ue_radio_capability_for_paging, OpenAPI_n2_info_content_t *ue_nbiot_radio_capability, char *supported_features ); diff --git a/lib/sbi/openapi/model/ue_differentiation_info.h b/lib/sbi/openapi/model/ue_differentiation_info.h index 2cf0b4e27..2dc68ed91 100644 --- a/lib/sbi/openapi/model/ue_differentiation_info.h +++ b/lib/sbi/openapi/model/ue_differentiation_info.h @@ -1,7 +1,7 @@ /* * ue_differentiation_info.h * - * + * Represents the UE Differentiation Information and its validity time */ #ifndef _OpenAPI_ue_differentiation_info_H_ diff --git a/lib/sbi/openapi/model/ue_in_area_filter.c b/lib/sbi/openapi/model/ue_in_area_filter.c new file mode 100644 index 000000000..bdb3206b4 --- /dev/null +++ b/lib/sbi/openapi/model/ue_in_area_filter.c @@ -0,0 +1,140 @@ + +#include +#include +#include +#include "ue_in_area_filter.h" + +OpenAPI_ue_in_area_filter_t *OpenAPI_ue_in_area_filter_create( + OpenAPI_ue_type_t *ue_type, + bool is_aerial_srv_dnn_ind, + int aerial_srv_dnn_ind +) +{ + OpenAPI_ue_in_area_filter_t *ue_in_area_filter_local_var = ogs_malloc(sizeof(OpenAPI_ue_in_area_filter_t)); + ogs_assert(ue_in_area_filter_local_var); + + ue_in_area_filter_local_var->ue_type = ue_type; + ue_in_area_filter_local_var->is_aerial_srv_dnn_ind = is_aerial_srv_dnn_ind; + ue_in_area_filter_local_var->aerial_srv_dnn_ind = aerial_srv_dnn_ind; + + return ue_in_area_filter_local_var; +} + +void OpenAPI_ue_in_area_filter_free(OpenAPI_ue_in_area_filter_t *ue_in_area_filter) +{ + OpenAPI_lnode_t *node = NULL; + + if (NULL == ue_in_area_filter) { + return; + } + if (ue_in_area_filter->ue_type) { + OpenAPI_ue_type_free(ue_in_area_filter->ue_type); + ue_in_area_filter->ue_type = NULL; + } + ogs_free(ue_in_area_filter); +} + +cJSON *OpenAPI_ue_in_area_filter_convertToJSON(OpenAPI_ue_in_area_filter_t *ue_in_area_filter) +{ + cJSON *item = NULL; + OpenAPI_lnode_t *node = NULL; + + if (ue_in_area_filter == NULL) { + ogs_error("OpenAPI_ue_in_area_filter_convertToJSON() failed [UeInAreaFilter]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (ue_in_area_filter->ue_type) { + cJSON *ue_type_local_JSON = OpenAPI_ue_type_convertToJSON(ue_in_area_filter->ue_type); + if (ue_type_local_JSON == NULL) { + ogs_error("OpenAPI_ue_in_area_filter_convertToJSON() failed [ue_type]"); + goto end; + } + cJSON_AddItemToObject(item, "ueType", ue_type_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_ue_in_area_filter_convertToJSON() failed [ue_type]"); + goto end; + } + } + + if (ue_in_area_filter->is_aerial_srv_dnn_ind) { + if (cJSON_AddBoolToObject(item, "aerialSrvDnnInd", ue_in_area_filter->aerial_srv_dnn_ind) == NULL) { + ogs_error("OpenAPI_ue_in_area_filter_convertToJSON() failed [aerial_srv_dnn_ind]"); + goto end; + } + } + +end: + return item; +} + +OpenAPI_ue_in_area_filter_t *OpenAPI_ue_in_area_filter_parseFromJSON(cJSON *ue_in_area_filterJSON) +{ + OpenAPI_ue_in_area_filter_t *ue_in_area_filter_local_var = NULL; + OpenAPI_lnode_t *node = NULL; + cJSON *ue_type = NULL; + OpenAPI_ue_type_t *ue_type_local_nonprim = NULL; + cJSON *aerial_srv_dnn_ind = NULL; + ue_type = cJSON_GetObjectItemCaseSensitive(ue_in_area_filterJSON, "ueType"); + if (ue_type) { + ue_type_local_nonprim = OpenAPI_ue_type_parseFromJSON(ue_type); + } + + aerial_srv_dnn_ind = cJSON_GetObjectItemCaseSensitive(ue_in_area_filterJSON, "aerialSrvDnnInd"); + if (aerial_srv_dnn_ind) { + if (!cJSON_IsBool(aerial_srv_dnn_ind)) { + ogs_error("OpenAPI_ue_in_area_filter_parseFromJSON() failed [aerial_srv_dnn_ind]"); + goto end; + } + } + + ue_in_area_filter_local_var = OpenAPI_ue_in_area_filter_create ( + ue_type ? ue_type_local_nonprim : NULL, + aerial_srv_dnn_ind ? true : false, + aerial_srv_dnn_ind ? aerial_srv_dnn_ind->valueint : 0 + ); + + return ue_in_area_filter_local_var; +end: + if (ue_type_local_nonprim) { + OpenAPI_ue_type_free(ue_type_local_nonprim); + ue_type_local_nonprim = NULL; + } + return NULL; +} + +OpenAPI_ue_in_area_filter_t *OpenAPI_ue_in_area_filter_copy(OpenAPI_ue_in_area_filter_t *dst, OpenAPI_ue_in_area_filter_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_ue_in_area_filter_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_ue_in_area_filter_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_ue_in_area_filter_free(dst); + dst = OpenAPI_ue_in_area_filter_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/ue_in_area_filter.h b/lib/sbi/openapi/model/ue_in_area_filter.h new file mode 100644 index 000000000..8ae1e4877 --- /dev/null +++ b/lib/sbi/openapi/model/ue_in_area_filter.h @@ -0,0 +1,43 @@ +/* + * ue_in_area_filter.h + * + * Additional filters for UE in Area Report event + */ + +#ifndef _OpenAPI_ue_in_area_filter_H_ +#define _OpenAPI_ue_in_area_filter_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "ue_type.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_ue_in_area_filter_s OpenAPI_ue_in_area_filter_t; +typedef struct OpenAPI_ue_in_area_filter_s { + struct OpenAPI_ue_type_s *ue_type; + bool is_aerial_srv_dnn_ind; + int aerial_srv_dnn_ind; +} OpenAPI_ue_in_area_filter_t; + +OpenAPI_ue_in_area_filter_t *OpenAPI_ue_in_area_filter_create( + OpenAPI_ue_type_t *ue_type, + bool is_aerial_srv_dnn_ind, + int aerial_srv_dnn_ind +); +void OpenAPI_ue_in_area_filter_free(OpenAPI_ue_in_area_filter_t *ue_in_area_filter); +OpenAPI_ue_in_area_filter_t *OpenAPI_ue_in_area_filter_parseFromJSON(cJSON *ue_in_area_filterJSON); +cJSON *OpenAPI_ue_in_area_filter_convertToJSON(OpenAPI_ue_in_area_filter_t *ue_in_area_filter); +OpenAPI_ue_in_area_filter_t *OpenAPI_ue_in_area_filter_copy(OpenAPI_ue_in_area_filter_t *dst, OpenAPI_ue_in_area_filter_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_ue_in_area_filter_H_ */ + diff --git a/lib/sbi/openapi/model/ue_initiated_resource_request.h b/lib/sbi/openapi/model/ue_initiated_resource_request.h index 8b88b6940..cfb9e9742 100644 --- a/lib/sbi/openapi/model/ue_initiated_resource_request.h +++ b/lib/sbi/openapi/model/ue_initiated_resource_request.h @@ -1,7 +1,7 @@ /* * ue_initiated_resource_request.h * - * + * Indicates that a UE requests specific QoS handling for the selected SDF. */ #ifndef _OpenAPI_ue_initiated_resource_request_H_ diff --git a/lib/sbi/openapi/model/ue_mobility.c b/lib/sbi/openapi/model/ue_mobility.c new file mode 100644 index 000000000..612807444 --- /dev/null +++ b/lib/sbi/openapi/model/ue_mobility.c @@ -0,0 +1,245 @@ + +#include +#include +#include +#include "ue_mobility.h" + +OpenAPI_ue_mobility_t *OpenAPI_ue_mobility_create( + char *ts, + OpenAPI_scheduled_communication_time_1_t *recurring_time, + bool is_duration, + int duration, + bool is_duration_variance, + float duration_variance, + OpenAPI_list_t *loc_infos +) +{ + OpenAPI_ue_mobility_t *ue_mobility_local_var = ogs_malloc(sizeof(OpenAPI_ue_mobility_t)); + ogs_assert(ue_mobility_local_var); + + ue_mobility_local_var->ts = ts; + ue_mobility_local_var->recurring_time = recurring_time; + ue_mobility_local_var->is_duration = is_duration; + ue_mobility_local_var->duration = duration; + ue_mobility_local_var->is_duration_variance = is_duration_variance; + ue_mobility_local_var->duration_variance = duration_variance; + ue_mobility_local_var->loc_infos = loc_infos; + + return ue_mobility_local_var; +} + +void OpenAPI_ue_mobility_free(OpenAPI_ue_mobility_t *ue_mobility) +{ + OpenAPI_lnode_t *node = NULL; + + if (NULL == ue_mobility) { + return; + } + if (ue_mobility->ts) { + ogs_free(ue_mobility->ts); + ue_mobility->ts = NULL; + } + if (ue_mobility->recurring_time) { + OpenAPI_scheduled_communication_time_1_free(ue_mobility->recurring_time); + ue_mobility->recurring_time = NULL; + } + if (ue_mobility->loc_infos) { + OpenAPI_list_for_each(ue_mobility->loc_infos, node) { + OpenAPI_location_info_free(node->data); + } + OpenAPI_list_free(ue_mobility->loc_infos); + ue_mobility->loc_infos = NULL; + } + ogs_free(ue_mobility); +} + +cJSON *OpenAPI_ue_mobility_convertToJSON(OpenAPI_ue_mobility_t *ue_mobility) +{ + cJSON *item = NULL; + OpenAPI_lnode_t *node = NULL; + + if (ue_mobility == NULL) { + ogs_error("OpenAPI_ue_mobility_convertToJSON() failed [UeMobility]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (ue_mobility->ts) { + if (cJSON_AddStringToObject(item, "ts", ue_mobility->ts) == NULL) { + ogs_error("OpenAPI_ue_mobility_convertToJSON() failed [ts]"); + goto end; + } + } + + if (ue_mobility->recurring_time) { + cJSON *recurring_time_local_JSON = OpenAPI_scheduled_communication_time_1_convertToJSON(ue_mobility->recurring_time); + if (recurring_time_local_JSON == NULL) { + ogs_error("OpenAPI_ue_mobility_convertToJSON() failed [recurring_time]"); + goto end; + } + cJSON_AddItemToObject(item, "recurringTime", recurring_time_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_ue_mobility_convertToJSON() failed [recurring_time]"); + goto end; + } + } + + if (ue_mobility->is_duration) { + if (cJSON_AddNumberToObject(item, "duration", ue_mobility->duration) == NULL) { + ogs_error("OpenAPI_ue_mobility_convertToJSON() failed [duration]"); + goto end; + } + } + + if (ue_mobility->is_duration_variance) { + if (cJSON_AddNumberToObject(item, "durationVariance", ue_mobility->duration_variance) == NULL) { + ogs_error("OpenAPI_ue_mobility_convertToJSON() failed [duration_variance]"); + goto end; + } + } + + if (ue_mobility->loc_infos) { + cJSON *loc_infosList = cJSON_AddArrayToObject(item, "locInfos"); + if (loc_infosList == NULL) { + ogs_error("OpenAPI_ue_mobility_convertToJSON() failed [loc_infos]"); + goto end; + } + OpenAPI_list_for_each(ue_mobility->loc_infos, node) { + cJSON *itemLocal = OpenAPI_location_info_convertToJSON(node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_ue_mobility_convertToJSON() failed [loc_infos]"); + goto end; + } + cJSON_AddItemToArray(loc_infosList, itemLocal); + } + } + +end: + return item; +} + +OpenAPI_ue_mobility_t *OpenAPI_ue_mobility_parseFromJSON(cJSON *ue_mobilityJSON) +{ + OpenAPI_ue_mobility_t *ue_mobility_local_var = NULL; + OpenAPI_lnode_t *node = NULL; + cJSON *ts = NULL; + cJSON *recurring_time = NULL; + OpenAPI_scheduled_communication_time_1_t *recurring_time_local_nonprim = NULL; + cJSON *duration = NULL; + cJSON *duration_variance = NULL; + cJSON *loc_infos = NULL; + OpenAPI_list_t *loc_infosList = NULL; + ts = cJSON_GetObjectItemCaseSensitive(ue_mobilityJSON, "ts"); + if (ts) { + if (!cJSON_IsString(ts) && !cJSON_IsNull(ts)) { + ogs_error("OpenAPI_ue_mobility_parseFromJSON() failed [ts]"); + goto end; + } + } + + recurring_time = cJSON_GetObjectItemCaseSensitive(ue_mobilityJSON, "recurringTime"); + if (recurring_time) { + recurring_time_local_nonprim = OpenAPI_scheduled_communication_time_1_parseFromJSON(recurring_time); + } + + duration = cJSON_GetObjectItemCaseSensitive(ue_mobilityJSON, "duration"); + if (duration) { + if (!cJSON_IsNumber(duration)) { + ogs_error("OpenAPI_ue_mobility_parseFromJSON() failed [duration]"); + goto end; + } + } + + duration_variance = cJSON_GetObjectItemCaseSensitive(ue_mobilityJSON, "durationVariance"); + if (duration_variance) { + if (!cJSON_IsNumber(duration_variance)) { + ogs_error("OpenAPI_ue_mobility_parseFromJSON() failed [duration_variance]"); + goto end; + } + } + + loc_infos = cJSON_GetObjectItemCaseSensitive(ue_mobilityJSON, "locInfos"); + if (loc_infos) { + cJSON *loc_infos_local = NULL; + if (!cJSON_IsArray(loc_infos)) { + ogs_error("OpenAPI_ue_mobility_parseFromJSON() failed [loc_infos]"); + goto end; + } + + loc_infosList = OpenAPI_list_create(); + + cJSON_ArrayForEach(loc_infos_local, loc_infos) { + if (!cJSON_IsObject(loc_infos_local)) { + ogs_error("OpenAPI_ue_mobility_parseFromJSON() failed [loc_infos]"); + goto end; + } + OpenAPI_location_info_t *loc_infosItem = OpenAPI_location_info_parseFromJSON(loc_infos_local); + if (!loc_infosItem) { + ogs_error("No loc_infosItem"); + OpenAPI_list_free(loc_infosList); + goto end; + } + OpenAPI_list_add(loc_infosList, loc_infosItem); + } + } + + ue_mobility_local_var = OpenAPI_ue_mobility_create ( + ts && !cJSON_IsNull(ts) ? ogs_strdup(ts->valuestring) : NULL, + recurring_time ? recurring_time_local_nonprim : NULL, + duration ? true : false, + duration ? duration->valuedouble : 0, + duration_variance ? true : false, + duration_variance ? duration_variance->valuedouble : 0, + loc_infos ? loc_infosList : NULL + ); + + return ue_mobility_local_var; +end: + if (recurring_time_local_nonprim) { + OpenAPI_scheduled_communication_time_1_free(recurring_time_local_nonprim); + recurring_time_local_nonprim = NULL; + } + if (loc_infosList) { + OpenAPI_list_for_each(loc_infosList, node) { + OpenAPI_location_info_free(node->data); + } + OpenAPI_list_free(loc_infosList); + loc_infosList = NULL; + } + return NULL; +} + +OpenAPI_ue_mobility_t *OpenAPI_ue_mobility_copy(OpenAPI_ue_mobility_t *dst, OpenAPI_ue_mobility_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_ue_mobility_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_ue_mobility_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_ue_mobility_free(dst); + dst = OpenAPI_ue_mobility_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/ue_mobility.h b/lib/sbi/openapi/model/ue_mobility.h new file mode 100644 index 000000000..b37f3924d --- /dev/null +++ b/lib/sbi/openapi/model/ue_mobility.h @@ -0,0 +1,52 @@ +/* + * ue_mobility.h + * + * Represents UE mobility information. + */ + +#ifndef _OpenAPI_ue_mobility_H_ +#define _OpenAPI_ue_mobility_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "location_info.h" +#include "scheduled_communication_time_1.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_ue_mobility_s OpenAPI_ue_mobility_t; +typedef struct OpenAPI_ue_mobility_s { + char *ts; + struct OpenAPI_scheduled_communication_time_1_s *recurring_time; + bool is_duration; + int duration; + bool is_duration_variance; + float duration_variance; + OpenAPI_list_t *loc_infos; +} OpenAPI_ue_mobility_t; + +OpenAPI_ue_mobility_t *OpenAPI_ue_mobility_create( + char *ts, + OpenAPI_scheduled_communication_time_1_t *recurring_time, + bool is_duration, + int duration, + bool is_duration_variance, + float duration_variance, + OpenAPI_list_t *loc_infos +); +void OpenAPI_ue_mobility_free(OpenAPI_ue_mobility_t *ue_mobility); +OpenAPI_ue_mobility_t *OpenAPI_ue_mobility_parseFromJSON(cJSON *ue_mobilityJSON); +cJSON *OpenAPI_ue_mobility_convertToJSON(OpenAPI_ue_mobility_t *ue_mobility); +OpenAPI_ue_mobility_t *OpenAPI_ue_mobility_copy(OpenAPI_ue_mobility_t *dst, OpenAPI_ue_mobility_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_ue_mobility_H_ */ + diff --git a/lib/sbi/openapi/model/ue_n1_n2_info_subscription_create_data.h b/lib/sbi/openapi/model/ue_n1_n2_info_subscription_create_data.h index 909507a01..bebf37802 100644 --- a/lib/sbi/openapi/model/ue_n1_n2_info_subscription_create_data.h +++ b/lib/sbi/openapi/model/ue_n1_n2_info_subscription_create_data.h @@ -1,7 +1,7 @@ /* * ue_n1_n2_info_subscription_create_data.h * - * + * Data within a create subscription request for UE specific N1 and/or N2 information notification */ #ifndef _OpenAPI_ue_n1_n2_info_subscription_create_data_H_ diff --git a/lib/sbi/openapi/model/ue_n1_n2_info_subscription_created_data.h b/lib/sbi/openapi/model/ue_n1_n2_info_subscription_created_data.h index 24eca0635..28a17fe93 100644 --- a/lib/sbi/openapi/model/ue_n1_n2_info_subscription_created_data.h +++ b/lib/sbi/openapi/model/ue_n1_n2_info_subscription_created_data.h @@ -1,7 +1,7 @@ /* * ue_n1_n2_info_subscription_created_data.h * - * + * Data for the created subscription for UE specific N1 and/or N2 information notification */ #ifndef _OpenAPI_ue_n1_n2_info_subscription_created_data_H_ diff --git a/lib/sbi/openapi/model/ue_policy_set.c b/lib/sbi/openapi/model/ue_policy_set.c index de05cf2a6..7002851f4 100644 --- a/lib/sbi/openapi/model/ue_policy_set.c +++ b/lib/sbi/openapi/model/ue_policy_set.c @@ -14,7 +14,8 @@ OpenAPI_ue_policy_set_t *OpenAPI_ue_policy_set_create( int andsp_ind, char *pei, OpenAPI_list_t *os_ids, - char *supp_feat + char *supp_feat, + OpenAPI_list_t *reset_ids ) { OpenAPI_ue_policy_set_t *ue_policy_set_local_var = ogs_malloc(sizeof(OpenAPI_ue_policy_set_t)); @@ -30,6 +31,7 @@ OpenAPI_ue_policy_set_t *OpenAPI_ue_policy_set_create( ue_policy_set_local_var->pei = pei; ue_policy_set_local_var->os_ids = os_ids; ue_policy_set_local_var->supp_feat = supp_feat; + ue_policy_set_local_var->reset_ids = reset_ids; return ue_policy_set_local_var; } @@ -100,6 +102,13 @@ void OpenAPI_ue_policy_set_free(OpenAPI_ue_policy_set_t *ue_policy_set) ogs_free(ue_policy_set->supp_feat); ue_policy_set->supp_feat = NULL; } + if (ue_policy_set->reset_ids) { + OpenAPI_list_for_each(ue_policy_set->reset_ids, node) { + ogs_free(node->data); + } + OpenAPI_list_free(ue_policy_set->reset_ids); + ue_policy_set->reset_ids = NULL; + } ogs_free(ue_policy_set); } @@ -243,6 +252,20 @@ cJSON *OpenAPI_ue_policy_set_convertToJSON(OpenAPI_ue_policy_set_t *ue_policy_se } } + if (ue_policy_set->reset_ids) { + cJSON *reset_idsList = cJSON_AddArrayToObject(item, "resetIds"); + if (reset_idsList == NULL) { + ogs_error("OpenAPI_ue_policy_set_convertToJSON() failed [reset_ids]"); + goto end; + } + OpenAPI_list_for_each(ue_policy_set->reset_ids, node) { + if (cJSON_AddStringToObject(reset_idsList, "", (char*)node->data) == NULL) { + ogs_error("OpenAPI_ue_policy_set_convertToJSON() failed [reset_ids]"); + goto end; + } + } + } + end: return item; } @@ -266,6 +289,8 @@ OpenAPI_ue_policy_set_t *OpenAPI_ue_policy_set_parseFromJSON(cJSON *ue_policy_se cJSON *os_ids = NULL; OpenAPI_list_t *os_idsList = NULL; cJSON *supp_feat = NULL; + cJSON *reset_ids = NULL; + OpenAPI_list_t *reset_idsList = NULL; pra_infos = cJSON_GetObjectItemCaseSensitive(ue_policy_setJSON, "praInfos"); if (pra_infos) { cJSON *pra_infos_local_map = NULL; @@ -431,6 +456,27 @@ OpenAPI_ue_policy_set_t *OpenAPI_ue_policy_set_parseFromJSON(cJSON *ue_policy_se } } + reset_ids = cJSON_GetObjectItemCaseSensitive(ue_policy_setJSON, "resetIds"); + if (reset_ids) { + cJSON *reset_ids_local = NULL; + if (!cJSON_IsArray(reset_ids)) { + ogs_error("OpenAPI_ue_policy_set_parseFromJSON() failed [reset_ids]"); + goto end; + } + + reset_idsList = OpenAPI_list_create(); + + cJSON_ArrayForEach(reset_ids_local, reset_ids) { + double *localDouble = NULL; + int *localInt = NULL; + if (!cJSON_IsString(reset_ids_local)) { + ogs_error("OpenAPI_ue_policy_set_parseFromJSON() failed [reset_ids]"); + goto end; + } + OpenAPI_list_add(reset_idsList, ogs_strdup(reset_ids_local->valuestring)); + } + } + ue_policy_set_local_var = OpenAPI_ue_policy_set_create ( pra_infos ? pra_infosList : NULL, subsc_cats ? subsc_catsList : NULL, @@ -441,7 +487,8 @@ OpenAPI_ue_policy_set_t *OpenAPI_ue_policy_set_parseFromJSON(cJSON *ue_policy_se andsp_ind ? andsp_ind->valueint : 0, pei && !cJSON_IsNull(pei) ? ogs_strdup(pei->valuestring) : NULL, os_ids ? os_idsList : NULL, - supp_feat && !cJSON_IsNull(supp_feat) ? ogs_strdup(supp_feat->valuestring) : NULL + supp_feat && !cJSON_IsNull(supp_feat) ? ogs_strdup(supp_feat->valuestring) : NULL, + reset_ids ? reset_idsList : NULL ); return ue_policy_set_local_var; @@ -497,6 +544,13 @@ end: OpenAPI_list_free(os_idsList); os_idsList = NULL; } + if (reset_idsList) { + OpenAPI_list_for_each(reset_idsList, node) { + ogs_free(node->data); + } + OpenAPI_list_free(reset_idsList); + reset_idsList = NULL; + } return NULL; } diff --git a/lib/sbi/openapi/model/ue_policy_set.h b/lib/sbi/openapi/model/ue_policy_set.h index 1e3709c63..189045ecd 100644 --- a/lib/sbi/openapi/model/ue_policy_set.h +++ b/lib/sbi/openapi/model/ue_policy_set.h @@ -32,6 +32,7 @@ typedef struct OpenAPI_ue_policy_set_s { char *pei; OpenAPI_list_t *os_ids; char *supp_feat; + OpenAPI_list_t *reset_ids; } OpenAPI_ue_policy_set_t; OpenAPI_ue_policy_set_t *OpenAPI_ue_policy_set_create( @@ -44,7 +45,8 @@ OpenAPI_ue_policy_set_t *OpenAPI_ue_policy_set_create( int andsp_ind, char *pei, OpenAPI_list_t *os_ids, - char *supp_feat + char *supp_feat, + OpenAPI_list_t *reset_ids ); void OpenAPI_ue_policy_set_free(OpenAPI_ue_policy_set_t *ue_policy_set); OpenAPI_ue_policy_set_t *OpenAPI_ue_policy_set_parseFromJSON(cJSON *ue_policy_setJSON); diff --git a/lib/sbi/openapi/model/ue_reachability.h b/lib/sbi/openapi/model/ue_reachability.h index 8fd20ad34..7871618b6 100644 --- a/lib/sbi/openapi/model/ue_reachability.h +++ b/lib/sbi/openapi/model/ue_reachability.h @@ -1,7 +1,7 @@ /* * ue_reachability.h * - * + * Describes the reachability of the UE */ #ifndef _OpenAPI_ue_reachability_H_ diff --git a/lib/sbi/openapi/model/ue_reachable_ind.c b/lib/sbi/openapi/model/ue_reachable_ind.c new file mode 100644 index 000000000..03420af95 --- /dev/null +++ b/lib/sbi/openapi/model/ue_reachable_ind.c @@ -0,0 +1,30 @@ + +#include +#include +#include +#include "ue_reachable_ind.h" + +char* OpenAPI_ue_reachable_ind_ToString(OpenAPI_ue_reachable_ind_e ue_reachable_ind) +{ + const char *ue_reachable_indArray[] = { "NULL", "REACHABLE", "NOT_REACHABLE", "UNKNOWN" }; + size_t sizeofArray = sizeof(ue_reachable_indArray) / sizeof(ue_reachable_indArray[0]); + if (ue_reachable_ind < sizeofArray) + return (char *)ue_reachable_indArray[ue_reachable_ind]; + else + return (char *)"Unknown"; +} + +OpenAPI_ue_reachable_ind_e OpenAPI_ue_reachable_ind_FromString(char* ue_reachable_ind) +{ + int stringToReturn = 0; + const char *ue_reachable_indArray[] = { "NULL", "REACHABLE", "NOT_REACHABLE", "UNKNOWN" }; + size_t sizeofArray = sizeof(ue_reachable_indArray) / sizeof(ue_reachable_indArray[0]); + while (stringToReturn < sizeofArray) { + if (strcmp(ue_reachable_ind, ue_reachable_indArray[stringToReturn]) == 0) { + return stringToReturn; + } + stringToReturn++; + } + return 0; +} + diff --git a/lib/sbi/openapi/model/ue_reachable_ind.h b/lib/sbi/openapi/model/ue_reachable_ind.h new file mode 100644 index 000000000..d4215836c --- /dev/null +++ b/lib/sbi/openapi/model/ue_reachable_ind.h @@ -0,0 +1,31 @@ +/* + * ue_reachable_ind.h + * + * + */ + +#ifndef _OpenAPI_ue_reachable_ind_H_ +#define _OpenAPI_ue_reachable_ind_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef enum { OpenAPI_ue_reachable_ind_NULL = 0, OpenAPI_ue_reachable_ind_REACHABLE, OpenAPI_ue_reachable_ind_NOT_REACHABLE, OpenAPI_ue_reachable_ind_UNKNOWN } OpenAPI_ue_reachable_ind_e; + +char* OpenAPI_ue_reachable_ind_ToString(OpenAPI_ue_reachable_ind_e ue_reachable_ind); + +OpenAPI_ue_reachable_ind_e OpenAPI_ue_reachable_ind_FromString(char* ue_reachable_ind); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_ue_reachable_ind_H_ */ + diff --git a/lib/sbi/openapi/model/ue_reg_status_update_req_data.c b/lib/sbi/openapi/model/ue_reg_status_update_req_data.c index f8b568678..3c86604ae 100644 --- a/lib/sbi/openapi/model/ue_reg_status_update_req_data.c +++ b/lib/sbi/openapi/model/ue_reg_status_update_req_data.c @@ -9,7 +9,9 @@ OpenAPI_ue_reg_status_update_req_data_t *OpenAPI_ue_reg_status_update_req_data_c OpenAPI_list_t *to_release_session_list, bool is_pcf_reselected_ind, int pcf_reselected_ind, - OpenAPI_list_t *smf_change_info_list + OpenAPI_list_t *smf_change_info_list, + OpenAPI_list_t *analytics_not_used_list, + OpenAPI_list_t *to_release_session_info ) { OpenAPI_ue_reg_status_update_req_data_t *ue_reg_status_update_req_data_local_var = ogs_malloc(sizeof(OpenAPI_ue_reg_status_update_req_data_t)); @@ -20,6 +22,8 @@ OpenAPI_ue_reg_status_update_req_data_t *OpenAPI_ue_reg_status_update_req_data_c ue_reg_status_update_req_data_local_var->is_pcf_reselected_ind = is_pcf_reselected_ind; ue_reg_status_update_req_data_local_var->pcf_reselected_ind = pcf_reselected_ind; ue_reg_status_update_req_data_local_var->smf_change_info_list = smf_change_info_list; + ue_reg_status_update_req_data_local_var->analytics_not_used_list = analytics_not_used_list; + ue_reg_status_update_req_data_local_var->to_release_session_info = to_release_session_info; return ue_reg_status_update_req_data_local_var; } @@ -45,6 +49,20 @@ void OpenAPI_ue_reg_status_update_req_data_free(OpenAPI_ue_reg_status_update_req OpenAPI_list_free(ue_reg_status_update_req_data->smf_change_info_list); ue_reg_status_update_req_data->smf_change_info_list = NULL; } + if (ue_reg_status_update_req_data->analytics_not_used_list) { + OpenAPI_list_for_each(ue_reg_status_update_req_data->analytics_not_used_list, node) { + ogs_free(node->data); + } + OpenAPI_list_free(ue_reg_status_update_req_data->analytics_not_used_list); + ue_reg_status_update_req_data->analytics_not_used_list = NULL; + } + if (ue_reg_status_update_req_data->to_release_session_info) { + OpenAPI_list_for_each(ue_reg_status_update_req_data->to_release_session_info, node) { + OpenAPI_release_session_info_free(node->data); + } + OpenAPI_list_free(ue_reg_status_update_req_data->to_release_session_info); + ue_reg_status_update_req_data->to_release_session_info = NULL; + } ogs_free(ue_reg_status_update_req_data); } @@ -105,6 +123,36 @@ cJSON *OpenAPI_ue_reg_status_update_req_data_convertToJSON(OpenAPI_ue_reg_status } } + if (ue_reg_status_update_req_data->analytics_not_used_list) { + cJSON *analytics_not_used_listList = cJSON_AddArrayToObject(item, "analyticsNotUsedList"); + if (analytics_not_used_listList == NULL) { + ogs_error("OpenAPI_ue_reg_status_update_req_data_convertToJSON() failed [analytics_not_used_list]"); + goto end; + } + OpenAPI_list_for_each(ue_reg_status_update_req_data->analytics_not_used_list, node) { + if (cJSON_AddStringToObject(analytics_not_used_listList, "", (char*)node->data) == NULL) { + ogs_error("OpenAPI_ue_reg_status_update_req_data_convertToJSON() failed [analytics_not_used_list]"); + goto end; + } + } + } + + if (ue_reg_status_update_req_data->to_release_session_info) { + cJSON *to_release_session_infoList = cJSON_AddArrayToObject(item, "toReleaseSessionInfo"); + if (to_release_session_infoList == NULL) { + ogs_error("OpenAPI_ue_reg_status_update_req_data_convertToJSON() failed [to_release_session_info]"); + goto end; + } + OpenAPI_list_for_each(ue_reg_status_update_req_data->to_release_session_info, node) { + cJSON *itemLocal = OpenAPI_release_session_info_convertToJSON(node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_ue_reg_status_update_req_data_convertToJSON() failed [to_release_session_info]"); + goto end; + } + cJSON_AddItemToArray(to_release_session_infoList, itemLocal); + } + } + end: return item; } @@ -120,6 +168,10 @@ OpenAPI_ue_reg_status_update_req_data_t *OpenAPI_ue_reg_status_update_req_data_p cJSON *pcf_reselected_ind = NULL; cJSON *smf_change_info_list = NULL; OpenAPI_list_t *smf_change_info_listList = NULL; + cJSON *analytics_not_used_list = NULL; + OpenAPI_list_t *analytics_not_used_listList = NULL; + cJSON *to_release_session_info = NULL; + OpenAPI_list_t *to_release_session_infoList = NULL; transfer_status = cJSON_GetObjectItemCaseSensitive(ue_reg_status_update_req_dataJSON, "transferStatus"); if (!transfer_status) { ogs_error("OpenAPI_ue_reg_status_update_req_data_parseFromJSON() failed [transfer_status]"); @@ -191,12 +243,60 @@ OpenAPI_ue_reg_status_update_req_data_t *OpenAPI_ue_reg_status_update_req_data_p } } + analytics_not_used_list = cJSON_GetObjectItemCaseSensitive(ue_reg_status_update_req_dataJSON, "analyticsNotUsedList"); + if (analytics_not_used_list) { + cJSON *analytics_not_used_list_local = NULL; + if (!cJSON_IsArray(analytics_not_used_list)) { + ogs_error("OpenAPI_ue_reg_status_update_req_data_parseFromJSON() failed [analytics_not_used_list]"); + goto end; + } + + analytics_not_used_listList = OpenAPI_list_create(); + + cJSON_ArrayForEach(analytics_not_used_list_local, analytics_not_used_list) { + double *localDouble = NULL; + int *localInt = NULL; + if (!cJSON_IsString(analytics_not_used_list_local)) { + ogs_error("OpenAPI_ue_reg_status_update_req_data_parseFromJSON() failed [analytics_not_used_list]"); + goto end; + } + OpenAPI_list_add(analytics_not_used_listList, ogs_strdup(analytics_not_used_list_local->valuestring)); + } + } + + to_release_session_info = cJSON_GetObjectItemCaseSensitive(ue_reg_status_update_req_dataJSON, "toReleaseSessionInfo"); + if (to_release_session_info) { + cJSON *to_release_session_info_local = NULL; + if (!cJSON_IsArray(to_release_session_info)) { + ogs_error("OpenAPI_ue_reg_status_update_req_data_parseFromJSON() failed [to_release_session_info]"); + goto end; + } + + to_release_session_infoList = OpenAPI_list_create(); + + cJSON_ArrayForEach(to_release_session_info_local, to_release_session_info) { + if (!cJSON_IsObject(to_release_session_info_local)) { + ogs_error("OpenAPI_ue_reg_status_update_req_data_parseFromJSON() failed [to_release_session_info]"); + goto end; + } + OpenAPI_release_session_info_t *to_release_session_infoItem = OpenAPI_release_session_info_parseFromJSON(to_release_session_info_local); + if (!to_release_session_infoItem) { + ogs_error("No to_release_session_infoItem"); + OpenAPI_list_free(to_release_session_infoList); + goto end; + } + OpenAPI_list_add(to_release_session_infoList, to_release_session_infoItem); + } + } + ue_reg_status_update_req_data_local_var = OpenAPI_ue_reg_status_update_req_data_create ( transfer_statusVariable, to_release_session_list ? to_release_session_listList : NULL, pcf_reselected_ind ? true : false, pcf_reselected_ind ? pcf_reselected_ind->valueint : 0, - smf_change_info_list ? smf_change_info_listList : NULL + smf_change_info_list ? smf_change_info_listList : NULL, + analytics_not_used_list ? analytics_not_used_listList : NULL, + to_release_session_info ? to_release_session_infoList : NULL ); return ue_reg_status_update_req_data_local_var; @@ -215,6 +315,20 @@ end: OpenAPI_list_free(smf_change_info_listList); smf_change_info_listList = NULL; } + if (analytics_not_used_listList) { + OpenAPI_list_for_each(analytics_not_used_listList, node) { + ogs_free(node->data); + } + OpenAPI_list_free(analytics_not_used_listList); + analytics_not_used_listList = NULL; + } + if (to_release_session_infoList) { + OpenAPI_list_for_each(to_release_session_infoList, node) { + OpenAPI_release_session_info_free(node->data); + } + OpenAPI_list_free(to_release_session_infoList); + to_release_session_infoList = NULL; + } return NULL; } diff --git a/lib/sbi/openapi/model/ue_reg_status_update_req_data.h b/lib/sbi/openapi/model/ue_reg_status_update_req_data.h index cca51d63a..041d7971d 100644 --- a/lib/sbi/openapi/model/ue_reg_status_update_req_data.h +++ b/lib/sbi/openapi/model/ue_reg_status_update_req_data.h @@ -1,7 +1,7 @@ /* * ue_reg_status_update_req_data.h * - * + * Data within a UE registration status update request to indicate a completion of transferring at a target AMF */ #ifndef _OpenAPI_ue_reg_status_update_req_data_H_ @@ -12,6 +12,7 @@ #include "../include/list.h" #include "../include/keyValuePair.h" #include "../include/binary.h" +#include "release_session_info.h" #include "smf_change_info.h" #include "ue_context_transfer_status.h" @@ -26,6 +27,8 @@ typedef struct OpenAPI_ue_reg_status_update_req_data_s { bool is_pcf_reselected_ind; int pcf_reselected_ind; OpenAPI_list_t *smf_change_info_list; + OpenAPI_list_t *analytics_not_used_list; + OpenAPI_list_t *to_release_session_info; } OpenAPI_ue_reg_status_update_req_data_t; OpenAPI_ue_reg_status_update_req_data_t *OpenAPI_ue_reg_status_update_req_data_create( @@ -33,7 +36,9 @@ OpenAPI_ue_reg_status_update_req_data_t *OpenAPI_ue_reg_status_update_req_data_c OpenAPI_list_t *to_release_session_list, bool is_pcf_reselected_ind, int pcf_reselected_ind, - OpenAPI_list_t *smf_change_info_list + OpenAPI_list_t *smf_change_info_list, + OpenAPI_list_t *analytics_not_used_list, + OpenAPI_list_t *to_release_session_info ); void OpenAPI_ue_reg_status_update_req_data_free(OpenAPI_ue_reg_status_update_req_data_t *ue_reg_status_update_req_data); OpenAPI_ue_reg_status_update_req_data_t *OpenAPI_ue_reg_status_update_req_data_parseFromJSON(cJSON *ue_reg_status_update_req_dataJSON); diff --git a/lib/sbi/openapi/model/ue_reg_status_update_rsp_data.h b/lib/sbi/openapi/model/ue_reg_status_update_rsp_data.h index 653b6fdb7..d4574f0f4 100644 --- a/lib/sbi/openapi/model/ue_reg_status_update_rsp_data.h +++ b/lib/sbi/openapi/model/ue_reg_status_update_rsp_data.h @@ -1,7 +1,7 @@ /* * ue_reg_status_update_rsp_data.h * - * + * Data within a UE registration status update response to provide the status of UE context transfer status update at a source AMF */ #ifndef _OpenAPI_ue_reg_status_update_rsp_data_H_ diff --git a/lib/sbi/openapi/model/ue_slice_mbr.c b/lib/sbi/openapi/model/ue_slice_mbr.c new file mode 100644 index 000000000..dd00c77dc --- /dev/null +++ b/lib/sbi/openapi/model/ue_slice_mbr.c @@ -0,0 +1,230 @@ + +#include +#include +#include +#include "ue_slice_mbr.h" + +OpenAPI_ue_slice_mbr_t *OpenAPI_ue_slice_mbr_create( + OpenAPI_list_t* slice_mbr, + OpenAPI_snssai_t *serving_snssai, + OpenAPI_snssai_t *mapped_home_snssai +) +{ + OpenAPI_ue_slice_mbr_t *ue_slice_mbr_local_var = ogs_malloc(sizeof(OpenAPI_ue_slice_mbr_t)); + ogs_assert(ue_slice_mbr_local_var); + + ue_slice_mbr_local_var->slice_mbr = slice_mbr; + ue_slice_mbr_local_var->serving_snssai = serving_snssai; + ue_slice_mbr_local_var->mapped_home_snssai = mapped_home_snssai; + + return ue_slice_mbr_local_var; +} + +void OpenAPI_ue_slice_mbr_free(OpenAPI_ue_slice_mbr_t *ue_slice_mbr) +{ + OpenAPI_lnode_t *node = NULL; + + if (NULL == ue_slice_mbr) { + return; + } + if (ue_slice_mbr->slice_mbr) { + OpenAPI_list_for_each(ue_slice_mbr->slice_mbr, node) { + OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*)node->data; + ogs_free(localKeyValue->key); + OpenAPI_slice_mbr_free(localKeyValue->value); + OpenAPI_map_free(localKeyValue); + } + OpenAPI_list_free(ue_slice_mbr->slice_mbr); + ue_slice_mbr->slice_mbr = NULL; + } + if (ue_slice_mbr->serving_snssai) { + OpenAPI_snssai_free(ue_slice_mbr->serving_snssai); + ue_slice_mbr->serving_snssai = NULL; + } + if (ue_slice_mbr->mapped_home_snssai) { + OpenAPI_snssai_free(ue_slice_mbr->mapped_home_snssai); + ue_slice_mbr->mapped_home_snssai = NULL; + } + ogs_free(ue_slice_mbr); +} + +cJSON *OpenAPI_ue_slice_mbr_convertToJSON(OpenAPI_ue_slice_mbr_t *ue_slice_mbr) +{ + cJSON *item = NULL; + OpenAPI_lnode_t *node = NULL; + + if (ue_slice_mbr == NULL) { + ogs_error("OpenAPI_ue_slice_mbr_convertToJSON() failed [UeSliceMbr]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (!ue_slice_mbr->slice_mbr) { + ogs_error("OpenAPI_ue_slice_mbr_convertToJSON() failed [slice_mbr]"); + return NULL; + } + cJSON *slice_mbr = cJSON_AddObjectToObject(item, "sliceMbr"); + if (slice_mbr == NULL) { + ogs_error("OpenAPI_ue_slice_mbr_convertToJSON() failed [slice_mbr]"); + goto end; + } + cJSON *localMapObject = slice_mbr; + if (ue_slice_mbr->slice_mbr) { + OpenAPI_list_for_each(ue_slice_mbr->slice_mbr, node) { + OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*)node->data; + cJSON *itemLocal = localKeyValue->value ? + OpenAPI_slice_mbr_convertToJSON(localKeyValue->value) : + cJSON_CreateNull(); + if (itemLocal == NULL) { + ogs_error("OpenAPI_ue_slice_mbr_convertToJSON() failed [inner]"); + goto end; + } + cJSON_AddItemToObject(localMapObject, localKeyValue->key, itemLocal); + } + } + + if (!ue_slice_mbr->serving_snssai) { + ogs_error("OpenAPI_ue_slice_mbr_convertToJSON() failed [serving_snssai]"); + return NULL; + } + cJSON *serving_snssai_local_JSON = OpenAPI_snssai_convertToJSON(ue_slice_mbr->serving_snssai); + if (serving_snssai_local_JSON == NULL) { + ogs_error("OpenAPI_ue_slice_mbr_convertToJSON() failed [serving_snssai]"); + goto end; + } + cJSON_AddItemToObject(item, "servingSnssai", serving_snssai_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_ue_slice_mbr_convertToJSON() failed [serving_snssai]"); + goto end; + } + + if (ue_slice_mbr->mapped_home_snssai) { + cJSON *mapped_home_snssai_local_JSON = OpenAPI_snssai_convertToJSON(ue_slice_mbr->mapped_home_snssai); + if (mapped_home_snssai_local_JSON == NULL) { + ogs_error("OpenAPI_ue_slice_mbr_convertToJSON() failed [mapped_home_snssai]"); + goto end; + } + cJSON_AddItemToObject(item, "mappedHomeSnssai", mapped_home_snssai_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_ue_slice_mbr_convertToJSON() failed [mapped_home_snssai]"); + goto end; + } + } + +end: + return item; +} + +OpenAPI_ue_slice_mbr_t *OpenAPI_ue_slice_mbr_parseFromJSON(cJSON *ue_slice_mbrJSON) +{ + OpenAPI_ue_slice_mbr_t *ue_slice_mbr_local_var = NULL; + OpenAPI_lnode_t *node = NULL; + cJSON *slice_mbr = NULL; + OpenAPI_list_t *slice_mbrList = NULL; + cJSON *serving_snssai = NULL; + OpenAPI_snssai_t *serving_snssai_local_nonprim = NULL; + cJSON *mapped_home_snssai = NULL; + OpenAPI_snssai_t *mapped_home_snssai_local_nonprim = NULL; + slice_mbr = cJSON_GetObjectItemCaseSensitive(ue_slice_mbrJSON, "sliceMbr"); + if (!slice_mbr) { + ogs_error("OpenAPI_ue_slice_mbr_parseFromJSON() failed [slice_mbr]"); + goto end; + } + cJSON *slice_mbr_local_map = NULL; + if (!cJSON_IsObject(slice_mbr) && !cJSON_IsNull(slice_mbr)) { + ogs_error("OpenAPI_ue_slice_mbr_parseFromJSON() failed [slice_mbr]"); + goto end; + } + if (cJSON_IsObject(slice_mbr)) { + slice_mbrList = OpenAPI_list_create(); + OpenAPI_map_t *localMapKeyPair = NULL; + cJSON_ArrayForEach(slice_mbr_local_map, slice_mbr) { + cJSON *localMapObject = slice_mbr_local_map; + if (cJSON_IsObject(localMapObject)) { + localMapKeyPair = OpenAPI_map_create( + ogs_strdup(localMapObject->string), OpenAPI_slice_mbr_parseFromJSON(localMapObject)); + } else if (cJSON_IsNull(localMapObject)) { + localMapKeyPair = OpenAPI_map_create(ogs_strdup(localMapObject->string), NULL); + } else { + ogs_error("OpenAPI_ue_slice_mbr_parseFromJSON() failed [inner]"); + goto end; + } + OpenAPI_list_add(slice_mbrList, localMapKeyPair); + } + } + + serving_snssai = cJSON_GetObjectItemCaseSensitive(ue_slice_mbrJSON, "servingSnssai"); + if (!serving_snssai) { + ogs_error("OpenAPI_ue_slice_mbr_parseFromJSON() failed [serving_snssai]"); + goto end; + } + serving_snssai_local_nonprim = OpenAPI_snssai_parseFromJSON(serving_snssai); + + mapped_home_snssai = cJSON_GetObjectItemCaseSensitive(ue_slice_mbrJSON, "mappedHomeSnssai"); + if (mapped_home_snssai) { + mapped_home_snssai_local_nonprim = OpenAPI_snssai_parseFromJSON(mapped_home_snssai); + } + + ue_slice_mbr_local_var = OpenAPI_ue_slice_mbr_create ( + slice_mbrList, + serving_snssai_local_nonprim, + mapped_home_snssai ? mapped_home_snssai_local_nonprim : NULL + ); + + return ue_slice_mbr_local_var; +end: + if (slice_mbrList) { + OpenAPI_list_for_each(slice_mbrList, node) { + OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*) node->data; + ogs_free(localKeyValue->key); + OpenAPI_slice_mbr_free(localKeyValue->value); + OpenAPI_map_free(localKeyValue); + } + OpenAPI_list_free(slice_mbrList); + slice_mbrList = NULL; + } + if (serving_snssai_local_nonprim) { + OpenAPI_snssai_free(serving_snssai_local_nonprim); + serving_snssai_local_nonprim = NULL; + } + if (mapped_home_snssai_local_nonprim) { + OpenAPI_snssai_free(mapped_home_snssai_local_nonprim); + mapped_home_snssai_local_nonprim = NULL; + } + return NULL; +} + +OpenAPI_ue_slice_mbr_t *OpenAPI_ue_slice_mbr_copy(OpenAPI_ue_slice_mbr_t *dst, OpenAPI_ue_slice_mbr_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_ue_slice_mbr_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_ue_slice_mbr_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_ue_slice_mbr_free(dst); + dst = OpenAPI_ue_slice_mbr_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/ue_slice_mbr.h b/lib/sbi/openapi/model/ue_slice_mbr.h new file mode 100644 index 000000000..4c823ff39 --- /dev/null +++ b/lib/sbi/openapi/model/ue_slice_mbr.h @@ -0,0 +1,44 @@ +/* + * ue_slice_mbr.h + * + * Contains a UE-Slice-MBR and the related information. + */ + +#ifndef _OpenAPI_ue_slice_mbr_H_ +#define _OpenAPI_ue_slice_mbr_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "slice_mbr.h" +#include "snssai.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_ue_slice_mbr_s OpenAPI_ue_slice_mbr_t; +typedef struct OpenAPI_ue_slice_mbr_s { + OpenAPI_list_t* slice_mbr; + struct OpenAPI_snssai_s *serving_snssai; + struct OpenAPI_snssai_s *mapped_home_snssai; +} OpenAPI_ue_slice_mbr_t; + +OpenAPI_ue_slice_mbr_t *OpenAPI_ue_slice_mbr_create( + OpenAPI_list_t* slice_mbr, + OpenAPI_snssai_t *serving_snssai, + OpenAPI_snssai_t *mapped_home_snssai +); +void OpenAPI_ue_slice_mbr_free(OpenAPI_ue_slice_mbr_t *ue_slice_mbr); +OpenAPI_ue_slice_mbr_t *OpenAPI_ue_slice_mbr_parseFromJSON(cJSON *ue_slice_mbrJSON); +cJSON *OpenAPI_ue_slice_mbr_convertToJSON(OpenAPI_ue_slice_mbr_t *ue_slice_mbr); +OpenAPI_ue_slice_mbr_t *OpenAPI_ue_slice_mbr_copy(OpenAPI_ue_slice_mbr_t *dst, OpenAPI_ue_slice_mbr_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_ue_slice_mbr_H_ */ + diff --git a/lib/sbi/openapi/model/ue_type.c b/lib/sbi/openapi/model/ue_type.c new file mode 100644 index 000000000..0918ddbde --- /dev/null +++ b/lib/sbi/openapi/model/ue_type.c @@ -0,0 +1,87 @@ + +#include +#include +#include +#include "ue_type.h" + +OpenAPI_ue_type_t *OpenAPI_ue_type_create( +) +{ + OpenAPI_ue_type_t *ue_type_local_var = ogs_malloc(sizeof(OpenAPI_ue_type_t)); + ogs_assert(ue_type_local_var); + + + return ue_type_local_var; +} + +void OpenAPI_ue_type_free(OpenAPI_ue_type_t *ue_type) +{ + OpenAPI_lnode_t *node = NULL; + + if (NULL == ue_type) { + return; + } + ogs_free(ue_type); +} + +cJSON *OpenAPI_ue_type_convertToJSON(OpenAPI_ue_type_t *ue_type) +{ + cJSON *item = NULL; + OpenAPI_lnode_t *node = NULL; + + if (ue_type == NULL) { + ogs_error("OpenAPI_ue_type_convertToJSON() failed [UeType]"); + return NULL; + } + + item = cJSON_CreateObject(); +end: + return item; +} + +OpenAPI_ue_type_t *OpenAPI_ue_type_parseFromJSON(cJSON *ue_typeJSON) +{ + OpenAPI_ue_type_t *ue_type_local_var = NULL; + OpenAPI_lnode_t *node = NULL; + ue_type_local_var = OpenAPI_ue_type_create ( + ); + + return ue_type_local_var; +end: + return NULL; +} + +OpenAPI_ue_type_t *OpenAPI_ue_type_copy(OpenAPI_ue_type_t *dst, OpenAPI_ue_type_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_ue_type_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_ue_type_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_ue_type_free(dst); + dst = OpenAPI_ue_type_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/ue_type.h b/lib/sbi/openapi/model/ue_type.h new file mode 100644 index 000000000..1ebf0d384 --- /dev/null +++ b/lib/sbi/openapi/model/ue_type.h @@ -0,0 +1,37 @@ +/* + * ue_type.h + * + * Describes the type of UEs + */ + +#ifndef _OpenAPI_ue_type_H_ +#define _OpenAPI_ue_type_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "ue_type_any_of.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_ue_type_s OpenAPI_ue_type_t; +typedef struct OpenAPI_ue_type_s { +} OpenAPI_ue_type_t; + +OpenAPI_ue_type_t *OpenAPI_ue_type_create( +); +void OpenAPI_ue_type_free(OpenAPI_ue_type_t *ue_type); +OpenAPI_ue_type_t *OpenAPI_ue_type_parseFromJSON(cJSON *ue_typeJSON); +cJSON *OpenAPI_ue_type_convertToJSON(OpenAPI_ue_type_t *ue_type); +OpenAPI_ue_type_t *OpenAPI_ue_type_copy(OpenAPI_ue_type_t *dst, OpenAPI_ue_type_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_ue_type_H_ */ + diff --git a/lib/sbi/openapi/model/ue_type_any_of.c b/lib/sbi/openapi/model/ue_type_any_of.c new file mode 100644 index 000000000..c69559b77 --- /dev/null +++ b/lib/sbi/openapi/model/ue_type_any_of.c @@ -0,0 +1,30 @@ + +#include +#include +#include +#include "ue_type_any_of.h" + +char* OpenAPI_ue_type_any_of_ToString(OpenAPI_ue_type_any_of_e ue_type_any_of) +{ + const char *ue_type_any_ofArray[] = { "NULL", "AERIAL_UE" }; + size_t sizeofArray = sizeof(ue_type_any_ofArray) / sizeof(ue_type_any_ofArray[0]); + if (ue_type_any_of < sizeofArray) + return (char *)ue_type_any_ofArray[ue_type_any_of]; + else + return (char *)"Unknown"; +} + +OpenAPI_ue_type_any_of_e OpenAPI_ue_type_any_of_FromString(char* ue_type_any_of) +{ + int stringToReturn = 0; + const char *ue_type_any_ofArray[] = { "NULL", "AERIAL_UE" }; + size_t sizeofArray = sizeof(ue_type_any_ofArray) / sizeof(ue_type_any_ofArray[0]); + while (stringToReturn < sizeofArray) { + if (strcmp(ue_type_any_of, ue_type_any_ofArray[stringToReturn]) == 0) { + return stringToReturn; + } + stringToReturn++; + } + return 0; +} + diff --git a/lib/sbi/openapi/model/ue_type_any_of.h b/lib/sbi/openapi/model/ue_type_any_of.h new file mode 100644 index 000000000..b39972718 --- /dev/null +++ b/lib/sbi/openapi/model/ue_type_any_of.h @@ -0,0 +1,31 @@ +/* + * ue_type_any_of.h + * + * + */ + +#ifndef _OpenAPI_ue_type_any_of_H_ +#define _OpenAPI_ue_type_any_of_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef enum { OpenAPI_ue_type_any_of_NULL = 0, OpenAPI_ue_type_any_of_AERIAL_UE } OpenAPI_ue_type_any_of_e; + +char* OpenAPI_ue_type_any_of_ToString(OpenAPI_ue_type_any_of_e ue_type_any_of); + +OpenAPI_ue_type_any_of_e OpenAPI_ue_type_any_of_FromString(char* ue_type_any_of); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_ue_type_any_of_H_ */ + diff --git a/lib/sbi/openapi/model/ue_update_status.h b/lib/sbi/openapi/model/ue_update_status.h index f63b99bad..b917a583e 100644 --- a/lib/sbi/openapi/model/ue_update_status.h +++ b/lib/sbi/openapi/model/ue_update_status.h @@ -1,7 +1,7 @@ /* * ue_update_status.h * - * + * Status of the procedure. */ #ifndef _OpenAPI_ue_update_status_H_ diff --git a/lib/sbi/openapi/model/ulcl_bp_information.h b/lib/sbi/openapi/model/ulcl_bp_information.h index 93636c401..3e3eab90b 100644 --- a/lib/sbi/openapi/model/ulcl_bp_information.h +++ b/lib/sbi/openapi/model/ulcl_bp_information.h @@ -1,7 +1,7 @@ /* * ulcl_bp_information.h * - * + * UL CL or BP Information */ #ifndef _OpenAPI_ulcl_bp_information_H_ diff --git a/lib/sbi/openapi/model/umt_time.c b/lib/sbi/openapi/model/umt_time.c new file mode 100644 index 000000000..c61d90427 --- /dev/null +++ b/lib/sbi/openapi/model/umt_time.c @@ -0,0 +1,134 @@ + +#include +#include +#include +#include "umt_time.h" + +OpenAPI_umt_time_t *OpenAPI_umt_time_create( + char *time_of_day, + int day_of_week +) +{ + OpenAPI_umt_time_t *umt_time_local_var = ogs_malloc(sizeof(OpenAPI_umt_time_t)); + ogs_assert(umt_time_local_var); + + umt_time_local_var->time_of_day = time_of_day; + umt_time_local_var->day_of_week = day_of_week; + + return umt_time_local_var; +} + +void OpenAPI_umt_time_free(OpenAPI_umt_time_t *umt_time) +{ + OpenAPI_lnode_t *node = NULL; + + if (NULL == umt_time) { + return; + } + if (umt_time->time_of_day) { + ogs_free(umt_time->time_of_day); + umt_time->time_of_day = NULL; + } + ogs_free(umt_time); +} + +cJSON *OpenAPI_umt_time_convertToJSON(OpenAPI_umt_time_t *umt_time) +{ + cJSON *item = NULL; + OpenAPI_lnode_t *node = NULL; + + if (umt_time == NULL) { + ogs_error("OpenAPI_umt_time_convertToJSON() failed [UmtTime]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (!umt_time->time_of_day) { + ogs_error("OpenAPI_umt_time_convertToJSON() failed [time_of_day]"); + return NULL; + } + if (cJSON_AddStringToObject(item, "timeOfDay", umt_time->time_of_day) == NULL) { + ogs_error("OpenAPI_umt_time_convertToJSON() failed [time_of_day]"); + goto end; + } + + if (cJSON_AddNumberToObject(item, "dayOfWeek", umt_time->day_of_week) == NULL) { + ogs_error("OpenAPI_umt_time_convertToJSON() failed [day_of_week]"); + goto end; + } + +end: + return item; +} + +OpenAPI_umt_time_t *OpenAPI_umt_time_parseFromJSON(cJSON *umt_timeJSON) +{ + OpenAPI_umt_time_t *umt_time_local_var = NULL; + OpenAPI_lnode_t *node = NULL; + cJSON *time_of_day = NULL; + cJSON *day_of_week = NULL; + time_of_day = cJSON_GetObjectItemCaseSensitive(umt_timeJSON, "timeOfDay"); + if (!time_of_day) { + ogs_error("OpenAPI_umt_time_parseFromJSON() failed [time_of_day]"); + goto end; + } + if (!cJSON_IsString(time_of_day)) { + ogs_error("OpenAPI_umt_time_parseFromJSON() failed [time_of_day]"); + goto end; + } + + day_of_week = cJSON_GetObjectItemCaseSensitive(umt_timeJSON, "dayOfWeek"); + if (!day_of_week) { + ogs_error("OpenAPI_umt_time_parseFromJSON() failed [day_of_week]"); + goto end; + } + if (!cJSON_IsNumber(day_of_week)) { + ogs_error("OpenAPI_umt_time_parseFromJSON() failed [day_of_week]"); + goto end; + } + + umt_time_local_var = OpenAPI_umt_time_create ( + ogs_strdup(time_of_day->valuestring), + + day_of_week->valuedouble + ); + + return umt_time_local_var; +end: + return NULL; +} + +OpenAPI_umt_time_t *OpenAPI_umt_time_copy(OpenAPI_umt_time_t *dst, OpenAPI_umt_time_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_umt_time_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_umt_time_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_umt_time_free(dst); + dst = OpenAPI_umt_time_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/umt_time.h b/lib/sbi/openapi/model/umt_time.h new file mode 100644 index 000000000..31c2e467f --- /dev/null +++ b/lib/sbi/openapi/model/umt_time.h @@ -0,0 +1,40 @@ +/* + * umt_time.h + * + * + */ + +#ifndef _OpenAPI_umt_time_H_ +#define _OpenAPI_umt_time_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_umt_time_s OpenAPI_umt_time_t; +typedef struct OpenAPI_umt_time_s { + char *time_of_day; + int day_of_week; +} OpenAPI_umt_time_t; + +OpenAPI_umt_time_t *OpenAPI_umt_time_create( + char *time_of_day, + int day_of_week +); +void OpenAPI_umt_time_free(OpenAPI_umt_time_t *umt_time); +OpenAPI_umt_time_t *OpenAPI_umt_time_parseFromJSON(cJSON *umt_timeJSON); +cJSON *OpenAPI_umt_time_convertToJSON(OpenAPI_umt_time_t *umt_time); +OpenAPI_umt_time_t *OpenAPI_umt_time_copy(OpenAPI_umt_time_t *dst, OpenAPI_umt_time_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_umt_time_H_ */ + diff --git a/lib/sbi/openapi/model/umt_time_1.c b/lib/sbi/openapi/model/umt_time_1.c new file mode 100644 index 000000000..0f8f7bc3c --- /dev/null +++ b/lib/sbi/openapi/model/umt_time_1.c @@ -0,0 +1,134 @@ + +#include +#include +#include +#include "umt_time_1.h" + +OpenAPI_umt_time_1_t *OpenAPI_umt_time_1_create( + char *time_of_day, + int day_of_week +) +{ + OpenAPI_umt_time_1_t *umt_time_1_local_var = ogs_malloc(sizeof(OpenAPI_umt_time_1_t)); + ogs_assert(umt_time_1_local_var); + + umt_time_1_local_var->time_of_day = time_of_day; + umt_time_1_local_var->day_of_week = day_of_week; + + return umt_time_1_local_var; +} + +void OpenAPI_umt_time_1_free(OpenAPI_umt_time_1_t *umt_time_1) +{ + OpenAPI_lnode_t *node = NULL; + + if (NULL == umt_time_1) { + return; + } + if (umt_time_1->time_of_day) { + ogs_free(umt_time_1->time_of_day); + umt_time_1->time_of_day = NULL; + } + ogs_free(umt_time_1); +} + +cJSON *OpenAPI_umt_time_1_convertToJSON(OpenAPI_umt_time_1_t *umt_time_1) +{ + cJSON *item = NULL; + OpenAPI_lnode_t *node = NULL; + + if (umt_time_1 == NULL) { + ogs_error("OpenAPI_umt_time_1_convertToJSON() failed [UmtTime_1]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (!umt_time_1->time_of_day) { + ogs_error("OpenAPI_umt_time_1_convertToJSON() failed [time_of_day]"); + return NULL; + } + if (cJSON_AddStringToObject(item, "timeOfDay", umt_time_1->time_of_day) == NULL) { + ogs_error("OpenAPI_umt_time_1_convertToJSON() failed [time_of_day]"); + goto end; + } + + if (cJSON_AddNumberToObject(item, "dayOfWeek", umt_time_1->day_of_week) == NULL) { + ogs_error("OpenAPI_umt_time_1_convertToJSON() failed [day_of_week]"); + goto end; + } + +end: + return item; +} + +OpenAPI_umt_time_1_t *OpenAPI_umt_time_1_parseFromJSON(cJSON *umt_time_1JSON) +{ + OpenAPI_umt_time_1_t *umt_time_1_local_var = NULL; + OpenAPI_lnode_t *node = NULL; + cJSON *time_of_day = NULL; + cJSON *day_of_week = NULL; + time_of_day = cJSON_GetObjectItemCaseSensitive(umt_time_1JSON, "timeOfDay"); + if (!time_of_day) { + ogs_error("OpenAPI_umt_time_1_parseFromJSON() failed [time_of_day]"); + goto end; + } + if (!cJSON_IsString(time_of_day)) { + ogs_error("OpenAPI_umt_time_1_parseFromJSON() failed [time_of_day]"); + goto end; + } + + day_of_week = cJSON_GetObjectItemCaseSensitive(umt_time_1JSON, "dayOfWeek"); + if (!day_of_week) { + ogs_error("OpenAPI_umt_time_1_parseFromJSON() failed [day_of_week]"); + goto end; + } + if (!cJSON_IsNumber(day_of_week)) { + ogs_error("OpenAPI_umt_time_1_parseFromJSON() failed [day_of_week]"); + goto end; + } + + umt_time_1_local_var = OpenAPI_umt_time_1_create ( + ogs_strdup(time_of_day->valuestring), + + day_of_week->valuedouble + ); + + return umt_time_1_local_var; +end: + return NULL; +} + +OpenAPI_umt_time_1_t *OpenAPI_umt_time_1_copy(OpenAPI_umt_time_1_t *dst, OpenAPI_umt_time_1_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_umt_time_1_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_umt_time_1_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_umt_time_1_free(dst); + dst = OpenAPI_umt_time_1_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/umt_time_1.h b/lib/sbi/openapi/model/umt_time_1.h new file mode 100644 index 000000000..6c2c1b4f6 --- /dev/null +++ b/lib/sbi/openapi/model/umt_time_1.h @@ -0,0 +1,40 @@ +/* + * umt_time_1.h + * + * + */ + +#ifndef _OpenAPI_umt_time_1_H_ +#define _OpenAPI_umt_time_1_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_umt_time_1_s OpenAPI_umt_time_1_t; +typedef struct OpenAPI_umt_time_1_s { + char *time_of_day; + int day_of_week; +} OpenAPI_umt_time_1_t; + +OpenAPI_umt_time_1_t *OpenAPI_umt_time_1_create( + char *time_of_day, + int day_of_week +); +void OpenAPI_umt_time_1_free(OpenAPI_umt_time_1_t *umt_time_1); +OpenAPI_umt_time_1_t *OpenAPI_umt_time_1_parseFromJSON(cJSON *umt_time_1JSON); +cJSON *OpenAPI_umt_time_1_convertToJSON(OpenAPI_umt_time_1_t *umt_time_1); +OpenAPI_umt_time_1_t *OpenAPI_umt_time_1_copy(OpenAPI_umt_time_1_t *dst, OpenAPI_umt_time_1_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_umt_time_1_H_ */ + diff --git a/lib/sbi/openapi/model/un_trust_af_info.c b/lib/sbi/openapi/model/un_trust_af_info.c new file mode 100644 index 000000000..e9815146d --- /dev/null +++ b/lib/sbi/openapi/model/un_trust_af_info.c @@ -0,0 +1,196 @@ + +#include +#include +#include +#include "un_trust_af_info.h" + +OpenAPI_un_trust_af_info_t *OpenAPI_un_trust_af_info_create( + char *af_id, + OpenAPI_list_t *s_nssai_info_list, + bool is_mapping_ind, + int mapping_ind +) +{ + OpenAPI_un_trust_af_info_t *un_trust_af_info_local_var = ogs_malloc(sizeof(OpenAPI_un_trust_af_info_t)); + ogs_assert(un_trust_af_info_local_var); + + un_trust_af_info_local_var->af_id = af_id; + un_trust_af_info_local_var->s_nssai_info_list = s_nssai_info_list; + un_trust_af_info_local_var->is_mapping_ind = is_mapping_ind; + un_trust_af_info_local_var->mapping_ind = mapping_ind; + + return un_trust_af_info_local_var; +} + +void OpenAPI_un_trust_af_info_free(OpenAPI_un_trust_af_info_t *un_trust_af_info) +{ + OpenAPI_lnode_t *node = NULL; + + if (NULL == un_trust_af_info) { + return; + } + if (un_trust_af_info->af_id) { + ogs_free(un_trust_af_info->af_id); + un_trust_af_info->af_id = NULL; + } + if (un_trust_af_info->s_nssai_info_list) { + OpenAPI_list_for_each(un_trust_af_info->s_nssai_info_list, node) { + OpenAPI_snssai_info_item_free(node->data); + } + OpenAPI_list_free(un_trust_af_info->s_nssai_info_list); + un_trust_af_info->s_nssai_info_list = NULL; + } + ogs_free(un_trust_af_info); +} + +cJSON *OpenAPI_un_trust_af_info_convertToJSON(OpenAPI_un_trust_af_info_t *un_trust_af_info) +{ + cJSON *item = NULL; + OpenAPI_lnode_t *node = NULL; + + if (un_trust_af_info == NULL) { + ogs_error("OpenAPI_un_trust_af_info_convertToJSON() failed [UnTrustAfInfo]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (!un_trust_af_info->af_id) { + ogs_error("OpenAPI_un_trust_af_info_convertToJSON() failed [af_id]"); + return NULL; + } + if (cJSON_AddStringToObject(item, "afId", un_trust_af_info->af_id) == NULL) { + ogs_error("OpenAPI_un_trust_af_info_convertToJSON() failed [af_id]"); + goto end; + } + + if (un_trust_af_info->s_nssai_info_list) { + cJSON *s_nssai_info_listList = cJSON_AddArrayToObject(item, "sNssaiInfoList"); + if (s_nssai_info_listList == NULL) { + ogs_error("OpenAPI_un_trust_af_info_convertToJSON() failed [s_nssai_info_list]"); + goto end; + } + OpenAPI_list_for_each(un_trust_af_info->s_nssai_info_list, node) { + cJSON *itemLocal = OpenAPI_snssai_info_item_convertToJSON(node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_un_trust_af_info_convertToJSON() failed [s_nssai_info_list]"); + goto end; + } + cJSON_AddItemToArray(s_nssai_info_listList, itemLocal); + } + } + + if (un_trust_af_info->is_mapping_ind) { + if (cJSON_AddBoolToObject(item, "mappingInd", un_trust_af_info->mapping_ind) == NULL) { + ogs_error("OpenAPI_un_trust_af_info_convertToJSON() failed [mapping_ind]"); + goto end; + } + } + +end: + return item; +} + +OpenAPI_un_trust_af_info_t *OpenAPI_un_trust_af_info_parseFromJSON(cJSON *un_trust_af_infoJSON) +{ + OpenAPI_un_trust_af_info_t *un_trust_af_info_local_var = NULL; + OpenAPI_lnode_t *node = NULL; + cJSON *af_id = NULL; + cJSON *s_nssai_info_list = NULL; + OpenAPI_list_t *s_nssai_info_listList = NULL; + cJSON *mapping_ind = NULL; + af_id = cJSON_GetObjectItemCaseSensitive(un_trust_af_infoJSON, "afId"); + if (!af_id) { + ogs_error("OpenAPI_un_trust_af_info_parseFromJSON() failed [af_id]"); + goto end; + } + if (!cJSON_IsString(af_id)) { + ogs_error("OpenAPI_un_trust_af_info_parseFromJSON() failed [af_id]"); + goto end; + } + + s_nssai_info_list = cJSON_GetObjectItemCaseSensitive(un_trust_af_infoJSON, "sNssaiInfoList"); + if (s_nssai_info_list) { + cJSON *s_nssai_info_list_local = NULL; + if (!cJSON_IsArray(s_nssai_info_list)) { + ogs_error("OpenAPI_un_trust_af_info_parseFromJSON() failed [s_nssai_info_list]"); + goto end; + } + + s_nssai_info_listList = OpenAPI_list_create(); + + cJSON_ArrayForEach(s_nssai_info_list_local, s_nssai_info_list) { + if (!cJSON_IsObject(s_nssai_info_list_local)) { + ogs_error("OpenAPI_un_trust_af_info_parseFromJSON() failed [s_nssai_info_list]"); + goto end; + } + OpenAPI_snssai_info_item_t *s_nssai_info_listItem = OpenAPI_snssai_info_item_parseFromJSON(s_nssai_info_list_local); + if (!s_nssai_info_listItem) { + ogs_error("No s_nssai_info_listItem"); + OpenAPI_list_free(s_nssai_info_listList); + goto end; + } + OpenAPI_list_add(s_nssai_info_listList, s_nssai_info_listItem); + } + } + + mapping_ind = cJSON_GetObjectItemCaseSensitive(un_trust_af_infoJSON, "mappingInd"); + if (mapping_ind) { + if (!cJSON_IsBool(mapping_ind)) { + ogs_error("OpenAPI_un_trust_af_info_parseFromJSON() failed [mapping_ind]"); + goto end; + } + } + + un_trust_af_info_local_var = OpenAPI_un_trust_af_info_create ( + ogs_strdup(af_id->valuestring), + s_nssai_info_list ? s_nssai_info_listList : NULL, + mapping_ind ? true : false, + mapping_ind ? mapping_ind->valueint : 0 + ); + + return un_trust_af_info_local_var; +end: + if (s_nssai_info_listList) { + OpenAPI_list_for_each(s_nssai_info_listList, node) { + OpenAPI_snssai_info_item_free(node->data); + } + OpenAPI_list_free(s_nssai_info_listList); + s_nssai_info_listList = NULL; + } + return NULL; +} + +OpenAPI_un_trust_af_info_t *OpenAPI_un_trust_af_info_copy(OpenAPI_un_trust_af_info_t *dst, OpenAPI_un_trust_af_info_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_un_trust_af_info_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_un_trust_af_info_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_un_trust_af_info_free(dst); + dst = OpenAPI_un_trust_af_info_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/un_trust_af_info.h b/lib/sbi/openapi/model/un_trust_af_info.h new file mode 100644 index 000000000..5d128a097 --- /dev/null +++ b/lib/sbi/openapi/model/un_trust_af_info.h @@ -0,0 +1,45 @@ +/* + * un_trust_af_info.h + * + * Information of a untrusted AF Instance + */ + +#ifndef _OpenAPI_un_trust_af_info_H_ +#define _OpenAPI_un_trust_af_info_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "snssai_info_item.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_un_trust_af_info_s OpenAPI_un_trust_af_info_t; +typedef struct OpenAPI_un_trust_af_info_s { + char *af_id; + OpenAPI_list_t *s_nssai_info_list; + bool is_mapping_ind; + int mapping_ind; +} OpenAPI_un_trust_af_info_t; + +OpenAPI_un_trust_af_info_t *OpenAPI_un_trust_af_info_create( + char *af_id, + OpenAPI_list_t *s_nssai_info_list, + bool is_mapping_ind, + int mapping_ind +); +void OpenAPI_un_trust_af_info_free(OpenAPI_un_trust_af_info_t *un_trust_af_info); +OpenAPI_un_trust_af_info_t *OpenAPI_un_trust_af_info_parseFromJSON(cJSON *un_trust_af_infoJSON); +cJSON *OpenAPI_un_trust_af_info_convertToJSON(OpenAPI_un_trust_af_info_t *un_trust_af_info); +OpenAPI_un_trust_af_info_t *OpenAPI_un_trust_af_info_copy(OpenAPI_un_trust_af_info_t *dst, OpenAPI_un_trust_af_info_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_un_trust_af_info_H_ */ + diff --git a/lib/sbi/openapi/model/uncertainty_ellipse.h b/lib/sbi/openapi/model/uncertainty_ellipse.h index 8fb855851..a134aec78 100644 --- a/lib/sbi/openapi/model/uncertainty_ellipse.h +++ b/lib/sbi/openapi/model/uncertainty_ellipse.h @@ -1,7 +1,7 @@ /* * uncertainty_ellipse.h * - * + * Ellipse with uncertainty. */ #ifndef _OpenAPI_uncertainty_ellipse_H_ diff --git a/lib/sbi/openapi/model/uncertainty_ellipsoid.c b/lib/sbi/openapi/model/uncertainty_ellipsoid.c new file mode 100644 index 000000000..7bc45e9d9 --- /dev/null +++ b/lib/sbi/openapi/model/uncertainty_ellipsoid.c @@ -0,0 +1,167 @@ + +#include +#include +#include +#include "uncertainty_ellipsoid.h" + +OpenAPI_uncertainty_ellipsoid_t *OpenAPI_uncertainty_ellipsoid_create( + float semi_major, + float semi_minor, + float vertical, + int orientation_major +) +{ + OpenAPI_uncertainty_ellipsoid_t *uncertainty_ellipsoid_local_var = ogs_malloc(sizeof(OpenAPI_uncertainty_ellipsoid_t)); + ogs_assert(uncertainty_ellipsoid_local_var); + + uncertainty_ellipsoid_local_var->semi_major = semi_major; + uncertainty_ellipsoid_local_var->semi_minor = semi_minor; + uncertainty_ellipsoid_local_var->vertical = vertical; + uncertainty_ellipsoid_local_var->orientation_major = orientation_major; + + return uncertainty_ellipsoid_local_var; +} + +void OpenAPI_uncertainty_ellipsoid_free(OpenAPI_uncertainty_ellipsoid_t *uncertainty_ellipsoid) +{ + OpenAPI_lnode_t *node = NULL; + + if (NULL == uncertainty_ellipsoid) { + return; + } + ogs_free(uncertainty_ellipsoid); +} + +cJSON *OpenAPI_uncertainty_ellipsoid_convertToJSON(OpenAPI_uncertainty_ellipsoid_t *uncertainty_ellipsoid) +{ + cJSON *item = NULL; + OpenAPI_lnode_t *node = NULL; + + if (uncertainty_ellipsoid == NULL) { + ogs_error("OpenAPI_uncertainty_ellipsoid_convertToJSON() failed [UncertaintyEllipsoid]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (cJSON_AddNumberToObject(item, "semiMajor", uncertainty_ellipsoid->semi_major) == NULL) { + ogs_error("OpenAPI_uncertainty_ellipsoid_convertToJSON() failed [semi_major]"); + goto end; + } + + if (cJSON_AddNumberToObject(item, "semiMinor", uncertainty_ellipsoid->semi_minor) == NULL) { + ogs_error("OpenAPI_uncertainty_ellipsoid_convertToJSON() failed [semi_minor]"); + goto end; + } + + if (cJSON_AddNumberToObject(item, "vertical", uncertainty_ellipsoid->vertical) == NULL) { + ogs_error("OpenAPI_uncertainty_ellipsoid_convertToJSON() failed [vertical]"); + goto end; + } + + if (cJSON_AddNumberToObject(item, "orientationMajor", uncertainty_ellipsoid->orientation_major) == NULL) { + ogs_error("OpenAPI_uncertainty_ellipsoid_convertToJSON() failed [orientation_major]"); + goto end; + } + +end: + return item; +} + +OpenAPI_uncertainty_ellipsoid_t *OpenAPI_uncertainty_ellipsoid_parseFromJSON(cJSON *uncertainty_ellipsoidJSON) +{ + OpenAPI_uncertainty_ellipsoid_t *uncertainty_ellipsoid_local_var = NULL; + OpenAPI_lnode_t *node = NULL; + cJSON *semi_major = NULL; + cJSON *semi_minor = NULL; + cJSON *vertical = NULL; + cJSON *orientation_major = NULL; + semi_major = cJSON_GetObjectItemCaseSensitive(uncertainty_ellipsoidJSON, "semiMajor"); + if (!semi_major) { + ogs_error("OpenAPI_uncertainty_ellipsoid_parseFromJSON() failed [semi_major]"); + goto end; + } + if (!cJSON_IsNumber(semi_major)) { + ogs_error("OpenAPI_uncertainty_ellipsoid_parseFromJSON() failed [semi_major]"); + goto end; + } + + semi_minor = cJSON_GetObjectItemCaseSensitive(uncertainty_ellipsoidJSON, "semiMinor"); + if (!semi_minor) { + ogs_error("OpenAPI_uncertainty_ellipsoid_parseFromJSON() failed [semi_minor]"); + goto end; + } + if (!cJSON_IsNumber(semi_minor)) { + ogs_error("OpenAPI_uncertainty_ellipsoid_parseFromJSON() failed [semi_minor]"); + goto end; + } + + vertical = cJSON_GetObjectItemCaseSensitive(uncertainty_ellipsoidJSON, "vertical"); + if (!vertical) { + ogs_error("OpenAPI_uncertainty_ellipsoid_parseFromJSON() failed [vertical]"); + goto end; + } + if (!cJSON_IsNumber(vertical)) { + ogs_error("OpenAPI_uncertainty_ellipsoid_parseFromJSON() failed [vertical]"); + goto end; + } + + orientation_major = cJSON_GetObjectItemCaseSensitive(uncertainty_ellipsoidJSON, "orientationMajor"); + if (!orientation_major) { + ogs_error("OpenAPI_uncertainty_ellipsoid_parseFromJSON() failed [orientation_major]"); + goto end; + } + if (!cJSON_IsNumber(orientation_major)) { + ogs_error("OpenAPI_uncertainty_ellipsoid_parseFromJSON() failed [orientation_major]"); + goto end; + } + + uncertainty_ellipsoid_local_var = OpenAPI_uncertainty_ellipsoid_create ( + + semi_major->valuedouble, + + semi_minor->valuedouble, + + vertical->valuedouble, + + orientation_major->valuedouble + ); + + return uncertainty_ellipsoid_local_var; +end: + return NULL; +} + +OpenAPI_uncertainty_ellipsoid_t *OpenAPI_uncertainty_ellipsoid_copy(OpenAPI_uncertainty_ellipsoid_t *dst, OpenAPI_uncertainty_ellipsoid_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_uncertainty_ellipsoid_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_uncertainty_ellipsoid_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_uncertainty_ellipsoid_free(dst); + dst = OpenAPI_uncertainty_ellipsoid_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/uncertainty_ellipsoid.h b/lib/sbi/openapi/model/uncertainty_ellipsoid.h new file mode 100644 index 000000000..ae28a5e36 --- /dev/null +++ b/lib/sbi/openapi/model/uncertainty_ellipsoid.h @@ -0,0 +1,44 @@ +/* + * uncertainty_ellipsoid.h + * + * Ellipsoid with uncertainty + */ + +#ifndef _OpenAPI_uncertainty_ellipsoid_H_ +#define _OpenAPI_uncertainty_ellipsoid_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_uncertainty_ellipsoid_s OpenAPI_uncertainty_ellipsoid_t; +typedef struct OpenAPI_uncertainty_ellipsoid_s { + float semi_major; + float semi_minor; + float vertical; + int orientation_major; +} OpenAPI_uncertainty_ellipsoid_t; + +OpenAPI_uncertainty_ellipsoid_t *OpenAPI_uncertainty_ellipsoid_create( + float semi_major, + float semi_minor, + float vertical, + int orientation_major +); +void OpenAPI_uncertainty_ellipsoid_free(OpenAPI_uncertainty_ellipsoid_t *uncertainty_ellipsoid); +OpenAPI_uncertainty_ellipsoid_t *OpenAPI_uncertainty_ellipsoid_parseFromJSON(cJSON *uncertainty_ellipsoidJSON); +cJSON *OpenAPI_uncertainty_ellipsoid_convertToJSON(OpenAPI_uncertainty_ellipsoid_t *uncertainty_ellipsoid); +OpenAPI_uncertainty_ellipsoid_t *OpenAPI_uncertainty_ellipsoid_copy(OpenAPI_uncertainty_ellipsoid_t *dst, OpenAPI_uncertainty_ellipsoid_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_uncertainty_ellipsoid_H_ */ + diff --git a/lib/sbi/openapi/model/unrelated_class_1.c b/lib/sbi/openapi/model/unrelated_class_1.c deleted file mode 100644 index 44548128d..000000000 --- a/lib/sbi/openapi/model/unrelated_class_1.c +++ /dev/null @@ -1,213 +0,0 @@ - -#include -#include -#include -#include "unrelated_class_1.h" - -OpenAPI_unrelated_class_1_t *OpenAPI_unrelated_class_1_create( - OpenAPI_default_unrelated_class_1_t *default_unrelated_class, - OpenAPI_external_unrelated_class_t *external_unrelated_class, - OpenAPI_list_t *service_type_unrelated_classes -) -{ - OpenAPI_unrelated_class_1_t *unrelated_class_1_local_var = ogs_malloc(sizeof(OpenAPI_unrelated_class_1_t)); - ogs_assert(unrelated_class_1_local_var); - - unrelated_class_1_local_var->default_unrelated_class = default_unrelated_class; - unrelated_class_1_local_var->external_unrelated_class = external_unrelated_class; - unrelated_class_1_local_var->service_type_unrelated_classes = service_type_unrelated_classes; - - return unrelated_class_1_local_var; -} - -void OpenAPI_unrelated_class_1_free(OpenAPI_unrelated_class_1_t *unrelated_class_1) -{ - OpenAPI_lnode_t *node = NULL; - - if (NULL == unrelated_class_1) { - return; - } - if (unrelated_class_1->default_unrelated_class) { - OpenAPI_default_unrelated_class_1_free(unrelated_class_1->default_unrelated_class); - unrelated_class_1->default_unrelated_class = NULL; - } - if (unrelated_class_1->external_unrelated_class) { - OpenAPI_external_unrelated_class_free(unrelated_class_1->external_unrelated_class); - unrelated_class_1->external_unrelated_class = NULL; - } - if (unrelated_class_1->service_type_unrelated_classes) { - OpenAPI_list_for_each(unrelated_class_1->service_type_unrelated_classes, node) { - OpenAPI_service_type_unrelated_class_1_free(node->data); - } - OpenAPI_list_free(unrelated_class_1->service_type_unrelated_classes); - unrelated_class_1->service_type_unrelated_classes = NULL; - } - ogs_free(unrelated_class_1); -} - -cJSON *OpenAPI_unrelated_class_1_convertToJSON(OpenAPI_unrelated_class_1_t *unrelated_class_1) -{ - cJSON *item = NULL; - OpenAPI_lnode_t *node = NULL; - - if (unrelated_class_1 == NULL) { - ogs_error("OpenAPI_unrelated_class_1_convertToJSON() failed [UnrelatedClass_1]"); - return NULL; - } - - item = cJSON_CreateObject(); - if (!unrelated_class_1->default_unrelated_class) { - ogs_error("OpenAPI_unrelated_class_1_convertToJSON() failed [default_unrelated_class]"); - return NULL; - } - cJSON *default_unrelated_class_local_JSON = OpenAPI_default_unrelated_class_1_convertToJSON(unrelated_class_1->default_unrelated_class); - if (default_unrelated_class_local_JSON == NULL) { - ogs_error("OpenAPI_unrelated_class_1_convertToJSON() failed [default_unrelated_class]"); - goto end; - } - cJSON_AddItemToObject(item, "defaultUnrelatedClass", default_unrelated_class_local_JSON); - if (item->child == NULL) { - ogs_error("OpenAPI_unrelated_class_1_convertToJSON() failed [default_unrelated_class]"); - goto end; - } - - if (unrelated_class_1->external_unrelated_class) { - cJSON *external_unrelated_class_local_JSON = OpenAPI_external_unrelated_class_convertToJSON(unrelated_class_1->external_unrelated_class); - if (external_unrelated_class_local_JSON == NULL) { - ogs_error("OpenAPI_unrelated_class_1_convertToJSON() failed [external_unrelated_class]"); - goto end; - } - cJSON_AddItemToObject(item, "externalUnrelatedClass", external_unrelated_class_local_JSON); - if (item->child == NULL) { - ogs_error("OpenAPI_unrelated_class_1_convertToJSON() failed [external_unrelated_class]"); - goto end; - } - } - - if (unrelated_class_1->service_type_unrelated_classes) { - cJSON *service_type_unrelated_classesList = cJSON_AddArrayToObject(item, "serviceTypeUnrelatedClasses"); - if (service_type_unrelated_classesList == NULL) { - ogs_error("OpenAPI_unrelated_class_1_convertToJSON() failed [service_type_unrelated_classes]"); - goto end; - } - OpenAPI_list_for_each(unrelated_class_1->service_type_unrelated_classes, node) { - cJSON *itemLocal = OpenAPI_service_type_unrelated_class_1_convertToJSON(node->data); - if (itemLocal == NULL) { - ogs_error("OpenAPI_unrelated_class_1_convertToJSON() failed [service_type_unrelated_classes]"); - goto end; - } - cJSON_AddItemToArray(service_type_unrelated_classesList, itemLocal); - } - } - -end: - return item; -} - -OpenAPI_unrelated_class_1_t *OpenAPI_unrelated_class_1_parseFromJSON(cJSON *unrelated_class_1JSON) -{ - OpenAPI_unrelated_class_1_t *unrelated_class_1_local_var = NULL; - OpenAPI_lnode_t *node = NULL; - cJSON *default_unrelated_class = NULL; - OpenAPI_default_unrelated_class_1_t *default_unrelated_class_local_nonprim = NULL; - cJSON *external_unrelated_class = NULL; - OpenAPI_external_unrelated_class_t *external_unrelated_class_local_nonprim = NULL; - cJSON *service_type_unrelated_classes = NULL; - OpenAPI_list_t *service_type_unrelated_classesList = NULL; - default_unrelated_class = cJSON_GetObjectItemCaseSensitive(unrelated_class_1JSON, "defaultUnrelatedClass"); - if (!default_unrelated_class) { - ogs_error("OpenAPI_unrelated_class_1_parseFromJSON() failed [default_unrelated_class]"); - goto end; - } - default_unrelated_class_local_nonprim = OpenAPI_default_unrelated_class_1_parseFromJSON(default_unrelated_class); - - external_unrelated_class = cJSON_GetObjectItemCaseSensitive(unrelated_class_1JSON, "externalUnrelatedClass"); - if (external_unrelated_class) { - external_unrelated_class_local_nonprim = OpenAPI_external_unrelated_class_parseFromJSON(external_unrelated_class); - } - - service_type_unrelated_classes = cJSON_GetObjectItemCaseSensitive(unrelated_class_1JSON, "serviceTypeUnrelatedClasses"); - if (service_type_unrelated_classes) { - cJSON *service_type_unrelated_classes_local = NULL; - if (!cJSON_IsArray(service_type_unrelated_classes)) { - ogs_error("OpenAPI_unrelated_class_1_parseFromJSON() failed [service_type_unrelated_classes]"); - goto end; - } - - service_type_unrelated_classesList = OpenAPI_list_create(); - - cJSON_ArrayForEach(service_type_unrelated_classes_local, service_type_unrelated_classes) { - if (!cJSON_IsObject(service_type_unrelated_classes_local)) { - ogs_error("OpenAPI_unrelated_class_1_parseFromJSON() failed [service_type_unrelated_classes]"); - goto end; - } - OpenAPI_service_type_unrelated_class_1_t *service_type_unrelated_classesItem = OpenAPI_service_type_unrelated_class_1_parseFromJSON(service_type_unrelated_classes_local); - if (!service_type_unrelated_classesItem) { - ogs_error("No service_type_unrelated_classesItem"); - OpenAPI_list_free(service_type_unrelated_classesList); - goto end; - } - OpenAPI_list_add(service_type_unrelated_classesList, service_type_unrelated_classesItem); - } - } - - unrelated_class_1_local_var = OpenAPI_unrelated_class_1_create ( - default_unrelated_class_local_nonprim, - external_unrelated_class ? external_unrelated_class_local_nonprim : NULL, - service_type_unrelated_classes ? service_type_unrelated_classesList : NULL - ); - - return unrelated_class_1_local_var; -end: - if (default_unrelated_class_local_nonprim) { - OpenAPI_default_unrelated_class_1_free(default_unrelated_class_local_nonprim); - default_unrelated_class_local_nonprim = NULL; - } - if (external_unrelated_class_local_nonprim) { - OpenAPI_external_unrelated_class_free(external_unrelated_class_local_nonprim); - external_unrelated_class_local_nonprim = NULL; - } - if (service_type_unrelated_classesList) { - OpenAPI_list_for_each(service_type_unrelated_classesList, node) { - OpenAPI_service_type_unrelated_class_1_free(node->data); - } - OpenAPI_list_free(service_type_unrelated_classesList); - service_type_unrelated_classesList = NULL; - } - return NULL; -} - -OpenAPI_unrelated_class_1_t *OpenAPI_unrelated_class_1_copy(OpenAPI_unrelated_class_1_t *dst, OpenAPI_unrelated_class_1_t *src) -{ - cJSON *item = NULL; - char *content = NULL; - - ogs_assert(src); - item = OpenAPI_unrelated_class_1_convertToJSON(src); - if (!item) { - ogs_error("OpenAPI_unrelated_class_1_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_unrelated_class_1_free(dst); - dst = OpenAPI_unrelated_class_1_parseFromJSON(item); - cJSON_Delete(item); - - return dst; -} - diff --git a/lib/sbi/openapi/model/unrelated_class_1.h b/lib/sbi/openapi/model/unrelated_class_1.h deleted file mode 100644 index 483d620b0..000000000 --- a/lib/sbi/openapi/model/unrelated_class_1.h +++ /dev/null @@ -1,45 +0,0 @@ -/* - * unrelated_class_1.h - * - * - */ - -#ifndef _OpenAPI_unrelated_class_1_H_ -#define _OpenAPI_unrelated_class_1_H_ - -#include -#include "../external/cJSON.h" -#include "../include/list.h" -#include "../include/keyValuePair.h" -#include "../include/binary.h" -#include "default_unrelated_class_1.h" -#include "external_unrelated_class.h" -#include "service_type_unrelated_class_1.h" - -#ifdef __cplusplus -extern "C" { -#endif - -typedef struct OpenAPI_unrelated_class_1_s OpenAPI_unrelated_class_1_t; -typedef struct OpenAPI_unrelated_class_1_s { - struct OpenAPI_default_unrelated_class_1_s *default_unrelated_class; - struct OpenAPI_external_unrelated_class_s *external_unrelated_class; - OpenAPI_list_t *service_type_unrelated_classes; -} OpenAPI_unrelated_class_1_t; - -OpenAPI_unrelated_class_1_t *OpenAPI_unrelated_class_1_create( - OpenAPI_default_unrelated_class_1_t *default_unrelated_class, - OpenAPI_external_unrelated_class_t *external_unrelated_class, - OpenAPI_list_t *service_type_unrelated_classes -); -void OpenAPI_unrelated_class_1_free(OpenAPI_unrelated_class_1_t *unrelated_class_1); -OpenAPI_unrelated_class_1_t *OpenAPI_unrelated_class_1_parseFromJSON(cJSON *unrelated_class_1JSON); -cJSON *OpenAPI_unrelated_class_1_convertToJSON(OpenAPI_unrelated_class_1_t *unrelated_class_1); -OpenAPI_unrelated_class_1_t *OpenAPI_unrelated_class_1_copy(OpenAPI_unrelated_class_1_t *dst, OpenAPI_unrelated_class_1_t *src); - -#ifdef __cplusplus -} -#endif - -#endif /* _OpenAPI_unrelated_class_1_H_ */ - diff --git a/lib/sbi/openapi/model/up_interface_type.c b/lib/sbi/openapi/model/up_interface_type.c index f6f7f3544..34fd43ced 100644 --- a/lib/sbi/openapi/model/up_interface_type.c +++ b/lib/sbi/openapi/model/up_interface_type.c @@ -6,7 +6,7 @@ char* OpenAPI_up_interface_type_ToString(OpenAPI_up_interface_type_e up_interface_type) { - const char *up_interface_typeArray[] = { "NULL", "N3", "N6", "N9", "DATA_FORWARDING" }; + const char *up_interface_typeArray[] = { "NULL", "N3", "N6", "N9", "DATA_FORWARDING", "N3MB", "N6MB", "N19MB", "NMB9" }; size_t sizeofArray = sizeof(up_interface_typeArray) / sizeof(up_interface_typeArray[0]); if (up_interface_type < sizeofArray) return (char *)up_interface_typeArray[up_interface_type]; @@ -17,7 +17,7 @@ char* OpenAPI_up_interface_type_ToString(OpenAPI_up_interface_type_e up_interfac OpenAPI_up_interface_type_e OpenAPI_up_interface_type_FromString(char* up_interface_type) { int stringToReturn = 0; - const char *up_interface_typeArray[] = { "NULL", "N3", "N6", "N9", "DATA_FORWARDING" }; + const char *up_interface_typeArray[] = { "NULL", "N3", "N6", "N9", "DATA_FORWARDING", "N3MB", "N6MB", "N19MB", "NMB9" }; size_t sizeofArray = sizeof(up_interface_typeArray) / sizeof(up_interface_typeArray[0]); while (stringToReturn < sizeofArray) { if (strcmp(up_interface_type, up_interface_typeArray[stringToReturn]) == 0) { diff --git a/lib/sbi/openapi/model/up_interface_type.h b/lib/sbi/openapi/model/up_interface_type.h index 58418a9fa..8135d8f31 100644 --- a/lib/sbi/openapi/model/up_interface_type.h +++ b/lib/sbi/openapi/model/up_interface_type.h @@ -17,7 +17,7 @@ extern "C" { #endif -typedef enum { OpenAPI_up_interface_type_NULL = 0, OpenAPI_up_interface_type_N3, OpenAPI_up_interface_type_N6, OpenAPI_up_interface_type_N9, OpenAPI_up_interface_type_DATA_FORWARDING } OpenAPI_up_interface_type_e; +typedef enum { OpenAPI_up_interface_type_NULL = 0, OpenAPI_up_interface_type_N3, OpenAPI_up_interface_type_N6, OpenAPI_up_interface_type_N9, OpenAPI_up_interface_type_DATA_FORWARDING, OpenAPI_up_interface_type_N3MB, OpenAPI_up_interface_type_N6MB, OpenAPI_up_interface_type_N19MB, OpenAPI_up_interface_type_NMB9 } OpenAPI_up_interface_type_e; char* OpenAPI_up_interface_type_ToString(OpenAPI_up_interface_type_e up_interface_type); diff --git a/lib/sbi/openapi/model/up_path_chg_event.h b/lib/sbi/openapi/model/up_path_chg_event.h index ed75dddb1..3e940873c 100644 --- a/lib/sbi/openapi/model/up_path_chg_event.h +++ b/lib/sbi/openapi/model/up_path_chg_event.h @@ -1,7 +1,7 @@ /* * up_path_chg_event.h * - * + * Contains the UP path change event subscription from the AF. */ #ifndef _OpenAPI_up_path_chg_event_H_ diff --git a/lib/sbi/openapi/model/up_security.h b/lib/sbi/openapi/model/up_security.h index 2309ba117..e179395ca 100644 --- a/lib/sbi/openapi/model/up_security.h +++ b/lib/sbi/openapi/model/up_security.h @@ -1,7 +1,7 @@ /* * up_security.h * - * + * Contains Userplain security information. */ #ifndef _OpenAPI_up_security_H_ diff --git a/lib/sbi/openapi/model/up_security_1.h b/lib/sbi/openapi/model/up_security_1.h index 149d13a6d..2654a7b6c 100644 --- a/lib/sbi/openapi/model/up_security_1.h +++ b/lib/sbi/openapi/model/up_security_1.h @@ -1,7 +1,7 @@ /* * up_security_1.h * - * + * Contains Userplain security information. */ #ifndef _OpenAPI_up_security_1_H_ diff --git a/lib/sbi/openapi/model/up_security_info.h b/lib/sbi/openapi/model/up_security_info.h index 006aa736f..3d4fdc0ef 100644 --- a/lib/sbi/openapi/model/up_security_info.h +++ b/lib/sbi/openapi/model/up_security_info.h @@ -1,7 +1,7 @@ /* * up_security_info.h * - * + * User Plane Security Information */ #ifndef _OpenAPI_up_security_info_H_ diff --git a/lib/sbi/openapi/model/update_nwdaf_registration_200_response.c b/lib/sbi/openapi/model/update_nwdaf_registration_200_response.c new file mode 100644 index 000000000..786deaf88 --- /dev/null +++ b/lib/sbi/openapi/model/update_nwdaf_registration_200_response.c @@ -0,0 +1,396 @@ + +#include +#include +#include +#include "update_nwdaf_registration_200_response.h" + +OpenAPI_update_nwdaf_registration_200_response_t *OpenAPI_update_nwdaf_registration_200_response_create( + char *nwdaf_instance_id, + OpenAPI_list_t *analytics_ids, + char *nwdaf_set_id, + char *registration_time, + OpenAPI_context_info_t *context_info, + char *supported_features, + OpenAPI_list_t *reset_ids, + OpenAPI_list_t *report +) +{ + OpenAPI_update_nwdaf_registration_200_response_t *update_nwdaf_registration_200_response_local_var = ogs_malloc(sizeof(OpenAPI_update_nwdaf_registration_200_response_t)); + ogs_assert(update_nwdaf_registration_200_response_local_var); + + update_nwdaf_registration_200_response_local_var->nwdaf_instance_id = nwdaf_instance_id; + update_nwdaf_registration_200_response_local_var->analytics_ids = analytics_ids; + update_nwdaf_registration_200_response_local_var->nwdaf_set_id = nwdaf_set_id; + update_nwdaf_registration_200_response_local_var->registration_time = registration_time; + update_nwdaf_registration_200_response_local_var->context_info = context_info; + update_nwdaf_registration_200_response_local_var->supported_features = supported_features; + update_nwdaf_registration_200_response_local_var->reset_ids = reset_ids; + update_nwdaf_registration_200_response_local_var->report = report; + + return update_nwdaf_registration_200_response_local_var; +} + +void OpenAPI_update_nwdaf_registration_200_response_free(OpenAPI_update_nwdaf_registration_200_response_t *update_nwdaf_registration_200_response) +{ + OpenAPI_lnode_t *node = NULL; + + if (NULL == update_nwdaf_registration_200_response) { + return; + } + if (update_nwdaf_registration_200_response->nwdaf_instance_id) { + ogs_free(update_nwdaf_registration_200_response->nwdaf_instance_id); + update_nwdaf_registration_200_response->nwdaf_instance_id = NULL; + } + if (update_nwdaf_registration_200_response->analytics_ids) { + OpenAPI_list_for_each(update_nwdaf_registration_200_response->analytics_ids, node) { + OpenAPI_event_id_free(node->data); + } + OpenAPI_list_free(update_nwdaf_registration_200_response->analytics_ids); + update_nwdaf_registration_200_response->analytics_ids = NULL; + } + if (update_nwdaf_registration_200_response->nwdaf_set_id) { + ogs_free(update_nwdaf_registration_200_response->nwdaf_set_id); + update_nwdaf_registration_200_response->nwdaf_set_id = NULL; + } + if (update_nwdaf_registration_200_response->registration_time) { + ogs_free(update_nwdaf_registration_200_response->registration_time); + update_nwdaf_registration_200_response->registration_time = NULL; + } + if (update_nwdaf_registration_200_response->context_info) { + OpenAPI_context_info_free(update_nwdaf_registration_200_response->context_info); + update_nwdaf_registration_200_response->context_info = NULL; + } + if (update_nwdaf_registration_200_response->supported_features) { + ogs_free(update_nwdaf_registration_200_response->supported_features); + update_nwdaf_registration_200_response->supported_features = NULL; + } + if (update_nwdaf_registration_200_response->reset_ids) { + OpenAPI_list_for_each(update_nwdaf_registration_200_response->reset_ids, node) { + ogs_free(node->data); + } + OpenAPI_list_free(update_nwdaf_registration_200_response->reset_ids); + update_nwdaf_registration_200_response->reset_ids = NULL; + } + if (update_nwdaf_registration_200_response->report) { + OpenAPI_list_for_each(update_nwdaf_registration_200_response->report, node) { + OpenAPI_report_item_free(node->data); + } + OpenAPI_list_free(update_nwdaf_registration_200_response->report); + update_nwdaf_registration_200_response->report = NULL; + } + ogs_free(update_nwdaf_registration_200_response); +} + +cJSON *OpenAPI_update_nwdaf_registration_200_response_convertToJSON(OpenAPI_update_nwdaf_registration_200_response_t *update_nwdaf_registration_200_response) +{ + cJSON *item = NULL; + OpenAPI_lnode_t *node = NULL; + + if (update_nwdaf_registration_200_response == NULL) { + ogs_error("OpenAPI_update_nwdaf_registration_200_response_convertToJSON() failed [UpdateNwdafRegistration_200_response]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (!update_nwdaf_registration_200_response->nwdaf_instance_id) { + ogs_error("OpenAPI_update_nwdaf_registration_200_response_convertToJSON() failed [nwdaf_instance_id]"); + return NULL; + } + if (cJSON_AddStringToObject(item, "nwdafInstanceId", update_nwdaf_registration_200_response->nwdaf_instance_id) == NULL) { + ogs_error("OpenAPI_update_nwdaf_registration_200_response_convertToJSON() failed [nwdaf_instance_id]"); + goto end; + } + + if (!update_nwdaf_registration_200_response->analytics_ids) { + ogs_error("OpenAPI_update_nwdaf_registration_200_response_convertToJSON() failed [analytics_ids]"); + return NULL; + } + cJSON *analytics_idsList = cJSON_AddArrayToObject(item, "analyticsIds"); + if (analytics_idsList == NULL) { + ogs_error("OpenAPI_update_nwdaf_registration_200_response_convertToJSON() failed [analytics_ids]"); + goto end; + } + OpenAPI_list_for_each(update_nwdaf_registration_200_response->analytics_ids, node) { + cJSON *itemLocal = OpenAPI_event_id_convertToJSON(node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_update_nwdaf_registration_200_response_convertToJSON() failed [analytics_ids]"); + goto end; + } + cJSON_AddItemToArray(analytics_idsList, itemLocal); + } + + if (update_nwdaf_registration_200_response->nwdaf_set_id) { + if (cJSON_AddStringToObject(item, "nwdafSetId", update_nwdaf_registration_200_response->nwdaf_set_id) == NULL) { + ogs_error("OpenAPI_update_nwdaf_registration_200_response_convertToJSON() failed [nwdaf_set_id]"); + goto end; + } + } + + if (update_nwdaf_registration_200_response->registration_time) { + if (cJSON_AddStringToObject(item, "registrationTime", update_nwdaf_registration_200_response->registration_time) == NULL) { + ogs_error("OpenAPI_update_nwdaf_registration_200_response_convertToJSON() failed [registration_time]"); + goto end; + } + } + + if (update_nwdaf_registration_200_response->context_info) { + cJSON *context_info_local_JSON = OpenAPI_context_info_convertToJSON(update_nwdaf_registration_200_response->context_info); + if (context_info_local_JSON == NULL) { + ogs_error("OpenAPI_update_nwdaf_registration_200_response_convertToJSON() failed [context_info]"); + goto end; + } + cJSON_AddItemToObject(item, "contextInfo", context_info_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_update_nwdaf_registration_200_response_convertToJSON() failed [context_info]"); + goto end; + } + } + + if (update_nwdaf_registration_200_response->supported_features) { + if (cJSON_AddStringToObject(item, "supportedFeatures", update_nwdaf_registration_200_response->supported_features) == NULL) { + ogs_error("OpenAPI_update_nwdaf_registration_200_response_convertToJSON() failed [supported_features]"); + goto end; + } + } + + if (update_nwdaf_registration_200_response->reset_ids) { + cJSON *reset_idsList = cJSON_AddArrayToObject(item, "resetIds"); + if (reset_idsList == NULL) { + ogs_error("OpenAPI_update_nwdaf_registration_200_response_convertToJSON() failed [reset_ids]"); + goto end; + } + OpenAPI_list_for_each(update_nwdaf_registration_200_response->reset_ids, node) { + if (cJSON_AddStringToObject(reset_idsList, "", (char*)node->data) == NULL) { + ogs_error("OpenAPI_update_nwdaf_registration_200_response_convertToJSON() failed [reset_ids]"); + goto end; + } + } + } + + if (!update_nwdaf_registration_200_response->report) { + ogs_error("OpenAPI_update_nwdaf_registration_200_response_convertToJSON() failed [report]"); + return NULL; + } + cJSON *reportList = cJSON_AddArrayToObject(item, "report"); + if (reportList == NULL) { + ogs_error("OpenAPI_update_nwdaf_registration_200_response_convertToJSON() failed [report]"); + goto end; + } + OpenAPI_list_for_each(update_nwdaf_registration_200_response->report, node) { + cJSON *itemLocal = OpenAPI_report_item_convertToJSON(node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_update_nwdaf_registration_200_response_convertToJSON() failed [report]"); + goto end; + } + cJSON_AddItemToArray(reportList, itemLocal); + } + +end: + return item; +} + +OpenAPI_update_nwdaf_registration_200_response_t *OpenAPI_update_nwdaf_registration_200_response_parseFromJSON(cJSON *update_nwdaf_registration_200_responseJSON) +{ + OpenAPI_update_nwdaf_registration_200_response_t *update_nwdaf_registration_200_response_local_var = NULL; + OpenAPI_lnode_t *node = NULL; + cJSON *nwdaf_instance_id = NULL; + cJSON *analytics_ids = NULL; + OpenAPI_list_t *analytics_idsList = NULL; + cJSON *nwdaf_set_id = NULL; + cJSON *registration_time = NULL; + cJSON *context_info = NULL; + OpenAPI_context_info_t *context_info_local_nonprim = NULL; + cJSON *supported_features = NULL; + cJSON *reset_ids = NULL; + OpenAPI_list_t *reset_idsList = NULL; + cJSON *report = NULL; + OpenAPI_list_t *reportList = NULL; + nwdaf_instance_id = cJSON_GetObjectItemCaseSensitive(update_nwdaf_registration_200_responseJSON, "nwdafInstanceId"); + if (!nwdaf_instance_id) { + ogs_error("OpenAPI_update_nwdaf_registration_200_response_parseFromJSON() failed [nwdaf_instance_id]"); + goto end; + } + if (!cJSON_IsString(nwdaf_instance_id)) { + ogs_error("OpenAPI_update_nwdaf_registration_200_response_parseFromJSON() failed [nwdaf_instance_id]"); + goto end; + } + + analytics_ids = cJSON_GetObjectItemCaseSensitive(update_nwdaf_registration_200_responseJSON, "analyticsIds"); + if (!analytics_ids) { + ogs_error("OpenAPI_update_nwdaf_registration_200_response_parseFromJSON() failed [analytics_ids]"); + goto end; + } + cJSON *analytics_ids_local = NULL; + if (!cJSON_IsArray(analytics_ids)) { + ogs_error("OpenAPI_update_nwdaf_registration_200_response_parseFromJSON() failed [analytics_ids]"); + goto end; + } + + analytics_idsList = OpenAPI_list_create(); + + cJSON_ArrayForEach(analytics_ids_local, analytics_ids) { + if (!cJSON_IsObject(analytics_ids_local)) { + ogs_error("OpenAPI_update_nwdaf_registration_200_response_parseFromJSON() failed [analytics_ids]"); + goto end; + } + OpenAPI_event_id_t *analytics_idsItem = OpenAPI_event_id_parseFromJSON(analytics_ids_local); + if (!analytics_idsItem) { + ogs_error("No analytics_idsItem"); + OpenAPI_list_free(analytics_idsList); + goto end; + } + OpenAPI_list_add(analytics_idsList, analytics_idsItem); + } + + nwdaf_set_id = cJSON_GetObjectItemCaseSensitive(update_nwdaf_registration_200_responseJSON, "nwdafSetId"); + if (nwdaf_set_id) { + if (!cJSON_IsString(nwdaf_set_id) && !cJSON_IsNull(nwdaf_set_id)) { + ogs_error("OpenAPI_update_nwdaf_registration_200_response_parseFromJSON() failed [nwdaf_set_id]"); + goto end; + } + } + + registration_time = cJSON_GetObjectItemCaseSensitive(update_nwdaf_registration_200_responseJSON, "registrationTime"); + if (registration_time) { + if (!cJSON_IsString(registration_time) && !cJSON_IsNull(registration_time)) { + ogs_error("OpenAPI_update_nwdaf_registration_200_response_parseFromJSON() failed [registration_time]"); + goto end; + } + } + + context_info = cJSON_GetObjectItemCaseSensitive(update_nwdaf_registration_200_responseJSON, "contextInfo"); + if (context_info) { + context_info_local_nonprim = OpenAPI_context_info_parseFromJSON(context_info); + } + + supported_features = cJSON_GetObjectItemCaseSensitive(update_nwdaf_registration_200_responseJSON, "supportedFeatures"); + if (supported_features) { + if (!cJSON_IsString(supported_features) && !cJSON_IsNull(supported_features)) { + ogs_error("OpenAPI_update_nwdaf_registration_200_response_parseFromJSON() failed [supported_features]"); + goto end; + } + } + + reset_ids = cJSON_GetObjectItemCaseSensitive(update_nwdaf_registration_200_responseJSON, "resetIds"); + if (reset_ids) { + cJSON *reset_ids_local = NULL; + if (!cJSON_IsArray(reset_ids)) { + ogs_error("OpenAPI_update_nwdaf_registration_200_response_parseFromJSON() failed [reset_ids]"); + goto end; + } + + reset_idsList = OpenAPI_list_create(); + + cJSON_ArrayForEach(reset_ids_local, reset_ids) { + double *localDouble = NULL; + int *localInt = NULL; + if (!cJSON_IsString(reset_ids_local)) { + ogs_error("OpenAPI_update_nwdaf_registration_200_response_parseFromJSON() failed [reset_ids]"); + goto end; + } + OpenAPI_list_add(reset_idsList, ogs_strdup(reset_ids_local->valuestring)); + } + } + + report = cJSON_GetObjectItemCaseSensitive(update_nwdaf_registration_200_responseJSON, "report"); + if (!report) { + ogs_error("OpenAPI_update_nwdaf_registration_200_response_parseFromJSON() failed [report]"); + goto end; + } + cJSON *report_local = NULL; + if (!cJSON_IsArray(report)) { + ogs_error("OpenAPI_update_nwdaf_registration_200_response_parseFromJSON() failed [report]"); + goto end; + } + + reportList = OpenAPI_list_create(); + + cJSON_ArrayForEach(report_local, report) { + if (!cJSON_IsObject(report_local)) { + ogs_error("OpenAPI_update_nwdaf_registration_200_response_parseFromJSON() failed [report]"); + goto end; + } + OpenAPI_report_item_t *reportItem = OpenAPI_report_item_parseFromJSON(report_local); + if (!reportItem) { + ogs_error("No reportItem"); + OpenAPI_list_free(reportList); + goto end; + } + OpenAPI_list_add(reportList, reportItem); + } + + update_nwdaf_registration_200_response_local_var = OpenAPI_update_nwdaf_registration_200_response_create ( + ogs_strdup(nwdaf_instance_id->valuestring), + analytics_idsList, + nwdaf_set_id && !cJSON_IsNull(nwdaf_set_id) ? ogs_strdup(nwdaf_set_id->valuestring) : NULL, + registration_time && !cJSON_IsNull(registration_time) ? ogs_strdup(registration_time->valuestring) : NULL, + context_info ? context_info_local_nonprim : NULL, + supported_features && !cJSON_IsNull(supported_features) ? ogs_strdup(supported_features->valuestring) : NULL, + reset_ids ? reset_idsList : NULL, + reportList + ); + + return update_nwdaf_registration_200_response_local_var; +end: + if (analytics_idsList) { + OpenAPI_list_for_each(analytics_idsList, node) { + OpenAPI_event_id_free(node->data); + } + OpenAPI_list_free(analytics_idsList); + analytics_idsList = NULL; + } + if (context_info_local_nonprim) { + OpenAPI_context_info_free(context_info_local_nonprim); + context_info_local_nonprim = NULL; + } + if (reset_idsList) { + OpenAPI_list_for_each(reset_idsList, node) { + ogs_free(node->data); + } + OpenAPI_list_free(reset_idsList); + reset_idsList = NULL; + } + if (reportList) { + OpenAPI_list_for_each(reportList, node) { + OpenAPI_report_item_free(node->data); + } + OpenAPI_list_free(reportList); + reportList = NULL; + } + return NULL; +} + +OpenAPI_update_nwdaf_registration_200_response_t *OpenAPI_update_nwdaf_registration_200_response_copy(OpenAPI_update_nwdaf_registration_200_response_t *dst, OpenAPI_update_nwdaf_registration_200_response_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_update_nwdaf_registration_200_response_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_update_nwdaf_registration_200_response_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_update_nwdaf_registration_200_response_free(dst); + dst = OpenAPI_update_nwdaf_registration_200_response_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/update_nwdaf_registration_200_response.h b/lib/sbi/openapi/model/update_nwdaf_registration_200_response.h new file mode 100644 index 000000000..eb153d97b --- /dev/null +++ b/lib/sbi/openapi/model/update_nwdaf_registration_200_response.h @@ -0,0 +1,57 @@ +/* + * update_nwdaf_registration_200_response.h + * + * + */ + +#ifndef _OpenAPI_update_nwdaf_registration_200_response_H_ +#define _OpenAPI_update_nwdaf_registration_200_response_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "context_info.h" +#include "event_id.h" +#include "nwdaf_registration.h" +#include "patch_result.h" +#include "report_item.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_update_nwdaf_registration_200_response_s OpenAPI_update_nwdaf_registration_200_response_t; +typedef struct OpenAPI_update_nwdaf_registration_200_response_s { + char *nwdaf_instance_id; + OpenAPI_list_t *analytics_ids; + char *nwdaf_set_id; + char *registration_time; + struct OpenAPI_context_info_s *context_info; + char *supported_features; + OpenAPI_list_t *reset_ids; + OpenAPI_list_t *report; +} OpenAPI_update_nwdaf_registration_200_response_t; + +OpenAPI_update_nwdaf_registration_200_response_t *OpenAPI_update_nwdaf_registration_200_response_create( + char *nwdaf_instance_id, + OpenAPI_list_t *analytics_ids, + char *nwdaf_set_id, + char *registration_time, + OpenAPI_context_info_t *context_info, + char *supported_features, + OpenAPI_list_t *reset_ids, + OpenAPI_list_t *report +); +void OpenAPI_update_nwdaf_registration_200_response_free(OpenAPI_update_nwdaf_registration_200_response_t *update_nwdaf_registration_200_response); +OpenAPI_update_nwdaf_registration_200_response_t *OpenAPI_update_nwdaf_registration_200_response_parseFromJSON(cJSON *update_nwdaf_registration_200_responseJSON); +cJSON *OpenAPI_update_nwdaf_registration_200_response_convertToJSON(OpenAPI_update_nwdaf_registration_200_response_t *update_nwdaf_registration_200_response); +OpenAPI_update_nwdaf_registration_200_response_t *OpenAPI_update_nwdaf_registration_200_response_copy(OpenAPI_update_nwdaf_registration_200_response_t *dst, OpenAPI_update_nwdaf_registration_200_response_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_update_nwdaf_registration_200_response_H_ */ + diff --git a/lib/sbi/openapi/model/updated_item.c b/lib/sbi/openapi/model/updated_item.c index 734d98966..0da1296a6 100644 --- a/lib/sbi/openapi/model/updated_item.c +++ b/lib/sbi/openapi/model/updated_item.c @@ -6,7 +6,7 @@ OpenAPI_updated_item_t *OpenAPI_updated_item_create( char *item, - char *value + OpenAPI_any_type_t *value ) { OpenAPI_updated_item_t *updated_item_local_var = ogs_malloc(sizeof(OpenAPI_updated_item_t)); @@ -30,7 +30,7 @@ void OpenAPI_updated_item_free(OpenAPI_updated_item_t *updated_item) updated_item->item = NULL; } if (updated_item->value) { - ogs_free(updated_item->value); + OpenAPI_any_type_free(updated_item->value); updated_item->value = NULL; } ogs_free(updated_item); @@ -60,7 +60,13 @@ cJSON *OpenAPI_updated_item_convertToJSON(OpenAPI_updated_item_t *updated_item) ogs_error("OpenAPI_updated_item_convertToJSON() failed [value]"); return NULL; } - if (cJSON_AddStringToObject(item, "value", updated_item->value) == NULL) { + cJSON *value_object = OpenAPI_any_type_convertToJSON(updated_item->value); + if (value_object == NULL) { + ogs_error("OpenAPI_updated_item_convertToJSON() failed [value]"); + goto end; + } + cJSON_AddItemToObject(item, "value", value_object); + if (item->child == NULL) { ogs_error("OpenAPI_updated_item_convertToJSON() failed [value]"); goto end; } @@ -75,6 +81,7 @@ OpenAPI_updated_item_t *OpenAPI_updated_item_parseFromJSON(cJSON *updated_itemJS OpenAPI_lnode_t *node = NULL; cJSON *item = NULL; cJSON *value = NULL; + OpenAPI_any_type_t *value_local_object = NULL; item = cJSON_GetObjectItemCaseSensitive(updated_itemJSON, "item"); if (!item) { ogs_error("OpenAPI_updated_item_parseFromJSON() failed [item]"); @@ -90,18 +97,19 @@ OpenAPI_updated_item_t *OpenAPI_updated_item_parseFromJSON(cJSON *updated_itemJS ogs_error("OpenAPI_updated_item_parseFromJSON() failed [value]"); goto end; } - if (!cJSON_IsString(value)) { - ogs_error("OpenAPI_updated_item_parseFromJSON() failed [value]"); - goto end; - } + value_local_object = OpenAPI_any_type_parseFromJSON(value); updated_item_local_var = OpenAPI_updated_item_create ( ogs_strdup(item->valuestring), - ogs_strdup(value->valuestring) + value_local_object ); return updated_item_local_var; end: + if (value_local_object) { + OpenAPI_any_type_free(value_local_object); + value_local_object = NULL; + } return NULL; } diff --git a/lib/sbi/openapi/model/updated_item.h b/lib/sbi/openapi/model/updated_item.h index ca965173b..a91415863 100644 --- a/lib/sbi/openapi/model/updated_item.h +++ b/lib/sbi/openapi/model/updated_item.h @@ -12,6 +12,7 @@ #include "../include/list.h" #include "../include/keyValuePair.h" #include "../include/binary.h" +#include "any_type.h" #ifdef __cplusplus extern "C" { @@ -20,12 +21,12 @@ extern "C" { typedef struct OpenAPI_updated_item_s OpenAPI_updated_item_t; typedef struct OpenAPI_updated_item_s { char *item; - char *value; + OpenAPI_any_type_t *value; } OpenAPI_updated_item_t; OpenAPI_updated_item_t *OpenAPI_updated_item_create( char *item, - char *value + OpenAPI_any_type_t *value ); void OpenAPI_updated_item_free(OpenAPI_updated_item_t *updated_item); OpenAPI_updated_item_t *OpenAPI_updated_item_parseFromJSON(cJSON *updated_itemJSON); diff --git a/lib/sbi/openapi/model/updp_subscription_data.c b/lib/sbi/openapi/model/updp_subscription_data.c new file mode 100644 index 000000000..7079d0765 --- /dev/null +++ b/lib/sbi/openapi/model/updp_subscription_data.c @@ -0,0 +1,187 @@ + +#include +#include +#include +#include "updp_subscription_data.h" + +OpenAPI_updp_subscription_data_t *OpenAPI_updp_subscription_data_create( + char *updp_notify_subscription_id, + char *updp_notify_callback_uri, + char *supported_features, + char *updp_callback_binding +) +{ + OpenAPI_updp_subscription_data_t *updp_subscription_data_local_var = ogs_malloc(sizeof(OpenAPI_updp_subscription_data_t)); + ogs_assert(updp_subscription_data_local_var); + + updp_subscription_data_local_var->updp_notify_subscription_id = updp_notify_subscription_id; + updp_subscription_data_local_var->updp_notify_callback_uri = updp_notify_callback_uri; + updp_subscription_data_local_var->supported_features = supported_features; + updp_subscription_data_local_var->updp_callback_binding = updp_callback_binding; + + return updp_subscription_data_local_var; +} + +void OpenAPI_updp_subscription_data_free(OpenAPI_updp_subscription_data_t *updp_subscription_data) +{ + OpenAPI_lnode_t *node = NULL; + + if (NULL == updp_subscription_data) { + return; + } + if (updp_subscription_data->updp_notify_subscription_id) { + ogs_free(updp_subscription_data->updp_notify_subscription_id); + updp_subscription_data->updp_notify_subscription_id = NULL; + } + if (updp_subscription_data->updp_notify_callback_uri) { + ogs_free(updp_subscription_data->updp_notify_callback_uri); + updp_subscription_data->updp_notify_callback_uri = NULL; + } + if (updp_subscription_data->supported_features) { + ogs_free(updp_subscription_data->supported_features); + updp_subscription_data->supported_features = NULL; + } + if (updp_subscription_data->updp_callback_binding) { + ogs_free(updp_subscription_data->updp_callback_binding); + updp_subscription_data->updp_callback_binding = NULL; + } + ogs_free(updp_subscription_data); +} + +cJSON *OpenAPI_updp_subscription_data_convertToJSON(OpenAPI_updp_subscription_data_t *updp_subscription_data) +{ + cJSON *item = NULL; + OpenAPI_lnode_t *node = NULL; + + if (updp_subscription_data == NULL) { + ogs_error("OpenAPI_updp_subscription_data_convertToJSON() failed [UpdpSubscriptionData]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (!updp_subscription_data->updp_notify_subscription_id) { + ogs_error("OpenAPI_updp_subscription_data_convertToJSON() failed [updp_notify_subscription_id]"); + return NULL; + } + if (cJSON_AddStringToObject(item, "updpNotifySubscriptionId", updp_subscription_data->updp_notify_subscription_id) == NULL) { + ogs_error("OpenAPI_updp_subscription_data_convertToJSON() failed [updp_notify_subscription_id]"); + goto end; + } + + if (!updp_subscription_data->updp_notify_callback_uri) { + ogs_error("OpenAPI_updp_subscription_data_convertToJSON() failed [updp_notify_callback_uri]"); + return NULL; + } + if (cJSON_AddStringToObject(item, "updpNotifyCallbackUri", updp_subscription_data->updp_notify_callback_uri) == NULL) { + ogs_error("OpenAPI_updp_subscription_data_convertToJSON() failed [updp_notify_callback_uri]"); + goto end; + } + + if (updp_subscription_data->supported_features) { + if (cJSON_AddStringToObject(item, "supportedFeatures", updp_subscription_data->supported_features) == NULL) { + ogs_error("OpenAPI_updp_subscription_data_convertToJSON() failed [supported_features]"); + goto end; + } + } + + if (updp_subscription_data->updp_callback_binding) { + if (cJSON_AddStringToObject(item, "updpCallbackBinding", updp_subscription_data->updp_callback_binding) == NULL) { + ogs_error("OpenAPI_updp_subscription_data_convertToJSON() failed [updp_callback_binding]"); + goto end; + } + } + +end: + return item; +} + +OpenAPI_updp_subscription_data_t *OpenAPI_updp_subscription_data_parseFromJSON(cJSON *updp_subscription_dataJSON) +{ + OpenAPI_updp_subscription_data_t *updp_subscription_data_local_var = NULL; + OpenAPI_lnode_t *node = NULL; + cJSON *updp_notify_subscription_id = NULL; + cJSON *updp_notify_callback_uri = NULL; + cJSON *supported_features = NULL; + cJSON *updp_callback_binding = NULL; + updp_notify_subscription_id = cJSON_GetObjectItemCaseSensitive(updp_subscription_dataJSON, "updpNotifySubscriptionId"); + if (!updp_notify_subscription_id) { + ogs_error("OpenAPI_updp_subscription_data_parseFromJSON() failed [updp_notify_subscription_id]"); + goto end; + } + if (!cJSON_IsString(updp_notify_subscription_id)) { + ogs_error("OpenAPI_updp_subscription_data_parseFromJSON() failed [updp_notify_subscription_id]"); + goto end; + } + + updp_notify_callback_uri = cJSON_GetObjectItemCaseSensitive(updp_subscription_dataJSON, "updpNotifyCallbackUri"); + if (!updp_notify_callback_uri) { + ogs_error("OpenAPI_updp_subscription_data_parseFromJSON() failed [updp_notify_callback_uri]"); + goto end; + } + if (!cJSON_IsString(updp_notify_callback_uri)) { + ogs_error("OpenAPI_updp_subscription_data_parseFromJSON() failed [updp_notify_callback_uri]"); + goto end; + } + + supported_features = cJSON_GetObjectItemCaseSensitive(updp_subscription_dataJSON, "supportedFeatures"); + if (supported_features) { + if (!cJSON_IsString(supported_features) && !cJSON_IsNull(supported_features)) { + ogs_error("OpenAPI_updp_subscription_data_parseFromJSON() failed [supported_features]"); + goto end; + } + } + + updp_callback_binding = cJSON_GetObjectItemCaseSensitive(updp_subscription_dataJSON, "updpCallbackBinding"); + if (updp_callback_binding) { + if (!cJSON_IsString(updp_callback_binding) && !cJSON_IsNull(updp_callback_binding)) { + ogs_error("OpenAPI_updp_subscription_data_parseFromJSON() failed [updp_callback_binding]"); + goto end; + } + } + + updp_subscription_data_local_var = OpenAPI_updp_subscription_data_create ( + ogs_strdup(updp_notify_subscription_id->valuestring), + ogs_strdup(updp_notify_callback_uri->valuestring), + supported_features && !cJSON_IsNull(supported_features) ? ogs_strdup(supported_features->valuestring) : NULL, + updp_callback_binding && !cJSON_IsNull(updp_callback_binding) ? ogs_strdup(updp_callback_binding->valuestring) : NULL + ); + + return updp_subscription_data_local_var; +end: + return NULL; +} + +OpenAPI_updp_subscription_data_t *OpenAPI_updp_subscription_data_copy(OpenAPI_updp_subscription_data_t *dst, OpenAPI_updp_subscription_data_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_updp_subscription_data_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_updp_subscription_data_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_updp_subscription_data_free(dst); + dst = OpenAPI_updp_subscription_data_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/updp_subscription_data.h b/lib/sbi/openapi/model/updp_subscription_data.h new file mode 100644 index 000000000..49e6e7227 --- /dev/null +++ b/lib/sbi/openapi/model/updp_subscription_data.h @@ -0,0 +1,44 @@ +/* + * updp_subscription_data.h + * + * UE policy delivery related N1 message notification subscription data. + */ + +#ifndef _OpenAPI_updp_subscription_data_H_ +#define _OpenAPI_updp_subscription_data_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_updp_subscription_data_s OpenAPI_updp_subscription_data_t; +typedef struct OpenAPI_updp_subscription_data_s { + char *updp_notify_subscription_id; + char *updp_notify_callback_uri; + char *supported_features; + char *updp_callback_binding; +} OpenAPI_updp_subscription_data_t; + +OpenAPI_updp_subscription_data_t *OpenAPI_updp_subscription_data_create( + char *updp_notify_subscription_id, + char *updp_notify_callback_uri, + char *supported_features, + char *updp_callback_binding +); +void OpenAPI_updp_subscription_data_free(OpenAPI_updp_subscription_data_t *updp_subscription_data); +OpenAPI_updp_subscription_data_t *OpenAPI_updp_subscription_data_parseFromJSON(cJSON *updp_subscription_dataJSON); +cJSON *OpenAPI_updp_subscription_data_convertToJSON(OpenAPI_updp_subscription_data_t *updp_subscription_data); +OpenAPI_updp_subscription_data_t *OpenAPI_updp_subscription_data_copy(OpenAPI_updp_subscription_data_t *dst, OpenAPI_updp_subscription_data_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_updp_subscription_data_H_ */ + diff --git a/lib/sbi/openapi/model/upf_cond.h b/lib/sbi/openapi/model/upf_cond.h index 8d6e63af5..46b742ab6 100644 --- a/lib/sbi/openapi/model/upf_cond.h +++ b/lib/sbi/openapi/model/upf_cond.h @@ -1,7 +1,7 @@ /* * upf_cond.h * - * Subscription to a set of NF Instances (UPFs), able to serve a certain service area (i.e. SMF serving area or TAI list) + * Subscription to a set of NF Instances (UPFs), able to serve a certain service area (i.e. SMF serving area or TAI list) */ #ifndef _OpenAPI_upf_cond_H_ diff --git a/lib/sbi/openapi/model/upf_info.c b/lib/sbi/openapi/model/upf_info.c index 170c0583b..bac446a60 100644 --- a/lib/sbi/openapi/model/upf_info.c +++ b/lib/sbi/openapi/model/upf_info.c @@ -15,6 +15,7 @@ OpenAPI_upf_info_t *OpenAPI_upf_info_create( bool is_ue_ip_addr_ind, int ue_ip_addr_ind, OpenAPI_list_t *tai_list, + OpenAPI_list_t *tai_range_list, OpenAPI_w_agf_info_t *w_agf_info, OpenAPI_tngf_info_t *tngf_info, OpenAPI_twif_info_t *twif_info, @@ -25,7 +26,8 @@ OpenAPI_upf_info_t *OpenAPI_upf_info_create( bool is_ipups, int ipups, bool is_data_forwarding, - int data_forwarding + int data_forwarding, + char *supported_pfcp_features ) { OpenAPI_upf_info_t *upf_info_local_var = ogs_malloc(sizeof(OpenAPI_upf_info_t)); @@ -41,6 +43,7 @@ OpenAPI_upf_info_t *OpenAPI_upf_info_create( upf_info_local_var->is_ue_ip_addr_ind = is_ue_ip_addr_ind; upf_info_local_var->ue_ip_addr_ind = ue_ip_addr_ind; upf_info_local_var->tai_list = tai_list; + upf_info_local_var->tai_range_list = tai_range_list; upf_info_local_var->w_agf_info = w_agf_info; upf_info_local_var->tngf_info = tngf_info; upf_info_local_var->twif_info = twif_info; @@ -52,6 +55,7 @@ OpenAPI_upf_info_t *OpenAPI_upf_info_create( upf_info_local_var->ipups = ipups; upf_info_local_var->is_data_forwarding = is_data_forwarding; upf_info_local_var->data_forwarding = data_forwarding; + upf_info_local_var->supported_pfcp_features = supported_pfcp_features; return upf_info_local_var; } @@ -99,6 +103,13 @@ void OpenAPI_upf_info_free(OpenAPI_upf_info_t *upf_info) OpenAPI_list_free(upf_info->tai_list); upf_info->tai_list = NULL; } + if (upf_info->tai_range_list) { + OpenAPI_list_for_each(upf_info->tai_range_list, node) { + OpenAPI_tai_range_free(node->data); + } + OpenAPI_list_free(upf_info->tai_range_list); + upf_info->tai_range_list = NULL; + } if (upf_info->w_agf_info) { OpenAPI_w_agf_info_free(upf_info->w_agf_info); upf_info->w_agf_info = NULL; @@ -111,6 +122,10 @@ void OpenAPI_upf_info_free(OpenAPI_upf_info_t *upf_info) OpenAPI_twif_info_free(upf_info->twif_info); upf_info->twif_info = NULL; } + if (upf_info->supported_pfcp_features) { + ogs_free(upf_info->supported_pfcp_features); + upf_info->supported_pfcp_features = NULL; + } ogs_free(upf_info); } @@ -230,6 +245,22 @@ cJSON *OpenAPI_upf_info_convertToJSON(OpenAPI_upf_info_t *upf_info) } } + if (upf_info->tai_range_list) { + cJSON *tai_range_listList = cJSON_AddArrayToObject(item, "taiRangeList"); + if (tai_range_listList == NULL) { + ogs_error("OpenAPI_upf_info_convertToJSON() failed [tai_range_list]"); + goto end; + } + OpenAPI_list_for_each(upf_info->tai_range_list, node) { + cJSON *itemLocal = OpenAPI_tai_range_convertToJSON(node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_upf_info_convertToJSON() failed [tai_range_list]"); + goto end; + } + cJSON_AddItemToArray(tai_range_listList, itemLocal); + } + } + if (upf_info->w_agf_info) { cJSON *w_agf_info_local_JSON = OpenAPI_w_agf_info_convertToJSON(upf_info->w_agf_info); if (w_agf_info_local_JSON == NULL) { @@ -297,6 +328,13 @@ cJSON *OpenAPI_upf_info_convertToJSON(OpenAPI_upf_info_t *upf_info) } } + if (upf_info->supported_pfcp_features) { + if (cJSON_AddStringToObject(item, "supportedPfcpFeatures", upf_info->supported_pfcp_features) == NULL) { + ogs_error("OpenAPI_upf_info_convertToJSON() failed [supported_pfcp_features]"); + goto end; + } + } + end: return item; } @@ -319,6 +357,8 @@ OpenAPI_upf_info_t *OpenAPI_upf_info_parseFromJSON(cJSON *upf_infoJSON) cJSON *ue_ip_addr_ind = NULL; cJSON *tai_list = NULL; OpenAPI_list_t *tai_listList = NULL; + cJSON *tai_range_list = NULL; + OpenAPI_list_t *tai_range_listList = NULL; cJSON *w_agf_info = NULL; OpenAPI_w_agf_info_t *w_agf_info_local_nonprim = NULL; cJSON *tngf_info = NULL; @@ -329,6 +369,7 @@ OpenAPI_upf_info_t *OpenAPI_upf_info_parseFromJSON(cJSON *upf_infoJSON) cJSON *redundant_gtpu = NULL; cJSON *ipups = NULL; cJSON *data_forwarding = NULL; + cJSON *supported_pfcp_features = NULL; s_nssai_upf_info_list = cJSON_GetObjectItemCaseSensitive(upf_infoJSON, "sNssaiUpfInfoList"); if (!s_nssai_upf_info_list) { ogs_error("OpenAPI_upf_info_parseFromJSON() failed [s_nssai_upf_info_list]"); @@ -467,6 +508,31 @@ OpenAPI_upf_info_t *OpenAPI_upf_info_parseFromJSON(cJSON *upf_infoJSON) } } + tai_range_list = cJSON_GetObjectItemCaseSensitive(upf_infoJSON, "taiRangeList"); + if (tai_range_list) { + cJSON *tai_range_list_local = NULL; + if (!cJSON_IsArray(tai_range_list)) { + ogs_error("OpenAPI_upf_info_parseFromJSON() failed [tai_range_list]"); + goto end; + } + + tai_range_listList = OpenAPI_list_create(); + + cJSON_ArrayForEach(tai_range_list_local, tai_range_list) { + if (!cJSON_IsObject(tai_range_list_local)) { + ogs_error("OpenAPI_upf_info_parseFromJSON() failed [tai_range_list]"); + goto end; + } + OpenAPI_tai_range_t *tai_range_listItem = OpenAPI_tai_range_parseFromJSON(tai_range_list_local); + if (!tai_range_listItem) { + ogs_error("No tai_range_listItem"); + OpenAPI_list_free(tai_range_listList); + goto end; + } + OpenAPI_list_add(tai_range_listList, tai_range_listItem); + } + } + w_agf_info = cJSON_GetObjectItemCaseSensitive(upf_infoJSON, "wAgfInfo"); if (w_agf_info) { w_agf_info_local_nonprim = OpenAPI_w_agf_info_parseFromJSON(w_agf_info); @@ -514,6 +580,14 @@ OpenAPI_upf_info_t *OpenAPI_upf_info_parseFromJSON(cJSON *upf_infoJSON) } } + supported_pfcp_features = cJSON_GetObjectItemCaseSensitive(upf_infoJSON, "supportedPfcpFeatures"); + if (supported_pfcp_features) { + if (!cJSON_IsString(supported_pfcp_features) && !cJSON_IsNull(supported_pfcp_features)) { + ogs_error("OpenAPI_upf_info_parseFromJSON() failed [supported_pfcp_features]"); + goto end; + } + } + upf_info_local_var = OpenAPI_upf_info_create ( s_nssai_upf_info_listList, smf_serving_area ? smf_serving_areaList : NULL, @@ -525,6 +599,7 @@ OpenAPI_upf_info_t *OpenAPI_upf_info_parseFromJSON(cJSON *upf_infoJSON) ue_ip_addr_ind ? true : false, ue_ip_addr_ind ? ue_ip_addr_ind->valueint : 0, tai_list ? tai_listList : NULL, + tai_range_list ? tai_range_listList : NULL, w_agf_info ? w_agf_info_local_nonprim : NULL, tngf_info ? tngf_info_local_nonprim : NULL, twif_info ? twif_info_local_nonprim : NULL, @@ -535,7 +610,8 @@ OpenAPI_upf_info_t *OpenAPI_upf_info_parseFromJSON(cJSON *upf_infoJSON) ipups ? true : false, ipups ? ipups->valueint : 0, data_forwarding ? true : false, - data_forwarding ? data_forwarding->valueint : 0 + data_forwarding ? data_forwarding->valueint : 0, + supported_pfcp_features && !cJSON_IsNull(supported_pfcp_features) ? ogs_strdup(supported_pfcp_features->valuestring) : NULL ); return upf_info_local_var; @@ -576,6 +652,13 @@ end: OpenAPI_list_free(tai_listList); tai_listList = NULL; } + if (tai_range_listList) { + OpenAPI_list_for_each(tai_range_listList, node) { + OpenAPI_tai_range_free(node->data); + } + OpenAPI_list_free(tai_range_listList); + tai_range_listList = NULL; + } if (w_agf_info_local_nonprim) { OpenAPI_w_agf_info_free(w_agf_info_local_nonprim); w_agf_info_local_nonprim = NULL; diff --git a/lib/sbi/openapi/model/upf_info.h b/lib/sbi/openapi/model/upf_info.h index e523e00e2..6ac12130c 100644 --- a/lib/sbi/openapi/model/upf_info.h +++ b/lib/sbi/openapi/model/upf_info.h @@ -17,6 +17,7 @@ #include "pdu_session_type.h" #include "snssai_upf_info_item.h" #include "tai.h" +#include "tai_range.h" #include "tngf_info.h" #include "twif_info.h" #include "w_agf_info.h" @@ -37,6 +38,7 @@ typedef struct OpenAPI_upf_info_s { bool is_ue_ip_addr_ind; int ue_ip_addr_ind; OpenAPI_list_t *tai_list; + OpenAPI_list_t *tai_range_list; struct OpenAPI_w_agf_info_s *w_agf_info; struct OpenAPI_tngf_info_s *tngf_info; struct OpenAPI_twif_info_s *twif_info; @@ -48,6 +50,7 @@ typedef struct OpenAPI_upf_info_s { int ipups; bool is_data_forwarding; int data_forwarding; + char *supported_pfcp_features; } OpenAPI_upf_info_t; OpenAPI_upf_info_t *OpenAPI_upf_info_create( @@ -61,6 +64,7 @@ OpenAPI_upf_info_t *OpenAPI_upf_info_create( bool is_ue_ip_addr_ind, int ue_ip_addr_ind, OpenAPI_list_t *tai_list, + OpenAPI_list_t *tai_range_list, OpenAPI_w_agf_info_t *w_agf_info, OpenAPI_tngf_info_t *tngf_info, OpenAPI_twif_info_t *twif_info, @@ -71,7 +75,8 @@ OpenAPI_upf_info_t *OpenAPI_upf_info_create( bool is_ipups, int ipups, bool is_data_forwarding, - int data_forwarding + int data_forwarding, + char *supported_pfcp_features ); void OpenAPI_upf_info_free(OpenAPI_upf_info_t *upf_info); OpenAPI_upf_info_t *OpenAPI_upf_info_parseFromJSON(cJSON *upf_infoJSON); diff --git a/lib/sbi/openapi/model/upf_information.c b/lib/sbi/openapi/model/upf_information.c new file mode 100644 index 000000000..c91b8d4b1 --- /dev/null +++ b/lib/sbi/openapi/model/upf_information.c @@ -0,0 +1,141 @@ + +#include +#include +#include +#include "upf_information.h" + +OpenAPI_upf_information_t *OpenAPI_upf_information_create( + char *upf_id, + OpenAPI_addr_fqdn_t *upf_addr +) +{ + OpenAPI_upf_information_t *upf_information_local_var = ogs_malloc(sizeof(OpenAPI_upf_information_t)); + ogs_assert(upf_information_local_var); + + upf_information_local_var->upf_id = upf_id; + upf_information_local_var->upf_addr = upf_addr; + + return upf_information_local_var; +} + +void OpenAPI_upf_information_free(OpenAPI_upf_information_t *upf_information) +{ + OpenAPI_lnode_t *node = NULL; + + if (NULL == upf_information) { + return; + } + if (upf_information->upf_id) { + ogs_free(upf_information->upf_id); + upf_information->upf_id = NULL; + } + if (upf_information->upf_addr) { + OpenAPI_addr_fqdn_free(upf_information->upf_addr); + upf_information->upf_addr = NULL; + } + ogs_free(upf_information); +} + +cJSON *OpenAPI_upf_information_convertToJSON(OpenAPI_upf_information_t *upf_information) +{ + cJSON *item = NULL; + OpenAPI_lnode_t *node = NULL; + + if (upf_information == NULL) { + ogs_error("OpenAPI_upf_information_convertToJSON() failed [UpfInformation]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (upf_information->upf_id) { + if (cJSON_AddStringToObject(item, "upfId", upf_information->upf_id) == NULL) { + ogs_error("OpenAPI_upf_information_convertToJSON() failed [upf_id]"); + goto end; + } + } + + if (upf_information->upf_addr) { + cJSON *upf_addr_local_JSON = OpenAPI_addr_fqdn_convertToJSON(upf_information->upf_addr); + if (upf_addr_local_JSON == NULL) { + ogs_error("OpenAPI_upf_information_convertToJSON() failed [upf_addr]"); + goto end; + } + cJSON_AddItemToObject(item, "upfAddr", upf_addr_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_upf_information_convertToJSON() failed [upf_addr]"); + goto end; + } + } + +end: + return item; +} + +OpenAPI_upf_information_t *OpenAPI_upf_information_parseFromJSON(cJSON *upf_informationJSON) +{ + OpenAPI_upf_information_t *upf_information_local_var = NULL; + OpenAPI_lnode_t *node = NULL; + cJSON *upf_id = NULL; + cJSON *upf_addr = NULL; + OpenAPI_addr_fqdn_t *upf_addr_local_nonprim = NULL; + upf_id = cJSON_GetObjectItemCaseSensitive(upf_informationJSON, "upfId"); + if (upf_id) { + if (!cJSON_IsString(upf_id) && !cJSON_IsNull(upf_id)) { + ogs_error("OpenAPI_upf_information_parseFromJSON() failed [upf_id]"); + goto end; + } + } + + upf_addr = cJSON_GetObjectItemCaseSensitive(upf_informationJSON, "upfAddr"); + if (upf_addr) { + upf_addr_local_nonprim = OpenAPI_addr_fqdn_parseFromJSON(upf_addr); + } + + upf_information_local_var = OpenAPI_upf_information_create ( + upf_id && !cJSON_IsNull(upf_id) ? ogs_strdup(upf_id->valuestring) : NULL, + upf_addr ? upf_addr_local_nonprim : NULL + ); + + return upf_information_local_var; +end: + if (upf_addr_local_nonprim) { + OpenAPI_addr_fqdn_free(upf_addr_local_nonprim); + upf_addr_local_nonprim = NULL; + } + return NULL; +} + +OpenAPI_upf_information_t *OpenAPI_upf_information_copy(OpenAPI_upf_information_t *dst, OpenAPI_upf_information_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_upf_information_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_upf_information_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_upf_information_free(dst); + dst = OpenAPI_upf_information_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/upf_information.h b/lib/sbi/openapi/model/upf_information.h new file mode 100644 index 000000000..27198cb8c --- /dev/null +++ b/lib/sbi/openapi/model/upf_information.h @@ -0,0 +1,41 @@ +/* + * upf_information.h + * + * + */ + +#ifndef _OpenAPI_upf_information_H_ +#define _OpenAPI_upf_information_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "addr_fqdn.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_upf_information_s OpenAPI_upf_information_t; +typedef struct OpenAPI_upf_information_s { + char *upf_id; + struct OpenAPI_addr_fqdn_s *upf_addr; +} OpenAPI_upf_information_t; + +OpenAPI_upf_information_t *OpenAPI_upf_information_create( + char *upf_id, + OpenAPI_addr_fqdn_t *upf_addr +); +void OpenAPI_upf_information_free(OpenAPI_upf_information_t *upf_information); +OpenAPI_upf_information_t *OpenAPI_upf_information_parseFromJSON(cJSON *upf_informationJSON); +cJSON *OpenAPI_upf_information_convertToJSON(OpenAPI_upf_information_t *upf_information); +OpenAPI_upf_information_t *OpenAPI_upf_information_copy(OpenAPI_upf_information_t *dst, OpenAPI_upf_information_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_upf_information_H_ */ + diff --git a/lib/sbi/openapi/model/upu_data.h b/lib/sbi/openapi/model/upu_data.h index 8be344765..5ba2e30ec 100644 --- a/lib/sbi/openapi/model/upu_data.h +++ b/lib/sbi/openapi/model/upu_data.h @@ -1,7 +1,7 @@ /* * upu_data.h * - * + * Contains UE parameters update data set (e.g., the updated Routing ID Data or the Default configured NSSAI). */ #ifndef _OpenAPI_upu_data_H_ diff --git a/lib/sbi/openapi/model/upu_data_1.h b/lib/sbi/openapi/model/upu_data_1.h index 078f752c9..c78fb711c 100644 --- a/lib/sbi/openapi/model/upu_data_1.h +++ b/lib/sbi/openapi/model/upu_data_1.h @@ -1,7 +1,7 @@ /* * upu_data_1.h * - * + * Contains UE parameters update data set (e.g., the updated Routing ID Data or the Default configured NSSAI). */ #ifndef _OpenAPI_upu_data_1_H_ diff --git a/lib/sbi/openapi/model/upu_data_2.h b/lib/sbi/openapi/model/upu_data_2.h index 9082d170b..167c05118 100644 --- a/lib/sbi/openapi/model/upu_data_2.h +++ b/lib/sbi/openapi/model/upu_data_2.h @@ -1,7 +1,7 @@ /* * upu_data_2.h * - * + * Contains UE parameters update data set (e.g., the updated Routing ID Data or the Default configured NSSAI). */ #ifndef _OpenAPI_upu_data_2_H_ diff --git a/lib/sbi/openapi/model/upu_info.c b/lib/sbi/openapi/model/upu_info.c index 61743ae72..d7bf471ee 100644 --- a/lib/sbi/openapi/model/upu_info.c +++ b/lib/sbi/openapi/model/upu_info.c @@ -6,22 +6,28 @@ OpenAPI_upu_info_t *OpenAPI_upu_info_create( OpenAPI_list_t *upu_data_list, + bool is_upu_reg_ind, int upu_reg_ind, + bool is_upu_ack_ind, int upu_ack_ind, char *upu_mac_iausf, char *counter_upu, - char *provisioning_time + char *provisioning_time, + char *upu_transparent_container ) { OpenAPI_upu_info_t *upu_info_local_var = ogs_malloc(sizeof(OpenAPI_upu_info_t)); ogs_assert(upu_info_local_var); upu_info_local_var->upu_data_list = upu_data_list; + upu_info_local_var->is_upu_reg_ind = is_upu_reg_ind; upu_info_local_var->upu_reg_ind = upu_reg_ind; + upu_info_local_var->is_upu_ack_ind = is_upu_ack_ind; upu_info_local_var->upu_ack_ind = upu_ack_ind; upu_info_local_var->upu_mac_iausf = upu_mac_iausf; upu_info_local_var->counter_upu = counter_upu; upu_info_local_var->provisioning_time = provisioning_time; + upu_info_local_var->upu_transparent_container = upu_transparent_container; return upu_info_local_var; } @@ -52,6 +58,10 @@ void OpenAPI_upu_info_free(OpenAPI_upu_info_t *upu_info) ogs_free(upu_info->provisioning_time); upu_info->provisioning_time = NULL; } + if (upu_info->upu_transparent_container) { + ogs_free(upu_info->upu_transparent_container); + upu_info->upu_transparent_container = NULL; + } ogs_free(upu_info); } @@ -66,10 +76,7 @@ cJSON *OpenAPI_upu_info_convertToJSON(OpenAPI_upu_info_t *upu_info) } item = cJSON_CreateObject(); - if (!upu_info->upu_data_list) { - ogs_error("OpenAPI_upu_info_convertToJSON() failed [upu_data_list]"); - return NULL; - } + if (upu_info->upu_data_list) { cJSON *upu_data_listList = cJSON_AddArrayToObject(item, "upuDataList"); if (upu_data_listList == NULL) { ogs_error("OpenAPI_upu_info_convertToJSON() failed [upu_data_list]"); @@ -83,16 +90,21 @@ cJSON *OpenAPI_upu_info_convertToJSON(OpenAPI_upu_info_t *upu_info) } cJSON_AddItemToArray(upu_data_listList, itemLocal); } + } + if (upu_info->is_upu_reg_ind) { if (cJSON_AddBoolToObject(item, "upuRegInd", upu_info->upu_reg_ind) == NULL) { ogs_error("OpenAPI_upu_info_convertToJSON() failed [upu_reg_ind]"); goto end; } + } + if (upu_info->is_upu_ack_ind) { if (cJSON_AddBoolToObject(item, "upuAckInd", upu_info->upu_ack_ind) == NULL) { ogs_error("OpenAPI_upu_info_convertToJSON() failed [upu_ack_ind]"); goto end; } + } if (upu_info->upu_mac_iausf) { if (cJSON_AddStringToObject(item, "upuMacIausf", upu_info->upu_mac_iausf) == NULL) { @@ -117,6 +129,13 @@ cJSON *OpenAPI_upu_info_convertToJSON(OpenAPI_upu_info_t *upu_info) goto end; } + if (upu_info->upu_transparent_container) { + if (cJSON_AddStringToObject(item, "upuTransparentContainer", upu_info->upu_transparent_container) == NULL) { + ogs_error("OpenAPI_upu_info_convertToJSON() failed [upu_transparent_container]"); + goto end; + } + } + end: return item; } @@ -132,11 +151,9 @@ OpenAPI_upu_info_t *OpenAPI_upu_info_parseFromJSON(cJSON *upu_infoJSON) cJSON *upu_mac_iausf = NULL; cJSON *counter_upu = NULL; cJSON *provisioning_time = NULL; + cJSON *upu_transparent_container = NULL; upu_data_list = cJSON_GetObjectItemCaseSensitive(upu_infoJSON, "upuDataList"); - if (!upu_data_list) { - ogs_error("OpenAPI_upu_info_parseFromJSON() failed [upu_data_list]"); - goto end; - } + if (upu_data_list) { cJSON *upu_data_list_local = NULL; if (!cJSON_IsArray(upu_data_list)) { ogs_error("OpenAPI_upu_info_parseFromJSON() failed [upu_data_list]"); @@ -158,26 +175,23 @@ OpenAPI_upu_info_t *OpenAPI_upu_info_parseFromJSON(cJSON *upu_infoJSON) } OpenAPI_list_add(upu_data_listList, upu_data_listItem); } + } upu_reg_ind = cJSON_GetObjectItemCaseSensitive(upu_infoJSON, "upuRegInd"); - if (!upu_reg_ind) { - ogs_error("OpenAPI_upu_info_parseFromJSON() failed [upu_reg_ind]"); - goto end; - } + if (upu_reg_ind) { if (!cJSON_IsBool(upu_reg_ind)) { ogs_error("OpenAPI_upu_info_parseFromJSON() failed [upu_reg_ind]"); goto end; } + } upu_ack_ind = cJSON_GetObjectItemCaseSensitive(upu_infoJSON, "upuAckInd"); - if (!upu_ack_ind) { - ogs_error("OpenAPI_upu_info_parseFromJSON() failed [upu_ack_ind]"); - goto end; - } + if (upu_ack_ind) { if (!cJSON_IsBool(upu_ack_ind)) { ogs_error("OpenAPI_upu_info_parseFromJSON() failed [upu_ack_ind]"); goto end; } + } upu_mac_iausf = cJSON_GetObjectItemCaseSensitive(upu_infoJSON, "upuMacIausf"); if (upu_mac_iausf) { @@ -205,15 +219,24 @@ OpenAPI_upu_info_t *OpenAPI_upu_info_parseFromJSON(cJSON *upu_infoJSON) goto end; } + upu_transparent_container = cJSON_GetObjectItemCaseSensitive(upu_infoJSON, "upuTransparentContainer"); + if (upu_transparent_container) { + if (!cJSON_IsString(upu_transparent_container) && !cJSON_IsNull(upu_transparent_container)) { + ogs_error("OpenAPI_upu_info_parseFromJSON() failed [upu_transparent_container]"); + goto end; + } + } + upu_info_local_var = OpenAPI_upu_info_create ( - upu_data_listList, - - upu_reg_ind->valueint, - - upu_ack_ind->valueint, + upu_data_list ? upu_data_listList : NULL, + upu_reg_ind ? true : false, + upu_reg_ind ? upu_reg_ind->valueint : 0, + upu_ack_ind ? true : false, + upu_ack_ind ? upu_ack_ind->valueint : 0, upu_mac_iausf && !cJSON_IsNull(upu_mac_iausf) ? ogs_strdup(upu_mac_iausf->valuestring) : NULL, counter_upu && !cJSON_IsNull(counter_upu) ? ogs_strdup(counter_upu->valuestring) : NULL, - ogs_strdup(provisioning_time->valuestring) + ogs_strdup(provisioning_time->valuestring), + upu_transparent_container && !cJSON_IsNull(upu_transparent_container) ? ogs_strdup(upu_transparent_container->valuestring) : NULL ); return upu_info_local_var; diff --git a/lib/sbi/openapi/model/upu_info.h b/lib/sbi/openapi/model/upu_info.h index 402c47ba5..e931901ae 100644 --- a/lib/sbi/openapi/model/upu_info.h +++ b/lib/sbi/openapi/model/upu_info.h @@ -21,20 +21,26 @@ extern "C" { typedef struct OpenAPI_upu_info_s OpenAPI_upu_info_t; typedef struct OpenAPI_upu_info_s { OpenAPI_list_t *upu_data_list; + bool is_upu_reg_ind; int upu_reg_ind; + bool is_upu_ack_ind; int upu_ack_ind; char *upu_mac_iausf; char *counter_upu; char *provisioning_time; + char *upu_transparent_container; } OpenAPI_upu_info_t; OpenAPI_upu_info_t *OpenAPI_upu_info_create( OpenAPI_list_t *upu_data_list, + bool is_upu_reg_ind, int upu_reg_ind, + bool is_upu_ack_ind, int upu_ack_ind, char *upu_mac_iausf, char *counter_upu, - char *provisioning_time + char *provisioning_time, + char *upu_transparent_container ); void OpenAPI_upu_info_free(OpenAPI_upu_info_t *upu_info); OpenAPI_upu_info_t *OpenAPI_upu_info_parseFromJSON(cJSON *upu_infoJSON); diff --git a/lib/sbi/openapi/model/upu_info_1.c b/lib/sbi/openapi/model/upu_info_1.c index f5689fc21..7084b992a 100644 --- a/lib/sbi/openapi/model/upu_info_1.c +++ b/lib/sbi/openapi/model/upu_info_1.c @@ -6,22 +6,28 @@ OpenAPI_upu_info_1_t *OpenAPI_upu_info_1_create( OpenAPI_list_t *upu_data_list, + bool is_upu_reg_ind, int upu_reg_ind, + bool is_upu_ack_ind, int upu_ack_ind, char *upu_mac_iausf, char *counter_upu, - char *provisioning_time + char *provisioning_time, + char *upu_transparent_container ) { OpenAPI_upu_info_1_t *upu_info_1_local_var = ogs_malloc(sizeof(OpenAPI_upu_info_1_t)); ogs_assert(upu_info_1_local_var); upu_info_1_local_var->upu_data_list = upu_data_list; + upu_info_1_local_var->is_upu_reg_ind = is_upu_reg_ind; upu_info_1_local_var->upu_reg_ind = upu_reg_ind; + upu_info_1_local_var->is_upu_ack_ind = is_upu_ack_ind; upu_info_1_local_var->upu_ack_ind = upu_ack_ind; upu_info_1_local_var->upu_mac_iausf = upu_mac_iausf; upu_info_1_local_var->counter_upu = counter_upu; upu_info_1_local_var->provisioning_time = provisioning_time; + upu_info_1_local_var->upu_transparent_container = upu_transparent_container; return upu_info_1_local_var; } @@ -52,6 +58,10 @@ void OpenAPI_upu_info_1_free(OpenAPI_upu_info_1_t *upu_info_1) ogs_free(upu_info_1->provisioning_time); upu_info_1->provisioning_time = NULL; } + if (upu_info_1->upu_transparent_container) { + ogs_free(upu_info_1->upu_transparent_container); + upu_info_1->upu_transparent_container = NULL; + } ogs_free(upu_info_1); } @@ -66,10 +76,7 @@ cJSON *OpenAPI_upu_info_1_convertToJSON(OpenAPI_upu_info_1_t *upu_info_1) } item = cJSON_CreateObject(); - if (!upu_info_1->upu_data_list) { - ogs_error("OpenAPI_upu_info_1_convertToJSON() failed [upu_data_list]"); - return NULL; - } + if (upu_info_1->upu_data_list) { cJSON *upu_data_listList = cJSON_AddArrayToObject(item, "upuDataList"); if (upu_data_listList == NULL) { ogs_error("OpenAPI_upu_info_1_convertToJSON() failed [upu_data_list]"); @@ -83,16 +90,21 @@ cJSON *OpenAPI_upu_info_1_convertToJSON(OpenAPI_upu_info_1_t *upu_info_1) } cJSON_AddItemToArray(upu_data_listList, itemLocal); } + } + if (upu_info_1->is_upu_reg_ind) { if (cJSON_AddBoolToObject(item, "upuRegInd", upu_info_1->upu_reg_ind) == NULL) { ogs_error("OpenAPI_upu_info_1_convertToJSON() failed [upu_reg_ind]"); goto end; } + } + if (upu_info_1->is_upu_ack_ind) { if (cJSON_AddBoolToObject(item, "upuAckInd", upu_info_1->upu_ack_ind) == NULL) { ogs_error("OpenAPI_upu_info_1_convertToJSON() failed [upu_ack_ind]"); goto end; } + } if (upu_info_1->upu_mac_iausf) { if (cJSON_AddStringToObject(item, "upuMacIausf", upu_info_1->upu_mac_iausf) == NULL) { @@ -117,6 +129,13 @@ cJSON *OpenAPI_upu_info_1_convertToJSON(OpenAPI_upu_info_1_t *upu_info_1) goto end; } + if (upu_info_1->upu_transparent_container) { + if (cJSON_AddStringToObject(item, "upuTransparentContainer", upu_info_1->upu_transparent_container) == NULL) { + ogs_error("OpenAPI_upu_info_1_convertToJSON() failed [upu_transparent_container]"); + goto end; + } + } + end: return item; } @@ -132,11 +151,9 @@ OpenAPI_upu_info_1_t *OpenAPI_upu_info_1_parseFromJSON(cJSON *upu_info_1JSON) cJSON *upu_mac_iausf = NULL; cJSON *counter_upu = NULL; cJSON *provisioning_time = NULL; + cJSON *upu_transparent_container = NULL; upu_data_list = cJSON_GetObjectItemCaseSensitive(upu_info_1JSON, "upuDataList"); - if (!upu_data_list) { - ogs_error("OpenAPI_upu_info_1_parseFromJSON() failed [upu_data_list]"); - goto end; - } + if (upu_data_list) { cJSON *upu_data_list_local = NULL; if (!cJSON_IsArray(upu_data_list)) { ogs_error("OpenAPI_upu_info_1_parseFromJSON() failed [upu_data_list]"); @@ -158,26 +175,23 @@ OpenAPI_upu_info_1_t *OpenAPI_upu_info_1_parseFromJSON(cJSON *upu_info_1JSON) } OpenAPI_list_add(upu_data_listList, upu_data_listItem); } + } upu_reg_ind = cJSON_GetObjectItemCaseSensitive(upu_info_1JSON, "upuRegInd"); - if (!upu_reg_ind) { - ogs_error("OpenAPI_upu_info_1_parseFromJSON() failed [upu_reg_ind]"); - goto end; - } + if (upu_reg_ind) { if (!cJSON_IsBool(upu_reg_ind)) { ogs_error("OpenAPI_upu_info_1_parseFromJSON() failed [upu_reg_ind]"); goto end; } + } upu_ack_ind = cJSON_GetObjectItemCaseSensitive(upu_info_1JSON, "upuAckInd"); - if (!upu_ack_ind) { - ogs_error("OpenAPI_upu_info_1_parseFromJSON() failed [upu_ack_ind]"); - goto end; - } + if (upu_ack_ind) { if (!cJSON_IsBool(upu_ack_ind)) { ogs_error("OpenAPI_upu_info_1_parseFromJSON() failed [upu_ack_ind]"); goto end; } + } upu_mac_iausf = cJSON_GetObjectItemCaseSensitive(upu_info_1JSON, "upuMacIausf"); if (upu_mac_iausf) { @@ -205,15 +219,24 @@ OpenAPI_upu_info_1_t *OpenAPI_upu_info_1_parseFromJSON(cJSON *upu_info_1JSON) goto end; } + upu_transparent_container = cJSON_GetObjectItemCaseSensitive(upu_info_1JSON, "upuTransparentContainer"); + if (upu_transparent_container) { + if (!cJSON_IsString(upu_transparent_container) && !cJSON_IsNull(upu_transparent_container)) { + ogs_error("OpenAPI_upu_info_1_parseFromJSON() failed [upu_transparent_container]"); + goto end; + } + } + upu_info_1_local_var = OpenAPI_upu_info_1_create ( - upu_data_listList, - - upu_reg_ind->valueint, - - upu_ack_ind->valueint, + upu_data_list ? upu_data_listList : NULL, + upu_reg_ind ? true : false, + upu_reg_ind ? upu_reg_ind->valueint : 0, + upu_ack_ind ? true : false, + upu_ack_ind ? upu_ack_ind->valueint : 0, upu_mac_iausf && !cJSON_IsNull(upu_mac_iausf) ? ogs_strdup(upu_mac_iausf->valuestring) : NULL, counter_upu && !cJSON_IsNull(counter_upu) ? ogs_strdup(counter_upu->valuestring) : NULL, - ogs_strdup(provisioning_time->valuestring) + ogs_strdup(provisioning_time->valuestring), + upu_transparent_container && !cJSON_IsNull(upu_transparent_container) ? ogs_strdup(upu_transparent_container->valuestring) : NULL ); return upu_info_1_local_var; diff --git a/lib/sbi/openapi/model/upu_info_1.h b/lib/sbi/openapi/model/upu_info_1.h index 41edd47b9..37411da5d 100644 --- a/lib/sbi/openapi/model/upu_info_1.h +++ b/lib/sbi/openapi/model/upu_info_1.h @@ -21,20 +21,26 @@ extern "C" { typedef struct OpenAPI_upu_info_1_s OpenAPI_upu_info_1_t; typedef struct OpenAPI_upu_info_1_s { OpenAPI_list_t *upu_data_list; + bool is_upu_reg_ind; int upu_reg_ind; + bool is_upu_ack_ind; int upu_ack_ind; char *upu_mac_iausf; char *counter_upu; char *provisioning_time; + char *upu_transparent_container; } OpenAPI_upu_info_1_t; OpenAPI_upu_info_1_t *OpenAPI_upu_info_1_create( OpenAPI_list_t *upu_data_list, + bool is_upu_reg_ind, int upu_reg_ind, + bool is_upu_ack_ind, int upu_ack_ind, char *upu_mac_iausf, char *counter_upu, - char *provisioning_time + char *provisioning_time, + char *upu_transparent_container ); void OpenAPI_upu_info_1_free(OpenAPI_upu_info_1_t *upu_info_1); OpenAPI_upu_info_1_t *OpenAPI_upu_info_1_parseFromJSON(cJSON *upu_info_1JSON); diff --git a/lib/sbi/openapi/model/get_nf_instances_200_response.c b/lib/sbi/openapi/model/uri_list.c similarity index 52% rename from lib/sbi/openapi/model/get_nf_instances_200_response.c rename to lib/sbi/openapi/model/uri_list.c index 0ea8a2b2b..200151ec1 100644 --- a/lib/sbi/openapi/model/get_nf_instances_200_response.c +++ b/lib/sbi/openapi/model/uri_list.c @@ -2,66 +2,70 @@ #include #include #include -#include "get_nf_instances_200_response.h" +#include "uri_list.h" -OpenAPI_get_nf_instances_200_response_t *OpenAPI_get_nf_instances_200_response_create( - OpenAPI_list_t* _links +OpenAPI_uri_list_t *OpenAPI_uri_list_create( + OpenAPI_list_t* _links, + bool is_total_item_count, + int total_item_count ) { - OpenAPI_get_nf_instances_200_response_t *get_nf_instances_200_response_local_var = ogs_malloc(sizeof(OpenAPI_get_nf_instances_200_response_t)); - ogs_assert(get_nf_instances_200_response_local_var); + OpenAPI_uri_list_t *uri_list_local_var = ogs_malloc(sizeof(OpenAPI_uri_list_t)); + ogs_assert(uri_list_local_var); - get_nf_instances_200_response_local_var->_links = _links; + uri_list_local_var->_links = _links; + uri_list_local_var->is_total_item_count = is_total_item_count; + uri_list_local_var->total_item_count = total_item_count; - return get_nf_instances_200_response_local_var; + return uri_list_local_var; } -void OpenAPI_get_nf_instances_200_response_free(OpenAPI_get_nf_instances_200_response_t *get_nf_instances_200_response) +void OpenAPI_uri_list_free(OpenAPI_uri_list_t *uri_list) { OpenAPI_lnode_t *node = NULL; - if (NULL == get_nf_instances_200_response) { + if (NULL == uri_list) { return; } - if (get_nf_instances_200_response->_links) { - OpenAPI_list_for_each(get_nf_instances_200_response->_links, node) { + if (uri_list->_links) { + OpenAPI_list_for_each(uri_list->_links, node) { OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*)node->data; ogs_free(localKeyValue->key); OpenAPI_links_value_schema_free(localKeyValue->value); OpenAPI_map_free(localKeyValue); } - OpenAPI_list_free(get_nf_instances_200_response->_links); - get_nf_instances_200_response->_links = NULL; + OpenAPI_list_free(uri_list->_links); + uri_list->_links = NULL; } - ogs_free(get_nf_instances_200_response); + ogs_free(uri_list); } -cJSON *OpenAPI_get_nf_instances_200_response_convertToJSON(OpenAPI_get_nf_instances_200_response_t *get_nf_instances_200_response) +cJSON *OpenAPI_uri_list_convertToJSON(OpenAPI_uri_list_t *uri_list) { cJSON *item = NULL; OpenAPI_lnode_t *node = NULL; - if (get_nf_instances_200_response == NULL) { - ogs_error("OpenAPI_get_nf_instances_200_response_convertToJSON() failed [GetNFInstances_200_response]"); + if (uri_list == NULL) { + ogs_error("OpenAPI_uri_list_convertToJSON() failed [UriList]"); return NULL; } item = cJSON_CreateObject(); - if (get_nf_instances_200_response->_links) { + if (uri_list->_links) { cJSON *_links = cJSON_AddObjectToObject(item, "_links"); if (_links == NULL) { - ogs_error("OpenAPI_get_nf_instances_200_response_convertToJSON() failed [_links]"); + ogs_error("OpenAPI_uri_list_convertToJSON() failed [_links]"); goto end; } cJSON *localMapObject = _links; - if (get_nf_instances_200_response->_links) { - OpenAPI_list_for_each(get_nf_instances_200_response->_links, node) { + if (uri_list->_links) { + OpenAPI_list_for_each(uri_list->_links, node) { OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*)node->data; cJSON *itemLocal = localKeyValue->value ? OpenAPI_links_value_schema_convertToJSON(localKeyValue->value) : cJSON_CreateNull(); if (itemLocal == NULL) { - ogs_error("OpenAPI_get_nf_instances_200_response_convertToJSON() failed [inner]"); + ogs_error("OpenAPI_uri_list_convertToJSON() failed [inner]"); goto end; } cJSON_AddItemToObject(localMapObject, localKeyValue->key, itemLocal); @@ -69,21 +73,29 @@ cJSON *OpenAPI_get_nf_instances_200_response_convertToJSON(OpenAPI_get_nf_instan } } + if (uri_list->is_total_item_count) { + if (cJSON_AddNumberToObject(item, "totalItemCount", uri_list->total_item_count) == NULL) { + ogs_error("OpenAPI_uri_list_convertToJSON() failed [total_item_count]"); + goto end; + } + } + end: return item; } -OpenAPI_get_nf_instances_200_response_t *OpenAPI_get_nf_instances_200_response_parseFromJSON(cJSON *get_nf_instances_200_responseJSON) +OpenAPI_uri_list_t *OpenAPI_uri_list_parseFromJSON(cJSON *uri_listJSON) { - OpenAPI_get_nf_instances_200_response_t *get_nf_instances_200_response_local_var = NULL; + OpenAPI_uri_list_t *uri_list_local_var = NULL; OpenAPI_lnode_t *node = NULL; cJSON *_links = NULL; OpenAPI_list_t *_linksList = NULL; - _links = cJSON_GetObjectItemCaseSensitive(get_nf_instances_200_responseJSON, "_links"); + cJSON *total_item_count = NULL; + _links = cJSON_GetObjectItemCaseSensitive(uri_listJSON, "_links"); if (_links) { cJSON *_links_local_map = NULL; if (!cJSON_IsObject(_links) && !cJSON_IsNull(_links)) { - ogs_error("OpenAPI_get_nf_instances_200_response_parseFromJSON() failed [_links]"); + ogs_error("OpenAPI_uri_list_parseFromJSON() failed [_links]"); goto end; } if (cJSON_IsObject(_links)) { @@ -97,7 +109,7 @@ OpenAPI_get_nf_instances_200_response_t *OpenAPI_get_nf_instances_200_response_p } else if (cJSON_IsNull(localMapObject)) { localMapKeyPair = OpenAPI_map_create(ogs_strdup(localMapObject->string), NULL); } else { - ogs_error("OpenAPI_get_nf_instances_200_response_parseFromJSON() failed [inner]"); + ogs_error("OpenAPI_uri_list_parseFromJSON() failed [inner]"); goto end; } OpenAPI_list_add(_linksList, localMapKeyPair); @@ -105,11 +117,21 @@ OpenAPI_get_nf_instances_200_response_t *OpenAPI_get_nf_instances_200_response_p } } - get_nf_instances_200_response_local_var = OpenAPI_get_nf_instances_200_response_create ( - _links ? _linksList : NULL + total_item_count = cJSON_GetObjectItemCaseSensitive(uri_listJSON, "totalItemCount"); + if (total_item_count) { + if (!cJSON_IsNumber(total_item_count)) { + ogs_error("OpenAPI_uri_list_parseFromJSON() failed [total_item_count]"); + goto end; + } + } + + uri_list_local_var = OpenAPI_uri_list_create ( + _links ? _linksList : NULL, + total_item_count ? true : false, + total_item_count ? total_item_count->valuedouble : 0 ); - return get_nf_instances_200_response_local_var; + return uri_list_local_var; end: if (_linksList) { OpenAPI_list_for_each(_linksList, node) { @@ -124,15 +146,15 @@ end: return NULL; } -OpenAPI_get_nf_instances_200_response_t *OpenAPI_get_nf_instances_200_response_copy(OpenAPI_get_nf_instances_200_response_t *dst, OpenAPI_get_nf_instances_200_response_t *src) +OpenAPI_uri_list_t *OpenAPI_uri_list_copy(OpenAPI_uri_list_t *dst, OpenAPI_uri_list_t *src) { cJSON *item = NULL; char *content = NULL; ogs_assert(src); - item = OpenAPI_get_nf_instances_200_response_convertToJSON(src); + item = OpenAPI_uri_list_convertToJSON(src); if (!item) { - ogs_error("OpenAPI_get_nf_instances_200_response_convertToJSON() failed"); + ogs_error("OpenAPI_uri_list_convertToJSON() failed"); return NULL; } @@ -151,8 +173,8 @@ OpenAPI_get_nf_instances_200_response_t *OpenAPI_get_nf_instances_200_response_c return NULL; } - OpenAPI_get_nf_instances_200_response_free(dst); - dst = OpenAPI_get_nf_instances_200_response_parseFromJSON(item); + OpenAPI_uri_list_free(dst); + dst = OpenAPI_uri_list_parseFromJSON(item); cJSON_Delete(item); return dst; diff --git a/lib/sbi/openapi/model/uri_list.h b/lib/sbi/openapi/model/uri_list.h new file mode 100644 index 000000000..e49b5b622 --- /dev/null +++ b/lib/sbi/openapi/model/uri_list.h @@ -0,0 +1,43 @@ +/* + * uri_list.h + * + * Represents a set of URIs following the 3GPP hypermedia format (containing a \"_links\" attribute). + */ + +#ifndef _OpenAPI_uri_list_H_ +#define _OpenAPI_uri_list_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "links_value_schema.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_uri_list_s OpenAPI_uri_list_t; +typedef struct OpenAPI_uri_list_s { + OpenAPI_list_t* _links; + bool is_total_item_count; + int total_item_count; +} OpenAPI_uri_list_t; + +OpenAPI_uri_list_t *OpenAPI_uri_list_create( + OpenAPI_list_t* _links, + bool is_total_item_count, + int total_item_count +); +void OpenAPI_uri_list_free(OpenAPI_uri_list_t *uri_list); +OpenAPI_uri_list_t *OpenAPI_uri_list_parseFromJSON(cJSON *uri_listJSON); +cJSON *OpenAPI_uri_list_convertToJSON(OpenAPI_uri_list_t *uri_list); +OpenAPI_uri_list_t *OpenAPI_uri_list_copy(OpenAPI_uri_list_t *dst, OpenAPI_uri_list_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_uri_list_H_ */ + diff --git a/lib/sbi/openapi/model/ursp_rule_request.c b/lib/sbi/openapi/model/ursp_rule_request.c new file mode 100644 index 000000000..12169fc05 --- /dev/null +++ b/lib/sbi/openapi/model/ursp_rule_request.c @@ -0,0 +1,200 @@ + +#include +#include +#include +#include "ursp_rule_request.h" + +OpenAPI_ursp_rule_request_t *OpenAPI_ursp_rule_request_create( + OpenAPI_traffic_descriptor_components_t *traffic_desc, + bool is_relat_precedence, + int relat_precedence, + OpenAPI_list_t *route_sel_param_sets +) +{ + OpenAPI_ursp_rule_request_t *ursp_rule_request_local_var = ogs_malloc(sizeof(OpenAPI_ursp_rule_request_t)); + ogs_assert(ursp_rule_request_local_var); + + ursp_rule_request_local_var->traffic_desc = traffic_desc; + ursp_rule_request_local_var->is_relat_precedence = is_relat_precedence; + ursp_rule_request_local_var->relat_precedence = relat_precedence; + ursp_rule_request_local_var->route_sel_param_sets = route_sel_param_sets; + + return ursp_rule_request_local_var; +} + +void OpenAPI_ursp_rule_request_free(OpenAPI_ursp_rule_request_t *ursp_rule_request) +{ + OpenAPI_lnode_t *node = NULL; + + if (NULL == ursp_rule_request) { + return; + } + if (ursp_rule_request->traffic_desc) { + OpenAPI_traffic_descriptor_components_free(ursp_rule_request->traffic_desc); + ursp_rule_request->traffic_desc = NULL; + } + if (ursp_rule_request->route_sel_param_sets) { + OpenAPI_list_for_each(ursp_rule_request->route_sel_param_sets, node) { + OpenAPI_route_selection_parameter_set_free(node->data); + } + OpenAPI_list_free(ursp_rule_request->route_sel_param_sets); + ursp_rule_request->route_sel_param_sets = NULL; + } + ogs_free(ursp_rule_request); +} + +cJSON *OpenAPI_ursp_rule_request_convertToJSON(OpenAPI_ursp_rule_request_t *ursp_rule_request) +{ + cJSON *item = NULL; + OpenAPI_lnode_t *node = NULL; + + if (ursp_rule_request == NULL) { + ogs_error("OpenAPI_ursp_rule_request_convertToJSON() failed [UrspRuleRequest]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (ursp_rule_request->traffic_desc) { + cJSON *traffic_desc_local_JSON = OpenAPI_traffic_descriptor_components_convertToJSON(ursp_rule_request->traffic_desc); + if (traffic_desc_local_JSON == NULL) { + ogs_error("OpenAPI_ursp_rule_request_convertToJSON() failed [traffic_desc]"); + goto end; + } + cJSON_AddItemToObject(item, "trafficDesc", traffic_desc_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_ursp_rule_request_convertToJSON() failed [traffic_desc]"); + goto end; + } + } + + if (ursp_rule_request->is_relat_precedence) { + if (cJSON_AddNumberToObject(item, "relatPrecedence", ursp_rule_request->relat_precedence) == NULL) { + ogs_error("OpenAPI_ursp_rule_request_convertToJSON() failed [relat_precedence]"); + goto end; + } + } + + if (ursp_rule_request->route_sel_param_sets) { + cJSON *route_sel_param_setsList = cJSON_AddArrayToObject(item, "routeSelParamSets"); + if (route_sel_param_setsList == NULL) { + ogs_error("OpenAPI_ursp_rule_request_convertToJSON() failed [route_sel_param_sets]"); + goto end; + } + OpenAPI_list_for_each(ursp_rule_request->route_sel_param_sets, node) { + cJSON *itemLocal = OpenAPI_route_selection_parameter_set_convertToJSON(node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_ursp_rule_request_convertToJSON() failed [route_sel_param_sets]"); + goto end; + } + cJSON_AddItemToArray(route_sel_param_setsList, itemLocal); + } + } + +end: + return item; +} + +OpenAPI_ursp_rule_request_t *OpenAPI_ursp_rule_request_parseFromJSON(cJSON *ursp_rule_requestJSON) +{ + OpenAPI_ursp_rule_request_t *ursp_rule_request_local_var = NULL; + OpenAPI_lnode_t *node = NULL; + cJSON *traffic_desc = NULL; + OpenAPI_traffic_descriptor_components_t *traffic_desc_local_nonprim = NULL; + cJSON *relat_precedence = NULL; + cJSON *route_sel_param_sets = NULL; + OpenAPI_list_t *route_sel_param_setsList = NULL; + traffic_desc = cJSON_GetObjectItemCaseSensitive(ursp_rule_requestJSON, "trafficDesc"); + if (traffic_desc) { + traffic_desc_local_nonprim = OpenAPI_traffic_descriptor_components_parseFromJSON(traffic_desc); + } + + relat_precedence = cJSON_GetObjectItemCaseSensitive(ursp_rule_requestJSON, "relatPrecedence"); + if (relat_precedence) { + if (!cJSON_IsNumber(relat_precedence)) { + ogs_error("OpenAPI_ursp_rule_request_parseFromJSON() failed [relat_precedence]"); + goto end; + } + } + + route_sel_param_sets = cJSON_GetObjectItemCaseSensitive(ursp_rule_requestJSON, "routeSelParamSets"); + if (route_sel_param_sets) { + cJSON *route_sel_param_sets_local = NULL; + if (!cJSON_IsArray(route_sel_param_sets)) { + ogs_error("OpenAPI_ursp_rule_request_parseFromJSON() failed [route_sel_param_sets]"); + goto end; + } + + route_sel_param_setsList = OpenAPI_list_create(); + + cJSON_ArrayForEach(route_sel_param_sets_local, route_sel_param_sets) { + if (!cJSON_IsObject(route_sel_param_sets_local)) { + ogs_error("OpenAPI_ursp_rule_request_parseFromJSON() failed [route_sel_param_sets]"); + goto end; + } + OpenAPI_route_selection_parameter_set_t *route_sel_param_setsItem = OpenAPI_route_selection_parameter_set_parseFromJSON(route_sel_param_sets_local); + if (!route_sel_param_setsItem) { + ogs_error("No route_sel_param_setsItem"); + OpenAPI_list_free(route_sel_param_setsList); + goto end; + } + OpenAPI_list_add(route_sel_param_setsList, route_sel_param_setsItem); + } + } + + ursp_rule_request_local_var = OpenAPI_ursp_rule_request_create ( + traffic_desc ? traffic_desc_local_nonprim : NULL, + relat_precedence ? true : false, + relat_precedence ? relat_precedence->valuedouble : 0, + route_sel_param_sets ? route_sel_param_setsList : NULL + ); + + return ursp_rule_request_local_var; +end: + if (traffic_desc_local_nonprim) { + OpenAPI_traffic_descriptor_components_free(traffic_desc_local_nonprim); + traffic_desc_local_nonprim = NULL; + } + if (route_sel_param_setsList) { + OpenAPI_list_for_each(route_sel_param_setsList, node) { + OpenAPI_route_selection_parameter_set_free(node->data); + } + OpenAPI_list_free(route_sel_param_setsList); + route_sel_param_setsList = NULL; + } + return NULL; +} + +OpenAPI_ursp_rule_request_t *OpenAPI_ursp_rule_request_copy(OpenAPI_ursp_rule_request_t *dst, OpenAPI_ursp_rule_request_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_ursp_rule_request_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_ursp_rule_request_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_ursp_rule_request_free(dst); + dst = OpenAPI_ursp_rule_request_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/ursp_rule_request.h b/lib/sbi/openapi/model/ursp_rule_request.h new file mode 100644 index 000000000..bbf598440 --- /dev/null +++ b/lib/sbi/openapi/model/ursp_rule_request.h @@ -0,0 +1,46 @@ +/* + * ursp_rule_request.h + * + * Contains parameters that can be used to guide the URSP. + */ + +#ifndef _OpenAPI_ursp_rule_request_H_ +#define _OpenAPI_ursp_rule_request_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "route_selection_parameter_set.h" +#include "traffic_descriptor_components.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_ursp_rule_request_s OpenAPI_ursp_rule_request_t; +typedef struct OpenAPI_ursp_rule_request_s { + struct OpenAPI_traffic_descriptor_components_s *traffic_desc; + bool is_relat_precedence; + int relat_precedence; + OpenAPI_list_t *route_sel_param_sets; +} OpenAPI_ursp_rule_request_t; + +OpenAPI_ursp_rule_request_t *OpenAPI_ursp_rule_request_create( + OpenAPI_traffic_descriptor_components_t *traffic_desc, + bool is_relat_precedence, + int relat_precedence, + OpenAPI_list_t *route_sel_param_sets +); +void OpenAPI_ursp_rule_request_free(OpenAPI_ursp_rule_request_t *ursp_rule_request); +OpenAPI_ursp_rule_request_t *OpenAPI_ursp_rule_request_parseFromJSON(cJSON *ursp_rule_requestJSON); +cJSON *OpenAPI_ursp_rule_request_convertToJSON(OpenAPI_ursp_rule_request_t *ursp_rule_request); +OpenAPI_ursp_rule_request_t *OpenAPI_ursp_rule_request_copy(OpenAPI_ursp_rule_request_t *dst, OpenAPI_ursp_rule_request_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_ursp_rule_request_H_ */ + diff --git a/lib/sbi/openapi/model/usage_mon_data.c b/lib/sbi/openapi/model/usage_mon_data.c index fb0a7abf1..018365755 100644 --- a/lib/sbi/openapi/model/usage_mon_data.c +++ b/lib/sbi/openapi/model/usage_mon_data.c @@ -9,8 +9,9 @@ OpenAPI_usage_mon_data_t *OpenAPI_usage_mon_data_create( OpenAPI_list_t* scopes, OpenAPI_usage_mon_level_t *um_level, OpenAPI_usage_threshold_t *allowed_usage, - OpenAPI_time_period_t *reset_time, - char *supp_feat + char *reset_time, + char *supp_feat, + OpenAPI_list_t *reset_ids ) { OpenAPI_usage_mon_data_t *usage_mon_data_local_var = ogs_malloc(sizeof(OpenAPI_usage_mon_data_t)); @@ -22,6 +23,7 @@ OpenAPI_usage_mon_data_t *OpenAPI_usage_mon_data_create( usage_mon_data_local_var->allowed_usage = allowed_usage; usage_mon_data_local_var->reset_time = reset_time; usage_mon_data_local_var->supp_feat = supp_feat; + usage_mon_data_local_var->reset_ids = reset_ids; return usage_mon_data_local_var; } @@ -56,13 +58,20 @@ void OpenAPI_usage_mon_data_free(OpenAPI_usage_mon_data_t *usage_mon_data) usage_mon_data->allowed_usage = NULL; } if (usage_mon_data->reset_time) { - OpenAPI_time_period_free(usage_mon_data->reset_time); + ogs_free(usage_mon_data->reset_time); usage_mon_data->reset_time = NULL; } if (usage_mon_data->supp_feat) { ogs_free(usage_mon_data->supp_feat); usage_mon_data->supp_feat = NULL; } + if (usage_mon_data->reset_ids) { + OpenAPI_list_for_each(usage_mon_data->reset_ids, node) { + ogs_free(node->data); + } + OpenAPI_list_free(usage_mon_data->reset_ids); + usage_mon_data->reset_ids = NULL; + } ogs_free(usage_mon_data); } @@ -135,13 +144,7 @@ cJSON *OpenAPI_usage_mon_data_convertToJSON(OpenAPI_usage_mon_data_t *usage_mon_ } if (usage_mon_data->reset_time) { - cJSON *reset_time_local_JSON = OpenAPI_time_period_convertToJSON(usage_mon_data->reset_time); - if (reset_time_local_JSON == NULL) { - ogs_error("OpenAPI_usage_mon_data_convertToJSON() failed [reset_time]"); - goto end; - } - cJSON_AddItemToObject(item, "resetTime", reset_time_local_JSON); - if (item->child == NULL) { + if (cJSON_AddStringToObject(item, "resetTime", usage_mon_data->reset_time) == NULL) { ogs_error("OpenAPI_usage_mon_data_convertToJSON() failed [reset_time]"); goto end; } @@ -154,6 +157,20 @@ cJSON *OpenAPI_usage_mon_data_convertToJSON(OpenAPI_usage_mon_data_t *usage_mon_ } } + if (usage_mon_data->reset_ids) { + cJSON *reset_idsList = cJSON_AddArrayToObject(item, "resetIds"); + if (reset_idsList == NULL) { + ogs_error("OpenAPI_usage_mon_data_convertToJSON() failed [reset_ids]"); + goto end; + } + OpenAPI_list_for_each(usage_mon_data->reset_ids, node) { + if (cJSON_AddStringToObject(reset_idsList, "", (char*)node->data) == NULL) { + ogs_error("OpenAPI_usage_mon_data_convertToJSON() failed [reset_ids]"); + goto end; + } + } + } + end: return item; } @@ -170,8 +187,9 @@ OpenAPI_usage_mon_data_t *OpenAPI_usage_mon_data_parseFromJSON(cJSON *usage_mon_ cJSON *allowed_usage = NULL; OpenAPI_usage_threshold_t *allowed_usage_local_nonprim = NULL; cJSON *reset_time = NULL; - OpenAPI_time_period_t *reset_time_local_nonprim = NULL; cJSON *supp_feat = NULL; + cJSON *reset_ids = NULL; + OpenAPI_list_t *reset_idsList = NULL; limit_id = cJSON_GetObjectItemCaseSensitive(usage_mon_dataJSON, "limitId"); if (!limit_id) { ogs_error("OpenAPI_usage_mon_data_parseFromJSON() failed [limit_id]"); @@ -220,7 +238,10 @@ OpenAPI_usage_mon_data_t *OpenAPI_usage_mon_data_parseFromJSON(cJSON *usage_mon_ reset_time = cJSON_GetObjectItemCaseSensitive(usage_mon_dataJSON, "resetTime"); if (reset_time) { - reset_time_local_nonprim = OpenAPI_time_period_parseFromJSON(reset_time); + if (!cJSON_IsString(reset_time) && !cJSON_IsNull(reset_time)) { + ogs_error("OpenAPI_usage_mon_data_parseFromJSON() failed [reset_time]"); + goto end; + } } supp_feat = cJSON_GetObjectItemCaseSensitive(usage_mon_dataJSON, "suppFeat"); @@ -231,13 +252,35 @@ OpenAPI_usage_mon_data_t *OpenAPI_usage_mon_data_parseFromJSON(cJSON *usage_mon_ } } + reset_ids = cJSON_GetObjectItemCaseSensitive(usage_mon_dataJSON, "resetIds"); + if (reset_ids) { + cJSON *reset_ids_local = NULL; + if (!cJSON_IsArray(reset_ids)) { + ogs_error("OpenAPI_usage_mon_data_parseFromJSON() failed [reset_ids]"); + goto end; + } + + reset_idsList = OpenAPI_list_create(); + + cJSON_ArrayForEach(reset_ids_local, reset_ids) { + double *localDouble = NULL; + int *localInt = NULL; + if (!cJSON_IsString(reset_ids_local)) { + ogs_error("OpenAPI_usage_mon_data_parseFromJSON() failed [reset_ids]"); + goto end; + } + OpenAPI_list_add(reset_idsList, ogs_strdup(reset_ids_local->valuestring)); + } + } + usage_mon_data_local_var = OpenAPI_usage_mon_data_create ( ogs_strdup(limit_id->valuestring), scopes ? scopesList : NULL, um_level ? um_level_local_nonprim : NULL, allowed_usage ? allowed_usage_local_nonprim : NULL, - reset_time ? reset_time_local_nonprim : NULL, - supp_feat && !cJSON_IsNull(supp_feat) ? ogs_strdup(supp_feat->valuestring) : NULL + reset_time && !cJSON_IsNull(reset_time) ? ogs_strdup(reset_time->valuestring) : NULL, + supp_feat && !cJSON_IsNull(supp_feat) ? ogs_strdup(supp_feat->valuestring) : NULL, + reset_ids ? reset_idsList : NULL ); return usage_mon_data_local_var; @@ -260,9 +303,12 @@ end: OpenAPI_usage_threshold_free(allowed_usage_local_nonprim); allowed_usage_local_nonprim = NULL; } - if (reset_time_local_nonprim) { - OpenAPI_time_period_free(reset_time_local_nonprim); - reset_time_local_nonprim = NULL; + if (reset_idsList) { + OpenAPI_list_for_each(reset_idsList, node) { + ogs_free(node->data); + } + OpenAPI_list_free(reset_idsList); + reset_idsList = NULL; } return NULL; } diff --git a/lib/sbi/openapi/model/usage_mon_data.h b/lib/sbi/openapi/model/usage_mon_data.h index b0c3c48e3..fc3946ca9 100644 --- a/lib/sbi/openapi/model/usage_mon_data.h +++ b/lib/sbi/openapi/model/usage_mon_data.h @@ -12,7 +12,6 @@ #include "../include/list.h" #include "../include/keyValuePair.h" #include "../include/binary.h" -#include "time_period.h" #include "usage_mon_data_scope.h" #include "usage_mon_level.h" #include "usage_threshold.h" @@ -27,8 +26,9 @@ typedef struct OpenAPI_usage_mon_data_s { OpenAPI_list_t* scopes; struct OpenAPI_usage_mon_level_s *um_level; struct OpenAPI_usage_threshold_s *allowed_usage; - struct OpenAPI_time_period_s *reset_time; + char *reset_time; char *supp_feat; + OpenAPI_list_t *reset_ids; } OpenAPI_usage_mon_data_t; OpenAPI_usage_mon_data_t *OpenAPI_usage_mon_data_create( @@ -36,8 +36,9 @@ OpenAPI_usage_mon_data_t *OpenAPI_usage_mon_data_create( OpenAPI_list_t* scopes, OpenAPI_usage_mon_level_t *um_level, OpenAPI_usage_threshold_t *allowed_usage, - OpenAPI_time_period_t *reset_time, - char *supp_feat + char *reset_time, + char *supp_feat, + OpenAPI_list_t *reset_ids ); void OpenAPI_usage_mon_data_free(OpenAPI_usage_mon_data_t *usage_mon_data); OpenAPI_usage_mon_data_t *OpenAPI_usage_mon_data_parseFromJSON(cJSON *usage_mon_dataJSON); diff --git a/lib/sbi/openapi/model/usage_mon_data_limit.c b/lib/sbi/openapi/model/usage_mon_data_limit.c index c83a9a486..7a75ceab8 100644 --- a/lib/sbi/openapi/model/usage_mon_data_limit.c +++ b/lib/sbi/openapi/model/usage_mon_data_limit.c @@ -11,7 +11,7 @@ OpenAPI_usage_mon_data_limit_t *OpenAPI_usage_mon_data_limit_create( char *start_date, char *end_date, OpenAPI_usage_threshold_t *usage_limit, - char *reset_period + OpenAPI_time_period_t *reset_period ) { OpenAPI_usage_mon_data_limit_t *usage_mon_data_limit_local_var = ogs_malloc(sizeof(OpenAPI_usage_mon_data_limit_t)); @@ -66,7 +66,7 @@ void OpenAPI_usage_mon_data_limit_free(OpenAPI_usage_mon_data_limit_t *usage_mon usage_mon_data_limit->usage_limit = NULL; } if (usage_mon_data_limit->reset_period) { - ogs_free(usage_mon_data_limit->reset_period); + OpenAPI_time_period_free(usage_mon_data_limit->reset_period); usage_mon_data_limit->reset_period = NULL; } ogs_free(usage_mon_data_limit); @@ -155,7 +155,13 @@ cJSON *OpenAPI_usage_mon_data_limit_convertToJSON(OpenAPI_usage_mon_data_limit_t } if (usage_mon_data_limit->reset_period) { - if (cJSON_AddStringToObject(item, "resetPeriod", usage_mon_data_limit->reset_period) == NULL) { + cJSON *reset_period_local_JSON = OpenAPI_time_period_convertToJSON(usage_mon_data_limit->reset_period); + if (reset_period_local_JSON == NULL) { + ogs_error("OpenAPI_usage_mon_data_limit_convertToJSON() failed [reset_period]"); + goto end; + } + cJSON_AddItemToObject(item, "resetPeriod", reset_period_local_JSON); + if (item->child == NULL) { ogs_error("OpenAPI_usage_mon_data_limit_convertToJSON() failed [reset_period]"); goto end; } @@ -179,6 +185,7 @@ OpenAPI_usage_mon_data_limit_t *OpenAPI_usage_mon_data_limit_parseFromJSON(cJSON cJSON *usage_limit = NULL; OpenAPI_usage_threshold_t *usage_limit_local_nonprim = NULL; cJSON *reset_period = NULL; + OpenAPI_time_period_t *reset_period_local_nonprim = NULL; limit_id = cJSON_GetObjectItemCaseSensitive(usage_mon_data_limitJSON, "limitId"); if (!limit_id) { ogs_error("OpenAPI_usage_mon_data_limit_parseFromJSON() failed [limit_id]"); @@ -243,10 +250,7 @@ OpenAPI_usage_mon_data_limit_t *OpenAPI_usage_mon_data_limit_parseFromJSON(cJSON reset_period = cJSON_GetObjectItemCaseSensitive(usage_mon_data_limitJSON, "resetPeriod"); if (reset_period) { - if (!cJSON_IsString(reset_period) && !cJSON_IsNull(reset_period)) { - ogs_error("OpenAPI_usage_mon_data_limit_parseFromJSON() failed [reset_period]"); - goto end; - } + reset_period_local_nonprim = OpenAPI_time_period_parseFromJSON(reset_period); } usage_mon_data_limit_local_var = OpenAPI_usage_mon_data_limit_create ( @@ -256,7 +260,7 @@ OpenAPI_usage_mon_data_limit_t *OpenAPI_usage_mon_data_limit_parseFromJSON(cJSON start_date && !cJSON_IsNull(start_date) ? ogs_strdup(start_date->valuestring) : NULL, end_date && !cJSON_IsNull(end_date) ? ogs_strdup(end_date->valuestring) : NULL, usage_limit ? usage_limit_local_nonprim : NULL, - reset_period && !cJSON_IsNull(reset_period) ? ogs_strdup(reset_period->valuestring) : NULL + reset_period ? reset_period_local_nonprim : NULL ); return usage_mon_data_limit_local_var; @@ -279,6 +283,10 @@ end: OpenAPI_usage_threshold_free(usage_limit_local_nonprim); usage_limit_local_nonprim = NULL; } + if (reset_period_local_nonprim) { + OpenAPI_time_period_free(reset_period_local_nonprim); + reset_period_local_nonprim = NULL; + } return NULL; } diff --git a/lib/sbi/openapi/model/usage_mon_data_limit.h b/lib/sbi/openapi/model/usage_mon_data_limit.h index a41f982d3..2d0592372 100644 --- a/lib/sbi/openapi/model/usage_mon_data_limit.h +++ b/lib/sbi/openapi/model/usage_mon_data_limit.h @@ -12,6 +12,7 @@ #include "../include/list.h" #include "../include/keyValuePair.h" #include "../include/binary.h" +#include "time_period.h" #include "usage_mon_data_scope.h" #include "usage_mon_level.h" #include "usage_threshold.h" @@ -28,7 +29,7 @@ typedef struct OpenAPI_usage_mon_data_limit_s { char *start_date; char *end_date; struct OpenAPI_usage_threshold_s *usage_limit; - char *reset_period; + struct OpenAPI_time_period_s *reset_period; } OpenAPI_usage_mon_data_limit_t; OpenAPI_usage_mon_data_limit_t *OpenAPI_usage_mon_data_limit_create( @@ -38,7 +39,7 @@ OpenAPI_usage_mon_data_limit_t *OpenAPI_usage_mon_data_limit_create( char *start_date, char *end_date, OpenAPI_usage_threshold_t *usage_limit, - char *reset_period + OpenAPI_time_period_t *reset_period ); void OpenAPI_usage_mon_data_limit_free(OpenAPI_usage_mon_data_limit_t *usage_mon_data_limit); OpenAPI_usage_mon_data_limit_t *OpenAPI_usage_mon_data_limit_parseFromJSON(cJSON *usage_mon_data_limitJSON); diff --git a/lib/sbi/openapi/model/usage_mon_data_scope.h b/lib/sbi/openapi/model/usage_mon_data_scope.h index 0e52bac6f..f8779cc64 100644 --- a/lib/sbi/openapi/model/usage_mon_data_scope.h +++ b/lib/sbi/openapi/model/usage_mon_data_scope.h @@ -1,7 +1,7 @@ /* * usage_mon_data_scope.h * - * Contains a SNSSAI and DNN combinations to which the UsageMonData instance belongs to. + * Contains a SNSSAI and DNN combinations to which the UsageMonData instance belongs to. */ #ifndef _OpenAPI_usage_mon_data_scope_H_ diff --git a/lib/sbi/openapi/model/usage_mon_level.h b/lib/sbi/openapi/model/usage_mon_level.h index a0c74de57..f0efbe7d1 100644 --- a/lib/sbi/openapi/model/usage_mon_level.h +++ b/lib/sbi/openapi/model/usage_mon_level.h @@ -1,7 +1,7 @@ /* * usage_mon_level.h * - * + * Represents the usage monitoring level. */ #ifndef _OpenAPI_usage_mon_level_H_ diff --git a/lib/sbi/openapi/model/usage_monitoring_data.h b/lib/sbi/openapi/model/usage_monitoring_data.h index 9955e6e40..fe0c7fe3e 100644 --- a/lib/sbi/openapi/model/usage_monitoring_data.h +++ b/lib/sbi/openapi/model/usage_monitoring_data.h @@ -1,7 +1,7 @@ /* * usage_monitoring_data.h * - * + * Contains usage monitoring related control information. */ #ifndef _OpenAPI_usage_monitoring_data_H_ diff --git a/lib/sbi/openapi/model/usage_threshold.h b/lib/sbi/openapi/model/usage_threshold.h index be0fd33a1..2405ac221 100644 --- a/lib/sbi/openapi/model/usage_threshold.h +++ b/lib/sbi/openapi/model/usage_threshold.h @@ -1,7 +1,7 @@ /* * usage_threshold.h * - * + * Represents a usage threshold. */ #ifndef _OpenAPI_usage_threshold_H_ diff --git a/lib/sbi/openapi/model/usage_threshold_rm.h b/lib/sbi/openapi/model/usage_threshold_rm.h index e843b2dc3..7e6e96e8f 100644 --- a/lib/sbi/openapi/model/usage_threshold_rm.h +++ b/lib/sbi/openapi/model/usage_threshold_rm.h @@ -1,7 +1,7 @@ /* * usage_threshold_rm.h * - * + * Represents the same as the UsageThreshold data type but with the nullable:true property. */ #ifndef _OpenAPI_usage_threshold_rm_H_ diff --git a/lib/sbi/openapi/model/user_consent.c b/lib/sbi/openapi/model/user_consent.c new file mode 100644 index 000000000..5b1f3410d --- /dev/null +++ b/lib/sbi/openapi/model/user_consent.c @@ -0,0 +1,30 @@ + +#include +#include +#include +#include "user_consent.h" + +char* OpenAPI_user_consent_ToString(OpenAPI_user_consent_e user_consent) +{ + const char *user_consentArray[] = { "NULL", "CONSENT_NOT_GIVEN", "CONSENT_GIVEN" }; + size_t sizeofArray = sizeof(user_consentArray) / sizeof(user_consentArray[0]); + if (user_consent < sizeofArray) + return (char *)user_consentArray[user_consent]; + else + return (char *)"Unknown"; +} + +OpenAPI_user_consent_e OpenAPI_user_consent_FromString(char* user_consent) +{ + int stringToReturn = 0; + const char *user_consentArray[] = { "NULL", "CONSENT_NOT_GIVEN", "CONSENT_GIVEN" }; + size_t sizeofArray = sizeof(user_consentArray) / sizeof(user_consentArray[0]); + while (stringToReturn < sizeofArray) { + if (strcmp(user_consent, user_consentArray[stringToReturn]) == 0) { + return stringToReturn; + } + stringToReturn++; + } + return 0; +} + diff --git a/lib/sbi/openapi/model/user_consent.h b/lib/sbi/openapi/model/user_consent.h new file mode 100644 index 000000000..89e99ae8b --- /dev/null +++ b/lib/sbi/openapi/model/user_consent.h @@ -0,0 +1,31 @@ +/* + * user_consent.h + * + * + */ + +#ifndef _OpenAPI_user_consent_H_ +#define _OpenAPI_user_consent_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef enum { OpenAPI_user_consent_NULL = 0, OpenAPI_user_consent_CONSENT_NOT_GIVEN, OpenAPI_user_consent_CONSENT_GIVEN } OpenAPI_user_consent_e; + +char* OpenAPI_user_consent_ToString(OpenAPI_user_consent_e user_consent); + +OpenAPI_user_consent_e OpenAPI_user_consent_FromString(char* user_consent); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_user_consent_H_ */ + diff --git a/lib/sbi/openapi/model/user_data_congestion_info.c b/lib/sbi/openapi/model/user_data_congestion_info.c new file mode 100644 index 000000000..6a46e28f7 --- /dev/null +++ b/lib/sbi/openapi/model/user_data_congestion_info.c @@ -0,0 +1,188 @@ + +#include +#include +#include +#include "user_data_congestion_info.h" + +OpenAPI_user_data_congestion_info_t *OpenAPI_user_data_congestion_info_create( + OpenAPI_network_area_info_t *network_area, + OpenAPI_congestion_info_t *congestion_info, + OpenAPI_snssai_t *snssai +) +{ + OpenAPI_user_data_congestion_info_t *user_data_congestion_info_local_var = ogs_malloc(sizeof(OpenAPI_user_data_congestion_info_t)); + ogs_assert(user_data_congestion_info_local_var); + + user_data_congestion_info_local_var->network_area = network_area; + user_data_congestion_info_local_var->congestion_info = congestion_info; + user_data_congestion_info_local_var->snssai = snssai; + + return user_data_congestion_info_local_var; +} + +void OpenAPI_user_data_congestion_info_free(OpenAPI_user_data_congestion_info_t *user_data_congestion_info) +{ + OpenAPI_lnode_t *node = NULL; + + if (NULL == user_data_congestion_info) { + return; + } + if (user_data_congestion_info->network_area) { + OpenAPI_network_area_info_free(user_data_congestion_info->network_area); + user_data_congestion_info->network_area = NULL; + } + if (user_data_congestion_info->congestion_info) { + OpenAPI_congestion_info_free(user_data_congestion_info->congestion_info); + user_data_congestion_info->congestion_info = NULL; + } + if (user_data_congestion_info->snssai) { + OpenAPI_snssai_free(user_data_congestion_info->snssai); + user_data_congestion_info->snssai = NULL; + } + ogs_free(user_data_congestion_info); +} + +cJSON *OpenAPI_user_data_congestion_info_convertToJSON(OpenAPI_user_data_congestion_info_t *user_data_congestion_info) +{ + cJSON *item = NULL; + OpenAPI_lnode_t *node = NULL; + + if (user_data_congestion_info == NULL) { + ogs_error("OpenAPI_user_data_congestion_info_convertToJSON() failed [UserDataCongestionInfo]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (!user_data_congestion_info->network_area) { + ogs_error("OpenAPI_user_data_congestion_info_convertToJSON() failed [network_area]"); + return NULL; + } + cJSON *network_area_local_JSON = OpenAPI_network_area_info_convertToJSON(user_data_congestion_info->network_area); + if (network_area_local_JSON == NULL) { + ogs_error("OpenAPI_user_data_congestion_info_convertToJSON() failed [network_area]"); + goto end; + } + cJSON_AddItemToObject(item, "networkArea", network_area_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_user_data_congestion_info_convertToJSON() failed [network_area]"); + goto end; + } + + if (!user_data_congestion_info->congestion_info) { + ogs_error("OpenAPI_user_data_congestion_info_convertToJSON() failed [congestion_info]"); + return NULL; + } + cJSON *congestion_info_local_JSON = OpenAPI_congestion_info_convertToJSON(user_data_congestion_info->congestion_info); + if (congestion_info_local_JSON == NULL) { + ogs_error("OpenAPI_user_data_congestion_info_convertToJSON() failed [congestion_info]"); + goto end; + } + cJSON_AddItemToObject(item, "congestionInfo", congestion_info_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_user_data_congestion_info_convertToJSON() failed [congestion_info]"); + goto end; + } + + if (user_data_congestion_info->snssai) { + cJSON *snssai_local_JSON = OpenAPI_snssai_convertToJSON(user_data_congestion_info->snssai); + if (snssai_local_JSON == NULL) { + ogs_error("OpenAPI_user_data_congestion_info_convertToJSON() failed [snssai]"); + goto end; + } + cJSON_AddItemToObject(item, "snssai", snssai_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_user_data_congestion_info_convertToJSON() failed [snssai]"); + goto end; + } + } + +end: + return item; +} + +OpenAPI_user_data_congestion_info_t *OpenAPI_user_data_congestion_info_parseFromJSON(cJSON *user_data_congestion_infoJSON) +{ + OpenAPI_user_data_congestion_info_t *user_data_congestion_info_local_var = NULL; + OpenAPI_lnode_t *node = NULL; + cJSON *network_area = NULL; + OpenAPI_network_area_info_t *network_area_local_nonprim = NULL; + cJSON *congestion_info = NULL; + OpenAPI_congestion_info_t *congestion_info_local_nonprim = NULL; + cJSON *snssai = NULL; + OpenAPI_snssai_t *snssai_local_nonprim = NULL; + network_area = cJSON_GetObjectItemCaseSensitive(user_data_congestion_infoJSON, "networkArea"); + if (!network_area) { + ogs_error("OpenAPI_user_data_congestion_info_parseFromJSON() failed [network_area]"); + goto end; + } + network_area_local_nonprim = OpenAPI_network_area_info_parseFromJSON(network_area); + + congestion_info = cJSON_GetObjectItemCaseSensitive(user_data_congestion_infoJSON, "congestionInfo"); + if (!congestion_info) { + ogs_error("OpenAPI_user_data_congestion_info_parseFromJSON() failed [congestion_info]"); + goto end; + } + congestion_info_local_nonprim = OpenAPI_congestion_info_parseFromJSON(congestion_info); + + snssai = cJSON_GetObjectItemCaseSensitive(user_data_congestion_infoJSON, "snssai"); + if (snssai) { + snssai_local_nonprim = OpenAPI_snssai_parseFromJSON(snssai); + } + + user_data_congestion_info_local_var = OpenAPI_user_data_congestion_info_create ( + network_area_local_nonprim, + congestion_info_local_nonprim, + snssai ? snssai_local_nonprim : NULL + ); + + return user_data_congestion_info_local_var; +end: + if (network_area_local_nonprim) { + OpenAPI_network_area_info_free(network_area_local_nonprim); + network_area_local_nonprim = NULL; + } + if (congestion_info_local_nonprim) { + OpenAPI_congestion_info_free(congestion_info_local_nonprim); + congestion_info_local_nonprim = NULL; + } + if (snssai_local_nonprim) { + OpenAPI_snssai_free(snssai_local_nonprim); + snssai_local_nonprim = NULL; + } + return NULL; +} + +OpenAPI_user_data_congestion_info_t *OpenAPI_user_data_congestion_info_copy(OpenAPI_user_data_congestion_info_t *dst, OpenAPI_user_data_congestion_info_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_user_data_congestion_info_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_user_data_congestion_info_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_user_data_congestion_info_free(dst); + dst = OpenAPI_user_data_congestion_info_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/user_data_congestion_info.h b/lib/sbi/openapi/model/user_data_congestion_info.h new file mode 100644 index 000000000..fb6d81538 --- /dev/null +++ b/lib/sbi/openapi/model/user_data_congestion_info.h @@ -0,0 +1,45 @@ +/* + * user_data_congestion_info.h + * + * Represents the user data congestion information. + */ + +#ifndef _OpenAPI_user_data_congestion_info_H_ +#define _OpenAPI_user_data_congestion_info_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "congestion_info.h" +#include "network_area_info.h" +#include "snssai.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_user_data_congestion_info_s OpenAPI_user_data_congestion_info_t; +typedef struct OpenAPI_user_data_congestion_info_s { + struct OpenAPI_network_area_info_s *network_area; + struct OpenAPI_congestion_info_s *congestion_info; + struct OpenAPI_snssai_s *snssai; +} OpenAPI_user_data_congestion_info_t; + +OpenAPI_user_data_congestion_info_t *OpenAPI_user_data_congestion_info_create( + OpenAPI_network_area_info_t *network_area, + OpenAPI_congestion_info_t *congestion_info, + OpenAPI_snssai_t *snssai +); +void OpenAPI_user_data_congestion_info_free(OpenAPI_user_data_congestion_info_t *user_data_congestion_info); +OpenAPI_user_data_congestion_info_t *OpenAPI_user_data_congestion_info_parseFromJSON(cJSON *user_data_congestion_infoJSON); +cJSON *OpenAPI_user_data_congestion_info_convertToJSON(OpenAPI_user_data_congestion_info_t *user_data_congestion_info); +OpenAPI_user_data_congestion_info_t *OpenAPI_user_data_congestion_info_copy(OpenAPI_user_data_congestion_info_t *dst, OpenAPI_user_data_congestion_info_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_user_data_congestion_info_H_ */ + diff --git a/lib/sbi/openapi/model/user_identifier.h b/lib/sbi/openapi/model/user_identifier.h index ac732de7e..85eca7264 100644 --- a/lib/sbi/openapi/model/user_identifier.h +++ b/lib/sbi/openapi/model/user_identifier.h @@ -1,7 +1,7 @@ /* * user_identifier.h * - * + * Represents the user identifier. */ #ifndef _OpenAPI_user_identifier_H_ diff --git a/lib/sbi/openapi/model/user_location.c b/lib/sbi/openapi/model/user_location.c index 0ed3d8685..13fe41ecd 100644 --- a/lib/sbi/openapi/model/user_location.c +++ b/lib/sbi/openapi/model/user_location.c @@ -7,7 +7,9 @@ OpenAPI_user_location_t *OpenAPI_user_location_create( OpenAPI_eutra_location_t *eutra_location, OpenAPI_nr_location_t *nr_location, - OpenAPI_n3ga_location_t *n3ga_location + OpenAPI_n3ga_location_t *n3ga_location, + OpenAPI_utra_location_t *utra_location, + OpenAPI_gera_location_t *gera_location ) { OpenAPI_user_location_t *user_location_local_var = ogs_malloc(sizeof(OpenAPI_user_location_t)); @@ -16,6 +18,8 @@ OpenAPI_user_location_t *OpenAPI_user_location_create( user_location_local_var->eutra_location = eutra_location; user_location_local_var->nr_location = nr_location; user_location_local_var->n3ga_location = n3ga_location; + user_location_local_var->utra_location = utra_location; + user_location_local_var->gera_location = gera_location; return user_location_local_var; } @@ -39,6 +43,14 @@ void OpenAPI_user_location_free(OpenAPI_user_location_t *user_location) OpenAPI_n3ga_location_free(user_location->n3ga_location); user_location->n3ga_location = NULL; } + if (user_location->utra_location) { + OpenAPI_utra_location_free(user_location->utra_location); + user_location->utra_location = NULL; + } + if (user_location->gera_location) { + OpenAPI_gera_location_free(user_location->gera_location); + user_location->gera_location = NULL; + } ogs_free(user_location); } @@ -92,6 +104,32 @@ cJSON *OpenAPI_user_location_convertToJSON(OpenAPI_user_location_t *user_locatio } } + if (user_location->utra_location) { + cJSON *utra_location_local_JSON = OpenAPI_utra_location_convertToJSON(user_location->utra_location); + if (utra_location_local_JSON == NULL) { + ogs_error("OpenAPI_user_location_convertToJSON() failed [utra_location]"); + goto end; + } + cJSON_AddItemToObject(item, "utraLocation", utra_location_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_user_location_convertToJSON() failed [utra_location]"); + goto end; + } + } + + if (user_location->gera_location) { + cJSON *gera_location_local_JSON = OpenAPI_gera_location_convertToJSON(user_location->gera_location); + if (gera_location_local_JSON == NULL) { + ogs_error("OpenAPI_user_location_convertToJSON() failed [gera_location]"); + goto end; + } + cJSON_AddItemToObject(item, "geraLocation", gera_location_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_user_location_convertToJSON() failed [gera_location]"); + goto end; + } + } + end: return item; } @@ -106,6 +144,10 @@ OpenAPI_user_location_t *OpenAPI_user_location_parseFromJSON(cJSON *user_locatio OpenAPI_nr_location_t *nr_location_local_nonprim = NULL; cJSON *n3ga_location = NULL; OpenAPI_n3ga_location_t *n3ga_location_local_nonprim = NULL; + cJSON *utra_location = NULL; + OpenAPI_utra_location_t *utra_location_local_nonprim = NULL; + cJSON *gera_location = NULL; + OpenAPI_gera_location_t *gera_location_local_nonprim = NULL; eutra_location = cJSON_GetObjectItemCaseSensitive(user_locationJSON, "eutraLocation"); if (eutra_location) { eutra_location_local_nonprim = OpenAPI_eutra_location_parseFromJSON(eutra_location); @@ -121,10 +163,22 @@ OpenAPI_user_location_t *OpenAPI_user_location_parseFromJSON(cJSON *user_locatio n3ga_location_local_nonprim = OpenAPI_n3ga_location_parseFromJSON(n3ga_location); } + utra_location = cJSON_GetObjectItemCaseSensitive(user_locationJSON, "utraLocation"); + if (utra_location) { + utra_location_local_nonprim = OpenAPI_utra_location_parseFromJSON(utra_location); + } + + gera_location = cJSON_GetObjectItemCaseSensitive(user_locationJSON, "geraLocation"); + if (gera_location) { + gera_location_local_nonprim = OpenAPI_gera_location_parseFromJSON(gera_location); + } + user_location_local_var = OpenAPI_user_location_create ( eutra_location ? eutra_location_local_nonprim : NULL, nr_location ? nr_location_local_nonprim : NULL, - n3ga_location ? n3ga_location_local_nonprim : NULL + n3ga_location ? n3ga_location_local_nonprim : NULL, + utra_location ? utra_location_local_nonprim : NULL, + gera_location ? gera_location_local_nonprim : NULL ); return user_location_local_var; @@ -141,6 +195,14 @@ end: OpenAPI_n3ga_location_free(n3ga_location_local_nonprim); n3ga_location_local_nonprim = NULL; } + if (utra_location_local_nonprim) { + OpenAPI_utra_location_free(utra_location_local_nonprim); + utra_location_local_nonprim = NULL; + } + if (gera_location_local_nonprim) { + OpenAPI_gera_location_free(gera_location_local_nonprim); + gera_location_local_nonprim = NULL; + } return NULL; } diff --git a/lib/sbi/openapi/model/user_location.h b/lib/sbi/openapi/model/user_location.h index 48fc8da77..889180739 100644 --- a/lib/sbi/openapi/model/user_location.h +++ b/lib/sbi/openapi/model/user_location.h @@ -1,7 +1,7 @@ /* * user_location.h * - * + * At least one of eutraLocation, nrLocation and n3gaLocation shall be present. Several of them may be present. */ #ifndef _OpenAPI_user_location_H_ @@ -13,8 +13,10 @@ #include "../include/keyValuePair.h" #include "../include/binary.h" #include "eutra_location.h" +#include "gera_location.h" #include "n3ga_location.h" #include "nr_location.h" +#include "utra_location.h" #ifdef __cplusplus extern "C" { @@ -25,12 +27,16 @@ typedef struct OpenAPI_user_location_s { struct OpenAPI_eutra_location_s *eutra_location; struct OpenAPI_nr_location_s *nr_location; struct OpenAPI_n3ga_location_s *n3ga_location; + struct OpenAPI_utra_location_s *utra_location; + struct OpenAPI_gera_location_s *gera_location; } OpenAPI_user_location_t; OpenAPI_user_location_t *OpenAPI_user_location_create( OpenAPI_eutra_location_t *eutra_location, OpenAPI_nr_location_t *nr_location, - OpenAPI_n3ga_location_t *n3ga_location + OpenAPI_n3ga_location_t *n3ga_location, + OpenAPI_utra_location_t *utra_location, + OpenAPI_gera_location_t *gera_location ); void OpenAPI_user_location_free(OpenAPI_user_location_t *user_location); OpenAPI_user_location_t *OpenAPI_user_location_parseFromJSON(cJSON *user_locationJSON); diff --git a/lib/sbi/openapi/model/utra_location.c b/lib/sbi/openapi/model/utra_location.c new file mode 100644 index 000000000..e71b164a1 --- /dev/null +++ b/lib/sbi/openapi/model/utra_location.c @@ -0,0 +1,302 @@ + +#include +#include +#include +#include "utra_location.h" + +OpenAPI_utra_location_t *OpenAPI_utra_location_create( + OpenAPI_cell_global_id_t *cgi, + OpenAPI_service_area_id_t *sai, + OpenAPI_location_area_id_t *lai, + OpenAPI_routing_area_id_t *rai, + bool is_age_of_location_information, + int age_of_location_information, + char *ue_location_timestamp, + char *geographical_information, + char *geodetic_information +) +{ + OpenAPI_utra_location_t *utra_location_local_var = ogs_malloc(sizeof(OpenAPI_utra_location_t)); + ogs_assert(utra_location_local_var); + + utra_location_local_var->cgi = cgi; + utra_location_local_var->sai = sai; + utra_location_local_var->lai = lai; + utra_location_local_var->rai = rai; + utra_location_local_var->is_age_of_location_information = is_age_of_location_information; + utra_location_local_var->age_of_location_information = age_of_location_information; + utra_location_local_var->ue_location_timestamp = ue_location_timestamp; + utra_location_local_var->geographical_information = geographical_information; + utra_location_local_var->geodetic_information = geodetic_information; + + return utra_location_local_var; +} + +void OpenAPI_utra_location_free(OpenAPI_utra_location_t *utra_location) +{ + OpenAPI_lnode_t *node = NULL; + + if (NULL == utra_location) { + return; + } + if (utra_location->cgi) { + OpenAPI_cell_global_id_free(utra_location->cgi); + utra_location->cgi = NULL; + } + if (utra_location->sai) { + OpenAPI_service_area_id_free(utra_location->sai); + utra_location->sai = NULL; + } + if (utra_location->lai) { + OpenAPI_location_area_id_free(utra_location->lai); + utra_location->lai = NULL; + } + if (utra_location->rai) { + OpenAPI_routing_area_id_free(utra_location->rai); + utra_location->rai = NULL; + } + if (utra_location->ue_location_timestamp) { + ogs_free(utra_location->ue_location_timestamp); + utra_location->ue_location_timestamp = NULL; + } + if (utra_location->geographical_information) { + ogs_free(utra_location->geographical_information); + utra_location->geographical_information = NULL; + } + if (utra_location->geodetic_information) { + ogs_free(utra_location->geodetic_information); + utra_location->geodetic_information = NULL; + } + ogs_free(utra_location); +} + +cJSON *OpenAPI_utra_location_convertToJSON(OpenAPI_utra_location_t *utra_location) +{ + cJSON *item = NULL; + OpenAPI_lnode_t *node = NULL; + + if (utra_location == NULL) { + ogs_error("OpenAPI_utra_location_convertToJSON() failed [UtraLocation]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (utra_location->cgi) { + cJSON *cgi_local_JSON = OpenAPI_cell_global_id_convertToJSON(utra_location->cgi); + if (cgi_local_JSON == NULL) { + ogs_error("OpenAPI_utra_location_convertToJSON() failed [cgi]"); + goto end; + } + cJSON_AddItemToObject(item, "cgi", cgi_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_utra_location_convertToJSON() failed [cgi]"); + goto end; + } + } + + if (utra_location->sai) { + cJSON *sai_local_JSON = OpenAPI_service_area_id_convertToJSON(utra_location->sai); + if (sai_local_JSON == NULL) { + ogs_error("OpenAPI_utra_location_convertToJSON() failed [sai]"); + goto end; + } + cJSON_AddItemToObject(item, "sai", sai_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_utra_location_convertToJSON() failed [sai]"); + goto end; + } + } + + if (utra_location->lai) { + cJSON *lai_local_JSON = OpenAPI_location_area_id_convertToJSON(utra_location->lai); + if (lai_local_JSON == NULL) { + ogs_error("OpenAPI_utra_location_convertToJSON() failed [lai]"); + goto end; + } + cJSON_AddItemToObject(item, "lai", lai_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_utra_location_convertToJSON() failed [lai]"); + goto end; + } + } + + if (utra_location->rai) { + cJSON *rai_local_JSON = OpenAPI_routing_area_id_convertToJSON(utra_location->rai); + if (rai_local_JSON == NULL) { + ogs_error("OpenAPI_utra_location_convertToJSON() failed [rai]"); + goto end; + } + cJSON_AddItemToObject(item, "rai", rai_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_utra_location_convertToJSON() failed [rai]"); + goto end; + } + } + + if (utra_location->is_age_of_location_information) { + if (cJSON_AddNumberToObject(item, "ageOfLocationInformation", utra_location->age_of_location_information) == NULL) { + ogs_error("OpenAPI_utra_location_convertToJSON() failed [age_of_location_information]"); + goto end; + } + } + + if (utra_location->ue_location_timestamp) { + if (cJSON_AddStringToObject(item, "ueLocationTimestamp", utra_location->ue_location_timestamp) == NULL) { + ogs_error("OpenAPI_utra_location_convertToJSON() failed [ue_location_timestamp]"); + goto end; + } + } + + if (utra_location->geographical_information) { + if (cJSON_AddStringToObject(item, "geographicalInformation", utra_location->geographical_information) == NULL) { + ogs_error("OpenAPI_utra_location_convertToJSON() failed [geographical_information]"); + goto end; + } + } + + if (utra_location->geodetic_information) { + if (cJSON_AddStringToObject(item, "geodeticInformation", utra_location->geodetic_information) == NULL) { + ogs_error("OpenAPI_utra_location_convertToJSON() failed [geodetic_information]"); + goto end; + } + } + +end: + return item; +} + +OpenAPI_utra_location_t *OpenAPI_utra_location_parseFromJSON(cJSON *utra_locationJSON) +{ + OpenAPI_utra_location_t *utra_location_local_var = NULL; + OpenAPI_lnode_t *node = NULL; + cJSON *cgi = NULL; + OpenAPI_cell_global_id_t *cgi_local_nonprim = NULL; + cJSON *sai = NULL; + OpenAPI_service_area_id_t *sai_local_nonprim = NULL; + cJSON *lai = NULL; + OpenAPI_location_area_id_t *lai_local_nonprim = NULL; + cJSON *rai = NULL; + OpenAPI_routing_area_id_t *rai_local_nonprim = NULL; + cJSON *age_of_location_information = NULL; + cJSON *ue_location_timestamp = NULL; + cJSON *geographical_information = NULL; + cJSON *geodetic_information = NULL; + cgi = cJSON_GetObjectItemCaseSensitive(utra_locationJSON, "cgi"); + if (cgi) { + cgi_local_nonprim = OpenAPI_cell_global_id_parseFromJSON(cgi); + } + + sai = cJSON_GetObjectItemCaseSensitive(utra_locationJSON, "sai"); + if (sai) { + sai_local_nonprim = OpenAPI_service_area_id_parseFromJSON(sai); + } + + lai = cJSON_GetObjectItemCaseSensitive(utra_locationJSON, "lai"); + if (lai) { + lai_local_nonprim = OpenAPI_location_area_id_parseFromJSON(lai); + } + + rai = cJSON_GetObjectItemCaseSensitive(utra_locationJSON, "rai"); + if (rai) { + rai_local_nonprim = OpenAPI_routing_area_id_parseFromJSON(rai); + } + + age_of_location_information = cJSON_GetObjectItemCaseSensitive(utra_locationJSON, "ageOfLocationInformation"); + if (age_of_location_information) { + if (!cJSON_IsNumber(age_of_location_information)) { + ogs_error("OpenAPI_utra_location_parseFromJSON() failed [age_of_location_information]"); + goto end; + } + } + + ue_location_timestamp = cJSON_GetObjectItemCaseSensitive(utra_locationJSON, "ueLocationTimestamp"); + if (ue_location_timestamp) { + if (!cJSON_IsString(ue_location_timestamp) && !cJSON_IsNull(ue_location_timestamp)) { + ogs_error("OpenAPI_utra_location_parseFromJSON() failed [ue_location_timestamp]"); + goto end; + } + } + + geographical_information = cJSON_GetObjectItemCaseSensitive(utra_locationJSON, "geographicalInformation"); + if (geographical_information) { + if (!cJSON_IsString(geographical_information) && !cJSON_IsNull(geographical_information)) { + ogs_error("OpenAPI_utra_location_parseFromJSON() failed [geographical_information]"); + goto end; + } + } + + geodetic_information = cJSON_GetObjectItemCaseSensitive(utra_locationJSON, "geodeticInformation"); + if (geodetic_information) { + if (!cJSON_IsString(geodetic_information) && !cJSON_IsNull(geodetic_information)) { + ogs_error("OpenAPI_utra_location_parseFromJSON() failed [geodetic_information]"); + goto end; + } + } + + utra_location_local_var = OpenAPI_utra_location_create ( + cgi ? cgi_local_nonprim : NULL, + sai ? sai_local_nonprim : NULL, + lai ? lai_local_nonprim : NULL, + rai ? rai_local_nonprim : NULL, + age_of_location_information ? true : false, + age_of_location_information ? age_of_location_information->valuedouble : 0, + ue_location_timestamp && !cJSON_IsNull(ue_location_timestamp) ? ogs_strdup(ue_location_timestamp->valuestring) : NULL, + geographical_information && !cJSON_IsNull(geographical_information) ? ogs_strdup(geographical_information->valuestring) : NULL, + geodetic_information && !cJSON_IsNull(geodetic_information) ? ogs_strdup(geodetic_information->valuestring) : NULL + ); + + return utra_location_local_var; +end: + if (cgi_local_nonprim) { + OpenAPI_cell_global_id_free(cgi_local_nonprim); + cgi_local_nonprim = NULL; + } + if (sai_local_nonprim) { + OpenAPI_service_area_id_free(sai_local_nonprim); + sai_local_nonprim = NULL; + } + if (lai_local_nonprim) { + OpenAPI_location_area_id_free(lai_local_nonprim); + lai_local_nonprim = NULL; + } + if (rai_local_nonprim) { + OpenAPI_routing_area_id_free(rai_local_nonprim); + rai_local_nonprim = NULL; + } + return NULL; +} + +OpenAPI_utra_location_t *OpenAPI_utra_location_copy(OpenAPI_utra_location_t *dst, OpenAPI_utra_location_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_utra_location_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_utra_location_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_utra_location_free(dst); + dst = OpenAPI_utra_location_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/utra_location.h b/lib/sbi/openapi/model/utra_location.h new file mode 100644 index 000000000..072026d8c --- /dev/null +++ b/lib/sbi/openapi/model/utra_location.h @@ -0,0 +1,58 @@ +/* + * utra_location.h + * + * Exactly one of cgi, sai or lai shall be present. + */ + +#ifndef _OpenAPI_utra_location_H_ +#define _OpenAPI_utra_location_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "cell_global_id.h" +#include "location_area_id.h" +#include "routing_area_id.h" +#include "service_area_id.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_utra_location_s OpenAPI_utra_location_t; +typedef struct OpenAPI_utra_location_s { + struct OpenAPI_cell_global_id_s *cgi; + struct OpenAPI_service_area_id_s *sai; + struct OpenAPI_location_area_id_s *lai; + struct OpenAPI_routing_area_id_s *rai; + bool is_age_of_location_information; + int age_of_location_information; + char *ue_location_timestamp; + char *geographical_information; + char *geodetic_information; +} OpenAPI_utra_location_t; + +OpenAPI_utra_location_t *OpenAPI_utra_location_create( + OpenAPI_cell_global_id_t *cgi, + OpenAPI_service_area_id_t *sai, + OpenAPI_location_area_id_t *lai, + OpenAPI_routing_area_id_t *rai, + bool is_age_of_location_information, + int age_of_location_information, + char *ue_location_timestamp, + char *geographical_information, + char *geodetic_information +); +void OpenAPI_utra_location_free(OpenAPI_utra_location_t *utra_location); +OpenAPI_utra_location_t *OpenAPI_utra_location_parseFromJSON(cJSON *utra_locationJSON); +cJSON *OpenAPI_utra_location_convertToJSON(OpenAPI_utra_location_t *utra_location); +OpenAPI_utra_location_t *OpenAPI_utra_location_copy(OpenAPI_utra_location_t *dst, OpenAPI_utra_location_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_utra_location_H_ */ + diff --git a/lib/sbi/openapi/model/uuaa_mm_status.c b/lib/sbi/openapi/model/uuaa_mm_status.c new file mode 100644 index 000000000..f34b57278 --- /dev/null +++ b/lib/sbi/openapi/model/uuaa_mm_status.c @@ -0,0 +1,30 @@ + +#include +#include +#include +#include "uuaa_mm_status.h" + +char* OpenAPI_uuaa_mm_status_ToString(OpenAPI_uuaa_mm_status_e uuaa_mm_status) +{ + const char *uuaa_mm_statusArray[] = { "NULL", "SUCCESS", "PENDING", "FAILED" }; + size_t sizeofArray = sizeof(uuaa_mm_statusArray) / sizeof(uuaa_mm_statusArray[0]); + if (uuaa_mm_status < sizeofArray) + return (char *)uuaa_mm_statusArray[uuaa_mm_status]; + else + return (char *)"Unknown"; +} + +OpenAPI_uuaa_mm_status_e OpenAPI_uuaa_mm_status_FromString(char* uuaa_mm_status) +{ + int stringToReturn = 0; + const char *uuaa_mm_statusArray[] = { "NULL", "SUCCESS", "PENDING", "FAILED" }; + size_t sizeofArray = sizeof(uuaa_mm_statusArray) / sizeof(uuaa_mm_statusArray[0]); + while (stringToReturn < sizeofArray) { + if (strcmp(uuaa_mm_status, uuaa_mm_statusArray[stringToReturn]) == 0) { + return stringToReturn; + } + stringToReturn++; + } + return 0; +} + diff --git a/lib/sbi/openapi/model/uuaa_mm_status.h b/lib/sbi/openapi/model/uuaa_mm_status.h new file mode 100644 index 000000000..857cdfd5a --- /dev/null +++ b/lib/sbi/openapi/model/uuaa_mm_status.h @@ -0,0 +1,31 @@ +/* + * uuaa_mm_status.h + * + * + */ + +#ifndef _OpenAPI_uuaa_mm_status_H_ +#define _OpenAPI_uuaa_mm_status_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef enum { OpenAPI_uuaa_mm_status_NULL = 0, OpenAPI_uuaa_mm_status_SUCCESS, OpenAPI_uuaa_mm_status_PENDING, OpenAPI_uuaa_mm_status_FAILED } OpenAPI_uuaa_mm_status_e; + +char* OpenAPI_uuaa_mm_status_ToString(OpenAPI_uuaa_mm_status_e uuaa_mm_status); + +OpenAPI_uuaa_mm_status_e OpenAPI_uuaa_mm_status_FromString(char* uuaa_mm_status); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_uuaa_mm_status_H_ */ + diff --git a/lib/sbi/openapi/model/v2x_capability.c b/lib/sbi/openapi/model/v2x_capability.c new file mode 100644 index 000000000..885c913aa --- /dev/null +++ b/lib/sbi/openapi/model/v2x_capability.c @@ -0,0 +1,131 @@ + +#include +#include +#include +#include "v2x_capability.h" + +OpenAPI_v2x_capability_t *OpenAPI_v2x_capability_create( + bool is_lte_v2x, + int lte_v2x, + bool is_nr_v2x, + int nr_v2x +) +{ + OpenAPI_v2x_capability_t *v2x_capability_local_var = ogs_malloc(sizeof(OpenAPI_v2x_capability_t)); + ogs_assert(v2x_capability_local_var); + + v2x_capability_local_var->is_lte_v2x = is_lte_v2x; + v2x_capability_local_var->lte_v2x = lte_v2x; + v2x_capability_local_var->is_nr_v2x = is_nr_v2x; + v2x_capability_local_var->nr_v2x = nr_v2x; + + return v2x_capability_local_var; +} + +void OpenAPI_v2x_capability_free(OpenAPI_v2x_capability_t *v2x_capability) +{ + OpenAPI_lnode_t *node = NULL; + + if (NULL == v2x_capability) { + return; + } + ogs_free(v2x_capability); +} + +cJSON *OpenAPI_v2x_capability_convertToJSON(OpenAPI_v2x_capability_t *v2x_capability) +{ + cJSON *item = NULL; + OpenAPI_lnode_t *node = NULL; + + if (v2x_capability == NULL) { + ogs_error("OpenAPI_v2x_capability_convertToJSON() failed [V2xCapability]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (v2x_capability->is_lte_v2x) { + if (cJSON_AddBoolToObject(item, "lteV2x", v2x_capability->lte_v2x) == NULL) { + ogs_error("OpenAPI_v2x_capability_convertToJSON() failed [lte_v2x]"); + goto end; + } + } + + if (v2x_capability->is_nr_v2x) { + if (cJSON_AddBoolToObject(item, "nrV2x", v2x_capability->nr_v2x) == NULL) { + ogs_error("OpenAPI_v2x_capability_convertToJSON() failed [nr_v2x]"); + goto end; + } + } + +end: + return item; +} + +OpenAPI_v2x_capability_t *OpenAPI_v2x_capability_parseFromJSON(cJSON *v2x_capabilityJSON) +{ + OpenAPI_v2x_capability_t *v2x_capability_local_var = NULL; + OpenAPI_lnode_t *node = NULL; + cJSON *lte_v2x = NULL; + cJSON *nr_v2x = NULL; + lte_v2x = cJSON_GetObjectItemCaseSensitive(v2x_capabilityJSON, "lteV2x"); + if (lte_v2x) { + if (!cJSON_IsBool(lte_v2x)) { + ogs_error("OpenAPI_v2x_capability_parseFromJSON() failed [lte_v2x]"); + goto end; + } + } + + nr_v2x = cJSON_GetObjectItemCaseSensitive(v2x_capabilityJSON, "nrV2x"); + if (nr_v2x) { + if (!cJSON_IsBool(nr_v2x)) { + ogs_error("OpenAPI_v2x_capability_parseFromJSON() failed [nr_v2x]"); + goto end; + } + } + + v2x_capability_local_var = OpenAPI_v2x_capability_create ( + lte_v2x ? true : false, + lte_v2x ? lte_v2x->valueint : 0, + nr_v2x ? true : false, + nr_v2x ? nr_v2x->valueint : 0 + ); + + return v2x_capability_local_var; +end: + return NULL; +} + +OpenAPI_v2x_capability_t *OpenAPI_v2x_capability_copy(OpenAPI_v2x_capability_t *dst, OpenAPI_v2x_capability_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_v2x_capability_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_v2x_capability_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_v2x_capability_free(dst); + dst = OpenAPI_v2x_capability_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/v2x_capability.h b/lib/sbi/openapi/model/v2x_capability.h new file mode 100644 index 000000000..f94a8d3ef --- /dev/null +++ b/lib/sbi/openapi/model/v2x_capability.h @@ -0,0 +1,44 @@ +/* + * v2x_capability.h + * + * Indicate the supported V2X Capability by the PCF. + */ + +#ifndef _OpenAPI_v2x_capability_H_ +#define _OpenAPI_v2x_capability_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_v2x_capability_s OpenAPI_v2x_capability_t; +typedef struct OpenAPI_v2x_capability_s { + bool is_lte_v2x; + int lte_v2x; + bool is_nr_v2x; + int nr_v2x; +} OpenAPI_v2x_capability_t; + +OpenAPI_v2x_capability_t *OpenAPI_v2x_capability_create( + bool is_lte_v2x, + int lte_v2x, + bool is_nr_v2x, + int nr_v2x +); +void OpenAPI_v2x_capability_free(OpenAPI_v2x_capability_t *v2x_capability); +OpenAPI_v2x_capability_t *OpenAPI_v2x_capability_parseFromJSON(cJSON *v2x_capabilityJSON); +cJSON *OpenAPI_v2x_capability_convertToJSON(OpenAPI_v2x_capability_t *v2x_capability); +OpenAPI_v2x_capability_t *OpenAPI_v2x_capability_copy(OpenAPI_v2x_capability_t *dst, OpenAPI_v2x_capability_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_v2x_capability_H_ */ + diff --git a/lib/sbi/openapi/model/v2x_context.c b/lib/sbi/openapi/model/v2x_context.c index 3b40ccf60..b5b01b9c6 100644 --- a/lib/sbi/openapi/model/v2x_context.c +++ b/lib/sbi/openapi/model/v2x_context.c @@ -111,7 +111,7 @@ cJSON *OpenAPI_v2x_context_convertToJSON(OpenAPI_v2x_context_t *v2x_context) ogs_error("OpenAPI_v2x_context_convertToJSON() failed [pc5_qo_s_para]"); goto end; } - cJSON_AddItemToObject(item, "Pc5QoSPara", pc5_qo_s_para_local_JSON); + cJSON_AddItemToObject(item, "pc5QoSPara", pc5_qo_s_para_local_JSON); if (item->child == NULL) { ogs_error("OpenAPI_v2x_context_convertToJSON() failed [pc5_qo_s_para]"); goto end; @@ -160,7 +160,7 @@ OpenAPI_v2x_context_t *OpenAPI_v2x_context_parseFromJSON(cJSON *v2x_contextJSON) } } - pc5_qo_s_para = cJSON_GetObjectItemCaseSensitive(v2x_contextJSON, "Pc5QoSPara"); + pc5_qo_s_para = cJSON_GetObjectItemCaseSensitive(v2x_contextJSON, "pc5QoSPara"); if (pc5_qo_s_para) { pc5_qo_s_para_local_nonprim = OpenAPI_pc5_qo_s_para_parseFromJSON(pc5_qo_s_para); } diff --git a/lib/sbi/openapi/model/v2x_context.h b/lib/sbi/openapi/model/v2x_context.h index c2bbda86b..85edb0d27 100644 --- a/lib/sbi/openapi/model/v2x_context.h +++ b/lib/sbi/openapi/model/v2x_context.h @@ -1,7 +1,7 @@ /* * v2x_context.h * - * + * Represents the V2X services related parameters */ #ifndef _OpenAPI_v2x_context_H_ diff --git a/lib/sbi/openapi/model/v2x_information.h b/lib/sbi/openapi/model/v2x_information.h index 7e2f80140..cf54a509e 100644 --- a/lib/sbi/openapi/model/v2x_information.h +++ b/lib/sbi/openapi/model/v2x_information.h @@ -1,7 +1,7 @@ /* * v2x_information.h * - * + * V2X related N2 information */ #ifndef _OpenAPI_v2x_information_H_ diff --git a/lib/sbi/openapi/model/v2x_subscription_data_1.c b/lib/sbi/openapi/model/v2x_subscription_data_1.c deleted file mode 100644 index fa85f1517..000000000 --- a/lib/sbi/openapi/model/v2x_subscription_data_1.c +++ /dev/null @@ -1,195 +0,0 @@ - -#include -#include -#include -#include "v2x_subscription_data_1.h" - -OpenAPI_v2x_subscription_data_1_t *OpenAPI_v2x_subscription_data_1_create( - OpenAPI_nr_v2x_auth_1_t *nr_v2x_services_auth, - OpenAPI_lte_v2x_auth_1_t *lte_v2x_services_auth, - char *nr_ue_pc5_ambr, - char *lte_pc5_ambr -) -{ - OpenAPI_v2x_subscription_data_1_t *v2x_subscription_data_1_local_var = ogs_malloc(sizeof(OpenAPI_v2x_subscription_data_1_t)); - ogs_assert(v2x_subscription_data_1_local_var); - - v2x_subscription_data_1_local_var->nr_v2x_services_auth = nr_v2x_services_auth; - v2x_subscription_data_1_local_var->lte_v2x_services_auth = lte_v2x_services_auth; - v2x_subscription_data_1_local_var->nr_ue_pc5_ambr = nr_ue_pc5_ambr; - v2x_subscription_data_1_local_var->lte_pc5_ambr = lte_pc5_ambr; - - return v2x_subscription_data_1_local_var; -} - -void OpenAPI_v2x_subscription_data_1_free(OpenAPI_v2x_subscription_data_1_t *v2x_subscription_data_1) -{ - OpenAPI_lnode_t *node = NULL; - - if (NULL == v2x_subscription_data_1) { - return; - } - if (v2x_subscription_data_1->nr_v2x_services_auth) { - OpenAPI_nr_v2x_auth_1_free(v2x_subscription_data_1->nr_v2x_services_auth); - v2x_subscription_data_1->nr_v2x_services_auth = NULL; - } - if (v2x_subscription_data_1->lte_v2x_services_auth) { - OpenAPI_lte_v2x_auth_1_free(v2x_subscription_data_1->lte_v2x_services_auth); - v2x_subscription_data_1->lte_v2x_services_auth = NULL; - } - if (v2x_subscription_data_1->nr_ue_pc5_ambr) { - ogs_free(v2x_subscription_data_1->nr_ue_pc5_ambr); - v2x_subscription_data_1->nr_ue_pc5_ambr = NULL; - } - if (v2x_subscription_data_1->lte_pc5_ambr) { - ogs_free(v2x_subscription_data_1->lte_pc5_ambr); - v2x_subscription_data_1->lte_pc5_ambr = NULL; - } - ogs_free(v2x_subscription_data_1); -} - -cJSON *OpenAPI_v2x_subscription_data_1_convertToJSON(OpenAPI_v2x_subscription_data_1_t *v2x_subscription_data_1) -{ - cJSON *item = NULL; - OpenAPI_lnode_t *node = NULL; - - if (v2x_subscription_data_1 == NULL) { - ogs_error("OpenAPI_v2x_subscription_data_1_convertToJSON() failed [V2xSubscriptionData_1]"); - return NULL; - } - - item = cJSON_CreateObject(); - if (v2x_subscription_data_1->nr_v2x_services_auth) { - cJSON *nr_v2x_services_auth_local_JSON = OpenAPI_nr_v2x_auth_1_convertToJSON(v2x_subscription_data_1->nr_v2x_services_auth); - if (nr_v2x_services_auth_local_JSON == NULL) { - ogs_error("OpenAPI_v2x_subscription_data_1_convertToJSON() failed [nr_v2x_services_auth]"); - goto end; - } - cJSON_AddItemToObject(item, "nrV2xServicesAuth", nr_v2x_services_auth_local_JSON); - if (item->child == NULL) { - ogs_error("OpenAPI_v2x_subscription_data_1_convertToJSON() failed [nr_v2x_services_auth]"); - goto end; - } - } - - if (v2x_subscription_data_1->lte_v2x_services_auth) { - cJSON *lte_v2x_services_auth_local_JSON = OpenAPI_lte_v2x_auth_1_convertToJSON(v2x_subscription_data_1->lte_v2x_services_auth); - if (lte_v2x_services_auth_local_JSON == NULL) { - ogs_error("OpenAPI_v2x_subscription_data_1_convertToJSON() failed [lte_v2x_services_auth]"); - goto end; - } - cJSON_AddItemToObject(item, "lteV2xServicesAuth", lte_v2x_services_auth_local_JSON); - if (item->child == NULL) { - ogs_error("OpenAPI_v2x_subscription_data_1_convertToJSON() failed [lte_v2x_services_auth]"); - goto end; - } - } - - if (v2x_subscription_data_1->nr_ue_pc5_ambr) { - if (cJSON_AddStringToObject(item, "nrUePc5Ambr", v2x_subscription_data_1->nr_ue_pc5_ambr) == NULL) { - ogs_error("OpenAPI_v2x_subscription_data_1_convertToJSON() failed [nr_ue_pc5_ambr]"); - goto end; - } - } - - if (v2x_subscription_data_1->lte_pc5_ambr) { - if (cJSON_AddStringToObject(item, "ltePc5Ambr", v2x_subscription_data_1->lte_pc5_ambr) == NULL) { - ogs_error("OpenAPI_v2x_subscription_data_1_convertToJSON() failed [lte_pc5_ambr]"); - goto end; - } - } - -end: - return item; -} - -OpenAPI_v2x_subscription_data_1_t *OpenAPI_v2x_subscription_data_1_parseFromJSON(cJSON *v2x_subscription_data_1JSON) -{ - OpenAPI_v2x_subscription_data_1_t *v2x_subscription_data_1_local_var = NULL; - OpenAPI_lnode_t *node = NULL; - cJSON *nr_v2x_services_auth = NULL; - OpenAPI_nr_v2x_auth_1_t *nr_v2x_services_auth_local_nonprim = NULL; - cJSON *lte_v2x_services_auth = NULL; - OpenAPI_lte_v2x_auth_1_t *lte_v2x_services_auth_local_nonprim = NULL; - cJSON *nr_ue_pc5_ambr = NULL; - cJSON *lte_pc5_ambr = NULL; - nr_v2x_services_auth = cJSON_GetObjectItemCaseSensitive(v2x_subscription_data_1JSON, "nrV2xServicesAuth"); - if (nr_v2x_services_auth) { - nr_v2x_services_auth_local_nonprim = OpenAPI_nr_v2x_auth_1_parseFromJSON(nr_v2x_services_auth); - } - - lte_v2x_services_auth = cJSON_GetObjectItemCaseSensitive(v2x_subscription_data_1JSON, "lteV2xServicesAuth"); - if (lte_v2x_services_auth) { - lte_v2x_services_auth_local_nonprim = OpenAPI_lte_v2x_auth_1_parseFromJSON(lte_v2x_services_auth); - } - - nr_ue_pc5_ambr = cJSON_GetObjectItemCaseSensitive(v2x_subscription_data_1JSON, "nrUePc5Ambr"); - if (nr_ue_pc5_ambr) { - if (!cJSON_IsString(nr_ue_pc5_ambr) && !cJSON_IsNull(nr_ue_pc5_ambr)) { - ogs_error("OpenAPI_v2x_subscription_data_1_parseFromJSON() failed [nr_ue_pc5_ambr]"); - goto end; - } - } - - lte_pc5_ambr = cJSON_GetObjectItemCaseSensitive(v2x_subscription_data_1JSON, "ltePc5Ambr"); - if (lte_pc5_ambr) { - if (!cJSON_IsString(lte_pc5_ambr) && !cJSON_IsNull(lte_pc5_ambr)) { - ogs_error("OpenAPI_v2x_subscription_data_1_parseFromJSON() failed [lte_pc5_ambr]"); - goto end; - } - } - - v2x_subscription_data_1_local_var = OpenAPI_v2x_subscription_data_1_create ( - nr_v2x_services_auth ? nr_v2x_services_auth_local_nonprim : NULL, - lte_v2x_services_auth ? lte_v2x_services_auth_local_nonprim : NULL, - nr_ue_pc5_ambr && !cJSON_IsNull(nr_ue_pc5_ambr) ? ogs_strdup(nr_ue_pc5_ambr->valuestring) : NULL, - lte_pc5_ambr && !cJSON_IsNull(lte_pc5_ambr) ? ogs_strdup(lte_pc5_ambr->valuestring) : NULL - ); - - return v2x_subscription_data_1_local_var; -end: - if (nr_v2x_services_auth_local_nonprim) { - OpenAPI_nr_v2x_auth_1_free(nr_v2x_services_auth_local_nonprim); - nr_v2x_services_auth_local_nonprim = NULL; - } - if (lte_v2x_services_auth_local_nonprim) { - OpenAPI_lte_v2x_auth_1_free(lte_v2x_services_auth_local_nonprim); - lte_v2x_services_auth_local_nonprim = NULL; - } - return NULL; -} - -OpenAPI_v2x_subscription_data_1_t *OpenAPI_v2x_subscription_data_1_copy(OpenAPI_v2x_subscription_data_1_t *dst, OpenAPI_v2x_subscription_data_1_t *src) -{ - cJSON *item = NULL; - char *content = NULL; - - ogs_assert(src); - item = OpenAPI_v2x_subscription_data_1_convertToJSON(src); - if (!item) { - ogs_error("OpenAPI_v2x_subscription_data_1_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_v2x_subscription_data_1_free(dst); - dst = OpenAPI_v2x_subscription_data_1_parseFromJSON(item); - cJSON_Delete(item); - - return dst; -} - diff --git a/lib/sbi/openapi/model/v2x_subscription_data_1.h b/lib/sbi/openapi/model/v2x_subscription_data_1.h deleted file mode 100644 index 790217a6b..000000000 --- a/lib/sbi/openapi/model/v2x_subscription_data_1.h +++ /dev/null @@ -1,46 +0,0 @@ -/* - * v2x_subscription_data_1.h - * - * - */ - -#ifndef _OpenAPI_v2x_subscription_data_1_H_ -#define _OpenAPI_v2x_subscription_data_1_H_ - -#include -#include "../external/cJSON.h" -#include "../include/list.h" -#include "../include/keyValuePair.h" -#include "../include/binary.h" -#include "lte_v2x_auth_1.h" -#include "nr_v2x_auth_1.h" - -#ifdef __cplusplus -extern "C" { -#endif - -typedef struct OpenAPI_v2x_subscription_data_1_s OpenAPI_v2x_subscription_data_1_t; -typedef struct OpenAPI_v2x_subscription_data_1_s { - struct OpenAPI_nr_v2x_auth_1_s *nr_v2x_services_auth; - struct OpenAPI_lte_v2x_auth_1_s *lte_v2x_services_auth; - char *nr_ue_pc5_ambr; - char *lte_pc5_ambr; -} OpenAPI_v2x_subscription_data_1_t; - -OpenAPI_v2x_subscription_data_1_t *OpenAPI_v2x_subscription_data_1_create( - OpenAPI_nr_v2x_auth_1_t *nr_v2x_services_auth, - OpenAPI_lte_v2x_auth_1_t *lte_v2x_services_auth, - char *nr_ue_pc5_ambr, - char *lte_pc5_ambr -); -void OpenAPI_v2x_subscription_data_1_free(OpenAPI_v2x_subscription_data_1_t *v2x_subscription_data_1); -OpenAPI_v2x_subscription_data_1_t *OpenAPI_v2x_subscription_data_1_parseFromJSON(cJSON *v2x_subscription_data_1JSON); -cJSON *OpenAPI_v2x_subscription_data_1_convertToJSON(OpenAPI_v2x_subscription_data_1_t *v2x_subscription_data_1); -OpenAPI_v2x_subscription_data_1_t *OpenAPI_v2x_subscription_data_1_copy(OpenAPI_v2x_subscription_data_1_t *dst, OpenAPI_v2x_subscription_data_1_t *src); - -#ifdef __cplusplus -} -#endif - -#endif /* _OpenAPI_v2x_subscription_data_1_H_ */ - diff --git a/lib/sbi/openapi/model/valid_time_period_1.c b/lib/sbi/openapi/model/valid_time_period_1.c deleted file mode 100644 index 61e77cde6..000000000 --- a/lib/sbi/openapi/model/valid_time_period_1.c +++ /dev/null @@ -1,133 +0,0 @@ - -#include -#include -#include -#include "valid_time_period_1.h" - -OpenAPI_valid_time_period_1_t *OpenAPI_valid_time_period_1_create( - char *start_time, - char *end_time -) -{ - OpenAPI_valid_time_period_1_t *valid_time_period_1_local_var = ogs_malloc(sizeof(OpenAPI_valid_time_period_1_t)); - ogs_assert(valid_time_period_1_local_var); - - valid_time_period_1_local_var->start_time = start_time; - valid_time_period_1_local_var->end_time = end_time; - - return valid_time_period_1_local_var; -} - -void OpenAPI_valid_time_period_1_free(OpenAPI_valid_time_period_1_t *valid_time_period_1) -{ - OpenAPI_lnode_t *node = NULL; - - if (NULL == valid_time_period_1) { - return; - } - if (valid_time_period_1->start_time) { - ogs_free(valid_time_period_1->start_time); - valid_time_period_1->start_time = NULL; - } - if (valid_time_period_1->end_time) { - ogs_free(valid_time_period_1->end_time); - valid_time_period_1->end_time = NULL; - } - ogs_free(valid_time_period_1); -} - -cJSON *OpenAPI_valid_time_period_1_convertToJSON(OpenAPI_valid_time_period_1_t *valid_time_period_1) -{ - cJSON *item = NULL; - OpenAPI_lnode_t *node = NULL; - - if (valid_time_period_1 == NULL) { - ogs_error("OpenAPI_valid_time_period_1_convertToJSON() failed [ValidTimePeriod_1]"); - return NULL; - } - - item = cJSON_CreateObject(); - if (valid_time_period_1->start_time) { - if (cJSON_AddStringToObject(item, "startTime", valid_time_period_1->start_time) == NULL) { - ogs_error("OpenAPI_valid_time_period_1_convertToJSON() failed [start_time]"); - goto end; - } - } - - if (valid_time_period_1->end_time) { - if (cJSON_AddStringToObject(item, "endTime", valid_time_period_1->end_time) == NULL) { - ogs_error("OpenAPI_valid_time_period_1_convertToJSON() failed [end_time]"); - goto end; - } - } - -end: - return item; -} - -OpenAPI_valid_time_period_1_t *OpenAPI_valid_time_period_1_parseFromJSON(cJSON *valid_time_period_1JSON) -{ - OpenAPI_valid_time_period_1_t *valid_time_period_1_local_var = NULL; - OpenAPI_lnode_t *node = NULL; - cJSON *start_time = NULL; - cJSON *end_time = NULL; - start_time = cJSON_GetObjectItemCaseSensitive(valid_time_period_1JSON, "startTime"); - if (start_time) { - if (!cJSON_IsString(start_time) && !cJSON_IsNull(start_time)) { - ogs_error("OpenAPI_valid_time_period_1_parseFromJSON() failed [start_time]"); - goto end; - } - } - - end_time = cJSON_GetObjectItemCaseSensitive(valid_time_period_1JSON, "endTime"); - if (end_time) { - if (!cJSON_IsString(end_time) && !cJSON_IsNull(end_time)) { - ogs_error("OpenAPI_valid_time_period_1_parseFromJSON() failed [end_time]"); - goto end; - } - } - - valid_time_period_1_local_var = OpenAPI_valid_time_period_1_create ( - start_time && !cJSON_IsNull(start_time) ? ogs_strdup(start_time->valuestring) : NULL, - end_time && !cJSON_IsNull(end_time) ? ogs_strdup(end_time->valuestring) : NULL - ); - - return valid_time_period_1_local_var; -end: - return NULL; -} - -OpenAPI_valid_time_period_1_t *OpenAPI_valid_time_period_1_copy(OpenAPI_valid_time_period_1_t *dst, OpenAPI_valid_time_period_1_t *src) -{ - cJSON *item = NULL; - char *content = NULL; - - ogs_assert(src); - item = OpenAPI_valid_time_period_1_convertToJSON(src); - if (!item) { - ogs_error("OpenAPI_valid_time_period_1_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_valid_time_period_1_free(dst); - dst = OpenAPI_valid_time_period_1_parseFromJSON(item); - cJSON_Delete(item); - - return dst; -} - diff --git a/lib/sbi/openapi/model/valid_time_period_1.h b/lib/sbi/openapi/model/valid_time_period_1.h deleted file mode 100644 index 92b9ec22e..000000000 --- a/lib/sbi/openapi/model/valid_time_period_1.h +++ /dev/null @@ -1,40 +0,0 @@ -/* - * valid_time_period_1.h - * - * - */ - -#ifndef _OpenAPI_valid_time_period_1_H_ -#define _OpenAPI_valid_time_period_1_H_ - -#include -#include "../external/cJSON.h" -#include "../include/list.h" -#include "../include/keyValuePair.h" -#include "../include/binary.h" - -#ifdef __cplusplus -extern "C" { -#endif - -typedef struct OpenAPI_valid_time_period_1_s OpenAPI_valid_time_period_1_t; -typedef struct OpenAPI_valid_time_period_1_s { - char *start_time; - char *end_time; -} OpenAPI_valid_time_period_1_t; - -OpenAPI_valid_time_period_1_t *OpenAPI_valid_time_period_1_create( - char *start_time, - char *end_time -); -void OpenAPI_valid_time_period_1_free(OpenAPI_valid_time_period_1_t *valid_time_period_1); -OpenAPI_valid_time_period_1_t *OpenAPI_valid_time_period_1_parseFromJSON(cJSON *valid_time_period_1JSON); -cJSON *OpenAPI_valid_time_period_1_convertToJSON(OpenAPI_valid_time_period_1_t *valid_time_period_1); -OpenAPI_valid_time_period_1_t *OpenAPI_valid_time_period_1_copy(OpenAPI_valid_time_period_1_t *dst, OpenAPI_valid_time_period_1_t *src); - -#ifdef __cplusplus -} -#endif - -#endif /* _OpenAPI_valid_time_period_1_H_ */ - diff --git a/lib/sbi/openapi/model/volume_timed_report.h b/lib/sbi/openapi/model/volume_timed_report.h index 9c05cf681..baa0f8c0c 100644 --- a/lib/sbi/openapi/model/volume_timed_report.h +++ b/lib/sbi/openapi/model/volume_timed_report.h @@ -1,7 +1,7 @@ /* * volume_timed_report.h * - * + * Contains Usage data information. */ #ifndef _OpenAPI_volume_timed_report_H_ diff --git a/lib/sbi/openapi/model/vplmn_qos.h b/lib/sbi/openapi/model/vplmn_qos.h index 157f933fe..b853fe2ff 100644 --- a/lib/sbi/openapi/model/vplmn_qos.h +++ b/lib/sbi/openapi/model/vplmn_qos.h @@ -1,7 +1,7 @@ /* * vplmn_qos.h * - * + * VPLMN QoS */ #ifndef _OpenAPI_vplmn_qos_H_ diff --git a/lib/sbi/openapi/model/vsmf_update_data.c b/lib/sbi/openapi/model/vsmf_update_data.c index a9f7ac247..1fcb7144d 100644 --- a/lib/sbi/openapi/model/vsmf_update_data.c +++ b/lib/sbi/openapi/model/vsmf_update_data.c @@ -19,6 +19,8 @@ OpenAPI_vsmf_update_data_t *OpenAPI_vsmf_update_data_create( bool is_always_on_granted, int always_on_granted, char *hsmf_pdu_session_uri, + char *new_smf_id, + char *new_smf_pdu_session_uri, char *supported_features, OpenAPI_cause_e cause, char *n1sm_cause, @@ -32,9 +34,15 @@ OpenAPI_vsmf_update_data_t *OpenAPI_vsmf_update_data_create( OpenAPI_n4_information_t *n4_info, OpenAPI_n4_information_t *n4_info_ext1, OpenAPI_n4_information_t *n4_info_ext2, + OpenAPI_n4_information_t *n4_info_ext3, bool is_small_data_rate_control_enabled, int small_data_rate_control_enabled, - OpenAPI_qos_monitoring_info_t *qos_monitoring_info + OpenAPI_qos_monitoring_info_t *qos_monitoring_info, + OpenAPI_eps_pdn_cnx_info_t *eps_pdn_cnx_info, + bool is_n9_data_forwarding_ind, + int n9_data_forwarding_ind, + bool is_n9_inactivity_timer, + int n9_inactivity_timer ) { OpenAPI_vsmf_update_data_t *vsmf_update_data_local_var = ogs_malloc(sizeof(OpenAPI_vsmf_update_data_t)); @@ -54,6 +62,8 @@ OpenAPI_vsmf_update_data_t *OpenAPI_vsmf_update_data_create( vsmf_update_data_local_var->is_always_on_granted = is_always_on_granted; vsmf_update_data_local_var->always_on_granted = always_on_granted; vsmf_update_data_local_var->hsmf_pdu_session_uri = hsmf_pdu_session_uri; + vsmf_update_data_local_var->new_smf_id = new_smf_id; + vsmf_update_data_local_var->new_smf_pdu_session_uri = new_smf_pdu_session_uri; vsmf_update_data_local_var->supported_features = supported_features; vsmf_update_data_local_var->cause = cause; vsmf_update_data_local_var->n1sm_cause = n1sm_cause; @@ -67,9 +77,15 @@ OpenAPI_vsmf_update_data_t *OpenAPI_vsmf_update_data_create( vsmf_update_data_local_var->n4_info = n4_info; vsmf_update_data_local_var->n4_info_ext1 = n4_info_ext1; vsmf_update_data_local_var->n4_info_ext2 = n4_info_ext2; + vsmf_update_data_local_var->n4_info_ext3 = n4_info_ext3; vsmf_update_data_local_var->is_small_data_rate_control_enabled = is_small_data_rate_control_enabled; vsmf_update_data_local_var->small_data_rate_control_enabled = small_data_rate_control_enabled; vsmf_update_data_local_var->qos_monitoring_info = qos_monitoring_info; + vsmf_update_data_local_var->eps_pdn_cnx_info = eps_pdn_cnx_info; + vsmf_update_data_local_var->is_n9_data_forwarding_ind = is_n9_data_forwarding_ind; + vsmf_update_data_local_var->n9_data_forwarding_ind = n9_data_forwarding_ind; + vsmf_update_data_local_var->is_n9_inactivity_timer = is_n9_inactivity_timer; + vsmf_update_data_local_var->n9_inactivity_timer = n9_inactivity_timer; return vsmf_update_data_local_var; } @@ -135,6 +151,14 @@ void OpenAPI_vsmf_update_data_free(OpenAPI_vsmf_update_data_t *vsmf_update_data) ogs_free(vsmf_update_data->hsmf_pdu_session_uri); vsmf_update_data->hsmf_pdu_session_uri = NULL; } + if (vsmf_update_data->new_smf_id) { + ogs_free(vsmf_update_data->new_smf_id); + vsmf_update_data->new_smf_id = NULL; + } + if (vsmf_update_data->new_smf_pdu_session_uri) { + ogs_free(vsmf_update_data->new_smf_pdu_session_uri); + vsmf_update_data->new_smf_pdu_session_uri = NULL; + } if (vsmf_update_data->supported_features) { ogs_free(vsmf_update_data->supported_features); vsmf_update_data->supported_features = NULL; @@ -166,10 +190,18 @@ void OpenAPI_vsmf_update_data_free(OpenAPI_vsmf_update_data_t *vsmf_update_data) OpenAPI_n4_information_free(vsmf_update_data->n4_info_ext2); vsmf_update_data->n4_info_ext2 = NULL; } + if (vsmf_update_data->n4_info_ext3) { + OpenAPI_n4_information_free(vsmf_update_data->n4_info_ext3); + vsmf_update_data->n4_info_ext3 = NULL; + } if (vsmf_update_data->qos_monitoring_info) { OpenAPI_qos_monitoring_info_free(vsmf_update_data->qos_monitoring_info); vsmf_update_data->qos_monitoring_info = NULL; } + if (vsmf_update_data->eps_pdn_cnx_info) { + OpenAPI_eps_pdn_cnx_info_free(vsmf_update_data->eps_pdn_cnx_info); + vsmf_update_data->eps_pdn_cnx_info = NULL; + } ogs_free(vsmf_update_data); } @@ -334,6 +366,20 @@ cJSON *OpenAPI_vsmf_update_data_convertToJSON(OpenAPI_vsmf_update_data_t *vsmf_u } } + if (vsmf_update_data->new_smf_id) { + if (cJSON_AddStringToObject(item, "newSmfId", vsmf_update_data->new_smf_id) == NULL) { + ogs_error("OpenAPI_vsmf_update_data_convertToJSON() failed [new_smf_id]"); + goto end; + } + } + + if (vsmf_update_data->new_smf_pdu_session_uri) { + if (cJSON_AddStringToObject(item, "newSmfPduSessionUri", vsmf_update_data->new_smf_pdu_session_uri) == NULL) { + ogs_error("OpenAPI_vsmf_update_data_convertToJSON() failed [new_smf_pdu_session_uri]"); + goto end; + } + } + if (vsmf_update_data->supported_features) { if (cJSON_AddStringToObject(item, "supportedFeatures", vsmf_update_data->supported_features) == NULL) { ogs_error("OpenAPI_vsmf_update_data_convertToJSON() failed [supported_features]"); @@ -442,6 +488,19 @@ cJSON *OpenAPI_vsmf_update_data_convertToJSON(OpenAPI_vsmf_update_data_t *vsmf_u } } + if (vsmf_update_data->n4_info_ext3) { + cJSON *n4_info_ext3_local_JSON = OpenAPI_n4_information_convertToJSON(vsmf_update_data->n4_info_ext3); + if (n4_info_ext3_local_JSON == NULL) { + ogs_error("OpenAPI_vsmf_update_data_convertToJSON() failed [n4_info_ext3]"); + goto end; + } + cJSON_AddItemToObject(item, "n4InfoExt3", n4_info_ext3_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_vsmf_update_data_convertToJSON() failed [n4_info_ext3]"); + goto end; + } + } + if (vsmf_update_data->is_small_data_rate_control_enabled) { if (cJSON_AddBoolToObject(item, "smallDataRateControlEnabled", vsmf_update_data->small_data_rate_control_enabled) == NULL) { ogs_error("OpenAPI_vsmf_update_data_convertToJSON() failed [small_data_rate_control_enabled]"); @@ -462,6 +521,33 @@ cJSON *OpenAPI_vsmf_update_data_convertToJSON(OpenAPI_vsmf_update_data_t *vsmf_u } } + if (vsmf_update_data->eps_pdn_cnx_info) { + cJSON *eps_pdn_cnx_info_local_JSON = OpenAPI_eps_pdn_cnx_info_convertToJSON(vsmf_update_data->eps_pdn_cnx_info); + if (eps_pdn_cnx_info_local_JSON == NULL) { + ogs_error("OpenAPI_vsmf_update_data_convertToJSON() failed [eps_pdn_cnx_info]"); + goto end; + } + cJSON_AddItemToObject(item, "epsPdnCnxInfo", eps_pdn_cnx_info_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_vsmf_update_data_convertToJSON() failed [eps_pdn_cnx_info]"); + goto end; + } + } + + if (vsmf_update_data->is_n9_data_forwarding_ind) { + if (cJSON_AddBoolToObject(item, "n9DataForwardingInd", vsmf_update_data->n9_data_forwarding_ind) == NULL) { + ogs_error("OpenAPI_vsmf_update_data_convertToJSON() failed [n9_data_forwarding_ind]"); + goto end; + } + } + + if (vsmf_update_data->is_n9_inactivity_timer) { + if (cJSON_AddNumberToObject(item, "n9InactivityTimer", vsmf_update_data->n9_inactivity_timer) == NULL) { + ogs_error("OpenAPI_vsmf_update_data_convertToJSON() failed [n9_inactivity_timer]"); + goto end; + } + } + end: return item; } @@ -491,6 +577,8 @@ OpenAPI_vsmf_update_data_t *OpenAPI_vsmf_update_data_parseFromJSON(cJSON *vsmf_u OpenAPI_ref_to_binary_data_t *n1_sm_info_to_ue_local_nonprim = NULL; cJSON *always_on_granted = NULL; cJSON *hsmf_pdu_session_uri = NULL; + cJSON *new_smf_id = NULL; + cJSON *new_smf_pdu_session_uri = NULL; cJSON *supported_features = NULL; cJSON *cause = NULL; OpenAPI_cause_e causeVariable = 0; @@ -509,9 +597,15 @@ OpenAPI_vsmf_update_data_t *OpenAPI_vsmf_update_data_parseFromJSON(cJSON *vsmf_u OpenAPI_n4_information_t *n4_info_ext1_local_nonprim = NULL; cJSON *n4_info_ext2 = NULL; OpenAPI_n4_information_t *n4_info_ext2_local_nonprim = NULL; + cJSON *n4_info_ext3 = NULL; + OpenAPI_n4_information_t *n4_info_ext3_local_nonprim = NULL; cJSON *small_data_rate_control_enabled = NULL; cJSON *qos_monitoring_info = NULL; OpenAPI_qos_monitoring_info_t *qos_monitoring_info_local_nonprim = NULL; + cJSON *eps_pdn_cnx_info = NULL; + OpenAPI_eps_pdn_cnx_info_t *eps_pdn_cnx_info_local_nonprim = NULL; + cJSON *n9_data_forwarding_ind = NULL; + cJSON *n9_inactivity_timer = NULL; request_indication = cJSON_GetObjectItemCaseSensitive(vsmf_update_dataJSON, "requestIndication"); if (!request_indication) { ogs_error("OpenAPI_vsmf_update_data_parseFromJSON() failed [request_indication]"); @@ -709,6 +803,22 @@ OpenAPI_vsmf_update_data_t *OpenAPI_vsmf_update_data_parseFromJSON(cJSON *vsmf_u } } + new_smf_id = cJSON_GetObjectItemCaseSensitive(vsmf_update_dataJSON, "newSmfId"); + if (new_smf_id) { + if (!cJSON_IsString(new_smf_id) && !cJSON_IsNull(new_smf_id)) { + ogs_error("OpenAPI_vsmf_update_data_parseFromJSON() failed [new_smf_id]"); + goto end; + } + } + + new_smf_pdu_session_uri = cJSON_GetObjectItemCaseSensitive(vsmf_update_dataJSON, "newSmfPduSessionUri"); + if (new_smf_pdu_session_uri) { + if (!cJSON_IsString(new_smf_pdu_session_uri) && !cJSON_IsNull(new_smf_pdu_session_uri)) { + ogs_error("OpenAPI_vsmf_update_data_parseFromJSON() failed [new_smf_pdu_session_uri]"); + goto end; + } + } + supported_features = cJSON_GetObjectItemCaseSensitive(vsmf_update_dataJSON, "supportedFeatures"); if (supported_features) { if (!cJSON_IsString(supported_features) && !cJSON_IsNull(supported_features)) { @@ -800,6 +910,11 @@ OpenAPI_vsmf_update_data_t *OpenAPI_vsmf_update_data_parseFromJSON(cJSON *vsmf_u n4_info_ext2_local_nonprim = OpenAPI_n4_information_parseFromJSON(n4_info_ext2); } + n4_info_ext3 = cJSON_GetObjectItemCaseSensitive(vsmf_update_dataJSON, "n4InfoExt3"); + if (n4_info_ext3) { + n4_info_ext3_local_nonprim = OpenAPI_n4_information_parseFromJSON(n4_info_ext3); + } + small_data_rate_control_enabled = cJSON_GetObjectItemCaseSensitive(vsmf_update_dataJSON, "smallDataRateControlEnabled"); if (small_data_rate_control_enabled) { if (!cJSON_IsBool(small_data_rate_control_enabled)) { @@ -813,6 +928,27 @@ OpenAPI_vsmf_update_data_t *OpenAPI_vsmf_update_data_parseFromJSON(cJSON *vsmf_u qos_monitoring_info_local_nonprim = OpenAPI_qos_monitoring_info_parseFromJSON(qos_monitoring_info); } + eps_pdn_cnx_info = cJSON_GetObjectItemCaseSensitive(vsmf_update_dataJSON, "epsPdnCnxInfo"); + if (eps_pdn_cnx_info) { + eps_pdn_cnx_info_local_nonprim = OpenAPI_eps_pdn_cnx_info_parseFromJSON(eps_pdn_cnx_info); + } + + n9_data_forwarding_ind = cJSON_GetObjectItemCaseSensitive(vsmf_update_dataJSON, "n9DataForwardingInd"); + if (n9_data_forwarding_ind) { + if (!cJSON_IsBool(n9_data_forwarding_ind)) { + ogs_error("OpenAPI_vsmf_update_data_parseFromJSON() failed [n9_data_forwarding_ind]"); + goto end; + } + } + + n9_inactivity_timer = cJSON_GetObjectItemCaseSensitive(vsmf_update_dataJSON, "n9InactivityTimer"); + if (n9_inactivity_timer) { + if (!cJSON_IsNumber(n9_inactivity_timer)) { + ogs_error("OpenAPI_vsmf_update_data_parseFromJSON() failed [n9_inactivity_timer]"); + goto end; + } + } + vsmf_update_data_local_var = OpenAPI_vsmf_update_data_create ( request_indicationVariable, session_ambr ? session_ambr_local_nonprim : NULL, @@ -828,6 +964,8 @@ OpenAPI_vsmf_update_data_t *OpenAPI_vsmf_update_data_parseFromJSON(cJSON *vsmf_u always_on_granted ? true : false, always_on_granted ? always_on_granted->valueint : 0, hsmf_pdu_session_uri && !cJSON_IsNull(hsmf_pdu_session_uri) ? ogs_strdup(hsmf_pdu_session_uri->valuestring) : NULL, + new_smf_id && !cJSON_IsNull(new_smf_id) ? ogs_strdup(new_smf_id->valuestring) : NULL, + new_smf_pdu_session_uri && !cJSON_IsNull(new_smf_pdu_session_uri) ? ogs_strdup(new_smf_pdu_session_uri->valuestring) : NULL, supported_features && !cJSON_IsNull(supported_features) ? ogs_strdup(supported_features->valuestring) : NULL, cause ? causeVariable : 0, n1sm_cause && !cJSON_IsNull(n1sm_cause) ? ogs_strdup(n1sm_cause->valuestring) : NULL, @@ -841,9 +979,15 @@ OpenAPI_vsmf_update_data_t *OpenAPI_vsmf_update_data_parseFromJSON(cJSON *vsmf_u n4_info ? n4_info_local_nonprim : NULL, n4_info_ext1 ? n4_info_ext1_local_nonprim : NULL, n4_info_ext2 ? n4_info_ext2_local_nonprim : NULL, + n4_info_ext3 ? n4_info_ext3_local_nonprim : NULL, small_data_rate_control_enabled ? true : false, small_data_rate_control_enabled ? small_data_rate_control_enabled->valueint : 0, - qos_monitoring_info ? qos_monitoring_info_local_nonprim : NULL + qos_monitoring_info ? qos_monitoring_info_local_nonprim : NULL, + eps_pdn_cnx_info ? eps_pdn_cnx_info_local_nonprim : NULL, + n9_data_forwarding_ind ? true : false, + n9_data_forwarding_ind ? n9_data_forwarding_ind->valueint : 0, + n9_inactivity_timer ? true : false, + n9_inactivity_timer ? n9_inactivity_timer->valuedouble : 0 ); return vsmf_update_data_local_var; @@ -921,10 +1065,18 @@ end: OpenAPI_n4_information_free(n4_info_ext2_local_nonprim); n4_info_ext2_local_nonprim = NULL; } + if (n4_info_ext3_local_nonprim) { + OpenAPI_n4_information_free(n4_info_ext3_local_nonprim); + n4_info_ext3_local_nonprim = NULL; + } if (qos_monitoring_info_local_nonprim) { OpenAPI_qos_monitoring_info_free(qos_monitoring_info_local_nonprim); qos_monitoring_info_local_nonprim = NULL; } + if (eps_pdn_cnx_info_local_nonprim) { + OpenAPI_eps_pdn_cnx_info_free(eps_pdn_cnx_info_local_nonprim); + eps_pdn_cnx_info_local_nonprim = NULL; + } return NULL; } diff --git a/lib/sbi/openapi/model/vsmf_update_data.h b/lib/sbi/openapi/model/vsmf_update_data.h index 711a052d1..2e5decde1 100644 --- a/lib/sbi/openapi/model/vsmf_update_data.h +++ b/lib/sbi/openapi/model/vsmf_update_data.h @@ -1,7 +1,7 @@ /* * vsmf_update_data.h * - * + * Data within Update Request towards V-SMF, or from SMF to I-SMF */ #ifndef _OpenAPI_vsmf_update_data_H_ @@ -17,6 +17,7 @@ #include "cause.h" #include "ebi_arp_mapping.h" #include "eps_bearer_info.h" +#include "eps_pdn_cnx_info.h" #include "ma_release_indication.h" #include "n4_information.h" #include "qos_flow_add_modify_request_item.h" @@ -46,6 +47,8 @@ typedef struct OpenAPI_vsmf_update_data_s { bool is_always_on_granted; int always_on_granted; char *hsmf_pdu_session_uri; + char *new_smf_id; + char *new_smf_pdu_session_uri; char *supported_features; OpenAPI_cause_e cause; char *n1sm_cause; @@ -59,9 +62,15 @@ typedef struct OpenAPI_vsmf_update_data_s { struct OpenAPI_n4_information_s *n4_info; struct OpenAPI_n4_information_s *n4_info_ext1; struct OpenAPI_n4_information_s *n4_info_ext2; + struct OpenAPI_n4_information_s *n4_info_ext3; bool is_small_data_rate_control_enabled; int small_data_rate_control_enabled; struct OpenAPI_qos_monitoring_info_s *qos_monitoring_info; + struct OpenAPI_eps_pdn_cnx_info_s *eps_pdn_cnx_info; + bool is_n9_data_forwarding_ind; + int n9_data_forwarding_ind; + bool is_n9_inactivity_timer; + int n9_inactivity_timer; } OpenAPI_vsmf_update_data_t; OpenAPI_vsmf_update_data_t *OpenAPI_vsmf_update_data_create( @@ -79,6 +88,8 @@ OpenAPI_vsmf_update_data_t *OpenAPI_vsmf_update_data_create( bool is_always_on_granted, int always_on_granted, char *hsmf_pdu_session_uri, + char *new_smf_id, + char *new_smf_pdu_session_uri, char *supported_features, OpenAPI_cause_e cause, char *n1sm_cause, @@ -92,9 +103,15 @@ OpenAPI_vsmf_update_data_t *OpenAPI_vsmf_update_data_create( OpenAPI_n4_information_t *n4_info, OpenAPI_n4_information_t *n4_info_ext1, OpenAPI_n4_information_t *n4_info_ext2, + OpenAPI_n4_information_t *n4_info_ext3, bool is_small_data_rate_control_enabled, int small_data_rate_control_enabled, - OpenAPI_qos_monitoring_info_t *qos_monitoring_info + OpenAPI_qos_monitoring_info_t *qos_monitoring_info, + OpenAPI_eps_pdn_cnx_info_t *eps_pdn_cnx_info, + bool is_n9_data_forwarding_ind, + int n9_data_forwarding_ind, + bool is_n9_inactivity_timer, + int n9_inactivity_timer ); void OpenAPI_vsmf_update_data_free(OpenAPI_vsmf_update_data_t *vsmf_update_data); OpenAPI_vsmf_update_data_t *OpenAPI_vsmf_update_data_parseFromJSON(cJSON *vsmf_update_dataJSON); diff --git a/lib/sbi/openapi/model/vsmf_update_error.c b/lib/sbi/openapi/model/vsmf_update_error.c index 5a4e22267..d1a1411a8 100644 --- a/lib/sbi/openapi/model/vsmf_update_error.c +++ b/lib/sbi/openapi/model/vsmf_update_error.c @@ -5,7 +5,7 @@ #include "vsmf_update_error.h" OpenAPI_vsmf_update_error_t *OpenAPI_vsmf_update_error_create( - OpenAPI_problem_details_t *error, + OpenAPI_ext_problem_details_t *error, bool is_pti, int pti, char *n1sm_cause, @@ -18,7 +18,8 @@ OpenAPI_vsmf_update_error_t *OpenAPI_vsmf_update_error_create( char *recovery_time, OpenAPI_n4_information_t *n4_info, OpenAPI_n4_information_t *n4_info_ext1, - OpenAPI_n4_information_t *n4_info_ext2 + OpenAPI_n4_information_t *n4_info_ext2, + OpenAPI_n4_information_t *n4_info_ext3 ) { OpenAPI_vsmf_update_error_t *vsmf_update_error_local_var = ogs_malloc(sizeof(OpenAPI_vsmf_update_error_t)); @@ -38,6 +39,7 @@ OpenAPI_vsmf_update_error_t *OpenAPI_vsmf_update_error_create( vsmf_update_error_local_var->n4_info = n4_info; vsmf_update_error_local_var->n4_info_ext1 = n4_info_ext1; vsmf_update_error_local_var->n4_info_ext2 = n4_info_ext2; + vsmf_update_error_local_var->n4_info_ext3 = n4_info_ext3; return vsmf_update_error_local_var; } @@ -50,7 +52,7 @@ void OpenAPI_vsmf_update_error_free(OpenAPI_vsmf_update_error_t *vsmf_update_err return; } if (vsmf_update_error->error) { - OpenAPI_problem_details_free(vsmf_update_error->error); + OpenAPI_ext_problem_details_free(vsmf_update_error->error); vsmf_update_error->error = NULL; } if (vsmf_update_error->n1sm_cause) { @@ -92,6 +94,10 @@ void OpenAPI_vsmf_update_error_free(OpenAPI_vsmf_update_error_t *vsmf_update_err OpenAPI_n4_information_free(vsmf_update_error->n4_info_ext2); vsmf_update_error->n4_info_ext2 = NULL; } + if (vsmf_update_error->n4_info_ext3) { + OpenAPI_n4_information_free(vsmf_update_error->n4_info_ext3); + vsmf_update_error->n4_info_ext3 = NULL; + } ogs_free(vsmf_update_error); } @@ -110,7 +116,7 @@ cJSON *OpenAPI_vsmf_update_error_convertToJSON(OpenAPI_vsmf_update_error_t *vsmf ogs_error("OpenAPI_vsmf_update_error_convertToJSON() failed [error]"); return NULL; } - cJSON *error_local_JSON = OpenAPI_problem_details_convertToJSON(vsmf_update_error->error); + cJSON *error_local_JSON = OpenAPI_ext_problem_details_convertToJSON(vsmf_update_error->error); if (error_local_JSON == NULL) { ogs_error("OpenAPI_vsmf_update_error_convertToJSON() failed [error]"); goto end; @@ -243,6 +249,19 @@ cJSON *OpenAPI_vsmf_update_error_convertToJSON(OpenAPI_vsmf_update_error_t *vsmf } } + if (vsmf_update_error->n4_info_ext3) { + cJSON *n4_info_ext3_local_JSON = OpenAPI_n4_information_convertToJSON(vsmf_update_error->n4_info_ext3); + if (n4_info_ext3_local_JSON == NULL) { + ogs_error("OpenAPI_vsmf_update_error_convertToJSON() failed [n4_info_ext3]"); + goto end; + } + cJSON_AddItemToObject(item, "n4InfoExt3", n4_info_ext3_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_vsmf_update_error_convertToJSON() failed [n4_info_ext3]"); + goto end; + } + } + end: return item; } @@ -252,7 +271,7 @@ OpenAPI_vsmf_update_error_t *OpenAPI_vsmf_update_error_parseFromJSON(cJSON *vsmf OpenAPI_vsmf_update_error_t *vsmf_update_error_local_var = NULL; OpenAPI_lnode_t *node = NULL; cJSON *error = NULL; - OpenAPI_problem_details_t *error_local_nonprim = NULL; + OpenAPI_ext_problem_details_t *error_local_nonprim = NULL; cJSON *pti = NULL; cJSON *n1sm_cause = NULL; cJSON *n1_sm_info_from_ue = NULL; @@ -271,12 +290,14 @@ OpenAPI_vsmf_update_error_t *OpenAPI_vsmf_update_error_parseFromJSON(cJSON *vsmf OpenAPI_n4_information_t *n4_info_ext1_local_nonprim = NULL; cJSON *n4_info_ext2 = NULL; OpenAPI_n4_information_t *n4_info_ext2_local_nonprim = NULL; + cJSON *n4_info_ext3 = NULL; + OpenAPI_n4_information_t *n4_info_ext3_local_nonprim = NULL; error = cJSON_GetObjectItemCaseSensitive(vsmf_update_errorJSON, "error"); if (!error) { ogs_error("OpenAPI_vsmf_update_error_parseFromJSON() failed [error]"); goto end; } - error_local_nonprim = OpenAPI_problem_details_parseFromJSON(error); + error_local_nonprim = OpenAPI_ext_problem_details_parseFromJSON(error); pti = cJSON_GetObjectItemCaseSensitive(vsmf_update_errorJSON, "pti"); if (pti) { @@ -365,6 +386,11 @@ OpenAPI_vsmf_update_error_t *OpenAPI_vsmf_update_error_parseFromJSON(cJSON *vsmf n4_info_ext2_local_nonprim = OpenAPI_n4_information_parseFromJSON(n4_info_ext2); } + n4_info_ext3 = cJSON_GetObjectItemCaseSensitive(vsmf_update_errorJSON, "n4InfoExt3"); + if (n4_info_ext3) { + n4_info_ext3_local_nonprim = OpenAPI_n4_information_parseFromJSON(n4_info_ext3); + } + vsmf_update_error_local_var = OpenAPI_vsmf_update_error_create ( error_local_nonprim, pti ? true : false, @@ -379,13 +405,14 @@ OpenAPI_vsmf_update_error_t *OpenAPI_vsmf_update_error_parseFromJSON(cJSON *vsmf recovery_time && !cJSON_IsNull(recovery_time) ? ogs_strdup(recovery_time->valuestring) : NULL, n4_info ? n4_info_local_nonprim : NULL, n4_info_ext1 ? n4_info_ext1_local_nonprim : NULL, - n4_info_ext2 ? n4_info_ext2_local_nonprim : NULL + n4_info_ext2 ? n4_info_ext2_local_nonprim : NULL, + n4_info_ext3 ? n4_info_ext3_local_nonprim : NULL ); return vsmf_update_error_local_var; end: if (error_local_nonprim) { - OpenAPI_problem_details_free(error_local_nonprim); + OpenAPI_ext_problem_details_free(error_local_nonprim); error_local_nonprim = NULL; } if (n1_sm_info_from_ue_local_nonprim) { @@ -419,6 +446,10 @@ end: OpenAPI_n4_information_free(n4_info_ext2_local_nonprim); n4_info_ext2_local_nonprim = NULL; } + if (n4_info_ext3_local_nonprim) { + OpenAPI_n4_information_free(n4_info_ext3_local_nonprim); + n4_info_ext3_local_nonprim = NULL; + } return NULL; } diff --git a/lib/sbi/openapi/model/vsmf_update_error.h b/lib/sbi/openapi/model/vsmf_update_error.h index 971a24b9d..330c82045 100644 --- a/lib/sbi/openapi/model/vsmf_update_error.h +++ b/lib/sbi/openapi/model/vsmf_update_error.h @@ -1,7 +1,7 @@ /* * vsmf_update_error.h * - * + * Error within Update Response from V-SMF, or from I-SMF to SMF */ #ifndef _OpenAPI_vsmf_update_error_H_ @@ -13,9 +13,9 @@ #include "../include/keyValuePair.h" #include "../include/binary.h" #include "arp.h" +#include "ext_problem_details.h" #include "n4_information.h" #include "ng_ap_cause.h" -#include "problem_details.h" #include "ref_to_binary_data.h" #ifdef __cplusplus @@ -24,7 +24,7 @@ extern "C" { typedef struct OpenAPI_vsmf_update_error_s OpenAPI_vsmf_update_error_t; typedef struct OpenAPI_vsmf_update_error_s { - struct OpenAPI_problem_details_s *error; + struct OpenAPI_ext_problem_details_s *error; bool is_pti; int pti; char *n1sm_cause; @@ -38,10 +38,11 @@ typedef struct OpenAPI_vsmf_update_error_s { struct OpenAPI_n4_information_s *n4_info; struct OpenAPI_n4_information_s *n4_info_ext1; struct OpenAPI_n4_information_s *n4_info_ext2; + struct OpenAPI_n4_information_s *n4_info_ext3; } OpenAPI_vsmf_update_error_t; OpenAPI_vsmf_update_error_t *OpenAPI_vsmf_update_error_create( - OpenAPI_problem_details_t *error, + OpenAPI_ext_problem_details_t *error, bool is_pti, int pti, char *n1sm_cause, @@ -54,7 +55,8 @@ OpenAPI_vsmf_update_error_t *OpenAPI_vsmf_update_error_create( char *recovery_time, OpenAPI_n4_information_t *n4_info, OpenAPI_n4_information_t *n4_info_ext1, - OpenAPI_n4_information_t *n4_info_ext2 + OpenAPI_n4_information_t *n4_info_ext2, + OpenAPI_n4_information_t *n4_info_ext3 ); void OpenAPI_vsmf_update_error_free(OpenAPI_vsmf_update_error_t *vsmf_update_error); OpenAPI_vsmf_update_error_t *OpenAPI_vsmf_update_error_parseFromJSON(cJSON *vsmf_update_errorJSON); diff --git a/lib/sbi/openapi/model/vsmf_updated_data.c b/lib/sbi/openapi/model/vsmf_updated_data.c index 386e5da87..6d3baebac 100644 --- a/lib/sbi/openapi/model/vsmf_updated_data.c +++ b/lib/sbi/openapi/model/vsmf_updated_data.c @@ -21,7 +21,8 @@ OpenAPI_vsmf_updated_data_t *OpenAPI_vsmf_updated_data_create( OpenAPI_list_t *secondary_rat_usage_info, OpenAPI_n4_information_t *n4_info, OpenAPI_n4_information_t *n4_info_ext1, - OpenAPI_n4_information_t *n4_info_ext2 + OpenAPI_n4_information_t *n4_info_ext2, + OpenAPI_n4_information_t *n4_info_ext3 ) { OpenAPI_vsmf_updated_data_t *vsmf_updated_data_local_var = ogs_malloc(sizeof(OpenAPI_vsmf_updated_data_t)); @@ -44,6 +45,7 @@ OpenAPI_vsmf_updated_data_t *OpenAPI_vsmf_updated_data_create( vsmf_updated_data_local_var->n4_info = n4_info; vsmf_updated_data_local_var->n4_info_ext1 = n4_info_ext1; vsmf_updated_data_local_var->n4_info_ext2 = n4_info_ext2; + vsmf_updated_data_local_var->n4_info_ext3 = n4_info_ext3; return vsmf_updated_data_local_var; } @@ -150,6 +152,10 @@ void OpenAPI_vsmf_updated_data_free(OpenAPI_vsmf_updated_data_t *vsmf_updated_da OpenAPI_n4_information_free(vsmf_updated_data->n4_info_ext2); vsmf_updated_data->n4_info_ext2 = NULL; } + if (vsmf_updated_data->n4_info_ext3) { + OpenAPI_n4_information_free(vsmf_updated_data->n4_info_ext3); + vsmf_updated_data->n4_info_ext3 = NULL; + } ogs_free(vsmf_updated_data); } @@ -404,6 +410,19 @@ cJSON *OpenAPI_vsmf_updated_data_convertToJSON(OpenAPI_vsmf_updated_data_t *vsmf } } + if (vsmf_updated_data->n4_info_ext3) { + cJSON *n4_info_ext3_local_JSON = OpenAPI_n4_information_convertToJSON(vsmf_updated_data->n4_info_ext3); + if (n4_info_ext3_local_JSON == NULL) { + ogs_error("OpenAPI_vsmf_updated_data_convertToJSON() failed [n4_info_ext3]"); + goto end; + } + cJSON_AddItemToObject(item, "n4InfoExt3", n4_info_ext3_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_vsmf_updated_data_convertToJSON() failed [n4_info_ext3]"); + goto end; + } + } + end: return item; } @@ -445,6 +464,8 @@ OpenAPI_vsmf_updated_data_t *OpenAPI_vsmf_updated_data_parseFromJSON(cJSON *vsmf OpenAPI_n4_information_t *n4_info_ext1_local_nonprim = NULL; cJSON *n4_info_ext2 = NULL; OpenAPI_n4_information_t *n4_info_ext2_local_nonprim = NULL; + cJSON *n4_info_ext3 = NULL; + OpenAPI_n4_information_t *n4_info_ext3_local_nonprim = NULL; qos_flows_add_mod_list = cJSON_GetObjectItemCaseSensitive(vsmf_updated_dataJSON, "qosFlowsAddModList"); if (qos_flows_add_mod_list) { cJSON *qos_flows_add_mod_list_local = NULL; @@ -715,6 +736,11 @@ OpenAPI_vsmf_updated_data_t *OpenAPI_vsmf_updated_data_parseFromJSON(cJSON *vsmf n4_info_ext2_local_nonprim = OpenAPI_n4_information_parseFromJSON(n4_info_ext2); } + n4_info_ext3 = cJSON_GetObjectItemCaseSensitive(vsmf_updated_dataJSON, "n4InfoExt3"); + if (n4_info_ext3) { + n4_info_ext3_local_nonprim = OpenAPI_n4_information_parseFromJSON(n4_info_ext3); + } + vsmf_updated_data_local_var = OpenAPI_vsmf_updated_data_create ( qos_flows_add_mod_list ? qos_flows_add_mod_listList : NULL, qos_flows_rel_list ? qos_flows_rel_listList : NULL, @@ -732,7 +758,8 @@ OpenAPI_vsmf_updated_data_t *OpenAPI_vsmf_updated_data_parseFromJSON(cJSON *vsmf secondary_rat_usage_info ? secondary_rat_usage_infoList : NULL, n4_info ? n4_info_local_nonprim : NULL, n4_info_ext1 ? n4_info_ext1_local_nonprim : NULL, - n4_info_ext2 ? n4_info_ext2_local_nonprim : NULL + n4_info_ext2 ? n4_info_ext2_local_nonprim : NULL, + n4_info_ext3 ? n4_info_ext3_local_nonprim : NULL ); return vsmf_updated_data_local_var; @@ -828,6 +855,10 @@ end: OpenAPI_n4_information_free(n4_info_ext2_local_nonprim); n4_info_ext2_local_nonprim = NULL; } + if (n4_info_ext3_local_nonprim) { + OpenAPI_n4_information_free(n4_info_ext3_local_nonprim); + n4_info_ext3_local_nonprim = NULL; + } return NULL; } diff --git a/lib/sbi/openapi/model/vsmf_updated_data.h b/lib/sbi/openapi/model/vsmf_updated_data.h index 9349bb1d2..1224ef4cd 100644 --- a/lib/sbi/openapi/model/vsmf_updated_data.h +++ b/lib/sbi/openapi/model/vsmf_updated_data.h @@ -1,7 +1,7 @@ /* * vsmf_updated_data.h * - * + * Data within Update Response from V-SMF, or from I-SMF to SMF */ #ifndef _OpenAPI_vsmf_updated_data_H_ @@ -44,6 +44,7 @@ typedef struct OpenAPI_vsmf_updated_data_s { struct OpenAPI_n4_information_s *n4_info; struct OpenAPI_n4_information_s *n4_info_ext1; struct OpenAPI_n4_information_s *n4_info_ext2; + struct OpenAPI_n4_information_s *n4_info_ext3; } OpenAPI_vsmf_updated_data_t; OpenAPI_vsmf_updated_data_t *OpenAPI_vsmf_updated_data_create( @@ -63,7 +64,8 @@ OpenAPI_vsmf_updated_data_t *OpenAPI_vsmf_updated_data_create( OpenAPI_list_t *secondary_rat_usage_info, OpenAPI_n4_information_t *n4_info, OpenAPI_n4_information_t *n4_info_ext1, - OpenAPI_n4_information_t *n4_info_ext2 + OpenAPI_n4_information_t *n4_info_ext2, + OpenAPI_n4_information_t *n4_info_ext3 ); void OpenAPI_vsmf_updated_data_free(OpenAPI_vsmf_updated_data_t *vsmf_updated_data); OpenAPI_vsmf_updated_data_t *OpenAPI_vsmf_updated_data_parseFromJSON(cJSON *vsmf_updated_dataJSON); diff --git a/lib/sbi/openapi/model/wireline_area.h b/lib/sbi/openapi/model/wireline_area.h index 98e4072e0..0fc89483d 100644 --- a/lib/sbi/openapi/model/wireline_area.h +++ b/lib/sbi/openapi/model/wireline_area.h @@ -1,7 +1,7 @@ /* * wireline_area.h * - * + * One and only one of the \"globLineIds\", \"hfcNIds\", \"areaCodeB\" and \"areaCodeC\" attributes shall be included in a WirelineArea data structure */ #ifndef _OpenAPI_wireline_area_H_ diff --git a/lib/sbi/openapi/model/wireline_area_1.h b/lib/sbi/openapi/model/wireline_area_1.h index bd5e38540..5b96f95e5 100644 --- a/lib/sbi/openapi/model/wireline_area_1.h +++ b/lib/sbi/openapi/model/wireline_area_1.h @@ -1,7 +1,7 @@ /* * wireline_area_1.h * - * + * One and only one of the \"globLineIds\", \"hfcNIds\", \"areaCodeB\" and \"areaCodeC\" attributes shall be included in a WirelineArea data structure */ #ifndef _OpenAPI_wireline_area_1_H_ diff --git a/lib/sbi/openapi/model/wireline_service_area_restriction.h b/lib/sbi/openapi/model/wireline_service_area_restriction.h index 6972c399d..53b1e53ee 100644 --- a/lib/sbi/openapi/model/wireline_service_area_restriction.h +++ b/lib/sbi/openapi/model/wireline_service_area_restriction.h @@ -1,7 +1,7 @@ /* * wireline_service_area_restriction.h * - * + * The \"restrictionType\" attribute and the \"areas\" attribute shall be either both present or absent. The empty array of areas is used when service is allowed/restricted nowhere. */ #ifndef _OpenAPI_wireline_service_area_restriction_H_ diff --git a/lib/sbi/openapi/model/wireline_service_area_restriction_1.h b/lib/sbi/openapi/model/wireline_service_area_restriction_1.h index 06a4a8b87..02aa311a7 100644 --- a/lib/sbi/openapi/model/wireline_service_area_restriction_1.h +++ b/lib/sbi/openapi/model/wireline_service_area_restriction_1.h @@ -1,7 +1,7 @@ /* * wireline_service_area_restriction_1.h * - * + * The \"restrictionType\" attribute and the \"areas\" attribute shall be either both present or absent. The empty array of areas is used when service is allowed/restricted nowhere. */ #ifndef _OpenAPI_wireline_service_area_restriction_1_H_ diff --git a/lib/sbi/openapi/model/wlan_ordering_criterion.c b/lib/sbi/openapi/model/wlan_ordering_criterion.c new file mode 100644 index 000000000..7ec19e292 --- /dev/null +++ b/lib/sbi/openapi/model/wlan_ordering_criterion.c @@ -0,0 +1,87 @@ + +#include +#include +#include +#include "wlan_ordering_criterion.h" + +OpenAPI_wlan_ordering_criterion_t *OpenAPI_wlan_ordering_criterion_create( +) +{ + OpenAPI_wlan_ordering_criterion_t *wlan_ordering_criterion_local_var = ogs_malloc(sizeof(OpenAPI_wlan_ordering_criterion_t)); + ogs_assert(wlan_ordering_criterion_local_var); + + + return wlan_ordering_criterion_local_var; +} + +void OpenAPI_wlan_ordering_criterion_free(OpenAPI_wlan_ordering_criterion_t *wlan_ordering_criterion) +{ + OpenAPI_lnode_t *node = NULL; + + if (NULL == wlan_ordering_criterion) { + return; + } + ogs_free(wlan_ordering_criterion); +} + +cJSON *OpenAPI_wlan_ordering_criterion_convertToJSON(OpenAPI_wlan_ordering_criterion_t *wlan_ordering_criterion) +{ + cJSON *item = NULL; + OpenAPI_lnode_t *node = NULL; + + if (wlan_ordering_criterion == NULL) { + ogs_error("OpenAPI_wlan_ordering_criterion_convertToJSON() failed [WlanOrderingCriterion]"); + return NULL; + } + + item = cJSON_CreateObject(); +end: + return item; +} + +OpenAPI_wlan_ordering_criterion_t *OpenAPI_wlan_ordering_criterion_parseFromJSON(cJSON *wlan_ordering_criterionJSON) +{ + OpenAPI_wlan_ordering_criterion_t *wlan_ordering_criterion_local_var = NULL; + OpenAPI_lnode_t *node = NULL; + wlan_ordering_criterion_local_var = OpenAPI_wlan_ordering_criterion_create ( + ); + + return wlan_ordering_criterion_local_var; +end: + return NULL; +} + +OpenAPI_wlan_ordering_criterion_t *OpenAPI_wlan_ordering_criterion_copy(OpenAPI_wlan_ordering_criterion_t *dst, OpenAPI_wlan_ordering_criterion_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_wlan_ordering_criterion_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_wlan_ordering_criterion_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_wlan_ordering_criterion_free(dst); + dst = OpenAPI_wlan_ordering_criterion_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/wlan_ordering_criterion.h b/lib/sbi/openapi/model/wlan_ordering_criterion.h new file mode 100644 index 000000000..4a8a57283 --- /dev/null +++ b/lib/sbi/openapi/model/wlan_ordering_criterion.h @@ -0,0 +1,37 @@ +/* + * wlan_ordering_criterion.h + * + * Possible values are: - TIME_SLOT_START: Indicates the order of time slot start. - NUMBER_OF_UES: Indicates the order of number of UEs. - RSSI: Indicates the order of RSSI. - RTT: Indicates the order of RTT. - TRAFFIC_INFO: Indicates the order of Traffic information. + */ + +#ifndef _OpenAPI_wlan_ordering_criterion_H_ +#define _OpenAPI_wlan_ordering_criterion_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "wlan_ordering_criterion_any_of.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_wlan_ordering_criterion_s OpenAPI_wlan_ordering_criterion_t; +typedef struct OpenAPI_wlan_ordering_criterion_s { +} OpenAPI_wlan_ordering_criterion_t; + +OpenAPI_wlan_ordering_criterion_t *OpenAPI_wlan_ordering_criterion_create( +); +void OpenAPI_wlan_ordering_criterion_free(OpenAPI_wlan_ordering_criterion_t *wlan_ordering_criterion); +OpenAPI_wlan_ordering_criterion_t *OpenAPI_wlan_ordering_criterion_parseFromJSON(cJSON *wlan_ordering_criterionJSON); +cJSON *OpenAPI_wlan_ordering_criterion_convertToJSON(OpenAPI_wlan_ordering_criterion_t *wlan_ordering_criterion); +OpenAPI_wlan_ordering_criterion_t *OpenAPI_wlan_ordering_criterion_copy(OpenAPI_wlan_ordering_criterion_t *dst, OpenAPI_wlan_ordering_criterion_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_wlan_ordering_criterion_H_ */ + diff --git a/lib/sbi/openapi/model/wlan_ordering_criterion_any_of.c b/lib/sbi/openapi/model/wlan_ordering_criterion_any_of.c new file mode 100644 index 000000000..aa55a0db1 --- /dev/null +++ b/lib/sbi/openapi/model/wlan_ordering_criterion_any_of.c @@ -0,0 +1,30 @@ + +#include +#include +#include +#include "wlan_ordering_criterion_any_of.h" + +char* OpenAPI_wlan_ordering_criterion_any_of_ToString(OpenAPI_wlan_ordering_criterion_any_of_e wlan_ordering_criterion_any_of) +{ + const char *wlan_ordering_criterion_any_ofArray[] = { "NULL", "TIME_SLOT_START", "NUMBER_OF_UES", "RSSI", "RTT", "TRAFFIC_INFO" }; + size_t sizeofArray = sizeof(wlan_ordering_criterion_any_ofArray) / sizeof(wlan_ordering_criterion_any_ofArray[0]); + if (wlan_ordering_criterion_any_of < sizeofArray) + return (char *)wlan_ordering_criterion_any_ofArray[wlan_ordering_criterion_any_of]; + else + return (char *)"Unknown"; +} + +OpenAPI_wlan_ordering_criterion_any_of_e OpenAPI_wlan_ordering_criterion_any_of_FromString(char* wlan_ordering_criterion_any_of) +{ + int stringToReturn = 0; + const char *wlan_ordering_criterion_any_ofArray[] = { "NULL", "TIME_SLOT_START", "NUMBER_OF_UES", "RSSI", "RTT", "TRAFFIC_INFO" }; + size_t sizeofArray = sizeof(wlan_ordering_criterion_any_ofArray) / sizeof(wlan_ordering_criterion_any_ofArray[0]); + while (stringToReturn < sizeofArray) { + if (strcmp(wlan_ordering_criterion_any_of, wlan_ordering_criterion_any_ofArray[stringToReturn]) == 0) { + return stringToReturn; + } + stringToReturn++; + } + return 0; +} + diff --git a/lib/sbi/openapi/model/wlan_ordering_criterion_any_of.h b/lib/sbi/openapi/model/wlan_ordering_criterion_any_of.h new file mode 100644 index 000000000..165e08741 --- /dev/null +++ b/lib/sbi/openapi/model/wlan_ordering_criterion_any_of.h @@ -0,0 +1,31 @@ +/* + * wlan_ordering_criterion_any_of.h + * + * + */ + +#ifndef _OpenAPI_wlan_ordering_criterion_any_of_H_ +#define _OpenAPI_wlan_ordering_criterion_any_of_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef enum { OpenAPI_wlan_ordering_criterion_any_of_NULL = 0, OpenAPI_wlan_ordering_criterion_any_of_TIME_SLOT_START, OpenAPI_wlan_ordering_criterion_any_of_NUMBER_OF_UES, OpenAPI_wlan_ordering_criterion_any_of_RSSI, OpenAPI_wlan_ordering_criterion_any_of_RTT, OpenAPI_wlan_ordering_criterion_any_of_TRAFFIC_INFO } OpenAPI_wlan_ordering_criterion_any_of_e; + +char* OpenAPI_wlan_ordering_criterion_any_of_ToString(OpenAPI_wlan_ordering_criterion_any_of_e wlan_ordering_criterion_any_of); + +OpenAPI_wlan_ordering_criterion_any_of_e OpenAPI_wlan_ordering_criterion_any_of_FromString(char* wlan_ordering_criterion_any_of); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_wlan_ordering_criterion_any_of_H_ */ + diff --git a/lib/sbi/openapi/model/wlan_per_ss_id_performance_info.c b/lib/sbi/openapi/model/wlan_per_ss_id_performance_info.c new file mode 100644 index 000000000..d6355b7d2 --- /dev/null +++ b/lib/sbi/openapi/model/wlan_per_ss_id_performance_info.c @@ -0,0 +1,178 @@ + +#include +#include +#include +#include "wlan_per_ss_id_performance_info.h" + +OpenAPI_wlan_per_ss_id_performance_info_t *OpenAPI_wlan_per_ss_id_performance_info_create( + char *ss_id, + OpenAPI_list_t *wlan_per_ts_infos +) +{ + OpenAPI_wlan_per_ss_id_performance_info_t *wlan_per_ss_id_performance_info_local_var = ogs_malloc(sizeof(OpenAPI_wlan_per_ss_id_performance_info_t)); + ogs_assert(wlan_per_ss_id_performance_info_local_var); + + wlan_per_ss_id_performance_info_local_var->ss_id = ss_id; + wlan_per_ss_id_performance_info_local_var->wlan_per_ts_infos = wlan_per_ts_infos; + + return wlan_per_ss_id_performance_info_local_var; +} + +void OpenAPI_wlan_per_ss_id_performance_info_free(OpenAPI_wlan_per_ss_id_performance_info_t *wlan_per_ss_id_performance_info) +{ + OpenAPI_lnode_t *node = NULL; + + if (NULL == wlan_per_ss_id_performance_info) { + return; + } + if (wlan_per_ss_id_performance_info->ss_id) { + ogs_free(wlan_per_ss_id_performance_info->ss_id); + wlan_per_ss_id_performance_info->ss_id = NULL; + } + if (wlan_per_ss_id_performance_info->wlan_per_ts_infos) { + OpenAPI_list_for_each(wlan_per_ss_id_performance_info->wlan_per_ts_infos, node) { + OpenAPI_wlan_per_ts_performance_info_free(node->data); + } + OpenAPI_list_free(wlan_per_ss_id_performance_info->wlan_per_ts_infos); + wlan_per_ss_id_performance_info->wlan_per_ts_infos = NULL; + } + ogs_free(wlan_per_ss_id_performance_info); +} + +cJSON *OpenAPI_wlan_per_ss_id_performance_info_convertToJSON(OpenAPI_wlan_per_ss_id_performance_info_t *wlan_per_ss_id_performance_info) +{ + cJSON *item = NULL; + OpenAPI_lnode_t *node = NULL; + + if (wlan_per_ss_id_performance_info == NULL) { + ogs_error("OpenAPI_wlan_per_ss_id_performance_info_convertToJSON() failed [WlanPerSsIdPerformanceInfo]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (!wlan_per_ss_id_performance_info->ss_id) { + ogs_error("OpenAPI_wlan_per_ss_id_performance_info_convertToJSON() failed [ss_id]"); + return NULL; + } + if (cJSON_AddStringToObject(item, "ssId", wlan_per_ss_id_performance_info->ss_id) == NULL) { + ogs_error("OpenAPI_wlan_per_ss_id_performance_info_convertToJSON() failed [ss_id]"); + goto end; + } + + if (!wlan_per_ss_id_performance_info->wlan_per_ts_infos) { + ogs_error("OpenAPI_wlan_per_ss_id_performance_info_convertToJSON() failed [wlan_per_ts_infos]"); + return NULL; + } + cJSON *wlan_per_ts_infosList = cJSON_AddArrayToObject(item, "wlanPerTsInfos"); + if (wlan_per_ts_infosList == NULL) { + ogs_error("OpenAPI_wlan_per_ss_id_performance_info_convertToJSON() failed [wlan_per_ts_infos]"); + goto end; + } + OpenAPI_list_for_each(wlan_per_ss_id_performance_info->wlan_per_ts_infos, node) { + cJSON *itemLocal = OpenAPI_wlan_per_ts_performance_info_convertToJSON(node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_wlan_per_ss_id_performance_info_convertToJSON() failed [wlan_per_ts_infos]"); + goto end; + } + cJSON_AddItemToArray(wlan_per_ts_infosList, itemLocal); + } + +end: + return item; +} + +OpenAPI_wlan_per_ss_id_performance_info_t *OpenAPI_wlan_per_ss_id_performance_info_parseFromJSON(cJSON *wlan_per_ss_id_performance_infoJSON) +{ + OpenAPI_wlan_per_ss_id_performance_info_t *wlan_per_ss_id_performance_info_local_var = NULL; + OpenAPI_lnode_t *node = NULL; + cJSON *ss_id = NULL; + cJSON *wlan_per_ts_infos = NULL; + OpenAPI_list_t *wlan_per_ts_infosList = NULL; + ss_id = cJSON_GetObjectItemCaseSensitive(wlan_per_ss_id_performance_infoJSON, "ssId"); + if (!ss_id) { + ogs_error("OpenAPI_wlan_per_ss_id_performance_info_parseFromJSON() failed [ss_id]"); + goto end; + } + if (!cJSON_IsString(ss_id)) { + ogs_error("OpenAPI_wlan_per_ss_id_performance_info_parseFromJSON() failed [ss_id]"); + goto end; + } + + wlan_per_ts_infos = cJSON_GetObjectItemCaseSensitive(wlan_per_ss_id_performance_infoJSON, "wlanPerTsInfos"); + if (!wlan_per_ts_infos) { + ogs_error("OpenAPI_wlan_per_ss_id_performance_info_parseFromJSON() failed [wlan_per_ts_infos]"); + goto end; + } + cJSON *wlan_per_ts_infos_local = NULL; + if (!cJSON_IsArray(wlan_per_ts_infos)) { + ogs_error("OpenAPI_wlan_per_ss_id_performance_info_parseFromJSON() failed [wlan_per_ts_infos]"); + goto end; + } + + wlan_per_ts_infosList = OpenAPI_list_create(); + + cJSON_ArrayForEach(wlan_per_ts_infos_local, wlan_per_ts_infos) { + if (!cJSON_IsObject(wlan_per_ts_infos_local)) { + ogs_error("OpenAPI_wlan_per_ss_id_performance_info_parseFromJSON() failed [wlan_per_ts_infos]"); + goto end; + } + OpenAPI_wlan_per_ts_performance_info_t *wlan_per_ts_infosItem = OpenAPI_wlan_per_ts_performance_info_parseFromJSON(wlan_per_ts_infos_local); + if (!wlan_per_ts_infosItem) { + ogs_error("No wlan_per_ts_infosItem"); + OpenAPI_list_free(wlan_per_ts_infosList); + goto end; + } + OpenAPI_list_add(wlan_per_ts_infosList, wlan_per_ts_infosItem); + } + + wlan_per_ss_id_performance_info_local_var = OpenAPI_wlan_per_ss_id_performance_info_create ( + ogs_strdup(ss_id->valuestring), + wlan_per_ts_infosList + ); + + return wlan_per_ss_id_performance_info_local_var; +end: + if (wlan_per_ts_infosList) { + OpenAPI_list_for_each(wlan_per_ts_infosList, node) { + OpenAPI_wlan_per_ts_performance_info_free(node->data); + } + OpenAPI_list_free(wlan_per_ts_infosList); + wlan_per_ts_infosList = NULL; + } + return NULL; +} + +OpenAPI_wlan_per_ss_id_performance_info_t *OpenAPI_wlan_per_ss_id_performance_info_copy(OpenAPI_wlan_per_ss_id_performance_info_t *dst, OpenAPI_wlan_per_ss_id_performance_info_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_wlan_per_ss_id_performance_info_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_wlan_per_ss_id_performance_info_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_wlan_per_ss_id_performance_info_free(dst); + dst = OpenAPI_wlan_per_ss_id_performance_info_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/wlan_per_ss_id_performance_info.h b/lib/sbi/openapi/model/wlan_per_ss_id_performance_info.h new file mode 100644 index 000000000..dcacc2653 --- /dev/null +++ b/lib/sbi/openapi/model/wlan_per_ss_id_performance_info.h @@ -0,0 +1,41 @@ +/* + * wlan_per_ss_id_performance_info.h + * + * The WLAN performance per SSID. + */ + +#ifndef _OpenAPI_wlan_per_ss_id_performance_info_H_ +#define _OpenAPI_wlan_per_ss_id_performance_info_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "wlan_per_ts_performance_info.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_wlan_per_ss_id_performance_info_s OpenAPI_wlan_per_ss_id_performance_info_t; +typedef struct OpenAPI_wlan_per_ss_id_performance_info_s { + char *ss_id; + OpenAPI_list_t *wlan_per_ts_infos; +} OpenAPI_wlan_per_ss_id_performance_info_t; + +OpenAPI_wlan_per_ss_id_performance_info_t *OpenAPI_wlan_per_ss_id_performance_info_create( + char *ss_id, + OpenAPI_list_t *wlan_per_ts_infos +); +void OpenAPI_wlan_per_ss_id_performance_info_free(OpenAPI_wlan_per_ss_id_performance_info_t *wlan_per_ss_id_performance_info); +OpenAPI_wlan_per_ss_id_performance_info_t *OpenAPI_wlan_per_ss_id_performance_info_parseFromJSON(cJSON *wlan_per_ss_id_performance_infoJSON); +cJSON *OpenAPI_wlan_per_ss_id_performance_info_convertToJSON(OpenAPI_wlan_per_ss_id_performance_info_t *wlan_per_ss_id_performance_info); +OpenAPI_wlan_per_ss_id_performance_info_t *OpenAPI_wlan_per_ss_id_performance_info_copy(OpenAPI_wlan_per_ss_id_performance_info_t *dst, OpenAPI_wlan_per_ss_id_performance_info_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_wlan_per_ss_id_performance_info_H_ */ + diff --git a/lib/sbi/openapi/model/wlan_per_ts_performance_info.c b/lib/sbi/openapi/model/wlan_per_ts_performance_info.c new file mode 100644 index 000000000..a7993ba91 --- /dev/null +++ b/lib/sbi/openapi/model/wlan_per_ts_performance_info.c @@ -0,0 +1,253 @@ + +#include +#include +#include +#include "wlan_per_ts_performance_info.h" + +OpenAPI_wlan_per_ts_performance_info_t *OpenAPI_wlan_per_ts_performance_info_create( + char *ts_start, + int ts_duration, + bool is_rssi, + int rssi, + bool is_rtt, + int rtt, + OpenAPI_traffic_information_t *traffic_info, + bool is_number_of_ues, + int number_of_ues, + bool is_confidence, + int confidence +) +{ + OpenAPI_wlan_per_ts_performance_info_t *wlan_per_ts_performance_info_local_var = ogs_malloc(sizeof(OpenAPI_wlan_per_ts_performance_info_t)); + ogs_assert(wlan_per_ts_performance_info_local_var); + + wlan_per_ts_performance_info_local_var->ts_start = ts_start; + wlan_per_ts_performance_info_local_var->ts_duration = ts_duration; + wlan_per_ts_performance_info_local_var->is_rssi = is_rssi; + wlan_per_ts_performance_info_local_var->rssi = rssi; + wlan_per_ts_performance_info_local_var->is_rtt = is_rtt; + wlan_per_ts_performance_info_local_var->rtt = rtt; + wlan_per_ts_performance_info_local_var->traffic_info = traffic_info; + wlan_per_ts_performance_info_local_var->is_number_of_ues = is_number_of_ues; + wlan_per_ts_performance_info_local_var->number_of_ues = number_of_ues; + wlan_per_ts_performance_info_local_var->is_confidence = is_confidence; + wlan_per_ts_performance_info_local_var->confidence = confidence; + + return wlan_per_ts_performance_info_local_var; +} + +void OpenAPI_wlan_per_ts_performance_info_free(OpenAPI_wlan_per_ts_performance_info_t *wlan_per_ts_performance_info) +{ + OpenAPI_lnode_t *node = NULL; + + if (NULL == wlan_per_ts_performance_info) { + return; + } + if (wlan_per_ts_performance_info->ts_start) { + ogs_free(wlan_per_ts_performance_info->ts_start); + wlan_per_ts_performance_info->ts_start = NULL; + } + if (wlan_per_ts_performance_info->traffic_info) { + OpenAPI_traffic_information_free(wlan_per_ts_performance_info->traffic_info); + wlan_per_ts_performance_info->traffic_info = NULL; + } + ogs_free(wlan_per_ts_performance_info); +} + +cJSON *OpenAPI_wlan_per_ts_performance_info_convertToJSON(OpenAPI_wlan_per_ts_performance_info_t *wlan_per_ts_performance_info) +{ + cJSON *item = NULL; + OpenAPI_lnode_t *node = NULL; + + if (wlan_per_ts_performance_info == NULL) { + ogs_error("OpenAPI_wlan_per_ts_performance_info_convertToJSON() failed [WlanPerTsPerformanceInfo]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (!wlan_per_ts_performance_info->ts_start) { + ogs_error("OpenAPI_wlan_per_ts_performance_info_convertToJSON() failed [ts_start]"); + return NULL; + } + if (cJSON_AddStringToObject(item, "tsStart", wlan_per_ts_performance_info->ts_start) == NULL) { + ogs_error("OpenAPI_wlan_per_ts_performance_info_convertToJSON() failed [ts_start]"); + goto end; + } + + if (cJSON_AddNumberToObject(item, "tsDuration", wlan_per_ts_performance_info->ts_duration) == NULL) { + ogs_error("OpenAPI_wlan_per_ts_performance_info_convertToJSON() failed [ts_duration]"); + goto end; + } + + if (wlan_per_ts_performance_info->is_rssi) { + if (cJSON_AddNumberToObject(item, "rssi", wlan_per_ts_performance_info->rssi) == NULL) { + ogs_error("OpenAPI_wlan_per_ts_performance_info_convertToJSON() failed [rssi]"); + goto end; + } + } + + if (wlan_per_ts_performance_info->is_rtt) { + if (cJSON_AddNumberToObject(item, "rtt", wlan_per_ts_performance_info->rtt) == NULL) { + ogs_error("OpenAPI_wlan_per_ts_performance_info_convertToJSON() failed [rtt]"); + goto end; + } + } + + if (wlan_per_ts_performance_info->traffic_info) { + cJSON *traffic_info_local_JSON = OpenAPI_traffic_information_convertToJSON(wlan_per_ts_performance_info->traffic_info); + if (traffic_info_local_JSON == NULL) { + ogs_error("OpenAPI_wlan_per_ts_performance_info_convertToJSON() failed [traffic_info]"); + goto end; + } + cJSON_AddItemToObject(item, "trafficInfo", traffic_info_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_wlan_per_ts_performance_info_convertToJSON() failed [traffic_info]"); + goto end; + } + } + + if (wlan_per_ts_performance_info->is_number_of_ues) { + if (cJSON_AddNumberToObject(item, "numberOfUes", wlan_per_ts_performance_info->number_of_ues) == NULL) { + ogs_error("OpenAPI_wlan_per_ts_performance_info_convertToJSON() failed [number_of_ues]"); + goto end; + } + } + + if (wlan_per_ts_performance_info->is_confidence) { + if (cJSON_AddNumberToObject(item, "confidence", wlan_per_ts_performance_info->confidence) == NULL) { + ogs_error("OpenAPI_wlan_per_ts_performance_info_convertToJSON() failed [confidence]"); + goto end; + } + } + +end: + return item; +} + +OpenAPI_wlan_per_ts_performance_info_t *OpenAPI_wlan_per_ts_performance_info_parseFromJSON(cJSON *wlan_per_ts_performance_infoJSON) +{ + OpenAPI_wlan_per_ts_performance_info_t *wlan_per_ts_performance_info_local_var = NULL; + OpenAPI_lnode_t *node = NULL; + cJSON *ts_start = NULL; + cJSON *ts_duration = NULL; + cJSON *rssi = NULL; + cJSON *rtt = NULL; + cJSON *traffic_info = NULL; + OpenAPI_traffic_information_t *traffic_info_local_nonprim = NULL; + cJSON *number_of_ues = NULL; + cJSON *confidence = NULL; + ts_start = cJSON_GetObjectItemCaseSensitive(wlan_per_ts_performance_infoJSON, "tsStart"); + if (!ts_start) { + ogs_error("OpenAPI_wlan_per_ts_performance_info_parseFromJSON() failed [ts_start]"); + goto end; + } + if (!cJSON_IsString(ts_start) && !cJSON_IsNull(ts_start)) { + ogs_error("OpenAPI_wlan_per_ts_performance_info_parseFromJSON() failed [ts_start]"); + goto end; + } + + ts_duration = cJSON_GetObjectItemCaseSensitive(wlan_per_ts_performance_infoJSON, "tsDuration"); + if (!ts_duration) { + ogs_error("OpenAPI_wlan_per_ts_performance_info_parseFromJSON() failed [ts_duration]"); + goto end; + } + if (!cJSON_IsNumber(ts_duration)) { + ogs_error("OpenAPI_wlan_per_ts_performance_info_parseFromJSON() failed [ts_duration]"); + goto end; + } + + rssi = cJSON_GetObjectItemCaseSensitive(wlan_per_ts_performance_infoJSON, "rssi"); + if (rssi) { + if (!cJSON_IsNumber(rssi)) { + ogs_error("OpenAPI_wlan_per_ts_performance_info_parseFromJSON() failed [rssi]"); + goto end; + } + } + + rtt = cJSON_GetObjectItemCaseSensitive(wlan_per_ts_performance_infoJSON, "rtt"); + if (rtt) { + if (!cJSON_IsNumber(rtt)) { + ogs_error("OpenAPI_wlan_per_ts_performance_info_parseFromJSON() failed [rtt]"); + goto end; + } + } + + traffic_info = cJSON_GetObjectItemCaseSensitive(wlan_per_ts_performance_infoJSON, "trafficInfo"); + if (traffic_info) { + traffic_info_local_nonprim = OpenAPI_traffic_information_parseFromJSON(traffic_info); + } + + number_of_ues = cJSON_GetObjectItemCaseSensitive(wlan_per_ts_performance_infoJSON, "numberOfUes"); + if (number_of_ues) { + if (!cJSON_IsNumber(number_of_ues)) { + ogs_error("OpenAPI_wlan_per_ts_performance_info_parseFromJSON() failed [number_of_ues]"); + goto end; + } + } + + confidence = cJSON_GetObjectItemCaseSensitive(wlan_per_ts_performance_infoJSON, "confidence"); + if (confidence) { + if (!cJSON_IsNumber(confidence)) { + ogs_error("OpenAPI_wlan_per_ts_performance_info_parseFromJSON() failed [confidence]"); + goto end; + } + } + + wlan_per_ts_performance_info_local_var = OpenAPI_wlan_per_ts_performance_info_create ( + ogs_strdup(ts_start->valuestring), + + ts_duration->valuedouble, + rssi ? true : false, + rssi ? rssi->valuedouble : 0, + rtt ? true : false, + rtt ? rtt->valuedouble : 0, + traffic_info ? traffic_info_local_nonprim : NULL, + number_of_ues ? true : false, + number_of_ues ? number_of_ues->valuedouble : 0, + confidence ? true : false, + confidence ? confidence->valuedouble : 0 + ); + + return wlan_per_ts_performance_info_local_var; +end: + if (traffic_info_local_nonprim) { + OpenAPI_traffic_information_free(traffic_info_local_nonprim); + traffic_info_local_nonprim = NULL; + } + return NULL; +} + +OpenAPI_wlan_per_ts_performance_info_t *OpenAPI_wlan_per_ts_performance_info_copy(OpenAPI_wlan_per_ts_performance_info_t *dst, OpenAPI_wlan_per_ts_performance_info_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_wlan_per_ts_performance_info_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_wlan_per_ts_performance_info_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_wlan_per_ts_performance_info_free(dst); + dst = OpenAPI_wlan_per_ts_performance_info_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/wlan_per_ts_performance_info.h b/lib/sbi/openapi/model/wlan_per_ts_performance_info.h new file mode 100644 index 000000000..9bc95158a --- /dev/null +++ b/lib/sbi/openapi/model/wlan_per_ts_performance_info.h @@ -0,0 +1,59 @@ +/* + * wlan_per_ts_performance_info.h + * + * WLAN performance information per Time Slot during the analytics target period. + */ + +#ifndef _OpenAPI_wlan_per_ts_performance_info_H_ +#define _OpenAPI_wlan_per_ts_performance_info_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "traffic_information.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_wlan_per_ts_performance_info_s OpenAPI_wlan_per_ts_performance_info_t; +typedef struct OpenAPI_wlan_per_ts_performance_info_s { + char *ts_start; + int ts_duration; + bool is_rssi; + int rssi; + bool is_rtt; + int rtt; + struct OpenAPI_traffic_information_s *traffic_info; + bool is_number_of_ues; + int number_of_ues; + bool is_confidence; + int confidence; +} OpenAPI_wlan_per_ts_performance_info_t; + +OpenAPI_wlan_per_ts_performance_info_t *OpenAPI_wlan_per_ts_performance_info_create( + char *ts_start, + int ts_duration, + bool is_rssi, + int rssi, + bool is_rtt, + int rtt, + OpenAPI_traffic_information_t *traffic_info, + bool is_number_of_ues, + int number_of_ues, + bool is_confidence, + int confidence +); +void OpenAPI_wlan_per_ts_performance_info_free(OpenAPI_wlan_per_ts_performance_info_t *wlan_per_ts_performance_info); +OpenAPI_wlan_per_ts_performance_info_t *OpenAPI_wlan_per_ts_performance_info_parseFromJSON(cJSON *wlan_per_ts_performance_infoJSON); +cJSON *OpenAPI_wlan_per_ts_performance_info_convertToJSON(OpenAPI_wlan_per_ts_performance_info_t *wlan_per_ts_performance_info); +OpenAPI_wlan_per_ts_performance_info_t *OpenAPI_wlan_per_ts_performance_info_copy(OpenAPI_wlan_per_ts_performance_info_t *dst, OpenAPI_wlan_per_ts_performance_info_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_wlan_per_ts_performance_info_H_ */ + diff --git a/lib/sbi/openapi/model/wlan_performance_info.c b/lib/sbi/openapi/model/wlan_performance_info.c new file mode 100644 index 000000000..7c9aa1461 --- /dev/null +++ b/lib/sbi/openapi/model/wlan_performance_info.c @@ -0,0 +1,182 @@ + +#include +#include +#include +#include "wlan_performance_info.h" + +OpenAPI_wlan_performance_info_t *OpenAPI_wlan_performance_info_create( + OpenAPI_network_area_info_t *network_area, + OpenAPI_list_t *wlan_per_ssid_infos +) +{ + OpenAPI_wlan_performance_info_t *wlan_performance_info_local_var = ogs_malloc(sizeof(OpenAPI_wlan_performance_info_t)); + ogs_assert(wlan_performance_info_local_var); + + wlan_performance_info_local_var->network_area = network_area; + wlan_performance_info_local_var->wlan_per_ssid_infos = wlan_per_ssid_infos; + + return wlan_performance_info_local_var; +} + +void OpenAPI_wlan_performance_info_free(OpenAPI_wlan_performance_info_t *wlan_performance_info) +{ + OpenAPI_lnode_t *node = NULL; + + if (NULL == wlan_performance_info) { + return; + } + if (wlan_performance_info->network_area) { + OpenAPI_network_area_info_free(wlan_performance_info->network_area); + wlan_performance_info->network_area = NULL; + } + if (wlan_performance_info->wlan_per_ssid_infos) { + OpenAPI_list_for_each(wlan_performance_info->wlan_per_ssid_infos, node) { + OpenAPI_wlan_per_ss_id_performance_info_free(node->data); + } + OpenAPI_list_free(wlan_performance_info->wlan_per_ssid_infos); + wlan_performance_info->wlan_per_ssid_infos = NULL; + } + ogs_free(wlan_performance_info); +} + +cJSON *OpenAPI_wlan_performance_info_convertToJSON(OpenAPI_wlan_performance_info_t *wlan_performance_info) +{ + cJSON *item = NULL; + OpenAPI_lnode_t *node = NULL; + + if (wlan_performance_info == NULL) { + ogs_error("OpenAPI_wlan_performance_info_convertToJSON() failed [WlanPerformanceInfo]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (wlan_performance_info->network_area) { + cJSON *network_area_local_JSON = OpenAPI_network_area_info_convertToJSON(wlan_performance_info->network_area); + if (network_area_local_JSON == NULL) { + ogs_error("OpenAPI_wlan_performance_info_convertToJSON() failed [network_area]"); + goto end; + } + cJSON_AddItemToObject(item, "networkArea", network_area_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_wlan_performance_info_convertToJSON() failed [network_area]"); + goto end; + } + } + + if (!wlan_performance_info->wlan_per_ssid_infos) { + ogs_error("OpenAPI_wlan_performance_info_convertToJSON() failed [wlan_per_ssid_infos]"); + return NULL; + } + cJSON *wlan_per_ssid_infosList = cJSON_AddArrayToObject(item, "wlanPerSsidInfos"); + if (wlan_per_ssid_infosList == NULL) { + ogs_error("OpenAPI_wlan_performance_info_convertToJSON() failed [wlan_per_ssid_infos]"); + goto end; + } + OpenAPI_list_for_each(wlan_performance_info->wlan_per_ssid_infos, node) { + cJSON *itemLocal = OpenAPI_wlan_per_ss_id_performance_info_convertToJSON(node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_wlan_performance_info_convertToJSON() failed [wlan_per_ssid_infos]"); + goto end; + } + cJSON_AddItemToArray(wlan_per_ssid_infosList, itemLocal); + } + +end: + return item; +} + +OpenAPI_wlan_performance_info_t *OpenAPI_wlan_performance_info_parseFromJSON(cJSON *wlan_performance_infoJSON) +{ + OpenAPI_wlan_performance_info_t *wlan_performance_info_local_var = NULL; + OpenAPI_lnode_t *node = NULL; + cJSON *network_area = NULL; + OpenAPI_network_area_info_t *network_area_local_nonprim = NULL; + cJSON *wlan_per_ssid_infos = NULL; + OpenAPI_list_t *wlan_per_ssid_infosList = NULL; + network_area = cJSON_GetObjectItemCaseSensitive(wlan_performance_infoJSON, "networkArea"); + if (network_area) { + network_area_local_nonprim = OpenAPI_network_area_info_parseFromJSON(network_area); + } + + wlan_per_ssid_infos = cJSON_GetObjectItemCaseSensitive(wlan_performance_infoJSON, "wlanPerSsidInfos"); + if (!wlan_per_ssid_infos) { + ogs_error("OpenAPI_wlan_performance_info_parseFromJSON() failed [wlan_per_ssid_infos]"); + goto end; + } + cJSON *wlan_per_ssid_infos_local = NULL; + if (!cJSON_IsArray(wlan_per_ssid_infos)) { + ogs_error("OpenAPI_wlan_performance_info_parseFromJSON() failed [wlan_per_ssid_infos]"); + goto end; + } + + wlan_per_ssid_infosList = OpenAPI_list_create(); + + cJSON_ArrayForEach(wlan_per_ssid_infos_local, wlan_per_ssid_infos) { + if (!cJSON_IsObject(wlan_per_ssid_infos_local)) { + ogs_error("OpenAPI_wlan_performance_info_parseFromJSON() failed [wlan_per_ssid_infos]"); + goto end; + } + OpenAPI_wlan_per_ss_id_performance_info_t *wlan_per_ssid_infosItem = OpenAPI_wlan_per_ss_id_performance_info_parseFromJSON(wlan_per_ssid_infos_local); + if (!wlan_per_ssid_infosItem) { + ogs_error("No wlan_per_ssid_infosItem"); + OpenAPI_list_free(wlan_per_ssid_infosList); + goto end; + } + OpenAPI_list_add(wlan_per_ssid_infosList, wlan_per_ssid_infosItem); + } + + wlan_performance_info_local_var = OpenAPI_wlan_performance_info_create ( + network_area ? network_area_local_nonprim : NULL, + wlan_per_ssid_infosList + ); + + return wlan_performance_info_local_var; +end: + if (network_area_local_nonprim) { + OpenAPI_network_area_info_free(network_area_local_nonprim); + network_area_local_nonprim = NULL; + } + if (wlan_per_ssid_infosList) { + OpenAPI_list_for_each(wlan_per_ssid_infosList, node) { + OpenAPI_wlan_per_ss_id_performance_info_free(node->data); + } + OpenAPI_list_free(wlan_per_ssid_infosList); + wlan_per_ssid_infosList = NULL; + } + return NULL; +} + +OpenAPI_wlan_performance_info_t *OpenAPI_wlan_performance_info_copy(OpenAPI_wlan_performance_info_t *dst, OpenAPI_wlan_performance_info_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_wlan_performance_info_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_wlan_performance_info_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_wlan_performance_info_free(dst); + dst = OpenAPI_wlan_performance_info_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/wlan_performance_info.h b/lib/sbi/openapi/model/wlan_performance_info.h new file mode 100644 index 000000000..29eb41f24 --- /dev/null +++ b/lib/sbi/openapi/model/wlan_performance_info.h @@ -0,0 +1,42 @@ +/* + * wlan_performance_info.h + * + * The WLAN performance related information. + */ + +#ifndef _OpenAPI_wlan_performance_info_H_ +#define _OpenAPI_wlan_performance_info_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "network_area_info.h" +#include "wlan_per_ss_id_performance_info.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_wlan_performance_info_s OpenAPI_wlan_performance_info_t; +typedef struct OpenAPI_wlan_performance_info_s { + struct OpenAPI_network_area_info_s *network_area; + OpenAPI_list_t *wlan_per_ssid_infos; +} OpenAPI_wlan_performance_info_t; + +OpenAPI_wlan_performance_info_t *OpenAPI_wlan_performance_info_create( + OpenAPI_network_area_info_t *network_area, + OpenAPI_list_t *wlan_per_ssid_infos +); +void OpenAPI_wlan_performance_info_free(OpenAPI_wlan_performance_info_t *wlan_performance_info); +OpenAPI_wlan_performance_info_t *OpenAPI_wlan_performance_info_parseFromJSON(cJSON *wlan_performance_infoJSON); +cJSON *OpenAPI_wlan_performance_info_convertToJSON(OpenAPI_wlan_performance_info_t *wlan_performance_info); +OpenAPI_wlan_performance_info_t *OpenAPI_wlan_performance_info_copy(OpenAPI_wlan_performance_info_t *dst, OpenAPI_wlan_performance_info_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_wlan_performance_info_H_ */ + diff --git a/lib/sbi/openapi/model/wlan_performance_req.c b/lib/sbi/openapi/model/wlan_performance_req.c new file mode 100644 index 000000000..aa406499c --- /dev/null +++ b/lib/sbi/openapi/model/wlan_performance_req.c @@ -0,0 +1,257 @@ + +#include +#include +#include +#include "wlan_performance_req.h" + +OpenAPI_wlan_performance_req_t *OpenAPI_wlan_performance_req_create( + OpenAPI_list_t *ss_ids, + OpenAPI_list_t *bss_ids, + OpenAPI_wlan_ordering_criterion_t *wlan_order_criter, + OpenAPI_matching_direction_t *order +) +{ + OpenAPI_wlan_performance_req_t *wlan_performance_req_local_var = ogs_malloc(sizeof(OpenAPI_wlan_performance_req_t)); + ogs_assert(wlan_performance_req_local_var); + + wlan_performance_req_local_var->ss_ids = ss_ids; + wlan_performance_req_local_var->bss_ids = bss_ids; + wlan_performance_req_local_var->wlan_order_criter = wlan_order_criter; + wlan_performance_req_local_var->order = order; + + return wlan_performance_req_local_var; +} + +void OpenAPI_wlan_performance_req_free(OpenAPI_wlan_performance_req_t *wlan_performance_req) +{ + OpenAPI_lnode_t *node = NULL; + + if (NULL == wlan_performance_req) { + return; + } + if (wlan_performance_req->ss_ids) { + OpenAPI_list_for_each(wlan_performance_req->ss_ids, node) { + ogs_free(node->data); + } + OpenAPI_list_free(wlan_performance_req->ss_ids); + wlan_performance_req->ss_ids = NULL; + } + if (wlan_performance_req->bss_ids) { + OpenAPI_list_for_each(wlan_performance_req->bss_ids, node) { + ogs_free(node->data); + } + OpenAPI_list_free(wlan_performance_req->bss_ids); + wlan_performance_req->bss_ids = NULL; + } + if (wlan_performance_req->wlan_order_criter) { + OpenAPI_wlan_ordering_criterion_free(wlan_performance_req->wlan_order_criter); + wlan_performance_req->wlan_order_criter = NULL; + } + if (wlan_performance_req->order) { + OpenAPI_matching_direction_free(wlan_performance_req->order); + wlan_performance_req->order = NULL; + } + ogs_free(wlan_performance_req); +} + +cJSON *OpenAPI_wlan_performance_req_convertToJSON(OpenAPI_wlan_performance_req_t *wlan_performance_req) +{ + cJSON *item = NULL; + OpenAPI_lnode_t *node = NULL; + + if (wlan_performance_req == NULL) { + ogs_error("OpenAPI_wlan_performance_req_convertToJSON() failed [WlanPerformanceReq]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (wlan_performance_req->ss_ids) { + cJSON *ss_idsList = cJSON_AddArrayToObject(item, "ssIds"); + if (ss_idsList == NULL) { + ogs_error("OpenAPI_wlan_performance_req_convertToJSON() failed [ss_ids]"); + goto end; + } + OpenAPI_list_for_each(wlan_performance_req->ss_ids, node) { + if (cJSON_AddStringToObject(ss_idsList, "", (char*)node->data) == NULL) { + ogs_error("OpenAPI_wlan_performance_req_convertToJSON() failed [ss_ids]"); + goto end; + } + } + } + + if (wlan_performance_req->bss_ids) { + cJSON *bss_idsList = cJSON_AddArrayToObject(item, "bssIds"); + if (bss_idsList == NULL) { + ogs_error("OpenAPI_wlan_performance_req_convertToJSON() failed [bss_ids]"); + goto end; + } + OpenAPI_list_for_each(wlan_performance_req->bss_ids, node) { + if (cJSON_AddStringToObject(bss_idsList, "", (char*)node->data) == NULL) { + ogs_error("OpenAPI_wlan_performance_req_convertToJSON() failed [bss_ids]"); + goto end; + } + } + } + + if (wlan_performance_req->wlan_order_criter) { + cJSON *wlan_order_criter_local_JSON = OpenAPI_wlan_ordering_criterion_convertToJSON(wlan_performance_req->wlan_order_criter); + if (wlan_order_criter_local_JSON == NULL) { + ogs_error("OpenAPI_wlan_performance_req_convertToJSON() failed [wlan_order_criter]"); + goto end; + } + cJSON_AddItemToObject(item, "wlanOrderCriter", wlan_order_criter_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_wlan_performance_req_convertToJSON() failed [wlan_order_criter]"); + goto end; + } + } + + if (wlan_performance_req->order) { + cJSON *order_local_JSON = OpenAPI_matching_direction_convertToJSON(wlan_performance_req->order); + if (order_local_JSON == NULL) { + ogs_error("OpenAPI_wlan_performance_req_convertToJSON() failed [order]"); + goto end; + } + cJSON_AddItemToObject(item, "order", order_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_wlan_performance_req_convertToJSON() failed [order]"); + goto end; + } + } + +end: + return item; +} + +OpenAPI_wlan_performance_req_t *OpenAPI_wlan_performance_req_parseFromJSON(cJSON *wlan_performance_reqJSON) +{ + OpenAPI_wlan_performance_req_t *wlan_performance_req_local_var = NULL; + OpenAPI_lnode_t *node = NULL; + cJSON *ss_ids = NULL; + OpenAPI_list_t *ss_idsList = NULL; + cJSON *bss_ids = NULL; + OpenAPI_list_t *bss_idsList = NULL; + cJSON *wlan_order_criter = NULL; + OpenAPI_wlan_ordering_criterion_t *wlan_order_criter_local_nonprim = NULL; + cJSON *order = NULL; + OpenAPI_matching_direction_t *order_local_nonprim = NULL; + ss_ids = cJSON_GetObjectItemCaseSensitive(wlan_performance_reqJSON, "ssIds"); + if (ss_ids) { + cJSON *ss_ids_local = NULL; + if (!cJSON_IsArray(ss_ids)) { + ogs_error("OpenAPI_wlan_performance_req_parseFromJSON() failed [ss_ids]"); + goto end; + } + + ss_idsList = OpenAPI_list_create(); + + cJSON_ArrayForEach(ss_ids_local, ss_ids) { + double *localDouble = NULL; + int *localInt = NULL; + if (!cJSON_IsString(ss_ids_local)) { + ogs_error("OpenAPI_wlan_performance_req_parseFromJSON() failed [ss_ids]"); + goto end; + } + OpenAPI_list_add(ss_idsList, ogs_strdup(ss_ids_local->valuestring)); + } + } + + bss_ids = cJSON_GetObjectItemCaseSensitive(wlan_performance_reqJSON, "bssIds"); + if (bss_ids) { + cJSON *bss_ids_local = NULL; + if (!cJSON_IsArray(bss_ids)) { + ogs_error("OpenAPI_wlan_performance_req_parseFromJSON() failed [bss_ids]"); + goto end; + } + + bss_idsList = OpenAPI_list_create(); + + cJSON_ArrayForEach(bss_ids_local, bss_ids) { + double *localDouble = NULL; + int *localInt = NULL; + if (!cJSON_IsString(bss_ids_local)) { + ogs_error("OpenAPI_wlan_performance_req_parseFromJSON() failed [bss_ids]"); + goto end; + } + OpenAPI_list_add(bss_idsList, ogs_strdup(bss_ids_local->valuestring)); + } + } + + wlan_order_criter = cJSON_GetObjectItemCaseSensitive(wlan_performance_reqJSON, "wlanOrderCriter"); + if (wlan_order_criter) { + wlan_order_criter_local_nonprim = OpenAPI_wlan_ordering_criterion_parseFromJSON(wlan_order_criter); + } + + order = cJSON_GetObjectItemCaseSensitive(wlan_performance_reqJSON, "order"); + if (order) { + order_local_nonprim = OpenAPI_matching_direction_parseFromJSON(order); + } + + wlan_performance_req_local_var = OpenAPI_wlan_performance_req_create ( + ss_ids ? ss_idsList : NULL, + bss_ids ? bss_idsList : NULL, + wlan_order_criter ? wlan_order_criter_local_nonprim : NULL, + order ? order_local_nonprim : NULL + ); + + return wlan_performance_req_local_var; +end: + if (ss_idsList) { + OpenAPI_list_for_each(ss_idsList, node) { + ogs_free(node->data); + } + OpenAPI_list_free(ss_idsList); + ss_idsList = NULL; + } + if (bss_idsList) { + OpenAPI_list_for_each(bss_idsList, node) { + ogs_free(node->data); + } + OpenAPI_list_free(bss_idsList); + bss_idsList = NULL; + } + if (wlan_order_criter_local_nonprim) { + OpenAPI_wlan_ordering_criterion_free(wlan_order_criter_local_nonprim); + wlan_order_criter_local_nonprim = NULL; + } + if (order_local_nonprim) { + OpenAPI_matching_direction_free(order_local_nonprim); + order_local_nonprim = NULL; + } + return NULL; +} + +OpenAPI_wlan_performance_req_t *OpenAPI_wlan_performance_req_copy(OpenAPI_wlan_performance_req_t *dst, OpenAPI_wlan_performance_req_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_wlan_performance_req_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_wlan_performance_req_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_wlan_performance_req_free(dst); + dst = OpenAPI_wlan_performance_req_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/wlan_performance_req.h b/lib/sbi/openapi/model/wlan_performance_req.h new file mode 100644 index 000000000..6af70d95d --- /dev/null +++ b/lib/sbi/openapi/model/wlan_performance_req.h @@ -0,0 +1,46 @@ +/* + * wlan_performance_req.h + * + * Represents other WLAN performance analytics requirements. + */ + +#ifndef _OpenAPI_wlan_performance_req_H_ +#define _OpenAPI_wlan_performance_req_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "matching_direction.h" +#include "wlan_ordering_criterion.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_wlan_performance_req_s OpenAPI_wlan_performance_req_t; +typedef struct OpenAPI_wlan_performance_req_s { + OpenAPI_list_t *ss_ids; + OpenAPI_list_t *bss_ids; + struct OpenAPI_wlan_ordering_criterion_s *wlan_order_criter; + struct OpenAPI_matching_direction_s *order; +} OpenAPI_wlan_performance_req_t; + +OpenAPI_wlan_performance_req_t *OpenAPI_wlan_performance_req_create( + OpenAPI_list_t *ss_ids, + OpenAPI_list_t *bss_ids, + OpenAPI_wlan_ordering_criterion_t *wlan_order_criter, + OpenAPI_matching_direction_t *order +); +void OpenAPI_wlan_performance_req_free(OpenAPI_wlan_performance_req_t *wlan_performance_req); +OpenAPI_wlan_performance_req_t *OpenAPI_wlan_performance_req_parseFromJSON(cJSON *wlan_performance_reqJSON); +cJSON *OpenAPI_wlan_performance_req_convertToJSON(OpenAPI_wlan_performance_req_t *wlan_performance_req); +OpenAPI_wlan_performance_req_t *OpenAPI_wlan_performance_req_copy(OpenAPI_wlan_performance_req_t *dst, OpenAPI_wlan_performance_req_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_wlan_performance_req_H_ */ + diff --git a/src/nrf/nnrf-handler.c b/src/nrf/nnrf-handler.c index 2926723c0..84fc53575 100644 --- a/src/nrf/nnrf-handler.c +++ b/src/nrf/nnrf-handler.c @@ -165,7 +165,7 @@ bool nrf_nnrf_handle_nf_status_subscribe( int status; ogs_sbi_response_t *response = NULL; OpenAPI_subscription_data_t *SubscriptionData = NULL; - OpenAPI_subscription_data_subscr_cond_t *SubscrCond = NULL; + OpenAPI_subscr_cond_t *SubscrCond = NULL; ogs_sbi_subscription_data_t *subscription_data = NULL; ogs_sbi_client_t *client = NULL; OpenAPI_uri_scheme_e scheme = OpenAPI_uri_scheme_NULL;