From e41afff7acbfaa254b696b058010895904cc840c Mon Sep 17 00:00:00 2001 From: Sukchan Lee Date: Sun, 5 Mar 2023 22:55:36 +0900 Subject: [PATCH] Added N32 Interface to implement SEPP --- lib/sbi/openapi/meson.build | 554 +++++++++--------- ...e_data_subs_to_notify_post_request_inner.c | 145 +++++ ...e_data_subs_to_notify_post_request_inner.h | 42 ++ lib/sbi/openapi/model/api_ie_mapping.c | 211 +++++++ lib/sbi/openapi/model/api_ie_mapping.h | 45 ++ lib/sbi/openapi/model/api_signature.c | 114 ++++ lib/sbi/openapi/model/api_signature.h | 39 ++ lib/sbi/openapi/model/callback_name.c | 114 ++++ lib/sbi/openapi/model/callback_name.h | 38 ++ .../openapi/model/failed_modification_info.c | 139 +++++ .../openapi/model/failed_modification_info.h | 41 ++ lib/sbi/openapi/model/failure_reason.c | 30 + lib/sbi/openapi/model/failure_reason.h | 31 + lib/sbi/openapi/model/failure_reason_any_of.c | 30 + lib/sbi/openapi/model/failure_reason_any_of.h | 31 + lib/sbi/openapi/model/http_method.c | 30 + lib/sbi/openapi/model/http_method.h | 31 + lib/sbi/openapi/model/http_method_any_of.c | 30 + lib/sbi/openapi/model/http_method_any_of.h | 31 + lib/sbi/openapi/model/ie_info.c | 278 +++++++++ lib/sbi/openapi/model/ie_info.h | 52 ++ lib/sbi/openapi/model/ie_location.c | 30 + lib/sbi/openapi/model/ie_location.h | 31 + lib/sbi/openapi/model/ie_location_any_of.c | 30 + lib/sbi/openapi/model/ie_location_any_of.h | 31 + lib/sbi/openapi/model/ie_type.c | 30 + lib/sbi/openapi/model/ie_type.h | 31 + lib/sbi/openapi/model/ie_type_any_of.c | 30 + lib/sbi/openapi/model/ie_type_any_of.h | 31 + lib/sbi/openapi/model/intended_n32_purpose.c | 158 +++++ lib/sbi/openapi/model/intended_n32_purpose.h | 43 ++ lib/sbi/openapi/model/ipx_provider_sec_info.c | 222 +++++++ lib/sbi/openapi/model/ipx_provider_sec_info.h | 42 ++ lib/sbi/openapi/model/n32_purpose.c | 30 + lib/sbi/openapi/model/n32_purpose.h | 31 + lib/sbi/openapi/model/n32_purpose_any_of.c | 30 + lib/sbi/openapi/model/n32_purpose_any_of.h | 31 + lib/sbi/openapi/model/n32f_context_info.c | 114 ++++ lib/sbi/openapi/model/n32f_context_info.h | 38 ++ lib/sbi/openapi/model/n32f_error_detail.c | 139 +++++ lib/sbi/openapi/model/n32f_error_detail.h | 41 ++ lib/sbi/openapi/model/n32f_error_info.c | 282 +++++++++ lib/sbi/openapi/model/n32f_error_info.h | 49 ++ lib/sbi/openapi/model/n32f_error_type.c | 30 + lib/sbi/openapi/model/n32f_error_type.h | 31 + .../openapi/model/n32f_error_type_any_of.c | 30 + .../openapi/model/n32f_error_type_any_of.h | 31 + lib/sbi/openapi/model/protection_policy.c | 197 +++++++ lib/sbi/openapi/model/protection_policy.h | 42 ++ .../openapi/model/sec_negotiate_req_data.c | 451 ++++++++++++++ .../openapi/model/sec_negotiate_req_data.h | 60 ++ .../openapi/model/sec_negotiate_rsp_data.c | 424 ++++++++++++++ .../openapi/model/sec_negotiate_rsp_data.h | 58 ++ .../openapi/model/sec_param_exch_req_data.c | 336 +++++++++++ .../openapi/model/sec_param_exch_req_data.h | 50 ++ .../openapi/model/sec_param_exch_rsp_data.c | 274 +++++++++ .../openapi/model/sec_param_exch_rsp_data.h | 50 ++ lib/sbi/openapi/model/security_capability.c | 30 + lib/sbi/openapi/model/security_capability.h | 31 + .../model/security_capability_any_of.c | 30 + .../model/security_capability_any_of.h | 31 + .../generator.sh | 1 + .../modified/TS29573_N32_Handshake.yaml | 56 +- 63 files changed, 5503 insertions(+), 290 deletions(-) create mode 100644 lib/sbi/openapi/model/_application_data_influence_data_subs_to_notify_post_request_inner.c create mode 100644 lib/sbi/openapi/model/_application_data_influence_data_subs_to_notify_post_request_inner.h create mode 100644 lib/sbi/openapi/model/api_ie_mapping.c create mode 100644 lib/sbi/openapi/model/api_ie_mapping.h create mode 100644 lib/sbi/openapi/model/api_signature.c create mode 100644 lib/sbi/openapi/model/api_signature.h create mode 100644 lib/sbi/openapi/model/callback_name.c create mode 100644 lib/sbi/openapi/model/callback_name.h create mode 100644 lib/sbi/openapi/model/failed_modification_info.c create mode 100644 lib/sbi/openapi/model/failed_modification_info.h create mode 100644 lib/sbi/openapi/model/failure_reason.c create mode 100644 lib/sbi/openapi/model/failure_reason.h create mode 100644 lib/sbi/openapi/model/failure_reason_any_of.c create mode 100644 lib/sbi/openapi/model/failure_reason_any_of.h create mode 100644 lib/sbi/openapi/model/http_method.c create mode 100644 lib/sbi/openapi/model/http_method.h create mode 100644 lib/sbi/openapi/model/http_method_any_of.c create mode 100644 lib/sbi/openapi/model/http_method_any_of.h create mode 100644 lib/sbi/openapi/model/ie_info.c create mode 100644 lib/sbi/openapi/model/ie_info.h create mode 100644 lib/sbi/openapi/model/ie_location.c create mode 100644 lib/sbi/openapi/model/ie_location.h create mode 100644 lib/sbi/openapi/model/ie_location_any_of.c create mode 100644 lib/sbi/openapi/model/ie_location_any_of.h create mode 100644 lib/sbi/openapi/model/ie_type.c create mode 100644 lib/sbi/openapi/model/ie_type.h create mode 100644 lib/sbi/openapi/model/ie_type_any_of.c create mode 100644 lib/sbi/openapi/model/ie_type_any_of.h create mode 100644 lib/sbi/openapi/model/intended_n32_purpose.c create mode 100644 lib/sbi/openapi/model/intended_n32_purpose.h create mode 100644 lib/sbi/openapi/model/ipx_provider_sec_info.c create mode 100644 lib/sbi/openapi/model/ipx_provider_sec_info.h create mode 100644 lib/sbi/openapi/model/n32_purpose.c create mode 100644 lib/sbi/openapi/model/n32_purpose.h create mode 100644 lib/sbi/openapi/model/n32_purpose_any_of.c create mode 100644 lib/sbi/openapi/model/n32_purpose_any_of.h create mode 100644 lib/sbi/openapi/model/n32f_context_info.c create mode 100644 lib/sbi/openapi/model/n32f_context_info.h create mode 100644 lib/sbi/openapi/model/n32f_error_detail.c create mode 100644 lib/sbi/openapi/model/n32f_error_detail.h create mode 100644 lib/sbi/openapi/model/n32f_error_info.c create mode 100644 lib/sbi/openapi/model/n32f_error_info.h create mode 100644 lib/sbi/openapi/model/n32f_error_type.c create mode 100644 lib/sbi/openapi/model/n32f_error_type.h create mode 100644 lib/sbi/openapi/model/n32f_error_type_any_of.c create mode 100644 lib/sbi/openapi/model/n32f_error_type_any_of.h create mode 100644 lib/sbi/openapi/model/protection_policy.c create mode 100644 lib/sbi/openapi/model/protection_policy.h create mode 100644 lib/sbi/openapi/model/sec_negotiate_req_data.c create mode 100644 lib/sbi/openapi/model/sec_negotiate_req_data.h create mode 100644 lib/sbi/openapi/model/sec_negotiate_rsp_data.c create mode 100644 lib/sbi/openapi/model/sec_negotiate_rsp_data.h create mode 100644 lib/sbi/openapi/model/sec_param_exch_req_data.c create mode 100644 lib/sbi/openapi/model/sec_param_exch_req_data.h create mode 100644 lib/sbi/openapi/model/sec_param_exch_rsp_data.c create mode 100644 lib/sbi/openapi/model/sec_param_exch_rsp_data.h create mode 100644 lib/sbi/openapi/model/security_capability.c create mode 100644 lib/sbi/openapi/model/security_capability.h create mode 100644 lib/sbi/openapi/model/security_capability_any_of.c create mode 100644 lib/sbi/openapi/model/security_capability_any_of.h diff --git a/lib/sbi/openapi/meson.build b/lib/sbi/openapi/meson.build index c51b96124..b3a507bd3 100644 --- a/lib/sbi/openapi/meson.build +++ b/lib/sbi/openapi/meson.build @@ -23,41 +23,41 @@ libsbi_openapi_sources = files(''' 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.c model/access_and_mobility_subscription_data_1.c + model/access_and_mobility_subscription_data.c model/access_net_charging_identifier.c model/access_network_id.c - model/access_right_status.c model/access_right_status_any_of.c - model/access_tech.c + model/access_right_status.c model/access_tech_any_of.c + model/access_tech.c model/access_token_err.c model/access_token_req.c model/access_type.c model/access_type_rm.c - model/accu_usage_report.c + model/acc_net_charging_address.c + model/acc_net_ch_id.c model/accumulated_usage.c - model/accuracy.c model/accuracy_any_of.c + model/accuracy.c + model/accu_usage_report.c model/acknowledge_info.c - model/acs_info.c model/acs_info_1.c + model/acs_info.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/additional_snssai_data.c model/address_list.c + model/addr_fqdn.c model/aerial_ue_indication.c - model/aerial_ue_subscription_info.c model/aerial_ue_subscription_info_1.c + model/aerial_ue_subscription_info.c model/af_coordination_info.c model/af_event.c model/af_event_exposure_data.c @@ -74,50 +74,56 @@ libsbi_openapi_sources = files(''' model/allowed_snssai.c model/alternative_qos_profile.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.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.c model/amf_event_area.c + model/amf_event.c model/amf_event_mode.c - model/amf_event_subscription.c model/amf_event_subscription_add_info.c - model/amf_event_trigger.c + model/amf_event_subscription.c model/amf_event_trigger_any_of.c - model/amf_event_type.c + model/amf_event_trigger.c model/amf_event_type_any_of.c + model/amf_event_type.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_info.c model/amf_subscription_info.c - model/an_gw_address.c - model/an_node_type.c - model/analytics_metadata.c + model/am_influ_data.c + model/am_influ_event_any_of.c + model/am_influ_event.c + model/am_policy_data.c + model/am_requested_value_rep.c model/analytics_metadata_any_of.c + model/analytics_metadata.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/analytics_subset.c model/anchor_smf_features.c + model/an_gw_address.c + model/an_node_type.c model/any_type.c + model/api_ie_mapping.c + model/api_signature.c model/apn_rate_status.c - model/app_descriptor.c model/app_descriptor_1.c + model/app_descriptor.c model/app_detection_info.c model/app_detection_notif_type.c model/app_detection_report.c + model/application_data_change_notif.c + model/_application_data_influence_data_subs_to_notify_post_request_inner.c + model/application_data_subs.c + model/application_volume.c model/app_list_for_ue_comm.c model/app_port_id.c model/app_session_context.c @@ -125,42 +131,39 @@ libsbi_openapi_sources = files(''' model/app_session_context_resp_data.c model/app_session_context_update_data.c model/app_session_context_update_data_patch.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.c model/area_of_interest_event_state.c model/area_of_validity.c model/area_scope.c - model/arp.c model/arp_1.c - model/as_time_distribution_param.c + model/arp.c model/assign_ebi_data.c model/assign_ebi_error.c model/assign_ebi_failed.c model/assigned_ebi_data.c - model/association_type.c model/association_type_any_of.c + model/association_type.c + model/as_time_distribution_param.c model/atom.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/av5_ghe_aka.c + model/auth_result.c + model/auth_status.c + model/auth_type.c model/av5g_aka.c + model/av5_ghe_aka.c model/av_eap_aka_prime.c model/av_eps_aka.c model/av_ims_gba_eap_aka.c @@ -172,8 +175,8 @@ libsbi_openapi_sources = files(''' model/bdt_data_patch.c model/bdt_policy_data.c model/bdt_policy_data_patch.c - model/bdt_policy_status.c model/bdt_policy_status_any_of.c + model/bdt_policy_status.c model/binding_level.c model/binding_resp.c model/bridge_management_container.c @@ -185,15 +188,16 @@ libsbi_openapi_sources = files(''' model/bsf_subscription_resp.c model/bw_requirement.c model/cag_ack_data.c - model/cag_data.c model/cag_data_1.c - model/cag_info.c + model/cag_data.c model/cag_info_1.c + model/cag_info.c + model/callback_name.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/ce_mode_b_ind.c model/change_item.c model/change_type.c model/charging_data.c @@ -204,8 +208,8 @@ libsbi_openapi_sources = files(''' model/civic_address.c model/class_criterion.c model/cm_info.c - model/cm_state.c model/cm_state_any_of.c + model/cm_state.c model/cn_assisted_ran_para.c model/cnf.c model/cnf_unit.c @@ -214,8 +218,8 @@ libsbi_openapi_sources = files(''' 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/communication_characteristics.c model/complex_query.c model/condition_data.c model/condition_event_type.c @@ -223,10 +227,10 @@ libsbi_openapi_sources = files(''' 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/congestion_type.c model/connection_capabilities_any_of.c + model/connection_capabilities.c model/consumer_nf_information.c model/context_data_set_name.c model/context_data_sets.c @@ -238,24 +242,24 @@ libsbi_openapi_sources = files(''' model/credit_management_status.c model/data_change_notify.c model/data_filter.c - model/data_ind.c model/data_ind_any_of.c + model/data_ind.c + model/datalink_reporting_configuration_1.c + model/datalink_reporting_configuration.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/dataset_statistical_property.c model/dccf_cond.c model/dccf_info.c - model/ddd_traffic_descriptor.c model/ddd_traffic_descriptor_1.c + model/ddd_traffic_descriptor.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.c + model/def_sub_service_info.c model/deregistration_data.c model/deregistration_info.c model/deregistration_reason.c @@ -264,23 +268,18 @@ libsbi_openapi_sources = files(''' 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_ordering_criterion.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.c model/dnn_configuration_1.c + model/dnn_configuration.c model/dnn_easdf_info_item.c model/dnn_info.c model/dnn_info_item.c @@ -292,34 +291,39 @@ libsbi_openapi_sources = files(''' model/dnn_snssai_information.c model/dnn_tsctsf_info_item.c model/dnn_upf_info_item.c - model/domain_name_protocol.c + model/dn_perf.c + model/dn_perf_info.c + model/dn_perf_ordering_criterion_any_of.c + model/dn_perf_ordering_criterion.c + model/dn_performance_req.c model/domain_name_protocol_any_of.c + model/domain_name_protocol.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/easdf_info.c model/eas_ip_replacement_info.c model/eas_server_address.c - model/easdf_info.c model/ebi_arp_mapping.c - model/ec_restriction.c - model/ec_restriction_1.c - model/ec_restriction_data_wb.c - model/ecgi.c model/ecgi_1.c - model/ecs_addr_config_info.c + model/ecgi.c + model/ec_restriction_1.c + model/ec_restriction.c + model/ec_restriction_data_wb.c model/ecs_addr_config_info_1.c + model/ecs_addr_config_info.c model/ecs_server_addr.c - model/edrx_parameters.c model/edrx_parameters_1.c + model/edrx_parameters.c model/ee_group_profile_data.c model/ee_profile_data.c - model/ee_subscription.c model/ee_subscription_1.c + model/ee_subscription.c model/ee_subscription_ext.c - model/ellipsoid_arc.c model/ellipsoid_arc_all_of.c + model/ellipsoid_arc.c model/emergency_info.c model/enhanced_coverage_restriction_data.c model/eps_bearer_info.c @@ -333,74 +337,77 @@ 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.c model/event_for_mdt.c - model/event_id.c model/event_id_any_of.c + model/event_id.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/event_report_mode_any_of.c + model/event_report_mode.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_subscription.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_id.c model/exception_trend_any_of.c + model/exception_trend.c model/exemption_ind.c - model/expected_analytics_type.c model/expected_analytics_type_any_of.c + model/expected_analytics_type.c model/expected_ue_behavior.c model/expected_ue_behaviour.c - model/expected_ue_behaviour_data.c model/expected_ue_behaviour_data_1.c + model/expected_ue_behaviour_data.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/extended_sm_subs_data.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/failed_modification_info.c model/failure_cause.c model/failure_code.c model/failure_event_info.c - model/final_unit_action.c + model/failure_reason_any_of.c + model/failure_reason.c model/final_unit_action_any_of.c + model/final_unit_action.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/flows.c model/fqdn_rm.c - model/frame_route_info.c model/frame_route_info_1.c + model/frame_route_info.c model/gad_shape.c - model/gba_auth_type.c model/gba_authentication_info_request.c model/gba_authentication_info_result.c + model/gba_auth_type.c model/gbr_qos_flow_information.c - model/geo_service_area.c - model/geo_service_area_1.c - model/geographic_area.c model/geographical_area.c model/geographical_coordinates.c + model/geographic_area.c + model/geo_service_area_1.c + model/geo_service_area.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/global_ran_node_id.c model/gmlc_info.c model/gnb_id.c model/gpsi_type.c @@ -410,35 +417,43 @@ libsbi_openapi_sources = files(''' model/hfc_node_id.c model/ho_state.c model/hsmf_update_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/hsmf_update_error.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/http_method_any_of.c + model/http_method.c model/identity_data.c model/identity_range.c + model/id_translation_result.c + model/ie_info.c + model/ie_location_any_of.c + model/ie_location.c + model/ie_type_any_of.c + model/ie_type.c model/immediate_mdt_conf.c model/immediate_report.c - model/ims_vo_ps.c model/imsi_range.c + model/ims_vo_ps.c model/indirect_data_forwarding_tunnel_info.c model/integrity_algorithm.c - model/inter_freq_target_info.c - model/inter_freq_target_info_1.c + model/intended_n32_purpose.c model/interface_upf_info_item.c + model/inter_freq_target_info_1.c + model/inter_freq_target_info.c model/internal_group_id_range.c model/invalid_param.c - model/ip_addr.c model/ip_addr_1.c - model/ip_address.c + model/ip_addr.c model/ip_address_1.c + model/ip_address.c model/ip_end_point.c model/ip_eth_flow_description.c model/ip_index.c @@ -451,6 +466,7 @@ libsbi_openapi_sources = files(''' model/iptv_config_data_patch.c model/ipv4_address_range.c model/ipv6_prefix_range.c + model/ipx_provider_sec_info.c model/iwmsc_info.c model/job_type.c model/key_amf.c @@ -469,51 +485,51 @@ libsbi_openapi_sources = files(''' model/link.c model/links_value_schema.c model/lmf_info.c - model/local2d_point_uncertainty_ellipse.c model/local2d_point_uncertainty_ellipse_all_of.c - model/local3d_point_uncertainty_ellipsoid.c + model/local2d_point_uncertainty_ellipse.c model/local3d_point_uncertainty_ellipsoid_all_of.c + model/local3d_point_uncertainty_ellipsoid.c model/local_origin.c - model/location_accuracy.c model/location_accuracy_any_of.c - model/location_area.c + model/location_accuracy.c model/location_area_1.c + model/location_area.c model/location_area_id.c - model/location_filter.c model/location_filter_any_of.c + model/location_filter.c model/location_info.c model/location_privacy_ind.c - model/location_reporting_configuration.c model/location_reporting_configuration_1.c + model/location_reporting_configuration.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/loss_connectivity_cfg_1.c + model/loss_connectivity_cfg.c model/lpi.c model/lte_m_ind.c model/lte_v2x_auth.c model/ma_pdu_indication.c - model/ma_release_indication.c model/mapping_of_snssai.c - model/matching_direction.c + model/ma_release_indication.c model/matching_direction_any_of.c + model/matching_direction.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/mbsfn_area.c + model/mb_smf_info.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_session_id.c model/mbs_subscription_data_1.c - model/mbsfn_area.c - model/mdt_configuration.c + model/mbs_subscription_data.c + model/mb_upf_info.c model/mdt_configuration_1.c + model/mdt_configuration.c model/mdt_user_consent.c model/measurement_lte_for_mdt.c model/measurement_nr_for_mdt.c @@ -531,7 +547,6 @@ libsbi_openapi_sources = files(''' 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 @@ -540,8 +555,9 @@ libsbi_openapi_sources = files(''' model/modification_notification.c model/modify_200_response.c model/modifysubscription_data_subscription_200_response.c - model/monitoring_configuration.c + model/mo_exp_data_counter.c model/monitoring_configuration_1.c + model/monitoring_configuration.c model/mps_action.c model/mtc_provider.c model/multicast_access_control.c @@ -568,28 +584,35 @@ 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_info_type.c model/n2_sm_information.c + model/n2_sm_info_type.c + model/n32f_context_info.c + model/n32f_error_detail.c + model/n32f_error_info.c + model/n32f_error_type_any_of.c + model/n32f_error_type.c + model/n32_purpose_any_of.c + model/n32_purpose.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.c model/ncgi_1.c + model/ncgi.c model/ncgi_tai.c model/nef_cond.c model/nef_info.c model/net_loc_access_support.c - model/network_area_info.c model/network_area_info_1.c model/network_area_info_2.c - model/network_node_diameter_address.c + model/network_area_info.c model/network_node_diameter_address_1.c + model/network_node_diameter_address.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_perf_type.c model/network_slice_cond.c model/nf_group_cond.c model/nf_group_list_cond.c @@ -610,23 +633,23 @@ 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/ngap_ie_type.c model/nidd_authorization_info.c - model/nidd_information.c model/nidd_information_1.c + model/nidd_information.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 model/non_ue_n2_info_subscription_create_data.c model/non_ue_n2_info_subscription_created_data.c model/non_ue_n2_message_transfer_request.c + model/no_profile_match_info.c + model/no_profile_match_reason_any_of.c + model/no_profile_match_reason.c model/notif_condition.c model/notification_cause.c model/notification_control.c @@ -636,10 +659,10 @@ libsbi_openapi_sources = files(''' 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_1.c model/notification_method_any_of.c + model/notification_method.c model/notification_type.c model/notify_item.c model/npcf_af_event.c @@ -647,8 +670,6 @@ libsbi_openapi_sources = files(''' model/npcf_multicast_access_control.c model/npcf_pdu_session_status.c model/npn_access_info.c - model/nr_location.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 @@ -670,18 +691,20 @@ libsbi_openapi_sources = files(''' 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/nr_location.c model/nrppa_information.c + model/nr_v2x_auth.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/nssaa_status.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 @@ -689,10 +712,10 @@ libsbi_openapi_sources = files(''' model/nwdaf_capability.c model/nwdaf_cond.c model/nwdaf_data.c - model/nwdaf_event.c model/nwdaf_event_any_of.c - model/nwdaf_failure_code.c + model/nwdaf_event.c model/nwdaf_failure_code_any_of.c + model/nwdaf_failure_code.c model/nwdaf_info.c model/nwdaf_registration.c model/nwdaf_registration_info.c @@ -707,20 +730,20 @@ libsbi_openapi_sources = files(''' 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/output_strategy.c model/packet_filter_info.c model/parameter_combination.c - model/partial_record_method.c model/partial_record_method_any_of.c + model/partial_record_method.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_qo_s_para.c model/pc5_qos_flow_item.c + model/pc5_qo_s_para.c model/pcc_rule.c model/pcf_addressing_info.c model/pcf_binding.c @@ -732,8 +755,8 @@ libsbi_openapi_sources = files(''' 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_selection_assistance_info.c model/pcf_ue_callback_info.c model/pcscf_address.c model/pcscf_info.c @@ -744,53 +767,53 @@ libsbi_openapi_sources = files(''' model/pdu_session_context_type.c model/pdu_session_continuity_ind.c model/pdu_session_create_data.c - model/pdu_session_create_error.c model/pdu_session_created_data.c + model/pdu_session_create_error.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.c - model/pdu_session_status_cfg.c model/pdu_session_status_cfg_1.c + model/pdu_session_status_cfg.c model/pdu_session_tsn_bridge.c model/pdu_session_type.c - model/pdu_session_types.c model/pdu_session_types_1.c + model/pdu_session_types.c model/pei_update_info.c model/perf_data.c model/periodic_communication_indicator.c - model/periodicity.c model/periodicity_any_of.c + model/periodicity.c model/pfd_change_notification.c model/pfd_content.c model/pfd_data.c model/pfd_data_for_app_ext.c model/pgw_info.c - model/plmn_ec_info.c model/plmn_ec_info_1.c - model/plmn_id.c + model/plmn_ec_info.c model/plmn_id_1.c - model/plmn_id_nid.c + model/plmn_id.c model/plmn_id_nid_1.c + model/plmn_id_nid.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_restriction.c model/plmn_route_selection_descriptor.c model/plmn_snssai.c - model/point.c model/point_all_of.c - model/point_altitude.c model/point_altitude_all_of.c - model/point_altitude_uncertainty.c + model/point_altitude.c model/point_altitude_uncertainty_all_of.c - model/point_uncertainty_circle.c + model/point_altitude_uncertainty.c + model/point.c model/point_uncertainty_circle_all_of.c - model/point_uncertainty_ellipse.c + model/point_uncertainty_circle.c model/point_uncertainty_ellipse_all_of.c + model/point_uncertainty_ellipse.c model/policy_association.c model/policy_association_release_cause.c model/policy_association_request.c @@ -799,13 +822,13 @@ libsbi_openapi_sources = files(''' 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_data_subset.c model/policy_decision_failure_code.c model/policy_req_trigger.c model/policy_update.c - model/polygon.c model/polygon_all_of.c + model/polygon.c model/port_management_container.c model/positioning_method_mdt.c model/pp5g_vn_group_profile_data.c @@ -831,6 +854,9 @@ libsbi_openapi_sources = files(''' model/prev_sub_info.c model/priority_sharing_indicator.c model/privacy_check_related_action.c + model/problem_details_1.c + model/problem_details_add_info.c + model/problem_details.c model/pro_se_allowed_plmn.c model/pro_se_auth_data.c model/pro_se_authentication_ctx.c @@ -840,21 +866,19 @@ libsbi_openapi_sources = files(''' 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/pro_se_eap_session.c + model/pro_se_information.c model/prose_service_auth.c model/prose_subscription_data.c + model/protection_policy.c model/protection_result.c model/provisioned_data_sets.c model/psa_indication.c model/psa_information.c - model/ptw_parameters.c model/ptw_parameters_1.c + model/ptw_parameters.c model/pws_error_data.c model/pws_information.c model/pws_response_data.c @@ -876,37 +900,37 @@ libsbi_openapi_sources = files(''' model/qos_monitoring_information_rm.c model/qos_monitoring_report.c model/qos_monitoring_req.c - model/qos_notif_type.c model/qos_notification_control_info.c + model/qos_notif_type.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/ran_nas_rel_cause.c model/rat_freq_information.c model/rat_selector.c model/rat_type.c - model/reachability_filter.c model/reachability_filter_any_of.c - model/reachability_for_data_configuration.c + model/reachability_filter.c model/reachability_for_data_configuration_1.c - model/reachability_for_data_report_config.c + model/reachability_for_data_configuration.c model/reachability_for_data_report_config_any_of.c - model/reachability_for_sms_configuration.c + model/reachability_for_data_report_config.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/reachability_for_sms_configuration.c model/redirect_address_type.c model/redirect_information.c model/redirect_response.c + model/red_trans_exp_ordering_criterion_any_of.c + model/red_trans_exp_ordering_criterion.c model/redundant_pdu_session_information.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/ref_to_binary_data.c model/registration_context_container.c model/registration_data_set_name.c model/registration_data_sets.c @@ -915,48 +939,48 @@ libsbi_openapi_sources = files(''' 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_information.c + model/reporting_level.c + model/reporting_options_1.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/resynchronization_info.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.c model/rm_state_any_of.c + model/rm_state.c model/roaming_charging_profile.c model/roaming_indication.c model/roaming_info_update.c @@ -974,9 +998,8 @@ libsbi_openapi_sources = files(''' model/rule_status.c model/satellite_backhaul_category.c model/sbi_binding_level.c - model/sc_type.c - model/scheduled_communication_time.c model/scheduled_communication_time_1.c + model/scheduled_communication_time.c model/scheduled_communication_time_rm.c model/scheduled_communication_type.c model/scheduled_communication_type_rm.c @@ -985,17 +1008,24 @@ libsbi_openapi_sources = files(''' 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_domain_routing_info_subscription.c model/scp_info.c - model/sd_range.c - model/sdm_subs_modification.c - model/sdm_subscription.c + model/sc_type.c model/sdm_subscription_1.c + model/sdm_subscription.c + model/sdm_subs_modification.c + model/sd_range.c model/seaf_data.c model/search_result.c + model/sec_negotiate_req_data.c + model/sec_negotiate_rsp_data.c model/secondary_rat_usage_info.c model/secondary_rat_usage_report.c + model/sec_param_exch_req_data.c + model/sec_param_exch_rsp_data.c + model/security_capability_any_of.c + model/security_capability.c model/security_result.c model/send_mo_data_req_data.c model/send_mo_data_request.c @@ -1006,24 +1036,24 @@ libsbi_openapi_sources = files(''' 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_area_restriction.c model/service_experience_info.c - model/service_experience_type.c model/service_experience_type_any_of.c + model/service_experience_type.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_specific_authorization_info.c - model/service_type.c model/service_type_any_of.c + model/service_type.c model/service_type_unrelated_class.c model/serving_nf_identity.c model/sess_inact_timer_for_ue_comm.c - model/session_management_subscription_data.c model/session_management_subscription_data_1.c + model/session_management_subscription_data.c model/session_rule.c model/session_rule_failure_code.c model/session_rule_report.c @@ -1037,14 +1067,18 @@ libsbi_openapi_sources = files(''' model/slice_info_for_registration.c model/slice_info_for_ue_configuration_update.c model/slice_load_level_information.c - model/slice_mbr.c model/slice_mbr_1.c + model/slice_mbr.c model/slice_mbr_rm.c model/slice_policy_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/sm_context.c model/sm_context_create_data.c - model/sm_context_create_error.c model/sm_context_created_data.c + model/sm_context_create_error.c model/sm_context_release_data.c model/sm_context_released_data.c model/sm_context_retrieve_data.c @@ -1052,8 +1086,19 @@ libsbi_openapi_sources = files(''' model/sm_context_status_notification.c model/sm_context_type.c model/sm_context_update_data.c - model/sm_context_update_error.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_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/sm_policy_association_release_cause.c model/sm_policy_context_data.c model/sm_policy_control.c @@ -1067,31 +1112,16 @@ 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.c model/smsf_registration.c + model/sms_management_subscription_data_1.c + model/sms_management_subscription_data.c + model/sms_router_info.c + model/sms_subscription_data_1.c + model/sms_subscription_data.c + model/sms_support.c + model/sm_subs_data.c model/snssai.c model/snssai_dnn_pair.c model/snssai_easdf_info_item.c @@ -1104,56 +1134,56 @@ libsbi_openapi_sources = files(''' model/snssai_tsctsf_info_item.c model/snssai_upf_info_item.c model/sor_data.c - model/sor_info.c model/sor_info_1.c + model/sor_info.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_cond.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.c model/ssc_modes_1.c - model/ssm.c + model/ssc_modes.c model/ssm_1.c + model/ssm.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_indicator.c + model/steer_mode_value.c model/stored_search_result.c model/subscr_cond.c - model/subscribed_default_qos.c model/subscribed_default_qos_1.c - model/subscribed_event.c + model/subscribed_default_qos.c model/subscribed_event_any_of.c + model/subscribed_event.c model/subscribed_snssai.c model/subscription_context.c model/subscription_data.c model/subscription_data_sets.c model/subscription_data_subscriptions.c model/suci_info.c - model/suggested_packet_num_dl.c model/suggested_packet_num_dl_1.c + model/suggested_packet_num_dl.c model/supi_info.c model/supi_range.c - model/supported_gad_shapes.c model/supported_gad_shapes_any_of.c + model/supported_gad_shapes.c model/svc_experience.c model/tac_info.c model/tac_range.c - model/tai.c model/tai_1.c + model/tai.c model/tai_range.c model/target_area.c model/target_dnai_info.c @@ -1165,17 +1195,17 @@ libsbi_openapi_sources = files(''' model/threshold_level.c model/threshold_value.c model/time_period.c - model/time_unit.c model/time_unit_any_of.c + model/time_unit.c model/time_window.c - model/tmgi.c model/tmgi_1.c + model/tmgi.c model/tmgi_range.c model/tnap_id.c model/tngf_info.c model/top_application.c - model/trace_data.c model/trace_data_1.c + model/trace_data.c model/trace_data_response.c model/trace_depth.c model/traffic_characterization.c @@ -1197,14 +1227,14 @@ libsbi_openapi_sources = files(''' model/transfer_mt_data_req_data.c model/transfer_policy.c model/transfer_reason.c - model/transport_protocol.c model/transport_protocol_1.c + model/transport_protocol.c model/trigger.c - model/trigger_category.c model/trigger_category_any_of.c + model/trigger_category.c model/trigger_request.c - model/trigger_type.c model/trigger_type_any_of.c + model/trigger_type.c model/trust_af_info.c model/tscai_input_container.c model/tsctsf_info.c @@ -1221,19 +1251,19 @@ libsbi_openapi_sources = files(''' model/udsf_info.c model/ue_analytics_context_descriptor.c model/ue_auth.c - model/ue_authentication_ctx.c model/ue_authentication_ctx_5g_auth_data.c + model/ue_authentication_ctx.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_create_error.c model/ue_context_created_data.c + model/ue_context_create_error.c model/ue_context_in_amf_data.c model/ue_context_in_smf_data.c - model/ue_context_in_smf_data_sub_filter.c model/ue_context_in_smf_data_sub_filter_1.c + model/ue_context_in_smf_data_sub_filter.c model/ue_context_in_smsf_data.c model/ue_context_release.c model/ue_context_relocate_data.c @@ -1254,31 +1284,26 @@ libsbi_openapi_sources = files(''' model/ue_policy_section.c model/ue_policy_set.c model/ue_policy_set_patch.c - model/ue_reachability.c model/ue_reachability_any_of.c + model/ue_reachability.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_type.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/umt_time.c model/unavailable_access_indication.c model/uncertainty_ellipse.c model/uncertainty_ellipsoid.c model/unrelated_class.c + model/un_trust_af_info.c model/up_cnx_state.c model/up_confidentiality.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/updated_item.c model/update_nwdaf_registration_200_response.c model/update_pdu_session_200_response.c model/update_pdu_session_400_response.c @@ -1286,25 +1311,30 @@ libsbi_openapi_sources = files(''' 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/upf_information.c - model/upu_data.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/upu_data_1.c model/upu_data_2.c - model/upu_info.c + model/upu_data.c model/upu_info_1.c + model/upu_info.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_mon_level.c - model/usage_mon_level_any_of.c model/usage_monitoring_data.c + model/usage_mon_level_any_of.c + model/usage_mon_level.c model/usage_threshold.c model/usage_threshold_rm.c model/user_consent.c @@ -1324,19 +1354,19 @@ libsbi_openapi_sources = files(''' model/volume_timed_report.c model/vplmn_qos.c model/vsmf_update_data.c - model/vsmf_update_error.c model/vsmf_updated_data.c + model/vsmf_update_error.c model/w_agf_info.c - model/wireline_area.c model/wireline_area_1.c - model/wireline_service_area_restriction.c + model/wireline_area.c model/wireline_service_area_restriction_1.c - model/wlan_ordering_criterion.c + model/wireline_service_area_restriction.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_ordering_criterion.c model/wlan_performance_info.c model/wlan_performance_req.c + model/wlan_per_ss_id_performance_info.c + model/wlan_per_ts_performance_info.c '''.split()) libsbi_openapi_inc = include_directories('.') diff --git a/lib/sbi/openapi/model/_application_data_influence_data_subs_to_notify_post_request_inner.c b/lib/sbi/openapi/model/_application_data_influence_data_subs_to_notify_post_request_inner.c new file mode 100644 index 000000000..a4a26ed07 --- /dev/null +++ b/lib/sbi/openapi/model/_application_data_influence_data_subs_to_notify_post_request_inner.c @@ -0,0 +1,145 @@ + +#include +#include +#include +#include "_application_data_influence_data_subs_to_notify_post_request_inner.h" + +OpenAPI__application_data_influence_data_subs_to_notify_post_request_inner_t *OpenAPI__application_data_influence_data_subs_to_notify_post_request_inner_create( + char *res_uri, + OpenAPI_traffic_influ_data_t *traffic_influ_data +) +{ + OpenAPI__application_data_influence_data_subs_to_notify_post_request_inner_t *_application_data_influence_data_subs_to_notify_post_request_inner_local_var = ogs_malloc(sizeof(OpenAPI__application_data_influence_data_subs_to_notify_post_request_inner_t)); + ogs_assert(_application_data_influence_data_subs_to_notify_post_request_inner_local_var); + + _application_data_influence_data_subs_to_notify_post_request_inner_local_var->res_uri = res_uri; + _application_data_influence_data_subs_to_notify_post_request_inner_local_var->traffic_influ_data = traffic_influ_data; + + return _application_data_influence_data_subs_to_notify_post_request_inner_local_var; +} + +void OpenAPI__application_data_influence_data_subs_to_notify_post_request_inner_free(OpenAPI__application_data_influence_data_subs_to_notify_post_request_inner_t *_application_data_influence_data_subs_to_notify_post_request_inner) +{ + OpenAPI_lnode_t *node = NULL; + + if (NULL == _application_data_influence_data_subs_to_notify_post_request_inner) { + return; + } + if (_application_data_influence_data_subs_to_notify_post_request_inner->res_uri) { + ogs_free(_application_data_influence_data_subs_to_notify_post_request_inner->res_uri); + _application_data_influence_data_subs_to_notify_post_request_inner->res_uri = NULL; + } + if (_application_data_influence_data_subs_to_notify_post_request_inner->traffic_influ_data) { + OpenAPI_traffic_influ_data_free(_application_data_influence_data_subs_to_notify_post_request_inner->traffic_influ_data); + _application_data_influence_data_subs_to_notify_post_request_inner->traffic_influ_data = NULL; + } + ogs_free(_application_data_influence_data_subs_to_notify_post_request_inner); +} + +cJSON *OpenAPI__application_data_influence_data_subs_to_notify_post_request_inner_convertToJSON(OpenAPI__application_data_influence_data_subs_to_notify_post_request_inner_t *_application_data_influence_data_subs_to_notify_post_request_inner) +{ + cJSON *item = NULL; + OpenAPI_lnode_t *node = NULL; + + if (_application_data_influence_data_subs_to_notify_post_request_inner == NULL) { + ogs_error("OpenAPI__application_data_influence_data_subs_to_notify_post_request_inner_convertToJSON() failed [_application_data_influenceData_subs_to_notify_post_request_inner]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (!_application_data_influence_data_subs_to_notify_post_request_inner->res_uri) { + ogs_error("OpenAPI__application_data_influence_data_subs_to_notify_post_request_inner_convertToJSON() failed [res_uri]"); + return NULL; + } + if (cJSON_AddStringToObject(item, "resUri", _application_data_influence_data_subs_to_notify_post_request_inner->res_uri) == NULL) { + ogs_error("OpenAPI__application_data_influence_data_subs_to_notify_post_request_inner_convertToJSON() failed [res_uri]"); + goto end; + } + + if (_application_data_influence_data_subs_to_notify_post_request_inner->traffic_influ_data) { + cJSON *traffic_influ_data_local_JSON = OpenAPI_traffic_influ_data_convertToJSON(_application_data_influence_data_subs_to_notify_post_request_inner->traffic_influ_data); + if (traffic_influ_data_local_JSON == NULL) { + ogs_error("OpenAPI__application_data_influence_data_subs_to_notify_post_request_inner_convertToJSON() failed [traffic_influ_data]"); + goto end; + } + cJSON_AddItemToObject(item, "trafficInfluData", traffic_influ_data_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI__application_data_influence_data_subs_to_notify_post_request_inner_convertToJSON() failed [traffic_influ_data]"); + goto end; + } + } + +end: + return item; +} + +OpenAPI__application_data_influence_data_subs_to_notify_post_request_inner_t *OpenAPI__application_data_influence_data_subs_to_notify_post_request_inner_parseFromJSON(cJSON *_application_data_influence_data_subs_to_notify_post_request_innerJSON) +{ + OpenAPI__application_data_influence_data_subs_to_notify_post_request_inner_t *_application_data_influence_data_subs_to_notify_post_request_inner_local_var = NULL; + OpenAPI_lnode_t *node = NULL; + cJSON *res_uri = NULL; + cJSON *traffic_influ_data = NULL; + OpenAPI_traffic_influ_data_t *traffic_influ_data_local_nonprim = NULL; + res_uri = cJSON_GetObjectItemCaseSensitive(_application_data_influence_data_subs_to_notify_post_request_innerJSON, "resUri"); + if (!res_uri) { + ogs_error("OpenAPI__application_data_influence_data_subs_to_notify_post_request_inner_parseFromJSON() failed [res_uri]"); + goto end; + } + if (!cJSON_IsString(res_uri)) { + ogs_error("OpenAPI__application_data_influence_data_subs_to_notify_post_request_inner_parseFromJSON() failed [res_uri]"); + goto end; + } + + traffic_influ_data = cJSON_GetObjectItemCaseSensitive(_application_data_influence_data_subs_to_notify_post_request_innerJSON, "trafficInfluData"); + if (traffic_influ_data) { + traffic_influ_data_local_nonprim = OpenAPI_traffic_influ_data_parseFromJSON(traffic_influ_data); + } + + _application_data_influence_data_subs_to_notify_post_request_inner_local_var = OpenAPI__application_data_influence_data_subs_to_notify_post_request_inner_create ( + ogs_strdup(res_uri->valuestring), + traffic_influ_data ? traffic_influ_data_local_nonprim : NULL + ); + + return _application_data_influence_data_subs_to_notify_post_request_inner_local_var; +end: + if (traffic_influ_data_local_nonprim) { + OpenAPI_traffic_influ_data_free(traffic_influ_data_local_nonprim); + traffic_influ_data_local_nonprim = NULL; + } + return NULL; +} + +OpenAPI__application_data_influence_data_subs_to_notify_post_request_inner_t *OpenAPI__application_data_influence_data_subs_to_notify_post_request_inner_copy(OpenAPI__application_data_influence_data_subs_to_notify_post_request_inner_t *dst, OpenAPI__application_data_influence_data_subs_to_notify_post_request_inner_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI__application_data_influence_data_subs_to_notify_post_request_inner_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI__application_data_influence_data_subs_to_notify_post_request_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__application_data_influence_data_subs_to_notify_post_request_inner_free(dst); + dst = OpenAPI__application_data_influence_data_subs_to_notify_post_request_inner_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/_application_data_influence_data_subs_to_notify_post_request_inner.h b/lib/sbi/openapi/model/_application_data_influence_data_subs_to_notify_post_request_inner.h new file mode 100644 index 000000000..e351f7d1b --- /dev/null +++ b/lib/sbi/openapi/model/_application_data_influence_data_subs_to_notify_post_request_inner.h @@ -0,0 +1,42 @@ +/* + * _application_data_influence_data_subs_to_notify_post_request_inner.h + * + * + */ + +#ifndef _OpenAPI__application_data_influence_data_subs_to_notify_post_request_inner_H_ +#define _OpenAPI__application_data_influence_data_subs_to_notify_post_request_inner_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "traffic_influ_data.h" +#include "traffic_influ_data_notif.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI__application_data_influence_data_subs_to_notify_post_request_inner_s OpenAPI__application_data_influence_data_subs_to_notify_post_request_inner_t; +typedef struct OpenAPI__application_data_influence_data_subs_to_notify_post_request_inner_s { + char *res_uri; + struct OpenAPI_traffic_influ_data_s *traffic_influ_data; +} OpenAPI__application_data_influence_data_subs_to_notify_post_request_inner_t; + +OpenAPI__application_data_influence_data_subs_to_notify_post_request_inner_t *OpenAPI__application_data_influence_data_subs_to_notify_post_request_inner_create( + char *res_uri, + OpenAPI_traffic_influ_data_t *traffic_influ_data +); +void OpenAPI__application_data_influence_data_subs_to_notify_post_request_inner_free(OpenAPI__application_data_influence_data_subs_to_notify_post_request_inner_t *_application_data_influence_data_subs_to_notify_post_request_inner); +OpenAPI__application_data_influence_data_subs_to_notify_post_request_inner_t *OpenAPI__application_data_influence_data_subs_to_notify_post_request_inner_parseFromJSON(cJSON *_application_data_influence_data_subs_to_notify_post_request_innerJSON); +cJSON *OpenAPI__application_data_influence_data_subs_to_notify_post_request_inner_convertToJSON(OpenAPI__application_data_influence_data_subs_to_notify_post_request_inner_t *_application_data_influence_data_subs_to_notify_post_request_inner); +OpenAPI__application_data_influence_data_subs_to_notify_post_request_inner_t *OpenAPI__application_data_influence_data_subs_to_notify_post_request_inner_copy(OpenAPI__application_data_influence_data_subs_to_notify_post_request_inner_t *dst, OpenAPI__application_data_influence_data_subs_to_notify_post_request_inner_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI__application_data_influence_data_subs_to_notify_post_request_inner_H_ */ + diff --git a/lib/sbi/openapi/model/api_ie_mapping.c b/lib/sbi/openapi/model/api_ie_mapping.c new file mode 100644 index 000000000..bdb92216b --- /dev/null +++ b/lib/sbi/openapi/model/api_ie_mapping.c @@ -0,0 +1,211 @@ + +#include +#include +#include +#include "api_ie_mapping.h" + +OpenAPI_api_ie_mapping_t *OpenAPI_api_ie_mapping_create( + OpenAPI_api_signature_t *api_signature, + OpenAPI_http_method_e api_method, + OpenAPI_list_t *ie_list +) +{ + OpenAPI_api_ie_mapping_t *api_ie_mapping_local_var = ogs_malloc(sizeof(OpenAPI_api_ie_mapping_t)); + ogs_assert(api_ie_mapping_local_var); + + api_ie_mapping_local_var->api_signature = api_signature; + api_ie_mapping_local_var->api_method = api_method; + api_ie_mapping_local_var->ie_list = ie_list; + + return api_ie_mapping_local_var; +} + +void OpenAPI_api_ie_mapping_free(OpenAPI_api_ie_mapping_t *api_ie_mapping) +{ + OpenAPI_lnode_t *node = NULL; + + if (NULL == api_ie_mapping) { + return; + } + if (api_ie_mapping->api_signature) { + OpenAPI_api_signature_free(api_ie_mapping->api_signature); + api_ie_mapping->api_signature = NULL; + } + if (api_ie_mapping->ie_list) { + OpenAPI_list_for_each(api_ie_mapping->ie_list, node) { + OpenAPI_ie_info_free(node->data); + } + OpenAPI_list_free(api_ie_mapping->ie_list); + api_ie_mapping->ie_list = NULL; + } + ogs_free(api_ie_mapping); +} + +cJSON *OpenAPI_api_ie_mapping_convertToJSON(OpenAPI_api_ie_mapping_t *api_ie_mapping) +{ + cJSON *item = NULL; + OpenAPI_lnode_t *node = NULL; + + if (api_ie_mapping == NULL) { + ogs_error("OpenAPI_api_ie_mapping_convertToJSON() failed [ApiIeMapping]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (!api_ie_mapping->api_signature) { + ogs_error("OpenAPI_api_ie_mapping_convertToJSON() failed [api_signature]"); + return NULL; + } + cJSON *api_signature_local_JSON = OpenAPI_api_signature_convertToJSON(api_ie_mapping->api_signature); + if (api_signature_local_JSON == NULL) { + ogs_error("OpenAPI_api_ie_mapping_convertToJSON() failed [api_signature]"); + goto end; + } + cJSON_AddItemToObject(item, "apiSignature", api_signature_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_api_ie_mapping_convertToJSON() failed [api_signature]"); + goto end; + } + + if (api_ie_mapping->api_method == OpenAPI_http_method_NULL) { + ogs_error("OpenAPI_api_ie_mapping_convertToJSON() failed [api_method]"); + return NULL; + } + if (cJSON_AddStringToObject(item, "apiMethod", OpenAPI_http_method_ToString(api_ie_mapping->api_method)) == NULL) { + ogs_error("OpenAPI_api_ie_mapping_convertToJSON() failed [api_method]"); + goto end; + } + + if (!api_ie_mapping->ie_list) { + ogs_error("OpenAPI_api_ie_mapping_convertToJSON() failed [ie_list]"); + return NULL; + } + cJSON *ie_listList = cJSON_AddArrayToObject(item, "IeList"); + if (ie_listList == NULL) { + ogs_error("OpenAPI_api_ie_mapping_convertToJSON() failed [ie_list]"); + goto end; + } + OpenAPI_list_for_each(api_ie_mapping->ie_list, node) { + cJSON *itemLocal = OpenAPI_ie_info_convertToJSON(node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_api_ie_mapping_convertToJSON() failed [ie_list]"); + goto end; + } + cJSON_AddItemToArray(ie_listList, itemLocal); + } + +end: + return item; +} + +OpenAPI_api_ie_mapping_t *OpenAPI_api_ie_mapping_parseFromJSON(cJSON *api_ie_mappingJSON) +{ + OpenAPI_api_ie_mapping_t *api_ie_mapping_local_var = NULL; + OpenAPI_lnode_t *node = NULL; + cJSON *api_signature = NULL; + OpenAPI_api_signature_t *api_signature_local_nonprim = NULL; + cJSON *api_method = NULL; + OpenAPI_http_method_e api_methodVariable = 0; + cJSON *ie_list = NULL; + OpenAPI_list_t *ie_listList = NULL; + api_signature = cJSON_GetObjectItemCaseSensitive(api_ie_mappingJSON, "apiSignature"); + if (!api_signature) { + ogs_error("OpenAPI_api_ie_mapping_parseFromJSON() failed [api_signature]"); + goto end; + } + api_signature_local_nonprim = OpenAPI_api_signature_parseFromJSON(api_signature); + + api_method = cJSON_GetObjectItemCaseSensitive(api_ie_mappingJSON, "apiMethod"); + if (!api_method) { + ogs_error("OpenAPI_api_ie_mapping_parseFromJSON() failed [api_method]"); + goto end; + } + if (!cJSON_IsString(api_method)) { + ogs_error("OpenAPI_api_ie_mapping_parseFromJSON() failed [api_method]"); + goto end; + } + api_methodVariable = OpenAPI_http_method_FromString(api_method->valuestring); + + ie_list = cJSON_GetObjectItemCaseSensitive(api_ie_mappingJSON, "IeList"); + if (!ie_list) { + ogs_error("OpenAPI_api_ie_mapping_parseFromJSON() failed [ie_list]"); + goto end; + } + cJSON *ie_list_local = NULL; + if (!cJSON_IsArray(ie_list)) { + ogs_error("OpenAPI_api_ie_mapping_parseFromJSON() failed [ie_list]"); + goto end; + } + + ie_listList = OpenAPI_list_create(); + + cJSON_ArrayForEach(ie_list_local, ie_list) { + if (!cJSON_IsObject(ie_list_local)) { + ogs_error("OpenAPI_api_ie_mapping_parseFromJSON() failed [ie_list]"); + goto end; + } + OpenAPI_ie_info_t *ie_listItem = OpenAPI_ie_info_parseFromJSON(ie_list_local); + if (!ie_listItem) { + ogs_error("No ie_listItem"); + OpenAPI_list_free(ie_listList); + goto end; + } + OpenAPI_list_add(ie_listList, ie_listItem); + } + + api_ie_mapping_local_var = OpenAPI_api_ie_mapping_create ( + api_signature_local_nonprim, + api_methodVariable, + ie_listList + ); + + return api_ie_mapping_local_var; +end: + if (api_signature_local_nonprim) { + OpenAPI_api_signature_free(api_signature_local_nonprim); + api_signature_local_nonprim = NULL; + } + if (ie_listList) { + OpenAPI_list_for_each(ie_listList, node) { + OpenAPI_ie_info_free(node->data); + } + OpenAPI_list_free(ie_listList); + ie_listList = NULL; + } + return NULL; +} + +OpenAPI_api_ie_mapping_t *OpenAPI_api_ie_mapping_copy(OpenAPI_api_ie_mapping_t *dst, OpenAPI_api_ie_mapping_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_api_ie_mapping_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_api_ie_mapping_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_api_ie_mapping_free(dst); + dst = OpenAPI_api_ie_mapping_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/api_ie_mapping.h b/lib/sbi/openapi/model/api_ie_mapping.h new file mode 100644 index 000000000..37abd73d8 --- /dev/null +++ b/lib/sbi/openapi/model/api_ie_mapping.h @@ -0,0 +1,45 @@ +/* + * api_ie_mapping.h + * + * API URI to IE mapping on which the protection policy needs to be applied + */ + +#ifndef _OpenAPI_api_ie_mapping_H_ +#define _OpenAPI_api_ie_mapping_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "api_signature.h" +#include "http_method.h" +#include "ie_info.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_api_ie_mapping_s OpenAPI_api_ie_mapping_t; +typedef struct OpenAPI_api_ie_mapping_s { + struct OpenAPI_api_signature_s *api_signature; + OpenAPI_http_method_e api_method; + OpenAPI_list_t *ie_list; +} OpenAPI_api_ie_mapping_t; + +OpenAPI_api_ie_mapping_t *OpenAPI_api_ie_mapping_create( + OpenAPI_api_signature_t *api_signature, + OpenAPI_http_method_e api_method, + OpenAPI_list_t *ie_list +); +void OpenAPI_api_ie_mapping_free(OpenAPI_api_ie_mapping_t *api_ie_mapping); +OpenAPI_api_ie_mapping_t *OpenAPI_api_ie_mapping_parseFromJSON(cJSON *api_ie_mappingJSON); +cJSON *OpenAPI_api_ie_mapping_convertToJSON(OpenAPI_api_ie_mapping_t *api_ie_mapping); +OpenAPI_api_ie_mapping_t *OpenAPI_api_ie_mapping_copy(OpenAPI_api_ie_mapping_t *dst, OpenAPI_api_ie_mapping_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_api_ie_mapping_H_ */ + diff --git a/lib/sbi/openapi/model/api_signature.c b/lib/sbi/openapi/model/api_signature.c new file mode 100644 index 000000000..4b593c481 --- /dev/null +++ b/lib/sbi/openapi/model/api_signature.c @@ -0,0 +1,114 @@ + +#include +#include +#include +#include "api_signature.h" + +OpenAPI_api_signature_t *OpenAPI_api_signature_create( + char *callback_type +) +{ + OpenAPI_api_signature_t *api_signature_local_var = ogs_malloc(sizeof(OpenAPI_api_signature_t)); + ogs_assert(api_signature_local_var); + + api_signature_local_var->callback_type = callback_type; + + return api_signature_local_var; +} + +void OpenAPI_api_signature_free(OpenAPI_api_signature_t *api_signature) +{ + OpenAPI_lnode_t *node = NULL; + + if (NULL == api_signature) { + return; + } + if (api_signature->callback_type) { + ogs_free(api_signature->callback_type); + api_signature->callback_type = NULL; + } + ogs_free(api_signature); +} + +cJSON *OpenAPI_api_signature_convertToJSON(OpenAPI_api_signature_t *api_signature) +{ + cJSON *item = NULL; + OpenAPI_lnode_t *node = NULL; + + if (api_signature == NULL) { + ogs_error("OpenAPI_api_signature_convertToJSON() failed [ApiSignature]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (!api_signature->callback_type) { + ogs_error("OpenAPI_api_signature_convertToJSON() failed [callback_type]"); + return NULL; + } + if (cJSON_AddStringToObject(item, "callbackType", api_signature->callback_type) == NULL) { + ogs_error("OpenAPI_api_signature_convertToJSON() failed [callback_type]"); + goto end; + } + +end: + return item; +} + +OpenAPI_api_signature_t *OpenAPI_api_signature_parseFromJSON(cJSON *api_signatureJSON) +{ + OpenAPI_api_signature_t *api_signature_local_var = NULL; + OpenAPI_lnode_t *node = NULL; + cJSON *callback_type = NULL; + callback_type = cJSON_GetObjectItemCaseSensitive(api_signatureJSON, "callbackType"); + if (!callback_type) { + ogs_error("OpenAPI_api_signature_parseFromJSON() failed [callback_type]"); + goto end; + } + if (!cJSON_IsString(callback_type)) { + ogs_error("OpenAPI_api_signature_parseFromJSON() failed [callback_type]"); + goto end; + } + + api_signature_local_var = OpenAPI_api_signature_create ( + ogs_strdup(callback_type->valuestring) + ); + + return api_signature_local_var; +end: + return NULL; +} + +OpenAPI_api_signature_t *OpenAPI_api_signature_copy(OpenAPI_api_signature_t *dst, OpenAPI_api_signature_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_api_signature_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_api_signature_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_api_signature_free(dst); + dst = OpenAPI_api_signature_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/api_signature.h b/lib/sbi/openapi/model/api_signature.h new file mode 100644 index 000000000..6137d01aa --- /dev/null +++ b/lib/sbi/openapi/model/api_signature.h @@ -0,0 +1,39 @@ +/* + * api_signature.h + * + * API URI of the service operation + */ + +#ifndef _OpenAPI_api_signature_H_ +#define _OpenAPI_api_signature_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "callback_name.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_api_signature_s OpenAPI_api_signature_t; +typedef struct OpenAPI_api_signature_s { + char *callback_type; +} OpenAPI_api_signature_t; + +OpenAPI_api_signature_t *OpenAPI_api_signature_create( + char *callback_type +); +void OpenAPI_api_signature_free(OpenAPI_api_signature_t *api_signature); +OpenAPI_api_signature_t *OpenAPI_api_signature_parseFromJSON(cJSON *api_signatureJSON); +cJSON *OpenAPI_api_signature_convertToJSON(OpenAPI_api_signature_t *api_signature); +OpenAPI_api_signature_t *OpenAPI_api_signature_copy(OpenAPI_api_signature_t *dst, OpenAPI_api_signature_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_api_signature_H_ */ + diff --git a/lib/sbi/openapi/model/callback_name.c b/lib/sbi/openapi/model/callback_name.c new file mode 100644 index 000000000..246193858 --- /dev/null +++ b/lib/sbi/openapi/model/callback_name.c @@ -0,0 +1,114 @@ + +#include +#include +#include +#include "callback_name.h" + +OpenAPI_callback_name_t *OpenAPI_callback_name_create( + char *callback_type +) +{ + OpenAPI_callback_name_t *callback_name_local_var = ogs_malloc(sizeof(OpenAPI_callback_name_t)); + ogs_assert(callback_name_local_var); + + callback_name_local_var->callback_type = callback_type; + + return callback_name_local_var; +} + +void OpenAPI_callback_name_free(OpenAPI_callback_name_t *callback_name) +{ + OpenAPI_lnode_t *node = NULL; + + if (NULL == callback_name) { + return; + } + if (callback_name->callback_type) { + ogs_free(callback_name->callback_type); + callback_name->callback_type = NULL; + } + ogs_free(callback_name); +} + +cJSON *OpenAPI_callback_name_convertToJSON(OpenAPI_callback_name_t *callback_name) +{ + cJSON *item = NULL; + OpenAPI_lnode_t *node = NULL; + + if (callback_name == NULL) { + ogs_error("OpenAPI_callback_name_convertToJSON() failed [CallbackName]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (!callback_name->callback_type) { + ogs_error("OpenAPI_callback_name_convertToJSON() failed [callback_type]"); + return NULL; + } + if (cJSON_AddStringToObject(item, "callbackType", callback_name->callback_type) == NULL) { + ogs_error("OpenAPI_callback_name_convertToJSON() failed [callback_type]"); + goto end; + } + +end: + return item; +} + +OpenAPI_callback_name_t *OpenAPI_callback_name_parseFromJSON(cJSON *callback_nameJSON) +{ + OpenAPI_callback_name_t *callback_name_local_var = NULL; + OpenAPI_lnode_t *node = NULL; + cJSON *callback_type = NULL; + callback_type = cJSON_GetObjectItemCaseSensitive(callback_nameJSON, "callbackType"); + if (!callback_type) { + ogs_error("OpenAPI_callback_name_parseFromJSON() failed [callback_type]"); + goto end; + } + if (!cJSON_IsString(callback_type)) { + ogs_error("OpenAPI_callback_name_parseFromJSON() failed [callback_type]"); + goto end; + } + + callback_name_local_var = OpenAPI_callback_name_create ( + ogs_strdup(callback_type->valuestring) + ); + + return callback_name_local_var; +end: + return NULL; +} + +OpenAPI_callback_name_t *OpenAPI_callback_name_copy(OpenAPI_callback_name_t *dst, OpenAPI_callback_name_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_callback_name_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_callback_name_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_callback_name_free(dst); + dst = OpenAPI_callback_name_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/callback_name.h b/lib/sbi/openapi/model/callback_name.h new file mode 100644 index 000000000..274fdabc7 --- /dev/null +++ b/lib/sbi/openapi/model/callback_name.h @@ -0,0 +1,38 @@ +/* + * callback_name.h + * + * Callback Name + */ + +#ifndef _OpenAPI_callback_name_H_ +#define _OpenAPI_callback_name_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_callback_name_s OpenAPI_callback_name_t; +typedef struct OpenAPI_callback_name_s { + char *callback_type; +} OpenAPI_callback_name_t; + +OpenAPI_callback_name_t *OpenAPI_callback_name_create( + char *callback_type +); +void OpenAPI_callback_name_free(OpenAPI_callback_name_t *callback_name); +OpenAPI_callback_name_t *OpenAPI_callback_name_parseFromJSON(cJSON *callback_nameJSON); +cJSON *OpenAPI_callback_name_convertToJSON(OpenAPI_callback_name_t *callback_name); +OpenAPI_callback_name_t *OpenAPI_callback_name_copy(OpenAPI_callback_name_t *dst, OpenAPI_callback_name_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_callback_name_H_ */ + diff --git a/lib/sbi/openapi/model/failed_modification_info.c b/lib/sbi/openapi/model/failed_modification_info.c new file mode 100644 index 000000000..75085b172 --- /dev/null +++ b/lib/sbi/openapi/model/failed_modification_info.c @@ -0,0 +1,139 @@ + +#include +#include +#include +#include "failed_modification_info.h" + +OpenAPI_failed_modification_info_t *OpenAPI_failed_modification_info_create( + char *ipx_id, + OpenAPI_n32f_error_type_e n32f_error_type +) +{ + OpenAPI_failed_modification_info_t *failed_modification_info_local_var = ogs_malloc(sizeof(OpenAPI_failed_modification_info_t)); + ogs_assert(failed_modification_info_local_var); + + failed_modification_info_local_var->ipx_id = ipx_id; + failed_modification_info_local_var->n32f_error_type = n32f_error_type; + + return failed_modification_info_local_var; +} + +void OpenAPI_failed_modification_info_free(OpenAPI_failed_modification_info_t *failed_modification_info) +{ + OpenAPI_lnode_t *node = NULL; + + if (NULL == failed_modification_info) { + return; + } + if (failed_modification_info->ipx_id) { + ogs_free(failed_modification_info->ipx_id); + failed_modification_info->ipx_id = NULL; + } + ogs_free(failed_modification_info); +} + +cJSON *OpenAPI_failed_modification_info_convertToJSON(OpenAPI_failed_modification_info_t *failed_modification_info) +{ + cJSON *item = NULL; + OpenAPI_lnode_t *node = NULL; + + if (failed_modification_info == NULL) { + ogs_error("OpenAPI_failed_modification_info_convertToJSON() failed [FailedModificationInfo]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (!failed_modification_info->ipx_id) { + ogs_error("OpenAPI_failed_modification_info_convertToJSON() failed [ipx_id]"); + return NULL; + } + if (cJSON_AddStringToObject(item, "ipxId", failed_modification_info->ipx_id) == NULL) { + ogs_error("OpenAPI_failed_modification_info_convertToJSON() failed [ipx_id]"); + goto end; + } + + if (failed_modification_info->n32f_error_type == OpenAPI_n32f_error_type_NULL) { + ogs_error("OpenAPI_failed_modification_info_convertToJSON() failed [n32f_error_type]"); + return NULL; + } + if (cJSON_AddStringToObject(item, "n32fErrorType", OpenAPI_n32f_error_type_ToString(failed_modification_info->n32f_error_type)) == NULL) { + ogs_error("OpenAPI_failed_modification_info_convertToJSON() failed [n32f_error_type]"); + goto end; + } + +end: + return item; +} + +OpenAPI_failed_modification_info_t *OpenAPI_failed_modification_info_parseFromJSON(cJSON *failed_modification_infoJSON) +{ + OpenAPI_failed_modification_info_t *failed_modification_info_local_var = NULL; + OpenAPI_lnode_t *node = NULL; + cJSON *ipx_id = NULL; + cJSON *n32f_error_type = NULL; + OpenAPI_n32f_error_type_e n32f_error_typeVariable = 0; + ipx_id = cJSON_GetObjectItemCaseSensitive(failed_modification_infoJSON, "ipxId"); + if (!ipx_id) { + ogs_error("OpenAPI_failed_modification_info_parseFromJSON() failed [ipx_id]"); + goto end; + } + if (!cJSON_IsString(ipx_id)) { + ogs_error("OpenAPI_failed_modification_info_parseFromJSON() failed [ipx_id]"); + goto end; + } + + n32f_error_type = cJSON_GetObjectItemCaseSensitive(failed_modification_infoJSON, "n32fErrorType"); + if (!n32f_error_type) { + ogs_error("OpenAPI_failed_modification_info_parseFromJSON() failed [n32f_error_type]"); + goto end; + } + if (!cJSON_IsString(n32f_error_type)) { + ogs_error("OpenAPI_failed_modification_info_parseFromJSON() failed [n32f_error_type]"); + goto end; + } + n32f_error_typeVariable = OpenAPI_n32f_error_type_FromString(n32f_error_type->valuestring); + + failed_modification_info_local_var = OpenAPI_failed_modification_info_create ( + ogs_strdup(ipx_id->valuestring), + n32f_error_typeVariable + ); + + return failed_modification_info_local_var; +end: + return NULL; +} + +OpenAPI_failed_modification_info_t *OpenAPI_failed_modification_info_copy(OpenAPI_failed_modification_info_t *dst, OpenAPI_failed_modification_info_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_failed_modification_info_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_failed_modification_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_failed_modification_info_free(dst); + dst = OpenAPI_failed_modification_info_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/failed_modification_info.h b/lib/sbi/openapi/model/failed_modification_info.h new file mode 100644 index 000000000..f0a7cc246 --- /dev/null +++ b/lib/sbi/openapi/model/failed_modification_info.h @@ -0,0 +1,41 @@ +/* + * failed_modification_info.h + * + * Information on N32-f modifications block that failed to process + */ + +#ifndef _OpenAPI_failed_modification_info_H_ +#define _OpenAPI_failed_modification_info_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "n32f_error_type.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_failed_modification_info_s OpenAPI_failed_modification_info_t; +typedef struct OpenAPI_failed_modification_info_s { + char *ipx_id; + OpenAPI_n32f_error_type_e n32f_error_type; +} OpenAPI_failed_modification_info_t; + +OpenAPI_failed_modification_info_t *OpenAPI_failed_modification_info_create( + char *ipx_id, + OpenAPI_n32f_error_type_e n32f_error_type +); +void OpenAPI_failed_modification_info_free(OpenAPI_failed_modification_info_t *failed_modification_info); +OpenAPI_failed_modification_info_t *OpenAPI_failed_modification_info_parseFromJSON(cJSON *failed_modification_infoJSON); +cJSON *OpenAPI_failed_modification_info_convertToJSON(OpenAPI_failed_modification_info_t *failed_modification_info); +OpenAPI_failed_modification_info_t *OpenAPI_failed_modification_info_copy(OpenAPI_failed_modification_info_t *dst, OpenAPI_failed_modification_info_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_failed_modification_info_H_ */ + diff --git a/lib/sbi/openapi/model/failure_reason.c b/lib/sbi/openapi/model/failure_reason.c new file mode 100644 index 000000000..4b9194fbe --- /dev/null +++ b/lib/sbi/openapi/model/failure_reason.c @@ -0,0 +1,30 @@ + +#include +#include +#include +#include "failure_reason.h" + +char* OpenAPI_failure_reason_ToString(OpenAPI_failure_reason_e failure_reason) +{ + const char *failure_reasonArray[] = { "NULL", "INVALID_JSON_POINTER", "INVALID_INDEX_TO_ENCRYPTED_BLOCK", "INVALID_HTTP_HEADER" }; + size_t sizeofArray = sizeof(failure_reasonArray) / sizeof(failure_reasonArray[0]); + if (failure_reason < sizeofArray) + return (char *)failure_reasonArray[failure_reason]; + else + return (char *)"Unknown"; +} + +OpenAPI_failure_reason_e OpenAPI_failure_reason_FromString(char* failure_reason) +{ + int stringToReturn = 0; + const char *failure_reasonArray[] = { "NULL", "INVALID_JSON_POINTER", "INVALID_INDEX_TO_ENCRYPTED_BLOCK", "INVALID_HTTP_HEADER" }; + size_t sizeofArray = sizeof(failure_reasonArray) / sizeof(failure_reasonArray[0]); + while (stringToReturn < sizeofArray) { + if (strcmp(failure_reason, failure_reasonArray[stringToReturn]) == 0) { + return stringToReturn; + } + stringToReturn++; + } + return 0; +} + diff --git a/lib/sbi/openapi/model/failure_reason.h b/lib/sbi/openapi/model/failure_reason.h new file mode 100644 index 000000000..4b824ffe5 --- /dev/null +++ b/lib/sbi/openapi/model/failure_reason.h @@ -0,0 +1,31 @@ +/* + * failure_reason.h + * + * + */ + +#ifndef _OpenAPI_failure_reason_H_ +#define _OpenAPI_failure_reason_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_failure_reason_NULL = 0, OpenAPI_failure_reason_INVALID_JSON_POINTER, OpenAPI_failure_reason_INVALID_INDEX_TO_ENCRYPTED_BLOCK, OpenAPI_failure_reason_INVALID_HTTP_HEADER } OpenAPI_failure_reason_e; + +char* OpenAPI_failure_reason_ToString(OpenAPI_failure_reason_e failure_reason); + +OpenAPI_failure_reason_e OpenAPI_failure_reason_FromString(char* failure_reason); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_failure_reason_H_ */ + diff --git a/lib/sbi/openapi/model/failure_reason_any_of.c b/lib/sbi/openapi/model/failure_reason_any_of.c new file mode 100644 index 000000000..7c5d976b3 --- /dev/null +++ b/lib/sbi/openapi/model/failure_reason_any_of.c @@ -0,0 +1,30 @@ + +#include +#include +#include +#include "failure_reason_any_of.h" + +char* OpenAPI_failure_reason_any_of_ToString(OpenAPI_failure_reason_any_of_e failure_reason_any_of) +{ + const char *failure_reason_any_ofArray[] = { "NULL", "INVALID_JSON_POINTER", "INVALID_INDEX_TO_ENCRYPTED_BLOCK", "INVALID_HTTP_HEADER" }; + size_t sizeofArray = sizeof(failure_reason_any_ofArray) / sizeof(failure_reason_any_ofArray[0]); + if (failure_reason_any_of < sizeofArray) + return (char *)failure_reason_any_ofArray[failure_reason_any_of]; + else + return (char *)"Unknown"; +} + +OpenAPI_failure_reason_any_of_e OpenAPI_failure_reason_any_of_FromString(char* failure_reason_any_of) +{ + int stringToReturn = 0; + const char *failure_reason_any_ofArray[] = { "NULL", "INVALID_JSON_POINTER", "INVALID_INDEX_TO_ENCRYPTED_BLOCK", "INVALID_HTTP_HEADER" }; + size_t sizeofArray = sizeof(failure_reason_any_ofArray) / sizeof(failure_reason_any_ofArray[0]); + while (stringToReturn < sizeofArray) { + if (strcmp(failure_reason_any_of, failure_reason_any_ofArray[stringToReturn]) == 0) { + return stringToReturn; + } + stringToReturn++; + } + return 0; +} + diff --git a/lib/sbi/openapi/model/failure_reason_any_of.h b/lib/sbi/openapi/model/failure_reason_any_of.h new file mode 100644 index 000000000..751b6bbdc --- /dev/null +++ b/lib/sbi/openapi/model/failure_reason_any_of.h @@ -0,0 +1,31 @@ +/* + * failure_reason_any_of.h + * + * + */ + +#ifndef _OpenAPI_failure_reason_any_of_H_ +#define _OpenAPI_failure_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_failure_reason_any_of_NULL = 0, OpenAPI_failure_reason_any_of_INVALID_JSON_POINTER, OpenAPI_failure_reason_any_of_INVALID_INDEX_TO_ENCRYPTED_BLOCK, OpenAPI_failure_reason_any_of_INVALID_HTTP_HEADER } OpenAPI_failure_reason_any_of_e; + +char* OpenAPI_failure_reason_any_of_ToString(OpenAPI_failure_reason_any_of_e failure_reason_any_of); + +OpenAPI_failure_reason_any_of_e OpenAPI_failure_reason_any_of_FromString(char* failure_reason_any_of); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_failure_reason_any_of_H_ */ + diff --git a/lib/sbi/openapi/model/http_method.c b/lib/sbi/openapi/model/http_method.c new file mode 100644 index 000000000..8d8fb1bac --- /dev/null +++ b/lib/sbi/openapi/model/http_method.c @@ -0,0 +1,30 @@ + +#include +#include +#include +#include "http_method.h" + +char* OpenAPI_http_method_ToString(OpenAPI_http_method_e http_method) +{ + const char *http_methodArray[] = { "NULL", "GET", "PUT", "POST", "DELETE", "PATCH", "HEAD", "OPTIONS", "CONNECT", "TRACE" }; + size_t sizeofArray = sizeof(http_methodArray) / sizeof(http_methodArray[0]); + if (http_method < sizeofArray) + return (char *)http_methodArray[http_method]; + else + return (char *)"Unknown"; +} + +OpenAPI_http_method_e OpenAPI_http_method_FromString(char* http_method) +{ + int stringToReturn = 0; + const char *http_methodArray[] = { "NULL", "GET", "PUT", "POST", "DELETE", "PATCH", "HEAD", "OPTIONS", "CONNECT", "TRACE" }; + size_t sizeofArray = sizeof(http_methodArray) / sizeof(http_methodArray[0]); + while (stringToReturn < sizeofArray) { + if (strcmp(http_method, http_methodArray[stringToReturn]) == 0) { + return stringToReturn; + } + stringToReturn++; + } + return 0; +} + diff --git a/lib/sbi/openapi/model/http_method.h b/lib/sbi/openapi/model/http_method.h new file mode 100644 index 000000000..8f838854c --- /dev/null +++ b/lib/sbi/openapi/model/http_method.h @@ -0,0 +1,31 @@ +/* + * http_method.h + * + * + */ + +#ifndef _OpenAPI_http_method_H_ +#define _OpenAPI_http_method_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_http_method_NULL = 0, OpenAPI_http_method_GET, OpenAPI_http_method_PUT, OpenAPI_http_method_POST, OpenAPI_http_method__DELETE, OpenAPI_http_method_PATCH, OpenAPI_http_method_HEAD, OpenAPI_http_method_OPTIONS, OpenAPI_http_method_CONNECT, OpenAPI_http_method_TRACE } OpenAPI_http_method_e; + +char* OpenAPI_http_method_ToString(OpenAPI_http_method_e http_method); + +OpenAPI_http_method_e OpenAPI_http_method_FromString(char* http_method); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_http_method_H_ */ + diff --git a/lib/sbi/openapi/model/http_method_any_of.c b/lib/sbi/openapi/model/http_method_any_of.c new file mode 100644 index 000000000..7ce215efb --- /dev/null +++ b/lib/sbi/openapi/model/http_method_any_of.c @@ -0,0 +1,30 @@ + +#include +#include +#include +#include "http_method_any_of.h" + +char* OpenAPI_http_method_any_of_ToString(OpenAPI_http_method_any_of_e http_method_any_of) +{ + const char *http_method_any_ofArray[] = { "NULL", "GET", "PUT", "POST", "DELETE", "PATCH", "HEAD", "OPTIONS", "CONNECT", "TRACE" }; + size_t sizeofArray = sizeof(http_method_any_ofArray) / sizeof(http_method_any_ofArray[0]); + if (http_method_any_of < sizeofArray) + return (char *)http_method_any_ofArray[http_method_any_of]; + else + return (char *)"Unknown"; +} + +OpenAPI_http_method_any_of_e OpenAPI_http_method_any_of_FromString(char* http_method_any_of) +{ + int stringToReturn = 0; + const char *http_method_any_ofArray[] = { "NULL", "GET", "PUT", "POST", "DELETE", "PATCH", "HEAD", "OPTIONS", "CONNECT", "TRACE" }; + size_t sizeofArray = sizeof(http_method_any_ofArray) / sizeof(http_method_any_ofArray[0]); + while (stringToReturn < sizeofArray) { + if (strcmp(http_method_any_of, http_method_any_ofArray[stringToReturn]) == 0) { + return stringToReturn; + } + stringToReturn++; + } + return 0; +} + diff --git a/lib/sbi/openapi/model/http_method_any_of.h b/lib/sbi/openapi/model/http_method_any_of.h new file mode 100644 index 000000000..81a1c30f9 --- /dev/null +++ b/lib/sbi/openapi/model/http_method_any_of.h @@ -0,0 +1,31 @@ +/* + * http_method_any_of.h + * + * + */ + +#ifndef _OpenAPI_http_method_any_of_H_ +#define _OpenAPI_http_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_http_method_any_of_NULL = 0, OpenAPI_http_method_any_of_GET, OpenAPI_http_method_any_of_PUT, OpenAPI_http_method_any_of_POST, OpenAPI_http_method_any_of__DELETE, OpenAPI_http_method_any_of_PATCH, OpenAPI_http_method_any_of_HEAD, OpenAPI_http_method_any_of_OPTIONS, OpenAPI_http_method_any_of_CONNECT, OpenAPI_http_method_any_of_TRACE } OpenAPI_http_method_any_of_e; + +char* OpenAPI_http_method_any_of_ToString(OpenAPI_http_method_any_of_e http_method_any_of); + +OpenAPI_http_method_any_of_e OpenAPI_http_method_any_of_FromString(char* http_method_any_of); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_http_method_any_of_H_ */ + diff --git a/lib/sbi/openapi/model/ie_info.c b/lib/sbi/openapi/model/ie_info.c new file mode 100644 index 000000000..d71101852 --- /dev/null +++ b/lib/sbi/openapi/model/ie_info.c @@ -0,0 +1,278 @@ + +#include +#include +#include +#include "ie_info.h" + +OpenAPI_ie_info_t *OpenAPI_ie_info_create( + OpenAPI_ie_location_e ie_loc, + OpenAPI_ie_type_e ie_type, + char *req_ie, + char *rsp_ie, + bool is_is_modifiable, + int is_modifiable, + OpenAPI_list_t* is_modifiable_by_ipx +) +{ + OpenAPI_ie_info_t *ie_info_local_var = ogs_malloc(sizeof(OpenAPI_ie_info_t)); + ogs_assert(ie_info_local_var); + + ie_info_local_var->ie_loc = ie_loc; + ie_info_local_var->ie_type = ie_type; + ie_info_local_var->req_ie = req_ie; + ie_info_local_var->rsp_ie = rsp_ie; + ie_info_local_var->is_is_modifiable = is_is_modifiable; + ie_info_local_var->is_modifiable = is_modifiable; + ie_info_local_var->is_modifiable_by_ipx = is_modifiable_by_ipx; + + return ie_info_local_var; +} + +void OpenAPI_ie_info_free(OpenAPI_ie_info_t *ie_info) +{ + OpenAPI_lnode_t *node = NULL; + + if (NULL == ie_info) { + return; + } + if (ie_info->req_ie) { + ogs_free(ie_info->req_ie); + ie_info->req_ie = NULL; + } + if (ie_info->rsp_ie) { + ogs_free(ie_info->rsp_ie); + ie_info->rsp_ie = NULL; + } + if (ie_info->is_modifiable_by_ipx) { + OpenAPI_list_for_each(ie_info->is_modifiable_by_ipx, 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(ie_info->is_modifiable_by_ipx); + ie_info->is_modifiable_by_ipx = NULL; + } + ogs_free(ie_info); +} + +cJSON *OpenAPI_ie_info_convertToJSON(OpenAPI_ie_info_t *ie_info) +{ + cJSON *item = NULL; + OpenAPI_lnode_t *node = NULL; + + if (ie_info == NULL) { + ogs_error("OpenAPI_ie_info_convertToJSON() failed [IeInfo]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (ie_info->ie_loc == OpenAPI_ie_location_NULL) { + ogs_error("OpenAPI_ie_info_convertToJSON() failed [ie_loc]"); + return NULL; + } + if (cJSON_AddStringToObject(item, "ieLoc", OpenAPI_ie_location_ToString(ie_info->ie_loc)) == NULL) { + ogs_error("OpenAPI_ie_info_convertToJSON() failed [ie_loc]"); + goto end; + } + + if (ie_info->ie_type == OpenAPI_ie_type_NULL) { + ogs_error("OpenAPI_ie_info_convertToJSON() failed [ie_type]"); + return NULL; + } + if (cJSON_AddStringToObject(item, "ieType", OpenAPI_ie_type_ToString(ie_info->ie_type)) == NULL) { + ogs_error("OpenAPI_ie_info_convertToJSON() failed [ie_type]"); + goto end; + } + + if (ie_info->req_ie) { + if (cJSON_AddStringToObject(item, "reqIe", ie_info->req_ie) == NULL) { + ogs_error("OpenAPI_ie_info_convertToJSON() failed [req_ie]"); + goto end; + } + } + + if (ie_info->rsp_ie) { + if (cJSON_AddStringToObject(item, "rspIe", ie_info->rsp_ie) == NULL) { + ogs_error("OpenAPI_ie_info_convertToJSON() failed [rsp_ie]"); + goto end; + } + } + + if (ie_info->is_is_modifiable) { + if (cJSON_AddBoolToObject(item, "isModifiable", ie_info->is_modifiable) == NULL) { + ogs_error("OpenAPI_ie_info_convertToJSON() failed [is_modifiable]"); + goto end; + } + } + + if (ie_info->is_modifiable_by_ipx) { + cJSON *is_modifiable_by_ipx = cJSON_AddObjectToObject(item, "isModifiableByIpx"); + if (is_modifiable_by_ipx == NULL) { + ogs_error("OpenAPI_ie_info_convertToJSON() failed [is_modifiable_by_ipx]"); + goto end; + } + cJSON *localMapObject = is_modifiable_by_ipx; + if (ie_info->is_modifiable_by_ipx) { + OpenAPI_list_for_each(ie_info->is_modifiable_by_ipx, node) { + OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*)node->data; + if (cJSON_AddBoolToObject(localMapObject, localKeyValue->key, (uintptr_t)localKeyValue->value) == NULL) { + ogs_error("OpenAPI_ie_info_convertToJSON() failed [inner]"); + goto end; + } + } + } + } + +end: + return item; +} + +OpenAPI_ie_info_t *OpenAPI_ie_info_parseFromJSON(cJSON *ie_infoJSON) +{ + OpenAPI_ie_info_t *ie_info_local_var = NULL; + OpenAPI_lnode_t *node = NULL; + cJSON *ie_loc = NULL; + OpenAPI_ie_location_e ie_locVariable = 0; + cJSON *ie_type = NULL; + OpenAPI_ie_type_e ie_typeVariable = 0; + cJSON *req_ie = NULL; + cJSON *rsp_ie = NULL; + cJSON *is_modifiable = NULL; + cJSON *is_modifiable_by_ipx = NULL; + OpenAPI_list_t *is_modifiable_by_ipxList = NULL; + ie_loc = cJSON_GetObjectItemCaseSensitive(ie_infoJSON, "ieLoc"); + if (!ie_loc) { + ogs_error("OpenAPI_ie_info_parseFromJSON() failed [ie_loc]"); + goto end; + } + if (!cJSON_IsString(ie_loc)) { + ogs_error("OpenAPI_ie_info_parseFromJSON() failed [ie_loc]"); + goto end; + } + ie_locVariable = OpenAPI_ie_location_FromString(ie_loc->valuestring); + + ie_type = cJSON_GetObjectItemCaseSensitive(ie_infoJSON, "ieType"); + if (!ie_type) { + ogs_error("OpenAPI_ie_info_parseFromJSON() failed [ie_type]"); + goto end; + } + if (!cJSON_IsString(ie_type)) { + ogs_error("OpenAPI_ie_info_parseFromJSON() failed [ie_type]"); + goto end; + } + ie_typeVariable = OpenAPI_ie_type_FromString(ie_type->valuestring); + + req_ie = cJSON_GetObjectItemCaseSensitive(ie_infoJSON, "reqIe"); + if (req_ie) { + if (!cJSON_IsString(req_ie) && !cJSON_IsNull(req_ie)) { + ogs_error("OpenAPI_ie_info_parseFromJSON() failed [req_ie]"); + goto end; + } + } + + rsp_ie = cJSON_GetObjectItemCaseSensitive(ie_infoJSON, "rspIe"); + if (rsp_ie) { + if (!cJSON_IsString(rsp_ie) && !cJSON_IsNull(rsp_ie)) { + ogs_error("OpenAPI_ie_info_parseFromJSON() failed [rsp_ie]"); + goto end; + } + } + + is_modifiable = cJSON_GetObjectItemCaseSensitive(ie_infoJSON, "isModifiable"); + if (is_modifiable) { + if (!cJSON_IsBool(is_modifiable)) { + ogs_error("OpenAPI_ie_info_parseFromJSON() failed [is_modifiable]"); + goto end; + } + } + + is_modifiable_by_ipx = cJSON_GetObjectItemCaseSensitive(ie_infoJSON, "isModifiableByIpx"); + if (is_modifiable_by_ipx) { + cJSON *is_modifiable_by_ipx_local_map = NULL; + if (!cJSON_IsObject(is_modifiable_by_ipx) && !cJSON_IsNull(is_modifiable_by_ipx)) { + ogs_error("OpenAPI_ie_info_parseFromJSON() failed [is_modifiable_by_ipx]"); + goto end; + } + if (cJSON_IsObject(is_modifiable_by_ipx)) { + is_modifiable_by_ipxList = OpenAPI_list_create(); + OpenAPI_map_t *localMapKeyPair = NULL; + cJSON_ArrayForEach(is_modifiable_by_ipx_local_map, is_modifiable_by_ipx) { + cJSON *localMapObject = is_modifiable_by_ipx_local_map; + double *localDouble = NULL; + int *localInt = NULL; + if (!cJSON_IsBool(localMapObject)) { + ogs_error("OpenAPI_ie_info_parseFromJSON() failed [inner]"); + goto end; + } + localInt = (int *)ogs_calloc(1, sizeof(int)); + if (!localInt) { + ogs_error("OpenAPI_ie_info_parseFromJSON() failed [inner]"); + goto end; + } + *localInt = localMapObject->valueint; + localMapKeyPair = OpenAPI_map_create(ogs_strdup(localMapObject->string), localInt); + OpenAPI_list_add(is_modifiable_by_ipxList, localMapKeyPair); + } + } + } + + ie_info_local_var = OpenAPI_ie_info_create ( + ie_locVariable, + ie_typeVariable, + req_ie && !cJSON_IsNull(req_ie) ? ogs_strdup(req_ie->valuestring) : NULL, + rsp_ie && !cJSON_IsNull(rsp_ie) ? ogs_strdup(rsp_ie->valuestring) : NULL, + is_modifiable ? true : false, + is_modifiable ? is_modifiable->valueint : 0, + is_modifiable_by_ipx ? is_modifiable_by_ipxList : NULL + ); + + return ie_info_local_var; +end: + if (is_modifiable_by_ipxList) { + OpenAPI_list_for_each(is_modifiable_by_ipxList, 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(is_modifiable_by_ipxList); + is_modifiable_by_ipxList = NULL; + } + return NULL; +} + +OpenAPI_ie_info_t *OpenAPI_ie_info_copy(OpenAPI_ie_info_t *dst, OpenAPI_ie_info_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_ie_info_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_ie_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_ie_info_free(dst); + dst = OpenAPI_ie_info_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/ie_info.h b/lib/sbi/openapi/model/ie_info.h new file mode 100644 index 000000000..bee289de1 --- /dev/null +++ b/lib/sbi/openapi/model/ie_info.h @@ -0,0 +1,52 @@ +/* + * ie_info.h + * + * Protection and modification policy for the IE + */ + +#ifndef _OpenAPI_ie_info_H_ +#define _OpenAPI_ie_info_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "ie_location.h" +#include "ie_type.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_ie_info_s OpenAPI_ie_info_t; +typedef struct OpenAPI_ie_info_s { + OpenAPI_ie_location_e ie_loc; + OpenAPI_ie_type_e ie_type; + char *req_ie; + char *rsp_ie; + bool is_is_modifiable; + int is_modifiable; + OpenAPI_list_t* is_modifiable_by_ipx; +} OpenAPI_ie_info_t; + +OpenAPI_ie_info_t *OpenAPI_ie_info_create( + OpenAPI_ie_location_e ie_loc, + OpenAPI_ie_type_e ie_type, + char *req_ie, + char *rsp_ie, + bool is_is_modifiable, + int is_modifiable, + OpenAPI_list_t* is_modifiable_by_ipx +); +void OpenAPI_ie_info_free(OpenAPI_ie_info_t *ie_info); +OpenAPI_ie_info_t *OpenAPI_ie_info_parseFromJSON(cJSON *ie_infoJSON); +cJSON *OpenAPI_ie_info_convertToJSON(OpenAPI_ie_info_t *ie_info); +OpenAPI_ie_info_t *OpenAPI_ie_info_copy(OpenAPI_ie_info_t *dst, OpenAPI_ie_info_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_ie_info_H_ */ + diff --git a/lib/sbi/openapi/model/ie_location.c b/lib/sbi/openapi/model/ie_location.c new file mode 100644 index 000000000..7781b6bcd --- /dev/null +++ b/lib/sbi/openapi/model/ie_location.c @@ -0,0 +1,30 @@ + +#include +#include +#include +#include "ie_location.h" + +char* OpenAPI_ie_location_ToString(OpenAPI_ie_location_e ie_location) +{ + const char *ie_locationArray[] = { "NULL", "URI_PARAM", "HEADER", "BODY", "MULTIPART_BINARY" }; + size_t sizeofArray = sizeof(ie_locationArray) / sizeof(ie_locationArray[0]); + if (ie_location < sizeofArray) + return (char *)ie_locationArray[ie_location]; + else + return (char *)"Unknown"; +} + +OpenAPI_ie_location_e OpenAPI_ie_location_FromString(char* ie_location) +{ + int stringToReturn = 0; + const char *ie_locationArray[] = { "NULL", "URI_PARAM", "HEADER", "BODY", "MULTIPART_BINARY" }; + size_t sizeofArray = sizeof(ie_locationArray) / sizeof(ie_locationArray[0]); + while (stringToReturn < sizeofArray) { + if (strcmp(ie_location, ie_locationArray[stringToReturn]) == 0) { + return stringToReturn; + } + stringToReturn++; + } + return 0; +} + diff --git a/lib/sbi/openapi/model/ie_location.h b/lib/sbi/openapi/model/ie_location.h new file mode 100644 index 000000000..66e6bc40e --- /dev/null +++ b/lib/sbi/openapi/model/ie_location.h @@ -0,0 +1,31 @@ +/* + * ie_location.h + * + * + */ + +#ifndef _OpenAPI_ie_location_H_ +#define _OpenAPI_ie_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 enum { OpenAPI_ie_location_NULL = 0, OpenAPI_ie_location_URI_PARAM, OpenAPI_ie_location_HEADER, OpenAPI_ie_location_BODY, OpenAPI_ie_location_MULTIPART_BINARY } OpenAPI_ie_location_e; + +char* OpenAPI_ie_location_ToString(OpenAPI_ie_location_e ie_location); + +OpenAPI_ie_location_e OpenAPI_ie_location_FromString(char* ie_location); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_ie_location_H_ */ + diff --git a/lib/sbi/openapi/model/ie_location_any_of.c b/lib/sbi/openapi/model/ie_location_any_of.c new file mode 100644 index 000000000..8f0e05324 --- /dev/null +++ b/lib/sbi/openapi/model/ie_location_any_of.c @@ -0,0 +1,30 @@ + +#include +#include +#include +#include "ie_location_any_of.h" + +char* OpenAPI_ie_location_any_of_ToString(OpenAPI_ie_location_any_of_e ie_location_any_of) +{ + const char *ie_location_any_ofArray[] = { "NULL", "URI_PARAM", "HEADER", "BODY", "MULTIPART_BINARY" }; + size_t sizeofArray = sizeof(ie_location_any_ofArray) / sizeof(ie_location_any_ofArray[0]); + if (ie_location_any_of < sizeofArray) + return (char *)ie_location_any_ofArray[ie_location_any_of]; + else + return (char *)"Unknown"; +} + +OpenAPI_ie_location_any_of_e OpenAPI_ie_location_any_of_FromString(char* ie_location_any_of) +{ + int stringToReturn = 0; + const char *ie_location_any_ofArray[] = { "NULL", "URI_PARAM", "HEADER", "BODY", "MULTIPART_BINARY" }; + size_t sizeofArray = sizeof(ie_location_any_ofArray) / sizeof(ie_location_any_ofArray[0]); + while (stringToReturn < sizeofArray) { + if (strcmp(ie_location_any_of, ie_location_any_ofArray[stringToReturn]) == 0) { + return stringToReturn; + } + stringToReturn++; + } + return 0; +} + diff --git a/lib/sbi/openapi/model/ie_location_any_of.h b/lib/sbi/openapi/model/ie_location_any_of.h new file mode 100644 index 000000000..25de633cb --- /dev/null +++ b/lib/sbi/openapi/model/ie_location_any_of.h @@ -0,0 +1,31 @@ +/* + * ie_location_any_of.h + * + * + */ + +#ifndef _OpenAPI_ie_location_any_of_H_ +#define _OpenAPI_ie_location_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_ie_location_any_of_NULL = 0, OpenAPI_ie_location_any_of_URI_PARAM, OpenAPI_ie_location_any_of_HEADER, OpenAPI_ie_location_any_of_BODY, OpenAPI_ie_location_any_of_MULTIPART_BINARY } OpenAPI_ie_location_any_of_e; + +char* OpenAPI_ie_location_any_of_ToString(OpenAPI_ie_location_any_of_e ie_location_any_of); + +OpenAPI_ie_location_any_of_e OpenAPI_ie_location_any_of_FromString(char* ie_location_any_of); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_ie_location_any_of_H_ */ + diff --git a/lib/sbi/openapi/model/ie_type.c b/lib/sbi/openapi/model/ie_type.c new file mode 100644 index 000000000..8c39cc515 --- /dev/null +++ b/lib/sbi/openapi/model/ie_type.c @@ -0,0 +1,30 @@ + +#include +#include +#include +#include "ie_type.h" + +char* OpenAPI_ie_type_ToString(OpenAPI_ie_type_e ie_type) +{ + const char *ie_typeArray[] = { "NULL", "UEID", "LOCATION", "KEY_MATERIAL", "AUTHENTICATION_MATERIAL", "AUTHORIZATION_TOKEN", "OTHER", "NONSENSITIVE" }; + size_t sizeofArray = sizeof(ie_typeArray) / sizeof(ie_typeArray[0]); + if (ie_type < sizeofArray) + return (char *)ie_typeArray[ie_type]; + else + return (char *)"Unknown"; +} + +OpenAPI_ie_type_e OpenAPI_ie_type_FromString(char* ie_type) +{ + int stringToReturn = 0; + const char *ie_typeArray[] = { "NULL", "UEID", "LOCATION", "KEY_MATERIAL", "AUTHENTICATION_MATERIAL", "AUTHORIZATION_TOKEN", "OTHER", "NONSENSITIVE" }; + size_t sizeofArray = sizeof(ie_typeArray) / sizeof(ie_typeArray[0]); + while (stringToReturn < sizeofArray) { + if (strcmp(ie_type, ie_typeArray[stringToReturn]) == 0) { + return stringToReturn; + } + stringToReturn++; + } + return 0; +} + diff --git a/lib/sbi/openapi/model/ie_type.h b/lib/sbi/openapi/model/ie_type.h new file mode 100644 index 000000000..13013e0ca --- /dev/null +++ b/lib/sbi/openapi/model/ie_type.h @@ -0,0 +1,31 @@ +/* + * ie_type.h + * + * + */ + +#ifndef _OpenAPI_ie_type_H_ +#define _OpenAPI_ie_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_ie_type_NULL = 0, OpenAPI_ie_type_UEID, OpenAPI_ie_type_LOCATION, OpenAPI_ie_type_KEY_MATERIAL, OpenAPI_ie_type_AUTHENTICATION_MATERIAL, OpenAPI_ie_type_AUTHORIZATION_TOKEN, OpenAPI_ie_type_OTHER, OpenAPI_ie_type_NONSENSITIVE } OpenAPI_ie_type_e; + +char* OpenAPI_ie_type_ToString(OpenAPI_ie_type_e ie_type); + +OpenAPI_ie_type_e OpenAPI_ie_type_FromString(char* ie_type); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_ie_type_H_ */ + diff --git a/lib/sbi/openapi/model/ie_type_any_of.c b/lib/sbi/openapi/model/ie_type_any_of.c new file mode 100644 index 000000000..484230a85 --- /dev/null +++ b/lib/sbi/openapi/model/ie_type_any_of.c @@ -0,0 +1,30 @@ + +#include +#include +#include +#include "ie_type_any_of.h" + +char* OpenAPI_ie_type_any_of_ToString(OpenAPI_ie_type_any_of_e ie_type_any_of) +{ + const char *ie_type_any_ofArray[] = { "NULL", "UEID", "LOCATION", "KEY_MATERIAL", "AUTHENTICATION_MATERIAL", "AUTHORIZATION_TOKEN", "OTHER", "NONSENSITIVE" }; + size_t sizeofArray = sizeof(ie_type_any_ofArray) / sizeof(ie_type_any_ofArray[0]); + if (ie_type_any_of < sizeofArray) + return (char *)ie_type_any_ofArray[ie_type_any_of]; + else + return (char *)"Unknown"; +} + +OpenAPI_ie_type_any_of_e OpenAPI_ie_type_any_of_FromString(char* ie_type_any_of) +{ + int stringToReturn = 0; + const char *ie_type_any_ofArray[] = { "NULL", "UEID", "LOCATION", "KEY_MATERIAL", "AUTHENTICATION_MATERIAL", "AUTHORIZATION_TOKEN", "OTHER", "NONSENSITIVE" }; + size_t sizeofArray = sizeof(ie_type_any_ofArray) / sizeof(ie_type_any_ofArray[0]); + while (stringToReturn < sizeofArray) { + if (strcmp(ie_type_any_of, ie_type_any_ofArray[stringToReturn]) == 0) { + return stringToReturn; + } + stringToReturn++; + } + return 0; +} + diff --git a/lib/sbi/openapi/model/ie_type_any_of.h b/lib/sbi/openapi/model/ie_type_any_of.h new file mode 100644 index 000000000..e6a6ec7d9 --- /dev/null +++ b/lib/sbi/openapi/model/ie_type_any_of.h @@ -0,0 +1,31 @@ +/* + * ie_type_any_of.h + * + * + */ + +#ifndef _OpenAPI_ie_type_any_of_H_ +#define _OpenAPI_ie_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_ie_type_any_of_NULL = 0, OpenAPI_ie_type_any_of_UEID, OpenAPI_ie_type_any_of_LOCATION, OpenAPI_ie_type_any_of_KEY_MATERIAL, OpenAPI_ie_type_any_of_AUTHENTICATION_MATERIAL, OpenAPI_ie_type_any_of_AUTHORIZATION_TOKEN, OpenAPI_ie_type_any_of_OTHER, OpenAPI_ie_type_any_of_NONSENSITIVE } OpenAPI_ie_type_any_of_e; + +char* OpenAPI_ie_type_any_of_ToString(OpenAPI_ie_type_any_of_e ie_type_any_of); + +OpenAPI_ie_type_any_of_e OpenAPI_ie_type_any_of_FromString(char* ie_type_any_of); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_ie_type_any_of_H_ */ + diff --git a/lib/sbi/openapi/model/intended_n32_purpose.c b/lib/sbi/openapi/model/intended_n32_purpose.c new file mode 100644 index 000000000..05ece2049 --- /dev/null +++ b/lib/sbi/openapi/model/intended_n32_purpose.c @@ -0,0 +1,158 @@ + +#include +#include +#include +#include "intended_n32_purpose.h" + +OpenAPI_intended_n32_purpose_t *OpenAPI_intended_n32_purpose_create( + OpenAPI_n32_purpose_e usage_purpose, + char *additional_info, + char *cause +) +{ + OpenAPI_intended_n32_purpose_t *intended_n32_purpose_local_var = ogs_malloc(sizeof(OpenAPI_intended_n32_purpose_t)); + ogs_assert(intended_n32_purpose_local_var); + + intended_n32_purpose_local_var->usage_purpose = usage_purpose; + intended_n32_purpose_local_var->additional_info = additional_info; + intended_n32_purpose_local_var->cause = cause; + + return intended_n32_purpose_local_var; +} + +void OpenAPI_intended_n32_purpose_free(OpenAPI_intended_n32_purpose_t *intended_n32_purpose) +{ + OpenAPI_lnode_t *node = NULL; + + if (NULL == intended_n32_purpose) { + return; + } + if (intended_n32_purpose->additional_info) { + ogs_free(intended_n32_purpose->additional_info); + intended_n32_purpose->additional_info = NULL; + } + if (intended_n32_purpose->cause) { + ogs_free(intended_n32_purpose->cause); + intended_n32_purpose->cause = NULL; + } + ogs_free(intended_n32_purpose); +} + +cJSON *OpenAPI_intended_n32_purpose_convertToJSON(OpenAPI_intended_n32_purpose_t *intended_n32_purpose) +{ + cJSON *item = NULL; + OpenAPI_lnode_t *node = NULL; + + if (intended_n32_purpose == NULL) { + ogs_error("OpenAPI_intended_n32_purpose_convertToJSON() failed [IntendedN32Purpose]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (intended_n32_purpose->usage_purpose == OpenAPI_n32_purpose_NULL) { + ogs_error("OpenAPI_intended_n32_purpose_convertToJSON() failed [usage_purpose]"); + return NULL; + } + if (cJSON_AddStringToObject(item, "usagePurpose", OpenAPI_n32_purpose_ToString(intended_n32_purpose->usage_purpose)) == NULL) { + ogs_error("OpenAPI_intended_n32_purpose_convertToJSON() failed [usage_purpose]"); + goto end; + } + + if (intended_n32_purpose->additional_info) { + if (cJSON_AddStringToObject(item, "additionalInfo", intended_n32_purpose->additional_info) == NULL) { + ogs_error("OpenAPI_intended_n32_purpose_convertToJSON() failed [additional_info]"); + goto end; + } + } + + if (intended_n32_purpose->cause) { + if (cJSON_AddStringToObject(item, "cause", intended_n32_purpose->cause) == NULL) { + ogs_error("OpenAPI_intended_n32_purpose_convertToJSON() failed [cause]"); + goto end; + } + } + +end: + return item; +} + +OpenAPI_intended_n32_purpose_t *OpenAPI_intended_n32_purpose_parseFromJSON(cJSON *intended_n32_purposeJSON) +{ + OpenAPI_intended_n32_purpose_t *intended_n32_purpose_local_var = NULL; + OpenAPI_lnode_t *node = NULL; + cJSON *usage_purpose = NULL; + OpenAPI_n32_purpose_e usage_purposeVariable = 0; + cJSON *additional_info = NULL; + cJSON *cause = NULL; + usage_purpose = cJSON_GetObjectItemCaseSensitive(intended_n32_purposeJSON, "usagePurpose"); + if (!usage_purpose) { + ogs_error("OpenAPI_intended_n32_purpose_parseFromJSON() failed [usage_purpose]"); + goto end; + } + if (!cJSON_IsString(usage_purpose)) { + ogs_error("OpenAPI_intended_n32_purpose_parseFromJSON() failed [usage_purpose]"); + goto end; + } + usage_purposeVariable = OpenAPI_n32_purpose_FromString(usage_purpose->valuestring); + + additional_info = cJSON_GetObjectItemCaseSensitive(intended_n32_purposeJSON, "additionalInfo"); + if (additional_info) { + if (!cJSON_IsString(additional_info) && !cJSON_IsNull(additional_info)) { + ogs_error("OpenAPI_intended_n32_purpose_parseFromJSON() failed [additional_info]"); + goto end; + } + } + + cause = cJSON_GetObjectItemCaseSensitive(intended_n32_purposeJSON, "cause"); + if (cause) { + if (!cJSON_IsString(cause) && !cJSON_IsNull(cause)) { + ogs_error("OpenAPI_intended_n32_purpose_parseFromJSON() failed [cause]"); + goto end; + } + } + + intended_n32_purpose_local_var = OpenAPI_intended_n32_purpose_create ( + usage_purposeVariable, + additional_info && !cJSON_IsNull(additional_info) ? ogs_strdup(additional_info->valuestring) : NULL, + cause && !cJSON_IsNull(cause) ? ogs_strdup(cause->valuestring) : NULL + ); + + return intended_n32_purpose_local_var; +end: + return NULL; +} + +OpenAPI_intended_n32_purpose_t *OpenAPI_intended_n32_purpose_copy(OpenAPI_intended_n32_purpose_t *dst, OpenAPI_intended_n32_purpose_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_intended_n32_purpose_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_intended_n32_purpose_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_intended_n32_purpose_free(dst); + dst = OpenAPI_intended_n32_purpose_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/intended_n32_purpose.h b/lib/sbi/openapi/model/intended_n32_purpose.h new file mode 100644 index 000000000..9652ed7a4 --- /dev/null +++ b/lib/sbi/openapi/model/intended_n32_purpose.h @@ -0,0 +1,43 @@ +/* + * intended_n32_purpose.h + * + * Indicates the intended N32 establishment purpose + */ + +#ifndef _OpenAPI_intended_n32_purpose_H_ +#define _OpenAPI_intended_n32_purpose_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "n32_purpose.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_intended_n32_purpose_s OpenAPI_intended_n32_purpose_t; +typedef struct OpenAPI_intended_n32_purpose_s { + OpenAPI_n32_purpose_e usage_purpose; + char *additional_info; + char *cause; +} OpenAPI_intended_n32_purpose_t; + +OpenAPI_intended_n32_purpose_t *OpenAPI_intended_n32_purpose_create( + OpenAPI_n32_purpose_e usage_purpose, + char *additional_info, + char *cause +); +void OpenAPI_intended_n32_purpose_free(OpenAPI_intended_n32_purpose_t *intended_n32_purpose); +OpenAPI_intended_n32_purpose_t *OpenAPI_intended_n32_purpose_parseFromJSON(cJSON *intended_n32_purposeJSON); +cJSON *OpenAPI_intended_n32_purpose_convertToJSON(OpenAPI_intended_n32_purpose_t *intended_n32_purpose); +OpenAPI_intended_n32_purpose_t *OpenAPI_intended_n32_purpose_copy(OpenAPI_intended_n32_purpose_t *dst, OpenAPI_intended_n32_purpose_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_intended_n32_purpose_H_ */ + diff --git a/lib/sbi/openapi/model/ipx_provider_sec_info.c b/lib/sbi/openapi/model/ipx_provider_sec_info.c new file mode 100644 index 000000000..9c678657a --- /dev/null +++ b/lib/sbi/openapi/model/ipx_provider_sec_info.c @@ -0,0 +1,222 @@ + +#include +#include +#include +#include "ipx_provider_sec_info.h" + +OpenAPI_ipx_provider_sec_info_t *OpenAPI_ipx_provider_sec_info_create( + char *ipx_provider_id, + OpenAPI_list_t *raw_public_key_list, + OpenAPI_list_t *certificate_list +) +{ + OpenAPI_ipx_provider_sec_info_t *ipx_provider_sec_info_local_var = ogs_malloc(sizeof(OpenAPI_ipx_provider_sec_info_t)); + ogs_assert(ipx_provider_sec_info_local_var); + + ipx_provider_sec_info_local_var->ipx_provider_id = ipx_provider_id; + ipx_provider_sec_info_local_var->raw_public_key_list = raw_public_key_list; + ipx_provider_sec_info_local_var->certificate_list = certificate_list; + + return ipx_provider_sec_info_local_var; +} + +void OpenAPI_ipx_provider_sec_info_free(OpenAPI_ipx_provider_sec_info_t *ipx_provider_sec_info) +{ + OpenAPI_lnode_t *node = NULL; + + if (NULL == ipx_provider_sec_info) { + return; + } + if (ipx_provider_sec_info->ipx_provider_id) { + ogs_free(ipx_provider_sec_info->ipx_provider_id); + ipx_provider_sec_info->ipx_provider_id = NULL; + } + if (ipx_provider_sec_info->raw_public_key_list) { + OpenAPI_list_for_each(ipx_provider_sec_info->raw_public_key_list, node) { + ogs_free(node->data); + } + OpenAPI_list_free(ipx_provider_sec_info->raw_public_key_list); + ipx_provider_sec_info->raw_public_key_list = NULL; + } + if (ipx_provider_sec_info->certificate_list) { + OpenAPI_list_for_each(ipx_provider_sec_info->certificate_list, node) { + ogs_free(node->data); + } + OpenAPI_list_free(ipx_provider_sec_info->certificate_list); + ipx_provider_sec_info->certificate_list = NULL; + } + ogs_free(ipx_provider_sec_info); +} + +cJSON *OpenAPI_ipx_provider_sec_info_convertToJSON(OpenAPI_ipx_provider_sec_info_t *ipx_provider_sec_info) +{ + cJSON *item = NULL; + OpenAPI_lnode_t *node = NULL; + + if (ipx_provider_sec_info == NULL) { + ogs_error("OpenAPI_ipx_provider_sec_info_convertToJSON() failed [IpxProviderSecInfo]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (!ipx_provider_sec_info->ipx_provider_id) { + ogs_error("OpenAPI_ipx_provider_sec_info_convertToJSON() failed [ipx_provider_id]"); + return NULL; + } + if (cJSON_AddStringToObject(item, "ipxProviderId", ipx_provider_sec_info->ipx_provider_id) == NULL) { + ogs_error("OpenAPI_ipx_provider_sec_info_convertToJSON() failed [ipx_provider_id]"); + goto end; + } + + if (ipx_provider_sec_info->raw_public_key_list) { + cJSON *raw_public_key_listList = cJSON_AddArrayToObject(item, "rawPublicKeyList"); + if (raw_public_key_listList == NULL) { + ogs_error("OpenAPI_ipx_provider_sec_info_convertToJSON() failed [raw_public_key_list]"); + goto end; + } + OpenAPI_list_for_each(ipx_provider_sec_info->raw_public_key_list, node) { + if (cJSON_AddStringToObject(raw_public_key_listList, "", (char*)node->data) == NULL) { + ogs_error("OpenAPI_ipx_provider_sec_info_convertToJSON() failed [raw_public_key_list]"); + goto end; + } + } + } + + if (ipx_provider_sec_info->certificate_list) { + cJSON *certificate_listList = cJSON_AddArrayToObject(item, "certificateList"); + if (certificate_listList == NULL) { + ogs_error("OpenAPI_ipx_provider_sec_info_convertToJSON() failed [certificate_list]"); + goto end; + } + OpenAPI_list_for_each(ipx_provider_sec_info->certificate_list, node) { + if (cJSON_AddStringToObject(certificate_listList, "", (char*)node->data) == NULL) { + ogs_error("OpenAPI_ipx_provider_sec_info_convertToJSON() failed [certificate_list]"); + goto end; + } + } + } + +end: + return item; +} + +OpenAPI_ipx_provider_sec_info_t *OpenAPI_ipx_provider_sec_info_parseFromJSON(cJSON *ipx_provider_sec_infoJSON) +{ + OpenAPI_ipx_provider_sec_info_t *ipx_provider_sec_info_local_var = NULL; + OpenAPI_lnode_t *node = NULL; + cJSON *ipx_provider_id = NULL; + cJSON *raw_public_key_list = NULL; + OpenAPI_list_t *raw_public_key_listList = NULL; + cJSON *certificate_list = NULL; + OpenAPI_list_t *certificate_listList = NULL; + ipx_provider_id = cJSON_GetObjectItemCaseSensitive(ipx_provider_sec_infoJSON, "ipxProviderId"); + if (!ipx_provider_id) { + ogs_error("OpenAPI_ipx_provider_sec_info_parseFromJSON() failed [ipx_provider_id]"); + goto end; + } + if (!cJSON_IsString(ipx_provider_id)) { + ogs_error("OpenAPI_ipx_provider_sec_info_parseFromJSON() failed [ipx_provider_id]"); + goto end; + } + + raw_public_key_list = cJSON_GetObjectItemCaseSensitive(ipx_provider_sec_infoJSON, "rawPublicKeyList"); + if (raw_public_key_list) { + cJSON *raw_public_key_list_local = NULL; + if (!cJSON_IsArray(raw_public_key_list)) { + ogs_error("OpenAPI_ipx_provider_sec_info_parseFromJSON() failed [raw_public_key_list]"); + goto end; + } + + raw_public_key_listList = OpenAPI_list_create(); + + cJSON_ArrayForEach(raw_public_key_list_local, raw_public_key_list) { + double *localDouble = NULL; + int *localInt = NULL; + if (!cJSON_IsString(raw_public_key_list_local)) { + ogs_error("OpenAPI_ipx_provider_sec_info_parseFromJSON() failed [raw_public_key_list]"); + goto end; + } + OpenAPI_list_add(raw_public_key_listList, ogs_strdup(raw_public_key_list_local->valuestring)); + } + } + + certificate_list = cJSON_GetObjectItemCaseSensitive(ipx_provider_sec_infoJSON, "certificateList"); + if (certificate_list) { + cJSON *certificate_list_local = NULL; + if (!cJSON_IsArray(certificate_list)) { + ogs_error("OpenAPI_ipx_provider_sec_info_parseFromJSON() failed [certificate_list]"); + goto end; + } + + certificate_listList = OpenAPI_list_create(); + + cJSON_ArrayForEach(certificate_list_local, certificate_list) { + double *localDouble = NULL; + int *localInt = NULL; + if (!cJSON_IsString(certificate_list_local)) { + ogs_error("OpenAPI_ipx_provider_sec_info_parseFromJSON() failed [certificate_list]"); + goto end; + } + OpenAPI_list_add(certificate_listList, ogs_strdup(certificate_list_local->valuestring)); + } + } + + ipx_provider_sec_info_local_var = OpenAPI_ipx_provider_sec_info_create ( + ogs_strdup(ipx_provider_id->valuestring), + raw_public_key_list ? raw_public_key_listList : NULL, + certificate_list ? certificate_listList : NULL + ); + + return ipx_provider_sec_info_local_var; +end: + if (raw_public_key_listList) { + OpenAPI_list_for_each(raw_public_key_listList, node) { + ogs_free(node->data); + } + OpenAPI_list_free(raw_public_key_listList); + raw_public_key_listList = NULL; + } + if (certificate_listList) { + OpenAPI_list_for_each(certificate_listList, node) { + ogs_free(node->data); + } + OpenAPI_list_free(certificate_listList); + certificate_listList = NULL; + } + return NULL; +} + +OpenAPI_ipx_provider_sec_info_t *OpenAPI_ipx_provider_sec_info_copy(OpenAPI_ipx_provider_sec_info_t *dst, OpenAPI_ipx_provider_sec_info_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_ipx_provider_sec_info_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_ipx_provider_sec_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_ipx_provider_sec_info_free(dst); + dst = OpenAPI_ipx_provider_sec_info_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/ipx_provider_sec_info.h b/lib/sbi/openapi/model/ipx_provider_sec_info.h new file mode 100644 index 000000000..71be54287 --- /dev/null +++ b/lib/sbi/openapi/model/ipx_provider_sec_info.h @@ -0,0 +1,42 @@ +/* + * ipx_provider_sec_info.h + * + * Defines the security information list of an IPX + */ + +#ifndef _OpenAPI_ipx_provider_sec_info_H_ +#define _OpenAPI_ipx_provider_sec_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_ipx_provider_sec_info_s OpenAPI_ipx_provider_sec_info_t; +typedef struct OpenAPI_ipx_provider_sec_info_s { + char *ipx_provider_id; + OpenAPI_list_t *raw_public_key_list; + OpenAPI_list_t *certificate_list; +} OpenAPI_ipx_provider_sec_info_t; + +OpenAPI_ipx_provider_sec_info_t *OpenAPI_ipx_provider_sec_info_create( + char *ipx_provider_id, + OpenAPI_list_t *raw_public_key_list, + OpenAPI_list_t *certificate_list +); +void OpenAPI_ipx_provider_sec_info_free(OpenAPI_ipx_provider_sec_info_t *ipx_provider_sec_info); +OpenAPI_ipx_provider_sec_info_t *OpenAPI_ipx_provider_sec_info_parseFromJSON(cJSON *ipx_provider_sec_infoJSON); +cJSON *OpenAPI_ipx_provider_sec_info_convertToJSON(OpenAPI_ipx_provider_sec_info_t *ipx_provider_sec_info); +OpenAPI_ipx_provider_sec_info_t *OpenAPI_ipx_provider_sec_info_copy(OpenAPI_ipx_provider_sec_info_t *dst, OpenAPI_ipx_provider_sec_info_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_ipx_provider_sec_info_H_ */ + diff --git a/lib/sbi/openapi/model/n32_purpose.c b/lib/sbi/openapi/model/n32_purpose.c new file mode 100644 index 000000000..c544e9478 --- /dev/null +++ b/lib/sbi/openapi/model/n32_purpose.c @@ -0,0 +1,30 @@ + +#include +#include +#include +#include "n32_purpose.h" + +char* OpenAPI_n32_purpose_ToString(OpenAPI_n32_purpose_e n32_purpose) +{ + const char *n32_purposeArray[] = { "NULL", "ROAMING", "INTER_PLMN_MOBILITY", "SMS_INTERCONNECT", "ROAMING_TEST", "INTER_PLMN_MOBILITY_TEST", "SMS_INTERCONNECT_TEST", "SNPN_INTERCONNECT", "SNPN_INTERCONNECT_TEST", "DISASTER_ROAMING", "DISASTER_ROAMING_TEST" }; + size_t sizeofArray = sizeof(n32_purposeArray) / sizeof(n32_purposeArray[0]); + if (n32_purpose < sizeofArray) + return (char *)n32_purposeArray[n32_purpose]; + else + return (char *)"Unknown"; +} + +OpenAPI_n32_purpose_e OpenAPI_n32_purpose_FromString(char* n32_purpose) +{ + int stringToReturn = 0; + const char *n32_purposeArray[] = { "NULL", "ROAMING", "INTER_PLMN_MOBILITY", "SMS_INTERCONNECT", "ROAMING_TEST", "INTER_PLMN_MOBILITY_TEST", "SMS_INTERCONNECT_TEST", "SNPN_INTERCONNECT", "SNPN_INTERCONNECT_TEST", "DISASTER_ROAMING", "DISASTER_ROAMING_TEST" }; + size_t sizeofArray = sizeof(n32_purposeArray) / sizeof(n32_purposeArray[0]); + while (stringToReturn < sizeofArray) { + if (strcmp(n32_purpose, n32_purposeArray[stringToReturn]) == 0) { + return stringToReturn; + } + stringToReturn++; + } + return 0; +} + diff --git a/lib/sbi/openapi/model/n32_purpose.h b/lib/sbi/openapi/model/n32_purpose.h new file mode 100644 index 000000000..604362c8e --- /dev/null +++ b/lib/sbi/openapi/model/n32_purpose.h @@ -0,0 +1,31 @@ +/* + * n32_purpose.h + * + * + */ + +#ifndef _OpenAPI_n32_purpose_H_ +#define _OpenAPI_n32_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_n32_purpose_NULL = 0, OpenAPI_n32_purpose_ROAMING, OpenAPI_n32_purpose_INTER_PLMN_MOBILITY, OpenAPI_n32_purpose_SMS_INTERCONNECT, OpenAPI_n32_purpose_ROAMING_TEST, OpenAPI_n32_purpose_INTER_PLMN_MOBILITY_TEST, OpenAPI_n32_purpose_SMS_INTERCONNECT_TEST, OpenAPI_n32_purpose_SNPN_INTERCONNECT, OpenAPI_n32_purpose_SNPN_INTERCONNECT_TEST, OpenAPI_n32_purpose_DISASTER_ROAMING, OpenAPI_n32_purpose_DISASTER_ROAMING_TEST } OpenAPI_n32_purpose_e; + +char* OpenAPI_n32_purpose_ToString(OpenAPI_n32_purpose_e n32_purpose); + +OpenAPI_n32_purpose_e OpenAPI_n32_purpose_FromString(char* n32_purpose); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_n32_purpose_H_ */ + diff --git a/lib/sbi/openapi/model/n32_purpose_any_of.c b/lib/sbi/openapi/model/n32_purpose_any_of.c new file mode 100644 index 000000000..a6a2db234 --- /dev/null +++ b/lib/sbi/openapi/model/n32_purpose_any_of.c @@ -0,0 +1,30 @@ + +#include +#include +#include +#include "n32_purpose_any_of.h" + +char* OpenAPI_n32_purpose_any_of_ToString(OpenAPI_n32_purpose_any_of_e n32_purpose_any_of) +{ + const char *n32_purpose_any_ofArray[] = { "NULL", "ROAMING", "INTER_PLMN_MOBILITY", "SMS_INTERCONNECT", "ROAMING_TEST", "INTER_PLMN_MOBILITY_TEST", "SMS_INTERCONNECT_TEST", "SNPN_INTERCONNECT", "SNPN_INTERCONNECT_TEST", "DISASTER_ROAMING", "DISASTER_ROAMING_TEST" }; + size_t sizeofArray = sizeof(n32_purpose_any_ofArray) / sizeof(n32_purpose_any_ofArray[0]); + if (n32_purpose_any_of < sizeofArray) + return (char *)n32_purpose_any_ofArray[n32_purpose_any_of]; + else + return (char *)"Unknown"; +} + +OpenAPI_n32_purpose_any_of_e OpenAPI_n32_purpose_any_of_FromString(char* n32_purpose_any_of) +{ + int stringToReturn = 0; + const char *n32_purpose_any_ofArray[] = { "NULL", "ROAMING", "INTER_PLMN_MOBILITY", "SMS_INTERCONNECT", "ROAMING_TEST", "INTER_PLMN_MOBILITY_TEST", "SMS_INTERCONNECT_TEST", "SNPN_INTERCONNECT", "SNPN_INTERCONNECT_TEST", "DISASTER_ROAMING", "DISASTER_ROAMING_TEST" }; + size_t sizeofArray = sizeof(n32_purpose_any_ofArray) / sizeof(n32_purpose_any_ofArray[0]); + while (stringToReturn < sizeofArray) { + if (strcmp(n32_purpose_any_of, n32_purpose_any_ofArray[stringToReturn]) == 0) { + return stringToReturn; + } + stringToReturn++; + } + return 0; +} + diff --git a/lib/sbi/openapi/model/n32_purpose_any_of.h b/lib/sbi/openapi/model/n32_purpose_any_of.h new file mode 100644 index 000000000..1f1a7ec71 --- /dev/null +++ b/lib/sbi/openapi/model/n32_purpose_any_of.h @@ -0,0 +1,31 @@ +/* + * n32_purpose_any_of.h + * + * + */ + +#ifndef _OpenAPI_n32_purpose_any_of_H_ +#define _OpenAPI_n32_purpose_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_n32_purpose_any_of_NULL = 0, OpenAPI_n32_purpose_any_of_ROAMING, OpenAPI_n32_purpose_any_of_INTER_PLMN_MOBILITY, OpenAPI_n32_purpose_any_of_SMS_INTERCONNECT, OpenAPI_n32_purpose_any_of_ROAMING_TEST, OpenAPI_n32_purpose_any_of_INTER_PLMN_MOBILITY_TEST, OpenAPI_n32_purpose_any_of_SMS_INTERCONNECT_TEST, OpenAPI_n32_purpose_any_of_SNPN_INTERCONNECT, OpenAPI_n32_purpose_any_of_SNPN_INTERCONNECT_TEST, OpenAPI_n32_purpose_any_of_DISASTER_ROAMING, OpenAPI_n32_purpose_any_of_DISASTER_ROAMING_TEST } OpenAPI_n32_purpose_any_of_e; + +char* OpenAPI_n32_purpose_any_of_ToString(OpenAPI_n32_purpose_any_of_e n32_purpose_any_of); + +OpenAPI_n32_purpose_any_of_e OpenAPI_n32_purpose_any_of_FromString(char* n32_purpose_any_of); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_n32_purpose_any_of_H_ */ + diff --git a/lib/sbi/openapi/model/n32f_context_info.c b/lib/sbi/openapi/model/n32f_context_info.c new file mode 100644 index 000000000..701c4b7bc --- /dev/null +++ b/lib/sbi/openapi/model/n32f_context_info.c @@ -0,0 +1,114 @@ + +#include +#include +#include +#include "n32f_context_info.h" + +OpenAPI_n32f_context_info_t *OpenAPI_n32f_context_info_create( + char *n32f_context_id +) +{ + OpenAPI_n32f_context_info_t *n32f_context_info_local_var = ogs_malloc(sizeof(OpenAPI_n32f_context_info_t)); + ogs_assert(n32f_context_info_local_var); + + n32f_context_info_local_var->n32f_context_id = n32f_context_id; + + return n32f_context_info_local_var; +} + +void OpenAPI_n32f_context_info_free(OpenAPI_n32f_context_info_t *n32f_context_info) +{ + OpenAPI_lnode_t *node = NULL; + + if (NULL == n32f_context_info) { + return; + } + if (n32f_context_info->n32f_context_id) { + ogs_free(n32f_context_info->n32f_context_id); + n32f_context_info->n32f_context_id = NULL; + } + ogs_free(n32f_context_info); +} + +cJSON *OpenAPI_n32f_context_info_convertToJSON(OpenAPI_n32f_context_info_t *n32f_context_info) +{ + cJSON *item = NULL; + OpenAPI_lnode_t *node = NULL; + + if (n32f_context_info == NULL) { + ogs_error("OpenAPI_n32f_context_info_convertToJSON() failed [N32fContextInfo]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (!n32f_context_info->n32f_context_id) { + ogs_error("OpenAPI_n32f_context_info_convertToJSON() failed [n32f_context_id]"); + return NULL; + } + if (cJSON_AddStringToObject(item, "n32fContextId", n32f_context_info->n32f_context_id) == NULL) { + ogs_error("OpenAPI_n32f_context_info_convertToJSON() failed [n32f_context_id]"); + goto end; + } + +end: + return item; +} + +OpenAPI_n32f_context_info_t *OpenAPI_n32f_context_info_parseFromJSON(cJSON *n32f_context_infoJSON) +{ + OpenAPI_n32f_context_info_t *n32f_context_info_local_var = NULL; + OpenAPI_lnode_t *node = NULL; + cJSON *n32f_context_id = NULL; + n32f_context_id = cJSON_GetObjectItemCaseSensitive(n32f_context_infoJSON, "n32fContextId"); + if (!n32f_context_id) { + ogs_error("OpenAPI_n32f_context_info_parseFromJSON() failed [n32f_context_id]"); + goto end; + } + if (!cJSON_IsString(n32f_context_id)) { + ogs_error("OpenAPI_n32f_context_info_parseFromJSON() failed [n32f_context_id]"); + goto end; + } + + n32f_context_info_local_var = OpenAPI_n32f_context_info_create ( + ogs_strdup(n32f_context_id->valuestring) + ); + + return n32f_context_info_local_var; +end: + return NULL; +} + +OpenAPI_n32f_context_info_t *OpenAPI_n32f_context_info_copy(OpenAPI_n32f_context_info_t *dst, OpenAPI_n32f_context_info_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_n32f_context_info_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_n32f_context_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_n32f_context_info_free(dst); + dst = OpenAPI_n32f_context_info_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/n32f_context_info.h b/lib/sbi/openapi/model/n32f_context_info.h new file mode 100644 index 000000000..cc4a2fd54 --- /dev/null +++ b/lib/sbi/openapi/model/n32f_context_info.h @@ -0,0 +1,38 @@ +/* + * n32f_context_info.h + * + * N32-f context information + */ + +#ifndef _OpenAPI_n32f_context_info_H_ +#define _OpenAPI_n32f_context_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_n32f_context_info_s OpenAPI_n32f_context_info_t; +typedef struct OpenAPI_n32f_context_info_s { + char *n32f_context_id; +} OpenAPI_n32f_context_info_t; + +OpenAPI_n32f_context_info_t *OpenAPI_n32f_context_info_create( + char *n32f_context_id +); +void OpenAPI_n32f_context_info_free(OpenAPI_n32f_context_info_t *n32f_context_info); +OpenAPI_n32f_context_info_t *OpenAPI_n32f_context_info_parseFromJSON(cJSON *n32f_context_infoJSON); +cJSON *OpenAPI_n32f_context_info_convertToJSON(OpenAPI_n32f_context_info_t *n32f_context_info); +OpenAPI_n32f_context_info_t *OpenAPI_n32f_context_info_copy(OpenAPI_n32f_context_info_t *dst, OpenAPI_n32f_context_info_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_n32f_context_info_H_ */ + diff --git a/lib/sbi/openapi/model/n32f_error_detail.c b/lib/sbi/openapi/model/n32f_error_detail.c new file mode 100644 index 000000000..e9a78a380 --- /dev/null +++ b/lib/sbi/openapi/model/n32f_error_detail.c @@ -0,0 +1,139 @@ + +#include +#include +#include +#include "n32f_error_detail.h" + +OpenAPI_n32f_error_detail_t *OpenAPI_n32f_error_detail_create( + char *attribute, + OpenAPI_failure_reason_e msg_reconstruct_fail_reason +) +{ + OpenAPI_n32f_error_detail_t *n32f_error_detail_local_var = ogs_malloc(sizeof(OpenAPI_n32f_error_detail_t)); + ogs_assert(n32f_error_detail_local_var); + + n32f_error_detail_local_var->attribute = attribute; + n32f_error_detail_local_var->msg_reconstruct_fail_reason = msg_reconstruct_fail_reason; + + return n32f_error_detail_local_var; +} + +void OpenAPI_n32f_error_detail_free(OpenAPI_n32f_error_detail_t *n32f_error_detail) +{ + OpenAPI_lnode_t *node = NULL; + + if (NULL == n32f_error_detail) { + return; + } + if (n32f_error_detail->attribute) { + ogs_free(n32f_error_detail->attribute); + n32f_error_detail->attribute = NULL; + } + ogs_free(n32f_error_detail); +} + +cJSON *OpenAPI_n32f_error_detail_convertToJSON(OpenAPI_n32f_error_detail_t *n32f_error_detail) +{ + cJSON *item = NULL; + OpenAPI_lnode_t *node = NULL; + + if (n32f_error_detail == NULL) { + ogs_error("OpenAPI_n32f_error_detail_convertToJSON() failed [N32fErrorDetail]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (!n32f_error_detail->attribute) { + ogs_error("OpenAPI_n32f_error_detail_convertToJSON() failed [attribute]"); + return NULL; + } + if (cJSON_AddStringToObject(item, "attribute", n32f_error_detail->attribute) == NULL) { + ogs_error("OpenAPI_n32f_error_detail_convertToJSON() failed [attribute]"); + goto end; + } + + if (n32f_error_detail->msg_reconstruct_fail_reason == OpenAPI_failure_reason_NULL) { + ogs_error("OpenAPI_n32f_error_detail_convertToJSON() failed [msg_reconstruct_fail_reason]"); + return NULL; + } + if (cJSON_AddStringToObject(item, "msgReconstructFailReason", OpenAPI_failure_reason_ToString(n32f_error_detail->msg_reconstruct_fail_reason)) == NULL) { + ogs_error("OpenAPI_n32f_error_detail_convertToJSON() failed [msg_reconstruct_fail_reason]"); + goto end; + } + +end: + return item; +} + +OpenAPI_n32f_error_detail_t *OpenAPI_n32f_error_detail_parseFromJSON(cJSON *n32f_error_detailJSON) +{ + OpenAPI_n32f_error_detail_t *n32f_error_detail_local_var = NULL; + OpenAPI_lnode_t *node = NULL; + cJSON *attribute = NULL; + cJSON *msg_reconstruct_fail_reason = NULL; + OpenAPI_failure_reason_e msg_reconstruct_fail_reasonVariable = 0; + attribute = cJSON_GetObjectItemCaseSensitive(n32f_error_detailJSON, "attribute"); + if (!attribute) { + ogs_error("OpenAPI_n32f_error_detail_parseFromJSON() failed [attribute]"); + goto end; + } + if (!cJSON_IsString(attribute)) { + ogs_error("OpenAPI_n32f_error_detail_parseFromJSON() failed [attribute]"); + goto end; + } + + msg_reconstruct_fail_reason = cJSON_GetObjectItemCaseSensitive(n32f_error_detailJSON, "msgReconstructFailReason"); + if (!msg_reconstruct_fail_reason) { + ogs_error("OpenAPI_n32f_error_detail_parseFromJSON() failed [msg_reconstruct_fail_reason]"); + goto end; + } + if (!cJSON_IsString(msg_reconstruct_fail_reason)) { + ogs_error("OpenAPI_n32f_error_detail_parseFromJSON() failed [msg_reconstruct_fail_reason]"); + goto end; + } + msg_reconstruct_fail_reasonVariable = OpenAPI_failure_reason_FromString(msg_reconstruct_fail_reason->valuestring); + + n32f_error_detail_local_var = OpenAPI_n32f_error_detail_create ( + ogs_strdup(attribute->valuestring), + msg_reconstruct_fail_reasonVariable + ); + + return n32f_error_detail_local_var; +end: + return NULL; +} + +OpenAPI_n32f_error_detail_t *OpenAPI_n32f_error_detail_copy(OpenAPI_n32f_error_detail_t *dst, OpenAPI_n32f_error_detail_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_n32f_error_detail_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_n32f_error_detail_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_n32f_error_detail_free(dst); + dst = OpenAPI_n32f_error_detail_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/n32f_error_detail.h b/lib/sbi/openapi/model/n32f_error_detail.h new file mode 100644 index 000000000..2686d7cdc --- /dev/null +++ b/lib/sbi/openapi/model/n32f_error_detail.h @@ -0,0 +1,41 @@ +/* + * n32f_error_detail.h + * + * Details about the N32f error + */ + +#ifndef _OpenAPI_n32f_error_detail_H_ +#define _OpenAPI_n32f_error_detail_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "failure_reason.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_n32f_error_detail_s OpenAPI_n32f_error_detail_t; +typedef struct OpenAPI_n32f_error_detail_s { + char *attribute; + OpenAPI_failure_reason_e msg_reconstruct_fail_reason; +} OpenAPI_n32f_error_detail_t; + +OpenAPI_n32f_error_detail_t *OpenAPI_n32f_error_detail_create( + char *attribute, + OpenAPI_failure_reason_e msg_reconstruct_fail_reason +); +void OpenAPI_n32f_error_detail_free(OpenAPI_n32f_error_detail_t *n32f_error_detail); +OpenAPI_n32f_error_detail_t *OpenAPI_n32f_error_detail_parseFromJSON(cJSON *n32f_error_detailJSON); +cJSON *OpenAPI_n32f_error_detail_convertToJSON(OpenAPI_n32f_error_detail_t *n32f_error_detail); +OpenAPI_n32f_error_detail_t *OpenAPI_n32f_error_detail_copy(OpenAPI_n32f_error_detail_t *dst, OpenAPI_n32f_error_detail_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_n32f_error_detail_H_ */ + diff --git a/lib/sbi/openapi/model/n32f_error_info.c b/lib/sbi/openapi/model/n32f_error_info.c new file mode 100644 index 000000000..74da1b62d --- /dev/null +++ b/lib/sbi/openapi/model/n32f_error_info.c @@ -0,0 +1,282 @@ + +#include +#include +#include +#include "n32f_error_info.h" + +OpenAPI_n32f_error_info_t *OpenAPI_n32f_error_info_create( + char *n32f_message_id, + OpenAPI_n32f_error_type_e n32f_error_type, + char *n32f_context_id, + OpenAPI_list_t *failed_modification_list, + OpenAPI_list_t *error_details_list +) +{ + OpenAPI_n32f_error_info_t *n32f_error_info_local_var = ogs_malloc(sizeof(OpenAPI_n32f_error_info_t)); + ogs_assert(n32f_error_info_local_var); + + n32f_error_info_local_var->n32f_message_id = n32f_message_id; + n32f_error_info_local_var->n32f_error_type = n32f_error_type; + n32f_error_info_local_var->n32f_context_id = n32f_context_id; + n32f_error_info_local_var->failed_modification_list = failed_modification_list; + n32f_error_info_local_var->error_details_list = error_details_list; + + return n32f_error_info_local_var; +} + +void OpenAPI_n32f_error_info_free(OpenAPI_n32f_error_info_t *n32f_error_info) +{ + OpenAPI_lnode_t *node = NULL; + + if (NULL == n32f_error_info) { + return; + } + if (n32f_error_info->n32f_message_id) { + ogs_free(n32f_error_info->n32f_message_id); + n32f_error_info->n32f_message_id = NULL; + } + if (n32f_error_info->n32f_context_id) { + ogs_free(n32f_error_info->n32f_context_id); + n32f_error_info->n32f_context_id = NULL; + } + if (n32f_error_info->failed_modification_list) { + OpenAPI_list_for_each(n32f_error_info->failed_modification_list, node) { + OpenAPI_failed_modification_info_free(node->data); + } + OpenAPI_list_free(n32f_error_info->failed_modification_list); + n32f_error_info->failed_modification_list = NULL; + } + if (n32f_error_info->error_details_list) { + OpenAPI_list_for_each(n32f_error_info->error_details_list, node) { + OpenAPI_n32f_error_detail_free(node->data); + } + OpenAPI_list_free(n32f_error_info->error_details_list); + n32f_error_info->error_details_list = NULL; + } + ogs_free(n32f_error_info); +} + +cJSON *OpenAPI_n32f_error_info_convertToJSON(OpenAPI_n32f_error_info_t *n32f_error_info) +{ + cJSON *item = NULL; + OpenAPI_lnode_t *node = NULL; + + if (n32f_error_info == NULL) { + ogs_error("OpenAPI_n32f_error_info_convertToJSON() failed [N32fErrorInfo]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (!n32f_error_info->n32f_message_id) { + ogs_error("OpenAPI_n32f_error_info_convertToJSON() failed [n32f_message_id]"); + return NULL; + } + if (cJSON_AddStringToObject(item, "n32fMessageId", n32f_error_info->n32f_message_id) == NULL) { + ogs_error("OpenAPI_n32f_error_info_convertToJSON() failed [n32f_message_id]"); + goto end; + } + + if (n32f_error_info->n32f_error_type == OpenAPI_n32f_error_type_NULL) { + ogs_error("OpenAPI_n32f_error_info_convertToJSON() failed [n32f_error_type]"); + return NULL; + } + if (cJSON_AddStringToObject(item, "n32fErrorType", OpenAPI_n32f_error_type_ToString(n32f_error_info->n32f_error_type)) == NULL) { + ogs_error("OpenAPI_n32f_error_info_convertToJSON() failed [n32f_error_type]"); + goto end; + } + + if (n32f_error_info->n32f_context_id) { + if (cJSON_AddStringToObject(item, "n32fContextId", n32f_error_info->n32f_context_id) == NULL) { + ogs_error("OpenAPI_n32f_error_info_convertToJSON() failed [n32f_context_id]"); + goto end; + } + } + + if (n32f_error_info->failed_modification_list) { + cJSON *failed_modification_listList = cJSON_AddArrayToObject(item, "failedModificationList"); + if (failed_modification_listList == NULL) { + ogs_error("OpenAPI_n32f_error_info_convertToJSON() failed [failed_modification_list]"); + goto end; + } + OpenAPI_list_for_each(n32f_error_info->failed_modification_list, node) { + cJSON *itemLocal = OpenAPI_failed_modification_info_convertToJSON(node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_n32f_error_info_convertToJSON() failed [failed_modification_list]"); + goto end; + } + cJSON_AddItemToArray(failed_modification_listList, itemLocal); + } + } + + if (n32f_error_info->error_details_list) { + cJSON *error_details_listList = cJSON_AddArrayToObject(item, "errorDetailsList"); + if (error_details_listList == NULL) { + ogs_error("OpenAPI_n32f_error_info_convertToJSON() failed [error_details_list]"); + goto end; + } + OpenAPI_list_for_each(n32f_error_info->error_details_list, node) { + cJSON *itemLocal = OpenAPI_n32f_error_detail_convertToJSON(node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_n32f_error_info_convertToJSON() failed [error_details_list]"); + goto end; + } + cJSON_AddItemToArray(error_details_listList, itemLocal); + } + } + +end: + return item; +} + +OpenAPI_n32f_error_info_t *OpenAPI_n32f_error_info_parseFromJSON(cJSON *n32f_error_infoJSON) +{ + OpenAPI_n32f_error_info_t *n32f_error_info_local_var = NULL; + OpenAPI_lnode_t *node = NULL; + cJSON *n32f_message_id = NULL; + cJSON *n32f_error_type = NULL; + OpenAPI_n32f_error_type_e n32f_error_typeVariable = 0; + cJSON *n32f_context_id = NULL; + cJSON *failed_modification_list = NULL; + OpenAPI_list_t *failed_modification_listList = NULL; + cJSON *error_details_list = NULL; + OpenAPI_list_t *error_details_listList = NULL; + n32f_message_id = cJSON_GetObjectItemCaseSensitive(n32f_error_infoJSON, "n32fMessageId"); + if (!n32f_message_id) { + ogs_error("OpenAPI_n32f_error_info_parseFromJSON() failed [n32f_message_id]"); + goto end; + } + if (!cJSON_IsString(n32f_message_id)) { + ogs_error("OpenAPI_n32f_error_info_parseFromJSON() failed [n32f_message_id]"); + goto end; + } + + n32f_error_type = cJSON_GetObjectItemCaseSensitive(n32f_error_infoJSON, "n32fErrorType"); + if (!n32f_error_type) { + ogs_error("OpenAPI_n32f_error_info_parseFromJSON() failed [n32f_error_type]"); + goto end; + } + if (!cJSON_IsString(n32f_error_type)) { + ogs_error("OpenAPI_n32f_error_info_parseFromJSON() failed [n32f_error_type]"); + goto end; + } + n32f_error_typeVariable = OpenAPI_n32f_error_type_FromString(n32f_error_type->valuestring); + + n32f_context_id = cJSON_GetObjectItemCaseSensitive(n32f_error_infoJSON, "n32fContextId"); + if (n32f_context_id) { + if (!cJSON_IsString(n32f_context_id) && !cJSON_IsNull(n32f_context_id)) { + ogs_error("OpenAPI_n32f_error_info_parseFromJSON() failed [n32f_context_id]"); + goto end; + } + } + + failed_modification_list = cJSON_GetObjectItemCaseSensitive(n32f_error_infoJSON, "failedModificationList"); + if (failed_modification_list) { + cJSON *failed_modification_list_local = NULL; + if (!cJSON_IsArray(failed_modification_list)) { + ogs_error("OpenAPI_n32f_error_info_parseFromJSON() failed [failed_modification_list]"); + goto end; + } + + failed_modification_listList = OpenAPI_list_create(); + + cJSON_ArrayForEach(failed_modification_list_local, failed_modification_list) { + if (!cJSON_IsObject(failed_modification_list_local)) { + ogs_error("OpenAPI_n32f_error_info_parseFromJSON() failed [failed_modification_list]"); + goto end; + } + OpenAPI_failed_modification_info_t *failed_modification_listItem = OpenAPI_failed_modification_info_parseFromJSON(failed_modification_list_local); + if (!failed_modification_listItem) { + ogs_error("No failed_modification_listItem"); + OpenAPI_list_free(failed_modification_listList); + goto end; + } + OpenAPI_list_add(failed_modification_listList, failed_modification_listItem); + } + } + + error_details_list = cJSON_GetObjectItemCaseSensitive(n32f_error_infoJSON, "errorDetailsList"); + if (error_details_list) { + cJSON *error_details_list_local = NULL; + if (!cJSON_IsArray(error_details_list)) { + ogs_error("OpenAPI_n32f_error_info_parseFromJSON() failed [error_details_list]"); + goto end; + } + + error_details_listList = OpenAPI_list_create(); + + cJSON_ArrayForEach(error_details_list_local, error_details_list) { + if (!cJSON_IsObject(error_details_list_local)) { + ogs_error("OpenAPI_n32f_error_info_parseFromJSON() failed [error_details_list]"); + goto end; + } + OpenAPI_n32f_error_detail_t *error_details_listItem = OpenAPI_n32f_error_detail_parseFromJSON(error_details_list_local); + if (!error_details_listItem) { + ogs_error("No error_details_listItem"); + OpenAPI_list_free(error_details_listList); + goto end; + } + OpenAPI_list_add(error_details_listList, error_details_listItem); + } + } + + n32f_error_info_local_var = OpenAPI_n32f_error_info_create ( + ogs_strdup(n32f_message_id->valuestring), + n32f_error_typeVariable, + n32f_context_id && !cJSON_IsNull(n32f_context_id) ? ogs_strdup(n32f_context_id->valuestring) : NULL, + failed_modification_list ? failed_modification_listList : NULL, + error_details_list ? error_details_listList : NULL + ); + + return n32f_error_info_local_var; +end: + if (failed_modification_listList) { + OpenAPI_list_for_each(failed_modification_listList, node) { + OpenAPI_failed_modification_info_free(node->data); + } + OpenAPI_list_free(failed_modification_listList); + failed_modification_listList = NULL; + } + if (error_details_listList) { + OpenAPI_list_for_each(error_details_listList, node) { + OpenAPI_n32f_error_detail_free(node->data); + } + OpenAPI_list_free(error_details_listList); + error_details_listList = NULL; + } + return NULL; +} + +OpenAPI_n32f_error_info_t *OpenAPI_n32f_error_info_copy(OpenAPI_n32f_error_info_t *dst, OpenAPI_n32f_error_info_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_n32f_error_info_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_n32f_error_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_n32f_error_info_free(dst); + dst = OpenAPI_n32f_error_info_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/n32f_error_info.h b/lib/sbi/openapi/model/n32f_error_info.h new file mode 100644 index 000000000..0ac5c0b33 --- /dev/null +++ b/lib/sbi/openapi/model/n32f_error_info.h @@ -0,0 +1,49 @@ +/* + * n32f_error_info.h + * + * N32-f error information + */ + +#ifndef _OpenAPI_n32f_error_info_H_ +#define _OpenAPI_n32f_error_info_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "failed_modification_info.h" +#include "n32f_error_detail.h" +#include "n32f_error_type.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_n32f_error_info_s OpenAPI_n32f_error_info_t; +typedef struct OpenAPI_n32f_error_info_s { + char *n32f_message_id; + OpenAPI_n32f_error_type_e n32f_error_type; + char *n32f_context_id; + OpenAPI_list_t *failed_modification_list; + OpenAPI_list_t *error_details_list; +} OpenAPI_n32f_error_info_t; + +OpenAPI_n32f_error_info_t *OpenAPI_n32f_error_info_create( + char *n32f_message_id, + OpenAPI_n32f_error_type_e n32f_error_type, + char *n32f_context_id, + OpenAPI_list_t *failed_modification_list, + OpenAPI_list_t *error_details_list +); +void OpenAPI_n32f_error_info_free(OpenAPI_n32f_error_info_t *n32f_error_info); +OpenAPI_n32f_error_info_t *OpenAPI_n32f_error_info_parseFromJSON(cJSON *n32f_error_infoJSON); +cJSON *OpenAPI_n32f_error_info_convertToJSON(OpenAPI_n32f_error_info_t *n32f_error_info); +OpenAPI_n32f_error_info_t *OpenAPI_n32f_error_info_copy(OpenAPI_n32f_error_info_t *dst, OpenAPI_n32f_error_info_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_n32f_error_info_H_ */ + diff --git a/lib/sbi/openapi/model/n32f_error_type.c b/lib/sbi/openapi/model/n32f_error_type.c new file mode 100644 index 000000000..91b69d3fc --- /dev/null +++ b/lib/sbi/openapi/model/n32f_error_type.c @@ -0,0 +1,30 @@ + +#include +#include +#include +#include "n32f_error_type.h" + +char* OpenAPI_n32f_error_type_ToString(OpenAPI_n32f_error_type_e n32f_error_type) +{ + const char *n32f_error_typeArray[] = { "NULL", "INTEGRITY_CHECK_FAILED", "INTEGRITY_CHECK_ON_MODIFICATIONS_FAILED", "MODIFICATIONS_INSTRUCTIONS_FAILED", "DECIPHERING_FAILED", "MESSAGE_RECONSTRUCTION_FAILED", "CONTEXT_NOT_FOUND", "INTEGRITY_KEY_EXPIRED", "ENCRYPTION_KEY_EXPIRED", "POLICY_MISMATCH" }; + size_t sizeofArray = sizeof(n32f_error_typeArray) / sizeof(n32f_error_typeArray[0]); + if (n32f_error_type < sizeofArray) + return (char *)n32f_error_typeArray[n32f_error_type]; + else + return (char *)"Unknown"; +} + +OpenAPI_n32f_error_type_e OpenAPI_n32f_error_type_FromString(char* n32f_error_type) +{ + int stringToReturn = 0; + const char *n32f_error_typeArray[] = { "NULL", "INTEGRITY_CHECK_FAILED", "INTEGRITY_CHECK_ON_MODIFICATIONS_FAILED", "MODIFICATIONS_INSTRUCTIONS_FAILED", "DECIPHERING_FAILED", "MESSAGE_RECONSTRUCTION_FAILED", "CONTEXT_NOT_FOUND", "INTEGRITY_KEY_EXPIRED", "ENCRYPTION_KEY_EXPIRED", "POLICY_MISMATCH" }; + size_t sizeofArray = sizeof(n32f_error_typeArray) / sizeof(n32f_error_typeArray[0]); + while (stringToReturn < sizeofArray) { + if (strcmp(n32f_error_type, n32f_error_typeArray[stringToReturn]) == 0) { + return stringToReturn; + } + stringToReturn++; + } + return 0; +} + diff --git a/lib/sbi/openapi/model/n32f_error_type.h b/lib/sbi/openapi/model/n32f_error_type.h new file mode 100644 index 000000000..8612080da --- /dev/null +++ b/lib/sbi/openapi/model/n32f_error_type.h @@ -0,0 +1,31 @@ +/* + * n32f_error_type.h + * + * + */ + +#ifndef _OpenAPI_n32f_error_type_H_ +#define _OpenAPI_n32f_error_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_n32f_error_type_NULL = 0, OpenAPI_n32f_error_type_INTEGRITY_CHECK_FAILED, OpenAPI_n32f_error_type_INTEGRITY_CHECK_ON_MODIFICATIONS_FAILED, OpenAPI_n32f_error_type_MODIFICATIONS_INSTRUCTIONS_FAILED, OpenAPI_n32f_error_type_DECIPHERING_FAILED, OpenAPI_n32f_error_type_MESSAGE_RECONSTRUCTION_FAILED, OpenAPI_n32f_error_type_CONTEXT_NOT_FOUND, OpenAPI_n32f_error_type_INTEGRITY_KEY_EXPIRED, OpenAPI_n32f_error_type_ENCRYPTION_KEY_EXPIRED, OpenAPI_n32f_error_type_POLICY_MISMATCH } OpenAPI_n32f_error_type_e; + +char* OpenAPI_n32f_error_type_ToString(OpenAPI_n32f_error_type_e n32f_error_type); + +OpenAPI_n32f_error_type_e OpenAPI_n32f_error_type_FromString(char* n32f_error_type); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_n32f_error_type_H_ */ + diff --git a/lib/sbi/openapi/model/n32f_error_type_any_of.c b/lib/sbi/openapi/model/n32f_error_type_any_of.c new file mode 100644 index 000000000..79dd67b03 --- /dev/null +++ b/lib/sbi/openapi/model/n32f_error_type_any_of.c @@ -0,0 +1,30 @@ + +#include +#include +#include +#include "n32f_error_type_any_of.h" + +char* OpenAPI_n32f_error_type_any_of_ToString(OpenAPI_n32f_error_type_any_of_e n32f_error_type_any_of) +{ + const char *n32f_error_type_any_ofArray[] = { "NULL", "INTEGRITY_CHECK_FAILED", "INTEGRITY_CHECK_ON_MODIFICATIONS_FAILED", "MODIFICATIONS_INSTRUCTIONS_FAILED", "DECIPHERING_FAILED", "MESSAGE_RECONSTRUCTION_FAILED", "CONTEXT_NOT_FOUND", "INTEGRITY_KEY_EXPIRED", "ENCRYPTION_KEY_EXPIRED", "POLICY_MISMATCH" }; + size_t sizeofArray = sizeof(n32f_error_type_any_ofArray) / sizeof(n32f_error_type_any_ofArray[0]); + if (n32f_error_type_any_of < sizeofArray) + return (char *)n32f_error_type_any_ofArray[n32f_error_type_any_of]; + else + return (char *)"Unknown"; +} + +OpenAPI_n32f_error_type_any_of_e OpenAPI_n32f_error_type_any_of_FromString(char* n32f_error_type_any_of) +{ + int stringToReturn = 0; + const char *n32f_error_type_any_ofArray[] = { "NULL", "INTEGRITY_CHECK_FAILED", "INTEGRITY_CHECK_ON_MODIFICATIONS_FAILED", "MODIFICATIONS_INSTRUCTIONS_FAILED", "DECIPHERING_FAILED", "MESSAGE_RECONSTRUCTION_FAILED", "CONTEXT_NOT_FOUND", "INTEGRITY_KEY_EXPIRED", "ENCRYPTION_KEY_EXPIRED", "POLICY_MISMATCH" }; + size_t sizeofArray = sizeof(n32f_error_type_any_ofArray) / sizeof(n32f_error_type_any_ofArray[0]); + while (stringToReturn < sizeofArray) { + if (strcmp(n32f_error_type_any_of, n32f_error_type_any_ofArray[stringToReturn]) == 0) { + return stringToReturn; + } + stringToReturn++; + } + return 0; +} + diff --git a/lib/sbi/openapi/model/n32f_error_type_any_of.h b/lib/sbi/openapi/model/n32f_error_type_any_of.h new file mode 100644 index 000000000..772cb7ac6 --- /dev/null +++ b/lib/sbi/openapi/model/n32f_error_type_any_of.h @@ -0,0 +1,31 @@ +/* + * n32f_error_type_any_of.h + * + * + */ + +#ifndef _OpenAPI_n32f_error_type_any_of_H_ +#define _OpenAPI_n32f_error_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_n32f_error_type_any_of_NULL = 0, OpenAPI_n32f_error_type_any_of_INTEGRITY_CHECK_FAILED, OpenAPI_n32f_error_type_any_of_INTEGRITY_CHECK_ON_MODIFICATIONS_FAILED, OpenAPI_n32f_error_type_any_of_MODIFICATIONS_INSTRUCTIONS_FAILED, OpenAPI_n32f_error_type_any_of_DECIPHERING_FAILED, OpenAPI_n32f_error_type_any_of_MESSAGE_RECONSTRUCTION_FAILED, OpenAPI_n32f_error_type_any_of_CONTEXT_NOT_FOUND, OpenAPI_n32f_error_type_any_of_INTEGRITY_KEY_EXPIRED, OpenAPI_n32f_error_type_any_of_ENCRYPTION_KEY_EXPIRED, OpenAPI_n32f_error_type_any_of_POLICY_MISMATCH } OpenAPI_n32f_error_type_any_of_e; + +char* OpenAPI_n32f_error_type_any_of_ToString(OpenAPI_n32f_error_type_any_of_e n32f_error_type_any_of); + +OpenAPI_n32f_error_type_any_of_e OpenAPI_n32f_error_type_any_of_FromString(char* n32f_error_type_any_of); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_n32f_error_type_any_of_H_ */ + diff --git a/lib/sbi/openapi/model/protection_policy.c b/lib/sbi/openapi/model/protection_policy.c new file mode 100644 index 000000000..0041084d3 --- /dev/null +++ b/lib/sbi/openapi/model/protection_policy.c @@ -0,0 +1,197 @@ + +#include +#include +#include +#include "protection_policy.h" + +OpenAPI_protection_policy_t *OpenAPI_protection_policy_create( + OpenAPI_list_t *api_ie_mapping_list, + OpenAPI_list_t *data_type_enc_policy +) +{ + OpenAPI_protection_policy_t *protection_policy_local_var = ogs_malloc(sizeof(OpenAPI_protection_policy_t)); + ogs_assert(protection_policy_local_var); + + protection_policy_local_var->api_ie_mapping_list = api_ie_mapping_list; + protection_policy_local_var->data_type_enc_policy = data_type_enc_policy; + + return protection_policy_local_var; +} + +void OpenAPI_protection_policy_free(OpenAPI_protection_policy_t *protection_policy) +{ + OpenAPI_lnode_t *node = NULL; + + if (NULL == protection_policy) { + return; + } + if (protection_policy->api_ie_mapping_list) { + OpenAPI_list_for_each(protection_policy->api_ie_mapping_list, node) { + OpenAPI_api_ie_mapping_free(node->data); + } + OpenAPI_list_free(protection_policy->api_ie_mapping_list); + protection_policy->api_ie_mapping_list = NULL; + } + if (protection_policy->data_type_enc_policy) { + OpenAPI_list_free(protection_policy->data_type_enc_policy); + protection_policy->data_type_enc_policy = NULL; + } + ogs_free(protection_policy); +} + +cJSON *OpenAPI_protection_policy_convertToJSON(OpenAPI_protection_policy_t *protection_policy) +{ + cJSON *item = NULL; + OpenAPI_lnode_t *node = NULL; + + if (protection_policy == NULL) { + ogs_error("OpenAPI_protection_policy_convertToJSON() failed [ProtectionPolicy]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (!protection_policy->api_ie_mapping_list) { + ogs_error("OpenAPI_protection_policy_convertToJSON() failed [api_ie_mapping_list]"); + return NULL; + } + cJSON *api_ie_mapping_listList = cJSON_AddArrayToObject(item, "apiIeMappingList"); + if (api_ie_mapping_listList == NULL) { + ogs_error("OpenAPI_protection_policy_convertToJSON() failed [api_ie_mapping_list]"); + goto end; + } + OpenAPI_list_for_each(protection_policy->api_ie_mapping_list, node) { + cJSON *itemLocal = OpenAPI_api_ie_mapping_convertToJSON(node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_protection_policy_convertToJSON() failed [api_ie_mapping_list]"); + goto end; + } + cJSON_AddItemToArray(api_ie_mapping_listList, itemLocal); + } + + if (protection_policy->data_type_enc_policy != OpenAPI_ie_type_NULL) { + cJSON *data_type_enc_policyList = cJSON_AddArrayToObject(item, "dataTypeEncPolicy"); + if (data_type_enc_policyList == NULL) { + ogs_error("OpenAPI_protection_policy_convertToJSON() failed [data_type_enc_policy]"); + goto end; + } + OpenAPI_list_for_each(protection_policy->data_type_enc_policy, node) { + if (cJSON_AddStringToObject(data_type_enc_policyList, "", OpenAPI_ie_type_ToString((intptr_t)node->data)) == NULL) { + ogs_error("OpenAPI_protection_policy_convertToJSON() failed [data_type_enc_policy]"); + goto end; + } + } + } + +end: + return item; +} + +OpenAPI_protection_policy_t *OpenAPI_protection_policy_parseFromJSON(cJSON *protection_policyJSON) +{ + OpenAPI_protection_policy_t *protection_policy_local_var = NULL; + OpenAPI_lnode_t *node = NULL; + cJSON *api_ie_mapping_list = NULL; + OpenAPI_list_t *api_ie_mapping_listList = NULL; + cJSON *data_type_enc_policy = NULL; + OpenAPI_list_t *data_type_enc_policyList = NULL; + api_ie_mapping_list = cJSON_GetObjectItemCaseSensitive(protection_policyJSON, "apiIeMappingList"); + if (!api_ie_mapping_list) { + ogs_error("OpenAPI_protection_policy_parseFromJSON() failed [api_ie_mapping_list]"); + goto end; + } + cJSON *api_ie_mapping_list_local = NULL; + if (!cJSON_IsArray(api_ie_mapping_list)) { + ogs_error("OpenAPI_protection_policy_parseFromJSON() failed [api_ie_mapping_list]"); + goto end; + } + + api_ie_mapping_listList = OpenAPI_list_create(); + + cJSON_ArrayForEach(api_ie_mapping_list_local, api_ie_mapping_list) { + if (!cJSON_IsObject(api_ie_mapping_list_local)) { + ogs_error("OpenAPI_protection_policy_parseFromJSON() failed [api_ie_mapping_list]"); + goto end; + } + OpenAPI_api_ie_mapping_t *api_ie_mapping_listItem = OpenAPI_api_ie_mapping_parseFromJSON(api_ie_mapping_list_local); + if (!api_ie_mapping_listItem) { + ogs_error("No api_ie_mapping_listItem"); + OpenAPI_list_free(api_ie_mapping_listList); + goto end; + } + OpenAPI_list_add(api_ie_mapping_listList, api_ie_mapping_listItem); + } + + data_type_enc_policy = cJSON_GetObjectItemCaseSensitive(protection_policyJSON, "dataTypeEncPolicy"); + if (data_type_enc_policy) { + cJSON *data_type_enc_policy_local = NULL; + if (!cJSON_IsArray(data_type_enc_policy)) { + ogs_error("OpenAPI_protection_policy_parseFromJSON() failed [data_type_enc_policy]"); + goto end; + } + + data_type_enc_policyList = OpenAPI_list_create(); + + cJSON_ArrayForEach(data_type_enc_policy_local, data_type_enc_policy) { + if (!cJSON_IsString(data_type_enc_policy_local)) { + ogs_error("OpenAPI_protection_policy_parseFromJSON() failed [data_type_enc_policy]"); + goto end; + } + OpenAPI_list_add(data_type_enc_policyList, (void *)OpenAPI_ie_type_FromString(data_type_enc_policy_local->valuestring)); + } + } + + protection_policy_local_var = OpenAPI_protection_policy_create ( + api_ie_mapping_listList, + data_type_enc_policy ? data_type_enc_policyList : NULL + ); + + return protection_policy_local_var; +end: + if (api_ie_mapping_listList) { + OpenAPI_list_for_each(api_ie_mapping_listList, node) { + OpenAPI_api_ie_mapping_free(node->data); + } + OpenAPI_list_free(api_ie_mapping_listList); + api_ie_mapping_listList = NULL; + } + if (data_type_enc_policyList) { + OpenAPI_list_free(data_type_enc_policyList); + data_type_enc_policyList = NULL; + } + return NULL; +} + +OpenAPI_protection_policy_t *OpenAPI_protection_policy_copy(OpenAPI_protection_policy_t *dst, OpenAPI_protection_policy_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_protection_policy_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_protection_policy_convertToJSON() failed"); + return NULL; + } + + content = cJSON_Print(item); + cJSON_Delete(item); + + if (!content) { + ogs_error("cJSON_Print() failed"); + return NULL; + } + + item = cJSON_Parse(content); + ogs_free(content); + if (!item) { + ogs_error("cJSON_Parse() failed"); + return NULL; + } + + OpenAPI_protection_policy_free(dst); + dst = OpenAPI_protection_policy_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/protection_policy.h b/lib/sbi/openapi/model/protection_policy.h new file mode 100644 index 000000000..01e094120 --- /dev/null +++ b/lib/sbi/openapi/model/protection_policy.h @@ -0,0 +1,42 @@ +/* + * protection_policy.h + * + * The protection policy to be negotiated between the SEPPs + */ + +#ifndef _OpenAPI_protection_policy_H_ +#define _OpenAPI_protection_policy_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "api_ie_mapping.h" +#include "ie_type.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_protection_policy_s OpenAPI_protection_policy_t; +typedef struct OpenAPI_protection_policy_s { + OpenAPI_list_t *api_ie_mapping_list; + OpenAPI_list_t *data_type_enc_policy; +} OpenAPI_protection_policy_t; + +OpenAPI_protection_policy_t *OpenAPI_protection_policy_create( + OpenAPI_list_t *api_ie_mapping_list, + OpenAPI_list_t *data_type_enc_policy +); +void OpenAPI_protection_policy_free(OpenAPI_protection_policy_t *protection_policy); +OpenAPI_protection_policy_t *OpenAPI_protection_policy_parseFromJSON(cJSON *protection_policyJSON); +cJSON *OpenAPI_protection_policy_convertToJSON(OpenAPI_protection_policy_t *protection_policy); +OpenAPI_protection_policy_t *OpenAPI_protection_policy_copy(OpenAPI_protection_policy_t *dst, OpenAPI_protection_policy_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_protection_policy_H_ */ + diff --git a/lib/sbi/openapi/model/sec_negotiate_req_data.c b/lib/sbi/openapi/model/sec_negotiate_req_data.c new file mode 100644 index 000000000..4c75d5ad0 --- /dev/null +++ b/lib/sbi/openapi/model/sec_negotiate_req_data.c @@ -0,0 +1,451 @@ + +#include +#include +#include +#include "sec_negotiate_req_data.h" + +OpenAPI_sec_negotiate_req_data_t *OpenAPI_sec_negotiate_req_data_create( + char *sender, + OpenAPI_list_t *supported_sec_capability_list, + bool is__3_gpp_sbi_target_api_root_supported, + int _3_gpp_sbi_target_api_root_supported, + OpenAPI_list_t *plmn_id_list, + OpenAPI_list_t *snpn_id_list, + OpenAPI_plmn_id_t *target_plmn_id, + OpenAPI_plmn_id_nid_t *target_snpn_id, + OpenAPI_list_t *intended_usage_purpose, + char *supported_features +) +{ + OpenAPI_sec_negotiate_req_data_t *sec_negotiate_req_data_local_var = ogs_malloc(sizeof(OpenAPI_sec_negotiate_req_data_t)); + ogs_assert(sec_negotiate_req_data_local_var); + + sec_negotiate_req_data_local_var->sender = sender; + sec_negotiate_req_data_local_var->supported_sec_capability_list = supported_sec_capability_list; + sec_negotiate_req_data_local_var->is__3_gpp_sbi_target_api_root_supported = is__3_gpp_sbi_target_api_root_supported; + sec_negotiate_req_data_local_var->_3_gpp_sbi_target_api_root_supported = _3_gpp_sbi_target_api_root_supported; + sec_negotiate_req_data_local_var->plmn_id_list = plmn_id_list; + sec_negotiate_req_data_local_var->snpn_id_list = snpn_id_list; + sec_negotiate_req_data_local_var->target_plmn_id = target_plmn_id; + sec_negotiate_req_data_local_var->target_snpn_id = target_snpn_id; + sec_negotiate_req_data_local_var->intended_usage_purpose = intended_usage_purpose; + sec_negotiate_req_data_local_var->supported_features = supported_features; + + return sec_negotiate_req_data_local_var; +} + +void OpenAPI_sec_negotiate_req_data_free(OpenAPI_sec_negotiate_req_data_t *sec_negotiate_req_data) +{ + OpenAPI_lnode_t *node = NULL; + + if (NULL == sec_negotiate_req_data) { + return; + } + if (sec_negotiate_req_data->sender) { + ogs_free(sec_negotiate_req_data->sender); + sec_negotiate_req_data->sender = NULL; + } + if (sec_negotiate_req_data->supported_sec_capability_list) { + OpenAPI_list_free(sec_negotiate_req_data->supported_sec_capability_list); + sec_negotiate_req_data->supported_sec_capability_list = NULL; + } + if (sec_negotiate_req_data->plmn_id_list) { + OpenAPI_list_for_each(sec_negotiate_req_data->plmn_id_list, node) { + OpenAPI_plmn_id_free(node->data); + } + OpenAPI_list_free(sec_negotiate_req_data->plmn_id_list); + sec_negotiate_req_data->plmn_id_list = NULL; + } + if (sec_negotiate_req_data->snpn_id_list) { + OpenAPI_list_for_each(sec_negotiate_req_data->snpn_id_list, node) { + OpenAPI_plmn_id_nid_free(node->data); + } + OpenAPI_list_free(sec_negotiate_req_data->snpn_id_list); + sec_negotiate_req_data->snpn_id_list = NULL; + } + if (sec_negotiate_req_data->target_plmn_id) { + OpenAPI_plmn_id_free(sec_negotiate_req_data->target_plmn_id); + sec_negotiate_req_data->target_plmn_id = NULL; + } + if (sec_negotiate_req_data->target_snpn_id) { + OpenAPI_plmn_id_nid_free(sec_negotiate_req_data->target_snpn_id); + sec_negotiate_req_data->target_snpn_id = NULL; + } + if (sec_negotiate_req_data->intended_usage_purpose) { + OpenAPI_list_for_each(sec_negotiate_req_data->intended_usage_purpose, node) { + OpenAPI_intended_n32_purpose_free(node->data); + } + OpenAPI_list_free(sec_negotiate_req_data->intended_usage_purpose); + sec_negotiate_req_data->intended_usage_purpose = NULL; + } + if (sec_negotiate_req_data->supported_features) { + ogs_free(sec_negotiate_req_data->supported_features); + sec_negotiate_req_data->supported_features = NULL; + } + ogs_free(sec_negotiate_req_data); +} + +cJSON *OpenAPI_sec_negotiate_req_data_convertToJSON(OpenAPI_sec_negotiate_req_data_t *sec_negotiate_req_data) +{ + cJSON *item = NULL; + OpenAPI_lnode_t *node = NULL; + + if (sec_negotiate_req_data == NULL) { + ogs_error("OpenAPI_sec_negotiate_req_data_convertToJSON() failed [SecNegotiateReqData]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (!sec_negotiate_req_data->sender) { + ogs_error("OpenAPI_sec_negotiate_req_data_convertToJSON() failed [sender]"); + return NULL; + } + if (cJSON_AddStringToObject(item, "sender", sec_negotiate_req_data->sender) == NULL) { + ogs_error("OpenAPI_sec_negotiate_req_data_convertToJSON() failed [sender]"); + goto end; + } + + if (sec_negotiate_req_data->supported_sec_capability_list == OpenAPI_security_capability_NULL) { + ogs_error("OpenAPI_sec_negotiate_req_data_convertToJSON() failed [supported_sec_capability_list]"); + return NULL; + } + cJSON *supported_sec_capability_listList = cJSON_AddArrayToObject(item, "supportedSecCapabilityList"); + if (supported_sec_capability_listList == NULL) { + ogs_error("OpenAPI_sec_negotiate_req_data_convertToJSON() failed [supported_sec_capability_list]"); + goto end; + } + OpenAPI_list_for_each(sec_negotiate_req_data->supported_sec_capability_list, node) { + if (cJSON_AddStringToObject(supported_sec_capability_listList, "", OpenAPI_security_capability_ToString((intptr_t)node->data)) == NULL) { + ogs_error("OpenAPI_sec_negotiate_req_data_convertToJSON() failed [supported_sec_capability_list]"); + goto end; + } + } + + if (sec_negotiate_req_data->is__3_gpp_sbi_target_api_root_supported) { + if (cJSON_AddBoolToObject(item, "3GppSbiTargetApiRootSupported", sec_negotiate_req_data->_3_gpp_sbi_target_api_root_supported) == NULL) { + ogs_error("OpenAPI_sec_negotiate_req_data_convertToJSON() failed [_3_gpp_sbi_target_api_root_supported]"); + goto end; + } + } + + if (sec_negotiate_req_data->plmn_id_list) { + cJSON *plmn_id_listList = cJSON_AddArrayToObject(item, "plmnIdList"); + if (plmn_id_listList == NULL) { + ogs_error("OpenAPI_sec_negotiate_req_data_convertToJSON() failed [plmn_id_list]"); + goto end; + } + OpenAPI_list_for_each(sec_negotiate_req_data->plmn_id_list, node) { + cJSON *itemLocal = OpenAPI_plmn_id_convertToJSON(node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_sec_negotiate_req_data_convertToJSON() failed [plmn_id_list]"); + goto end; + } + cJSON_AddItemToArray(plmn_id_listList, itemLocal); + } + } + + if (sec_negotiate_req_data->snpn_id_list) { + cJSON *snpn_id_listList = cJSON_AddArrayToObject(item, "snpnIdList"); + if (snpn_id_listList == NULL) { + ogs_error("OpenAPI_sec_negotiate_req_data_convertToJSON() failed [snpn_id_list]"); + goto end; + } + OpenAPI_list_for_each(sec_negotiate_req_data->snpn_id_list, node) { + cJSON *itemLocal = OpenAPI_plmn_id_nid_convertToJSON(node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_sec_negotiate_req_data_convertToJSON() failed [snpn_id_list]"); + goto end; + } + cJSON_AddItemToArray(snpn_id_listList, itemLocal); + } + } + + if (sec_negotiate_req_data->target_plmn_id) { + cJSON *target_plmn_id_local_JSON = OpenAPI_plmn_id_convertToJSON(sec_negotiate_req_data->target_plmn_id); + if (target_plmn_id_local_JSON == NULL) { + ogs_error("OpenAPI_sec_negotiate_req_data_convertToJSON() failed [target_plmn_id]"); + goto end; + } + cJSON_AddItemToObject(item, "targetPlmnId", target_plmn_id_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_sec_negotiate_req_data_convertToJSON() failed [target_plmn_id]"); + goto end; + } + } + + if (sec_negotiate_req_data->target_snpn_id) { + cJSON *target_snpn_id_local_JSON = OpenAPI_plmn_id_nid_convertToJSON(sec_negotiate_req_data->target_snpn_id); + if (target_snpn_id_local_JSON == NULL) { + ogs_error("OpenAPI_sec_negotiate_req_data_convertToJSON() failed [target_snpn_id]"); + goto end; + } + cJSON_AddItemToObject(item, "targetSnpnId", target_snpn_id_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_sec_negotiate_req_data_convertToJSON() failed [target_snpn_id]"); + goto end; + } + } + + if (sec_negotiate_req_data->intended_usage_purpose) { + cJSON *intended_usage_purposeList = cJSON_AddArrayToObject(item, "intendedUsagePurpose"); + if (intended_usage_purposeList == NULL) { + ogs_error("OpenAPI_sec_negotiate_req_data_convertToJSON() failed [intended_usage_purpose]"); + goto end; + } + OpenAPI_list_for_each(sec_negotiate_req_data->intended_usage_purpose, node) { + cJSON *itemLocal = OpenAPI_intended_n32_purpose_convertToJSON(node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_sec_negotiate_req_data_convertToJSON() failed [intended_usage_purpose]"); + goto end; + } + cJSON_AddItemToArray(intended_usage_purposeList, itemLocal); + } + } + + if (sec_negotiate_req_data->supported_features) { + if (cJSON_AddStringToObject(item, "supportedFeatures", sec_negotiate_req_data->supported_features) == NULL) { + ogs_error("OpenAPI_sec_negotiate_req_data_convertToJSON() failed [supported_features]"); + goto end; + } + } + +end: + return item; +} + +OpenAPI_sec_negotiate_req_data_t *OpenAPI_sec_negotiate_req_data_parseFromJSON(cJSON *sec_negotiate_req_dataJSON) +{ + OpenAPI_sec_negotiate_req_data_t *sec_negotiate_req_data_local_var = NULL; + OpenAPI_lnode_t *node = NULL; + cJSON *sender = NULL; + cJSON *supported_sec_capability_list = NULL; + OpenAPI_list_t *supported_sec_capability_listList = NULL; + cJSON *_3_gpp_sbi_target_api_root_supported = NULL; + cJSON *plmn_id_list = NULL; + OpenAPI_list_t *plmn_id_listList = NULL; + cJSON *snpn_id_list = NULL; + OpenAPI_list_t *snpn_id_listList = NULL; + cJSON *target_plmn_id = NULL; + OpenAPI_plmn_id_t *target_plmn_id_local_nonprim = NULL; + cJSON *target_snpn_id = NULL; + OpenAPI_plmn_id_nid_t *target_snpn_id_local_nonprim = NULL; + cJSON *intended_usage_purpose = NULL; + OpenAPI_list_t *intended_usage_purposeList = NULL; + cJSON *supported_features = NULL; + sender = cJSON_GetObjectItemCaseSensitive(sec_negotiate_req_dataJSON, "sender"); + if (!sender) { + ogs_error("OpenAPI_sec_negotiate_req_data_parseFromJSON() failed [sender]"); + goto end; + } + if (!cJSON_IsString(sender)) { + ogs_error("OpenAPI_sec_negotiate_req_data_parseFromJSON() failed [sender]"); + goto end; + } + + supported_sec_capability_list = cJSON_GetObjectItemCaseSensitive(sec_negotiate_req_dataJSON, "supportedSecCapabilityList"); + if (!supported_sec_capability_list) { + ogs_error("OpenAPI_sec_negotiate_req_data_parseFromJSON() failed [supported_sec_capability_list]"); + goto end; + } + cJSON *supported_sec_capability_list_local = NULL; + if (!cJSON_IsArray(supported_sec_capability_list)) { + ogs_error("OpenAPI_sec_negotiate_req_data_parseFromJSON() failed [supported_sec_capability_list]"); + goto end; + } + + supported_sec_capability_listList = OpenAPI_list_create(); + + cJSON_ArrayForEach(supported_sec_capability_list_local, supported_sec_capability_list) { + if (!cJSON_IsString(supported_sec_capability_list_local)) { + ogs_error("OpenAPI_sec_negotiate_req_data_parseFromJSON() failed [supported_sec_capability_list]"); + goto end; + } + OpenAPI_list_add(supported_sec_capability_listList, (void *)OpenAPI_security_capability_FromString(supported_sec_capability_list_local->valuestring)); + } + + _3_gpp_sbi_target_api_root_supported = cJSON_GetObjectItemCaseSensitive(sec_negotiate_req_dataJSON, "3GppSbiTargetApiRootSupported"); + if (_3_gpp_sbi_target_api_root_supported) { + if (!cJSON_IsBool(_3_gpp_sbi_target_api_root_supported)) { + ogs_error("OpenAPI_sec_negotiate_req_data_parseFromJSON() failed [_3_gpp_sbi_target_api_root_supported]"); + goto end; + } + } + + plmn_id_list = cJSON_GetObjectItemCaseSensitive(sec_negotiate_req_dataJSON, "plmnIdList"); + if (plmn_id_list) { + cJSON *plmn_id_list_local = NULL; + if (!cJSON_IsArray(plmn_id_list)) { + ogs_error("OpenAPI_sec_negotiate_req_data_parseFromJSON() failed [plmn_id_list]"); + goto end; + } + + plmn_id_listList = OpenAPI_list_create(); + + cJSON_ArrayForEach(plmn_id_list_local, plmn_id_list) { + if (!cJSON_IsObject(plmn_id_list_local)) { + ogs_error("OpenAPI_sec_negotiate_req_data_parseFromJSON() failed [plmn_id_list]"); + goto end; + } + OpenAPI_plmn_id_t *plmn_id_listItem = OpenAPI_plmn_id_parseFromJSON(plmn_id_list_local); + if (!plmn_id_listItem) { + ogs_error("No plmn_id_listItem"); + OpenAPI_list_free(plmn_id_listList); + goto end; + } + OpenAPI_list_add(plmn_id_listList, plmn_id_listItem); + } + } + + snpn_id_list = cJSON_GetObjectItemCaseSensitive(sec_negotiate_req_dataJSON, "snpnIdList"); + if (snpn_id_list) { + cJSON *snpn_id_list_local = NULL; + if (!cJSON_IsArray(snpn_id_list)) { + ogs_error("OpenAPI_sec_negotiate_req_data_parseFromJSON() failed [snpn_id_list]"); + goto end; + } + + snpn_id_listList = OpenAPI_list_create(); + + cJSON_ArrayForEach(snpn_id_list_local, snpn_id_list) { + if (!cJSON_IsObject(snpn_id_list_local)) { + ogs_error("OpenAPI_sec_negotiate_req_data_parseFromJSON() failed [snpn_id_list]"); + goto end; + } + OpenAPI_plmn_id_nid_t *snpn_id_listItem = OpenAPI_plmn_id_nid_parseFromJSON(snpn_id_list_local); + if (!snpn_id_listItem) { + ogs_error("No snpn_id_listItem"); + OpenAPI_list_free(snpn_id_listList); + goto end; + } + OpenAPI_list_add(snpn_id_listList, snpn_id_listItem); + } + } + + target_plmn_id = cJSON_GetObjectItemCaseSensitive(sec_negotiate_req_dataJSON, "targetPlmnId"); + if (target_plmn_id) { + target_plmn_id_local_nonprim = OpenAPI_plmn_id_parseFromJSON(target_plmn_id); + } + + target_snpn_id = cJSON_GetObjectItemCaseSensitive(sec_negotiate_req_dataJSON, "targetSnpnId"); + if (target_snpn_id) { + target_snpn_id_local_nonprim = OpenAPI_plmn_id_nid_parseFromJSON(target_snpn_id); + } + + intended_usage_purpose = cJSON_GetObjectItemCaseSensitive(sec_negotiate_req_dataJSON, "intendedUsagePurpose"); + if (intended_usage_purpose) { + cJSON *intended_usage_purpose_local = NULL; + if (!cJSON_IsArray(intended_usage_purpose)) { + ogs_error("OpenAPI_sec_negotiate_req_data_parseFromJSON() failed [intended_usage_purpose]"); + goto end; + } + + intended_usage_purposeList = OpenAPI_list_create(); + + cJSON_ArrayForEach(intended_usage_purpose_local, intended_usage_purpose) { + if (!cJSON_IsObject(intended_usage_purpose_local)) { + ogs_error("OpenAPI_sec_negotiate_req_data_parseFromJSON() failed [intended_usage_purpose]"); + goto end; + } + OpenAPI_intended_n32_purpose_t *intended_usage_purposeItem = OpenAPI_intended_n32_purpose_parseFromJSON(intended_usage_purpose_local); + if (!intended_usage_purposeItem) { + ogs_error("No intended_usage_purposeItem"); + OpenAPI_list_free(intended_usage_purposeList); + goto end; + } + OpenAPI_list_add(intended_usage_purposeList, intended_usage_purposeItem); + } + } + + supported_features = cJSON_GetObjectItemCaseSensitive(sec_negotiate_req_dataJSON, "supportedFeatures"); + if (supported_features) { + if (!cJSON_IsString(supported_features) && !cJSON_IsNull(supported_features)) { + ogs_error("OpenAPI_sec_negotiate_req_data_parseFromJSON() failed [supported_features]"); + goto end; + } + } + + sec_negotiate_req_data_local_var = OpenAPI_sec_negotiate_req_data_create ( + ogs_strdup(sender->valuestring), + supported_sec_capability_listList, + _3_gpp_sbi_target_api_root_supported ? true : false, + _3_gpp_sbi_target_api_root_supported ? _3_gpp_sbi_target_api_root_supported->valueint : 0, + plmn_id_list ? plmn_id_listList : NULL, + snpn_id_list ? snpn_id_listList : NULL, + target_plmn_id ? target_plmn_id_local_nonprim : NULL, + target_snpn_id ? target_snpn_id_local_nonprim : NULL, + intended_usage_purpose ? intended_usage_purposeList : NULL, + supported_features && !cJSON_IsNull(supported_features) ? ogs_strdup(supported_features->valuestring) : NULL + ); + + return sec_negotiate_req_data_local_var; +end: + if (supported_sec_capability_listList) { + OpenAPI_list_free(supported_sec_capability_listList); + supported_sec_capability_listList = NULL; + } + if (plmn_id_listList) { + OpenAPI_list_for_each(plmn_id_listList, node) { + OpenAPI_plmn_id_free(node->data); + } + OpenAPI_list_free(plmn_id_listList); + plmn_id_listList = NULL; + } + if (snpn_id_listList) { + OpenAPI_list_for_each(snpn_id_listList, node) { + OpenAPI_plmn_id_nid_free(node->data); + } + OpenAPI_list_free(snpn_id_listList); + snpn_id_listList = NULL; + } + if (target_plmn_id_local_nonprim) { + OpenAPI_plmn_id_free(target_plmn_id_local_nonprim); + target_plmn_id_local_nonprim = NULL; + } + if (target_snpn_id_local_nonprim) { + OpenAPI_plmn_id_nid_free(target_snpn_id_local_nonprim); + target_snpn_id_local_nonprim = NULL; + } + if (intended_usage_purposeList) { + OpenAPI_list_for_each(intended_usage_purposeList, node) { + OpenAPI_intended_n32_purpose_free(node->data); + } + OpenAPI_list_free(intended_usage_purposeList); + intended_usage_purposeList = NULL; + } + return NULL; +} + +OpenAPI_sec_negotiate_req_data_t *OpenAPI_sec_negotiate_req_data_copy(OpenAPI_sec_negotiate_req_data_t *dst, OpenAPI_sec_negotiate_req_data_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_sec_negotiate_req_data_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_sec_negotiate_req_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_sec_negotiate_req_data_free(dst); + dst = OpenAPI_sec_negotiate_req_data_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/sec_negotiate_req_data.h b/lib/sbi/openapi/model/sec_negotiate_req_data.h new file mode 100644 index 000000000..b20bfd5c8 --- /dev/null +++ b/lib/sbi/openapi/model/sec_negotiate_req_data.h @@ -0,0 +1,60 @@ +/* + * sec_negotiate_req_data.h + * + * Defines the security capabilities of a SEPP sent to a receiving SEPP + */ + +#ifndef _OpenAPI_sec_negotiate_req_data_H_ +#define _OpenAPI_sec_negotiate_req_data_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "intended_n32_purpose.h" +#include "plmn_id.h" +#include "plmn_id_nid.h" +#include "security_capability.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_sec_negotiate_req_data_s OpenAPI_sec_negotiate_req_data_t; +typedef struct OpenAPI_sec_negotiate_req_data_s { + char *sender; + OpenAPI_list_t *supported_sec_capability_list; + bool is__3_gpp_sbi_target_api_root_supported; + int _3_gpp_sbi_target_api_root_supported; + OpenAPI_list_t *plmn_id_list; + OpenAPI_list_t *snpn_id_list; + struct OpenAPI_plmn_id_s *target_plmn_id; + struct OpenAPI_plmn_id_nid_s *target_snpn_id; + OpenAPI_list_t *intended_usage_purpose; + char *supported_features; +} OpenAPI_sec_negotiate_req_data_t; + +OpenAPI_sec_negotiate_req_data_t *OpenAPI_sec_negotiate_req_data_create( + char *sender, + OpenAPI_list_t *supported_sec_capability_list, + bool is__3_gpp_sbi_target_api_root_supported, + int _3_gpp_sbi_target_api_root_supported, + OpenAPI_list_t *plmn_id_list, + OpenAPI_list_t *snpn_id_list, + OpenAPI_plmn_id_t *target_plmn_id, + OpenAPI_plmn_id_nid_t *target_snpn_id, + OpenAPI_list_t *intended_usage_purpose, + char *supported_features +); +void OpenAPI_sec_negotiate_req_data_free(OpenAPI_sec_negotiate_req_data_t *sec_negotiate_req_data); +OpenAPI_sec_negotiate_req_data_t *OpenAPI_sec_negotiate_req_data_parseFromJSON(cJSON *sec_negotiate_req_dataJSON); +cJSON *OpenAPI_sec_negotiate_req_data_convertToJSON(OpenAPI_sec_negotiate_req_data_t *sec_negotiate_req_data); +OpenAPI_sec_negotiate_req_data_t *OpenAPI_sec_negotiate_req_data_copy(OpenAPI_sec_negotiate_req_data_t *dst, OpenAPI_sec_negotiate_req_data_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_sec_negotiate_req_data_H_ */ + diff --git a/lib/sbi/openapi/model/sec_negotiate_rsp_data.c b/lib/sbi/openapi/model/sec_negotiate_rsp_data.c new file mode 100644 index 000000000..0ee1a5e81 --- /dev/null +++ b/lib/sbi/openapi/model/sec_negotiate_rsp_data.c @@ -0,0 +1,424 @@ + +#include +#include +#include +#include "sec_negotiate_rsp_data.h" + +OpenAPI_sec_negotiate_rsp_data_t *OpenAPI_sec_negotiate_rsp_data_create( + char *sender, + OpenAPI_security_capability_e selected_sec_capability, + bool is__3_gpp_sbi_target_api_root_supported, + int _3_gpp_sbi_target_api_root_supported, + OpenAPI_list_t *plmn_id_list, + OpenAPI_list_t *snpn_id_list, + OpenAPI_list_t *allowed_usage_purpose, + OpenAPI_list_t *rejected_usage_purpose, + char *supported_features +) +{ + OpenAPI_sec_negotiate_rsp_data_t *sec_negotiate_rsp_data_local_var = ogs_malloc(sizeof(OpenAPI_sec_negotiate_rsp_data_t)); + ogs_assert(sec_negotiate_rsp_data_local_var); + + sec_negotiate_rsp_data_local_var->sender = sender; + sec_negotiate_rsp_data_local_var->selected_sec_capability = selected_sec_capability; + sec_negotiate_rsp_data_local_var->is__3_gpp_sbi_target_api_root_supported = is__3_gpp_sbi_target_api_root_supported; + sec_negotiate_rsp_data_local_var->_3_gpp_sbi_target_api_root_supported = _3_gpp_sbi_target_api_root_supported; + sec_negotiate_rsp_data_local_var->plmn_id_list = plmn_id_list; + sec_negotiate_rsp_data_local_var->snpn_id_list = snpn_id_list; + sec_negotiate_rsp_data_local_var->allowed_usage_purpose = allowed_usage_purpose; + sec_negotiate_rsp_data_local_var->rejected_usage_purpose = rejected_usage_purpose; + sec_negotiate_rsp_data_local_var->supported_features = supported_features; + + return sec_negotiate_rsp_data_local_var; +} + +void OpenAPI_sec_negotiate_rsp_data_free(OpenAPI_sec_negotiate_rsp_data_t *sec_negotiate_rsp_data) +{ + OpenAPI_lnode_t *node = NULL; + + if (NULL == sec_negotiate_rsp_data) { + return; + } + if (sec_negotiate_rsp_data->sender) { + ogs_free(sec_negotiate_rsp_data->sender); + sec_negotiate_rsp_data->sender = NULL; + } + if (sec_negotiate_rsp_data->plmn_id_list) { + OpenAPI_list_for_each(sec_negotiate_rsp_data->plmn_id_list, node) { + OpenAPI_plmn_id_free(node->data); + } + OpenAPI_list_free(sec_negotiate_rsp_data->plmn_id_list); + sec_negotiate_rsp_data->plmn_id_list = NULL; + } + if (sec_negotiate_rsp_data->snpn_id_list) { + OpenAPI_list_for_each(sec_negotiate_rsp_data->snpn_id_list, node) { + OpenAPI_plmn_id_nid_free(node->data); + } + OpenAPI_list_free(sec_negotiate_rsp_data->snpn_id_list); + sec_negotiate_rsp_data->snpn_id_list = NULL; + } + if (sec_negotiate_rsp_data->allowed_usage_purpose) { + OpenAPI_list_for_each(sec_negotiate_rsp_data->allowed_usage_purpose, node) { + OpenAPI_intended_n32_purpose_free(node->data); + } + OpenAPI_list_free(sec_negotiate_rsp_data->allowed_usage_purpose); + sec_negotiate_rsp_data->allowed_usage_purpose = NULL; + } + if (sec_negotiate_rsp_data->rejected_usage_purpose) { + OpenAPI_list_for_each(sec_negotiate_rsp_data->rejected_usage_purpose, node) { + OpenAPI_intended_n32_purpose_free(node->data); + } + OpenAPI_list_free(sec_negotiate_rsp_data->rejected_usage_purpose); + sec_negotiate_rsp_data->rejected_usage_purpose = NULL; + } + if (sec_negotiate_rsp_data->supported_features) { + ogs_free(sec_negotiate_rsp_data->supported_features); + sec_negotiate_rsp_data->supported_features = NULL; + } + ogs_free(sec_negotiate_rsp_data); +} + +cJSON *OpenAPI_sec_negotiate_rsp_data_convertToJSON(OpenAPI_sec_negotiate_rsp_data_t *sec_negotiate_rsp_data) +{ + cJSON *item = NULL; + OpenAPI_lnode_t *node = NULL; + + if (sec_negotiate_rsp_data == NULL) { + ogs_error("OpenAPI_sec_negotiate_rsp_data_convertToJSON() failed [SecNegotiateRspData]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (!sec_negotiate_rsp_data->sender) { + ogs_error("OpenAPI_sec_negotiate_rsp_data_convertToJSON() failed [sender]"); + return NULL; + } + if (cJSON_AddStringToObject(item, "sender", sec_negotiate_rsp_data->sender) == NULL) { + ogs_error("OpenAPI_sec_negotiate_rsp_data_convertToJSON() failed [sender]"); + goto end; + } + + if (sec_negotiate_rsp_data->selected_sec_capability == OpenAPI_security_capability_NULL) { + ogs_error("OpenAPI_sec_negotiate_rsp_data_convertToJSON() failed [selected_sec_capability]"); + return NULL; + } + if (cJSON_AddStringToObject(item, "selectedSecCapability", OpenAPI_security_capability_ToString(sec_negotiate_rsp_data->selected_sec_capability)) == NULL) { + ogs_error("OpenAPI_sec_negotiate_rsp_data_convertToJSON() failed [selected_sec_capability]"); + goto end; + } + + if (sec_negotiate_rsp_data->is__3_gpp_sbi_target_api_root_supported) { + if (cJSON_AddBoolToObject(item, "3GppSbiTargetApiRootSupported", sec_negotiate_rsp_data->_3_gpp_sbi_target_api_root_supported) == NULL) { + ogs_error("OpenAPI_sec_negotiate_rsp_data_convertToJSON() failed [_3_gpp_sbi_target_api_root_supported]"); + goto end; + } + } + + if (sec_negotiate_rsp_data->plmn_id_list) { + cJSON *plmn_id_listList = cJSON_AddArrayToObject(item, "plmnIdList"); + if (plmn_id_listList == NULL) { + ogs_error("OpenAPI_sec_negotiate_rsp_data_convertToJSON() failed [plmn_id_list]"); + goto end; + } + OpenAPI_list_for_each(sec_negotiate_rsp_data->plmn_id_list, node) { + cJSON *itemLocal = OpenAPI_plmn_id_convertToJSON(node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_sec_negotiate_rsp_data_convertToJSON() failed [plmn_id_list]"); + goto end; + } + cJSON_AddItemToArray(plmn_id_listList, itemLocal); + } + } + + if (sec_negotiate_rsp_data->snpn_id_list) { + cJSON *snpn_id_listList = cJSON_AddArrayToObject(item, "snpnIdList"); + if (snpn_id_listList == NULL) { + ogs_error("OpenAPI_sec_negotiate_rsp_data_convertToJSON() failed [snpn_id_list]"); + goto end; + } + OpenAPI_list_for_each(sec_negotiate_rsp_data->snpn_id_list, node) { + cJSON *itemLocal = OpenAPI_plmn_id_nid_convertToJSON(node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_sec_negotiate_rsp_data_convertToJSON() failed [snpn_id_list]"); + goto end; + } + cJSON_AddItemToArray(snpn_id_listList, itemLocal); + } + } + + if (sec_negotiate_rsp_data->allowed_usage_purpose) { + cJSON *allowed_usage_purposeList = cJSON_AddArrayToObject(item, "allowedUsagePurpose"); + if (allowed_usage_purposeList == NULL) { + ogs_error("OpenAPI_sec_negotiate_rsp_data_convertToJSON() failed [allowed_usage_purpose]"); + goto end; + } + OpenAPI_list_for_each(sec_negotiate_rsp_data->allowed_usage_purpose, node) { + cJSON *itemLocal = OpenAPI_intended_n32_purpose_convertToJSON(node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_sec_negotiate_rsp_data_convertToJSON() failed [allowed_usage_purpose]"); + goto end; + } + cJSON_AddItemToArray(allowed_usage_purposeList, itemLocal); + } + } + + if (sec_negotiate_rsp_data->rejected_usage_purpose) { + cJSON *rejected_usage_purposeList = cJSON_AddArrayToObject(item, "rejectedUsagePurpose"); + if (rejected_usage_purposeList == NULL) { + ogs_error("OpenAPI_sec_negotiate_rsp_data_convertToJSON() failed [rejected_usage_purpose]"); + goto end; + } + OpenAPI_list_for_each(sec_negotiate_rsp_data->rejected_usage_purpose, node) { + cJSON *itemLocal = OpenAPI_intended_n32_purpose_convertToJSON(node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_sec_negotiate_rsp_data_convertToJSON() failed [rejected_usage_purpose]"); + goto end; + } + cJSON_AddItemToArray(rejected_usage_purposeList, itemLocal); + } + } + + if (sec_negotiate_rsp_data->supported_features) { + if (cJSON_AddStringToObject(item, "supportedFeatures", sec_negotiate_rsp_data->supported_features) == NULL) { + ogs_error("OpenAPI_sec_negotiate_rsp_data_convertToJSON() failed [supported_features]"); + goto end; + } + } + +end: + return item; +} + +OpenAPI_sec_negotiate_rsp_data_t *OpenAPI_sec_negotiate_rsp_data_parseFromJSON(cJSON *sec_negotiate_rsp_dataJSON) +{ + OpenAPI_sec_negotiate_rsp_data_t *sec_negotiate_rsp_data_local_var = NULL; + OpenAPI_lnode_t *node = NULL; + cJSON *sender = NULL; + cJSON *selected_sec_capability = NULL; + OpenAPI_security_capability_e selected_sec_capabilityVariable = 0; + cJSON *_3_gpp_sbi_target_api_root_supported = NULL; + cJSON *plmn_id_list = NULL; + OpenAPI_list_t *plmn_id_listList = NULL; + cJSON *snpn_id_list = NULL; + OpenAPI_list_t *snpn_id_listList = NULL; + cJSON *allowed_usage_purpose = NULL; + OpenAPI_list_t *allowed_usage_purposeList = NULL; + cJSON *rejected_usage_purpose = NULL; + OpenAPI_list_t *rejected_usage_purposeList = NULL; + cJSON *supported_features = NULL; + sender = cJSON_GetObjectItemCaseSensitive(sec_negotiate_rsp_dataJSON, "sender"); + if (!sender) { + ogs_error("OpenAPI_sec_negotiate_rsp_data_parseFromJSON() failed [sender]"); + goto end; + } + if (!cJSON_IsString(sender)) { + ogs_error("OpenAPI_sec_negotiate_rsp_data_parseFromJSON() failed [sender]"); + goto end; + } + + selected_sec_capability = cJSON_GetObjectItemCaseSensitive(sec_negotiate_rsp_dataJSON, "selectedSecCapability"); + if (!selected_sec_capability) { + ogs_error("OpenAPI_sec_negotiate_rsp_data_parseFromJSON() failed [selected_sec_capability]"); + goto end; + } + if (!cJSON_IsString(selected_sec_capability)) { + ogs_error("OpenAPI_sec_negotiate_rsp_data_parseFromJSON() failed [selected_sec_capability]"); + goto end; + } + selected_sec_capabilityVariable = OpenAPI_security_capability_FromString(selected_sec_capability->valuestring); + + _3_gpp_sbi_target_api_root_supported = cJSON_GetObjectItemCaseSensitive(sec_negotiate_rsp_dataJSON, "3GppSbiTargetApiRootSupported"); + if (_3_gpp_sbi_target_api_root_supported) { + if (!cJSON_IsBool(_3_gpp_sbi_target_api_root_supported)) { + ogs_error("OpenAPI_sec_negotiate_rsp_data_parseFromJSON() failed [_3_gpp_sbi_target_api_root_supported]"); + goto end; + } + } + + plmn_id_list = cJSON_GetObjectItemCaseSensitive(sec_negotiate_rsp_dataJSON, "plmnIdList"); + if (plmn_id_list) { + cJSON *plmn_id_list_local = NULL; + if (!cJSON_IsArray(plmn_id_list)) { + ogs_error("OpenAPI_sec_negotiate_rsp_data_parseFromJSON() failed [plmn_id_list]"); + goto end; + } + + plmn_id_listList = OpenAPI_list_create(); + + cJSON_ArrayForEach(plmn_id_list_local, plmn_id_list) { + if (!cJSON_IsObject(plmn_id_list_local)) { + ogs_error("OpenAPI_sec_negotiate_rsp_data_parseFromJSON() failed [plmn_id_list]"); + goto end; + } + OpenAPI_plmn_id_t *plmn_id_listItem = OpenAPI_plmn_id_parseFromJSON(plmn_id_list_local); + if (!plmn_id_listItem) { + ogs_error("No plmn_id_listItem"); + OpenAPI_list_free(plmn_id_listList); + goto end; + } + OpenAPI_list_add(plmn_id_listList, plmn_id_listItem); + } + } + + snpn_id_list = cJSON_GetObjectItemCaseSensitive(sec_negotiate_rsp_dataJSON, "snpnIdList"); + if (snpn_id_list) { + cJSON *snpn_id_list_local = NULL; + if (!cJSON_IsArray(snpn_id_list)) { + ogs_error("OpenAPI_sec_negotiate_rsp_data_parseFromJSON() failed [snpn_id_list]"); + goto end; + } + + snpn_id_listList = OpenAPI_list_create(); + + cJSON_ArrayForEach(snpn_id_list_local, snpn_id_list) { + if (!cJSON_IsObject(snpn_id_list_local)) { + ogs_error("OpenAPI_sec_negotiate_rsp_data_parseFromJSON() failed [snpn_id_list]"); + goto end; + } + OpenAPI_plmn_id_nid_t *snpn_id_listItem = OpenAPI_plmn_id_nid_parseFromJSON(snpn_id_list_local); + if (!snpn_id_listItem) { + ogs_error("No snpn_id_listItem"); + OpenAPI_list_free(snpn_id_listList); + goto end; + } + OpenAPI_list_add(snpn_id_listList, snpn_id_listItem); + } + } + + allowed_usage_purpose = cJSON_GetObjectItemCaseSensitive(sec_negotiate_rsp_dataJSON, "allowedUsagePurpose"); + if (allowed_usage_purpose) { + cJSON *allowed_usage_purpose_local = NULL; + if (!cJSON_IsArray(allowed_usage_purpose)) { + ogs_error("OpenAPI_sec_negotiate_rsp_data_parseFromJSON() failed [allowed_usage_purpose]"); + goto end; + } + + allowed_usage_purposeList = OpenAPI_list_create(); + + cJSON_ArrayForEach(allowed_usage_purpose_local, allowed_usage_purpose) { + if (!cJSON_IsObject(allowed_usage_purpose_local)) { + ogs_error("OpenAPI_sec_negotiate_rsp_data_parseFromJSON() failed [allowed_usage_purpose]"); + goto end; + } + OpenAPI_intended_n32_purpose_t *allowed_usage_purposeItem = OpenAPI_intended_n32_purpose_parseFromJSON(allowed_usage_purpose_local); + if (!allowed_usage_purposeItem) { + ogs_error("No allowed_usage_purposeItem"); + OpenAPI_list_free(allowed_usage_purposeList); + goto end; + } + OpenAPI_list_add(allowed_usage_purposeList, allowed_usage_purposeItem); + } + } + + rejected_usage_purpose = cJSON_GetObjectItemCaseSensitive(sec_negotiate_rsp_dataJSON, "rejectedUsagePurpose"); + if (rejected_usage_purpose) { + cJSON *rejected_usage_purpose_local = NULL; + if (!cJSON_IsArray(rejected_usage_purpose)) { + ogs_error("OpenAPI_sec_negotiate_rsp_data_parseFromJSON() failed [rejected_usage_purpose]"); + goto end; + } + + rejected_usage_purposeList = OpenAPI_list_create(); + + cJSON_ArrayForEach(rejected_usage_purpose_local, rejected_usage_purpose) { + if (!cJSON_IsObject(rejected_usage_purpose_local)) { + ogs_error("OpenAPI_sec_negotiate_rsp_data_parseFromJSON() failed [rejected_usage_purpose]"); + goto end; + } + OpenAPI_intended_n32_purpose_t *rejected_usage_purposeItem = OpenAPI_intended_n32_purpose_parseFromJSON(rejected_usage_purpose_local); + if (!rejected_usage_purposeItem) { + ogs_error("No rejected_usage_purposeItem"); + OpenAPI_list_free(rejected_usage_purposeList); + goto end; + } + OpenAPI_list_add(rejected_usage_purposeList, rejected_usage_purposeItem); + } + } + + supported_features = cJSON_GetObjectItemCaseSensitive(sec_negotiate_rsp_dataJSON, "supportedFeatures"); + if (supported_features) { + if (!cJSON_IsString(supported_features) && !cJSON_IsNull(supported_features)) { + ogs_error("OpenAPI_sec_negotiate_rsp_data_parseFromJSON() failed [supported_features]"); + goto end; + } + } + + sec_negotiate_rsp_data_local_var = OpenAPI_sec_negotiate_rsp_data_create ( + ogs_strdup(sender->valuestring), + selected_sec_capabilityVariable, + _3_gpp_sbi_target_api_root_supported ? true : false, + _3_gpp_sbi_target_api_root_supported ? _3_gpp_sbi_target_api_root_supported->valueint : 0, + plmn_id_list ? plmn_id_listList : NULL, + snpn_id_list ? snpn_id_listList : NULL, + allowed_usage_purpose ? allowed_usage_purposeList : NULL, + rejected_usage_purpose ? rejected_usage_purposeList : NULL, + supported_features && !cJSON_IsNull(supported_features) ? ogs_strdup(supported_features->valuestring) : NULL + ); + + return sec_negotiate_rsp_data_local_var; +end: + if (plmn_id_listList) { + OpenAPI_list_for_each(plmn_id_listList, node) { + OpenAPI_plmn_id_free(node->data); + } + OpenAPI_list_free(plmn_id_listList); + plmn_id_listList = NULL; + } + if (snpn_id_listList) { + OpenAPI_list_for_each(snpn_id_listList, node) { + OpenAPI_plmn_id_nid_free(node->data); + } + OpenAPI_list_free(snpn_id_listList); + snpn_id_listList = NULL; + } + if (allowed_usage_purposeList) { + OpenAPI_list_for_each(allowed_usage_purposeList, node) { + OpenAPI_intended_n32_purpose_free(node->data); + } + OpenAPI_list_free(allowed_usage_purposeList); + allowed_usage_purposeList = NULL; + } + if (rejected_usage_purposeList) { + OpenAPI_list_for_each(rejected_usage_purposeList, node) { + OpenAPI_intended_n32_purpose_free(node->data); + } + OpenAPI_list_free(rejected_usage_purposeList); + rejected_usage_purposeList = NULL; + } + return NULL; +} + +OpenAPI_sec_negotiate_rsp_data_t *OpenAPI_sec_negotiate_rsp_data_copy(OpenAPI_sec_negotiate_rsp_data_t *dst, OpenAPI_sec_negotiate_rsp_data_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_sec_negotiate_rsp_data_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_sec_negotiate_rsp_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_sec_negotiate_rsp_data_free(dst); + dst = OpenAPI_sec_negotiate_rsp_data_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/sec_negotiate_rsp_data.h b/lib/sbi/openapi/model/sec_negotiate_rsp_data.h new file mode 100644 index 000000000..8cab6bf7f --- /dev/null +++ b/lib/sbi/openapi/model/sec_negotiate_rsp_data.h @@ -0,0 +1,58 @@ +/* + * sec_negotiate_rsp_data.h + * + * Defines the selected security capabilities by a SEPP + */ + +#ifndef _OpenAPI_sec_negotiate_rsp_data_H_ +#define _OpenAPI_sec_negotiate_rsp_data_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "intended_n32_purpose.h" +#include "plmn_id.h" +#include "plmn_id_nid.h" +#include "security_capability.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_sec_negotiate_rsp_data_s OpenAPI_sec_negotiate_rsp_data_t; +typedef struct OpenAPI_sec_negotiate_rsp_data_s { + char *sender; + OpenAPI_security_capability_e selected_sec_capability; + bool is__3_gpp_sbi_target_api_root_supported; + int _3_gpp_sbi_target_api_root_supported; + OpenAPI_list_t *plmn_id_list; + OpenAPI_list_t *snpn_id_list; + OpenAPI_list_t *allowed_usage_purpose; + OpenAPI_list_t *rejected_usage_purpose; + char *supported_features; +} OpenAPI_sec_negotiate_rsp_data_t; + +OpenAPI_sec_negotiate_rsp_data_t *OpenAPI_sec_negotiate_rsp_data_create( + char *sender, + OpenAPI_security_capability_e selected_sec_capability, + bool is__3_gpp_sbi_target_api_root_supported, + int _3_gpp_sbi_target_api_root_supported, + OpenAPI_list_t *plmn_id_list, + OpenAPI_list_t *snpn_id_list, + OpenAPI_list_t *allowed_usage_purpose, + OpenAPI_list_t *rejected_usage_purpose, + char *supported_features +); +void OpenAPI_sec_negotiate_rsp_data_free(OpenAPI_sec_negotiate_rsp_data_t *sec_negotiate_rsp_data); +OpenAPI_sec_negotiate_rsp_data_t *OpenAPI_sec_negotiate_rsp_data_parseFromJSON(cJSON *sec_negotiate_rsp_dataJSON); +cJSON *OpenAPI_sec_negotiate_rsp_data_convertToJSON(OpenAPI_sec_negotiate_rsp_data_t *sec_negotiate_rsp_data); +OpenAPI_sec_negotiate_rsp_data_t *OpenAPI_sec_negotiate_rsp_data_copy(OpenAPI_sec_negotiate_rsp_data_t *dst, OpenAPI_sec_negotiate_rsp_data_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_sec_negotiate_rsp_data_H_ */ + diff --git a/lib/sbi/openapi/model/sec_param_exch_req_data.c b/lib/sbi/openapi/model/sec_param_exch_req_data.c new file mode 100644 index 000000000..8c352d7d5 --- /dev/null +++ b/lib/sbi/openapi/model/sec_param_exch_req_data.c @@ -0,0 +1,336 @@ + +#include +#include +#include +#include "sec_param_exch_req_data.h" + +OpenAPI_sec_param_exch_req_data_t *OpenAPI_sec_param_exch_req_data_create( + char *n32f_context_id, + OpenAPI_list_t *jwe_cipher_suite_list, + OpenAPI_list_t *jws_cipher_suite_list, + OpenAPI_protection_policy_t *protection_policy_info, + OpenAPI_list_t *ipx_provider_sec_info_list, + char *sender +) +{ + OpenAPI_sec_param_exch_req_data_t *sec_param_exch_req_data_local_var = ogs_malloc(sizeof(OpenAPI_sec_param_exch_req_data_t)); + ogs_assert(sec_param_exch_req_data_local_var); + + sec_param_exch_req_data_local_var->n32f_context_id = n32f_context_id; + sec_param_exch_req_data_local_var->jwe_cipher_suite_list = jwe_cipher_suite_list; + sec_param_exch_req_data_local_var->jws_cipher_suite_list = jws_cipher_suite_list; + sec_param_exch_req_data_local_var->protection_policy_info = protection_policy_info; + sec_param_exch_req_data_local_var->ipx_provider_sec_info_list = ipx_provider_sec_info_list; + sec_param_exch_req_data_local_var->sender = sender; + + return sec_param_exch_req_data_local_var; +} + +void OpenAPI_sec_param_exch_req_data_free(OpenAPI_sec_param_exch_req_data_t *sec_param_exch_req_data) +{ + OpenAPI_lnode_t *node = NULL; + + if (NULL == sec_param_exch_req_data) { + return; + } + if (sec_param_exch_req_data->n32f_context_id) { + ogs_free(sec_param_exch_req_data->n32f_context_id); + sec_param_exch_req_data->n32f_context_id = NULL; + } + if (sec_param_exch_req_data->jwe_cipher_suite_list) { + OpenAPI_list_for_each(sec_param_exch_req_data->jwe_cipher_suite_list, node) { + ogs_free(node->data); + } + OpenAPI_list_free(sec_param_exch_req_data->jwe_cipher_suite_list); + sec_param_exch_req_data->jwe_cipher_suite_list = NULL; + } + if (sec_param_exch_req_data->jws_cipher_suite_list) { + OpenAPI_list_for_each(sec_param_exch_req_data->jws_cipher_suite_list, node) { + ogs_free(node->data); + } + OpenAPI_list_free(sec_param_exch_req_data->jws_cipher_suite_list); + sec_param_exch_req_data->jws_cipher_suite_list = NULL; + } + if (sec_param_exch_req_data->protection_policy_info) { + OpenAPI_protection_policy_free(sec_param_exch_req_data->protection_policy_info); + sec_param_exch_req_data->protection_policy_info = NULL; + } + if (sec_param_exch_req_data->ipx_provider_sec_info_list) { + OpenAPI_list_for_each(sec_param_exch_req_data->ipx_provider_sec_info_list, node) { + OpenAPI_ipx_provider_sec_info_free(node->data); + } + OpenAPI_list_free(sec_param_exch_req_data->ipx_provider_sec_info_list); + sec_param_exch_req_data->ipx_provider_sec_info_list = NULL; + } + if (sec_param_exch_req_data->sender) { + ogs_free(sec_param_exch_req_data->sender); + sec_param_exch_req_data->sender = NULL; + } + ogs_free(sec_param_exch_req_data); +} + +cJSON *OpenAPI_sec_param_exch_req_data_convertToJSON(OpenAPI_sec_param_exch_req_data_t *sec_param_exch_req_data) +{ + cJSON *item = NULL; + OpenAPI_lnode_t *node = NULL; + + if (sec_param_exch_req_data == NULL) { + ogs_error("OpenAPI_sec_param_exch_req_data_convertToJSON() failed [SecParamExchReqData]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (!sec_param_exch_req_data->n32f_context_id) { + ogs_error("OpenAPI_sec_param_exch_req_data_convertToJSON() failed [n32f_context_id]"); + return NULL; + } + if (cJSON_AddStringToObject(item, "n32fContextId", sec_param_exch_req_data->n32f_context_id) == NULL) { + ogs_error("OpenAPI_sec_param_exch_req_data_convertToJSON() failed [n32f_context_id]"); + goto end; + } + + if (sec_param_exch_req_data->jwe_cipher_suite_list) { + cJSON *jwe_cipher_suite_listList = cJSON_AddArrayToObject(item, "jweCipherSuiteList"); + if (jwe_cipher_suite_listList == NULL) { + ogs_error("OpenAPI_sec_param_exch_req_data_convertToJSON() failed [jwe_cipher_suite_list]"); + goto end; + } + OpenAPI_list_for_each(sec_param_exch_req_data->jwe_cipher_suite_list, node) { + if (cJSON_AddStringToObject(jwe_cipher_suite_listList, "", (char*)node->data) == NULL) { + ogs_error("OpenAPI_sec_param_exch_req_data_convertToJSON() failed [jwe_cipher_suite_list]"); + goto end; + } + } + } + + if (sec_param_exch_req_data->jws_cipher_suite_list) { + cJSON *jws_cipher_suite_listList = cJSON_AddArrayToObject(item, "jwsCipherSuiteList"); + if (jws_cipher_suite_listList == NULL) { + ogs_error("OpenAPI_sec_param_exch_req_data_convertToJSON() failed [jws_cipher_suite_list]"); + goto end; + } + OpenAPI_list_for_each(sec_param_exch_req_data->jws_cipher_suite_list, node) { + if (cJSON_AddStringToObject(jws_cipher_suite_listList, "", (char*)node->data) == NULL) { + ogs_error("OpenAPI_sec_param_exch_req_data_convertToJSON() failed [jws_cipher_suite_list]"); + goto end; + } + } + } + + if (sec_param_exch_req_data->protection_policy_info) { + cJSON *protection_policy_info_local_JSON = OpenAPI_protection_policy_convertToJSON(sec_param_exch_req_data->protection_policy_info); + if (protection_policy_info_local_JSON == NULL) { + ogs_error("OpenAPI_sec_param_exch_req_data_convertToJSON() failed [protection_policy_info]"); + goto end; + } + cJSON_AddItemToObject(item, "protectionPolicyInfo", protection_policy_info_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_sec_param_exch_req_data_convertToJSON() failed [protection_policy_info]"); + goto end; + } + } + + if (sec_param_exch_req_data->ipx_provider_sec_info_list) { + cJSON *ipx_provider_sec_info_listList = cJSON_AddArrayToObject(item, "ipxProviderSecInfoList"); + if (ipx_provider_sec_info_listList == NULL) { + ogs_error("OpenAPI_sec_param_exch_req_data_convertToJSON() failed [ipx_provider_sec_info_list]"); + goto end; + } + OpenAPI_list_for_each(sec_param_exch_req_data->ipx_provider_sec_info_list, node) { + cJSON *itemLocal = OpenAPI_ipx_provider_sec_info_convertToJSON(node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_sec_param_exch_req_data_convertToJSON() failed [ipx_provider_sec_info_list]"); + goto end; + } + cJSON_AddItemToArray(ipx_provider_sec_info_listList, itemLocal); + } + } + + if (sec_param_exch_req_data->sender) { + if (cJSON_AddStringToObject(item, "sender", sec_param_exch_req_data->sender) == NULL) { + ogs_error("OpenAPI_sec_param_exch_req_data_convertToJSON() failed [sender]"); + goto end; + } + } + +end: + return item; +} + +OpenAPI_sec_param_exch_req_data_t *OpenAPI_sec_param_exch_req_data_parseFromJSON(cJSON *sec_param_exch_req_dataJSON) +{ + OpenAPI_sec_param_exch_req_data_t *sec_param_exch_req_data_local_var = NULL; + OpenAPI_lnode_t *node = NULL; + cJSON *n32f_context_id = NULL; + cJSON *jwe_cipher_suite_list = NULL; + OpenAPI_list_t *jwe_cipher_suite_listList = NULL; + cJSON *jws_cipher_suite_list = NULL; + OpenAPI_list_t *jws_cipher_suite_listList = NULL; + cJSON *protection_policy_info = NULL; + OpenAPI_protection_policy_t *protection_policy_info_local_nonprim = NULL; + cJSON *ipx_provider_sec_info_list = NULL; + OpenAPI_list_t *ipx_provider_sec_info_listList = NULL; + cJSON *sender = NULL; + n32f_context_id = cJSON_GetObjectItemCaseSensitive(sec_param_exch_req_dataJSON, "n32fContextId"); + if (!n32f_context_id) { + ogs_error("OpenAPI_sec_param_exch_req_data_parseFromJSON() failed [n32f_context_id]"); + goto end; + } + if (!cJSON_IsString(n32f_context_id)) { + ogs_error("OpenAPI_sec_param_exch_req_data_parseFromJSON() failed [n32f_context_id]"); + goto end; + } + + jwe_cipher_suite_list = cJSON_GetObjectItemCaseSensitive(sec_param_exch_req_dataJSON, "jweCipherSuiteList"); + if (jwe_cipher_suite_list) { + cJSON *jwe_cipher_suite_list_local = NULL; + if (!cJSON_IsArray(jwe_cipher_suite_list)) { + ogs_error("OpenAPI_sec_param_exch_req_data_parseFromJSON() failed [jwe_cipher_suite_list]"); + goto end; + } + + jwe_cipher_suite_listList = OpenAPI_list_create(); + + cJSON_ArrayForEach(jwe_cipher_suite_list_local, jwe_cipher_suite_list) { + double *localDouble = NULL; + int *localInt = NULL; + if (!cJSON_IsString(jwe_cipher_suite_list_local)) { + ogs_error("OpenAPI_sec_param_exch_req_data_parseFromJSON() failed [jwe_cipher_suite_list]"); + goto end; + } + OpenAPI_list_add(jwe_cipher_suite_listList, ogs_strdup(jwe_cipher_suite_list_local->valuestring)); + } + } + + jws_cipher_suite_list = cJSON_GetObjectItemCaseSensitive(sec_param_exch_req_dataJSON, "jwsCipherSuiteList"); + if (jws_cipher_suite_list) { + cJSON *jws_cipher_suite_list_local = NULL; + if (!cJSON_IsArray(jws_cipher_suite_list)) { + ogs_error("OpenAPI_sec_param_exch_req_data_parseFromJSON() failed [jws_cipher_suite_list]"); + goto end; + } + + jws_cipher_suite_listList = OpenAPI_list_create(); + + cJSON_ArrayForEach(jws_cipher_suite_list_local, jws_cipher_suite_list) { + double *localDouble = NULL; + int *localInt = NULL; + if (!cJSON_IsString(jws_cipher_suite_list_local)) { + ogs_error("OpenAPI_sec_param_exch_req_data_parseFromJSON() failed [jws_cipher_suite_list]"); + goto end; + } + OpenAPI_list_add(jws_cipher_suite_listList, ogs_strdup(jws_cipher_suite_list_local->valuestring)); + } + } + + protection_policy_info = cJSON_GetObjectItemCaseSensitive(sec_param_exch_req_dataJSON, "protectionPolicyInfo"); + if (protection_policy_info) { + protection_policy_info_local_nonprim = OpenAPI_protection_policy_parseFromJSON(protection_policy_info); + } + + ipx_provider_sec_info_list = cJSON_GetObjectItemCaseSensitive(sec_param_exch_req_dataJSON, "ipxProviderSecInfoList"); + if (ipx_provider_sec_info_list) { + cJSON *ipx_provider_sec_info_list_local = NULL; + if (!cJSON_IsArray(ipx_provider_sec_info_list)) { + ogs_error("OpenAPI_sec_param_exch_req_data_parseFromJSON() failed [ipx_provider_sec_info_list]"); + goto end; + } + + ipx_provider_sec_info_listList = OpenAPI_list_create(); + + cJSON_ArrayForEach(ipx_provider_sec_info_list_local, ipx_provider_sec_info_list) { + if (!cJSON_IsObject(ipx_provider_sec_info_list_local)) { + ogs_error("OpenAPI_sec_param_exch_req_data_parseFromJSON() failed [ipx_provider_sec_info_list]"); + goto end; + } + OpenAPI_ipx_provider_sec_info_t *ipx_provider_sec_info_listItem = OpenAPI_ipx_provider_sec_info_parseFromJSON(ipx_provider_sec_info_list_local); + if (!ipx_provider_sec_info_listItem) { + ogs_error("No ipx_provider_sec_info_listItem"); + OpenAPI_list_free(ipx_provider_sec_info_listList); + goto end; + } + OpenAPI_list_add(ipx_provider_sec_info_listList, ipx_provider_sec_info_listItem); + } + } + + sender = cJSON_GetObjectItemCaseSensitive(sec_param_exch_req_dataJSON, "sender"); + if (sender) { + if (!cJSON_IsString(sender) && !cJSON_IsNull(sender)) { + ogs_error("OpenAPI_sec_param_exch_req_data_parseFromJSON() failed [sender]"); + goto end; + } + } + + sec_param_exch_req_data_local_var = OpenAPI_sec_param_exch_req_data_create ( + ogs_strdup(n32f_context_id->valuestring), + jwe_cipher_suite_list ? jwe_cipher_suite_listList : NULL, + jws_cipher_suite_list ? jws_cipher_suite_listList : NULL, + protection_policy_info ? protection_policy_info_local_nonprim : NULL, + ipx_provider_sec_info_list ? ipx_provider_sec_info_listList : NULL, + sender && !cJSON_IsNull(sender) ? ogs_strdup(sender->valuestring) : NULL + ); + + return sec_param_exch_req_data_local_var; +end: + if (jwe_cipher_suite_listList) { + OpenAPI_list_for_each(jwe_cipher_suite_listList, node) { + ogs_free(node->data); + } + OpenAPI_list_free(jwe_cipher_suite_listList); + jwe_cipher_suite_listList = NULL; + } + if (jws_cipher_suite_listList) { + OpenAPI_list_for_each(jws_cipher_suite_listList, node) { + ogs_free(node->data); + } + OpenAPI_list_free(jws_cipher_suite_listList); + jws_cipher_suite_listList = NULL; + } + if (protection_policy_info_local_nonprim) { + OpenAPI_protection_policy_free(protection_policy_info_local_nonprim); + protection_policy_info_local_nonprim = NULL; + } + if (ipx_provider_sec_info_listList) { + OpenAPI_list_for_each(ipx_provider_sec_info_listList, node) { + OpenAPI_ipx_provider_sec_info_free(node->data); + } + OpenAPI_list_free(ipx_provider_sec_info_listList); + ipx_provider_sec_info_listList = NULL; + } + return NULL; +} + +OpenAPI_sec_param_exch_req_data_t *OpenAPI_sec_param_exch_req_data_copy(OpenAPI_sec_param_exch_req_data_t *dst, OpenAPI_sec_param_exch_req_data_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_sec_param_exch_req_data_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_sec_param_exch_req_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_sec_param_exch_req_data_free(dst); + dst = OpenAPI_sec_param_exch_req_data_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/sec_param_exch_req_data.h b/lib/sbi/openapi/model/sec_param_exch_req_data.h new file mode 100644 index 000000000..76bdf1008 --- /dev/null +++ b/lib/sbi/openapi/model/sec_param_exch_req_data.h @@ -0,0 +1,50 @@ +/* + * sec_param_exch_req_data.h + * + * Request data structure for parameter exchange + */ + +#ifndef _OpenAPI_sec_param_exch_req_data_H_ +#define _OpenAPI_sec_param_exch_req_data_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "ipx_provider_sec_info.h" +#include "protection_policy.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_sec_param_exch_req_data_s OpenAPI_sec_param_exch_req_data_t; +typedef struct OpenAPI_sec_param_exch_req_data_s { + char *n32f_context_id; + OpenAPI_list_t *jwe_cipher_suite_list; + OpenAPI_list_t *jws_cipher_suite_list; + struct OpenAPI_protection_policy_s *protection_policy_info; + OpenAPI_list_t *ipx_provider_sec_info_list; + char *sender; +} OpenAPI_sec_param_exch_req_data_t; + +OpenAPI_sec_param_exch_req_data_t *OpenAPI_sec_param_exch_req_data_create( + char *n32f_context_id, + OpenAPI_list_t *jwe_cipher_suite_list, + OpenAPI_list_t *jws_cipher_suite_list, + OpenAPI_protection_policy_t *protection_policy_info, + OpenAPI_list_t *ipx_provider_sec_info_list, + char *sender +); +void OpenAPI_sec_param_exch_req_data_free(OpenAPI_sec_param_exch_req_data_t *sec_param_exch_req_data); +OpenAPI_sec_param_exch_req_data_t *OpenAPI_sec_param_exch_req_data_parseFromJSON(cJSON *sec_param_exch_req_dataJSON); +cJSON *OpenAPI_sec_param_exch_req_data_convertToJSON(OpenAPI_sec_param_exch_req_data_t *sec_param_exch_req_data); +OpenAPI_sec_param_exch_req_data_t *OpenAPI_sec_param_exch_req_data_copy(OpenAPI_sec_param_exch_req_data_t *dst, OpenAPI_sec_param_exch_req_data_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_sec_param_exch_req_data_H_ */ + diff --git a/lib/sbi/openapi/model/sec_param_exch_rsp_data.c b/lib/sbi/openapi/model/sec_param_exch_rsp_data.c new file mode 100644 index 000000000..6c7d9bca7 --- /dev/null +++ b/lib/sbi/openapi/model/sec_param_exch_rsp_data.c @@ -0,0 +1,274 @@ + +#include +#include +#include +#include "sec_param_exch_rsp_data.h" + +OpenAPI_sec_param_exch_rsp_data_t *OpenAPI_sec_param_exch_rsp_data_create( + char *n32f_context_id, + char *selected_jwe_cipher_suite, + char *selected_jws_cipher_suite, + OpenAPI_protection_policy_t *sel_protection_policy_info, + OpenAPI_list_t *ipx_provider_sec_info_list, + char *sender +) +{ + OpenAPI_sec_param_exch_rsp_data_t *sec_param_exch_rsp_data_local_var = ogs_malloc(sizeof(OpenAPI_sec_param_exch_rsp_data_t)); + ogs_assert(sec_param_exch_rsp_data_local_var); + + sec_param_exch_rsp_data_local_var->n32f_context_id = n32f_context_id; + sec_param_exch_rsp_data_local_var->selected_jwe_cipher_suite = selected_jwe_cipher_suite; + sec_param_exch_rsp_data_local_var->selected_jws_cipher_suite = selected_jws_cipher_suite; + sec_param_exch_rsp_data_local_var->sel_protection_policy_info = sel_protection_policy_info; + sec_param_exch_rsp_data_local_var->ipx_provider_sec_info_list = ipx_provider_sec_info_list; + sec_param_exch_rsp_data_local_var->sender = sender; + + return sec_param_exch_rsp_data_local_var; +} + +void OpenAPI_sec_param_exch_rsp_data_free(OpenAPI_sec_param_exch_rsp_data_t *sec_param_exch_rsp_data) +{ + OpenAPI_lnode_t *node = NULL; + + if (NULL == sec_param_exch_rsp_data) { + return; + } + if (sec_param_exch_rsp_data->n32f_context_id) { + ogs_free(sec_param_exch_rsp_data->n32f_context_id); + sec_param_exch_rsp_data->n32f_context_id = NULL; + } + if (sec_param_exch_rsp_data->selected_jwe_cipher_suite) { + ogs_free(sec_param_exch_rsp_data->selected_jwe_cipher_suite); + sec_param_exch_rsp_data->selected_jwe_cipher_suite = NULL; + } + if (sec_param_exch_rsp_data->selected_jws_cipher_suite) { + ogs_free(sec_param_exch_rsp_data->selected_jws_cipher_suite); + sec_param_exch_rsp_data->selected_jws_cipher_suite = NULL; + } + if (sec_param_exch_rsp_data->sel_protection_policy_info) { + OpenAPI_protection_policy_free(sec_param_exch_rsp_data->sel_protection_policy_info); + sec_param_exch_rsp_data->sel_protection_policy_info = NULL; + } + if (sec_param_exch_rsp_data->ipx_provider_sec_info_list) { + OpenAPI_list_for_each(sec_param_exch_rsp_data->ipx_provider_sec_info_list, node) { + OpenAPI_ipx_provider_sec_info_free(node->data); + } + OpenAPI_list_free(sec_param_exch_rsp_data->ipx_provider_sec_info_list); + sec_param_exch_rsp_data->ipx_provider_sec_info_list = NULL; + } + if (sec_param_exch_rsp_data->sender) { + ogs_free(sec_param_exch_rsp_data->sender); + sec_param_exch_rsp_data->sender = NULL; + } + ogs_free(sec_param_exch_rsp_data); +} + +cJSON *OpenAPI_sec_param_exch_rsp_data_convertToJSON(OpenAPI_sec_param_exch_rsp_data_t *sec_param_exch_rsp_data) +{ + cJSON *item = NULL; + OpenAPI_lnode_t *node = NULL; + + if (sec_param_exch_rsp_data == NULL) { + ogs_error("OpenAPI_sec_param_exch_rsp_data_convertToJSON() failed [SecParamExchRspData]"); + return NULL; + } + + item = cJSON_CreateObject(); + if (!sec_param_exch_rsp_data->n32f_context_id) { + ogs_error("OpenAPI_sec_param_exch_rsp_data_convertToJSON() failed [n32f_context_id]"); + return NULL; + } + if (cJSON_AddStringToObject(item, "n32fContextId", sec_param_exch_rsp_data->n32f_context_id) == NULL) { + ogs_error("OpenAPI_sec_param_exch_rsp_data_convertToJSON() failed [n32f_context_id]"); + goto end; + } + + if (sec_param_exch_rsp_data->selected_jwe_cipher_suite) { + if (cJSON_AddStringToObject(item, "selectedJweCipherSuite", sec_param_exch_rsp_data->selected_jwe_cipher_suite) == NULL) { + ogs_error("OpenAPI_sec_param_exch_rsp_data_convertToJSON() failed [selected_jwe_cipher_suite]"); + goto end; + } + } + + if (sec_param_exch_rsp_data->selected_jws_cipher_suite) { + if (cJSON_AddStringToObject(item, "selectedJwsCipherSuite", sec_param_exch_rsp_data->selected_jws_cipher_suite) == NULL) { + ogs_error("OpenAPI_sec_param_exch_rsp_data_convertToJSON() failed [selected_jws_cipher_suite]"); + goto end; + } + } + + if (sec_param_exch_rsp_data->sel_protection_policy_info) { + cJSON *sel_protection_policy_info_local_JSON = OpenAPI_protection_policy_convertToJSON(sec_param_exch_rsp_data->sel_protection_policy_info); + if (sel_protection_policy_info_local_JSON == NULL) { + ogs_error("OpenAPI_sec_param_exch_rsp_data_convertToJSON() failed [sel_protection_policy_info]"); + goto end; + } + cJSON_AddItemToObject(item, "selProtectionPolicyInfo", sel_protection_policy_info_local_JSON); + if (item->child == NULL) { + ogs_error("OpenAPI_sec_param_exch_rsp_data_convertToJSON() failed [sel_protection_policy_info]"); + goto end; + } + } + + if (sec_param_exch_rsp_data->ipx_provider_sec_info_list) { + cJSON *ipx_provider_sec_info_listList = cJSON_AddArrayToObject(item, "ipxProviderSecInfoList"); + if (ipx_provider_sec_info_listList == NULL) { + ogs_error("OpenAPI_sec_param_exch_rsp_data_convertToJSON() failed [ipx_provider_sec_info_list]"); + goto end; + } + OpenAPI_list_for_each(sec_param_exch_rsp_data->ipx_provider_sec_info_list, node) { + cJSON *itemLocal = OpenAPI_ipx_provider_sec_info_convertToJSON(node->data); + if (itemLocal == NULL) { + ogs_error("OpenAPI_sec_param_exch_rsp_data_convertToJSON() failed [ipx_provider_sec_info_list]"); + goto end; + } + cJSON_AddItemToArray(ipx_provider_sec_info_listList, itemLocal); + } + } + + if (sec_param_exch_rsp_data->sender) { + if (cJSON_AddStringToObject(item, "sender", sec_param_exch_rsp_data->sender) == NULL) { + ogs_error("OpenAPI_sec_param_exch_rsp_data_convertToJSON() failed [sender]"); + goto end; + } + } + +end: + return item; +} + +OpenAPI_sec_param_exch_rsp_data_t *OpenAPI_sec_param_exch_rsp_data_parseFromJSON(cJSON *sec_param_exch_rsp_dataJSON) +{ + OpenAPI_sec_param_exch_rsp_data_t *sec_param_exch_rsp_data_local_var = NULL; + OpenAPI_lnode_t *node = NULL; + cJSON *n32f_context_id = NULL; + cJSON *selected_jwe_cipher_suite = NULL; + cJSON *selected_jws_cipher_suite = NULL; + cJSON *sel_protection_policy_info = NULL; + OpenAPI_protection_policy_t *sel_protection_policy_info_local_nonprim = NULL; + cJSON *ipx_provider_sec_info_list = NULL; + OpenAPI_list_t *ipx_provider_sec_info_listList = NULL; + cJSON *sender = NULL; + n32f_context_id = cJSON_GetObjectItemCaseSensitive(sec_param_exch_rsp_dataJSON, "n32fContextId"); + if (!n32f_context_id) { + ogs_error("OpenAPI_sec_param_exch_rsp_data_parseFromJSON() failed [n32f_context_id]"); + goto end; + } + if (!cJSON_IsString(n32f_context_id)) { + ogs_error("OpenAPI_sec_param_exch_rsp_data_parseFromJSON() failed [n32f_context_id]"); + goto end; + } + + selected_jwe_cipher_suite = cJSON_GetObjectItemCaseSensitive(sec_param_exch_rsp_dataJSON, "selectedJweCipherSuite"); + if (selected_jwe_cipher_suite) { + if (!cJSON_IsString(selected_jwe_cipher_suite) && !cJSON_IsNull(selected_jwe_cipher_suite)) { + ogs_error("OpenAPI_sec_param_exch_rsp_data_parseFromJSON() failed [selected_jwe_cipher_suite]"); + goto end; + } + } + + selected_jws_cipher_suite = cJSON_GetObjectItemCaseSensitive(sec_param_exch_rsp_dataJSON, "selectedJwsCipherSuite"); + if (selected_jws_cipher_suite) { + if (!cJSON_IsString(selected_jws_cipher_suite) && !cJSON_IsNull(selected_jws_cipher_suite)) { + ogs_error("OpenAPI_sec_param_exch_rsp_data_parseFromJSON() failed [selected_jws_cipher_suite]"); + goto end; + } + } + + sel_protection_policy_info = cJSON_GetObjectItemCaseSensitive(sec_param_exch_rsp_dataJSON, "selProtectionPolicyInfo"); + if (sel_protection_policy_info) { + sel_protection_policy_info_local_nonprim = OpenAPI_protection_policy_parseFromJSON(sel_protection_policy_info); + } + + ipx_provider_sec_info_list = cJSON_GetObjectItemCaseSensitive(sec_param_exch_rsp_dataJSON, "ipxProviderSecInfoList"); + if (ipx_provider_sec_info_list) { + cJSON *ipx_provider_sec_info_list_local = NULL; + if (!cJSON_IsArray(ipx_provider_sec_info_list)) { + ogs_error("OpenAPI_sec_param_exch_rsp_data_parseFromJSON() failed [ipx_provider_sec_info_list]"); + goto end; + } + + ipx_provider_sec_info_listList = OpenAPI_list_create(); + + cJSON_ArrayForEach(ipx_provider_sec_info_list_local, ipx_provider_sec_info_list) { + if (!cJSON_IsObject(ipx_provider_sec_info_list_local)) { + ogs_error("OpenAPI_sec_param_exch_rsp_data_parseFromJSON() failed [ipx_provider_sec_info_list]"); + goto end; + } + OpenAPI_ipx_provider_sec_info_t *ipx_provider_sec_info_listItem = OpenAPI_ipx_provider_sec_info_parseFromJSON(ipx_provider_sec_info_list_local); + if (!ipx_provider_sec_info_listItem) { + ogs_error("No ipx_provider_sec_info_listItem"); + OpenAPI_list_free(ipx_provider_sec_info_listList); + goto end; + } + OpenAPI_list_add(ipx_provider_sec_info_listList, ipx_provider_sec_info_listItem); + } + } + + sender = cJSON_GetObjectItemCaseSensitive(sec_param_exch_rsp_dataJSON, "sender"); + if (sender) { + if (!cJSON_IsString(sender) && !cJSON_IsNull(sender)) { + ogs_error("OpenAPI_sec_param_exch_rsp_data_parseFromJSON() failed [sender]"); + goto end; + } + } + + sec_param_exch_rsp_data_local_var = OpenAPI_sec_param_exch_rsp_data_create ( + ogs_strdup(n32f_context_id->valuestring), + selected_jwe_cipher_suite && !cJSON_IsNull(selected_jwe_cipher_suite) ? ogs_strdup(selected_jwe_cipher_suite->valuestring) : NULL, + selected_jws_cipher_suite && !cJSON_IsNull(selected_jws_cipher_suite) ? ogs_strdup(selected_jws_cipher_suite->valuestring) : NULL, + sel_protection_policy_info ? sel_protection_policy_info_local_nonprim : NULL, + ipx_provider_sec_info_list ? ipx_provider_sec_info_listList : NULL, + sender && !cJSON_IsNull(sender) ? ogs_strdup(sender->valuestring) : NULL + ); + + return sec_param_exch_rsp_data_local_var; +end: + if (sel_protection_policy_info_local_nonprim) { + OpenAPI_protection_policy_free(sel_protection_policy_info_local_nonprim); + sel_protection_policy_info_local_nonprim = NULL; + } + if (ipx_provider_sec_info_listList) { + OpenAPI_list_for_each(ipx_provider_sec_info_listList, node) { + OpenAPI_ipx_provider_sec_info_free(node->data); + } + OpenAPI_list_free(ipx_provider_sec_info_listList); + ipx_provider_sec_info_listList = NULL; + } + return NULL; +} + +OpenAPI_sec_param_exch_rsp_data_t *OpenAPI_sec_param_exch_rsp_data_copy(OpenAPI_sec_param_exch_rsp_data_t *dst, OpenAPI_sec_param_exch_rsp_data_t *src) +{ + cJSON *item = NULL; + char *content = NULL; + + ogs_assert(src); + item = OpenAPI_sec_param_exch_rsp_data_convertToJSON(src); + if (!item) { + ogs_error("OpenAPI_sec_param_exch_rsp_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_sec_param_exch_rsp_data_free(dst); + dst = OpenAPI_sec_param_exch_rsp_data_parseFromJSON(item); + cJSON_Delete(item); + + return dst; +} + diff --git a/lib/sbi/openapi/model/sec_param_exch_rsp_data.h b/lib/sbi/openapi/model/sec_param_exch_rsp_data.h new file mode 100644 index 000000000..c64b145c5 --- /dev/null +++ b/lib/sbi/openapi/model/sec_param_exch_rsp_data.h @@ -0,0 +1,50 @@ +/* + * sec_param_exch_rsp_data.h + * + * Response data structure for parameter exchange + */ + +#ifndef _OpenAPI_sec_param_exch_rsp_data_H_ +#define _OpenAPI_sec_param_exch_rsp_data_H_ + +#include +#include "../external/cJSON.h" +#include "../include/list.h" +#include "../include/keyValuePair.h" +#include "../include/binary.h" +#include "ipx_provider_sec_info.h" +#include "protection_policy.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct OpenAPI_sec_param_exch_rsp_data_s OpenAPI_sec_param_exch_rsp_data_t; +typedef struct OpenAPI_sec_param_exch_rsp_data_s { + char *n32f_context_id; + char *selected_jwe_cipher_suite; + char *selected_jws_cipher_suite; + struct OpenAPI_protection_policy_s *sel_protection_policy_info; + OpenAPI_list_t *ipx_provider_sec_info_list; + char *sender; +} OpenAPI_sec_param_exch_rsp_data_t; + +OpenAPI_sec_param_exch_rsp_data_t *OpenAPI_sec_param_exch_rsp_data_create( + char *n32f_context_id, + char *selected_jwe_cipher_suite, + char *selected_jws_cipher_suite, + OpenAPI_protection_policy_t *sel_protection_policy_info, + OpenAPI_list_t *ipx_provider_sec_info_list, + char *sender +); +void OpenAPI_sec_param_exch_rsp_data_free(OpenAPI_sec_param_exch_rsp_data_t *sec_param_exch_rsp_data); +OpenAPI_sec_param_exch_rsp_data_t *OpenAPI_sec_param_exch_rsp_data_parseFromJSON(cJSON *sec_param_exch_rsp_dataJSON); +cJSON *OpenAPI_sec_param_exch_rsp_data_convertToJSON(OpenAPI_sec_param_exch_rsp_data_t *sec_param_exch_rsp_data); +OpenAPI_sec_param_exch_rsp_data_t *OpenAPI_sec_param_exch_rsp_data_copy(OpenAPI_sec_param_exch_rsp_data_t *dst, OpenAPI_sec_param_exch_rsp_data_t *src); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_sec_param_exch_rsp_data_H_ */ + diff --git a/lib/sbi/openapi/model/security_capability.c b/lib/sbi/openapi/model/security_capability.c new file mode 100644 index 000000000..2320ad53e --- /dev/null +++ b/lib/sbi/openapi/model/security_capability.c @@ -0,0 +1,30 @@ + +#include +#include +#include +#include "security_capability.h" + +char* OpenAPI_security_capability_ToString(OpenAPI_security_capability_e security_capability) +{ + const char *security_capabilityArray[] = { "NULL", "TLS", "PRINS", "NONE" }; + size_t sizeofArray = sizeof(security_capabilityArray) / sizeof(security_capabilityArray[0]); + if (security_capability < sizeofArray) + return (char *)security_capabilityArray[security_capability]; + else + return (char *)"Unknown"; +} + +OpenAPI_security_capability_e OpenAPI_security_capability_FromString(char* security_capability) +{ + int stringToReturn = 0; + const char *security_capabilityArray[] = { "NULL", "TLS", "PRINS", "NONE" }; + size_t sizeofArray = sizeof(security_capabilityArray) / sizeof(security_capabilityArray[0]); + while (stringToReturn < sizeofArray) { + if (strcmp(security_capability, security_capabilityArray[stringToReturn]) == 0) { + return stringToReturn; + } + stringToReturn++; + } + return 0; +} + diff --git a/lib/sbi/openapi/model/security_capability.h b/lib/sbi/openapi/model/security_capability.h new file mode 100644 index 000000000..b13e779ac --- /dev/null +++ b/lib/sbi/openapi/model/security_capability.h @@ -0,0 +1,31 @@ +/* + * security_capability.h + * + * + */ + +#ifndef _OpenAPI_security_capability_H_ +#define _OpenAPI_security_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_security_capability_NULL = 0, OpenAPI_security_capability_TLS, OpenAPI_security_capability_PRINS, OpenAPI_security_capability_NONE } OpenAPI_security_capability_e; + +char* OpenAPI_security_capability_ToString(OpenAPI_security_capability_e security_capability); + +OpenAPI_security_capability_e OpenAPI_security_capability_FromString(char* security_capability); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_security_capability_H_ */ + diff --git a/lib/sbi/openapi/model/security_capability_any_of.c b/lib/sbi/openapi/model/security_capability_any_of.c new file mode 100644 index 000000000..a7b6befa2 --- /dev/null +++ b/lib/sbi/openapi/model/security_capability_any_of.c @@ -0,0 +1,30 @@ + +#include +#include +#include +#include "security_capability_any_of.h" + +char* OpenAPI_security_capability_any_of_ToString(OpenAPI_security_capability_any_of_e security_capability_any_of) +{ + const char *security_capability_any_ofArray[] = { "NULL", "TLS", "PRINS", "NONE" }; + size_t sizeofArray = sizeof(security_capability_any_ofArray) / sizeof(security_capability_any_ofArray[0]); + if (security_capability_any_of < sizeofArray) + return (char *)security_capability_any_ofArray[security_capability_any_of]; + else + return (char *)"Unknown"; +} + +OpenAPI_security_capability_any_of_e OpenAPI_security_capability_any_of_FromString(char* security_capability_any_of) +{ + int stringToReturn = 0; + const char *security_capability_any_ofArray[] = { "NULL", "TLS", "PRINS", "NONE" }; + size_t sizeofArray = sizeof(security_capability_any_ofArray) / sizeof(security_capability_any_ofArray[0]); + while (stringToReturn < sizeofArray) { + if (strcmp(security_capability_any_of, security_capability_any_ofArray[stringToReturn]) == 0) { + return stringToReturn; + } + stringToReturn++; + } + return 0; +} + diff --git a/lib/sbi/openapi/model/security_capability_any_of.h b/lib/sbi/openapi/model/security_capability_any_of.h new file mode 100644 index 000000000..d4b84a579 --- /dev/null +++ b/lib/sbi/openapi/model/security_capability_any_of.h @@ -0,0 +1,31 @@ +/* + * security_capability_any_of.h + * + * + */ + +#ifndef _OpenAPI_security_capability_any_of_H_ +#define _OpenAPI_security_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_security_capability_any_of_NULL = 0, OpenAPI_security_capability_any_of_TLS, OpenAPI_security_capability_any_of_PRINS, OpenAPI_security_capability_any_of_NONE } OpenAPI_security_capability_any_of_e; + +char* OpenAPI_security_capability_any_of_ToString(OpenAPI_security_capability_any_of_e security_capability_any_of); + +OpenAPI_security_capability_any_of_e OpenAPI_security_capability_any_of_FromString(char* security_capability_any_of); + +#ifdef __cplusplus +} +#endif + +#endif /* _OpenAPI_security_capability_any_of_H_ */ + diff --git a/lib/sbi/support/r17-20230301-openapitools-6.4.0/generator.sh b/lib/sbi/support/r17-20230301-openapitools-6.4.0/generator.sh index d8ad9fa21..50bedeff2 100755 --- a/lib/sbi/support/r17-20230301-openapitools-6.4.0/generator.sh +++ b/lib/sbi/support/r17-20230301-openapitools-6.4.0/generator.sh @@ -6,6 +6,7 @@ openapi_generator_cli="openapi-generator-cli" +$openapi_generator_cli generate -i ./modified/TS29573_N32_Handshake.yaml -c ./openapi-generator/config.yaml -g c -o ../../openapi || exit 1 $openapi_generator_cli generate -i ./modified/TS29504_Nudr_DR.yaml -c ./openapi-generator/config.yaml -g c -o ../../openapi || exit 1 $openapi_generator_cli generate -i ./modified/TS29521_Nbsf_Management.yaml -c ./openapi-generator/config.yaml -g c -o ../../openapi || exit 1 $openapi_generator_cli generate -i ./modified/TS29531_Nnssf_NSSelection.yaml -c ./openapi-generator/config.yaml -g c -o ../../openapi || exit 1 diff --git a/lib/sbi/support/r17-20230301-openapitools-6.4.0/modified/TS29573_N32_Handshake.yaml b/lib/sbi/support/r17-20230301-openapitools-6.4.0/modified/TS29573_N32_Handshake.yaml index 73bb7f469..3629eac09 100644 --- a/lib/sbi/support/r17-20230301-openapitools-6.4.0/modified/TS29573_N32_Handshake.yaml +++ b/lib/sbi/support/r17-20230301-openapitools-6.4.0/modified/TS29573_N32_Handshake.yaml @@ -165,23 +165,23 @@ paths: components: schemas: SecurityCapability: - description: Enumeration of security capabilities - anyOf: - - type: string +# description: Enumeration of security capabilities +# anyOf: +# - type: string enum: - TLS - PRINS - NONE - - type: string +# - type: string ApiSignature: description: API URI of the service operation oneOf: - $ref: 'TS29571_CommonData.yaml#/components/schemas/Uri' - $ref: '#/components/schemas/CallbackName' HttpMethod: - description: Enumeration of HTTP methods - anyOf: - - type: string +# description: Enumeration of HTTP methods +# anyOf: +# - type: string enum: - GET - PUT @@ -192,12 +192,12 @@ components: - OPTIONS - CONNECT - TRACE - - type: string +# - type: string IeType: - description: Enumeration of types of IEs (i.e kind of IE) to specify the protection policy - anyOf: - - type: string +# description: Enumeration of types of IEs (i.e kind of IE) to specify the protection policy +# anyOf: +# - type: string enum: - UEID - LOCATION @@ -206,18 +206,18 @@ components: - AUTHORIZATION_TOKEN - OTHER - NONSENSITIVE - - type: string +# - type: string IeLocation: - description: Location of the IE in a HTTP message - anyOf: - - type: string +# description: Location of the IE in a HTTP message +# anyOf: +# - type: string enum: - URI_PARAM - HEADER - BODY - MULTIPART_BINARY - - type: string +# - type: string IeInfo: description: Protection and modification policy for the IE @@ -504,9 +504,9 @@ components: type: string N32fErrorType: - description: Type of error while processing N32-f message - anyOf: - - type: string +# description: Type of error while processing N32-f message +# anyOf: +# - type: string enum: - INTEGRITY_CHECK_FAILED - INTEGRITY_CHECK_ON_MODIFICATIONS_FAILED @@ -517,21 +517,21 @@ components: - INTEGRITY_KEY_EXPIRED - ENCRYPTION_KEY_EXPIRED - POLICY_MISMATCH - - type: string +# - type: string FailureReason: - description: Reason for failure to reconstruct a HTTP/2 message from N32-f message - anyOf: - - type: string +# description: Reason for failure to reconstruct a HTTP/2 message from N32-f message +# anyOf: +# - type: string enum: - INVALID_JSON_POINTER - INVALID_INDEX_TO_ENCRYPTED_BLOCK - INVALID_HTTP_HEADER - - type: string +# - type: string N32Purpose: - description: Usage purpose of establishing N32 connectivity - anyOf: - - type: string +# description: Usage purpose of establishing N32 connectivity +# anyOf: +# - type: string enum: - ROAMING - INTER_PLMN_MOBILITY @@ -543,4 +543,4 @@ components: - SNPN_INTERCONNECT_TEST - DISASTER_ROAMING - DISASTER_ROAMING_TEST - - type: string \ No newline at end of file +# - type: string